1 | !> @file user_read_restart_data.f90 |
---|
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 | ! |
---|
16 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
17 | !--------------------------------------------------------------------------------! |
---|
18 | ! |
---|
19 | ! Current revisions: |
---|
20 | ! ----------------- |
---|
21 | ! |
---|
22 | ! |
---|
23 | ! Former revisions: |
---|
24 | ! ----------------- |
---|
25 | ! $Id: user_read_restart_data.f90 1683 2015-10-07 23:57:51Z knoop $ |
---|
26 | ! |
---|
27 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
28 | ! Code annotations made doxygen readable |
---|
29 | ! |
---|
30 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
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 |
---|
37 | ! |
---|
38 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
39 | ! code put under GPL (PALM 3.9) |
---|
40 | ! |
---|
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 | ! |
---|
46 | ! Description: |
---|
47 | ! ------------ |
---|
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. |
---|
53 | !------------------------------------------------------------------------------! |
---|
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 | |
---|
59 | |
---|
60 | USE control_parameters |
---|
61 | |
---|
62 | USE indices |
---|
63 | |
---|
64 | USE kinds |
---|
65 | |
---|
66 | USE pegrid |
---|
67 | |
---|
68 | USE user |
---|
69 | |
---|
70 | IMPLICIT NONE |
---|
71 | |
---|
72 | CHARACTER (LEN=20) :: field_char !< |
---|
73 | |
---|
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 !< |
---|
89 | |
---|
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 !< |
---|
96 | |
---|
97 | REAL(wp), & |
---|
98 | DIMENSION(nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) ::& |
---|
99 | tmp_2d !< |
---|
100 | |
---|
101 | REAL(wp), & |
---|
102 | DIMENSION(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) ::& |
---|
103 | tmp_3d !< |
---|
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 | ! |
---|
113 | ! DO k = 1, overlap_count |
---|
114 | ! |
---|
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 |
---|
129 | ! ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
130 | ! ENDIF |
---|
131 | ! IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
132 | ! u2_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
133 | ! tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
134 | ! |
---|
135 | ! CASE DEFAULT |
---|
136 | ! WRITE( message_string, * ) 'unknown variable named "', & |
---|
137 | ! TRIM( field_char ), '" found in', & |
---|
138 | ! '&data from prior run on PE ', myid |
---|
139 | ! CALL message( 'user_read_restart_data', 'UI0012', 1, 2, 0, 6, 0 ) |
---|
140 | ! |
---|
141 | ! END SELECT |
---|
142 | ! |
---|
143 | ! ENDDO |
---|
144 | ! |
---|
145 | ! READ ( 13 ) field_char |
---|
146 | ! |
---|
147 | ! ENDDO |
---|
148 | ! ENDIF |
---|
149 | |
---|
150 | END SUBROUTINE user_read_restart_data |
---|
151 | |
---|