@@ -113,6 +113,8 @@ subroutine schism_init(iorder,indir,iths,ntime)
113
113
character (len= 10 ) :: timestamp
114
114
! character(len=72) :: it_char
115
115
character (len= 72 ) :: fgb ! Processor specific global output file name
116
+ character (len= 6 ) :: char6
117
+ character (len= 6 ), allocatable :: tp_name(:)
116
118
integer :: lfgb ! Length of processor specific global output file name
117
119
real (4 ) :: floatout,floatout2
118
120
real (rkind) :: double1 ! for hotstart.in
@@ -184,7 +186,8 @@ subroutine schism_init(iorder,indir,iths,ntime)
184
186
&iwbl,cur_wwm,if_source,nramp_ss,dramp_ss,ieos_type,ieos_pres,eos_a,eos_b,slr_rate, &
185
187
&rho0,shw,isav,nstep_ice,iunder_deep,h1_bcc,h2_bcc,hw_depth,hw_ratio, &
186
188
&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
188
191
189
192
namelist / SCHOUT/ iof_hydro,iof_wwm,iof_gen,iof_age,iof_sed,iof_eco,iof_icm,iof_cos,iof_fib, &
190
193
&iof_sed2d,iof_ice,iof_ana,iof_marsh,iof_dvd, &
@@ -464,6 +467,7 @@ subroutine schism_init(iorder,indir,iths,ntime)
464
467
ielm_transport= 0 ; max_subcyc= 10
465
468
hmin_airsea_ex= 0.2_rkind
466
469
itransport_only= 0 ; meth_sink= 0
470
+ iloadtide= 0
467
471
468
472
! Output elev, hvel by detault
469
473
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)
2466
2470
read (31 ,* ) ntip,tip_dp ! cut-off depth for applying tidal potential
2467
2471
if (ntip> 0 ) then
2468
2472
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/
2471
2479
endif ! iorder
2472
2480
! '
2473
2481
open (32 ,file= in_dir(1 :len_in_dir)// ' hgrid.ll' ,status= ' old' )
@@ -2489,14 +2497,36 @@ subroutine schism_init(iorder,indir,iths,ntime)
2489
2497
lreadll= .true.
2490
2498
2491
2499
do i= 1 ,ntip
2492
- read (31 ,* ) ! tag
2500
+ read (31 ,' (a6) ' )tp_name(i ) ! tag
2493
2501
read (31 ,* ) jspc(i),tamp(i),tfreq(i),tnf(i),tear(i)
2494
2502
if (jspc(i)<0.or .jspc(i)>2 ) then
2495
2503
write (errmsg,* )' Illegal tidal species #' ,jspc(i)
2496
2504
call parallel_abort(errmsg)
2497
2505
endif
2498
2506
tear(i)= tear(i)* pi/ 180.d0
2499
2507
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
2500
2530
endif ! ntip>0
2501
2531
2502
2532
! ... Boundary forcing freqs.
0 commit comments