Skip to content

Commit

Permalink
Merge pull request NOAA-EMC#2 from mvertens/feature/icewav_coupling
Browse files Browse the repository at this point in the history
updates to ww3 cap code for ww3/cice coupling
  • Loading branch information
alperaltuntas authored May 3, 2022
2 parents 3e876b9 + 5fda269 commit 67b1ff4
Show file tree
Hide file tree
Showing 7 changed files with 1,077 additions and 349 deletions.
1 change: 1 addition & 0 deletions model/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ set(SRCFILES constants.F90
w3wdatmd.F90
wav_comp_nuopc.F90
wav_import_export.F90
wav_grdout.F90
wav_kind_mod.F90
wav_shel_inp.F90
wav_shr_mod.F90)
Expand Down
353 changes: 199 additions & 154 deletions model/src/wav_comp_nuopc.F90

Large diffs are not rendered by default.

273 changes: 273 additions & 0 deletions model/src/wav_grdout.F90

Large diffs are not rendered by default.

361 changes: 284 additions & 77 deletions model/src/wav_import_export.F90

Large diffs are not rendered by default.

30 changes: 19 additions & 11 deletions model/src/wav_kind_mod.F90
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
!> @file wav_kind_mod
!!
!> Precision and kind constants
!!
!> @details Contains public definitions of variable types and constants
!!
!> @author [email protected], [email protected]
!> @date 01-05-2022
module wav_kind_mod

!----------------------------------------------------------------------------
! precision/kind constants add data public
!----------------------------------------------------------------------------
public
integer,parameter :: SHR_KIND_R8 = selected_real_kind(12) ! 8 byte real
integer,parameter :: SHR_KIND_R4 = selected_real_kind( 6) ! 4 byte real
integer,parameter :: SHR_KIND_RN = kind(1.0) ! native real
integer,parameter :: SHR_KIND_I8 = selected_int_kind (13) ! 8 byte integer
integer,parameter :: SHR_KIND_I4 = selected_int_kind ( 6) ! 4 byte integer
integer,parameter :: SHR_KIND_IN = kind(1) ! native integer
integer,parameter :: SHR_KIND_CS = 80 ! short char
integer,parameter :: SHR_KIND_CM = 160 ! mid-sized char
integer,parameter :: SHR_KIND_CL = 256 ! long char
integer,parameter :: SHR_KIND_CX = 512 ! extra-long char
integer,parameter :: SHR_KIND_CXX= 4096 ! extra-extra-long char
integer,parameter :: SHR_KIND_R8 = selected_real_kind(12) !< @public 8 byte real
integer,parameter :: SHR_KIND_R4 = selected_real_kind( 6) !< @public 4 byte real
integer,parameter :: SHR_KIND_RN = kind(1.0) !< @public native real
integer,parameter :: SHR_KIND_I8 = selected_int_kind (13) !< @public 8 byte integer
integer,parameter :: SHR_KIND_I4 = selected_int_kind ( 6) !< @public 4 byte integer
integer,parameter :: SHR_KIND_IN = kind(1) !< @public native integer
integer,parameter :: SHR_KIND_CS = 80 !< @public short char
integer,parameter :: SHR_KIND_CM = 160 !< @public mid-sized char
integer,parameter :: SHR_KIND_CL = 256 !< @public long char
integer,parameter :: SHR_KIND_CX = 512 !< @public extra-long char
integer,parameter :: SHR_KIND_CXX= 4096 !< @public extra-extra-long char

end module wav_kind_mod
69 changes: 51 additions & 18 deletions model/src/wav_shel_inp.F90
Original file line number Diff line number Diff line change
@@ -1,32 +1,51 @@
!> @file wav_shel_inp
!!
!> Set up for running in shel mode
!!
!> @details Contains public routines to sets up IO unit numbers and to
!! either reads a shel.inp file (UWM) or set the required values directly
!! (CESM).
!!
!> @author [email protected], [email protected]
!> @date 01-05-2022
module wav_shel_inp

use w3odatmd, only: nogrp, ngrpp
use w3odatmd , only : nogrp, ngrpp
use wav_shr_mod , only : wav_coupling_to_cice

implicit none
private ! except

public :: set_shel_io
public :: set_shel_inp
public :: read_shel_inp
public :: set_shel_io !< @public set the IO unit numbers
public :: set_shel_inp !< @public directly set required input variabls (CESM)
public :: read_shel_inp !< @public read ww3_shel.inp (UWM)

integer, public :: odat(40)
character(len=40), allocatable, public :: pnames(:)
integer, public :: odat(40) !< @public output dates
character(len=40), allocatable, public :: pnames(:) !< @public point names

integer, public :: npts
integer, public :: iprt(6)
logical, public :: prtfrm
logical, public :: flgrd(nogrp,ngrpp) !flags for gridded output
logical, public :: flgr2(nogrp,ngrpp) !flags for coupling output
logical, public :: flgd(nogrp) !flags for whole group - not currently used in cesm
logical, public :: flg2(nogrp) !flags for whole group - not currently used in cesm
real, allocatable, public :: x(:), y(:)
integer, public :: npts !< @public number of points for point output
integer, public :: iprt(6) !< @public partitioning grid information
logical, public :: prtfrm !< @public partitioning format flag
logical, public :: flgrd(nogrp,ngrpp) !< @public flags for gridded output
logical, public :: flgr2(nogrp,ngrpp) !< @public flags for coupling output
logical, public :: flgd(nogrp) !< @public flags for whole group - not currently used in cesm
logical, public :: flg2(nogrp) !< @public flags for whole group - not currently used in cesm
real, allocatable, public :: x(:) !< @public x locations for point output
real, allocatable, public :: y(:) !< @public y locations for point output

include "mpif.h"

!===============================================================================
contains
!===============================================================================

!> Set IO unit numbers
!!
!! @param[in] stdout unit number for stdout
!! @param[out] mds an array of 13 unit numbers
!! @param[out] ntrace an array of 2 unit numbers used for trace output
!!
!> @author [email protected], [email protected]
!> @date 01-05-2022
subroutine set_shel_io(stdout,mds,ntrace)

use ESMF, only : ESMF_UtilIOUnitGet
Expand Down Expand Up @@ -79,13 +98,17 @@ subroutine set_shel_io(stdout,mds,ntrace)
ntrace(2) = 10

end subroutine set_shel_io

!> Set up variables used in shel mode directly (CESM)
!!
!! @param[in] dtime_sync coupling interval in s
!!
!> @author [email protected], [email protected]
!> @date 01-05-2022
subroutine set_shel_inp(dtime_sync)

use w3idatmd , only : inflags1, inflags2
use w3odatmd , only : noge, idout, nds, notype, iaproc, napout
use w3wdatmd , only : time
use wav_shr_mod , only : wav_coupling_to_cice

! Input parameter
integer , intent(in) :: dtime_sync
Expand Down Expand Up @@ -325,6 +348,12 @@ subroutine set_shel_inp(dtime_sync)
end subroutine set_shel_inp

!===============================================================================
!> Read ww3_shel.inp (UWM)
!!
!! @param[in] mpi_comm mpi communicator
!!
!> @author [email protected], [email protected]
!> @date 01-05-2022
subroutine read_shel_inp(mpi_comm)

USE W3GDATMD, ONLY: FLAGLL
Expand Down Expand Up @@ -437,7 +466,11 @@ subroutine read_shel_inp(mpi_comm)
! If using experimental mud or ice physics, additional lines will
! be read in from ww3_shel.inp and applied, so JFIRST is changed from
! its initialization setting "JFIRST=1" to some lower value.
JFIRST=1
if (wav_coupling_to_cice) then
JFIRST=-7
else
JFIRST=1
end if

! process old ww3_shel.inp format
OPEN (NDSI,FILE=TRIM(FNMPRE)//'ww3_shel.inp',STATUS='OLD',IOSTAT=IERR)
Expand Down
Loading

0 comments on commit 67b1ff4

Please sign in to comment.