sailfish.solvers.scdg_1d.Solver

class sailfish.solvers.scdg_1d.Solver(setup=None, mesh=None, time=0.0, solution=None, num_patches=1, mode='cpu', physics={}, options={})[source]

Bases: SolverBase

An n-th order, discontinuous Galerkin solver for 1D scalar advection.

Time-advance integrator options:

  • rk1: Forward Euler

  • rk2: SSP-RK2 of Shu & Osher (1988; Eq. 2.15)

  • rk3: SSP-RK3 of Shu & Osher (1988; Eq. 2.18)

  • rk3-sr02: four-stage 3rd Order SSP-4RK3 of Spiteri & Ruuth (2002)

__init__(setup=None, mesh=None, time=0.0, solution=None, num_patches=1, mode='cpu', physics={}, options={})[source]

Methods

__init__([setup, mesh, time, solution, ...])

advance(dt)

Advance the solution state by one iteration.

maximum_wavespeed()

Return the largest wavespeed on the grid.

reductions()

Return a set of measurements derived from the solution state.

Attributes

maximum_cfl

Return the largest CFL number that should be used for this solver.

options

A dictionary that reflects the solver solution scheme.

physics

A dictionary describing the physics parameters of the system.

primitive

Return primitive hydrodynamic data for use in plotting.

recommended_cfl

Return a recommended CFL number to the driver, default to the maximum.

solution

Return an object representing the solution state.

time

Return the simulation time.

advance(dt)[source]

Advance the solution state by one iteration.

property maximum_cfl

Return the largest CFL number that should be used for this solver.

maximum_wavespeed()[source]

Return the largest wavespeed on the grid.

This function is not implemented as a property, to emphasize that it might be relatively expensive to compute.

property options

A dictionary that reflects the solver solution scheme.

An example of an options object would be dict(plm=1.5, rk=2). The items should describe the solver algorithm, not the parameters of the physical system being solved, such as an equation of state or cooling prescription.

Solver options and physics parameters are kept logically separate because their configuration comes from different places: the physics parameters come from the sailfish.setup.Setup class instance (which can in turn be set from model parameters), whereas the solver options come directly from the driver instance (i.e. command line --solver key=val if sailfish is invoked as an executable).

property physics

A dictionary describing the physics parameters of the system.

The physics parameters are supplied by the setup. They can include things like an equation of state, a cooling prescription, external gravity, a wavespeed in the case of passive scalar advection, fluid viscocity model, etc. These items can still be influenced at runtime through the setup’s model parameters.

property primitive

Return primitive hydrodynamic data for use in plotting.

The primitive variable data returned from this function could be written to checkpoint files, but it might also be written to non-checkpoint output files for offline analysis, or passed along to runtime post-processing routines.

property recommended_cfl

Return a recommended CFL number to the driver, default to the maximum.

reductions()

Return a set of measurements derived from the solution state.

Solvers do not need to implement this. If they do, the diagnostic outputs they will return when this function is called should be provided to the solver by the setup when the setup is first constructed.

property solution

Return an object representing the solution state.

The solution object is generally going to be either an array of primitive hydrodynamic data, or of conserved quantities, depending on which the solver considers to be more fundamental. If the solver maintains state in addition to the hydrodynamic data, such as a list of tracer or star particles, then objects like that should also be returned as part of the solution object.

The solution object will be written to the checkpoint file, read back on restarts, and passed to the solver constructor. When the run is not a restart, the solver should instead construct its initial solution object from the setup and mesh instances.

property time

Return the simulation time.