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

Update WRF-DART interface to support WRF4 #673

Merged
merged 20 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion models/wrf/model_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ subroutine static_init_model()
wrf%dom(id)%type_u = get_type_ind_from_type_string(id,'U')
wrf%dom(id)%type_v = get_type_ind_from_type_string(id,'V')
wrf%dom(id)%type_w = get_type_ind_from_type_string(id,'W')
wrf%dom(id)%type_t = get_type_ind_from_type_string(id,'T')
wrf%dom(id)%type_t = get_type_ind_from_type_string(id,'THM')
wrf%dom(id)%type_gz = get_type_ind_from_type_string(id,'PH')
wrf%dom(id)%type_qv = get_type_ind_from_type_string(id,'QVAPOR')
wrf%dom(id)%type_qr = get_type_ind_from_type_string(id,'QRAIN')
Expand Down
6 changes: 5 additions & 1 deletion models/wrf/readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ DART interface module for the Weather Research and Forecasting
`(WRF) <https://www.mmm.ucar.edu/weather-research-and-forecasting-model>`__
model. This page documents the details of the
module compiled into DART that interfaces with the WRF data in the state vector.
**The WRF-DART interface is compatible with WRF versions 4 and later, and is
no longer backwards compatible with WRFv3.9 and earlier.**
For more information on the interface changes required between
different WRF versions see the WRF tutorial link in the next section.

WRF+DART Tutorial
-----------------
Expand Down Expand Up @@ -362,4 +366,4 @@ Files
References
----------

http://www2.mmm.ucar.edu/wrf/users/docs/user_guide_V3/contents.html
https://www2.mmm.ucar.edu/wrf/users/docs/user_guide_v4/contents.html
5 changes: 5 additions & 0 deletions models/wrf/shell_scripts/add_bank_perts.ncl
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,21 @@ begin
asciiwrite("mem"+MEM_NUM+"_pert_bank_num",ens_mem_num)
print ("bank member number "+ens_mem_num)


;For WRFv4 or later prognostic temp variable is THM
pert_fields = (/"U", "V", "T", "QVAPOR","MU"/)
wrf_fields = (/"U", "V", "THM", "QVAPOR","MU"/)
pert_scale = (/scale_U,scale_V,scale_T,scale_Q,scale_M/)
nperts = dimsizes(pert_fields)
pert_in = addfile(pert_bank_path+"/"+pert_bank_file,"r")
wrf_in = addfile(wrf_file,"w")
do n=0,nperts-1
temp_w = wrf_in->$pert_fields(n)$
temp_w = wrf_in->$wrf_fields(n)$
Copy link
Member

Choose a reason for hiding this comment

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

I might not be following the ncl here, but this looks like you set
temp_w = wrf_in->$pert_fields(n)$ which is T
then immediately overwrite it with
temp_w = wrf_in->$wrf_fields(n)$ which is THM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch -- I think I just forgot to remove the original line that I edited. Not very smart on my part.

temp_p = pert_in->$pert_fields(n)$
temp_c = temp_w+(temp_p * pert_scale(n))
wrf_in->$pert_fields(n)$ = temp_c
wrf_in->$wrf_fields(n)$ = temp_c
delete(temp_w)
delete(temp_p)
delete(temp_c)
Expand Down
10 changes: 5 additions & 5 deletions models/wrf/shell_scripts/param.csh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ set POST_STAGE_DIR = ${BASE_DIR}/post
set OBS_DIAG_DIR = ${BASE_DIR}/obs_diag
set PERTS_DIR = ${BASE_DIR}/perts

# Directories that can be used by many things
# Assign path to DART, WRF, WPS and WRFDA build
set SHELL_SCRIPTS_DIR = ${BASE_DIR}/scripts
set DART_DIR = /glade/work/USER/DART # set this appropriately #%%%#
set WRF_DM_SRC_DIR = /glade/work/USER/WRFV3 # set this appropriately #%%%#
Expand All @@ -47,14 +47,14 @@ set GRIB_DATA_DIR = ${ICBC_DIR}/grib_data # set this app
set GRIB_SRC = 'GFS' # set this appropriately #%%%#

# list of variables for extraction and cycling
set extract_vars_a = ( U V PH T MU QVAPOR QCLOUD QRAIN QICE QSNOW QGRAUP QNICE QNRAIN \
set extract_vars_a = ( U V PH THM MU QVAPOR QCLOUD QRAIN QICE QSNOW QGRAUP QNICE QNRAIN \
U10 V10 T2 Q2 PSFC TSLB SMOIS TSK RAINC RAINNC GRAUPELNC )
set extract_vars_b = ( U V W PH T MU QVAPOR QCLOUD QRAIN QICE QSNOW QGRAUP QNICE QNRAIN \
set extract_vars_b = ( U V W PH THM MU QVAPOR QCLOUD QRAIN QICE QSNOW QGRAUP QNICE QNRAIN \
U10 V10 T2 Q2 PSFC TSLB SMOIS TSK RAINC RAINNC GRAUPELNC \
REFL_10CM VT_DBZ_WT )
set cycle_vars_a = ( U V PH T MU QVAPOR QCLOUD QRAIN QICE QSNOW QGRAUP QNICE QNRAIN \
set cycle_vars_a = ( U V PH THM MU QVAPOR QCLOUD QRAIN QICE QSNOW QGRAUP QNICE QNRAIN \
U10 V10 T2 Q2 PSFC TSLB SMOIS TSK )
set increment_vars_a = ( U V PH T MU QVAPOR QCLOUD QRAIN QICE QSNOW QGRAUP QNICE QNRAIN U10 V10 T2 Q2 PSFC )
set increment_vars_a = ( U V PH THM MU QVAPOR QCLOUD QRAIN QICE QSNOW QGRAUP QNICE QNRAIN U10 V10 T2 Q2 PSFC )

# Diagnostic parameters
set OBS_VERIF_DAYS = 7
Expand Down
36 changes: 28 additions & 8 deletions models/wrf/tutorial/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,30 @@ and only covers the WRF-specific aspects of coupling with DART.
It is not wise to try to run WRF-DART if you have no experience with
either WRF or DART.

This tutorial was designed to be compatible with WRF V3.9.1 and was
tested with DART V11.0.2. Other releases of WRF may or may not be
backwards or forwards compatible with this tutorial.
.. Important ::

This tutorial was designed to be compatible with WRF Version 4 and was
tested with WRFv4.5.2. This tutorial should not be used with DART
versions 11.4.0 and earlier because those older versions do not account
for different coordinate systems including the sigma hybrid coordinates as
described in `DART Issue #650 <https://github.com/NCAR/DART/pull/650>`__.
Furthermore, older versions do not account for the prognostic temperature variable
switch from T to the moist potential temperature (THM) as described in
`DART issue #661 <https://github.com/NCAR/DART/issues/661>`__.

Earlier version of WRF (v3.9) may run without errors with more recent versions of
DART (later than 11.4.0), but the assimilation performance will be deprecated.
If you need to run with earlier versions of WRF, please review the changes required
to switch from WRFv4 to WRFv3 as documented within
`DART issue #661 <https://github.com/NCAR/DART/issues/661>`__,
or contact the DART team. Earlier WRF versions also require different settings
within the WRF ``namelist.input`` file to promote vertical stability for the tutorial
example. These settings are also described in DART Issue #661.

Prior to running this tutorial, we urge the users to familarize themselves with the
`WRF system <https://www2.mmm.ucar.edu/wrf/users/model_overview.html>`__
(WRF_ARW, WPS and WRFDA), and to read through the `WRFv3.9 User's Guide
<https://www2.mmm.ucar.edu/wrf/users/docs/user_guide_V3/user_guide_V3.9/contents.html>`__
(WRF_ARW, WPS and WRFDA), and to read through the `WRFv4.5 User's Guide
<https://www2.mmm.ucar.edu/wrf/users/docs/user_guide_v4/contents.html>`__
and the `WRF model tutorials <https://www2.mmm.ucar.edu/wrf/users/tutorial/tutorial.html>`__

The DART team is not responsible for and does not maintain the WRF code. For WRF related issues check out the
Expand Down Expand Up @@ -233,13 +250,16 @@ bash ``export BASE_DIR=<path_to_your_working_directory>``
::

cd $BASE_DIR
wget http://www.image.ucar.edu/wrfdart/tutorial/wrf_dart_tutorial_23May2018_v3.tar.gz
tar -xzvf wrf_dart_tutorial_23May2018_v3.tar.gz
wget http://www.image.ucar.edu/wrfdart/tutorial/wrf_dart_tutorial_29Apr2024.tar.gz
tar -xzvf wrf_dart_tutorial_29Apr2024.tar.gz

After untarring the file you should see the following directories:
*icbc, output, perts,* and *template.* The directory names (case
sensitive) are important, as the scripts rely on these local paths
and file names.
and file names. Please note that the perturbation, surface and initial
condition files were derived from an earlier version (pre-4.0) of WRF/WPS/WRFDA
but still maintains compatibility with the (post-4.0, post-11.4.0)
WRF-DART versions recommended to run this WRF assimilation example.

2. You will need template WRF namelists from the
``$DART_DIR/models/wrf/tutorial/template`` directory:
Expand Down
6 changes: 3 additions & 3 deletions models/wrf/tutorial/template/input.nml.template
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
first_obs_seconds = -1,
last_obs_days = -1,
last_obs_seconds = -1,
num_output_state_members = 0,
num_output_obs_members = 3,
num_output_state_members = 50,
num_output_obs_members = 50,
output_interval = 1,
num_groups = 1,
output_forward_op_errors = .false.,
Expand Down Expand Up @@ -117,7 +117,7 @@
wrf_state_variables = 'U','QTY_U_WIND_COMPONENT','TYPE_U','UPDATE','999',
'V','QTY_V_WIND_COMPONENT','TYPE_V','UPDATE','999',
'W','QTY_VERTICAL_VELOCITY','TYPE_W','UPDATE','999',
'T','QTY_POTENTIAL_TEMPERATURE','TYPE_T','UPDATE','999',
'THM','QTY_POTENTIAL_TEMPERATURE','TYPE_T','UPDATE','999',
'PH','QTY_GEOPOTENTIAL_HEIGHT','TYPE_GZ','UPDATE','999',
'MU','QTY_PRESSURE','TYPE_MU','UPDATE','999',
'QVAPOR','QTY_VAPOR_MIXING_RATIO','TYPE_QV','UPDATE','999',
Expand Down
2 changes: 2 additions & 0 deletions models/wrf/tutorial/template/namelist.input.meso
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@
diff_6th_opt = 2, 2,
diff_6th_factor = 0.25, 0.12,
epssm = 0.1
use_theta_m = 0
zadvect_implicit = 1
/

&bdy_control
Expand Down
6 changes: 3 additions & 3 deletions models/wrf/work/input.nml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
first_obs_seconds = -1,
last_obs_days = -1,
last_obs_seconds = -1,
num_output_state_members = 0,
num_output_obs_members = 32,
num_output_state_members = 3,
num_output_obs_members = 3,
output_interval = 1,
num_groups = 1,
distributed_state = .true.
Expand Down Expand Up @@ -205,7 +205,7 @@
'V', 'QTY_V_WIND_COMPONENT', 'TYPE_V', 'UPDATE','999',
'W', 'QTY_VERTICAL_VELOCITY', 'TYPE_W', 'UPDATE','999',
'PH', 'QTY_GEOPOTENTIAL_HEIGHT', 'TYPE_GZ', 'UPDATE','999',
'T', 'QTY_POTENTIAL_TEMPERATURE','TYPE_T', 'UPDATE','999',
'THM', 'QTY_POTENTIAL_TEMPERATURE','TYPE_T', 'UPDATE','999',
'MU', 'QTY_PRESSURE', 'TYPE_MU', 'UPDATE','999',
'QVAPOR','QTY_VAPOR_MIXING_RATIO', 'TYPE_QV', 'UPDATE','999',
'PSFC', 'QTY_SURFACE_PRESSURE', 'TYPE_PSFC', 'UPDATE','999',
Expand Down