Skip to content

Commit e6c97d3

Browse files
committed
Fix temperature BC for tides
1 parent ef1b987 commit e6c97d3

1 file changed

Lines changed: 19 additions & 13 deletions

File tree

src/updateS.f90

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module updateS_mod
1111
use truncation, only: n_r_max, lm_max, l_max
1212
use radial_data, only: n_r_cmb, n_r_icb, nRstart, nRstop
1313
use radial_functions, only: orho1, or1, or2, beta, dentropy0, rscheme_oc, &
14-
& kappa, dLkappa, dLtemp0, temp0, r, l_R
14+
& kappa, dLkappa, dLtemp0, temp0, r, l_R, r_cmb
1515
use physical_parameters, only: opr, kbots, ktops, stef, radratio
1616
use special, only: amp_tide, omega_tide, tide_fac20, tide_fac22p, tide_fac22n
1717
use num_param, only: dct_counter, solve_counter
@@ -260,21 +260,21 @@ subroutine updateS(time, s, ds, dsdt, phi, tscheme)
260260
if (amp_tide /= 0.0_cp) then
261261
if (l1 == 2 .and. m1 == 0) then
262262
rhs1(1,2*lm-1,threadid) = rhs1(1,2*lm-1,threadid) &
263-
& + radratio/omega_tide * tide_fac20 &
263+
& + radratio/omega_tide * tide_fac20 * 6.0_cp/r_cmb**2 &
264264
& * sin(omega_tide * time)
265265
rhs1(1,2*lm,threadid) = rhs1(1,2*lm,threadid) &
266-
& - radratio/omega_tide * tide_fac20 &
266+
& - radratio/omega_tide * tide_fac20 * 6.0_cp/r_cmb**2 &
267267
& * cos(omega_tide * time)
268268
end if
269269

270270
if (l1 == 2 .and. m1 == 2) then
271271
rhs1(1,2*lm-1,threadid) = rhs1(1,2*lm-1,threadid) &
272-
& + radratio/omega_tide &
273-
& * (tide_fac22p + tide_fac22n) &
272+
& + radratio/omega_tide * 6.0_cp/r_cmb**2 &
273+
& * (-tide_fac22p + tide_fac22n) & ! ← B = (-p + n)
274274
& * sin(omega_tide * time)
275275
rhs1(1,2*lm,threadid) = rhs1(1,2*lm,threadid) &
276-
& - radratio/omega_tide &
277-
& * (-tide_fac22p + tide_fac22n) &
276+
& - radratio/omega_tide * 6.0_cp/r_cmb**2 &
277+
& * (tide_fac22p + tide_fac22n) & ! ← A = (p + n)
278278
& * cos(omega_tide * time)
279279
end if
280280
end if
@@ -1346,17 +1346,23 @@ subroutine get_radial_flow_bc(time, m, sBC)
13461346
!-- Output variable
13471347
complex(cp), intent(out) :: sBC
13481348

1349+
!-- Local variable
1350+
real(cp) :: fac
1351+
1352+
fac = 6.0_cp / r_cmb**2 ! l(l+1)/r_o^2 for l=2
1353+
13491354
if (m==0) then
1350-
sBC = sBc + radratio/omega_tide * tide_fac20 * &
1351-
& cmplx(sin(omega_tide*time), &
1352-
& -cos(omega_tide*time),cp)
1355+
sBC = sBC + radratio/omega_tide * fac * tide_fac20 * &
1356+
& cmplx(sin(omega_tide*time), &
1357+
& -cos(omega_tide*time), cp)
13531358
end if
13541359

13551360
if (m==2) then
1356-
sBC = sBc + radratio/omega_tide * &
1357-
cmplx( (tide_fac22p + tide_fac22n) * sin(omega_tide * time), &
1358-
& (tide_fac22p - tide_fac22n) * cos(omega_tide * time), cp)
1361+
sBC = sBC + radratio/omega_tide * fac * &
1362+
& cmplx((-tide_fac22p + tide_fac22n) * sin(omega_tide*time), & ! B * sin(ωt)
1363+
& -(tide_fac22p + tide_fac22n) * cos(omega_tide*time), cp) ! -A * cos(ωt)
13591364
end if
1365+
13601366
end subroutine get_radial_flow_bc
13611367

13621368
end module updateS_mod

0 commit comments

Comments
 (0)