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

Add NOAA UFS UGWP suite of physics parameterizations #1276

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from

Conversation

mdtoyNOAA
Copy link

@mdtoyNOAA mdtoyNOAA commented Jan 24, 2025

This PR incorporates NOAA's Unified Forecast System (UFS) Unified Gravity Wave Physics (UGWP) suite of physics parameterizations into MPAS: https://ufs.epic.noaa.gov/wp-content/uploads/2021/07/UGWP_in_UFS_July_2021-1.pdf.

The following is a brief overview on using the suite:

  1. In the init_atmosphere core, there is a new static pre-processing option, 'config_native_gwd_gsl_static', that is used to generate a new static file used by the Unified Gravity Wave Physics. The static file is written by the ugwp_oro_data stream, and requires two new datasets in the geographical dataset directory: 'topo_ugwp_30s' and 'topo_ugwp_2.5m'.
  2. In the atmosphere core, there are several new options when config_gwdo_scheme = 'bl_ugwp_gwdo': config_ngw_scheme, config_knob_ugwp_tauamp, and config_ugwp_diags.
  3. If config_ngw_scheme = true, an additional input file, ugwp_limb_tau.nc is needed. This namelist options activates the non-stationary gravity wave drag scheme.
  4. If config_ugwp_diags = true, the diag_ugwp output stream will be written.

NOTE: This physics package is the "NOAA/GSL" orographic gravity wave drag (GWD) suite introduced in WRF Version 4.3 (activated by WRF namelist option "gwd_opt=3"), but with the addition of a non-stationary GWD parameterization that represents gravity wave sources such as deep convection and frontal instability.

Thanks to @mgduda for help and advice on how to incorporate the NOAA/GSL code into the MPAS-Dev repository.

…tmosphere

This commit adds three new source files

 mpas_gsl_oro_data_sm_scale.F
 mpas_gsl_oro_data_lg_scale.F
 mpas_init_atm_gwd_gsl.F

to the init_atmosphere core, along with modifications to the main
core_init_atmosphere Makefile to compile these source files.

At present, none of the code in these files is called from the init_atmosphere
core.
…re core

This commit defines new static fields, a new package, a new namelist option, and
a new output stream for the GSL GWDO scheme. Also included in this commit are
changes to the init_atm_setup_packages() routine to set the new
'gwd_gsl_stage_out' package if and only if the new namelist option
'config_native_gwd_gsl_static' is true.

When 'config_native_gwd_gsl_static' is set in the namelist, the init_atmosphere
core will write the twenty new static fields (var2d, con, oa{1,2,3,4}, and
ol{1,2,3,4}) for large scale (ls) and small scale (ss) to a new 'ugwp_oro_data'
output stream.

As of this commit, code to actually compute the twenty new static fields is not
being called, and so the fields are expected to be zero everywhere.
When the namelist option config_native_gwd_gsl_static is .true., the
init_atm_setup_case() routine now calls thecalc_gsl_oro_data() routine to
compute the twenty GSL GWDO static fields.
This commit adds an entry to the Externals.cfg file to obtain the GSL UGWP code
from a GitHub repository. Also included in this commit are changes to the main
physics Makefile to compile the UGWP code.

At present, none of the UGWP code is called.
Also included in this commit is logic for setting up packages related to the GSL
UGWP scheme in the atm_setup_packages() routine.
…emes

This commit adds a new module, module_bl_ugwp_gwdo, in the
core_atmosphere/physics/physics_wrf directory. This module serves as a wrapper
for the UGWP physics that is compatible with the MPAS-A physics drivers.

Changes to the Makefile in the physics_wrf directory ensure that the
module_bl_ugwp_gwdo.F file is compiled, but at present the code in that module
is not actually called.
With this commit, the UGWP physics can now be used in MPAS-A simulations

* Setting the 'config_gwdo_scheme' namelist option to 'bl_ugwp_gwdo' selects the
  GSL GWDO scheme.

  NOTE: If the GSL GWDO scheme is selected, the 'ugwp_oro_data_in' input stream
        must specify a valid input file with UGWP static fields.

* Setting the 'config_ngw_scheme' namelist option to 'true' will activate the
  non-stationary gravity wave drag scheme.

  NOTE: If the NGW scheme is activated, the 'ugwp_ngw_in' input stream
        must specify a valid input file.

* Setting the 'config_ugwp_diags' namelist option to 'true' will compute UGWP
  diagnostic fields, which will be written by the 'diag_ugwp' output stream.
@@ -243,6 +247,7 @@ clean:
( cd physics_noahmp/drivers/mpas; $(MAKE) clean )
( cd physics_noahmp/src; $(MAKE) clean )
( cd physics_noahmp/utility; $(MAKE) clean )
( cd UGWP; $(MAKE) clean )
Copy link
Contributor

Choose a reason for hiding this comment

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

If the command

make clean CORE=atmosphere

is run before the UWGP directory has been created (for example, if we haven't yet compiled the code), it looks like make will get stuck in a loop. A simple solution might be to change this line to:

( if [ -d UGWP ]; then cd UGWP; $(MAKE) clean; fi )

Copy link
Author

Choose a reason for hiding this comment

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

Done

@mgduda
Copy link
Contributor

mgduda commented Jan 31, 2025

It looks like we may need to add -I./physics/UGWP to the build commands in src/core_atmosphere/Makefile to prevent issues with the nvfortran compiler not finding modules. This seems to be a general issue with the nvfortran compiler -- that search paths for all modules that are used directly and indirectly are required.

--- a/src/core_atmosphere/Makefile
+++ b/src/core_atmosphere/Makefile
@@ -81,7 +81,7 @@ clean:
        $(RM) $@ $*.mod
 ifeq "$(GEN_F90)" "true"
        $(CPP) $(CPPFLAGS) $(PHYSICS) $(CPPINCLUDES) -I./inc $< > $*.f90
-       $(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I../framework -I../operators -I./physics -I./dynamics -I./diagnostics -I./physics/physics_wrf -I./physics/physics_mmm -I../external/esmf_time_f90
+       $(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I../framework -I../operators -I./physics -I./dynamics -I./diagnostics -I./physics/physics_wrf -I./physics/physics_mmm -I./physics/UGWP -I../external/esmf_time_f90
 else
-       $(FC) $(CPPFLAGS) $(PHYSICS) $(FFLAGS) -c $*.F $(CPPINCLUDES) $(FCINCLUDES) -I./inc -I../framework -I../operators -I./physics -I./dynamics -I./diagnostics -I./physics/physics_wrf -I./physics/physics_mmm -I../external/esmf_time_f90
+       $(FC) $(CPPFLAGS) $(PHYSICS) $(FFLAGS) -c $*.F $(CPPINCLUDES) $(FCINCLUDES) -I./inc -I../framework -I../operators -I./physics -I./dynamics -I./diagnostics -I./physics/physics_wrf -I./physics/physics_mmm -I./physics/UGWP -I../external/esmf_time_f90
 endif

Modified src/core_atmosphere/Makefile to avoid endless loop if running
'make clean CORE=atmospere' before the UGWP directory has been created.

Added '-I./physics/UGWP' to src/core_atmosphere/physics/Makefile to
prevent issues with the nvfortran compiler not finding modules.  This
seems to be a general issue with the nvfortran compiler -- that search
paths for all modules that are used directly and indirectly are required.
@mdtoyNOAA
Copy link
Author

@mgduda I added -I./physics/UGWP to the physics/Makefile, did a test compile, and pushed new commit.

@mgduda mgduda self-requested a review February 27, 2025 22:30
Copy link
Contributor

@mgduda mgduda left a comment

Choose a reason for hiding this comment

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

I've just left one request to add pre-processing directives in the Registry.xml file so that we can compile stand-alone MPAS-A as a dynamics-only model. I think just pushing an additional commit to the PR branch with this change should be all that's needed.

@mgduda mgduda self-requested a review February 28, 2025 19:58
Copy link
Contributor

@mgduda mgduda left a comment

Choose a reason for hiding this comment

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

The code changes look good to me. Thanks for all of your work on this, @mdtoyNOAA!

I have one small request: could the PR description be updated to document some of the practical aspects of the changes in this PR? For example, it would be nice to note that:

  1. In the init_atmosphere core, there is a new static pre-processing option, config_native_gwd_gsl_static, that is used to generate a new static file used by the Unified Gravity Wave Physics. The static file is written by the ugwp_oro_data stream, and requires two new datasets in the geographical dataset directory: topo_ugwp_30s and topo_ugwp_2.5m.
  2. In the atmosphere core, there are several new options when config_gwdo_scheme = 'bl_ugwp_gwdo': config_ngw_scheme, config_knob_ugwp_tauamp, and config_ugwp_diags.
  3. If config_ngw_scheme = true, an additional input file, ugwp_limb_tau.nc is needed.
  4. If config_ugwp_diags = true, the diag_ugwp output stream will be written.

I can imagine members of the community asking about the new UGWP option, so having some of this documentation to point to in the PR description (perhaps later to be migrated to more formal user documentation) could be helpful.

@mdtoyNOAA
Copy link
Author

mdtoyNOAA commented Mar 6, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants