v8.4.1 merge, attempt two - #267
Closed
clark-evans wants to merge 282 commits into
Closed
Conversation
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.
Added unit test for deformation coefficients on Cartesian-plane meshes.
The algorithm for the 2D Smagorinsky eddy viscosity coefficients are implemented in this module. Others to follow.
(2) Changes in atm_compute_dyn_tend to call dissipation module subroutine to compute 2D Smagorinsky eddy viscosity.
so that compile time specification of Nvertlevels and maxEdges is enabled.
…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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Duplicate of #246.