From 6f29a73feb6dac81acddac0ab256de756a5148bc Mon Sep 17 00:00:00 2001 From: Michael Duda Date: Fri, 28 Jun 2024 15:52:33 -0600 Subject: [PATCH 01/16] Update version number to 8.2.1 --- README.md | 2 +- src/core_atmosphere/Registry.xml | 2 +- src/core_init_atmosphere/Registry.xml | 2 +- src/core_landice/Registry.xml | 2 +- src/core_ocean/Registry.xml | 2 +- src/core_seaice/Registry.xml | 2 +- src/core_sw/Registry.xml | 2 +- src/core_test/Registry.xml | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index b48f282e17..b62228420a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -MPAS-v8.2.0 +MPAS-v8.2.1 ==== The Model for Prediction Across Scales (MPAS) is a collaborative project for diff --git a/src/core_atmosphere/Registry.xml b/src/core_atmosphere/Registry.xml index 10cfbca3ea..8ce63d3d80 100644 --- a/src/core_atmosphere/Registry.xml +++ b/src/core_atmosphere/Registry.xml @@ -1,5 +1,5 @@ - + diff --git a/src/core_init_atmosphere/Registry.xml b/src/core_init_atmosphere/Registry.xml index ee422f40b5..cb1216ca4c 100644 --- a/src/core_init_atmosphere/Registry.xml +++ b/src/core_init_atmosphere/Registry.xml @@ -1,5 +1,5 @@ - + diff --git a/src/core_landice/Registry.xml b/src/core_landice/Registry.xml index 39af560a1a..57e34cc8fd 100644 --- a/src/core_landice/Registry.xml +++ b/src/core_landice/Registry.xml @@ -1,5 +1,5 @@ - + diff --git a/src/core_ocean/Registry.xml b/src/core_ocean/Registry.xml index 0fada27075..3c1b5dee95 100644 --- a/src/core_ocean/Registry.xml +++ b/src/core_ocean/Registry.xml @@ -1,5 +1,5 @@ - + - + - + diff --git a/src/core_test/Registry.xml b/src/core_test/Registry.xml index e5ef8dd94f..9ec004120d 100644 --- a/src/core_test/Registry.xml +++ b/src/core_test/Registry.xml @@ -1,5 +1,5 @@ - + From 90758d584ebcd96e206d05e5c58778983c454dad Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Fri, 28 Jun 2024 07:55:22 -0700 Subject: [PATCH 02/16] Use more mpi_f08 features in mpi_f08_test for odd cases where certain MPI implementations not compiled with mpi_f08 enabled still pass the check. Using OpenMPI 4.0.0 and gfortran 11.4.1 compiling without mpi_f08 features the MPI wrapper will still link and supply mpi_f08 (-lmpi_usempif08) despite not being valid or usable. This causes the `use mpi_f08` and some features to compile fine, but other mpi_f08 features to not exist and fail compilation. --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 41d470489d..5e86aa6533 100644 --- a/Makefile +++ b/Makefile @@ -1267,9 +1267,10 @@ mpi_f08_test: $(info Checking for mpi_f08 support...) $(eval MPAS_MPI_F08 := $(shell $\ printf "program main\n$\ - & use mpi_f08, only : MPI_Init, MPI_Comm\n$\ + & use mpi_f08, only : MPI_Init, MPI_Comm, MPI_INTEGER, MPI_Datatype\n$\ & integer :: ierr\n$\ & type (MPI_Comm) :: comm\n$\ + & type (MPI_Datatype), parameter :: MPI_INTEGERKIND = MPI_INTEGER\n$\ & call MPI_Init(ierr)\n$\ end program main\n" | sed 's/&/ /' > mpi_f08.f90; $\ $\ From 0ca4208840df12d572fbdfbebb192f09030093c0 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Fri, 28 Jun 2024 07:47:25 -0700 Subject: [PATCH 03/16] Check for libpnetcdf library existence rather than just directory This follows the same logic as before with the added check that a libpnetcdf.* file exists in the checked directory. The change in logic will now account for situations where PNETCDF is set to a directory containing both lib/ and lib64/ directories and libpnetcdf.* exists in just the lib/ folder. Should libpnetcdf.* exist in both directories, the lib64/ still maintains precedence. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index cc7a5debf7..9b0a17a0bb 100644 --- a/Makefile +++ b/Makefile @@ -549,10 +549,10 @@ endif ifneq "$(PNETCDF)" "" -ifneq ($(wildcard $(PNETCDF)/lib), ) +ifneq ($(wildcard $(PNETCDF)/lib/libpnetcdf.*), ) PNETCDFLIBLOC = lib endif -ifneq ($(wildcard $(PNETCDF)/lib64), ) +ifneq ($(wildcard $(PNETCDF)/lib64/libpnetcdf.*), ) PNETCDFLIBLOC = lib64 endif CPPINCLUDES += -I$(PNETCDF)/include From 3af54a8bc91436ef0595a8ca9660a6ddf45465c6 Mon Sep 17 00:00:00 2001 From: Michael Duda Date: Fri, 5 Jul 2024 17:02:49 -0600 Subject: [PATCH 04/16] Remove debugging prints around calls to sfclayrev in driver_sfclayer This commit removes some debugging log writes around calls to sfclayrev in the driver_sfclayer subroutine. These writes led to messages like the following appearing in the log file for every model timestep: --- enter subroutine sfclayrev: --- end subroutine sfclayrev: --- enter subroutine sfclayrev seaice: --- end subroutine sfclayrev seaice: --- src/core_atmosphere/physics/mpas_atmphys_driver_sfclayer.F | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/core_atmosphere/physics/mpas_atmphys_driver_sfclayer.F b/src/core_atmosphere/physics/mpas_atmphys_driver_sfclayer.F index 4b5a603543..afde4fa523 100644 --- a/src/core_atmosphere/physics/mpas_atmphys_driver_sfclayer.F +++ b/src/core_atmosphere/physics/mpas_atmphys_driver_sfclayer.F @@ -950,7 +950,6 @@ subroutine driver_sfclayer(itimestep,configs,mesh,diag_physics,sfc_input,its,ite case("sf_monin_obukhov_rev") call mpas_timer_start('sf_monin_obukhov_rev') - call mpas_log_write('--- enter subroutine sfclayrev:') call sfclayrev( & p3d = pres_hyd_p , psfc = psfc_p , t3d = t_p , & u3d = u_p , v3d = v_p , qv3d = qv_p , & @@ -979,10 +978,8 @@ subroutine driver_sfclayer(itimestep,configs,mesh,diag_physics,sfc_input,its,ite ims = ims , ime = ime , jms = jms , jme = jme , kms = kms , kme = kme , & its = its , ite = ite , jts = jts , jte = jte , kts = kts , kte = kte & ) - call mpas_log_write('--- end subroutine sfclayrev:') if(config_frac_seaice) then - call mpas_log_write('--- enter subroutine sfclayrev seaice:') call sfclayrev( & p3d = pres_hyd_p , psfc = psfc_p , t3d = t_p , & u3d = u_p , v3d = v_p , qv3d = qv_p , & @@ -1011,7 +1008,6 @@ subroutine driver_sfclayer(itimestep,configs,mesh,diag_physics,sfc_input,its,ite ims = ims , ime = ime , jms = jms , jme = jme , kms = kms , kme = kme , & its = its , ite = ite , jts = jts , jte = jte , kts = kts , kte = kte & ) - call mpas_log_write('--- end subroutine sfclayrev seaice:') endif call mpas_timer_stop('sf_monin_obukhov_rev') From 660ab51d3e3afe2ddfc16ea6ebbff3f324b6e99e Mon Sep 17 00:00:00 2001 From: Michael Duda Date: Mon, 8 Jul 2024 17:54:18 -0600 Subject: [PATCH 05/16] Add mpas_dmpar_bcast_real4s routine for broadcasting real(kind=R4KIND) arrays This commit adds a new routine to the dmpar module for broadcasing real(kind=R4KIND) arrays. The new mpas_dmpar_bcast_real4s routine mirrors the mpas_dmpar_bcast_reals routine, with the dummy array argument being of R4KIND rather than RKIND kind. --- src/framework/mpas_dmpar.F | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/framework/mpas_dmpar.F b/src/framework/mpas_dmpar.F index 0addb63ed0..6d68c0c656 100644 --- a/src/framework/mpas_dmpar.F +++ b/src/framework/mpas_dmpar.F @@ -98,6 +98,7 @@ module mpas_dmpar public :: mpas_dmpar_bcast_ints public :: mpas_dmpar_bcast_real public :: mpas_dmpar_bcast_reals + public :: mpas_dmpar_bcast_real4s public :: mpas_dmpar_bcast_double public :: mpas_dmpar_bcast_doubles public :: mpas_dmpar_bcast_logical @@ -551,6 +552,46 @@ subroutine mpas_dmpar_bcast_reals(dminfo, n, rarray, proc)!{{{ end subroutine mpas_dmpar_bcast_reals!}}} +!----------------------------------------------------------------------- +! routine mpas_dmpar_bcast_real4s +! +!> \brief MPAS dmpar broadcast R4KIND routine. +!> \author Michael Duda, William Lipscomb +!> \date 8 July 2024 +!> \details +!> This routine broadcasts an array of R4KIND reals to all processors in +!> the communicator. An optional argument specifies the source node; else +!> broadcast from IO_NODE. +! +!----------------------------------------------------------------------- + subroutine mpas_dmpar_bcast_real4s(dminfo, n, rarray, proc)!{{{ + + implicit none + + type (dm_info), intent(in) :: dminfo !< Input: Domain information + integer, intent(in) :: n !< Input: Length of array + real (kind=R4KIND), dimension(n), intent(inout) :: rarray !< Input/Output: Array of reals to be broadcast + integer, intent(in), optional :: proc !< optional argument indicating which processor to broadcast from + +#ifdef _MPI + integer :: mpi_ierr, source + integer :: threadNum + + threadNum = mpas_threading_get_thread_num() + + if ( threadNum == 0 ) then + if (present(proc)) then + source = proc + else + source = IO_NODE + endif + + call MPI_Bcast(rarray, n, MPI_REAL, source, dminfo % comm, mpi_ierr) + end if +#endif + + end subroutine mpas_dmpar_bcast_real4s!}}} + !----------------------------------------------------------------------- ! routine mpas_dmpar_bcast_double ! From 6b705bca414e1d2d8a032ef35a27139c0f57a620 Mon Sep 17 00:00:00 2001 From: Michael Duda Date: Mon, 8 Jul 2024 18:03:53 -0600 Subject: [PATCH 06/16] Correct double-precision build failures of mpas_atmphys_init_microphysics.F The mpas_atmphys_init_microphysics module contains a routine, table_ccnAct, that broadcasts an R4KIND real array, tnccn_act, from the Thompson microphysics scheme. This broadcast was previously performed by a call to mpas_dmpar_bcast_reals through the macro DM_BCAST_MACRO. However, because the mpas_dmpar_bcast_reals routine broadcasts arrays of kind RKIND, when MPAS-A is compiled with double-precision reals, the mpas_dmpar_bcast_reals routine can no longer be used with the tnccn_act array. With this commit, the DM_BCAST_MACRO in mpas_atmphys_init_microphysics.F has been defined to mpas_dmpar_bcast_real4s, which broadcasts arrays of R4KIND reals. This works for both single- and double-precision builds of MPAS-A, since the kind type of the tnccn_act array is independent of the MPAS-A build precision. --- src/core_atmosphere/physics/mpas_atmphys_init_microphysics.F | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core_atmosphere/physics/mpas_atmphys_init_microphysics.F b/src/core_atmosphere/physics/mpas_atmphys_init_microphysics.F index 17ec774f65..f2a75d6c90 100644 --- a/src/core_atmosphere/physics/mpas_atmphys_init_microphysics.F +++ b/src/core_atmosphere/physics/mpas_atmphys_init_microphysics.F @@ -5,7 +5,7 @@ ! Additional copyright and license information can be found in the LICENSE file ! distributed with this code, or at http://mpas-dev.github.com/license.html ! -#define DM_BCAST_MACRO(A) call mpas_dmpar_bcast_reals(dminfo,size(A),A) +#define DM_BCAST_MACRO(A) call mpas_dmpar_bcast_real4s(dminfo,size(A),A) !================================================================================================================= module mpas_atmphys_init_microphysics From 90f7f7f3dcc8bb3de73cf2929041b5c78210ef5a Mon Sep 17 00:00:00 2001 From: ldfowler58 Date: Mon, 15 Jul 2024 10:09:11 -0600 Subject: [PATCH 07/16] * In ./src/core_atmosphere/physics/physics_wrf/Makefile, corrected all instances when spaces were used instead of tabs (lines 41-43, and lines 104, 108, 111, and 114.) --- src/core_atmosphere/physics/physics_wrf/Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/core_atmosphere/physics/physics_wrf/Makefile b/src/core_atmosphere/physics/physics_wrf/Makefile index 0c8f45a3dd..0d7d70ddbb 100644 --- a/src/core_atmosphere/physics/physics_wrf/Makefile +++ b/src/core_atmosphere/physics/physics_wrf/Makefile @@ -38,9 +38,9 @@ OBJS = \ module_sf_mynn.o \ module_sf_noahdrv.o \ module_sf_noahlsm.o \ - module_sf_noahlsm_glacial_only.o \ - module_sf_noah_seaice.o \ - module_sf_noah_seaice_drv.o \ + module_sf_noahlsm_glacial_only.o \ + module_sf_noah_seaice.o \ + module_sf_noah_seaice_drv.o \ module_sf_oml.o \ module_sf_sfclay.o \ module_sf_sfclayrev.o \ @@ -101,17 +101,17 @@ module_sf_noahdrv.o: \ module_sf_bep.o \ module_sf_bep_bem.o \ module_sf_noahlsm.o \ - module_sf_noahlsm_glacial_only.o \ + module_sf_noahlsm_glacial_only.o \ module_sf_urban.o module_sf_noahlsm_glacial_only.o: \ - module_sf_noahlsm.o + module_sf_noahlsm.o module_sf_noah_seaice_drv.o: \ - module_sf_noah_seaice.o + module_sf_noah_seaice.o module_sf_noah_seaice.o: \ - module_sf_noahlsm.o + module_sf_noahlsm.o clean: $(RM) *.f90 *.o *.mod From 74ddbd0d6c595607a4b9d138f1307b08feb482c8 Mon Sep 17 00:00:00 2001 From: Andy Stokely Date: Tue, 25 Jun 2024 14:17:27 -0600 Subject: [PATCH 08/16] Restore CMake support for building the atmosphere core This commit restores CMake support for the atmosphere core, which broke due to changes made prior to the version 8.2 release. The breaking changes included moving the physics_mmm directory to its own git repository. This is accounted for in CMake by using FetchContent to clone the correct version of the physics_mmm source code directory based on the MPAS model git version. Additionally, this commit builds the noahmp library that was added to the code base. Previously, this library only supported being built with a hardcoded GNU Makefile. This commit also accounts for the new registry preprocessing arguments that make the registry processing core-agnostic. These changes re-enable a seamless build process for the atmosphere core and improve modularity and maintainability. --- .gitignore | 1 + cmake/Functions/MPAS_Functions.cmake | 40 ++- src/core_atmosphere/CMakeLists.txt | 437 +++++++++++++++++++-------- src/framework/mpas_dmpar.F | 1 + 4 files changed, 351 insertions(+), 128 deletions(-) diff --git a/.gitignore b/.gitignore index 42e80e9e98..a06f462226 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ src/core_*/*.f90 src/framework/*.f90 src/driver/*.f90 src/operators/*.f90 +src/core_atmosphere/physics/physics_mmm # All object files *.o diff --git a/cmake/Functions/MPAS_Functions.cmake b/cmake/Functions/MPAS_Functions.cmake index ee329691f5..42127af00b 100644 --- a/cmake/Functions/MPAS_Functions.cmake +++ b/cmake/Functions/MPAS_Functions.cmake @@ -29,6 +29,33 @@ function(get_mpas_version mpas_version) set(${mpas_version} ${CMAKE_MATCH_1} PARENT_SCOPE) endfunction() +## +# get_git_version( ) +# Extracts the current Git version of the project. +# will contain the Git version string. +# Example usage: +# get_git_version(GIT_VERSION) +# message("Git Version: ${GIT_VERSION}") +## + + +function(get_git_version git_version) + execute_process( + COMMAND git describe --tags --always + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + RESULT_VARIABLE RESULT + OUTPUT_VARIABLE GIT_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + if(NOT RESULT EQUAL 0) + message(WARNING "Failed to get Git version!") + endif() + set(${git_version} ${GIT_VERSION} PARENT_SCOPE + ) +endfunction() + + ## # mpas_fortran_target( ) # @@ -162,15 +189,20 @@ function(mpas_core_target) file(MAKE_DIRECTORY ${CORE_DATADIR}) #Process registry and generate includes, namelists, and streams - if(${ARG_CORE} STREQUAL "atmosphere" AND ${DO_PHYSICS}) - set(CPP_EXTRA_FLAGS ${CPP_EXTRA_FLAGS} -DDO_PHYSICS) + get_git_version(git_version) + string(TOUPPER ${ARG_CORE} ARG_CORE_UPPER) + set(CPP_EXTRA_FLAGS ${CPP_EXTRA_FLAGS} -DCORE_${ARG_CORE_UPPER} -DMPAS_NAMELIST_SUFFIX=${ARG_CORE} -DMPAS_EXE_NAME=mpas_${ARG_CORE} -DMPAS_GIT_VERSION=${git_version} -DMPAS_BUILD_TARGET=${CMAKE_Fortran_COMPILER_ID}) + message("CPP_EXTRA_FLAGS: ${CPP_EXTRA_FLAGS}") + if (${DO_PHYSICS}) + set(CPP_EXTRA_FLAGS ${CPP_EXTRA_FLAGS} -DDO_PHYSICS) endif() - add_custom_command(OUTPUT Registry_processed.xml + +add_custom_command(OUTPUT Registry_processed.xml COMMAND ${CPP_EXECUTABLE} -E -P ${CPP_EXTRA_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/Registry.xml > Registry_processed.xml COMMENT "CORE ${ARG_CORE}: Pre-Process Registry" DEPENDS Registry.xml) add_custom_command(OUTPUT ${ARG_INCLUDES} - COMMAND mpas_parse_${ARG_CORE} Registry_processed.xml + COMMAND mpas_parse_${ARG_CORE} Registry_processed.xml ${CPP_EXTRA_FLAGS} COMMENT "CORE ${ARG_CORE}: Parse Registry" DEPENDS mpas_parse_${ARG_CORE} Registry_processed.xml) add_custom_command(OUTPUT namelist.${ARG_CORE} diff --git a/src/core_atmosphere/CMakeLists.txt b/src/core_atmosphere/CMakeLists.txt index 9563fcac87..210f366727 100644 --- a/src/core_atmosphere/CMakeLists.txt +++ b/src/core_atmosphere/CMakeLists.txt @@ -2,165 +2,354 @@ ## Source files # physics/ set(ATMOSPHERE_CORE_PHYSICS_SOURCES - ccpp_kinds.F - mpas_atmphys_camrad_init.F - mpas_atmphys_constants.F - mpas_atmphys_control.F - mpas_atmphys_date_time.F - mpas_atmphys_driver_cloudiness.F - mpas_atmphys_driver_microphysics.F - mpas_atmphys_driver_oml.F - mpas_atmphys_finalize.F - mpas_atmphys_functions.F - mpas_atmphys_init_microphysics.F - mpas_atmphys_interface.F - mpas_atmphys_landuse.F - mpas_atmphys_lsm_noahinit.F - mpas_atmphys_manager.F - mpas_atmphys_o3climatology.F - mpas_atmphys_rrtmg_lwinit.F - mpas_atmphys_rrtmg_swinit.F - mpas_atmphys_update.F - mpas_atmphys_update_surface.F - mpas_atmphys_utilities.F - mpas_atmphys_driver.F - mpas_atmphys_driver_convection.F - mpas_atmphys_driver_gwdo.F - mpas_atmphys_driver_lsm.F - mpas_atmphys_driver_pbl.F - mpas_atmphys_driver_radiation_lw.F - mpas_atmphys_driver_radiation_sw.F - mpas_atmphys_driver_seaice.F - mpas_atmphys_driver_sfclayer.F - mpas_atmphys_init.F - mpas_atmphys_lsm_shared.F - mpas_atmphys_packages.F - mpas_atmphys_todynamics.F - mpas_atmphys_vars.F + ccpp_kind_types.F + mpas_atmphys_camrad_init.F + mpas_atmphys_constants.F + mpas_atmphys_control.F + mpas_atmphys_date_time.F + mpas_atmphys_driver_cloudiness.F + mpas_atmphys_driver_microphysics.F + mpas_atmphys_driver_oml.F + mpas_atmphys_finalize.F + mpas_atmphys_functions.F + mpas_atmphys_init_microphysics.F + mpas_atmphys_interface.F + mpas_atmphys_landuse.F + mpas_atmphys_lsm_noahinit.F + mpas_atmphys_manager.F + mpas_atmphys_o3climatology.F + mpas_atmphys_rrtmg_lwinit.F + mpas_atmphys_rrtmg_swinit.F + mpas_atmphys_update.F + mpas_atmphys_update_surface.F + mpas_atmphys_utilities.F + mpas_atmphys_driver.F + mpas_atmphys_driver_convection.F + mpas_atmphys_driver_gwdo.F + mpas_atmphys_driver_lsm.F + mpas_atmphys_driver_pbl.F + mpas_atmphys_driver_radiation_lw.F + mpas_atmphys_driver_radiation_sw.F + mpas_atmphys_driver_seaice.F + mpas_atmphys_driver_sfclayer.F + mpas_atmphys_init.F + mpas_atmphys_lsm_shared.F + mpas_atmphys_packages.F + mpas_atmphys_todynamics.F + mpas_atmphys_vars.F + mpas_atmphys_driver_lsm_noahmp.F + mpas_atmphys_lsm_noahmpfinalize.F + mpas_atmphys_lsm_noahmpinit.F ) list(TRANSFORM ATMOSPHERE_CORE_PHYSICS_SOURCES PREPEND physics/) ## Unused # physics/physics_wrf/ set(ATMOSPHERE_CORE_PHYSICS_WRF_SOURCES - libmassv.F - module_bep_bem_helper.F - module_bl_gwdo.F - module_bl_ysu.F - module_cam_error_function.F - module_cam_shr_kind_mod.F - module_cam_support.F - module_cu_gf.mpas.F - module_mp_kessler.F - module_mp_radar.F - module_mp_thompson.F - module_mp_thompson_cldfra3.F - module_mp_wsm6.F - module_ra_cam_support.F - module_ra_rrtmg_lw.F - module_ra_rrtmg_sw.F - module_ra_rrtmg_vinterp.F - module_sf_bem.F - module_sf_bep.F - module_sf_bep_bem.F - module_sf_noah_seaice.F - module_sf_noah_seaice_drv.F - module_sf_noahdrv.F - module_sf_noahlsm.F - module_sf_noahlsm_glacial_only.F - module_sf_oml.F - module_sf_sfcdiags.F - module_sf_sfclay.F - module_sf_sfclayrev.F - module_sf_urban.F - bl_mynn_post.F - bl_mynn_pre.F - module_bl_mynn.F - module_cu_kfeta.F - module_cu_ntiedtke.F - module_cu_tiedtke.F - module_ra_cam.F - module_sf_mynn.F - sf_mynn_pre.F + libmassv.F + cu_ntiedtke_post.F + cu_ntiedtke_pre.F + module_bep_bem_helper.F + module_bl_gwdo.F + module_bl_ysu.F + module_cam_error_function.F + module_cam_shr_kind_mod.F + module_cam_support.F + module_cu_gf.mpas.F + module_mp_kessler.F + module_mp_radar.F + module_mp_thompson.F + module_mp_thompson_cldfra3.F + module_mp_thompson_aerosols.F + module_mp_wsm6.F + module_ra_rrtmg_sw_aerosols + module_ra_cam_support.F + module_ra_rrtmg_lw.F + module_ra_rrtmg_sw.F + module_ra_rrtmg_vinterp.F + module_sf_bem.F + module_sf_bep.F + module_sf_bep_bem.F + module_sf_noah_seaice.F + module_sf_noah_seaice_drv.F + module_sf_noahdrv.F + module_sf_noahlsm.F + module_sf_noahlsm_glacial_only.F + module_sf_oml.F + module_sf_sfcdiags.F + module_sf_sfclay.F + module_sf_sfclayrev.F + module_sf_urban.F + bl_mynn_post.F + bl_mynn_pre.F + module_bl_mynn.F + module_cu_kfeta.F + module_cu_ntiedtke.F + module_cu_tiedtke.F + module_ra_cam.F + module_sf_mynn.F + sf_mynn_pre.F + sf_sfclayrev_pre.F ) list(TRANSFORM ATMOSPHERE_CORE_PHYSICS_WRF_SOURCES PREPEND physics/physics_wrf/) + +set(ATMOSPHERE_CORE_PHYSICS_MMM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/physics/physics_mmm) + +if(NOT EXISTS ${ATMOSPHERE_CORE_PHYSICS_MMM_DIR}) + set(PHYSICS_MMM_REPO_URL "https://github.com/NCAR/MMM-physics") + execute_process(COMMAND git clone ${PHYSICS_MMM_REPO_URL} ${ATMOSPHERE_CORE_PHYSICS_MMM_DIR} + RESULT_VARIABLE GIT_CLONE_RESULT + OUTPUT_VARIABLE GIT_CLONE_OUTPUT + ERROR_VARIABLE GIT_CLONE_ERROR) + if(NOT GIT_CLONE_RESULT EQUAL 0) + message(FATAL_ERROR "Git clone failed with error: ${GIT_CLONE_ERROR}") + endif() + +else() + message(STATUS "Directory ${DIR_TO_CHECK} already exists, skipping clone") +endif() + set(ATMOSPHERE_CORE_PHYSICS_MMM_SOURCES - bl_gwdo.F - bl_ysu.F - cu_ntiedtke.F - module_libmassv.F - mp_wsm6.F - mp_wsm6_effectRad.F - bl_mynn.F - bl_mynn_subroutines.F - mp_radar.F - mynn_shared.F - sf_mynn.F - sf_sfclayrev.F + bl_gwdo.F90 + bl_ysu.F90 + cu_ntiedtke.F90 + module_libmassv.F90 + mp_wsm6.F90 + mp_wsm6_effectRad.F90 + bl_mynn.F90 + bl_mynn_subroutines.F90 + mp_radar.F90 + mynn_shared.F90 + sf_mynn.F90 + sf_sfclayrev.F90 ) list(TRANSFORM ATMOSPHERE_CORE_PHYSICS_MMM_SOURCES PREPEND physics/physics_mmm/) +set(ATMOSPHERE_CORE_PHYSICS_NOAMP_UTILITY_SOURCES + CheckNanMod.F90 + ErrorHandleMod.F90 + Machine.F90 +) +list(TRANSFORM ATMOSPHERE_CORE_PHYSICS_NOAMP_UTILITY_SOURCES PREPEND physics/physics_noahmp/utility/) + +set(ATMOSPHERE_CORE_PHYSICS_NOAMP_MPAS_DRIVER_SOURCES + BiochemVarInTransferMod.F90 + ConfigVarOutTransferMod.F90 + ForcingVarInTransferMod.F90 + NoahmpDriverMainMod.F90 + NoahmpIOVarFinalizeMod.F90 + NoahmpReadNamelistMod.F90 + PedoTransferSR2006Mod.F90 + BiochemVarOutTransferMod.F90 + EnergyVarInTransferMod.F90 + ForcingVarOutTransferMod.F90 + NoahmpIOVarInitMod.F90 + NoahmpReadTableMod.F90 + WaterVarInTransferMod.F90 + ConfigVarInTransferMod.F90 + EnergyVarOutTransferMod.F90 + NoahmpInitMainMod.F90 + NoahmpIOVarType.F90 + NoahmpSnowInitMod.F90 + WaterVarOutTransferMod.F90 +) +list(TRANSFORM ATMOSPHERE_CORE_PHYSICS_NOAMP_MPAS_DRIVER_SOURCES PREPEND physics/physics_noahmp/drivers/mpas/) + +set(ATMOSPHERE_CORE_PHYSICS_NOAMP_SRC_SOURCES + AtmosForcingMod.F90 + BalanceErrorCheckGlacierMod.F90 + BalanceErrorCheckMod.F90 + BiochemCropMainMod.F90 + BiochemNatureVegMainMod.F90 + BiochemVarInitMod.F90 + BiochemVarType.F90 + CanopyHydrologyMod.F90 + CanopyRadiationTwoStreamMod.F90 + CanopyWaterInterceptMod.F90 + CarbonFluxCropMod.F90 + CarbonFluxNatureVegMod.F90 + ConfigVarInitMod.F90 + ConfigVarType.F90 + ConstantDefineMod.F90 + CropGrowDegreeDayMod.F90 + CropPhotosynthesisMod.F90 + EnergyMainGlacierMod.F90 + EnergyMainMod.F90 + EnergyVarInitMod.F90 + EnergyVarType.F90 + ForcingVarInitMod.F90 + ForcingVarType.F90 + GeneralInitGlacierMod.F90 + GeneralInitMod.F90 + GlacierIceThermalPropertyMod.F90 + GlacierPhaseChangeMod.F90 + GlacierTemperatureMainMod.F90 + GlacierTemperatureSolverMod.F90 + GlacierThermalDiffusionMod.F90 + GroundAlbedoGlacierMod.F90 + GroundAlbedoMod.F90 + GroundRoughnessPropertyGlacierMod.F90 + GroundRoughnessPropertyMod.F90 + GroundThermalPropertyGlacierMod.F90 + GroundThermalPropertyMod.F90 + GroundWaterMmfMod.F90 + GroundWaterTopModelMod.F90 + HumiditySaturationMod.F90 + IrrigationFloodMod.F90 + IrrigationInfilPhilipMod.F90 + IrrigationMicroMod.F90 + IrrigationPrepareMod.F90 + IrrigationSprinklerMod.F90 + IrrigationTriggerMod.F90 + Makefile + MatrixSolverTriDiagonalMod.F90 + NoahmpMainGlacierMod.F90 + NoahmpMainMod.F90 + NoahmpVarType.F90 + PhenologyMainMod.F90 + PrecipitationHeatAdvectGlacierMod.F90 + PrecipitationHeatAdvectMod.F90 + PsychrometricVariableGlacierMod.F90 + PsychrometricVariableMod.F90 + ResistanceAboveCanopyChen97Mod.F90 + ResistanceAboveCanopyMostMod.F90 + ResistanceBareGroundChen97Mod.F90 + ResistanceBareGroundMostMod.F90 + ResistanceCanopyStomataBallBerryMod.F90 + ResistanceCanopyStomataJarvisMod.F90 + ResistanceGroundEvaporationGlacierMod.F90 + ResistanceGroundEvaporationMod.F90 + ResistanceLeafToGroundMod.F90 + RunoffSubSurfaceDrainageMod.F90 + RunoffSubSurfaceEquiWaterTableMod.F90 + RunoffSubSurfaceGroundWaterMod.F90 + RunoffSubSurfaceShallowMmfMod.F90 + RunoffSurfaceBatsMod.F90 + RunoffSurfaceDynamicVicMod.F90 + RunoffSurfaceExcessDynamicVicMod.F90 + RunoffSurfaceFreeDrainMod.F90 + RunoffSurfaceTopModelEquiMod.F90 + RunoffSurfaceTopModelGrdMod.F90 + RunoffSurfaceTopModelMmfMod.F90 + RunoffSurfaceVicMod.F90 + RunoffSurfaceXinAnJiangMod.F90 + ShallowWaterTableMmfMod.F90 + SnowAgingBatsMod.F90 + SnowAlbedoBatsMod.F90 + SnowAlbedoClassMod.F90 + SnowCoverGlacierMod.F90 + SnowCoverGroundNiu07Mod.F90 + SnowfallBelowCanopyMod.F90 + SnowLayerCombineMod.F90 + SnowLayerDivideMod.F90 + SnowLayerWaterComboMod.F90 + SnowpackCompactionMod.F90 + SnowpackHydrologyGlacierMod.F90 + SnowpackHydrologyMod.F90 + SnowThermalPropertyMod.F90 + SnowWaterMainGlacierMod.F90 + SnowWaterMainMod.F90 + SoilHydraulicPropertyMod.F90 + SoilMoistureSolverMod.F90 + SoilSnowTemperatureMainMod.F90 + SoilSnowTemperatureSolverMod.F90 + SoilSnowThermalDiffusionMod.F90 + SoilSnowWaterPhaseChangeMod.F90 + SoilThermalPropertyMod.F90 + SoilWaterDiffusionRichardsMod.F90 + SoilWaterInfilGreenAmptMod.F90 + SoilWaterInfilPhilipMod.F90 + SoilWaterInfilSmithParlangeMod.F90 + SoilWaterMainMod.F90 + SoilWaterSupercoolKoren99Mod.F90 + SoilWaterSupercoolNiu06Mod.F90 + SoilWaterTranspirationMod.F90 + SurfaceAlbedoGlacierMod.F90 + SurfaceAlbedoMod.F90 + SurfaceEmissivityGlacierMod.F90 + SurfaceEmissivityMod.F90 + SurfaceEnergyFluxBareGroundMod.F90 + SurfaceEnergyFluxGlacierMod.F90 + SurfaceEnergyFluxVegetatedMod.F90 + SurfaceRadiationGlacierMod.F90 + SurfaceRadiationMod.F90 + TileDrainageEquiDepthMod.F90 + TileDrainageHooghoudtMod.F90 + TileDrainageSimpleMod.F90 + VaporPressureSaturationMod.F90 + WaterMainGlacierMod.F90 + WaterMainMod.F90 + WaterTableDepthSearchMod.F90 + WaterTableEquilibriumMod.F90 + WaterVarInitMod.F90 + WaterVarType.F90 +) +list(TRANSFORM ATMOSPHERE_CORE_PHYSICS_NOAMP_SRC_SOURCES PREPEND physics/physics_noahmp/src/) + # diagnostics/ set(ATMOSPHERE_CORE_DIAGNOSTIC_SOURCES - mpas_atm_diagnostic_template.F - mpas_atm_diagnostics_manager.F - mpas_atm_diagnostics_utils.F - mpas_cloud_diagnostics.F - mpas_convective_diagnostics.F - mpas_isobaric_diagnostics.F - mpas_pv_diagnostics.F - mpas_soundings.F + mpas_atm_diagnostic_template.F + mpas_atm_diagnostics_manager.F + mpas_atm_diagnostics_utils.F + mpas_cloud_diagnostics.F + mpas_convective_diagnostics.F + mpas_isobaric_diagnostics.F + mpas_pv_diagnostics.F + mpas_soundings.F ) list(TRANSFORM ATMOSPHERE_CORE_DIAGNOSTIC_SOURCES PREPEND diagnostics/) # dynamics/ set(ATMOSPHERE_CORE_DYNAMICS_SOURCES - mpas_atm_boundaries.F - mpas_atm_iau.F - mpas_atm_time_integration.F) + mpas_atm_boundaries.F + mpas_atm_iau.F + mpas_atm_time_integration.F) list(TRANSFORM ATMOSPHERE_CORE_DYNAMICS_SOURCES PREPEND dynamics/) # utils/ set(ATMOSPHERE_CORE_UTILS_SOURCES - atmphys_build_tables_thompson.F - build_tables.F) + atmphys_build_tables_thompson.F + build_tables.F) list(TRANSFORM ATMOSPHERE_CORE_UTILS_SOURCES PREPEND utils/) # core_atosphere set(ATMOSPHERE_CORE_SOURCES - mpas_atm_dimensions.F - mpas_atm_threading.F - mpas_atm_core.F - mpas_atm_core_interface.F - mpas_atm_halos.F + mpas_atm_dimensions.F + mpas_atm_threading.F + mpas_atm_core.F + mpas_atm_core_interface.F + mpas_atm_halos.F ) ## Generated includes set(ATMOSPHERE_CORE_INCLUDES - block_dimension_routines.inc - core_variables.inc - define_packages.inc - domain_variables.inc - namelist_call.inc - namelist_defines.inc - setup_immutable_streams.inc - structs_and_variables.inc) + block_dimension_routines.inc + core_variables.inc + define_packages.inc + domain_variables.inc + namelist_call.inc + namelist_defines.inc + setup_immutable_streams.inc + structs_and_variables.inc) add_library(core_atmosphere ${ATMOSPHERE_CORE_SOURCES} - ${ATMOSPHERE_CORE_PHYSICS_SOURCES} - ${ATMOSPHERE_CORE_PHYSICS_MMM_SOURCES} - ${ATMOSPHERE_CORE_PHYSICS_WRF_SOURCES} - ${ATMOSPHERE_CORE_DIAGNOSTIC_SOURCES} - ${ATMOSPHERE_CORE_DYNAMICS_SOURCES}) + ${ATMOSPHERE_CORE_PHYSICS_NOAMP_UTILITY_SOURCES} + ${ATMOSPHERE_CORE_PHYSICS_NOAMP_MPAS_DRIVER_SOURCES} + ${ATMOSPHERE_CORE_PHYSICS_NOAMP_SRC_SOURCES} + ${ATMOSPHERE_CORE_PHYSICS_SOURCES} + ${ATMOSPHERE_CORE_PHYSICS_MMM_SOURCES} + ${ATMOSPHERE_CORE_PHYSICS_WRF_SOURCES} + ${ATMOSPHERE_CORE_DIAGNOSTIC_SOURCES} + ${ATMOSPHERE_CORE_DYNAMICS_SOURCES}) set(CORE_ATMOSPHERE_COMPILE_DEFINITIONS - mpas=1 - MPAS_NATIVE_TIMERS + mpas=1 + MPAS_NATIVE_TIMERS ) if (${DO_PHYSICS}) list(APPEND CORE_ATMOSPHERE_COMPILE_DEFINITIONS DO_PHYSICS) @@ -178,10 +367,10 @@ else () endif () FetchContent_Declare(mpas_data - GIT_REPOSITORY https://github.com/MPAS-Dev/MPAS-Data.git - GIT_TAG ${MPAS_DATA_GIT_TAG} - GIT_PROGRESS True - GIT_SHALLOW True) + GIT_REPOSITORY https://github.com/MPAS-Dev/MPAS-Data.git + GIT_TAG ${MPAS_DATA_GIT_TAG} + GIT_PROGRESS True + GIT_SHALLOW True) FetchContent_Populate(mpas_data) message(STATUS "MPAS-Data source dir: ${mpas_data_SOURCE_DIR}") set(PHYSICS_WRF_DATA_DIR ${mpas_data_SOURCE_DIR}/atmosphere/physics_wrf/files) @@ -189,7 +378,7 @@ file(GLOB PHYSICS_WRF_DATA RELATIVE ${PHYSICS_WRF_DATA_DIR} "${PHYSICS_WRF_DATA_ file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${PROJECT_NAME}/core_atmosphere) foreach (data_file IN LISTS PHYSICS_WRF_DATA) execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${PHYSICS_WRF_DATA_DIR}/${data_file} - ${CMAKE_BINARY_DIR}/${PROJECT_NAME}/core_atmosphere/${data_file}) + ${CMAKE_BINARY_DIR}/${PROJECT_NAME}/core_atmosphere/${data_file}) endforeach () install(DIRECTORY ${PHYSICS_WRF_DATA_DIR}/ DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/core_atmosphere) diff --git a/src/framework/mpas_dmpar.F b/src/framework/mpas_dmpar.F index 6d68c0c656..3840ad6124 100644 --- a/src/framework/mpas_dmpar.F +++ b/src/framework/mpas_dmpar.F @@ -552,6 +552,7 @@ subroutine mpas_dmpar_bcast_reals(dminfo, n, rarray, proc)!{{{ end subroutine mpas_dmpar_bcast_reals!}}} + !----------------------------------------------------------------------- ! routine mpas_dmpar_bcast_real4s ! From 2c3e974b7098fd38b481434f2b2fc9b7e31eabf4 Mon Sep 17 00:00:00 2001 From: amstokely Date: Mon, 8 Jul 2024 14:12:05 -0600 Subject: [PATCH 09/16] Restore CMake support for building the init_atmosphere core This commit restores CMake support for the atmosphere core, which broke due to changes made prior to the version 8.2 release. The breaking changes were a result of the addition of mpas_init_atm_thompson_aerosols.F to the init_atmosphere core without updating the CMakeLists.txt. To fix this problem, this file was appended to the list of source files in the init_atmosphere core's CMakeLists.txt. --- .gitignore | 1 - src/core_atmosphere/CMakeLists.txt | 2 +- src/core_init_atmosphere/CMakeLists.txt | 1 + src/framework/mpas_dmpar.F | 1 - 4 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index a06f462226..42e80e9e98 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,6 @@ src/core_*/*.f90 src/framework/*.f90 src/driver/*.f90 src/operators/*.f90 -src/core_atmosphere/physics/physics_mmm # All object files *.o diff --git a/src/core_atmosphere/CMakeLists.txt b/src/core_atmosphere/CMakeLists.txt index 210f366727..ac0d28f469 100644 --- a/src/core_atmosphere/CMakeLists.txt +++ b/src/core_atmosphere/CMakeLists.txt @@ -62,7 +62,7 @@ set(ATMOSPHERE_CORE_PHYSICS_WRF_SOURCES module_mp_thompson_cldfra3.F module_mp_thompson_aerosols.F module_mp_wsm6.F - module_ra_rrtmg_sw_aerosols + module_ra_rrtmg_sw_aerosols.F module_ra_cam_support.F module_ra_rrtmg_lw.F module_ra_rrtmg_sw.F diff --git a/src/core_init_atmosphere/CMakeLists.txt b/src/core_init_atmosphere/CMakeLists.txt index cd67fb4d2e..0835d55be9 100644 --- a/src/core_init_atmosphere/CMakeLists.txt +++ b/src/core_init_atmosphere/CMakeLists.txt @@ -27,6 +27,7 @@ set(init_atm_core_srcs mpas_init_atm_cases.F mpas_init_atm_core.F mpas_init_atm_core_interface.F + mpas_init_atm_thompson_aerosols.F mpas_init_atm_gwd.F mpas_init_atm_hinterp.F mpas_init_atm_llxy.F diff --git a/src/framework/mpas_dmpar.F b/src/framework/mpas_dmpar.F index 3840ad6124..6d68c0c656 100644 --- a/src/framework/mpas_dmpar.F +++ b/src/framework/mpas_dmpar.F @@ -552,7 +552,6 @@ subroutine mpas_dmpar_bcast_reals(dminfo, n, rarray, proc)!{{{ end subroutine mpas_dmpar_bcast_reals!}}} - !----------------------------------------------------------------------- ! routine mpas_dmpar_bcast_real4s ! From 84724d50d581a88b35fdfc345245e800d64a5fa5 Mon Sep 17 00:00:00 2001 From: ldfowler58 Date: Tue, 16 Jul 2024 14:13:50 -0600 Subject: [PATCH 10/16] * In ./src/core_atmosphere//physics/mpas_atmphys_driver_microphysics.F, corrected the calculation of the height Above Ground Level (AGL) prior to computing radar in subroutine compute_radar_reflectivity. --- .../physics/mpas_atmphys_driver_microphysics.F | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core_atmosphere/physics/mpas_atmphys_driver_microphysics.F b/src/core_atmosphere/physics/mpas_atmphys_driver_microphysics.F index 90b4d9292f..067b4ef22f 100644 --- a/src/core_atmosphere/physics/mpas_atmphys_driver_microphysics.F +++ b/src/core_atmosphere/physics/mpas_atmphys_driver_microphysics.F @@ -705,7 +705,7 @@ subroutine compute_radar_reflectivity(configs,diag_physics,its,ite) qs1d(k) = qs_p(i,k,j) qg1d(k) = qg_p(i,k,j) dBZ1d(k) = -35._RKIND - zp(k) = z_p(i,k,j) - z_p(i,1,j)+0.5*dz_p(i,1,j) ! height AGL + zp(k) = z_p(i,k,j) - z_p(i,1,j) + 0.5*dz_p(i,k,j) ! height AGL enddo call refl10cm_wsm6(qv1d,qr1d,qs1d,qg1d,t1d,p1d,dBZ1d,kts,kte) @@ -756,7 +756,7 @@ subroutine compute_radar_reflectivity(configs,diag_physics,its,ite) qg1d(k) = qg_p(i,k,j) nr1d(k) = nr_p(i,k,j) dBZ1d(k) = -35._RKIND - zp(k) = z_p(i,k,j) - z_p(i,1,j)+0.5*dz_p(i,1,j) ! height AGL + zp(k) = z_p(i,k,j) - z_p(i,1,j) + 0.5*dz_p(i,k,j) ! height AGL enddo call calc_refl10cm(qv1d,qc1d,qr1d,nr1d,qs1d,qg1d,t1d,p1d,dBZ1d,kts,kte,i,j) From fe46d4ffc4ec3c5ce4aa4ef7b8977318031e1d43 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Mon, 1 Jul 2024 17:01:01 -0700 Subject: [PATCH 11/16] Check for the libnetcdf library existence similar to pnetcdf As the netcdf library logic mirrors the pnetcdf one, it would suffer from the same issues noted in 0ca4208 about lib/lib64 checking. This updates the corresponding issue in the netcdf library detection before it becomes an issue. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 9b0a17a0bb..1483ba56b0 100644 --- a/Makefile +++ b/Makefile @@ -525,10 +525,10 @@ ifneq ($(wildcard $(PIO_LIB)/libgptl\.*), ) endif ifneq "$(NETCDF)" "" -ifneq ($(wildcard $(NETCDF)/lib), ) +ifneq ($(wildcard $(NETCDF)/lib/libnetcdf.*), ) NETCDFLIBLOC = lib endif -ifneq ($(wildcard $(NETCDF)/lib64), ) +ifneq ($(wildcard $(NETCDF)/lib64/libnetcdf.*), ) NETCDFLIBLOC = lib64 endif CPPINCLUDES += -I$(NETCDF)/include From bbcb89dec62fcab95871d6734cdbaf8d23665774 Mon Sep 17 00:00:00 2001 From: ldfowler58 Date: Wed, 17 Jul 2024 14:45:38 -0600 Subject: [PATCH 12/16] * In ./src/core_atmosphere: -> removed package bl_mynn_in from packages included for nc and tend_nc. the array declaration for nc, nifa, nwfa, tend_nc, tend_nifa, and tend_nwfa now includes the same packages. -> in ./physics/mpas_atmphys_interface.F, added arrays nifa_p, and nwfa_p for the PBL option "bl_mynn". -> in ./physics/mpas_atmphys_todynamics.F, only updates tend_scalars(index_nc, tend_scalars(index_nifa, and tend_scalars(index_nwfa due to PBL processes when the microp_scheme option is "mp_thompson_aerosols". These changes are needed to run the MYNN PBL scheme without the aerosol-aware option of the Thompson cloud microphysics scheme. --- src/core_atmosphere/Registry.xml | 4 ++-- .../physics/mpas_atmphys_interface.F | 18 ++++++++++++++++-- .../physics/mpas_atmphys_todynamics.F | 13 ++++++++++--- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/core_atmosphere/Registry.xml b/src/core_atmosphere/Registry.xml index 10cfbca3ea..71a361a730 100644 --- a/src/core_atmosphere/Registry.xml +++ b/src/core_atmosphere/Registry.xml @@ -1576,7 +1576,7 @@ + packages="mp_thompson_aers_in"/> + packages="mp_thompson_aers_in"/> scalars(index_nc,:,:) + nifa => scalars(index_nifa,:,:) + nwfa => scalars(index_nwfa,:,:) do j = jts,jte do k = kts,kte do i = its,ite - nc_p(i,k,j) = max(0.,nc(k,i) ) + nc_p(i,k,j) = max(0.,nc(k,i)) + nifa_p(i,k,j) = max(0.,nifa(k,i)) + nwfa_p(i,k,j) = max(0.,nwfa(k,i)) enddo enddo enddo diff --git a/src/core_atmosphere/physics/mpas_atmphys_todynamics.F b/src/core_atmosphere/physics/mpas_atmphys_todynamics.F index 81100225a0..284b072851 100644 --- a/src/core_atmosphere/physics/mpas_atmphys_todynamics.F +++ b/src/core_atmosphere/physics/mpas_atmphys_todynamics.F @@ -352,13 +352,20 @@ subroutine physics_get_tend_work( & do i = 1, nCellsSolve do k = 1, nVertLevels tend_scalars(index_qs,k,i) = tend_scalars(index_qs,k,i) + rqsblten(k,i)*mass(k,i) - tend_scalars(index_nc,k,i) = tend_scalars(index_nc,k,i) + rncblten(k,i)*mass(k,i) tend_scalars(index_ni,k,i) = tend_scalars(index_ni,k,i) + rniblten(k,i)*mass(k,i) - tend_scalars(index_nifa,k,i) = tend_scalars(index_nifa,k,i) + rnifablten(k,i)*mass(k,i) - tend_scalars(index_nwfa,k,i) = tend_scalars(index_nwfa,k,i) + rnwfablten(k,i)*mass(k,i) enddo enddo + if(trim(microp_scheme) == 'mp_thompson_aerosols') then + do i = 1, nCellsSolve + do k = 1, nVertLevels + tend_scalars(index_nc,k,i) = tend_scalars(index_nc,k,i) + rncblten(k,i)*mass(k,i) + tend_scalars(index_nifa,k,i) = tend_scalars(index_nifa,k,i) + rnifablten(k,i)*mass(k,i) + tend_scalars(index_nwfa,k,i) = tend_scalars(index_nwfa,k,i) + rnwfablten(k,i)*mass(k,i) + enddo + enddo + endif + case default end select pbl_select endif From 5f250195f520e46eb7f6795e2fe192e158ff99a4 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Fri, 28 Jun 2024 07:38:35 -0700 Subject: [PATCH 13/16] Add core_physic-specific dependencies to mpas_atmphys_lsm_noahmpfinalize.o Add the object dependencies in the makefile for mpas_atmphys_lsm_noahmpfinalize.o specific to the objects created under core_physics, i.e. any use statement that reference modules compiled as part of the core_physics target. Modules originating from NoahMP and framework are ignored as they should be handled separately before the core_physics target is started. --- src/core_atmosphere/physics/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core_atmosphere/physics/Makefile b/src/core_atmosphere/physics/Makefile index 4efbdcf1cc..94a8a9788a 100644 --- a/src/core_atmosphere/physics/Makefile +++ b/src/core_atmosphere/physics/Makefile @@ -194,6 +194,9 @@ mpas_atmphys_lsm_noahmpinit.o: \ mpas_atmphys_utilities.o \ mpas_atmphys_vars.o +mpas_atmphys_lsm_noahmpfinalize.o : \ + mpas_atmphys_vars.o + mpas_atmphys_manager.o: \ mpas_atmphys_constants.o \ mpas_atmphys_o3climatology.o \ From 520d165ae7fe722ea85ba15e4500152262d37a04 Mon Sep 17 00:00:00 2001 From: Kuan-Chih Wang Date: Thu, 1 Aug 2024 16:19:29 -0600 Subject: [PATCH 14/16] Fix MPAS-A dycore-only build When building MPAS-A as a dycore, all physics-related components are disabled. An example scenario of this is for use with CAM/CAM-SIMA. However, the MPAS-A registry file in version 8.2.0 contains the following regressions, which cause the dycore-only build to break: * The MPAS-A registry file introduced a new stream, `da_state`, which unconditionally includes variables that exist only when physics are enabled. * The MPAS-A registry file unconditionally includes a new registry file from Noah-MP, which is applicable only when physics are enabled. Fix MPAS-A dycore-only build by guarding the above regions with the `DO_PHYSICS` macro. --- src/core_atmosphere/Registry.xml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/core_atmosphere/Registry.xml b/src/core_atmosphere/Registry.xml index 10cfbca3ea..cba1532823 100644 --- a/src/core_atmosphere/Registry.xml +++ b/src/core_atmosphere/Registry.xml @@ -1155,10 +1155,6 @@ - - - - @@ -1171,6 +1167,11 @@ +#ifdef DO_PHYSICS + + + + @@ -1209,6 +1210,7 @@ +#endif @@ -3588,6 +3590,8 @@ #include "diagnostics/Registry_diagnostics.xml" -#include "physics/Registry_noahmp.xml" +#ifdef DO_PHYSICS +#include "physics/Registry_noahmp.xml" +#endif From ba80002db1d760ab21439a0584555501091c3d0b Mon Sep 17 00:00:00 2001 From: ldfowler58 Date: Tue, 6 Aug 2024 16:33:40 -0600 Subject: [PATCH 15/16] * In ./src/core_init_atmosphere/mpas_init_atm_thompson_aerosols.F, changed print statements "enter/end subroutine init_atm_gocart" with "enter/end subroutine init_atm_thompson_aerosols. --- src/core_init_atmosphere/mpas_init_atm_thompson_aerosols.F | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core_init_atmosphere/mpas_init_atm_thompson_aerosols.F b/src/core_init_atmosphere/mpas_init_atm_thompson_aerosols.F index 660a836e6e..89fc6916f1 100644 --- a/src/core_init_atmosphere/mpas_init_atm_thompson_aerosols.F +++ b/src/core_init_atmosphere/mpas_init_atm_thompson_aerosols.F @@ -52,7 +52,7 @@ subroutine init_atm_thompson_aerosols(block,mesh,configs,diag,state) logical:: lexist !----------------------------------------------------------------------------------------------------------------- -!call mpas_log_write('--- enter subroutine init_atm_gocart:') +!call mpas_log_write('--- enter subroutine init_atm_thompson_aerosols:') !inquire if the GOCART input file exists: lexist = .false. @@ -75,7 +75,7 @@ subroutine init_atm_thompson_aerosols(block,mesh,configs,diag,state) call mpas_log_write('nwfa and nifa are set to zero and not interpolated from climatological data.') endif -!call mpas_log_write('--- end subroutine init_atm_gocart.') +!call mpas_log_write('--- end subroutine init_atm_thompson_aerosols.') call mpas_log_write(' ') end subroutine init_atm_thompson_aerosols From bd4d0e06a4f5ae73578d2257a206b7f2503a2fe4 Mon Sep 17 00:00:00 2001 From: ldfowler58 Date: Tue, 6 Aug 2024 16:53:46 -0600 Subject: [PATCH 16/16] * In ./src/core_atmosphere/physics/mpas_atmphys_driver_radiation_sw.F, removed extra deallocate for variable tao5503d_p in subroutine deallocate_radiation_sw.F. --- src/core_atmosphere/physics/mpas_atmphys_driver_radiation_sw.F | 1 - 1 file changed, 1 deletion(-) diff --git a/src/core_atmosphere/physics/mpas_atmphys_driver_radiation_sw.F b/src/core_atmosphere/physics/mpas_atmphys_driver_radiation_sw.F index 0b5353481a..bc2be079ef 100644 --- a/src/core_atmosphere/physics/mpas_atmphys_driver_radiation_sw.F +++ b/src/core_atmosphere/physics/mpas_atmphys_driver_radiation_sw.F @@ -300,7 +300,6 @@ subroutine deallocate_radiation_sw(configs) if(allocated(pin_p) ) deallocate(pin_p ) if(allocated(o3clim_p) ) deallocate(o3clim_p ) - if(allocated(taod5503d_p) ) deallocate(taod5503d_p ) if(allocated(tauaer_p) ) deallocate(tauaer_p ) if(allocated(ssaaer_p) ) deallocate(ssaaer_p ) if(allocated(asyaer_p) ) deallocate(asyaer_p )