This methods ensures n_e(ψ) is everywhere positive and C²-continuous.
The density boundary is now dependent on the width w of the mollifier,
which also controls the smoothness of the curve, specifically:
ψ_bnd = ψ_last + w
where ψ_last = 1.01 currently is an extra point added to improve the
convergence of the mollified density to the original data as w→0.
This makes the following changes to summary.7.txt:
1. Preserve the sign of J_φ_peak J_φ_max, i.e. if the J_φ is negative,
those will be negative. Previously they would always be unsigned.
2. If the sign of J_φ is alternating significantly, specifically if
(∫|J_φ|dA - |∫J_φ⋅dA|) / ∫|J_φ|dA > 10%
then sign of ρ_avg_J, Δρ_avg_J, ρ_max_J, Δρ_max_J will be negative.
Previously they were always positive.
3. If there is no current J_φ=0 (power dPdV=0), then
ρ_avg_J=1, rho_max_J=1 (ρ_avg_P=1, rho_max_P=1).
Previosuly they would be set to zero.
This helps producing continuous results as a beam is gradually
focused into the plasma.
There are two cases in which a wave in GRAY can reach and pass through a
cutoff:
1. a discontinuity or too large step size causes the integrator to jump
into region with N⊥² < 0, according to the cold plasma theory.
2. a wave gets close to a cutoff region is still propagating according
to the cold plasma theory, but the warm disperion relation already
gives re(N⊥²) < 0.
For case 1. we raise an error and immediately stop the raytracing as it
must be completely invalid. For case 2. we force N⊥² = 0 to avoid
interpreting the wave reflection as a strong energy absorption, but
allow the raytracing to continue.
Store the polarisation ellipse angles χ, ψ only for the central ray.
Otherwise they'll be zeroed out since `plasma_in` does not compute the
polarisation of the other rays.
Idea: a release will be a git tag, distributed as an autogenerated
archive (eg. by GitLab release feature).
This version string must therefore be stored in a revisioned file, so we
use `.version` for this purpose. Before tagging a new release this file
will have to be updated with the new version number.
When building gray the revision (shown in the output headers and usage
screen) will be set to either
- the latest commit hash when building from a git checkout,
- from the .version file when building from release archive.
The implementation is based on whether the .git directory is present.
The unused elements of the array are now initialized explicitly
with empty strings to add compatibility with ifort 2020, that
otherwise fails with internal error.
To keep the notation used in compute_initial_conds consistent with the
source linked (Q = K - iW for the complex curvature tensor), we need to
adds a minus sign in a few places where ∇S_I is computed.
1. Local variables are automatically deallocated when they go out of
scope.
2. When calling exit() during CLI processing some stuff wasn't being
deallocated, but it doesnt matter because the OS does it anyway.
So, get rid of it entirely.
This changes the ψ, χ polarisation ellipse angles shown in the summary
table to be those of the current plasma wave mode, not the polarisation
of the beam upon re-entering the plasma boundary after reflecting.
Note that the former has always been the intended value, but was likely
changed inadvertently when reflections have been implemented.
When the beam reflects before entering the boundary the Jones vector
(ext, eyt) is still uninitialised, set it at the beginning to avoid
raising an exception in debug mode.
The caching is cool, but it's implemented using static variables and
therefore not thread-safe. Since the savings are pretty modest (about
20% of the total eccdeff calls, itself 3% of the total execution) let's
just drop it.
This was the final module with global variables to be rewritten.
The functionaly of pec: `pec_init`, `spec`, `postproc_profiles` has been
replaced by the `ray_projector` object in `gray_project.f90` with the
following methods: `projector%init`, `projector%project` and
`projector%statistics`.
The new code is functionally identically with only breaking change being
in Δρ_J, the full-width at max/e of the current density.
Before this change Δρ_J could be negative to signal the J_φ profile had
at least one positive and one negative peak, after the value is always
positive. Note: in either case Δρ_J was given by the largest peak only.
When combining multiple independent simulations with `gray -s`, the
statistics in sum-summary.txt are computed by summing the profiles
pointwise and calling `postproc_profiles` with their (supposedly common)
MHD equilibrium.
The subroutine assumes the normalisations of dP/dV⋅dV and J_φ⋅dA are
P_inside(ρ=1), I_cd_inside(ρ=1), however if the individual profiles have
been computed with different versions of Gray, built with different
compilers, or on different machines, the values may be very slightly off.
Further, due to the use of the relation Δρ² = ⟨ρ²⟩ - ⟨ρ⟩², the profile
widths are very sensible to the normalisation, producing wildly
incorrect values.
For example, due to the refactor of `magsurf_data`, a change of about
0.05% in dV resulted in Δρ² being off by 300%.