Skip to content

Commit 0633e80

Browse files
committed
Time dependent temp BCs for tides
1 parent 7d3ed01 commit 0633e80

2 files changed

Lines changed: 27 additions & 3 deletions

File tree

src/LMLoop.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ subroutine LMLoop(time,timeNext,tscheme,lMat,lRmsNext,lPressNext, &
224224

225225
if ( l_heat .and. .not. l_single_matrix .and. l_update_s ) then
226226
PERFON('up_S')
227-
call updateS( s_LMloc, ds_LMloc, dsdt, phi_LMloc, tscheme )
227+
call updateS( s_LMloc, ds_LMloc, dsdt, phi_LMloc, time, tscheme )
228228
PERFOFF
229229
end if
230230

src/updateS.f90

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ module updateS_mod
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, &
1414
& kappa, dLkappa, dLtemp0, temp0, r, l_R
15-
use physical_parameters, only: opr, kbots, ktops, stef
15+
use physical_parameters, only: opr, kbots, ktops, stef, radratio
16+
use special, only: amp_tide, omega_tide, tide_fac20, tide_fac22p, tide_fac22n
1617
use num_param, only: dct_counter, solve_counter
1718
use init_fields, only: tops, bots
1819
use blocking, only: lo_map, lo_sub_map, llm, ulm, st_map
@@ -152,14 +153,15 @@ subroutine finalize_updateS
152153

153154
end subroutine finalize_updateS
154155
!------------------------------------------------------------------------------
155-
subroutine updateS(s, ds, dsdt, phi, tscheme)
156+
subroutine updateS(s, ds, dsdt, phi, time, tscheme)
156157
!
157158
! Updates the entropy field s and its radial derivative.
158159
!
159160

160161
!-- Input of variables:
161162
class(type_tscheme), intent(in) :: tscheme
162163
complex(cp), intent(in) :: phi(llm:ulm,n_r_max) ! Phase field
164+
real(cp), intent(in) :: time
163165

164166
!-- Input/output of scalar fields:
165167
complex(cp), intent(inout) :: s(llm:ulm,n_r_max) ! Entropy
@@ -255,6 +257,28 @@ subroutine updateS(s, ds, dsdt, phi, tscheme)
255257
rhs1(n_r_max,2*lm-1,threadid)= real(bots(l1,m1))
256258
rhs1(n_r_max,2*lm,threadid) =aimag(bots(l1,m1))
257259

260+
if (amp_tide /= 0.0_cp) then
261+
if (l1 == 2 .and. m1 == 0) then
262+
rhs1(1,2*lm-1,threadid) = rhs1(1,2*lm-1,threadid) &
263+
& - radratio/omega_tide * tide_fac20/real(l1*(l1+1),kind=cp) &
264+
& * sin(omega_tide * time)
265+
rhs1(1,2*lm,threadid) = rhs1(1,2*lm,threadid) &
266+
& + radratio/omega_tide * tide_fac20/real(l1*(l1+1),kind=cp) &
267+
& * cos(omega_tide * time)
268+
end if
269+
270+
if (l1 == 2 .and. m1 == 2) then
271+
rhs1(1,2*lm-1,threadid) = rhs1(1,2*lm-1,threadid) &
272+
& - radratio/omega_tide &
273+
& * (tide_fac22p + tide_fac22n)/real(l1*(l1+1),kind=cp) &
274+
& * sin(omega_tide * time)
275+
rhs1(1,2*lm,threadid) = rhs1(1,2*lm,threadid) &
276+
& + radratio/omega_tide &
277+
& * (-tide_fac22p + tide_fac22n)/real(l1*(l1+1),kind=cp) &
278+
& * cos(omega_tide * time)
279+
end if
280+
end if
281+
258282
do nR=2,n_r_max-1
259283
rhs1(nR,2*lm-1,threadid)= real(work_LMloc(lm1,nR))
260284
rhs1(nR,2*lm,threadid) =aimag(work_LMloc(lm1,nR))

0 commit comments

Comments
 (0)