Skip to content

Commit 515e520

Browse files
committed
Merge branch 'release-v8.4.0'
MPAS Version 8.4.0 This release of MPAS introduces new capabilities and improvements in the MPAS-Atmosphere model and its supporting software infrastructure, and it is the first release to provide the foundation for CheMPAS-A, a chemistry capability for MPAS-Atmosphere. Notable changes are listed below. MPAS-Atmosphere Initialization: * Fix an issue in snow initialization over areas covered by seaice. (PR #1438) * Introduce namelist control over the vertical coordinate configuration for real-data case initialization. Two new namelist options may now be specified in the &vertical_grid namelist group in the namelist.init_atmosphere file: - config_hybrid_coordinate (default: true) Whether to employ a hybrid vertical coordinate - config_hybrid_top_z (default: 30000 m) Height at which coordinate surfaces become constant height surfaces Additionally, the smoothing coefficient formula for the hybrid coordinate now uses the transition height instead of the model top height. (PR #1382) * Add computation of the edgeNormalVectors, cellTangentPlane, and localVerticalUnitVectors fields for MPAS-A initialization case 13 (CAM-MPAS 3-d grid) to better support alternative initialization workflows for CAM-MPAS. (PR #1351) MPAS-Atmosphere Dynamics: * Implement an initial Large-Eddy Simulation (LES) capability. Similar to WRF, it contains two subgrid turbulence models -- a diagnostic Turbulent Kinetic Energy (TKE) formulation based on a 3-d Smagorinsky formulation, and a 1.5-order prognostic TKE formulation. These formulations generally follow the implementation in WRF (see the WRF Technical Note Version 4, sections 4.2.3 and 4.2.4 for a description of the formulations). (PR #1404) * Generalize the epssm parameter, allowing level-dependent values to be specified through four new namelist options: - config_epssm_minimum (default value: 0.1) - config_epssm_maximum (default value: 0.5) - config_epssm_transition_bottom_z (default value: 30000.0) - config_epssm_transition_top_z (default value: 50000.0) The epssm parameter is an off-centering coefficient for the vertically semi-implicit acoustic / gravity-wave integration, and it was previously specified as a single, constant value using the config_epssm namelist option. (PR #1381) * Add the capability to turn off microphysics tendencies above a specified height with a new namelist option, config_microphysics_top, in the &physics namelist group. Ignoring tendencies from the microphysics at upper levels has been found to alleviate some instabilities in deep-domain (i.e., model tops above the stratopause) MPAS-Atmosphere simulations. (PR #1380) * Optimize OpenACC data movement throughout the MPAS-A dycore, so that the majority of fields are transferred to the device at the start of a dynamics step and from the device at the end of a dynamics step. (PR #1315) * Remove 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. (PR #1379) MPAS-Atmosphere Physics: * Correct an issue with high q2 values over urban cells in Noah-MP. (PR #1383) * Fix crashes when using the CAM SW radiation scheme. (PR #1391) * Fix an indexing typo in mpas_atmphys_interface.F, where evapprod(k,k) was used instead of evapprod(k,i). The fix corrects diagnostic output, but should not affect the model state or simulation results. (PR #1396) * Correct the units designations of the gravity wave drag diagnostics variables dusfcg, dvsfcg, dtaux3d and dtauy3d in the atmosphere core's Registry.xml file. (PR #1378) MPAS-Atmosphere Misc.: * Remove PV diagnostic fields from the default "output" stream for MPAS-Atmosphere, reducing the size of the default "history" netCDF files by ~20%. (PR #1428) * Modify the MPAS-Atmosphere CMake build system to use manage_externals to obtain specific tags from the https://github.com/NCAR/MMM-physics.git and https://github.com/NOAA-GSL/UGWP.git repositories, rather than simply obtaining the HEAD of the default branch. This modification corrects build failures when using CMake. (PR #1421) CheMPAS-A: * Enable linking with the MUSICA-Fortran library to support development of chemistry capabilities based on MICM and TUV-x. (PR #1309) * Add a new namelist group, &musica, with a single option, config_micm_file, to control the MICM configuration in MPAS-Atmosphere. The new namelist group is only included in the namelist.atmosphere file (and therefore, only recognized) when MPAS is compiled with support for the MUSICA library. (PR #1376) * Introduce directory structure and stub modules for MUSICA, and more broadly, for chemistry options in the atmosphere core. (PR #1360) New directories and modules include: src/ core_atmosphere/ chemistry/ <--| mpas_atm_chemistry.F <--| musica/ <--| new in this release mpas_musica.F <--| Infrastructure: * Introduce the ability to partition meshes "online" at model startup using the PT-Scotch library. (PR #1364) * Enable execution of halo exchanges directly on GPU-resident fields when MPAS is linked with an MPI library that is GPU-aware. To enable GPU-aware halo exchanges, a new namelist option, config_gpu_aware_mpi, in the &development namelist group must be set to true at runtime. (PR #1355) * Improve support for using an external ESMF library through a new build option, MPAS_ESMF. (PR #1405) * Set the default PnetCDF header alignment to 128 KiB when creating new output files with SMIOL. This has been found to fix I/O issues when overwriting existing model output files under certain conditions. (PR #1386) * Fix an issue with macro expansion with newer Intel oneAPI compilers by adding a flag for the 'intel' build target to change the order of macro expansion in the Fortran pre-processor. This change in macro expansion order fixes an issue with some nested macro use in MPAS. (PR #1392) * Fix a buffer overflow in the streaminfo_query function in the mpas_stream_inquiry module , where the local array c_attname was allocated without space for a C null character. (PR #1352)
2 parents b9090a1 + c0f839d commit 515e520

81 files changed

Lines changed: 8276 additions & 1812 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 122 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ gnu: # BUILDTARGET GNU Fortran, C, and C++ compilers
1616
"CC_SERIAL = gcc" \
1717
"CXX_SERIAL = g++" \
1818
"FFLAGS_PROMOTION = -fdefault-real-8 -fdefault-double-8" \
19-
"FFLAGS_OPT = -std=f2008 -O3 -ffree-line-length-none -fconvert=big-endian -ffree-form" \
19+
"FFLAGS_OPT = -std=f2008 -fimplicit-none -O3 -ffree-line-length-none -fconvert=big-endian -ffree-form" \
2020
"CFLAGS_OPT = -O3" \
2121
"CXXFLAGS_OPT = -O3" \
2222
"LDFLAGS_OPT = -O3" \
23-
"FFLAGS_DEBUG = -std=f2008 -g -ffree-line-length-none -fconvert=big-endian -ffree-form -fcheck=all -fbacktrace -ffpe-trap=invalid,zero,overflow" \
23+
"FFLAGS_DEBUG = -std=f2008 -fimplicit-none -g -ffree-line-length-none -fconvert=big-endian -ffree-form -fcheck=all -fbacktrace -ffpe-trap=invalid,zero,overflow" \
2424
"CFLAGS_DEBUG = -g" \
2525
"CXXFLAGS_DEBUG = -g" \
2626
"LDFLAGS_DEBUG = -g" \
@@ -663,11 +663,11 @@ intel: # BUILDTARGET Intel oneAPI Fortran, C, and C++ compiler suite
663663
"CC_SERIAL = icx" \
664664
"CXX_SERIAL = icpx" \
665665
"FFLAGS_PROMOTION = -real-size 64" \
666-
"FFLAGS_OPT = -O3 -convert big_endian -free -align array64byte" \
666+
"FFLAGS_OPT = -O3 -convert big_endian -free -align array64byte -Qoption,fpp,-macro_expand=vc" \
667667
"CFLAGS_OPT = -O3" \
668668
"CXXFLAGS_OPT = -O3" \
669669
"LDFLAGS_OPT = -O3" \
670-
"FFLAGS_DEBUG = -g -convert big_endian -free -check bounds,pointers,arg_temp_created,format,shape,contiguous -fpe0 -traceback" \
670+
"FFLAGS_DEBUG = -g -convert big_endian -free -check bounds,pointers,arg_temp_created,format,shape,contiguous -fpe0 -traceback -Qoption,fpp,-macro_expand=vc" \
671671
"CFLAGS_DEBUG = -g -traceback" \
672672
"CXXFLAGS_DEBUG = -g -traceback" \
673673
"LDFLAGS_DEBUG = -g -traceback" \
@@ -685,6 +685,24 @@ CPPINCLUDES =
685685
FCINCLUDES =
686686
LIBS =
687687

688+
export MPAS_ESMF ?= embedded
689+
ifeq "$(MPAS_ESMF)" "external"
690+
ifeq ($(wildcard $(ESMFMKFILE)), )
691+
$(error ESMFMKFILE must be set if MPAS_ESMF=external)
692+
endif
693+
include $(ESMFMKFILE)
694+
export MPAS_ESMF_INC = $(ESMF_F90COMPILEPATHS)
695+
export MPAS_ESMF_LIB = $(ESMF_F90LINKPATHS) $(ESMF_F90ESMFLINKPATHS) $(ESMF_F90ESMFLINKLIBS)
696+
override CPPFLAGS += -DMPAS_EXTERNAL_ESMF_LIB=true
697+
ESMF_MESSAGE="MPAS was built with an external ESMF library using ESMFMKFILE"
698+
else ifeq "$(MPAS_ESMF)" "embedded"
699+
export MPAS_ESMF_INC = -I$(PWD)/src/external/esmf_time_f90
700+
export MPAS_ESMF_LIB = -L$(PWD)/src/external/esmf_time_f90 -lesmf_time
701+
ESMF_MESSAGE="MPAS was built with the embedded ESMF timekeeping library."
702+
else
703+
$(error Invalid MPAS_ESMF option: $(MPAS_ESMF) - valid options "embedded", "external")
704+
endif
705+
688706
ifneq "$(PIO)" ""
689707
#
690708
# Regardless of PIO library version, look for a lib subdirectory of PIO path
@@ -759,6 +777,15 @@ endif
759777
LIBS += $(NCLIB)
760778
endif
761779

780+
ifneq "$(SCOTCH)" ""
781+
SCOTCH_INCLUDES += -I$(SCOTCH)/include
782+
SCOTCH_LIBS += -L$(SCOTCH)/lib64 -lptscotch -lscotch -lptscotcherr -lm
783+
SCOTCH_FLAGS = -DMPAS_SCOTCH
784+
785+
CPPINCLUDES += $(SCOTCH_INCLUDES)
786+
LIBS += $(SCOTCH_LIBS)
787+
override CPPFLAGS += $(SCOTCH_FLAGS)
788+
endif
762789

763790
ifneq "$(PNETCDF)" ""
764791
ifneq ($(wildcard $(PNETCDF)/lib/libpnetcdf.*), )
@@ -872,6 +899,20 @@ $(if $(PRECISION),$(info NOTE: PRECISION=single is unnecessary, single is the de
872899
PRECISION_MESSAGE="MPAS was built with default single-precision reals."
873900
endif #PRECISION IF
874901

902+
# Optional MUSICA support for chemistry
903+
ifeq "$(shell echo $(MUSICA) | tr '[:upper:]' '[:lower:]')" "true"
904+
ifeq ($(shell pkg-config --exists musica-fortran && echo yes || echo no), no)
905+
$(error "musica-fortran package is not installed. Please install it to proceed.")
906+
endif
907+
MUSICA_FCINCLUDES += $(shell pkg-config --cflags musica-fortran)
908+
MUSICA_LIBS += $(shell pkg-config --libs musica-fortran)
909+
MUSICA_FFLAGS = -DMPAS_USE_MUSICA
910+
911+
FCINCLUDES += $(MUSICA_FCINCLUDES)
912+
LIBS += $(MUSICA_LIBS)
913+
override CPPFLAGS += $(MUSICA_FFLAGS)
914+
endif
915+
875916
ifeq "$(USE_PAPI)" "true"
876917
CPPINCLUDES += -I$(PAPI)/include -D_PAPI
877918
FCINCLUDES += -I$(PAPI)/include
@@ -1374,6 +1415,63 @@ mpi_f08_test:
13741415
$(if $(findstring 1,$(MPAS_MPI_F08)), $(eval MPI_F08_MESSAGE = "Using the mpi_f08 module."), )
13751416
$(if $(findstring 1,$(MPAS_MPI_F08)), $(info mpi_f08 module detected.))
13761417

1418+
musica_fortran_test:
1419+
@#
1420+
@# Create a Fortran test program that will link against the MUSICA library
1421+
@#
1422+
$(info Checking for a working MUSICA-Fortran library...)
1423+
$(eval MUSICA_FORTRAN_TEST := $(shell $\
1424+
printf "program test_musica_fortran\n$\
1425+
& use musica_util, only : string_t\n$\
1426+
& use musica_micm, only : get_micm_version\n$\
1427+
& type(string_t) :: version_string\n$\
1428+
& version_string = get_micm_version()\n$\
1429+
& print *, \"MUSICA support is available. MICM version: \", version_string%%value_\n$\
1430+
end program test_musica_fortran\n" | sed 's/&/ /' > test_musica_fortran.f90; $\
1431+
$\
1432+
$(FC) $(MUSICA_FCINCLUDES) $(MUSICA_FFLAGS) test_musica_fortran.f90 -o test_musica_fortran.x $(MUSICA_LIBS) > /dev/null 2>&1; $\
1433+
musica_fortran_status=$$?; $\
1434+
rm -f test_musica_fortran.f90 test_musica_fortran.x; $\
1435+
if [ $$musica_fortran_status -eq 0 ]; then $\
1436+
printf "1"; $\
1437+
else $\
1438+
printf "0"; $\
1439+
fi $\
1440+
))
1441+
$(if $(findstring 0,$(MUSICA_FORTRAN_TEST)), $(error Could not build a simple test program with MUSICA-Fortran))
1442+
$(eval MUSICA_FORTRAN_VERSION := $(shell pkg-config --modversion musica-fortran))
1443+
$(if $(findstring 1,$(MUSICA_FORTRAN_TEST)), $(info Built a simple test program with MUSICA-Fortran version $(MUSICA_FORTRAN_VERSION)), )
1444+
1445+
scotch_c_test:
1446+
@#
1447+
@# Create a C test program and try to build against the PT-SCOTCH library
1448+
@#
1449+
$(info Checking for a working Scotch library...)
1450+
$(eval SCOTCH_C_TEST := $(shell $\
1451+
printf "#include <stdio.h>\n\
1452+
&#include \"mpi.h\"\n\
1453+
&#include \"ptscotch.h\"\n\
1454+
&int main(){\n\
1455+
& int err;\n\
1456+
& SCOTCH_Dgraph *dgraph;\n\
1457+
& err = SCOTCH_dgraphInit(dgraph, MPI_COMM_WORLD);\n\
1458+
& SCOTCH_dgraphExit(dgraph);\n\
1459+
& return err;\n\
1460+
&}\n" | sed 's/&/ /' > ptscotch_c_test.c; $\
1461+
$\
1462+
$(CC) $(CPPINCLUDES) $(CFLAGS) $(LDFLAGS) ptscotch_c_test.c -o ptscotch_c_test.x $(SCOTCH_LIBS) > ptscotch_c_test.log 2>&1; $\
1463+
scotch_c_status=$$?; $\
1464+
if [ $$scotch_c_status -eq 0 ]; then $\
1465+
printf "1"; $\
1466+
rm -f ptscotch_c_test.c ptscotch_c_test.x ptscotch_c_test.log; $\
1467+
else $\
1468+
printf "0"; $\
1469+
fi $\
1470+
))
1471+
$(if $(findstring 0,$(SCOTCH_C_TEST)), $(error Could not build a simple C program with Scotch. $\
1472+
Test program ptscotch_c_test.c and output ptscotch_c_test.log have been left $\
1473+
in the top-level MPAS directory for further debugging ))
1474+
$(if $(findstring 1,$(SCOTCH_C_TEST)), $(info Built a simple C program with Scotch ))
13771475

13781476
pnetcdf_test:
13791477
@#
@@ -1424,6 +1522,20 @@ IO_MESSAGE = "Using the SMIOL library."
14241522
override CPPFLAGS += "-DMPAS_SMIOL_SUPPORT"
14251523
endif
14261524

1525+
ifneq "$(MUSICA_FFLAGS)" ""
1526+
MAIN_DEPS += musica_fortran_test
1527+
MUSICA_MESSAGE = "MPAS was linked with the MUSICA-Fortran library version $(MUSICA_FORTRAN_VERSION)."
1528+
else
1529+
MUSICA_MESSAGE = "MPAS was not linked with the MUSICA-Fortran library."
1530+
endif
1531+
1532+
ifneq "$(SCOTCH)" ""
1533+
MAIN_DEPS += scotch_c_test
1534+
SCOTCH_MESSAGE = "MPAS has been linked with the Scotch graph partitioning library."
1535+
else
1536+
SCOTCH_MESSAGE = "MPAS was NOT linked with the Scotch graph partitioning library."
1537+
endif
1538+
14271539
mpas_main: $(MAIN_DEPS)
14281540
cd src; $(MAKE) FC="$(FC)" \
14291541
CC="$(CC)" \
@@ -1460,13 +1572,16 @@ mpas_main: $(MAIN_DEPS)
14601572
@echo $(OPENMP_MESSAGE)
14611573
@echo $(OPENMP_OFFLOAD_MESSAGE)
14621574
@echo $(OPENACC_MESSAGE)
1575+
@echo $(MUSICA_MESSAGE)
1576+
@echo $(SCOTCH_MESSAGE)
14631577
@echo $(SHAREDLIB_MESSAGE)
14641578
ifeq "$(AUTOCLEAN)" "true"
14651579
@echo $(AUTOCLEAN_MESSAGE)
14661580
endif
14671581
@echo $(GEN_F90_MESSAGE)
14681582
@echo $(TIMER_MESSAGE)
14691583
@echo $(IO_MESSAGE)
1584+
@echo $(ESMF_MESSAGE)
14701585
@echo "*******************************************************************************"
14711586
clean:
14721587
cd src; $(MAKE) clean RM="$(RM)" CORE="$(CORE)" AUTOCLEAN="$(AUTOCLEAN)"
@@ -1523,6 +1638,9 @@ errmsg:
15231638
@echo " OPENACC=true - builds and links with OpenACC flags. Default is to not use OpenACC."
15241639
@echo " PRECISION=double - builds with default double-precision real kind. Default is to use single-precision."
15251640
@echo " SHAREDLIB=true - generate position-independent code suitable for use in a shared library. Default is false."
1641+
@echo " MPAS_ESMF=opt - Selects the ESMF library to be used for MPAS. Options are:"
1642+
@echo " MPAS_ESMF=embedded - Use the embedded ESMF timekeeping library (default)"
1643+
@echo " MPAS_ESMF=external - Use an external ESMF library, determined by ESMFMKFILE"
15261644
@echo ""
15271645
@echo "Ensure that NETCDF, PNETCDF, PIO, and PAPI (if USE_PAPI=true) are environment variables"
15281646
@echo "that point to the absolute paths for the libraries."

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
MPAS-v8.3.1
1+
MPAS-v8.4.0
22
====
33

44
The Model for Prediction Across Scales (MPAS) is a collaborative project for

cmake/Functions/MPAS_Functions.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ function(mpas_fortran_target target)
121121
list(APPEND MPAS_FORTRAN_TARGET_COMPILE_OPTIONS_PUBLIC
122122
$<$<COMPILE_LANGUAGE:Fortran>:-align array64byte>
123123
$<$<COMPILE_LANGUAGE:Fortran>:-convert big_endian>
124+
$<$<COMPILE_LANGUAGE:Fortran>:-Qoption,fpp,-macro_expand=vc>
124125
)
125126
if(MPAS_DOUBLE_PRECISION)
126127
list(APPEND MPAS_FORTRAN_TARGET_COMPILE_OPTIONS_PRIVATE

cmake/Modules/FindPnetCDF.cmake

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,27 +133,29 @@ set(_new_components)
133133
if(PnetCDF_Fortran_FOUND AND NOT TARGET PnetCDF::PnetCDF_Fortran)
134134
add_library(PnetCDF::PnetCDF_Fortran INTERFACE IMPORTED)
135135
set_target_properties(PnetCDF::PnetCDF_Fortran PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${PnetCDF_INCLUDE_DIR}
136-
INTERFACE_LINK_DIRECTORIES ${PnetCDF_LIB_DIR})
136+
INTERFACE_LINK_DIRECTORIES ${PnetCDF_LIB_DIR}
137+
INTERFACE_LINK_LIBRARIES pnetcdf)
137138
if(PnetCDF_MODULE_DIR AND NOT PnetCDF_MODULE_DIR STREQUAL PnetCDF_INCLUDE_DIR )
138139
set_property(TARGET PnetCDF::PnetCDF_Fortran APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PnetCDF_MODULE_DIR})
139140
endif()
140141
set(_new_components 1)
141-
target_link_libraries(PnetCDF::PnetCDF_Fortran INTERFACE -lpnetcdf)
142142
endif()
143143

144144
# PnetCDF::PnetCDF_C imported interface target
145145
if(PnetCDF_C_FOUND AND NOT TARGET PnetCDF::PnetCDF_C)
146146
add_library(PnetCDF::PnetCDF_C INTERFACE IMPORTED)
147147
set_target_properties(PnetCDF::PnetCDF_C PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${PnetCDF_INCLUDE_DIR}
148-
INTERFACE_LINK_DIRECTORIES ${PnetCDF_LIB_DIR})
148+
INTERFACE_LINK_DIRECTORIES ${PnetCDF_LIB_DIR}
149+
INTERFACE_LINK_LIBRARIES pnetcdf)
149150
set(_new_components 1)
150151
endif()
151152

152153
# PnetCDF::PnetCDF_CXX imported interface target
153154
if(PnetCDF_CXX_FOUND AND NOT TARGET PnetCDF::PnetCDF_CXX)
154155
add_library(PnetCDF::PnetCDF_CXX INTERFACE IMPORTED)
155156
set_target_properties(PnetCDF::PnetCDF_CXX PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${PnetCDF_INCLUDE_DIR}
156-
INTERFACE_LINK_DIRECTORIES ${PnetCDF_LIB_DIR})
157+
INTERFACE_LINK_DIRECTORIES ${PnetCDF_LIB_DIR}
158+
INTERFACE_LINK_LIBRARIES pnetcdf)
157159
set(_new_components 1)
158160
endif()
159161

src/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ else
99
all: mpas
1010

1111
mpas: $(AUTOCLEAN_DEPS) externals frame ops dycore drver
12-
$(LINKER) $(LDFLAGS) -o $(EXE_NAME) driver/*.o -L. -ldycore -lops -lframework $(LIBS) -I./external/esmf_time_f90 -L./external/esmf_time_f90 -lesmf_time
12+
$(LINKER) $(LDFLAGS) -o $(EXE_NAME) driver/*.o -L. -ldycore -lops -lframework $(LIBS) $(MPAS_ESMF_INC) $(MPAS_ESMF_LIB)
1313

1414
externals: $(AUTOCLEAN_DEPS)
1515
( cd external; $(MAKE) FC="$(FC)" SFC="$(SFC)" CC="$(CC)" SCC="$(SCC)" FFLAGS="$(FFLAGS)" CFLAGS="$(CFLAGS)" CPP="$(CPP)" NETCDF="$(NETCDF)" CORE="$(CORE)" all )

src/core_atmosphere/CMakeLists.txt

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -97,20 +97,16 @@ set(ATMOSPHERE_CORE_PHYSICS_WRF_SOURCES
9797
list(TRANSFORM ATMOSPHERE_CORE_PHYSICS_WRF_SOURCES PREPEND physics/physics_wrf/)
9898

9999

100-
set(ATMOSPHERE_CORE_PHYSICS_MMM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/physics/physics_mmm)
101-
102-
if(NOT EXISTS ${ATMOSPHERE_CORE_PHYSICS_MMM_DIR})
103-
set(PHYSICS_MMM_REPO_URL "https://github.com/NCAR/MMM-physics")
104-
execute_process(COMMAND git clone ${PHYSICS_MMM_REPO_URL} ${ATMOSPHERE_CORE_PHYSICS_MMM_DIR}
105-
RESULT_VARIABLE GIT_CLONE_RESULT
106-
OUTPUT_VARIABLE GIT_CLONE_OUTPUT
107-
ERROR_VARIABLE GIT_CLONE_ERROR)
108-
if(NOT GIT_CLONE_RESULT EQUAL 0)
109-
message(FATAL_ERROR "Git clone failed with error: ${GIT_CLONE_ERROR}")
110-
endif()
111-
100+
set(CHECKOUT ${CMAKE_CURRENT_SOURCE_DIR}/tools/manage_externals/checkout_externals )
101+
execute_process( COMMAND
102+
${CHECKOUT} --externals ${CMAKE_CURRENT_SOURCE_DIR}/Externals.cfg
103+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/physics/
104+
RESULT_VARIABLE MANAGE_EXTERNALS_STATUS
105+
)
106+
if ( ${MANAGE_EXTERNALS_STATUS} AND NOT ${MANAGE_EXTERNALS_STATUS} EQUAL 0 )
107+
message( FATAL_ERROR "Failed to checkout external repos via manage_externals" )
112108
else()
113-
message(STATUS "Directory ${DIR_TO_CHECK} already exists, skipping clone")
109+
message( STATUS "Finished checking out external repos via manage_externals" )
114110
endif()
115111

116112
set(ATMOSPHERE_CORE_PHYSICS_MMM_SOURCES
@@ -130,22 +126,6 @@ set(ATMOSPHERE_CORE_PHYSICS_MMM_SOURCES
130126

131127
list(TRANSFORM ATMOSPHERE_CORE_PHYSICS_MMM_SOURCES PREPEND physics/physics_mmm/)
132128

133-
set(ATMOSPHERE_CORE_PHYSICS_NOAA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/physics/physics_noaa/UGWP)
134-
135-
if(NOT EXISTS ${ATMOSPHERE_CORE_PHYSICS_NOAA_DIR})
136-
set(PHYSICS_NOAA_REPO_URL "https://github.com/NOAA-GSL/UGWP.git")
137-
execute_process(COMMAND git clone ${PHYSICS_NOAA_REPO_URL} ${ATMOSPHERE_CORE_PHYSICS_NOAA_DIR}
138-
RESULT_VARIABLE GIT_CLONE_RESULT
139-
OUTPUT_VARIABLE GIT_CLONE_OUTPUT
140-
ERROR_VARIABLE GIT_CLONE_ERROR)
141-
if(NOT GIT_CLONE_RESULT EQUAL 0)
142-
message(FATAL_ERROR "Git clone failed with error: ${GIT_CLONE_ERROR}")
143-
endif()
144-
145-
else()
146-
message(STATUS "Directory ${DIR_TO_CHECK} already exists, skipping clone")
147-
endif()
148-
149129
set(ATMOSPHERE_CORE_PHYSICS_NOAA_SOURCES
150130
bl_ugwp.F
151131
bl_ugwpv1_ngw.F
@@ -335,6 +315,7 @@ list(TRANSFORM ATMOSPHERE_CORE_DIAGNOSTIC_SOURCES PREPEND diagnostics/)
335315
# dynamics/
336316
set(ATMOSPHERE_CORE_DYNAMICS_SOURCES
337317
mpas_atm_boundaries.F
318+
mpas_atm_dissipation_models.F
338319
mpas_atm_iau.F
339320
mpas_atm_time_integration.F)
340321
list(TRANSFORM ATMOSPHERE_CORE_DYNAMICS_SOURCES PREPEND dynamics/)

0 commit comments

Comments
 (0)