@@ -70,7 +70,9 @@ module MOM_tidal_forcing
70
70
ampsal(:,:,:), & ! < The amplitude of the SAL [Z ~> m].
71
71
cosphase_prev(:,:,:), & ! < The cosine of the phase of the amphidromes in the previous tidal solutions [nondim].
72
72
sinphase_prev(:,:,:), & ! < The sine of the phase of the amphidromes in the previous tidal solutions [nondim].
73
- amp_prev(:,:,:) ! < The amplitude of the previous tidal solution [Z ~> m].
73
+ amp_prev(:,:,:), & ! < The amplitude of the previous tidal solution [Z ~> m].
74
+ tide_fn(:), & ! < Amplitude modulation of tides by nodal cycle [nondim].
75
+ tide_un(:) ! < Phase modulation of tides by nodal cycle [rad].
74
76
end type tidal_forcing_CS
75
77
76
78
integer :: id_clock_tides ! < CPU clock for tides
@@ -251,9 +253,14 @@ subroutine tidal_forcing_init(Time, G, US, param_file, CS, HA_CS)
251
253
real , dimension (MAX_CONSTITUENTS) :: amp_def ! Default amplitude for each tidal constituent [m]
252
254
real , dimension (MAX_CONSTITUENTS) :: love_def ! Default love number for each constituent [nondim]
253
255
integer , dimension (3 ) :: tide_ref_date ! < Reference date (t = 0) for tidal forcing.
256
+ integer , dimension (3 ) :: nodal_ref_date ! < Reference date for calculating nodal modulation for tidal forcing.
254
257
logical :: use_M2, use_S2, use_N2, use_K2, use_K1, use_O1, use_P1, use_Q1
255
258
logical :: use_MF, use_MM
256
259
logical :: tides ! True if a tidal forcing is to be used.
260
+ logical :: add_nodal_terms = .false. ! < If true, insert terms for the 18.6 year modulation when
261
+ ! ! calculating tidal forcing.
262
+ type (time_type) :: nodal_time ! < Model time to calculate nodal modulation for.
263
+ type (astro_longitudes) :: nodal_longitudes ! < Solar and lunar longitudes for tidal forcing
257
264
logical :: HA_ssh, HA_ubt, HA_vbt
258
265
! This include declares and sets the variable "version".
259
266
# include " version_variable.h"
@@ -527,8 +534,46 @@ subroutine tidal_forcing_init(Time, G, US, param_file, CS, HA_CS)
527
534
enddo
528
535
endif
529
536
537
+ call get_param(param_file, mdl, " TIDE_ADD_NODAL" , add_nodal_terms, &
538
+ " If true, include 18.6 year nodal modulation in the astronomical tidal forcing." , &
539
+ default= .false. )
540
+ call get_param(param_file, mdl, " TIDE_NODAL_REF_DATE" , nodal_ref_date, &
541
+ " Fixed reference date to use for nodal modulation of astronomical tidal forcing." , &
542
+ fail_if_missing= .false. , default= 0 )
543
+
544
+ ! If the nodal correction is based on a different time, initialize that.
545
+ ! Otherwise, it can use N from the time reference.
546
+ if (add_nodal_terms) then
547
+ if (sum (nodal_ref_date) /= 0 ) then
548
+ ! A reference date was provided for the nodal correction
549
+ nodal_time = set_date(nodal_ref_date(1 ), nodal_ref_date(2 ), nodal_ref_date(3 ))
550
+ call astro_longitudes_init(nodal_time, nodal_longitudes)
551
+ elseif (CS% use_eq_phase) then
552
+ ! Astronomical longitudes were already calculated for use in equilibrium phases,
553
+ ! so use nodal longitude from that.
554
+ nodal_longitudes = CS% tidal_longitudes
555
+ else
556
+ ! Tidal reference time is a required parameter, so calculate the longitudes from that.
557
+ call astro_longitudes_init(CS% time_ref, nodal_longitudes)
558
+ endif
559
+ endif
560
+
561
+ allocate (CS% tide_fn(nc))
562
+ allocate (CS% tide_un(nc))
563
+
564
+ do c= 1 ,nc
565
+ ! Find nodal corrections if needed
566
+ if (add_nodal_terms) then
567
+ call nodal_fu(trim (CS% const_name(c)), nodal_longitudes% N, CS% tide_fn(c), CS% tide_un(c))
568
+ else
569
+ CS% tide_fn(c) = 1.0
570
+ CS% tide_un(c) = 0.0
571
+ endif
572
+ enddo
573
+
530
574
if (present (HA_CS)) then
531
- call HA_init(Time, US, param_file, CS% time_ref, CS% nc, CS% freq, CS% phase0, CS% const_name, HA_CS)
575
+ call HA_init(Time, US, param_file, CS% time_ref, CS% nc, CS% freq, CS% phase0, CS% const_name, &
576
+ CS% tide_fn, CS% tide_un, HA_CS)
532
577
call get_param(param_file, mdl, " HA_SSH" , HA_ssh, &
533
578
" If true, perform harmonic analysis of sea serface height." , default= .false. )
534
579
if (HA_ssh) call HA_register(' ssh' , ' h' , HA_CS)
@@ -613,26 +658,26 @@ subroutine calc_tidal_forcing(Time, e_tide_eq, e_tide_sal, G, US, CS)
613
658
614
659
do c= 1 ,CS% nc
615
660
m = CS% struct(c)
616
- amp_cosomegat = CS% amp(c)* CS% love_no(c) * cos (CS% freq(c)* now + CS% phase0(c))
617
- amp_sinomegat = CS% amp(c)* CS% love_no(c) * sin (CS% freq(c)* now + CS% phase0(c))
661
+ amp_cosomegat = CS% amp(c)* CS% love_no(c)* CS % tide_fn(c) * cos (CS% freq(c)* now + CS% phase0(c) + CS % tide_un (c))
662
+ amp_sinomegat = CS% amp(c)* CS% love_no(c)* CS % tide_fn(c) * sin (CS% freq(c)* now + CS% phase0(c) + CS % tide_un (c))
618
663
do j= Jsq,Jeq+1 ; do i= Isq,Ieq+1
619
664
e_tide_eq(i,j) = e_tide_eq(i,j) + (amp_cosomegat* CS% cos_struct(i,j,m) + &
620
665
amp_sinomegat* CS% sin_struct(i,j,m))
621
666
enddo ; enddo
622
667
enddo
623
668
624
669
if (CS% use_tidal_sal_file) then ; do c= 1 ,CS% nc
625
- cosomegat = cos (CS% freq(c)* now)
626
- sinomegat = sin (CS% freq(c)* now)
670
+ cosomegat = CS % tide_fn(c) * cos (CS% freq(c)* now + CS % phase0(c) + CS % tide_un(c) )
671
+ sinomegat = CS % tide_fn(c) * sin (CS% freq(c)* now + CS % phase0(c) + CS % tide_un(c) )
627
672
do j= Jsq,Jeq+1 ; do i= Isq,Ieq+1
628
673
e_tide_sal(i,j) = e_tide_sal(i,j) + CS% ampsal(i,j,c) * &
629
674
(cosomegat* CS% cosphasesal(i,j,c) + sinomegat* CS% sinphasesal(i,j,c))
630
675
enddo ; enddo
631
676
enddo ; endif
632
677
633
678
if (CS% use_tidal_sal_prev) then ; do c= 1 ,CS% nc
634
- cosomegat = cos (CS% freq(c)* now)
635
- sinomegat = sin (CS% freq(c)* now)
679
+ cosomegat = CS % tide_fn(c) * cos (CS% freq(c)* now + CS % phase0(c) + CS % tide_un(c) )
680
+ sinomegat = CS % tide_fn(c) * sin (CS% freq(c)* now + CS % phase0(c) + CS % tide_un(c) )
636
681
do j= Jsq,Jeq+1 ; do i= Isq,Ieq+1
637
682
e_tide_sal(i,j) = e_tide_sal(i,j) - CS% sal_scalar * CS% amp_prev(i,j,c) * &
638
683
(cosomegat* CS% cosphase_prev(i,j,c) + sinomegat* CS% sinphase_prev(i,j,c))
@@ -691,8 +736,8 @@ subroutine calc_tidal_forcing_legacy(Time, e_sal, e_sal_tide, e_tide_eq, e_tide_
691
736
692
737
do c= 1 ,CS% nc
693
738
m = CS% struct(c)
694
- amp_cosomegat = CS% amp(c)* CS% love_no(c) * cos (CS% freq(c)* now + CS% phase0(c))
695
- amp_sinomegat = CS% amp(c)* CS% love_no(c) * sin (CS% freq(c)* now + CS% phase0(c))
739
+ amp_cosomegat = CS% amp(c)* CS% love_no(c)* CS % tide_fn(c) * cos (CS% freq(c)* now + CS% phase0(c) + CS % tide_un (c))
740
+ amp_sinomegat = CS% amp(c)* CS% love_no(c)* CS % tide_fn(c) * sin (CS% freq(c)* now + CS% phase0(c) + CS % tide_un (c))
696
741
do j= Jsq,Jeq+1 ; do i= Isq,Ieq+1
697
742
amp_cossin = (amp_cosomegat* CS% cos_struct(i,j,m) + amp_sinomegat* CS% sin_struct(i,j,m))
698
743
e_sal_tide(i,j) = e_sal_tide(i,j) + amp_cossin
@@ -701,8 +746,8 @@ subroutine calc_tidal_forcing_legacy(Time, e_sal, e_sal_tide, e_tide_eq, e_tide_
701
746
enddo
702
747
703
748
if (CS% use_tidal_sal_file) then ; do c= 1 ,CS% nc
704
- cosomegat = cos (CS% freq(c)* now)
705
- sinomegat = sin (CS% freq(c)* now)
749
+ cosomegat = CS % tide_fn(c) * cos (CS% freq(c)* now + CS % phase0(c) + CS % tide_un(c) )
750
+ sinomegat = CS % tide_fn(c) * sin (CS% freq(c)* now + CS % phase0(c) + CS % tide_un(c) )
706
751
do j= Jsq,Jeq+1 ; do i= Isq,Ieq+1
707
752
amp_cossin = CS% ampsal(i,j,c) &
708
753
* (cosomegat* CS% cosphasesal(i,j,c) + sinomegat* CS% sinphasesal(i,j,c))
@@ -712,8 +757,8 @@ subroutine calc_tidal_forcing_legacy(Time, e_sal, e_sal_tide, e_tide_eq, e_tide_
712
757
enddo ; endif
713
758
714
759
if (CS% use_tidal_sal_prev) then ; do c= 1 ,CS% nc
715
- cosomegat = cos (CS% freq(c)* now)
716
- sinomegat = sin (CS% freq(c)* now)
760
+ cosomegat = CS % tide_fn(c) * cos (CS% freq(c)* now + CS % phase0(c) + CS % tide_un(c) )
761
+ sinomegat = CS % tide_fn(c) * sin (CS% freq(c)* now + CS % phase0(c) + CS % tide_un(c) )
717
762
do j= Jsq,Jeq+1 ; do i= Isq,Ieq+1
718
763
amp_cossin = - CS% sal_scalar * CS% amp_prev(i,j,c) &
719
764
* (cosomegat* CS% cosphase_prev(i,j,c) + sinomegat* CS% sinphase_prev(i,j,c))
0 commit comments