josie.general.schemes.diffusive package

Submodules

josie.general.schemes.diffusive.central module

class josie.general.schemes.diffusive.central.CentralDifferenceGradient(problem)

Bases: josie.scheme.diffusive.DiffusiveScheme

The gradient term in the diffusive term is approximated as a simple directional derivative using node values of the cells and their corresponding neighbour

\gradient{\pdeState} \cdot \pdeNormal =
\frac{\pdeState_R - \pdeState_L}{\Delta x}

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

post_init(cells)

Initialize the datastructure holding the norm of the relative vector between cells and their neighbours

\delta x = \norm{\vb{r_R} - \vb{r_L}}

josie.general.schemes.diffusive.lstsq module

class josie.general.schemes.diffusive.lstsq.LeastSquareGradient(problem)

Bases: josie.scheme.diffusive.DiffusiveScheme

The gradient term in the diffusive term is approximated as a least square approximation over all the neighbours of the mesh cells

Given a neighbour cell N and a generic cell C, the value of a generic field \phi_N can be approximated as:

\phi_N = \phi_C + \nabla \phi_C \cdot \qty(\vb{r}_N - \vb{r}_C)

So we can optimize a cost function

G_C = \sum_\text{neigh} \phi_C + \nabla \phi_C \cdot \qty(\vb{r}_N -
    \vb{r}_C) - \phi_N

to obtain the value of the gradient in the cell \nabla \phi_C

post_init(cells)

Initialize the datastructure holding the matrix used to solve the Least Square problem and also the RHS of the linear system

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

Module contents