Skip to content

Commit 2023dc9

Browse files
committed
Switch to curl of body force, better AM conserv
1 parent 3a2deaa commit 2023dc9

1 file changed

Lines changed: 8 additions & 24 deletions

File tree

src/init_fields.f90

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,38 +1579,22 @@ subroutine initF(bodyForce)
15791579
a_force = eta_fac / (r_cmb * (1.0_cp - eta_fac))
15801580
b_force = 1.0_cp / (r_cmb**2 * ( 1.0_cp - eta_fac ))
15811581

1582+
! This is the curl of the body force, \vec{e}_r\cdot \nabla\times\vec{F}
1583+
15821584
do nR = nRstart,nRstop
15831585
do nPhi=1,n_phi_max
15841586
do nTheta=1,n_theta_max
1585-
! This is F_{\phi}/sin(\theta) for toroidal equation
1586-
! where F = ( -a s + b s^2 ) \vec{e}_\phi
1587-
! Use F_r for poloidal equation
1588-
bf_spat(nTheta,nPhi) = ampForce * &
1589-
& (- a_force * r(nR) &
1590-
& + b_force * r(nR) * r(nR) &
1591-
& * sinTheta(nTheta) )
1587+
bf_spat(nTheta,nPhi) = ampForce * &
1588+
& (- 2.0_cp * a_force &
1589+
& + 3.0_cp * b_force * r(nR) &
1590+
& * sinTheta(nTheta) ) * cosTheta(nTheta)
15921591
end do
15931592
end do
15941593

15951594
call scal_to_SH(bf_spat, bfLM, l_max)
15961595

1597-
!------- body force is now in spherical harmonic space,
1598-
! For toroidal equation, get radial component of
1599-
! curl by applying operator
1600-
! dTheta1=1/(r sinTheta) d/ d theta sinTheta**2,
1601-
! comment out for poloidal equation
1602-
do lm=2,lm_max
1603-
l=st_map%lm2l(lm)
1604-
m=st_map%lm2m(lm)
1605-
if ( l < l_max .and. l > m ) then
1606-
bf_Rloc(lm,nR)=dTheta1S(lm)*bfLM(st_map%lm2lmS(lm)) &
1607-
& -dTheta1A(lm)*bfLM(st_map%lm2lmA(lm))
1608-
else if ( l < l_max .and. l == m ) then
1609-
bf_Rloc(lm,nR)=dTheta1A(lm)*bfLM(st_map%lm2lmA(lm))
1610-
else if ( l == l_max .and. m < l ) then
1611-
bf_Rloc(lm,nR)=dTheta1S(lm)*bfLM(st_map%lm2lmS(lm))
1612-
end if
1613-
end do
1596+
!------- body force is now in spherical harmonic space
1597+
bf_Rloc(:,nR)=bfLM(:)
16141598

16151599
end do ! close loop over radial points
16161600

0 commit comments

Comments
 (0)