sailfish.solvers.cbdgam_2d.Solver
- class sailfish.solvers.cbdgam_2d.Solver(setup=None, mesh=None, time=0.0, solution=None, num_patches=1, mode='cpu', physics={}, options={})[source]
Bases:
SolverBase
Adapter class to drive the cbdgam_2d C extension module.
- __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.
advance_rk
(rk_param, dt)Return the largest wavespeed on the grid.
new_iteration
()Generate runtime reductions on the solution data for time series.
set_bc
(array)set_bc_patch
(pl, pc, pr, patch_index)Attributes
Return the largest CFL number that should be used for this solver.
A dictionary that reflects the solver solution scheme.
A dictionary describing the physics parameters of the system.
This solver uses primitive data as the solution array.
Return a recommended CFL number to the driver, default to the maximum.
Return an object representing the solution state.
Return the simulation time.
- 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
This solver uses primitive data as the solution array.
- property recommended_cfl
Return a recommended CFL number to the driver, default to the maximum.
- 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.