diff --git a/.gitmodules b/.gitmodules index 3c9be99d..692d9223 100644 --- a/.gitmodules +++ b/.gitmodules @@ -8,7 +8,7 @@ path = src/dynamics/mpas/dycore url = https://github.com/MPAS-Dev/MPAS-Model.git fxsparse = ../.mpas_sparse_checkout - fxtag = ed6f8e39ec0a811b6d079ca0fc6f9fb6e30bad23 + fxtag = v8.2.1 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/MPAS-Dev/MPAS-Model.git [submodule "ncar-physics"] diff --git a/src/dynamics/mpas/Makefile.in.CESM b/src/dynamics/mpas/Makefile.in.CESM index f4016f0e..8e4ba049 100644 --- a/src/dynamics/mpas/Makefile.in.CESM +++ b/src/dynamics/mpas/Makefile.in.CESM @@ -4,6 +4,15 @@ ifeq ($(strip $(LIBROOT)),) LIBROOT = .. endif +ifeq ($(strip $(SRCROOT)),) + $(warning `SRCROOT` should not be empty. Defaulting to `..`) + + SRCROOT = .. + MPAS_SRC_ROOT = $(SRCROOT) +else + MPAS_SRC_ROOT = $(SRCROOT)/src/dynamics/mpas/dycore +endif + # # Define and export variables used by MPAS build infrastructure. # @@ -19,7 +28,7 @@ export BUILD_TARGET = N/A export CORE = atmosphere export EXE_NAME = atmosphere_model export GEN_F90 = false -export GIT_VERSION = N/A +export GIT_VERSION = $(shell git -C "$(MPAS_SRC_ROOT)" describe --always --dirty --tags || echo "N/A") export NAMELIST_SUFFIX = atmosphere # Customize variables (e.g., build options) for use with CESM. @@ -57,9 +66,9 @@ all: @echo 'Users are responsible to provide all necessary build options via environment variables or command line arguments.' @echo '' @echo 'Usage hints:' - @echo ' `make libmpas-prepare ESM="CESM" LIBROOT="..."`' - @echo ' `make libmpas-build ESM="CESM" LIBROOT="..."`' - @echo ' `make libmpas-clean ESM="CESM" LIBROOT="..."`' + @echo ' `make libmpas-prepare ESM="CESM" LIBROOT="..." SRCROOT="..."`' + @echo ' `make libmpas-build ESM="CESM" LIBROOT="..." SRCROOT="..."`' + @echo ' `make libmpas-clean ESM="CESM" LIBROOT="..." SRCROOT="..."`' .PHONY: libmpas-prepare libmpas-prepare: libmpas-archiver-script.txt libmpas-no-physics libmpas-prefix-namelist-groups libmpas-preview @@ -116,7 +125,6 @@ $(LIBROOT)/libmpas.a: libmpas.a libmpas.a: $(AUTOCLEAN_DEPS) dycore externals frame ops subdrv $(AR) $(ARFLAGS) < libmpas-archiver-script.txt - @find -P . -name "*.mod" -type f -exec $(LN) "{}" . ";" .PHONY: libmpas-clean libmpas-clean: clean @@ -131,4 +139,5 @@ subdrv: driver/dyn_mpas_subdriver.o %.o: %.F90 dycore frame ops ( cd $( mpi_comm, operator(==) +#else use mpi, only: mpi_comm_null, mpi_comm_rank, mpi_success +#endif use pio, only: pio_char, pio_int, pio_real, pio_double, & file_desc_t, iosystem_desc_t, pio_file_is_open, pio_iosystem_is_active, & pio_inq_varid, pio_inq_varndims, pio_inq_vartype, pio_noerr @@ -47,6 +52,7 @@ module dyn_mpas_subdriver mpas_pool_add_dimension, mpas_pool_get_dimension, & mpas_pool_get_field, mpas_pool_get_field_info, & mpas_pool_initialize_time_levels + use mpas_stream_inquiry, only: mpas_stream_inquiry_new_streaminfo use mpas_stream_manager, only: postread_reindex, prewrite_reindex, postwrite_reindex use mpas_string_utils, only: mpas_string_replace use mpas_timekeeping, only: mpas_get_clock_time, mpas_get_time @@ -76,7 +82,11 @@ end subroutine model_error_if ! Initialized by `dyn_mpas_init_phase1`. integer :: log_unit = output_unit +#ifdef MPAS_USE_MPI_F08 + type(mpi_comm_type) :: mpi_comm = mpi_comm_null +#else integer :: mpi_comm = mpi_comm_null +#endif integer :: mpi_rank = 0 logical :: mpi_rank_root = .false. @@ -447,7 +457,11 @@ end function stringify !------------------------------------------------------------------------------- subroutine dyn_mpas_init_phase1(self, mpi_comm, model_error_impl, log_unit, mpas_log_unit) class(mpas_dynamical_core_type), intent(inout) :: self +#ifdef MPAS_USE_MPI_F08 + type(mpi_comm_type), intent(in) :: mpi_comm +#else integer, intent(in) :: mpi_comm +#endif procedure(model_error_if) :: model_error_impl integer, intent(in) :: log_unit integer, intent(in) :: mpas_log_unit(2) @@ -503,7 +517,7 @@ subroutine dyn_mpas_init_phase1(self, mpi_comm, model_error_impl, log_unit, mpas call self % debug_print('Calling mpas_framework_init_phase1') ! Initialize MPAS framework with supplied MPI communicator group. - call mpas_framework_init_phase1(self % domain_ptr % dminfo, mpi_comm=self % mpi_comm) + call mpas_framework_init_phase1(self % domain_ptr % dminfo, external_comm=self % mpi_comm) call self % debug_print('Setting up core') @@ -706,6 +720,15 @@ subroutine dyn_mpas_init_phase2(self, pio_iosystem) ! Initialize MPAS framework with supplied PIO system descriptor. call mpas_framework_init_phase2(self % domain_ptr, io_system=pio_iosystem) + ! Instantiate `streaminfo` but do not actually initialize it. Any queries made to it will always return `.false.`. + ! This is the intended behavior because MPAS as a dynamical core is not responsible for managing IO. + self % domain_ptr % streaminfo => mpas_stream_inquiry_new_streaminfo() + + if (.not. associated(self % domain_ptr % streaminfo)) then + call self % model_error('Stream info instantiation failed for core ' // trim(self % domain_ptr % core % corename), & + subname, __LINE__) + end if + ierr = self % domain_ptr % core % define_packages(self % domain_ptr % packages) if (ierr /= 0) then @@ -714,7 +737,8 @@ subroutine dyn_mpas_init_phase2(self, pio_iosystem) end if ierr = self % domain_ptr % core % setup_packages( & - self % domain_ptr % configs, self % domain_ptr % packages, self % domain_ptr % iocontext) + self % domain_ptr % configs, self % domain_ptr % streaminfo, & + self % domain_ptr % packages, self % domain_ptr % iocontext) if (ierr /= 0) then call self % model_error('Package setup failed for core ' // trim(self % domain_ptr % core % corename), & diff --git a/src/dynamics/mpas/dycore b/src/dynamics/mpas/dycore index ed6f8e39..b566fc8a 160000 --- a/src/dynamics/mpas/dycore +++ b/src/dynamics/mpas/dycore @@ -1 +1 @@ -Subproject commit ed6f8e39ec0a811b6d079ca0fc6f9fb6e30bad23 +Subproject commit b566fc8a959390d838aba08fd03c81edae986f6a