Changeset 3731 for palm/trunk
- Timestamp:
- Feb 11, 2019 1:06:27 PM (6 years ago)
- Location:
- palm/trunk/SOURCE
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/module_interface.f90
r3717 r3731 20 20 ! Current revisions: 21 21 ! ----------------- 22 ! 22 ! Add required restart data for surface output module 23 23 ! 24 24 ! Former revisions: … … 57 57 !> This is the interface between the PALM model core and all its modules. 58 58 !> 59 !> @todo Re-format module to be consistent with coding standard 59 60 !------------------------------------------------------------------------------! 60 61 MODULE module_interface … … 259 260 USE surface_data_output_mod, & 260 261 ONLY: surface_data_output_parin, & 261 surface_data_output_check_parameters 262 surface_data_output_check_parameters, & 263 surface_data_output_init_arrays, & 264 surface_data_output_rrd_local, & 265 surface_data_output_rrd_global, & 266 surface_data_output_wrd_local, & 267 surface_data_output_wrd_global 262 268 263 269 USE synthetic_turbulence_generator_mod, & … … 723 729 IF ( salsa ) CALL salsa_init_arrays 724 730 IF ( urban_surface ) CALL usm_init_arrays 731 IF ( surface_output ) CALL surface_data_output_init_arrays 725 732 IF ( wind_turbine ) CALL wtm_init_arrays 726 733 … … 1079 1086 IF ( .NOT. found ) CALL stg_rrd_global ( found ) ! ToDo: change interface to pass variable 1080 1087 IF ( .NOT. found ) CALL wtm_rrd_global( found ) ! ToDo: change interface to pass variable 1088 IF ( .NOT. found ) CALL surface_data_output_rrd_global( found ) 1081 1089 IF ( .NOT. found ) CALL user_rrd_global( found ) ! ToDo: change interface to pass variable 1082 1090 … … 1100 1108 IF ( syn_turb_gen ) CALL stg_wrd_global 1101 1109 IF ( wind_turbine ) CALL wtm_wrd_global 1110 IF ( surface_output ) CALL surface_data_output_wrd_global 1102 1111 IF ( user_module_enabled ) CALL user_wrd_global 1103 1112 … … 1215 1224 found & 1216 1225 ) ! ToDo: change interface to pass variable 1217 1226 1227 IF ( .NOT. found ) CALL surface_data_output_rrd_local( & 1228 file_index, map_index, & 1229 nxlf, nxlc, nxl_on_file, & 1230 nxrf, nxrc, nxr_on_file, & 1231 nynf, nync, nyn_on_file, & 1232 nysf, nysc, nys_on_file, & 1233 found & 1234 ) ! ToDo: change interface to pass variable 1235 1218 1236 IF ( .NOT. found ) CALL user_rrd_local( & 1219 1237 file_index, map_index, & … … 1246 1264 IF ( salsa ) CALL salsa_wrd_local 1247 1265 IF ( urban_surface ) CALL usm_wrd_local 1266 IF ( surface_output ) CALL surface_data_output_wrd_local 1248 1267 IF ( user_module_enabled ) CALL user_wrd_local 1249 1268 -
palm/trunk/SOURCE/surface_data_output_mod.f90
r3728 r3731 20 20 ! Current revisions: 21 21 ! ------------------ 22 ! 22 ! - Split initialization into initialization of arrays and further initialization 23 ! in order to enable reading of restart data. 24 ! - Consider restarts in surface data averaging. 25 ! - Correct error message numbers 23 26 ! 24 27 ! Former revisions: … … 197 200 END INTERFACE surface_data_output_init 198 201 202 INTERFACE surface_data_output_init_arrays 203 MODULE PROCEDURE surface_data_output_init_arrays 204 END INTERFACE surface_data_output_init_arrays 205 199 206 INTERFACE surface_data_output_last_action 200 207 MODULE PROCEDURE surface_data_output_last_action … … 204 211 MODULE PROCEDURE surface_data_output_parin 205 212 END INTERFACE surface_data_output_parin 213 214 INTERFACE surface_data_output_rrd_global 215 MODULE PROCEDURE surface_data_output_rrd_global 216 END INTERFACE surface_data_output_rrd_global 217 218 INTERFACE surface_data_output_rrd_local 219 MODULE PROCEDURE surface_data_output_rrd_local 220 END INTERFACE surface_data_output_rrd_local 221 222 INTERFACE surface_data_output_wrd_global 223 MODULE PROCEDURE surface_data_output_wrd_global 224 END INTERFACE surface_data_output_wrd_global 225 226 INTERFACE surface_data_output_wrd_local 227 MODULE PROCEDURE surface_data_output_wrd_local 228 END INTERFACE surface_data_output_wrd_local 206 229 207 230 ! … … 209 232 PUBLIC surface_data_output, surface_data_output_averaging, & 210 233 surface_data_output_check_parameters, surface_data_output_init, & 211 surface_data_output_last_action, surface_data_output_parin 234 surface_data_output_init_arrays, surface_data_output_last_action, & 235 surface_data_output_parin, surface_data_output_rrd_global, & 236 surface_data_output_rrd_local, surface_data_output_wrd_local, & 237 surface_data_output_wrd_global 212 238 ! 213 239 !--Public variables … … 217 243 CONTAINS 218 244 245 !------------------------------------------------------------------------------! 246 ! Description: 247 ! ------------ 248 !> This routine counts the number of surfaces on each core and allocates 249 !> arrays. 250 !------------------------------------------------------------------------------! 251 SUBROUTINE surface_data_output_init_arrays 252 253 IMPLICIT NONE 254 255 ! 256 !-- Determine the number of surface elements on subdomain 257 surfaces%ns = surf_def_h(0)%ns + surf_lsm_h%ns + surf_usm_h%ns & !horizontal upward-facing 258 + surf_def_h(1)%ns & !horizontal downard-facing 259 + surf_def_v(0)%ns + surf_lsm_v(0)%ns + surf_usm_v(0)%ns & !northward-facing 260 + surf_def_v(1)%ns + surf_lsm_v(1)%ns + surf_usm_v(1)%ns & !southward-facing 261 + surf_def_v(2)%ns + surf_lsm_v(2)%ns + surf_usm_v(2)%ns & !westward-facing 262 + surf_def_v(3)%ns + surf_lsm_v(3)%ns + surf_usm_v(3)%ns !eastward-facing 263 ! 264 !-- Determine the total number of surfaces in the model domain 265 #if defined( __parallel ) 266 CALL MPI_ALLREDUCE( surfaces%ns, surfaces%ns_total, 1, & 267 MPI_INTEGER, MPI_SUM, comm2d, ierr ) 268 #else 269 surfaces%ns_total = surfaces%ns 270 #endif 271 ! 272 !-- Allocate output variable and set to _FillValue attribute 273 ALLOCATE ( surfaces%var_out(1:surfaces%ns) ) 274 surfaces%var_out = surfaces%fillvalue 275 ! 276 !-- If there is an output of time average output variables, allocate the 277 !-- required array. 278 IF ( dosurf_no(1) > 0 ) THEN 279 ALLOCATE ( surfaces%var_av(1:surfaces%ns,1:dosurf_no(1)) ) 280 surfaces%var_av = 0.0_wp 281 ENDIF 282 283 END SUBROUTINE surface_data_output_init_arrays 284 285 219 286 !------------------------------------------------------------------------------! 220 287 ! Description: … … 252 319 REAL(wp), DIMENSION(:), ALLOCATABLE :: netcdf_data_1d !< dummy array to output 1D data into netcdf file 253 320 254 255 !256 !-- Determine the number of surface elements on subdomain257 surfaces%ns = surf_def_h(0)%ns + surf_lsm_h%ns + surf_usm_h%ns & !horizontal upward-facing258 + surf_def_h(1)%ns & !horizontal downard-facing259 + surf_def_v(0)%ns + surf_lsm_v(0)%ns + surf_usm_v(0)%ns & !northward-facing260 + surf_def_v(1)%ns + surf_lsm_v(1)%ns + surf_usm_v(1)%ns & !southward-facing261 + surf_def_v(2)%ns + surf_lsm_v(2)%ns + surf_usm_v(2)%ns & !westward-facing262 + surf_def_v(3)%ns + surf_lsm_v(3)%ns + surf_usm_v(3)%ns !eastward-facing263 !264 !-- Determine the total number of surfaces in the model domain265 #if defined( __parallel )266 CALL MPI_ALLREDUCE( surfaces%ns, surfaces%ns_total, 1, &267 MPI_INTEGER, MPI_SUM, comm2d, ierr )268 #else269 surfaces%ns_total = surfaces%ns270 #endif271 !272 !-- Allocate output variable and set to _FillValue attribute273 ALLOCATE ( surfaces%var_out(1:surfaces%ns) )274 surfaces%var_out = surfaces%fillvalue275 !276 !-- If there is an output of time average output variables, allocate the277 !-- required array.278 IF ( dosurf_no(1) > 0 ) THEN279 ALLOCATE ( surfaces%var_av(1:surfaces%ns,1:dosurf_no(1)) )280 surfaces%var_av = 0.0_wp281 ENDIF282 321 ! 283 322 !-- If output to VTK format is enabled, initialize point and polygon data. … … 1333 1372 time_since_reference_point, 's because the maximum ', & 1334 1373 'number of output time levels is exceeded.' 1335 CALL message( 'surface_data_output', 'PA0 ???', 0, 1, 0, 6, 0 )1374 CALL message( 'surface_data_output', 'PA0539', 0, 1, 0, 6, 0 ) 1336 1375 1337 1376 RETURN … … 4051 4090 4052 4091 USE control_parameters, & 4053 ONLY: averaging_interval, dt_data_output, message_string 4092 ONLY: averaging_interval, dt_data_output, initializing_actions, & 4093 message_string 4094 4095 USE pegrid, & 4096 ONLY: numprocs_previous_run 4054 4097 4055 4098 IMPLICIT NONE … … 4077 4120 dt_dosurf_av 4078 4121 CALL message( 'surface_data_output_check_parameters', & 4079 'PA0 087', 1, 2, 0, 6, 0 )4122 'PA0536', 1, 2, 0, 6, 0 ) 4080 4123 ENDIF 4081 4124 … … 4089 4132 ENDIF 4090 4133 #endif 4134 ! 4135 !-- In case of restart runs, check it the number of cores has been changed. 4136 !-- With surface output this is not allowed. 4137 IF ( TRIM( initializing_actions ) == 'read_restart_data' .AND. & 4138 numprocs_previous_run /= numprocs ) THEN 4139 message_string = 'The number of cores has been changed between ' // & 4140 'restart runs. This is not allowed when surface ' // & 4141 'data output is used.' 4142 CALL message( 'surface_data_output_check_parameters', & 4143 'PA0585', 1, 2, 0, 6, 0 ) 4144 ENDIF 4091 4145 ! 4092 4146 !-- Count number of output variables and separate output strings for … … 4121 4175 ' is not yet implemented in the surface output' 4122 4176 CALL message( 'surface_data_output_check_parameters', & 4123 'PA0 087', 1, 2, 0, 6, 0 )4177 'PA0537', 1, 2, 0, 6, 0 ) 4124 4178 4125 4179 CASE ( 'us', 'uvw1' ) … … 4173 4227 ' is not part of the surface output' 4174 4228 CALL message( 'surface_data_output_check_parameters', & 4175 'PA0 087', 1, 2, 0, 6, 0 )4229 'PA0538', 1, 2, 0, 6, 0 ) 4176 4230 END SELECT 4177 4231 … … 4223 4277 4224 4278 END SUBROUTINE surface_data_output_last_action 4279 4280 !------------------------------------------------------------------------------! 4281 ! Description: 4282 ! ------------ 4283 !> This routine reads globally used restart data. 4284 !------------------------------------------------------------------------------! 4285 SUBROUTINE surface_data_output_rrd_global( found ) 4286 4287 4288 USE control_parameters, & 4289 ONLY: length, restart_string 4290 4291 IMPLICIT NONE 4292 4293 LOGICAL, INTENT(OUT) :: found !< flag indicating if variable was found 4294 4295 found = .TRUE. 4296 4297 SELECT CASE ( restart_string(1:length) ) 4298 4299 CASE ( 'average_count_surf' ) 4300 READ ( 13 ) average_count_surf 4301 4302 CASE DEFAULT 4303 4304 found = .FALSE. 4305 4306 END SELECT 4307 4308 4309 END SUBROUTINE surface_data_output_rrd_global 4310 4311 !------------------------------------------------------------------------------! 4312 ! Description: 4313 ! ------------ 4314 !> This routine reads the respective restart data. 4315 !------------------------------------------------------------------------------! 4316 SUBROUTINE surface_data_output_rrd_local( i, k, nxlf, nxlc, nxl_on_file, & 4317 nxrf, nxrc, nxr_on_file, nynf, nync, nyn_on_file,& 4318 nysf, nysc, nys_on_file, found ) 4319 4320 4321 USE control_parameters, & 4322 ONLY: length, restart_string 4323 4324 IMPLICIT NONE 4325 4326 INTEGER(iwp) :: l !< index variable for surface type 4327 INTEGER(iwp) :: i !< running index over input files 4328 INTEGER(iwp) :: k !< running index over previous input files covering current local domain 4329 INTEGER(iwp) :: ns_h_on_file_usm !< number of horizontal surface elements (urban type) on file 4330 INTEGER(iwp) :: nxlc !< index of left boundary on current subdomain 4331 INTEGER(iwp) :: nxlf !< index of left boundary on former subdomain 4332 INTEGER(iwp) :: nxl_on_file !< index of left boundary on former local domain 4333 INTEGER(iwp) :: nxrc !< index of right boundary on current subdomain 4334 INTEGER(iwp) :: nxrf !< index of right boundary on former subdomain 4335 INTEGER(iwp) :: nxr_on_file !< index of right boundary on former local domain 4336 INTEGER(iwp) :: nync !< index of north boundary on current subdomain 4337 INTEGER(iwp) :: nynf !< index of north boundary on former subdomain 4338 INTEGER(iwp) :: nyn_on_file !< index of north boundary on former local domain 4339 INTEGER(iwp) :: nysc !< index of south boundary on current subdomain 4340 INTEGER(iwp) :: nysf !< index of south boundary on former subdomain 4341 INTEGER(iwp) :: nys_on_file !< index of south boundary on former local domain 4342 4343 LOGICAL, INTENT(OUT) :: found 4344 ! 4345 !-- Here the reading of user-defined restart data follows: 4346 !-- Sample for user-defined output 4347 found = .TRUE. 4348 4349 SELECT CASE ( restart_string(1:length) ) 4350 4351 CASE ( 'surfaces%var_av' ) 4352 IF ( k == 1 ) READ ( 13 ) surfaces%var_av 4353 4354 CASE DEFAULT 4355 4356 found = .FALSE. 4357 4358 END SELECT 4359 4360 4361 END SUBROUTINE surface_data_output_rrd_local 4362 4363 !------------------------------------------------------------------------------! 4364 ! Description: 4365 ! ------------ 4366 !> This routine writes the respective restart data. 4367 !------------------------------------------------------------------------------! 4368 SUBROUTINE surface_data_output_wrd_global 4369 4370 IMPLICIT NONE 4371 4372 CALL wrd_write_string( 'average_count_surf' ) 4373 WRITE ( 14 ) average_count_surf 4374 4375 END SUBROUTINE surface_data_output_wrd_global 4376 4377 !------------------------------------------------------------------------------! 4378 ! Description: 4379 ! ------------ 4380 !> This routine writes restart data which individual on each PE 4381 !------------------------------------------------------------------------------! 4382 SUBROUTINE surface_data_output_wrd_local 4383 4384 IMPLICIT NONE 4385 4386 IF ( ALLOCATED( surfaces%var_av ) ) THEN 4387 CALL wrd_write_string( 'surfaces%var_av' ) 4388 WRITE ( 14 ) surfaces%var_av 4389 ENDIF 4390 4391 4392 END SUBROUTINE surface_data_output_wrd_local 4225 4393 4226 4394
Note: See TracChangeset
for help on using the changeset viewer.