forked from NOAA-EMC/CMEPS
-
Notifications
You must be signed in to change notification settings - Fork 1
UFS-coastal: CICE implementation #4
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
Draft
SmithJos13
wants to merge
5
commits into
oceanmodeling:feature/coastalapp
Choose a base branch
from
SmithJos13:feature/cice
base: feature/coastalapp
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.
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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 |
---|---|---|
|
@@ -11,6 +11,7 @@ module esmFldsExchange_coastal_mod | |
use med_internalstate_mod , only : compatm | ||
use med_internalstate_mod , only : compocn | ||
use med_internalstate_mod , only : compwav | ||
use med_internalstate_mod , only : compice | ||
use med_internalstate_mod , only : ncomps | ||
use med_internalstate_mod , only : coupling_mode | ||
|
||
|
@@ -38,10 +39,17 @@ module esmFldsExchange_coastal_mod | |
character(len=CX) :: ocn2wav_smap = 'unset' | ||
character(len=CX) :: wav2ocn_smap = 'unset' | ||
character(len=CX) :: wav2atm_smap = 'unset' | ||
|
||
character(len=CX) :: atm2ice_smap = 'unset' | ||
character(len=CX) :: ocn2ice_smap = 'unset' | ||
character(len=CX) :: ice2ocn_smap = 'unset' | ||
character(len=CX) :: ice2atm_smap = 'unset' | ||
|
||
character(len=CS) :: mapnorm = 'one' | ||
logical :: atm_present = .false. | ||
logical :: ocn_present = .false. | ||
logical :: wav_present = .false. | ||
logical :: ice_present = .false. | ||
end type | ||
|
||
!=============================================================================== | ||
|
@@ -140,11 +148,23 @@ subroutine esmFldsExchange_coastal_advt(gcomp, phase, rc) | |
! to med: masks from components | ||
!---------------------------------------------------------- | ||
call addfld_from(compocn, 'So_omask') | ||
call addfld_from(compice, 'Si_imask') | ||
|
||
!---------------------------------------------------------- | ||
! to med: frac from components | ||
!---------------------------------------------------------- | ||
call addfld_to(compatm, 'So_ofrac') | ||
|
||
if (coastal_attr%ice_present .and. coastal_attr%atm_present) then | ||
call addfld_from(compice , 'Si_ifrac') | ||
call addfld_to(compatm , 'Si_ifrac') | ||
|
||
end if | ||
|
||
if (coastal_attr%ice_present .and. coastal_attr%ocn_present) then | ||
call addfld_from(compice , 'Si_ifrac') | ||
call addfld_to(compocn , 'Si_ifrac') | ||
end if | ||
|
||
!===================================================================== | ||
! FIELDS TO OCEAN (compocn) | ||
|
@@ -236,6 +256,84 @@ subroutine esmFldsExchange_coastal_advt(gcomp, phase, rc) | |
deallocate(S_flds) | ||
end if | ||
|
||
! --------------------------------------------------------------------- | ||
! to ice: atm fields | ||
! --------------------------------------------------------------------- | ||
if (coastal_attr%atm_present .and. coastal_attr%ice_present) then | ||
allocate(S_flds(14)) | ||
S_flds = (/'Sa_u ', & ! inst_zonalv_wind_height10m | ||
'Sa_v ', & ! inst_merid_wind_height10m | ||
'Sa_z ', & ! lowest atmospheric height | ||
'Sa_tbot ', & ! tenperature at lowest atm level | ||
'Sa_shum ', & ! Specific Humidity | ||
'Sa_pbot ', & ! pressure bottom | ||
'Faxa_snow ', & ! Snow | ||
'Faxa_rain ', & ! Rain | ||
'Faxa_swvdr', & ! Short-wave | ||
'Faxa_swvdf', & ! Short-wave | ||
'Faxa_swndr', & ! Short-wave | ||
'Faxa_swndf', & ! Short-wave | ||
'Faxa_swnet', & ! Short-wave net | ||
'Faxa_lwdn ' /) ! Long-wave | ||
|
||
do n = 1,size(S_flds) | ||
fldname = trim(S_flds(n)) | ||
call addfld_from(compatm, trim(fldname)) | ||
call addfld_to(compice, trim(fldname)) | ||
end do | ||
deallocate(S_flds) | ||
end if | ||
|
||
! --------------------------------------------------------------------- | ||
! to ice: ocean fields | ||
! --------------------------------------------------------------------- | ||
if (coastal_attr%ocn_present .and. coastal_attr%ice_present) then | ||
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. @SmithJos13 Same in here. Please make sure to use same length for strings in the array. |
||
allocate(S_flds(8)) | ||
S_flds = (/'So_u ', & ! ocn_current_zonal | ||
'So_v ', & ! ocn_current_merid | ||
'So_t ', & ! SST | ||
'So_s ', & ! SSS | ||
'So_h ', & ! depth of ml | ||
'So_dhdx', & ! tilt-x | ||
'So_dhdy', & ! tilt-y | ||
'Fioo_q '/) ! heat flux | ||
do n = 1,size(S_flds) | ||
fldname = trim(S_flds(n)) | ||
call addfld_from(compocn, trim(fldname)) | ||
call addfld_to(compice, trim(fldname)) | ||
end do | ||
deallocate(S_flds) | ||
end if | ||
|
||
! --------------------------------------------------------------------- | ||
! to ocean: ice fields | ||
! --------------------------------------------------------------------- | ||
if (coastal_attr%ocn_present .and. coastal_attr%ice_present) then | ||
allocate(S_flds(13)) | ||
S_flds = (/'Si_ifrac ', & ! Ice area fraction aice | ||
'Si_vice ', & ! Ice volume | ||
'Si_vsno ', & ! Snow volume | ||
'Si_uvel ', & ! Ice u-velocity | ||
'Si_vvel ', & ! Ice v-velocity | ||
'Fioi_meltw', & ! Fresh water flux due to melting/freeze | ||
'Fioi_melth', & ! Ice-to-ocean heat flux at base of ice | ||
'Fioi_taux ', & ! Ice-to-ocean surface stress in x-dir | ||
'Fioi_tauy ', & ! Ice-to-ocean surface stress in y-dir | ||
'Fioi_salt ', & ! Salinity flux due to melting/freeze | ||
'Fioi_swpen', & ! Penatrive SW radiation flux | ||
'Si_frzmlt ', & ! Energy used to create ice (all energy sst-tfrz) | ||
'Si_CdnIO ' /) ! ice drag coeff | ||
|
||
do n = 1,size(S_flds) | ||
fldname = trim(S_flds(n)) | ||
call addfld_from(compice, trim(fldname)) | ||
call addfld_to(compocn, trim(fldname)) | ||
end do | ||
deallocate(S_flds) | ||
end if | ||
|
||
|
||
|
||
call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) | ||
|
||
end subroutine esmFldsExchange_coastal_advt | ||
|
@@ -458,8 +556,161 @@ subroutine esmFldsExchange_coastal_init(gcomp, phase, rc) | |
end do | ||
deallocate(S_flds) | ||
end if | ||
|
||
|
||
!====================================================================== | ||
! BEGIN FIELDS TO ICE (compice) | ||
!====================================================================== | ||
! --------------------------------------------------------------------- | ||
! To ice from atm | ||
! --------------------------------------------------------------------- | ||
! ---------------------------------------- | ||
! | Atmospheric Fields: | | ||
! ---------------------------------------- | ||
! - zonal wind height 10m [m/s] | ||
! - merid wind height 10m [m/s] | ||
! - lowest atmospheric height [m] (defualt in CICE is 10m see model comp) | ||
! - Temperature at 10m [k] | ||
! - Specific Humidity [kg/kg] | ||
! - Pressure at 10m [Pa] | ||
! - Rainfall rate [kg/m/m/s] | ||
! - Snowfall rate [kg/m/m/s] | ||
! - Net shortwave rad [W/m/m] Other bands are derived from this | ||
! - Net longwave rad [W/m/m] | ||
! --------------------------------------- | ||
if (coastal_attr%atm_present .and. coastal_attr%ice_present) then | ||
allocate(S_flds(14)) | ||
S_flds = (/'Sa_u ', & ! inst_zonal_wind_height10m | ||
'Sa_v ', & ! inst_merid_wind_height10m | ||
'Sa_z ', & ! lowest atmospheric height | ||
'Sa_tbot ', & ! tenperature at lowest atm level | ||
'Sa_shum ', & ! Specific Humidity | ||
'Sa_pbot ', & ! pressure bottom | ||
'Faxa_rain ', & ! Rain | ||
'Faxa_snow ', & ! Snow | ||
'Faxa_swvdr', & ! Short-wave | ||
'Faxa_swvdf', & ! Short-wave | ||
'Faxa_swndr', & ! Short-wave | ||
'Faxa_swndf', & ! Short-wave | ||
'Faxa_swnet', & ! Short-wave net | ||
'Faxa_lwdn '/) ! long-wave | ||
do n = 1,size(S_flds) | ||
fldname = trim(S_flds(n)) | ||
if (fldchk(is_local%wrap%FBExp(compice),trim(fldname),rc=rc) .and. & | ||
fldchk(is_local%wrap%FBImp(compatm,compatm),trim(fldname),rc=rc) & | ||
) then | ||
call addmap_from(compatm, trim(fldname), compice, & | ||
mapnstod_consf, coastal_attr%mapnorm, coastal_attr%atm2ice_smap) !!mapnstod_consf conservative interp | ||
call addmrg_to(compice, trim(fldname), & | ||
mrg_from=compatm, mrg_fld=trim(fldname), mrg_type='copy') | ||
end if | ||
end do | ||
deallocate(S_flds) | ||
end if | ||
|
||
! --------------------------------------------------------------------- | ||
! To ice from ocn fields | ||
! --------------------------------------------------------------------- | ||
! ---------------------------------------- | ||
! | Oceanic fields: | | ||
! ---------------------------------------- | ||
! - zonal current [m/s] | ||
! - merid current [m/s] | ||
! - Sea Surface temperature [K] | ||
! - Sea surface salinity [psu. (g/kg)] | ||
! - Mixed layer depth [m] | ||
! - Zonal sea surface tilt [1] | ||
! - Merid sea surface tilt [1] | ||
! - deep ocean heatflux [W/m/m] | ||
! --------------------------------------- | ||
|
||
if (coastal_attr%ocn_present .and. coastal_attr%ice_present) then | ||
allocate(S_flds(8)) | ||
S_flds = (/'So_u ', & ! ocn_current_zonal | ||
'So_v ', & ! ocn_current_merid | ||
'So_t ', & ! SST | ||
'So_s ', & ! SSS | ||
'So_h ', & ! depth of ml | ||
'So_dhdx', & ! tilt-x | ||
'So_dhdy', & ! tilt-y | ||
'Fioo_qi'/) ! heat flux | ||
|
||
call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) | ||
do n = 1,size(S_flds) | ||
fldname = trim(S_flds(n)) | ||
if (fldchk(is_local%wrap%FBExp(compice),trim(fldname),rc=rc) .and. & | ||
fldchk(is_local%wrap%FBImp(compocn,compocn),trim(fldname),rc=rc) & | ||
) then | ||
call addmap_from(compocn, trim(fldname), compice, & | ||
mapbilnr_nstod, coastal_attr%mapnorm, coastal_attr%ocn2ice_smap) | ||
call addmrg_to(compice, trim(fldname), & | ||
mrg_from=compocn, mrg_fld=trim(fldname), mrg_type='copy') | ||
end if | ||
end do | ||
deallocate(S_flds) | ||
end if | ||
|
||
!====================================================================== | ||
! END FIELDS TO ICE (compice) | ||
!====================================================================== | ||
|
||
!====================================================================== | ||
! BEGIN FIELDS FROM ICE (compice) | ||
!====================================================================== | ||
! --------------------------------------------------------------------- | ||
! To ocn from ice fields | ||
! --------------------------------------------------------------------- | ||
! ---------------------------------------- | ||
! | Ice fields: | | ||
! ---------------------------------------- | ||
! - Ice area fraction [1] | ||
! - Ice volume [m^3] | ||
! - Snow volume [m^3] | ||
! - Ice merid vel. [m/s] | ||
! - Ice Zonal vel. [m/s] | ||
! - Fresh water flux [kg/m/m/s] | ||
! - Heat flux at base of ice [W/m/m] | ||
! - Ice-to-Ocn merid stress [N/m/m] | ||
! - Ice-to-Ocn zonal stress [N/m/m] | ||
! - Salinity flux [kg/m/m/s] | ||
! - Shortwave pen. rad [W/m/m] | ||
! - Freeze melt potential [W/m/m] (Internal energy mixed layer) | ||
! - Ice ocean drag [1] (Computed by ice component) | ||
|
||
if (coastal_attr%ocn_present .and. coastal_attr%ice_present) then | ||
allocate(S_flds(13)) | ||
S_flds = (/'Si_ifrac ', & ! Ice area fraction aice | ||
'Si_vice ', & ! Ice volume | ||
'Si_vsno ', & ! Snow volume | ||
'Si_uvel ', & ! Ice u-velocity | ||
'Si_vvel ', & ! Ice v-velocity | ||
'Fioi_meltw', & ! Fresh water flux due to melting/freeze | ||
'Fioi_melth', & ! Ice-to-ocean heat flux at base of ice | ||
'Fioi_taux ', & ! Ice-to-ocean surface stress in x-dir | ||
'Fioi_tauy ', & ! Ice-to-ocean surface stress in y-dir | ||
'Fioi_salt ', & ! Salinity flux due to melting/freeze | ||
'Fioi_swpen', & ! Penatrive SW radiation flux | ||
'Si_frzmlt ', & ! Energy used to create ice (all energy sst-tfrz) | ||
'Si_CdnIO ' /) ! ice drag | ||
|
||
call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) | ||
do n = 1,size(S_flds) | ||
fldname = trim(S_flds(n)) | ||
if (fldchk(is_local%wrap%FBExp(compocn),trim(fldname),rc=rc) .and. & | ||
fldchk(is_local%wrap%FBImp(compice,compice),trim(fldname),rc=rc) & | ||
) then | ||
call addmap_from(compice, trim(fldname), compocn, & | ||
mapnstod_consf, coastal_attr%mapnorm, coastal_attr%ice2ocn_smap) | ||
call addmrg_to(compocn, trim(fldname), & | ||
mrg_from=compice, mrg_fld=trim(fldname), mrg_type='copy') | ||
end if | ||
end do | ||
deallocate(S_flds) | ||
end if | ||
|
||
!====================================================================== | ||
! END FIELDS FROM ICE (compice) | ||
!====================================================================== | ||
|
||
end subroutine esmFldsExchange_coastal_init | ||
|
||
|
@@ -513,6 +764,13 @@ subroutine esmFldsExchange_coastal_attr(gcomp, coastal_attr, rc) | |
if (trim(cvalue) /= 'swav') coastal_attr%wav_present = .true. | ||
end if | ||
|
||
call NUOPC_CompAttributeGet(gcomp, name='ICE_model', & | ||
value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) | ||
if (ChkErr(rc,__LINE__,u_FILE_u)) return | ||
if (isPresent .and. isSet) then | ||
if (trim(cvalue) /= 'sice') coastal_attr%ice_present = .true. | ||
end if | ||
|
||
!---------------------------------------------------------- | ||
! Normalization type | ||
!---------------------------------------------------------- | ||
|
@@ -592,6 +850,33 @@ subroutine esmFldsExchange_coastal_attr(gcomp, coastal_attr, rc) | |
if (chkerr(rc,__LINE__,u_FILE_u)) return | ||
end if | ||
|
||
! to ice | ||
call NUOPC_CompAttributeGet(gcomp, name='atm2ice_smapname', & | ||
isPresent=isPresent, rc=rc) | ||
if (chkerr(rc,__LINE__,u_FILE_u)) return | ||
if (isPresent) then | ||
call NUOPC_CompAttributeGet(gcomp, name='atm2ice_smapname', & | ||
value=coastal_attr%atm2ice_smap, rc=rc) | ||
if (chkerr(rc,__LINE__,u_FILE_u)) return | ||
end if | ||
call NUOPC_CompAttributeGet(gcomp, name='ocn2ice_smapname', & | ||
isPresent=isPresent, rc=rc) | ||
if (chkerr(rc,__LINE__,u_FILE_u)) return | ||
if (isPresent) then | ||
call NUOPC_CompAttributeGet(gcomp, name='ocn2ice_smapname', & | ||
value=coastal_attr%ocn2ice_smap, rc=rc) | ||
if (chkerr(rc,__LINE__,u_FILE_u)) return | ||
end if | ||
|
||
call NUOPC_CompAttributeGet(gcomp, name='ice2ocn_smapname', & | ||
isPresent=isPresent, rc=rc) | ||
if (chkerr(rc,__LINE__,u_FILE_u)) return | ||
if (isPresent) then | ||
call NUOPC_CompAttributeGet(gcomp, name='ice2ocn_smapname', & | ||
value=coastal_attr%ice2ocn_smap, rc=rc) | ||
if (chkerr(rc,__LINE__,u_FILE_u)) return | ||
end if | ||
|
||
! Log Attribute Settings | ||
if (btest(verbosity,16)) then | ||
write(cvalue,"(I0)") verbosity | ||
|
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.
@SmithJos13 You have 13 field but the size is 14. Please check also other sections. They must be consistent.