Skip to content

Commit

Permalink
Merge pull request #3240 from GEOS-ESM/feature/wdboggs/add_run_dt_to_…
Browse files Browse the repository at this point in the history
…field_specs

Feature/wdboggs/add run dt to field specs
  • Loading branch information
tclune authored Dec 11, 2024
2 parents 39d4278 + 4cfa466 commit 0434ad9
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 21 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add tests for time accumulation
- Add variable to FieldSpec for accumulation type
- Add accumulation type variable to VariableSpec and ComponentSpecParser
_ Add run_dt to ComponentSpec and ComponentSpecParser
- Add run_dt to ComponentSpec and ComponentSpecParser
- Add run_dt to FieldSpec

### Changed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ subroutine self_advertise(this, unusable, rc)

integer :: status

call this%registry%set_blanket_geometry(this%geom, this%vertical_grid, _RC)
call this%registry%set_blanket_geometry(this%geom, this%vertical_grid, this%component_spec%run_dt, _RC)

_RETURN(_SUCCESS)
_UNUSED_DUMMY(unusable)
Expand Down
7 changes: 4 additions & 3 deletions generic3g/registry/StateRegistry.F90
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module mapl3g_StateRegistry
use mapl3g_GriddedComponentDriver
use mapl3g_VerticalGrid
use mapl_ErrorHandling
use esmf, only: ESMF_Geom
use esmf, only: ESMF_Geom, ESMF_TimeInterval

implicit none
private
Expand Down Expand Up @@ -627,10 +627,11 @@ subroutine allocate(this, rc)
_RETURN(_SUCCESS)
end subroutine allocate

subroutine set_blanket_geometry(this, geom, vertical_grid, rc)
subroutine set_blanket_geometry(this, geom, vertical_grid, run_dt, rc)
class(StateRegistry), target, intent(inout) :: this
type(ESMF_Geom), optional, intent(in) :: geom
class(VerticalGrid), optional, intent(in) :: vertical_grid
type(ESMF_TimeInterval), optional, intent(in) :: run_dt
integer, optional, intent(out) :: rc

integer :: status
Expand All @@ -645,7 +646,7 @@ subroutine set_blanket_geometry(this, geom, vertical_grid, rc)
extension => iter%of()
spec => extension%get_spec()
if (spec%is_active()) then
call spec%set_geometry(geom, vertical_grid, _RC)
call spec%set_geometry(geom, vertical_grid, run_dt, _RC)
end if
end do
end associate
Expand Down
4 changes: 3 additions & 1 deletion generic3g/specs/BracketSpec.F90
Original file line number Diff line number Diff line change
Expand Up @@ -255,17 +255,19 @@ subroutine add_to_bundle(this, bundle, rc)
_UNUSED_DUMMY(bundle)
end subroutine add_to_bundle

subroutine set_geometry(this, geom, vertical_grid, rc)
subroutine set_geometry(this, geom, vertical_grid, run_dt, rc)
class(BracketSpec), intent(inout) :: this
type(ESMF_Geom), optional, intent(in) :: geom
class(VerticalGrid), optional, intent(in) :: vertical_grid
type(ESMF_TimeInterval), optional, intent(in) :: run_dt
integer, optional, intent(out) :: rc

_FAIL('unimplemented')

_UNUSED_DUMMY(this)
_UNUSED_DUMMY(geom)
_UNUSED_DUMMY(vertical_grid)
_UNUSED_DUMMY(run_dt)
end subroutine set_geometry

subroutine write_formatted(this, unit, iotype, v_list, iostat, iomsg)
Expand Down
4 changes: 1 addition & 3 deletions generic3g/specs/ComponentSpec.F90
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function new_ComponentSpec(var_specs, connections, run_dt) result(spec)
if (present(var_specs)) spec%var_specs = var_specs
if (present(connections)) spec%connections = connections
if (present(run_dt)) spec%run_dt = run_dt

end function new_ComponentSpec

logical function has_geom_hconfig(this)
Expand All @@ -63,8 +64,5 @@ subroutine add_connection(this, conn)
call this%connections%push_back(conn)
end subroutine add_connection




end module mapl3g_ComponentSpec

13 changes: 9 additions & 4 deletions generic3g/specs/FieldSpec.F90
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ module mapl3g_FieldSpec
!# type(VariableSpec) :: variable_spec

logical :: is_created = .false.
type(ESMF_TimeInterval), allocatable :: run_dt

contains

Expand Down Expand Up @@ -192,7 +193,7 @@ module mapl3g_FieldSpec

function new_FieldSpec_geom(unusable, geom, vertical_grid, vertical_dim_spec, typekind, ungridded_dims, &
standard_name, long_name, units, &
attributes, regrid_param, default_value, accumulation_type) result(field_spec)
attributes, regrid_param, default_value, accumulation_type, run_dt) result(field_spec)
type(FieldSpec) :: field_spec

class(KeywordEnforcer), optional, intent(in) :: unusable
Expand All @@ -210,6 +211,7 @@ function new_FieldSpec_geom(unusable, geom, vertical_grid, vertical_dim_spec, ty
! optional args last
real, optional, intent(in) :: default_value
character(*), optional, intent(in) :: accumulation_type
type(ESMF_TimeInterval), optional, intent(in) :: run_dt

integer :: status

Expand All @@ -231,6 +233,7 @@ function new_FieldSpec_geom(unusable, geom, vertical_grid, vertical_dim_spec, ty
if (present(default_value)) field_spec%default_value = default_value
field_spec%accumulation_type = NO_ACCUMULATION
if (present(accumulation_type)) field_spec%accumulation_type = trim(accumulation_type)
if (present(run_dt)) field_spec%run_dt = run_dt
end function new_FieldSpec_geom

function new_FieldSpec_varspec(variable_spec) result(field_spec)
Expand All @@ -239,6 +242,7 @@ function new_FieldSpec_varspec(variable_spec) result(field_spec)

type(ESMF_RegridMethod_Flag), allocatable :: regrid_method

field_spec%accumulation_type = NO_ACCUMULATION
_SET_FIELD(field_spec, variable_spec, vertical_dim_spec)
_SET_FIELD(field_spec, variable_spec, typekind)
_SET_FIELD(field_spec, variable_spec, ungridded_dims)
Expand All @@ -247,23 +251,24 @@ function new_FieldSpec_varspec(variable_spec) result(field_spec)
_SET_ALLOCATED_FIELD(field_spec, variable_spec, standard_name)
_SET_ALLOCATED_FIELD(field_spec, variable_spec, units)
_SET_ALLOCATED_FIELD(field_spec, variable_spec, default_value)
_SET_ALLOCATED_FIELD(field_spec, variable_spec, accumulation_type)

field_spec%long_name = 'unknown'
field_spec%accumulation_type = NO_ACCUMULATION
_SET_ALLOCATED_FIELD(field_spec, variable_spec, accumulation_type)

end function new_FieldSpec_varspec

subroutine set_geometry(this, geom, vertical_grid, rc)
subroutine set_geometry(this, geom, vertical_grid, run_dt, rc)
class(FieldSpec), intent(inout) :: this
type(ESMF_Geom), optional, intent(in) :: geom
class(VerticalGrid), optional, intent(in) :: vertical_grid
type(ESMF_TimeInterval), optional, intent(in) :: run_dt
integer, optional, intent(out) :: rc
integer :: status
type(ESMF_RegridMethod_Flag), allocatable :: regrid_method

if (present(geom)) this%geom = geom
if (present(vertical_grid)) this%vertical_grid = vertical_grid
if (present(run_dt)) this%run_dt = run_dt

_RETURN(_SUCCESS)
end subroutine set_geometry
Expand Down
5 changes: 4 additions & 1 deletion generic3g/specs/InvalidSpec.F90
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module mapl3g_InvalidSpec
use esmf, only: ESMF_Geom
use esmf, only: ESMF_State
use esmf, only: ESMF_SUCCESS
use esmf, only: ESMF_TimeInterval

implicit none
private
Expand Down Expand Up @@ -132,16 +133,18 @@ subroutine add_to_bundle(this, bundle, rc)
_UNUSED_DUMMY(bundle)
end subroutine add_to_bundle

subroutine set_geometry(this, geom, vertical_grid, rc)
subroutine set_geometry(this, geom, vertical_grid, run_dt, rc)
class(InvalidSpec), intent(inout) :: this
type(ESMF_Geom), optional, intent(in) :: geom
class(VerticalGrid), optional, intent(in) :: vertical_grid
type(ESMF_TimeInterval), optional, intent(in) :: run_dt
integer, optional, intent(out) :: rc

_FAIL('Attempt to initialize item of type InvalidSpec')
_UNUSED_DUMMY(this)
_UNUSED_DUMMY(geom)
_UNUSED_DUMMY(vertical_grid)
_UNUSED_DUMMY(run_dt)
end subroutine set_geometry

subroutine write_formatted(this, unit, iotype, v_list, iostat, iomsg)
Expand Down
3 changes: 2 additions & 1 deletion generic3g/specs/ServiceSpec.F90
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,11 @@ subroutine destroy(this, rc)
_RETURN(ESMF_SUCCESS)
end subroutine destroy

subroutine set_geometry(this, geom, vertical_grid, rc)
subroutine set_geometry(this, geom, vertical_grid, run_dt, rc)
class(ServiceSpec), intent(inout) :: this
type(ESMF_Geom), optional, intent(in) :: geom
class(VerticalGrid), optional, intent(in) :: vertical_grid
type(ESMF_TimeInterval), optional, intent(in) :: run_dt
integer, optional, intent(out) :: rc
integer :: status

Expand Down
5 changes: 3 additions & 2 deletions generic3g/specs/StateItemSpec.F90
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,14 @@ subroutine I_add_to_bundle(this, bundle, rc)
integer, optional, intent(out) :: rc
end subroutine I_add_to_bundle

subroutine I_set_geometry(this, geom, vertical_grid, rc)
use esmf, only: ESMF_Geom
subroutine I_set_geometry(this, geom, vertical_grid, run_dt, rc)
use esmf, only: ESMF_Geom, ESMF_TimeInterval
use mapl3g_VerticalGrid, only: VerticalGrid
import StateItemSpec
class(StateItemSpec), intent(inout) :: this
type(ESMF_Geom), optional, intent(in) :: geom
class(VerticalGrid), optional, intent(in) :: vertical_grid
type(ESMF_TimeInterval), optional, intent(in) :: run_dt
integer, optional, intent(out) :: rc
end subroutine I_set_geometry

Expand Down
4 changes: 3 additions & 1 deletion generic3g/specs/StateSpec.F90
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,19 @@ module mapl3g_StateSpec
contains

! Nothing defined at this time.
subroutine set_geometry(this, geom, vertical_grid, rc)
subroutine set_geometry(this, geom, vertical_grid, run_dt, rc)
class(StateSpec), intent(inout) :: this
type(ESMF_Geom), optional, intent(in) :: geom
class(VerticalGrid), optional, intent(in) :: vertical_grid
type(ESMF_TimeInterval), optional, intent(in) :: run_dt
integer, optional, intent(out) :: rc

_RETURN(_SUCCESS)

_UNUSED_DUMMY(this)
_UNUSED_DUMMY(geom)
_UNUSED_DUMMY(vertical_grid)
_UNUSED_DUMMY(run_dt)
end subroutine set_geometry

subroutine add_item(this, name, item)
Expand Down
5 changes: 3 additions & 2 deletions generic3g/specs/WildcardSpec.F90
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,16 @@ subroutine add_to_bundle(this, bundle, rc)
_RETURN(_SUCCESS)
end subroutine add_to_bundle

subroutine set_geometry(this, geom, vertical_grid, rc)
subroutine set_geometry(this, geom, vertical_grid, run_dt, rc)
class(WildcardSpec), intent(inout) :: this
type(ESMF_Geom), optional, intent(in) :: geom
class(VerticalGrid), optional, intent(in) :: vertical_grid
type(ESMF_TimeInterval), optional, intent(in) :: run_dt
integer, optional, intent(out) :: rc

integer :: status

call this%reference_spec%set_geometry(geom, vertical_grid, _RC)
call this%reference_spec%set_geometry(geom, vertical_grid, run_dt, _RC)

_RETURN(_SUCCESS)
end subroutine set_geometry
Expand Down
3 changes: 2 additions & 1 deletion generic3g/tests/MockItemSpec.F90
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,11 @@ function new_MockItemSpec(name, subtype, adapter_type) result(spec)

end function new_MockItemSpec

subroutine set_geometry(this, geom, vertical_grid, rc)
subroutine set_geometry(this, geom, vertical_grid, run_dt, rc)
class(MockItemSpec), intent(inout) :: this
type(ESMF_Geom), optional, intent(in) :: geom
class(VerticalGrid), optional, intent(in) :: vertical_grid
type(ESMF_TimeInterval), optional, intent(in) :: run_dt
integer, optional, intent(out) :: rc

_RETURN(_SUCCESS)
Expand Down

0 comments on commit 0434ad9

Please sign in to comment.