v8.4.1 merge#246
Conversation
…_core.F to initialize the Registry-defined arrays storing the values (1 +- epssm(z))/2 at the levels and interfaces needed in the solution procedure. The initialization occurs at model integration start up. The vertically varying epssm is NOT active at this point; the simulation still uses the constant value from config_epssm.
…ev#1353) This merge fixes a bug in the mpas_stream_list module where adjacent duplicate streams were allowed to be inserted into a list. The issue was in the MPAS_stream_list_insert logic, which has been updated to properly reject adjacent duplicates. As part of this merge, unit tests for the mpas_stream_list_module have been added to the 'test' core. The fix for the duplicate insertion bug is tested by the mpas_test_insert_duplicate_at_begin and mpas_test_insert_duplicate_at_end tests.
This commit introduces a new include file mpas_halo_interface under src/framework in order to remove the repeated definitions of the generic interface halo_exchange_routine and replace them with an include.
…S-Dev#1359) This merge introduces a new include file under the src/framework directory, mpas_halo_interface.inc, that contains the definition of the halo_exchange_routine abstract interface. By including this file in other files, four separate definitions of the halo_exchange_routine interface have been eliminated, specifically, in: - mpas_atm_time_integration.F - mpas_atmphys_todynamics.F - mpas_atm_core.F - mpas_atm_halos.F
the coefficients for the vertically-implicit acoustic solution to use the variable epssm formulation, and modified the acoustic step solver to use the variable epssm coefficients. This commit changes the solution at roundoff level even if a constant epssm is configured because we have changed the order of the computations in some places and we have incorporated the acoustic timestep delta tau in a different manner than in the previous formulation.
to the intended general configuration for real-data cases.
…Make In PR 1359 a new file, src/framework/mpas_halo_interface.inc is included by several files in the src/core_atmosphere tree. Therefore compiling core_atmosphere now requires including src/framework. To accomplish that the CMakeLists.txt file for src/framework now exports its source directory as an interface include directory. This adds that directory to the compilation include path for any target which links against framework.
) This merge fixes a CMake build failure by adding src/framework to the list of include file search paths. With merge commit 55c737f (PR MPAS-Dev#1359), the file mpas_halo_interface.inc from the src/framework directory was included by several files in the atmosphere core via preprocessing directives. While the Makefile files under src/core_atmosphere already contained the framework directory in the list of search paths for include files, the CMakeLists.txt files did not, resulting in a build failure when compiling the atmosphere core with CMake. To address the build error, the CMakeLists.txt file for src/framework now exports its source directory as an interface include directory, adding that directory to the compilation include path for any target that links against framework. * atmosphere/cmake_framework: Add src/framework to list of include directories when building with CMake
All pool accessor routines now nullify their pointer arguments at the start of each subroutine. This includes mpas_pool_get_config_* (real, int, char, and logical), mpas_pool_get_subpool, and mpas_pool_get_package. Nullifying these pointers ensures they are in a defined state before assignment, allowing callers to safely use associated() checks to determine whether a configuration key, subpool, or package exists in the pool. This change also makes the behavior of these accessor subroutines consistent with the existing behavior of mpas_pool_get_field_*, mpas_pool_get_array_*, and mpas_pool_get_dimension_*. No other logic or behavior was changed.
…lop (PR MPAS-Dev#1372) This merge updates pool accessor routines to nullify their pointer arguments at the start of each subroutine. The affected routines are: mpas_pool_get_config_real mpas_pool_get_config_int mpas_pool_get_config_char mpas_pool_get_config_logical mpas_pool_get_subpool mpas_pool_get_package Previously, these pointer arguments (value, subPool, and package) were not initialized before assignment. This could lead to undefined behavior if callers used associated() to check whether a config key, subpool, or package existed in the pool and the pointer wasn't explicitly initialized before the call to the mpas_pool_get_* routine. By explicitly nullifying these pointers, they are guaranteed to be in a defined state upon return from the routines, allowing callers to safely perform associated() checks. This change also makes the behavior of these accessor routines consistent with the existing behavior of mpas_pool_get_field_*, mpas_pool_get_array_*, and mpas_pool_get_dimension_*. * framework/nullify_ptr_args_in_pool_accessors: Nullify pointer arguments in all pool accessor routines
The chemistry infrastructure now lives in a dedicated `core_atmosphere/chemistry` hierarchy, which includes a `musica` subdirectory and its Makefiles. Within this structure we added the MUSICA MICM-facing modules `mpas_atm_chemistry.F` and `musica/mpas_musica.F`, providing the stubs that expose the chemistry hooks needed by the atmospheric core. `mpas_atm_chemistry.F` now establishes the MICM configuration path, performs initialization at the end of `atm_core_init`, advances the chemistry tendencies through `chemistry_step` inside `atm_do_timestep`, and finalizes the subsystem during shutdown. These calls are wrapped in `#ifdef DO_CHEMISTRY` and coordinated with the new `#ifdef MPAS_USE_MUSICA` guards so that chemistry support is compiled and executed only when explicitly enabled. The interface routines also accept the MPAS pool, configuration, and dimension objects, including forwarding `nVertLevels` to `musica_init`. Inside `musica/mpas_musica.F`, the initialization sequence now queries the MICM version via `get_micm_version`, records both the version and the number of grid cells in the log, and honors the compile-time flag to keep MUSICA linkage optional. Matching updates to the atmospheric and chemistry Makefiles add the new sources, apply the `CHEMISTRY` flags to the compiler command line, and ensure the MUSICA library is only built and linked when `MPAS_USE_MUSICA` is defined.
This merge adds directory structure and stub modules for MUSICA, and
more broadly, for chemistry options in the atmosphere core. New
directories and modules include
src/
core_atmosphere/
chemistry/ <--|
mpas_atm_chemistry.F <--|
musica/ <--| new in this merge
mpas_musica.F <--|
If the CHEMISTRY make variable is defined as -DDO_CHEMISTRY in the main
atmosphere core Makefile, code within the chemistry/ directory will be
compiled, and the atmosphere core will make calls to chemistry_init,
chemistry_step, and chemistry_finalize.
If the MUSICA make variable and the MPAS_USE_MUSICA preprocessing macro
are defined, the mpas_atm_chemistry module will make calls to the
musica_init and musica_finalize routines from the mpas_musica module.
Note that the call to musica_step is currently commented-out in the
chemistry_step routine.
This merge adds declarations for variables that were previously implicitly declared in the atmosphere core and shared framework.
…tine Towards the goal of having no implicitly declared variables in the atmosphere core, this commit adds a declaration for the 'ierr' variable in the noahmp_init routine in the mpas_atmphys_lsm_noahmpinit module. Because the name of the 'ierr' variable begins with the letter 'i', it was implicitly defined as an integer variable, and its use within the noahmp_init routine was consistent with that of an integer variable.
MPAS-Dev#1375) This merge modifies the noahmp_init subroutine in the mpas_atmphys_lsm_noahmpinit module so that the ierr variable is explicitly declared as an integer variable. Because the name of the ierr variable begins with the letter 'i', it was implicitly defined as an integer variable, and its use within the noahmp_init routine was consistent with that of an integer variable. * atmosphere/noahmpinit_fix_implicit_ierr: Explicitly declare ierr as an integer variable in the noahmp_init routine
This commit adds the -fimplicit-none flag to both the FFLAGS_OPT and FFLAGS_DEBUG variables in the 'gnu' build target in the top-level Makefile. With the addition of this flag, compilation will now fail with the gfortran compiler if implicitly defined variables are present in Fortran source code.
…PAS-Dev#1377) This merge adds the -fimplicit-none flag to both the FFLAGS_OPT and FFLAGS_DEBUG variables in the 'gnu' build target in the top-level Makefile. With the addition of this flag, compilation will now fail with the gfortran compiler if implicitly defined variables are present in Fortran source code. * framework/add_gnu_implicit_none_flag: Add -fimplicit-none to FFLAGS_OPT and FFLAGS_DEBUG in 'gnu' build target
…esh size This commit removes the scaling of the gravity-wave absorbing layer coefficient by the local mesh size. Previously, the absorbing layer coefficient was scaled by dx/dx_fine. For large values of dx/dx_fine instabilities have been encountered associated with this scaling of the absorbing layer coefficient. Units have been added to the configuration variable config_xnutr (1/s) in the Registry - it is used in calculating the absorbing layer coefficient. Units have also been added to config_visc4_2dsmag (m/s) in the Registry - it is used in the calculation of the hyperviscosity.
This merge removes the scaling of the gravity-wave absorbing layer coefficient (dss) by the local mesh size. Previously, the absorbing layer coefficient was scaled by dx/dx_fine, and for large values of dx/dx_fine, instabilities have been encountered associated with this scaling of the absorbing layer coefficient. Also included in this merge are updates to units and descriptions in the atmosphere core's Registry.xml file: - units have been added to the configuration variable config_xnutr (1/s), which is used in calculating the absorbing layer coefficient - units have also been added to config_visc4_2dsmag (m/s), which is used in the calculation of the hyperviscosity * gw_absorbing_layer_fix: Remove scaling of gravity-wave absorbing layer coefficient by local mesh size
This commit fixes the incorrect path for the esmf_time_f90 external modules in the root chemistry Makefile. This issue only came to known when building with the nvhpc compiler.
…#1390) This merge corrects the include path for esmf_time_f90 in the core_atmosphere/chemistry Makefile. Without the fixes in this merge, compilation failures were observed with the Intel ifx and NVHPC nvfortran compilers; for example: NVFORTRAN-F-0004-Unable to open MODULE file esmf_clockmod.mod (mpas_atm_chemistry.F: 50) NVFORTRAN/x86-64 Linux 24.3-0: compilation aborted * atmosphere/fix_chem_makefile: Fix to esmf_time_f90 include path in the root chemistry Makefile
Increase the default Parallel NetCDF header alignment to 128 KiB when creating new files with SMIOL. This increases the default header size, providing additional header memory padding and reducing the likelihood of header reallocations and associated performance degradation. The alignment hint can be overridden via the PNETCDF_HINTS environment variable.
…rinsky scheme on Cartesian planes. This also fixes periodicity on those planes for the coefficients.
…4.1 (PR MPAS-Dev#1448) This merge fixes a crash in the atm_srk3 routine when MPAS-A is compiled without defining DO_PHYSICS, as is done when the MPAS-A dynamical core is used in, e.g., CAM or CAM-SIMA. At line 1970 inside the atm_srk3 time stepping subroutine, if the DO_PHYSICS macro is undefined, the diag_physics pointer will not be initialized by the call to mpas_pool_get_subpool, and therefore its pointer association status will remain undefined. However, at line 2250, this pointer is used as an actual argument to call atm_compute_dyn_tend, which constitutes a Fortran standard violation. Quoted from Fortran 2023, 15.5.2.4 Argument association Except in references to intrinsic inquiry functions, a pointer actual argument that corresponds to a nonoptional nonpointer dummy argument shall be pointer associated with a target. This bug can lead to a runtime crash for models that use MPAS as a dynamical core (e.g., CAM, CAM-SIMA). This merge fixes the issue by adding the pointer attribute to the diag_physics dummy argument for the atm_compute_dyn_tend subroutine. In addition, two one-line changes have also been introduced to better conform to the Fortran best practices. * staging/fix-undefined-pointer-argument: Avoid implicit save attribute during variable declaration in atm_srk3 Add missing dummy argument intent in atm_compute_dyn_tend Fix Fortran standard violation due to undefined pointer actual argument in atm_srk3
This commit limits the saturation vapor pressure e_s used in the Kessler microphysics to a value at or below 99% of the full pressure. In the previous version of Kessler the saturation vapor pressure formula could produce unphysically large values of e_s at very low pressures (high model top) and cause the model to blow up.
) This merge limits the saturation vapor pressure, e_s, used in the Kessler microphysics to a value at or below 99% of the full pressure. In the previous version of Kessler the saturation vapor pressure formula could produce unphysically large values of e_s at very low pressures (high model top) and cause the model to blow up. * kessler_high_top_fix: Limit the saturation vapor pressure e_s used in the Kessler microphysics
…(PR MPAS-Dev#1461) This merge fixes an issue with multiple occurrences of the same namelist option in the specification for the optional active_when attribute for a package. When declaring a package with the optional active_when attribute in a Registry.xml file, if a namelist option appeared more than once in an active_when attribute (e.g., config_foo > 0 .and. config_foo < 10), the code generation logic in gen_inc.c would produce duplicate Fortran variable declarations and mpas_pool_get_config calls in the generated setup_packages.inc. This caused compiler errors associated the generated code. The solution involves modifying the logic in package_logic_routine and gen_pkg_debug_info in gen_inc.c to identify unique namelist options in the active_when attributes. This merge introduces a simple helper function, add_unique_key_to_list, to add unique namelist options to a string list. This list is then iterated over by subsequent logic in order to ensure that there are no multiply defined variables in the generated Fortran code. At present, the MAX_LIST_SIZE macro caps the maximum number of unique namelist options allowed in the active_when attribute at 20. * framework/fix_duplicate_activewhen: Check for duplicate namelist options in active_when attributes
… that only occurs when the code is modified to run with more than four soil layers. The logic in mpas_atmphys_driver_lsm_noahmp.F can be simplified to a single loop that will always work. Likewise, Registry_noahmp.xml does not need to have the combined number of soil plus snow levels (nzSoilLevels) hardcoded, it can be written as the sum of the levels so it always works.
…#1459) This merge fixes a bug that occurs when the number of soil layers in Noah-MP is not the default (4 layers), which results in the model not conserving water. Noah-MP uses positive indices for soil layers and negative indices for snowpack layers. In subroutine lsm_noahmp_toMPAS, the code copies the depths from Noah-MP to a local structure (zsnsoxy) that assumes indices going from 1 to the number of combined snowpack and soil layers. However, the original code had one error in the conversion logic, which coincidentally worked for the specific case in which the number of soil layers is exactly the number of snowpack layers plus 1. The changes in this merge follow the logic used elsewhere in the code and ensure the conversion always works. Additionally, this merge redefines the dimension nzSnowLevels (the total number of soil plus snowpack layers) in Registry_noahmp.xml from a constant value of 7 to "nSoilLevels+nSnowLevels", eliminating the need to modify nzSnowLevels when either nSoilLevels or nSnowLevels is modified. * mpaiao-pr-nsoil-hotfix: This commit mirrors a similar commit in MONAN. It fixes a cryptic bug that...
…o Makefiles This commit adds missing include paths to the Makefile recipes that are used when MPAS is compiled with GEN_F90=true.
…1465) This merge fixes broken builds with GEN_F90=true by adding missing include paths to the Makefile recipes that are used when MPAS is compiled with GEN_F90=true. * all/fix_gen_f90_build: Fix broken builds with GEN_F90=true by adding missing include paths to Makefiles
…BL choice When the LES options are run in real-data cases, the sfclayer physics is used but not the PBL physics. Many (over 30) 2d arrays were allocated based on PBL packages when their true dependence is on the sfclayer package. This caused a failure due to using unallocated arrays. The fix is to create and use instead a sfclayer package in the Registry.
This merge switches the allocation of surface arrays to be based on the choice
of surface layer scheme rather than on the choice of PBL scheme.
When the LES options are run in real-data cases, the surface layer physics is
used but not the PBL physics. Many (over 30) 2-d arrays were allocated based on
PBL packages when their true dependence is on the surface layer scheme, leading
to a failure due to the use of unallocated arrays. This merge addresses this
issue by defining a new package, 'sfclayer', that is active when
config_sfclayer_scheme == 'suite' .and. config_physics_suite /= 'none'
or when
any(config_sfclayer_scheme == [ character(len=StrKind) :: &
'sf_monin_obukhov', &
'sf_monin_obukhov_rev', &
'sf_mynn' &
]
and it associates surface arrays with this new package in the atmosphere core's
Registry.xml file.
* sfclayfix:
Atmosphere core allocates surface arrays based on sfclay choice not PBL choice
This merge release addresses several issues in the MPAS-Atmosphere model and in the MPAS infrastructure. Specific changes include: * Fix crashes in the atm_srk3 routine when MPAS-A is compiled without defining DO_PHYSICS, as is done when the MPAS-A dynamical core is used in, e.g., CAM or CAM-SIMA. (PR MPAS-Dev#1448) * Limit the saturation vapor pressure, e_s, used in the Kessler microphysics to a value at or below 99% of the full pressure. Prior to this change, the saturation vapor pressure formula in Kessler could produce unphysically large values of e_s at very low pressures (high model tops) and cause the model to blow up. (PR MPAS-Dev#1452) * Fix an issue with multiple occurrences of the same namelist option in the specification for the optional active_when attribute for a Registry-defined package. With this fix, an active_when attribute may contain logic that uses a given namelist option more than once. (PR MPAS-Dev#1461) * Fix a bug that occurs when the number of soil layers in Noah-MP is not the default (4 layers), resulting in the model not conserving water. (PR MPAS-Dev#1459) * Fix broken builds with GEN_F90=true by adding missing include paths to the Makefile recipes that are used when MPAS is compiled with GEN_F90=true. (PR MPAS-Dev#1465) * Switch the allocation of surface arrays to be based on the choice of surface layer scheme rather than on the choice of PBL scheme. This change allows model simulations that use a surface layer scheme but no PBL scheme to run correctly, for example, real-data simulations that use LES options in MPAS-A. (PR MPAS-Dev#1460)
|
I have added the commits for today's v8.4.1 bugfix release to this PR. I updated the initial comment to indicate the files that had merge conflicts for the v8.4.1 bugfix release. The major change with this release is the addition of a new sfclayer package for allocating the surface arrays (see MPAS-Dev#1460), necessary for MPAS-LES. These changes led to a lot of conflicts in src/core_atmosphere/Registry.xml. I modified everything in the upstream that needed to be switched over to this new package, but I did not modify the surface arrays we've added (e.g., qcg for MYNN-EDMF) to use the new package. @joeolson42 in particular, and maybe also @XiaSun-Atmos, please review the updated Registry.xml and let me know of any further changes that need to be made for or in MYNN-EDMF with the new package. |
joeolson42
left a comment
There was a problem hiding this comment.
With the latest update, I think the v4.8.1 changes are acceptable.
dustinswales
left a comment
There was a problem hiding this comment.
Relying on passing CI tests and sensible production results in dev2 for approval.
After this is merged...
@joeolson42 will explore on the need/cause for the reduced time step in the HRRR rap summer test.
@dustinswales will explore the failing HRRR tests in DEBUG mode.
|
@clark-evans Unfortunately, it looks like the issue persists. Once yourrevert a2c1812, this is ready to merge. |
|
@dustinswales When the time step is changed finally, we may want to change the |
@guoqing-noaa Good point. |
Done, I changed the history interval to 10 min and the first diagnostics output interval to 0-1-10m. |
This PR brings in the upstream v8.4 feature and subsequent upstream v8.4.1 bugfix releases. There were some conflicts that needed to be resolved, as detailed below, but it was a relatively clean merge. Thanks to @barlage for the instructions he put together for last year's merges.
Note: I don't think we want to squash merge this PR because we want to bring in the upstream PR history.
Full List of Conflicting Files
README.md (also for v8.4.1 - just the version number in both cases)src/core_atmosphere/CMakeLists.txtsrc/core_atmosphere/Registry.xml (also for v8.4.1 - bigger conflicts in v8.4.1 with the new sfclayer package)src/core_atmosphere/dynamics/mpas_atm_time_integration.Fsrc/core_atmosphere/physics/Makefile (also for v8.4.1)src/core_atmosphere/physics/mpas_atmphys_init.Fsrc/core_atmosphere/physics/mpas_atmphys_initialize_real.Fsrc/core_atmosphere/physics/physics_wrf/Makefilesrc/core_atmosphere/utils/Makefilesrc/core_init_atmosphere/Makefilesrc/core_init_atmosphere/Registry.xml (also for v8.4.1 - just the version number in both cases)src/core_init_atmosphere/mpas_init_atm_cases.Fsrc/core_landice/Registry.xmlsrc/core_ocean/Registry.xmlsrc/core_seaice/Registry.xmlsrc/core_sw/Registry.xmlsrc/core_test/Registry.xmlsrc/driver/Makefilesrc/framework/Makefilesrc/operators/MakefileMost of the conflicts were trivial to address. The most substantial were (1) conflicts due to GSL-added physics, (2) conflicts due to NSSL-added horizontal filters, and (3) some minor conflicts due to upstream changes in how ESMF and SMIOL includes are handled. I updated our code to match the upstream changes for (3).
Mandatory Questions
Reviews
I listed the entire core development team because this is a bigger merge.