josie.scheme package

Submodules

josie.scheme.convective module

class josie.scheme.convective.ConvectiveScheme(problem)

Bases: josie.scheme.scheme.Scheme

A mixin that provides the scheme implementation for the convective term

\numConvectiveFull

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:

\pdeFull

The convective term is discretized as follows:

\numConvectiveFull

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 \numConvective

Parameters
  • cells (MeshCellSet) – A MeshCellSet containing the state of the mesh cells

  • neighs (NeighboursCellSet) – A NeighboursCellSet containing data of neighbour cells corresponding to the values

Returns

The value of the numerical convective flux multiplied by the surface value \numConvective

Return type

F

accumulate(cells, neighs, t)

This method implements the accumulation of all fluxes between each cell and its neighbour.

Potentially if the problem is a full problem featuring all the terms, this method accumulates the terms

\numSpaceTerms

Parameters
  • cells (MeshCellSet) – A MeshCellSet containing the state of the mesh cells

  • neighs (NeighboursCellSet) – A NeighboursCellSet containing data of neighbour cells corresponding to the cells

  • t (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.Scheme

A mixin that provides the scheme interface for the diffusive term. The DiffusiveScheme needs 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

\dd{t} = C_{fl} \dd{x}^2 / 2

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:

\pdeFull

The diffusive term is discretized as follows:

\numDiffusiveFull

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 \numDiffusive

Parameters
  • values – The values of the state fields in each cell

  • neighs (NeighboursCellSet) – A NeighboursCellSet containing data of neighbour cells corresponding to the values

Returns

The value of the numerical diffusive flux multiplied by the surface value \numDiffusive

Return type

D

accumulate(cells, neighs, t)

This method implements the accumulation of all fluxes between each cell and its neighbour.

Potentially if the problem is a full problem featuring all the terms, this method accumulates the terms

\numSpaceTerms

Parameters
  • cells (MeshCellSet) – A MeshCellSet containing the state of the mesh cells

  • neighs (NeighboursCellSet) – A NeighboursCellSet containing data of neighbour cells corresponding to the cells

  • t (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.Scheme

A 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:

\pdeFull

The non-conservative term is discretized as follows:

\numNonConservativeFull

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 \numNonConservative

Parameters
  • values – The values of the state fields in each cell

  • neighs (NeighboursCellSet) – A NeighboursCellSet containing data of neighbour cells corresponding to the values

Returns

The value of the numerical nonconservative flux multiplied by the surface value \numNonConservative

Return type

G

accumulate(cells, neighs, t)

This method implements the accumulation of all fluxes between each cell and its neighbour.

Potentially if the problem is a full problem featuring all the terms, this method accumulates the terms

\numSpaceTerms

Parameters
  • cells (MeshCellSet) – A MeshCellSet containing the state of the mesh cells

  • neighs (NeighboursCellSet) – A NeighboursCellSet containing data of neighbour cells corresponding to the cells

  • t (float) – The time instant at which to compute time-dependent terms

josie.scheme.scheme module

class josie.scheme.scheme.Scheme(problem)

Bases: abc.ABC

An abstract class representing a scheme to be used during a simulation.

A general problem can be written in a compact way:

\pdeFull

A concrete instance of this class needs to implement discretization strategies for the terms that are present in a specific Problem within a Finite Volume discretization method

  • \numConvectiveFull

  • \numNonConservativeFull

  • \numDiffusiveFull

  • \numSourceFull

Together with the time update scheme to solve:

\numTime

problem

An instance of Problem representing 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 MeshCellSet containing the cell data at the current time step

  • CFL_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 problem is a full problem featuring all the terms, this method accumulates the terms

\numSpaceTerms

Parameters
  • cells (MeshCellSet) – A MeshCellSet containing the state of the mesh cells

  • neighs (NeighboursCellSet) – A NeighboursCellSet containing data of neighbour cells corresponding to the cells

  • t (float) – The time instant at which to compute time-dependent terms

post_init(cells)

Scheme can implement a post_init() in order to perform operations after the Solver.init() initialize the solver state

Can be used to store additional data, for example, to compute the CFL in an optimized way

Parameters

cells (MeshCellSet) – A MeshCellSet containing the state of the mesh cells

post_step(cells)

Scheme can implement a post-step hook that is executed by the solver after the update step. It can be needed, for example, to apply an EOS

cells

A MeshCellSet containing 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 MeshCellSet containing the state of the mesh cells

  • t (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 MeshCellSet containing 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 TimeScheme in order to implement multi-step accumulation

Parameters
  • mesh (Mesh) – A Mesh containing the state of the mesh

  • dt (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 the Mesh object in-place.

\numTimeFull

Parameters
  • mesh (Mesh) – A Mesh containing the state of the mesh at the given time step

  • dt (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.Scheme

A mixin that provides the scheme implementation for the source term

\numSourceFull

accumulate(cells, neighs, t)

This method implements the accumulation of all fluxes between each cell and its neighbour.

Potentially if the problem is a full problem featuring all the terms, this method accumulates the terms

\numSpaceTerms

Parameters
  • cells (MeshCellSet) – A MeshCellSet containing the state of the mesh cells

  • neighs (NeighboursCellSet) – A NeighboursCellSet containing data of neighbour cells corresponding to the cells

  • t (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:

\pdeFull

The source term is discretized as follows:

\numSourceFull

Parameters
  • cells (MeshCellSet) – A MeshCellSet containing the state of the mesh cells

  • neighs (NeighboursCellSet) – A NeighboursCellSet containing data of neighbour cells corresponding to the values

  • t (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.Scheme

A mixin that provides the scheme implementation for the time derivative

\numTime

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 TimeScheme in order to implement multi-step accumulation

Parameters
  • mesh (Mesh) – A Mesh containing the state of the mesh

  • dt (float) – Time step

  • t (float) – The current time instant of the simulation

time_order: float

Module contents