Skip to content

Commit

Permalink
Add stub interface for MPAS dynamical core
Browse files Browse the repository at this point in the history
The APIs between CAM-SIMA control and dynamical core have changed from CAM.

This stub interface currently does nothing, but it provides a fresh start from
scratch for actual functionalities to be incrementally implemented later.
  • Loading branch information
kuanchihwang committed Dec 29, 2023
1 parent 1a0fc31 commit 13a466d
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/dynamics/mpas/dyn_comp.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
module dyn_comp
use runtime_obj, only: runtime_options

implicit none

private
! Provide APIs required by CAM Control.
public :: dyn_import_t
public :: dyn_export_t
public :: dyn_readnl
public :: dyn_init
! public :: dyn_run
! public :: dyn_final

type dyn_import_t
end type dyn_import_t

type dyn_export_t
end type dyn_export_t
contains

! Called by `read_namelist` in `src/control/runtime_opts.F90`.
subroutine dyn_readnl(namelist_path)
character(*), intent(in) :: namelist_path
end subroutine dyn_readnl

! Called by `cam_init` in `src/control/cam_comp.F90`.
subroutine dyn_init(cam_runtime_opts, dyn_in, dyn_out)
type(runtime_options), intent(in) :: cam_runtime_opts
type(dyn_import_t), intent(out) :: dyn_in
type(dyn_export_t), intent(out) :: dyn_out
end subroutine dyn_init

! Not used for now. Intended to be called by `stepon_run*` in `src/dynamics/mpas/stepon.F90`.
! subroutine dyn_run()
! end subroutine dyn_run

! Not used for now. Intended to be called by `stepon_final` in `src/dynamics/mpas/stepon.F90`.
! subroutine dyn_final()
! end subroutine dyn_final

end module dyn_comp
13 changes: 13 additions & 0 deletions src/dynamics/mpas/dyn_grid.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module dyn_grid
implicit none

private
! Provide APIs required by CAM Control.
public :: model_grid_init
contains

! Called by `cam_init` in `src/control/cam_comp.F90`.
subroutine model_grid_init()
end subroutine model_grid_init

end module dyn_grid
62 changes: 62 additions & 0 deletions src/dynamics/mpas/stepon.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
module stepon
use camsrfexch, only: cam_out_t
use dyn_comp, only: dyn_import_t, dyn_export_t
use physics_types, only: physics_state, physics_tend
use runtime_obj, only: runtime_options
use shr_kind_mod, only: r8 => shr_kind_r8

implicit none

private
! Provide APIs required by CAM Control.
public :: stepon_init
public :: stepon_run1
public :: stepon_run2
public :: stepon_run3
public :: stepon_final
contains

! Called by `cam_init` in `src/control/cam_comp.F90`.
subroutine stepon_init(cam_runtime_opts, dyn_in, dyn_out)
type(runtime_options), intent(in) :: cam_runtime_opts
type(dyn_import_t), intent(in) :: dyn_in
type(dyn_export_t), intent(in) :: dyn_out
end subroutine stepon_init

! Called by `cam_run1` in `src/control/cam_comp.F90`.
subroutine stepon_run1(dtime_phys, cam_runtime_opts, phys_state, phys_tend, dyn_in, dyn_out)
real(r8), intent(out) :: dtime_phys
type(runtime_options), intent(in) :: cam_runtime_opts
type(physics_state), intent(inout) :: phys_state
type(physics_tend), intent(inout) :: phys_tend
type(dyn_import_t), intent(inout) :: dyn_in
type(dyn_export_t), intent(inout) :: dyn_out
end subroutine stepon_run1

! Called by `cam_run2` in `src/control/cam_comp.F90`.
subroutine stepon_run2(cam_runtime_opts, phys_state, phys_tend, dyn_in, dyn_out)
type(runtime_options), intent(in) :: cam_runtime_opts
type(physics_state), intent(inout) :: phys_state
type(physics_tend), intent(inout) :: phys_tend
type(dyn_import_t), intent(inout) :: dyn_in
type(dyn_export_t), intent(inout) :: dyn_out
end subroutine stepon_run2

! Called by `cam_run3` in `src/control/cam_comp.F90`.
subroutine stepon_run3(dtime_phys, cam_runtime_opts, cam_out, phys_state, dyn_in, dyn_out)
real(r8), intent(in) :: dtime_phys
type(runtime_options), intent(in) :: cam_runtime_opts
type(cam_out_t), intent(inout) :: cam_out
type(physics_state), intent(inout) :: phys_state
type(dyn_import_t), intent(inout) :: dyn_in
type(dyn_export_t), intent(inout) :: dyn_out
end subroutine stepon_run3

! Called by `cam_final` in `src/control/cam_comp.F90`.
subroutine stepon_final(cam_runtime_opts, dyn_in, dyn_out)
type(runtime_options), intent(in) :: cam_runtime_opts
type(dyn_import_t), intent(inout) :: dyn_in
type(dyn_export_t), intent(inout) :: dyn_out
end subroutine stepon_final

end module stepon

0 comments on commit 13a466d

Please sign in to comment.