Skip to content

Commit

Permalink
introduce nR_mag in rIter.f90
Browse files Browse the repository at this point in the history
It turns out the code does not run in debug flags since get_td calls slices empty
arrays. For some reason, this does not occur for dVXirLM and dVxVhLM though it
should when they are not allocated. Bug fix is not entirely satisfactory.
  • Loading branch information
tgastine committed May 30, 2024
1 parent 152a783 commit 4b5a1d5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions src/rIter.f90
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ subroutine radialLoop(this,l_graph,l_frame,time,timeStage,tscheme,dtLast, &
complex(cp), intent(out) :: dVxBhLM(lm_maxMag,nRstartMag:nRstopMag)

!---- Output of nonlinear products for nonlinear
! magnetic boundary conditions (needed in s_updateB.f):
! magnetic boundary conditions (needed in updateB.f90):
complex(cp), intent(out) :: br_vt_lm_cmb(:) ! product br*vt at CMB
complex(cp), intent(out) :: br_vp_lm_cmb(:) ! product br*vp at CMB
complex(cp), intent(out) :: br_vt_lm_icb(:) ! product br*vt at ICB
Expand All @@ -149,7 +149,7 @@ subroutine radialLoop(this,l_graph,l_frame,time,timeStage,tscheme,dtLast, &
!-- Courant citeria:
real(cp), intent(out) :: dtrkc(nRstart:nRstop),dthkc(nRstart:nRstop)

integer :: nR, nBc
integer :: nR, nBc, nR_Mag
logical :: lMagNlBc, l_bound, lDeriv

if ( l_graph ) then
Expand Down Expand Up @@ -218,6 +218,12 @@ subroutine radialLoop(this,l_graph,l_frame,time,timeStage,tscheme,dtLast, &

if ( lRmsCalc ) nBc=0 ! One also needs to compute the boundaries in that case

if ( l_mag .or. l_mag_LF ) then
nR_Mag=nR
else
nR_Mag=1
end if

dtrkc(nR)=1e10_cp
dthkc(nR)=1e10_cp

Expand Down Expand Up @@ -418,13 +424,12 @@ subroutine radialLoop(this,l_graph,l_frame,time,timeStage,tscheme,dtLast, &
! input flm... is in (l,m) space at radial grid points nR !
! Only dVxBh needed for boundaries !
! get_td finally calculates the d*dt terms needed for the
! time step performed in s_LMLoop.f . This should be distributed
! over the different models that s_LMLoop.f parallelizes over.
! time step performed in LMLoop.f90 .
call td_counter%start_count()
call this%nl_lm%get_td(nR, nBc, lPressNext, dVSrLM(:,nR), dVXirLM(:,nR), &
& dVxVhLM(:,nR), dVxBhLM(:,nR), dwdt(:,nR), &
& dVxVhLM(:,nR), dVxBhLM(:,nR_Mag), dwdt(:,nR), &
& dzdt(:,nR), dpdt(:,nR), dsdt(:,nR), dxidt(:,nR), &
& dbdt(:,nR), djdt(:,nR))
& dbdt(:,nR_Mag), djdt(:,nR_Mag))
call td_counter%stop_count(l_increment=.false.)

!-- Finish computation of r.m.s. forces
Expand Down
2 changes: 1 addition & 1 deletion src/step_time.f90
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ subroutine step_time(time, tscheme, n_time_step, run_time_start)
if ( tscheme%istage == 1 ) then
if ( lVerbose ) write(output_unit,*) "! start output"

if ( l_cmb .and. l_dt_cmb_field ) then
if ( l_cmb .and. l_dt_cmb_field .and. nRstart==n_r_cmb ) then
call scatter_from_rank0_to_lo(dbdt_Rloc(:,n_r_cmb), dbdt_CMB_LMloc)
end if

Expand Down

0 comments on commit 4b5a1d5

Please sign in to comment.