[1682] | 1 | !> @file user_read_restart_data.f90 |
---|
[2000] | 2 | !------------------------------------------------------------------------------! |
---|
[1036] | 3 | ! This file is part of PALM. |
---|
| 4 | ! |
---|
[2000] | 5 | ! PALM is free software: you can redistribute it and/or modify it under the |
---|
| 6 | ! terms of the GNU General Public License as published by the Free Software |
---|
| 7 | ! Foundation, either version 3 of the License, or (at your option) any later |
---|
| 8 | ! version. |
---|
[1036] | 9 | ! |
---|
| 10 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 11 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 12 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 13 | ! |
---|
| 14 | ! You should have received a copy of the GNU General Public License along with |
---|
| 15 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 16 | ! |
---|
[1818] | 17 | ! Copyright 1997-2016 Leibniz Universitaet Hannover |
---|
[2000] | 18 | !------------------------------------------------------------------------------! |
---|
[1036] | 19 | ! |
---|
[258] | 20 | ! Current revisions: |
---|
[211] | 21 | ! ----------------- |
---|
[1683] | 22 | ! |
---|
[2001] | 23 | ! |
---|
[1321] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: user_read_restart_data.f90 2001 2016-08-20 18:41:22Z suehring $ |
---|
| 27 | ! |
---|
[2001] | 28 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 29 | ! Forced header and separation lines into 80 columns |
---|
| 30 | ! |
---|
[1683] | 31 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 32 | ! Code annotations made doxygen readable |
---|
| 33 | ! |
---|
[1321] | 34 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 35 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 36 | ! kinds are defined in new module kinds, |
---|
| 37 | ! old module precision_kind is removed, |
---|
| 38 | ! revision history before 2012 removed, |
---|
| 39 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 40 | ! all variable declaration statements |
---|
[211] | 41 | ! |
---|
[1037] | 42 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 43 | ! code put under GPL (PALM 3.9) |
---|
| 44 | ! |
---|
[226] | 45 | ! 220 2008-12-18 07:00:36Z raasch |
---|
| 46 | ! reading mechanism revised (subdomain/total domain size can vary arbitrarily |
---|
| 47 | ! between current and previous run), |
---|
| 48 | ! former file user_interface.f90 split into one file per subroutine |
---|
| 49 | ! |
---|
[211] | 50 | ! Description: |
---|
| 51 | ! ------------ |
---|
[1682] | 52 | !> Reading restart data from file(s) |
---|
| 53 | !> Subdomain index limits on file are given by nxl_on_file, etc. |
---|
| 54 | !> Indices nxlc, etc. indicate the range of gridpoints to be mapped from the |
---|
| 55 | !> subdomain on file (f) to the subdomain of the current PE (c). They have been |
---|
| 56 | !> calculated in routine read_3d_binary. |
---|
[211] | 57 | !------------------------------------------------------------------------------! |
---|
[1682] | 58 | SUBROUTINE user_read_restart_data( i, nxlfa, nxl_on_file, nxrfa, nxr_on_file, & |
---|
| 59 | nynfa, nyn_on_file, nysfa, nys_on_file, & |
---|
| 60 | offset_xa, offset_ya, overlap_count, & |
---|
| 61 | tmp_2d, tmp_3d ) |
---|
| 62 | |
---|
[211] | 63 | |
---|
| 64 | USE control_parameters |
---|
[1320] | 65 | |
---|
[211] | 66 | USE indices |
---|
[1320] | 67 | |
---|
| 68 | USE kinds |
---|
| 69 | |
---|
[211] | 70 | USE pegrid |
---|
[1320] | 71 | |
---|
[211] | 72 | USE user |
---|
| 73 | |
---|
| 74 | IMPLICIT NONE |
---|
| 75 | |
---|
[1682] | 76 | CHARACTER (LEN=20) :: field_char !< |
---|
[211] | 77 | |
---|
[1682] | 78 | INTEGER(iwp) :: i !< |
---|
| 79 | INTEGER(iwp) :: k !< |
---|
| 80 | INTEGER(iwp) :: nxlc !< |
---|
| 81 | INTEGER(iwp) :: nxlf !< |
---|
| 82 | INTEGER(iwp) :: nxl_on_file !< |
---|
| 83 | INTEGER(iwp) :: nxrc !< |
---|
| 84 | INTEGER(iwp) :: nxrf !< |
---|
| 85 | INTEGER(iwp) :: nxr_on_file !< |
---|
| 86 | INTEGER(iwp) :: nync !< |
---|
| 87 | INTEGER(iwp) :: nynf !< |
---|
| 88 | INTEGER(iwp) :: nyn_on_file !< |
---|
| 89 | INTEGER(iwp) :: nysc !< |
---|
| 90 | INTEGER(iwp) :: nysf !< |
---|
| 91 | INTEGER(iwp) :: nys_on_file !< |
---|
| 92 | INTEGER(iwp) :: overlap_count !< |
---|
[211] | 93 | |
---|
[1682] | 94 | INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: nxlfa !< |
---|
| 95 | INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: nxrfa !< |
---|
| 96 | INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: nynfa !< |
---|
| 97 | INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: nysfa !< |
---|
| 98 | INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: offset_xa !< |
---|
| 99 | INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: offset_ya !< |
---|
[216] | 100 | |
---|
[1320] | 101 | REAL(wp), & |
---|
| 102 | DIMENSION(nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) ::& |
---|
[1682] | 103 | tmp_2d !< |
---|
[211] | 104 | |
---|
[1320] | 105 | REAL(wp), & |
---|
| 106 | DIMENSION(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) ::& |
---|
[1682] | 107 | tmp_3d !< |
---|
[211] | 108 | |
---|
| 109 | ! |
---|
| 110 | !-- Here the reading of user-defined restart data follows: |
---|
| 111 | !-- Sample for user-defined output |
---|
| 112 | ! |
---|
| 113 | ! IF ( initializing_actions == 'read_restart_data' ) THEN |
---|
| 114 | ! READ ( 13 ) field_char |
---|
| 115 | ! DO WHILE ( TRIM( field_char ) /= '*** end user ***' ) |
---|
| 116 | ! |
---|
[216] | 117 | ! DO k = 1, overlap_count |
---|
[211] | 118 | ! |
---|
[216] | 119 | ! nxlf = nxlfa(i,k) |
---|
| 120 | ! nxlc = nxlfa(i,k) + offset_xa(i,k) |
---|
| 121 | ! nxrf = nxrfa(i,k) |
---|
| 122 | ! nxrc = nxrfa(i,k) + offset_xa(i,k) |
---|
| 123 | ! nysf = nysfa(i,k) |
---|
| 124 | ! nysc = nysfa(i,k) + offset_ya(i,k) |
---|
| 125 | ! nynf = nynfa(i,k) |
---|
| 126 | ! nync = nynfa(i,k) + offset_ya(i,k) |
---|
| 127 | ! |
---|
| 128 | ! |
---|
| 129 | ! SELECT CASE ( TRIM( field_char ) ) |
---|
| 130 | ! |
---|
| 131 | ! CASE ( 'u2_av' ) |
---|
| 132 | ! IF ( .NOT. ALLOCATED( u2_av ) ) THEN |
---|
[702] | 133 | ! ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[216] | 134 | ! ENDIF |
---|
| 135 | ! IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
[1320] | 136 | ! u2_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
[702] | 137 | ! tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
[211] | 138 | ! |
---|
[216] | 139 | ! CASE DEFAULT |
---|
[1320] | 140 | ! WRITE( message_string, * ) 'unknown variable named "', & |
---|
| 141 | ! TRIM( field_char ), '" found in', & |
---|
[274] | 142 | ! '&data from prior run on PE ', myid |
---|
[583] | 143 | ! CALL message( 'user_read_restart_data', 'UI0012', 1, 2, 0, 6, 0 ) |
---|
[211] | 144 | ! |
---|
[216] | 145 | ! END SELECT |
---|
[211] | 146 | ! |
---|
[216] | 147 | ! ENDDO |
---|
| 148 | ! |
---|
[211] | 149 | ! READ ( 13 ) field_char |
---|
| 150 | ! |
---|
| 151 | ! ENDDO |
---|
| 152 | ! ENDIF |
---|
| 153 | |
---|
| 154 | END SUBROUTINE user_read_restart_data |
---|
| 155 | |
---|