dyn_comp Module

This module, part of the MPAS interface, integrates MPAS dynamical core with CAM-SIMA by implementing the necessary APIs and managing their interaction.

It contains the instance of MPAS dynamical core, which is used extensively throughout CAM-SIMA. It provides core functionalities such as the initialization, running, and finalization of MPAS dynamical core. Various utility procedures for debug printing, exchanging constituent states, inquiring mesh dimensions, etc. are also provided here.


Uses

  • module~~dyn_comp~~UsesGraph module~dyn_comp dyn_comp module~dyn_mpas_subdriver dyn_mpas_subdriver module~dyn_comp->module~dyn_mpas_subdriver iso_fortran_env iso_fortran_env module~dyn_mpas_subdriver->iso_fortran_env mpas_derived_types mpas_derived_types module~dyn_mpas_subdriver->mpas_derived_types mpas_kind_types mpas_kind_types module~dyn_mpas_subdriver->mpas_kind_types mpi mpi module~dyn_mpas_subdriver->mpi

Used by

  • module~~dyn_comp~~UsedByGraph module~dyn_comp dyn_comp none~init_shared_variables~2 init_shared_variables none~init_shared_variables~2->module~dyn_comp none~init_shared_variables~3 init_shared_variables none~init_shared_variables~3->module~dyn_comp none~set_mpas_physics_tendency_rho set_mpas_physics_tendency_rho none~set_mpas_physics_tendency_rho->module~dyn_comp none~set_mpas_physics_tendency_rtheta set_mpas_physics_tendency_rtheta none~set_mpas_physics_tendency_rtheta->module~dyn_comp none~set_mpas_physics_tendency_ru set_mpas_physics_tendency_ru none~set_mpas_physics_tendency_ru->module~dyn_comp none~set_physics_state_column set_physics_state_column none~set_physics_state_column->module~dyn_comp none~set_physics_state_external set_physics_state_external none~set_physics_state_external->module~dyn_comp proc~define_cam_grid define_cam_grid proc~define_cam_grid->module~dyn_comp proc~dynamics_to_physics_coupling dynamics_to_physics_coupling proc~dynamics_to_physics_coupling->module~dyn_comp proc~init_physics_grid init_physics_grid proc~init_physics_grid->module~dyn_comp proc~init_reference_pressure init_reference_pressure proc~init_reference_pressure->module~dyn_comp proc~model_grid_init model_grid_init proc~model_grid_init->module~dyn_comp proc~physics_to_dynamics_coupling physics_to_dynamics_coupling proc~physics_to_dynamics_coupling->module~dyn_comp proc~stepon_final stepon_final proc~stepon_final->module~dyn_comp proc~stepon_init stepon_init proc~stepon_init->module~dyn_comp proc~stepon_run2 stepon_run2 proc~stepon_run2->module~dyn_comp proc~stepon_run3 stepon_run3 proc~stepon_run3->module~dyn_comp proc~stepon_timestep_init stepon_timestep_init proc~stepon_timestep_init->module~dyn_comp

Variables

Type Visibility Attributes Name Initial
type(mpas_dynamical_core_type), public :: mpas_dynamical_core

The "instance/object" of MPAS dynamical core.

integer, public :: ncells
integer, public :: ncells_global
integer, public :: ncells_max
integer, public :: ncells_solve
integer, public :: nedges
integer, public :: nedges_global
integer, public :: nedges_max
integer, public :: nedges_solve
integer, public :: nvertices
integer, public :: nvertices_global
integer, public :: nvertices_solve
integer, public :: nvertlevels
real(kind=kind_dyn_mpas), public :: sphere_radius

Derived Types

type, public :: dyn_export_t

This derived type is not used by MPAS dynamical core. It exists only as a placeholder because CAM-SIMA requires it. Developers/Maintainers/Users who wish to interact with MPAS dynamical core may do so by using the "instance/object" below.

type, public :: dyn_import_t

This derived type is not used by MPAS dynamical core. It exists only as a placeholder because CAM-SIMA requires it. Developers/Maintainers/Users who wish to interact with MPAS dynamical core may do so by using the "instance/object" below.


Functions

public pure function reverse(array)

Helper function for reversing the order of elements in array. (KCW, 2024-07-17)

Arguments

Type IntentOptional Attributes Name
real(kind=kind_r8), intent(in) :: array(:)

Return Value real(kind=kind_r8), (size(array))


Subroutines

private subroutine check_topography_data(pio_file)

Check for consistency in topography data. The presence of topography file is inferred from the pio_file pointer. If topography file is used, check that the "PHIS" variable, which denotes surface geopotential, is consistent with the surface geometric height in MPAS. Otherwise, if topography file is not used, check that the surface geometric height in MPAS is zero. (KCW, 2024-05-10)

Arguments

Type IntentOptional Attributes Name
type(file_desc_t), intent(in), pointer :: pio_file

public subroutine dyn_debug_print(level, message, printer)

Print a debug message at a debug level. The debug message will be prefixed by "MPAS Interface (N): ", where N is the MPI rank. The debug level is one of the debugout_* constants from the cam_logfile module. If printer is not supplied, the MPI root rank will print. Otherwise, the designated MPI rank will print instead. (KCW, 2024-02-03)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: level
character(len=*), intent(in) :: message
integer, intent(in), optional :: printer

public subroutine dyn_exchange_constituent_states(direction, exchange, conversion)

Exchange and/or convert constituent states between CAM-SIMA and MPAS. If exchange is .true. and direction is "e" or "export", set MPAS state scalars from physics state constituents. If exchange is .true. and direction is "i" or "import", set physics state constituents from MPAS state scalars. Think of it as "exporting/importing constituent states in CAM-SIMA to/from MPAS". Otherwise, if exchange is .false., no exchange is performed at all. If conversion is .true., appropriate conversion is performed for constituent mixing ratios that have different definitions between CAM-SIMA and MPAS (i.e., dry/moist). Otherwise, if conversion is .false., no conversion is performed at all. This subroutine is intentionally designed to have these elaborate controls due to complications in CAM-SIMA. Some procedures in CAM-SIMA expect constituent states to be dry, while the others expect them to be moist. (KCW, 2024-09-26)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: direction
logical, intent(in) :: exchange
logical, intent(in) :: conversion

public subroutine dyn_final()

Finalize MPAS dynamical core as well as its framework. (KCW, 2024-10-04)

Arguments

None

public subroutine dyn_init(cam_runtime_opts, dyn_in, dyn_out)

Initialize MPAS dynamical core by one of the following: 1. Setting analytic initial condition; 2. Reading initial condition from a file; 3. Restarting from a file. (KCW, 2024-05-28)

Arguments

Type IntentOptional Attributes Name
type(runtime_options), intent(in) :: cam_runtime_opts
type(dyn_import_t), intent(in) :: dyn_in
type(dyn_export_t), intent(in) :: dyn_out

public subroutine dyn_inquire_mesh_dimensions()

Inquire local and global mesh dimensions. Save them as protected module variables. (KCW, 2024-11-21)

Arguments

None

public subroutine dyn_readnl(namelist_path)

Read MPAS namelist from the supplied path. Additionally, perform early initialization of MPAS dynamical core. (KCW, 2024-02-09)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: namelist_path

public subroutine dyn_run()

Run MPAS dynamical core to integrate the dynamical states with time. (KCW, 2024-07-11)

Arguments

None

private subroutine dyn_variable_dump()

Arguments

None

private subroutine mark_variables_as_initialized()

Mark everything in the physics_types module along with constituents as initialized to prevent physics from attempting to read them from a file. (KCW, 2024-05-23)

Arguments

None

private subroutine set_analytic_initial_condition()

Set analytic initial condition for MPAS. (KCW, 2024-05-22)

Arguments

None