forked from ESCOMP/CMEPS
-
Notifications
You must be signed in to change notification settings - Fork 0
Time-travelling ice #7
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
Open
kieranricardo
wants to merge
1
commit into
access-cmeps-0.14.35
Choose a base branch
from
time-travelling-ice
base: access-cmeps-0.14.35
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,7 +33,7 @@ subroutine med_phases_post_atm(gcomp, rc) | |
| use med_map_mod , only : med_map_field_packed | ||
| use med_constants_mod , only : dbug_flag => med_constants_dbug_flag | ||
| use med_utils_mod , only : chkerr => med_utils_ChkErr | ||
| use med_internalstate_mod , only : compocn, compatm, compice, complnd, compwav | ||
| use med_internalstate_mod , only : compocn, compatm, compice, complnd, compwav, coupling_mode | ||
| use perf_mod , only : t_startf, t_stopf | ||
|
|
||
| ! input/output variables | ||
|
|
@@ -58,6 +58,11 @@ subroutine med_phases_post_atm(gcomp, rc) | |
| call ESMF_GridCompGetInternalState(gcomp, is_local, rc) | ||
| if (ChkErr(rc,__LINE__,u_FILE_u)) return | ||
|
|
||
| if (trim(coupling_mode) == 'access') then | ||
| call med_phases_post_atm_custom_access(gcomp, rc) | ||
| if (ChkErr(rc,__LINE__,u_FILE_u)) return | ||
| end if | ||
|
|
||
| ! map atm to ocn | ||
| if (is_local%wrap%med_coupling_active(compatm,compocn)) then | ||
| call t_startf('MED:'//trim(subname)//' map_atm2ocn') | ||
|
|
@@ -126,4 +131,65 @@ subroutine med_phases_post_atm(gcomp, rc) | |
|
|
||
| end subroutine med_phases_post_atm | ||
|
|
||
| subroutine med_phases_post_atm_custom_access(gcomp, rc) | ||
| use med_kind_mod , only : CX=>SHR_KIND_CX, CS=>SHR_KIND_CS, CL=>SHR_KIND_CL, R8=>SHR_KIND_R8 | ||
| use med_internalstate_mod , only : compocn, compatm, compice, coupling_mode | ||
| use med_internalstate_mod , only : InternalState, maintask, logunit | ||
| use ESMF , only : ESMF_GridComp, ESMF_FieldBundleGet, ESMF_FieldCreate | ||
| use ESMF , only : ESMF_FieldGet, ESMF_Field, ESMF_Mesh, ESMF_MESHLOC_ELEMENT, ESMF_TYPEKIND_R8 | ||
| use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_INFO, ESMF_SUCCESS | ||
| use ESMF , only : ESMF_FAILURE, ESMF_LOGMSG_ERROR | ||
| use med_map_mod , only : med_map_field | ||
| use med_internalstate_mod , only : mapconsf | ||
| use med_constants_mod , only : dbug_flag => med_constants_dbug_flag | ||
| use med_methods_mod , only : FB_GetFldPtr => med_methods_FB_GetFldPtr | ||
|
|
||
| ! input/output variables | ||
| type(ESMF_GridComp) :: gcomp | ||
| integer, intent(out) :: rc | ||
|
|
||
| ! local variables | ||
| type(InternalState) :: is_local | ||
| real(R8), pointer :: ice_frac_cat_ptr(:, :), ice_flux_cat_ptr(:, :) | ||
| type(ESMF_Field) :: ice_frac_cat, ice_flux_cat | ||
| integer :: lsize1, lsize2, i, j, n | ||
| character(len=*), parameter :: subname='(med_phases_post_atm_custom_access)' | ||
| character(len=CS) :: fld_names(4) | ||
| !--------------------------------------- | ||
|
|
||
|
Collaborator
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. Possibly unnecessary, but wondering if we should add the logging messages at the start and end just in case debugging is needed: |
||
| rc = ESMF_SUCCESS | ||
|
|
||
| ! Get the internal state | ||
| nullify(is_local%wrap) | ||
| call ESMF_GridCompGetInternalState(gcomp, is_local, rc) | ||
|
|
||
| call ESMF_FieldBundleGet(is_local%wrap%FBImp(compice, compatm), fieldName='ia_aicen', field=ice_frac_cat, rc=rc) | ||
| call ESMF_FieldGet(ice_frac_cat, farrayptr=ice_frac_cat_ptr) | ||
|
|
||
| lsize1 = size(ice_frac_cat_ptr, dim=1) | ||
| lsize2 = size(ice_frac_cat_ptr, dim=2) | ||
|
|
||
| fld_names = [character(len=CS) :: & | ||
| 'topmelt', & | ||
| 'botmelt', & | ||
| 'sublim', & | ||
| 'pen_rad'] | ||
|
|
||
| do n = 1,size(fld_names) | ||
|
|
||
| call ESMF_FieldBundleGet(is_local%wrap%FBImp(compatm, compatm), fieldName=trim(fld_names(n)), field=ice_flux_cat, rc=rc) | ||
| call ESMF_FieldGet(ice_flux_cat, farrayptr=ice_flux_cat_ptr) | ||
|
|
||
| do j = 1,lsize2 | ||
| do i = 1,lsize1 | ||
| if (ice_frac_cat_ptr(i, j) > 0.0) then | ||
| ice_flux_cat_ptr(i, j) = ice_flux_cat_ptr(i, j) / ice_frac_cat_ptr(i, j) | ||
| end if | ||
| end do | ||
| end do | ||
|
|
||
| end do | ||
|
|
||
| end subroutine med_phases_post_atm_custom_access | ||
|
|
||
| end module med_phases_post_atm_mod | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'm not 100% on this, but are the following needed for this subroutine:
If they aren't needed, wondering if it's best to remove them just for clarity?