- Timestamp:
- Mar 27, 2018 3:52:42 PM (7 years ago)
- Location:
- palm/trunk/SOURCE
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/Makefile
r2934 r2938 25 25 # ----------------- 26 26 # $Id$ 27 # No initialization of child domains via dynamic input file, except for soil 28 # moisture and temperature 29 # Apply turbulence generator at non-cyclic lateral boundary in nesting case 30 # 31 # 2936 2018-03-27 14:49:27Z suehring 27 32 # Added dependencies for parent and child synchronization 28 33 # … … 1008 1013 modules.o \ 1009 1014 netcdf_data_input_mod.o \ 1015 pmc_interface_mod.o \ 1010 1016 radiation_model_mod.o \ 1011 1017 surface_mod.o … … 1434 1440 cpulog_mod.o \ 1435 1441 mod_kinds.o \ 1436 modules.o 1442 modules.o \ 1443 pmc_interface_mod.o 1437 1444 temperton_fft_mod.o: \ 1438 1445 mod_kinds.o \ … … 1510 1517 modules.o \ 1511 1518 plant_canopy_model_mod.o \ 1519 pmc_interface_mod.o \ 1512 1520 surface_mod.o \ 1513 1521 user_actions.o -
palm/trunk/SOURCE/boundary_conds.f90
r2766 r2938 25 25 ! ----------------- 26 26 ! $Id$ 27 ! Set boundary condition for TKE and TKE dissipation rate in case of nesting 28 ! and if parent model operates in RANS mode but child model in LES mode. 29 ! mode 30 ! 31 ! 2793 2018-02-07 10:54:33Z suehring 27 32 ! Removed preprocessor directive __chem 28 33 ! … … 193 198 inflow_s, intermediate_timestep_count, & 194 199 microphysics_morrison, microphysics_seifert, nest_domain, & 195 nest_bound_l, nest_bound_ s, nudging, ocean, outflow_l,&196 o utflow_n, outflow_r, outflow_s, passive_scalar, rans_tke_e,&197 tsc, use_cmax200 nest_bound_l, nest_bound_n, nest_bound_r, nest_bound_s, nudging,& 201 ocean, outflow_l, outflow_n, outflow_r, outflow_s, & 202 passive_scalar, rans_mode, rans_tke_e, tsc, use_cmax 198 203 199 204 USE grid_variables, & … … 209 214 210 215 USE pmc_interface, & 211 ONLY : nesting_mode 216 ONLY : nesting_mode, rans_mode_parent 212 217 213 218 USE surface_mod, & … … 321 326 322 327 ! 323 !-- Boundary conditions for TKE 324 !-- Generally Neumann conditions with de/dz=0 are assumed 328 !-- Boundary conditions for TKE. 329 !-- Generally Neumann conditions with de/dz=0 are assumed. 325 330 IF ( .NOT. constant_diffusion ) THEN 326 331 … … 343 348 IF ( .NOT. nest_domain ) THEN 344 349 e_p(nzt+1,:,:) = e_p(nzt,:,:) 345 ENDIF 346 ENDIF 347 348 ! 349 !-- Boundary conditions for TKE dissipation rate 350 ! 351 !-- Nesting case: if parent operates in RANS mode and child in LES mode, 352 !-- no TKE is transfered. This case, set Neumann conditions at lateral and 353 !-- top child boundaries. 354 !-- If not ( both either in RANS or in LES mode ), TKE boundary condition 355 !-- is treated in the nesting. 356 ELSE 357 358 IF ( rans_mode_parent .AND. .NOT. rans_mode ) THEN 359 360 361 362 e_p(nzt+1,:,:) = e_p(nzt,:,:) 363 IF ( nest_bound_l ) e_p(:,:,nxl-1) = e_p(:,:,nxl) 364 IF ( nest_bound_r ) e_p(:,:,nxr+1) = e_p(:,:,nxr) 365 IF ( nest_bound_s ) e_p(:,nys-1,:) = e_p(:,nys,:) 366 IF ( nest_bound_n ) e_p(:,nyn+1,:) = e_p(:,nyn,:) 367 368 ENDIF 369 ENDIF 370 ENDIF 371 372 ! 373 !-- Boundary conditions for TKE dissipation rate. 350 374 IF ( rans_tke_e .AND. .NOT. nest_domain ) THEN 351 375 diss_p(nzt+1,:,:) = diss_p(nzt,:,:) -
palm/trunk/SOURCE/check_parameters.f90
r2934 r2938 25 25 ! ----------------- 26 26 ! $Id$ 27 ! - Revise start and end indices for imposing random disturbances in case of 28 ! nesting or large-scale forcing. 29 ! - Remove check for inifor initialization in case of nested runs. 30 ! - Adapt call to check for synthetic turbulence geneartor settings. 31 ! 32 ! 2936 2018-03-27 14:49:27Z suehring 27 33 ! Check spinup in case of nested runs, spinup time and timestep must be 28 34 ! identical to assure synchronuous simulations. … … 1382 1388 ENDIF 1383 1389 ! 1384 !-- In case of nested run assure that all domains are initialized the same1385 !-- way, i.e. if at least at one domain is initialized with soil and1386 !-- atmospheric data provided by COSMO, all domains must be initialized the1387 !-- same way, to assure that soil and atmospheric quantities are1388 !-- consistent.1389 IF ( nested_run ) THEN1390 check_nest = .TRUE.1391 #if defined( __parallel )1392 CALL MPI_ALLREDUCE( TRIM( initializing_actions ) == 'inifor', &1393 check_nest, 1, MPI_LOGICAL, &1394 MPI_LAND, MPI_COMM_WORLD, ierr )1395 1396 IF ( TRIM( initializing_actions ) == 'inifor' .AND. &1397 .NOT. check_nest ) THEN1398 message_string = 'In case of nesting, if at least in one ' // &1399 'domain initializing_actions = inifor, ' // &1400 'all domains need to be initialized that way.'1401 CALL message( 'netcdf_data_input_mod', 'PA0430', 3, 2, 0, 6, 0 )1402 ENDIF1403 #endif1404 ENDIF1405 !1406 1390 !-- In case of spinup and nested run, spinup end time must be identical 1407 1391 !-- in order to have synchronously running simulations. … … 1436 1420 1437 1421 ! 1438 !-- When synthetic turbulence generator is used, peform addtional checks1439 IF ( syn_turb_gen )CALL stg_check_parameters1422 !-- Check for synthetic turbulence generator settings 1423 CALL stg_check_parameters 1440 1424 ! 1441 1425 !-- When plant canopy model is used, peform addtional checks … … 3898 3882 dist_nxr(1) = MIN( inflow_disturbance_end, nxr ) 3899 3883 ELSEIF ( bc_lr == 'nested' .OR. bc_lr == 'forcing' ) THEN 3900 dist_nxl = MAX( inflow_disturbance_begin, nxl ) 3884 dist_nxl = MAX( inflow_disturbance_begin, nxl ) 3885 dist_nxr = MIN( nx - inflow_disturbance_begin, nxr ) 3901 3886 ENDIF 3902 3887 IF ( bc_ns == 'dirichlet/radiation' ) THEN … … 3907 3892 dist_nyn(1) = MIN( inflow_disturbance_end, nyn ) 3908 3893 ELSEIF ( bc_ns == 'nested' .OR. bc_ns == 'forcing' ) THEN 3909 dist_nys = MAX( inflow_disturbance_begin, nys ) 3894 dist_nys = MAX( inflow_disturbance_begin, nys ) 3895 dist_nyn = MIN( ny - inflow_disturbance_begin, nyn ) 3910 3896 ENDIF 3911 3897 ELSE … … 3918 3904 dist_nxl = inflow_disturbance_begin 3919 3905 dist_nxr(1) = inflow_disturbance_end 3906 ELSEIF ( bc_lr == 'nested' .OR. bc_lr == 'forcing' ) THEN 3907 dist_nxr = nx - inflow_disturbance_begin 3908 dist_nxl = inflow_disturbance_begin 3920 3909 ENDIF 3921 3910 IF ( bc_ns == 'dirichlet/radiation' ) THEN … … 3925 3914 dist_nys = inflow_disturbance_begin 3926 3915 dist_nyn(1) = inflow_disturbance_end 3916 ELSEIF ( bc_ns == 'nested' .OR. bc_ns == 'forcing' ) THEN 3917 dist_nyn = ny - inflow_disturbance_begin 3918 dist_nys = inflow_disturbance_begin 3927 3919 ENDIF 3928 3920 ENDIF -
palm/trunk/SOURCE/init_3d_model.f90
r2934 r2938 25 25 ! ----------------- 26 26 ! $Id$ 27 ! - Revise Inifor initialization for geostrophic wind components 28 ! - Initialize synthetic turbulence generator in case of Inifor initialization 29 ! 30 ! 2936 2018-03-27 14:49:27Z suehring 27 31 ! Synchronize parent and child models after initialization. 28 32 ! Remove obsolete masking of topography grid points for Runge-Kutta weighted … … 1189 1193 !-- are not identical to the initial wind profiles in this case. 1190 1194 !-- This need to be further revised. 1191 ! ug(:) = u_init(:) 1192 ! vg(:) = v_init(:) 1195 IF ( init_3d%from_file_ug ) THEN 1196 ug(:) = init_3d%ug_init(:) 1197 ENDIF 1198 IF ( init_3d%from_file_vg ) THEN 1199 vg(:) = init_3d%vg_init(:) 1200 ENDIF 1201 1202 ug(nzt+1) = ug(nzt) 1203 vg(nzt+1) = vg(nzt) 1204 1193 1205 ! 1194 1206 !-- Set inital w to 0 … … 1243 1255 !-- fluxes, etc. 1244 1256 CALL init_surfaces 1257 ! 1258 !-- Initialize turbulence generator 1259 IF( use_syn_turb_gen ) CALL stg_init 1245 1260 1246 1261 CALL location_message( 'finished', .TRUE. ) … … 1335 1350 ! 1336 1351 !-- Overwrite initial profiles in case of synthetic turbulence generator 1337 IF( use_syn_turb_gen ) THEN 1338 CALL stg_init 1339 ENDIF 1352 IF( use_syn_turb_gen ) CALL stg_init 1340 1353 1341 1354 ! -
palm/trunk/SOURCE/init_pegrid.f90
r2776 r2938 25 25 ! ----------------- 26 26 ! $Id$ 27 ! - No checks for domain decomposition in case of turbulence generator 28 ! (is done in stg module) 29 ! - Introduce ids to indicate lateral processors for turbulence generator 30 ! 31 ! 2936 2018-03-27 14:49:27Z suehring 27 32 ! Variable use_synthetic_turbulence_generator has been abbreviated 28 33 ! … … 251 256 252 257 USE synthetic_turbulence_generator_mod, & 253 ONLY: use_syn_turb_gen 258 ONLY: id_stg_left, id_stg_north, id_stg_right, id_stg_south, & 259 use_syn_turb_gen 254 260 255 261 USE transpose_indices, & … … 267 273 INTEGER(iwp) :: id_outflow_source_l !< local value of id_outflow_source 268 274 INTEGER(iwp) :: id_recycling_l !< 275 INTEGER(iwp) :: id_stg_left_l !< left lateral boundary local core id in case of turbulence generator 276 INTEGER(iwp) :: id_stg_north_l !< north lateral boundary local core id in case of turbulence generator 277 INTEGER(iwp) :: id_stg_right_l !< right lateral boundary local core id in case of turbulence generator 278 INTEGER(iwp) :: id_stg_south_l !< south lateral boundary local core id in case of turbulence generator 269 279 INTEGER(iwp) :: ind(5) !< 270 280 INTEGER(iwp) :: j !< … … 518 528 !-- 1. transposition z --> x 519 529 !-- This transposition is not neccessary in case of a 1d-decomposition along x 520 IF ( psolver == 'poisfft' .OR. calculate_spectra .OR. & 521 use_syn_turb_gen ) THEN 530 IF ( psolver == 'poisfft' .OR. calculate_spectra ) THEN 522 531 523 532 IF ( pdims(2) /= 1 ) THEN … … 1263 1272 ENDIF 1264 1273 ENDIF 1265 1274 ! 1275 !-- In case of synthetic turbulence geneartor determine ids. 1276 !-- Please note, if no forcing or nesting is applied, the generator is applied 1277 !-- only at the left lateral boundary. 1278 IF ( use_syn_turb_gen ) THEN 1279 IF ( force_bound_l .OR. nest_bound_l .OR. inflow_l ) THEN 1280 id_stg_left_l = myidx 1281 ELSE 1282 id_stg_left_l = 0 1283 ENDIF 1284 IF ( force_bound_r .OR. nest_bound_r ) THEN 1285 id_stg_right_l = myidx 1286 ELSE 1287 id_stg_right_l = 0 1288 ENDIF 1289 IF ( force_bound_s .OR. nest_bound_s ) THEN 1290 id_stg_south_l = myidy 1291 ELSE 1292 id_stg_south_l = 0 1293 ENDIF 1294 IF ( force_bound_n .OR. nest_bound_n ) THEN 1295 id_stg_north_l = myidy 1296 ELSE 1297 id_stg_north_l = 0 1298 ENDIF 1299 1300 IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) 1301 CALL MPI_ALLREDUCE( id_stg_left_l, id_stg_left, 1, MPI_INTEGER, & 1302 MPI_SUM, comm1dx, ierr ) 1303 1304 IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) 1305 CALL MPI_ALLREDUCE( id_stg_right_l, id_stg_right, 1, MPI_INTEGER, & 1306 MPI_SUM, comm1dx, ierr ) 1307 1308 IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) 1309 CALL MPI_ALLREDUCE( id_stg_south_l, id_stg_south, 1, MPI_INTEGER, & 1310 MPI_SUM, comm1dy, ierr ) 1311 1312 IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) 1313 CALL MPI_ALLREDUCE( id_stg_north_l, id_stg_north, 1, MPI_INTEGER, & 1314 MPI_SUM, comm1dy, ierr ) 1315 1316 ENDIF 1317 1266 1318 ! 1267 1319 !-- Broadcast the id of the inflow PE -
palm/trunk/SOURCE/land_surface_model_mod.f90
r2932 r2938 25 25 ! ----------------- 26 26 ! $Id$ 27 ! Initialization of soil moisture and temperature via Inifor-provided data also 28 ! in nested child domains, even if no dynamic input file is available for 29 ! child domain. 1D soil profiles are received from parent model. 30 ! 31 ! 2936 2018-03-27 14:49:27Z suehring 27 32 ! renamed lsm_par to land_surface_parameters. Bugfix in message calls 28 33 ! … … 2365 2370 USE control_parameters, & 2366 2371 ONLY: message_string 2372 2373 USE indices, & 2374 ONLY: nx, ny 2375 2376 USE pmc_interface, & 2377 ONLY: nested_run 2367 2378 2368 2379 IMPLICIT NONE 2380 2381 LOGICAL :: init_soil_dynamically_in_child !< flag controlling initialization of soil in child domains 2369 2382 2370 2383 INTEGER(iwp) :: i !< running index … … 2384 2397 2385 2398 REAL(wp), DIMENSION(:), ALLOCATABLE :: bound, bound_root_fr !< temporary arrays for storing index bounds 2399 REAL(wp), DIMENSION(:), ALLOCATABLE :: pr_soil_init !< temporary array used for averaging soil profiles 2386 2400 2387 2401 ! … … 3894 3908 IF ( TRIM( initializing_actions ) /= 'read_restart_data' ) THEN 3895 3909 ! 3910 !-- In case of nested runs, check if soil is initialized via dynamic 3911 !-- input file in root domain and distribute this information 3912 !-- to all embedded child domains. This case, soil moisture and 3913 !-- temperature will be initialized via root domain. 3914 init_soil_dynamically_in_child = .FALSE. 3915 IF ( nested_run ) THEN 3916 #if defined( __parallel ) 3917 CALL MPI_ALLREDUCE( init_3d%from_file_tsoil .OR. & 3918 init_3d%from_file_msoil, & 3919 init_soil_dynamically_in_child, & 3920 1, MPI_LOGICAL, MPI_LOR, MPI_COMM_WORLD, ierr ) 3921 #endif 3922 ENDIF 3923 3924 ! 3896 3925 !-- First, initialize soil temperature and moisture. 3897 3926 !-- According to the initialization for surface and soil parameters, … … 3923 3952 ENDDO 3924 3953 ! 3925 !-- Level 2, if soil moisture and/or temperature are 3926 !-- provided from file, interpolate / extrapolate the provided data 3927 !-- onto the respective soil layers. Please note, both, zs as well as 3928 !-- init_3d%z_soil indicate a depth with positive values, so that no 3929 !-- distinction between atmosphere is required concerning interpolation. 3930 !-- Start with soil moisture 3954 !-- Initialization of soil moisture and temperature from file. 3955 !-- In case of nested runs, only root parent reads dynamic input file. 3956 !-- This case, transfer respective soil information provide 3957 !-- by dynamic input file from root parent domain onto all other domains. 3958 IF ( init_soil_dynamically_in_child ) THEN 3959 ! 3960 !-- Child domains will be only initialized with horizontally 3961 !-- averaged soil profiles in parent domain (for sake of simplicity). 3962 !-- If required, average soil data on root parent domain before 3963 !-- distribute onto child domains. 3964 IF ( init_3d%from_file_msoil .AND. init_3d%lod_msoil == 2 ) & 3965 THEN 3966 ALLOCATE( pr_soil_init(0:init_3d%nzs-1) ) 3967 3968 DO k = 0, init_3d%nzs-1 3969 pr_soil_init(k) = SUM( init_3d%msoil(k,nys:nyn,nxl:nxr) ) 3970 ENDDO 3971 ! 3972 !-- Allocate 1D array for soil-moisture profile (will not be 3973 !-- allocated in lod==2 case). 3974 ALLOCATE( init_3d%msoil_init(0:init_3d%nzs-1) ) 3975 init_3d%msoil_init = 0.0_wp 3976 #if defined( __parallel ) 3977 CALL MPI_ALLREDUCE( pr_soil_init(0), init_3d%msoil_init(0), & 3978 SIZE(pr_soil_init), & 3979 MPI_REAL, MPI_SUM, comm2d, ierr ) 3980 #endif 3981 init_3d%msoil_init = init_3d%msoil_init / & 3982 REAL( ( nx + 1 ) * ( ny + 1), KIND=wp ) 3983 DEALLOCATE( pr_soil_init ) 3984 ENDIF 3985 IF ( init_3d%from_file_tsoil .AND. init_3d%lod_tsoil == 2 ) THEN 3986 ALLOCATE( pr_soil_init(0:init_3d%nzs-1) ) 3987 3988 DO k = 0, init_3d%nzs-1 3989 pr_soil_init(k) = SUM( init_3d%tsoil(k,nys:nyn,nxl:nxr) ) 3990 ENDDO 3991 ! 3992 !-- Allocate 1D array for soil-temperature profile (will not be 3993 !-- allocated in lod==2 case). 3994 ALLOCATE( init_3d%tsoil_init(0:init_3d%nzs-1) ) 3995 init_3d%tsoil_init = 0.0_wp 3996 #if defined( __parallel ) 3997 CALL MPI_ALLREDUCE( pr_soil_init(0), init_3d%tsoil_init(0), & 3998 SIZE(pr_soil_init), & 3999 MPI_REAL, MPI_SUM, comm2d, ierr ) 4000 #endif 4001 init_3d%tsoil_init = init_3d%tsoil_init / & 4002 REAL( ( nx + 1 ) * ( ny + 1), KIND=wp ) 4003 DEALLOCATE( pr_soil_init ) 4004 4005 ENDIF 4006 4007 #if defined( __parallel ) 4008 ! 4009 !-- Distribute soil grid information on file from root to all childs. 4010 !-- Only process with rank 0 sends the information. 4011 CALL MPI_BCAST( init_3d%nzs, 1, & 4012 MPI_INTEGER, 0, MPI_COMM_WORLD, ierr ) 4013 4014 IF ( .NOT. ALLOCATED( init_3d%z_soil ) ) & 4015 ALLOCATE( init_3d%z_soil(1:init_3d%nzs) ) 4016 4017 CALL MPI_BCAST( init_3d%z_soil, SIZE(init_3d%z_soil), & 4018 MPI_REAL, 0, MPI_COMM_WORLD, ierr ) 4019 #endif 4020 ! 4021 !-- ALLOCATE arrays on child domains and set control attributes. 4022 IF ( .NOT. init_3d%from_file_msoil ) THEN 4023 ALLOCATE( init_3d%msoil_init(0:init_3d%nzs-1) ) 4024 init_3d%lod_msoil = 1 4025 init_3d%from_file_msoil = .TRUE. 4026 ENDIF 4027 IF ( .NOT. init_3d%from_file_tsoil ) THEN 4028 ALLOCATE( init_3d%tsoil_init(0:init_3d%nzs-1) ) 4029 init_3d%lod_tsoil = 1 4030 init_3d%from_file_tsoil = .TRUE. 4031 ENDIF 4032 4033 4034 #if defined( __parallel ) 4035 ! 4036 !-- Distribute soil profiles from root to all childs 4037 CALL MPI_BCAST( init_3d%msoil_init, SIZE(init_3d%msoil_init), & 4038 MPI_REAL, 0, MPI_COMM_WORLD, ierr ) 4039 CALL MPI_BCAST( init_3d%tsoil_init, SIZE(init_3d%tsoil_init), & 4040 MPI_REAL, 0, MPI_COMM_WORLD, ierr ) 4041 #endif 4042 4043 ENDIF 4044 ! 4045 !-- Proceed with Level 2 initialization. Information from dynamic input 4046 !-- is now available on all processes. 3931 4047 IF ( init_3d%from_file_msoil ) THEN 3932 4048 … … 3983 4099 ENDDO 3984 4100 ENDIF 3985 3986 4101 ENDIF 3987 4102 ! -
palm/trunk/SOURCE/large_scale_forcing_nudging_mod.f90
r2718 r2938 25 25 ! ----------------- 26 26 ! $Id$ 27 ! Further improvements for nesting in larger-scale model 28 ! 29 ! 2863 2018-03-08 11:36:25Z suehring 27 30 ! Corrected "Former revisions" section 28 31 ! … … 210 213 ENDIF 211 214 ! 212 !-- 215 !-- Top boundary 213 216 k = nzt 214 217 DO i = nxl, nxr … … 235 238 ENDDO 236 239 ENDDO 240 241 write(9,*) "w correction", w_correct 242 flush(9) 237 243 238 244 END SUBROUTINE forcing_bc_mass_conservation … … 581 587 !-- identical to the Inifor grid. At the top boundary an extrapolation is 582 588 !-- not possible. 583 IF ( ANY( zu(1:nzt+1) /= force%zu_atmos(1:force%nzu) ) ) THEN 584 DO i = nxlu, nxr 585 DO j = nys, nyn 586 u(nzt+1,j,i) = force%u_top(0,j,i) + ddt_lsf * t_ref * & 587 ( force%u_top(1,j,i) - force%u_top(0,j,i) ) * & 588 MERGE( 1.0_wp, 0.0_wp, & 589 BTEST( wall_flags_0(nzt+1,j,i), 1 ) ) 590 ENDDO 591 ENDDO 592 593 DO i = nxl, nxr 594 DO j = nysv, nyn 595 v(nzt+1,j,i) = force%v_top(0,j,i) + ddt_lsf * t_ref * & 596 ( force%v_top(1,j,i) - force%v_top(0,j,i) ) * & 597 MERGE( 1.0_wp, 0.0_wp, & 598 BTEST( wall_flags_0(nzt+1,j,i), 2 ) ) 599 ENDDO 600 ENDDO 601 589 DO i = nxlu, nxr 590 DO j = nys, nyn 591 u(nzt+1,j,i) = force%u_top(0,j,i) + ddt_lsf * t_ref * & 592 ( force%u_top(1,j,i) - force%u_top(0,j,i) ) * & 593 MERGE( 1.0_wp, 0.0_wp, & 594 BTEST( wall_flags_0(nzt+1,j,i), 1 ) ) 595 ENDDO 596 ENDDO 597 598 DO i = nxl, nxr 599 DO j = nysv, nyn 600 v(nzt+1,j,i) = force%v_top(0,j,i) + ddt_lsf * t_ref * & 601 ( force%v_top(1,j,i) - force%v_top(0,j,i) ) * & 602 MERGE( 1.0_wp, 0.0_wp, & 603 BTEST( wall_flags_0(nzt+1,j,i), 2 ) ) 604 ENDDO 605 ENDDO 606 607 DO i = nxl, nxr 608 DO j = nys, nyn 609 w(nzt:nzt+1,j,i) = force%w_top(0,j,i) + ddt_lsf * t_ref * & 610 ( force%w_top(1,j,i) - force%w_top(0,j,i) ) * & 611 MERGE( 1.0_wp, 0.0_wp, & 612 BTEST( wall_flags_0(nzt:nzt+1,j,i), 3 ) ) 613 ENDDO 614 ENDDO 615 616 617 IF ( .NOT. neutral ) THEN 602 618 DO i = nxl, nxr 603 619 DO j = nys, nyn 604 w(nzt:nzt+1,j,i) = force%w_top(0,j,i) + ddt_lsf * t_ref * & 605 ( force%w_top(1,j,i) - force%w_top(0,j,i) ) * & 606 MERGE( 1.0_wp, 0.0_wp, & 607 BTEST( wall_flags_0(nzt:nzt+1,j,i), 3 ) ) 608 ENDDO 609 ENDDO 610 611 612 IF ( .NOT. neutral ) THEN 613 DO i = nxl, nxr 614 DO j = nys, nyn 615 pt(nzt+1,j,i) = force%pt_top(0,j,i) + ddt_lsf * t_ref * & 616 ( force%pt_top(1,j,i) - force%pt_top(0,j,i) ) 617 ENDDO 618 ENDDO 619 ENDIF 620 621 IF ( humidity ) THEN 622 DO i = nxl, nxr 623 DO j = nys, nyn 624 q(nzt+1,j,i) = force%q_top(0,j,i) + ddt_lsf * t_ref * & 625 ( force%q_top(1,j,i) - force%q_top(0,j,i) ) 626 ENDDO 627 ENDDO 628 ENDIF 620 pt(nzt+1,j,i) = force%pt_top(0,j,i) + ddt_lsf * t_ref * & 621 ( force%pt_top(1,j,i) - force%pt_top(0,j,i) ) 622 ENDDO 623 ENDDO 624 ENDIF 625 626 IF ( humidity ) THEN 627 DO i = nxl, nxr 628 DO j = nys, nyn 629 q(nzt+1,j,i) = force%q_top(0,j,i) + ddt_lsf * t_ref * & 630 ( force%q_top(1,j,i) - force%q_top(0,j,i) ) 631 ENDDO 632 ENDDO 633 ENDIF 634 ! 635 !-- At the edges( left-south, left-north, right-south and right-north) set 636 !-- data on ghost points. 637 IF ( force_bound_l .AND. force_bound_s ) THEN 638 DO i = 1, nbgp 639 u(:,nys-i,nxlg:nxl) = u(:,nys,nxlg:nxl) 640 w(:,nys-i,nxlg:nxl-1) = w(:,nys,nxlg:nxl-1) 641 IF ( .NOT. neutral ) pt(:,nys-i,nxlg:nxl-1) = pt(:,nys,nxlg:nxl-1) 642 IF ( humidity ) q(:,nys-i,nxlg:nxl-1) = q(:,nys,nxlg:nxl-1) 643 ENDDO 644 DO i = 1, nbgp+1 645 v(:,nysv-i,nxlg:nxl-1) = v(:,nysv,nxlg:nxl-1) 646 ENDDO 647 ENDIF 648 IF ( force_bound_l .AND. force_bound_n ) THEN 649 DO i = 1, nbgp 650 u(:,nyn+i,nxlg:nxl) = u(:,nyn,nxlg:nxl) 651 v(:,nyn+i,nxlg:nxl-1) = v(:,nyn,nxlg:nxl-1) 652 w(:,nyn+i,nxlg:nxl-1) = w(:,nyn,nxlg:nxl-1) 653 IF ( .NOT. neutral ) pt(:,nyn+i,nxlg:nxl-1) = pt(:,nyn,nxlg:nxl-1) 654 IF ( humidity ) q(:,nyn+i,nxlg:nxl-1) = q(:,nyn,nxlg:nxl-1) 655 ENDDO 656 ENDIF 657 IF ( force_bound_r .AND. force_bound_s ) THEN 658 DO i = 1, nbgp 659 u(:,nys-i,nxr+1:nxrg) = u(:,nys,nxr+1:nxrg) 660 w(:,nys-i,nxr+1:nxrg) = w(:,nys,nxr+1:nxrg) 661 IF ( .NOT. neutral ) pt(:,nys-i,nxr+1:nxrg) = pt(:,nys,nxr+1:nxrg) 662 IF ( humidity ) q(:,nys-i,nxr+1:nxrg) = q(:,nys,nxr+1:nxrg) 663 ENDDO 664 DO i = 1, nbgp+1 665 v(:,nysv-i,nxr+1:nxrg) = v(:,nysv,nxr+1:nxrg) 666 ENDDO 667 ENDIF 668 IF ( force_bound_r .AND. force_bound_n ) THEN 669 DO i = 1, nbgp 670 u(:,nyn+i,nxr+1:nxrg) = u(:,nyn,nxr+1:nxrg) 671 v(:,nyn+i,nxr+1:nxrg) = v(:,nyn,nxr+1:nxrg) 672 w(:,nyn+i,nxr+1:nxrg) = w(:,nyn,nxr+1:nxrg) 673 IF ( .NOT. neutral ) pt(:,nyn+i,nxr+1:nxrg) = pt(:,nyn,nxr+1:nxrg) 674 IF ( humidity ) q(:,nyn+i,nxr+1:nxrg) = q(:,nyn,nxr+1:nxrg) 675 ENDDO 629 676 ENDIF 630 677 ! … … 941 988 SUBROUTINE lsf_init 942 989 990 USE control_parameters, & 991 ONLY: bc_lr_cyc, bc_ns_cyc 992 943 993 USE netcdf_data_input_mod, & 944 994 ONLY: netcdf_data_input_lsf … … 975 1025 976 1026 IF ( forcing ) THEN 1027 ! 1028 !-- Allocate arrays for geostrophic wind components. Arrays will 1029 !-- incorporate 2 time levels in order to interpolate in between. Please 1030 !-- note, forcing using geostrophic wind components is only required in 1031 !-- case of cyclic boundary conditions. 1032 IF ( bc_lr_cyc .AND. bc_ns_cyc ) THEN 1033 ALLOCATE( force%ug(0:1,nzb:nzt+1) ) 1034 ALLOCATE( force%vg(0:1,nzb:nzt+1) ) 1035 ENDIF 977 1036 ! 978 1037 !-- Allocate arrays for reading boundary values. Arrays will incorporate 2 -
palm/trunk/SOURCE/netcdf_data_input_mod.f90
r2930 r2938 25 25 ! ----------------- 26 26 ! $Id$ 27 ! Initial read of geostrophic wind components from dynamic driver. 28 ! 29 ! 2773 2018-01-30 14:12:54Z suehring 27 30 ! Revise checks for surface_fraction. 28 31 ! … … 126 129 REAL(wp), DIMENSION(:), ALLOCATABLE :: zw_atmos !< vertical levels at w grid in dynamic input file 127 130 131 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: ug !< domain-averaged geostrophic component 132 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: vg !< domain-averaged geostrophic component 133 128 134 REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: u_left !< u-component at left boundary 129 135 REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: v_left !< v-component at left boundary … … 180 186 LOGICAL :: from_file_tsoil = .FALSE. !< flag indicating whether soil temperature is already initialized from file 181 187 LOGICAL :: from_file_u = .FALSE. !< flag indicating whether u is already initialized from file 188 LOGICAL :: from_file_ug = .FALSE. !< flag indicating whether ug is already initialized from file 182 189 LOGICAL :: from_file_v = .FALSE. !< flag indicating whether v is already initialized from file 183 LOGICAL :: from_file_w = .FALSE. !< flag indicating whether w is already initialized from file 190 LOGICAL :: from_file_vg = .FALSE. !< flag indicating whether ug is already initialized from file 191 LOGICAL :: from_file_w = .FALSE. !< flag indicating whether w is already initialized from file 192 184 193 185 194 REAL(wp) :: fill_msoil !< fill value for soil moisture … … 422 431 MODULE PROCEDURE get_variable_4d_real 423 432 END INTERFACE get_variable 433 434 INTERFACE get_variable_pr 435 MODULE PROCEDURE get_variable_pr 436 END INTERFACE get_variable_pr 424 437 425 438 INTERFACE get_attribute … … 2025 2038 ENDIF 2026 2039 ! 2027 !-- Read geostrophic wind components 2028 ! IF ( check_existence( var_names, 'ls_forcing_ug' ) ) THEN 2029 ! 2030 ! ENDIF 2031 ! IF ( check_existence( var_names, 'ls_forcing_vg' ) ) THEN 2032 ! 2033 ! ENDIF 2034 2040 !-- Read initial geostrophic wind components at 2041 !-- t = 0 (index 1 in file). 2042 IF ( check_existence( var_names, 'ls_forcing_ug' ) ) THEN 2043 ALLOCATE( init_3d%ug_init(nzb:nzt+1) ) 2044 CALL get_variable_pr( id_dynamic, 'ls_forcing_ug', 1, & 2045 init_3d%ug_init ) 2046 init_3d%from_file_ug = .TRUE. 2047 ELSE 2048 init_3d%from_file_ug = .FALSE. 2049 ENDIF 2050 IF ( check_existence( var_names, 'ls_forcing_vg' ) ) THEN 2051 ALLOCATE( init_3d%vg_init(nzb:nzt+1) ) 2052 CALL get_variable_pr( id_dynamic, 'ls_forcing_vg', 1, & 2053 init_3d%vg_init ) 2054 init_3d%from_file_vg = .TRUE. 2055 ELSE 2056 init_3d%from_file_vg = .FALSE. 2057 ENDIF 2035 2058 ! 2036 2059 !-- Read inital 3D data of u, v, w, pt and q, … … 2222 2245 !-- Read soil moisture 2223 2246 IF ( land_surface ) THEN 2247 2224 2248 IF ( check_existence( var_names, 'init_soil_m' ) ) THEN 2225 2249 ! … … 2240 2264 ! 2241 2265 !-- level-of-detail 2 - read 3D initialization data 2242 ELSEIF ( init_3d%lod_msoil == 2 ) THEN ! need to be corrected2266 ELSEIF ( init_3d%lod_msoil == 2 ) THEN 2243 2267 ALLOCATE ( init_3d%msoil(0:init_3d%nzs-1,nys:nyn,nxl:nxr) ) 2244 2268 DO i = nxl, nxr … … 2272 2296 ! 2273 2297 !-- level-of-detail 2 - read 3D initialization data 2274 ELSEIF ( init_3d%lod_tsoil == 2 ) THEN ! need to be corrected2298 ELSEIF ( init_3d%lod_tsoil == 2 ) THEN 2275 2299 ALLOCATE ( init_3d%tsoil(0:init_3d%nzs-1,nys:nyn,nxl:nxr) ) 2276 2300 DO i = nxl, nxr … … 2346 2370 2347 2371 USE control_parameters, & 2348 ONLY: force_bound_l, force_bound_n, force_bound_r, force_bound_s, & 2372 ONLY: bc_lr_cyc, bc_ns_cyc, force_bound_l, force_bound_n, & 2373 force_bound_r, force_bound_s, & 2349 2374 forcing, humidity, message_string, neutral, simulated_time 2375 2350 2376 2351 2377 USE indices, & … … 2430 2456 force%tind = MINLOC( ABS( force%time - simulated_time ), DIM = 1 )& 2431 2457 - 1 2432 force%tind_p = force%tind + 1 2458 force%tind_p = force%tind + 1 2459 ! 2460 !-- Read geostrophic wind components. In case of forcing, this is only 2461 !-- required if cyclic boundary conditions are applied. 2462 IF ( bc_lr_cyc .AND. bc_ns_cyc ) THEN 2463 DO t = force%tind, force%tind_p 2464 CALL get_variable_pr( id_dynamic, 'ls_forcing_ug', t+1, & 2465 force%ug(t-force%tind,:) ) 2466 CALL get_variable_pr( id_dynamic, 'ls_forcing_vg', t+1, & 2467 force%ug(t-force%tind,:) ) 2468 ENDDO 2469 ENDIF 2433 2470 ! 2434 2471 !-- Read data at lateral and top boundaries. Please note, at left and … … 3832 3869 END SUBROUTINE get_variable_1d_real 3833 3870 3871 3872 !------------------------------------------------------------------------------! 3873 ! Description: 3874 ! ------------ 3875 !> Reads a time-dependent 1D float variable from file. 3876 !------------------------------------------------------------------------------! 3877 SUBROUTINE get_variable_pr( id, variable_name, t, var ) 3878 #if defined( __netcdf ) 3879 3880 USE pegrid 3881 3882 IMPLICIT NONE 3883 3884 CHARACTER(LEN=*) :: variable_name !< variable name 3885 3886 INTEGER(iwp), INTENT(IN) :: id !< file id 3887 INTEGER(iwp), DIMENSION(1:2) :: id_dim !< dimension ids 3888 INTEGER(iwp) :: id_var !< dimension id 3889 INTEGER(iwp) :: n_file !< number of data-points in file along z dimension 3890 INTEGER(iwp), INTENT(IN) :: t !< timestep number 3891 3892 REAL(wp), DIMENSION(:), INTENT(INOUT) :: var !< variable to be read 3893 3894 ! 3895 !-- First, inquire variable ID 3896 nc_stat = NF90_INQ_VARID( id, TRIM( variable_name ), id_var ) 3897 ! 3898 !-- Inquire dimension size of vertical dimension 3899 nc_stat = NF90_INQUIRE_VARIABLE( id, id_var, DIMIDS = id_dim ) 3900 nc_stat = NF90_INQUIRE_DIMENSION( id, id_dim(1), LEN = n_file ) 3901 ! 3902 !-- Read variable. 3903 nc_stat = NF90_GET_VAR( id, id_var, var, & 3904 start = (/ 1, t /), & 3905 count = (/ n_file, 1 /) ) 3906 CALL handle_error( 'get_variable_pr', 527 ) 3907 3908 #endif 3909 END SUBROUTINE get_variable_pr 3910 3911 3834 3912 !------------------------------------------------------------------------------! 3835 3913 ! Description: -
palm/trunk/SOURCE/parin.f90
r2932 r2938 25 25 ! ----------------- 26 26 ! $Id$ 27 ! Change initialization in case child domain should be initialized with Inifor. 28 ! 29 ! 2936 2018-03-27 14:49:27Z suehring 27 30 ! inipar renamed to initialization_parameters. 28 31 ! d3par renamed to runtime_parameters. … … 907 910 !-- are set properly. An exception is made in case of restart runs and 908 911 !-- if user decides to do everything by its own. 909 !-- MS: is this really necessary?910 912 IF ( nest_domain .AND. .NOT. ( & 911 913 TRIM( initializing_actions ) == 'read_restart_data' .OR. & 912 TRIM( initializing_actions ) == 'by_user' .OR. & 913 TRIM( initializing_actions ) == 'inifor' ) ) THEN 914 TRIM( initializing_actions ) == 'by_user' ) ) THEN 914 915 initializing_actions = 'set_constant_profiles' 915 916 ENDIF -
palm/trunk/SOURCE/pmc_interface_mod.f90
r2903 r2938 25 25 ! ----------------- 26 26 ! $Id$ 27 ! - Nesting for RANS mode implemented 28 ! - Interpolation of TKE onto child domain only if both parent and child are 29 ! either in LES mode or in RANS mode 30 ! - Interpolation of dissipation if both parent and child are in RANS mode 31 ! and TKE-epsilon closure is applied 32 ! - Enable anterpolation of TKE and dissipation rate in case parent and 33 ! child operate in RANS mode 34 ! 35 ! - Some unused variables removed from ONLY list 36 ! - Some formatting adjustments for particle nesting 37 ! 38 ! 2936 2018-03-27 14:49:27Z suehring 27 39 ! Control logics improved to allow nesting also in cases with 28 40 ! constant_flux_layer = .F. or constant_diffusion = .T. … … 254 266 #if defined( __nopointer ) 255 267 USE arrays_3d, & 256 ONLY: d zu, dzw, e, e_p, nc, nr, pt, pt_p, q, q_p, qc, qr, s, u, u_p,&268 ONLY: diss, dzu, dzw, e, e_p, nc, nr, pt, q, qc, qr, s, u, u_p, & 257 269 v, v_p, w, w_p, zu, zw 258 270 #else 259 271 USE arrays_3d, & 260 ONLY: d zu, dzw, e, e_p, e_1, e_2, nc, nc_2, nc_p, nr, nr_2, nr_p, pt,&261 pt _p, pt_1, pt_2, q, q_p, q_1, q_2, qc, qc_2, qr, qr_2, s, s_2,&262 u, u_p, u_ 1, u_2, v, v_p, v_1, v_2, w, w_p, w_1, w_2, zu, zw272 ONLY: diss, diss_2, dzu, dzw, e, e_p, e_2, nc, nc_2, nc_p, nr, nr_2, & 273 pt, pt_2, q, q_2, qc, qc_2, qr, qr_2, s, s_2, & 274 u, u_p, u_2, v, v_p, v_2, w, w_p, w_2, zu, zw 263 275 #endif 264 276 … … 269 281 microphysics_morrison, microphysics_seifert, & 270 282 nest_bound_l, nest_bound_r, nest_bound_s, nest_bound_n, & 271 nest_domain, neutral, passive_scalar, r oughness_length, &272 simulated_time, topography, volume_flow283 nest_domain, neutral, passive_scalar, rans_mode, rans_tke_e, & 284 roughness_length, simulated_time, topography, volume_flow 273 285 274 286 USE chem_modules, & … … 359 371 360 372 LOGICAL, SAVE :: nested_run = .FALSE. !< general switch 373 LOGICAL :: rans_mode_parent = .FALSE. !< mode of parent model (.F. - LES mode, .T. - RANS mode) 361 374 362 375 REAL(wp), SAVE :: anterp_relax_length_l = -1.0_wp !< … … 387 400 REAL(wp), SAVE, DIMENSION(:,:), ALLOCATABLE :: tkefactor_t !< 388 401 402 REAL(wp), SAVE, DIMENSION(:,:,:), ALLOCATABLE, TARGET :: dissc !< coarse grid array on child domain - dissipation rate 389 403 REAL(wp), SAVE, DIMENSION(:,:,:), ALLOCATABLE, TARGET :: ec !< 390 404 REAL(wp), SAVE, DIMENSION(:,:,:), ALLOCATABLE, TARGET :: ptc !< … … 401 415 INTEGER(idp), SAVE, DIMENSION(:,:), ALLOCATABLE, TARGET, PUBLIC :: part_adrc !< 402 416 403 404 REAL(wp), SAVE, DIMENSION(:,:,:,:), ALLOCATABLE, TARGET :: chem_spec_c !< child coarse data array for chemical species 417 REAL(wp), SAVE, DIMENSION(:,:,:,:), ALLOCATABLE, TARGET :: chem_spec_c !< coarse grid array on child domain - chemical species 405 418 406 419 ! … … 616 629 anterp_relax_length_t, child_to_parent, comm_world_nesting, & 617 630 cpl_id, nested_run, nesting_datatransfer_mode, nesting_mode, & 618 parent_to_child 631 parent_to_child, rans_mode_parent 619 632 620 633 PUBLIC pmci_boundary_conds … … 804 817 ! Initialize the pmc parent 805 818 CALL pmc_parentinit 819 806 820 ! 807 821 !-- Corners of all children of the present parent … … 821 835 822 836 child_id = pmc_parent_for_child(m) 823 IF ( myid == 0 ) THEN 837 838 IF ( myid == 0 ) THEN 824 839 825 840 CALL pmc_recv_from_child( child_id, val, size(val), 0, 123, ierr ) … … 932 947 DEALLOCATE( cl_coord_x ) 933 948 DEALLOCATE( cl_coord_y ) 949 950 ! 951 !-- Send information about operating mode (LES or RANS) to child. This will be 952 !-- used to control TKE nesting and setting boundary conditions properly. 953 CALL pmc_send_to_child( child_id, rans_mode, 1, 0, 19, ierr ) 934 954 ! 935 955 !-- Send coarse grid information to child … … 990 1010 ENDIF 991 1011 ENDDO 1012 992 1013 CALL pmc_s_setind_and_allocmem( child_id ) 993 1014 ENDDO … … 1195 1216 CALL pmc_set_dataarray_name( 'coarse', 'v' ,'fine', 'v', ierr ) 1196 1217 CALL pmc_set_dataarray_name( 'coarse', 'w' ,'fine', 'w', ierr ) 1218 ! 1219 !-- Set data array name for TKE. Please note, nesting of TKE is actually 1220 !-- only done if both parent and child are in LES or in RANS mode. Due to 1221 !-- design of model coupler, however, data array names must be already 1222 !-- available at this point. 1197 1223 CALL pmc_set_dataarray_name( 'coarse', 'e' ,'fine', 'e', ierr ) 1224 ! 1225 !-- Nesting of dissipation rate only if both parent and child are in RANS 1226 !-- mode and TKE-epsilo closure is applied. Please so also comment for TKE 1227 !-- above. 1228 CALL pmc_set_dataarray_name( 'coarse', 'diss' ,'fine', 'diss', ierr ) 1198 1229 1199 1230 IF ( .NOT. neutral ) THEN … … 1260 1291 CALL pmc_send_to_parent( coord_x, nx + 1 + 2 * nbgp, 0, 11, ierr ) 1261 1292 CALL pmc_send_to_parent( coord_y, ny + 1 + 2 * nbgp, 0, 12, ierr ) 1293 1294 CALL pmc_recv_from_parent( rans_mode_parent, 1, 0, 19, ierr ) 1295 ! 1262 1296 ! 1263 1297 !-- Receive Coarse grid information. … … 1319 1353 CALL MPI_BCAST( cg%zu, cg%nz+2, MPI_REAL, 0, comm2d, ierr ) 1320 1354 CALL MPI_BCAST( cg%zw, cg%nz+2, MPI_REAL, 0, comm2d, ierr ) 1321 1355 CALL MPI_BCAST( rans_mode_parent, 1, MPI_LOGICAL, 0, comm2d, ierr ) 1356 1322 1357 ! 1323 1358 !-- Find the index bounds for the nest domain in the coarse-grid index space … … 1357 1392 ENDIF 1358 1393 ! 1359 !-- Define the SGS-TKE scaling factor based on the grid-spacing ratio 1360 IF ( .NOT. constant_diffusion ) THEN 1361 CALL pmci_init_tkefactor 1362 ENDIF 1394 !-- Define the SGS-TKE scaling factor based on the grid-spacing ratio. Only 1395 !-- if both parent and child are in LES mode or in RANS mode. 1396 !-- Please note, in case parent and child are in RANS mode, TKE weighting 1397 !-- factor is simply one. 1398 IF ( ( rans_mode_parent .AND. rans_mode ) .OR. & 1399 ( .NOT. rans_mode_parent .AND. .NOT. rans_mode .AND. & 1400 .NOT. constant_diffusion ) ) CALL pmci_init_tkefactor 1363 1401 ! 1364 1402 !-- Two-way coupling for general and vertical nesting. … … 2995 3033 !-- energy spectrum. Near the surface, the reduction of TKE is made 2996 3034 !-- smaller than further away from the surface. 3035 !-- Please note, in case parent and child model operate in RANS mode, 3036 !-- TKE is not grid depenedent and weighting factor is one. 2997 3037 2998 3038 IMPLICIT NONE … … 3012 3052 REAL(wp), PARAMETER :: p23 = 2.0_wp/3.0_wp !< 3013 3053 3014 IF ( nest_bound_l ) THEN 3015 ALLOCATE( tkefactor_l(nzb:nzt+1,nysg:nyng) ) 3016 tkefactor_l = 0.0_wp 3017 i = nxl - 1 3018 DO j = nysg, nyng 3019 k_wall = get_topography_top_index_ji( j, i, 's' ) 3020 3021 DO k = k_wall + 1, nzt 3022 3023 kc = kco(k) + 1 3024 glsf = ( dx * dy * dzu(k) )**p13 3025 glsc = ( cg%dx * cg%dy *cg%dzu(kc) )**p13 3026 height = zu(k) - zu(k_wall) 3027 fw = EXP( -cfw * height / glsf ) 3028 tkefactor_l(k,j) = c_tkef * ( fw0 * fw + ( 1.0_wp - fw ) * & 3029 ( glsf / glsc )**p23 ) 3054 ! 3055 IF ( .NOT. rans_mode .AND. .NOT. rans_mode_parent ) THEN 3056 IF ( nest_bound_l ) THEN 3057 ALLOCATE( tkefactor_l(nzb:nzt+1,nysg:nyng) ) 3058 tkefactor_l = 0.0_wp 3059 i = nxl - 1 3060 DO j = nysg, nyng 3061 k_wall = get_topography_top_index_ji( j, i, 's' ) 3062 3063 DO k = k_wall + 1, nzt 3064 kc = kco(k) + 1 3065 glsf = ( dx * dy * dzu(k) )**p13 3066 glsc = ( cg%dx * cg%dy *cg%dzu(kc) )**p13 3067 height = zu(k) - zu(k_wall) 3068 fw = EXP( -cfw * height / glsf ) 3069 tkefactor_l(k,j) = c_tkef * ( fw0 * fw + ( 1.0_wp - fw ) * & 3070 ( glsf / glsc )**p23 ) 3071 ENDDO 3072 tkefactor_l(k_wall,j) = c_tkef * fw0 3030 3073 ENDDO 3031 tkefactor_l(k_wall,j) = c_tkef * fw0 3032 ENDDO 3033 ENDIF 3034 3035 IF ( nest_bound_r ) THEN 3036 ALLOCATE( tkefactor_r(nzb:nzt+1,nysg:nyng) ) 3037 tkefactor_r = 0.0_wp 3038 i = nxr + 1 3039 DO j = nysg, nyng 3040 k_wall = get_topography_top_index_ji( j, i, 's' ) 3041 3042 DO k = k_wall + 1, nzt 3074 ENDIF 3075 3076 IF ( nest_bound_r ) THEN 3077 ALLOCATE( tkefactor_r(nzb:nzt+1,nysg:nyng) ) 3078 tkefactor_r = 0.0_wp 3079 i = nxr + 1 3080 DO j = nysg, nyng 3081 k_wall = get_topography_top_index_ji( j, i, 's' ) 3082 3083 DO k = k_wall + 1, nzt 3084 kc = kco(k) + 1 3085 glsf = ( dx * dy * dzu(k) )**p13 3086 glsc = ( cg%dx * cg%dy * cg%dzu(kc) )**p13 3087 height = zu(k) - zu(k_wall) 3088 fw = EXP( -cfw * height / glsf ) 3089 tkefactor_r(k,j) = c_tkef * ( fw0 * fw + ( 1.0_wp - fw ) * & 3090 ( glsf / glsc )**p23 ) 3091 ENDDO 3092 tkefactor_r(k_wall,j) = c_tkef * fw0 3093 ENDDO 3094 ENDIF 3095 3096 IF ( nest_bound_s ) THEN 3097 ALLOCATE( tkefactor_s(nzb:nzt+1,nxlg:nxrg) ) 3098 tkefactor_s = 0.0_wp 3099 j = nys - 1 3100 DO i = nxlg, nxrg 3101 k_wall = get_topography_top_index_ji( j, i, 's' ) 3102 3103 DO k = k_wall + 1, nzt 3104 3105 kc = kco(k) + 1 3106 glsf = ( dx * dy * dzu(k) )**p13 3107 glsc = ( cg%dx * cg%dy * cg%dzu(kc) ) ** p13 3108 height = zu(k) - zu(k_wall) 3109 fw = EXP( -cfw*height / glsf ) 3110 tkefactor_s(k,i) = c_tkef * ( fw0 * fw + ( 1.0_wp - fw ) * & 3111 ( glsf / glsc )**p23 ) 3112 ENDDO 3113 tkefactor_s(k_wall,i) = c_tkef * fw0 3114 ENDDO 3115 ENDIF 3116 3117 IF ( nest_bound_n ) THEN 3118 ALLOCATE( tkefactor_n(nzb:nzt+1,nxlg:nxrg) ) 3119 tkefactor_n = 0.0_wp 3120 j = nyn + 1 3121 DO i = nxlg, nxrg 3122 k_wall = get_topography_top_index_ji( j, i, 's' ) 3123 3124 DO k = k_wall + 1, nzt 3125 3126 kc = kco(k) + 1 3127 glsf = ( dx * dy * dzu(k) )**p13 3128 glsc = ( cg%dx * cg%dy * cg%dzu(kc) )**p13 3129 height = zu(k) - zu(k_wall) 3130 fw = EXP( -cfw * height / glsf ) 3131 tkefactor_n(k,i) = c_tkef * ( fw0 * fw + ( 1.0_wp - fw ) * & 3132 ( glsf / glsc )**p23 ) 3133 ENDDO 3134 tkefactor_n(k_wall,i) = c_tkef * fw0 3135 ENDDO 3136 ENDIF 3137 3138 ALLOCATE( tkefactor_t(nysg:nyng,nxlg:nxrg) ) 3139 k = nzt 3140 3141 DO i = nxlg, nxrg 3142 DO j = nysg, nyng 3143 ! 3144 !-- Determine vertical index for local topography top 3145 k_wall = get_topography_top_index_ji( j, i, 's' ) 3043 3146 3044 3147 kc = kco(k) + 1 … … 3047 3150 height = zu(k) - zu(k_wall) 3048 3151 fw = EXP( -cfw * height / glsf ) 3049 tkefactor_ r(k,j) = c_tkef * ( fw0 * fw + ( 1.0_wp - fw ) *&3152 tkefactor_t(j,i) = c_tkef * ( fw0 * fw + ( 1.0_wp - fw ) * & 3050 3153 ( glsf / glsc )**p23 ) 3051 3154 ENDDO 3052 tkefactor_r(k_wall,j) = c_tkef * fw03053 3155 ENDDO 3054 ENDIF 3055 3056 IF ( nest_bound_s ) THEN 3057 ALLOCATE( tkefactor_s(nzb:nzt+1,nxlg:nxrg) ) 3058 tkefactor_s = 0.0_wp 3059 j = nys - 1 3060 DO i = nxlg, nxrg 3061 k_wall = get_topography_top_index_ji( j, i, 's' ) 3062 3063 DO k = k_wall + 1, nzt 3064 3065 kc = kco(k) + 1 3066 glsf = ( dx * dy * dzu(k) )**p13 3067 glsc = ( cg%dx * cg%dy * cg%dzu(kc) ) ** p13 3068 height = zu(k) - zu(k_wall) 3069 fw = EXP( -cfw*height / glsf ) 3070 tkefactor_s(k,i) = c_tkef * ( fw0 * fw + ( 1.0_wp - fw ) * & 3071 ( glsf / glsc )**p23 ) 3072 ENDDO 3073 tkefactor_s(k_wall,i) = c_tkef * fw0 3074 ENDDO 3075 ENDIF 3076 3077 IF ( nest_bound_n ) THEN 3078 ALLOCATE( tkefactor_n(nzb:nzt+1,nxlg:nxrg) ) 3079 tkefactor_n = 0.0_wp 3080 j = nyn + 1 3081 DO i = nxlg, nxrg 3082 k_wall = get_topography_top_index_ji( j, i, 's' ) 3083 3084 DO k = k_wall + 1, nzt 3085 3086 kc = kco(k) + 1 3087 glsf = ( dx * dy * dzu(k) )**p13 3088 glsc = ( cg%dx * cg%dy * cg%dzu(kc) )**p13 3089 height = zu(k) - zu(k_wall) 3090 fw = EXP( -cfw * height / glsf ) 3091 tkefactor_n(k,i) = c_tkef * ( fw0 * fw + ( 1.0_wp - fw ) * & 3092 ( glsf / glsc )**p23 ) 3093 ENDDO 3094 tkefactor_n(k_wall,i) = c_tkef * fw0 3095 ENDDO 3096 ENDIF 3097 3098 ALLOCATE( tkefactor_t(nysg:nyng,nxlg:nxrg) ) 3099 k = nzt 3100 3101 DO i = nxlg, nxrg 3102 DO j = nysg, nyng 3103 ! 3104 !-- Determine vertical index for local topography top 3105 k_wall = get_topography_top_index_ji( j, i, 's' ) 3106 3107 kc = kco(k) + 1 3108 glsf = ( dx * dy * dzu(k) )**p13 3109 glsc = ( cg%dx * cg%dy * cg%dzu(kc) )**p13 3110 height = zu(k) - zu(k_wall) 3111 fw = EXP( -cfw * height / glsf ) 3112 tkefactor_t(j,i) = c_tkef * ( fw0 * fw + ( 1.0_wp - fw ) * & 3113 ( glsf / glsc )**p23 ) 3114 ENDDO 3115 ENDDO 3156 ! 3157 !-- RANS mode 3158 ELSE 3159 IF ( nest_bound_l ) THEN 3160 ALLOCATE( tkefactor_l(nzb:nzt+1,nysg:nyng) ) 3161 tkefactor_l = 1.0_wp 3162 ENDIF 3163 IF ( nest_bound_r ) THEN 3164 ALLOCATE( tkefactor_r(nzb:nzt+1,nysg:nyng) ) 3165 tkefactor_r = 1.0_wp 3166 ENDIF 3167 IF ( nest_bound_s ) THEN 3168 ALLOCATE( tkefactor_s(nzb:nzt+1,nxlg:nxrg) ) 3169 tkefactor_s = 1.0_wp 3170 ENDIF 3171 IF ( nest_bound_n ) THEN 3172 ALLOCATE( tkefactor_n(nzb:nzt+1,nxlg:nxrg) ) 3173 tkefactor_n = 1.0_wp 3174 ENDIF 3175 3176 ALLOCATE( tkefactor_t(nysg:nyng,nxlg:nxrg) ) 3177 tkefactor_t = 1.0_wp 3178 3179 ENDIF 3116 3180 3117 3181 END SUBROUTINE pmci_init_tkefactor … … 3177 3241 !-- List of array names, which can be coupled. 3178 3242 !-- In case of 3D please change also the second array for the pointer version 3179 IF ( TRIM(name) == "u" ) p_3d => u 3180 IF ( TRIM(name) == "v" ) p_3d => v 3181 IF ( TRIM(name) == "w" ) p_3d => w 3182 IF ( TRIM(name) == "e" ) p_3d => e 3183 IF ( TRIM(name) == "pt" ) p_3d => pt 3184 IF ( TRIM(name) == "q" ) p_3d => q 3185 IF ( TRIM(name) == "qc" ) p_3d => qc 3186 IF ( TRIM(name) == "qr" ) p_3d => qr 3187 IF ( TRIM(name) == "nr" ) p_3d => nr 3188 IF ( TRIM(name) == "nc" ) p_3d => nc 3189 IF ( TRIM(name) == "s" ) p_3d => s 3190 IF ( TRIM(name) == "nr_part" ) i_2d => nr_part 3191 IF ( TRIM(name) == "part_adr" ) i_2d => part_adr 3243 IF ( TRIM(name) == "u" ) p_3d => u 3244 IF ( TRIM(name) == "v" ) p_3d => v 3245 IF ( TRIM(name) == "w" ) p_3d => w 3246 IF ( TRIM(name) == "e" ) p_3d => e 3247 IF ( TRIM(name) == "pt" ) p_3d => pt 3248 IF ( TRIM(name) == "q" ) p_3d => q 3249 IF ( TRIM(name) == "qc" ) p_3d => qc 3250 IF ( TRIM(name) == "qr" ) p_3d => qr 3251 IF ( TRIM(name) == "nr" ) p_3d => nr 3252 IF ( TRIM(name) == "nc" ) p_3d => nc 3253 IF ( TRIM(name) == "s" ) p_3d => s 3254 IF ( TRIM(name) == "diss" ) p_3d => diss 3255 IF ( TRIM(name) == "nr_part" ) i_2d => nr_part 3256 IF ( TRIM(name) == "part_adr" ) i_2d => part_adr 3192 3257 IF ( INDEX( TRIM(name), "chem_" ) /= 0 ) p_3d => chem_species(n)%conc 3193 3258 … … 3219 3284 ENDIF 3220 3285 #else 3221 IF ( TRIM(name) == "u" ) p_3d_sec => u_2 3222 IF ( TRIM(name) == "v" ) p_3d_sec => v_2 3223 IF ( TRIM(name) == "w" ) p_3d_sec => w_2 3224 IF ( TRIM(name) == "e" ) p_3d_sec => e_2 3225 IF ( TRIM(name) == "pt" ) p_3d_sec => pt_2 3226 IF ( TRIM(name) == "q" ) p_3d_sec => q_2 3227 IF ( TRIM(name) == "qc" ) p_3d_sec => qc_2 3228 IF ( TRIM(name) == "qr" ) p_3d_sec => qr_2 3229 IF ( TRIM(name) == "nr" ) p_3d_sec => nr_2 3230 IF ( TRIM(name) == "nc" ) p_3d_sec => nc_2 3231 IF ( TRIM(name) == "s" ) p_3d_sec => s_2 3286 IF ( TRIM(name) == "u" ) p_3d_sec => u_2 3287 IF ( TRIM(name) == "v" ) p_3d_sec => v_2 3288 IF ( TRIM(name) == "w" ) p_3d_sec => w_2 3289 IF ( TRIM(name) == "e" ) p_3d_sec => e_2 3290 IF ( TRIM(name) == "pt" ) p_3d_sec => pt_2 3291 IF ( TRIM(name) == "q" ) p_3d_sec => q_2 3292 IF ( TRIM(name) == "qc" ) p_3d_sec => qc_2 3293 IF ( TRIM(name) == "qr" ) p_3d_sec => qr_2 3294 IF ( TRIM(name) == "nr" ) p_3d_sec => nr_2 3295 IF ( TRIM(name) == "nc" ) p_3d_sec => nc_2 3296 IF ( TRIM(name) == "s" ) p_3d_sec => s_2 3297 IF ( TRIM(name) == "diss" ) p_3d_sec => diss_2 3232 3298 IF ( INDEX( TRIM(name), "chem_" ) /= 0 ) p_3d_sec => spec_conc_2(:,:,:,n) 3233 3299 … … 3358 3424 IF ( .NOT. ALLOCATED( ec ) ) ALLOCATE( ec(0:nzc+1,js:je,is:ie) ) 3359 3425 p_3d => ec 3426 ELSEIF ( TRIM( name ) == "diss" ) THEN 3427 IF ( .NOT. ALLOCATED( dissc ) ) ALLOCATE( dissc(0:nzc+1,js:je,is:ie) ) 3428 p_3d => dissc 3360 3429 ELSEIF ( TRIM( name ) == "pt") THEN 3361 3430 IF ( .NOT. ALLOCATED( ptc ) ) ALLOCATE( ptc(0:nzc+1,js:je,is:ie) ) … … 3379 3448 IF ( .NOT. ALLOCATED( sc ) ) ALLOCATE( sc(0:nzc+1,js:je,is:ie) ) 3380 3449 p_3d => sc 3381 ELSEIF ( trim(name) == "nr_part") then3382 IF ( .not.allocated(nr_partc)) allocate(nr_partc(js:je, is:ie))3450 ELSEIF ( TRIM( name ) == "nr_part") THEN 3451 IF ( .NOT. ALLOCATED( nr_partc ) ) ALLOCATE( nr_partc(js:je,is:ie) ) 3383 3452 i_2d => nr_partc 3384 ELSEIF ( trim(name) == "part_adr") then3385 IF ( .not.allocated(part_adrc)) allocate(part_adrc(js:je, is:ie))3453 ELSEIF ( TRIM( name ) == "part_adr") THEN 3454 IF ( .NOT. ALLOCATED( part_adrc ) ) ALLOCATE( part_adrc(js:je,is:ie) ) 3386 3455 i_2d => part_adrc 3387 3456 ELSEIF ( TRIM( name(1:5) ) == "chem_" ) THEN … … 3484 3553 r2yo, r1zw, r2zw, 'w' ) 3485 3554 3486 IF ( .NOT. constant_diffusion ) THEN 3487 CALL pmci_interp_tril_all ( e, ec, ico, jco, kco, r1xo, r2xo, & 3488 r1yo, r2yo, r1zo, r2zo, 'e' ) 3489 ENDIF 3490 3555 IF ( ( rans_mode_parent .AND. rans_mode ) .OR. & 3556 ( .NOT. rans_mode_parent .AND. .NOT. rans_mode .AND. & 3557 .NOT. constant_diffusion ) ) THEN 3558 CALL pmci_interp_tril_all ( e, ec, ico, jco, kco, r1xo, r2xo, r1yo, & 3559 r2yo, r1zo, r2zo, 'e' ) 3560 ENDIF 3561 3562 IF ( rans_mode_parent .AND. rans_mode .AND. rans_tke_e ) THEN 3563 CALL pmci_interp_tril_all ( diss, dissc, ico, jco, kco, r1xo, r2xo,& 3564 r1yo, r2yo, r1zo, r2zo, 's' ) 3565 ENDIF 3566 3491 3567 IF ( .NOT. neutral ) THEN 3492 3568 CALL pmci_interp_tril_all ( pt, ptc, ico, jco, kco, r1xo, r2xo, & … … 4207 4283 nzt_topo_nestbc_l, 'l', 'w' ) 4208 4284 4209 IF ( .NOT. constant_diffusion ) THEN 4285 IF ( ( rans_mode_parent .AND. rans_mode ) .OR. & 4286 ( .NOT. rans_mode_parent .AND. .NOT. rans_mode .AND. & 4287 .NOT. constant_diffusion ) ) THEN 4210 4288 CALL pmci_interp_tril_lr( e, ec, ico, jco, kco, r1xo, r2xo, & 4211 4289 r1yo, r2yo, r1zo, r2zo, & … … 4214 4292 nzt_topo_nestbc_l, 'l', 'e' ) 4215 4293 ENDIF 4216 4294 4295 IF ( rans_mode_parent .AND. rans_mode .AND. rans_tke_e ) THEN 4296 CALL pmci_interp_tril_lr( diss, dissc, ico, jco, kco, r1xo, & 4297 r2xo, r1yo, r2yo, r1zo, r2zo, & 4298 logc_w_l, logc_ratio_w_l, & 4299 logc_kbounds_w_l, & 4300 nzt_topo_nestbc_l, 'l', 's' ) 4301 ENDIF 4302 4217 4303 IF ( .NOT. neutral ) THEN 4218 4304 CALL pmci_interp_tril_lr( pt, ptc, ico, jco, kco, r1xo, r2xo, & … … 4304 4390 nzt_topo_nestbc_r, 'r', 'w' ) 4305 4391 4306 IF ( .NOT. constant_diffusion ) THEN 4392 IF ( ( rans_mode_parent .AND. rans_mode ) .OR. & 4393 ( .NOT. rans_mode_parent .AND. .NOT. rans_mode .AND. & 4394 .NOT. constant_diffusion ) ) THEN 4307 4395 CALL pmci_interp_tril_lr( e, ec, ico, jco, kco, r1xo, r2xo, & 4308 4396 r1yo,r2yo, r1zo, r2zo, & … … 4310 4398 logc_kbounds_w_r, & 4311 4399 nzt_topo_nestbc_r, 'r', 'e' ) 4400 4401 ENDIF 4402 4403 IF ( rans_mode_parent .AND. rans_mode .AND. rans_tke_e ) THEN 4404 CALL pmci_interp_tril_lr( diss, dissc, ico, jco, kco, r1xo, & 4405 r2xo, r1yo,r2yo, r1zo, r2zo, & 4406 logc_w_r, logc_ratio_w_r, & 4407 logc_kbounds_w_r, & 4408 nzt_topo_nestbc_r, 'r', 's' ) 4409 4312 4410 ENDIF 4313 4411 … … 4382 4480 ENDDO 4383 4481 ENDIF 4384 4385 4482 ENDIF 4386 4483 ! … … 4406 4503 nzt_topo_nestbc_s, 's','w' ) 4407 4504 4408 IF ( .NOT. constant_diffusion ) THEN 4505 IF ( ( rans_mode_parent .AND. rans_mode ) .OR. & 4506 ( .NOT. rans_mode_parent .AND. .NOT. rans_mode .AND. & 4507 .NOT. constant_diffusion ) ) THEN 4409 4508 CALL pmci_interp_tril_sn( e, ec, ico, jco, kco, r1xo, r2xo, & 4410 4509 r1yo, r2yo, r1zo, r2zo, & … … 4412 4511 logc_kbounds_w_s, & 4413 4512 nzt_topo_nestbc_s, 's', 'e' ) 4513 4414 4514 ENDIF 4415 4515 4516 IF ( rans_mode_parent .AND. rans_mode .AND. rans_tke_e ) THEN 4517 CALL pmci_interp_tril_sn( diss, dissc, ico, jco, kco, r1xo, & 4518 r2xo, r1yo, r2yo, r1zo, r2zo, & 4519 logc_w_s, logc_ratio_w_s, & 4520 logc_kbounds_w_s, & 4521 nzt_topo_nestbc_s, 's', 's' ) 4522 4523 ENDIF 4524 4416 4525 IF ( .NOT. neutral ) THEN 4417 4526 CALL pmci_interp_tril_sn( pt, ptc, ico, jco, kco, r1xo, r2xo, & … … 4482 4591 ENDDO 4483 4592 ENDIF 4484 4485 4593 ENDIF 4486 4594 ! … … 4505 4613 logc_kbounds_w_n, & 4506 4614 nzt_topo_nestbc_n, 'n', 'w' ) 4507 IF ( .NOT. constant_diffusion ) THEN 4615 4616 IF ( ( rans_mode_parent .AND. rans_mode ) .OR. & 4617 ( .NOT. rans_mode_parent .AND. .NOT. rans_mode .AND. & 4618 .NOT. constant_diffusion ) ) THEN 4508 4619 CALL pmci_interp_tril_sn( e, ec, ico, jco, kco, r1xo, r2xo, & 4509 4620 r1yo, r2yo, r1zo, r2zo, & … … 4511 4622 logc_kbounds_w_n, & 4512 4623 nzt_topo_nestbc_n, 'n', 'e' ) 4624 4513 4625 ENDIF 4514 4626 4627 IF ( rans_mode_parent .AND. rans_mode .AND. rans_tke_e ) THEN 4628 CALL pmci_interp_tril_sn( diss, dissc, ico, jco, kco, r1xo, & 4629 r2xo, r1yo, r2yo, r1zo, r2zo, & 4630 logc_w_n, logc_ratio_w_n, & 4631 logc_kbounds_w_n, & 4632 nzt_topo_nestbc_n, 'n', 's' ) 4633 4634 ENDIF 4635 4515 4636 IF ( .NOT. neutral ) THEN 4516 4637 CALL pmci_interp_tril_sn( pt, ptc, ico, jco, kco, r1xo, r2xo, & … … 4581 4702 ENDDO 4582 4703 ENDIF 4583 4584 4704 ENDIF 4585 4705 … … 4593 4713 CALL pmci_interp_tril_t( w, wc, ico, jco, kcw, r1xo, r2xo, r1yo, & 4594 4714 r2yo, r1zw, r2zw, 'w' ) 4595 IF ( .NOT. constant_diffusion ) THEN 4715 4716 IF ( ( rans_mode_parent .AND. rans_mode ) .OR. & 4717 ( .NOT. rans_mode_parent .AND. .NOT. rans_mode .AND. & 4718 .NOT. constant_diffusion ) ) THEN 4596 4719 CALL pmci_interp_tril_t( e, ec, ico, jco, kco, r1xo, r2xo, r1yo, & 4597 4720 r2yo, r1zo, r2zo, 'e' ) 4598 4721 ENDIF 4722 4723 IF ( rans_mode_parent .AND. rans_mode .AND. rans_tke_e ) THEN 4724 CALL pmci_interp_tril_t( diss, dissc, ico, jco, kco, r1xo, r2xo, & 4725 r1yo, r2yo, r1zo, r2zo, 's' ) 4726 ENDIF 4727 4599 4728 IF ( .NOT. neutral ) THEN 4600 4729 CALL pmci_interp_tril_t( pt, ptc, ico, jco, kco, r1xo, r2xo, r1yo, & … … 4644 4773 ENDDO 4645 4774 ENDIF 4646 4775 4647 4776 END SUBROUTINE pmci_interpolation 4648 4777 … … 4666 4795 CALL pmci_anterp_tophat( w, wc, kctw, iflo, ifuo, jflo, jfuo, kflw, & 4667 4796 kfuw, ijfc_s, kfc_w, 'w' ) 4797 ! 4798 !-- Anterpolation of TKE and dissipation rate if parent and child are in 4799 !-- RANS mode. 4800 IF ( rans_mode_parent .AND. rans_mode ) THEN 4801 CALL pmci_anterp_tophat( e, ec, kctu, iflo, ifuo, jflo, jfuo, kflo, & 4802 kfuo, ijfc_s, kfc_s, 'e' ) 4803 ! 4804 !-- Anterpolation of dissipation rate only if TKE-e closure is applied. 4805 IF ( rans_tke_e ) THEN 4806 CALL pmci_anterp_tophat( diss, dissc, kctu, iflo, ifuo, jflo, jfuo,& 4807 kflo, kfuo, ijfc_s, kfc_s, 'diss' ) 4808 ENDIF 4809 4810 ENDIF 4668 4811 4669 4812 IF ( .NOT. neutral ) THEN … … 5569 5712 END SUBROUTINE pmci_boundary_conds 5570 5713 5714 5571 5715 END MODULE pmc_interface -
palm/trunk/SOURCE/pmc_mpi_wrapper_mod.f90
r2841 r2938 26 26 ! ----------------- 27 27 ! $Id$ 28 ! Extent interface by logical buffer 29 ! 30 ! 2936 2018-03-27 14:49:27Z suehring 28 31 ! Bugfix: wrong placement of include 'mpif.h' corrected 29 32 ! … … 103 106 104 107 INTERFACE pmc_recv_from_parent 108 MODULE PROCEDURE pmc_recv_from_parent_logical 105 109 MODULE PROCEDURE pmc_recv_from_parent_integer 106 110 MODULE PROCEDURE pmc_recv_from_parent_real_r1 … … 110 114 111 115 INTERFACE pmc_send_to_child 116 MODULE PROCEDURE pmc_send_to_child_logical 112 117 MODULE PROCEDURE pmc_send_to_child_integer 113 118 MODULE PROCEDURE pmc_send_to_child_real_r1 … … 149 154 150 155 156 SUBROUTINE pmc_recv_from_parent_logical( buf, n, parent_rank, tag, ierr ) 157 158 IMPLICIT NONE 159 160 INTEGER, INTENT(IN) :: n !< 161 INTEGER, INTENT(IN) :: parent_rank !< 162 INTEGER, INTENT(IN) :: tag !< 163 INTEGER, INTENT(OUT) :: ierr !< 164 165 LOGICAL, INTENT(OUT) :: buf !< 166 167 ierr = 0 168 CALL MPI_RECV( buf, n, MPI_LOGICAL, parent_rank, tag, m_to_parent_comm, & 169 MPI_STATUS_IGNORE, ierr ) 170 171 END SUBROUTINE pmc_recv_from_parent_logical 172 173 SUBROUTINE pmc_send_to_child_logical( child_id, buf, n, child_rank, tag, & 174 ierr ) 175 176 IMPLICIT NONE 177 178 INTEGER, INTENT(IN) :: child_id !< 179 INTEGER, INTENT(IN) :: n !< 180 INTEGER, INTENT(IN) :: child_rank !< 181 INTEGER, INTENT(IN) :: tag !< 182 INTEGER, INTENT(OUT) :: ierr !< 183 184 LOGICAL, INTENT(IN) :: buf !< 185 186 ierr = 0 187 CALL MPI_SEND( buf, n, MPI_LOGICAL, child_rank, tag, & 188 m_to_child_comm(child_id), ierr ) 189 190 END SUBROUTINE pmc_send_to_child_logical 191 192 151 193 SUBROUTINE pmc_send_to_parent_integer( buf, n, parent_rank, tag, ierr ) 152 194 … … 167 209 168 210 169 170 211 SUBROUTINE pmc_recv_from_parent_integer( buf, n, parent_rank, tag, ierr ) 171 212 … … 312 353 313 354 END SUBROUTINE pmc_recv_from_parent_real_r3 314 315 355 316 356 -
palm/trunk/SOURCE/synthetic_turbulence_generator_mod.f90
r2894 r2938 25 25 ! ----------------- 26 26 ! $Id$ 27 ! Apply turbulence generator at all non-cyclic lateral boundaries in case of 28 ! realistic Inifor large-scale forcing or RANS-LES nesting 29 ! 30 ! 2936 2018-03-27 14:49:27Z suehring 27 31 ! variable named found has been introduced for checking if restart data was found, 28 32 ! reading of restart strings has been moved completely to read_restart_data_mod, … … 101 105 102 106 USE control_parameters, & 103 ONLY: initializing_actions, message_string, & 104 syn_turb_gen 107 ONLY: initializing_actions, message_string, syn_turb_gen 105 108 106 109 USE cpulog, & … … 108 111 109 112 USE indices, & 110 ONLY: nbgp, nzb, nzt, n yng, nysg113 ONLY: nbgp, nzb, nzt, nxl, nxlg, nxr, nxrg, nys, nyn, nyng, nysg 111 114 112 115 USE kinds … … 117 120 118 121 USE pegrid, & 119 ONLY: comm1dx, comm1dy, comm2d, i d_inflow, ierr, myidx, pdims122 ONLY: comm1dx, comm1dy, comm2d, ierr, myidx, myidy, pdims 120 123 121 124 USE transpose_indices, & … … 132 135 LOGICAL :: use_syn_turb_gen = .FALSE. !< switch to use synthetic turbulence generator 133 136 134 INTEGER(iwp) :: stg_type_yz !< MPI type for full z range 135 INTEGER(iwp) :: stg_type_yz_small !< MPI type for small z range 136 INTEGER(iwp) :: merg !< maximum length scale (in gp) 137 INTEGER(iwp) :: mergp !< merg + nbgp 137 INTEGER(iwp) :: id_stg_left !< left lateral boundary core id in case of turbulence generator 138 INTEGER(iwp) :: id_stg_north !< north lateral boundary core id in case of turbulence generator 139 INTEGER(iwp) :: id_stg_right !< right lateral boundary core id in case of turbulence generator 140 INTEGER(iwp) :: id_stg_south !< south lateral boundary core id in case of turbulence generator 141 INTEGER(iwp) :: stg_type_xz !< MPI type for full z range 142 INTEGER(iwp) :: stg_type_xz_small !< MPI type for small z range 143 INTEGER(iwp) :: stg_type_yz !< MPI type for full z range 144 INTEGER(iwp) :: stg_type_yz_small !< MPI type for small z range 145 INTEGER(iwp) :: merg !< maximum length scale (in gp) 146 INTEGER(iwp) :: mergp !< merg + nbgp 147 INTEGER(iwp) :: nzb_x_stg !< 148 INTEGER(iwp) :: nzt_x_stg !< 149 INTEGER(iwp) :: nzb_y_stg !< 150 INTEGER(iwp) :: nzt_y_stg !< 138 151 139 152 REAL(wp) :: mc_factor !< mass flux correction factor 140 153 141 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: displs !< displacement for MPI_GATHERV 142 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: recv_count !< receive count for MPI_GATHERV 143 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: nuy !< length scale of u in y direction (in gp) 144 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: nuz !< length scale of u in z direction (in gp) 145 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: nvy !< length scale of v in y direction (in gp) 146 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: nvz !< length scale of v in z direction (in gp) 147 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: nwy !< length scale of w in y direction (in gp) 148 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: nwz !< length scale of w in z direction (in gp) 154 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: displs_xz !< displacement for MPI_GATHERV 155 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: recv_count_xz !< receive count for MPI_GATHERV 156 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: displs_yz !< displacement for MPI_GATHERV 157 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: recv_count_yz !< receive count for MPI_GATHERV 158 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: nux !< length scale of u in x direction (in gp) 159 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: nuy !< length scale of u in y direction (in gp) 160 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: nuz !< length scale of u in z direction (in gp) 161 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: nvx !< length scale of v in x direction (in gp) 162 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: nvy !< length scale of v in y direction (in gp) 163 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: nvz !< length scale of v in z direction (in gp) 164 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: nwx !< length scale of w in x direction (in gp) 165 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: nwy !< length scale of w in y direction (in gp) 166 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: nwz !< length scale of w in z direction (in gp) 149 167 150 168 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: seed !< seed of random number for rn-generator … … 160 178 REAL(wp), DIMENSION(:), ALLOCATABLE :: tw !< Lagrangian time scale of w 161 179 180 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: bux !< filter function for u in x direction 162 181 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: buy !< filter function for u in y direction 163 182 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: buz !< filter function for u in z direction 183 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: bvx !< filter function for v in x direction 164 184 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: bvy !< filter function for v in y direction 165 185 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: bvz !< filter function for v in z direction 186 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: bwx !< filter function for w in y direction 166 187 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: bwy !< filter function for w in y direction 167 188 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: bwz !< filter function for w in z direction 168 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: fu !< velocity seed for u 169 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: fuo !< velocity seed for u with new random number 170 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: fv !< velocity seed for v 171 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: fvo !< velocity seed for v with new random number 172 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: fw !< velocity seed for w 173 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: fwo !< velocity seed for w with new random number 189 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: fu_xz !< velocity seed for u at xz plane 190 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: fuo_xz !< velocity seed for u at xz plane with new random number 191 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: fu_yz !< velocity seed for u at yz plane 192 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: fuo_yz !< velocity seed for u at yz plane with new random number 193 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: fv_xz !< velocity seed for v at xz plane 194 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: fvo_xz !< velocity seed for v at xz plane with new random number 195 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: fv_yz !< velocity seed for v at yz plane 196 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: fvo_yz !< velocity seed for v at yz plane with new random number 197 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: fw_xz !< velocity seed for w at xz plane 198 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: fwo_xz !< velocity seed for w at xz plane with new random number 199 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: fw_yz !< velocity seed for w at yz plane 200 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: fwo_yz !< velocity seed for w at yz plane with new random number 174 201 175 202 … … 188 215 189 216 ! 190 !-- Generate velocity seeds 217 !-- Generate velocity seeds at south and north domain boundary 218 INTERFACE stg_generate_seed_xz 219 MODULE PROCEDURE stg_generate_seed_xz 220 END INTERFACE stg_generate_seed_xz 221 ! 222 !-- Generate velocity seeds at left and/or right domain boundary 191 223 INTERFACE stg_generate_seed_yz 192 224 MODULE PROCEDURE stg_generate_seed_yz … … 240 272 ! 241 273 !-- Public variables 242 PUBLIC use_syn_turb_gen 274 PUBLIC id_stg_left, id_stg_north, id_stg_right, id_stg_south, & 275 use_syn_turb_gen 243 276 244 277 … … 255 288 256 289 USE control_parameters, & 257 ONLY: bc_lr, bc_ns, turbulent_inflow 290 ONLY: bc_lr, bc_ns, forcing, nest_domain, rans_mode, turbulent_inflow 291 292 USE pmc_interface, & 293 ONLY : rans_mode_parent 258 294 259 295 260 296 IMPLICIT NONE 261 297 298 IF ( .NOT. use_syn_turb_gen .AND. .NOT. rans_mode .AND. forcing ) THEN 299 message_string = 'Synthetic turbulence generator has to be applied ' // & 300 'when forcing is used and model operates in LES mode.' 301 CALL message( 'stg_check_parameters', 'PA0000', 1, 2, 0, 6, 0 ) 302 ENDIF 303 304 IF ( .NOT. use_syn_turb_gen .AND. nest_domain & 305 .AND. rans_mode_parent .AND. .NOT. rans_mode ) THEN 306 message_string = 'Synthetic turbulence generator has to be applied ' // & 307 'when nesting is applied and parent operates in ' // & 308 'RANS-mode but current child in LES mode.' 309 CALL message( 'stg_check_parameters', 'PA0000', 1, 2, 0, 6, 0 ) 310 ENDIF 311 262 312 IF ( use_syn_turb_gen ) THEN 263 313 264 IF ( INDEX( initializing_actions, 'set_constant_profiles' ) == 0 .AND. & 265 INDEX( initializing_actions, 'read_restart_data' ) == 0 ) THEN 266 message_string = 'Using synthetic turbulence generator ' // & 267 'requires &initializing_actions = ' // & 268 '"set_constant_profiles" or "read_restart_data"' 269 CALL message( 'stg_check_parameters', 'PA0015', 1, 2, 0, 6, 0 ) 314 IF ( .NOT. forcing .AND. .NOT. nest_domain ) THEN 315 316 IF ( INDEX( initializing_actions, 'set_constant_profiles' ) == 0 & 317 .AND. INDEX( initializing_actions, 'read_restart_data' ) == 0 ) THEN 318 message_string = 'Using synthetic turbulence generator ' // & 319 'requires &initializing_actions = ' // & 320 '"set_constant_profiles" or "read_restart_data"' 321 CALL message( 'stg_check_parameters', 'PA0015', 1, 2, 0, 6, 0 ) 322 ENDIF 323 324 IF ( bc_lr /= 'dirichlet/radiation' ) THEN 325 message_string = 'Using synthetic turbulence generator ' // & 326 'requires &bc_lr = "dirichlet/radiation"' 327 CALL message( 'stg_check_parameters', 'PA0035', 1, 2, 0, 6, 0 ) 328 ENDIF 329 IF ( bc_ns /= 'cyclic' ) THEN 330 message_string = 'Using synthetic turbulence generator ' // & 331 'requires &bc_ns = "cyclic"' 332 CALL message( 'stg_check_parameters', 'PA0037', 1, 2, 0, 6, 0 ) 333 ENDIF 334 270 335 ENDIF 271 336 272 IF ( bc_lr /= 'dirichlet/radiation' ) THEN273 message_string = 'Using synthetic turbulence generator ' // &274 'requires &bc_lr = "dirichlet/radiation"'275 CALL message( 'stg_check_parameters', 'PA0035', 1, 2, 0, 6, 0 )276 ENDIF277 IF ( bc_ns /= 'cyclic' ) THEN278 message_string = 'Using synthetic turbulence generator ' // &279 'requires &bc_ns = "cyclic"'280 CALL message( 'stg_check_parameters', 'PA0037', 1, 2, 0, 6, 0 )281 ENDIF282 337 IF ( turbulent_inflow ) THEN 283 338 message_string = 'Using synthetic turbulence generator ' // & 284 'in combination &with turbulent_inflow = .T. ' //&285 'is not allowed'339 'in combination &with turbulent_inflow = .T. '// & 340 'is not allowed' 286 341 CALL message( 'stg_check_parameters', 'PA0039', 1, 2, 0, 6, 0 ) 287 342 ENDIF … … 330 385 331 386 USE arrays_3d, & 332 ONLY: u_init, v_init387 ONLY: ddzw, u_init, v_init, zu 333 388 334 389 USE control_parameters, & 335 ONLY: coupling_char, dz, e_init 390 ONLY: coupling_char, dz, e_init, forcing, nest_domain 336 391 337 392 USE grid_variables, & 338 ONLY: ddy 393 ONLY: ddx, ddy 394 395 USE indices, & 396 ONLY: nz 339 397 340 398 341 399 IMPLICIT NONE 400 401 LOGICAL :: file_stg_exist = .FALSE. !< flag indication whether parameter file for Reynolds stress and length scales exist 342 402 343 403 #if defined( __parallel ) … … 346 406 #endif 347 407 408 INTEGER(iwp) :: i !> grid index in x-direction 348 409 INTEGER(iwp) :: j !> loop index 349 410 INTEGER(iwp) :: k !< index 350 411 INTEGER(iwp) :: newtype !< dummy MPI type 351 412 INTEGER(iwp) :: realsize !< size of REAL variables 413 INTEGER(iwp) :: nnz !< increment used to determine processor decomposition of z-axis along x and y direction 352 414 INTEGER(iwp) :: nseed !< dimension of random number seed 353 415 INTEGER(iwp) :: startseed = 1234567890 !< start seed for random number generator … … 362 424 REAL(wp) :: d21 !< vertical interpolation for a21 363 425 REAL(wp) :: d22 !< vertical interpolation for a22 426 REAL(wp) :: dum_exp !< dummy variable used for exponential vertical decrease of turbulent length scales 364 427 REAL(wp) :: luy !< length scale for u in y direction 365 428 REAL(wp) :: luz !< length scale for u in z direction … … 370 433 REAL(wp) :: zz !< height 371 434 435 REAL(wp) :: length_scale_surface, r_ii_0, time_scale, length_scale_z 436 372 437 REAL(wp),DIMENSION(nzb:nzt+1) :: r11 !< Reynolds parameter 373 438 REAL(wp),DIMENSION(nzb:nzt+1) :: r21 !< Reynolds parameter … … 389 454 ALLOCATE ( a11(nzb:nzt+1), a21(nzb:nzt+1), a22(nzb:nzt+1), & 390 455 a31(nzb:nzt+1), a32(nzb:nzt+1), a33(nzb:nzt+1), & 391 nuy(nzb:nzt+1), nuz(nzb:nzt+1), nvy(nzb:nzt+1), & 392 nvz(nzb:nzt+1), nwy(nzb:nzt+1), nwz(nzb:nzt+1), & 456 nux(nzb:nzt+1), nuy(nzb:nzt+1), nuz(nzb:nzt+1), & 457 nvx(nzb:nzt+1), nvy(nzb:nzt+1), nvz(nzb:nzt+1), & 458 nwx(nzb:nzt+1), nwy(nzb:nzt+1), nwz(nzb:nzt+1), & 393 459 tu(nzb:nzt+1), tv(nzb:nzt+1), tw(nzb:nzt+1) ) 394 460 395 461 #if defined( __parallel ) 462 ! 463 !-- Determine processor decomposition of z-axis along x- and y-direction 464 nnz = nz / pdims(1) 465 nzb_x_stg = 1 + myidx * nnz 466 nzt_x_stg = ( myidx + 1 ) * nnz 467 468 IF ( MOD( nz , pdims(1) ) /= 0 .AND. myidx == id_stg_right ) & 469 nzt_x_stg = myidx * nnz + MOD( nz , pdims(1) ) 470 471 IF ( forcing .OR. nest_domain ) THEN 472 nnz = nz / pdims(2) 473 nzb_y_stg = 1 + myidy * nnz 474 nzt_y_stg = ( myidy + 1 ) * nnz 475 476 IF ( MOD( nz , pdims(2) ) /= 0 .AND. myidy == id_stg_north ) & 477 nzt_y_stg = myidy * nnz + MOD( nz , pdims(2) ) 478 ENDIF 479 396 480 ! 397 481 !-- Define MPI type used in stg_generate_seed_yz to gather vertical splitted … … 399 483 CALL MPI_TYPE_SIZE( MPI_REAL, realsize, ierr ) 400 484 extent = 1 * realsize 401 402 ! stg_type_yz: yz-slice with vertical bounds nzb:nzt+1 485 ! 486 !-- Set-up MPI datatyp to involve all cores for turbulence generation at yz 487 !-- layer 488 !-- stg_type_yz: yz-slice with vertical bounds nzb:nzt+1 403 489 CALL MPI_TYPE_CREATE_SUBARRAY( 2, [nzt-nzb+2,nyng-nysg+1], & 404 490 [1,nyng-nysg+1], [0,0], MPI_ORDER_FORTRAN, MPI_REAL, newtype, ierr ) … … 407 493 CALL MPI_TYPE_FREE( newtype, ierr ) 408 494 409 ! stg_type_yz_small: yz-slice with vertical bounds nzb_x :nzt_x+1410 CALL MPI_TYPE_CREATE_SUBARRAY( 2, [nzt_x -nzb_x+2,nyng-nysg+1], &495 ! stg_type_yz_small: yz-slice with vertical bounds nzb_x_stg:nzt_x_stg+1 496 CALL MPI_TYPE_CREATE_SUBARRAY( 2, [nzt_x_stg-nzb_x_stg+2,nyng-nysg+1], & 411 497 [1,nyng-nysg+1], [0,0], MPI_ORDER_FORTRAN, MPI_REAL, newtype, ierr ) 412 498 CALL MPI_TYPE_CREATE_RESIZED( newtype, tob, extent, stg_type_yz_small, ierr ) … … 415 501 416 502 ! receive count and displacement for MPI_GATHERV in stg_generate_seed_yz 417 ALLOCATE( recv_count (pdims(1)), displs(pdims(1)) )418 419 recv_count = nzt_x-nzb_x+ 1420 recv_count (pdims(1)) = recv_count(pdims(1)) + 1503 ALLOCATE( recv_count_yz(pdims(1)), displs_yz(pdims(1)) ) 504 505 recv_count_yz = nzt_x_stg-nzb_x_stg + 1 506 recv_count_yz(pdims(1)) = recv_count_yz(pdims(1)) + 1 421 507 422 508 DO j = 1, pdims(1) 423 displs(j) = 0 + (nzt_x-nzb_x+1) * (j-1) 424 ENDDO 509 displs_yz(j) = 0 + (nzt_x_stg-nzb_x_stg+1) * (j-1) 510 ENDDO 511 ! 512 !-- Set-up MPI datatyp to involve all cores for turbulence generation at xz 513 !-- layer 514 !-- stg_type_xz: xz-slice with vertical bounds nzb:nzt+1 515 IF ( forcing .OR. nest_domain) THEN 516 CALL MPI_TYPE_CREATE_SUBARRAY( 2, [nzt-nzb+2,nxrg-nxlg+1], & 517 [1,nxrg-nxlg+1], [0,0], MPI_ORDER_FORTRAN, MPI_REAL, newtype, ierr ) 518 CALL MPI_TYPE_CREATE_RESIZED( newtype, tob, extent, stg_type_xz, ierr ) 519 CALL MPI_TYPE_COMMIT( stg_type_xz, ierr ) 520 CALL MPI_TYPE_FREE( newtype, ierr ) 521 522 ! stg_type_yz_small: xz-slice with vertical bounds nzb_x_stg:nzt_x_stg+1 523 CALL MPI_TYPE_CREATE_SUBARRAY( 2, [nzt_y_stg-nzb_y_stg+2,nxrg-nxlg+1], & 524 [1,nxrg-nxlg+1], [0,0], MPI_ORDER_FORTRAN, MPI_REAL, newtype, ierr ) 525 CALL MPI_TYPE_CREATE_RESIZED( newtype, tob, extent, stg_type_xz_small, ierr ) 526 CALL MPI_TYPE_COMMIT( stg_type_xz_small, ierr ) 527 CALL MPI_TYPE_FREE( newtype, ierr ) 528 529 ! receive count and displacement for MPI_GATHERV in stg_generate_seed_yz 530 ALLOCATE( recv_count_xz(pdims(2)), displs_xz(pdims(2)) ) 531 532 recv_count_xz = nzt_y_stg-nzb_y_stg + 1 533 recv_count_xz(pdims(2)) = recv_count_xz(pdims(2)) + 1 534 535 DO j = 1, pdims(2) 536 displs_xz(j) = 0 + (nzt_y_stg-nzb_y_stg+1) * (j-1) 537 ENDDO 538 539 ENDIF 540 425 541 #endif 426 427 542 ! 428 543 !-- Define seed of random number … … 435 550 CALL RANDOM_SEED(put=seed) 436 551 437 !438 552 !-- Read inflow profile 439 553 !-- Height levels of profiles in input profile is as follows: … … 441 555 !-- zw: lwy, lwz, tw, r31, r32, r33, d3 442 556 !-- WARNING: zz is not used at the moment 443 OPEN( 90, FILE='STG_PROFILES'//TRIM( coupling_char ), STATUS='OLD', & 444 FORM='FORMATTED') 445 446 ! Skip header 447 READ( 90, * ) 448 449 DO k = nzb, nzt+1 450 READ( 90, * ) zz, luy, luz, tu(k), lvy, lvz, tv(k), lwy, lwz, tw(k), & 451 r11(k), r21(k), r22(k), r31(k), r32(k), r33(k), & 452 d1, d2, d3, d5 453 454 ! 455 !-- Convert length scales from meter to number of grid points 456 nuy(k) = INT( luy * ddy ) 457 nuz(k) = INT( luz / dz ) 458 nvy(k) = INT( lvy * ddy ) 459 nvz(k) = INT( lvz / dz ) 460 nwy(k) = INT( lwy * ddy ) 461 nwz(k) = INT( lwz / dz ) 462 463 ! 464 !-- Save Mean inflow profiles 465 IF ( TRIM( initializing_actions ) /= 'read_restart_data' ) THEN 466 mean_inflow_profiles(k,1) = d1 467 mean_inflow_profiles(k,2) = d2 468 ! mean_inflow_profiles(k,4) = d4 469 mean_inflow_profiles(k,5) = d5 470 ENDIF 471 ENDDO 472 473 CLOSE( 90 ) 474 475 ! 476 !-- Assign initial profiles 477 u_init = mean_inflow_profiles(:,1) 478 v_init = mean_inflow_profiles(:,2) 479 ! pt_init = mean_inflow_profiles(:,4) 480 e_init = MAXVAL( mean_inflow_profiles(:,5) ) 481 557 INQUIRE( FILE = 'STG_PROFILES' // TRIM( coupling_char ), & 558 EXIST = file_stg_exist ) 559 560 IF ( file_stg_exist ) THEN 561 562 OPEN( 90, FILE='STG_PROFILES'//TRIM( coupling_char ), STATUS='OLD', & 563 FORM='FORMATTED') 564 ! 565 !-- Skip header 566 READ( 90, * ) 567 568 DO k = nzb, nzt+1 569 READ( 90, * ) zz, luy, luz, tu(k), lvy, lvz, tv(k), lwy, lwz, tw(k), & 570 r11(k), r21(k), r22(k), r31(k), r32(k), r33(k), & 571 d1, d2, d3, d5 572 573 ! 574 !-- Convert length scales from meter to number of grid points 575 nuy(k) = INT( luy * ddy ) 576 nuz(k) = INT( luz / dz ) 577 nvy(k) = INT( lvy * ddy ) 578 nvz(k) = INT( lvz / dz ) 579 nwy(k) = INT( lwy * ddy ) 580 nwz(k) = INT( lwz / dz ) 581 ! 582 !-- Workaround, assume isotropic turbulence 583 nwx(k) = nwy(k) 584 nvx(k) = nvy(k) 585 nux(k) = nuy(k) 586 ! 587 !-- Save Mean inflow profiles 588 IF ( TRIM( initializing_actions ) /= 'read_restart_data' ) THEN 589 mean_inflow_profiles(k,1) = d1 590 mean_inflow_profiles(k,2) = d2 591 ! mean_inflow_profiles(k,4) = d4 592 mean_inflow_profiles(k,5) = d5 593 ENDIF 594 ENDDO 595 596 CLOSE( 90 ) 597 598 ELSE 599 ! 600 !-- Set-up defaul length scales. Assume exponentially decreasing length 601 !-- scales and isotropic turbulence. 602 !-- Typical length (time) scales of 100 m (s) should be a goog compromise 603 !-- between all stratrifications. Near-surface variances are fixed to 604 !-- 0.1 m2/s2, vertical fluxes are one order of magnitude smaller. 605 !-- Vertical fluxes 606 length_scale_surface = 100.0_wp 607 r_ii_0 = 0.1_wp 608 time_scale = 100.0_wp 609 DO k = nzb+1, nzt+1 610 dum_exp = MERGE( -zu(k) / ( 0.3* zu(nzt) ), & 611 0.0_wp, & 612 zu(k) > 0.3 * zu(nzt) & 613 ) 614 length_scale_z = length_scale_surface * EXP( dum_exp ) 615 616 nux(k) = MAX( INT( length_scale_z * ddx ), 1 ) 617 nuy(k) = MAX( INT( length_scale_z * ddy ), 1 ) 618 nuz(k) = MAX( INT( length_scale_z * ddzw(k) ), 1 ) 619 nvx(k) = MAX( INT( length_scale_z * ddx ), 1 ) 620 nvy(k) = MAX( INT( length_scale_z * ddy ), 1 ) 621 nvz(k) = MAX( INT( length_scale_z * ddzw(k) ), 1 ) 622 nwx(k) = MAX( INT( length_scale_z * ddx ), 1 ) 623 nwy(k) = MAX( INT( length_scale_z * ddy ), 1 ) 624 nwz(k) = MAX( INT( length_scale_z * ddzw(k) ), 1 ) 625 626 r11(k) = r_ii_0 * EXP( dum_exp ) 627 r22(k) = r_ii_0 * EXP( dum_exp ) 628 r33(k) = r_ii_0 * EXP( dum_exp ) 629 630 r21(k) = 0.1_wp * r_ii_0 * EXP( dum_exp ) 631 r31(k) = 0.1_wp * r_ii_0 * EXP( dum_exp ) 632 r32(k) = 0.1_wp * r_ii_0 * EXP( dum_exp ) 633 634 tu(k) = time_scale 635 tv(k) = time_scale 636 tw(k) = time_scale 637 638 ENDDO 639 nux(nzb) = nux(nzb+1) 640 nuy(nzb) = nuy(nzb+1) 641 nuz(nzb) = nuz(nzb+1) 642 nvx(nzb) = nvx(nzb+1) 643 nvy(nzb) = nvy(nzb+1) 644 nvz(nzb) = nvz(nzb+1) 645 nwx(nzb) = nwx(nzb+1) 646 nwy(nzb) = nwy(nzb+1) 647 nwz(nzb) = nwz(nzb+1) 648 649 r11(nzb) = r11(nzb+1) 650 r22(nzb) = r22(nzb+1) 651 r33(nzb) = r33(nzb+1) 652 653 r21(nzb) = r11(nzb+1) 654 r31(nzb) = r31(nzb+1) 655 r32(nzb) = r32(nzb+1) 656 657 tu(nzb) = time_scale 658 tv(nzb) = time_scale 659 tw(nzb) = time_scale 660 661 ENDIF 662 663 ! 664 !-- Assign initial profiles 665 IF ( .NOT. forcing .AND. .NOT. nest_domain ) THEN 666 u_init = mean_inflow_profiles(:,1) 667 v_init = mean_inflow_profiles(:,2) 668 !pt_init = mean_inflow_profiles(:,4) 669 e_init = MAXVAL( mean_inflow_profiles(:,5) ) 670 ENDIF 482 671 ! 483 672 !-- Calculate coefficient matrix from Reynolds stress tensor (Lund rotation) … … 534 723 535 724 ENDDO 536 537 725 ! 538 726 !-- Define the size of the filter functions and allocate them. … … 541 729 ! arrays must be large enough to cover the largest length scale 542 730 DO k = nzb, nzt+1 543 j = MAX( ABS(nu y(k)), ABS(nuz(k)), &544 ABS(nv y(k)), ABS(nvz(k)), &545 ABS(nw y(k)), ABS(nwz(k)) )731 j = MAX( ABS(nux(k)), ABS(nuy(k)), ABS(nuz(k)), & 732 ABS(nvx(k)), ABS(nvy(k)), ABS(nvz(k)), & 733 ABS(nwx(k)), ABS(nwy(k)), ABS(nwz(k)) ) 546 734 IF ( j > merg ) merg = j 547 735 ENDDO … … 550 738 mergp = merg + nbgp 551 739 552 ALLOCATE ( buy(-merg:merg,nzb:nzt+1), buz(-merg:merg,nzb:nzt+1), & 553 bvy(-merg:merg,nzb:nzt+1), bvz(-merg:merg,nzb:nzt+1), & 554 bwy(-merg:merg,nzb:nzt+1), bwz(-merg:merg,nzb:nzt+1) ) 555 556 ! 557 !-- Allocate velocity seeds 558 ALLOCATE ( fu( nzb:nzt+1,nysg:nyng), fuo(nzb:nzt+1,nysg:nyng), & 559 fv( nzb:nzt+1,nysg:nyng), fvo(nzb:nzt+1,nysg:nyng), & 560 fw( nzb:nzt+1,nysg:nyng), fwo(nzb:nzt+1,nysg:nyng) ) 561 562 fu = 0._wp 563 fuo = 0._wp 564 fv = 0._wp 565 fvo = 0._wp 566 fw = 0._wp 567 fwo = 0._wp 740 ALLOCATE ( bux(-merg:merg,nzb:nzt+1), & 741 buy(-merg:merg,nzb:nzt+1), & 742 buz(-merg:merg,nzb:nzt+1), & 743 bvx(-merg:merg,nzb:nzt+1), & 744 bvy(-merg:merg,nzb:nzt+1), & 745 bvz(-merg:merg,nzb:nzt+1), & 746 bwx(-merg:merg,nzb:nzt+1), & 747 bwy(-merg:merg,nzb:nzt+1), & 748 bwz(-merg:merg,nzb:nzt+1) ) 749 750 ! 751 !-- Allocate velocity seeds for turbulence at xz-layer 752 ALLOCATE ( fu_xz( nzb:nzt+1,nxlg:nxrg), fuo_xz(nzb:nzt+1,nxlg:nxrg), & 753 fv_xz( nzb:nzt+1,nxlg:nxrg), fvo_xz(nzb:nzt+1,nxlg:nxrg), & 754 fw_xz( nzb:nzt+1,nxlg:nxrg), fwo_xz(nzb:nzt+1,nxlg:nxrg) ) 755 756 ! 757 !-- Allocate velocity seeds for turbulence at yz-layer 758 ALLOCATE ( fu_yz( nzb:nzt+1,nysg:nyng), fuo_yz(nzb:nzt+1,nysg:nyng), & 759 fv_yz( nzb:nzt+1,nysg:nyng), fvo_yz(nzb:nzt+1,nysg:nyng), & 760 fw_yz( nzb:nzt+1,nysg:nyng), fwo_yz(nzb:nzt+1,nysg:nyng) ) 761 762 fu_xz = 0.0_wp 763 fuo_xz = 0.0_wp 764 fv_xz = 0.0_wp 765 fvo_xz = 0.0_wp 766 fw_xz = 0.0_wp 767 fwo_xz = 0.0_wp 768 769 fu_yz = 0.0_wp 770 fuo_yz = 0.0_wp 771 fv_yz = 0.0_wp 772 fvo_yz = 0.0_wp 773 fw_yz = 0.0_wp 774 fwo_yz = 0.0_wp 568 775 569 776 ! 570 777 !-- Create filter functions 778 CALL stg_filter_func( nux, bux ) !filter ux 571 779 CALL stg_filter_func( nuy, buy ) !filter uy 572 780 CALL stg_filter_func( nuz, buz ) !filter uz 781 CALL stg_filter_func( nvx, bvx ) !filter vx 573 782 CALL stg_filter_func( nvy, bvy ) !filter vy 574 783 CALL stg_filter_func( nvz, bvz ) !filter vz 784 CALL stg_filter_func( nwx, bwx ) !filter wx 575 785 CALL stg_filter_func( nwy, bwy ) !filter wy 576 786 CALL stg_filter_func( nwz, bwz ) !filter wz … … 581 791 582 792 ! 583 !-- 584 ! 585 ! 586 ! 793 !-- In case of restart, calculate velocity seeds fu, fv, fw from former 794 ! time step. 795 ! Bug: fu, fv, fw are different in those heights where a11, a22, a33 796 ! are 0 compared to the prerun. This is mostly for k=nzt+1. 587 797 IF ( TRIM( initializing_actions ) == 'read_restart_data' ) THEN 588 IF ( myidx == id_inflow ) THEN 798 IF ( myidx == id_stg_left .OR. myidx == id_stg_right ) THEN 799 800 IF ( myidx == id_stg_left ) i = -1 801 IF ( myidx == id_stg_right ) i = nxr+1 802 589 803 DO j = nysg, nyng 590 804 DO k = nzb, nzt+1 591 805 592 806 IF ( a11(k) .NE. 0._wp ) THEN 593 fu(k,j) = ( u(k,j,-1) / mc_factor - & 594 mean_inflow_profiles(k,1) ) / a11(k) 807 fu_yz(k,j) = ( u(k,j,i) / mc_factor - u_init(k) ) / a11(k) 595 808 ELSE 596 fu (k,j) = 0._wp809 fu_yz(k,j) = 0._wp 597 810 ENDIF 598 811 599 812 IF ( a22(k) .NE. 0._wp ) THEN 600 fv(k,j) = ( v(k,j,-1) / mc_factor - a21(k) * fu(k,j) - &601 mean_inflow_profiles(k,2) ) / a22(k)813 fv_yz(k,j) = ( v(k,j,i) / mc_factor - a21(k) * fu_yz(k,j) - & 814 v_init(k) ) / a22(k) 602 815 ELSE 603 fv (k,j) = 0._wp816 fv_yz(k,j) = 0._wp 604 817 ENDIF 605 818 606 819 IF ( a33(k) .NE. 0._wp ) THEN 607 fw(k,j) = ( w(k,j,-1) / mc_factor - a31(k) * fu(k,j) - &608 a32(k) * fv(k,j) ) / a33(k)820 fw_yz(k,j) = ( w(k,j,i) / mc_factor - a31(k) * fu_yz(k,j) - & 821 a32(k) * fv_yz(k,j) ) / a33(k) 609 822 ELSE 610 fw = 0._wp823 fw_yz = 0._wp 611 824 ENDIF 612 825 … … 759 972 IMPLICIT NONE 760 973 761 762 974 CALL wrd_write_string( 'mc_factor' ) 763 975 WRITE ( 14 ) mc_factor … … 785 997 786 998 USE control_parameters, & 787 ONLY: dt_3d, intermediate_timestep_count, simulated_time, & 788 volume_flow_initial 999 ONLY: dt_3d, forcing, intermediate_timestep_count, nest_domain, & 1000 simulated_time, volume_flow_initial 1001 1002 USE grid_variables, & 1003 ONLY: dx, dy 789 1004 790 1005 USE indices, & 791 ONLY: nyn, nys1006 ONLY: wall_flags_0 792 1007 793 1008 USE statistics, & … … 797 1012 IMPLICIT NONE 798 1013 1014 INTEGER(iwp) :: i !< grid index in x-direction 799 1015 INTEGER(iwp) :: j !< loop index in y-direction 800 1016 INTEGER(iwp) :: k !< loop index in z-direction … … 802 1018 REAL(wp) :: dt_stg !< wheighted subtimestep 803 1019 REAL(wp) :: mc_factor_l !< local mass flux correction factor 804 805 REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,5,nbgp) :: inflow_dist !< disturbance for inflow profiles 1020 REAL(wp) :: volume_flow !< mass flux through lateral boundary 1021 REAL(wp) :: volume_flow_l !< local mass flux through lateral boundary 1022 1023 REAL(wp), DIMENSION(nzb:nzt+1,nxlg:nxrg,5) :: dist_xz !< imposed disturbances at north/south boundary 1024 REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,5) :: dist_yz !< imposed disturbances at left/right boundary 806 1025 807 1026 … … 815 1034 !-- Initial value of fu, fv, fw 816 1035 IF ( simulated_time == 0.0_wp .AND. .NOT. velocity_seed_initialized ) THEN 817 CALL stg_generate_seed_yz( nuy, nuz, buy, buz, fu ) 818 CALL stg_generate_seed_yz( nvy, nvz, bvy, bvz, fv ) 819 CALL stg_generate_seed_yz( nwy, nwz, bwy, bwz, fw ) 1036 CALL stg_generate_seed_yz( nuy, nuz, buy, buz, fu_yz, id_stg_left ) 1037 CALL stg_generate_seed_yz( nvy, nvz, bvy, bvz, fv_yz, id_stg_left ) 1038 CALL stg_generate_seed_yz( nwy, nwz, bwy, bwz, fw_yz, id_stg_left ) 1039 1040 IF ( forcing .OR. nest_domain ) THEN 1041 ! 1042 !-- Generate turbulence at right boundary 1043 CALL stg_generate_seed_yz( nuy, nuz, buy, buz, fu_yz, id_stg_right ) 1044 CALL stg_generate_seed_yz( nvy, nvz, bvy, bvz, fv_yz, id_stg_right ) 1045 CALL stg_generate_seed_yz( nwy, nwz, bwy, bwz, fw_yz, id_stg_right ) 1046 ! 1047 !-- Generate turbulence at north boundary 1048 CALL stg_generate_seed_xz( nux, nuz, bux, buz, fu_xz, id_stg_north ) 1049 CALL stg_generate_seed_xz( nvx, nvz, bvx, bvz, fv_xz, id_stg_north ) 1050 CALL stg_generate_seed_xz( nwx, nwz, bwx, bwz, fw_xz, id_stg_north ) 1051 ! 1052 !-- Generate turbulence at south boundary 1053 CALL stg_generate_seed_xz( nux, nuz, bux, buz, fu_xz, id_stg_south ) 1054 CALL stg_generate_seed_xz( nvx, nvz, bvx, bvz, fv_xz, id_stg_south ) 1055 CALL stg_generate_seed_xz( nwx, nwz, bwx, bwz, fw_xz, id_stg_south ) 1056 ENDIF 820 1057 velocity_seed_initialized = .TRUE. 821 1058 ENDIF 822 1059 ! 823 1060 !-- New set of fu, fv, fw 824 CALL stg_generate_seed_yz( nuy, nuz, buy, buz, fuo ) 825 CALL stg_generate_seed_yz( nvy, nvz, bvy, bvz, fvo ) 826 CALL stg_generate_seed_yz( nwy, nwz, bwy, bwz, fwo ) 827 828 IF ( myidx == id_inflow ) THEN 1061 CALL stg_generate_seed_yz( nuy, nuz, buy, buz, fuo_yz, id_stg_left ) 1062 CALL stg_generate_seed_yz( nvy, nvz, bvy, bvz, fvo_yz, id_stg_left ) 1063 CALL stg_generate_seed_yz( nwy, nwz, bwy, bwz, fwo_yz, id_stg_left ) 1064 1065 IF ( forcing .OR. nest_domain ) THEN 1066 ! 1067 !-- Generate turbulence at right boundary 1068 CALL stg_generate_seed_yz( nuy, nuz, buy, buz, fuo_yz, id_stg_right ) 1069 CALL stg_generate_seed_yz( nvy, nvz, bvy, bvz, fvo_yz, id_stg_right ) 1070 CALL stg_generate_seed_yz( nwy, nwz, bwy, bwz, fwo_yz, id_stg_right ) 1071 ! 1072 !-- Generate turbulence at north boundary 1073 CALL stg_generate_seed_xz( nux, nuz, bux, buz, fuo_xz, id_stg_north ) 1074 CALL stg_generate_seed_xz( nvx, nvz, bvx, bvz, fvo_xz, id_stg_north ) 1075 CALL stg_generate_seed_xz( nwx, nwz, bwx, bwz, fwo_xz, id_stg_north ) 1076 ! 1077 !-- Generate turbulence at south boundary 1078 CALL stg_generate_seed_xz( nux, nuz, bux, buz, fuo_xz, id_stg_south ) 1079 CALL stg_generate_seed_xz( nvx, nvz, bvx, bvz, fvo_xz, id_stg_south ) 1080 CALL stg_generate_seed_xz( nwx, nwz, bwx, bwz, fwo_xz, id_stg_south ) 1081 ENDIF 1082 ! 1083 !-- Turbulence generation at left and or right boundary 1084 IF ( myidx == id_stg_left .OR. myidx == id_stg_right ) THEN 829 1085 830 1086 DO j = nysg, nyng … … 833 1089 !-- Update fu, fv, fw following Eq. 14 of Xie and Castro (2008) 834 1090 IF ( tu(k) == 0.0_wp ) THEN 835 fu (k,j) = fuo(k,j)1091 fu_yz(k,j) = fuo_yz(k,j) 836 1092 ELSE 837 fu (k,j) = fu(k,j) * EXP( -pi * dt_stg * 0.5_wp / tu(k) ) + &838 fuo (k,j) * SQRT( 1.0_wp - EXP( -pi * dt_stg / tu(k) ) )1093 fu_yz(k,j) = fu_yz(k,j) * EXP( -pi * dt_stg * 0.5_wp / tu(k) ) + & 1094 fuo_yz(k,j) * SQRT( 1.0_wp - EXP( -pi * dt_stg / tu(k) ) ) 839 1095 ENDIF 840 1096 841 1097 IF ( tv(k) == 0.0_wp ) THEN 842 fv (k,j) = fvo(k,j)1098 fv_yz(k,j) = fvo_yz(k,j) 843 1099 ELSE 844 fv (k,j) = fv(k,j) * EXP( -pi * dt_stg * 0.5_wp / tv(k) ) + &845 fvo (k,j) * SQRT( 1.0_wp - EXP( -pi * dt_stg / tv(k) ) )1100 fv_yz(k,j) = fv_yz(k,j) * EXP( -pi * dt_stg * 0.5_wp / tv(k) ) + & 1101 fvo_yz(k,j) * SQRT( 1.0_wp - EXP( -pi * dt_stg / tv(k) ) ) 846 1102 ENDIF 847 1103 848 1104 IF ( tw(k) == 0.0_wp ) THEN 849 fw (k,j) = fwo(k,j)1105 fw_yz(k,j) = fwo_yz(k,j) 850 1106 ELSE 851 fw (k,j) = fw(k,j) * EXP( -pi * dt_stg * 0.5_wp / tw(k) ) + &852 fwo (k,j) * SQRT( 1.0_wp - EXP( -pi * dt_stg / tw(k) ) )1107 fw_yz(k,j) = fw_yz(k,j) * EXP( -pi * dt_stg * 0.5_wp / tw(k) ) + & 1108 fwo_yz(k,j) * SQRT( 1.0_wp - EXP( -pi * dt_stg / tw(k) ) ) 853 1109 ENDIF 854 1110 ! … … 856 1112 !-- Additional factors are added to improve the variance of v and w 857 1113 IF( k == 0 ) THEN 858 inflow_dist(k,j,1,1) = 0.0_wp859 inflow_dist(k,j,2,1) = 0.0_wp860 inflow_dist(k,j,3,1) = 0.0_wp861 inflow_dist(k,j,4,1) = 0.0_wp862 inflow_dist(k,j,5,1) = 0.0_wp1114 dist_yz(k,j,1) = 0.0_wp 1115 dist_yz(k,j,2) = 0.0_wp 1116 dist_yz(k,j,3) = 0.0_wp 1117 ! dist_yz(k,j,4) = 0.0_wp 1118 ! dist_yz(k,j,5) = 0.0_wp 863 1119 ELSE 864 inflow_dist(k,j,1,1) = a11(k) * fu(k,j)1120 dist_yz(k,j,1) = a11(k) * fu_yz(k,j) 865 1121 !experimental test of 1.2 866 inflow_dist(k,j,2,1) = ( SQRT( a22(k) / MAXVAL(a22) )&1122 dist_yz(k,j,2) = ( SQRT( a22(k) / MAXVAL(a22) ) & 867 1123 * 1.2_wp ) & 868 * ( a21(k) * fu (k,j) &869 + a22(k) * fv (k,j) )870 inflow_dist(k,j,3,1) = ( SQRT(a33(k) / MAXVAL(a33) )&1124 * ( a21(k) * fu_yz(k,j) & 1125 + a22(k) * fv_yz(k,j) ) 1126 dist_yz(k,j,3) = ( SQRT(a33(k) / MAXVAL(a33) ) & 871 1127 * 1.3_wp ) & 872 * ( a31(k) * fu (k,j) &873 + a32(k) * fv (k,j) &874 + a33(k) * fw (k,j) )1128 * ( a31(k) * fu_yz(k,j) & 1129 + a32(k) * fv_yz(k,j) & 1130 + a33(k) * fw_yz(k,j) ) 875 1131 ! Calculation for pt and e not yet implemented 876 inflow_dist(k,j,4,1) = 0.0_wp877 inflow_dist(k,j,5,1) = 0.0_wp1132 ! dist_yz(k,j,4) = 0.0_wp 1133 ! dist_yz(k,j,5) = 0.0_wp 878 1134 ENDIF 879 1135 … … 885 1141 !-- This correction factor insures that the mass flux is preserved at the 886 1142 !-- inflow boundary 887 mc_factor_l = 0.0_wp 888 mc_factor = 0.0_wp 889 DO j = nys, nyn 1143 IF ( .NOT. forcing .AND. .NOT. nest_domain ) THEN 1144 mc_factor_l = 0.0_wp 1145 mc_factor = 0.0_wp 1146 DO j = nys, nyn 1147 DO k = nzb+1, nzt 1148 mc_factor_l = mc_factor_l + dzw(k) * & 1149 ( mean_inflow_profiles(k,1) + dist_yz(k,j,1) ) 1150 ENDDO 1151 ENDDO 1152 1153 #if defined( __parallel ) 1154 CALL MPI_ALLREDUCE( mc_factor_l, mc_factor, & 1155 1, MPI_REAL, MPI_SUM, comm1dy, ierr ) 1156 #else 1157 mc_factor = mc_factor_l 1158 #endif 1159 1160 mc_factor = volume_flow_initial(1) / mc_factor 1161 1162 ! 1163 !-- Add disturbance at the inflow 1164 DO j = nysg, nyng 1165 DO k = nzb, nzt+1 1166 u(k,j,-nbgp+1:0) = ( mean_inflow_profiles(k,1) + & 1167 dist_yz(k,j,1) ) * mc_factor 1168 v(k,j,-nbgp:-1) = ( mean_inflow_profiles(k,2) + & 1169 dist_yz(k,j,2) ) * mc_factor 1170 w(k,j,-nbgp:-1) = dist_yz(k,j,3) * mc_factor 1171 ENDDO 1172 ENDDO 1173 1174 ELSE 1175 ! 1176 !-- First, calculate volume flow at yz boundary 1177 IF ( myidx == id_stg_left ) i = nxl 1178 IF ( myidx == id_stg_right ) i = nxr+1 1179 1180 volume_flow_l = 0.0_wp 1181 volume_flow = 0.0_wp 1182 mc_factor_l = 0.0_wp 1183 mc_factor = 0.0_wp 1184 DO j = nys, nyn 1185 DO k = nzb+1, nzt 1186 volume_flow_l = volume_flow_l + u(k,j,i) * dzw(k) * dy & 1187 * MERGE( 1.0_wp, 0.0_wp, & 1188 BTEST( wall_flags_0(k,j,i), 1 ) ) 1189 1190 mc_factor_l = mc_factor_l + ( u(k,j,i) + dist_yz(k,j,1) ) & 1191 * dzw(k) * dy & 1192 * MERGE( 1.0_wp, 0.0_wp, & 1193 BTEST( wall_flags_0(k,j,i), 1 ) ) 1194 ENDDO 1195 ENDDO 1196 #if defined( __parallel ) 1197 CALL MPI_ALLREDUCE( volume_flow_l, volume_flow, & 1198 1, MPI_REAL, MPI_SUM, comm1dy, ierr ) 1199 CALL MPI_ALLREDUCE( mc_factor_l, mc_factor, & 1200 1, MPI_REAL, MPI_SUM, comm1dy, ierr ) 1201 #else 1202 volume_flow = volume_flow_l 1203 mc_factor = mc_factor_l 1204 #endif 1205 1206 mc_factor = volume_flow / mc_factor 1207 1208 ! 1209 !-- Add disturbances 1210 IF ( myidx == id_stg_left ) THEN 1211 1212 DO j = nysg, nyng 1213 DO k = nzb, nzt+1 1214 u(k,j,-nbgp+1:0) = ( u(k,j,-nbgp+1:0) + dist_yz(k,j,1) ) & 1215 * mc_factor 1216 v(k,j,-nbgp:-1) = ( v(k,j,-nbgp:-1) + dist_yz(k,j,2) ) & 1217 * mc_factor 1218 w(k,j,-nbgp:-1) = ( w(k,j,-nbgp:-1) + dist_yz(k,j,3) ) & 1219 * mc_factor 1220 ENDDO 1221 ENDDO 1222 ENDIF 1223 IF ( myidx == id_stg_right ) THEN 1224 1225 DO j = nysg, nyng 1226 DO k = nzb, nzt+1 1227 u(k,j,nxr+1:nxr+nbgp) = ( u(k,j,nxr+1:nxr+nbgp) + & 1228 dist_yz(k,j,1) ) * mc_factor 1229 v(k,j,nxr+1:nxr+nbgp) = ( v(k,j,nxr+1:nxr+nbgp) + & 1230 dist_yz(k,j,2) ) * mc_factor 1231 w(k,j,nxr+1:nxr+nbgp) = ( w(k,j,nxr+1:nxr+nbgp) + & 1232 dist_yz(k,j,3) ) * mc_factor 1233 ENDDO 1234 ENDDO 1235 ENDIF 1236 ENDIF 1237 1238 ENDIF 1239 ! 1240 !-- Turbulence generation at north and south boundary 1241 IF ( myidy == id_stg_north .OR. myidy == id_stg_south ) THEN 1242 1243 DO i = nxlg, nxrg 1244 DO k = nzb, nzt + 1 1245 ! 1246 !-- Update fu, fv, fw following Eq. 14 of Xie and Castro (2008) 1247 IF ( tu(k) == 0.0_wp ) THEN 1248 fu_xz(k,i) = fuo_xz(k,i) 1249 ELSE 1250 fu_xz(k,i) = fu_xz(k,i) * EXP( -pi * dt_stg * 0.5_wp / tu(k) ) + & 1251 fuo_xz(k,i) * SQRT( 1.0_wp - EXP( -pi * dt_stg / tu(k) ) ) 1252 ENDIF 1253 1254 IF ( tv(k) == 0.0_wp ) THEN 1255 fv_xz(k,i) = fvo_xz(k,i) 1256 ELSE 1257 fv_xz(k,i) = fv_xz(k,i) * EXP( -pi * dt_stg * 0.5_wp / tv(k) ) + & 1258 fvo_xz(k,i) * SQRT( 1.0_wp - EXP( -pi * dt_stg / tv(k) ) ) 1259 ENDIF 1260 1261 IF ( tw(k) == 0.0_wp ) THEN 1262 fw_xz(k,i) = fwo_xz(k,i) 1263 ELSE 1264 fw_xz(k,i) = fw_xz(k,i) * EXP( -pi * dt_stg * 0.5_wp / tw(k) ) + & 1265 fwo_xz(k,i) * SQRT( 1.0_wp - EXP( -pi * dt_stg / tw(k) ) ) 1266 ENDIF 1267 ! 1268 !-- Lund rotation following Eq. 17 in Xie and Castro (2008). 1269 !-- Additional factors are added to improve the variance of v and w 1270 IF( k == 0 ) THEN 1271 dist_xz(k,i,1) = 0.0_wp 1272 dist_xz(k,i,2) = 0.0_wp 1273 dist_xz(k,i,3) = 0.0_wp 1274 1275 ELSE 1276 dist_xz(k,i,1) = a11(k) * fu_xz(k,i) 1277 !experimental test of 1.2 1278 dist_xz(k,i,2) = ( SQRT( a22(k) / MAXVAL(a22) ) & 1279 * 1.2_wp ) & 1280 * ( a21(k) * fu_xz(k,i) & 1281 + a22(k) * fv_xz(k,i) ) 1282 dist_xz(k,i,3) = ( SQRT(a33(k) / MAXVAL(a33) ) & 1283 * 1.3_wp ) & 1284 * ( a31(k) * fu_xz(k,i) & 1285 + a32(k) * fv_xz(k,i) & 1286 + a33(k) * fw_xz(k,i) ) 1287 ENDIF 1288 1289 ENDDO 1290 ENDDO 1291 ! 1292 !-- Mass flux correction following Kim et al. (2013) 1293 !-- This correction factor insures that the mass flux is preserved at the 1294 !-- inflow boundary. 1295 !-- First, calculate volume flow at xz boundary 1296 IF ( myidy == id_stg_south ) j = nys 1297 IF ( myidy == id_stg_north ) j = nyn+1 1298 1299 volume_flow_l = 0.0_wp 1300 volume_flow = 0.0_wp 1301 mc_factor_l = 0.0_wp 1302 mc_factor = 0.0_wp 1303 DO i = nxl, nxr 890 1304 DO k = nzb+1, nzt 891 mc_factor_l = mc_factor_l + dzw(k) * & 892 ( mean_inflow_profiles(k,1) + inflow_dist(k,j,1,1) ) 1305 volume_flow_l = volume_flow_l + v(k,j,i) * dzw(k) * dx & 1306 * MERGE( 1.0_wp, 0.0_wp, & 1307 BTEST( wall_flags_0(k,j,i), 2 ) ) 1308 1309 mc_factor_l = mc_factor_l + ( v(k,j,i) + dist_xz(k,i,2) ) & 1310 * dzw(k) * dx & 1311 * MERGE( 1.0_wp, 0.0_wp, & 1312 BTEST( wall_flags_0(k,j,i), 2 ) ) 893 1313 ENDDO 894 1314 ENDDO 895 896 1315 #if defined( __parallel ) 897 CALL MPI_ALLREDUCE( mc_factor_l, mc_factor, & 898 1, MPI_REAL, MPI_SUM, comm1dy, ierr ) 1316 CALL MPI_ALLREDUCE( volume_flow_l, volume_flow, & 1317 1, MPI_REAL, MPI_SUM, comm1dx, ierr ) 1318 CALL MPI_ALLREDUCE( mc_factor_l, mc_factor, & 1319 1, MPI_REAL, MPI_SUM, comm1dx, ierr ) 899 1320 #else 900 mc_factor = mc_factor_l 1321 volume_flow = volume_flow_l 1322 mc_factor = mc_factor_l 901 1323 #endif 902 1324 903 mc_factor = volume_flow_initial(1) / mc_factor 904 905 ! 906 !-- Add disturbance at the inflow 907 DO j = nysg, nyng 908 DO k = nzb, nzt+1 909 u(k,j,-nbgp+1:0) = ( mean_inflow_profiles(k,1) + & 910 inflow_dist(k,j,1,1) ) * mc_factor 911 v(k,j,-nbgp:-1) = ( mean_inflow_profiles(k,2) + & 912 inflow_dist(k,j,2,1) ) * mc_factor 913 w(k,j,-nbgp:-1) = inflow_dist(k,j,3,1) * mc_factor 1325 mc_factor = volume_flow / mc_factor 1326 1327 ! 1328 !-- Add disturbances 1329 IF ( myidy == id_stg_south ) THEN 1330 1331 DO i = nxlg, nxrg 1332 DO k = nzb, nzt+1 1333 u(k,-nbgp:-1,i) = ( u(k,-nbgp:-1,i) + dist_xz(k,i,1) ) & 1334 * mc_factor 1335 v(k,-nbgp:0,i) = ( v(k,-nbgp:0,i) + dist_xz(k,i,2) ) & 1336 * mc_factor 1337 w(k,-nbgp:-1,i) = ( w(k,-nbgp:-1,i) + dist_xz(k,i,3) ) & 1338 * mc_factor 1339 ENDDO 914 1340 ENDDO 915 ENDDO 916 1341 ENDIF 1342 IF ( myidy == id_stg_north ) THEN 1343 1344 DO i = nxlg, nxrg 1345 DO k = nzb, nzt+1 1346 u(k,nyn+1:nyn+nbgp,i) = ( u(k,nyn+1:nyn+nbgp,i) + & 1347 dist_xz(k,i,1) ) * mc_factor 1348 v(k,nyn+1:nyn+nbgp,i) = ( v(k,nyn+1:nyn+nbgp,i) + & 1349 dist_xz(k,i,2) ) * mc_factor 1350 w(k,nyn+1:nyn+nbgp,i) = ( w(k,nyn+1:nyn+nbgp,i) + & 1351 dist_xz(k,i,3) ) * mc_factor 1352 ENDDO 1353 ENDDO 1354 ENDIF 917 1355 ENDIF 918 1356 … … 920 1358 921 1359 END SUBROUTINE stg_main 922 923 1360 924 1361 !------------------------------------------------------------------------------! … … 931 1368 !> parts are collected to form the full array. 932 1369 !------------------------------------------------------------------------------! 933 SUBROUTINE stg_generate_seed_yz( n_y, n_z, b_y, b_z, f_n )1370 SUBROUTINE stg_generate_seed_yz( n_y, n_z, b_y, b_z, f_n, id ) 934 1371 935 1372 … … 940 1377 IMPLICIT NONE 941 1378 1379 INTEGER(iwp) :: id !< core ids at respective boundaries 942 1380 INTEGER(iwp) :: j !< loop index in y-direction 943 1381 INTEGER(iwp) :: jj !< loop index in y-direction … … 957 1395 REAL(wp), DIMENSION(-merg:merg,nzb:nzt+1) :: b_y !< filter func in y-dir 958 1396 REAL(wp), DIMENSION(-merg:merg,nzb:nzt+1) :: b_z !< filter func in z-dir 959 REAL(wp), DIMENSION(nzb_x :nzt_x+1,nysg:nyng) :: f_n_l !< local velocity seed1397 REAL(wp), DIMENSION(nzb_x_stg:nzt_x_stg+1,nysg:nyng) :: f_n_l !< local velocity seed 960 1398 REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng) :: f_n !< velocity seed 961 1399 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: rand_it !< random number … … 1018 1456 1019 1457 DO j = nysg, nyng 1020 DO k = nzb_x , nzt_x+11458 DO k = nzb_x_stg, nzt_x_stg+1 1021 1459 DO jj = -n_y2(k), n_y2(k) 1022 1460 DO kk = -n_z2(k), n_z2(k) … … 1032 1470 ! 1033 1471 !-- Gather velocity seeds of full subdomain 1034 send_count = nzt_x - nzb_x+ 11035 IF ( nzt_x == nzt ) send_count = send_count + 11472 send_count = nzt_x_stg - nzb_x_stg + 1 1473 IF ( nzt_x_stg == nzt ) send_count = send_count + 1 1036 1474 1037 1475 #if defined( __parallel ) 1038 CALL MPI_GATHERV( f_n_l(nzb_x ,nysg), send_count, stg_type_yz_small, &1039 f_n(nzb+1,nysg), recv_count , displs, stg_type_yz, &1040 id _inflow, comm1dx, ierr )1476 CALL MPI_GATHERV( f_n_l(nzb_x_stg,nysg), send_count, stg_type_yz_small, & 1477 f_n(nzb+1,nysg), recv_count_yz, displs_yz, stg_type_yz, & 1478 id, comm1dx, ierr ) 1041 1479 #else 1042 f_n(nzb+1:nzt+1,nysg:nyng) = f_n_l(nzb_x :nzt_x+1,nysg:nyng)1480 f_n(nzb+1:nzt+1,nysg:nyng) = f_n_l(nzb_x_stg:nzt_x_stg+1,nysg:nyng) 1043 1481 #endif 1044 1482 … … 1046 1484 END SUBROUTINE stg_generate_seed_yz 1047 1485 1486 1487 1488 1489 !------------------------------------------------------------------------------! 1490 ! Description: 1491 ! ------------ 1492 !> Generate a set of random number rand_it wich is equal on each PE 1493 !> and calculate the velocity seed f_n. 1494 !> f_n is splitted in vertical direction by the number of PEs in y-direction and 1495 !> and each PE calculates a vertical subsection of f_n. At the the end, all 1496 !> parts are collected to form the full array. 1497 !------------------------------------------------------------------------------! 1498 SUBROUTINE stg_generate_seed_xz( n_x, n_z, b_x, b_z, f_n, id ) 1499 1500 1501 USE indices, & 1502 ONLY: nx 1503 1504 1505 IMPLICIT NONE 1506 1507 INTEGER(iwp) :: id !< core ids at respective boundaries 1508 INTEGER(iwp) :: i !< loop index in x-direction 1509 INTEGER(iwp) :: ii !< loop index in x-direction 1510 INTEGER(iwp) :: k !< loop index in z-direction 1511 INTEGER(iwp) :: kk !< loop index in z-direction 1512 INTEGER(iwp) :: send_count !< send count for MPI_GATHERV 1513 1514 INTEGER(iwp), DIMENSION(nzb:nzt+1) :: n_x !< length scale in x-direction 1515 INTEGER(iwp), DIMENSION(nzb:nzt+1) :: n_z !< length scale in z-direction 1516 INTEGER(iwp), DIMENSION(nzb:nzt+1) :: n_x2 !< n_y*2 1517 INTEGER(iwp), DIMENSION(nzb:nzt+1) :: n_z2 !< n_z*2 1518 1519 REAL(wp) :: nxz_inv !< inverse of number of grid points in xz-slice 1520 REAL(wp) :: rand_av !< average of random number 1521 REAL(wp) :: rand_sigma_inv !< inverse of stdev of random number 1522 1523 REAL(wp), DIMENSION(-merg:merg,nzb:nzt+1) :: b_x !< filter func in y-dir 1524 REAL(wp), DIMENSION(-merg:merg,nzb:nzt+1) :: b_z !< filter func in z-dir 1525 REAL(wp), DIMENSION(nzb_y_stg:nzt_y_stg+1,nxlg:nxrg) :: f_n_l !< local velocity seed 1526 REAL(wp), DIMENSION(nzb:nzt+1,nxlg:nxrg) :: f_n !< velocity seed 1527 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: rand_it !< random number 1528 1529 1530 ! 1531 !-- Generate random numbers using a seed generated in stg_init. 1532 !-- The set of random numbers are modified to have an average of 0 and 1533 !-- unit variance. 1534 ALLOCATE( rand_it(nzb-mergp:nzt+1+mergp,-mergp:nx+mergp) ) 1535 1536 rand_av = 0.0_wp 1537 rand_sigma_inv = 0.0_wp 1538 nxz_inv = 1.0_wp / REAL( ( nzt+1 - nzb+1 ) * ( nx+1 ), KIND=wp ) 1539 1540 DO i = 0, nx 1541 DO k = nzb, nzt+1 1542 CALL RANDOM_NUMBER( rand_it(k,i) ) 1543 rand_av = rand_av + rand_it(k,i) 1544 ENDDO 1545 ENDDO 1546 1547 rand_av = rand_av * nxz_inv 1548 1549 DO i = 0, nx 1550 DO k = nzb, nzt+1 1551 rand_it(k,i) = rand_it(k,i) - rand_av 1552 rand_sigma_inv = rand_sigma_inv + rand_it(k,i) ** 2 1553 ENDDO 1554 ENDDO 1555 1556 rand_sigma_inv = 1.0_wp / SQRT(rand_sigma_inv * nxz_inv) 1557 1558 DO i = 0, nx 1559 DO k = nzb, nzt+1 1560 rand_it(k,i) = rand_it(k,i) * rand_sigma_inv 1561 ENDDO 1562 ENDDO 1563 1564 ! 1565 !-- Periodic fill of random number in space 1566 DO i = 0, nx 1567 DO k = 1, mergp 1568 rand_it(nzb-k,i) = rand_it(nzt+2-k,i) ! bottom margin 1569 rand_it(nzt+1+k,i) = rand_it(nzb+k-1,i) ! top margin 1570 ENDDO 1571 ENDDO 1572 DO i = 1, mergp 1573 DO k = nzb-mergp, nzt+1+mergp 1574 rand_it(k,-i) = rand_it(k,nx-i+1) ! left margin 1575 rand_it(k,nx+i) = rand_it(k,i-1) ! right margin 1576 ENDDO 1577 ENDDO 1578 1579 ! 1580 !-- Generate velocity seed following Eq.6 of Xie and Castro (2008) 1581 n_x2 = n_x * 2 1582 n_z2 = n_z * 2 1583 f_n_l = 0.0_wp 1584 1585 DO i = nxlg, nxrg 1586 DO k = nzb_y_stg, nzt_y_stg+1 1587 DO ii = -n_x2(k), n_x2(k) 1588 DO kk = -n_z2(k), n_z2(k) 1589 f_n_l(k,i) = f_n_l(k,i) & 1590 + b_x(ii,k) * b_z(kk,k) * rand_it(k+kk,i+ii) 1591 ENDDO 1592 ENDDO 1593 ENDDO 1594 ENDDO 1595 1596 DEALLOCATE( rand_it ) 1597 1598 ! 1599 !-- Gather velocity seeds of full subdomain 1600 send_count = nzt_y_stg - nzb_y_stg + 1 1601 IF ( nzt_y_stg == nzt ) send_count = send_count + 1 1602 1603 1604 #if defined( __parallel ) 1605 CALL MPI_GATHERV( f_n_l(nzb_y_stg,nxlg), send_count, stg_type_xz_small, & 1606 f_n(nzb+1,nxlg), recv_count_xz, displs_xz, stg_type_xz, & 1607 id, comm1dy, ierr ) 1608 #else 1609 f_n(nzb+1:nzt+1,nxlg:nxrg) = f_n_l(nzb_y_stg:nzt_y_stg+1,nxlg:nxrg) 1610 #endif 1611 1612 1613 END SUBROUTINE stg_generate_seed_xz 1614 1048 1615 END MODULE synthetic_turbulence_generator_mod -
palm/trunk/SOURCE/time_integration.f90
r2934 r2938 25 25 ! ----------------- 26 26 ! $Id$ 27 ! Nesting of dissipation rate in case of RANS mode and TKE-e closure is applied 28 ! 29 ! 2936 2018-03-27 14:49:27Z suehring 27 30 ! Little formatting adjustment. 28 31 ! … … 358 361 microphysics_morrison, microphysics_seifert, mid, nest_domain, & 359 362 neutral, nr_timesteps_this_run, nudging, & 360 ocean, passive_scalar, 361 p rho_reference, pt_reference, pt_slope_offset, random_heatflux,&363 ocean, passive_scalar, prho_reference, pt_reference, & 364 pt_slope_offset, random_heatflux, rans_mode, & 362 365 rans_tke_e, run_coupled, simulated_time, simulated_time_chr, & 363 366 skip_time_do2d_xy, skip_time_do2d_xz, skip_time_do2d_yz, & … … 782 785 IF ( .NOT. constant_diffusion ) CALL exchange_horiz( e, nbgp ) 783 786 787 IF ( .NOT. constant_diffusion .AND. rans_mode .AND. & 788 rans_tke_e ) & 789 CALL exchange_horiz( diss, nbgp ) 790 784 791 IF ( air_chemistry ) THEN 785 792 DO n = 1, nspec … … 820 827 ! 821 828 !-- Impose a turbulent inflow using synthetic generated turbulence 822 IF ( use_syn_turb_gen ) THEN 823 CALL stg_main 824 ENDIF 829 IF ( use_syn_turb_gen ) CALL stg_main 825 830 826 831 ! … … 862 867 intermediate_timestep_count_max ) THEN 863 868 CALL forcing_bc 864 ENDIF 865 ! 866 !-- Moreover, ensure mass conservation at each RK substep. 867 IF ( forcing ) CALL forcing_bc_mass_conservation869 ! 870 !-- Moreover, ensure mass conservation 871 CALL forcing_bc_mass_conservation 872 ENDIF 868 873 869 874 ! -
palm/trunk/SOURCE/turbulence_closure_mod.f90
r2918 r2938 25 25 ! ----------------- 26 26 ! $Id$ 27 ! Further todo's 28 ! 29 ! 2936 2018-03-27 14:49:27Z suehring 27 30 ! - defined l_grid only within this module 28 31 ! - Moved l_wall definition from modules.f90 … … 69 72 !> add OpenMP directives whereever possible 70 73 !> remove debug output variables (dummy1, dummy2, dummy3) 74 !> @todo Move initialization of wall-mixing length from init_grid 75 !> @todo Check for random disturbances 71 76 !> @note <Enter notes on the module> 72 77 !> @bug TKE-e closure still crashes due to too small dt … … 284 289 285 290 USE control_parameters, & 286 ONLY: message_string, neutral, turbulent_inflow, turbulent_outflow 291 ONLY: message_string, nest_domain, neutral, turbulent_inflow, & 292 turbulent_outflow 287 293 288 294 IMPLICIT NONE … … 302 308 rans_tke_e = .TRUE. 303 309 304 IF ( INDEX( initializing_actions, 'set_1d-model_profiles' ) 305 == 0) THEN310 IF ( INDEX( initializing_actions, 'set_1d-model_profiles' ) == 0 & 311 .AND. .NOT. nest_domain ) THEN 306 312 message_string = 'Initializing without 1D model while ' // & 307 313 'using TKE-e closure&' // & … … 826 832 ONLY: use_sgs_for_particles, wang_kernel 827 833 834 USE pmc_interface, & 835 ONLY: nested_run 836 828 837 IMPLICIT NONE 829 838 … … 847 856 ALLOCATE( e_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) 848 857 #endif 849 858 ! 859 !-- Allocate arrays required for dissipation. 860 !-- Please note, if it is a nested run, arrays need to be allocated even if 861 !-- they do not necessarily need to be transferred, which is attributed to 862 !-- the design of the model coupler which allocates memory for each variable. 850 863 IF ( rans_tke_e .OR. use_sgs_for_particles .OR. wang_kernel .OR. & 851 collision_turbulence ) THEN864 collision_turbulence .OR. nested_run ) THEN 852 865 #if defined( __nopointer ) 853 866 ALLOCATE( diss(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) … … 858 871 #else 859 872 ALLOCATE( diss_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) 860 IF ( rans_tke_e ) THEN873 IF ( rans_tke_e .OR. nested_run ) THEN 861 874 ALLOCATE( diss_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) 862 875 ALLOCATE( diss_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) … … 871 884 872 885 IF ( rans_tke_e .OR. use_sgs_for_particles .OR. & 873 wang_kernel .OR. collision_turbulence ) THEN886 wang_kernel .OR. collision_turbulence .OR. nested_run ) THEN 874 887 diss => diss_1 875 IF ( rans_tke_e ) THEN888 IF ( rans_tke_e .OR. nested_run ) THEN 876 889 diss_p => diss_2; tdiss_m => diss_3 877 890 ENDIF
Note: See TracChangeset
for help on using the changeset viewer.