From b9ae6681b66fb0a0043cf2fcd8b518318b8b81db Mon Sep 17 00:00:00 2001 From: Michele Guerini Rocco Date: Tue, 30 Jul 2024 14:16:57 +0200 Subject: [PATCH] src/dispersion.f90: remove global variables The extv and ttv arrays can be computed at compile-time and simply defined as parameters. --- src/dispersion.f90 | 25 ++++++------------------- src/gray_core.f90 | 4 ---- 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/src/dispersion.f90 b/src/dispersion.f90 index 4108b4f..4abc07a 100644 --- a/src/dispersion.f90 +++ b/src/dispersion.f90 @@ -18,15 +18,15 @@ module dispersion implicit none ! global constants + integer :: i integer, parameter :: npts = 500 - real(wp_), parameter :: tmax = 5.0_wp_ - real(wp_), parameter :: dtex = 2*tmax/dble(npts) - - ! global variables - real(wp_), dimension(npts+1), save :: ttv, extv + real(wp_), parameter :: tmax = 5 + real(wp_), parameter :: dtex = 2 * tmax/npts + real(wp_), parameter :: ttv(*) = [(-tmax + (i-1)*dtex, i = 1, npts+1)] + real(wp_), parameter :: extv(*) = exp(-ttv**2) private - public expinit, colddisp, warmdisp + public colddisp, warmdisp public zetac, harmnumber contains @@ -1201,19 +1201,6 @@ subroutine ssbi(zz,n,l,fsbi) end do ! end subroutine ssbi -! -! -! -subroutine expinit -! local variables - integer :: i -! - do i = 1, npts+1 - ttv(i) = -tmax+dble(i-1)*dtex - extv(i)=exp(-ttv(i)*ttv(i)) - end do -! -end subroutine expinit pure subroutine fsup(lrm, yg, npl, mu, cefp, cefm, error) diff --git a/src/gray_core.f90 b/src/gray_core.f90 index d671bc9..59eab95 100644 --- a/src/gray_core.f90 +++ b/src/gray_core.f90 @@ -10,7 +10,6 @@ contains subroutine gray_main(params, data, results, error, rhout) use const_and_precisions, only : zero, one, comp_tiny use coreprofiles, only : temp, fzeff - use dispersion, only : expinit use polarization, only : ellipse_to_field use types, only : table, wrap use gray_params, only : gray_parameters, gray_data, gray_results, EQ_VACUUM @@ -113,9 +112,6 @@ contains ! from launch angles α,β and the position call launchangles2n(params%antenna, anv0) - ! Initialise the dispersion module - if(params%ecrh_cd%iwarm > 1) call expinit - if (params%equilibrium%iequil /= EQ_VACUUM) then ! Initialise the magsurf_data module call compute_flux_averages(params, results%tables)