Skip to content

Commit

Permalink
Merge PR #420 'jgfouca/cvmix_bgc_as_subs' into ocean/develop
Browse files Browse the repository at this point in the history
This is a significant change to the structure of the MPAS repository.
Instead of external code dependencies being downloaded by home-grown
scripts, we instead express the dependency as a git submodule. This will
impact the cvmix and BGC dependencies for core_ocean.

I tested building the E3SM case ERS_Ld5.T62_oQU120.CMPASO-NYF with both
the old (Makefile-based) and new (CMake-based) build systems.

For additional discussion, see #3377
  • Loading branch information
mark-petersen committed Mar 20, 2020
2 parents edd7682 + fb0322a commit c4ae651
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 264 deletions.
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# Ignore all cvmix code.
cvmix
.cvmix_all
BGC
.BGC_all
.*.zip

# Ignore processed registry files.
Expand Down
1 change: 1 addition & 0 deletions BGC
Submodule BGC added at 558863
30 changes: 11 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


OCEAN_SHARED_INCLUDES = -I$(PWD)/../framework -I$(PWD)/../external/esmf_time_f90 -I$(PWD)/../operators
OCEAN_SHARED_INCLUDES += -I$(PWD)/BGC -I$(PWD)/shared -I$(PWD)/analysis_members -I$(PWD)/cvmix -I$(PWD)/mode_forward -I$(PWD)/mode_analysis -I$(PWD)/mode_init
OCEAN_SHARED_INCLUDES += -I$(PWD)/BGC -I$(PWD)/shared -I$(PWD)/analysis_members -I$(PWD)/cvmix/src/shared -I$(PWD)/mode_forward -I$(PWD)/mode_analysis -I$(PWD)/mode_init

all: shared libcvmix analysis_members libBGC
(cd mode_forward; $(MAKE) FCINCLUDES="$(FCINCLUDES) $(OCEAN_SHARED_INCLUDES)" all )
Expand Down Expand Up @@ -45,26 +45,18 @@ post_build:
( cp $(ROOT_DIR)/default_inputs/streams.ocean.analysis $(ROOT_DIR)/streams.ocean.analysis )
( cp $(ROOT_DIR)/default_inputs/streams.ocean.init $(ROOT_DIR)/streams.ocean.init )

cvmix_source: get_cvmix.sh
(/bin/bash ./get_cvmix.sh)
(cd cvmix)

BGC_source: get_BGC.sh
(/bin/bash ./get_BGC.sh)
(cd BGC)

libcvmix: cvmix_source
if [ -d cvmix ]; then \
(cd cvmix; make all FC="$(FC)" FCFLAGS="$(FFLAGS)" FINCLUDES="$(FINCLUDES)") \
libcvmix:
if [ -e cvmix/.git ]; then \
(cd cvmix/src/shared; make all FC="$(FC)" FCFLAGS="$(FFLAGS)" FINCLUDES="$(FINCLUDES)") \
else \
(exit 1) \
(pwd ; echo "Missing core_ocean/cvmix/.git, did you forget to 'git submodule update --init --recursive' ?"; exit 1) \
fi

libBGC: BGC_source
if [ -d BGC ]; then \
libBGC:
if [ -e BGC/.git ]; then \
(cd BGC; make all FC="$(FC)" FCFLAGS="$(FFLAGS)" FINCLUDES="$(FINCLUDES)") \
else \
(exit 1) \
(echo "Missing core_ocean/BGC/.git, did you forget to 'git submodule update --init --recursive' ?"; exit 1) \
fi

shared: libcvmix libBGC
Expand All @@ -74,13 +66,13 @@ analysis_members: libcvmix shared
( cd analysis_members; $(MAKE) FCINCLUDES="$(FCINCLUDES) $(OCEAN_SHARED_INCLUDES)" CPPFLAGS="$(CPPFLAGS)" CPPINCLUDES="$(CPPINCLUDES)" all )

clean:
if [ -d cvmix ]; then \
(cd cvmix; make clean) \
if [ -e cvmix/.git ]; then \
(cd cvmix/src/shared; make clean) \
fi
if [ -d inc ]; then \
($(RM) -r inc) \
fi
if [ -d BGC ]; then \
if [ -e BGC/.git ]; then \
(cd BGC; make clean) \
fi
(cd mode_forward; $(MAKE) clean)
Expand Down
1 change: 1 addition & 0 deletions cvmix
Submodule cvmix added at 183c56
107 changes: 0 additions & 107 deletions get_BGC.sh

This file was deleted.

107 changes: 0 additions & 107 deletions get_cvmix.sh

This file was deleted.

50 changes: 24 additions & 26 deletions ocean.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# build_options.mk stuff handled here
list(APPEND CPPDEFS "-DCORE_OCEAN")
list(APPEND INCLUDES "${CMAKE_BINARY_DIR}/core_ocean/BGC" "${CMAKE_BINARY_DIR}/core_ocean/shared" "${CMAKE_BINARY_DIR}/core_ocean/analysis_members" "${CMAKE_BINARY_DIR}/core_ocean/cvmix" "${CMAKE_BINARY_DIR}/core_ocean/mode_forward" "${CMAKE_BINARY_DIR}/core_ocean/mode_analysis" "${CMAKE_BINARY_DIR}/core_ocean/mode_init")
list(APPEND INCLUDES "${CMAKE_BINARY_DIR}/core_ocean/shared") # Only need this for '#include "../inc/core_variables.inc"' to work

# driver (files live in E3SM)
list(APPEND RAW_SOURCES
Expand Down Expand Up @@ -118,37 +118,35 @@ set(OCEAN_DRIVER
list(APPEND RAW_SOURCES ${OCEAN_DRIVER})
list(APPEND DISABLE_QSMP ${OCEAN_DRIVER})

# Get CVMix
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/core_ocean/get_cvmix.sh
WORKING_DIRECTORY ${CORE_BLDDIR})

# Get BGC
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/core_ocean/get_BGC.sh
WORKING_DIRECTORY ${CORE_BLDDIR})

# Add CVMix
if (NOT EXISTS core_ocean/cvmix/.git)
message(FATAL "Missing core_ocean/cvmix/.git, did you forget to 'git submodule update --init --recursive' ?")
endif()
set(CVMIX_FILES
${CORE_BLDDIR}/cvmix/cvmix_kinds_and_types.F90
${CORE_BLDDIR}/cvmix/cvmix_background.F90
${CORE_BLDDIR}/cvmix/cvmix_convection.F90
${CORE_BLDDIR}/cvmix/cvmix_ddiff.F90
${CORE_BLDDIR}/cvmix/cvmix_kpp.F90
${CORE_BLDDIR}/cvmix/cvmix_math.F90
${CORE_BLDDIR}/cvmix/cvmix_put_get.F90
${CORE_BLDDIR}/cvmix/cvmix_shear.F90
${CORE_BLDDIR}/cvmix/cvmix_tidal.F90
${CORE_BLDDIR}/cvmix/cvmix_utils.F90
core_ocean/cvmix/src/shared/cvmix_kinds_and_types.F90
core_ocean/cvmix/src/shared/cvmix_background.F90
core_ocean/cvmix/src/shared/cvmix_convection.F90
core_ocean/cvmix/src/shared/cvmix_ddiff.F90
core_ocean/cvmix/src/shared/cvmix_kpp.F90
core_ocean/cvmix/src/shared/cvmix_math.F90
core_ocean/cvmix/src/shared/cvmix_put_get.F90
core_ocean/cvmix/src/shared/cvmix_shear.F90
core_ocean/cvmix/src/shared/cvmix_tidal.F90
core_ocean/cvmix/src/shared/cvmix_utils.F90
)

# Add BGC
if (NOT EXISTS core_ocean/BGC/.git)
message(FATAL "Missing core_ocean/BGC/.git, did you forget to 'git submodule update --init --recursive' ?")
endif()
set(BGC_FILES
${CORE_BLDDIR}/BGC/BGC_mod.F90
${CORE_BLDDIR}/BGC/BGC_parms.F90
${CORE_BLDDIR}/BGC/DMS_mod.F90
${CORE_BLDDIR}/BGC/DMS_parms.F90
${CORE_BLDDIR}/BGC/MACROS_mod.F90
${CORE_BLDDIR}/BGC/MACROS_parms.F90
${CORE_BLDDIR}/BGC/co2calc.F90
core_ocean/BGC/BGC_mod.F90
core_ocean/BGC/BGC_parms.F90
core_ocean/BGC/DMS_mod.F90
core_ocean/BGC/DMS_parms.F90
core_ocean/BGC/MACROS_mod.F90
core_ocean/BGC/MACROS_parms.F90
core_ocean/BGC/co2calc.F90
)

list(APPEND RAW_SOURCES ${CVMIX_FILES} ${BGC_FILES})
Expand Down

0 comments on commit c4ae651

Please sign in to comment.