Changeset 4117
- Timestamp:
- Jul 25, 2019 8:54:02 AM (5 years ago)
- Location:
- palm/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/salsa_mod.f90
r4110 r4117 21 21 ! Current revisions: 22 22 ! ----------------- 23 ! 23 ! - When Dirichlet condition is applied in decycling, the boundary conditions are 24 ! only set at the ghost points and not at the prognostic grid points as done 25 ! before 26 ! - Rename decycle_ns/lr to decycle_salsa_ns/lr and decycle_method to 27 ! decycle_method_salsa 28 ! - Allocation and initialization of special advection flags salsa_advc_flags_s 29 ! used for salsa. These are exclusively used for salsa variables to 30 ! distinguish from the usually-used flags which might be different when 31 ! decycling is applied in combination with cyclic boundary conditions. 32 ! Moreover, salsa_advc_flags_s considers extended zones around buildings where 33 ! the first-order upwind scheme is applied for the horizontal advection terms. 34 ! This is doneto overcome high concentration peaks due to stationary numerical 35 ! oscillations caused by horizontal advection discretization. 24 36 ! 25 37 ! Former revisions: … … 192 204 ONLY: call_chem_at_all_substeps, chem_gasphase_on, chem_species 193 205 194 USE control_parameters 206 USE control_parameters, & 207 ONLY: air_chemistry, bc_dirichlet_l, bc_dirichlet_n, bc_dirichlet_r, bc_dirichlet_s, & 208 bc_lr, bc_lr_cyc, bc_ns, bc_ns_cyc, bc_radiation_l, bc_radiation_n, bc_radiation_r, & 209 bc_radiation_s, coupling_char, debug_output, dt_3d, intermediate_timestep_count, & 210 intermediate_timestep_count_max, land_surface, message_string, monotonic_limiter_z, & 211 plant_canopy, pt_surface, salsa, scalar_advec, surface_pressure, & 212 time_since_reference_point, timestep_scheme, tsc, urban_surface, ws_scheme_sca 195 213 196 214 USE indices, & … … 337 355 !< 'parameterized', 'read_from_file' 338 356 339 CHARACTER(LEN=20), DIMENSION(4) :: decycle_method =&357 CHARACTER(LEN=20), DIMENSION(4) :: decycle_method_salsa = & 340 358 (/'dirichlet','dirichlet','dirichlet','dirichlet'/) 341 359 !< Decycling method at horizontal boundaries … … 404 422 405 423 INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE :: k_topo_top !< vertical index of the topography top 424 425 INTEGER(iwp), DIMENSION(:,:,:), ALLOCATABLE :: salsa_advc_flags_s !< flags used to degrade order of advection 426 !< scheme for salsa variables near walls and 427 !< lateral boundaries 406 428 ! 407 429 !-- SALSA switches: 408 430 LOGICAL :: advect_particle_water = .TRUE. !< Advect water concentration of particles 409 LOGICAL :: decycle_ lr= .FALSE. !< Undo cyclic boundaries: left and right410 LOGICAL :: decycle_ ns= .FALSE. !< Undo cyclic boundaries: north and south431 LOGICAL :: decycle_salsa_lr = .FALSE. !< Undo cyclic boundaries: left and right 432 LOGICAL :: decycle_salsa_ns = .FALSE. !< Undo cyclic boundaries: north and south 411 433 LOGICAL :: include_emission = .FALSE. !< Include or not emissions 412 434 LOGICAL :: feedback_to_palm = .FALSE. !< Allow feedback due to condensation of H2O … … 870 892 NAMELIST /salsa_parameters/ aerosol_flux_dpg, aerosol_flux_mass_fracs_a, & 871 893 aerosol_flux_mass_fracs_b, aerosol_flux_sigmag, & 872 advect_particle_water, bc_salsa_b, bc_salsa_t, decycle_lr, & 873 decycle_method, decycle_ns, depo_pcm_par, depo_pcm_type, & 894 advect_particle_water, bc_salsa_b, bc_salsa_t, & 895 decycle_salsa_lr, decycle_method_salsa, decycle_salsa_ns, & 896 depo_pcm_par, depo_pcm_type, & 874 897 depo_surf_par, dpg, dt_salsa, feedback_to_palm, h2so4_init, & 875 898 hno3_init, init_gases_type, init_aerosol_type, listspec, & … … 909 932 910 933 USE control_parameters, & 911 ONLY: message_string934 ONLY: humidity 912 935 913 936 IMPLICIT NONE … … 1127 1150 SUBROUTINE salsa_init_arrays 1128 1151 1129 USE chem_gasphase_mod,&1130 ONLY: nvar1152 USE advec_ws, & 1153 ONLY: ws_init_flags_scalar 1131 1154 1132 1155 USE surface_mod, & … … 1368 1391 1369 1392 ENDIF 1393 ! 1394 !-- Set control flags for decycling only at lateral boundary cores. Within the inner cores the 1395 !-- decycle flag is set to .FALSE.. Even though it does not affect the setting of chemistry boundary 1396 !-- conditions, this flag is used to set advection control flags appropriately. 1397 decycle_salsa_lr = MERGE( decycle_salsa_lr, .FALSE., nxl == 0 .OR. nxr == nx ) 1398 decycle_salsa_ns = MERGE( decycle_salsa_ns, .FALSE., nys == 0 .OR. nyn == ny ) 1399 ! 1400 !-- Decycling can be applied separately for aerosol variables, while wind and other scalars may have 1401 !-- cyclic or nested boundary conditions. However, large gradients near the boundaries may produce 1402 !-- stationary numerical oscillations near the lateral boundaries when a higher-order scheme is 1403 !-- applied near these boundaries. To get rid-off this, set-up additional flags that control the 1404 !-- order of the scalar advection scheme near the lateral boundaries for passive scalars with 1405 !-- decycling. 1406 IF ( scalar_advec == 'ws-scheme' ) THEN 1407 ALLOCATE( salsa_advc_flags_s(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) 1408 ! 1409 !-- In case of decycling, set Neuman boundary conditions for wall_flags_0 bit 31 instead of 1410 !-- cyclic boundary conditions. Bit 31 is used to identify extended degradation zones (please see 1411 !-- the following comment). Note, since several also other modules may access this bit but may 1412 !-- have other boundary conditions, the original value of wall_flags_0 bit 31 must not be 1413 !-- modified. Hence, store the boundary conditions directly on salsa_advc_flags_s. 1414 !-- salsa_advc_flags_s will be later overwritten in ws_init_flags_scalar and bit 31 won't be used 1415 !-- to control the numerical order. 1416 !-- Initialize with flag 31 only. 1417 salsa_advc_flags_s = 0 1418 salsa_advc_flags_s = MERGE( IBSET( salsa_advc_flags_s, 31 ), 0, BTEST( wall_flags_0, 31 ) ) 1419 1420 IF ( decycle_salsa_ns ) THEN 1421 IF ( nys == 0 ) THEN 1422 DO i = 1, nbgp 1423 salsa_advc_flags_s(:,nys-i,:) = MERGE( IBSET( salsa_advc_flags_s(:,nys,:), 31 ), & 1424 IBCLR( salsa_advc_flags_s(:,nys,:), 31 ), & 1425 BTEST( salsa_advc_flags_s(:,nys,:), 31 ) ) 1426 ENDDO 1427 ENDIF 1428 IF ( nyn == ny ) THEN 1429 DO i = 1, nbgp 1430 salsa_advc_flags_s(:,nyn+i,:) = MERGE( IBSET( salsa_advc_flags_s(:,nyn,:), 31 ), & 1431 IBCLR( salsa_advc_flags_s(:,nyn,:), 31 ), & 1432 BTEST( salsa_advc_flags_s(:,nyn,:), 31 ) ) 1433 ENDDO 1434 ENDIF 1435 ENDIF 1436 IF ( decycle_salsa_lr ) THEN 1437 IF ( nxl == 0 ) THEN 1438 DO i = 1, nbgp 1439 salsa_advc_flags_s(:,:,nxl-i) = MERGE( IBSET( salsa_advc_flags_s(:,:,nxl), 31 ), & 1440 IBCLR( salsa_advc_flags_s(:,:,nxl), 31 ), & 1441 BTEST( salsa_advc_flags_s(:,:,nxl), 31 ) ) 1442 ENDDO 1443 ENDIF 1444 IF ( nxr == nx ) THEN 1445 DO i = 1, nbgp 1446 salsa_advc_flags_s(:,:,nxr+i) = MERGE( IBSET( salsa_advc_flags_s(:,:,nxr), 31 ), & 1447 IBCLR( salsa_advc_flags_s(:,:,nxr), 31 ), & 1448 BTEST( salsa_advc_flags_s(:,:,nxr), 31 ) ) 1449 ENDDO 1450 ENDIF 1451 ENDIF 1452 ! 1453 !-- To initialise the advection flags appropriately, pass the boundary flags to 1454 !-- ws_init_flags_scalar. The last argument in ws_init_flags_scalar indicates that a passive 1455 !-- scalar is being treated and the horizontal advection terms are degraded already 2 grid points 1456 !-- before the lateral boundary. Also, extended degradation zones are applied, where 1457 !-- horizontal advection of scalars is discretised by the first-order scheme at all grid points 1458 !-- in the vicinity of buildings (<= 3 grid points). Even though no building is within the 1459 !-- numerical stencil, the first-order scheme is used. At fourth and fifth grid points, the order 1460 !-- of the horizontal advection scheme is successively upgraded. 1461 !-- These degradations of the advection scheme are done to avoid stationary numerical 1462 !-- oscillations, which are responsible for high concentration maxima that may appear e.g. under 1463 !-- shear-free stable conditions. 1464 CALL ws_init_flags_scalar( bc_dirichlet_l .OR. bc_radiation_l .OR. decycle_salsa_lr, & 1465 bc_dirichlet_n .OR. bc_radiation_n .OR. decycle_salsa_ns, & 1466 bc_dirichlet_r .OR. bc_radiation_r .OR. decycle_salsa_lr, & 1467 bc_dirichlet_s .OR. bc_radiation_s .OR. decycle_salsa_ns, & 1468 salsa_advc_flags_s, .TRUE. ) 1469 ENDIF 1470 1370 1471 1371 1472 END SUBROUTINE salsa_init_arrays … … 2531 2632 nyn_on_file, nysf, nysc, nys_on_file, tmp_3d, found ) 2532 2633 2634 USE control_parameters, & 2635 ONLY: length, restart_string 2636 2533 2637 IMPLICIT NONE 2534 2638 … … 2602 2706 !------------------------------------------------------------------------------! 2603 2707 SUBROUTINE salsa_wrd_local 2708 2709 USE control_parameters, & 2710 ONLY: write_binary 2604 2711 2605 2712 IMPLICIT NONE … … 3212 3319 USE basic_constants_and_equations_mod, & 3213 3320 ONLY: barometric_formula, exner_function, ideal_gas_law_rho, magnus 3214 3215 USE control_parameters, &3216 ONLY: pt_surface, surface_pressure3217 3321 3218 3322 IMPLICIT NONE … … 3509 3613 SUBROUTINE deposition( paero, tk, adn, mag_u, lad, kvis, schmidt_num, vc ) 3510 3614 3511 USE plant_canopy_model_mod, &3512 ONLY: cdc3615 USE plant_canopy_model_mod, & 3616 ONLY: cdc 3513 3617 3514 3618 IMPLICIT NONE … … 7604 7708 SUBROUTINE salsa_prognostic_equations_ij( i, j, i_omp_start, tn ) 7605 7709 7606 USE control_parameters, &7607 ONLY: time_since_reference_point7608 7609 7710 IMPLICIT NONE 7610 7711 … … 7671 7772 SUBROUTINE salsa_prognostic_equations() 7672 7773 7673 USE control_parameters, &7674 ONLY: time_since_reference_point7675 7676 7774 IMPLICIT NONE 7677 7775 … … 7743 7841 7744 7842 USE indices, & 7745 ONLY: advc_flags_s, wall_flags_0 7746 7747 USE pegrid, & 7748 ONLY: threads_per_task 7843 ONLY: wall_flags_0 7749 7844 7750 7845 USE surface_mod, & … … 7786 7881 IF ( timestep_scheme(1:5) == 'runge' ) THEN 7787 7882 IF ( ws_scheme_sca ) THEN 7788 CALL advec_s_ws( advc_flags_s, i, j, rs, id, flux_s, diss_s, flux_l, diss_l, & 7789 i_omp_start, tn, & 7790 bc_dirichlet_l .OR. bc_radiation_l, & 7883 CALL advec_s_ws( salsa_advc_flags_s, i, j, rs, id, flux_s, diss_s, flux_l, diss_l, & 7884 i_omp_start, tn, bc_dirichlet_l .OR. bc_radiation_l, & 7791 7885 bc_dirichlet_n .OR. bc_radiation_n, & 7792 7886 bc_dirichlet_r .OR. bc_radiation_r, & 7793 bc_dirichlet_s .OR. bc_radiation_s, & 7794 monotonic_limiter_z ) 7887 bc_dirichlet_s .OR. bc_radiation_s, monotonic_limiter_z ) 7795 7888 ELSE 7796 7889 CALL advec_s_pw( i, j, rs ) … … 7892 7985 ONLY: diffusion_s 7893 7986 USE indices, & 7894 ONLY: advc_flags_s,wall_flags_07987 ONLY: wall_flags_0 7895 7988 USE surface_mod, & 7896 7989 ONLY : surf_def_h, surf_def_v, surf_lsm_h, surf_lsm_v, surf_usm_h, surf_usm_v … … 7923 8016 IF ( timestep_scheme(1:5) == 'runge' ) THEN 7924 8017 IF ( ws_scheme_sca ) THEN 7925 CALL advec_s_ws( advc_flags_s, rs, id, & 7926 bc_dirichlet_l .OR. bc_radiation_l, & 8018 CALL advec_s_ws( salsa_advc_flags_s, rs, id, bc_dirichlet_l .OR. bc_radiation_l, & 7927 8019 bc_dirichlet_n .OR. bc_radiation_n, & 7928 8020 bc_dirichlet_r .OR. bc_radiation_r, & … … 8248 8340 ! 8249 8341 !-- Left and right boundaries 8250 IF ( decycle_ lr .AND. ( bc_lr_cyc .OR. bc_lr == 'nested' ) ) THEN8342 IF ( decycle_salsa_lr .AND. ( bc_lr_cyc .OR. bc_lr == 'nested' ) ) THEN 8251 8343 8252 8344 DO boundary = 1, 2 8253 8345 8254 IF ( decycle_method (boundary) == 'dirichlet' ) THEN8346 IF ( decycle_method_salsa(boundary) == 'dirichlet' ) THEN 8255 8347 ! 8256 8348 !-- Initial profile is copied to ghost and first three layers … … 8259 8351 IF ( boundary == 1 .AND. nxl == 0 ) THEN 8260 8352 ss = nxlg 8261 ee = nxl +28353 ee = nxl-1 8262 8354 ELSEIF ( boundary == 2 .AND. nxr == nx ) THEN 8263 ss = nxr -28355 ss = nxr+1 8264 8356 ee = nxrg 8265 8357 ENDIF … … 8274 8366 ENDDO 8275 8367 8276 ELSEIF ( decycle_method (boundary) == 'neumann' ) THEN8368 ELSEIF ( decycle_method_salsa(boundary) == 'neumann' ) THEN 8277 8369 ! 8278 8370 !-- The value at the boundary is copied to the ghost layers to simulate an outlet with … … 8300 8392 8301 8393 ELSE 8302 WRITE(message_string,*) 'unknown decycling method: decycle_method (', boundary,&8303 ') ="' // TRIM( decycle_method (boundary) ) // '"'8394 WRITE(message_string,*) 'unknown decycling method: decycle_method_salsa (', boundary, & 8395 ') ="' // TRIM( decycle_method_salsa(boundary) ) // '"' 8304 8396 CALL message( 'salsa_boundary_conds_decycle', 'PA0626', 1, 2, 0, 6, 0 ) 8305 8397 ENDIF … … 8309 8401 ! 8310 8402 !-- South and north boundaries 8311 IF ( decycle_ ns .AND. ( bc_ns_cyc .OR. bc_ns == 'nested' ) ) THEN8403 IF ( decycle_salsa_ns .AND. ( bc_ns_cyc .OR. bc_ns == 'nested' ) ) THEN 8312 8404 8313 8405 DO boundary = 3, 4 8314 8406 8315 IF ( decycle_method (boundary) == 'dirichlet' ) THEN8407 IF ( decycle_method_salsa(boundary) == 'dirichlet' ) THEN 8316 8408 ! 8317 8409 !-- Initial profile is copied to ghost and first three layers … … 8320 8412 IF ( boundary == 3 .AND. nys == 0 ) THEN 8321 8413 ss = nysg 8322 ee = nys +28414 ee = nys-1 8323 8415 ELSEIF ( boundary == 4 .AND. nyn == ny ) THEN 8324 ss = nyn -28416 ss = nyn+1 8325 8417 ee = nyng 8326 8418 ENDIF … … 8335 8427 ENDDO 8336 8428 8337 ELSEIF ( decycle_method (boundary) == 'neumann' ) THEN8429 ELSEIF ( decycle_method_salsa(boundary) == 'neumann' ) THEN 8338 8430 ! 8339 8431 !-- The value at the boundary is copied to the ghost layers to simulate an outlet with … … 8361 8453 8362 8454 ELSE 8363 WRITE(message_string,*) 'unknown decycling method: decycle_method (', boundary,&8364 ') ="' // TRIM( decycle_method (boundary) ) // '"'8455 WRITE(message_string,*) 'unknown decycling method: decycle_method_salsa (', boundary, & 8456 ') ="' // TRIM( decycle_method_salsa(boundary) ) // '"' 8365 8457 CALL message( 'salsa_boundary_conds_decycle', 'PA0627', 1, 2, 0, 6, 0 ) 8366 8458 ENDIF … … 8417 8509 SUBROUTINE salsa_emission_update 8418 8510 8419 USE control_parameters, &8420 ONLY: time_since_reference_point8421 8422 8511 IMPLICIT NONE 8423 8512 … … 8450 8539 !------------------------------------------------------------------------------! 8451 8540 SUBROUTINE salsa_emission_setup( init ) 8452 8453 USE control_parameters, &8454 ONLY: time_since_reference_point8455 8541 8456 8542 USE date_and_time_mod, & … … 9139 9225 !------------------------------------------------------------------------------! 9140 9226 SUBROUTINE salsa_gas_emission_setup( init ) 9141 9142 USE control_parameters, &9143 ONLY: time_since_reference_point9144 9227 9145 9228 USE date_and_time_mod, & … … 9489 9572 !------------------------------------------------------------------------------! 9490 9573 SUBROUTINE salsa_check_data_output( var, unit ) 9491 9492 USE control_parameters, &9493 ONLY: message_string9494 9574 9495 9575 IMPLICIT NONE … … 9551 9631 SUBROUTINE salsa_3d_data_averaging( mode, variable ) 9552 9632 9553 USE control_parameters 9554 9555 USE indices 9556 9557 USE kinds 9633 USE control_parameters, & 9634 ONLY: average_count_3d 9558 9635 9559 9636 IMPLICIT NONE … … 10746 10823 10747 10824 USE control_parameters, & 10748 ONLY: mask_ size_l, mask_surface10825 ONLY: mask_i, mask_j, mask_k, mask_size_l, mask_surface, nz_do3d 10749 10826 10750 10827 USE surface_mod, & -
palm/trunk/TESTS/cases/urban_environment_salsa/INPUT/urban_environment_salsa_p3d
r4012 r4117 20 20 !------------------------------------------------------------------------------ 21 21 fft_method = 'fftw', 22 22 monotonic_limiter_z = .T., 23 23 ! 24 24 !-- Mode … … 243 243 !-- Decycle at the north & south boundaries: initial concentration 244 244 !-- is copied to ghost and first three layers at both boundaries 245 decycle_ lr = .T.,246 decycle_ ns = .F.,247 decycle_method = 'dirichlet','dirichlet','dirichlet','dirichlet',245 decycle_salsa_lr = .T., 246 decycle_salsa_ns = .F., 247 decycle_method_salsa = 'dirichlet','dirichlet','dirichlet','dirichlet', 248 248 bc_salsa_b = 'neumann', !'dirichlet', ! surface flux requires 'neumann' 249 249 bc_salsa_t = 'dirichlet', ! top
Note: See TracChangeset
for help on using the changeset viewer.