Skip to content

Commit

Permalink
some docs changes to remove refs to DifferentialEquations, also remov…
Browse files Browse the repository at this point in the history
…e unused callback option
  • Loading branch information
archermarx committed Feb 23, 2024
1 parent 327a6c5 commit c61ae08
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions HallThrusterTutorial.ipynb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion docs/src/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ Aside from these arguments, all others have default values provided. These are
- `implicit_energy`: The degree to which the energy is solved implicitly. `0.0` is a fully-explicit forward Euler, `0.5` is Crank-Nicholson, and `1.0` is backward Euler. Defaults to `1.0`.
- `min_number_density`: Minimum allowable number density for any species. Defaults to `1e6`
- `min_electron_temperature`: Minimum allowable electron temperature. Defaults to `1.0`.
- `callback`: User-provided callback. This can by any standard callback from `DifferentialEquations.jl`. Defaults to `nothing`.
- `magnetic_field_scale`: Factor by which the magnetic field is increased or decreased compared to the one in the provided `Thruster` struct. Defaults to `1.0`.
- `source_neutrals`: Extra user-provided neutral source term. Can be an arbitrary function, but must take `(U, params, i)` as arguments. Defaults to `Returns(0.0)`. See [User-Provided Source Terms](@ref) for more information.
- `source_ion_continuity`: Vector of extra source terms for ion continuity, one for each charge state. Defaults to `fill(Returns(0.0), ncharge)` . See [User-Provided Source Terms](@ref) for more information.
Expand Down
11 changes: 5 additions & 6 deletions docs/src/numerics.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Numerics

As described in [Configuration](@ref) and [Initialization](@ref) different flux options are available in `HyperbolicScheme`. Timemarching for the heavy species is handled by [DifferentialEquations.jl](https://github.com/SciML/DifferentialEquations.jl). The left hand side of the electron energy equation is integrated implicitly using a Crank Nicolson Adams Bashforth (CNAB) scheme. This enables larger timessteps due to the severe restrictions due to the electron heat flux.
As described in [Configuration](@ref) and [Initialization](@ref) different flux options are available in `HyperbolicScheme`. Timemarching for the heavy species is handled using a second order strong-stability preserving Runge-Kutta scheme (SSPRK22). The left hand side of the electron energy equation is integrated implicitly using a Crank Nicolson Adams Bashforth (CNAB) scheme. This enables larger timessteps due to the severe restrictions due to the electron heat flux.

## Spatial discretization for heavy species

Expand All @@ -19,25 +19,24 @@ See [Fluxes](@ref) for the implemented fluxes, and possible limiters to be used

## Time discretization of heavy species

Time integration is handled by [DifferentialEquations.jl](https://github.com/SciML/DifferentialEquations.jl). Strong stability preserving Runge Kutta schemes are used by default (specifically `SSPRK22`), but the user is free use other schemes provided by DifferentialEquations.jl.
We employ a strong stability preserving second-order Runge Kutta schemes (`SSPRK22`) for timestepping

Keep in mind that following von-Neumann stability analysis for explicit schemes the CFL number has to be lower than 1. The CFL number is defined as:
The user has the option to supply a fixed timestep, or a CFL number. In the former case, the user will need to select a timestep that obeys the CFL condition, defined as

```math
\sigma = \frac{u_i \Delta t}{\Delta x}
\sigma = \frac{u_i \Delta t}{\Delta x} < 1
```

Using a maximum ion velocity of 22000 m/s, a domain length of 0.05m and 200 cells, results in ``\Delta t \leq 1.2 \times 10^{-8}`` s. In practice, it needs to be a bit lower in order to handle transients as the solution oscillates. This restriction is valid for the continuity and isothermal euler equations. Information on setting `dt` and selecting the integration scheme can be found in the [Tutorial](@ref).

HallThruster.jl also has an adaptive timestepping option. If adaptive timestepping is enabled, the user-defined timestep is ignored in favor of a timestep based on the minimum of three conditions and the user-defined CFL number. Mathematically the timstep is choosen as:
In most cases, it is better to let HallThruster.jl handle timestepping automatically using its adaptive timestepping option. If adaptive timestepping is enabled, the user-defined timestep is ignored in favor of a timestep based on the minimum of three conditions and a user-supplied CFL number. Mathematically the timstep is choosen as:

```math
\Delta t = min(\sigma \frac{\Delta x}{max(u_i + a_i, u_i - a_i)}, \sigma \frac{\dot{n}_i}{n_i}, \sqrt{\frac{\sigma m_i \Delta x}{q_i E}})
```

Where ``a_i`` is the ion sound speed. Physically, these three conditions represent timestep limits imposed by the flux, ionization, and electrostatic acceleration. Keep in mind that due to stability limits imposed by the ionization condition, the CFL number cannot be higher than 0.799 to remain stable. This limit will be imposed by HallThruster.jl if the user-defined value is too high.


## Electron energy equation discretization

While the ions can be explicitly solved with ``\Delta t \sim 10^{-8}``s, the heat condution term in the electron energy equation adds additional constraints which would lower the timestep by about a factor of 10. In order to not further increase the timestepping restrictions and increase computation time, the electron energy equation is solved semi-implicitly in time using a backward Euler or Crank-Nicholson scheme. See [Configuration](@ref) for information on how to select which scheme is used.
Expand Down
4 changes: 2 additions & 2 deletions docs/src/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,13 @@ tasks.

### The `Solution` object

Running a simulation returns a `HallThruster.Solution` object. This mimics a DifferentialEquations `DiffEqSolution` object and has the same fields:
Running a simulation returns a `HallThruster.Solution` object, which has the the same fields:

`t`: A `vector` of times at which the simulation state is saved
`u`: A `vector` of simulation state matrices saved at each of the times in `t`
`savevals`: A `Vector` of `NamedTuple`s containing saved derived plasma properties at each of the times in `t`
`retcode`: A `Symbol` describing how the simulation finished. This should be `:Success` if the simulation succeeded, but may be `:NaNDetected` if the simulation failed.
`params`: A NamedTuple containing simulation parameters, such as the `Config` the simulation was run with, the computational grid, and more.
`params`: A NamedTuple containing simulation parameters, such as the `Config` the simulation was run with, the computational grid, and more. `params.cache` contains all of the variables not contained in `u`

### Extracting performance metrics

Expand Down
14 changes: 8 additions & 6 deletions src/simulation/configuration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ Hall thruster configuration struct. Only four mandatory fields: `discharge_volta
# Fields
$(TYPEDFIELDS)
"""
struct Config{A<:AnomalousTransportModel, TC<:ThermalConductivityModel, W<:WallLossModel, IZ<:IonizationModel, EX<:ExcitationModel, EN<:ElectronNeutralModel, HET<:Thruster, S_N, S_IC, S_IM, S_ϕ, S_E, T<:TransitionFunction, IC<:InitialCondition, CB, HS<:HyperbolicScheme}
struct Config{A<:AnomalousTransportModel, TC<:ThermalConductivityModel, W<:WallLossModel, IZ<:IonizationModel,
EX<:ExcitationModel, EN<:ElectronNeutralModel, HET<:Thruster, S_N, S_IC, S_IM, S_ϕ, S_E,
T<:TransitionFunction, IC<:InitialCondition, HS<:HyperbolicScheme}
discharge_voltage::Float64
cathode_potential::Float64
anode_Te::Float64
Expand All @@ -27,7 +29,6 @@ struct Config{A<:AnomalousTransportModel, TC<:ThermalConductivityModel, W<:WallL
min_electron_temperature::Float64
transition_function::T
initial_condition::IC
callback::CB
magnetic_field_scale::Float64
source_neutrals::S_N
source_ion_continuity::S_IC
Expand Down Expand Up @@ -74,7 +75,6 @@ function Config(;
min_electron_temperature = min(anode_Te, cathode_Te),
transition_function::TransitionFunction = LinearTransition(0.2 * thruster.geometry.channel_length, 0.0),
initial_condition::IC = DefaultInitialization(),
callback = nothing,
magnetic_field_scale::Float64 = 1.0,
source_neutrals::S_N = nothing,
source_ion_continuity::S_IC = nothing,
Expand Down Expand Up @@ -130,9 +130,11 @@ function Config(;

return Config(
discharge_voltage, cathode_potential, anode_Te, cathode_Te, wall_loss_model,
neutral_velocity, neutral_temperature, implicit_energy, propellant, ncharge, ion_temperature, anom_model, conductivity_model,
ionization_model, excitation_model, electron_neutral_model, electron_ion_collisions, min_number_density, min_electron_temperature, transition_function,
initial_condition, callback, magnetic_field_scale, source_neutrals,
neutral_velocity, neutral_temperature, implicit_energy, propellant, ncharge,
ion_temperature, anom_model, conductivity_model,
ionization_model, excitation_model, electron_neutral_model, electron_ion_collisions,
min_number_density, min_electron_temperature, transition_function,
initial_condition, magnetic_field_scale, source_neutrals,
source_IC,
source_IM,
source_potential,
Expand Down

0 comments on commit c61ae08

Please sign in to comment.