From 9b2371b951b39a4311698a6501411ef5ff36be97 Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 16 Aug 2023 11:07:52 -0600 Subject: [PATCH 01/11] Add develop nightly test --- .github/workflows/develop-nightly.yml | 111 ++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 .github/workflows/develop-nightly.yml diff --git a/.github/workflows/develop-nightly.yml b/.github/workflows/develop-nightly.yml new file mode 100644 index 0000000..36a7597 --- /dev/null +++ b/.github/workflows/develop-nightly.yml @@ -0,0 +1,111 @@ +name: Develop - Nightly + +on: + schedule: + - cron: '30 7 * * *' + workflow_dispatch: + +jobs: + nuopc-test: + name: ${{matrix.config.name}} + runs-on: ${{matrix.config.os}} + strategy: + matrix: + config: + - { + name: "Ubuntu (gfortran, openmpi)", + os: ubuntu-latest, + compiler: gfortran, + comm: openmpi + } + steps: + - uses: actions/checkout@v3 + - name: Library Directory + run: | + export STACK_ROOT=${HOME}/stack + mkdir -p ${STACK_ROOT}/{include,lib,lib64,bin} + echo "STACK_ROOT=${STACK_ROOT}" >> $GITHUB_ENV + export LD_LIBRARY_PATH=${STACK_ROOT}/lib64:${STACK_ROOT}/lib:${LD_LIBRARY_PATH} + echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV + echo "CPPFLAGS=-I${STACK_ROOT}/include" >> $GITHUB_ENV + echo "LDFLAGS=-L${STACK_ROOT}/lib" >> $GITHUB_ENV + echo "${STACK_ROOT}/bin" >> $GITHUB_PATH + - name: Cache Libraries + id: cache-libraries + uses: actions/cache@v3 + with: + path: ${{env.STACK_ROOT}} + key: develop-nightly-${{matrix.config.os}}-${{matrix.config.compiler}}-${{matrix.config.comm}} + - name: Install OPENMPI + if: ${{matrix.config.comm}} == 'openmpi' + env: + CACHE_HIT: ${{steps.cache-libraries.outputs.cache-hit}} + run: | + if [[ "$CACHE_HIT" != 'true' ]]; then + OPENMPI_URL="https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-4.0.3.tar.gz" + mkdir ${{runner.temp}}/openmpi + cd ${{runner.temp}}/openmpi + curl -L $OPENMPI_URL | tar --strip-components=1 -xz + ./configure --prefix=${{env.STACK_ROOT}} + make -j 2 install + fi + echo "CC=${{env.STACK_ROOT}}/bin/mpicc" >> $GITHUB_ENV + echo "CXX=${{env.STACK_ROOT}}/bin/mpicxx" >> $GITHUB_ENV + echo "F77=${{env.STACK_ROOT}}/bin/mpif77" >> $GITHUB_ENV + echo "F90=${{env.STACK_ROOT}}/bin/mpif90" >> $GITHUB_ENV + echo "FC=${{env.STACK_ROOT}}/bin/mpifort" >> $GITHUB_ENV + echo "OPENMPI_ROOT=${{env.STACK_ROOT}}" >> $GITHUB_ENV + - name: Install HDF5 + env: + CACHE_HIT: ${{steps.cache-libraries.outputs.cache-hit}} + run: | + if [[ "$CACHE_HIT" != 'true' ]]; then + HDF5_URL="https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-1.12.2/src/hdf5-1.12.2.tar.gz" + mkdir ${{runner.temp}}/hdf5 + cd ${{runner.temp}}/hdf5 + curl -L $HDF5_URL | tar --strip-components=2 -xz + ./configure --enable-fortran --prefix=${{env.STACK_ROOT}} + make -j 2 install + fi + echo "HDF5_ROOT=${{env.STACK_ROOT}}" >> $GITHUB_ENV + - name: Install NetCDF-C + env: + CACHE_HIT: ${{steps.cache-libraries.outputs.cache-hit}} + run: | + if [[ "$CACHE_HIT" != 'true' ]]; then + NETCDF_URL="https://github.com/Unidata/netcdf-c/archive/v4.9.0.tar.gz" + mkdir ${{runner.temp}}/netcdf-c + cd ${{runner.temp}}/netcdf-c + curl -L $NETCDF_URL | tar --strip-components=1 -xz + ./configure --enable-netcdf-4 --disable-dap --prefix=${{env.STACK_ROOT}} + make -j 2 install + fi + echo "NETCDF_ROOT=${{env.STACK_ROOT}}" >> $GITHUB_ENV + - name: Install NetCDF-Fortran + env: + CACHE_HIT: ${{steps.cache-libraries.outputs.cache-hit}} + run: | + if [[ "$CACHE_HIT" != 'true' ]]; then + NETCDFF_URL="https://github.com/Unidata/netcdf-fortran/archive/v4.5.4.tar.gz" + mkdir ${{runner.temp}}/netcdf-fortran + cd ${{runner.temp}}/netcdf-fortran + curl -L $NETCDFF_URL | tar --strip-components=1 -xz + ./configure --prefix=${{env.STACK_ROOT}} + make -j 2 install + fi + echo "NETCDFF_ROOT=${{env.STACK_ROOT}}" >> $GITHUB_ENV + - name: Install ESMF + uses: esmf-org/install-esmf-action@v1 + env: + ESMF_COMPILER: ${{matrix.config.compiler}} + ESMF_COMM: ${{matrix.config.comm}} + ESMF_NETCDF: 'nc-config' + ESMF_INSTALL_PREFIX: ${STACK_ROOT} + with: + version: 'develop' + esmpy: false + cache: false + - name: NUOPC Tests + run: | + export TOOLRUN="--oversubscribe" + ./testProtos.sh From 45a3ec2becca89c8a96c6d083586d226403e0073 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Tue, 8 Aug 2023 18:02:28 -0700 Subject: [PATCH 02/11] Clean-up and simplifications. --- ESMX_AtmOcnProto/Lumo/CMakeLists.txt | 22 +++++++++++++------ ESMX_AtmOcnProto/Makefile | 5 +++-- ESMX_ExternalDriverAPIProto/CMakeLists.txt | 1 + .../Lumo/CMakeLists.txt | 22 +++++++++++++------ ESMX_ExternalDriverAPIProto/Makefile | 4 ++-- 5 files changed, 36 insertions(+), 18 deletions(-) diff --git a/ESMX_AtmOcnProto/Lumo/CMakeLists.txt b/ESMX_AtmOcnProto/Lumo/CMakeLists.txt index a8cda0c..04a8435 100644 --- a/ESMX_AtmOcnProto/Lumo/CMakeLists.txt +++ b/ESMX_AtmOcnProto/Lumo/CMakeLists.txt @@ -1,19 +1,27 @@ cmake_minimum_required(VERSION 3.19) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) -find_package(ESMF 8.4.0 MODULE REQUIRED) +find_package(ESMF 8.5.0 MODULE REQUIRED) -if(NOT DEFINED CMAKE_Fortran_COMPILER) - set(CMAKE_Fortran_COMPILER "${ESMF_F90COMPILER}") -endif() -if(NOT DEFINED CMAKE_Fortran_FLAGS) - set(CMAKE_Fortran_FLAGS "${ESMF_F90COMPILEOPTS}") -endif() +set(CMAKE_Fortran_COMPILER "${ESMF_F90COMPILER}") project(Lumo VERSION 1.0 LANGUAGES Fortran) +if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") + set(CMAKE_Fortran_FLAGS "-ffree-line-length-none -Wall -Wextra -Wconversion -Wno-unused -Wno-unused-dummy-argument") + set(CMAKE_Fortran_FLAGS_RELEASE "-Ofast") + set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g -fbacktrace -0fast") + set(CMAKE_Fortran_FLAGS_DEBUG "-g -fbacktrace -O0 -fcheck=all -ffpe-trap=invalid,zero,overflow,underflow") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") + set(CMAKE_Fortran_FLAGS_RELEASE "-O2") + set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g -traceback -O2") + set(CMAKE_Fortran_FLAGS_DEBUG "-g -traceback -O0 -check all -fpe0 -ftrapuv -init=snan,arrays") +else() + message(WARNING "${CMAKE_Fortran_COMPILER_ID} Fortran compiler will be used with default options") +endif() + add_library(Lumo lumo.F90) target_link_libraries(Lumo ESMF) diff --git a/ESMX_AtmOcnProto/Makefile b/ESMX_AtmOcnProto/Makefile index a066785..066b528 100644 --- a/ESMX_AtmOcnProto/Makefile +++ b/ESMX_AtmOcnProto/Makefile @@ -30,9 +30,10 @@ ESMF_INTERNAL_MPIRUN := $(shell echo $(ESMF_INTERNAL_MPIRUN)) ################################################################################ ################################################################################ EXE = install/bin/esmx_app +.PHONY: $(EXE) -$(EXE): esmxBuild.yaml - $(ESMF_APPSDIR)/ESMX_Builder +$(EXE): + $(ESMF_APPSDIR)/ESMX_Builder -v # ----------------------------------------------------------------------------- # ----------------------------------------------------------------------------- diff --git a/ESMX_ExternalDriverAPIProto/CMakeLists.txt b/ESMX_ExternalDriverAPIProto/CMakeLists.txt index b1ac436..4426884 100644 --- a/ESMX_ExternalDriverAPIProto/CMakeLists.txt +++ b/ESMX_ExternalDriverAPIProto/CMakeLists.txt @@ -24,6 +24,7 @@ add_subdirectory(${ESMF_ESMXDIR}/Driver ./ESMX_Driver) add_executable(externalApp externalApp.F90) target_include_directories(externalApp PUBLIC ${PROJECT_BINARY_DIR}) target_link_libraries(externalApp PUBLIC esmx_driver) +set_target_properties(externalApp PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE) # Install executable install( diff --git a/ESMX_ExternalDriverAPIProto/Lumo/CMakeLists.txt b/ESMX_ExternalDriverAPIProto/Lumo/CMakeLists.txt index a8cda0c..04a8435 100644 --- a/ESMX_ExternalDriverAPIProto/Lumo/CMakeLists.txt +++ b/ESMX_ExternalDriverAPIProto/Lumo/CMakeLists.txt @@ -1,19 +1,27 @@ cmake_minimum_required(VERSION 3.19) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) -find_package(ESMF 8.4.0 MODULE REQUIRED) +find_package(ESMF 8.5.0 MODULE REQUIRED) -if(NOT DEFINED CMAKE_Fortran_COMPILER) - set(CMAKE_Fortran_COMPILER "${ESMF_F90COMPILER}") -endif() -if(NOT DEFINED CMAKE_Fortran_FLAGS) - set(CMAKE_Fortran_FLAGS "${ESMF_F90COMPILEOPTS}") -endif() +set(CMAKE_Fortran_COMPILER "${ESMF_F90COMPILER}") project(Lumo VERSION 1.0 LANGUAGES Fortran) +if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") + set(CMAKE_Fortran_FLAGS "-ffree-line-length-none -Wall -Wextra -Wconversion -Wno-unused -Wno-unused-dummy-argument") + set(CMAKE_Fortran_FLAGS_RELEASE "-Ofast") + set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g -fbacktrace -0fast") + set(CMAKE_Fortran_FLAGS_DEBUG "-g -fbacktrace -O0 -fcheck=all -ffpe-trap=invalid,zero,overflow,underflow") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") + set(CMAKE_Fortran_FLAGS_RELEASE "-O2") + set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g -traceback -O2") + set(CMAKE_Fortran_FLAGS_DEBUG "-g -traceback -O0 -check all -fpe0 -ftrapuv -init=snan,arrays") +else() + message(WARNING "${CMAKE_Fortran_COMPILER_ID} Fortran compiler will be used with default options") +endif() + add_library(Lumo lumo.F90) target_link_libraries(Lumo ESMF) diff --git a/ESMX_ExternalDriverAPIProto/Makefile b/ESMX_ExternalDriverAPIProto/Makefile index 57a5171..bf26525 100644 --- a/ESMX_ExternalDriverAPIProto/Makefile +++ b/ESMX_ExternalDriverAPIProto/Makefile @@ -30,9 +30,9 @@ ESMF_INTERNAL_MPIRUN := $(shell echo $(ESMF_INTERNAL_MPIRUN)) ################################################################################ ################################################################################ EXE = install/bin/externalApp +.PHONY: $(EXE) - -$(EXE): externalApp.F90 esmxBuild.yaml +$(EXE): cmake -S. -Bbuild -DESMF_ESMXDIR=$(ESMF_ESMXDIR) -DCMAKE_INSTALL_PREFIX=install cmake --build ./build cmake --install ./build From f83ffcb8a938ec34294feafe7c4a689ded44e7eb Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Tue, 15 Aug 2023 12:00:34 -0700 Subject: [PATCH 03/11] Correct typo in compiler option, and align GCC/Intel to -Ofast. --- ESMX_AtmOcnProto/Lumo/CMakeLists.txt | 6 +++--- ESMX_ExternalDriverAPIProto/Lumo/CMakeLists.txt | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ESMX_AtmOcnProto/Lumo/CMakeLists.txt b/ESMX_AtmOcnProto/Lumo/CMakeLists.txt index 04a8435..a573c11 100644 --- a/ESMX_AtmOcnProto/Lumo/CMakeLists.txt +++ b/ESMX_AtmOcnProto/Lumo/CMakeLists.txt @@ -12,11 +12,11 @@ project(Lumo if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") set(CMAKE_Fortran_FLAGS "-ffree-line-length-none -Wall -Wextra -Wconversion -Wno-unused -Wno-unused-dummy-argument") set(CMAKE_Fortran_FLAGS_RELEASE "-Ofast") - set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g -fbacktrace -0fast") + set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g -fbacktrace -Ofast") set(CMAKE_Fortran_FLAGS_DEBUG "-g -fbacktrace -O0 -fcheck=all -ffpe-trap=invalid,zero,overflow,underflow") elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") - set(CMAKE_Fortran_FLAGS_RELEASE "-O2") - set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g -traceback -O2") + set(CMAKE_Fortran_FLAGS_RELEASE "-Ofast") + set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g -traceback -Ofast") set(CMAKE_Fortran_FLAGS_DEBUG "-g -traceback -O0 -check all -fpe0 -ftrapuv -init=snan,arrays") else() message(WARNING "${CMAKE_Fortran_COMPILER_ID} Fortran compiler will be used with default options") diff --git a/ESMX_ExternalDriverAPIProto/Lumo/CMakeLists.txt b/ESMX_ExternalDriverAPIProto/Lumo/CMakeLists.txt index 04a8435..a573c11 100644 --- a/ESMX_ExternalDriverAPIProto/Lumo/CMakeLists.txt +++ b/ESMX_ExternalDriverAPIProto/Lumo/CMakeLists.txt @@ -12,11 +12,11 @@ project(Lumo if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") set(CMAKE_Fortran_FLAGS "-ffree-line-length-none -Wall -Wextra -Wconversion -Wno-unused -Wno-unused-dummy-argument") set(CMAKE_Fortran_FLAGS_RELEASE "-Ofast") - set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g -fbacktrace -0fast") + set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g -fbacktrace -Ofast") set(CMAKE_Fortran_FLAGS_DEBUG "-g -fbacktrace -O0 -fcheck=all -ffpe-trap=invalid,zero,overflow,underflow") elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") - set(CMAKE_Fortran_FLAGS_RELEASE "-O2") - set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g -traceback -O2") + set(CMAKE_Fortran_FLAGS_RELEASE "-Ofast") + set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g -traceback -Ofast") set(CMAKE_Fortran_FLAGS_DEBUG "-g -traceback -O0 -check all -fpe0 -ftrapuv -init=snan,arrays") else() message(WARNING "${CMAKE_Fortran_COMPILER_ID} Fortran compiler will be used with default options") From 333d3a663a15b1c4ae00bf0840ffaa8e81a56c93 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Tue, 15 Aug 2023 12:06:49 -0700 Subject: [PATCH 04/11] Bump ESMF required version to 8.6.0. --- ESMX_AtmOcnProto/Lumo/CMakeLists.txt | 2 +- ESMX_ExternalDriverAPIProto/CMakeLists.txt | 2 +- ESMX_ExternalDriverAPIProto/Lumo/CMakeLists.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ESMX_AtmOcnProto/Lumo/CMakeLists.txt b/ESMX_AtmOcnProto/Lumo/CMakeLists.txt index a573c11..4aa0292 100644 --- a/ESMX_AtmOcnProto/Lumo/CMakeLists.txt +++ b/ESMX_AtmOcnProto/Lumo/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.19) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) -find_package(ESMF 8.5.0 MODULE REQUIRED) +find_package(ESMF 8.6.0 MODULE REQUIRED) set(CMAKE_Fortran_COMPILER "${ESMF_F90COMPILER}") diff --git a/ESMX_ExternalDriverAPIProto/CMakeLists.txt b/ESMX_ExternalDriverAPIProto/CMakeLists.txt index 4426884..722e2da 100644 --- a/ESMX_ExternalDriverAPIProto/CMakeLists.txt +++ b/ESMX_ExternalDriverAPIProto/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.22) list(APPEND CMAKE_MODULE_PATH "${ESMF_ESMXDIR}/Driver/cmake") # Find ESMF -find_package(ESMF 8.5.0 MODULE REQUIRED) +find_package(ESMF 8.6.0 MODULE REQUIRED) # Set compilers consistent with ESMF set(CMAKE_Fortran_COMPILER "${ESMF_F90COMPILER}") diff --git a/ESMX_ExternalDriverAPIProto/Lumo/CMakeLists.txt b/ESMX_ExternalDriverAPIProto/Lumo/CMakeLists.txt index a573c11..4aa0292 100644 --- a/ESMX_ExternalDriverAPIProto/Lumo/CMakeLists.txt +++ b/ESMX_ExternalDriverAPIProto/Lumo/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.19) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) -find_package(ESMF 8.5.0 MODULE REQUIRED) +find_package(ESMF 8.6.0 MODULE REQUIRED) set(CMAKE_Fortran_COMPILER "${ESMF_F90COMPILER}") From 2adbad11c4bc4dbafef4c0d45af0bd22aee6d1a4 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Tue, 15 Aug 2023 12:23:54 -0700 Subject: [PATCH 05/11] Enable OpenMP for Lumo component via CMake. --- ESMX_AtmOcnProto/Lumo/CMakeLists.txt | 5 ++++- ESMX_AtmOcnProto/esmxBuild.yaml | 3 +++ ESMX_ExternalDriverAPIProto/CMakeLists.txt | 3 +++ ESMX_ExternalDriverAPIProto/Lumo/CMakeLists.txt | 5 ++++- ESMX_ExternalDriverAPIProto/externalApp.F90 | 2 +- 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ESMX_AtmOcnProto/Lumo/CMakeLists.txt b/ESMX_AtmOcnProto/Lumo/CMakeLists.txt index 4aa0292..ebf1139 100644 --- a/ESMX_AtmOcnProto/Lumo/CMakeLists.txt +++ b/ESMX_AtmOcnProto/Lumo/CMakeLists.txt @@ -9,6 +9,8 @@ project(Lumo VERSION 1.0 LANGUAGES Fortran) +find_package(OpenMP REQUIRED) + if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") set(CMAKE_Fortran_FLAGS "-ffree-line-length-none -Wall -Wextra -Wconversion -Wno-unused -Wno-unused-dummy-argument") set(CMAKE_Fortran_FLAGS_RELEASE "-Ofast") @@ -23,7 +25,8 @@ else() endif() add_library(Lumo lumo.F90) -target_link_libraries(Lumo ESMF) +target_link_libraries(Lumo PUBLIC ESMF) +target_link_libraries(Lumo PUBLIC OpenMP::OpenMP_Fortran) install(TARGETS Lumo EXPORT Lumo diff --git a/ESMX_AtmOcnProto/esmxBuild.yaml b/ESMX_AtmOcnProto/esmxBuild.yaml index 8eff360..b274dcc 100644 --- a/ESMX_AtmOcnProto/esmxBuild.yaml +++ b/ESMX_AtmOcnProto/esmxBuild.yaml @@ -1,3 +1,6 @@ +application: + link_packages: OpenMP + components: Lumo: diff --git a/ESMX_ExternalDriverAPIProto/CMakeLists.txt b/ESMX_ExternalDriverAPIProto/CMakeLists.txt index 722e2da..c85d476 100644 --- a/ESMX_ExternalDriverAPIProto/CMakeLists.txt +++ b/ESMX_ExternalDriverAPIProto/CMakeLists.txt @@ -17,6 +17,9 @@ project(ExternalDriverAPIProto LANGUAGES Fortran CXX C ) +# Find required packages +find_package(OpenMP REQUIRED) + # Add ESMX driver add_subdirectory(${ESMF_ESMXDIR}/Driver ./ESMX_Driver) diff --git a/ESMX_ExternalDriverAPIProto/Lumo/CMakeLists.txt b/ESMX_ExternalDriverAPIProto/Lumo/CMakeLists.txt index 4aa0292..ebf1139 100644 --- a/ESMX_ExternalDriverAPIProto/Lumo/CMakeLists.txt +++ b/ESMX_ExternalDriverAPIProto/Lumo/CMakeLists.txt @@ -9,6 +9,8 @@ project(Lumo VERSION 1.0 LANGUAGES Fortran) +find_package(OpenMP REQUIRED) + if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") set(CMAKE_Fortran_FLAGS "-ffree-line-length-none -Wall -Wextra -Wconversion -Wno-unused -Wno-unused-dummy-argument") set(CMAKE_Fortran_FLAGS_RELEASE "-Ofast") @@ -23,7 +25,8 @@ else() endif() add_library(Lumo lumo.F90) -target_link_libraries(Lumo ESMF) +target_link_libraries(Lumo PUBLIC ESMF) +target_link_libraries(Lumo PUBLIC OpenMP::OpenMP_Fortran) install(TARGETS Lumo EXPORT Lumo diff --git a/ESMX_ExternalDriverAPIProto/externalApp.F90 b/ESMX_ExternalDriverAPIProto/externalApp.F90 index 85890dd..aeafac8 100644 --- a/ESMX_ExternalDriverAPIProto/externalApp.F90 +++ b/ESMX_ExternalDriverAPIProto/externalApp.F90 @@ -36,7 +36,7 @@ program externalApp ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & - defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) + defaultCalkind=ESMF_CALKIND_GREGORIAN, globalResourceControl=.true., rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=FILENAME)) & From a9dbc767ab67bef09619e90a89ef1296f56b0258 Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 18 Aug 2023 15:13:24 -0600 Subject: [PATCH 06/11] Fix develop nightly cache updates (#4) --- .github/workflows/develop-nightly.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/develop-nightly.yml b/.github/workflows/develop-nightly.yml index 36a7597..7b2c11a 100644 --- a/.github/workflows/develop-nightly.yml +++ b/.github/workflows/develop-nightly.yml @@ -100,11 +100,12 @@ jobs: ESMF_COMPILER: ${{matrix.config.compiler}} ESMF_COMM: ${{matrix.config.comm}} ESMF_NETCDF: 'nc-config' - ESMF_INSTALL_PREFIX: ${STACK_ROOT} with: + build-key: 'develop-nightly-${{matrix.config.os}}-${{matrix.config.compiler}}-${{matrix.config.comm}}' version: 'develop' + rebuild-check: quick esmpy: false - cache: false + cache: true - name: NUOPC Tests run: | export TOOLRUN="--oversubscribe" From 84b794b3e44487a072f67f5734f238cb3c0ac938 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Mon, 9 Oct 2023 10:05:11 -0700 Subject: [PATCH 07/11] Remove AtmOcnSelectExternalProto: (1) The GNU Makefile based coponent build dependency approach is deprecated in favor of ESMX now. Testing the deprecated feature here can be misleading to users that use the apps prototypes as templates for their own projects. (2) There are issues with the old approach in the testing on some platforms that would require fixing, which is not worth the effort for a deprecated feature. --- .gitignore | 46 --- AtmOcnSelectExternalProto/ATM-A/Makefile | 76 ---- AtmOcnSelectExternalProto/ATM-A/atmA.F90 | 250 ------------- AtmOcnSelectExternalProto/ATM-B/Makefile | 79 ----- AtmOcnSelectExternalProto/ATM-B/atmB.F90 | 253 ------------- AtmOcnSelectExternalProto/ATM-B/procedure.F90 | 13 - AtmOcnSelectExternalProto/ATM-C/Makefile | 78 ----- AtmOcnSelectExternalProto/ATM-C/atmC.F90 | 253 ------------- AtmOcnSelectExternalProto/ATM-C/procedure.F90 | 13 - AtmOcnSelectExternalProto/ATM-D/Makefile | 81 ----- AtmOcnSelectExternalProto/ATM-D/atmD.F90 | 250 ------------- AtmOcnSelectExternalProto/ATM-E/Makefile | 80 ----- AtmOcnSelectExternalProto/ATM-E/atmE.F90 | 268 -------------- AtmOcnSelectExternalProto/ATM-F/Makefile | 78 ----- AtmOcnSelectExternalProto/ATM-F/atmF.C | 72 ---- AtmOcnSelectExternalProto/ATM-F/atmF.h | 22 -- AtmOcnSelectExternalProto/Makefile | 176 ---------- AtmOcnSelectExternalProto/OcnCommon/Makefile | 78 ----- .../OcnCommon/ocnCommon.F90 | 35 -- .../OcnCommon/subModule1.F90 | 25 -- .../OcnCommon/subModule2.F90 | 25 -- AtmOcnSelectExternalProto/OcnModelA/Makefile | 88 ----- AtmOcnSelectExternalProto/OcnModelA/ocn.F90 | 312 ----------------- AtmOcnSelectExternalProto/OcnModelB/Makefile | 96 ----- .../OcnModelB/OcnSub/Makefile | 76 ---- .../OcnModelB/OcnSub/ocnSub.F90 | 269 -------------- AtmOcnSelectExternalProto/OcnModelB/ocn.F90 | 313 ----------------- AtmOcnSelectExternalProto/OcnModelC/Makefile | 103 ------ .../OcnModelC/OcnSub/Makefile | 76 ---- .../OcnModelC/OcnSub/ocnSub.F90 | 269 -------------- AtmOcnSelectExternalProto/OcnModelC/ocn.F90 | 331 ------------------ AtmOcnSelectExternalProto/README | 108 ------ AtmOcnSelectExternalProto/buildSubs.sh | 52 --- AtmOcnSelectExternalProto/cleanSubs.sh | 50 --- AtmOcnSelectExternalProto/esm.F90 | 271 -------------- AtmOcnSelectExternalProto/esm.config | 1 - AtmOcnSelectExternalProto/esmApp.F90 | 106 ------ testProtos.sh | 140 +------- 38 files changed, 7 insertions(+), 4905 deletions(-) delete mode 100644 AtmOcnSelectExternalProto/ATM-A/Makefile delete mode 100644 AtmOcnSelectExternalProto/ATM-A/atmA.F90 delete mode 100644 AtmOcnSelectExternalProto/ATM-B/Makefile delete mode 100644 AtmOcnSelectExternalProto/ATM-B/atmB.F90 delete mode 100644 AtmOcnSelectExternalProto/ATM-B/procedure.F90 delete mode 100644 AtmOcnSelectExternalProto/ATM-C/Makefile delete mode 100644 AtmOcnSelectExternalProto/ATM-C/atmC.F90 delete mode 100644 AtmOcnSelectExternalProto/ATM-C/procedure.F90 delete mode 100644 AtmOcnSelectExternalProto/ATM-D/Makefile delete mode 100644 AtmOcnSelectExternalProto/ATM-D/atmD.F90 delete mode 100644 AtmOcnSelectExternalProto/ATM-E/Makefile delete mode 100644 AtmOcnSelectExternalProto/ATM-E/atmE.F90 delete mode 100644 AtmOcnSelectExternalProto/ATM-F/Makefile delete mode 100644 AtmOcnSelectExternalProto/ATM-F/atmF.C delete mode 100644 AtmOcnSelectExternalProto/ATM-F/atmF.h delete mode 100644 AtmOcnSelectExternalProto/Makefile delete mode 100644 AtmOcnSelectExternalProto/OcnCommon/Makefile delete mode 100644 AtmOcnSelectExternalProto/OcnCommon/ocnCommon.F90 delete mode 100644 AtmOcnSelectExternalProto/OcnCommon/subModule1.F90 delete mode 100644 AtmOcnSelectExternalProto/OcnCommon/subModule2.F90 delete mode 100644 AtmOcnSelectExternalProto/OcnModelA/Makefile delete mode 100644 AtmOcnSelectExternalProto/OcnModelA/ocn.F90 delete mode 100644 AtmOcnSelectExternalProto/OcnModelB/Makefile delete mode 100644 AtmOcnSelectExternalProto/OcnModelB/OcnSub/Makefile delete mode 100644 AtmOcnSelectExternalProto/OcnModelB/OcnSub/ocnSub.F90 delete mode 100644 AtmOcnSelectExternalProto/OcnModelB/ocn.F90 delete mode 100644 AtmOcnSelectExternalProto/OcnModelC/Makefile delete mode 100644 AtmOcnSelectExternalProto/OcnModelC/OcnSub/Makefile delete mode 100644 AtmOcnSelectExternalProto/OcnModelC/OcnSub/ocnSub.F90 delete mode 100644 AtmOcnSelectExternalProto/OcnModelC/ocn.F90 delete mode 100644 AtmOcnSelectExternalProto/README delete mode 100755 AtmOcnSelectExternalProto/buildSubs.sh delete mode 100755 AtmOcnSelectExternalProto/cleanSubs.sh delete mode 100644 AtmOcnSelectExternalProto/esm.F90 delete mode 100644 AtmOcnSelectExternalProto/esm.config delete mode 100644 AtmOcnSelectExternalProto/esmApp.F90 diff --git a/.gitignore b/.gitignore index cca37b5..306fdf0 100644 --- a/.gitignore +++ b/.gitignore @@ -356,52 +356,6 @@ AtmOcnScalarProto/esmApp.stdout AtmOcnScalarProto/field_ocn_export_adv_sst.nc AtmOcnScalarProto/ocn.mod AtmOcnScalarProto/ocn.o -AtmOcnSelectExternalProto/ATM-A/atmA.mk -AtmOcnSelectExternalProto/ATM-A/atmA.o -AtmOcnSelectExternalProto/ATM-A/atma.mod -AtmOcnSelectExternalProto/ATM-B/atmB.mk -AtmOcnSelectExternalProto/ATM-B/atmB.o -AtmOcnSelectExternalProto/ATM-B/atmb.mod -AtmOcnSelectExternalProto/ATM-B/procedure.o -AtmOcnSelectExternalProto/ATM-C/atmC.mk -AtmOcnSelectExternalProto/ATM-C/atmC.o -AtmOcnSelectExternalProto/ATM-C/atmc.mod -AtmOcnSelectExternalProto/ATM-C/libatmC.a -AtmOcnSelectExternalProto/ATM-C/procedure.o -AtmOcnSelectExternalProto/ATM-D/atmD.mk -AtmOcnSelectExternalProto/ATM-D/atmd.mod -AtmOcnSelectExternalProto/ATM-D/libatmD.so -AtmOcnSelectExternalProto/ATM-E/atmE.mk -AtmOcnSelectExternalProto/ATM-E/atme.mod -AtmOcnSelectExternalProto/OcnCommon/oceancommon.mod -AtmOcnSelectExternalProto/OcnCommon/ocnCommon.mk -AtmOcnSelectExternalProto/OcnCommon/ocnCommon.o -AtmOcnSelectExternalProto/OcnCommon/subModule1.o -AtmOcnSelectExternalProto/OcnCommon/subModule2.o -AtmOcnSelectExternalProto/OcnCommon/submodule1.mod -AtmOcnSelectExternalProto/OcnCommon/submodule2.mod -AtmOcnSelectExternalProto/OcnModelA/ocn.mk -AtmOcnSelectExternalProto/OcnModelA/ocn.o -AtmOcnSelectExternalProto/OcnModelA/ocna.mod -AtmOcnSelectExternalProto/OcnModelB/OcnSub/ocnSub.mk -AtmOcnSelectExternalProto/OcnModelB/OcnSub/ocnSub.o -AtmOcnSelectExternalProto/OcnModelB/OcnSub/ocnsub.mod -AtmOcnSelectExternalProto/OcnModelB/ocn.mk -AtmOcnSelectExternalProto/OcnModelB/ocn.o -AtmOcnSelectExternalProto/OcnModelB/ocnb.mod -AtmOcnSelectExternalProto/OcnModelC/OcnSub/ocnSub.mk -AtmOcnSelectExternalProto/OcnModelC/OcnSub/ocnSub.o -AtmOcnSelectExternalProto/OcnModelC/OcnSub/ocnsub.mod -AtmOcnSelectExternalProto/OcnModelC/ocn.mk -AtmOcnSelectExternalProto/OcnModelC/ocnc.mod -AtmOcnSelectExternalProto/PET0.ESMF_LogFile -AtmOcnSelectExternalProto/PET1.ESMF_LogFile -AtmOcnSelectExternalProto/PET2.ESMF_LogFile -AtmOcnSelectExternalProto/PET3.ESMF_LogFile -AtmOcnSelectExternalProto/atmD.so -AtmOcnSelectExternalProto/atmE.so -AtmOcnSelectExternalProto/esmApp.stdout -AtmOcnSelectExternalProto/ocn.so AtmOcnSelectProto/PET0.ESMF_LogFile AtmOcnSelectProto/PET1.ESMF_LogFile AtmOcnSelectProto/PET2.ESMF_LogFile diff --git a/AtmOcnSelectExternalProto/ATM-A/Makefile b/AtmOcnSelectExternalProto/ATM-A/Makefile deleted file mode 100644 index 83dda00..0000000 --- a/AtmOcnSelectExternalProto/ATM-A/Makefile +++ /dev/null @@ -1,76 +0,0 @@ -# GNU Makefile template for user ESMF component - -################################################################################ -################################################################################ -## This Makefile must be able to find the "esmf.mk" Makefile fragment in the ## -## 'include' line below. Following the ESMF User's Guide, a complete ESMF ## -## installation should ensure that a single environment variable "ESMFMKFILE" ## -## is made available on the system. This variable should point to the ## -## "esmf.mk" file. ## -## ## -## This example Makefile uses the "ESMFMKFILE" environment variable. ## -## ## -## If you notice that this Makefile cannot find variable ESMFMKFILE then ## -## please contact the person responsible for the ESMF installation on your ## -## system. ## -## As a work-around you can simply hardcode the path to "esmf.mk" in the ## -## include line below. However, doing so will render this Makefile a lot less ## -## flexible and non-portable. ## -################################################################################ - -ifneq ($(origin ESMFMKFILE), environment) -$(error Environment variable ESMFMKFILE was not set.) -endif - -include $(ESMFMKFILE) - -################################################################################ -################################################################################ - -.SUFFIXES: .f90 .F90 .c .C - -%.o : %.f90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREENOCPP) $< - -%.o : %.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $< - -%.o : %.c - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -%.o : %.C - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -.PRECIOUS: %.o - -%.mk : %.o - @echo "# ESMF self-describing build dependency makefile fragment" > $@ - @echo >> $@ - @echo "ESMF_DEP_FRONT = atmA" >> $@ - @echo "ESMF_DEP_INCPATH = `pwd`" >> $@ - @echo "ESMF_DEP_CMPL_OBJS = `pwd`/"$< >> $@ - @echo "ESMF_DEP_LINK_OBJS = `pwd`/"$< >> $@ - @echo "ESMF_DEP_SHRD_PATH = " >> $@ - @echo "ESMF_DEP_SHRD_LIBS = " >> $@ - -# ----------------------------------------------------------------------------- -atmA.mk: - -# ----------------------------------------------------------------------------- -# ----------------------------------------------------------------------------- -.PHONY: dust clean distclean info edit -dust: - rm -f PET*.ESMF_LogFile -clean: - rm -f *.o *.mod *.mk -distclean: dust clean - -info: - @echo ================================================================== - @echo ESMFMKFILE=$(ESMFMKFILE) - @echo ================================================================== - @cat $(ESMFMKFILE) - @echo ================================================================== - -edit: - nedit atmA.F90 & diff --git a/AtmOcnSelectExternalProto/ATM-A/atmA.F90 b/AtmOcnSelectExternalProto/ATM-A/atmA.F90 deleted file mode 100644 index 83c1ab2..0000000 --- a/AtmOcnSelectExternalProto/ATM-A/atmA.F90 +++ /dev/null @@ -1,250 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright (c) 2002-2023, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -module atmA - - !----------------------------------------------------------------------------- - ! ATM Component. - !----------------------------------------------------------------------------- - - use ESMF - use NUOPC - use NUOPC_Model, & - modelSS => SetServices - - implicit none - - private - - public SetServices - - !----------------------------------------------------------------------------- - contains - !----------------------------------------------------------------------------- - - subroutine SetServices(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! derive from NUOPC_Model - call NUOPC_CompDerive(model, modelSS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! specialize model - call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & - specRoutine=Advertise, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & - specRoutine=Realize, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(model, specLabel=label_Advance, & - specRoutine=Advance, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine Advertise(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_State) :: importState, exportState - - rc = ESMF_SUCCESS - - ! query for importState and exportState - call NUOPC_ModelGet(model, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! importable field: sea_surface_temperature - call NUOPC_Advertise(importState, & - StandardName="sea_surface_temperature", name="sst", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: air_pressure_at_sea_level - call NUOPC_Advertise(exportState, & - StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: surface_net_downward_shortwave_flux - call NUOPC_Advertise(exportState, & - StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set Component name so it becomes identifiable - call ESMF_GridCompSet(model, name="atmA", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine Realize(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_State) :: importState, exportState - type(ESMF_Field) :: field - type(ESMF_Grid) :: gridIn - type(ESMF_Grid) :: gridOut - - rc = ESMF_SUCCESS - - ! query for importState and exportState - call NUOPC_ModelGet(model, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! create a Grid object for Fields - gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & - minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & - maxCornerCoord=(/100._ESMF_KIND_R8, 200._ESMF_KIND_R8/), & - coordSys=ESMF_COORDSYS_CART, staggerLocList=(/ESMF_STAGGERLOC_CENTER/), & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - gridOut = gridIn ! for now out same as in - - ! importable field: sea_surface_temperature - field = ESMF_FieldCreate(name="sst", grid=gridIn, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(importState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: air_pressure_at_sea_level - field = ESMF_FieldCreate(name="pmsl", grid=gridOut, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(exportState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: surface_net_downward_shortwave_flux - field = ESMF_FieldCreate(name="rsns", grid=gridOut, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(exportState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine Advance(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_State) :: importState, exportState - character(len=160) :: msgString - - rc = ESMF_SUCCESS - - ! query for clock, importState and exportState - call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - - ! Because of the way that the internal Clock was set by default, - ! its timeStep is equal to the parent timeStep. As a consequence the - ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the Advance() routine. - - call ESMF_ClockPrint(clock, options="currTime", & - preString="------>Advancing ATM from: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ClockPrint(clock, options="stopTime", & - preString="---------------------> to: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - -end module diff --git a/AtmOcnSelectExternalProto/ATM-B/Makefile b/AtmOcnSelectExternalProto/ATM-B/Makefile deleted file mode 100644 index a2d55da..0000000 --- a/AtmOcnSelectExternalProto/ATM-B/Makefile +++ /dev/null @@ -1,79 +0,0 @@ -# GNU Makefile template for user ESMF component - -################################################################################ -################################################################################ -## This Makefile must be able to find the "esmf.mk" Makefile fragment in the ## -## 'include' line below. Following the ESMF User's Guide, a complete ESMF ## -## installation should ensure that a single environment variable "ESMFMKFILE" ## -## is made available on the system. This variable should point to the ## -## "esmf.mk" file. ## -## ## -## This example Makefile uses the "ESMFMKFILE" environment variable. ## -## ## -## If you notice that this Makefile cannot find variable ESMFMKFILE then ## -## please contact the person responsible for the ESMF installation on your ## -## system. ## -## As a work-around you can simply hardcode the path to "esmf.mk" in the ## -## include line below. However, doing so will render this Makefile a lot less ## -## flexible and non-portable. ## -################################################################################ - -ifneq ($(origin ESMFMKFILE), environment) -$(error Environment variable ESMFMKFILE was not set.) -endif - -include $(ESMFMKFILE) - -################################################################################ -################################################################################ - -.SUFFIXES: .f90 .F90 .c .C - -%.o : %.f90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREENOCPP) $< - -%.o : %.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $< - -%.o : %.c - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -%.o : %.C - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -OBJS = atmB.o procedure.o - - -.PRECIOUS: %.o -%.mk : %.o - @echo "# ESMF self-describing build dependency makefile fragment" > $@ - @echo >> $@ - @echo "ESMF_DEP_FRONT = atmB" >> $@ - @echo "ESMF_DEP_INCPATH = `pwd`" >> $@ - @echo "ESMF_DEP_CMPL_OBJS = `pwd`/"$< >> $@ - @echo "ESMF_DEP_LINK_OBJS = "$(addprefix `pwd`/, $(OBJS)) >> $@ - @echo "ESMF_DEP_SHRD_PATH = " >> $@ - @echo "ESMF_DEP_SHRD_LIBS = " >> $@ - -# ----------------------------------------------------------------------------- - -atmB.mk: $(OBJS) - -# ----------------------------------------------------------------------------- -# ----------------------------------------------------------------------------- -.PHONY: dust clean distclean info edit -dust: - rm -f PET*.ESMF_LogFile -clean: - rm -f *.o *.mod *.mk -distclean: dust clean - -info: - @echo ================================================================== - @echo ESMFMKFILE=$(ESMFMKFILE) - @echo ================================================================== - @cat $(ESMFMKFILE) - @echo ================================================================== - -edit: - nedit atmB.F90 procedure.F90 & diff --git a/AtmOcnSelectExternalProto/ATM-B/atmB.F90 b/AtmOcnSelectExternalProto/ATM-B/atmB.F90 deleted file mode 100644 index e2c51c5..0000000 --- a/AtmOcnSelectExternalProto/ATM-B/atmB.F90 +++ /dev/null @@ -1,253 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright (c) 2002-2023, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -module atmB - - !----------------------------------------------------------------------------- - ! ATM Component. - !----------------------------------------------------------------------------- - - use ESMF - use NUOPC - use NUOPC_Model, & - modelSS => SetServices - - implicit none - - private - - public SetServices - - !----------------------------------------------------------------------------- - contains - !----------------------------------------------------------------------------- - - subroutine SetServices(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! derive from NUOPC_Model - call NUOPC_CompDerive(model, modelSS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! specialize model - call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & - specRoutine=Advertise, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & - specRoutine=Realize, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(model, specLabel=label_Advance, & - specRoutine=Advance, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine Advertise(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_State) :: importState, exportState - - rc = ESMF_SUCCESS - - ! query for importState and exportState - call NUOPC_ModelGet(model, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! importable field: sea_surface_temperature - call NUOPC_Advertise(importState, & - StandardName="sea_surface_temperature", name="sst", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: air_pressure_at_sea_level - call NUOPC_Advertise(exportState, & - StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: surface_net_downward_shortwave_flux - call NUOPC_Advertise(exportState, & - StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set Component name so it becomes identifiable - call ESMF_GridCompSet(model, name="atmB", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! call into a procedure F77 style, i.e. without explicit interface - call procedure_f77style() - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine Realize(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_State) :: importState, exportState - type(ESMF_Field) :: field - type(ESMF_Grid) :: gridIn - type(ESMF_Grid) :: gridOut - - rc = ESMF_SUCCESS - - ! query for importState and exportState - call NUOPC_ModelGet(model, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! create a Grid object for Fields - gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & - minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & - maxCornerCoord=(/100._ESMF_KIND_R8, 200._ESMF_KIND_R8/), & - coordSys=ESMF_COORDSYS_CART, staggerLocList=(/ESMF_STAGGERLOC_CENTER/), & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - gridOut = gridIn ! for now out same as in - - ! importable field: sea_surface_temperature - field = ESMF_FieldCreate(name="sst", grid=gridIn, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(importState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: air_pressure_at_sea_level - field = ESMF_FieldCreate(name="pmsl", grid=gridOut, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(exportState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: surface_net_downward_shortwave_flux - field = ESMF_FieldCreate(name="rsns", grid=gridOut, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(exportState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine Advance(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_State) :: importState, exportState - character(len=160) :: msgString - - rc = ESMF_SUCCESS - - ! query for clock, importState and exportState - call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - - ! Because of the way that the internal Clock was set by default, - ! its timeStep is equal to the parent timeStep. As a consequence the - ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the Advance() routine. - - call ESMF_ClockPrint(clock, options="currTime", & - preString="------>Advancing ATM from: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ClockPrint(clock, options="stopTime", & - preString="---------------------> to: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - -end module diff --git a/AtmOcnSelectExternalProto/ATM-B/procedure.F90 b/AtmOcnSelectExternalProto/ATM-B/procedure.F90 deleted file mode 100644 index b353080..0000000 --- a/AtmOcnSelectExternalProto/ATM-B/procedure.F90 +++ /dev/null @@ -1,13 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright (c) 2002-2023, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -subroutine procedure_f77style() - print *, "Executing procedure_f77style()" -end subroutine diff --git a/AtmOcnSelectExternalProto/ATM-C/Makefile b/AtmOcnSelectExternalProto/ATM-C/Makefile deleted file mode 100644 index 14bd462..0000000 --- a/AtmOcnSelectExternalProto/ATM-C/Makefile +++ /dev/null @@ -1,78 +0,0 @@ -# GNU Makefile template for user ESMF component - -################################################################################ -################################################################################ -## This Makefile must be able to find the "esmf.mk" Makefile fragment in the ## -## 'include' line below. Following the ESMF User's Guide, a complete ESMF ## -## installation should ensure that a single environment variable "ESMFMKFILE" ## -## is made available on the system. This variable should point to the ## -## "esmf.mk" file. ## -## ## -## This example Makefile uses the "ESMFMKFILE" environment variable. ## -## ## -## If you notice that this Makefile cannot find variable ESMFMKFILE then ## -## please contact the person responsible for the ESMF installation on your ## -## system. ## -## As a work-around you can simply hardcode the path to "esmf.mk" in the ## -## include line below. However, doing so will render this Makefile a lot less ## -## flexible and non-portable. ## -################################################################################ - -ifneq ($(origin ESMFMKFILE), environment) -$(error Environment variable ESMFMKFILE was not set.) -endif - -include $(ESMFMKFILE) - -################################################################################ -################################################################################ - -.SUFFIXES: .f90 .F90 .c .C - -%.o : %.f90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREENOCPP) $< - -%.o : %.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $< - -%.o : %.c - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -%.o : %.C - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -.PRECIOUS: %.o -%.mk : %.o - @echo "# ESMF self-describing build dependency makefile fragment" > $@ - @echo >> $@ - @echo "ESMF_DEP_FRONT = atmC" >> $@ - @echo "ESMF_DEP_INCPATH = `pwd`" >> $@ - @echo "ESMF_DEP_CMPL_OBJS = `pwd`/"$< >> $@ - @echo "ESMF_DEP_LINK_OBJS = `pwd`/"libatmC.a >> $@ - @echo "ESMF_DEP_SHRD_PATH = " >> $@ - @echo "ESMF_DEP_SHRD_LIBS = " >> $@ - -# ----------------------------------------------------------------------------- -atmC.mk: libatmC.a - -libatmC.a: atmC.o procedure.o - ar cr $@ $^ - -# ----------------------------------------------------------------------------- -# ----------------------------------------------------------------------------- -.PHONY: dust clean distclean info edit -dust: - rm -f PET*.ESMF_LogFile -clean: - rm -f *.o *.mod *.a *.mk -distclean: dust clean - -info: - @echo ================================================================== - @echo ESMFMKFILE=$(ESMFMKFILE) - @echo ================================================================== - @cat $(ESMFMKFILE) - @echo ================================================================== - -edit: - nedit atmC.F90 procedure.F90 & diff --git a/AtmOcnSelectExternalProto/ATM-C/atmC.F90 b/AtmOcnSelectExternalProto/ATM-C/atmC.F90 deleted file mode 100644 index bfd9efb..0000000 --- a/AtmOcnSelectExternalProto/ATM-C/atmC.F90 +++ /dev/null @@ -1,253 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright (c) 2002-2023, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -module atmC - - !----------------------------------------------------------------------------- - ! ATM Component. - !----------------------------------------------------------------------------- - - use ESMF - use NUOPC - use NUOPC_Model, & - modelSS => SetServices - - implicit none - - private - - public SetServices - - !----------------------------------------------------------------------------- - contains - !----------------------------------------------------------------------------- - - subroutine SetServices(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! derive from NUOPC_Model - call NUOPC_CompDerive(model, modelSS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! specialize model - call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & - specRoutine=Advertise, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & - specRoutine=Realize, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(model, specLabel=label_Advance, & - specRoutine=Advance, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine Advertise(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_State) :: importState, exportState - - rc = ESMF_SUCCESS - - ! query for importState and exportState - call NUOPC_ModelGet(model, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! importable field: sea_surface_temperature - call NUOPC_Advertise(importState, & - StandardName="sea_surface_temperature", name="sst", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: air_pressure_at_sea_level - call NUOPC_Advertise(exportState, & - StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: surface_net_downward_shortwave_flux - call NUOPC_Advertise(exportState, & - StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set Component name so it becomes identifiable - call ESMF_GridCompSet(model, name="atmC", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! call into a procedure F77 style, i.e. without explicit interface - call procedure_f77style2() - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine Realize(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_State) :: importState, exportState - type(ESMF_Field) :: field - type(ESMF_Grid) :: gridIn - type(ESMF_Grid) :: gridOut - - rc = ESMF_SUCCESS - - ! query for importState and exportState - call NUOPC_ModelGet(model, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! create a Grid object for Fields - gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & - minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & - maxCornerCoord=(/100._ESMF_KIND_R8, 200._ESMF_KIND_R8/), & - coordSys=ESMF_COORDSYS_CART, staggerLocList=(/ESMF_STAGGERLOC_CENTER/), & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - gridOut = gridIn ! for now out same as in - - ! importable field: sea_surface_temperature - field = ESMF_FieldCreate(name="sst", grid=gridIn, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(importState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: air_pressure_at_sea_level - field = ESMF_FieldCreate(name="pmsl", grid=gridOut, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(exportState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: surface_net_downward_shortwave_flux - field = ESMF_FieldCreate(name="rsns", grid=gridOut, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(exportState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine Advance(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_State) :: importState, exportState - character(len=160) :: msgString - - rc = ESMF_SUCCESS - - ! query for clock, importState and exportState - call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - - ! Because of the way that the internal Clock was set by default, - ! its timeStep is equal to the parent timeStep. As a consequence the - ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the Advance() routine. - - call ESMF_ClockPrint(clock, options="currTime", & - preString="------>Advancing ATM from: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ClockPrint(clock, options="stopTime", & - preString="---------------------> to: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - -end module diff --git a/AtmOcnSelectExternalProto/ATM-C/procedure.F90 b/AtmOcnSelectExternalProto/ATM-C/procedure.F90 deleted file mode 100644 index 4a86fcd..0000000 --- a/AtmOcnSelectExternalProto/ATM-C/procedure.F90 +++ /dev/null @@ -1,13 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright (c) 2002-2023, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -subroutine procedure_f77style2() - print *, "Executing procedure_f77style2()" -end subroutine diff --git a/AtmOcnSelectExternalProto/ATM-D/Makefile b/AtmOcnSelectExternalProto/ATM-D/Makefile deleted file mode 100644 index 31d789a..0000000 --- a/AtmOcnSelectExternalProto/ATM-D/Makefile +++ /dev/null @@ -1,81 +0,0 @@ -# GNU Makefile template for user ESMF component - -################################################################################ -################################################################################ -## This Makefile must be able to find the "esmf.mk" Makefile fragment in the ## -## 'include' line below. Following the ESMF User's Guide, a complete ESMF ## -## installation should ensure that a single environment variable "ESMFMKFILE" ## -## is made available on the system. This variable should point to the ## -## "esmf.mk" file. ## -## ## -## This example Makefile uses the "ESMFMKFILE" environment variable. ## -## ## -## If you notice that this Makefile cannot find variable ESMFMKFILE then ## -## please contact the person responsible for the ESMF installation on your ## -## system. ## -## As a work-around you can simply hardcode the path to "esmf.mk" in the ## -## include line below. However, doing so will render this Makefile a lot less ## -## flexible and non-portable. ## -################################################################################ - -ifneq ($(origin ESMFMKFILE), environment) -$(error Environment variable ESMFMKFILE was not set.) -endif - -include $(ESMFMKFILE) - -################################################################################ -################################################################################ - -.SUFFIXES: .f90 .F90 .c .C - -%.o : %.f90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREENOCPP) $< - -%.o : %.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $< - -%.o : %.c - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -%.o : %.C - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -.PRECIOUS: %.so - -%.mk : %.so - @echo "# ESMF self-describing build dependency makefile fragment" > $@ - @echo >> $@ - @echo "ESMF_DEP_FRONT = atmD" >> $@ - @echo "ESMF_DEP_INCPATH = `pwd`" >> $@ - @echo "ESMF_DEP_CMPL_OBJS = " >> $@ - @echo "ESMF_DEP_LINK_OBJS = " >> $@ - @echo "ESMF_DEP_SHRD_PATH = `pwd`" >> $@ - @echo "ESMF_DEP_SHRD_LIBS = "$* >> $@ - -# ----------------------------------------------------------------------------- -atmD.mk: - -atmD.so: atmD.o - $(ESMF_F90LINKER) $(ESMF_SO_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $< $(ESMF_F90ESMFLINKLIBS) - mv $@ lib$@ - rm -f $< - -# ----------------------------------------------------------------------------- -# ----------------------------------------------------------------------------- -.PHONY: dust clean distclean info edit -dust: - rm -f PET*.ESMF_LogFile -clean: - rm -f *.o *.so *.mod *.mk -distclean: dust clean - -info: - @echo ================================================================== - @echo ESMFMKFILE=$(ESMFMKFILE) - @echo ================================================================== - @cat $(ESMFMKFILE) - @echo ================================================================== - -edit: - nedit atmD.F90 & diff --git a/AtmOcnSelectExternalProto/ATM-D/atmD.F90 b/AtmOcnSelectExternalProto/ATM-D/atmD.F90 deleted file mode 100644 index 57fa805..0000000 --- a/AtmOcnSelectExternalProto/ATM-D/atmD.F90 +++ /dev/null @@ -1,250 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright (c) 2002-2023, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -module atmD - - !----------------------------------------------------------------------------- - ! ATM Component. - !----------------------------------------------------------------------------- - - use ESMF - use NUOPC - use NUOPC_Model, & - modelSS => SetServices - - implicit none - - private - - public SetServices - - !----------------------------------------------------------------------------- - contains - !----------------------------------------------------------------------------- - - subroutine SetServices(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! derive from NUOPC_Model - call NUOPC_CompDerive(model, modelSS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! specialize model - call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & - specRoutine=Advertise, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & - specRoutine=Realize, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(model, specLabel=label_Advance, & - specRoutine=Advance, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine Advertise(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_State) :: importState, exportState - - rc = ESMF_SUCCESS - - ! query for importState and exportState - call NUOPC_ModelGet(model, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! importable field: sea_surface_temperature - call NUOPC_Advertise(importState, & - StandardName="sea_surface_temperature", name="sst", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: air_pressure_at_sea_level - call NUOPC_Advertise(exportState, & - StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: surface_net_downward_shortwave_flux - call NUOPC_Advertise(exportState, & - StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set Component name so it becomes identifiable - call ESMF_GridCompSet(model, name="atmD", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine Realize(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_State) :: importState, exportState - type(ESMF_Field) :: field - type(ESMF_Grid) :: gridIn - type(ESMF_Grid) :: gridOut - - rc = ESMF_SUCCESS - - ! query for importState and exportState - call NUOPC_ModelGet(model, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! create a Grid object for Fields - gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & - minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & - maxCornerCoord=(/100._ESMF_KIND_R8, 200._ESMF_KIND_R8/), & - coordSys=ESMF_COORDSYS_CART, staggerLocList=(/ESMF_STAGGERLOC_CENTER/), & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - gridOut = gridIn ! for now out same as in - - ! importable field: sea_surface_temperature - field = ESMF_FieldCreate(name="sst", grid=gridIn, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(importState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: air_pressure_at_sea_level - field = ESMF_FieldCreate(name="pmsl", grid=gridOut, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(exportState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: surface_net_downward_shortwave_flux - field = ESMF_FieldCreate(name="rsns", grid=gridOut, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(exportState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine Advance(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_State) :: importState, exportState - character(len=160) :: msgString - - rc = ESMF_SUCCESS - - ! query for clock, importState and exportState - call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - - ! Because of the way that the internal Clock was set by default, - ! its timeStep is equal to the parent timeStep. As a consequence the - ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the Advance() routine. - - call ESMF_ClockPrint(clock, options="currTime", & - preString="------>Advancing ATM from: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ClockPrint(clock, options="stopTime", & - preString="---------------------> to: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - -end module diff --git a/AtmOcnSelectExternalProto/ATM-E/Makefile b/AtmOcnSelectExternalProto/ATM-E/Makefile deleted file mode 100644 index 1c8b49e..0000000 --- a/AtmOcnSelectExternalProto/ATM-E/Makefile +++ /dev/null @@ -1,80 +0,0 @@ -# GNU Makefile template for user ESMF component - -################################################################################ -################################################################################ -## This Makefile must be able to find the "esmf.mk" Makefile fragment in the ## -## 'include' line below. Following the ESMF User's Guide, a complete ESMF ## -## installation should ensure that a single environment variable "ESMFMKFILE" ## -## is made available on the system. This variable should point to the ## -## "esmf.mk" file. ## -## ## -## This example Makefile uses the "ESMFMKFILE" environment variable. ## -## ## -## If you notice that this Makefile cannot find variable ESMFMKFILE then ## -## please contact the person responsible for the ESMF installation on your ## -## system. ## -## As a work-around you can simply hardcode the path to "esmf.mk" in the ## -## include line below. However, doing so will render this Makefile a lot less ## -## flexible and non-portable. ## -################################################################################ - -ifneq ($(origin ESMFMKFILE), environment) -$(error Environment variable ESMFMKFILE was not set.) -endif - -include $(ESMFMKFILE) - -################################################################################ -################################################################################ - -.SUFFIXES: .f90 .F90 .c .C - -%.o : %.f90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREENOCPP) $< - -%.o : %.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $< - -%.o : %.c - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -%.o : %.C - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -.PRECIOUS: %.so - -%.mk : %.so - @echo "# ESMF self-describing build dependency makefile fragment" > $@ - @echo >> $@ - @echo "ESMF_DEP_FRONT = "$< >> $@ - @echo "ESMF_DEP_INCPATH = " >> $@ - @echo "ESMF_DEP_CMPL_OBJS = " >> $@ - @echo "ESMF_DEP_LINK_OBJS = " >> $@ - @echo "ESMF_DEP_SHRD_PATH = " >> $@ - @echo "ESMF_DEP_SHRD_LIBS = " >> $@ - -# ----------------------------------------------------------------------------- -atmE.mk: - -atmE.so: atmE.o - $(ESMF_F90LINKER) $(ESMF_SO_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $< $(ESMF_F90ESMFLINKLIBS) - rm -f $< - -# ----------------------------------------------------------------------------- -# ----------------------------------------------------------------------------- -.PHONY: dust clean distclean info edit -dust: - rm -f PET*.ESMF_LogFile -clean: - rm -f *.o *.so *.mod *.mk -distclean: dust clean - -info: - @echo ================================================================== - @echo ESMFMKFILE=$(ESMFMKFILE) - @echo ================================================================== - @cat $(ESMFMKFILE) - @echo ================================================================== - -edit: - nedit atmE.F90 & diff --git a/AtmOcnSelectExternalProto/ATM-E/atmE.F90 b/AtmOcnSelectExternalProto/ATM-E/atmE.F90 deleted file mode 100644 index 65907b6..0000000 --- a/AtmOcnSelectExternalProto/ATM-E/atmE.F90 +++ /dev/null @@ -1,268 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright (c) 2002-2023, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -module atmE - - !----------------------------------------------------------------------------- - ! ATM Component. - !----------------------------------------------------------------------------- - - use ESMF - use NUOPC - use NUOPC_Model, & - modelSS => SetServices - - implicit none - - private - - public SetVM, SetServices - - !----------------------------------------------------------------------------- - contains - !----------------------------------------------------------------------------- - - subroutine SetServices(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! derive from NUOPC_Model - call NUOPC_CompDerive(model, modelSS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! specialize model - call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & - specRoutine=Advertise, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & - specRoutine=Realize, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(model, specLabel=label_Advance, & - specRoutine=Advance, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine Advertise(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_State) :: importState, exportState - - rc = ESMF_SUCCESS - - ! query for importState and exportState - call NUOPC_ModelGet(model, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! importable field: sea_surface_temperature - call NUOPC_Advertise(importState, & - StandardName="sea_surface_temperature", name="sst", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: air_pressure_at_sea_level - call NUOPC_Advertise(exportState, & - StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: surface_net_downward_shortwave_flux - call NUOPC_Advertise(exportState, & - StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set Component name so it becomes identifiable - call ESMF_GridCompSet(model, name="atmE", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine Realize(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_State) :: importState, exportState - type(ESMF_Field) :: field - type(ESMF_Grid) :: gridIn - type(ESMF_Grid) :: gridOut - - rc = ESMF_SUCCESS - - ! query for importState and exportState - call NUOPC_ModelGet(model, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! create a Grid object for Fields - gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 100/), & - minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & - maxCornerCoord=(/100._ESMF_KIND_R8, 200._ESMF_KIND_R8/), & - coordSys=ESMF_COORDSYS_CART, staggerLocList=(/ESMF_STAGGERLOC_CENTER/), & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - gridOut = gridIn ! for now out same as in - - ! importable field: sea_surface_temperature - field = ESMF_FieldCreate(name="sst", grid=gridIn, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(importState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: air_pressure_at_sea_level - field = ESMF_FieldCreate(name="pmsl", grid=gridOut, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(exportState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: surface_net_downward_shortwave_flux - field = ESMF_FieldCreate(name="rsns", grid=gridOut, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(exportState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine Advance(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_State) :: importState, exportState - character(len=160) :: msgString - - rc = ESMF_SUCCESS - - ! query for clock, importState and exportState - call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - - ! Because of the way that the internal Clock was set by default, - ! its timeStep is equal to the parent timeStep. As a consequence the - ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the Advance() routine. - - call ESMF_ClockPrint(clock, options="currTime", & - preString="------>Advancing ATM from: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ClockPrint(clock, options="stopTime", & - preString="---------------------> to: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - -end module - -! External access to SetVM -subroutine SetVM(comp, rc) - use ESMF - use atmE, only: SetVMModule => SetVM - type(ESMF_GridComp) :: comp - integer, intent(out) :: rc - call SetVMModule(comp, rc) -end subroutine - -! External access to SetServices -subroutine SetServices(comp, rc) - use ESMF - use atmE, only: SetServicesModule => SetServices - type(ESMF_GridComp) :: comp - integer, intent(out) :: rc - call SetServicesModule(comp, rc) -end subroutine diff --git a/AtmOcnSelectExternalProto/ATM-F/Makefile b/AtmOcnSelectExternalProto/ATM-F/Makefile deleted file mode 100644 index 70ceceb..0000000 --- a/AtmOcnSelectExternalProto/ATM-F/Makefile +++ /dev/null @@ -1,78 +0,0 @@ -# GNU Makefile template for user ESMF component - -################################################################################ -################################################################################ -## This Makefile must be able to find the "esmf.mk" Makefile fragment in the ## -## 'include' line below. Following the ESMF User's Guide, a complete ESMF ## -## installation should ensure that a single environment variable "ESMFMKFILE" ## -## is made available on the system. This variable should point to the ## -## "esmf.mk" file. ## -## ## -## This example Makefile uses the "ESMFMKFILE" environment variable. ## -## ## -## If you notice that this Makefile cannot find variable ESMFMKFILE then ## -## please contact the person responsible for the ESMF installation on your ## -## system. ## -## As a work-around you can simply hardcode the path to "esmf.mk" in the ## -## include line below. However, doing so will render this Makefile a lot less ## -## flexible and non-portable. ## -################################################################################ - -ifneq ($(origin ESMFMKFILE), environment) -$(error Environment variable ESMFMKFILE was not set.) -endif - -include $(ESMFMKFILE) - -################################################################################ -################################################################################ - -.SUFFIXES: .f90 .F90 .c .C - -%.o : %.f90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREENOCPP) $< - -%.o : %.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $< - -%.o : %.c - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -%.o : %.C - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -.PRECIOUS: %.o - -%.mk : %.o - @echo "# ESMF self-describing build dependency makefile fragment" > $@ - @echo >> $@ - @echo "ESMF_DEP_FRONT = atmF.h" >> $@ - @echo "ESMF_DEP_INCPATH = `pwd`" >> $@ - @echo "ESMF_DEP_CMPL_OBJS = `pwd`/"$< >> $@ - @echo "ESMF_DEP_LINK_OBJS = `pwd`/"$< >> $@ - @echo "ESMF_DEP_SHRD_PATH = " >> $@ - @echo "ESMF_DEP_SHRD_LIBS = " >> $@ - -# ----------------------------------------------------------------------------- -atmF.mk: - -atmF.o: atmF.h - -# ----------------------------------------------------------------------------- -# ----------------------------------------------------------------------------- -.PHONY: dust clean distclean info edit -dust: - rm -f PET*.ESMF_LogFile -clean: - rm -f *.o *.mod *.mk -distclean: dust clean - -info: - @echo ================================================================== - @echo ESMFMKFILE=$(ESMFMKFILE) - @echo ================================================================== - @cat $(ESMFMKFILE) - @echo ================================================================== - -edit: - nedit atmF.C & diff --git a/AtmOcnSelectExternalProto/ATM-F/atmF.C b/AtmOcnSelectExternalProto/ATM-F/atmF.C deleted file mode 100644 index 30ea761..0000000 --- a/AtmOcnSelectExternalProto/ATM-F/atmF.C +++ /dev/null @@ -1,72 +0,0 @@ -//============================================================================== -// Earth System Modeling Framework -// Copyright (c) 2002-2023, University Corporation for Atmospheric Research, -// Massachusetts Institute of Technology, Geophysical Fluid Dynamics -// Laboratory, University of Michigan, National Centers for Environmental -// Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -// NASA Goddard Space Flight Center. -// Licensed under the University of Illinois-NCSA License. -//============================================================================== - -// standard C headers -#include -#include -#include -#include - -// ESMF header -- provides access to the entire public ESMF C API -#include "ESMC.h" -#include "atmF.h" - -//------------------------------------------------------------------------- -//------------------------------------------------------------------------- - -void Initialize(ESMC_GridComp model, ESMC_State importState, - ESMC_State exportState, ESMC_Clock *clock, int *rc){ - - // initialize return code - *rc = ESMF_SUCCESS; -} - - -void Run(ESMC_GridComp model, ESMC_State importState, - ESMC_State exportState, ESMC_Clock *clock, int *rc){ - - // initialize return code - *rc = ESMF_SUCCESS; -} - - -void Finalize(ESMC_GridComp model, ESMC_State importState, - ESMC_State exportState, ESMC_Clock *clock, int *rc){ - - // initialize return code - *rc = ESMF_SUCCESS; -} - -//------------------------------------------------------------------------- -//------------------------------------------------------------------------- - -extern "C" { - // The SetServices entry point must ensure to have external C linkage, - // that way it can be called from C or Fortran. - - void FTN_X(setservices_atmf)(ESMC_GridComp model, int *rc){ - - // initialize return code - *rc = ESMF_SUCCESS; - - // This is where the NUOPC_Model SetServices needs to be called once it is - // available for C code. - - *rc = ESMC_GridCompSetEntryPoint(model, ESMF_METHOD_INITIALIZE,Initialize,1); - if (*rc!=ESMF_SUCCESS) return; // bail out - *rc = ESMC_GridCompSetEntryPoint(model, ESMF_METHOD_RUN, Run, 1); - if (*rc!=ESMF_SUCCESS) return; // bail out - *rc = ESMC_GridCompSetEntryPoint(model, ESMF_METHOD_FINALIZE, Finalize, 1); - if (*rc!=ESMF_SUCCESS) return; // bail out - } -} //extern "C" - -//------------------------------------------------------------------------- -//------------------------------------------------------------------------- diff --git a/AtmOcnSelectExternalProto/ATM-F/atmF.h b/AtmOcnSelectExternalProto/ATM-F/atmF.h deleted file mode 100644 index d63268f..0000000 --- a/AtmOcnSelectExternalProto/ATM-F/atmF.h +++ /dev/null @@ -1,22 +0,0 @@ -#if (defined __STDC__ || defined __cplusplus) - -// ---------- C and C++ block ---------- - -#include "ESMC.h" -extern "C" { - void FTN_X(setservices_atmf)(ESMC_GridComp gcomp, int *rc); -} - -#else - -!! ---------- Fortran block ---------- - -interface - subroutine setservices_atmf(gcomp, rc) - use ESMF - type(ESMF_GridComp) :: gcomp - integer, intent(out) :: rc - end subroutine -end interface - -#endif diff --git a/AtmOcnSelectExternalProto/Makefile b/AtmOcnSelectExternalProto/Makefile deleted file mode 100644 index 42f951d..0000000 --- a/AtmOcnSelectExternalProto/Makefile +++ /dev/null @@ -1,176 +0,0 @@ -# GNU Makefile template for user ESMF application - -################################################################################ -################################################################################ -## This Makefile must be able to find the "esmf.mk" Makefile fragment in the ## -## 'include' line below. Following the ESMF User's Guide, a complete ESMF ## -## installation should ensure that a single environment variable "ESMFMKFILE" ## -## is made available on the system. This variable should point to the ## -## "esmf.mk" file. ## -## ## -## This example Makefile uses the "ESMFMKFILE" environment variable. ## -## ## -## If you notice that this Makefile cannot find variable ESMFMKFILE then ## -## please contact the person responsible for the ESMF installation on your ## -## system. ## -## As a work-around you can simply hardcode the path to "esmf.mk" in the ## -## include line below. However, doing so will render this Makefile a lot less ## -## flexible and non-portable. ## -################################################################################ - -ifneq ($(origin ESMFMKFILE), environment) -$(error Environment variable ESMFMKFILE was not set.) -endif - -include $(ESMFMKFILE) - -# strip quotes around the ESMF_INTERNAL_MPIRUN value -ESMF_INTERNAL_MPIRUN := $(shell echo $(ESMF_INTERNAL_MPIRUN)) - -################################################################################ -# Need a variable that contains only a comma for some of the operations below -COMMA := , - -################################################################################ -# Use specified ATM and OCN variables to determine which self-describing -# component dependency files to include. -ifneq (,$(findstring A,$(ATM))) - include ATM-A/atmA.mk - DEP_FRONTS := $(DEP_FRONTS) -DFRONT_ATMA=$(ESMF_DEP_FRONT) - DEP_INCS := $(DEP_INCS) $(addprefix -I, $(ESMF_DEP_INCPATH)) - DEP_CMPL_OBJS := $(DEP_CMPL_OBJS) $(ESMF_DEP_CMPL_OBJS) - DEP_LINK_OBJS := $(DEP_LINK_OBJS) $(ESMF_DEP_LINK_OBJS) - DEP_SHRD_PATH := $(DEP_SHRD_PATH) $(addprefix -L, $(ESMF_DEP_SHRD_PATH)) $(addprefix -Wl$(COMMA)-rpath$(COMMA), $(ESMF_DEP_SHRD_PATH)) - DEP_SHRD_LIBS := $(DEP_SHRD_LIBS) $(addprefix -l, $(ESMF_DEP_SHRD_LIBS)) -endif -ifneq (,$(findstring B,$(ATM))) - include ATM-B/atmB.mk - DEP_FRONTS := $(DEP_FRONTS) -DFRONT_ATMB=$(ESMF_DEP_FRONT) - DEP_INCS := $(DEP_INCS) $(addprefix -I, $(ESMF_DEP_INCPATH)) - DEP_CMPL_OBJS := $(DEP_CMPL_OBJS) $(ESMF_DEP_CMPL_OBJS) - DEP_LINK_OBJS := $(DEP_LINK_OBJS) $(ESMF_DEP_LINK_OBJS) - DEP_SHRD_PATH := $(DEP_SHRD_PATH) $(addprefix -L, $(ESMF_DEP_SHRD_PATH)) $(addprefix -Wl$(COMMA)-rpath$(COMMA), $(ESMF_DEP_SHRD_PATH)) - DEP_SHRD_LIBS := $(DEP_SHRD_LIBS) $(addprefix -l, $(ESMF_DEP_SHRD_LIBS)) -endif -ifneq (,$(findstring C,$(ATM))) - include ATM-C/atmC.mk - DEP_FRONTS := $(DEP_FRONTS) -DFRONT_ATMC=$(ESMF_DEP_FRONT) - DEP_INCS := $(DEP_INCS) $(addprefix -I, $(ESMF_DEP_INCPATH)) - DEP_CMPL_OBJS := $(DEP_CMPL_OBJS) $(ESMF_DEP_CMPL_OBJS) - DEP_LINK_OBJS := $(DEP_LINK_OBJS) $(ESMF_DEP_LINK_OBJS) - DEP_SHRD_PATH := $(DEP_SHRD_PATH) $(addprefix -L, $(ESMF_DEP_SHRD_PATH)) $(addprefix -Wl$(COMMA)-rpath$(COMMA), $(ESMF_DEP_SHRD_PATH)) - DEP_SHRD_LIBS := $(DEP_SHRD_LIBS) $(addprefix -l, $(ESMF_DEP_SHRD_LIBS)) -endif -ifneq (,$(findstring D,$(ATM))) - include ATM-D/atmD.mk - DEP_FRONTS := $(DEP_FRONTS) -DFRONT_ATMD=$(ESMF_DEP_FRONT) - DEP_INCS := $(DEP_INCS) $(addprefix -I, $(ESMF_DEP_INCPATH)) - DEP_CMPL_OBJS := $(DEP_CMPL_OBJS) $(ESMF_DEP_CMPL_OBJS) - DEP_LINK_OBJS := $(DEP_LINK_OBJS) $(ESMF_DEP_LINK_OBJS) - DEP_SHRD_PATH := $(DEP_SHRD_PATH) $(addprefix -L, $(ESMF_DEP_SHRD_PATH)) $(addprefix -Wl$(COMMA)-rpath$(COMMA), $(ESMF_DEP_SHRD_PATH)) - DEP_SHRD_LIBS := $(DEP_SHRD_LIBS) $(addprefix -l, $(ESMF_DEP_SHRD_LIBS)) -endif -ifneq (,$(findstring E,$(ATM))) - include ATM-E/atmE.mk - ifneq (,$(findstring .so,$(ESMF_DEP_FRONT))) - DEP_FRONTS := $(DEP_FRONTS) -DFRONT_SO_ATME=\"$(ESMF_DEP_FRONT)\" - else - DEP_FRONTS := $(DEP_FRONTS) -DFRONT_ATME=$(ESMF_DEP_FRONT) - endif - DEP_INCS := $(DEP_INCS) $(addprefix -I, $(ESMF_DEP_INCPATH)) - DEP_CMPL_OBJS := $(DEP_CMPL_OBJS) $(ESMF_DEP_CMPL_OBJS) - DEP_LINK_OBJS := $(DEP_LINK_OBJS) $(ESMF_DEP_LINK_OBJS) - DEP_SHRD_PATH := $(DEP_SHRD_PATH) $(addprefix -L, $(ESMF_DEP_SHRD_PATH)) $(addprefix -Wl$(COMMA)-rpath$(COMMA), $(ESMF_DEP_SHRD_PATH)) - DEP_SHRD_LIBS := $(DEP_SHRD_LIBS) $(addprefix -l, $(ESMF_DEP_SHRD_LIBS)) -endif -ifneq (,$(findstring F,$(ATM))) - include ATM-F/atmF.mk - ifneq (,$(findstring .h,$(ESMF_DEP_FRONT))) - DEP_FRONTS := $(DEP_FRONTS) -DFRONT_H_ATMF=\"$(ESMF_DEP_FRONT)\" -DFRONT_H_ATMF_SS=SetServices_$(subst .h,,$(ESMF_DEP_FRONT)) - else ifneq (,$(findstring .so,$(ESMF_DEP_FRONT))) - DEP_FRONTS := $(DEP_FRONTS) -DFRONT_SO_ATMF=\"$(ESMF_DEP_FRONT)\" - else - DEP_FRONTS := $(DEP_FRONTS) -DFRONT_ATMF=$(ESMF_DEP_FRONT) - endif - DEP_INCS := $(DEP_INCS) $(addprefix -I, $(ESMF_DEP_INCPATH)) - DEP_CMPL_OBJS := $(DEP_CMPL_OBJS) $(ESMF_DEP_CMPL_OBJS) - DEP_LINK_OBJS := $(DEP_LINK_OBJS) $(ESMF_DEP_LINK_OBJS) - DEP_SHRD_PATH := $(DEP_SHRD_PATH) $(addprefix -L, $(ESMF_DEP_SHRD_PATH)) $(addprefix -Wl$(COMMA)-rpath$(COMMA), $(ESMF_DEP_SHRD_PATH)) - DEP_SHRD_LIBS := $(DEP_SHRD_LIBS) $(addprefix -l, $(ESMF_DEP_SHRD_LIBS)) -endif -ifneq (,$(findstring A,$(OCN))) - include OcnModelA/ocn.mk - DEP_FRONTS := $(DEP_FRONTS) -DFRONT_OCNA=$(ESMF_DEP_FRONT) - DEP_INCS := $(DEP_INCS) $(addprefix -I, $(ESMF_DEP_INCPATH)) - DEP_CMPL_OBJS := $(DEP_CMPL_OBJS) $(ESMF_DEP_CMPL_OBJS) - DEP_LINK_OBJS := $(DEP_LINK_OBJS) $(ESMF_DEP_LINK_OBJS) - DEP_SHRD_PATH := $(DEP_SHRD_PATH) $(addprefix -L, $(ESMF_DEP_SHRD_PATH)) $(addprefix -Wl$(COMMA)-rpath$(COMMA), $(ESMF_DEP_SHRD_PATH)) - DEP_SHRD_LIBS := $(DEP_SHRD_LIBS) $(addprefix -l, $(ESMF_DEP_SHRD_LIBS)) -endif -ifneq (,$(findstring B,$(OCN))) - include OcnModelB/ocn.mk - DEP_FRONTS := $(DEP_FRONTS) -DFRONT_OCNB=$(ESMF_DEP_FRONT) - DEP_INCS := $(DEP_INCS) $(addprefix -I, $(ESMF_DEP_INCPATH)) - DEP_CMPL_OBJS := $(DEP_CMPL_OBJS) $(ESMF_DEP_CMPL_OBJS) - DEP_LINK_OBJS := $(DEP_LINK_OBJS) $(ESMF_DEP_LINK_OBJS) - DEP_SHRD_PATH := $(DEP_SHRD_PATH) $(addprefix -L, $(ESMF_DEP_SHRD_PATH)) $(addprefix -Wl$(COMMA)-rpath$(COMMA), $(ESMF_DEP_SHRD_PATH)) - DEP_SHRD_LIBS := $(DEP_SHRD_LIBS) $(addprefix -l, $(ESMF_DEP_SHRD_LIBS)) -endif -ifneq (,$(findstring C,$(OCN))) - include OcnModelC/ocn.mk - DEP_FRONTS := $(DEP_FRONTS) -DFRONT_SO_OCNC=\"$(ESMF_DEP_FRONT)\" - DEP_INCS := $(DEP_INCS) $(addprefix -I, $(ESMF_DEP_INCPATH)) - DEP_CMPL_OBJS := $(DEP_CMPL_OBJS) $(ESMF_DEP_CMPL_OBJS) - DEP_LINK_OBJS := $(DEP_LINK_OBJS) $(ESMF_DEP_LINK_OBJS) - DEP_SHRD_PATH := $(DEP_SHRD_PATH) $(addprefix -L, $(ESMF_DEP_SHRD_PATH)) $(addprefix -Wl$(COMMA)-rpath$(COMMA), $(ESMF_DEP_SHRD_PATH)) - DEP_SHRD_LIBS := $(DEP_SHRD_LIBS) $(addprefix -l, $(ESMF_DEP_SHRD_LIBS)) -endif - -################################################################################ -################################################################################ - -.SUFFIXES: .f90 .F90 .c .C - -%.o : %.f90 - $(ESMF_F90COMPILER) -c $(DEP_FRONTS) $(DEP_INCS) $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREENOCPP) $< - -%.o : %.F90 - $(ESMF_F90COMPILER) -c $(DEP_FRONTS) $(DEP_INCS) $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $< - -%.o : %.c - $(ESMF_CXXCOMPILER) -c $(DEP_FRONTS) $(DEP_INCS) $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -%.o : %.C - $(ESMF_CXXCOMPILER) -c $(DEP_FRONTS) $(DEP_INCS) $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - - -# ----------------------------------------------------------------------------- -esmApp: esmApp.o esm.o $(DEP_LINK_OBJS) - $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $^ $(DEP_SHRD_PATH) $(DEP_SHRD_LIBS) $(ESMF_F90ESMFLINKLIBS) - -# module dependencies: -esmApp.o: esm.o -esm.o: $(DEP_CMPL_OBJS) - -# ----------------------------------------------------------------------------- -# ----------------------------------------------------------------------------- -.PHONY: dust clean distclean info edit -dust: - rm -f PET*.ESMF_LogFile *.nc *.stdout -clean: - rm -f esmApp *.o *.mod -distclean: dust clean - rm -f *.so - -info: - @echo ================================================================== - @echo ESMFMKFILE=$(ESMFMKFILE) - @echo ================================================================== - @cat $(ESMFMKFILE) - @echo ================================================================== - -edit: - nedit esmApp.F90 esm.F90 & - -run: - $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnSelectExternalProto/OcnCommon/Makefile b/AtmOcnSelectExternalProto/OcnCommon/Makefile deleted file mode 100644 index 596734c..0000000 --- a/AtmOcnSelectExternalProto/OcnCommon/Makefile +++ /dev/null @@ -1,78 +0,0 @@ -# GNU Makefile template for user ESMF component - -################################################################################ -################################################################################ -## This Makefile must be able to find the "esmf.mk" Makefile fragment in the ## -## 'include' line below. Following the ESMF User's Guide, a complete ESMF ## -## installation should ensure that a single environment variable "ESMFMKFILE" ## -## is made available on the system. This variable should point to the ## -## "esmf.mk" file. ## -## ## -## This example Makefile uses the "ESMFMKFILE" environment variable. ## -## ## -## If you notice that this Makefile cannot find variable ESMFMKFILE then ## -## please contact the person responsible for the ESMF installation on your ## -## system. ## -## As a work-around you can simply hardcode the path to "esmf.mk" in the ## -## include line below. However, doing so will render this Makefile a lot less ## -## flexible and non-portable. ## -################################################################################ - -ifneq ($(origin ESMFMKFILE), environment) -$(error Environment variable ESMFMKFILE was not set.) -endif - -include $(ESMFMKFILE) - -################################################################################ -################################################################################ - -.SUFFIXES: .f90 .F90 .c .C - -%.o : %.f90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREENOCPP) $< - -%.o : %.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $< - -%.o : %.c - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -%.o : %.C - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -.PRECIOUS: %.o -%.mk : %.o - @echo "# ESMF self-describing build dependency makefile fragment" > $@ - @echo >> $@ - @echo "ESMF_DEP_FRONT = OceanCommon" >> $@ - @echo "ESMF_DEP_INCPATH = `pwd`" >> $@ - @echo "ESMF_DEP_CMPL_OBJS = `pwd`/"$< >> $@ - @echo "ESMF_DEP_LINK_OBJS = "$(addprefix `pwd`/, $< $(OBJS)) >> $@ - @echo "ESMF_DEP_SHRD_PATH = " >> $@ - @echo "ESMF_DEP_SHRD_LIBS = " >> $@ - -# ----------------------------------------------------------------------------- -ocnCommon.mk: - -OBJS = subModule1.o subModule2.o -ocnCommon.o: $(OBJS) - -# ----------------------------------------------------------------------------- -# ----------------------------------------------------------------------------- -.PHONY: dust clean distclean info edit -dust: - rm -f PET*.ESMF_LogFile -clean: - rm -f *.o *.mod *.mk -distclean: dust clean - -info: - @echo ================================================================== - @echo ESMFMKFILE=$(ESMFMKFILE) - @echo ================================================================== - @cat $(ESMFMKFILE) - @echo ================================================================== - -edit: - nedit ocnCommon.F90 subModule1.F90 subModule2.F90 & diff --git a/AtmOcnSelectExternalProto/OcnCommon/ocnCommon.F90 b/AtmOcnSelectExternalProto/OcnCommon/ocnCommon.F90 deleted file mode 100644 index cedaa2c..0000000 --- a/AtmOcnSelectExternalProto/OcnCommon/ocnCommon.F90 +++ /dev/null @@ -1,35 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright (c) 2002-2023, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -module OceanCommon - - use ESMF - use NUOPC - - use subModule1 - use subModule2 - - implicit none - - private - - public procedure_ocnCommon - - contains - - subroutine procedure_ocnCommon(rc) - integer, intent(out) :: rc - print *, "Executing procedure_ocnCommon()" - call procedure_subModule1() - call procedure_subModule2() - rc=ESMF_SUCCESS - end subroutine - -end module diff --git a/AtmOcnSelectExternalProto/OcnCommon/subModule1.F90 b/AtmOcnSelectExternalProto/OcnCommon/subModule1.F90 deleted file mode 100644 index 9b06acc..0000000 --- a/AtmOcnSelectExternalProto/OcnCommon/subModule1.F90 +++ /dev/null @@ -1,25 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright (c) 2002-2023, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -module subModule1 - - implicit none - - private - - public procedure_subModule1 - - contains - - subroutine procedure_subModule1() - print *, "Executing procedure_subModule1()" - end subroutine - -end module diff --git a/AtmOcnSelectExternalProto/OcnCommon/subModule2.F90 b/AtmOcnSelectExternalProto/OcnCommon/subModule2.F90 deleted file mode 100644 index 686f949..0000000 --- a/AtmOcnSelectExternalProto/OcnCommon/subModule2.F90 +++ /dev/null @@ -1,25 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright (c) 2002-2023, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -module subModule2 - - implicit none - - private - - public procedure_subModule2 - - contains - - subroutine procedure_subModule2() - print *, "Executing procedure_subModule2()" - end subroutine - -end module diff --git a/AtmOcnSelectExternalProto/OcnModelA/Makefile b/AtmOcnSelectExternalProto/OcnModelA/Makefile deleted file mode 100644 index 51a66bd..0000000 --- a/AtmOcnSelectExternalProto/OcnModelA/Makefile +++ /dev/null @@ -1,88 +0,0 @@ -# GNU Makefile template for user ESMF component - -################################################################################ -################################################################################ -## This Makefile must be able to find the "esmf.mk" Makefile fragment in the ## -## 'include' line below. Following the ESMF User's Guide, a complete ESMF ## -## installation should ensure that a single environment variable "ESMFMKFILE" ## -## is made available on the system. This variable should point to the ## -## "esmf.mk" file. ## -## ## -## This example Makefile uses the "ESMFMKFILE" environment variable. ## -## ## -## If you notice that this Makefile cannot find variable ESMFMKFILE then ## -## please contact the person responsible for the ESMF installation on your ## -## system. ## -## As a work-around you can simply hardcode the path to "esmf.mk" in the ## -## include line below. However, doing so will render this Makefile a lot less ## -## flexible and non-portable. ## -################################################################################ - -ifneq ($(origin ESMFMKFILE), environment) -$(error Environment variable ESMFMKFILE was not set.) -endif - -include $(ESMFMKFILE) - -################################################################################ -# Include self-describing dependencies and accumulate into local variables - -include ../OcnCommon/ocnCommon.mk -DEP_FRONTS := $(DEP_FRONTS) -DFRONT_OCNCOMMON=$(ESMF_DEP_FRONT) -DEP_INCS := $(DEP_INCS) $(addprefix -I, $(ESMF_DEP_INCPATH)) -DEP_CMPL_OBJS := $(DEP_CMPL_OBJS) $(ESMF_DEP_CMPL_OBJS) -DEP_LINK_OBJS := $(DEP_LINK_OBJS) $(ESMF_DEP_LINK_OBJS) -DEP_SHRD_PATH := $(DEP_SHRD_PATH) $(ESMF_DEP_SHRD_PATH) -DEP_SHRD_LIBS := $(DEP_SHRD_LIBS) $(ESMF_DEP_SHRD_LIBS) - -################################################################################ -################################################################################ - -.SUFFIXES: .f90 .F90 .c .C - -%.o : %.f90 - $(ESMF_F90COMPILER) -c $(DEP_FRONTS) $(DEP_INCS) $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREENOCPP) $< - -%.o : %.F90 - $(ESMF_F90COMPILER) -c $(DEP_FRONTS) $(DEP_INCS) $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $< - -%.o : %.c - $(ESMF_CXXCOMPILER) -c $(DEP_FRONTS) $(DEP_INCS) $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -%.o : %.C - $(ESMF_CXXCOMPILER) -c $(DEP_FRONTS) $(DEP_INCS) $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -.PRECIOUS: %.o -%.mk : %.o - @echo "# ESMF self-describing build dependency makefile fragment" > $@ - @echo >> $@ - @echo "ESMF_DEP_FRONT = ocnA" >> $@ - @echo "ESMF_DEP_INCPATH = `pwd`" >> $@ - @echo "ESMF_DEP_CMPL_OBJS = `pwd`/"$< >> $@ - @echo "ESMF_DEP_LINK_OBJS = `pwd`/"$< $(DEP_LINK_OBJS) >> $@ - @echo "ESMF_DEP_SHRD_PATH = " $(DEP_SHRD_PATH) >> $@ - @echo "ESMF_DEP_SHRD_LIBS = " $(DEP_SHRD_LIBS) >> $@ - -# ----------------------------------------------------------------------------- -ocn.mk: - -ocn.o: $(DEP_CMPL_OBJS) - -# ----------------------------------------------------------------------------- -# ----------------------------------------------------------------------------- -.PHONY: dust clean distclean info edit -dust: - rm -f PET*.ESMF_LogFile -clean: - rm -f *.o *.mod *.mk -distclean: dust clean - -info: - @echo ================================================================== - @echo ESMFMKFILE=$(ESMFMKFILE) - @echo ================================================================== - @cat $(ESMFMKFILE) - @echo ================================================================== - -edit: - nedit ocn.F90 & diff --git a/AtmOcnSelectExternalProto/OcnModelA/ocn.F90 b/AtmOcnSelectExternalProto/OcnModelA/ocn.F90 deleted file mode 100644 index 0678223..0000000 --- a/AtmOcnSelectExternalProto/OcnModelA/ocn.F90 +++ /dev/null @@ -1,312 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright (c) 2002-2023, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -module ocnA - - !----------------------------------------------------------------------------- - ! OCN Component. - !----------------------------------------------------------------------------- - - use ESMF - use NUOPC - use NUOPC_Model, & - modelSS => SetServices - - use FRONT_OCNCOMMON - - implicit none - - private - - public SetServices - - !----------------------------------------------------------------------------- - contains - !----------------------------------------------------------------------------- - - subroutine SetServices(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! derive from NUOPC_Model - call NUOPC_CompDerive(model, modelSS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! specialize model - call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & - specRoutine=Advertise, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & - specRoutine=Realize, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & - specRoutine=SetClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(model, specLabel=label_Advance, & - specRoutine=Advance, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine Advertise(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_State) :: importState, exportState - - rc = ESMF_SUCCESS - - ! query for importState and exportState - call NUOPC_ModelGet(model, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! importable field: air_pressure_at_sea_level - call NUOPC_Advertise(importState, & - StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! importable field: surface_net_downward_shortwave_flux - call NUOPC_Advertise(importState, & - StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: sea_surface_temperature - call NUOPC_Advertise(exportState, & - StandardName="sea_surface_temperature", name="sst", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set Component name so it becomes identifiable - call ESMF_GridCompSet(model, name="ocnA", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! call into procedure from FRONT_OCNCOMMON module - call procedure_ocnCommon(rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine Realize(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_State) :: importState, exportState - type(ESMF_TimeInterval) :: stabilityTimeStep - type(ESMF_Field) :: field - type(ESMF_Grid) :: gridIn - type(ESMF_Grid) :: gridOut - - rc = ESMF_SUCCESS - - ! query for importState and exportState - call NUOPC_ModelGet(model, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! create a Grid object for Fields - gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 10/), & - minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & - maxCornerCoord=(/100._ESMF_KIND_R8, 200._ESMF_KIND_R8/), & - coordSys=ESMF_COORDSYS_CART, staggerLocList=(/ESMF_STAGGERLOC_CENTER/), & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - gridOut = gridIn ! for now out same as in - - ! importable field: air_pressure_at_sea_level - field = ESMF_FieldCreate(name="pmsl", grid=gridIn, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(importState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! importable field: surface_net_downward_shortwave_flux - field = ESMF_FieldCreate(name="rsns", grid=gridIn, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(importState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: sea_surface_temperature - field = ESMF_FieldCreate(name="sst", grid=gridOut, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(exportState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine SetClock(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_TimeInterval) :: stabilityTimeStep - - rc = ESMF_SUCCESS - - ! query for clock - call NUOPC_ModelGet(model, modelClock=clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! initialize internal clock - ! here: parent Clock and stability timeStep determine actual model timeStep - !TODO: stabilityTimeStep should be read in from configuation - !TODO: or computed from internal Grid information - call ESMF_TimeIntervalSet(stabilityTimeStep, m=5, rc=rc) ! 5 minute steps - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSetClock(model, clock, stabilityTimeStep, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine Advance(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_State) :: importState, exportState - type(ESMF_Time) :: currTime - type(ESMF_TimeInterval) :: timeStep - character(len=160) :: msgString - - rc = ESMF_SUCCESS - - ! query for clock, importState and exportState - call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - - ! Because of the way that the internal Clock was set in SetClock(), - ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the Advance() routine. Every time the currTime - ! will come in by one internal timeStep advanced. This goes until the - ! stopTime of the internal Clock has been reached. - - call ESMF_ClockPrint(clock, options="currTime", & - preString="------>Advancing OCN from: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_TimePrint(currTime + timeStep, & - preString="---------------------> to: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - -end module diff --git a/AtmOcnSelectExternalProto/OcnModelB/Makefile b/AtmOcnSelectExternalProto/OcnModelB/Makefile deleted file mode 100644 index b612e48..0000000 --- a/AtmOcnSelectExternalProto/OcnModelB/Makefile +++ /dev/null @@ -1,96 +0,0 @@ -# GNU Makefile template for user ESMF component - -################################################################################ -################################################################################ -## This Makefile must be able to find the "esmf.mk" Makefile fragment in the ## -## 'include' line below. Following the ESMF User's Guide, a complete ESMF ## -## installation should ensure that a single environment variable "ESMFMKFILE" ## -## is made available on the system. This variable should point to the ## -## "esmf.mk" file. ## -## ## -## This example Makefile uses the "ESMFMKFILE" environment variable. ## -## ## -## If you notice that this Makefile cannot find variable ESMFMKFILE then ## -## please contact the person responsible for the ESMF installation on your ## -## system. ## -## As a work-around you can simply hardcode the path to "esmf.mk" in the ## -## include line below. However, doing so will render this Makefile a lot less ## -## flexible and non-portable. ## -################################################################################ - -ifneq ($(origin ESMFMKFILE), environment) -$(error Environment variable ESMFMKFILE was not set.) -endif - -include $(ESMFMKFILE) - -################################################################################ -# Include self-describing dependencies and accumulate into local variables - -include ../OcnCommon/ocnCommon.mk -DEP_FRONTS := $(DEP_FRONTS) -DFRONT_OCNCOMMON=$(ESMF_DEP_FRONT) -DEP_INCS := $(DEP_INCS) $(addprefix -I, $(ESMF_DEP_INCPATH)) -DEP_CMPL_OBJS := $(DEP_CMPL_OBJS) $(ESMF_DEP_CMPL_OBJS) -DEP_LINK_OBJS := $(DEP_LINK_OBJS) $(ESMF_DEP_LINK_OBJS) -DEP_SHRD_PATH := $(DEP_SHRD_PATH) $(ESMF_DEP_SHRD_PATH) -DEP_SHRD_LIBS := $(DEP_SHRD_LIBS) $(ESMF_DEP_SHRD_LIBS) - -include OcnSub/ocnSub.mk -DEP_FRONTS := $(DEP_FRONTS) -DFRONT_OCNSUB=$(ESMF_DEP_FRONT) -DEP_INCS := $(DEP_INCS) $(addprefix -I, $(ESMF_DEP_INCPATH)) -DEP_CMPL_OBJS := $(DEP_CMPL_OBJS) $(ESMF_DEP_CMPL_OBJS) -DEP_LINK_OBJS := $(DEP_LINK_OBJS) $(ESMF_DEP_LINK_OBJS) -DEP_SHRD_PATH := $(DEP_SHRD_PATH) $(ESMF_DEP_SHRD_PATH) -DEP_SHRD_LIBS := $(DEP_SHRD_LIBS) $(ESMF_DEP_SHRD_LIBS) - -################################################################################ -################################################################################ - -.SUFFIXES: .f90 .F90 .c .C - -%.o : %.f90 - $(ESMF_F90COMPILER) -c $(DEP_FRONTS) $(DEP_INCS) $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREENOCPP) $< - -%.o : %.F90 - $(ESMF_F90COMPILER) -c $(DEP_FRONTS) $(DEP_INCS) $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $< - -%.o : %.c - $(ESMF_CXXCOMPILER) -c $(DEP_FRONTS) $(DEP_INCS) $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -%.o : %.C - $(ESMF_CXXCOMPILER) -c $(DEP_FRONTS) $(DEP_INCS) $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -.PRECIOUS: %.o -%.mk : %.o - @echo "# ESMF self-describing build dependency makefile fragment" > $@ - @echo >> $@ - @echo "ESMF_DEP_FRONT = ocnB" >> $@ - @echo "ESMF_DEP_INCPATH = `pwd`" >> $@ - @echo "ESMF_DEP_CMPL_OBJS = `pwd`/"$< >> $@ - @echo "ESMF_DEP_LINK_OBJS = `pwd`/"$< $(DEP_LINK_OBJS) >> $@ - @echo "ESMF_DEP_SHRD_PATH = " $(DEP_SHRD_PATH) >> $@ - @echo "ESMF_DEP_SHRD_LIBS = " $(DEP_SHRD_LIBS) >> $@ - -# ----------------------------------------------------------------------------- -ocn.mk: - -ocn.o: $(DEP_CMPL_OBJS) - -# ----------------------------------------------------------------------------- -# ----------------------------------------------------------------------------- -.PHONY: dust clean distclean info edit -dust: - rm -f PET*.ESMF_LogFile -clean: - rm -f *.o *.mod *.mk -distclean: dust clean - -info: - @echo ================================================================== - @echo ESMFMKFILE=$(ESMFMKFILE) - @echo ================================================================== - @cat $(ESMFMKFILE) - @echo ================================================================== - -edit: - nedit ocn.F90 & diff --git a/AtmOcnSelectExternalProto/OcnModelB/OcnSub/Makefile b/AtmOcnSelectExternalProto/OcnModelB/OcnSub/Makefile deleted file mode 100644 index a4a1ac5..0000000 --- a/AtmOcnSelectExternalProto/OcnModelB/OcnSub/Makefile +++ /dev/null @@ -1,76 +0,0 @@ -# GNU Makefile template for user ESMF component - -################################################################################ -################################################################################ -## This Makefile must be able to find the "esmf.mk" Makefile fragment in the ## -## 'include' line below. Following the ESMF User's Guide, a complete ESMF ## -## installation should ensure that a single environment variable "ESMFMKFILE" ## -## is made available on the system. This variable should point to the ## -## "esmf.mk" file. ## -## ## -## This example Makefile uses the "ESMFMKFILE" environment variable. ## -## ## -## If you notice that this Makefile cannot find variable ESMFMKFILE then ## -## please contact the person responsible for the ESMF installation on your ## -## system. ## -## As a work-around you can simply hardcode the path to "esmf.mk" in the ## -## include line below. However, doing so will render this Makefile a lot less ## -## flexible and non-portable. ## -################################################################################ - -ifneq ($(origin ESMFMKFILE), environment) -$(error Environment variable ESMFMKFILE was not set.) -endif - -include $(ESMFMKFILE) - -################################################################################ -################################################################################ - -.SUFFIXES: .f90 .F90 .c .C - -%.o : %.f90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREENOCPP) $< - -%.o : %.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $< - -%.o : %.c - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -% : %.C - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -.PRECIOUS: %.o - -%.mk : %.o - @echo "# ESMF self-describing build dependency makefile fragment" > $@ - @echo >> $@ - @echo "ESMF_DEP_FRONT = ocnSub" >> $@ - @echo "ESMF_DEP_INCPATH = `pwd`" >> $@ - @echo "ESMF_DEP_CMPL_OBJS = `pwd`/"$< >> $@ - @echo "ESMF_DEP_LINK_OBJS = `pwd`/"$< >> $@ - @echo "ESMF_DEP_SHRD_PATH = " >> $@ - @echo "ESMF_DEP_SHRD_LIBS = " >> $@ - -# ----------------------------------------------------------------------------- -ocnSub.mk: - -# ----------------------------------------------------------------------------- -# ----------------------------------------------------------------------------- -.PHONY: dust clean distclean info edit -dust: - rm -f PET*.ESMF_LogFile -clean: - rm -f *.o *.mod *.mk -distclean: dust clean - -info: - @echo ================================================================== - @echo ESMFMKFILE=$(ESMFMKFILE) - @echo ================================================================== - @cat $(ESMFMKFILE) - @echo ================================================================== - -edit: - nedit ocnSub.F90 & diff --git a/AtmOcnSelectExternalProto/OcnModelB/OcnSub/ocnSub.F90 b/AtmOcnSelectExternalProto/OcnModelB/OcnSub/ocnSub.F90 deleted file mode 100644 index fefe843..0000000 --- a/AtmOcnSelectExternalProto/OcnModelB/OcnSub/ocnSub.F90 +++ /dev/null @@ -1,269 +0,0 @@ -module ocnSub - - !----------------------------------------------------------------------------- - ! OCN SUB Component. - !----------------------------------------------------------------------------- - - use ESMF - use NUOPC - use NUOPC_Model, only: & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - - implicit none - - private - - public SetServices - - !----------------------------------------------------------------------------- - contains - !----------------------------------------------------------------------------- - - subroutine SetServices(gcomp, rc) - type(ESMF_GridComp) :: gcomp - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call model_routine_SS(gcomp, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set entry point for methods that require specific implementation - call ESMF_GridCompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP1, phase=1, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_GridCompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP2, phase=2, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! attach specializing method(s) - call ESMF_MethodAdd(gcomp, label=model_label_SetClock, & - userRoutine=SetClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_MethodAdd(gcomp, label=model_label_Advance, & - userRoutine=ModelAdvance, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP1(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! importable field: air_pressure_at_sea_level - call NUOPC_Advertise(importState, & - StandardName="air_pressure_at_sea_level", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! importable field: surface_net_downward_shortwave_flux - call NUOPC_Advertise(importState, & - StandardName="surface_net_downward_shortwave_flux", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: sea_surface_temperature - call NUOPC_Advertise(exportState, & - StandardName="sea_surface_temperature", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set Component name so it becomes identifiable - call ESMF_GridCompSet(gcomp, name="ocnSub", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP2(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - ! local variables - type(ESMF_TimeInterval) :: stabilityTimeStep - type(ESMF_Field) :: field - type(ESMF_Grid) :: gridIn - type(ESMF_Grid) :: gridOut - - rc = ESMF_SUCCESS - - ! create a Grid object for Fields - gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 10/), & - minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & - maxCornerCoord=(/100._ESMF_KIND_R8, 200._ESMF_KIND_R8/), & - coordSys=ESMF_COORDSYS_CART, staggerLocList=(/ESMF_STAGGERLOC_CENTER/), & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - gridOut = gridIn ! for now out same as in - - ! importable field: air_pressure_at_sea_level - field = ESMF_FieldCreate(name="pmsl", grid=gridIn, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(importState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! importable field: surface_net_downward_shortwave_flux - field = ESMF_FieldCreate(name="rsns", grid=gridIn, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(importState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: sea_surface_temperature - field = ESMF_FieldCreate(name="sst", grid=gridOut, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(exportState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine SetClock(gcomp, rc) - type(ESMF_GridComp) :: gcomp - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_TimeInterval) :: stabilityTimeStep - - rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState - call ESMF_GridCompGet(gcomp, clock=clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! initialize internal clock - ! here: parent Clock and stability timeStep determine actual model timeStep - !TODO: stabilityTimeStep should be read in from configuation - !TODO: or computed from internal Grid information - call ESMF_TimeIntervalSet(stabilityTimeStep, m=5, rc=rc) ! 5 minute steps - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSetClock(gcomp, clock, stabilityTimeStep, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine ModelAdvance(gcomp, rc) - type(ESMF_GridComp) :: gcomp - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_State) :: importState, exportState - type(ESMF_Time) :: currTime - type(ESMF_TimeInterval) :: timeStep - - rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState - call ESMF_GridCompGet(gcomp, clock=clock, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - - ! Because of the way that the internal Clock was set in SetClock(), - ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime - ! will come in by one internal timeStep advanced. This goes until the - ! stopTime of the internal Clock has been reached. - - call ESMF_ClockPrint(clock, options="currTime", & - preString="------>Advancing OCN from: ", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_TimePrint(currTime + timeStep, & - preString="--------------------------------> to: ", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - -end module diff --git a/AtmOcnSelectExternalProto/OcnModelB/ocn.F90 b/AtmOcnSelectExternalProto/OcnModelB/ocn.F90 deleted file mode 100644 index 3675950..0000000 --- a/AtmOcnSelectExternalProto/OcnModelB/ocn.F90 +++ /dev/null @@ -1,313 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright (c) 2002-2023, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -module ocnB - - !----------------------------------------------------------------------------- - ! OCN Component. - !----------------------------------------------------------------------------- - - use ESMF - use NUOPC - use NUOPC_Model, & - modelSS => SetServices - - use FRONT_OCNCOMMON - use FRONT_OCNSUB, only: sub_SS => SetServices - - implicit none - - private - - public SetServices - - !----------------------------------------------------------------------------- - contains - !----------------------------------------------------------------------------- - - subroutine SetServices(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! derive from NUOPC_Model - call NUOPC_CompDerive(model, modelSS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! specialize model - call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & - specRoutine=Advertise, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & - specRoutine=Realize, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & - specRoutine=SetClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(model, specLabel=label_Advance, & - specRoutine=Advance, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine Advertise(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_State) :: importState, exportState - - rc = ESMF_SUCCESS - - ! query for importState and exportState - call NUOPC_ModelGet(model, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! importable field: air_pressure_at_sea_level - call NUOPC_Advertise(importState, & - StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! importable field: surface_net_downward_shortwave_flux - call NUOPC_Advertise(importState, & - StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: sea_surface_temperature - call NUOPC_Advertise(exportState, & - StandardName="sea_surface_temperature", name="sst", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set Component name so it becomes identifiable - call ESMF_GridCompSet(model, name="ocnB", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! call into procedure from FRONT_OCNCOMMON module - call procedure_ocnCommon(rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine Realize(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_State) :: importState, exportState - type(ESMF_TimeInterval) :: stabilityTimeStep - type(ESMF_Field) :: field - type(ESMF_Grid) :: gridIn - type(ESMF_Grid) :: gridOut - - rc = ESMF_SUCCESS - - ! query for importState and exportState - call NUOPC_ModelGet(model, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! create a Grid object for Fields - gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 10/), & - minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & - maxCornerCoord=(/100._ESMF_KIND_R8, 200._ESMF_KIND_R8/), & - coordSys=ESMF_COORDSYS_CART, staggerLocList=(/ESMF_STAGGERLOC_CENTER/), & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - gridOut = gridIn ! for now out same as in - - ! importable field: air_pressure_at_sea_level - field = ESMF_FieldCreate(name="pmsl", grid=gridIn, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(importState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! importable field: surface_net_downward_shortwave_flux - field = ESMF_FieldCreate(name="rsns", grid=gridIn, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(importState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: sea_surface_temperature - field = ESMF_FieldCreate(name="sst", grid=gridOut, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(exportState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine SetClock(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_TimeInterval) :: stabilityTimeStep - - rc = ESMF_SUCCESS - - ! query for clock - call NUOPC_ModelGet(model, modelClock=clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! initialize internal clock - ! here: parent Clock and stability timeStep determine actual model timeStep - !TODO: stabilityTimeStep should be read in from configuation - !TODO: or computed from internal Grid information - call ESMF_TimeIntervalSet(stabilityTimeStep, m=5, rc=rc) ! 5 minute steps - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSetClock(model, clock, stabilityTimeStep, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine Advance(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_State) :: importState, exportState - type(ESMF_Time) :: currTime - type(ESMF_TimeInterval) :: timeStep - character(len=160) :: msgString - - rc = ESMF_SUCCESS - - ! query for clock, importState and exportState - call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - - ! Because of the way that the internal Clock was set in SetClock(), - ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the Advance() routine. Every time the currTime - ! will come in by one internal timeStep advanced. This goes until the - ! stopTime of the internal Clock has been reached. - - call ESMF_ClockPrint(clock, options="currTime", & - preString="------>Advancing OCN from: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_TimePrint(currTime + timeStep, & - preString="---------------------> to: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - -end module diff --git a/AtmOcnSelectExternalProto/OcnModelC/Makefile b/AtmOcnSelectExternalProto/OcnModelC/Makefile deleted file mode 100644 index 7d83070..0000000 --- a/AtmOcnSelectExternalProto/OcnModelC/Makefile +++ /dev/null @@ -1,103 +0,0 @@ -# GNU Makefile template for user ESMF component - -################################################################################ -################################################################################ -## This Makefile must be able to find the "esmf.mk" Makefile fragment in the ## -## 'include' line below. Following the ESMF User's Guide, a complete ESMF ## -## installation should ensure that a single environment variable "ESMFMKFILE" ## -## is made available on the system. This variable should point to the ## -## "esmf.mk" file. ## -## ## -## This example Makefile uses the "ESMFMKFILE" environment variable. ## -## ## -## If you notice that this Makefile cannot find variable ESMFMKFILE then ## -## please contact the person responsible for the ESMF installation on your ## -## system. ## -## As a work-around you can simply hardcode the path to "esmf.mk" in the ## -## include line below. However, doing so will render this Makefile a lot less ## -## flexible and non-portable. ## -################################################################################ - -ifneq ($(origin ESMFMKFILE), environment) -$(error Environment variable ESMFMKFILE was not set.) -endif - -include $(ESMFMKFILE) - -################################################################################ -# Need a variable that contains only a comma for some of the operations below -COMMA := , - -################################################################################ -# Include self-describing dependencies and accumulate into local variables - -include ../OcnCommon/ocnCommon.mk -DEP_FRONTS := $(DEP_FRONTS) -DFRONT_OCNCOMMON=$(ESMF_DEP_FRONT) -DEP_INCS := $(DEP_INCS) $(addprefix -I, $(ESMF_DEP_INCPATH)) -DEP_CMPL_OBJS := $(DEP_CMPL_OBJS) $(ESMF_DEP_CMPL_OBJS) -DEP_LINK_OBJS := $(DEP_LINK_OBJS) $(ESMF_DEP_LINK_OBJS) -DEP_SHRD_PATH := $(DEP_SHRD_PATH) $(addprefix -L, $(ESMF_DEP_SHRD_PATH)) $(addprefix -Wl$(COMMA)-rpath$(COMMA), $(ESMF_DEP_SHRD_PATH)) -DEP_SHRD_LIBS := $(DEP_SHRD_LIBS) $(addprefix -l, $(ESMF_DEP_SHRD_LIBS)) - -include OcnSub/ocnSub.mk -DEP_FRONTS := $(DEP_FRONTS) -DFRONT_OCNSUB=$(ESMF_DEP_FRONT) -DEP_INCS := $(DEP_INCS) $(addprefix -I, $(ESMF_DEP_INCPATH)) -DEP_CMPL_OBJS := $(DEP_CMPL_OBJS) $(ESMF_DEP_CMPL_OBJS) -DEP_LINK_OBJS := $(DEP_LINK_OBJS) $(ESMF_DEP_LINK_OBJS) -DEP_SHRD_PATH := $(DEP_SHRD_PATH) $(addprefix -L, $(ESMF_DEP_SHRD_PATH)) $(addprefix -Wl$(COMMA)-rpath$(COMMA), $(ESMF_DEP_SHRD_PATH)) -DEP_SHRD_LIBS := $(DEP_SHRD_LIBS) $(addprefix -l, $(ESMF_DEP_SHRD_LIBS)) - -################################################################################ -################################################################################ - -.SUFFIXES: .f90 .F90 .c .C - -%.o : %.f90 - $(ESMF_F90COMPILER) -c $(DEP_FRONTS) $(DEP_INCS) $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREENOCPP) $< - -%.o : %.F90 - $(ESMF_F90COMPILER) -c $(DEP_FRONTS) $(DEP_INCS) $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $< - -%.o : %.c - $(ESMF_CXXCOMPILER) -c $(DEP_FRONTS) $(DEP_INCS) $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -%.o : %.C - $(ESMF_CXXCOMPILER) -c $(DEP_FRONTS) $(DEP_INCS) $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -.PRECIOUS: %.so -%.mk : %.so - @echo "# ESMF self-describing build dependency makefile fragment" > $@ - @echo >> $@ - @echo "ESMF_DEP_FRONT = "$< >> $@ - @echo "ESMF_DEP_INCPATH = " >> $@ - @echo "ESMF_DEP_CMPL_OBJS = " >> $@ - @echo "ESMF_DEP_LINK_OBJS = " >> $@ - @echo "ESMF_DEP_SHRD_PATH = " >> $@ - @echo "ESMF_DEP_SHRD_LIBS = " >> $@ - -# ----------------------------------------------------------------------------- -ocn.mk: - -# - build everything (including dependencies) into a single shared object -ocn.so: ocn.o $(DEP_CMPL_OBJS) - $(ESMF_CXXLINKER) -shared -o $@ $< $(DEP_LINK_OBJS) $(DEP_SHRD_PATH) $(DEP_SHRD_LIBS) $(ESMF_CXXLINKPATHS) $(ESMF_CXXESMFLINKLIBS) - rm -f $< - -# ----------------------------------------------------------------------------- -# ----------------------------------------------------------------------------- -.PHONY: dust clean distclean info edit -dust: - rm -f PET*.ESMF_LogFile -clean: - rm -f *.o *.so *.mod *.mk -distclean: dust clean - -info: - @echo ================================================================== - @echo ESMFMKFILE=$(ESMFMKFILE) - @echo ================================================================== - @cat $(ESMFMKFILE) - @echo ================================================================== - -edit: - nedit ocn.F90 & diff --git a/AtmOcnSelectExternalProto/OcnModelC/OcnSub/Makefile b/AtmOcnSelectExternalProto/OcnModelC/OcnSub/Makefile deleted file mode 100644 index a4a1ac5..0000000 --- a/AtmOcnSelectExternalProto/OcnModelC/OcnSub/Makefile +++ /dev/null @@ -1,76 +0,0 @@ -# GNU Makefile template for user ESMF component - -################################################################################ -################################################################################ -## This Makefile must be able to find the "esmf.mk" Makefile fragment in the ## -## 'include' line below. Following the ESMF User's Guide, a complete ESMF ## -## installation should ensure that a single environment variable "ESMFMKFILE" ## -## is made available on the system. This variable should point to the ## -## "esmf.mk" file. ## -## ## -## This example Makefile uses the "ESMFMKFILE" environment variable. ## -## ## -## If you notice that this Makefile cannot find variable ESMFMKFILE then ## -## please contact the person responsible for the ESMF installation on your ## -## system. ## -## As a work-around you can simply hardcode the path to "esmf.mk" in the ## -## include line below. However, doing so will render this Makefile a lot less ## -## flexible and non-portable. ## -################################################################################ - -ifneq ($(origin ESMFMKFILE), environment) -$(error Environment variable ESMFMKFILE was not set.) -endif - -include $(ESMFMKFILE) - -################################################################################ -################################################################################ - -.SUFFIXES: .f90 .F90 .c .C - -%.o : %.f90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREENOCPP) $< - -%.o : %.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $< - -%.o : %.c - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -% : %.C - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -.PRECIOUS: %.o - -%.mk : %.o - @echo "# ESMF self-describing build dependency makefile fragment" > $@ - @echo >> $@ - @echo "ESMF_DEP_FRONT = ocnSub" >> $@ - @echo "ESMF_DEP_INCPATH = `pwd`" >> $@ - @echo "ESMF_DEP_CMPL_OBJS = `pwd`/"$< >> $@ - @echo "ESMF_DEP_LINK_OBJS = `pwd`/"$< >> $@ - @echo "ESMF_DEP_SHRD_PATH = " >> $@ - @echo "ESMF_DEP_SHRD_LIBS = " >> $@ - -# ----------------------------------------------------------------------------- -ocnSub.mk: - -# ----------------------------------------------------------------------------- -# ----------------------------------------------------------------------------- -.PHONY: dust clean distclean info edit -dust: - rm -f PET*.ESMF_LogFile -clean: - rm -f *.o *.mod *.mk -distclean: dust clean - -info: - @echo ================================================================== - @echo ESMFMKFILE=$(ESMFMKFILE) - @echo ================================================================== - @cat $(ESMFMKFILE) - @echo ================================================================== - -edit: - nedit ocnSub.F90 & diff --git a/AtmOcnSelectExternalProto/OcnModelC/OcnSub/ocnSub.F90 b/AtmOcnSelectExternalProto/OcnModelC/OcnSub/ocnSub.F90 deleted file mode 100644 index fefe843..0000000 --- a/AtmOcnSelectExternalProto/OcnModelC/OcnSub/ocnSub.F90 +++ /dev/null @@ -1,269 +0,0 @@ -module ocnSub - - !----------------------------------------------------------------------------- - ! OCN SUB Component. - !----------------------------------------------------------------------------- - - use ESMF - use NUOPC - use NUOPC_Model, only: & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - - implicit none - - private - - public SetServices - - !----------------------------------------------------------------------------- - contains - !----------------------------------------------------------------------------- - - subroutine SetServices(gcomp, rc) - type(ESMF_GridComp) :: gcomp - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call model_routine_SS(gcomp, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set entry point for methods that require specific implementation - call ESMF_GridCompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP1, phase=1, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_GridCompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP2, phase=2, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! attach specializing method(s) - call ESMF_MethodAdd(gcomp, label=model_label_SetClock, & - userRoutine=SetClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_MethodAdd(gcomp, label=model_label_Advance, & - userRoutine=ModelAdvance, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP1(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! importable field: air_pressure_at_sea_level - call NUOPC_Advertise(importState, & - StandardName="air_pressure_at_sea_level", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! importable field: surface_net_downward_shortwave_flux - call NUOPC_Advertise(importState, & - StandardName="surface_net_downward_shortwave_flux", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: sea_surface_temperature - call NUOPC_Advertise(exportState, & - StandardName="sea_surface_temperature", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set Component name so it becomes identifiable - call ESMF_GridCompSet(gcomp, name="ocnSub", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP2(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - ! local variables - type(ESMF_TimeInterval) :: stabilityTimeStep - type(ESMF_Field) :: field - type(ESMF_Grid) :: gridIn - type(ESMF_Grid) :: gridOut - - rc = ESMF_SUCCESS - - ! create a Grid object for Fields - gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 10/), & - minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & - maxCornerCoord=(/100._ESMF_KIND_R8, 200._ESMF_KIND_R8/), & - coordSys=ESMF_COORDSYS_CART, staggerLocList=(/ESMF_STAGGERLOC_CENTER/), & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - gridOut = gridIn ! for now out same as in - - ! importable field: air_pressure_at_sea_level - field = ESMF_FieldCreate(name="pmsl", grid=gridIn, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(importState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! importable field: surface_net_downward_shortwave_flux - field = ESMF_FieldCreate(name="rsns", grid=gridIn, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(importState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: sea_surface_temperature - field = ESMF_FieldCreate(name="sst", grid=gridOut, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(exportState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine SetClock(gcomp, rc) - type(ESMF_GridComp) :: gcomp - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_TimeInterval) :: stabilityTimeStep - - rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState - call ESMF_GridCompGet(gcomp, clock=clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! initialize internal clock - ! here: parent Clock and stability timeStep determine actual model timeStep - !TODO: stabilityTimeStep should be read in from configuation - !TODO: or computed from internal Grid information - call ESMF_TimeIntervalSet(stabilityTimeStep, m=5, rc=rc) ! 5 minute steps - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSetClock(gcomp, clock, stabilityTimeStep, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine ModelAdvance(gcomp, rc) - type(ESMF_GridComp) :: gcomp - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_State) :: importState, exportState - type(ESMF_Time) :: currTime - type(ESMF_TimeInterval) :: timeStep - - rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState - call ESMF_GridCompGet(gcomp, clock=clock, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - - ! Because of the way that the internal Clock was set in SetClock(), - ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime - ! will come in by one internal timeStep advanced. This goes until the - ! stopTime of the internal Clock has been reached. - - call ESMF_ClockPrint(clock, options="currTime", & - preString="------>Advancing OCN from: ", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_TimePrint(currTime + timeStep, & - preString="--------------------------------> to: ", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - -end module diff --git a/AtmOcnSelectExternalProto/OcnModelC/ocn.F90 b/AtmOcnSelectExternalProto/OcnModelC/ocn.F90 deleted file mode 100644 index 39150be..0000000 --- a/AtmOcnSelectExternalProto/OcnModelC/ocn.F90 +++ /dev/null @@ -1,331 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright (c) 2002-2023, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -module ocnC - - !----------------------------------------------------------------------------- - ! OCN Component. - !----------------------------------------------------------------------------- - - use ESMF - use NUOPC - use NUOPC_Model, & - modelSS => SetServices - - use FRONT_OCNCOMMON - use FRONT_OCNSUB, only: sub_SS => SetServices - - implicit none - - private - - public SetVM, SetServices - - !----------------------------------------------------------------------------- - contains - !----------------------------------------------------------------------------- - - subroutine SetServices(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! derive from NUOPC_Model - call NUOPC_CompDerive(model, modelSS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! specialize model - call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & - specRoutine=Advertise, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & - specRoutine=Realize, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & - specRoutine=SetClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(model, specLabel=label_Advance, & - specRoutine=Advance, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine Advertise(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_State) :: importState, exportState - - rc = ESMF_SUCCESS - - ! query for importState and exportState - call NUOPC_ModelGet(model, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! importable field: air_pressure_at_sea_level - call NUOPC_Advertise(importState, & - StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! importable field: surface_net_downward_shortwave_flux - call NUOPC_Advertise(importState, & - StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: sea_surface_temperature - call NUOPC_Advertise(exportState, & - StandardName="sea_surface_temperature", name="sst", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set Component name so it becomes identifiable - call ESMF_GridCompSet(model, name="ocnC", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! call into procedure from FRONT_OCNCOMMON module - call procedure_ocnCommon(rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine Realize(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_State) :: importState, exportState - type(ESMF_TimeInterval) :: stabilityTimeStep - type(ESMF_Field) :: field - type(ESMF_Grid) :: gridIn - type(ESMF_Grid) :: gridOut - - rc = ESMF_SUCCESS - - ! query for importState and exportState - call NUOPC_ModelGet(model, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! create a Grid object for Fields - gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 10/), & - minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & - maxCornerCoord=(/100._ESMF_KIND_R8, 200._ESMF_KIND_R8/), & - coordSys=ESMF_COORDSYS_CART, staggerLocList=(/ESMF_STAGGERLOC_CENTER/), & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - gridOut = gridIn ! for now out same as in - - ! importable field: air_pressure_at_sea_level - field = ESMF_FieldCreate(name="pmsl", grid=gridIn, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(importState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! importable field: surface_net_downward_shortwave_flux - field = ESMF_FieldCreate(name="rsns", grid=gridIn, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(importState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: sea_surface_temperature - field = ESMF_FieldCreate(name="sst", grid=gridOut, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(exportState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine SetClock(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_TimeInterval) :: stabilityTimeStep - - rc = ESMF_SUCCESS - - ! query for clock - call NUOPC_ModelGet(model, modelClock=clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! initialize internal clock - ! here: parent Clock and stability timeStep determine actual model timeStep - !TODO: stabilityTimeStep should be read in from configuation - !TODO: or computed from internal Grid information - call ESMF_TimeIntervalSet(stabilityTimeStep, m=5, rc=rc) ! 5 minute steps - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSetClock(model, clock, stabilityTimeStep, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine Advance(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_State) :: importState, exportState - type(ESMF_Time) :: currTime - type(ESMF_TimeInterval) :: timeStep - character(len=160) :: msgString - - rc = ESMF_SUCCESS - - ! query for clock, importState and exportState - call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - - ! Because of the way that the internal Clock was set in SetClock(), - ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the Advance() routine. Every time the currTime - ! will come in by one internal timeStep advanced. This goes until the - ! stopTime of the internal Clock has been reached. - - call ESMF_ClockPrint(clock, options="currTime", & - preString="------>Advancing OCN from: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_TimePrint(currTime + timeStep, & - preString="---------------------> to: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - -end module - -! External access to SetVM -subroutine SetVM(comp, rc) - use ESMF - use ocnC, only: SetVMModule => SetVM - type(ESMF_GridComp) :: comp - integer, intent(out) :: rc - call SetVMModule(comp, rc) -end subroutine - -! External access to SetServices -subroutine SetServices(comp, rc) - use ESMF - use ocnC, only: SetServicesModule => SetServices - type(ESMF_GridComp) :: comp - integer, intent(out) :: rc - call SetServicesModule(comp, rc) -end subroutine diff --git a/AtmOcnSelectExternalProto/README b/AtmOcnSelectExternalProto/README deleted file mode 100644 index 2ef18f7..0000000 --- a/AtmOcnSelectExternalProto/README +++ /dev/null @@ -1,108 +0,0 @@ -README for ATM-OCN Select External NUOPC prototype --------------------------------------------------- - -Demonstrate how to implement external component dependencies in NUOPC based -application code. At the same time selection between alternative component -options is shown on the driver level. - -Description: - - The term "external components" means that a component is build from source - outside of the build procedure of the code that actually uses the component. - The same component object file could be used by multiple applications. - The external nature of a component is only visible on the build level, - and does not affect how the component is used from within the calling code. - The build level uses GNU makefile fragments to handle external component - dependencies. - - Within each external component subdirectory a Makefile exisits that locally - builds the component object file, but also produces a file with the extension - ".mk". This is a makefile fragment that contains all the necessary - information needed to compile and link against the external component. The - Makefile of the main application that uses an external component includes the - makefile fragment and uses the defined variables to express the build rules - for the depending local source files. - - The component selection mechanism inside the driver code is unaffected by - the fact that some or all components are provided externally. Two basic - selection mechanisms exist: - 1) compile-time selection, e.g. via pre-processor macros - 2) run-time selection, e.g. via configuration file attribute - Both mechanisms are supported, and can be mixed. - - The esm.F90 code is where the selection occurs between atmA, atmB, and atmC, - as well as between ocnA and ocnB. - - * Selection between atmA, atmB, and atmC is purely a compile-time selection - based on the FRONT_ATMA, FRONT_ATMB, and FRONT_ATMC macros. The code - switches the atmSS association according to these macros and preprocessor - conditionals are in place to ensure that these three options are mutually - execlusive. - - * Selection between ocnA and ocnB is a combined compile-time and run-time based - selection. During build time the macros FRONT_OCNA and FRONT_OCNB determine - which options will be available during run-time. Then during run-time an - attribute is read from a configuration file and the actual selection between - ocnA and ocnB is made. An error code is issued if the selection is not - available at run-time, e.g. because it was not built into the code during - compile-time. - - * The Makefile contains code that looks at the ATM and OCN variables to - determine which self-describing component dependency files to inlcude. It - is in these conditionals where the FRONT_ATMA, FRONT_ATMB, FRONT_ATMC, - FRONT_OCNA, FRONT_OCNB macros are set. - - This prototype code demonstrates that there is generally no need for - component wrappers or stubs in codes that use the NUOPC Layer. Instead the - flexibility to select actual component instantiation either during - compile-time and/or run-time is best implemented using standard constructs - within the driver layer. The prototype shows a robust implementation that - catches configuration conflicts at the earliest stage. - -Build: - - Set environment variable ESMFMKFILE to point to the esmf.mk of your ESMF - installation. - - Manually change into each subdirectory and execute "make" to build the - local component. Alternatively the "buildSubs.csh" script can be used - to build all of the external components. This script is only supplied for - convenience, not inteded as a template in real-world applications where the - external components are under their own build mechanism. - - make ATM=B OCN=A,B (or other ATM, OCN settings, see description below) - -Execution: - - Optionally set environment variable ESMF_RUNTIME_COMPLIANCECHECK to ON. - - mpirun -np X ./esmApp (where X is the total number of PETs) - -Output: - - PET*.Log files containing compliance checker output if turned on. - - The prototype outputs time stepping information to stdout. - -Code structure: - - Makefile - Makefile that is based on the standard esmf.mk mechanism. - - esm.F90 - The Earth System Model (ESM) component, specializing generic - NUOPC_Driver. - - esmApp.F90 - ESM driver application. - - esm.config - ESMF configuration - --> ATM-A - subdirectory containing an external ATM model, only depending - on a single source file. - --> ATM-B - subdirectory containing another external ATM model, depending - on two source files, both of which are provided as objects. - --> ATM-C - subdirectory containing same external ATM model as ATM-B, but - this time the objects are provided as a single static archive. - --> ATM-D - subdirectory containing an external ATM model, only depending - on a single source file. Supply this component in form of a - shared library. - --> ATM-E - subdirectory containing an external ATM model, only depending - on a single source file. Supply this component in form of a - shared object. - --> ATM-F - subdirectory containing an external ATM model, only depending - on a single source file written in C. - --> OcnModelA - subdirectory containing an external OCN model which depends - on some common files in another subdir. - --> OcnModelB - subdirectory containing another external OCN model which - also depends on the same common files in another subdir but - has additional subdir dependencies. - --> OcnModelC - subdirectory containing another external OCN model which - also depends on the same common files in another subdir but - has additional subdir dependencies. Supply this component in - form of a shared object with all dependencies linked in. diff --git a/AtmOcnSelectExternalProto/buildSubs.sh b/AtmOcnSelectExternalProto/buildSubs.sh deleted file mode 100755 index 8461a05..0000000 --- a/AtmOcnSelectExternalProto/buildSubs.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh - -cd ATM-A -make distclean; make -cd .. - -cd ATM-B -make distclean; make -cd .. - -cd ATM-C -make distclean; make -cd .. - -cd ATM-D -make distclean; make -cp libatmD.so ../atmD.so -cd .. - -cd ATM-E -make distclean; make -mv atmE.so .. -cd .. - -cd ATM-F -make distclean; make -cd .. - -cd OcnCommon -make distclean; make -cd .. - -cd OcnModelA -make distclean; make -cd .. - -cd OcnModelB/OcnSub -make distclean; make -cd ../.. - -cd OcnModelB -make distclean; make -cd .. - -cd OcnModelC/OcnSub -make distclean; make -cd ../.. - -cd OcnModelC -make distclean; make -mv ocn.so .. -cd .. diff --git a/AtmOcnSelectExternalProto/cleanSubs.sh b/AtmOcnSelectExternalProto/cleanSubs.sh deleted file mode 100755 index c9172b1..0000000 --- a/AtmOcnSelectExternalProto/cleanSubs.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh - -cd ATM-A -make distclean -cd .. - -cd ATM-B -make distclean -cd .. - -cd ATM-C -make distclean -cd .. - -cd ATM-D -make distclean -cd .. - -cd ATM-E -make distclean -cd .. - -cd ATM-F -make distclean -cd .. - -cd OcnModelA -make distclean -cd .. - -cd OcnModelB -make distclean -cd .. - -cd OcnModelB/OcnSub -make distclean -cd ../.. - -cd OcnModelC -make distclean -cd .. - -cd OcnModelC/OcnSub -make distclean -cd ../.. - -cd OcnCommon -make distclean -cd .. - diff --git a/AtmOcnSelectExternalProto/esm.F90 b/AtmOcnSelectExternalProto/esm.F90 deleted file mode 100644 index 13e2987..0000000 --- a/AtmOcnSelectExternalProto/esm.F90 +++ /dev/null @@ -1,271 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright (c) 2002-2023, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -!- conditional module blocks that support modules maybe being supplied in C -#ifdef FRONT_H_ATMF -module atmF -#include FRONT_H_ATMF -end module -#endif -!-------------------------------------------------------------------------- - -module ESM - - !----------------------------------------------------------------------------- - ! Code that specializes generic ESM Component code. - !----------------------------------------------------------------------------- - - use ESMF - use NUOPC - use NUOPC_Driver, & - driverSS => SetServices - - !- select exactly one ATM component -#if (defined FRONT_ATMA && !defined FRONT_ATMB && !defined FRONT_ATMC && !defined FRONT_ATMD && !defined FRONT_ATME && !defined FRONT_SO_ATME && !defined FRONT_ATMF && !defined FRONT_H_ATMF ) - use FRONT_ATMA, only: atmSS => SetServices -#elif (!defined FRONT_ATMA && defined FRONT_ATMB && !defined FRONT_ATMC && !defined FRONT_ATMD && !defined FRONT_ATME && !defined FRONT_SO_ATME && !defined FRONT_ATMF && !defined FRONT_H_ATMF ) - use FRONT_ATMB, only: atmSS => SetServices -#elif (!defined FRONT_ATMA && !defined FRONT_ATMB && defined FRONT_ATMC && !defined FRONT_ATMD && !defined FRONT_ATME && !defined FRONT_SO_ATME && !defined FRONT_ATMF && !defined FRONT_H_ATMF ) - use FRONT_ATMC, only: atmSS => SetServices -#elif (!defined FRONT_ATMA && !defined FRONT_ATMB && !defined FRONT_ATMC && defined FRONT_ATMD && !defined FRONT_ATME && !defined FRONT_SO_ATME && !defined FRONT_ATMF && !defined FRONT_H_ATMF ) - use FRONT_ATMD, only: atmSS => SetServices -#elif (!defined FRONT_ATMA && !defined FRONT_ATMB && !defined FRONT_ATMC && !defined FRONT_ATMD && defined FRONT_ATME && !defined FRONT_SO_ATME && !defined FRONT_ATMF && !defined FRONT_H_ATMF ) - use FRONT_ATME, only: atmSS => SetServices -#elif (!defined FRONT_ATMA && !defined FRONT_ATMB && !defined FRONT_ATMC && !defined FRONT_ATMD && !defined FRONT_ATME && defined FRONT_SO_ATME && !defined FRONT_ATMF && !defined FRONT_H_ATMF ) -#define ATM_FRONT_SO FRONT_SO_ATME -#elif (!defined FRONT_ATMA && !defined FRONT_ATMB && !defined FRONT_ATMC && !defined FRONT_ATMD && !defined FRONT_ATME && !defined FRONT_SO_ATME && defined FRONT_ATMF && !defined FRONT_H_ATMF ) - use FRONT_ATMF, only: atmSS => SetServices -#elif (!defined FRONT_ATMA && !defined FRONT_ATMB && !defined FRONT_ATMC && !defined FRONT_ATMD && !defined FRONT_ATME && !defined FRONT_SO_ATME && !defined FRONT_ATMF && defined FRONT_H_ATMF ) - use atmF, only: atmSS => FRONT_H_ATMF_SS -#else -#error "Exactly one valid ATM option must be specified!" -#endif - - !- select as many OCN components as specified -#ifdef FRONT_OCNA - use FRONT_OCNA, only: ocnA_SS => SetServices -#endif -#ifdef FRONT_OCNB - use FRONT_OCNB, only: ocnB_SS => SetServices -#endif - - use NUOPC_Connector, only: cplSS => SetServices - - implicit none - - private - - public SetServices - - !----------------------------------------------------------------------------- - contains - !----------------------------------------------------------------------------- - - subroutine SetServices(driver, rc) - type(ESMF_GridComp) :: driver - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! derive from NUOPC_Driver - call NUOPC_CompDerive(driver, driverSS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! specialize driver - call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & - specRoutine=SetModelServices, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set driver verbosity - call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine SetModelServices(driver, rc) - type(ESMF_GridComp) :: driver - integer, intent(out) :: rc - - ! local variables - type(ESMF_Grid) :: grid - type(ESMF_Field) :: field - type(ESMF_Time) :: startTime - type(ESMF_Time) :: stopTime - type(ESMF_TimeInterval) :: timeStep - type(ESMF_Clock) :: internalClock - type(ESMF_Config) :: config - character(len=1) :: ocn_select - character(len=80) :: logMsg - type(ESMF_GridComp) :: child - type(ESMF_CplComp) :: connector - - rc = ESMF_SUCCESS - - ! Create and read Config - config = ESMF_ConfigCreate(rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ConfigLoadFile(config, "esm.config", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ConfigGetAttribute(config, value=ocn_select, label="OCN_SELECT:",& - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ConfigDestroy(config, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! SetServices for ATM -#ifndef ATM_FRONT_SO - call NUOPC_DriverAddComp(driver, "ATM", atmSS, comp=child, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#else - call NUOPC_DriverAddComp(driver, "ATM", & - sharedObj="./"//ATM_FRONT_SO, comp=child, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! SetServices for OCN - if (.false.) then -#ifdef FRONT_OCNA - elseif (ocn_select=="A") then - call NUOPC_DriverAddComp(driver, "OCN", ocnA_SS, comp=child, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif -#ifdef FRONT_OCNB - elseif (ocn_select=="B") then - call NUOPC_DriverAddComp(driver, "OCN", ocnB_SS, comp=child, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif -#ifdef FRONT_SO_OCNC - elseif (ocn_select=="C") then - call NUOPC_DriverAddComp(driver, "OCN", & - sharedObj="./"//FRONT_SO_OCNC, comp=child, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - else - write (logMsg,*) "Not a valid ocn_select: ", ocn_select - call ESMF_LogSetError(ESMF_RC_ARG_BAD, msg=logMsg, & - line=__LINE__, & - file=__FILE__, & - rcToReturn=rc) - return ! bail out - endif - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! SetServices for atm2ocn - call NUOPC_DriverAddComp(driver, srcCompLabel="ATM", dstCompLabel="OCN", & - compSetServicesRoutine=cplSS, comp=connector, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompAttributeSet(connector, name="Verbosity", value="1", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! SetServices for ocn2atm - call NUOPC_DriverAddComp(driver, srcCompLabel="OCN", dstCompLabel="ATM", & - compSetServicesRoutine=cplSS, comp=connector, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompAttributeSet(connector, name="Verbosity", value="1", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set the driver clock - call ESMF_TimeIntervalSet(timeStep, m=15, rc=rc) ! 15 minute steps - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_TimeSet(startTime, yy=2010, mm=6, dd=1, h=0, m=0, & - calkindflag=ESMF_CALKIND_GREGORIAN, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_TimeSet(stopTime, yy=2010, mm=6, dd=1, h=1, m=0, & - calkindflag=ESMF_CALKIND_GREGORIAN, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - internalClock = ESMF_ClockCreate(name="Application Clock", & - timeStep=timeStep, startTime=startTime, stopTime=stopTime, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - -end module diff --git a/AtmOcnSelectExternalProto/esm.config b/AtmOcnSelectExternalProto/esm.config deleted file mode 100644 index 8859eca..0000000 --- a/AtmOcnSelectExternalProto/esm.config +++ /dev/null @@ -1 +0,0 @@ -OCN_SELECT: C diff --git a/AtmOcnSelectExternalProto/esmApp.F90 b/AtmOcnSelectExternalProto/esmApp.F90 deleted file mode 100644 index a253a7e..0000000 --- a/AtmOcnSelectExternalProto/esmApp.F90 +++ /dev/null @@ -1,106 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright (c) 2002-2023, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -program esmApp - - !----------------------------------------------------------------------------- - ! Generic ESM application driver - !----------------------------------------------------------------------------- - - use ESMF - use ESM, only: esmSS => SetServices - - implicit none - - integer :: rc, urc - type(ESMF_GridComp) :: esmComp - - ! Initialize ESMF - call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & - defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Create the earth system Component - esmComp = ESMF_GridCompCreate(name="esm", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! SetServices for the earth system Component - call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Call Initialize for the earth system Component - call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Call Run for earth the system Component - call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Call Finalize for the earth system Component - call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Destroy the earth system Component - call ESMF_GridCompDestroy(esmComp, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Finalize ESMF - call ESMF_Finalize() - -end program diff --git a/testProtos.sh b/testProtos.sh index e7d5993..f78ef9e 100755 --- a/testProtos.sh +++ b/testProtos.sh @@ -161,137 +161,6 @@ echo --------------------------------------------------------------------------- echo } -function TestSelectExternalProto { -echo --------------------------------------------------------------------------- -date -echo STARTING: $1 -cd $1 -make distclean -./cleanSubs.sh -./buildSubs.sh -#- -make ATM=A OCN=A,B,C -echo "OCN_SELECT: A" > esm.config -((count++)) -testList[count]=$1 -set -x -$ESMF_INTERNAL_MPIRUN -np 4 $TOOLRUN ./$2 > $2.stdout 2>&1 -local result=$? -set +x -if [ $result -eq 0 ] -then -testResult[count]="PASS" -else -testResult[count]="FAIL" -fi -mkdir -p ../$RESULTSDIR -cp $2.stdout ../$RESULTSDIR/$1.1.stdout -cat PET*.ESMF_LogFile > ../$RESULTSDIR/$1.1.Log -echo -make clean -#- -make ATM=B OCN=A,B,C -echo "OCN_SELECT: B" > esm.config -((count++)) -testList[count]=$1 -set -x -$ESMF_INTERNAL_MPIRUN -np 4 $TOOLRUN ./$2 > $2.stdout 2>&1 -local result=$? -set +x -if [ $result -eq 0 ] -then -testResult[count]="PASS" -else -testResult[count]="FAIL" -fi -mkdir -p ../$RESULTSDIR -cp $2.stdout ../$RESULTSDIR/$1.2.stdout -cat PET*.ESMF_LogFile > ../$RESULTSDIR/$1.2.Log -echo -make clean -#- -make ATM=C OCN=A,B,C -echo "OCN_SELECT: C" > esm.config -((count++)) -testList[count]=$1 -set -x -$ESMF_INTERNAL_MPIRUN -np 4 $TOOLRUN ./$2 > $2.stdout 2>&1 -local result=$? -set +x -if [ $result -eq 0 ] -then -testResult[count]="PASS" -else -testResult[count]="FAIL" -fi -mkdir -p ../$RESULTSDIR -cp $2.stdout ../$RESULTSDIR/$1.3.stdout -cat PET*.ESMF_LogFile > ../$RESULTSDIR/$1.3.Log -echo -make clean -#- -make ATM=D OCN=A,B,C -echo "OCN_SELECT: A" > esm.config -((count++)) -testList[count]=$1 -set -x -$ESMF_INTERNAL_MPIRUN -np 4 $TOOLRUN ./$2 > $2.stdout 2>&1 -local result=$? -set +x -if [ $result -eq 0 ] -then -testResult[count]="PASS" -else -testResult[count]="FAIL" -fi -mkdir -p ../$RESULTSDIR -cp $2.stdout ../$RESULTSDIR/$1.4.stdout -cat PET*.ESMF_LogFile > ../$RESULTSDIR/$1.4.Log -echo -make clean -#- -make ATM=E OCN=A,B,C -echo "OCN_SELECT: B" > esm.config -((count++)) -testList[count]=$1 -set -x -$ESMF_INTERNAL_MPIRUN -np 4 $TOOLRUN ./$2 > $2.stdout 2>&1 -local result=$? -set +x -if [ $result -eq 0 ] -then -testResult[count]="PASS" -else -testResult[count]="FAIL" -fi -mkdir -p ../$RESULTSDIR -cp $2.stdout ../$RESULTSDIR/$1.5.stdout -cat PET*.ESMF_LogFile > ../$RESULTSDIR/$1.5.Log -echo -make clean -#- -#make ATM=F OCN=A,B,C -echo "OCN_SELECT: C" > esm.config -#((count++)) -#testList[count]=$1 -#set -x -#$ESMF_INTERNAL_MPIRUN -np 4 ./$2 --- cannot run this because atmF is not fully implemented -#local result=$? -#set +x -#if [ $result -eq 0 ] -#then -#testResult[count]="PASS" -#else -#testResult[count]="FAIL" -#fi -#- -echo FINISHED: $1 -cd .. -date -echo --------------------------------------------------------------------------- -echo -} - function TestExplorer { ((count++)) testList[count]=$1 @@ -419,13 +288,18 @@ TestProto AtmOcnPetListProto esmApp TestProto AtmOcnProto esmApp TestProto AtmOcnRtmTwoTimescalesProto esmApp TestProto AtmOcnScalarProto esmApp -TestSelectExternalProto AtmOcnSelectExternalProto esmApp TestSelectProto AtmOcnSelectProto esmApp TestProto AtmOcnSimpleImplicitProto esmApp TestProto AtmOcnTransferGridProto esmApp TestProto AtmOcnTransferLocStreamProto esmApp TestProto AtmOcnTransferMeshProto esmApp -TestExplorer ComponentExplorer nuopcExplorerApp +#TODO: Currently the ComponentExplorer implementation is based on the deprecated +#TODO: GNU Makefile based component build dependency approach. Consider moving +#TODO: any ComponentExplorer functionality worth preserving into ESMX, then +#TODO: test this approach here. +#TODO: Leaving the following line in as commented out for a reminder of the +#TODO: above for now. +#TestExplorer ComponentExplorer nuopcExplorerApp TestProto CustomFieldDictionaryProto mainApp TestProto DriverInDriverDataDepProto mainApp TestProto DriverInDriverProto mainApp From 2a4315386794fa66ae7c79edeb6348182b655a01 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Wed, 18 Oct 2023 12:16:20 -0700 Subject: [PATCH 08/11] Turn off output of ESMX_Data component... this way prototype can run cleanly even on test systems where we build with out NetCDF enabled. --- ESMX_AtmOcnProto/esmxRunAlt.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ESMX_AtmOcnProto/esmxRunAlt.yaml b/ESMX_AtmOcnProto/esmxRunAlt.yaml index 0f09308..60d5823 100644 --- a/ESMX_AtmOcnProto/esmxRunAlt.yaml +++ b/ESMX_AtmOcnProto/esmxRunAlt.yaml @@ -46,6 +46,8 @@ ATM: precipitation_flux: {dim: 2, val: 3.5} surface_net_downward_shortwave_flux: {dim: 2, val: 4.5} + output: + write_final: false OCN: model: lumo From 9f4a1fd436c35d71f375617d28cebc42103e7c21 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Wed, 25 Oct 2023 17:13:47 -0700 Subject: [PATCH 09/11] Ensure that Darwin systems that use Apple Clang can find libomp. --- testProtos.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/testProtos.sh b/testProtos.sh index f78ef9e..5687830 100755 --- a/testProtos.sh +++ b/testProtos.sh @@ -21,6 +21,17 @@ RESULTSDIR=NUOPC-PROTO-RESULTS count=0 failcount=0 +if [ "$ESMF_OS" = "Darwin" ] +then + # Darwin systems that use Apple Clang need extra environment variables + # to find the libomp installation. These are important for the ESMX + # tests where CMake is used under the hood to determine the correct + # compiler and linker flags. Set them here to be available: + export LDFLAGS=-L/opt/homebrew/opt/libomp/lib + export CXXFLAGS=-I/opt/homebrew/opt/libomp/include + export CFLAGS=-I/opt/homebrew/opt/libomp/include +fi + function TestProto { ((count++)) testList[count]=$1 From eb7f4c2197e15fb9119e41a49ee4a63d5a93bf68 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Wed, 25 Oct 2023 22:06:22 -0700 Subject: [PATCH 10/11] Change OS logic to depend on standard shell variable rather than ESMF variable that is typically not available in this context. --- testProtos.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testProtos.sh b/testProtos.sh index 5687830..d8aa63f 100755 --- a/testProtos.sh +++ b/testProtos.sh @@ -21,7 +21,7 @@ RESULTSDIR=NUOPC-PROTO-RESULTS count=0 failcount=0 -if [ "$ESMF_OS" = "Darwin" ] +if [[ $OSTYPE = *darwin* ]] then # Darwin systems that use Apple Clang need extra environment variables # to find the libomp installation. These are important for the ESMX From 087f34a89acb0d381e934c763fe6164874bbf6bb Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Thu, 26 Oct 2023 09:02:00 -0700 Subject: [PATCH 11/11] Do not depend on explicit F90 interface via keywords since there appears to be some disagreement on the ierror vs ierr keyword used. --- ExternalDriverAPIWeakCplDAProto/externalApp.F90 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ExternalDriverAPIWeakCplDAProto/externalApp.F90 b/ExternalDriverAPIWeakCplDAProto/externalApp.F90 index 7c4d239..000fddb 100644 --- a/ExternalDriverAPIWeakCplDAProto/externalApp.F90 +++ b/ExternalDriverAPIWeakCplDAProto/externalApp.F90 @@ -42,15 +42,15 @@ program externalApp ! Split up the MPI_COMM_WORLD into atmDA (first half) and ocnDA (second half) ! of MPI ranks. Call into the respective DA routine - call MPI_Comm_size(MPI_COMM_WORLD, size, ierror=rc) - call MPI_Comm_rank(MPI_COMM_WORLD, rank, ierror=rc) + call MPI_Comm_size(MPI_COMM_WORLD, size, rc) + call MPI_Comm_rank(MPI_COMM_WORLD, rank, rc) if (rank < size/2) then ! atm DA processes - call MPI_Comm_split(MPI_COMM_WORLD, 1, rank, splitComm, ierror=rc) + call MPI_Comm_split(MPI_COMM_WORLD, 1, rank, splitComm, rc) call atmDAexec(comm=splitComm) else ! ocn DA processes - call MPI_Comm_split(MPI_COMM_WORLD, 2, rank, splitComm, ierror=rc) + call MPI_Comm_split(MPI_COMM_WORLD, 2, rank, splitComm, rc) call ocnDAexec(comm=splitComm) endif