Add a scale-adaptive 3DTKE parameterization scheme as a subgrid mixing option #972
Add a scale-adaptive 3DTKE parameterization scheme as a subgrid mixing option #972smileMchen merged 9 commits intowrf-model:developfrom
Conversation
Ming,
Does this mean that the scheme ONLY works with sfclayrev? If so, another check_a_mundo IF test. |
|
@smileMchen
Do we need to update the TechNote or the User's Guide? |
|
@davegill |
|
@zhangx-3dtke Did you test restart? If you did, and it works, please add it to 'Tests Conducted'. |
Registry/Registry.EM_COMMON
Outdated
| state real CDA ij misc 1 - r "CDA" "DRAG COEFF AT LOWEST MODEL LVL" "" | ||
| state real UST ij misc 1 - rh "UST" "U* IN SIMILARITY THEORY" "m s-1" | ||
| state real USTM ij misc 1 - r "USTM" "U* IN SIMILARITY THEORY WITHOUT VCONV" "m s-1" | ||
| state real USTM ij misc 1 - rh "USTM" "U* IN SIMILARITY THEORY WITHOUT VCONV" "m s-1" |
There was a problem hiding this comment.
@zhangx-3dtke Do you need this variable to be in history file?
There was a problem hiding this comment.
No, I output this variable for diagnosis and forgot to change back.
There was a problem hiding this comment.
Restart run test passed. I added it to "Tests Conducted" @weiwangncar
smileMchen
left a comment
There was a problem hiding this comment.
I looked through this PR and I believe it is ready to merge into the development branch.
|
@zhangx-3dtke |
|
@zhangx-3dtke
|
|
@zhangx-3dtke |
|
@davegill |
|
|
||
| CALL wrf_debug ( 200 , ' call rk_scalar_tend for tke' ) | ||
| tenddec = .false. | ||
| ! XZ |
dyn_em/solve_em.F
Outdated
| !$OMP PRIVATE ( ij, tenddec ) | ||
| tke_tile_loop_2: DO ij = 1 , grid%num_tiles | ||
|
|
||
| IF( config_flags%km_opt .eq. 2 ) THEN !XZ |
There was a problem hiding this comment.
@zhangx-3dtke
NO more comments about it, but go through and fix the indenting
|
@davegill @dudhia I wonder what you think of comments like '!XZ' throughout the code. I remember we talked about things like this at one point. @zhangx-3dtke Is subroutine solve_tke_implicit functionally like rk_update_scalar for tke? If it is, could a different subroutine name be used (such as rk_update_tke_implicit)? Just curious. |
|
@weiwangncar This is a good idea! But, actually solve_tke_implicit is not using the Runge-Kutta time integration. I can change the name to update_tke_implicit. |
…id mixing option (wrf-model#972)" This reverts commit d059afe.
TYPE: bug fix KEYWORDS: packaging, sms3dtke SOURCE: Internal DESCRIPTION OF CHANGES: The existing packaging in combination with the logic added in the code for PR #972 (Add a scale-adaptive 3DTKE parameterization scheme as a subgrid mixing option) d059afe causes segmentation faults for most model simulations that use km_opt=2. The packaging is important, but we have a broken repository. The packaging will be removed, developers will fix the problem, and then put the packaging back into the Registry file for this option. Jan Mandel states: > "found that l_scale, th_h_tend, and tke_diffusion_h_tend made my km_opt=2 test case fail, and with them removed from the package it did not fail. But I do not know if sms_3dtke even with the packaging removed does not break something in a different way." Perhaps these are the variables to start the seg fault investigation to re-introduce packaging for this option. LIST OF MODIFIED FILES: modified: Registry/Registry.EM_COMMON TESTS CONDUCTED: - [x] With original packaging, all tests with km_opt=2 failed - [x] With mods (removing km_opt=5 packaging), km_opt=2 and km_opt=5 tests pass
|
This one breaks WRFPLUS compilation. Debugging … |
|
@liujake |
|
I cloned repo this noon, it is already the latest code. |
|
@davegill Most of time, wrfplus compilation failure is caused by newly added argument in forward code, which is sometimes also called in TL and/or AD code. Usually it is easy fix by simply adding new argument in TL/AD code. But this one seems to be a bit tricky. After I added s/ch/opt/netcdf/4.6.3/gnu/8.3.0/include -fdefault-real-8 module_diffusion_em_ad.f90 Error: Symbol ‘u_h_tend’ at (1) has no IMPLICIT type; did you mean ‘a_rw_tendf’? Error: Symbol ‘v_h_tend’ at (1) has no IMPLICIT type; did you mean ‘a_rw_tendf’? Error: Rank mismatch in argument ‘fnp’ at (1) (rank-1 and scalar) Error: Rank mismatch in argument ‘theta’ at (1) (rank-3 and scalar) Error: Type mismatch in argument ‘hpbl’ at (1); passed INTEGER(4) to REAL(8) Error: Type mismatch in argument ‘hpbl’ at (1); passed INTEGER(4) to REAL(8) |
|
@davegill . Resolved u_h_tend and v_h_tend lines by defining them as local variables. Move to next lines. My strategy is to simply allow code to compile, but will not try to update TL/AD code to match new modified forward code. |
|
@liujake u_h_tend, v_h_tend and a few others are state variables declared in Registry. Maybe they should be added to TL/AD registry? |
Changes committed: modified: wrftladj/module_diffusion_em_ad.F
TYPE: maintainance KEYWORDS: WRFPlus, adjoint code update SOURCE: internal DESCRIPTION OF CHANGES: PR #972 breaks wrfplus code compilation, this PR fixes compilation issue. ISSUE: None. LIST OF MODIFIED FILES: M wrftladj/module_diffusion_em_ad.F TESTS CONDUCTED: WRFPlus/3DVAR/4DVAR compilation Ok and WRFDA regtests passed. RELEASE NOTE: None.
TYPE: bug fix KEYWORDS: wrfplus, TL/AD code SOURCE: internal DESCRIPTION OF CHANGES: Two recent WRF model code changes break the wrfplus compilation: 1. ESMF name change This modification allowed the CTSM development to use standard ESMF without conflicting with WRF _old_ ESMF library namespace. Commit 8af5385, PR #1066 "Enabling WRF build with ESMF library" 2. module_diffusion_em_ad.F, 3d scale aware TKE (one of these, take your pick) Commit d059afe, PR #972 "Add a scale-adaptive 3DTKE parameterization scheme as a subgrid mixing option Commit 6d95883, PR #1012 "SMS3dTKE: Remove broken packaging for km_opt=5" Commit 94e5ed9, PR #1013 "Add missing "IF km_opt==5" tests for diag computations" Commit dd0c209, PR #1026 "Fixing the problem that km_opt=5 breaks km_opt=2 and cleaning codes" LIST OF MODIFIED FILES: M share/mediation_integrate.F M wrftladj/module_diffusion_em_ad.F TESTS CONDUCTED: wrfplus code compiles now.
TYPE: new feature
KEYWORDS: 3DTKE scheme, scale-adaptive
SOURCE: Xu Zhang (Shanghai Typhoon Institute/CMA, China)
DESCRIPTION OF CHANGES:
This PR adds a new scale-adaptive 3DTKE scheme (SMS-3DTKE, Shanghai Meteorological Service)
for subgrid turbulent mixing. The new scheme is self-adaptive to the grid-size between the
large-eddy simulation (LES) and mesoscale limits. The new 3DTKE scheme is added as a new
diffusion option km_opt = 5. This option extends original LES subgrid model 1.5-order TKE closure
(km_opt=2) to the mesoscale, and can be used in LES, mesoscale, and the gray zone resolutions in
between. In the horizontal diffusion, the new scheme blends horizontal Smagorinsky first-order
closure (km_opt=4) and 1.5-order TKE-based horizontal diffusivity. In the mesoscale limit,
horizontal diffusion recovers to the 2D Smagorinsky form (km_opt=4), and the new vertical
diffusion adds a non-local term and is made implicit to allow for longer time steps and thin levels.
The new scheme can therefore replace km_opt=2 and conventional PBL schemes. In the LES limit,
km_opt=5 recovers km_opt=2. The added 3D arrays are packaged in Registry.
Several newly added subroutines:
and computes the nonlocal momentum gamma term.
tke, moist, chem, scalar, tracer using an implicit method.
TKE diffusion and dissipation are implicitly treated.
From a user perspective, when the new scheme is turned on (diff_opt=2 and km_opt=5), PBL
schemes must be turned off (bl_pbl_physics = 0).
This scheme can be used with sf_sfclay_physics = 1, 5, 91.
LIST OF MODIFIED FILES:
Registry/Registry.EM_COMMON
dyn_em/module_diffusion_em.F
dyn_em/module_first_rk_step_part2.F
dyn_em/solve_em.F
run/README.namelist
test/em_real/examples.namelist
share/module_check_a_mundo.F
TESTS CONDUCTED:
RELEASE NOTE:
A three dimensional (3D) scale-adaptive TKE subgrid mixing parameterization scheme (SMS-3DTKE, km_opt=5) developed by Shanghai Meteorological Service (SMS), China. (Zhang, X., Bao, J., Chen, B., and Grell, E., 2018: A Three-Dimensional Scale-Adaptive Turbulent Kinetic Energy Scheme in the WRF-ARW Model. Mon. Wea. Rev., 146(7), 2023-2045, https://doi.org/10.1175/MWR-D-17-0356.1) . The subgrid mixing parameterization extends the original 3DTKE model (km_opt=2, Deardorff 1980) that is usually used as an LES subgrid model to the mesoscale limit in the framework of the WRF-ARW. The scheme can be used in LES, mesoscale and the gray zone resolutions in between. The option must be used with diff_opt=2. The scheme can replace LES subgrid model (km_opt=2) and conventional PBL schemes. When the scheme is turned on (diff_opt=2 and km_opt=5), PBL schemes must be turned off (bl_pbl_physics = 0). This scheme can be used with sf_sfclay_physics = 1, 5, 91.