1 | !> @file user_read_restart_data.f90 |
---|
2 | !------------------------------------------------------------------------------! |
---|
3 | ! This file is part of the PALM model system. |
---|
4 | ! |
---|
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. |
---|
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 | ! |
---|
17 | ! Copyright 1997-2017 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: user_read_restart_data.f90 2696 2017-12-14 17:12:51Z kanani $ |
---|
27 | ! |
---|
28 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
29 | ! Forced header and separation lines into 80 columns |
---|
30 | ! |
---|
31 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
32 | ! Code annotations made doxygen readable |
---|
33 | ! |
---|
34 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
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 |
---|
41 | ! |
---|
42 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
43 | ! code put under GPL (PALM 3.9) |
---|
44 | ! |
---|
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 | ! |
---|
50 | ! Description: |
---|
51 | ! ------------ |
---|
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. |
---|
57 | !------------------------------------------------------------------------------! |
---|
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 | |
---|
63 | |
---|
64 | USE control_parameters |
---|
65 | |
---|
66 | USE indices |
---|
67 | |
---|
68 | USE kinds |
---|
69 | |
---|
70 | USE pegrid |
---|
71 | |
---|
72 | USE user |
---|
73 | |
---|
74 | IMPLICIT NONE |
---|
75 | |
---|
76 | CHARACTER (LEN=20) :: field_char !< |
---|
77 | |
---|
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 !< |
---|
93 | |
---|
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 !< |
---|
100 | |
---|
101 | REAL(wp), & |
---|
102 | DIMENSION(nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) ::& |
---|
103 | tmp_2d !< |
---|
104 | |
---|
105 | REAL(wp), & |
---|
106 | DIMENSION(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) ::& |
---|
107 | tmp_3d !< |
---|
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 | ! |
---|
117 | ! DO k = 1, overlap_count |
---|
118 | ! |
---|
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 |
---|
133 | ! ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
134 | ! ENDIF |
---|
135 | ! IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
136 | ! u2_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
137 | ! tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
138 | ! |
---|
139 | ! CASE DEFAULT |
---|
140 | ! WRITE( message_string, * ) 'unknown variable named "', & |
---|
141 | ! TRIM( field_char ), '" found in', & |
---|
142 | ! '&data from prior run on PE ', myid |
---|
143 | ! CALL message( 'user_read_restart_data', 'UI0012', 1, 2, 0, 6, 0 ) |
---|
144 | ! |
---|
145 | ! END SELECT |
---|
146 | ! |
---|
147 | ! ENDDO |
---|
148 | ! |
---|
149 | ! READ ( 13 ) field_char |
---|
150 | ! |
---|
151 | ! ENDDO |
---|
152 | ! ENDIF |
---|
153 | |
---|
154 | END SUBROUTINE user_read_restart_data |
---|
155 | |
---|