Skip to content

Commit

Permalink
more explicit deuterium normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
orso82 committed Oct 21, 2024
1 parent 7be4cd7 commit ebc51d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 2 additions & 3 deletions src/hirshman_sigmar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ function get_ion_electron_parameters(dd::IMAS.dd)
loglam = 24.0 .- log.(sqrt.(ne) ./ Te)

n_norm = ne
m_norm = md
t_norm = Te
nu_norm = sqrt.(k .* Te ./ md) ./ a

Expand All @@ -99,7 +98,7 @@ function get_ion_electron_parameters(dd::IMAS.dd)
for i in 1:num_ions
T1 = cp1d.ion[i].temperature[Int(ceil(end / 2))]
Z[i] = IMAS.avgZ(cp1d.ion[i].element[1].z_n, T1)
mass[i] = cp1d.ion[i].element[1].a * mp / m_norm
mass[i] = cp1d.ion[i].element[1].a * mp / md

dens[:, i] = cp1d.ion[i].density ./ m³_to_cm³ ./ n_norm
temp[:, i] = cp1d.ion[i].temperature ./ t_norm
Expand All @@ -110,7 +109,7 @@ function get_ion_electron_parameters(dd::IMAS.dd)
dlnndr[:, i] = -IMAS.calc_z(rmin / a, cp1d.ion[i].density, :backward)
dlntdr[:, i] = -IMAS.calc_z(rmin / a, cp1d.ion[i].temperature, :backward)

vth[:, i] = sqrt.((cp1d.ion[i].temperature ./ t_norm) ./ (cp1d.ion[i].element[1].a * mp / m_norm))
vth[:, i] = sqrt.((cp1d.ion[i].temperature ./ t_norm) ./ (cp1d.ion[i].element[1].a * mp / md))
end

# tacking on electron parameters at the end
Expand Down
7 changes: 3 additions & 4 deletions src/input_neo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,8 @@ function InputNEO(dd::IMAS.dd, gridpoint_cp)
dlntedr = dlntedr[gridpoint_cp]

n_norm = ne
m_norm = md
t_norm = Te
v_norm = sqrt(k .* t_norm ./ m_norm)
v_norm = sqrt(k .* t_norm ./ md)

input_neo.RMIN_OVER_A = rmin[gridpoint_cp] / a

Expand Down Expand Up @@ -322,7 +321,7 @@ function InputNEO(dd::IMAS.dd, gridpoint_cp)
for iion in eachindex(ions)
species = iion
setfield!(input_neo, Symbol("ANISO_MODEL_$species"), 1)
setfield!(input_neo, Symbol("MASS_$species"), ions[iion].element[1].a .* mp / m_norm)
setfield!(input_neo, Symbol("MASS_$species"), ions[iion].element[1].a .* mp / md)
setfield!(input_neo, Symbol("Z_$species"), Int(ions[iion].element[1].z_n / ions[1].element[1].z_n))

Ti = ions[iion].temperature ./ t_norm
Expand All @@ -347,7 +346,7 @@ function InputNEO(dd::IMAS.dd, gridpoint_cp)
setfield!(input_neo, Symbol("DENS_$i"), ne / n_norm)
setfield!(input_neo, Symbol("TEMP_$i"), Te / t_norm)
setfield!(input_neo, Symbol("ANISO_MODEL_$i"), 1)
setfield!(input_neo, Symbol("MASS_$i"), me / m_norm)
setfield!(input_neo, Symbol("MASS_$i"), me / md)
setfield!(input_neo, Symbol("Z_$i"), -1)
setfield!(input_neo, Symbol("DLNNDR_$i"), dlnnedr)
setfield!(input_neo, Symbol("DLNTDR_$i"), dlntedr)
Expand Down

0 comments on commit ebc51d3

Please sign in to comment.