Skip to content

Merge wrf-cmake 4.2.2#2

Merged
letmaik merged 195 commits intowrf-cmake-tebfrom
letmaik/wrf-cmake-4.2
Jan 18, 2021
Merged

Merge wrf-cmake 4.2.2#2
letmaik merged 195 commits intowrf-cmake-tebfrom
letmaik/wrf-cmake-4.2

Conversation

@letmaik
Copy link

@letmaik letmaik commented Jan 17, 2021

Note: this changes the reference to the external teb repo to the ninja-patch branch which contains the patch for ninja on top of the old release. Updating to the latest teb will require more changes and can be done separately.
Note 2: Azure Pipelines seems to have issues but overall it looks fine: https://dev.azure.com/TEB-model/teb/_build/results?buildId=6&view=results

kkeene44 and others added 30 commits March 8, 2019 10:33
…-model#801)

TYPE: no impact

KEYWORDS: wrf, mpas, unification, ntiedtke, cumulus

SOURCE: internal

DESCRIPTION OF CHANGES: For the purpose of WRF/MPAS physics unification, we want the 2 models to have identical versions of each physics routine. After some mods were made to the MPAS version, this version then was behind. This particular PR defines t13 in the code rather using the Prandtl number since the Prandtl number is different in WRF and MPAS.

LIST OF MODIFIED FILES:
M phys/module_cu_ntiedtke.F

TESTS CONDUCTED: Verified that it compiles and runs fine. There were no diffs in output before/after modifications.
…#807)

TYPE: no impact

KEYWORDS: mm5, Monin-Obukhov, sfclay, mpas, wrf, SFCLAY1D

SOURCE: internal

DESCRIPTION OF CHANGES: When mods were made to unify wrf/mpas code, MPAS was left out of an if statement within the call to SFCLAY1D. Added it in to correct for MPAS purpose.

LIST OF MODIFIED FILES:
M phys/module_sf_sfclay.F

TESTS CONDUCTED:

Verified that it compiles and runs give bit-for-bit results before and after mods.

Simple test: does this CPP directive do what we want.
Source code

> cat foo.F
program foo
#if ( ( EM_CORE == 1 ) || ( defined(mpas) ) )
print *,'yep on EM_CORE == 1 || defined mpas'
#else
print *,'Nothing special at all'
#endif
end
  Works for WRF
> cpp -DEM_CORE=1 foo.F > foo.f90 ; gfortran foo.f90  ; a.out
 yep on EM_CORE == 1 || defined mpas
  Work for MPAS
> cpp -Dmpas foo.F > foo.f90 ; gfortran foo.f90 ; a.out
 yep on EM_CORE == 1 || defined mpas
  Expected null result
> cpp -DABC foo.F > foo.f90 ; gfortran foo.f90 ; a.out
 Nothing special at all
…up module (wrf-model#810)

TYPE: no impact

KEYWORDS: ntiedtke, wrf, mpas cu_physics, dx2d

SOURCE: internal

DESCRIPTION OF CHANGES: Toward an effort to use fewer if defined(mpas) (or wrfmodel) statements in the code, a dx2d variable was added to be used until WRF creates a 2d array for dx.

LIST OF MODIFIED FILES:
M phys/module_cu_ntiedtke.F

TESTS CONDUCTED: verified that WRF builds okay and that bit-for-bit results are given before/after mods.
wrf-model#809)

TYPE: no impact

KEYWORDS: wsm6, wrf, mpas, unify, if loop

SOURCE: internal

DESCRIPTION OF CHANGES:
At the top of the wsm6 module was an if defined (wrfmodel) loop that included a few 'use'
statements for models/routines that are currently not used in this MP scheme. Removed that
loop to unify this routine with MPAS and to clean-up unnecessary dependencies.

LIST OF MODIFIED FILES:
M phys/module_mp_wsm6.F

TESTS CONDUCTED:

 verified that this builds without problems and produces bit-for-bit results before and after mods.
TYPE:new feature

KEYWORDS: FY3C-MWHS2, Radiance, RTTOV

SOURCE: Wei Sun (NSSC,CAS/NCAR) and Jake Liu (NCAR)

DESCRIPITION OF CHANGES:
1. Add new capability to assimilate FY3C-MWHS2 Level-1 data in HDF5 format, which can be downloaded from https://satellite.nsmc.org.cn/portalsite. Assimilation of this observation only works with RTTOV, since CRTM has no coefficients corresponding to FY3C.

2. MWHS2 has 15 channels (1 at 89 GHz, 8 at 118.75 GHz, 1 at 150 GHz, and 5 at 183 GHz) and 98 FOVs within the swath width 2660 km. Channels 1-9's footprint is 29 km and channels 10-15's footprint is 16 km. See https://www.ecmwf.int/sites/default/files/elibrary/2015/10668-evaluation-fy-3c-mwhs-2-ecmwf.pdf and https://www.wmo-sat.info/oscar/satellites/view/115 for more detail.

3. Sensor triplet for FY3-C-MWHS2 is (23, 3, 73). Observation file name conversion?

MODIFIED FILES:
	M   Registry/registry.var
	M   var/da/da_obs_io/da_read_y_unit.inc
	A   var/da/da_radiance/da_qc_mwhs2.inc
	M   var/da/da_radiance/da_qc_rad.inc
	M   var/da/da_radiance/da_radiance.f90
	M   var/da/da_radiance/da_radiance1.f90
	M   var/da/da_radiance/da_radiance_init.inc
	A   var/da/da_radiance/da_read_obs_hdf5mwhs2.inc
	M   var/da/da_radiance/da_read_pseudo_rad.inc
	M   var/da/da_radiance/da_setup_radiance_structures.inc
	M   var/da/da_radiance/module_radiance.f90
	M   var/da/da_setup_structures/da_setup_obs_structures.inc
	M   var/da/da_setup_structures/da_setup_structures.f90
	M   var/run/VARBC.in
	A   var/run/radiance_info/fy3-3-mwhs2.info

TEST CONDUCTED:
1. WRFDA regression tests ran successfully with gnu/ifort+mpt on Cheyenne.
2. New FY3C-MWHS2 radiance DA capability is tested on Cheyenne for 6-hour cycling DA over a 9km domain with a grid mesh of 600 x 450 x50.
…nd sim start date in printout (wrf-model#784)

TYPE: new feature

KEYWORDS: time_step, dx, cfl, ratio, current date, simulation start date

SOURCE: internal

DESCRIPTION OF CHANGES:
Problem:
Users accidentally forget to change the model time step when adjusting
the grid distance. It sometimes takes the model a while to become unstable
enough to die, and it is not always easy to determine why the model stopped.
However, we can't provide a simple "if the time step ratio > 6,
then always stop", because ideal cases would be unintentionally 
impacted. Likely there are also real-data cases, maybe LES-scale or urban heat 
island studies, where a user could realistically get a stable solution at a dt/dx ratio > 6.

Solution:
For domain 1 only, for real data cases only, for explicit dt cases (no adaptive dt):
Check to see if the time step ratio is greater than a prescribed value (default = 6),
which is defined in the Registry as a namelist option. If so, and the user's time does exceed
the provided limit, then stop immediately. If the user _is_ running a special scenario 
where a time step ratio of 8 (for example) would be acceptable, there is an option to 
make that workable at run-time.

Whether a user specifies a questionable dt ratio or not, always output a few important nml
settings up towards the top of the model printout (right after the max map factor).

Additionally, to help the users, add the start date and simulation start date into the print-out
that is at the very beginning of the WRF model standard out.

LIST OF MODIFIED FILES:
M dyn_em/start_em.F
M share/input_wrf.F
M Registry/Registry.EM_COMMON

ISSUE:
Fixes wrf-model#772 "time_step check in the code"

 - [x] The model now always outputs the following for real-data cases:
```
 D01: Time step                              =    320.000000      (s)
 D01: Grid Distance                          =    30.0000000      (km)
 D01: Grid Distance Ratio dt/dx              =    10.6666670      (s/km)
 D01: Ratio Including Maximum Map Factor     =    10.9600906      (s/km)
 D01: NML defined reasonable_time_step_ratio =    6.00000000
```

TESTS CONDUCTED:
 - [x] With a reasonable time step, the model processes as normal.
```
 &domains
 time_step                           = 180,
 dx                                  = 30000, 10000,  3333.33,
 dy                                  = 30000, 10000,  3333.33,
 /
```

- [x] With a time step that is too large for a real-data case.
```
 &domains
 time_step                           = 320! 180,
 dx                                  = 30000, 10000,  3333.33,
 dy                                  = 30000, 10000,  3333.33,
 /
```
```
The time step is probably too large for this grid distance, reduce it.
 If you are sure of your settings, set reasonable_time_step_ratio in namelist.input >    10.9600906
-------------- FATAL CALLED ---------------
FATAL CALLED FROM FILE:  <stdin>  LINE:     335
--- ERROR: Time step too large
-------------------------------------------
```

 - [x] With a real data case, and a ratio < than the namelist ratio, the model runs (for just a bit):
```
 &domains
 time_step                           = 320
 reasonable_time_step_ratio          = 12.
 dx                                  = 30000, 10000,  3333.33,
 dy                                  = 30000, 10000,  3333.33,
```

 - [x] With a time step ratio greater than 10 for the LES case, the model integrates fine.
```
 &domains
 time_step                           = 1,
 dx                                  = 90,    50,    16.6667,
 dy                                  = 90,    50,    16.6667,
```
TYPE: bug fix

KEYWORDS: Noah LSM sh2o unified MPAS

SOURCE: internal

DESCRIPTION OF CHANGES: 
Problem:
A single variable was used as two calling arguments in a subroutine. Inside the subroutine, the 
separate names were pointing to the same memory and were treated differently.

Solution:
Since the two instances of the array were treated as IN and OUT, a copy of the array was made and
passed in as separately named input field. There were two locations to fix.

LIST OF MODIFIED FILES: 
M phys/module_sf_noahlsm.F

TESTS CONDUCTED: 
1. Comparing the results before vs after show no bit-for-bit differences (what we wanted).
```
../../external/io_netcdf/diffwrf INIT_develop/wrfout_d01_2000-01-24_12:00:00 INIT_FIX_dev/wrfout_d01_2000-01-24_12:00:00 
 Just plot  F
Diffing INIT_develop/wrfout_d01_2000-01-24_12:00:00 INIT_FIX_dev/wrfout_d01_2000-01-24_12:00:00
 Next Time 2000-01-24_12:00:00
     Field   Ndifs    Dims       RMS (1)            RMS (2)     DIGITS    RMSE     pntwise max
 Next Time 2000-01-24_12:03:00
     Field   Ndifs    Dims       RMS (1)            RMS (2)     DIGITS    RMSE     pntwise max
 Next Time 2000-01-24_12:06:00
     Field   Ndifs    Dims       RMS (1)            RMS (2)     DIGITS    RMSE     pntwise max
 Next Time 2000-01-24_12:09:00
     Field   Ndifs    Dims       RMS (1)            RMS (2)     DIGITS    RMSE     pntwise max
 Next Time 2000-01-24_12:12:00
     Field   Ndifs    Dims       RMS (1)            RMS (2)     DIGITS    RMSE     pntwise max
```
2. When the code was instrumented, the only differences were diagnostic only. No differences in any other WRF output fields. See davegill#5 (github.com/davegill/WRF PR 5).
TYPE: new feature

KEYWORDS:  WRFDA, Infrared Radiance Data Assimilation, Cloud detection

SOURCE: Dongmei Xu (NUIST/NCAR), Thomas Auligné(NCAR, now at JCSDA)

DESCRIPTION OF CHANGES: 
1. Add a new channel-based cloud detection scheme based on the Particle Filter method for Infrared sensors such as AIRS, IASI, GOES-Imager, and AHI. 

2. Same as two other existing schemes (MMR and ECMWF) in WRFDA, this cloud-detection scheme can retain high-peaking channels not affected by cloud even though the pixel scene is covered by cloud. This scheme is computationally more efficient than MMR scheme.

3. Integer namelist parameter 'use_clddet' determines which scheme to use (=0,1,2,3 for no cloud detection, MMR, particle filter, and ECMWF scheme). The default is set to 2 for particle filter.

LIST OF MODIFIED FILES: 
M       Registry/registry.var
M       var/build/depend.txt
A       var/da/da_radiance/da_cloud_detect.inc
D       var/da/da_radiance/da_cloud_detect_airs.inc
D       var/da/da_radiance/da_cloud_detect_iasi.inc
M       var/da/da_radiance/da_crtm.f90
M       var/da/da_radiance/da_get_innov_vector_crtm.inc
M       var/da/da_radiance/da_qc_ahi.inc
M       var/da/da_radiance/da_qc_airs.inc
M       var/da/da_radiance/da_qc_goesimg.inc
M       var/da/da_radiance/da_qc_iasi.inc
M       var/da/da_radiance/da_radiance1.f90
M       var/da/da_radiance/da_rttov.f90

TESTS CONDUCTED: WRFDA regression tests ran successfully with gnu/ifort+mpt on Cheyenne.

RELEASE NOTE: A new channel-based cloud detection scheme for Infrared sensors is added based on the Particle Filter method.
Xu D., T. Auligné, G. Descombes, and C. Snyder, 2016: A method for retrieving clouds with satellite infrared radiances using the particle filter. Geosci. Model Dev., 9, 3919–3932.
…MR (wrf-model#893)

TYPE: bug fix

KEYWORDS: WRFDA, Infrared Radiance Data Assimilation, Cloud detection

SOURCE: Dongmei Xu (NUIST/NCAR)

DESCRIPTION OF CHANGES:
Three arrays are not deallocated in cloud detection subroutine, which caused segmentation fault with gnu-compiler compiled code for two WRFDA regression test cases related to AIRS and IASI DA (now by default cloud detection is on with particle filter) even though ifort-compiled code ran Ok.

LIST OF MODIFIED FILES:
M var/da/da_radiance/da_cloud_detect.inc

TESTS CONDUCTED: WRFDA regression tests ran successfully with gnu/ifort+mpt on Cheyenne.
…round error) (wrf-model#912)

TYPE: new feature

KEYWORDS: WRFDA, ep, be, cv_options=7, cloud_cv_options=2, bin_type=5

SOURCE: Jamie Bresch (NCAR)

DESCRIPTION OF CHANGES:

Add a stand-alone program for
1. generating ep (ensemble perturbation)
2. generating be (background error statistics) for cv_options=7 and cloud_cv_options=2 (bin_type=5 only).
See var/gen_be_v3/README.gen_be_v3 for more info.

This PR complements PR#900.

ISSUE: none

LIST OF MODIFIED FILES:
new file:   var/gen_be_v3/README.gen_be_v3
new file:   var/gen_be_v3/compile_casper
new file:   var/gen_be_v3/compile_cheyenne
new file:   var/gen_be_v3/gen_be_v3.F90
new file:   var/gen_be_v3/util/combine_be_cv7.f90

TESTS CONDUCTED:
Lots of various tests...

RELEASE NOTE: New stand-alone gen_be_v3 for generating ep (ensemble perturbation) and be
(background error) for WRFDA alphacv_method=2, alpha_hydrometeors=true, cv_options=7 and
cloud_cv_options=2 applications. The major advantage of gen_be_v3 is that it is much much more
efficient than the existing gen_be package.
…del#900)

TYPE: new feature

KEYWORDS: WRFDA, ep, ep_format

SOURCE: Jamie Bresch (NCAR)

DESCRIPTION OF CHANGES:

ep_format=1:  (default) original format, double precision, each ep file is for one variable and one member, as the output from the current gen_be_ep2.
ep_format=11: same as ep_format=1 except data are in single precision
ep_format=2:  single precision, each ep file is for one variable and all members
ep_format=3:  single precision, each ep file is for one variable and all members but on decomposed patch domain

No impact on existing ep reading results.
New WRFDA code should work without any changes from the user when ep files are generated using the existing very inefficient gen_be_ep2 program.
New utility for generating ep in new formats (ep_format=1, 11, 2, 3 through namelist option) is proposed in PR wrf-model#912.

LIST OF MODIFIED FILES:

modified:   Registry/registry.var
modified:   var/build/depend.txt
modified:   var/da/da_main/da_solve.inc
modified:   var/da/da_main/da_wrfvar_top.f90
modified:   var/da/da_setup_structures/da_setup_flow_predictors.inc
new file:   var/da/da_setup_structures/da_setup_flow_predictors_ep_format2.inc
new file:   var/da/da_setup_structures/da_setup_flow_predictors_ep_format3.inc
modified:   var/da/da_setup_structures/da_setup_structures.f90

TESTS CONDUCTED:

A case with 80-member 414x324x50 running with nproc=216.
The ep reading time:

| EP Format     | Time (s)  |   
| -------------:|----------:|
|     1         |   52.0    |
|     11        |   45.0    |
|     2         |   24.0    |
|     3         |    0.3    |

ep_format=1   ~ 52 sec
ep_format=11  ~ 45 sec
ep_format=2   ~ 24 sec
ep_format=3   ~ 0.3 sec 
Another major benefit to ep_format=3 is the reduced memory requirement.
New ep_format=11,2,3 produce identical analysis results.

RELEASE NOTE: New DA ep_format option to read in ensemble perturbation (ep) generated by existing gen_be_ep2 and new gen_be_v3 utilities.
TYPE: bug fix

KEYWORDS: ep, ep_format2, bcast, WRFDA

SOURCE: Internal, JJ Guerrette

DESCRIPTION OF CHANGES: 

These modifications are required following wrf-model#908 for release-v4.1.1.
The interface to wrf_dm_bcast_* requires an array argument instead of a scalar.  A compile error only arises when wrf-model#908 and wrf-model#900 are merged together.  The fix was tested in a 4D-Var build, but should be general.

ISSUE: none

LIST OF MODIFIED FILES: 
M       var/da/da_setup_structures/da_setup_flow_predictors_ep_format2.inc


TESTS CONDUCTED: Compilation is fixed when release-v4.1.1 is merged into develop.  This fix will also work in the current develop branch.
…loc info (wrf-model#958)

TYPE: enhancement

KEYWORDS: WRFDA, alpha_vertloc, alpha_vertloc_opt

SOURCE: Jamie Bresch (NCAR/MMM)

DESCRIPTION OF CHANGES:

PR wrf-model#850 discussed about the issues in current var/gen_be/gen_be_vertloc.f90.
Instead of modifying the stand-alone var/gen_be/gen_be_vertloc.f90 utility that generates be.vertloc.dat, this PR proposes a simpler and better solution inside WRFDA.

1. A new namelist alpha_vertloc_opt is added to replace alpha_vertloc to choose how to handle
vertical localization for EnVar applications.
alpha_vertloc_opt=1, the behavior is the same as before, except that the new code now gives proper error message when be.vertloc.dat does not exist.
alpha_vertloc_opt=2 (default, recommended), let WRFDA calculate logP-based vertical localization. be.vertloc.dat will be written out.
alpha_vertloc_opt = 0, no vertical localization.
alpha_vertloc_opt  is only used when ensdim_alpha>0, so the alpha_vertloc_opt setting does not matter when ensdim_alpha=0.
2. frame/module_configure.F is modified to notify users about the obsolete alpha_vertloc option.
3. var/README.namelist is updated.

LIST OF MODIFIED FILES:
M       Registry/registry.var
M       frame/module_configure.F
M       var/README.namelist
M       var/build/depend.txt
A       var/da/da_setup_structures/da_get_alpha_vertloc.inc
M       var/da/da_setup_structures/da_setup_be_nmm_regional.inc
M       var/da/da_setup_structures/da_setup_be_regional.inc
M       var/da/da_setup_structures/da_setup_structures.f90

TESTS CONDUCTED:
A case to test the new code works as expected.

RELEASE NOTE: For EnVar DA applications, logical alpha_vertloc namelist switch is replaced by new integer option alpha_vertloc_opt. See var/README.namelist.
TYPE: enhancement

KEYWORDS: WRFDA, RANDOMCV

SOURCE: Jamie Bresch (NCAR/MMM), Tom Auligne (previously NCAR, initiated the change in 2010)

DESCRIPTION OF CHANGES:

Simplify and cleanup the analysis_type="RANDOMCV" capability.
(1) Remove unnecessary and redundant code for anal_type_randomcv.
Non-relevant files and log messages are not written out.
(2) Add a new namelist n_randomcv (default=1) to allow the generation of multiple perturbed output in one run.
For example, wrfvar_output_randomcv.e001, wrfvar_output_randomcv.e002, etc.

The changes have no impact on non-RANDOMCV applications.

LIST OF MODIFIED FILES:
M Registry/registry.var
M var/README.namelist
M var/da/da_define_structures/da_initialize_cv.inc
M var/da/da_main/da_solve.inc
M var/da/da_main/da_wrfvar_top.f90
M var/da/da_tools/da_set_randomcv.inc

TESTS CONDUCTED:
With default n_randomcv=1, the new code generates identical wrfvar_output as the origonal code.

RELEASE NOTE: WRFDA analysis_type="RANDOMCV" is improved. To get multiple perturbed output in one WRFDA run, set new namelist n_randomcv to the desired number.
…g option (wrf-model#972)

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:

SUBROUTINE nonlocal_flux: prescribes the nonlocal heat flux profile based on LES analysis
and computes the nonlocal momentum gamma term.
SUBROUTINE free_atmos_length: calculates mixing length in the free atmosphere.
SUBROUTINE meso_length_scale: calculates mesoscale length scale.
SUBROUTINE vertical_diffusion_implicit: solves the vertical diffusion equations for u, v, w, th,
tke, moist, chem, scalar, tracer using an implicit method.
SUBROUTINE update_tke_implicit: solves the TKE equation using implicit method. The vertical
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:

All WTF regression tests pass.
Restart run test passed.
The real case tests give reasonable results when km_opt = 5 comparable to the conventional PBL schemes for the following:
Summer and winter 24-hr case with the resolution of 20km.
18-hr case with resolution of 3km.
check_a_mundo tests correctly identified incorrect accompanying physics selections.
It is verified that no extra memory is being used when the scheme is not used.
Timing tests were conducted for the 3km resolution runs.
When the new option is turned on (km_opt=5), it requires 1.95s every time step.
When km_opt=2, it needs 1.88s every time step.
When turn on the YSU PBL scheme, it requires 1.42s every time step.
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.
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 wrf-model#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
TYPE: bug fix

KEYWORDS: sms3dtke, km_opt==5

SOURCE: Internal

DESCRIPTION OF CHANGES:
Each location where the optional diagnostics for km_opt==5 are computed,
instead of only using a local IF test, now a combination of the same local
IF test (T/F do the computation) is used in conjunction with and a test
for if the diagnostic is permitted (is km_opt==5).

The km_opt==5 scheme originally had (and hopefully, will eventually again have) 
specified arrays via the package capability in the Registry. Those fields need to be 
protected from accidental use when km_opt==2.

LIST OF MODIFIED FILES:
modified:   dyn_em/module_diffusion_em.F

TESTS CONDUCTED:
 - [x] Without mods, there are attempts to compute km_opt==5 diags when km_opt==2.
 - [x] With mods, no attempts to compute km_opt==5 diags when km_opt==2.
TYPE: maintainance

KEYWORDS: WRFPlus, adjoint code update

SOURCE: internal

DESCRIPTION OF CHANGES:
PR wrf-model#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: new feature

KEYWORDS: aircraft data assimilation, bias correction, predictor

SOURCE: Feng Gao, gao.feng.nuist@gmail.com.

DESCRIPTION OF CHANGES: 

1. Implement VarBC of TAMDAR temperature observations. It accounts for  the representation of some well-known error sources contributing to uncertainties in aircraft-based temperature measurements. The bias correction is applied based upon aircraft's IDs and phases (descent/ascent/cruise).

2. To turn on this function, set "use_varbc_tamdar = true" in namelist (\wrfvar4).
Two types of bias model are provided:
varbc_tamdar_bm=1: two predictors are a constant of 1.0 and vertical motion rates of aircraft. 
varbc_tamdar_bm=2: five predictors are a constant of 1.0, vertical motion rates of aircraft, Mach number, temperature tendency, and temperature measured. 

LIST OF MODIFIED FILES: 

	modified:   Registry/registry.var
	modified:   var/build/da.make
	modified:   var/build/depend.txt
	modified:   var/da/da_control/da_control.f90
	modified:   var/da/da_define_structures/da_define_structures.f90
	modified:   var/da/da_main/da_solve.inc
	modified:   var/da/da_main/da_wrfvar_finalize.inc
	modified:   var/da/da_main/da_wrfvar_init2.inc
	modified:   var/da/da_main/da_wrfvar_top.f90
	modified:   var/da/da_minimisation/da_adjoint_sensitivity.inc
	modified:   var/da/da_minimisation/da_calculate_gradj.inc
	modified:   var/da/da_minimisation/da_calculate_j.inc
	modified:   var/da/da_minimisation/da_get_innov_vector.inc
	modified:   var/da/da_minimisation/da_get_var_diagnostics.inc
	modified:   var/da/da_minimisation/da_kmat_mul.inc
	modified:   var/da/da_minimisation/da_minimisation.f90
	modified:   var/da/da_minimisation/da_minimise_cg.inc
	modified:   var/da/da_minimisation/da_minimise_lz.inc
	modified:   var/da/da_minimisation/da_transform_vtoy.inc
	modified:   var/da/da_minimisation/da_transform_vtoy_adj.inc
	modified:   var/da/da_test/da_check_gradient.inc
	new file:   var/da/da_varbc_tamdar/da_varbc_tamdar.f90
	new file:   var/da/da_varbc_tamdar/da_varbc_tamdar_adj.inc
	new file:   var/da/da_varbc_tamdar/da_varbc_tamdar_direct.inc
	new file:   var/da/da_varbc_tamdar/da_varbc_tamdar_init.inc
	new file:   var/da/da_varbc_tamdar/da_varbc_tamdar_precond.inc
	new file:   var/da/da_varbc_tamdar/da_varbc_tamdar_pred.inc
	new file:   var/da/da_varbc_tamdar/da_varbc_tamdar_tl.inc
	new file:   var/da/da_varbc_tamdar/da_varbc_tamdar_update.inc
	new file:   var/run/VARBC_TAMDAR.tbl

TESTS CONDUCTED: 
 1. A 6-week simulation over 'CONUS' domain with and without VarBC scheme has been conducted.
 2. WRFDA regression tests passed.

RELEASE NOTE: New capability for variational bias correction of TAMDAR T observations.
Gao Feng, Liu Zhiquan, Ma Juhui, A. Jacobs Neil, P. Childs Peter, & Wang, Hongli. (2019). Variational Bias Correction of TAMDAR Temperature Observations in the WRF Data Assimilation System. Monthly Weather Review. 147. 10.1175/MWR-D-18-0025.1.
TYPE: text only

KEYWORDS: landuse variables

SOURCE: internal

DESCRIPTION OF CHANGES: Add descriptions

LIST OF MODIFIED FILES:
M phys/module_physics_init.F

TESTS CONDUCTED:
Text only.
…#1054)

TYPE: new feature

KEYWORDS: dx, grid distance, MOAD

SOURCE: internal

DESCRIPTION OF CHANGES:
Similar to the WPS namelist, only the most-coarse domain needs to have the grid distance 
specified. For a user, this means that only column 1 in the `namelist.input` file needs to be specified
for the `dx` and `dy` namelist variables. If a user _does_ provide information for additional
domains, the provided `dx` an `dy` are ignored in favor of the values computed from the 
`parent_grid_ratio` entries.

Since the ARW code now handles the computation of the child domain grid distances, there is 
no need to explicitly include those additional columns of information in any of the ARW namelists. 

It is not an error to _HAVE_ those values additional columns of information for dx or dy (so as 
to support backwards capability with older namelists). However, the dx and dy values for the 
grid distances for columns 2 through max_dom are redundant and internally overwritten.

LIST OF MODIFIED FILES:
modified:   share/module_check_a_mundo.F
modified:   em_b_wave/namelist.input
modified:   em_b_wave/namelist.input.backwards
modified:   em_esmf_exp/namelist.input.jan00.ESMFSST
modified:   em_esmf_exp/namelist.input.jan00.NETCDFSST
modified:   em_fire/namelist.input_hill_simple
modified:   em_fire/namelist.input_two_fires
modified:   em_heldsuarez/namelist.input
modified:   em_les/namelist.input
modified:   em_les/namelist.input.SGP
modified:   em_les/namelist.input_shalconv
modified:   em_quarter_ss/namelist.input
modified:   em_quarter_ss/namelist.input_2to1
modified:   em_quarter_ss/namelist.input_3to1
modified:   em_quarter_ss/namelist.input_4to1
modified:   em_quarter_ss/namelist.input_5to1
modified:   em_real/namelist.input
modified:   em_real/namelist.input.4km
modified:   em_real/namelist.input.chem
modified:   em_real/namelist.input.diags
modified:   em_real/namelist.input.global
modified:   em_real/namelist.input.jan00
modified:   em_real/namelist.input.jun01
modified:   em_real/namelist.input.ndown_1
modified:   em_real/namelist.input.ndown_2
modified:   em_real/namelist.input.ndown_3
modified:   em_real/namelist.input.pbl-les
modified:   em_real/namelist.input.volc

TESTS CONDUCTED:
1. Comparing the results from the original code with the results from the new code, bit-wise
identical results are not expected, as the internally computed value of the grid distance will
be different that what is assigned based on the namelist entry. The output from the netcdf
files shows the difference in the grid distance:
```
> ncdump -h ORIG_CODE/wrfout_d03_2000-01-24_12:00:00 | grep -iw dx
		:DX = 3333.33f ;
```
```
> ncdump -h NEW_CODE/wrfout_d03_2000-01-24_12:00:00 | grep -iw dx
		:DX = 3333.333f ;
```


Differences on d01 after 3 minutes (1 CG time step, 3 d02 time steps, 9 d03 timesteps):
![Screen Shot 2020-01-14 at 2 03 47 PM](https://user-images.githubusercontent.com/12666234/72382550-b96c3880-36d6-11ea-9bee-bf2cce5ce279.png)

Differences on d03 after 3 minutes (1 CG time step, 3 d02 time steps, 9 d03 timesteps):
![Screen Shot 2020-01-14 at 2 08 39 PM](https://user-images.githubusercontent.com/12666234/72382896-78285880-36d7-11ea-8fcb-e335fab0f9fe.png)

2. Using the new source code mods, and comparing only against the new modifications, bit-wise 
identical answers with the following namelist options:
```
 max_dom                             = 3,
 e_we                                = 74,    31,    31,
 e_sn                                = 61,    31,    31,
 dx                                  = 30000, 10000,  3333.33,
 dy                                  = 30000, 10000,  3333.33,
 grid_id                             = 1,     2,     3,
 parent_id                           = 0,     1,     2,
 parent_grid_ratio                   = 1,     3,     3,
```
```
 max_dom                             = 3,
 e_we                                = 74,    31,    31,
 e_sn                                = 61,    31,    31,
 dx                                  = 30000, 11000,  3333.33,
 dy                                  = 30000, 11000,  3333.33,
 grid_id                             = 1,     2,     3,
 parent_id                           = 0,     1,     2,
 parent_grid_ratio                   = 1,     3,     3,
```
```
 max_dom                             = 3,
 e_we                                = 74,    31,    31,
 e_sn                                = 61,    31,    31,
 dx                                  = 30000,
 dy                                  = 30000,
 grid_id                             = 1,     2,     3,
 parent_id                           = 0,     1,     2,
 parent_grid_ratio                   = 1,     3,     3,
```
3. Helpful messages are printed at the top of the ARW real and WRF standard
outputs that describe the computed grid distances that are used within the
programs. For all three of the namelists above, the printout is:
```
  Domain # 1: dx = 30000.000 m
  Domain # 2: dx = 10000.000 m
  Domain # 3: dx =  3333.333 m
```
4. A test program was written around the new recursive subroutine.
```
MODULE inside

CONTAINS

RECURSIVE SUBROUTINE get_moad_factor ( id, parent_id, parent_grid_ratio, max_dom, factor )
   IMPLICIT NONE
   INTEGER                     :: max_dom
   INTEGER, DIMENSION(max_dom) :: parent_id, parent_grid_ratio
   INTEGER                     :: factor, id

   IF ( id .EQ. 1 ) THEN
      RETURN
   ELSE
      factor = factor * parent_grid_ratio(id)
      CALL get_moad_factor ( parent_id(id), parent_id, parent_grid_ratio, max_dom, factor )
   END IF
END  SUBROUTINE get_moad_factor

END MODULE inside

!==============

program tester
use inside
implicit none

integer , parameter :: huge_max_dom = 6

real,dimension(huge_max_dom) :: dx, dy
integer,dimension(huge_max_dom) :: grid_id, parent_id, parent_grid_ratio

integer :: factor, id, loop, max_dom

dx(1)             = 30000.
grid_id           = (/1, 2, 3, 4, 5, 6/)
parent_id         = (/0, 1, 2, 1, 4, 5/)
parent_grid_ratio = (/1, 3, 3, 2, 3, 4/)

do max_dom = 1, huge_max_dom
   do loop = 1, max_dom
      id = loop
      factor = 1
      call get_moad_factor ( id, parent_id, parent_grid_ratio, max_dom, factor )
      dx(id) = dx(1) / REAL(factor)
      print *,'max_dom = ',max_dom,', dom = ',loop,', dx = ',dx(id)
   end do
   print *,' '
end do

end program tester
```
The output is as expected:
```
> a.out
 max_dom =            1 , dom =            1 , dx =    30000.0000

 max_dom =            2 , dom =            1 , dx =    30000.0000
 max_dom =            2 , dom =            2 , dx =    10000.0000

 max_dom =            3 , dom =            1 , dx =    30000.0000
 max_dom =            3 , dom =            2 , dx =    10000.0000
 max_dom =            3 , dom =            3 , dx =    3333.33325

 max_dom =            4 , dom =            1 , dx =    30000.0000
 max_dom =            4 , dom =            2 , dx =    10000.0000
 max_dom =            4 , dom =            3 , dx =    3333.33325
 max_dom =            4 , dom =            4 , dx =    15000.0000

 max_dom =            5 , dom =            1 , dx =    30000.0000
 max_dom =            5 , dom =            2 , dx =    10000.0000
 max_dom =            5 , dom =            3 , dx =    3333.33325
 max_dom =            5 , dom =            4 , dx =    15000.0000
 max_dom =            5 , dom =            5 , dx =    5000.00000

 max_dom =            6 , dom =            1 , dx =    30000.0000
 max_dom =            6 , dom =            2 , dx =    10000.0000
 max_dom =            6 , dom =            3 , dx =    3333.33325
 max_dom =            6 , dom =            4 , dx =    15000.0000
 max_dom =            6 , dom =            5 , dx =    5000.00000
 max_dom =            6 , dom =            6 , dx =    1250.00000
```

RELEASE NOTE: The ARW real and WRF code now ignore the provided grid distance for any domain other than the most-coarse grid. This update to the namelist processing for grid distance provides user-level behavior in the real/WRF namelist.input file similar to the WPS geogrid and metgrid programs' usage of the namelist.wps file.
…rf-model#1026)

TYPE: bug fix

KEYWORDS: SMS-3DTKE, package

SOURCE: Xu Zhang (Shanghai Typhoon Institute)

DESCRIPTION OF CHANGES:
1. Redefined the variable `l_scale` using a new name `l_diss`, which does not conflict with
variables used in `km_opt=2`.
2. Packaged seven variables used in the `km_opt=5`.
3. Deleted most diagnostic variables such as `u_h_tend`, `v_h_tend`, `w_h_tend` that are 
seldom used by most users, and cleaned up the related codes. Only seven state variables used 
in `km_opt=5` are left.
 
LIST OF MODIFIED FILES:
Registry/Registry.EM_COMMON
Registry/Registry.NMM
dyn_em/module_diffusion_em.F
dyn_em/module_first_rk_step_part2.F
dyn_em/solve_em.F
share/module_check_a_mundo.F

TESTS CONDUCTED:
 - [x] em_fire test with `km_opt=2`.
 - [x] em_les tests with `km_opt=2` and `km_opt=5`.
 - [x] em_tropical_cyclone with `km_opt=2`, `km_opt=5`, and some PBL schemes.
TYPE: enhancement

KEYWORDS: LBC files

SOURCE: Kevin Manning and Jim Bresch (MMM/NCAR), internal

DESCRIPTION OF CHANGES:
For real-time users, the ability to start the WRF model before the
GFS model finishes allows the WRF model to complete a regional 
simulation earlier (because of not delaying the model start). However, this 
only works if the lateral boundary files from subsequent times are able to be 
ingested by the model. As a compile-time option, this split LBC capability has 
existed for years. Now that capability from the compile-time option is run-time 
selectable from the namelist.

1. WRF model

Modify the compile-time option in WRF that provides the capability for split
LBC files, and now make that capability a namelist-driven run-time option.
By default, the multi_bdy_files option is FALSE.

2. real program

The user may now set the namelist.input file as follows in real:
```
 &time_control
 start_year                          = 2000, 2000, 2000,
 start_month                         = 01,   01,   01,
 start_day                           = 24,   24,   24,
 start_hour                          = 12,   12,   12,
 end_year                            = 2000, 2000, 2000,
 end_month                           = 01,   01,   01,
 end_day                             = 25,   25,   25,
 end_hour                            = 12,   12,   12,
 interval_seconds                    = 21600
 bdy_inname                          = "wrfbdy_d<domain>_<date>"
 /

 &bdy_control
 multi_bdy_files                     = .true.
 /
```
and receive the following files with a single run of the real program.
```
wrfbdy_d01_2000-01-24_12:00:00
wrfbdy_d01_2000-01-24_18:00:00
wrfbdy_d01_2000-01-25_00:00:00
wrfbdy_d01_2000-01-25_06:00:00
```

ISSUE:
Fixes wrf-model#656 "Multi-file lateral boundary conditions"

LIST OF MODIFIED FILES:
modified:   Registry/Registry.EM_COMMON
modified:   main/real_em.F
modified:   run/README.namelist
modified:   share/mediation_integrate.F
modified:   share/module_check_a_mundo.F
modified:   test/em_real/examples.namelist

TESTS CONDUCTED:
1. Checked 24-h Jan 2000 simulation with SPLIT LBC vs traditional LBC: bit-for-bit results.
2. The lateral boundary files and the initial condition files are bit-wise identical whether the 
the original two-time-levels of multiple runs of the real program were used or if the new 
single-run of the real program is used.
3. Tried inconsistent namelist settings. They are detected:
```
 &time_control
 blah 
 /
 bdy_inname = "wrfbdy_d<domain>_<date>"

 &bdy_control
 multi_bdy_files = .true.
 /
```
Yields:
```
  --- ERROR: Need bdy_inname = "wrfbdy_d<domain>_<date>"
-------------- FATAL CALLED ---------------
FATAL CALLED FROM FILE:  <stdin>  LINE:    2035
NOTE:       1 namelist settings are wrong. Please check and reset these options
-------------------------------------------
```
And the other way:
```
 &time_control
 bdy_inname = "wrfbdy_d<domain>_<date>"
 /

 &bdy_control
 blah
 /
 multi_bdy_files = .true.
```
Yields:
```
  --- ERROR: Remove bdy_inname = "wrfbdy_d<domain>_<date>"
-------------- FATAL CALLED ---------------
FATAL CALLED FROM FILE:  <stdin>  LINE:    2035
NOTE:       1 namelist settings are wrong. Please check and reset these options
-------------------------------------------
```
4. Code benignly builds with NMM.

RELEASE NOTE: A run-time capability for multiple LBC files is now available. This supersedes and replaces the compile-time option. This is run-time option is accessed through &bdy_control namelist logical variable multi_bdy_files. This option requires that the lateral boundary file names in &time_control include a date: `bdy_inname = "wrfbdy_d<domain>_<date>"`. All other functionality of the capability is identical to the compile-time option.
…th vertical nesting (wrf-model#981)

TYPE: Enhancement

KEYWORDS: vertical nesting, RRTMG, longwave radiation, ra_lw_physics

SOURCE: Robert Arthur (LLNL)

DESCRIPTION OF CHANGES: When the RRTMG longwave radiation scheme (ra_lw_physics=4) was 
used in combination with vertical nesting, the longwave radiation was incorrect because the 
variable NLAYERS was set incorrectly. To fix this, NLAYERS is recalculated based on the updated 
number of vertical levels. This fix follows what is done already in the code for ra_lw_physics=1.

LIST OF MODIFIED FILES: 
phys/module_radiation_driver.F
share/module_check_a_mundo.F

TESTS CONDUCTED: 
1. Regression test runs and gives bit-wise identical parallel solutions with RRTMG and vertical 
nesting (21VN), and is also able to run RRTMG without vertical nesting (case=tropical, 
case=conus):
```
SUCCESS_RUN_WRF_d01_em_real_32_em_real_21VN vs SUCCESS_RUN_WRF_d01_em_real_33_em_real_21VN status = 0
SUCCESS_RUN_WRF_d01_em_real_32_em_real_21VN vs SUCCESS_RUN_WRF_d01_em_real_34_em_real_21VN status = 0
SUCCESS_RUN_WRF_d01_em_real_32_em_real_conus vs SUCCESS_RUN_WRF_d01_em_real_33_em_real_conus status = 0
SUCCESS_RUN_WRF_d01_em_real_32_em_real_conus vs SUCCESS_RUN_WRF_d01_em_real_34_em_real_conus status = 0
SUCCESS_RUN_WRF_d01_em_real_32_em_real_tropical vs SUCCESS_RUN_WRF_d01_em_real_33_em_real_tropical status = 0
SUCCESS_RUN_WRF_d01_em_real_32_em_real_tropical vs SUCCESS_RUN_WRF_d01_em_real_34_em_real_tropical status = 0
```

2. A nested case was run with 4 setups, with ra_sw/lw_physics = 1 and 4, and vertical nesting 
on and off on the finest domain (see plot). The non-vertically nested case has 88 vertical levels 
and the nested case has 351. While there are differences in the longwave radiation (GLW) 
depending on whether vertical nesting is used or not, the differences when using option 4 are 
comparable (and slightly smaller) than those with option 1.

![glw_comparison](https://user-images.githubusercontent.com/46732079/65084297-b0a16b00-d95f-11e9-89fb-d787d972c889.png)

RELEASE NOTE: The vertical refinement option now works with the RRTMG radiation scheme.
TYPE: new feature

KEYWORDS: Thompson microphysics, graupel, Y-intercept parameter

SOURCE: Greg Thompson (NCAR-RAL)

DESCRIPTION OF CHANGES:  
Significant alteration of how Y-intercept parameter is diagnosed for one-moment graupel.  
Attempt is made to follow observations of Field et al. (2018JAMC). Y-intercept is now directly 
proportional to mass mixing ratio as opposed to being inversely proportional. Also expands the 
lookup tables for rain collecting either snow or graupel and the total range of Y-intercept values.

ISSUE:  
Fixes issue wrf-model#966 "module_mp_thompson lookup tables (qr_acr_qs.dat and qr_acr_qg.dat) with 
PR: graupel_Yintercept_new".  Due to the expansion of the elements in 3 vectors (called "r_s," 
"r_g," and "N0g_exp") along with the number of elements held in variables "ntb_s," "ntb_g," 
and "ntb_g1," respectively, the look-up table files called "qr_acr_qs.dat" and "qr_acr_qg.dat" 
have now been updated to include "V2" in their names to avoid conflict with old lookup table 
files.

LIST OF MODIFIED FILES: 
phys/module_diag_misc.F
phys/module_mp_thompson.F

TESTS CONDUCTED:  
1. Numerous real cases and idealized 3D squall line cases were run with the new Y-intercept.
2. Since new data files are generated / used, a test case was run with the new code and with 
the old data in the directory. With a 3km DX, 12s DT for 20 minutes dumping history files each 
5 mins., the simulation ran fine reporting: d01 2015-06-19_12:20:00 wrf: SUCCESS COMPLETE 
WRF when the 20 minutes was reached. The wrfout files, viewed with with ncview, look as 
expected.

RELEASE NOTE:  For Thompson MP, a significant alteration is introduced for diagnosing the Y-intercept parameter for the one-moment graupel. These changes affect results for any graupel area. The changes are based on observations of graupel/hail size spectra from aircraft observations.
TYPE: bug fix, enhancement, and new feature

KEYWORDS: mass-flux, diffusivity, subgrid clouds, memory reduction

SOURCE: Joseph Olson (NOAA) with contributions from Jaymes Kenyon (NOAA/CIRES)

DESCRIPTION OF CHANGES:

A series of small tweaks to help reduce a cold bias in the PBL:
- slight increase in diffusion in convective conditions
- relaxed criteria for mass-flux activation/strength
- added capability to cycle TKE for continuity in hourly updating HRRR
- added effects of compensational environmental subsidence in mass-flux scheme, which resulted in tweaks to detrainment rates.

- Bug fix for diagnostic-decay of SGS clouds - noticed by Greg Thompson. This has
a very small, but primarily positive, impact on SW-down biases.
- Tweak to calculation of KPBL - urged by Laura Fowler - to make more intuitive.
- Tweak to temperature range of blending for saturation check (water to ice). This slightly reduces excessive SGS clouds in polar region. No impact warm clouds.
- Added namelist option bl_mynn_output (0 or 1) to suppress or activate the allocation and output of 10 3D variables. Most people will want this set to 0 (default) to save memory and disk space.
- Removed TKE_PBL for memory purposes - only outputting QKE
- Added the forcing of bl_mynn_output=0 when bl_mynn_edmf=0 in check_a_mundo

LIST OF MODIFIED FILES:
M Registry/Registry.EM_COMMON
M share/module_check_a_mundo.F
M dyn_em/module_first_rk_step_part1.F
M phys/module_bl_mynn.F
M phys/module_pbl_driver.F
M phys/module_physics_init.F

TESTS CONDUCTED: Single case study looked good - similar to GSD's v3.9+ code. Automatic reg test has passed.

RELEASE NOTE: Tweaks to reduce cold bias in PBL, bug fix to for diagnostic-decay of SGS clouds, tweak to reduce excessive SGS clouds in polar region, added namelist control for output of 10 3D diagnostic output, and removed TK_PBL in output (only QKE). This code is very similar to what's in the upcoming HRRRv4, which will become operation in June 2020.
rcabell and others added 20 commits January 7, 2021 17:41
TYPE: bug fix

KEYWORDS: build, hydro, intel, stanza

SOURCE: Ryan Cabell (NCAR)

DESCRIPTION OF CHANGES:
Problem:
Building coupled WRF/WRF Hydro models fails when choosing configuration INTEL (ifort/icc): HSW/BDW. 

Solution:
Add missing `ifort compiler with icc` text to ARCH line for the HSW/BDW configuration. For completeness, the KNL MIC
configure stanza was also missing the same information, and has been updated.

Neither of these stanzas are involved in the traditional WRF code build, so there is no impact on users of the default WRF
atmosphere model.

ISSUE: For use when this PR closes an issue.
Fixes wrf-model#1325 

LIST OF MODIFIED FILES: 
M       arch/configure.defaults

TESTS CONDUCTED: 
1. Modification causes WRF-Hydro build to complete successfully with the `INTEL (ifort/icc): HSW/BDW` configuration
2. Jenkins testing all positive
…model#1273)

TYPE: Bug fix

KEYWORDS: Fix, obsolescent, non-standard, features

SOURCE: Milan Curcic (University of Miami)

DESCRIPTION OF CHANGES:
Problem:
This PR removes or fixes some obsolescent and non-standard features in several physics modules which were
preventing WRF to be built with IBM XL v16.1.1 on Power9, as reported in wrf-model#1270.

Solution:
1. Replace amax1() occurrences with max()
2. Explicitly cast literal constants that are passed to min() and max() intrinsics so that they are type and kind
compatible with other arguments
3. Replace calls to the non-standard flush() subroutine with the standard flush() statement.

ISSUE:
Fixes wrf-model#1270

LIST OF MODIFIED FILES:
M phys/module_cu_mskf.F
M phys/module_cu_scalesas.F
M phys/module_dust_emis.F
M phys/module_mp_fast_sbm.F
M phys/module_mp_milbrandt2mom.F
M phys/module_mp_p3.F
M phys/module_mp_thompson.F
M phys/module_ra_goddard.F
M phys/module_shcu_deng.F

TESTS CONDUCTED:

These fixes were necessary to allow WRF to be built and run on IBM Power9 with the XL v16.1.1 compiler. The
executables build in both single (./configure) and double (./configure -r8) precision modes.
Jenkins testing is all pass.

RELEASE NOTE: Several physics modules were updated to be more Fortran standard-conforming. This PR removes or fixes some obsolescent and non-standard features in these physics modules which were preventing WRF to be built with IBM XL v16.1.1 on Power9.
…ent hydrometeors, shortwave irradiances in time series (wrf-model#1284)

TYPE: bug fix, enhancement

KEYWORDS: solar diagnostic, shortwave irradiance, solar zenith, hydrometeor, cloud

SOURCE: Timothy W. Juliano, Ju-Hye Kim, Pedro A. Jimenez, Jared Lee, Thomas Brummet (NCAR/RAL)

DESCRIPTION OF CHANGES:
Bug fixes
Problem:
1. Value of cosine solar zenith angle (coszen) can be slightly <-1 or slightly >1, which results in a nonphysical value for diagnosis of the solar zenith angle
2. Calculating cloud parameters in solar diagnostic package when hydrometeor type is not present

Solution:
1. Bound the values of coszen to be [-1, 1]
2. Add conditional check in solar diagnostic module for presence of hydrometeor type before calculating cloud parameters. Also add check for summation of water path variables to ensure >=0.0 kg/m2.

Enhancement
We have added the Global Horizontal Irradiance (SWDOWN), Direct Normal Irradiance (SWDDNI), and Diffuse Horizontal Irradiance (SWDDIF), as well as the clear-sky Global Horizontal Irradiance (SWDOWNC) and clear-sky Direct Normal Irradiance (SWDDNIC) variables to the tslist when the solar diagnostic package is activated. Furthermore, we add these five variables as calculated by FARMS: SWDOWN2, SWDDNI2, SWDDIF2, SWDOWNC2, and SWDDNIC2.

All 10 variables are output regardless of model physics configuration. Variables SWDOWN, SWDDNI, and SWDDIF are calculated when any shortwave radiation scheme is active. If the RRTMG (ra_sw_physics=4) or RRTMG FAST (ra_sw_physics=24) shortwave radiation scheme or FARMS (swint_opt=2) is activated, then variables SWDOWNC and SWDDNIC are calculated [otherwise, set to MISSING (=-999.0)]. If FARMS (swint_opt=2) is activated, then variables SWDOWN2, SWDDNI2, SWDDIF2, SWDOWNC2, and SWDDNIC2 are calculated [otherwise, set to MISSING (=-999.0)].

LIST OF MODIFIED FILES:
M Registry/Registry.EM_COMMON
M Registry/registry.solar_fields
M phys/module_diag_solar.F
M phys/module_diagnostics_driver.F
M phys/module_radiation_driver.F
M run/README.tslist
M share/wrf_timeseries.F

TESTS CONDUCTED:
1. We have run simulations with and without the fixes. Problem 1: When coszen is within the range [-1, 1], the model results are bit for bit identical before and after the change. Problem 2: The model output confirms that the cloud parameters are not calculated when the hydrometeor type is not present and also that the water path variables are positive. Enhancement: The tslist output is written as expected.
2. Jenkins testing is all PASS.

RELEASE NOTE: Several fixes are introduced for the solar diagnostic package: 1) Correct solar zenith angle calculation (this will have a small effect on radiation for all schemes); and 2) check presence of hydrometeor type before calculating cloud parameters. An enhancement to the package is also introduced: Adding shortwave irradiance variables to the tslist when activating the RRTMG or RRTMG FAST shortwave radiation scheme or FARMS.
…rf-model#1359)

TYPE: bug fix 

KEYWORDS: chemistry, sectional, CCN, mixactivate

SOURCE: Calvin Howes (UCLA), Richard Easter (PNNL), internal

DESCRIPTION OF CHANGES:

Problem:
The sectional scheme diagnostic CCN1, CCN2, ... CCN6 output as computed in mixactivate did not allow for particle 
growth in the computation of volume-mean diameters.  This bug was initially found by Calvin Howes, with the current 
fix proposed by Richard Easter 09/25/2020.  The CCN output fields being diagnostic do not impact actual aerosol 
activation, so cloud properties are not impacted by the bug.

Solution:

Subroutine mixactivate in module_mixactivate.F was modified to use actual time-dependent sizes rather than the default values in computing critical supersaturations and hence CCN.

LIST OF MODIFIED FILES:
M       phys/module_mixactivate.F 

TESTS CONDUCTED: 

1. The first set of attached figures shows CCN6 (CCN at > 1% SS) in the WRF restart files for the lowest model level in a simulation of the Amazon using chem_opt = 11 (RADM2SORG_AQ).  The number of CCN is reduced in areas of cloud formation, suggesting wet removal.  But this preferentially impacts the larger / activated Aitken mode particles, reducing the particle size from the default size.  Thus with the bug fix the diagnosed CCN is reduced relative to the standard code, while the cloud condensate mixing ratio (QCLOUD) is unchanged (second set of slides).

[CCN_bug_fix_test_4.2.2.pptx](https://github.com/wrf-model/WRF/files/5784455/CCN_bug_fix_test_4.2.2.pptx)

2. Jenkins testing is all pass.

RELEASE NOTE: Corrected bug in mixactivate for diagnostic CCN in sectional schemes. Impacts Morrison and Lin et al. microphysics schemes.
…1336)

TYPE: bug fix

KEYWORDS: geopotential, index, horizontal advection, open, specified

SOURCE: Matthias Göbel (University of Innsbruck)

DESCRIPTION OF CHANGES:

When using advection order < 5 (h_sca_adv_order) and open or specified boundary conditions, the upper limits in the horizontal advection loops of geopotential are one too small.

Let's look at the y-advection with advection order = 2, for instance and assume jte=jde. For open and specified BC the lower limit is increased by 1 from jds to jds+1, but the upper limit is decreased by 2 from jde-1 to jtf=jde-1-2=jde-3. It should be jtf=jde-2, however. Starting at line 2092 the jde-1 point is set, but the jde-2 point is not handled anywhere.

The issue is analogous for x-advection and advection order = 4 (jtf=jde-4 instead of jtf=jde-3).

For advection order >= 5, the limits are set correctly, because a different notation is used: jtf = min(jtf,jde-4)

LIST OF MODIFIED FILES: 
dyn_em/module_big_step_utilities_em.F

TESTING CONDUCTED: 
An LES case is used to test this change, with periodic y-boundaries and open x-boundaries, mean x-wind of 10 m/s, h_sca_adv_order=3, and north-south oriented cosine ridge in the center of the domain. Here is the perturbation geopotential after 1 minute integration at k=2:
![ph](https://user-images.githubusercontent.com/17001470/102336394-67d8c780-3f91-11eb-899d-3b05d28c05ab.png)
and here the difference plot:
![ph_diff](https://user-images.githubusercontent.com/17001470/102336506-876ff000-3f91-11eb-9ccf-7615df8adaff.png)

One can clearly see the higher geopotential in the new formulation at i=ide-3. This is the point where the horizontal advection is not carried out by the current algorithm.

After 10 minutes it looks like this:
![ph_600](https://user-images.githubusercontent.com/17001470/102336745-dd449800-3f91-11eb-9b06-94776b70d9c8.png)
![ph_diff_600](https://user-images.githubusercontent.com/17001470/102336749-df0e5b80-3f91-11eb-83ac-1d15a499aae9.png)

It passes all Jenkins tests too.

RELEASE NOTES: When using advection order < 5 (namelist h_sca_adv_order), and either open or specified boundary conditions, the upper limit of the indexing in the horizontal advection loops of geopotential was previously incorrect. For horizontal advection order >= 5 (which is the default), the index limits are correct.
TYPE: bug fix

KEYWORDS: lh_urb2d, diagnostics, noahmp

SOURCE: internal (reported by Xin-Zhong Liang)

DESCRIPTION OF CHANGES:
Problem:
lh_urb2d was inconsistent with other urban budget arrays sh_urb2d, g_urb2d, and rn_urb2d by being the only one multiplied by the urban fraction making it a grid cell average instead of urban area average. This is only a diagnostic for output with using of an urban option together with NoahMP.

Solution:
Divide lh_urb2d by frc_urb2d. Won't affect model run results apart from this diagnostic. These arrays are not in default history output.

LIST OF MODIFIED FILES:
phys/module_sf_noahmpdrv.F

TESTS CONDUCTED:
Only Jenkins tests were performed.
The Jenkins tests are all passing.

RELEASE NOTE: Fix lh_urb2d diagnostic to be urban area average instead of grid cell average consistent with other urb2d diagnostics associated with NoahMP. No effect on run results.
…del#1314)

TYPE: bug fix

KEYWORDS: boundary conditions, symmetric, corners

SOURCE: Matthias Göbel (University of Innsbruck)

DESCRIPTION OF CHANGES:
Problem:
In idealized simulations, the routine `set_physical_bc3d` sets the boundary zone points for periodic, symmetric, and open boundary conditions.
At first, the routine does not set the corner points (e.g., (ids-1,jds-1)): For the y-boundaries, it iterates i only from `MAX(ids,its-1)` to  `MIN(ite+1,ide+istag)` and analogously for the x-boundaries (note that for open BC it actually also tries to set the corner points (see line 896), but not effectively, because the RHS values in lines 903-905 are still 0 there, as the y-BC has not been applied yet).

For doubly-periodic BC, the corner points are set correctly afterward, starting at line 1100. In any other case, however, it seems that the corner points are not assigned and appear as zeros. 

These corner points are later used, e.g. in the SGS UV-flux (titau_21_12) in the diffusion module:
https://github.com/wrf-model/WRF/blob/f311cd5e136631ebf3ebaa02b4b7be3816ed171f/dyn_em/module_diffusion_em.F#L5511-L5517
Thus, because `rho(i_start-1,k,j_start-1)=0` and `xkx(i_start-1,k,j_start-1)=0`, we have `xkxavg(i_start, k, j_start)` much smaller than at the other locations.

This is usually not a problem, since the deformation defor12 and thus also the flux titau_21_12 should be 0 at these corner points when using symmetric boundary conditions on at least one of these boundaries.
I write "should" because that's a theoretical argument. In practice, only the deformation at the ids or jds boundaries is zero. Due to an inconsistency in the symmetric BC for the deformation, the deformation at the ide or jde boundaries is not 0. This problem is described in the following.

The deformation (variable = 'd') is treated like an unstaggered variable: https://github.com/wrf-model/WRF/blob/f311cd5e136631ebf3ebaa02b4b7be3816ed171f/share/module_bc.F#L1003-L1011
Thus, the deformation which was initially zero at the boundary is set to a non-zero value by `dat(i,k,jde) = dat(i,k,jde-1)`.
All staggered variables except the normal velocity (so also the deformation) should be treated equally in the symmetric boundaries since the location of the symmetric boundary is on the staggered grid. Therefore I adjusted the relevant if statement in the second commit.

If open boundary conditions are used on any of the boundaries, only the fluxes on the interior are calculated, so the corner points also don't matter. However, to avoid any current or future side effects due to the missing corner points, corner points are set anyway as it is done in `set_physical_bc2d`.

Solution:

1. commit:
The solution to set the corner points is the same as is already applied in the 2d routine `set_physical_bc2d`.

2. commit:
To treat all variables staggered in a certain direction equally, the variables `jstag` and `istag` are used in the if statement instead of checking the value of `variable`. This was done only for the symmetric BC. For the open BC, it might be necessary, too.

3. commit:
The corner point assignment for doubly-periodic BC is now redundant and was removed.

ISSUE:
Fixes wrf-model#1311

LIST OF MODIFIED FILES: share/module_bc.F

TESTS CONDUCTED:
With the first commit, I tested, whether the corner points for doubly-periodic BC are set in the same way as in the original code. This test allowed removing this redundant part of the code in commit 3.

To compare the different model versions, I ran an idealized simulation with km_opt=2, diff_opt=2, tke_heat_flux=0.2, U = 5 m/s, periodic in x, symmetric in y.
The following figure shows the titau_21_12 flux at k=kds after 20 minutes for three model versions:
left: original, middle: fixed corners (commit 1), right: fixed corners and fixed symmetric BC for the deformation (commit 1 and 2)
![fuy_sgs](https://user-images.githubusercontent.com/17001470/98154601-505be880-1ed5-11eb-9f0a-6eef1175e730.png)

All versions have titau_21_12=0 at j=jds. In the left and middle panel, the fluxes at jde and jde-1 are almost identical. However, the original version has fluxes with lower magnitudes at the upper left and right corners (as the corners of xkmh and rho are not set as explained above). In the right panel, the flux at j=jde is now also zero as it should be.

The following figure shows a time series of U at the upper left corner:
![u_timeseries](https://user-images.githubusercontent.com/17001470/98154606-52be4280-1ed5-11eb-93d3-563062274e5c.png)

We can see that fixing the symmetric BC to have zero fluxes at j=jde does have a significant effect.
Fixing the corners (commit 1) only has a minor effect, which is maximized at the corner points (j=jde, i=ids, and ide) as can be seen here:
![u_diff](https://user-images.githubusercontent.com/17001470/98154624-55b93300-1ed5-11eb-906d-b8aaef7f1596.png)

RELEASE NOTE: 
Missing corner points are set when setting boundary conditions of 3D variables and all staggered variables are treated equally in symmetric BC. Thereby the periodic BC become cleaner and more consistent with set_physical_bc2d and the symmetric BC are fixed as horizontal deformation is treated now as a staggered variable which leads to correct BC for SGS momentum fluxes at the northern boundaries.
Type: Text only
Keywords: prepare for release of WRFV4.2.2
Source: internal
Description of Changes: modify README and inc/version_decl
List of modified files:
M README
M inc/version_decl
Test conducted: not necessary
Finalize WRFV4.2.2 by merging bug fixes from release-v4.2.2 branch onto master.
See the annotation of the v4.2.2 tag for full release notes (git show v4.2.2)
@letmaik letmaik force-pushed the letmaik/wrf-cmake-4.2 branch 3 times, most recently from ab73f5d to 268b61e Compare January 17, 2021 19:02
@letmaik letmaik force-pushed the letmaik/wrf-cmake-4.2 branch from 268b61e to 02f7e2c Compare January 17, 2021 22:27
@letmaik letmaik marked this pull request as ready for review January 18, 2021 08:16
@letmaik letmaik requested a review from dmey January 18, 2021 08:17
@letmaik letmaik merged commit 77fc06d into wrf-cmake-teb Jan 18, 2021
@letmaik letmaik deleted the letmaik/wrf-cmake-4.2 branch January 18, 2021 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.