Skip to content

Commit 29e5b82

Browse files
committed
Add answer date flag for tide/SAL
A new date for TIDES_ANSWER_DATE is added to recover answers for tides in Boussinesq mode before 20250201.
1 parent 8039cb8 commit 29e5b82

File tree

2 files changed

+50
-27
lines changed

2 files changed

+50
-27
lines changed

src/core/MOM_PressureForce_FV.F90

Lines changed: 47 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,28 +1032,49 @@ subroutine PressureForce_FV_Bouss(h, tv, PFu, PFv, G, GV, US, CS, ALE_CSp, p_atm
10321032
e(i,j,nz+1) = -G%bathyT(i,j)
10331033
enddo ; enddo
10341034

1035-
! Self-attraction and loading (SAL) and tides (old answers)
1036-
! SAL and tidal geopotential height anomalies are calculated and added as corrections to interface heights.
1037-
! The following code is for recovering old answers only. The algorithm moves interface heights before density
1038-
! calculations, and therefore is incorrect without SSH_IN_EOS_PRESSURE_FOR_PGF=True (added in August 2024).
1039-
! See the code right after Pa calculation loop for the new method.
1040-
if (CS%tides .and. CS%tides_answer_date<=20230630) then
1035+
! The following two if-blocks are used to recover old answers for self-attraction and loading
1036+
! (SAL) and tides only. The old algorithm moves interface heights before density calculations,
1037+
! and therefore is incorrect without SSH_IN_EOS_PRESSURE_FOR_PGF=True (added in August 2024).
1038+
! See the code right after Pa calculation loop for the new algorithm.
1039+
1040+
! Calculate and add SAL geopotential anomaly to interface height (old answers)
1041+
if (CS%calculate_SAL .and. CS%tides_answer_date<=20250131) then
10411042
!$OMP parallel do default(shared)
10421043
do j=Jsq,Jeq+1
10431044
do i=Isq,Ieq+1
1044-
SSH(i,j) = min(-G%bathyT(i,j) - G%Z_ref, 0.0) ! reference bottom pressure
1045+
SSH(i,j) = min(-G%bathyT(i,j) - G%Z_ref, 0.0)
10451046
enddo
10461047
do k=1,nz ; do i=Isq,Ieq+1
10471048
SSH(i,j) = SSH(i,j) + h(i,j,k)*GV%H_to_Z
10481049
enddo ; enddo
10491050
enddo
10501051
call calc_SAL(SSH, e_sal, G, CS%SAL_CSp, tmp_scale=US%Z_to_m)
1051-
call calc_tidal_forcing_legacy(CS%Time, e_sal, e_sal_and_tide, e_tidal_eq, e_tidal_sal, &
1052-
G, US, CS%tides_CSp)
1053-
!$OMP parallel do default(shared)
1054-
do j=Jsq,Jeq+1 ; do i=Isq,Ieq+1
1055-
e(i,j,nz+1) = e(i,j,nz+1) - e_sal_and_tide(i,j)
1056-
enddo ; enddo
1052+
1053+
if (CS%tides_answer_date>20230630) then ! answers_date between [20230701, 20250131]
1054+
!$OMP parallel do default(shared)
1055+
do j=Jsq,Jeq+1 ; do i=Isq,Ieq+1
1056+
e(i,j,nz+1) = e(i,j,nz+1) - e_sal(i,j)
1057+
enddo ; enddo
1058+
endif
1059+
endif
1060+
1061+
! Calculate and add tidal geopotential anomaly to interface height (old answers)
1062+
if (CS%tides .and. CS%tides_answer_date<=20250131) then
1063+
if (CS%tides_answer_date>20230630) then ! answers_date between [20230701, 20250131]
1064+
call calc_tidal_forcing(CS%Time, e_tidal_eq, e_tidal_sal, G, US, CS%tides_CSp)
1065+
!$OMP parallel do default(shared)
1066+
do j=Jsq,Jeq+1 ; do i=Isq,Ieq+1
1067+
e(i,j,nz+1) = e(i,j,nz+1) - (e_tidal_eq(i,j) + e_tidal_sal(i,j))
1068+
enddo ; enddo
1069+
else ! answers_date before 20230701
1070+
if (.not.CS%calculate_SAL) e_sal(:,:) = 0.0
1071+
call calc_tidal_forcing_legacy(CS%Time, e_sal, e_sal_and_tide, e_tidal_eq, e_tidal_sal, &
1072+
G, US, CS%tides_CSp)
1073+
!$OMP parallel do default(shared)
1074+
do j=Jsq,Jeq+1 ; do i=Isq,Ieq+1
1075+
e(i,j,nz+1) = e(i,j,nz+1) - e_sal_and_tide(i,j)
1076+
enddo ; enddo
1077+
endif
10571078
endif
10581079

10591080
!$OMP parallel do default(shared)
@@ -1201,8 +1222,8 @@ subroutine PressureForce_FV_Bouss(h, tv, PFu, PFv, G, GV, US, CS, ALE_CSp, p_atm
12011222
enddo ; enddo
12021223
enddo
12031224

1204-
! Self-attraction and loading (SAL) (new answers)
1205-
if (CS%calculate_SAL .and. CS%tides_answer_date>20230630) then
1225+
! Calculate and add SAL geopotential anomaly to interface height (new answers)
1226+
if (CS%calculate_SAL .and. CS%tides_answer_date>20250131) then
12061227
if (CS%sal_use_bpa) then
12071228
!$OMP parallel do default(shared)
12081229
do j=Jsq,Jeq+1 ; do i=Isq,Ieq+1
@@ -1225,8 +1246,8 @@ subroutine PressureForce_FV_Bouss(h, tv, PFu, PFv, G, GV, US, CS, ALE_CSp, p_atm
12251246
enddo ; endif
12261247
endif
12271248

1228-
! Tides (new answers)
1229-
if (CS%tides .and. CS%tides_answer_date>20230630) then
1249+
! Calculate and add tidal geopotential anomaly to interface height (new answers)
1250+
if (CS%tides .and. CS%tides_answer_date>20250131) then
12301251
call calc_tidal_forcing(CS%Time, e_tidal_eq, e_tidal_sal, G, US, CS%tides_CSp)
12311252
if (.not.CS%bq_sal_tides) then ; do K=1,nz+1
12321253
!$OMP parallel do default(shared)
@@ -1812,11 +1833,13 @@ subroutine PressureForce_FV_init(Time, G, GV, US, param_file, diag, CS, SAL_CSp,
18121833
call get_param(param_file, '', "DEFAULT_ANSWER_DATE", default_answer_date, default=99991231)
18131834
if (CS%tides) &
18141835
call get_param(param_file, mdl, "TIDES_ANSWER_DATE", CS%tides_answer_date, "The vintage of "//&
1815-
"self-attraction and loading (SAL) and tidal forcing calculations. In both "//&
1816-
"Boussinesq and non-Boussinesq modes, values below 20230701 recover the old "//&
1817-
"answers in which the SAL is part of the tidal forcing calculation. The "//&
1818-
"change is due to a reordered summation and the difference is only at bit "//&
1819-
"level.", default=20230630, do_not_log=(.not.CS%tides))
1836+
"self-attraction and loading (SAL) and tidal forcing calculations. Setting "//&
1837+
"dates before 20230701 recovers old answers (Boussinesq and non-Boussinesq "//&
1838+
"modes) when SAL is part of the tidal forcing calculation. The answer "//&
1839+
"difference is only at bit level and due to a reordered summation. Setting "//&
1840+
"dates before 20250201 recovers answers (Boussinesq mode) that interface "//&
1841+
"heights are modified before pressure force integrals are calculated.", &
1842+
default=20230630, do_not_log=(.not.CS%tides))
18201843
call get_param(param_file, mdl, "CALCULATE_SAL", CS%calculate_SAL, &
18211844
"If true, calculate self-attraction and loading.", default=CS%tides)
18221845
if (CS%calculate_SAL) &
@@ -1844,9 +1867,9 @@ subroutine PressureForce_FV_init(Time, G, GV, US, param_file, diag, CS, SAL_CSp,
18441867
"pressure used in the equation of state calculations for the Boussinesq pressure "//&
18451868
"gradient forces, including adjustments for atmospheric or sea-ice pressure.", &
18461869
default=.false., do_not_log=.not.GV%Boussinesq)
1847-
if (CS%tides .and. CS%tides_answer_date<=20230630 .and. CS%use_SSH_in_Z0p) &
1870+
if (CS%tides .and. CS%tides_answer_date<=20250131 .and. CS%use_SSH_in_Z0p) &
18481871
call MOM_error(FATAL, trim(mdl) // ", PressureForce_FV_init: SSH_IN_EOS_PRESSURE_FOR_PGF "//&
1849-
"needs to be FALSE to recover tide answers before 20230701.")
1872+
"needs to be FALSE to recover tide answers before 20250131.")
18501873

18511874
call get_param(param_file, "MOM", "USE_REGRIDDING", use_ALE, &
18521875
"If True, use the ALE algorithm (regridding/remapping). "//&

src/parameterizations/lateral/MOM_self_attr_load.F90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ subroutine SAL_init(G, GV, US, param_file, CS)
187187
character(len=200) :: ebot_ref_varname ! Variable name in file
188188
logical :: calculate_sal=.false.
189189
logical :: tides=.false., use_tidal_sal_file=.false., bq_sal_tides_bug=.false.
190-
integer :: tides_answer_date=99991203 ! Recover old answers with tides
190+
integer :: tides_answer_date=99991231 ! Recover old answers with tides
191191
real :: sal_scalar_value, tide_sal_scalar_value ! Scaling SAL factors [nondim]
192192
integer :: isd, ied, jsd, jed
193193

@@ -231,9 +231,9 @@ subroutine SAL_init(G, GV, US, param_file, CS)
231231
scale=US%Pa_to_RL2_T2)
232232
call pass_var(CS%ebot_ref, G%Domain)
233233
endif
234-
if (tides_answer_date<=20230630 .and. CS%use_bpa) &
234+
if (tides_answer_date<=20250131 .and. CS%use_bpa) &
235235
call MOM_error(FATAL, trim(mdl) // ", SAL_init: SAL_USE_BPA needs to be false to recover "//&
236-
"tide answers before 20230630.")
236+
"tide answers before 20250131.")
237237
call get_param(param_file, mdl, "SAL_SCALAR_APPROX", CS%use_sal_scalar, &
238238
"If true, use the scalar approximation to calculate self-attraction and "//&
239239
"loading.", default=tides .and. (.not. use_tidal_sal_file))

0 commit comments

Comments
 (0)