[1682] | 1 | !> @file user_read_restart_data.f90 |
---|
[2000] | 2 | !------------------------------------------------------------------------------! |
---|
[2696] | 3 | ! This file is part of the PALM model system. |
---|
[1036] | 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 | ! |
---|
[2718] | 17 | ! Copyright 1997-2018 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 2718 2018-01-02 08:49:38Z thiele $ |
---|
[2716] | 27 | ! Corrected "Former revisions" section |
---|
| 28 | ! |
---|
| 29 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
| 30 | ! Change in file header (GPL part) |
---|
[1321] | 31 | ! |
---|
[2716] | 32 | ! 2101 2017-01-05 16:42:31Z suehring |
---|
| 33 | ! |
---|
[2001] | 34 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 35 | ! Forced header and separation lines into 80 columns |
---|
| 36 | ! |
---|
[1683] | 37 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 38 | ! Code annotations made doxygen readable |
---|
| 39 | ! |
---|
[1321] | 40 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 41 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 42 | ! kinds are defined in new module kinds, |
---|
| 43 | ! old module precision_kind is removed, |
---|
| 44 | ! revision history before 2012 removed, |
---|
| 45 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 46 | ! all variable declaration statements |
---|
[211] | 47 | ! |
---|
[1037] | 48 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 49 | ! code put under GPL (PALM 3.9) |
---|
| 50 | ! |
---|
[226] | 51 | ! 220 2008-12-18 07:00:36Z raasch |
---|
| 52 | ! reading mechanism revised (subdomain/total domain size can vary arbitrarily |
---|
| 53 | ! between current and previous run), |
---|
| 54 | ! former file user_interface.f90 split into one file per subroutine |
---|
| 55 | ! |
---|
[211] | 56 | ! Description: |
---|
| 57 | ! ------------ |
---|
[1682] | 58 | !> Reading restart data from file(s) |
---|
| 59 | !> Subdomain index limits on file are given by nxl_on_file, etc. |
---|
| 60 | !> Indices nxlc, etc. indicate the range of gridpoints to be mapped from the |
---|
| 61 | !> subdomain on file (f) to the subdomain of the current PE (c). They have been |
---|
| 62 | !> calculated in routine read_3d_binary. |
---|
[211] | 63 | !------------------------------------------------------------------------------! |
---|
[1682] | 64 | SUBROUTINE user_read_restart_data( i, nxlfa, nxl_on_file, nxrfa, nxr_on_file, & |
---|
| 65 | nynfa, nyn_on_file, nysfa, nys_on_file, & |
---|
| 66 | offset_xa, offset_ya, overlap_count, & |
---|
| 67 | tmp_2d, tmp_3d ) |
---|
| 68 | |
---|
[211] | 69 | |
---|
| 70 | USE control_parameters |
---|
[1320] | 71 | |
---|
[211] | 72 | USE indices |
---|
[1320] | 73 | |
---|
| 74 | USE kinds |
---|
| 75 | |
---|
[211] | 76 | USE pegrid |
---|
[1320] | 77 | |
---|
[211] | 78 | USE user |
---|
| 79 | |
---|
| 80 | IMPLICIT NONE |
---|
| 81 | |
---|
[1682] | 82 | CHARACTER (LEN=20) :: field_char !< |
---|
[211] | 83 | |
---|
[1682] | 84 | INTEGER(iwp) :: i !< |
---|
| 85 | INTEGER(iwp) :: k !< |
---|
| 86 | INTEGER(iwp) :: nxlc !< |
---|
| 87 | INTEGER(iwp) :: nxlf !< |
---|
| 88 | INTEGER(iwp) :: nxl_on_file !< |
---|
| 89 | INTEGER(iwp) :: nxrc !< |
---|
| 90 | INTEGER(iwp) :: nxrf !< |
---|
| 91 | INTEGER(iwp) :: nxr_on_file !< |
---|
| 92 | INTEGER(iwp) :: nync !< |
---|
| 93 | INTEGER(iwp) :: nynf !< |
---|
| 94 | INTEGER(iwp) :: nyn_on_file !< |
---|
| 95 | INTEGER(iwp) :: nysc !< |
---|
| 96 | INTEGER(iwp) :: nysf !< |
---|
| 97 | INTEGER(iwp) :: nys_on_file !< |
---|
| 98 | INTEGER(iwp) :: overlap_count !< |
---|
[211] | 99 | |
---|
[1682] | 100 | INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: nxlfa !< |
---|
| 101 | INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: nxrfa !< |
---|
| 102 | INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: nynfa !< |
---|
| 103 | INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: nysfa !< |
---|
| 104 | INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: offset_xa !< |
---|
| 105 | INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: offset_ya !< |
---|
[216] | 106 | |
---|
[1320] | 107 | REAL(wp), & |
---|
| 108 | DIMENSION(nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) ::& |
---|
[1682] | 109 | tmp_2d !< |
---|
[211] | 110 | |
---|
[1320] | 111 | REAL(wp), & |
---|
| 112 | DIMENSION(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) ::& |
---|
[1682] | 113 | tmp_3d !< |
---|
[211] | 114 | |
---|
| 115 | ! |
---|
| 116 | !-- Here the reading of user-defined restart data follows: |
---|
| 117 | !-- Sample for user-defined output |
---|
| 118 | ! |
---|
| 119 | ! IF ( initializing_actions == 'read_restart_data' ) THEN |
---|
| 120 | ! READ ( 13 ) field_char |
---|
| 121 | ! DO WHILE ( TRIM( field_char ) /= '*** end user ***' ) |
---|
| 122 | ! |
---|
[216] | 123 | ! DO k = 1, overlap_count |
---|
[211] | 124 | ! |
---|
[216] | 125 | ! nxlf = nxlfa(i,k) |
---|
| 126 | ! nxlc = nxlfa(i,k) + offset_xa(i,k) |
---|
| 127 | ! nxrf = nxrfa(i,k) |
---|
| 128 | ! nxrc = nxrfa(i,k) + offset_xa(i,k) |
---|
| 129 | ! nysf = nysfa(i,k) |
---|
| 130 | ! nysc = nysfa(i,k) + offset_ya(i,k) |
---|
| 131 | ! nynf = nynfa(i,k) |
---|
| 132 | ! nync = nynfa(i,k) + offset_ya(i,k) |
---|
| 133 | ! |
---|
| 134 | ! |
---|
| 135 | ! SELECT CASE ( TRIM( field_char ) ) |
---|
| 136 | ! |
---|
| 137 | ! CASE ( 'u2_av' ) |
---|
| 138 | ! IF ( .NOT. ALLOCATED( u2_av ) ) THEN |
---|
[702] | 139 | ! ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[216] | 140 | ! ENDIF |
---|
| 141 | ! IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
[1320] | 142 | ! u2_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
[702] | 143 | ! tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
[211] | 144 | ! |
---|
[216] | 145 | ! CASE DEFAULT |
---|
[1320] | 146 | ! WRITE( message_string, * ) 'unknown variable named "', & |
---|
| 147 | ! TRIM( field_char ), '" found in', & |
---|
[274] | 148 | ! '&data from prior run on PE ', myid |
---|
[583] | 149 | ! CALL message( 'user_read_restart_data', 'UI0012', 1, 2, 0, 6, 0 ) |
---|
[211] | 150 | ! |
---|
[216] | 151 | ! END SELECT |
---|
[211] | 152 | ! |
---|
[216] | 153 | ! ENDDO |
---|
| 154 | ! |
---|
[211] | 155 | ! READ ( 13 ) field_char |
---|
| 156 | ! |
---|
| 157 | ! ENDDO |
---|
| 158 | ! ENDIF |
---|
| 159 | |
---|
| 160 | END SUBROUTINE user_read_restart_data |
---|
| 161 | |
---|