Skip to content

Commit

Permalink
Update WW3 submodule and related changes
Browse files Browse the repository at this point in the history
 - E3SM WW3 branch has been rebased on most recent NOAA-EMC develop branch
   (fc3576f413acfe44f4c81e95eefd8ff7b5b21cdd)

   On top of this there are two important modifications:

     1) Fixes for rotated global unstructured meshes
     2) Re-organization of ww3_grid code into new module and subroutine

 - wav_comp_mct.F90 has been modified to update the interfaces to w3init
   and w3wave from the develop branch.

 - buildlib_cmake has be updated for the develop branch, w3_setup no
   longer uses the -c argument

 - buildlib_cmake now runs w3_source on the ww3_grid target to generate
   source code for the  w3gridmd module used to call w3grid from within
   wav_comp_init

 -  The wave_comp_init subroutine in wave_comp_mct.F was modified to
    call w3grid to generate the mod_def.ww3 and other related files
    prior to running the wave model. This is done serially.
  • Loading branch information
sbrus89 committed Apr 2, 2021
1 parent 3f29f2b commit 0db63bb
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 29 deletions.
13 changes: 8 additions & 5 deletions components/ww3/cime_config/buildlib_cmake
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,18 @@ def buildlib(bldroot, installpath, case):
y
""".format(sf90, scc, tmpdir))

run_bld_cmd_ensure_logging("./w3_setup {} -c {} -s E3SM < w3_setup.inp".format(modeldir, comp), logger, from_dir=bindir)
run_bld_cmd_ensure_logging("./w3_setup {} -s E3SM < w3_setup.inp".format(modeldir), logger, from_dir=bindir)
os.remove(inp_file)
os.remove(os.path.join(bindir, "switch_E3SM"))

# Generate pre-processed WW3 source code
tarfile = "{}/work/ww3_shel.tar.gz".format(modeldir)
run_bld_cmd_ensure_logging("./w3_source ww3_shel", logger, from_dir=bindir)
shutil.move(tarfile, tmpdir)
run_bld_cmd_ensure_logging("tar -xzvf ww3_shel.tar.gz", logger, from_dir=tmpdir)
ww3_exe = ['ww3_shel','ww3_grid']
for exe in ww3_exe:
run_bld_cmd_ensure_logging("./w3_source {}".format(exe), logger, from_dir=bindir)
for exe in ww3_exe:
tarfile = "{}/work/{}.tar.gz".format(modeldir,exe)
shutil.move(tarfile, tmpdir)
run_bld_cmd_ensure_logging("tar -xzvf {}.tar.gz".format(exe), logger, from_dir=tmpdir)

with open(os.path.join(casebuild, "ww3conf", "Filepath"), "w") as fd:
fd.write(
Expand Down
67 changes: 44 additions & 23 deletions components/ww3/src/cpl/wav_comp_mct.F90
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ MODULE WAV_COMP_MCT
!/
use w3initmd, only: w3init
use w3wavemd, only: w3wave
use w3gridmd, only: w3grid
!/
use w3iopomd, only:
use w3timemd, only: stme21
Expand Down Expand Up @@ -208,6 +209,7 @@ MODULE WAV_COMP_MCT
private :: wav_domain_mct

integer,save :: stdout
integer,save :: odat(40)

include "mpif.h"
!--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down Expand Up @@ -249,6 +251,7 @@ SUBROUTINE WAV_INIT_MCT( EClock, cdata, x2w_w, w2x_w, NLFilename )
integer :: stop_ymd ! stop date (yyyymmdd)
integer :: stop_tod ! stop time of day (sec)
integer :: ix, iy
integer :: iproc

character(CL) :: starttype
type(mct_gsmap), pointer :: gsmap
Expand All @@ -257,7 +260,7 @@ SUBROUTINE WAV_INIT_MCT( EClock, cdata, x2w_w, w2x_w, NLFilename )

integer :: unitn ! namelist unit number
integer :: ndso, ndse, nds(13), ntrace(2), time0(2)
integer :: timen(2), odat(35), nh(4), iprt(6)
integer :: timen(2), nh(4), iprt(6)
integer :: i,j,npts
integer :: ierr
integer :: jsea,isea
Expand Down Expand Up @@ -294,13 +297,41 @@ SUBROUTINE WAV_INIT_MCT( EClock, cdata, x2w_w, w2x_w, NLFilename )
namelist /ww3_inparm/ initfile, outfreq

!--------------------------------------------------------------------
! Set up data structures
! Initialize mpi
!--------------------------------------------------------------------

call w3nmod ( 1, 6, 6 )
call seq_cdata_setptrs(cdata, id=compid, mpicom=mpi_comm, &
gsmap=gsmap, dom=dom, infodata=infodata)
inst_name = seq_comm_name(compid)
inst_index = seq_comm_inst(compid)
inst_suffix = seq_comm_suffix(compid)
call ww3_cpl_indices_set()

!--------------------------------------------------------------------
! Initialize WW3 grid
!--------------------------------------------------------------------

call mpi_barrier ( mpi_comm, ierr )

call mpi_comm_rank(mpi_comm, iproc, ierr)
if ( iproc .eq. 1 ) then
call w3grid
endif

call mpi_barrier ( mpi_comm, ierr )

!--------------------------------------------------------------------
! Set up data structures
!--------------------------------------------------------------------

if ( iproc .ne. 1) then
call w3nmod ( 1, 6, 6 ) ! this is called for iproc = 1 in w3grid
endif
call w3ndat ( 6, 6 )
call w3naux ( 6, 6 )
call w3nout ( 6, 6 )
if ( iproc .ne. 1 ) then
call w3nout ( 6, 6 ) ! this is called for iproc = 1 in w3grid
end if
call w3ninp ( 6, 6 )

call w3setg ( 1, 6, 6 )
Expand All @@ -309,17 +340,6 @@ SUBROUTINE WAV_INIT_MCT( EClock, cdata, x2w_w, w2x_w, NLFilename )
call w3seto ( 1, 6, 6 )
call w3seti ( 1, 6, 6 )

!--------------------------------------------------------------------
! Initialize mpi
!--------------------------------------------------------------------

call seq_cdata_setptrs(cdata, id=compid, mpicom=mpi_comm, &
gsmap=gsmap, dom=dom, infodata=infodata)
inst_name = seq_comm_name(compid)
inst_index = seq_comm_inst(compid)
inst_suffix = seq_comm_suffix(compid)
call ww3_cpl_indices_set()

call mpi_comm_size(mpi_comm, naproc, ierr)
call mpi_comm_rank(mpi_comm, iaproc, ierr)
iaproc = iaproc + 1
Expand Down Expand Up @@ -476,17 +496,18 @@ SUBROUTINE WAV_INIT_MCT( EClock, cdata, x2w_w, w2x_w, NLFilename )
! Actually will need a new restart flag - since all of the ODAT
! should be set to 0 - since they are initializated in w3initmd
! ODAT I.A. I Output data, five parameters per output type
! 1-5 Data for OTYPE = 1; gridded fields.
! 1 YYYMMDD for first output.
! 2 HHMMSS for first output.
! 3 Output interval in seconds.
! 4 YYYMMDD for last output.
! 5 HHMMSS for last output.
! 1-5 Data for OTYPE = 1; gridded fields.
! 6-10 Id. for OTYPE = 2; point output.
! 11-15 Id. for OTYPE = 3; track point output.
! 16-20 Id. for OTYPE = 4; restart files.
! 21-25 Id. for OTYPE = 5; boundary data.
! 31-35 Id. for OTYPE = 5; coupling data.
! 6-10 Id. for OTYPE = 2; point output.
! 11-15 Id. for OTYPE = 3; track point output.
! 16-20 Id. for OTYPE = 4; restart files.
! 21-25 Id. for OTYPE = 5; boundary data.
! 31-35 Id. for OTYPE = 7; coupling data.
! 36-40 Id. for OTYPE = 8; second restart file
! FLGRD L.A. I Flags for gridded output.
! NPT Int. I Number of output points
! X/YPT R.A. I Coordinates of output points.
Expand All @@ -496,7 +517,7 @@ SUBROUTINE WAV_INIT_MCT( EClock, cdata, x2w_w, w2x_w, NLFilename )
allocate ( x(1), y(1), pnames(1) )
pnames(1) = ' '

notype = 7
notype = 8

do j=1, notype
odat(5*(j-1)+3) = 0
Expand Down Expand Up @@ -947,7 +968,7 @@ SUBROUTINE WAV_RUN_MCT(EClock, cdata_w, x2w_w, w2x_w)
! write(stdout,*) 'wrm tcx7a'
! call shr_sys_flush(stdout)

call w3wave ( 1, timen )
call w3wave ( 1, odat, timen )

! copy ww3 data to coupling datatype
! QL, 150612, copy enhancement factor, uStokes, vStokes to coupler
Expand Down
2 changes: 1 addition & 1 deletion components/ww3/src/source/WW3
Submodule WW3 updated 891 files

0 comments on commit 0db63bb

Please sign in to comment.