Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge WRF 4.2.1 #49

Merged
merged 147 commits into from
Jan 15, 2021
Merged

Merge WRF 4.2.1 #49

merged 147 commits into from
Jan 15, 2021

Conversation

letmaik
Copy link

@letmaik letmaik commented Jan 12, 2021

This brings the repo up-to-date with 4.2.1. See the last commit in this PR for all the extra changes done (CI, CMake etc).

Notable changes:

  • CMake: ninja is now the only supported build system (previously Make). Module dependency scanning is only approximate when using CMake's Makefile generator, but it is exact when using ninja. Some change in the preprocessor macros of WRF caused the approximate scanning to fail, hence the switch to ninja.

Other changes:

  • In CI, gcc/gfortran 10 is now used for macOS, Windows and Ubuntu builds. Some patches to fix compiler issues with gfortran 10 have been backported into this PR from the as yet unreleased 4.2.2 version of WRF.
  • Appveyor and Travis CI have been dropped in favour of maintaining only a single CI environment (Azure Pipelines).
  • CI environments have been updated:
    • macOS 10.14 -> 10.15
    • Ubuntu 16.04 -> 18.04
    • CentOS 6 -> 7

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, [email protected].

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.
YulongMa and others added 18 commits July 10, 2020 11:01
…1213)

TYPE: bug fix

KEYWORDS: nesting, configure -r8, integer

SOURCE: Yulong Ma (University of Delaware)

DESCRIPTION OF CHANGES:
Problem:
A segmentation fault occurs when running nesting with "./configure -r8" and using the urban
scheme. This was traced to incorrect interpolation (Registry d option) and feedback (Registry
u option) subroutines that are assigned in a Registry file. The interp_fcnm is a masked
interpolation for real variables. For integers, the interpolation should use the only available
option: interp_fcni.

Solution:
In Registry/Registry.EM_COMMON, an example of the incorrect subroutine is:

state    integer   UTYPE_URB2D  ij    misc        1         -     rd=(interp_fcnm)u=(copy_fcnm)       "UTYPE_URB"  "URBAN TYPE"         "dimensionless"
The Registry line should be:

state    integer   UTYPE_URB2D  ij    misc        1         -     rd=(interp_fcni)u=(copy_fcni)       "UTYPE_URB"  "URBAN TYPE"         "dimensionless"
LIST OF MODIFIED FILES:
Registry/Registry.EM_COMMON: fields changed= UTYPE_URB2D, mosaic_cat_index
Registry/registry.clm: fields changed= NUMC, NUMP, SNL
Registry/registry.noahmp: fields changed= isnowxy

TESTS CONDUCTED:

Without mod, code seg faults during first time step.
With mod, code runs to completion. Fields look OK
Jenkins testing all PASS.
RELEASE NOTE: Using real*8, nesting, and urban caused a segmentation fault, which has been fixed. The problem was traced to a default assignment to the wrong horizontal interpolation and feedback routines.
TYPE: bug fix

KEYWORDS: shin hong, divide by zero

SOURCE: Matthias Göbel (University of Innsbruck)

DESCRIPTION OF CHANGES: When using the Shin-Hong PBL with initially zero wind, divisions by zero can occur. This bug fix includes if-statements to avoid a crash of the model. All limit values that are used instead of the divisions by zero should be mathematically correct, except for the third change where I guessed the appropriate limit value.

LIST OF MODIFIED FILES: phys/module_bl_shinhong.F

RELEASE NOTE: fixed divide by zero in Shin-Hong PBL
…. See WRF Issue wrf-model#1206. (wrf-model#1221)

TYPE: bug fix

KEYWORDS: macros, compiler, llvm, clang

SOURCE: Isaac Rowe (University of Kentucky)

DESCRIPTION OF CHANGES:
Problem:
Some versions of LLVM clang cannot parse spaces near parentheses in cpp macros. For example:

DM_BCAST_MACRO_R16 ( FAF1 )
This bug has been discussed on the LLVM site: https://bugs.llvm.org/show_bug.cgi?id=18011.

Solution:
The surrounding spaces around the parentheses from the macros with parameters in
phys/module_mp_fast_sbm.F were removed.

DM_BCAST_MACRO_R16(FAF1)
Only a single file uses this "nonstandard" spacing for the cpp macros.

ISSUE:
Fixes wrf-model#1206 (Usage of macros is incompatible with clang cpp -traditional-cpp).

LIST OF MODIFIED FILES:
phys/module_mp_fast_sbm.F

TESTS CONDUCTED:

Now builds with LLVM cpp (Apple clang version 11.0.3 (clang-1103.0.32.62)). Previously received Unclassifiable statement error at module_mp_fast_sbm.f90:6065:4 during next step in compilation.
Jenkins test all PASS.
RELEASE NOTES: A fix was provided to support building the WRF system with LLVM clang. Some versions of LLVM clang cannot correctly parse spaces near parentheses in cpp macros, and those spaces have been removed.
TYPE: bug fix

KEYWORDS: subroutine, end

SOURCE: Ted Mansell (NSSL), issue reported by Manuel Luis Aznar (University of La Laguna)

DESCRIPTION OF CHANGES:
Compilation error generated by a subroutine which has an "end" statement but does not have an
"end subroutine X" statement.

Platform: Macos High Sierra (10.13)
Compilers: Fortran: ifort Version 13.0.3.198 Build 20130606; cc: clang-1000.11.45.5
MPI: Openmpi 2.1.2
ISSUE:
Fixes issue wrf-model#1215 (Error in compiling WRF v4.2)

LIST OF MODIFIED FILES:
phys/module_fr_fire_phys.F

TESTS CONDUCTED:

Previously, the compiler complained about the syntax:
time mpif90 -f90=ifort -o module_fr_fire_phys.o -c -O3 -fp-model precise -w -ftz -align all -fno-alias -fno-common -FR -convert big_endian  [etc.]  module_fr_fire_phys.f90
module_fr_fire_phys.f90(755): error #6378: SUBROUTINE must be present on the end-subroutine-stmt of an internal or module subroutine
end
^
compilation aborted for module_fr_fire_phys.f90 (code 1)
Addition of "subroutine read_namelist_fire" resolved the error.

Jenkins test passed.
RELEASE NOTE: A compiler error was raised by ifort 13 for a fire module routine due to omission of the keyword "SUBROUTINE" in the "END SUBROUTINE" statement. This has been addressed.
…1228)

TYPE: bug fix

KEYWORDS: process_time_series, solar, segfault

SOURCE: Franciano Puhales (Federal University of Santa Maria, Brazil) and internal

DESCRIPTION OF CHANGES:
When using time series with the solar diagnostic option activated, the model segfaults.
This was traced to missing fields in the package for tseries_add_solar: ts_p_profile
and ts_w_profile.

ISSUE:
Fixes wrf-model#1227 (time series + solar diagnostics = seg fault)

LIST OF MODIFIED FILES:
modified: Registry.EM_COMMON

TESTS CONDUCTED:

OP reports this fixes the issue.
Jenkins is all PASS.
RELEASE NOTE: When using time series with the solar diagnostic option activated, the model segfaulted. This problem was traced to missing fields in the package for tseries_add_solar: ts_p_profile and ts_w_profile. The missing fields have been added to the package list, allowing the proper functioning of time series with solar diagnostics.
TYPE: bug fix

KEYWORDS: advection, TKE, wind turbine

SOURCE: Cristina L. Archer, Sicheng Wu, and Yulong Ma (University of Delaware, CReW), and Pedro A. Jimenez (NCAR/RAL)

DESCRIPTION OF CHANGES: The TKE generated by wind turbines is not advected when the user instructs MYNN to advected the TKE. The present PR fixes this issue. Our research (Archer et al. 2020) indicates that after fixing this issue the production of TKE by wind turbines is too large and we have reduced the TKE coefficient (correction factor = 0.25) based on extensive comparison with LES results. The figure bellow summarizes this choice:

ALL_TKE_profiles_LES_PR_figc

ISSUE: N/A

LIST OF MODIFIED FILES:
M phys/module_pbl_driver.F
M phys/module_wind_fitch.F
M Registry/Registry.EM_COMMON
M run/README.namelist
M Registry/Registry.NMM

TESTS CONDUCTED:

We have conducted simulations with and without the fix to ensure WRF is properly advecting the TKE generated by the wind turbines.
The jenkins tests are OK
RELEASE NOTE: Bug fix to advect the TKE generated by the wind turbines if the user instructs MYNN to advect the TKE. There is also an empirical reduction of the wind turbines' TKE coefficient based on LES results (Archer et al. 2020).

Archer, C.L., S. Wu, Y. Ma, and P.A. Jimenez, 2020: Turbulent kinetic energy generated by wind farms is treated incorrectly in the WRF model. Mon. Wea. Rev. (Under review).
…model#1247)

TYPE: bug fix

KEYWORDS: advection, program, 1d

SOURCE: internal

DESCRIPTION OF CHANGES:
There were two types of problems. First the original cpp commands were broken. The cpp command was commented out,
but it is used to build the source code, with cut and paste). The second problem is caused by the modification of the
advection interface with the release of v4.0.

First Problem and Solution:

Original suggested using cpp -traditional. This is an incorrect cpp option. The flag is supposed to be
cpp -traditional-cpp.

Original suggested using cpp -C -P. The -C flag puts these GNU comments in the code (which is OK if you
are writing in the C language).

/* Copyright (C) 1991-2012 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, see
   <http:https://www.gnu.org/licenses/>.  */

Second Problem:
The existing advection testing program had not been updated to assume the existence of the hybrid vertical coordinate.
That meant a few variables in the calls to the scalar advection routines (c1 and c2) were missing. The advection testing
tool would not compile.

Second Solution:
Initialize the 1d arrays c1 and c2 to terrain-following coordinate settings (c1=1, c2=0), and pass those args into the
WRF scalar advection drivers. The simplified settings are not important since this is just for a 1d advection.

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

TESTS CONDUCTED:

All of the changes are inside of ifdefs, so there is no impact to the compilable WRF code. The advection main program
had the interfaces updated to match the current advection drivers.
Previously, the advection testing code did not compile. Now the tester program builds and runs. Here are the results
after 0, 1200, 1400, 1600, 1800, and 2000 full time steps (each full time step is constructed of three small time steps).
Results from the advection schemes scalar_adv_opt = 0 (standard scalar advection), 1 (positive definite), 2 (monotonic),
3 (WENO), and 4 (WENO PD) are shown. Every 200 full steps, the square wave should be back in the original location.
Screen Shot 2020-07-09 at 12 45 43 PM

Screen Shot 2020-07-09 at 12 47 18 PM

Screen Shot 2020-07-09 at 12 42 29 PM

Screen Shot 2020-07-09 at 12 49 10 PM

Screen Shot 2020-07-09 at 12 52 12 PM

RELEASE NOTE: I don't want to support this, so no release information.
…itions (wrf-model#1217)

TYPE: enhancement

KEYWORDS: slope, periodic boundary conditions

SOURCE: Matthias Göbel (University of Innsbruck)

DESCRIPTION OF CHANGES: In the current WRF version the slope angle on the lateral boundaries of the domain is calculated differently than in the interior of the domain. For the former, forward or backward final differences are used, for the latter central finite differences. This can lead to different shortwave fluxes for equivalent locations in mountainous terrain.
For periodic boundary conditions, the terrain outside of the domain is known and set right before.
This enhancement implements central differences also for the domain boundary to get the same shortwave flux for equivalent locations.

ISSUE: Fixes wrf-model#1008

LIST OF MODIFIED FILES: dyn_em/start_em.F

TESTS CONDUCTED:

RELEASE NOTE: for periodic boundary conditions the slope calculation for the lateral boundaries is made equivalent to the calculation for the interior of the domain
TYPE: text only

KEYWORDS: PR, commit message, template

SOURCE: internal

DESCRIPTION OF CHANGES:
Problem:
The older commit templates referred to WTF and had some singleton three quotes in a row (without
a closing set of quotes). There was ambiguity in the requests for what tests were to be conducted, and there
was no reference to the jenkins results.

Solution:
Small text tweaks, just update and clarify expectations from contributors. The text for the two templates is now
consistent.

LIST OF MODIFIED FILES:
modified:   .github/PULL_REQUEST_TEMPLATE
modified:   tools/commit_form.txt

TESTS CONDUCTED:
1. No source changes, but jenkins ran OK.
TYPE: bug fix

KEYWORDS: floating point exception, log, gamma

SOURCE: Ted Mansell (NSSL)

DESCRIPTION OF CHANGES: 
1. A previous change to a lookup table caused a log(0) floating point exception. There was no practical impact 
unless compiling with debug checks for FPEs.  The problem was when the incomplete gamma function was 
called with a second argument of zero. It now correctly returns the complete gamma. 
2. Since the gamxinflu lookup table is double precision, calculated values for it are now DP instead of single 
precision. Very slight differences will result.
3. The lookup table is also slightly expanded for the next update -- no impact here.

LIST OF MODIFIED FILES: 
phys/module_mp_nssl_2mom.F

ISSUE:
Fixes wrf-model#1207 "Bug: log(0) in module_mp_nssl_2mom.F"

TESTS CONDUCTED: 
1. Ideal simulation to confirm no substantial difference in result.
2. Jenkins status all PASS.

RELEASE NOTE: 
For NSSL Microphysics, fixed a floating point log(0) and minor change to lookup table.
TYPE: text only

KEYWORDS: readme, rinblw, max_dom

SOURCE: Peng Zimu (Peking University) and internal

DESCRIPTION OF CHANGES: 
One of the FDDA capabilities for blending observations with the gridded simulation relies on the appropriate 
observation density within a specified radius of influence, which is controlled by the option rinblw (km). To allow 
for different observations on different nests, this option is defined in the Registry as a max_domains namelist entry. 
Therefore this option should be specified for each individual domain. This PR:

1. adds (max_dom) to rinblw in test/em_real/README.grid_fdda
2. adds multiple columns for rinblw in test/em_real/examples.namelist. 

For users with nested domains, before this mod, the WRF code returned:
```
Error in rinblw, please specify a reasonable value ***
```
This update to the documentation helps users to _a priori_ correctly set rinblw for nested domains. 

LIST OF MODIFIED FILES:
M   test/em_real/examples.namelist
M   test/em_real/README.grid_fdda

TESTS CONDUCTED: 
1. After setting rinblw for nested domains, the WRF with surface-analysis nudging can run successfully.
2. Only README files changed, no tests required.

RELEASE NOTES: A modification to a couple of the README files, which helps users to correctly set rinblw when surface-analysis nudging is applied to nested domains. Previously, the rinblw was not consistently identified as a max_dom variable.
TYPE: bug

KEYWORDS: photolysis scheme, TUV, diagnostics, debug_level

SOURCE: Xin Zhang (NUIST)

DESCRIPTION OF CHANGES:
Problem:
When using WRF-Chem with the new Photolysis option (phot_opt = 4) activated, the model spends too much time
writing the TUV.diags. These diagnostics should only used for debugging photolysis rates. The diagnostics should be
enabled only for an explicitly requested debug value.

Solution:
Enable TUV diagnostics only when debug_level >= 100.

ISSUE:
Fixes wrf-model#1242 Speed up writing the TUV.diags file

LIST OF MODIFIED FILES:
M chem/rxn.F

TESTS CONDUCTED:

TUV init is much quicker and the WRF-Chem one domain simulation test is successful.
The time is the time of the diagnostics call.
Here's the table if debug_level = 0:

Before Commit	After Commit
24 cores	1s	skip
120 cores	10 min	skip
If I change debug_level to 100, this is the result:

Before Commit	After Commit
24 cores	1s	1s
120 cores	10 min	10 min
Jenkins test is successful.
RELEASE NOTE: When using WRF-Chem with the new Photolysis option (phot_opt = 4) activated, the model spent too much time on looping and writing the TUV.diags which is only used for debugging photolysis rates. The diagnostics are now enabled only for debug_level >=100.
)

TYPE: bug fix

KEYWORDS: m_opt, momentum flux

SOURCE: Matthias Göbel (University of Innsbruck)

DESCRIPTION OF CHANGES:
When outputting SGS momentum fluxes using the option m_opt, the units of the fluxes should be m2 s-2 according
to registry.les. The fluxes above the surface are divided by the density and thus have the correct units. The surface
fluxes, however, still contain the density.

This bug fix divides the surface fluxes by the density to obtain the correct units.

This change only affects the output of the SGS fluxes (nba_mij). The tendencies and thus the results are not changed.

LIST OF MODIFIED FILES:
dyn_em/module_diffusion_em.F

TESTS CONDUCTED:

Jenkins OK
RELEASE NOTE: Fixed units of surface momentum flux in dyn_em/module_diffusion_em.F when using m_opt. This bug fix divides the surface fluxes by the density to obtain the correct units. This change only affects the output of the SGS fluxes (nba_mij). The tendencies and thus the results are not changed.
… of subroutine 'rad_rrtmg_driver'. (wrf-model#1257)

TYPE: bug fix

KEYWORDS: module_ra_rrtmg_swk.F, RRTMK, RRTMG

SOURCE: James Ruppert, Penn State University

DESCRIPTION OF CHANGES: Longwave (RTHRATENLW) and shortwave (RTHRATENSW) radiative tendencies were in reversed order at start of subroutine rad_rrtmg_driver in module_ra_rrtmg_swk.F (driver for RRTMK radiation scheme). These reverse-ordered tendencies feed directly up to module_radiation_driver.F. While this bug leads to the output shortwave and longwave tendencies being in swapped positions, this bug does not affect the sum of shortwave and longwave heat tendency (RTHRATEN), so it does not affect model results.

LIST OF MODIFIED FILES:
M phys/module_ra_rrtmg_swk.F

TESTS CONDUCTED: Verified that this bug fix places the correct fields into the variables RTHRATENLW (aka RTHRATLW) and RTHRATENSW (aka RTHRATSW) as viewed through model output. Also verified that all other model output variables are not changed due to this fix in a test case by MMM.

RELEASE NOTE: A bug is fixed for the long- and short-wave radiative tendencies from RRTMK scheme. The current longwave tendency (RTHRATLW), if output from the model, is actually the shortwave tendency, and vise versa. However the sum of the two, RTHRATEN, is correct, and hence this bug only affect separate radiative tendencies, but not model results. (Thanks to James Ruppert of Penn State University.)
…wrf-model#1253)

TYPE: New feature

KEYWORDS: Static analysis, regression testing

SOURCE: John Collins (SimCon / Edge Hill University)

CHANGES:
The WRF code has a large number of nonstandard constructs that have been in the code for a while. Part of the capability 
of the FPT static analysis tool is to discover noncompliant Fortran syntax and usage. 
1. A few issues in the existing WRF code preclude the FPT utility from running on WRF, including outright Fortran 
bugs. The bugs are removed. 
2. Additionally, the temporary files in the frame directory associated with the automatic code generation of 
namelist configuration processing are no longer removed by the Makefile. This was not a bug, but the static 
analyzer needsthe cpp manufactured code to continue to exist.

This PR represents an initial step. Once the WRF code is suitable for automatic use by FPT, then a second PR will 
introduce the required exemplar files for comparison. That step, which insures no additional nonstandard Fortran 
constructs or usages are introduced, will eventually be part of the jenkins testing.

MODIFIED FILES:
dyn_em/module_first_rk_step_part1.F
   * Inserted missing continuation
   * The leading "&" character in column 6 on the following line was sufficient for GNU, Intel, PGI

external/io_grib2/bacio-1.3/bacio.F
   * Inserted missing "::" delimiters
   * A declaration with an assignment requires the "::" delimeters

frame/Makefile
   * Commented-out deletion of xx*.f90 and yy*.f90.    
   * These are needed for the regression test and are deleted by the `clean` script

phys/module_bl_mynn.F
   * Additional + sign deleted at line 3030

TESTS CONDUCTED:  
1. fpt regression tests
2. Jenkins is all PASS.

RELEASE NOTE: Changes required to implement a static analysis regression of WRF are being introduced. This is an initial phase, with the static analysis to implementation to follow.  Please see:
http:https://simconglobal.com/WRF_Workshop_June_2011_Poster_Automatic_Detection_of_Software_Errors_in_WRF.pdf
http:https://simconglobal.com/WRF_Workshop_June_2012_Poster_QA_Analysis_of_the_WRF_Program.pdf
http:https://simconglobal.com/collins_et_al_2013_automated_quality_assurance_analysis_wrf_a_case_study.pdf
TYPE: no impact

KEYWORDS: version_decl, README

SOURCE: internal

DESCRIPTION OF CHANGES: 
Update the version number of this release to v4.2.1

LIST OF MODIFIED FILES:
README
inc/version_decl

TESTS CONDUCTED: 
1. Regression test all PASS (of course).
@letmaik letmaik marked this pull request as draft January 13, 2021 07:53
@letmaik letmaik force-pushed the letmaik/wrf-4.2.1 branch 3 times, most recently from d596bb9 to b5c4e04 Compare January 14, 2021 08:46
@letmaik
Copy link
Author

letmaik commented Jan 15, 2021

Plots look fine.

rel_err_ext_boxplot
rel_err_ext_boxplot

@letmaik letmaik marked this pull request as ready for review January 15, 2021 19:09
@letmaik letmaik requested a review from dmey January 15, 2021 19:10
Copy link

@dmey dmey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In line with previous plots.👍

@letmaik letmaik merged commit 520bc0b into wrf-cmake Jan 15, 2021
@letmaik letmaik deleted the letmaik/wrf-4.2.1 branch January 15, 2021 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet