Skip to content

Commit

Permalink
Fixes #3429 and #3415 and #3413
Browse files Browse the repository at this point in the history
  • Loading branch information
tclune committed Feb 14, 2025
1 parent 888f873 commit 8b38e19
Show file tree
Hide file tree
Showing 10 changed files with 166 additions and 387 deletions.
475 changes: 120 additions & 355 deletions generic3g/MAPL_Generic.F90

Large diffs are not rendered by default.

23 changes: 18 additions & 5 deletions generic3g/specs/VariableSpec.F90
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,25 @@ module mapl3g_VariableSpec
contains

function make_VariableSpec( &
state_intent, short_name, unusable, standard_name, geom, &
units, itemtype, typekind, vertical_dim_spec, ungridded_dims, default_value, &
service_items, attributes, &
state_intent, short_name, unusable, &
standard_name, &
geom, &
units, &
itemtype, &
typekind, &
vertical_dim_spec, &
ungridded_dims, &
default_value, &
service_items, &
attributes, &
bracket_size, &
dependencies, regrid_param, horizontal_dims_spec, &
accumulation_type, timeStep, refTime, rc) result(var_spec)
dependencies, &
regrid_param, &
horizontal_dims_spec, &
accumulation_type, &
timeStep, &
refTime, &
rc) result(var_spec)

type(VariableSpec) :: var_spec
type(ESMF_StateIntent_Flag), intent(in) :: state_intent
Expand Down
6 changes: 3 additions & 3 deletions generic3g/tests/Test_timestep_propagation.pf
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,13 @@ contains

call MAPL_GridCompGet(gridcomp, hconfig=hconfig, _RC)

call MAPL_ResourceGet(gridcomp, keystring='use_default_timestep', value=use_default_timestep, default=.true., _RC)
call MAPL_GridCompResourceGet(gridcomp, keystring='use_default_timestep', value=use_default_timestep, default=.true., _RC)
if (.not. use_default_timestep) then
allocate(timeStep)
call ESMF_TimeIntervalSet(timeStep, s=1800)
end if

call MAPL_ResourceGet(gridcomp, keystring='use_default_refTime', value=use_default_refTime, default=.true., _RC)
call MAPL_GridCompResourceGet(gridcomp, keystring='use_default_refTime', value=use_default_refTime, default=.true., _RC)
if (.not. use_default_refTime) then
allocate(refTime)
! offset by 900 seconds
Expand All @@ -231,7 +231,7 @@ contains
integer :: status

rc=0
call MAPL_RunChild(gridcomp, 'child', _RC)
call MAPL_GridCompRunChild(gridcomp, 'child', _RC)

end subroutine run_parent

Expand Down
9 changes: 6 additions & 3 deletions generic3g/tests/gridcomps/ProtoExtDataGC.F90
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ subroutine init_modify_advertised(gc, importState, exportState, clock, rc)
type(StateItemExtension), pointer :: primary
type(StateItemExtensionPtr), target, allocatable :: extensions(:)

call MAPL_GridCompGet(gc, hconfig=hconfig, registry=registry, _RC)
call MAPL_GridCompGet(gc, hconfig=hconfig, _RC)
call MAPL_GridCompGetRegistry(gc, registry, _RC)

! We would do this quite differently in an actual ExtData implementation.
! Here we are using information from the generic spec.
Expand Down Expand Up @@ -122,7 +123,8 @@ subroutine init_modify_advertised2(gc, importState, exportState, clock, rc)
character(:), allocatable :: var_name
type(StateItemExtension), pointer :: primary

call MAPL_GridCompGet(gc, hconfig=hconfig, registry=registry, _RC)
call MAPL_GridCompGet(gc, hconfig=hconfig, _RC)
call MAPL_GridCompGetRegistry(gc, registry, _RC)

! We would do this quite differently in an actual ExtData implementation.
! Here we are using information from the generic spec.
Expand Down Expand Up @@ -181,7 +183,8 @@ subroutine run(gc, importState, exportState, clock, rc)
integer :: status


call MAPL_GridCompGet(gc, hconfig=hconfig, outer_meta=outer_meta, _RC)
call MAPL_GridCompGet(gc, hconfig=hconfig, _RC)
call MAPL_GridCompGetOuterMeta(gc, outer_meta, _RC)
call outer_meta%run_children(_RC)

mapl_config = ESMF_HConfigCreateAt(hconfig, keystring='mapl', _RC)
Expand Down
4 changes: 2 additions & 2 deletions gridcomps/ExtData3G/ExtDataGridComp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module mapl3g_ExtDataGridComp
use esmf
use pfio
use mapl3g_ExtDataGridComp_private
implicit none
implicit none(type,external)
private

public :: setServices
Expand Down Expand Up @@ -53,7 +53,7 @@ subroutine run(gridcomp, importState, exportState, clock, rc)

integer :: status

call MAPL_RunChildren(gridcomp, phase_name='run', _RC)
call MAPL_GridcompRunChildren(gridcomp, phase_name='run', _RC)

_RETURN(_SUCCESS)
end subroutine run
Expand Down
4 changes: 1 addition & 3 deletions gridcomps/History3G/HistoryCollectionGridComp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ subroutine setServices(gridcomp, rc)
integer :: status

type(BasicVerticalGrid) :: vertical_grid
type(OuterMetaComponent), pointer :: outer_meta

! Set entry points
call MAPL_GridCompSetEntryPoint(gridcomp, ESMF_METHOD_INITIALIZE, init_geom, phase_name='GENERIC::INIT_ADVERTISE', _RC)
Expand All @@ -50,9 +49,8 @@ subroutine setServices(gridcomp, rc)
! Attach private state
_SET_NAMED_PRIVATE_STATE(gridcomp, HistoryCollectionGridComp, PRIVATE_STATE)

outer_meta => get_outer_meta_from_inner_gc(gridcomp,_RC)
vertical_grid = BasicVerticalGrid(4)
call outer_meta%set_vertical_grid(vertical_grid)
call MAPL_GRidCompSetVerticalGrid(gridcomp, vertical_grid, _RC)
call MAPL_GridCompGet(gridcomp, hconfig=hconfig, _RC)
call register_imports(gridcomp,hconfig,_RC)

Expand Down
4 changes: 2 additions & 2 deletions gridcomps/History3G/HistoryCollectionGridComp_private.F90
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module mapl3g_HistoryCollectionGridComp_private
use mapl3g_UngriddedDims
use gFTL2_StringSet

implicit none
implicit none(type,external)
private

public :: make_geom
Expand Down Expand Up @@ -254,7 +254,7 @@ subroutine add_specs(gridcomp, names, rc)
call ftn_iter%next()
short_name = ftn_iter%of()
varspec = make_VariableSpec(ESMF_STATEINTENT_IMPORT, short_name, vertical_dim_spec=VERTICAL_DIM_MIRROR, _RC)
call MAPL_AddSpec(gridcomp, varspec, _RC)
call MAPL_GridCompAddVarSpec(gridcomp, varspec, _RC)
end do

_RETURN(_SUCCESS)
Expand Down
4 changes: 2 additions & 2 deletions gridcomps/History3G/HistoryGridComp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module mapl3g_HistoryGridComp
use pFlogger, only: logger
use esmf
use pfio
implicit none
implicit none(type,external)
private

public :: setServices
Expand Down Expand Up @@ -82,7 +82,7 @@ subroutine run(gridcomp, importState, exportState, clock, rc)

integer :: status

call MAPL_RunChildren(gridcomp, phase_name='run', _RC)
call MAPL_GridCompRunChildren(gridcomp, phase_name='run', _RC)

call o_Clients%done_collective_stage()
call o_Clients%post_wait()
Expand Down
20 changes: 10 additions & 10 deletions gridcomps/cap3g/CapGridComp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ subroutine setServices(gridcomp, rc)
_GET_NAMED_PRIVATE_STATE(gridcomp, CapGridComp, PRIVATE_STATE, cap)

! Disable extdata or history
call MAPL_ResourceGet(gridcomp, keystring='run_extdata', value=cap%run_extdata, default=.true., _RC)
call MAPL_ResourceGet(gridcomp, keystring='run_history', value=cap%run_history, default=.true., _RC)
call MAPL_GridCompResourceGet(gridcomp, keystring='run_extdata', value=cap%run_extdata, default=.true., _RC)
call MAPL_GridCompResourceGet(gridcomp, keystring='run_history', value=cap%run_history, default=.true., _RC)

! Get Names of children
call MAPL_ResourceGet(gridcomp, keystring='extdata_name', value=cap%extdata_name, default='EXTDATA', _RC)
call MAPL_ResourceGet(gridcomp, keystring='root_name', value=cap%root_name, _RC)
call MAPL_ResourceGet(gridcomp, keystring='history_name', value=cap%history_name, default='HIST', _RC)
call MAPL_GridCompResourceGet(gridcomp, keystring='extdata_name', value=cap%extdata_name, default='EXTDATA', _RC)
call MAPL_GridCompResourceGet(gridcomp, keystring='root_name', value=cap%root_name, _RC)
call MAPL_GridCompResourceGet(gridcomp, keystring='history_name', value=cap%history_name, default='HIST', _RC)

if (cap%run_extdata) then
call MAPL_ConnectAll(gridcomp, src_comp=cap%extdata_name, dst_comp=cap%root_name, _RC)
call MAPL_GridCompConnectAll(gridcomp, src_comp=cap%extdata_name, dst_comp=cap%root_name, _RC)
end if
if (cap%run_history) then
call MAPL_ConnectAll(gridcomp, src_comp=cap%root_name, dst_comp=cap%history_name, _RC)
call MAPL_GridCompConnectAll(gridcomp, src_comp=cap%root_name, dst_comp=cap%history_name, _RC)
end if
_RETURN(_SUCCESS)
end subroutine setServices
Expand Down Expand Up @@ -92,11 +92,11 @@ subroutine run(gridcomp, importState, exportState, clock, rc)
_GET_NAMED_PRIVATE_STATE(gridcomp, CapGridComp, PRIVATE_STATE, cap)

if (cap%run_extdata) then
call MAPL_RunChild(gridcomp, cap%extdata_name, _RC)
call MAPL_GridCompRunChild(gridcomp, cap%extdata_name, _RC)
end if
call MAPL_RunChild(gridcomp, cap%root_name, _RC)
call MAPL_GridCompRunChild(gridcomp, cap%root_name, _RC)
if (cap%run_history) then
call MAPL_RunChild(gridcomp, cap%history_name, phase_name='run', _RC)
call MAPL_GridCompRunChild(gridcomp, cap%history_name, phase_name='run', _RC)
end if

_RETURN(_SUCCESS)
Expand Down
4 changes: 2 additions & 2 deletions gridcomps/configurable/ConfigurableGridComp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module mapl3g_ConfigurableGridComp

use mapl_ErrorHandling
use mapl3g_Generic, only: MAPL_GridCompSetEntryPoint, MAPL_RunChildren
use mapl3g_Generic, only: MAPL_GridCompSetEntryPoint, MAPL_GridCompRunChildren
use mapl3g_Generic, only: MAPL_GridCompGet
use mapl, only: MAPL_GetPointer
use esmf
Expand Down Expand Up @@ -90,7 +90,7 @@ recursive subroutine run(gridcomp, importState, exportState, clock, rc)

integer :: status

call MAPL_RunChildren(gridcomp, phase_name="run", _RC)
call MAPL_GridcompRunChildren(gridcomp, phase_name="run", _RC)

_RETURN(_SUCCESS)
_UNUSED_DUMMY(importState)
Expand Down

0 comments on commit 8b38e19

Please sign in to comment.