From 2c46270f7a3687a439759c2aa60ed332475ea2c0 Mon Sep 17 00:00:00 2001 From: Thomas Gastine Date: Tue, 30 Jul 2024 15:11:23 +0200 Subject: [PATCH] remove redundant array init in radial_spectra.f90 --- src/TO.f90 | 12 +++++------- src/dtB.f90 | 6 +++--- src/radial_spectra.f90 | 19 ------------------- 3 files changed, 8 insertions(+), 29 deletions(-) diff --git a/src/TO.f90 b/src/TO.f90 index 3f4a67f4..6d602686 100644 --- a/src/TO.f90 +++ b/src/TO.f90 @@ -176,13 +176,11 @@ subroutine getTO(vr,vt,vp,cvr,dvpdr,br,bt,bp,cbr,cbt,phase,dtLast,nR) phiNorm=one/real(n_phi_max, kind=cp) !-- Set values to zero before filling it - do nTheta=1,n_theta_max - dzCorAS_Rloc(nTheta,nR) =0.0_cp - dzRstrAS_Rloc(nTheta,nR)=0.0_cp - dzAstrAS_Rloc(nTheta,nR)=0.0_cp - if ( l_mag ) dzLFAS_Rloc(nTheta,nR)=0.0_cp - if ( l_phase_field ) dzPenAS_Rloc(nTheta,nR)=0.0_cp - end do + dzCorAS_Rloc(:,nR) =0.0_cp + dzRstrAS_Rloc(:,nR)=0.0_cp + dzAstrAS_Rloc(:,nR)=0.0_cp + if ( l_mag ) dzLFAS_Rloc(:,nR)=0.0_cp + if ( l_phase_field ) dzPenAS_Rloc(:,nR)=0.0_cp !-- Big loop over thetas in block: do nTheta=1,n_theta_max diff --git a/src/dtB.f90 b/src/dtB.f90 index 77a6bdb7..ccbd01e8 100644 --- a/src/dtB.f90 +++ b/src/dtB.f90 @@ -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 + use constants, only: two, ci use radial_der, only: get_dr implicit none @@ -428,8 +428,8 @@ subroutine get_dtBLMfinish(time,n_time_step,omega_ic,b,ddb,aj,dj,ddj,b_ic, & do lm=start_lm,stop_lm l=lo_map%lm2l(lm) m=lo_map%lm2m(lm) - PadvLMIC_LMloc(lm,nR)=-omega_ic*dPhi(st_map%lm2(l,m))*b_ic(lm,nR) - TadvLMIC_LMloc(lm,nR)=-omega_ic*dPhi(st_map%lm2(l,m))*aj_ic(lm,nR) + PadvLMIC_LMloc(lm,nR)=-omega_ic*ci*m*b_ic(lm,nR) + TadvLMIC_LMloc(lm,nR)=-omega_ic*ci*m*aj_ic(lm,nR) PdifLMIC_LMloc(lm,nR)=opm*O_sr * ( ddb_ic(lm,nR) + & & two*real(l+1,cp)*O_r_ic(nR)*db_ic(lm,nR) ) TdifLMIC_LMloc(lm,nR)=opm*O_sr * ( ddj_ic(lm,nR) + & diff --git a/src/radial_spectra.f90 b/src/radial_spectra.f90 index 6138e63f..c66c2ad8 100644 --- a/src/radial_spectra.f90 +++ b/src/radial_spectra.f90 @@ -69,7 +69,6 @@ subroutine rBrSpec(time,Pol,PolIC,fileRoot,lIC,map) !-- Inner core: if ( lIC ) then - lAS=.true. if ( trim(adjustl(fileRoot)) == 'rBrAdvSpec' ) lAS= .false. @@ -77,10 +76,6 @@ subroutine rBrSpec(time,Pol,PolIC,fileRoot,lIC,map) do n_r=2,n_r_ic_max rRatio=r_ic(n_r)/r_ic(1) - do l=1,6 - e_p(l,n_r_max-1+n_r)=0.0_cp - e_p_AS(l,n_r_max-1+n_r)=0.0_cp - end do do lm=llm,ulm l=map%lm2l(lm) if ( l > 0 .and. l <= 6 ) then @@ -106,13 +101,6 @@ subroutine rBrSpec(time,Pol,PolIC,fileRoot,lIC,map) end if end do end do - else - do n_r=2,n_r_ic_max - do l=1,6 - e_p_AS(l,n_r_max-1+n_r)=0.0_cp - e_p(l,n_r_max-1+n_r) =0.0_cp - end do - end do end if call reduce_radial(e_p, e_p_global, 0) @@ -190,13 +178,6 @@ subroutine rBpSpec(time,Tor,TorIC,fileRoot,lIC,map) end do ! do loop over lms in block end do ! radial grid points - !-- Inner core: - do n_r=2,n_r_ic_max - do l=1,6 - e_t_AS(l,n_r_max-1+n_r)=0.0_cp - e_t(l,n_r_max-1+n_r) =0.0_cp - end do - end do if ( lIC .and. l_cond_ic ) then lAS=.true.