Skip to content

Commit

Permalink
remove useless dtB_arrays module
Browse files Browse the repository at this point in the history
Rather use local private arrays in dtB directly
  • Loading branch information
tgastine committed Sep 9, 2024
1 parent b640b20 commit 3ba7b78
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 238 deletions.
5 changes: 1 addition & 4 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,6 @@ mem_alloc.o : parallel.o precision_mod.o output_data.o
out_TO.o : truncation.o horizontal.o num_param.o logic.o\
phys_param.o radial.o parallel.o integration.o\
constants.o output_data.o TO.o useful.o mem_alloc.o
dtB_arrays.o : truncation.o precision_mod.o constants.o\
mem_alloc.o
courant.o : truncation.o blocking.o num_param.o\
phys_param.o radial.o horizontal.o logic.o\
useful.o radial_data.o parallel.o
Expand Down Expand Up @@ -417,10 +415,9 @@ LMLoop.o : truncation.o blocking.o parallel.o time_array.o\
logic.o radial_data.o updateWPS.o\
output_data.o fields.o dt_fieldsLast.o\
updateS.o updateB.o mem_alloc.o updateXI.o\
updateZ.o updateWP.o debugging.o
updateZ.o updateWP.o
mpi_transpose.o : precision_mod.o truncation.o radial_data.o\
mem_alloc.o parallel.o blocking.o
debugging.o : precision_mod.o precision_mod.o
timing.o : parallel.o precision_mod.o
radial_derivatives.o : $(DCT_OBJS) constants.o precision_mod.o chebyshev.o
output.o : truncation.o blocking.o phys_param.o\
Expand Down
119 changes: 0 additions & 119 deletions src/debugging.f90

This file was deleted.

50 changes: 28 additions & 22 deletions src/dtB.f90
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module dtB_mod
& lm2lmS, lm2lmA
use radial_spectra ! rBrSpec, rBpSpec
use sht, only: scal_to_SH, spat_to_sphertor
use constants, only: two, ci
use constants, only: zero, two, ci
use radial_der, only: get_dr

implicit none
Expand Down Expand Up @@ -57,6 +57,12 @@ module dtB_mod
complex(cp), public, allocatable :: PadvLMIC_LMloc(:,:), PdifLMIC_LMloc(:,:)
complex(cp), public, allocatable :: TadvLMIC_LMloc(:,:), TdifLMIC_LMloc(:,:)

!-- Local private complex arrays for SH transforms
complex(cp), allocatable :: BtVrLM(:), BpVrLM(:), BrVtLM(:)
complex(cp), allocatable :: BtVpLM(:), BpVtLM(:), BrVpLM(:)
complex(cp), allocatable :: BpVtBtVpCotLM(:), BpVtBtVpSn2LM(:)
complex(cp), allocatable :: BtVZLM(:), BtVZsn2LM(:), BrVZLM(:)

class(type_mpitransp), pointer :: r2lo_dtB

public :: initialize_dtB_mod, get_dtBLMfinish, get_dtBLM, get_dH_dtBLM, &
Expand All @@ -73,7 +79,6 @@ subroutine initialize_dtB_mod
! The remaining global arrays should be suppressed, they are only
! needed because of some movie outputs
!

if ( l_dtBmovie ) then
if ( rank == 0 ) then
allocate( PstrLM(lm_max,n_r_max), PadvLM(lm_max,n_r_max) )
Expand All @@ -96,6 +101,23 @@ subroutine initialize_dtB_mod
end if
end if

allocate( BtVrLM(lm_max), BpVrLM(lm_max), BrVtLM(lm_max), BrVpLM(lm_max) )
allocate( BtVpLM(lm_max), BpVtLM(lm_max), BpVtBtVpCotLM(lm_max) )
allocate( BpVtBtVpSn2LM(lm_max), BrVZLM(lm_max), BtVZLM(lm_max) )
allocate( BtVZsn2LM(lm_max) )
bytes_allocated = bytes_allocated+ 11*lm_max*SIZEOF_DEF_COMPLEX
BtVrLM(:) = zero
BpVrLM(:) = zero
BrVtLM(:) = zero
BrVpLM(:) = zero
BtVpLM(:) = zero
BpVtLM(:) = zero
BrVZLM(:) = zero
BtVZLM(:) = zero
BpVtBtVpCotLM(:) = zero
BpVtBtVpSn2LM(:) = zero
BtVZsn2LM(:) = zero

allocate( PdifLM_LMloc(llmMag:ulmMag,n_r_max) )
allocate( TdifLM_LMloc(llmMag:ulmMag,n_r_max) )
bytes_allocated = bytes_allocated+ &
Expand Down Expand Up @@ -147,6 +169,8 @@ subroutine finalize_dtB_mod
deallocate( TdifLMIC, TadvLMIC, PdifLMIC, PadvLMIC, TdifLM, PdifLM )
end if

deallocate( BtVrLM, BpVrLM, BrVtLM, BrVpLM, BtVpLM, BpVtLM )
deallocate( BpVtBtVpCotLM, BpVtBtVpSn2LM, BrVZLM, BtVZLM, BtVZsn2LM )
deallocate( PdifLM_LMloc, TdifLM_LMloc, PadvLMIC_LMloc, PdifLMIC_LMloc )
deallocate( TadvLMIC_LMloc, TdifLMIC_LMloc )
deallocate( dtB_Rloc_container, dtB_LMloc_container )
Expand Down Expand Up @@ -176,9 +200,7 @@ subroutine dtb_gather_lo_on_rank0

end subroutine dtb_gather_lo_on_rank0
!----------------------------------------------------------------------------
subroutine get_dtBLM(nR,vr,vt,vp,br,bt,bp,BtVrLM,BpVrLM,BrVtLM,BrVpLM, &
& BtVpLM,BpVtLM,BrVZLM,BtVZLM,BpVtBtVpCotLM, &
& BpVtBtVpSn2LM,BtVZsn2LM)
subroutine get_dtBLM(nR,vr,vt,vp,br,bt,bp)
!
! This subroutine calculates non-linear products in grid-space for radial
! level nR.
Expand All @@ -189,15 +211,6 @@ subroutine get_dtBLM(nR,vr,vt,vp,br,bt,bp,BtVrLM,BpVrLM,BrVtLM,BrVpLM, &
real(cp), intent(in) :: vr(:,:),vt(:,:),vp(:,:)
real(cp), intent(in) :: br(:,:),bt(:,:),bp(:,:)

!-- Output variables:
complex(cp), intent(out) :: BtVrLM(:),BpVrLM(:)
complex(cp), intent(out) :: BrVtLM(:),BrVpLM(:)
complex(cp), intent(out) :: BtVpLM(:),BpVtLM(:)
complex(cp), intent(out) :: BrVZLM(:),BtVZLM(:)
complex(cp), intent(out) :: BpVtBtVpCotLM(:)
complex(cp), intent(out) :: BpVtBtVpSn2LM(:)
complex(cp), intent(out) :: BtVZsn2LM(:)

!-- Local variables:
integer :: n_theta,n_phi
real(cp) :: fac,facCot
Expand Down Expand Up @@ -270,8 +283,7 @@ subroutine get_dtBLM(nR,vr,vt,vp,br,bt,bp,BtVrLM,BpVrLM,BrVtLM,BrVpLM, &

end subroutine get_dtBLM
!-----------------------------------------------------------------------
subroutine get_dH_dtBLM(nR,BtVrLM,BpVrLM,BrVtLM,BrVpLM,BtVpLM,BpVtLM, &
& BrVZLM,BtVZLM,BpVtBtVpCotLM,BpVtBtVpSn2LM)
subroutine get_dH_dtBLM(nR)
!
! Purpose of this routine is to calculate theta and phi
! derivative related terms of the magnetic production and
Expand All @@ -280,12 +292,6 @@ subroutine get_dH_dtBLM(nR,BtVrLM,BpVrLM,BrVtLM,BrVpLM,BtVpLM,BpVtLM, &

!-- Input variables:
integer, intent(in) :: nR
complex(cp), intent(in) :: BtVrLM(*),BpVrLM(*)
complex(cp), intent(in) :: BrVtLM(*),BrVpLM(*)
complex(cp), intent(in) :: BtVpLM(*),BpVtLM(*)
complex(cp), intent(in) :: BpVtBtVpCotLM(*)
complex(cp), intent(in) :: BpVtBtVpSn2LM(*)
complex(cp), intent(in) :: BrVZLM(*),BtVZLM(*)

!-- Local variables:
integer :: l,m,lm,lmS,lmA
Expand Down
69 changes: 0 additions & 69 deletions src/dtB_arrays.f90

This file was deleted.

4 changes: 1 addition & 3 deletions src/out_dtB_frame.f90
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ subroutine write_dtB_frame(n_movie,b,db,aj,dj,b_ic,db_ic,aj_ic,dj_ic)
const =movie_const(n_movie)

!--- Axisymmetric dtFL or dtAB:

if ( n_type == 31 .or. n_type == 32 .or. n_type == 33 .or. &
& n_type == 41 .or. n_type == 42 .or. n_type == 43 ) then

Expand Down Expand Up @@ -150,7 +149,7 @@ subroutine write_dtB_frame(n_movie,b,db,aj,dj,b_ic,db_ic,aj_ic,dj_ic)

end do

!--- dtBr:
!--- dtBr:
else ! non-axisymmetric fields

do n_field=1,n_fields
Expand Down Expand Up @@ -184,7 +183,6 @@ subroutine write_dtB_frame(n_movie,b,db,aj,dj,b_ic,db_ic,aj_ic,dj_ic)
end if

!------ Outer core contribution:

!------ Calculate needed radial derivatives:
if ( n_field_type == 35 ) then
call get_dr(PstrLM,workA,lm_max,1,lm_max, &
Expand Down
Loading

0 comments on commit 3ba7b78

Please sign in to comment.