Skip to content

Merge v8.1-gsl-merge branch into gsl/develop #14

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

Merged
merged 64 commits into from
May 10, 2024

Conversation

jderrico-noaa
Copy link
Collaborator

v8.1-gsl-merge branch contains the following PRs:

mgduda and others added 30 commits August 30, 2023 22:21
…ale-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.
… 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.
… 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.
… 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.
…ariable f_qv

  which is not needed in any of the physics parameterizations.
  -> 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.
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.
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.
)

This merge enables MPAS to make use of the more modern mpi_f08 module introduced
in MPI-3.0.

The top-level Makefile now tries to compile a test program that uses mpi_f08,
and if that test is successful, the macro MPAS_USE_MPI_F08 is defined in the
CPPFLAGS used in the build; otherwise, MPAS will make use of the mpi module as
it previously did.

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, and
MPI_Info. However, 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.

* framework/mpas_use_mpi_f08:
  Add logic in top-level Makefile to detect mpi_f08 module availability
  Allow MPAS to use either of 'mpi_f08' or 'mpi' modules
  -> 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.
…eres

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.
…gh the local variables

  needed in the calculation of t2m, th2m, and q2 prior to updating all LSM variables (see
  subroutine lsm_to_MPAS).
…he 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.
This merge updates the calculation of the 2-meter temperature, potential
temperature, and specfic humidity over seaice points.

In MPAS-v8.0.1, the 2-meter temperature (t2m), potential temperature (th2m), and
specific humidity (q2) are computed in subroutine sfcdiags which is called
immediately after the call to seaice_noah in subroutine driver_lsm (see
mpas_atmphys_driver_lsm.F). This implies that the input variables in subroutine
sfcdiags have not yet been weighted by the seaice fraction which in turn impacts
the calculation of the 2-meter diagnostics.

In order to have t2m, th2m, and q2 to depend on the seaice fraction, this merge
moves the correction of local variables as functions of the seaice fraction and
calls to subroutine sfcdiags at the top of subroutine lsm_to_MPAS.

* NSF-MPAS/lsm_sfcdiags:
  * In ./src/core_atmosphere/physics/mpas_atmphys_driver_lsm.F, moved the call
  * In ./src/core_atmosphere/physics/mpas_atmphys_driver_lsm.F, now weigh the
  * In ./src/core_atmosphere/physics:
…r_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.
…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.
…v8.0.2 (PR MPAS-Dev#1148)

This merge generalizes the mpas_sphere_angle function so that it provides
correct results 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 merge 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.

This merge closes Issue MPAS-Dev#1149.
…(PR MPAS-Dev#1152)

This merge 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 merge have separately been
introduced into newer versions of the Thompson microphysics scheme, and so the
changes here can be considered a back-port of these fixes.

This merge closes Issue MPAS-Dev#1150.
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.
…corrected the units of

  the variable dx_p from meters to kilometers (dx_p is used in the Thompson parameterization
  of the cloud fraction).
This merge fixes a bug when calling the Thompson parameterization of the cloud
fraction. The input to the Thompson scheme expects the grid scale to be in units
of km, but in the mpas_atmphys_driver_cloudiness module, dx_p was in units of
meters. The unit of dx_p has been corrected to be in kilometers.

Acknowledgements: Thanks to Brett Wilt for first identifying the bug in the
units of dx_p in the call to the Thompson cloud fraction scheme.

* mp_thompson_cldfra:
  * 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).
This merge corrects several issues in the MPAS-Atmosphere model, specifically:

* Generalize the mpas_sphere_angle function to provide correct results for
  non-unit-radius spheres. This generalization fixes problems in remapping
  static fields to the outermost layer of specified-zone cells in limited-area
  meshes.

* Initialize mvd_r and mvd_c before first use in the Thompson microphysics
  scheme to prevent the potential use of uninitialized memory, which could lead
  to floating-point exceptions.

* Correct the units for the grid scale input field to the Thompson cloud
  fraction scheme.
…1141)

This merge revises the initialization of the flags f_qc, f_qi, f_qr, f_qs, f_qg,
f_ni, and f_nc that control which cloud condensate mixing ratios (qc, qr, qi,
qs, qg) and cloud number concentrations (nc, ni) are used in the physics
parameterizations.  Note that the flag f_qv was removed from all physics
parameterizations because the mixing ratio qv is always needed.

In the original sourcecode, the flags were defined and set to true (or false)
manually in mpas_atmphys_vars.F. In the updated sourcecode, the flags are now
initialized in subroutine init_physics_flags in mpas_atmphys_init.F. Flags are
set to true if the corresponding cloud condensates and number concentrations are
actually allocated at run time.

This merge also changes the name of the 'cu_tiedtke_in' package to
'cu_ntiedtke_in'.

* NSF-MPAS/init_physics_flags:
  * In ./src/core_atmosphere/physics:
  * In ./src/core_atmosphere/physics/mpas_atmphys_vars.F, removed the variable f_qv...
  * In ./src/core_atmosphere/physics/physics_wrf, removed the variables f_qv and f_qc...
  * In ./src/core_atmosphere/physics/mpas_atmphys_driver_convection.F, added comments...
  * In ./src/core_atmosphere/physics/physics_wrf, removed the variables f_qv and f_qc...
  * In ./src/core_atmosphere/physics/physics_wrf, removed the variables f_qv, f_qr, and...
  * In ./src/core_atmosphere/physics/mpas_atmphys_control.F, the mesoscale-reference suite...
…AS-Dev#1154)

This merge removes $(LIBS) from build commands under the 'openacc_test' target
in the 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 target will fail if
OPENACC=true is specified and if a library the compiler expects to link against
hasn't been built yet (e.g., SMIOL).

* framework/fix_makefile_openacctest:
  Remove LIBS from openacc_test in top-level Makefile
…P directives around

  the loop that calls the seaice driver.
This merge adds a separate driver to call the parameterization of sea ice.

In preparation for the addition of the Noah-MP land surface model (LSM), and
because the Noah and Noah-MP LSMs share the same parameterization of sea ice,
this merge moves all code related to sea ice that currently sits in the Noah LSM
driver to its own driver (mpas_atmphys_driver_seaice.F). The call to the sea ice
driver is located in the main driver after the call to the Noah LSM. All
outputs are bit-for-bit relative to the original parameterization.

* NSF-MPAS/lsm_seaice:
  * In ./src/core_atmosphere/physics/mpas_atmphys_driver_seaice.F, updated the Copyright...
  * In ./src/core_atmosphere/physics/mpas_atmphys_driver.F, added OpenMP directives...
  * In ./src/core_atmosphere/physics, added the file mpas_atmphys_driver_seaice.F:
This merge introduces fixes from MPAS v8.0.2, and it connects the v8.0.2 tag to
future commits on 'develop'.

* master:
  In ./src/core_atmosphere/physics/mpas_atmphys_driver_cloudiness.F, corrected the units ...
  Initialize mvd_r and mvd_c before first use in Thompson microphysics scheme
  Generalize mpas_sphere_angle function to work for non-unit-radius spheres
  Update version number to 8.0.2

* master:
  * 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).
  Initialize mvd_r and mvd_c before first use in Thompson microphysics scheme
  Generalize mpas_sphere_angle function to work for non-unit-radius spheres
  Update version number to 8.0.2
mgduda and others added 12 commits March 28, 2024 14:00
This merge updates the MYNN Surface Layer and Planetary Boundary Layer (PBL)
schemes. The PBL scheme includes the options needed to run the Eddy Diffusivity
Mass Flux (EDMF) parameterizations.

 * The core of the SFC Layer scheme is located in ./physics_mmm/sf_mynn.F.

 * The core of the PBL scheme is located in ./physics_mmm/bl_mynn.F and
   ./physics_mmm/bl_mynn_subroutines.F.

* NSF-MPAS/bl_mynn_updated:
  * In ./src/core_atmosphere/physics/physics_mmm/bl_mynn_subroutines.F, changed all...
  * In ./src/core_atmosphere/physics/mpas_atmphys_driver_pbl.F, commented out extra...
  * In ./src/core_atmosphere/physics/physics_mm/bl_mynn.F, removed extra commented...
  * In ./src/core_atmosphere/physics:
  * In ./src/core_atmosphere/physics:
  * In ./src/core_atmosphere/physics:
  * In ./src/core_atmosphere/physics:
  * In ./src/core_atmosphere/physics:
  * In ./src/core_atmosphere/Registry.xml, changed the option config_mynn_topdown...
  * In ./src/core_atmosphere/physics:
  * In ./src/core_atmosphere/physics/physics_mmm/bl_mynn_subroutines.F, removed the extra...
  * In ./src/core_atmosphere/physics/physics_mmm/bl_mynn.F, removed the lines:
  * In ./src/core_atmosphere/physics/physics_mmm/bl_mynn_subroutines.F, commented out...
  * In ./src/core_atmosphere/physics, made minor corrections to ./physics_mmm/Makefile...
  * In ./src/core_atmosphere/physics/physics_mmm/bl_mynn_subroutines.F, removed extra...
  * In ./src/core_atmosphere/physics, updated the MYNN PBL with the sourcecode available...
  * In ./src/core_atmosphere/physics/physics_mmm, very minor corrections to mp_radar.F...
  * In ./src/core_atmosphere/physics, very minor corrections to Makefile,   mpas_atmphys_driver_convection.F...
  * In ./src/core_atmosphere/physics, updated the MYNN surface layer scheme using the...
This merge adds code to initialize the 'we' variable in the YSU PBL scheme.
Without this initialization, the 'we' variable may be accessed without having
been initialized, potentially leading to a floating-point exception.
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.
…Dev#1160)

This merge fixes memory leaks due to duplicate allocate calls on pointers in the
file structs_and_variables.inc. This file is auto-generated and then included by,
e.g., src/core_atmosphere/mpas_atm_core_interface.F at compile time. No
functional changes are introduced by this merge.

For example, in the auto-generated file
src/core_atmosphere/inc/structs_and_variables.inc, there are code snippets
similar to the following:

  subroutine atm_generate_pool_mesh(block, structPool, dimensionPool, packagePool)

  ! ... (Unrelated lines omitted) ...

        type(mpas_pool_type), pointer :: newSubPool

  ! ... (Unrelated lines omitted) ...

        allocate(newSubPool)
        call mpas_pool_create_pool(newSubPool)
        call mpas_pool_add_subpool(structPool, 'mesh', newSubPool)
        call mpas_pool_add_subpool(block % allStructs, 'mesh', newSubPool)

  ! ... (Unrelated lines omitted) ...

  end subroutine atm_generate_pool_mesh

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

The fix adopted in this merge is to simply remove the generation of the
'allocate' calls in the 'structs_and_variables.inc' file for each core.
MPAS Version 8.1.0

This release of MPAS introduces several updates and new capabilities for
MPAS-Atmosphere, most notably:

 * The MYNN Surface Layer and Planetary Boundary Layer (PBL) schemes have been
   updated. The PBL scheme includes the options needed to run the Eddy
   Diffusivity Mass Flux (EDMF) scheme.

 * A separate driver for the parameterization of surface processes over sea-ice
   points has been added.

 * The build system now tests for the availability of the modern 'mpi_f08'
   module in the MPI library. If detected, the 'mpi_f08' module interface to
   Fortran MPI routines will be used in favor of the older 'mpi' module
   interface.

 * The atmosphere core now supports the storage and retrieval of time-invariant
   fields in a separate I/O stream, offering significant disk space savings,
   especially in cases where large ensembles or cycled simulations are being
   run.

 * The top-level Makefile provides a new 'intel' build target for the Intel
   oneAPI Fortran, C, and C++ compiler suite.

 * To support real-data simulations on meshes with grid distances approaching
   1 km or less, the init_atmosphere core provides an option,
   config_30s_supersample_factor, for super-sampling of the 30 arc-second
   terrestrial fields (terrain, land use, soil category, and MODIS FPAR
   monthly vegetation fraction).

 * When compiling, PRECISION=single is now the default, and double-precision
   builds must be specified with PRECISION=double.
* 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.
* 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>
#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"

* "clean the print statements"
Copy link
Collaborator

@tanyasmirnova tanyasmirnova left a comment

Choose a reason for hiding this comment

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

@jderrico-noaa Janet, thank you for the commit in RUC LSM. My other comments are not critical, I was just curious. I reviewed carefully the physics part of the merge, and it looks good to me. I will approve this PR.

@jderrico-noaa
Copy link
Collaborator Author

@jderrico-noaa Janet, thank you for the commit in RUC LSM. My other comments are not critical, I was just curious. I reviewed carefully the physics part of the merge, and it looks good to me. I will approve this PR.

It's good you made a note of it here so that if issues that might be related to the to the removed variables come up we know where to start looking

@jderrico-noaa jderrico-noaa merged commit 98e5ddf into gsl/develop May 10, 2024
AndersJensen-NOAA pushed a commit to AndersJensen-NOAA/MPAS-Model that referenced this pull request Sep 12, 2024
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.

9 participants