src/dispersion.f90: remove global variables

The extv and ttv arrays can be computed at compile-time and simply
defined as parameters.
This commit is contained in:
Michele Guerini Rocco 2024-07-30 14:16:57 +02:00
parent 3a10b45595
commit a4ab741341
Signed by: rnhmjoj
GPG Key ID: BFBAF4C975F76450
2 changed files with 6 additions and 23 deletions

View File

@ -18,15 +18,15 @@ module dispersion
implicit none implicit none
! global constants ! global constants
integer :: i
integer, parameter :: npts = 500 integer, parameter :: npts = 500
real(wp_), parameter :: tmax = 5.0_wp_ real(wp_), parameter :: tmax = 5
real(wp_), parameter :: dtex = 2*tmax/dble(npts) real(wp_), parameter :: dtex = 2 * tmax/npts
real(wp_), parameter :: ttv(*) = [(-tmax + (i-1)*dtex, i = 1, npts+1)]
! global variables real(wp_), parameter :: extv(*) = exp(-ttv**2)
real(wp_), dimension(npts+1), save :: ttv, extv
private private
public expinit, colddisp, warmdisp public colddisp, warmdisp
public zetac, harmnumber public zetac, harmnumber
contains contains
@ -1201,19 +1201,6 @@ subroutine ssbi(zz,n,l,fsbi)
end do end do
! !
end subroutine ssbi 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) pure subroutine fsup(lrm, yg, npl, mu, cefp, cefm, error)

View File

@ -10,7 +10,6 @@ contains
subroutine gray_main(params, data, results, error, rhout) subroutine gray_main(params, data, results, error, rhout)
use const_and_precisions, only : zero, one, comp_tiny use const_and_precisions, only : zero, one, comp_tiny
use coreprofiles, only : temp, fzeff use coreprofiles, only : temp, fzeff
use dispersion, only : expinit
use polarization, only : ellipse_to_field use polarization, only : ellipse_to_field
use types, only : table, wrap use types, only : table, wrap
use gray_params, only : gray_parameters, gray_data, gray_results, EQ_VACUUM use gray_params, only : gray_parameters, gray_data, gray_results, EQ_VACUUM
@ -113,9 +112,6 @@ contains
! from launch angles α,β and the position ! from launch angles α,β and the position
call launchangles2n(params%antenna, anv0) call launchangles2n(params%antenna, anv0)
! Initialise the dispersion module
if(params%ecrh_cd%iwarm > 1) call expinit
if (params%equilibrium%iequil /= EQ_VACUUM) then if (params%equilibrium%iequil /= EQ_VACUUM) then
! Initialise the magsurf_data module ! Initialise the magsurf_data module
call compute_flux_averages(params, results%tables) call compute_flux_averages(params, results%tables)