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