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

Relative wind #213

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion TP5a0.06/expt_01.0/hycom_opt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
&hycom_nml
write_arche= .false.
write_arche= .true.,
relative_wnd_coef = 0.7 ! Coupling coefficient in Renault et al. JPO 2017 https://doi.org/10.1175/JPO-D-16-0168.1
! 0.0 is absolute winds, 1.0 is relative winds.
/
5 changes: 5 additions & 0 deletions bin/expt_preprocess.sh
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,11 @@ fi
# ls -laFq nest
#endif

if [ -f $P/hycom_opt ] ; then
cp $P/hycom_opt $S
else
echo "The hycom_opt namelist file is not in the expt dir"
fi

if [ $numerr -eq 0 ] ; then
echo "No fatal errors. Ok to start model set up in $S"
Expand Down
12 changes: 7 additions & 5 deletions hycom/RELO/src_2.2.98ZA-07Tsig0-i-sm-sse_relo_mpi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,20 @@ include ./hycom_feature_flags
CPPFLAGS:=$(CPPFLAGS) $(HYCOM_FEATURE_FLAGS)

MODS = mod_dimensions.o mod_xc.o mod_za.o mod_cb_arrays.o mod_pipe.o \
mod_NERSCnml.o \
mod_incupd.o \
mod_floats.o m_get_erfc.o mod_stokes.o mod_tides.o mod_mean.o mod_archiv.o \
mod_tsadvc.o mod_momtum.o \
mod_hycom.o mod_esmf_utils.o mod_netcdf_util.o mod_prgrad.o mod_NERSCnml.o
mod_hycom.o mod_esmf_utils.o mod_netcdf_util.o mod_prgrad.o
# ----------------------------------------------------
# Mostafa added this in order to use standalone hycom
# ----------------------------------------------------
MODS_HYCOM = mod_dimensions.o mod_xc.o mod_za.o mod_cb_arrays.o mod_pipe.o \
mod_NERSCnml.o \
mod_incupd.o \
mod_floats.o m_get_erfc.o mod_stokes.o mod_tides.o mod_mean.o mod_archiv.o \
mod_tsadvc.o mod_momtum.o \
mod_hycom.o mod_netcdf_util.o mod_prgrad.o mod_NERSCnml.o
mod_hycom.o mod_netcdf_util.o mod_prgrad.o

# Mostafa ----------------------------------------------------

Expand Down Expand Up @@ -136,13 +138,13 @@ trcupd.o: trcupd.F mod_xc.o mod_cb_arrays.o mod_pipe.o
wtime.o: wtime.F
mod_hycom.o: \
mod_hycom.F mod_xc.o mod_cb_arrays.o mod_za.o mod_pipe.o \
mod_NERSCnml.o \
mod_incupd.o \
mod_mean.o \
mod_floats.o \
mod_momtum.o \
mod_tsadvc.o \
mod_stokes.o \
mod_NERSCnml.o
mod_stokes.o
mod_hycom_dummy.o: \
mod_hycom_dummy.F mod_xc.o mod_cb_arrays.o mod_za.o mod_pipe.o \
mod_incupd.o \
Expand All @@ -156,7 +158,7 @@ mod_momtum.o: \
mod_momtum.F mod_xc.o mod_cb_arrays.o stmt_fns.h mod_pipe.o \
mod_tides.o \
mod_stokes.o \
mod_prgrad.o
mod_prgrad.o
mod_tsadvc.o: \
mod_tsadvc.F mod_xc.o mod_cb_arrays.o stmt_fns.h mod_pipe.o
mod_incupd.o: \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ module mod_NERSCnml

logical,save, public :: &
write_arche ! print arche files or not

real,save, public :: &
relative_wnd_coef ! relative wind coefficient
public NERSC_init

contains
Expand All @@ -20,9 +21,10 @@ subroutine NERSC_init
implicit none
integer (4), parameter :: funi=503
integer (4) :: nml_err
namelist /hycom_nml/ write_arche
namelist /hycom_nml/ write_arche,relative_wnd_coef
!default values
write_arche = .false.
relative_wnd_coef = 0.7
! read namelist
open (funi, file='hycom_opt', status='old',iostat=nml_err)
if (nml_err .ne. 0) then
Expand All @@ -48,6 +50,7 @@ subroutine NERSC_init
if (mnproc.eq.1) then
write (lp,*)'NERSC HYCOM: Reading hycom_nml from: hycom_opt'
write (lp,*)'NERSC HYCOM: Write arche = ',write_arche
write (lp,*)'NERSC HYCOM: relative_wnd_coef = ',relative_wnd_coef
endif !1st tile
call xcsync(flush_lp)

Expand Down
43 changes: 27 additions & 16 deletions hycom/RELO/src_2.2.98ZA-07Tsig0-i-sm-sse_relo_mpi/mod_momtum.F
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ subroutine momtum_hs(m,n)
#ifdef CPL_OASIS_HYCOM
use mod_cpl_oasis_init
#endif
use mod_NERSCnml, only : relative_wnd_coef
implicit none
c
integer m,n
Expand All @@ -67,6 +68,7 @@ subroutine momtum_hs(m,n)
& airt,vpmx,wndx,wndy,wind,cdw,pair,rair,
& sumdp,sumth,thksur
integer i,j,k,kl,l,margin,mbdy,hlstep

c &,iffstep
c data iffstep/0/
c save iffstep
Expand Down Expand Up @@ -384,11 +386,10 @@ subroutine momtum_hs(m,n)
exit
endif
enddo !k
usur = 0.5*( usur/psur + ubavg(i, j,n) +
& ubavg(i+1,j,n) )

vsur = 0.5*( vsur/psur + vbavg(i,j, n) +
& vbavg(i,j+1,n) )
usur = 0.5*( usur/psur +
& ubavg(i,j,n)+ubavg(i+1,j,n) )
vsur = 0.5*( vsur/psur +
& vbavg(i,j,n)+vbavg(i,j+1,n) )
endif !usur,vsur
c
if (wndflg.eq.2 .or. wndflg.eq.3) then ! tau on p grid
Expand Down Expand Up @@ -467,27 +468,37 @@ subroutine momtum_hs(m,n)
c
if (wndflg.eq.4 .and. flxflg.eq.6) then
c --- use wind-current in place of wind for everything
samo = sqrt( (wndx-usur)**2 + (wndy-vsur)**2 )
samo = sqrt( (wndx-relative_wnd_coef*usur)**2 +
& (wndy-relative_wnd_coef*vsur)**2 )
cdw = 1.0e-3*cd_coarep(samo,vpmx,airt,pair,
& temp(i,j,1,n))
surtx( i,j) = rair*cdw*samo*(wndx-usur)
surty( i,j) = rair*cdw*samo*(wndy-vsur)
& temp(i,j,1,n))
surtx( i,j) = rair*cdw*samo*(wndx-
& relative_wnd_coef*usur)
surty( i,j) = rair*cdw*samo*(wndy-
& relative_wnd_coef*vsur)

wndocn(i,j) = samo !save for thermf
elseif (wndflg.eq.4) then
cdw = 1.0e-3*cd_coare(wind,vpmx,airt,
& temp(i,j,1,n))
c --- use wind-current magnitude and direction for stress
samo = sqrt( (wndx-usur)**2 + (wndy-vsur)**2 )
surtx(i,j) = rair*cdw*samo*(wndx-usur)
surty(i,j) = rair*cdw*samo*(wndy-vsur)
samo = sqrt( (wndx-relative_wnd_coef*usur)**2 +
& (wndy-relative_wnd_coef*vsur)**2 )
surtx(i,j) = rair*cdw*samo*(wndx-
& relative_wnd_coef*usur)
surty(i,j) = rair*cdw*samo*(wndy-
& relative_wnd_coef*vsur)
else ! wndflg.eq.5
cdw = 1.0e-3*cd_core2(wind,vpmx,airt,
& temp(i,j,1,n))
c --- use wind-current magnitude and direction for stress
samo = sqrt( (wndx-usur)**2 + (wndy-vsur)**2 )
surtx(i,j) = rair*cdw*samo*(wndx-usur)
surty(i,j) = rair*cdw*samo*(wndy-vsur)
endif
samo = sqrt( (wndx-relative_wnd_coef*usur)**2 +
& (wndy-relative_wnd_coef*vsur)**2 )
surtx(i,j) = rair*cdw*samo*(wndx-
& relative_wnd_coef*usur)
surty(i,j) = rair*cdw*samo*(wndy-
& relative_wnd_coef*vsur)
endif
endif !wndflg
c
surtx(i,j) = surtx(i,j) + oftaux(i,j)
Expand Down