Skip to content

Commit

Permalink
update musica namelist parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
mattldawson committed Dec 11, 2024
1 parent 8c1a7ce commit 2a87a0c
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 27 deletions.
12 changes: 8 additions & 4 deletions schemes/musica/musica_ccpp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,22 @@ module musica_ccpp

!> \section arg_table_musica_ccpp_register Argument Table
!! \htmlinclude musica_ccpp_register.html
subroutine musica_ccpp_register(micm_solver_type, number_of_grid_cells, &
constituent_props, errmsg, errcode)
subroutine musica_ccpp_register(horizontal_loop_extent, &
vertical_layer_dimension, constituent_props, errmsg, &
errcode)
use ccpp_constituent_prop_mod, only: ccpp_constituent_properties_t
use musica_ccpp_namelist, only: micm_solver_type

integer, intent(in) :: micm_solver_type
integer, intent(in) :: number_of_grid_cells
integer, intent(in) :: horizontal_loop_extent
integer, intent(in) :: vertical_layer_dimension
type(ccpp_constituent_properties_t), allocatable, intent(out) :: constituent_props(:)
character(len=512), intent(out) :: errmsg
integer, intent(out) :: errcode

type(ccpp_constituent_properties_t), allocatable :: constituent_props_subset(:)
integer :: number_of_grid_cells

number_of_grid_cells = horizontal_loop_extent * vertical_layer_dimension
call micm_register(micm_solver_type, number_of_grid_cells, constituent_props_subset, &
errmsg, errcode)
if (errcode /= 0) return
Expand Down
10 changes: 5 additions & 5 deletions schemes/musica/musica_ccpp.meta
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
[ccpp-arg-table]
name = musica_ccpp_register
type = scheme
[ micm_solver_type ]
standard_name = micm_solver_type
units = none
[ horizontal_loop_extent ]
standard_name = horizontal_loop_extent
units = count
type = integer
dimensions = ()
intent = in
[ number_of_grid_cells ]
standard_name = number_of_grid_cells
[ vertical_layer_dimension ]
standard_name = vertical_layer_dimension
units = count
type = integer
dimensions = ()
Expand Down
22 changes: 13 additions & 9 deletions schemes/musica/musica_ccpp_namelist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,20 @@
units
This is the CCPP unit specification of the variable (e.g., m s-1).
-->
<section name="MUSICA Standard Names">
<standard_name name="micm_solver_type">
<type kind="" units="none">integer</type>
</standard_name>
<standard_name name="number_of_grid_cells">
<type kind="" units="count">integer</type>
</standard_name>
</section>

<!-- MUSICA configuration options -->
<entry id="micm_solver_type">
<type>integer</type>
<category>musica_ccpp</category>
<group>musica_ccpp</group>
<standard_name>micm_solver_type</standard_name>
<units>none</units>
<desc>
The type of MICM solver to use.
</desc>
<values>
<value>1</value>
</values>
</entry>
<entry id="filename_of_micm_configuration">
<type>char*512</type>
<category>musica_ccpp</category>
Expand Down
3 changes: 2 additions & 1 deletion test/musica/musica_ccpp_namelist.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ module musica_ccpp_namelist
implicit none

private


integer, public :: micm_solver_type = 1
character(len=250), public :: filename_of_micm_configuration = 'musica_configurations/chapman/micm/config.json'
character(len=250), public :: filename_of_tuvx_configuration = 'musica_configurations/chapman/tuvx/config.json'
character(len=250), public :: filename_of_tuvx_micm_mapping_configuration = 'musica_configurations/chapman/tuvx_micm_mapping.json'
Expand Down
10 changes: 2 additions & 8 deletions test/musica/test_musica_api.F90
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ end subroutine get_wavelength_edges

!> Tests the Chapman chemistry scheme
subroutine test_chapman()
use musica_micm, only: Rosenbrock, RosenbrockStandardOrder
use ccpp_constituent_prop_mod, only: ccpp_constituent_prop_ptr_t
use ccpp_constituent_prop_mod, only: ccpp_constituent_properties_t
use musica_ccpp_micm, only: micm
Expand All @@ -155,7 +154,6 @@ subroutine test_chapman()
integer, parameter :: NUM_LAYERS = 2
integer, parameter :: NUM_WAVELENGTH_BINS = 102
integer :: NUM_GRID_CELLS = NUM_COLUMNS * NUM_LAYERS
integer :: solver_type = Rosenbrock
integer :: errcode
character(len=512) :: errmsg
real(kind_phys) :: time_step = 60._kind_phys ! s
Expand Down Expand Up @@ -192,7 +190,6 @@ subroutine test_chapman()
real(kind_phys) :: total_O, total_O_init

call get_wavelength_edges(photolysis_wavelength_grid_interfaces)
solver_type = Rosenbrock
time_step = 60._kind_phys
geopotential_height_wrt_surface_at_midpoint(1,:) = (/ 2000.0_kind_phys, 500.0_kind_phys /)
geopotential_height_wrt_surface_at_midpoint(2,:) = (/ 2000.0_kind_phys, -500.0_kind_phys /)
Expand Down Expand Up @@ -225,7 +222,7 @@ subroutine test_chapman()
filename_of_tuvx_configuration = 'musica_configurations/chapman/tuvx/config.json'
filename_of_tuvx_micm_mapping_configuration = 'musica_configurations/chapman/tuvx_micm_mapping.json'

call musica_ccpp_register(solver_type, NUM_GRID_CELLS, constituent_props, errmsg, errcode)
call musica_ccpp_register(NUM_COLUMNS, NUM_LAYERS, constituent_props, errmsg, errcode)
if (errcode /= 0) then
write(*,*) trim(errmsg)
stop 3
Expand Down Expand Up @@ -374,7 +371,6 @@ end subroutine test_chapman

!> Tests the simple Terminator chemistry scheme
subroutine test_terminator()
use musica_micm, only: Rosenbrock, RosenbrockStandardOrder
use ccpp_constituent_prop_mod, only: ccpp_constituent_prop_ptr_t
use ccpp_constituent_prop_mod, only: ccpp_constituent_properties_t
use musica_ccpp_micm, only: micm
Expand All @@ -393,7 +389,6 @@ subroutine test_terminator()
integer, parameter :: NUM_LAYERS = 2
integer, parameter :: NUM_WAVELENGTH_BINS = 102
integer :: NUM_GRID_CELLS = NUM_COLUMNS * NUM_LAYERS
integer :: solver_type = Rosenbrock
integer :: errcode
character(len=512) :: errmsg
real(kind_phys) :: time_step = 60._kind_phys ! s
Expand Down Expand Up @@ -430,7 +425,6 @@ subroutine test_terminator()
real(kind_phys) :: total_Cl, total_Cl_init

call get_wavelength_edges(photolysis_wavelength_grid_interfaces)
solver_type = Rosenbrock
time_step = 60._kind_phys
geopotential_height_wrt_surface_at_midpoint(1,:) = (/ 2000.0_kind_phys, 500.0_kind_phys /)
geopotential_height_wrt_surface_at_midpoint(2,:) = (/ 2000.0_kind_phys, -500.0_kind_phys /)
Expand Down Expand Up @@ -463,7 +457,7 @@ subroutine test_terminator()
filename_of_tuvx_configuration = 'musica_configurations/terminator/tuvx/config.json'
filename_of_tuvx_micm_mapping_configuration = 'musica_configurations/terminator/tuvx_micm_mapping.json'

call musica_ccpp_register(solver_type, NUM_GRID_CELLS, constituent_props, errmsg, errcode)
call musica_ccpp_register(NUM_COLUMNS, NUM_LAYERS, constituent_props, errmsg, errcode)
if (errcode /= 0) then
write(*,*) trim(errmsg)
stop 3
Expand Down

0 comments on commit 2a87a0c

Please sign in to comment.