Skip to content

Commit 28ff9d1

Browse files
committed
Add SAL
1 parent 18a846c commit 28ff9d1

File tree

4 files changed

+52
-8
lines changed

4 files changed

+52
-8
lines changed

sample_inputs/param.nml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@
5858
!-----------------------------------------------------------------------
5959
itransport_only = 0
6060

61+
!-----------------------------------------------------------------------
62+
! Option to add self-attrection loading tide (SAL) into tidal potential
63+
! (usually for global model). If /=1, needs inputs: loadtide_[FREQ].gr3,
64+
! where [FREQ] are freq names (shared with tidal potential) and the _two_
65+
! 'depths' inside are amplitude (m) and phases (degrees behind GMT),
66+
! interpolated from global tide model (e.g. FES2014);
67+
! also shares some parameters with tidal potential in bctides.in (cut-off depth, frequencies).
68+
!-----------------------------------------------------------------------
69+
iloadtide = 0
70+
6171
! Starting time
6272
start_year = 2000 !int
6373
start_month = 1 !int

src/Core/schism_glbl.F90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ module schism_glbl
9292
&moitn0,mxitn0,nchi,ibtrack_test,nramp_elev,islip,ibtp,inunfl,shorewafo, &
9393
&inv_atm_bnd,ieos_type,ieos_pres,iupwind_mom,inter_mom,ishapiro,isav, &
9494
&nstep_ice,niter_shap,iunder_deep,ibtrack_openbnd,flag_fib,ielm_transport,max_subcyc, &
95-
&itransport_only,meth_sink
95+
&itransport_only,meth_sink,iloadtide
9696
integer,save :: ntrs(natrm),nnu_pts(natrm),mnu_pts
9797
integer,save,dimension(:),allocatable :: iof_hydro,iof_wwm,iof_gen,iof_age,iof_sed,iof_eco, &
9898
&iof_icm,iof_cos,iof_fib,iof_sed2d,iof_ice,iof_ana,iof_marsh,iof_dvd,iadjust_mass_consv
@@ -362,7 +362,7 @@ module schism_glbl
362362
&jspc(:)
363363
integer,save,allocatable :: isblock_nd(:,:),isblock_el(:),iq_block_lcl(:),iq_block(:)
364364
real(rkind),save,allocatable :: trobc(:,:),vobc1(:),vobc2(:),tamp(:), &
365-
&tnf(:),tfreq(:),tear(:),amig(:),ff(:),face(:), &
365+
&tnf(:),tfreq(:),tear(:),amig(:),ff(:),face(:),rloadtide(:,:,:), &
366366
&emo(:,:,:),efa(:,:,:),umo(:,:,:),ufa(:,:,:), &
367367
&vmo(:,:,:),vfa(:,:,:),eth(:,:), &
368368
&qthcon(:),uthnd(:,:,:),vthnd(:,:,:), &

src/Hydro/schism_init.F90

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ subroutine schism_init(iorder,indir,iths,ntime)
113113
character(len=10) :: timestamp
114114
! character(len=72) :: it_char
115115
character(len=72) :: fgb ! Processor specific global output file name
116+
character(len=6) :: char6
117+
character(len=6), allocatable :: tp_name(:)
116118
integer :: lfgb ! Length of processor specific global output file name
117119
real(4) :: floatout,floatout2
118120
real(rkind) :: double1 !for hotstart.in
@@ -184,7 +186,8 @@ subroutine schism_init(iorder,indir,iths,ntime)
184186
&iwbl,cur_wwm,if_source,nramp_ss,dramp_ss,ieos_type,ieos_pres,eos_a,eos_b,slr_rate, &
185187
&rho0,shw,isav,nstep_ice,iunder_deep,h1_bcc,h2_bcc,hw_depth,hw_ratio, &
186188
&ibtrack_openbnd,level_age,vclose_surf_frac,iadjust_mass_consv0,ipre2, &
187-
&ielm_transport,max_subcyc,i_hmin_airsea_ex,hmin_airsea_ex,itransport_only,meth_sink
189+
&ielm_transport,max_subcyc,i_hmin_airsea_ex,hmin_airsea_ex,itransport_only,meth_sink, &
190+
&iloadtide
188191

189192
namelist /SCHOUT/iof_hydro,iof_wwm,iof_gen,iof_age,iof_sed,iof_eco,iof_icm,iof_cos,iof_fib, &
190193
&iof_sed2d,iof_ice,iof_ana,iof_marsh,iof_dvd, &
@@ -464,6 +467,7 @@ subroutine schism_init(iorder,indir,iths,ntime)
464467
ielm_transport=0; max_subcyc=10
465468
hmin_airsea_ex=0.2_rkind
466469
itransport_only=0; meth_sink=0
470+
iloadtide=0
467471

468472
!Output elev, hvel by detault
469473
iof_hydro=0; iof_wwm=0; iof_gen=0; iof_age=0; iof_sed=0; iof_eco=0; iof_dvd=0
@@ -2466,8 +2470,12 @@ subroutine schism_init(iorder,indir,iths,ntime)
24662470
read(31,*) ntip,tip_dp !cut-off depth for applying tidal potential
24672471
if(ntip>0) then
24682472
if(iorder==0) then
2469-
allocate(tamp(ntip),tnf(ntip),tfreq(ntip),jspc(ntip),tear(ntip),stat=istat)
2470-
if(istat/=0) call parallel_abort('MAIN: allocation failure for tamp etc')
2473+
allocate(tp_name(ntip),tamp(ntip),tnf(ntip),tfreq(ntip),jspc(ntip),tear(ntip),stat=istat)
2474+
if(istat/=0) call parallel_abort('INIT: allocation failure for tamp etc')
2475+
if(iloadtide/=0) then !loading tide (SAL)
2476+
allocate(rloadtide(2,ntip,npa),stat=istat)
2477+
if(istat/=0) call parallel_abort('INIT: alloc failure for SAL')
2478+
endif !iloadtide/
24712479
endif !iorder
24722480
!'
24732481
open(32,file=in_dir(1:len_in_dir)//'hgrid.ll',status='old')
@@ -2489,14 +2497,36 @@ subroutine schism_init(iorder,indir,iths,ntime)
24892497
lreadll=.true.
24902498

24912499
do i=1,ntip
2492-
read(31,*) !tag
2500+
read(31,'(a6)')tp_name(i) !tag
24932501
read(31,*) jspc(i),tamp(i),tfreq(i),tnf(i),tear(i)
24942502
if(jspc(i)<0.or.jspc(i)>2) then
24952503
write(errmsg,*)'Illegal tidal species #',jspc(i)
24962504
call parallel_abort(errmsg)
24972505
endif
24982506
tear(i)=tear(i)*pi/180.d0
24992507
enddo !i
2508+
2509+
if(iloadtide/=0) then !loading tide
2510+
do i=1,ntip
2511+
char6=adjustl(tp_name(i))
2512+
itmp=len_trim(char6)
2513+
!Debug
2514+
! write(12,*)'SAL grid name:',in_dir(1:len_in_dir)//'loadtide_'//char6(1:itmp)//'.gr3'
2515+
2516+
!.gr3 has both amp, phase
2517+
open(32,file=in_dir(1:len_in_dir)//'loadtide_'//char6(1:itmp)//'.gr3',status='old')
2518+
read(32,*); read(32,*)
2519+
do j=1,np_global
2520+
read(32,*)k,xtmp,ytmp,tmp1,tmp2
2521+
if(ipgl(j)%rank==myrank) then
2522+
ii=ipgl(j)%id
2523+
rloadtide(1,i,ii)=tmp1 !amp [m]
2524+
rloadtide(2,i,ii)=tmp2*pi/180.d0 !phase [radian]
2525+
endif
2526+
enddo !j
2527+
close(32)
2528+
enddo !i
2529+
endif !iloadtide
25002530
endif !ntip>0
25012531

25022532
!... Boundary forcing freqs.

src/Hydro/schism_step.F90

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,15 +410,19 @@ subroutine schism_step(it)
410410
enddo !i
411411
!$OMP end do
412412

413-
!... Earth tidal potential at nodes: pre-compute to save time
414-
!...
413+
!... Earth tidal potential and loading tide at nodes: pre-compute to save time
414+
!...
415415
!$OMP do
416416
do i=1,npa
417417
etp(i)=0.d0
418418
do j=1,ntip
419419
ncyc=int(tfreq(j)*time/2.d0/pi)
420420
arg=tfreq(j)*time-real(ncyc,rkind)*2.d0*pi+jspc(j)*xlon(i)+tear(j)
421421
etp(i)=etp(i)+0.69d0*ramp*tamp(j)*tnf(j)*fun_lat(jspc(j),i)*cos(arg)
422+
423+
if(iloadtide/=0) then !loading tide
424+
etp(i)=etp(i)+rloadtide(1,j,i)*cos(tfreq(j)*time-rloadtide(2,j,i))
425+
endif !iloadtide/
422426
enddo !j
423427
enddo !i
424428
!$OMP end do

0 commit comments

Comments
 (0)