Skip to content
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

new multiple ice sheet functionality #140

Merged
merged 14 commits into from
Dec 1, 2020
116 changes: 41 additions & 75 deletions mediator/esmFlds.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,29 @@ module esmflds
! Set components
!-----------------------------------------------

integer, public, parameter :: ncomps = 8
integer, public, parameter :: compmed = 1
integer, public, parameter :: compatm = 2
integer, public, parameter :: complnd = 3
integer, public, parameter :: compocn = 4
integer, public, parameter :: compice = 5
integer, public, parameter :: comprof = 6
integer, public, parameter :: compwav = 7
integer, public, parameter :: compglc = 8
integer, public, parameter :: compmed = 1
integer, public, parameter :: compatm = 2
integer, public, parameter :: complnd = 3
integer, public, parameter :: compocn = 4
integer, public, parameter :: compice = 5
integer, public, parameter :: comprof = 6
integer, public, parameter :: compwav = 7
integer, public, parameter :: compglc1 = 8
integer, public, parameter :: ncomps = 8
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? Why number of components is still 8?


character(len=*), public, parameter :: compname(ncomps) = &
(/'med','atm','lnd','ocn','ice','rof','wav','glc'/)
(/'med ',&
'atm ',&
'lnd ',&
'ocn ',&
'ice ',&
'rof ',&
'wav ',&
'glc '/)

integer, public, parameter :: max_icesheets = 1
integer, public :: compglc(max_icesheets) = (/compglc1/)
integer, public :: num_icesheets = 1

mvertens marked this conversation as resolved.
Show resolved Hide resolved
!-----------------------------------------------
! Set mappers
Expand All @@ -36,10 +47,10 @@ module esmflds
integer , public, parameter :: mapnstod_consd = 7 ! nearest source to destination followed by conservative dst
integer , public, parameter :: mapnstod_consf = 8 ! nearest source to destination followed by conservative frac
integer , public, parameter :: mappatch_uv3d = 9 ! rotate u,v to 3d cartesian space, map from src->dest, then rotate back
integer , public, parameter :: map_glc2ocn_ice = 10 ! custom smoothing map to map ice from glc->ocn (cesm only)
integer , public, parameter :: map_glc2ocn_liq = 11 ! custom smoothing map to map liq from glc->ocn (cesm only)
integer , public, parameter :: map_rof2ocn_ice = 12 ! custom smoothing map to map ice from rof->ocn (cesm only)
integer , public, parameter :: map_rof2ocn_liq = 13 ! custom smoothing map to map liq from rof->ocn (cesm only)
integer , public, parameter :: map_rof2ocn_ice = 10 ! custom smoothing map to map ice from rof->ocn (cesm only)
integer , public, parameter :: map_rof2ocn_liq = 11 ! custom smoothing map to map liq from rof->ocn (cesm only)
integer , public, parameter :: map_glc2ocn_liq = 12 ! custom smoothing map to map liq from glc->ocn (cesm only)
integer , public, parameter :: map_glc2ocn_ice = 13 ! custom smoothing map to map ice from glc->ocn (cesm only)
integer , public, parameter :: nmappers = 13

character(len=*) , public, parameter :: mapnames(nmappers) = &
Expand Down Expand Up @@ -211,43 +222,25 @@ end subroutine med_fldList_AddFld

!================================================================================

subroutine med_fldList_AddMrg(flds, fldname, &
mrg_from1, mrg_fld1, mrg_type1, mrg_fracname1, &
mrg_from2, mrg_fld2, mrg_type2, mrg_fracname2, &
mrg_from3, mrg_fld3, mrg_type3, mrg_fracname3, &
mrg_from4, mrg_fld4, mrg_type4, mrg_fracname4)
subroutine med_fldList_AddMrg(flds, fldname, mrg_from, mrg_fld, mrg_type, mrg_fracname)

! ----------------------------------------------
! Determine mrg entry or entries in flds aray
! ----------------------------------------------

use ESMF, only : ESMF_FAILURE, ESMF_LogWrite
use ESMF, only : ESMF_LOGMSG_INFO, ESMF_LOGMSG_ERROR
use ESMF, only : ESMF_LogWrite, ESMF_END_ABORT, ESMF_LOGMSG_ERROR, ESMF_Finalize

! input/output variables
type(med_fldList_entry_type) , pointer :: flds(:)
character(len=*) , intent(in) :: fldname
integer , intent(in) , optional :: mrg_from1
character(len=*) , intent(in) , optional :: mrg_fld1
character(len=*) , intent(in) , optional :: mrg_type1
character(len=*) , intent(in) , optional :: mrg_fracname1
integer , intent(in) , optional :: mrg_from2
character(len=*) , intent(in) , optional :: mrg_fld2
character(len=*) , intent(in) , optional :: mrg_type2
character(len=*) , intent(in) , optional :: mrg_fracname2
integer , intent(in) , optional :: mrg_from3
character(len=*) , intent(in) , optional :: mrg_fld3
character(len=*) , intent(in) , optional :: mrg_type3
character(len=*) , intent(in) , optional :: mrg_fracname3
integer , intent(in) , optional :: mrg_from4
character(len=*) , intent(in) , optional :: mrg_fld4
character(len=*) , intent(in) , optional :: mrg_type4
character(len=*) , intent(in) , optional :: mrg_fracname4
type(med_fldList_entry_type) , pointer :: flds(:)
character(len=*) , intent(in) :: fldname
integer , intent(in) :: mrg_from
character(len=*) , intent(in) :: mrg_fld
character(len=*) , intent(in) :: mrg_type
character(len=*) , intent(in), optional :: mrg_fracname

! local variables
integer :: n, id
integer :: rc
character(len=*), parameter :: subname='(med_fldList_MrgFld)'
character(len=*), parameter :: subname='(med_fldList_AddMrg)'
! ----------------------------------------------

id = 0
Expand All @@ -261,42 +254,15 @@ subroutine med_fldList_AddMrg(flds, fldname, &
do n = 1,size(flds)
write(6,*) trim(subname)//' input flds entry is ',trim(flds(n)%stdname)
end do
call ESMF_LogWrite(subname // 'ERROR: fldname '// trim(fldname) // ' not found in input flds', ESMF_LOGMSG_INFO)
rc = ESMF_FAILURE
return
call ESMF_LogWrite(subname // 'ERROR: fldname '// trim(fldname) // ' not found in input flds', ESMF_LOGMSG_ERROR)
call ESMF_Finalize(endflag=ESMF_END_ABORT)
end if

if (present(mrg_from1) .and. present(mrg_fld1) .and. present(mrg_type1)) then
n = mrg_from1
flds(id)%merge_fields(n) = mrg_fld1
flds(id)%merge_types(n) = mrg_type1
if (present(mrg_fracname1)) then
flds(id)%merge_fracnames(n) = mrg_fracname1
end if
end if
if (present(mrg_from2) .and. present(mrg_fld2) .and. present(mrg_type2)) then
n = mrg_from2
flds(id)%merge_fields(n) = mrg_fld2
flds(id)%merge_types(n) = mrg_type2
if (present(mrg_fracname2)) then
flds(id)%merge_fracnames(n) = mrg_fracname2
end if
end if
if (present(mrg_from3) .and. present(mrg_fld3) .and. present(mrg_type3)) then
n = mrg_from3
flds(id)%merge_fields(n) = mrg_fld3
flds(id)%merge_types(n) = mrg_type3
if (present(mrg_fracname3)) then
flds(id)%merge_fracnames(n) = mrg_fracname3
end if
end if
if (present(mrg_from4) .and. present(mrg_fld4) .and. present(mrg_type4)) then
n = mrg_from4
flds(id)%merge_fields(n) = mrg_fld4
flds(id)%merge_types(n) = mrg_type4
if (present(mrg_fracname4)) then
flds(id)%merge_fracnames(n) = mrg_fracname4
end if
n = mrg_from
flds(id)%merge_fields(n) = mrg_fld
flds(id)%merge_types(n) = mrg_type
if (present(mrg_fracname)) then
flds(id)%merge_fracnames(n) = mrg_fracname
end if

end subroutine med_fldList_AddMrg
Expand Down
Loading