-
Notifications
You must be signed in to change notification settings - Fork 103
Reduce the memory usage that is important for ne1024 simulation #665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -169,7 +169,7 @@ subroutine med_fraction_init(gcomp, rc) | |
| ! Initialize FBFrac(:) field bundles | ||
|
|
||
| use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_INFO | ||
| use ESMF , only : ESMF_SUCCESS | ||
| use ESMF , only : ESMF_SUCCESS, ESMF_FAILURE, ESMF_LogSetError | ||
| use ESMF , only : ESMF_GridComp, ESMF_GridCompGet, ESMF_StateIsCreated | ||
| use ESMF , only : ESMF_FieldBundle, ESMF_FieldBundleIsCreated, ESMF_FieldBundleDestroy | ||
| use ESMF , only : ESMF_FieldBundleGet | ||
|
|
@@ -181,6 +181,7 @@ subroutine med_fraction_init(gcomp, rc) | |
| use med_internalstate_mod , only : InternalState | ||
| use med_map_mod , only : med_map_routehandles_init, med_map_rh_is_created | ||
| use med_methods_mod , only : State_getNumFields => med_methods_State_getNumFields | ||
| use NUOPC , only : NUOPC_CompAttributeGet | ||
| use perf_mod , only : t_startf, t_stopf | ||
|
|
||
| ! input/output variables | ||
|
|
@@ -208,6 +209,8 @@ subroutine med_fraction_init(gcomp, rc) | |
| integer :: n,n1,ns | ||
| integer :: maptype | ||
| integer :: fieldCount | ||
| logical :: isPresent, isSet, lexist | ||
| character(len=CX) :: lnd2rof_fmap ! consd (destarea) lnd->rof fraction-map file | ||
| logical, save :: first_call = .true. | ||
| character(len=*),parameter :: subname=' (med_fraction_init)' | ||
| !--------------------------------------- | ||
|
|
@@ -584,10 +587,34 @@ subroutine med_fraction_init(gcomp, rc) | |
| if (is_local%wrap%comp_present(complnd)) then | ||
| maptype = mapconsd | ||
| if (.not. med_map_RH_is_created(is_local%wrap%RH(complnd,comprof,:),maptype, rc=rc)) then | ||
| call med_map_routehandles_init( complnd, comprof, & | ||
| FBSrc=is_local%wrap%FBImp(complnd,complnd), & | ||
| FBDst=is_local%wrap%FBImp(complnd,comprof), & | ||
| mapindex=maptype, RouteHandle=is_local%wrap%RH, rc=rc) | ||
| ! The lnd->rof fraction map may be the only grid-crossing conservative coupling | ||
| ! map in a configuration, and computing its weights online (ESMF_FieldRegridStore) | ||
| ! can be prohibitively memory-heavy at high resolution. If the 'lnd2rof_fmap' | ||
| ! attribute names a file of offline consd (conserve/destarea) fraction weights, | ||
| ! read the weights from that file; otherwise compute them online. | ||
| call NUOPC_CompAttributeGet(gcomp, name='lnd2rof_fmap', value=lnd2rof_fmap, & | ||
| isPresent=isPresent, isSet=isSet, rc=rc) | ||
| if (ChkErr(rc,__LINE__,u_FILE_u)) return | ||
| if (.not. (isPresent .and. isSet)) lnd2rof_fmap = 'unset' | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like this line is redundant with the initialization to 'unset' a few lines above, and that just one or the other could be kept, with the other removed.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch. I have removed |
||
| if (lnd2rof_fmap /= 'unset') then | ||
| inquire(file=lnd2rof_fmap, exist=lexist) | ||
| if (.not. lexist) then | ||
| call ESMF_LogSetError(ESMF_FAILURE, & | ||
| msg=trim(subname)//': lnd2rof_fmap weight file not found: '//trim(lnd2rof_fmap), & | ||
| line=__LINE__, file=u_FILE_u, rcToReturn=rc) | ||
| return | ||
| end if | ||
| call med_map_routehandles_init( complnd, comprof, & | ||
| FBSrc=is_local%wrap%FBImp(complnd,complnd), & | ||
| FBDst=is_local%wrap%FBImp(complnd,comprof), & | ||
| mapindex=maptype, RouteHandle=is_local%wrap%RH, & | ||
| mapfile=trim(lnd2rof_fmap), rc=rc) | ||
| else | ||
| call med_map_routehandles_init( complnd, comprof, & | ||
| FBSrc=is_local%wrap%FBImp(complnd,complnd), & | ||
| FBDst=is_local%wrap%FBImp(complnd,comprof), & | ||
| mapindex=maptype, RouteHandle=is_local%wrap%RH, rc=rc) | ||
| end if | ||
| if (ChkErr(rc,__LINE__,u_FILE_u)) return | ||
| end if | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly, it looks like the difference between this and LND2ROF_FMAPNAME is that this one uses consd mapping and the other uses consf mapping. Is that right? If so, I think it would be useful to extend the comment in LND2ROF_FMAPNAME pointing out that that one uses consf mapping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. I updated it in the latest commit.