Repository navigation
Conversation
|
I've added @pchakraborty as a reviewer since he knows the code better than any of us! |
|
@lizziel Would it work if all the changes are moved to AdvCore instead? Both problems can be fixed entirely in For ! pchakrab - maybe use the FV_DynCoreIsRunning flag instead
if (.not. FV3_DynCoreIsRunning) then
call MAPL_GridCompSetGeometry(gc, _RC)
+ ! Done here, not in SetServices: num_levels is not known until Initialize
+ call fv_setup(gc, _RC)
end ifFor the duplicate geometry, AdvCore can pass its The updated subroutine fv_setup(gc, rc)
type(ESMF_GridComp), intent(inout) :: gc
integer, intent(out) :: rc
type(ESMF_VM) :: vm
- type(ESMF_HConfig) :: hconfig
+ type(ESMF_HConfig) :: hconfig, geom_parent_cfg
integer :: p_split = 1
- integer :: comm, im_world, topology(2), num_levels, status
+ integer :: comm, num_levels, status
+ logical :: has_mapl_section, use_mapl_section
call ESMF_VMGetCurrent(vm, _RC)
call ESMF_VMGet(vm, mpiCommunicator=comm, _RC)
call fms_init(comm)
call fv_init1(FV_Atm, dt, grids_on_my_pe, p_split)
call MAPL_GridCompGet(gc, hconfig=hconfig, num_levels=num_levels, _RC)
- call setup_fv_dimensions_and_topology(hconfig, num_levels, FV_Atm(1)%flagstruct, FV_Atm(1)%layout, _RC)
+
+ ! setup_fv_dimensions_and_topology reads geometry:esmf_geom from the
+ ! config it is given; pass the mapl section if the geometry lives there
+ use_mapl_section = .false.
+ has_mapl_section = ESMF_HConfigIsDefined(hconfig, keyString="mapl", _RC)
+ if (has_mapl_section) then
+ geom_parent_cfg = ESMF_HConfigCreateAt(hconfig, keyString="mapl", _RC)
+ use_mapl_section = ESMF_HConfigIsDefined(geom_parent_cfg, keyString="geometry", _RC)
+ if (.not. use_mapl_section) call ESMF_HConfigDestroy(geom_parent_cfg, _RC)
+ end if
+ if (.not. use_mapl_section) geom_parent_cfg = hconfig
+
+ call setup_fv_dimensions_and_topology(geom_parent_cfg, num_levels, FV_Atm(1)%flagstruct, FV_Atm(1)%layout, _RC)
+ if (use_mapl_section) call ESMF_HConfigDestroy(geom_parent_cfg, _RC)
+
call fv_init2(FV_Atm, dt, grids_on_my_pe, p_split)
_RETURN(_SUCCESS)
end subroutine fv_setupI'd like to keep changes to |
I agree that is a better fix. But you opened a PR with that change but then closed it with a note that we would go with my approach instead: #422. Do you remember why? |
Possibly because there was no activity on the PR, and it was my understanding that you had a workaround. |
|
Yes, this PR has the work-around. I can remove it if you want your fix instead and limit this PR to the duplicate geometry issue. Your closed PR can be reopened for merge. |
|
#422 is merged. |
04c77a0 to
8aac8e9
Compare
Signed-off-by: Lizzie Lundgren <elundgren@seas.harvard.edu>
8aac8e9 to
c548f8e
Compare
|
All set for another review. |
This PR contains fixes for two issues in AdvCore when using MAPL3:
SetServices(Bug getting number of vertical levels from AdvCore SetServices #420). In AdvCoreSetServices,num_levelsis now set by reading hconfig rather than retrieval from MAPL, where it is not yet set.maplsection ofadvcore.yaml, whileFV_StateMod.F90subroutineget_imi_work_and_topologyas well asfv_setupget grid information from the geometry in the top-level section of the same file. This required duplicate sections in the same file. This PR updates that to first look in themaplsection, and then look into the top-level section only if it is not found.A few unused local variables are also removed in this PR.