Simulations
In HallThruster, parameters used in the running of a specific simulation, such as the grid resolution and timestepping properties, are controlled by the SimParams
struct. Below are the fields of this struct. As in all parts of the code, dimensional quantities are SI unless explicitly noted, but units may be provided using Unitful
or DynamicQuantities
.
Types
HallThruster.SimParams
— Typemutable struct SimParams{C<:HallThruster.CurrentController}
grid::HallThruster.GridSpec
: A grid specifier, eitherHallThruster.EvenGrid(n)
orHallThruster.UnevenGrid(n)
, where n is the desired number of cells. See Grid generation for more information.
dt::Float64
: The simulation base timestep in seconds. See Timestepping for more info.
duration::Float64
: The simulation duration in seconds.
num_save::Int64
: How many simulation frames to save in theSolution
struct. Default: 1000
verbose::Bool
: Whether information such as the simulation run-time is printed to console. Default:true
print_errors::Bool
: Whether errors are printed to console in addition to being captured in theSolution
struct. Default:true
adaptive::Bool
: Whether to use adaptive timestepping. See Timestepping for more info. Default:true
CFL::Float64
: The CFL number used in adaptive timestepping. Maximum is 0.799. Default: 0.799
min_dt::Float64
: The minimum allowable timestep in adaptive timestepping, in seconds. Default: 1e-10
max_dt::Float64
: The maximum allowable timestep in adaptive timestepping, in seconds. Default: 1e-7
max_small_steps::Int64
: The maximum number of minimally-sized timesteps permitted in adaptive timestepping. Default: 100
current_control::HallThruster.CurrentController
: Discharge current controller. Default:HallThruster.NoController()
Using a SimParams
in combination with a suitable Config
, we can use run_simulation
to run a simulation. We can also run a simulation from an appropriately-formatted JSON file. See Use JSON for input and output for more information.
Functions
HallThruster.run_simulation
— Methodrun_simulation(
config::HallThruster.Config,
sim::HallThruster.SimParams;
postprocess,
restart,
kwargs...
) -> HallThruster.Solution{_A, P, C} where {_A, P<:NamedTuple, C<:HallThruster.Config}
Run a Hall thruster simulation using the provided Config
and SimParams
objects. Returns a Solution
object.
Arguments
config::Config
: contains geometry, plasma properties, and numerical information about the simulation. See Configuration for more information.sim::SimParams
: contains grid generation and timestepping information. See Simulations for more information.postprocess::Union{Postprocess, Nothing}
: contains file to which output is to be written and specifies what kind of output to write. Ifnothing
, no output is written to file. See Postprocessing for more information.restart
::String:An optional path to a JSON file containing plasma data. If non-empty, the solution will be restarted from that file.
HallThruster.run_simulation
— Methodrun_simulation(
json_file::String;
restart
) -> HallThruster.Solution{_A, P, C} where {_A, P<:NamedTuple, C<:HallThruster.Config}
Run a simulation from a JSON input file. If postprocess
is set in the JSON file and postprocess.output_file
is non-empty, output will be written to postprocess.output_file
. If restart
is a JSON file, this function will also try to restart the simulation from that file. Returns a Solution
object.