Skip to content

Commit

Permalink
Merge pull request #3119 from GEOS-ESM/feature/tclune/#3096-action-in…
Browse files Browse the repository at this point in the history
…validate_phase

Fixes #3096 - propagate time dependent changes
  • Loading branch information
tclune authored Oct 28, 2024
2 parents 34ef817 + 925cda7 commit 0c46242
Show file tree
Hide file tree
Showing 24 changed files with 1,708 additions and 731 deletions.
156 changes: 149 additions & 7 deletions esmf_utils/InfoUtilities.F90
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ module mapl3g_InfoUtilities

interface MAPL_InfoCreateFromInternal
procedure :: info_field_create_from_internal
procedure :: info_bundle_create_from_internal
end interface MAPL_InfoCreateFromInternal

interface MAPL_InfoCreateFromShared
Expand Down Expand Up @@ -113,7 +114,9 @@ module mapl3g_InfoUtilities
interface MAPL_InfoGetInternal
procedure :: info_field_get_internal_string
procedure :: info_field_get_internal_i4
procedure :: info_get_bundle_internal_r4_1d
procedure :: info_bundle_get_internal_string
procedure :: info_bundle_get_internal_i4
procedure :: info_bundle_get_internal_r4_1d
procedure :: info_stateitem_get_internal_string
procedure :: info_stateitem_get_internal_logical
procedure :: info_stateitem_get_internal_i4
Expand All @@ -123,8 +126,13 @@ module mapl3g_InfoUtilities
end interface MAPL_InfoGetInternal

interface MAPL_InfoSetInternal
procedure :: info_field_set_internal_info
procedure :: info_field_set_internal_string
procedure :: info_field_set_internal_i4
procedure :: info_bundle_set_internal_info
procedure :: info_bundle_set_internal_string
procedure :: info_bundle_set_internal_i4
procedure :: info_bundle_set_internal_r4_1d
procedure :: info_stateitem_set_internal_string
procedure :: info_stateitem_set_internal_logical
procedure :: info_stateitem_set_internal_i4
Expand Down Expand Up @@ -254,28 +262,57 @@ end subroutine info_get_r4_1d

! MAPL_InfoCreateFromInternal

function info_field_create_from_internal(field, rc) result(info)
function info_field_create_from_internal(field, key, rc) result(info)
type(ESMF_Info) :: info
type(ESMF_Field), intent(in) :: field
character(*), optional, intent(in) :: key
integer, optional, intent(out) :: rc

type(ESMF_Info) :: host_info
integer :: status
character(:), allocatable :: key_

call ESMF_InfoGetFromHost(field, host_info, _RC)
info = ESMF_InfoCreate(host_info, key=INFO_INTERNAL_NAMESPACE, _RC)

key_ = INFO_INTERNAL_NAMESPACE
if (present(key)) then
key_ = concat(key_, key)
end if

info = ESMF_InfoCreate(host_info, key=key_, _RC)

_RETURN(_SUCCESS)
end function info_field_create_from_internal

function info_field_create_from_shared(field, rc) result(info)
function info_bundle_create_from_internal(bundle, key, rc) result(info)
type(ESMF_Info) :: info
type(ESMF_Field), intent(in) :: field
type(ESMF_FieldBundle), intent(in) :: bundle
character(*), optional, intent(in) :: key
integer, optional, intent(out) :: rc

type(ESMF_Info) :: host_info
character(:), allocatable :: key_
integer :: status

key_ = INFO_INTERNAL_NAMESPACE
if (present(key)) then
key_ = concat(key_, key)
end if

call ESMF_InfoGetFromHost(bundle, host_info, _RC)
info = ESMF_InfoCreate(host_info, key=key_, _RC)

_RETURN(_SUCCESS)
end function info_bundle_create_from_internal

function info_field_create_from_shared(field, rc) result(info)
type(ESMF_Info) :: info
type(ESMF_Field), intent(in) :: field
integer, optional, intent(out) :: rc

integer :: status
type(ESMF_Info) :: host_info

call ESMF_InfoGetFromHost(field, host_info, _RC)
info = ESMF_InfoCreate(host_info, key=INFO_SHARED_NAMESPACE, _RC)

Expand Down Expand Up @@ -828,7 +865,37 @@ subroutine info_field_get_internal_i4(field, key, value, rc)
_RETURN(_SUCCESS)
end subroutine info_field_get_internal_i4

subroutine info_get_bundle_internal_r4_1d(bundle, key, values, rc)
subroutine info_bundle_get_internal_string(bundle, key, value, rc)
type(ESMF_FieldBundle), intent(in) :: bundle
character(*), intent(in) :: key
character(:), allocatable, intent(out) :: value
integer, optional, intent(out) :: rc

integer :: status
type(ESMF_Info) :: info

call ESMF_InfoGetFromHost(bundle, info, _RC)
call MAPL_InfoGet(info, key=concat(INFO_INTERNAL_NAMESPACE,key), value=value, _RC)

_RETURN(_SUCCESS)
end subroutine info_bundle_get_internal_string

subroutine info_bundle_get_internal_i4(bundle, key, value, rc)
type(ESMF_FieldBundle), intent(in) :: bundle
character(*), intent(in) :: key
integer(kind=ESMF_KIND_I4), intent(out) :: value
integer, optional, intent(out) :: rc

integer :: status
type(ESMF_Info) :: info

call ESMF_InfoGetFromHost(bundle, info, _RC)
call MAPL_InfoGet(info, key=concat(INFO_INTERNAL_NAMESPACE,key), value=value, _RC)

_RETURN(_SUCCESS)
end subroutine info_bundle_get_internal_i4

subroutine info_bundle_get_internal_r4_1d(bundle, key, values, rc)
type(ESMF_FieldBundle), intent(in) :: bundle
character(*), intent(in) :: key
real(kind=ESMF_KIND_R4), allocatable, intent(out) :: values(:)
Expand All @@ -841,7 +908,7 @@ subroutine info_get_bundle_internal_r4_1d(bundle, key, values, rc)
call MAPL_InfoGet(info, key=concat(INFO_INTERNAL_NAMESPACE,key), values=values, _RC)

_RETURN(_SUCCESS)
end subroutine info_get_bundle_internal_r4_1d
end subroutine info_bundle_get_internal_r4_1d

subroutine info_stateitem_get_internal_string(state, short_name, key, value, rc)
type(ESMF_State), intent(in) :: state
Expand Down Expand Up @@ -941,6 +1008,21 @@ end subroutine info_stateitem_get_internal_r4_1d

! MAPL_InfoSetInternal

subroutine info_field_set_internal_info(field, key, value, rc)
type(ESMF_Field), intent(in) :: field
character(*), intent(in) :: key
type(ESMF_Info), intent(in) :: value
integer, optional, intent(out) :: rc

integer :: status
type(ESMF_Info) :: field_info

call ESMF_InfoGetFromHost(field, field_info, _RC)
call MAPL_InfoSet(field_info, key=concat(INFO_INTERNAL_NAMESPACE,key), value=value, _RC)

_RETURN(_SUCCESS)
end subroutine info_field_set_internal_info

subroutine info_field_set_internal_string(field, key, value, rc)
type(ESMF_Field), intent(in) :: field
character(*), intent(in) :: key
Expand Down Expand Up @@ -971,6 +1053,66 @@ subroutine info_field_set_internal_i4(field, key, value, rc)
_RETURN(_SUCCESS)
end subroutine info_field_set_internal_i4

subroutine info_bundle_set_internal_info(bundle, key, value, rc)
type(ESMF_FieldBundle), intent(inout) :: bundle
character(*), intent(in) :: key
type(ESMF_Info), intent(in) :: value
integer, optional, intent(out) :: rc

integer :: status
type(ESMF_Info) :: bundle_info

call ESMF_InfoGetFromHost(bundle, bundle_info, _RC)
call MAPL_InfoSet(bundle_info, key=concat(INFO_INTERNAL_NAMESPACE,key), value=value, _RC)

_RETURN(_SUCCESS)
end subroutine info_bundle_set_internal_info

subroutine info_bundle_set_internal_string(bundle, key, value, rc)
type(ESMF_FieldBundle), intent(inout) :: bundle
character(*), intent(in) :: key
character(*), intent(in) :: value
integer, optional, intent(out) :: rc

integer :: status
type(ESMF_Info) :: info

call ESMF_InfoGetFromHost(bundle, info, _RC)
call MAPL_InfoSet(info, key=concat(INFO_INTERNAL_NAMESPACE,key), value=value, _RC)

_RETURN(_SUCCESS)
end subroutine info_bundle_set_internal_string

subroutine info_bundle_set_internal_i4(bundle, key, value, rc)
type(ESMF_FieldBundle), intent(inout) :: bundle
character(*), intent(in) :: key
integer, intent(in) :: value
integer, optional, intent(out) :: rc

integer :: status
type(ESMF_Info) :: info

call ESMF_InfoGetFromHost(bundle, info, _RC)
call MAPL_InfoSet(info, key=concat(INFO_INTERNAL_NAMESPACE,key), value=value, _RC)

_RETURN(_SUCCESS)
end subroutine info_bundle_set_internal_i4

subroutine info_bundle_set_internal_r4_1d(bundle, key, values, rc)
type(ESMF_FieldBundle), intent(inout) :: bundle
character(*), intent(in) :: key
real(kind=ESMF_KIND_R4), dimension(:), intent(in) :: values
integer, optional, intent(out) :: rc

integer :: status
type(ESMF_Info) :: info

call ESMF_InfoGetFromHost(bundle, info, _RC)
call MAPL_InfoSet(info, key=concat(INFO_INTERNAL_NAMESPACE,key), values=values, _RC)

_RETURN(_SUCCESS)
end subroutine info_bundle_set_internal_r4_1d

subroutine info_stateitem_set_internal_string(state, short_name, key, value, rc)
type(ESMF_State), intent(in) :: state
character(*), intent(in) :: short_name
Expand Down
3 changes: 3 additions & 0 deletions esmf_utils/UngriddedDims.F90
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ function make_ungriddedDims(info, key, rc) result(ungridded_dims)

do i = 1, num_ungridded_dims
dim_key = make_dim_key(i, _RC)
if (present(key)) then
dim_key = key // dim_key
end if
dim_info = ESMF_InfoCreate(info, key=dim_key, _RC)
dim_specs(i) = make_ungriddedDim(dim_info, _RC)
call ESMF_InfoDestroy(dim_info, _RC)
Expand Down
2 changes: 1 addition & 1 deletion esmf_utils/tests/Test_FieldDimensionInfo.pf
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ contains
call ESMF_InfoSet(info, KEY_UNGRIDDED_DIMS // KEY_NUM_UNGRIDDED_DIMS, num_ungridded, _RC)

do i=1, num_ungridded
key = make_dim_key(i, _RC)
key = KEY_UNGRIDDED_DIMS // make_dim_key(i, _RC)
name = names_(i)
units = units_(i)
coord = coordinates_(i, :)
Expand Down
3 changes: 3 additions & 0 deletions field_utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ set(srcs
FieldUtils.F90
FieldBLAS.F90
FieldPointerUtilities.F90
FieldDelta.F90
FieldUtilities.F90
FieldUnaryFunctions.F90
FieldBinaryOperations.F90
FieldUnits.F90
FieldCondensedArray.F90
FieldCondensedArray_private.F90
FieldDelta.F90
FieldBundleDelta.F90
)

# To use extended udunits2 procedures, udunits2.c must be built and linked.
Expand Down
Loading

0 comments on commit 0c46242

Please sign in to comment.