Ignition v0.1.0 documentation

Ignition Riemann

Language

Defines the Riemann language

class ignition.riemann.language.Conserved[source]

Represents a conserved variable

For multi-dimension variables, the dimension can be set with fields or with dim.

The given a list of expressions, jacobian will compute the jacobian of the expressions with respect to the fields of the conserved variable.

Examples:

>>> q = Conserved('q', dim=2)
>>> q_0, q_1 = q.fields()
>>> q.jacobian([.5*q_0+q_1, q_1**2])
[0.5,     1]
[  0, 2*q_1]
>>> nq = Conserved('nq')
>>> u, uh = nq.fields(['u', 'uh'])
>>> nq.jacobian([.5*u+uh, uh**2])
[0.5,    1]
[  0, 2*uh]
fields(list_of_names=None)[source]

Generates and returns the fields inside the conserve fields.

If list of names is given, the fields are named accordingly once initialized with different names the names field is ignored.

If a dimension wasn’t set when the Conserved object was constructed, the dimension is determined from the number of names. If the number of names and the dimension are different, an error is thrown.

jacobian(flux)[source]

Returns the jacobian of the flux expression with respect to the fields in the conserved variable.

class ignition.riemann.language.Constant[source]

Represents a global constant.

class ignition.riemann.language.ConstantField[source]

Represents a field of constants defined on cells.

class ignition.riemann.language.Field[source]

Represents a field of the conserved quantity.

Generator

Generator for simple Riemann solver

class ignition.riemann.generator.Generator(**kws)[source]

Manager of the code generation of Riemann problem kernels of the form:

q_t + f(q)*q_x = 0, or q_t + A * q_x = 0

The conserved variable (q) and either the flux (f) or the jacobian (A) must be provided. See either demos/Riemann or Riemann.language for defining these variables.

Parameters (see help(Generator.parameter) for more details):

conserved
The conserved field passed to the generated kernel.
flux
The flux being solved.
A
The jacobian of the flux.
constant_fields
Constant fields used by generate passed via aux_{l,r}.
eig_method
Generation method for solving eigen decompostion of A.
evaluation
The evaluation type for single kernel.
jacobian_averaging
The method for averaging left and right values of a cell interface used in the kernel.
language
Language to generate.
A[source]

The jacobian of f(q) of the hyperbolic system q_t + f(q)*q_x = 0.

If f is provided but not A, then A will be generated.

conserved[source]

The conserved variable q of the hyperbolic system q_t + f(q)*q_x = 0.

constant_fields[source]

The conserved variable q of the hyperbolic system q_t + f(q)*q_x = 0.

eig_method[source]

The method for the generating the eigen decomposition of A.

Options:
“analytic” - Using symbolic expression generate the analytic values
of the eigenvalue decomposition. Throws SymbolicEigenvalueError if unable to formulate the analytic eigen decomposition
“numerical” - Generates a simple eigenvalue decomposition algorithm
in the generated kernel.
“auto” (default) - Tries symbolic generation but if it fails it a
simple numerical eigen solver will be generated.
evaluation[source]

The evaluation method of the generated kernel.

Options:
“pointwise” (default) - the kernel will expect a single point for
left and right values of a cell.
“vectorized” - the kernel will expect a vector of points for left
and right values of cells.
flux[source]

The flux f(q) of the hyperbolic system q_t + f(q)*q_x = 0.

generate()[source]

Returns the code for the kernel function.

info()[source]

Returns the parameters of the Riemann problem being generated.

jacobian_averaging[source]

The jacobian_averaging method of the generated kernel.

Options:
“arithmetic” (default) - Any evaluation over a cell interface
required by the jacobian will use an average of the left and right states.
“LR_eigs” - A left and right jacobian will be formed and the
eigen decomposition of each will operate on the appropriate plus or minus fluctuation (amdq or apdq).
language[source]

The language of the generated kernel.

Options:
“pyclaw” - Code generated to the Python interface of CLAWPACK.
used_constant_fields()[source]

Constant Fields used inside jacobian evaluation

used_constants()[source]

Constants used inside jacobian evaluation

write(filename=None)[source]

Prints the generated kernel function to filename.

If filename is None, the kernel is printed to stdout.

ignition.riemann.generator.generate(filename=None, **kws)[source]

Generates the kernel to file (or stdout if no filename given).

For required keywords (kws) please see help(Generator).

RiemannPrinter

Base classes for code printers

class ignition.riemann.riemann_printer.RiemannPrinter(generator)[source]

Base class for Riemann printer objects

PyClawPrinter

Definition of code printers for PyClaw

class ignition.riemann.pyclaw_printer.PyClawPrinter(generator)[source]

Printer for pyclaw pointwise evaluation.

class ignition.riemann.pyclaw_printer.VectorizedPyClawPrinter(generator)[source]

Printer for pyclaw vectorized evaluation.