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 to Microphysics for HRRRv5 #10

Merged

Conversation

AndersJensen-NOAA
Copy link
Collaborator

@AndersJensen-NOAA AndersJensen-NOAA commented May 3, 2024

This PR is built on top of: #9

This PR includes:

  1. Addition of a 3D reflectivity diagnostic for the microphysics.
  2. Move the call to the reflectivity calculation from the MPAS microphysics driver to the microphysics scheme.
  3. Namelist configuration flags for aerosol aware and hail aware microphysics.
  4. Changes to the microphysics driver so that aerosol aware and non aerosol aware microphysics can be call (hail aware microphysics is NOT hooked up and has NOT been tested).
  5. Added code framework to allow for the initialization of cloud, rain, and ice number concentrations (NOT hooked up in the microphysics submodule and NOT yet tested).
  6. Added flags to the lookup table functionality.

3-km test runs successfully.

AndersJensen-NOAA and others added 10 commits May 2, 2024 07:20
* Set initial value of nc for aerosol-aware microphysics

* Move call to 3D reflectivity to microphysics
solutions for land and ice points. Therefore, with RUC LSM, do not do
call to dirver_seaice.
* Set initial value of nc for aerosol-aware microphysics

* Two quick MPAS fixes (#10)

* Move call to 3D reflectivity to microphysics

* Add flags for Thompson options

* Move lookup table functions to utils and add flags to initialization

* Clean up microphysics flags for table build and initialization

* Add MPAS code for initialization of cloud number concentration
* Set initial value of nc for aerosol-aware microphysics

* Two quick MPAS fixes (#10)

* Move call to 3D reflectivity to microphysics

* Add flags for Thompson options

* Move lookup table functions to utils and add flags to initialization

* Clean up microphysics flags for table build and initialization

* Add option to built hail-aware or non hail-aware lookup tables
@AndersJensen-NOAA AndersJensen-NOAA marked this pull request as ready for review May 4, 2024 03:00
do k=1,nsl
soilice(k)=0.
soiliqw(k)=0.
enddo
Copy link
Collaborator

Choose a reason for hiding this comment

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

@jderrico-noaa Janet, could we revert removing lines 577-580? After all I think it is safer to have this initialization to zero.

@joeolson42
Copy link
Collaborator

Hey everyone, let's get this reviewed asap!

@jderrico-noaa jderrico-noaa merged commit db8d1fb into NOAA-GSL:v8.1-gsl-merge May 8, 2024
jderrico-noaa added a commit that referenced this pull request May 10, 2024
* Update version number to 8.0.2

* * In ./src/core_atmosphere/physics/mpas_atmphys_control.F, the mesoscale-reference suite
  uses the nTiedtke (cu_ntiedtke) and not the tiedtke (cu_tiedtke) parameterization of
  deep and shallow convection. One motivation of using the cu_ntiedtke option instead of
  cu_tiedtke is the scale-aware capability of the nTiedtke parameterization, allowing the
  use of nTiedtke iwth variable-resolution meshes.

  -> therefore, we decided to rename the package cu_tiedtke_in to cu_ntiedtke_in.

* * In ./src/core_atmosphere/physics/physics_wrf, removed the variables f_qv, f_qr, and
  f_qs in module_cu_tiedtke.F and module_cu_ntiedtke.F. Those three variables are not
  used in the parameterizations.

* In ./src/core_atmosphere/physics/mpas_atmphys_driver_convection.F, removed f_qv,
  f_qr, and f_qs in the calls to cu_tiedtke and cu_ntiedtke.

* * In ./src/core_atmosphere/physics/physics_wrf, removed the variables f_qv and f_qc
  in module_cu_kfeta.F. Those two variables are not used in the parameterization.

* In ./src/core_atmosphere/physics/mpas_atmphys_driver_convection.F, removed f_qv
  and f_qc in the call to kf_eta_cps.

* * In ./src/core_atmosphere/physics/mpas_atmphys_driver_convection.F, added comments at the
  top of module.

* * In ./src/core_atmosphere/physics/physics_wrf, removed the variables f_qv and f_qc
  in module_ra_cam.F (subroutine camrad). Those two variables are not used in the
  parameterization.

* In ./src/core_atmosphere/physics/mpas_atmphys_driver_radiation_lw(sw).F, removed
  f_qv and f_qc in the calls to camrad.

* * In ./src/core_atmosphere/physics/mpas_atmphys_vars.F, removed the variable f_qv
  which is not needed in any of the physics parameterizations.

* * In ./src/core_atmosphere/physics:

  -> in mpas_atmphys_vars.F, removed the "parameter" definition for f_qc,f_qr,f_qi,
     f_qs,f_qg,f_nc,and f_ni. these variables are now simply defined as logicals.
     also renamed f_qnc to f_nc, and f_qni to f_ni.

  -> in mpas_atmphys_init.F, added subroutine init_physics_flags to initialize f_qc,
     f_qr,f_qi,f_qs,f_nc,and f_ni.

  -> in mpas_atmphys_driver_pbl.F, changed the call in mynn_bl_driver after renaming
     f_qnc to f_nc, and f_qni to f_ni.

* Allow MPAS to use either of 'mpi_f08' or 'mpi' modules

By defining the MPAS_USE_MPI_F08 macro at compile time, MPAS can now use the
more modern 'mpi_f08' module for MPI. If the MPAS_USE_MPI_F08 macro is not
defined, MPAS uses the 'mpi' module as prior to this commit.

With the use of the 'mpi_f08' module, certain MPI types are no longer integers
in Fortran, but are derived types; e.g., MPI_Comm, MPI_Request, MPI_Datatype,
MPI_Info.

In some instances, an integer-typed MPI type is still needed for
interoperability, and the MPI standard permits this to be done through the
'mpi_val' member of all MPI derived types, e.g., MPI_Comm % mpi_val.

* Add logic in top-level Makefile to detect mpi_f08 module availability

By trying to compile a test program that uses the 'mpi_f08' module, the
top-level Makefile can now detect whether the MPI implementation provides an
'mpi_f08' module and, if so, adds a definition of the MPAS_USE_MPI_F08 macro to
the CPPFLAGS used in the build.

* * In ./src/core_atmosphere/physics:

  -> renamed module mpas_atmphys_driver_lsm_shared.F to mpas_atmphys_lsm_shared.F.

  -> in mpas_atmphys_driver_lsm.F, now use mpas_atmphys_lsm_shared to call subroutine
     correct_tsk_over_seaice. removed subroutine correct_tsk_over_seaice at the bottom
     of the module.

  -> corrected Makefile accordingly.

* Generalize mpas_sphere_angle function to work for non-unit-radius spheres

The methods previously employed in the mpas_sphere_angle function for computing
the side lengths of a spherical triangle were only applicable to unit-radius
spheres. This commit generalizes the computation of these side lengths so that
the mpas_sphere_angle function can be used to compute spherical angles on
spheres of arbitrary radius.

* * In ./src/core_atmosphere/physics/mpas_atmphys_driver_lsm.F, now weigh the local variables
  needed in the calculation of t2m, th2m, and q2 prior to updating all LSM variables (see
  subroutine lsm_to_MPAS).

* * In ./src/core_atmosphere/physics/mpas_atmphys_driver_lsm.F, moved the call to sfcdiags
  from subroutine driver_lsm to subroutine lsm_to_MPAS. This allows t2m, th2m, and q2 to
  be correctly computed over seaice points.

* * In ./src/core_atmosphere/physics, added the file mpas_atmphys_driver_seaice.F:

  -> mpas_atmphys_driver_seaice.F contains all the sourcecode related to surface
     processes over seaice points.

  -> in mpas_atmphys_driver_lsm.F, removed all the sourcecode related to surface
     processes over seaice points and moved the sourcecode to the seaice driver.

  -> changed Makefile accordingly.

* Initialize mvd_r and mvd_c before first use in Thompson microphysics scheme

This commit initializes two local variables, mvd_r and mvd_c, in the mp_thompson
routine to avoid the potential use of uninitialized memory.

Note: Identical changes to those included in this commit have been introduced
into newer versions of the Thompson microphysics scheme, and so the changes here
can be considered a back-port of fixes.

* Remove LIBS from openacc_test in top-level Makefile

Since these OpenACC compilation tests don't depend on NetCDF, GPTL, or
other libraries, problems can be prevented by removing the linking
commands that come from the LIBS variable. For example, the openacc_test
rule will fail and the build will abort if a library the compiler
expects to link against hasn't built yet.

* * In ./src/core_atmosphere/physics/mpas_atmphys_driver_cloudiness.F, corrected the units of
  the variable dx_p from meters to kilometers (dx_p is used in the Thompson parameterization
  of the cloud fraction).

* * In ./src/core_atmosphere/physics/mpas_atmphys_driver.F, added OpenMP directives around
  the loop that calls the seaice driver.

* * In ./src/core_atmosphere/physics/mpas_atmphys_driver_seaice.F, updated the Copyright
  at the top of the module.

* Add '-std=f2008' to FFLAGS_DEBUG for the 'gnu' build target

For the 'gnu' target, FFLAGS_OPT contained '-std=f2008' to check for Fortran
2008 conformance, but the debug build flags in FFLAGS_DEBUG lacked this option.
This commit simply adds '-std=f2008' to FFLAGS_DEBUG so that both optimized and
debug builds check that code conforms to the Fortran 2008 standard.

* * In ./src/core_atmosphere/physics, updated the MYNN surface layer scheme using the
  sourcecode from WRF version 4.6.

  -> in ./physics_mmm, added the CCPP-compliant MYNN surface layer scheme (sf_mynn.F) and
     mynn_shared.F that contains functions also shared with the MYNN PBL scheme. Modified
     Makefile accordingly.

  -> in ./physics_wrf, added the file sf_mynn_pre.F to initialize variables needed in the
     surface layer scheme. Modified module_sf_mynn.F which called the MYNN surface layer
     scheme. Modified Makefile accordingly.

  -> Modified mpas_atmphys_driver_sfclayer.F and mpas_atmphys_vars.F to accomodate updates
     to the MYNN surface layer scheme.

* * In ./src/core_atmosphere/physics, very minor corrections to Makefile,
  mpas_atmphys_driver_convection.F, and mpas_atmphys_driver_gwdo.F.

* * In ./src/core_atmosphere/physics/physics_mmm, very minor corrections to mp_radar.F
  and sf_sfclayrev.F.

* * In ./src/core_atmosphere/physics, updated the MYNN PBL with the sourcecode available
  in the WRF version 4.6.

  -> in ./physics_mmm, added bl_mynn.F and bl_mynn_subroutines.F modules which are CCPP-
     compliant versions of the MYNN PBL scheme. Modified Makefile accordingly.

  -> in ./physics_wrf, added bl_mynn_pre.F and bl_mynn_post.F, and modified module_bl_mynn.F
     that calls the MYNN PBL scheme. Modified Makefile accordingly.

  -> in ./physics:
     in mpas_atmphys_vars.F, added (and deleted) variables need to run the updated scheme.
     in mpas_atmphys_init.F, initialized the added f_* flags needed to run the updated scheme.
     in mpas_atmphys_driver_pbl.F, modified and updated the call to run the updated scheme.
     in mpas_atmphys_todynamics.F, added rqsblten to the calculation to tend_scalars(index_qs,.).

  -> in ./../Registry.xml, added new variables needed to run the updated MYNN PBL scheme.

* * In ./src/core_atmosphere/physics/physics_mmm/bl_mynn_subroutines.F, removed extra blank spaces
  introduced when updating the sourcecode.

* * In ./src/core_atmosphere/physics, made minor corrections to ./physics_mmm/Makefile
  and ./physics_wrf/module_cu_ntiedtke.F.

* * In ./src/core_atmosphere/physics/physics_mmm/bl_mynn_subroutines.F, commented out
  the line:
  6537 !      wm2    = wm2 + wm3**twothirds

  in subroutine topdown_cloudrad. The variable wm2 is not initialized and not used
  anywhere in the subroutine.

* * In ./src/core_atmosphere/physics/physics_mmm/bl_mynn.F, removed the lines:

  !JOE-add GRIMS parameters & variables
   real(kind=kind_phys),parameter::  d1 = 0.02, d2 = 0.05, d3 = 0.001
   real(kind=kind_phys),parameter::  h1 = 0.33333335, h2 = 0.6666667
   real(kind=kind_phys):: govrth,sflux,bfx0,wstar3,wm2,wm3,delb
  !JOE-end GRIMS

  in subroutine bl_mynn_run. The removed GRIMS parameters and variables are
  not needed in bl_mynn.F.

* * In ./src/core_atmosphere/physics/physics_mmm/bl_mynn_subroutines.F, removed the extra
  definition of parameters cphm_st, cphm_unst, cphh_st, and cphh_unst.

* * In ./src/core_atmosphere/physics:

  -> in ./physics_mmm/bl_mynn.F, added the initialization of the optional variable dqke.
  -> in ./physics_wrf/module_bl_mynn.F, made the variables dqke, qwt, qshear, qbuoy, and
     qdiss optional variables.
  -> in mpas_atmphys_driver_pbl.F, rewrite outputs to logfiles.

* * In ./src/core_atmosphere/Registry.xml, changed the option config_mynn_topdown
  from 1 to 0.

* * In ./src/core_atmosphere/physics:

  -> in ./physics_wrf/module_bl_mynn.F, added the local logical mynn_tkebudget_l which
     is initialized as a function of the input integer variable bl_mynn_tkebudget.
     mynn_tkebudget_l == true (false) when bl_mynn_tkebudget == 1 (0). this change is
     needed to for CCPP-compliance of the MYNN files in ./physics_mmm.
  -> in ./physics_mmm, modified bl_mynn.F and bl_mynn_subroutines.F accordingly.

* * In ./src/core_atmosphere/physics:

  -> in physics_wrf/module_bl_mynn.F, added the local logicals mynn_mixclouds_l,
     mynn_mixscalars_l, and mynn_mixqt_l which are initialized as functions of the
     input integer variables bl_mynn_mixclouds, bl_mynn_mixscalars, and bl_mynn_mixqt.
     the local logicals are set to true (false) when their respective input integer
     variables are equal to 1 (0). this change is needed for CCPP-compliance of the MYNN
     files in ./physics_mmm.
  -> in physics_mmm, modified bl_mynn.F and bl_mynn_subroutines.F accordingly.

* * In ./src/core_atmosphere/physics:

  -> in physics_wrf/module_bl_mynn.F, added the local logicals mynn_edmf_l and
     mynn_edmf_dd_l which are initialized as functions of the input integer variables
     bl_mynn_edmf and bl_mynn_edmf_dd. the logicals are set to true (false) when when
     their respective input integer variables are equal to 1 (0). this change is needed
     for CCPP-compliance of the MYNN files in ./physics_mmm.
  -> in physics_mmm, modified bl_mynn.F and bl_mynn_subroutines.F accordingly.

* * In ./src/core_atmosphere/physics:

  -> in physics_wrf/module_bl_mynn.F, added the local logicals mynn_edmf_mom_l and
     mynn_edmf_tke_l which are initialized as functions of the input integer variables
     bl_mynn_edmf_mom and bl_mynn_edmf_tke. the logicals are set to true (false) when
     their respective input integer variables are equal to 1 (0). this change is needed
     for CCPP-compliance of the MYNN files in ./physics_mmm.
  -> in physics_mmm, modified bl_mynn.F and bl_mynn_subroutines.F accordingly.

* * In ./src/core_atmosphere/physics:

  -> in physics_wrf/module_bl_mynn.F, added the local logicals mynn_output_l, mynn_dheatopt_l,
     mynn_scaleaware_l, and mynn_topdown_l which are initialized as functions of the input integer
     variables bl_mynn_output, bl_mynn_dheat_opt, bl_mynn_scaleaware_l, and bl_mynn_topdown. the
     logicals are set to true (false) when when their respective input integer variables are equal
     to 1 (0). this change is needed for CCPP-compliance of the MYNN files in ./physics_mmm.
  -> in physics_mmm, modified bl_mynn.F and bl_mynn_subroutines.F accordingly.

* * In ./src/core_atmosphere/physics/physics_mm/bl_mynn.F, removed extra commented
  out lines.

* * In ./src/core_atmosphere/physics/mpas_atmphys_driver_pbl.F, commented out extra
  print statements before and after the call to subroutine mynn_bl_driver.

* * In ./src/core_atmosphere/physics/physics_mmm/bl_mynn_subroutines.F, changed all
  instances of DOUBLE PRECISION with kind_phys8 where kind_phys8 points to R8KIND.

* Update version number to 8.1.0

* * In ./src/core_atmosphere/physics/physics_mmm/bl_ysu.F, added the initialization
  of local variable we.

* Fix memory leaks due to duplicate `allocate` calls on pointers

The `mpas_pool_create_pool` subroutine already allocates the pointer in its arguments.
Therefore, calling `allocate` before `mpas_pool_create_pool` actually causes memory leaks.

* Solution #2 for the use of RUC LSM in the MPAS 8.1 (#9)

* Updated SOILPARM.TBL and VEGPARM.TBL for RUC LSM.

* Add mpas_atmphys_lsm_shared.o to dirver_lsm section

* RUC LSM and its 2-m diagnostics stay in the LSM driver. It will provide
solutions for land and ice points. Therefore, with RUC LSM, do not do
call to dirver_seaice.

* Added 2-m variables, will be used for RUC LSM diagnostics.

* Removed zero out of frozen and liqid soil water at the first time step.
It has been initialized in ruclsminit.

* Update to Microphysics for HRRRv5 (#10)

* 3D Reflectivity (#11)

* Set initial value of nc for aerosol-aware microphysics

* Move call to 3D reflectivity to microphysics

* Updated SOILPARM.TBL and VEGPARM.TBL for RUC LSM.

* Add mpas_atmphys_lsm_shared.o to dirver_lsm section

* RUC LSM and its 2-m diagnostics stay in the LSM driver. It will provide
solutions for land and ice points. Therefore, with RUC LSM, do not do
call to dirver_seaice.

* Added 2-m variables, will be used for RUC LSM diagnostics.

* Removed zero out of frozen and liqid soil water at the first time step.
It has been initialized in ruclsminit.

* Initialize clouds (#12)

* Set initial value of nc for aerosol-aware microphysics

* Two quick MPAS fixes (#10)

* Move call to 3D reflectivity to microphysics

* Add flags for Thompson options

* Move lookup table functions to utils and add flags to initialization

* Clean up microphysics flags for table build and initialization

* Add MPAS code for initialization of cloud number concentration

* Cleanup (#13)

* Set initial value of nc for aerosol-aware microphysics

* Two quick MPAS fixes (#10)

* Move call to 3D reflectivity to microphysics

* Add flags for Thompson options

* Move lookup table functions to utils and add flags to initialization

* Clean up microphysics flags for table build and initialization

* Add option to built hail-aware or non hail-aware lookup tables

* Update pointer to microphysics submodule commit

* Point to microphysics bugfix

* Update src/core_atmosphere/physics/physics_wrf/module_sf_ruclsm.F

---------

Co-authored-by: Tanya Smirnova <tanya.smirnova@noaa.gov>
Co-authored-by: Janet Derrico <143837053+jderrico-noaa@users.noreply.github.com>

* Updating MYNN-EDMF, cloud-radiation coupling, and surface layer tweaks (#12)

* Updating MYNN-EDMF, cloud-radiation coupling, and surface layer tweaks

* Update src/core_atmosphere/Registry.xml

fix typo

---------

Co-authored-by: Janet Derrico <143837053+jderrico-noaa@users.noreply.github.com>

* updated GF for MPAS (#13)

* "updated GF for MPAS"

* "clean the print statements"

* Update src/core_atmosphere/physics/physics_wrf/module_sf_ruclsm.F

---------

Co-authored-by: Michael Duda <duda@ucar.edu>
Co-authored-by: Laura Fowler <laura@ucar.edu>
Co-authored-by: G. Dylan Dickerson <gdicker@ucar.edu>
Co-authored-by: Kuan-Chih Wang <kuanchihw@ucar.edu>
Co-authored-by: tanyasmirnova <38667904+tanyasmirnova@users.noreply.github.com>
Co-authored-by: AndersJensen-NOAA <132939212+AndersJensen-NOAA@users.noreply.github.com>
Co-authored-by: Tanya Smirnova <tanya.smirnova@noaa.gov>
Co-authored-by: Joseph Olson <joeolson42@users.noreply.github.com>
Co-authored-by: haiqinli <38666296+haiqinli@users.noreply.github.com>
joeolson42 pushed a commit to joeolson42/MPAS-Model that referenced this pull request May 13, 2024
* Set initial value of nc for aerosol-aware microphysics

* Two quick MPAS fixes (NOAA-GSL#10)
jderrico-noaa referenced this pull request in jderrico-noaa/MPAS-Model May 15, 2024
Generalize mpas_sphere_angle function to work for non-unit-radius spheres
@AndersJensen-NOAA AndersJensen-NOAA deleted the v8.1-gsl-merge-ruc branch June 17, 2024 19:32
joeolson42 pushed a commit to joeolson42/MPAS-Model that referenced this pull request Sep 11, 2024
fixing surface layer conflicts by adding a new version that doesn't conflict with MMM's version
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.

5 participants