Skip to content

Commit

Permalink
Merge pull request #3466 from GEOS-ESM/feature/bmauer/fixes-#3442
Browse files Browse the repository at this point in the history
Feature/bmauer/fixes #3442
  • Loading branch information
mathomp4 authored Mar 8, 2025
2 parents a3f7889 + e0d93a7 commit 25fc5a4
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added new option to rule for ExtData2G to disable vertical regridding, default is true, vertical regridding is disabled
- Added experimental capabiltiy to regrid from constituents in mass mixing or emissions units from one set of hybrid sigma levels to model levels in ExtData2G
- Added subdirectory GetHorzIJIndex in the Tests directory for testing subroutine MAPL_GetHorzIJIndex to ensure the subroutine fails is teh cubed-sphere assumption is violated and also if the returned I and J indices are not correct.

Expand Down
16 changes: 7 additions & 9 deletions gridcomps/ExtData2G/ExtDataGridCompNG.F90
Original file line number Diff line number Diff line change
Expand Up @@ -692,9 +692,6 @@ SUBROUTINE Run_ ( GC, IMPORT, EXPORT, CLOCK, rc )

if (do_pointer_update(i)) then

call extdata_lgr%debug('ExtData Run_: INTERP_LOOP: interpolating between bracket times, variable: %a, file: %a', &
& trim(current_base_name), trim(item%file_template))

call MAPL_ExtDataVerticalInterpolate(self,item,import,_RC)

endif
Expand Down Expand Up @@ -868,7 +865,8 @@ subroutine new_GetLevs(item, current_time, rc)
end if

item%vcoord = verticalCoordinate(metadata, item%var, _RC)
if (item%vcoord%vertical_type /= NO_COORD .and. item%vcoord%vertical_type /= SIMPLE_COORD ) item%allow_vertical_regrid = .true.
if (item%vcoord%vertical_type /= NO_COORD .and. item%vcoord%vertical_type /= SIMPLE_COORD .and. &
(item%disable_vertical_regrid .eqv. .false.)) item%allow_vertical_regrid = .true.

_RETURN(ESMF_SUCCESS)

Expand Down Expand Up @@ -915,12 +913,10 @@ subroutine MAPL_ExtDataFlipBracketSide(item,bracket_side,rc)
_RETURN(_SUCCESS)
end if

if (item%allow_vertical_regrid) then
if (item%vcoord%positive /= item%importVDir) then
call MAPL_ExtDataFlipVertical(item,bracket_side,_RC)
end if
_RETURN(_SUCCESS)
if (item%vcoord%positive /= item%importVDir) then
call MAPL_ExtDataFlipVertical(item,bracket_side,_RC)
end if
_RETURN(_SUCCESS)
end subroutine MAPL_ExtDataFlipBracketSide

subroutine MAPL_ExtDataVerticalInterpolate(MAPLExtState,item,import,rc)
Expand Down Expand Up @@ -950,6 +946,7 @@ subroutine MAPL_ExtDataVerticalInterpolate(MAPLExtState,item,import,rc)

if (item%allow_vertical_regrid .and. (item%vcoord%vertical_type == model_pressure)) then

call extdata_lgr%info('ExtData vertical conservative regridding of '//trim(item%name))
call ESMF_StateGet(import, "PLE", dst_ple, _RC)
call ESMF_FieldGet(dst_ple,farrayPtr=dst_ple_ptr,_RC)
src_ps_name = item%vcoord%surf_name//"_"//trim(item%vcomp1)
Expand Down Expand Up @@ -979,6 +976,7 @@ subroutine MAPL_ExtDataVerticalInterpolate(MAPLExtState,item,import,rc)
_FAIL(units_in//" not supported for vertical regridding")
end select
else if (item%vcoord%vertical_type == simple_coord .and. item%do_fill) then
call extdata_lgr%info('ExtData filling destination with available layers of source for '//trim(item%name))
call ESMF_FieldBundleGet(item%t_interp_bundle, trim(item%vcomp1), field=src_field, _RC)
call ESMF_StateGet(MAPLExtState%ExtDataState,trim(item%vcomp1),dst_field,_RC)
call MAPL_ExtDataFillField(item, dst_field, src_field, _RC)
Expand Down
1 change: 1 addition & 0 deletions gridcomps/ExtData2G/ExtDataOldTypesCreator.F90
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ subroutine fillin_primary(this,item_name,base_name,primary_item,time,clock,unusa
end if

primary_item%fail_on_missing_file = rule%fail_on_missing_file
primary_item%disable_vertical_regrid= rule%disable_vertical_regrid

_RETURN(_SUCCESS)

Expand Down
7 changes: 7 additions & 0 deletions gridcomps/ExtData2G/ExtDataRule.F90
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module MAPL_ExtDataRule
character(:), allocatable :: vector_partner
character(:), allocatable :: vector_component
character(:), allocatable :: vector_file_partner
logical :: disable_vertical_regrid
logical :: multi_rule
logical :: fail_on_missing_file = .true.
contains
Expand Down Expand Up @@ -111,6 +112,12 @@ function new_ExtDataRule(config,sample_map,key,unusable,multi_rule,rc) result(ru
rule%fail_on_missing_file = ESMF_HConfigAsLogical(config,keyString="fail_on_missing_file",_RC)
end if

if (ESMF_HConfigIsDefined(config,keyString="disable_vertical_regrid")) then
rule%disable_vertical_regrid = ESMF_HConfigAsLogical(config,keyString="disable_vertical_regrid",_RC)
else
rule%disable_vertical_regrid = .true.
end if

rule%multi_rule=usable_multi_rule

_RETURN(_SUCCESS)
Expand Down
1 change: 1 addition & 0 deletions gridcomps/ExtData2G/ExtDataTypeDef.F90
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ module MAPL_ExtDataTypeDef
type(ESMF_FieldBundle) :: t_interp_bundle

character(len=4) :: importVDir = "down"
logical :: disable_vertical_regrid = .true.
logical :: allow_vertical_regrid = .false.


Expand Down

0 comments on commit 25fc5a4

Please sign in to comment.