Skip to content

Commit

Permalink
Removing unused variables
Browse files Browse the repository at this point in the history
  • Loading branch information
cpinte committed Dec 5, 2024
1 parent 95fba9f commit c8bb661
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 65 deletions.
10 changes: 4 additions & 6 deletions src/gas/atom_transfer.f90
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ end subroutine alloc_tau_surface_map

subroutine dealloc_tau_surface_map()
!TO DO: only at the centre of lines
integer :: ibin,iaz,i,j,la

character(len=50) :: filename
! real(kind=dp), allocatable :: image(:,:,:,:,:,:)

Expand Down Expand Up @@ -132,7 +132,7 @@ subroutine nlte_loop_mali()
integer :: etape, etape_start, etape_end, iray
integer :: n_iter, id, i, alloc_status, n_rayons
! integer :: , iray_start, n_rayons_max
integer :: nact, imax, icell_max, icell_max_2
integer :: nact
integer :: icell, ilevel, nb, nr, unconverged_cells
integer, parameter :: maxIter = 300!150!, maxIter3 = 10
!ray-by-ray integration of the SEE
Expand Down Expand Up @@ -174,7 +174,7 @@ subroutine nlte_loop_mali()
!-> overall the non-LTE loop
real :: time_nlte, time_nlte_loop, time_nlte_cpu
real :: cpu_time_begin, cpu_time_end, time_nlte_loop_cpu
integer :: count_start, count_end, itime
integer :: count_start, count_end
!-> for a single iteration
integer :: cstart_iter, cend_iter
real :: time_iteration, cpustart_iter, cpuend_iter, time_iter_avg
Expand Down Expand Up @@ -1044,7 +1044,6 @@ end subroutine compute_max_relative_velocity
subroutine setup_image_grid()
!to do lmono -limg
!keep somewhere tab_lambda_sed = tab_lambda because tab_lambda is overwritten in non-LTE
integer :: kr, nat

call deallocate_wavelengths_gasrt()
call dealloc_atom_opac()
Expand Down Expand Up @@ -1458,8 +1457,7 @@ subroutine emission_line_map(ibin,iaz)
integer :: ri_RT, phi_RT
logical :: lresolved

real(kind=dp) :: z1, z2
integer, dimension(:), allocatable :: tab_pix_healpix
!integer, dimension(:), allocatable :: tab_pix_healpix

write(*,*) "Vector to observer =", real(tab_u_rt(ibin,iaz)),real(tab_v_rt(ibin,iaz)),real(tab_w_rt(ibin))
write(*,*) "i=", real(tab_RT_incl(ibin)), "az=", real(tab_RT_az(iaz))
Expand Down
10 changes: 5 additions & 5 deletions src/gas/collision_atom.f90
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ subroutine Johnson_CI(temp, Cik)
! --------------------------------------------------- !
real(kind=dp), intent(in) :: temp
real(kind=dp), intent(out), dimension(:) :: Cik
integer :: i, j, Nl
integer :: i, Nl
!real(kind=dp) :: x0 = 1 - (n/n0)**2 with n0 -> infinity
real(kind=dp) :: C0, rn, bn, n, An, En, yn, zn, S, Bnp, deltaM

Expand Down Expand Up @@ -157,7 +157,7 @@ subroutine Johnson_CE(temp, Cij)
real(kind=dp), intent(in) :: temp
real(kind=dp), intent(out), dimension(:,:) :: Cij
integer :: i, j, Nl
real(kind=dp) :: C0, rn, bn, n, Ennp, y, z, S, Bnnp, En
real(kind=dp) :: C0, rn, bn, n, y, z, S, Bnnp, En
real(kind=dp) :: np, x, fnnp, rnnp, Annp, Gaunt_bf, deltam

deltam = 1. + Mel/ (hydrogen%weight * AMU_kg)
Expand Down Expand Up @@ -622,8 +622,8 @@ subroutine collision_rates_atom_loc(id, icell, atom)
! --------------------------------------------------------------------------- !
type (AtomType), intent(inout) :: atom
integer, intent(in) :: icell, id
integer :: ij, k, Nread, countline=0, colunit
integer :: NTMP, n, m, ii, Nitem, i1, i2, i, j, ji, Nitem2
integer :: ij, k, Nread, countline=0
integer :: NTMP, m, ii, Nitem, i1, i2, i, j, ji
character(len=3) :: END_OF_FILE="END"
integer, parameter :: max_len_key = 8!set by the maximum length of a keyword!!
character(len=max_len_key) :: key
Expand All @@ -636,7 +636,7 @@ subroutine collision_rates_atom_loc(id, icell, atom)
integer :: Ncoef, Nrow, Nlines, k1, kr
character(len=Nmax_line_per_collision) :: inputline, FormatLine
real(kind=dp) :: acolsh, tcolsh, aradsh, xradsh, adish, bdish
real(kind=dp) :: t0sh, t1sh, summrs, tg, cdn, ccup
real(kind=dp) :: t0sh, t1sh, summrs, tg, cdn
real(kind=dp) :: ar85t1, ar85t2, ar85a, ar85b, ar85c, ar85d, t4
real(kind=dp) :: de,zz,betab,cbar,dekt,dekti,wlog,wb,sumscl
real(kind=dp) :: ni_on_nj, nj_on_ni
Expand Down
25 changes: 12 additions & 13 deletions src/gas/electron_density.f90
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ subroutine solve_ne_loc(k,ne_init)
!solve for electronic density locally (one point).
integer, intent(in) :: k
real(kind=dp), intent(in) :: ne_init
real(kind=dp) :: delta, ne_old, akj, sum, Uk, Ukp1, dne
real(kind=dp) :: delta, ne_old, akj, sum, dne
real(kind=dp):: PhiHmin, n0
real(kind=dp), dimension(max_ionisation_stage) :: fjk, dfjk
!!real(kind=dp), dimension(-N_negative_ions:N_MAX_ELEMENT) :: max_fjk, min_fjk !Negative ions from -N_neg to 0 (H-), then from 1 to Nelem positive ions
Expand All @@ -316,7 +316,7 @@ subroutine solve_ne_loc(k,ne_init)
!difference between ne(k) and ne_init gives the different to the initial solution
!not the criterion of convergence
ne_old = ne_init

!Loop starts
ne(k) = ne_old
niter=0
Expand Down Expand Up @@ -403,7 +403,7 @@ subroutine solve_ne_loc(k,ne_init)

niter = niter + 1
if (dne <= MAX_ELECTRON_ERROR) then
!set transparent ? dark ?
!set transparent ? dark ?
! if (ne(k) < ne_small) then
! write(*,*) " (Solve ne) ne < ne_small at cell",k!, " ; setting cell transparent!"
! write(*,*) "T=", T(k), ' nHtot=', nHtot(k), " ne=", ne(k)
Expand All @@ -430,7 +430,7 @@ subroutine solve_ne_loc(k,ne_init)
return
end subroutine solve_ne_loc


subroutine solve_ne(initial, verbose, epsilon)
! ----------------------------------------------------------------------!
! Solve for electron density for a set of elements
Expand Down Expand Up @@ -458,16 +458,15 @@ subroutine solve_ne(initial, verbose, epsilon)
logical, intent(in) :: verbose
!difference wrt the initial solution, not criterion of convergence (dne)
real(kind=dp), intent(inout) :: epsilon
real(kind=dp):: ne_oldM, UkM, PhiHmin, ne0, Uk, Ukp1, eps_id(nb_proc)
real(kind=dp), dimension(max_ionisation_stage) :: fjk, dfjk
real(kind=dp), dimension(-N_negative_ions:N_MAX_ELEMENT) :: max_fjk, min_fjk !Negative ions from -N_neg to 0 (H-), then from 1 to Nelem positive ions
real(kind=dp):: ne_oldM, ne0, Uk, Ukp1, eps_id(nb_proc)
real(kind=dp), dimension(-N_negative_ions:N_MAX_ELEMENT) :: max_fjk !Negative ions from -N_neg to 0 (H-), then from 1 to Nelem positive ions
integer :: k, ZM, id, ibar, n_cells_done, n_cells_skipped
integer :: unconverged_cells(nb_proc), ik_max, ik_max_id(nb_proc)

ibar = 0
n_cells_done = 0
n_cells_skipped = 0!size(pack(icompute_atomRT,mask=icompute_atomRT /= 1))

unconverged_cells(:) = 0
eps_id(:) = 0.0
ik_max_id = 0.0
Expand Down Expand Up @@ -530,14 +529,14 @@ subroutine solve_ne(initial, verbose, epsilon)

end if

call solve_ne_loc(k, ne0)
call solve_ne_loc(k, ne0)

if (abs(1.0_dp - ne0 / ne(k)) > eps_id(id)) then
eps_id(id) = abs(1.0_dp - ne0 / ne(k))
ik_max_id(id) = k
endif


! Progress bar
!$omp atomic
n_cells_done = n_cells_done + 1
Expand Down Expand Up @@ -580,7 +579,7 @@ subroutine solve_ne(initial, verbose, epsilon)
end subroutine solve_ne






Expand All @@ -592,7 +591,7 @@ subroutine write_Electron
! ------------------------------------ !
integer :: unit, EOF = 0, blocksize, naxes(4), naxis,group, bitpix, fpixel
logical :: extend, simple
integer :: nelements, nfirst,sys_status
integer :: nelements,sys_status
character(len=512) :: cmd


Expand Down
21 changes: 10 additions & 11 deletions src/gas/escape.f90
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ subroutine mean_velocity_gradient()
real(kind=dp) :: x0,y0,z0,x1,y1,z1,u,v,w
real(kind=dp) :: xa,xb,xc,xa1,xb1,xc1,l1,l2,l3
integer :: next_cell, iray, icell_in, n_rayons
real :: rand, rand2, rand3, rand4
real :: rand, rand2, rand3
real(kind=dp) :: W02,SRW02,ARGMT,v0,v1, r0, wei, F1, T1, f_shock(n_etoiles)
integer :: n_rays_shock(n_etoiles), n_rays_star(n_etoiles)
real(kind=dp) :: l,l_contrib, l_void_before, Tchoc, rho_shock(n_etoiles)
Expand Down Expand Up @@ -617,7 +617,7 @@ subroutine nlte_loop_sobolev()
! - optically thin excitation with no lines for continua
! - MC rays (no healpix)
integer :: iray, n_iter, id, i, alloc_status, n_rayons
integer :: nact, imax, icell_max, icell_max_2
integer :: nact
integer :: icell, ilevel, nb, nr, unconverged_cells
integer, parameter :: maxIter = 80
!ray-by-ray integration of the SEE
Expand Down Expand Up @@ -647,7 +647,7 @@ subroutine nlte_loop_sobolev()
!-> overall the non-LTE loop
real :: time_nlte, time_nlte_loop, time_nlte_cpu
real :: cpu_time_begin, cpu_time_end, time_nlte_loop_cpu
integer :: count_start, count_end, itime
integer :: count_start, count_end
!-> for a single iteration
integer :: cstart_iter, cend_iter
real :: time_iteration, cpustart_iter, cpuend_iter, time_iter_avg
Expand Down Expand Up @@ -1180,8 +1180,8 @@ subroutine radrates_sobolev_average(id, icell)
integer, intent(in) :: id, icell
real, parameter :: fact_tau = 3.0
real(kind=dp), parameter :: prec_vel = 1.0 / Rsun ! [s^-1]
integer :: ns, nact, i, j, kc, kr, n0, nb, nr, Nl, l, i0
real(kind=dp) :: tau0, beta, chi_ij, Icore, l0, dvds
integer :: ns, nact, i, j, kr, n0, nb, nr, Nl, l, i0
real(kind=dp) :: tau0, beta, chi_ij, Icore, dvds
type(AtomType), pointer :: at
real(kind=dp) :: ni_on_nj_star, tau_escape, vth, gij
real(kind=dp) :: jbar_down, jbar_up, ehnukt, anu, tau_max
Expand Down Expand Up @@ -1334,7 +1334,7 @@ function I_sobolev_1ray(id,icell_in,x,y,z,u,v,w,iray,N,lambda)
integer, intent(in) :: N
real(kind=dp), dimension(N), intent(in) :: lambda
real(kind=dp), dimension(N) :: I_sobolev_1ray, Icore(N)
real(kind=dp) :: x0, y0, z0, x1, y1, z1, l, l_contrib, l_void_before, Q, P(4)
real(kind=dp) :: x0, y0, z0, x1, y1, z1, l, l_contrib, l_void_before
real(kind=dp), dimension(N) :: Snu, tau, dtau, chi, coronal_irrad
integer :: kr, nat, nl
integer, target :: icell
Expand Down Expand Up @@ -1442,8 +1442,8 @@ subroutine accumulate_radrates_sobolev_1ray(id, icell, iray, dOmega)
real(kind=dp), intent(in) :: dOmega
real, parameter :: fact_tau = 3.0
real(kind=dp), parameter :: prec_vel = 1.0 / Rsun ! [s^-1]
integer :: ns, nact, i, j, kc, kr, n0, nb, nr, Nl, l, i0
real(kind=dp) :: tau0, beta, chi_ij, Icore, l0, dvds, tau_max
integer :: ns, nact, i, j, kr, n0, nb, nr, Nl, l, i0
real(kind=dp) :: tau0, beta, chi_ij, Icore, dvds, tau_max
type(AtomType), pointer :: at
real(kind=dp) :: ni_on_nj_star, tau_escape, vth, gij, jbar_down, jbar_up, ehnukt, anu
real(kind=dp), dimension(Nlambda_max_trans) :: Ieff, xl
Expand Down Expand Up @@ -1577,7 +1577,7 @@ subroutine xccont(id,icell,iray,domega,rates)
integer :: kr, i, j, ip, jp, krr, Nbp, Nrp, i0, Nl, Nb, Nr, l
real(kind=dp) :: ni_on_nj_star, gij, wl, ehnukt, anu
real(kind=dp) :: jbar_down, jbar_up, xcc_down, xcc_up
real(kind=dp), dimension(Nlambda_max_trans) :: Ieff, dtau
real(kind=dp), dimension(Nlambda_max_trans) :: Ieff


!first loop to get the contributions from the different transitions
Expand Down Expand Up @@ -1683,8 +1683,7 @@ subroutine opt_thick_mali_rates_cont(id,icell,cont)
type (AtomicContinuum), intent(inout) :: cont
integer :: i, j, nact, kr
real(kind=dp) :: ni_on_nj_star, Jbar_down, Jbar_up, xcc_down, xcc_up
real(kind=dp) :: ehnukt, anu, wl
integer :: Nb, Nr, Nl, i0, l
integer :: Nb, Nr, Nl, i0
integer :: ip, jp, krr, Nrp, Nbp

!cont%Rji init at tab_Aji_cont
Expand Down
38 changes: 17 additions & 21 deletions src/gas/io_atom.f90
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@ subroutine read_model_atom(atomunit, atom)
!
integer, intent(in) :: atomunit
type (AtomType), intent(inout), target :: atom
real(kind=dp) :: dummy
character(len=2) :: IDread
character(len=512) :: inputline, FormatLine
logical :: find_abund, res
real, allocatable, dimension(:) :: levelNumber
logical, dimension(:), allocatable :: determined, parse_labs
character(len=20) :: shapeChar, vdWChar, nuDepChar
real(kind=dp) :: f, lambdaji, lambdamin
integer :: Nread, i,j, EOF, nll, nc, kr, la
real(kind=dp) :: f, lambdaji
integer :: Nread, i,j, EOF, nll, kr, la

EOF = 0
res = .false.
Expand Down Expand Up @@ -134,7 +133,7 @@ subroutine read_model_atom(atomunit, atom)
read(inputline,*) atom%E(i), atom%g(i), atom%label(i), &
atom%stage(i), levelNumber(i)
atom%E(i) = atom%E(i) * HP*C_LIGHT / (CM_TO_M)
end do
end do

! Check if there is at least one continuum transition
if (atom%stage(atom%Nlevel) /= atom%stage(atom%Nlevel-1)+1) then
Expand Down Expand Up @@ -168,14 +167,14 @@ subroutine read_model_atom(atomunit, atom)
atom%lines(kr)%g_lande_eff = -99.0
atom%lines(kr)%glande_i = -99.0; atom%lines(kr)%glande_j = -99.0

call read_line(atomunit, FormatLine, inputline, Nread)
call read_line(atomunit, FormatLine, inputline, Nread)
Nread = len(trim(inputline))
!!write(*,*) Nread, inputline(1:Nread)
read(inputline(1:Nread),*) j, i, f, shapeChar, atom%lines(kr)%qwing, vdWChar,&
atom%lines(kr)%cvdWaals(1), atom%lines(kr)%cvdWaals(2), &
atom%lines(kr)%cvdWaals(3), atom%lines(kr)%cvdWaals(4), &
atom%lines(kr)%Grad, atom%lines(kr)%cStark

!indexes in the atomic model are C indexes!
i = i + 1
j = j + 1
Expand All @@ -188,7 +187,7 @@ subroutine read_model_atom(atomunit, atom)
atom%i_trans(kr) = atom%lines(kr)%i
atom%j_trans(kr) = atom%lines(kr)%j

!because levels correspond to different transitions,
!because levels correspond to different transitions,
!we need to test if the level has already been indentified
if (.not.parse_labs(atom%lines(kr)%i)) then
call parse_label(atom%label(atom%lines(kr)%i),&
Expand Down Expand Up @@ -354,7 +353,7 @@ subroutine read_model_atom(atomunit, atom)
write(*,'(" Continuum "(1I3)" -> "(1I3)" at "(1F12.5)" nm")') &
atom%continua(kr)%i, atom%continua(kr)%j, atom%continua(kr)%lambda0
write(*,'(" -> lower edge cut at "(1F12.5)" nm !")') atom%continua(kr)%lambdamin

if (atom%continua(kr)%lambdamin>=atom%continua(kr)%lambda0) then
write(*,*) "Minimum wavelength for continuum is larger than continuum edge."
write(*,*) kr, atom%continua(kr)%lambda0, atom%continua(kr)%lambdamin
Expand All @@ -372,12 +371,12 @@ subroutine read_model_atom(atomunit, atom)
case default

call error("nudepchar!")

end select
enddo !bound-free

atom%set_ltepops = .true. !by default compute lte populations
!non-LTE pops in electronic density ? write non-LTE pops to file ?
!non-LTE pops in electronic density ? write non-LTE pops to file ?
atom%NLTEpops = .false. ! set to true during non-LTE loop (initial /= 1).
! true if read from file (initial==1).

Expand Down Expand Up @@ -413,7 +412,7 @@ subroutine read_model_atom(atomunit, atom)
allocate(atom%n(atom%Nlevel,n_cells))
atom%n = 0.0_dp
select case (atom%initial)
case (0)
case (0)
write(*,*) " -> Setting initial solution to LTE "
case (1)
write(*,*) " -> Setting initial solution to OLD_POPS " ! non-LTE + LTE
Expand Down Expand Up @@ -465,20 +464,17 @@ subroutine read_model_atom(atomunit, atom)
end subroutine read_Model_Atom

subroutine read_atomic_models()
integer :: EOF=0,Nread, nmet, mmet, nblancks, nact, npass
integer :: kr, k, imax, ic
real(kind=dp) :: min_resol, max_resol
integer :: Nread, nmet, mmet, nact, npass
integer :: unit = 1
character(len=15) :: FormatLine
character(len=512) :: popsfile, filename, inputline
character(len=512) :: inputline
character(len=2) :: IDread
type (AtomType), pointer :: atom


write(FormatLine,'("(1"A,I3")")') "A", 512
if (N_atoms > 1) then
write(*,*) "Reading ", N_atoms, " atoms"
else
else
write(*,*) "Reading ", N_atoms, " atom"
endif

Expand Down Expand Up @@ -643,7 +639,7 @@ subroutine write_pops_atom(atom,iter,step)
integer, optional :: iter, step
integer :: unit, blocksize, naxes(5), naxis,group, bitpix, fpixel
logical :: extend, simple, lte_only
integer :: nelements, hdutype, status, k, sys_status
integer :: nelements, status, sys_status
character(len=512) :: cmd, popsF
character(len=10000) :: step_c, iter_c

Expand Down Expand Up @@ -801,8 +797,8 @@ subroutine read_pops_atom(atom)
! ---------------------------------------------------------- !
type (AtomType), intent(inout) :: atom
integer :: unit, status, blocksize, naxis,group, bitpix, fpixel
logical :: extend, simple, anynull, show_warning = .true.
integer :: nelements, naxis2(4), Nl, naxis_found, hdutype, l, icell
logical :: extend, simple, anynull
integer :: nelements, naxis2(4), naxis_found, hdutype, l
character(len=256) :: some_comments, popsF
integer :: i, k
real(kind=dp) :: ntotal
Expand Down Expand Up @@ -1007,4 +1003,4 @@ subroutine read_pops_atom(atom)

end subroutine read_pops_atom

end module io_atom
end module io_atom
Loading

0 comments on commit c8bb661

Please sign in to comment.