Skip to content

Commit

Permalink
Add skeleton for driver initialisation routine
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanBryan51 committed Oct 25, 2024
1 parent 5c748af commit 3f0b3f1
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ target_link_libraries(cable_common_objlib PRIVATE PkgConfig::NETCDF)
add_executable(
cable
src/offline/cable_driver.F90
src/offline/cable_driver_init.F90
"$<TARGET_OBJECTS:cable_common_objlib>"
)
target_link_libraries(cable PRIVATE PkgConfig::NETCDF)
Expand All @@ -167,8 +168,10 @@ if(CABLE_MPI)
src/offline/cable_mpimaster.F90
src/offline/cable_mpiworker.F90
src/science/pop/pop_mpi.F90
src/offline/cable_driver_init.F90
"$<TARGET_OBJECTS:cable_common_objlib>"
)
target_compile_definitions(cable-mpi PRIVATE __MPI__)
target_link_libraries(cable-mpi PRIVATE PkgConfig::NETCDF MPI::MPI_Fortran)
install(TARGETS cable-mpi RUNTIME)
endif()
3 changes: 3 additions & 0 deletions src/offline/cable_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
!==============================================================================

PROGRAM cable_offline_driver
USE cable_driver_init_mod
USE cable_def_types_mod
USE cable_IO_vars_module, ONLY: logn,gswpfile,ncciy,leaps, &
verbose, fixedCO2,output,check,patchout, &
Expand Down Expand Up @@ -307,6 +308,8 @@ PROGRAM cable_offline_driver

! END header

CALL cable_driver_init()

cable_runtime%offline = .TRUE.
!check to see if first argument passed to cable is
!the name of the namelist file
Expand Down
21 changes: 21 additions & 0 deletions src/offline/cable_driver_init.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MODULE cable_driver_init_mod
!! Module containing routines for CABLE offline driver initialisation
IMPLICIT NONE
PRIVATE

PUBLIC :: cable_driver_init

CONTAINS

SUBROUTINE cable_driver_init()
!! Model initialisation routine for the CABLE offline driver.

#ifdef __MPI__
! MPI specific initialisation
#else
! Serial specific initialisation
#endif

END SUBROUTINE cable_driver_init

END MODULE cable_driver_init_mod
3 changes: 2 additions & 1 deletion src/offline/cable_mpidrv.F90
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
PROGRAM mpi_driver

USE mpi
USE cable_driver_init_mod

USE cable_mpicommon
USE cable_mpimaster
Expand All @@ -31,7 +32,7 @@ PROGRAM mpi_driver
INTEGER :: comm, np, rank, ierr
REAL :: etime ! Declare the type of etime()


CALL cable_driver_init()

CALL MPI_Init (ierr)
CALL MPI_Comm_dup (MPI_COMM_WORLD, comm, ierr)
Expand Down

0 comments on commit 3f0b3f1

Please sign in to comment.