Skip to content

Commit

Permalink
Several further changes to use the CESM driver:
Browse files Browse the repository at this point in the history
 - compile the corresponding MOM6 cap (this is simply a module wrapper around the real cap).
 - add options to turn on/off the different components (MOM6, WW3 and CICE6).
 - do not compile the data components when the corresponding model component is used.
 - set the *_PRESENT compile definitions for the CESM driver.
  • Loading branch information
micaeljtoliveira committed May 16, 2023
1 parent 7b0b112 commit 83a8083
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 20 deletions.
37 changes: 25 additions & 12 deletions CDEPS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,36 @@ list(APPEND cdeps_src_files
CDEPS/datm/datm_datamode_gefs_mod.F90
CDEPS/datm/datm_datamode_jra_mod.F90

CDEPS/dice/dice_datamode_ssmi_mod.F90
CDEPS/dice/dice_flux_atmice_mod.F90
CDEPS/dice/ice_comp_nuopc.F90

CDEPS/dlnd/lnd_comp_nuopc.F90

CDEPS/docn/docn_datamode_aquaplanet_mod.F90
CDEPS/docn/docn_datamode_copyall_mod.F90
CDEPS/docn/docn_datamode_iaf_mod.F90
CDEPS/docn/docn_datamode_som_mod.F90
CDEPS/docn/ocn_comp_nuopc.F90

CDEPS/drof/rof_comp_nuopc.F90

CDEPS/dwav/wav_comp_nuopc.F90
)


if(NOT ENABLE_MOM6)
list(APPEND cdeps_src_files
CDEPS/docn/docn_datamode_aquaplanet_mod.F90
CDEPS/docn/docn_datamode_copyall_mod.F90
CDEPS/docn/docn_datamode_iaf_mod.F90
CDEPS/docn/docn_datamode_som_mod.F90
CDEPS/docn/ocn_comp_nuopc.F90
)
endif()

if(NOT ENABLE_CICE)
list(APPEND cdeps_src_files
CDEPS/dice/dice_datamode_ssmi_mod.F90
CDEPS/dice/dice_flux_atmice_mod.F90
CDEPS/dice/ice_comp_nuopc.F90
)
endif()

if(NOT ENABLE_WW3)
list(APPEND cdeps_src_files
CDEPS/dwav/wav_comp_nuopc.F90
)
endif()

add_library(cdeps STATIC ${cdeps_src_files})

set_target_properties(cdeps PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod)
Expand Down
37 changes: 29 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ project(ACCESS-OM3

list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

# Components to enable
set(ENABLE_MOM6 ON CACHE BOOL "Enable MOM6")
set(ENABLE_CICE ON CACHE BOOL "Enable CICE6")
set(ENABLE_WW3 OFF CACHE BOOL "Enable WW3")

# Build options
set(OPENMP ON CACHE BOOL "Enable OpenMP threading")

Expand Down Expand Up @@ -61,14 +66,23 @@ add_subdirectory(share)
# Components

# Ocean component (MOM6)
add_subdirectory(MOM6)
if(ENABLE_MOM6)
add_subdirectory(MOM6)
list(APPEND COMPONENTS_TARGETS mom6)
endif()

# Sea-ice component (CICE6)
add_subdirectory(CICE)
if(ENABLE_CICE)
add_subdirectory(CICE)
list(APPEND COMPONENTS_TARGETS cice)
endif()

# Wave component (WW3)
set(SWITCH "multi_esmf" CACHE STRING "NUOPC mesh cap")
add_subdirectory(WW3)
if(ENABLE_WW3)
set(SWITCH "multi_esmf" CACHE STRING "NUOPC mesh cap")
add_subdirectory(WW3)
list(APPEND COMPONENTS_TARGETS WW3::WW3)
endif()

# Mediator component (CMEPS)
add_subdirectory(CMEPS)
Expand All @@ -85,13 +99,20 @@ add_library(cesm_driver
CMEPS/CMEPS/cesm/driver/ensemble_driver.F90
CMEPS/CMEPS/cesm/driver/esm_time_mod.F90
)
target_link_libraries(cesm_driver PUBLIC share mom6 cice WW3::WW3 cmeps cdeps esmf PIO::PIO_Fortran)

target_link_libraries(cesm_driver PUBLIC share ${COMPONENTS_TARGETS} cmeps cdeps esmf PIO::PIO_Fortran)
set_target_properties(cesm_driver PROPERTIES Fortran_MODULE_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/mod)
target_include_directories(cesm_driver PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/mod>
$<INSTALL_INTERFACE:mod>)

$<INSTALL_INTERFACE:mod>)

target_compile_definitions(cesm_driver PRIVATE MED_PRESENT
ATM_PRESENT
ICE_PRESENT
LND_PRESENT
OCN_PRESENT
WAV_PRESENT
ROF_PRESENT
)

add_executable(access-om3 CMEPS/CMEPS/cesm/driver/esmApp.F90)
target_link_libraries(access-om3 PRIVATE cesm_driver esmf PIO::PIO_Fortran NetCDF::NetCDF_Fortran)
1 change: 1 addition & 0 deletions MOM6/mom6_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ list(APPEND mom6_src_files
MOM6/config_src/infra/FMS2/MOM_time_manager.F90

MOM6/config_src/drivers/nuopc_cap/mom_cap.F90
MOM6/config_src/drivers/nuopc_cap/ocn_comp_NUOPC.F90
MOM6/config_src/drivers/nuopc_cap/time_utils.F90
MOM6/config_src/drivers/nuopc_cap/mom_cap_methods.F90
MOM6/config_src/drivers/nuopc_cap/mom_cap_time.F90
Expand Down

0 comments on commit 83a8083

Please sign in to comment.