josie.scheme package¶
Submodules¶
josie.scheme.convective module¶
- class josie.scheme.convective.ConvectiveScheme(problem)¶
Bases:
josie.scheme.scheme.SchemeA mixin that provides the scheme implementation for the convective term
- abstract F(cells, neighs)¶
This is the convective flux implementation of the scheme. See [Tor09] for a great overview on numerical methods for hyperbolic problems.
A general problem can be written in a compact way:
The convective term is discretized as follows:
A concrete implementation of this method needs to implement the discretization of the numerical flux on one face of a cell. It needs to implement the term
- Parameters
cells (MeshCellSet) – A
MeshCellSetcontaining the state of the mesh cellsneighs (NeighboursCellSet) – A
NeighboursCellSetcontaining data of neighbour cells corresponding to thevalues
- Returns
The value of the numerical convective flux multiplied by the surface value
- Return type
F
- accumulate(cells, neighs, t)¶
This method implements the accumulation of all fluxes between each cell and its neighbour.
Potentially if the
problemis a full problem featuring all the terms, this method accumulates the terms- Parameters
cells (MeshCellSet) – A
MeshCellSetcontaining the state of the mesh cellsneighs (NeighboursCellSet) – A
NeighboursCellSetcontaining data of neighbour cells corresponding to thecellst (float) – The time instant at which to compute time-dependent terms
josie.scheme.diffusive module¶
- class josie.scheme.diffusive.DiffusiveScheme(problem)¶
Bases:
josie.scheme.scheme.SchemeA mixin that provides the scheme interface for the diffusive term. The
DiffusiveSchemeneeds to implement a strategy to approximate the state gradient at the cell interface with its neighbour- CFL(cells, CFL_value)¶
Definition of CFL for a parabolic problem
- Return type
float
- D(cells, neighs)¶
This is the diffusive flux implementation of the scheme. See [Tor09] for a great overview on numerical methods for hyperbolic problems.
A general problem can be written in a compact way:
The diffusive term is discretized as follows:
A concrete implementation of this method needs to implement the discretization of the numerical diffusive flux on one face of a cell. It needs to implement the term
- Parameters
values – The values of the state fields in each cell
neighs (
NeighboursCellSet) – ANeighboursCellSetcontaining data of neighbour cells corresponding to thevalues
- Returns
The value of the numerical diffusive flux multiplied by the surface value
- Return type
D
- accumulate(cells, neighs, t)¶
This method implements the accumulation of all fluxes between each cell and its neighbour.
Potentially if the
problemis a full problem featuring all the terms, this method accumulates the terms- Parameters
cells (
MeshCellSet) – AMeshCellSetcontaining the state of the mesh cellsneighs (
NeighboursCellSet) – ANeighboursCellSetcontaining data of neighbour cells corresponding to thecellst (
float) – The time instant at which to compute time-dependent terms
josie.scheme.nonconservative module¶
- class josie.scheme.nonconservative.NonConservativeScheme(problem)¶
Bases:
josie.scheme.scheme.SchemeA mixin that provides the scheme implementation for the non conservative term
- abstract G(cells, neighs)¶
This is the non-conservative flux implementation of the scheme. See [Tor09] for a great overview on numerical methods for hyperbolic problems.
A general problem can be written in a compact way:
The non-conservative term is discretized as follows:
A concrete instance of this class needs to implement the discretization of the numerical flux on one face of a cell. It needs to implement the term
- Parameters
values – The values of the state fields in each cell
neighs (
NeighboursCellSet) – ANeighboursCellSetcontaining data of neighbour cells corresponding to thevalues
- Returns
The value of the numerical nonconservative flux multiplied by the surface value
- Return type
G
- accumulate(cells, neighs, t)¶
This method implements the accumulation of all fluxes between each cell and its neighbour.
Potentially if the
problemis a full problem featuring all the terms, this method accumulates the terms- Parameters
cells (
MeshCellSet) – AMeshCellSetcontaining the state of the mesh cellsneighs (
NeighboursCellSet) – ANeighboursCellSetcontaining data of neighbour cells corresponding to thecellst (
float) – The time instant at which to compute time-dependent terms
josie.scheme.scheme module¶
- class josie.scheme.scheme.Scheme(problem)¶
Bases:
abc.ABCAn abstract class representing a scheme to be used during a simulation.
A general problem can be written in a compact way:
A concrete instance of this class needs to implement discretization strategies for the terms that are present in a specific
Problemwithin a Finite Volume discretization methodTogether with the time update scheme to solve:
- problem¶
An instance of
Problemrepresenting the physical problem that this scheme discretizes
- abstract CFL(cells, CFL_value)¶
This method returns the optimal dt value that fulfills the CFL condition for the concrete the given scheme
- Parameters
cells (MeshCellSet) – A
MeshCellSetcontaining the cell data at the current time stepCFL_value (float) – The value of the CFL coefficient to impose
- Returns
The Optimal dt fulfilling the CFL condition for the given CFL number
- Return type
dt
- abstract accumulate(cells, neighs, t)¶
This method implements the accumulation of all fluxes between each cell and its neighbour.
Potentially if the
problemis a full problem featuring all the terms, this method accumulates the terms- Parameters
cells (MeshCellSet) – A
MeshCellSetcontaining the state of the mesh cellsneighs (NeighboursCellSet) – A
NeighboursCellSetcontaining data of neighbour cells corresponding to thecellst (float) – The time instant at which to compute time-dependent terms
- post_init(cells)¶
Schemecan implement apost_init()in order to perform operations after theSolver.init()initialize the solver stateCan be used to store additional data, for example, to compute the CFL in an optimized way
- Parameters
cells (MeshCellSet) – A
MeshCellSetcontaining the state of the mesh cells
- post_step(cells)¶
Schemecan implement a post-step hook that is executed by the solver after the update step. It can be needed, for example, to apply anEOS- cells¶
A
MeshCellSetcontaining the state of the mesh cells
- pre_accumulate(cells, t)¶
” Hook that can be used to do stuff before the accumulation around all the cell faces.
It can be used for exemple to implement schemes that just need the information on the cell and not its neighbours or to compute the gradient accessing all the neighbours are the same moment as done in
LeastSquareGradient- Parameters
cells (MeshCellSet) – A
MeshCellSetcontaining the state of the mesh cellst (float) – Time instant
- pre_step(cells)¶
Hook called just before the fluxes accumulation.
It’s used by default to reset the fluxes array to zeros. It can be extended to do reset other
Scheme-specific data containers- Parameters
cells (MeshCellSet) – A
MeshCellSetcontaining the state of the mesh cells
- abstract step(mesh, dt, t)¶
This method implements the accumulation over all the neighbours of a specific cell of the numerical fluxes. It can be overridden by, for example, a
TimeSchemein order to implement multi-step accumulation- Parameters
mesh (Mesh) – A
Meshcontaining the state of the meshdt (float) – Time step
t (float) – The current time instant of the simulation
- update(mesh, dt, t)¶
This method implements the time step update. It accumulates all the numerical fluxes using the
Scheme.step()method (possibly in multiple steps for high-order time schemes). It modifies theMeshobject in-place.- Parameters
mesh (Mesh) – A
Meshcontaining the state of the mesh at the given time stepdt (float) – Time step
t (float) – The current time instant of the simulation
josie.scheme.source module¶
- class josie.scheme.source.SourceScheme(problem)¶
Bases:
josie.scheme.scheme.SchemeA mixin that provides the scheme implementation for the source term
- accumulate(cells, neighs, t)¶
This method implements the accumulation of all fluxes between each cell and its neighbour.
Potentially if the
problemis a full problem featuring all the terms, this method accumulates the terms- Parameters
cells (MeshCellSet) – A
MeshCellSetcontaining the state of the mesh cellsneighs (NeighboursCellSet) – A
NeighboursCellSetcontaining data of neighbour cells corresponding to thecellst (float) – The time instant at which to compute time-dependent terms
- abstract s(cells, neighs, t)¶
This is the source term implementation of the scheme. See [Tor09] for a great overview on numerical methods for hyperbolic problems.
A general problem can be written in a compact way:
The source term is discretized as follows:
- Parameters
cells (MeshCellSet) – A
MeshCellSetcontaining the state of the mesh cellsneighs (NeighboursCellSet) – A
NeighboursCellSetcontaining data of neighbour cells corresponding to thevaluest (float) – Time instant
- Returns
The value of the source term approximated in the cell
- Return type
s
josie.scheme.time module¶
- class josie.scheme.time.TimeScheme(problem, *args, **kwargs)¶
Bases:
josie.scheme.scheme.SchemeA mixin that provides the scheme implementation for the time derivative
- order¶
The supposed order for the scheme. Useful for exemple when testing.
- abstract step(mesh, dt, t)¶
This method implements the accumulation over all the neighbours of a specific cell of the numerical fluxes. It can be overridden by, for example, a
TimeSchemein order to implement multi-step accumulation- Parameters
mesh (
Mesh) – AMeshcontaining the state of the meshdt (
float) – Time stept (
float) – The current time instant of the simulation
- time_order: float¶