Skip to content

Commit

Permalink
test 2-step mesh creation
Browse files Browse the repository at this point in the history
  • Loading branch information
DeniseWorthen committed Feb 9, 2025
1 parent 51c2d29 commit 78729a5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
32 changes: 28 additions & 4 deletions model/src/wav_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ module wav_comp_nuopc
use shr_is_restart_fh_mod , only : init_is_restart_fh, is_restart_fh, is_restart_fh_type
#endif
use constants , only : is_esmf_component
! debug
use wav_shr_mod , only : twostep

implicit none
private ! except
Expand Down Expand Up @@ -358,6 +360,16 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
write(logmsg,'(A,l)') trim(subname)//': Wave multigrid setting is ',multigrid
call ESMF_LogWrite(trim(logmsg), ESMF_LOGMSG_INFO)

! debug
twostep = .false.
call NUOPC_CompAttributeGet(gcomp, name='twostep', value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
if (isPresent .and. isSet) then
twostep=(trim(cvalue)=="true")
end if
write(logmsg,'(A,l)') trim(subname)//': Wave twostep setting is ',twostep
call ESMF_LogWrite(trim(logmsg), ESMF_LOGMSG_INFO)

! Determine wave-ice coupling
wav_coupling_to_cice = .false.
call NUOPC_CompAttributeGet(gcomp, name='wav_coupling_to_cice', value=cvalue, isPresent=isPresent, &
Expand Down Expand Up @@ -490,6 +502,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
character(ESMF_MAXSTR) :: preamb = './'
character(ESMF_MAXSTR) :: ifname = 'ww3_multi.inp'
character(len=*), parameter :: subname = '(wav_comp_nuopc:InitializeRealize)'
! debug
type(ESMF_Mesh) :: EMeshTemp
! -------------------------------------------------------------------

rc = ESMF_SUCCESS
Expand Down Expand Up @@ -894,10 +908,20 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
! get the mesh file name
call NUOPC_CompAttributeGet(gcomp, name='mesh_wav', value=cvalue, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
! read in the mesh with the the DistGrid
EMesh = ESMF_MeshCreate(filename=trim(cvalue), fileformat=ESMF_FILEFORMAT_ESMFMESH, &
elementDistgrid=Distgrid,rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

if (twostep) then
! read in the mesh w/ the autogenerated distrid
EMeshTemp = ESMF_MeshCreate(filename=trim(cvalue), fileformat=ESMF_FILEFORMAT_ESMFMESH,rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
! recreate the mesh using the above distGrid
EMesh = ESMF_MeshCreate(EMeshTemp, elementDistgrid=Distgrid, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
else
! read in the mesh with the the DistGrid
EMesh = ESMF_MeshCreate(filename=trim(cvalue), fileformat=ESMF_FILEFORMAT_ESMFMESH, &
elementDistgrid=Distgrid,rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end if

if (dbug_flag > 5) then
if (unstr_mesh) then
Expand Down
4 changes: 3 additions & 1 deletion model/src/wav_shr_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ module wav_shr_mod
logical , public :: merge_import = .false. !< @public logical to specify whether import fields will
!! be merged with a field provided from a file
logical , public :: multigrid = .false. !< @public logical to control whether wave model is run
!! as multigrid
!! as multigrid
! debug
logical, public :: twostep = .false.

interface ymd2date
module procedure ymd2date_int
Expand Down

0 comments on commit 78729a5

Please sign in to comment.