Skip to content

Commit

Permalink
Move instantiation of MPAS dynamical core to dyn_comp module
Browse files Browse the repository at this point in the history
... In accordance with the spirit of OOP.
  • Loading branch information
kuanchihwang committed Feb 22, 2024
1 parent 3eaeeb8 commit c4fda96
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 1 addition & 4 deletions src/dynamics/mpas/driver/dyn_mpas_subdriver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module dyn_mpas_subdriver
implicit none

private
public :: mpas_dynamical_core_type, mpas_dynamical_core
public :: mpas_dynamical_core_type

abstract interface
! This interface is compatible with `endrun` from CAM-SIMA.
Expand Down Expand Up @@ -59,9 +59,6 @@ end subroutine model_error_if
procedure, pass, public :: read_namelist => dyn_mpas_read_namelist
procedure, pass, public :: init_phase2 => dyn_mpas_init_phase2
end type mpas_dynamical_core_type

!> The "instance/object" of MPAS dynamical core.
type(mpas_dynamical_core_type) :: mpas_dynamical_core
contains
!> Print a debug message with optionally the value(s) of a variable.
!> If `printer` is not supplied, the MPI master rank will print. Otherwise, the designated MPI rank will print instead.
Expand Down
10 changes: 7 additions & 3 deletions src/dynamics/mpas/dyn_comp.F90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module dyn_comp
use dyn_mpas_subdriver, only: mpas_dynamical_core
use dyn_mpas_subdriver, only: mpas_dynamical_core_type

! Modules from CAM.
use cam_abortutils, only: endrun
Expand Down Expand Up @@ -28,12 +28,16 @@ module dyn_comp
public :: dyn_init
! public :: dyn_run
! public :: dyn_final
public :: mpas_dynamical_core

type dyn_import_t
type :: dyn_import_t
end type dyn_import_t

type dyn_export_t
type :: dyn_export_t
end type dyn_export_t

!> The "instance/object" of MPAS dynamical core.
type(mpas_dynamical_core_type) :: mpas_dynamical_core
contains
!> Read MPAS namelist from supplied path.
!> Additionally, perform early initialization of MPAS dynamical core.
Expand Down

0 comments on commit c4fda96

Please sign in to comment.