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

Add fields and fixes to dev/ufs-weather-model branch, as required by Coastal App #1291

Open
wants to merge 20 commits into
base: dev/ufs-weather-model
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
a2fd06e
fix units and directions for netcdf gridded output
DeniseWorthen Jan 31, 2024
e8b3ef6
fix nuopc cap for radiation stress components
uturuncoglu Jul 15, 2024
f13050b
fix type in the radiation stress components
uturuncoglu Jul 22, 2024
5debd42
fix ww3 restart issue
uturuncoglu Jul 29, 2024
6064dfc
fix time axis in netcdf output files
DeniseWorthen Jul 31, 2024
58718d7
Merge remote-tracking branch 'origin/feature/fixnctime' into feature/…
DeniseWorthen Aug 2, 2024
1f52e1f
use new radstr routine to match history file values
DeniseWorthen Aug 5, 2024
e236af5
fixes and placeholders
DeniseWorthen Aug 5, 2024
213dc9c
additional fields, with notes
DeniseWorthen Aug 5, 2024
c40e603
add stokes, allow for fill value
DeniseWorthen Aug 6, 2024
e4be313
allow cesm to use history frequency of ussx,ussy
DeniseWorthen Aug 6, 2024
3ac08f4
Merge branch 'dev/ufs-weather-model' into feature/fixunits
DeniseWorthen Aug 6, 2024
7fc0c8d
Merge remote-tracking branch 'origin/feature/fixunits' into HEAD
DeniseWorthen Aug 6, 2024
95010ab
add bottom currents and fix rad stress tag
DeniseWorthen Aug 7, 2024
b9c70b2
add t0m1 and thm
DeniseWorthen Aug 8, 2024
bd72ace
add bt4 switch and taubbl exports
DeniseWorthen Aug 8, 2024
b8d0ff7
fix debug failure
DeniseWorthen Aug 8, 2024
6b229be
uncomment So_h
DeniseWorthen Aug 8, 2024
19f7a27
remove unused variables from wav_import_export
DeniseWorthen Aug 8, 2024
cb2e58b
Merge branch 'dev/ufs-weather-model' into feature/addflds4schism
DeniseWorthen Aug 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions model/bin/switch_meshcap_pdlib_bt4
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NCO PDLIB SCOTCH NOGRB DIST MPI PR3 UQ FLX0 SEED ST4 STAB0 NL1 BT4 DB1 MLIM FLD2 TR0 BS0 RWND WNX1 WNT1 CRX1 CRT1 O0 O1 O2 O3 O4 O5 O6 O7 O14 O15 IC0 IS0 REF0
53 changes: 39 additions & 14 deletions model/src/w3iogoncdmd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

module w3iogoncdmd

use constants , only : rade
use w3gdatmd , only : nk, nx, ny, mapsf, mapsta, nsea
use w3odatmd , only : noswll, undef
use w3odatmd , only : nds, iaproc, napout
Expand Down Expand Up @@ -36,7 +37,7 @@ module w3iogoncdmd
contains
!===============================================================================

subroutine w3iogoncd ()
subroutine w3iogoncd ( timen )

use w3odatmd , only : fnmpre
use w3gdatmd , only : filext, trigp, ntri, ungtype, gtype
Expand All @@ -60,14 +61,16 @@ subroutine w3iogoncd ()
use w3adatmd , only : cflxymax, cflthmax, cflkmax, p2sms, us3d
use w3adatmd , only : th1m, sth1m, th2m, sth2m, hsig, phice, tauice
use w3adatmd , only : stmaxe, stmaxd, hmaxe, hcmaxe, hmaxd, hcmaxd, ussp, tauocx, tauocy
use w3adatmd , only : usshx, usshy
use w3adatmd , only : usshx, usshy
use wav_grdout , only : varatts, outvars
use w3timemd , only : set_user_timestring
use w3odatmd , only : time_origin, calendar_name, elapsed_secs
use w3odatmd , only : use_user_histname, user_histfname
!TODO: use unstr_mesh from wav_shr_mod; currently fails due to CI
!use wav_shr_mod, only : unstr_mesh

integer, intent(in) :: timen(2)

! local variables
integer :: igrd
integer ,target :: dimid3(3)
Expand Down Expand Up @@ -96,10 +99,10 @@ subroutine w3iogoncd ()
if (len_trim(user_histfname) == 0 ) then
call extcde (60, msg="user history filename requested but not provided")
end if
call set_user_timestring(time,user_timestring)
call set_user_timestring(timen,user_timestring)
fname = trim(user_histfname)//trim(user_timestring)//'.nc'
else
write(fname,'(a,i8.8,a1,i6.6,a)')trim(fnmpre),time(1),'.',time(2),'.out_grd.'//trim(filext)//'.nc'
write(fname,'(a,i8.8,a1,i6.6,a)')trim(fnmpre),timen(1),'.',timen(2),'.out_grd.'//trim(filext)//'.nc'
end if

len_s = noswll + 1 ! 0:noswll
Expand Down Expand Up @@ -240,10 +243,10 @@ subroutine w3iogoncd ()
if(vname .eq. 'PHS') call write_var3d(vname, phs (1:nsea,0:noswll) )
if(vname .eq. 'PTP') call write_var3d(vname, ptp (1:nsea,0:noswll) )
if(vname .eq. 'PLP') call write_var3d(vname, plp (1:nsea,0:noswll) )
if(vname .eq. 'PDIR') call write_var3d(vname, pdir (1:nsea,0:noswll) )
if(vname .eq. 'PSI') call write_var3d(vname, psi (1:nsea,0:noswll) )
if(vname .eq. 'PDIR') call write_var3d(vname, pdir (1:nsea,0:noswll), fldir='true' )
if(vname .eq. 'PSI') call write_var3d(vname, psi (1:nsea,0:noswll), fldir='true' )
if(vname .eq. 'PWS') call write_var3d(vname, pws (1:nsea,0:noswll) )
if(vname .eq. 'PDP') call write_var3d(vname, pthp0 (1:nsea,0:noswll) )
if(vname .eq. 'PDP') call write_var3d(vname, pthp0 (1:nsea,0:noswll), fldir='true' )
if(vname .eq. 'PQP') call write_var3d(vname, pqp (1:nsea,0:noswll) )
if(vname .eq. 'PPE') call write_var3d(vname, ppe (1:nsea,0:noswll) )
if(vname .eq. 'PGW') call write_var3d(vname, pgw (1:nsea,0:noswll) )
Expand Down Expand Up @@ -301,9 +304,9 @@ subroutine w3iogoncd ()
if (vname .eq. 'T0M1') call write_var2d(vname, t0m1 (1:nsea) )
if (vname .eq. 'T01') call write_var2d(vname, t01 (1:nsea) )
if (vname .eq. 'FP0') call write_var2d(vname, fp0 (1:nsea) )
if (vname .eq. 'THM') call write_var2d(vname, thm (1:nsea) )
if (vname .eq. 'THS') call write_var2d(vname, ths (1:nsea) )
if (vname .eq. 'THP0') call write_var2d(vname, thp0 (1:nsea) )
if (vname .eq. 'THM') call write_var2d(vname, thm (1:nsea), fldir='true' )
if (vname .eq. 'THS') call write_var2d(vname, ths (1:nsea), fldir='true' )
if (vname .eq. 'THP0') call write_var2d(vname, thp0 (1:nsea), fldir='true' )
if (vname .eq. 'HSIG') call write_var2d(vname, hsig (1:nsea) )
if (vname .eq. 'STMAXE') call write_var2d(vname, stmaxe (1:nsea) )
if (vname .eq. 'STMAXD') call write_var2d(vname, stmaxd (1:nsea) )
Expand Down Expand Up @@ -396,25 +399,27 @@ subroutine w3iogoncd ()
end subroutine w3iogoncd

!===============================================================================
subroutine write_var2d(vname, var, dir, usemask, init0, init2)
subroutine write_var2d(vname, var, dir, usemask, init0, init2, fldir)
! write (nsea) array as (nx,ny)
! if dir is present, write x or y component of (nsea) array as (nx,ny)
! if mask is present and true, use mapsta=1 to mask values
! if init0 is present and false, do not initialize values
! for mapsta<0. this prevents group 1 variables being set undef over
! ice. if init2 is present and true, apply a second initialization to
! a subset of variables for where mapsta==2
! if fldir is true then the directions will be converted to degrees

character(len=*), intent(in) :: vname
real , intent(in) :: var(:)
real, optional , intent(in) :: dir(:)
character(len=*), optional, intent(in) :: usemask
character(len=*), optional, intent(in) :: init0
character(len=*), optional, intent(in) :: init2
character(len=*), optional, intent(in) :: fldir

! local variables
real, dimension(nx,ny) :: var2d
logical :: lmask, linit0, linit2
logical :: lmask, linit0, linit2, lfldir
real :: varloc

lmask = .false.
Expand All @@ -429,6 +434,10 @@ subroutine write_var2d(vname, var, dir, usemask, init0, init2)
if (present(init2)) then
linit2 = (trim(init2) == "true")
end if
lfldir = .false.
if (present(fldir)) then
lfldir = (trim(fldir) == "true")
end if

! DEBUG
! write(nds(1),'(a)')' writing variable ' //trim(vname)//' to history file '//trim(fname)
Expand All @@ -445,6 +454,11 @@ subroutine write_var2d(vname, var, dir, usemask, init0, init2)
if (mapsta(mapsf(isea,2),mapsf(isea,1)) == 2) varloc = undef
end if

if (lfldir) then
if (varloc .ne. undef) then
varloc = mod(630. - rade*varloc, 360.)
end if
end if
if (present(dir)) then
if (varloc .ne. undef) then
if (lmask) then
Expand All @@ -471,24 +485,30 @@ subroutine write_var2d(vname, var, dir, usemask, init0, init2)
end subroutine write_var2d

!===============================================================================
subroutine write_var3d(vname, var, init2)
subroutine write_var3d(vname, var, init2, fldir)
! write (nsea,:) array as (nx,ny,:)
! if init2 is present and true, apply a second initialization to
! a subset of variables for where mapsta==2
! if fldir is true then the directions will be converted to degrees

character(len=*), intent(in) :: vname
real , intent(in) :: var(:,:)
character(len=*), optional, intent(in) :: init2
character(len=*), optional, intent(in) :: fldir

! local variables
real, allocatable, dimension(:) :: varloc
logical :: linit2
logical :: linit2, lfldir
integer :: lb, ub

linit2 = .false.
if (present(init2)) then
linit2 = (trim(init2) == "true")
end if
lfldir = .false.
if (present(fldir)) then
lfldir = (trim(fldir) == "true")
end if

lb = lbound(var,2)
ub = ubound(var,2)
Expand All @@ -506,6 +526,11 @@ subroutine write_var3d(vname, var, init2)
if (linit2) then
if (mapsta(mapsf(isea,2),mapsf(isea,1)) == 2) varloc(:) = undef
end if
if (lfldir) then
if (mapsta(mapsf(isea,2),mapsf(isea,1)).ge.0 ) then
varloc(:) = mod(630. - rade*varloc(:), 360.)
end if
end if
var3d(mapsf(isea,1),mapsf(isea,2),:) = varloc(:)
end do

Expand Down
1 change: 1 addition & 0 deletions model/src/w3iorsmd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,7 @@ SUBROUTINE W3IORS ( INXOUT, NDSR, DUMFPI, IMOD, FLRSTRT )
TICE(1) = -1
TICE(2) = 0
TRHO(1) = -1
TRHO(2) = 0
TIC1(1) = -1
TIC1(2) = 0
TIC5(1) = -1
Expand Down
2 changes: 1 addition & 1 deletion model/src/w3wavemd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2606,7 +2606,7 @@ SUBROUTINE W3WAVE ( IMOD, ODAT, TEND, STAMP, NO_OUT &
IF ( FLGMPI(1) ) CALL MPI_WAITALL( NRQGO2, IRQGO2, STATIO, IERR_MPI )
FLGMPI(1) = .FALSE.
#endif
CALL W3IOGONCD ()
CALL W3IOGONCD ( tend )
END IF
else
! default (binary) output
Expand Down
2 changes: 1 addition & 1 deletion model/src/wav_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
endif
! Determine time attributes for history output
call ESMF_TimeGet( esmfTime, timeString=time_origin, calendar=calendar, rc=rc )
call ESMF_TimeGet( startTime, timeString=time_origin, calendar=calendar, rc=rc )
if (ChkErr(rc,__LINE__,u_FILE_u)) return
time_origin = 'seconds since '//time_origin(1:10)//' '//time_origin(12:19)
!call ESMF_ClockGet(clock, calendar=calendar)
Expand Down
9 changes: 4 additions & 5 deletions model/src/wav_grdout.F90
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ subroutine initialize_gridout
gridoutdefs(:,:)%dims = ""
gridoutdefs(:,:)%validout = .false.

! TODO: confirm unit values
! 1 Forcing Fields
gridoutdefs(1,1:14) = [ &
varatts( "DPT ", "DW ", "Water depth ", "m ", " ", .false.) , &
Expand All @@ -157,9 +156,9 @@ subroutine initialize_gridout
varatts( "T0M1 ", "T0M1 ", "Mean wave period (Tm0,-1) ", "s ", " ", .false.) , &
varatts( "T01 ", "T01 ", "Mean wave period (Tm0,1) ", "s ", " ", .false.) , &
varatts( "FP ", "FP0 ", "Peak frequency ", "s-1 ", " ", .false.) , &
varatts( "DIR ", "THM ", "Mean wave direction ", "rad ", " ", .false.) , &
varatts( "SPR ", "THS ", "Mean directional spread ", "rad ", " ", .false.) , &
varatts( "DP ", "THP0 ", "Peak direction ", "rad ", " ", .false.) , &
varatts( "DIR ", "THM ", "Mean wave direction ", "deg ", " ", .false.) , &
varatts( "SPR ", "THS ", "Mean directional spread ", "deg ", " ", .false.) , &
varatts( "DP ", "THP0 ", "Peak direction ", "deg ", " ", .false.) , &
varatts( "HIG ", "HSIG ", "Infragravity height ", "m ", " ", .false.) , &
varatts( "MXE ", "STMAXE ", "Max surface elev (STE) ", "m ", " ", .false.) , &
varatts( "MXES ", "STMAXD ", "St Dev Max surface elev (STE) ", "m ", " ", .false.) , &
Expand All @@ -178,7 +177,7 @@ subroutine initialize_gridout
varatts( "STH1M", "STH1M ", "Directional spreading from a1,b2 ", "deg ", "k ", .false.) , &
varatts( "TH2M ", "TH2M ", "Mean wave direction from a2,b2 ", "deg ", "k ", .false.) , &
varatts( "STH2M", "STH2M ", "Directional spreading from a2,b2 ", "deg ", "k ", .false.) , &
!TODO: has reverse indices (nk,nsea)
!TODO: has reverse indices (nk,nsea)
varatts( "WN ", "WN ", "Wavenumber array ", "m-1 ", "k ", .false.) &
]

Expand Down
Loading
Loading