Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to next #38

Open
wants to merge 95 commits into
base: next
Choose a base branch
from
Open

Update to next #38

wants to merge 95 commits into from

Conversation

bshanahan
Copy link
Collaborator

The next branch is stale, and doesn't compile with the newest BOUT++ versions, so I made this.

johnomotani and others added 30 commits November 4, 2019 16:32
Versions of Hypnotoad newer than 1.1.3 generate output that can take
into account whether "shifted" or "identity" parallel transforms are
used. The option should be set to generate a grid file for "shifted" to
be compatible with Hermes. In this case the curvature vector is
generated by Hypnotoad with no contribution from integrated shear, so
the correction applied by Hermes to remove the integrated shear
contribution from the curvature vector should be skipped. This commit
adds a check of the "parallel_transform" variable in the grid file (if
not present indicates that an old enough version of Hypnotoad was used
that the correction is needed), and applies the correction if the grid
file was generated for 'parallel_transform == "identity"', skips it if
'parallel_transform == "shifted"' and throws an exception due to an
unrecognized value for 'parallel_transform' otherwise.
Used dx rather than dy to calculate diffusion and viscosity.
Copied over from diffusion2d neutral model.
…-compatibility

Add check for gridfile generated by new versions of Hypnotoad
Check coordinate system of input
Include diffusion of NVn in preconditioner
Thanks to S.Mordijck for the fix.
Newer grid files use "shiftedmetric" rather than "shifted".
Now allows either in check for compatible grid files.

Thanks to @wphu for the fix

Fixes issue #12
Sets a minimum density to be used in the sheath boundary conditions.
Other sources zeroed, but Spi was not.
The original switch, adapt_sources, now provides the default
value for two new switches: adapt_source_p and adapt_source_n
If temperature varies across the domain, this can lead to electric
fields along the boundary, and so radial ExB flows through the
boundary. This fix sets the radial boundary to the Z average (DC).
Another way to avoid negative densities/pressures, by extrapolating
the logarithm of density and pressure.
Should set zero gradient boundary condition on phi.
- Remove averaging in Y, except in the core closed field-line region.
- Add a switch radial_core_averagey to turn on/off this averaging in the core
- Modify treatment of NVi to be similar to the other fields, rather than damping
  to zero.
Prevent atomicpp.a being checked in accidentally.
Thanks @hahahasan ! Accidentally using Vort rather than NVi in
outer boundary.
Catch problems in future if new sheath models are added
but heat flux code is not updated.
Should be Neumann boundary condition, was set to tesheath.
In most cases this should be the same, but not when te gets
very low.
Fixes for boundary conditions
Similar to what is used in STORM, relax the radial boundary value of
phi towards zero-gradient on a given timescale.
When the boundary is modified, the `phi_boundary_last_update`
time needs to be set.
The INVERT_SET flag takes the value from the guard cell,
then sets this value on the boundary between cells. This results
in an unstable solution if the guard cells are then put back
in as the new boundary value.

With this fix, the old value of the boundary is taken from the
midpoint, and then put into the guard cell. Hopefully this is
consistent with how the value is used in the Laplacian inversion.
- Need to move phi boundary values from cell midpoint to boundary cell
  every time the solver is called.
- Need to include Pi in the solve, because Pi is subtracted from the
  result (Boussinesq approximation)
I don't think this should be necessary, but it seems to be.
Without setting phi in the outermost boundary cells (+2, -2)
the time advance eventually fails to converge. When this failure
occurs all fields seem to be well behaved except these outer boundary
cells which contain large (1e200) values.

With this change no such failures seem to happen (so far)
bendudson and others added 23 commits December 11, 2020 17:26
Integrates the sources over the domain, printing in SI units.
Hopefully fixes Github formatting.
Previous input went to steady state with no fluctuations.
This change makes the sources more peaked, and results in
growing modes then saturated fluctuations.
Enables simulations to be run from inside that directory.
Seems to be enough to stabilise turbulent stage of the simulation.
Sets zero-gradient on temperature. Now using the same
method as in sheath model 1.
Determines when the sheath current should be
turned off as unphysical. If nesheath_floor is larger
than 1e-10 then this condition would never be true.
Use the larger of the Alfven speed or electron sound speed,
capped at an upper limit of 100x reference, or light speed in vacuum.

This stabilises parallel zig-zags seen near the target in low density,
low pressure regions.
If Pe is floored to a non-zero value in these terms, then
energy can continue to be extracted from a zero (or negative) pressure
region.
Almost never what is wanted, so shouldn't be true by default.
Added some documentation.
Modify ramp_mesh to be false by default
Increase characteristic wave speed
Missing parameter in help message. Now using f-string.
Script to set profiles in tokamak grid files.
Explain what the profiles are used for, and how to set them using the script.
Make 2D plots, plots along the targets, and volume integrals
@bshanahan bshanahan marked this pull request as ready for review July 20, 2021 13:30
* Slab3D actually has seg fault, but at least starts.
@@ -106,7 +106,7 @@ void Diffusion2D::precon(BoutReal, BoutReal gamma, BoutReal) {
// Neutral gas diffusion
// Solve (1 - gamma*Dnn*Delp2)^{-1}
if(!inv) {
inv = Laplacian::create();
auto inv = Laplacian::create();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this creates a new Laplacian, that is deleted at the end of the scope (or at least no further used / referenced).

In this case, inv outside the scope is not set, and will give a segfault in line 117.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants