AMDiS  0.1 The Adaptive Multi-Dimensional Simulation Toolbox
ProblemStat< Traits > Class Template Reference

## Public Types

using GlobalBasis = typename Traits::GlobalBasis

using GridView = typename GlobalBasis::GridView

using Grid = AdaptiveGrid_t< typename GridView::Grid >

using Element = typename GridView::template Codim< 0 >::Entity

using WorldVector = typename Element::Geometry::GlobalCoordinate

using WorldMatrix = FieldMatrix< typename WorldVector::field_type, WorldVector::dimension, WorldVector::dimension >

using LinearSolver = LinearSolverInterface< Mat, Vec >

using SystemMatrix = BiLinearForm< GlobalBasis, GlobalBasis, typename Traits::CoefficientType, LinAlgTraits >

using SystemVector = LinearForm< GlobalBasis, typename Traits::CoefficientType, LinAlgTraits >

using SolutionVector = DOFVector< GlobalBasis, typename Traits::CoefficientType, LinAlgTraits >

## Public Member Functions

ProblemStat (std::string const &name)
Constructor. Takes the name of the problem that is used to access values corresponding to this problem in the parameter file.

template<class Grid_ >
ProblemStat (std::string const &name, Grid_ &&grid)

template<class Grid_ , class Basis_ , class B_ = Underlying_t<Basis_>, REQUIRES(Concepts::GlobalBasis< B_ >) >
ProblemStat (std::string const &name, Grid_ &&grid, Basis_ &&globalBasis)
Constructor taking a grid and basis. Wraps both in shared pointers.

template<class Grid_ , class PBF_ , class GV_ = typename Underlying_t<Grid_>::LeafGridView, REQUIRES(Concepts::PreBasisFactory< PBF_, GV_, MultiIndex_t< PBF_ >>) >
ProblemStat (std::string const &name, Grid_ &&grid, PBF_ const &preBasisFactory)
Constructor taking a grid and pre-basis factory to create a global basis on the fly.

Initialisation of the problem. More...

void restore (Flag initFlag)
Read the grid and solution from backup files and initialize the problem. More...

Implementation of StandardProblemIteration::oneIteration.

Implementation of ProblemStatBase::buildAfterCoarse.

Assemble the linear system by calling buildAfterAdapt with asmMatrix and asmVector set to true.

Implementation of ProblemStatBase::solve.

Implementation of ProblemStatBase::estimate.

Implementation of ProblemStatBase::refineMesh.

Implementation of ProblemStatBase::markElements.

Flag globalCoarsen (int n) override
Uniform global grid coarsening by up to n level.

Flag globalRefine (int n) override
Uniform global refinement by n level.

Writes output files. If force=true write even if timestep out of write rhythm.

std::string const & name () const override
Implementation of ProblemStatBase::name.

std::shared_ptr< Grid > grid ()
Return the grid_.

std::shared_ptr< Grid const > grid () const

GridView gridView () const
Return the gridView of the basis.

std::shared_ptr< BoundaryManager< Grid > > boundaryManager ()
Return the boundary manager to identify boundary segments.

std::shared_ptr< BoundaryManager< Grid > const > boundaryManager () const

std::shared_ptr< GlobalBasis > globalBasis ()
Return the globalBasis_.

std::shared_ptr< GlobalBasis const > globalBasis () const

std::shared_ptr< LinearSolversolver ()
Return a reference to the linear solver, linearSolver.

std::shared_ptr< LinearSolver const > solver () const

std::shared_ptr< SystemMatrixsystemMatrix ()
Returns a reference to system-matrix, systemMatrix_.

std::shared_ptr< SystemMatrix const > systemMatrix () const

std::shared_ptr< SolutionVectorsolutionVector ()
Returns a reference to the solution vector, solution_.

std::shared_ptr< SolutionVector const > solutionVector () const

std::shared_ptr< SystemVectorrhsVector ()
Return a reference to the rhs system-vector, rhs.

std::shared_ptr< SystemVector const > rhsVector () const

template<class... Indices>
auto solution (Indices... ii)
Return a mutable view to a solution component.

template<class... Indices>
auto solution (Indices... ii) const
Return a const view to a solution component.

template<class Solver_ >
void setSolver (Solver_ &&solver)
Set a new linear solver for the problem.

template<class Grid_ >
void setGrid (Grid_ &&grid)

template<class Marker_ >
Store the shared_ptr and the name of the marker in the problem. More...

void removeMarker (std::string name)
Remove a marker with the given name from the problem.

void removeMarker (Marker< Grid > const &marker)
Remove a marker from the problem.

template<class Operator , class RowTreePath = RootTreePath, class ColTreePath = RootTreePath>
void addMatrixOperator (Operator const &op, RowTreePath row={}, ColTreePath col={})
Add an operator to A. More...

template<class Operator , class RowTreePath = RootTreePath, class ColTreePath = RootTreePath>
void addMatrixOperator (BoundaryType b, Operator const &op, RowTreePath row={}, ColTreePath col={})
Operator evaluated on the boundary of the domain with boundary index b More...

template<class Operator , class TreePath = RootTreePath>
void addVectorOperator (Operator const &op, TreePath path={})
Add an operator to rhs. More...

template<class Operator , class TreePath = RootTreePath>
void addVectorOperator (BoundaryType b, Operator const &op, TreePath path={})
Operator evaluated on the boundary of the domain with boundary index b More...

template<class Predicate , class RowTreePath , class ColTreePath , class Values >
void addDirichletBC (Predicate const &predicate, RowTreePath row, ColTreePath col, Values const &values)
Add boundary conditions to the system. More...

template<class RowTreePath , class ColTreePath , class Values >
void addDirichletBC (BoundaryType id, RowTreePath row, ColTreePath col, Values const &values)

template<class Identifier , class Values >
void addDirichletBC (Identifier &&id, Values &&values)

void addPeriodicBC (BoundaryType id, WorldMatrix const &A, WorldVector const &b)

Public Member Functions inherited from StandardProblemIterationAdaptor< ProblemStat< Traits > >

Public Member Functions inherited from StandardProblemIteration
StandardProblemIteration (ProblemStatBase &prob)
constructor

Implementation of ProblemIterationIterface::beginIteration()

Implementation of ProblemIterationInterface::oneIteration()

Implementation of ProblemIterationInterface::endIteration()

std::string const & name () const override
Returns the name of the problem.

int numProblems () const override
Returns number of managed problems.

ProblemStatBaseproblem (int number=0) override
Return the managed ProblemStat problem, by number.

ProblemStatBaseproblem (std::string const &name) override
Return the managed ProblemStat problem, by name.

## Static Public Attributes

static constexpr int dim = Grid::dimension
Dimension of the grid.

static constexpr int dow = Grid::dimensionworld
Dimension of the world.

## Protected Member Functions

void createGlobalBasis ()

void createGrid ()

void createMatricesAndVectors ()

void createSolver ()

void createMarker ()

void createFileWriter ()

void adoptGlobalBasis (std::shared_ptr< GlobalBasis > globalBasis)

void adoptGrid (std::shared_ptr< Grid > const &grid, std::shared_ptr< BoundaryManager< Grid >> const &boundaryManager)

void adoptGrid (std::shared_ptr< Grid > const &grid)

void adoptGrid (std::shared_ptr< typename Grid::HostGrid > const &hostGrid)

Protected Member Functions inherited from StandardProblemIteration

## Friends

class ProblemInstat< Traits >

Protected Attributes inherited from StandardProblemIteration
ProblemStatBaseproblem_
The problem to solve.

## ◆ ProblemStat()

 ProblemStat ( std::string const & name, Grid_ && grid )
inline

Constructor taking additionally a grid that is used instead of the default created grid, ProblemStat

References ProblemStat< Traits >::grid(), and AMDiS::wrap_or_share().

## Member Function Documentation

 void addDirichletBC ( Predicate const & predicate, RowTreePath row, ColTreePath col, Values const & values )

Add boundary conditions to the system.

Dirichlet boundary condition Enforce Dirichlet boundary values for the solution vector on boundary regions identified by the predicate.

Parameters
 predicate Functor bool(WorldVector) returning true for all DOFs on the boundary that should be assigned a value. row TreePath identifying the sub-basis in the global basis tree corresponding to the row basis.
makeTreePath()
Parameters
 col TreePath identifying the sub-basis in the global basis tree corresponding to the column basis.
makeTreePath()
Parameters
 values Functor Range(WorldVector) or any GridFunction that is evaluated in the DOFs identified by the predicate.

Example:

prob.addDirichletBC([](auto const& x) { return x[0] < 1.e-8; }, 0, 0,
[](auto const& x) { return 0.0; });

Referenced by ProblemStat< Traits >::addVectorOperator(), and ProblemStat< Traits >::restore().

 void addMarker ( Marker_ && m )
inline

Store the shared_ptr and the name of the marker in the problem.

Note: multiple markers can be added but must have different names

References AMDiS::wrap_or_share().

 void addMatrixOperator ( Operator const & op, RowTreePath row = {}, ColTreePath col = {} )
inline

Operator evaluated on the whole element Adds an operator to the list of element operators to be assembled in quadrature points inside the element.

Parameters
 op A (pre-) local operator,
LocalOperator,
GridFunctionOperator
Parameters
 row TreePath identifying the sub-basis in the global basis tree corresponding to the row basis.
makeTreePath()
Parameters
 col TreePath identifying the sub-basis in the global basis tree corresponding to the column basis.
makeTreePath()

Example:

auto op = makeOperator(tag::test_trial{}, 1.0/tau);

 void addMatrixOperator ( BoundaryType b, Operator const & op, RowTreePath row = {}, ColTreePath col = {} )
inline

Operator evaluated on the boundary of the domain with boundary index b

Adds an operator to the list of boundary operators to be assembled in quadrature points on the boundary intersections.

Parameters
 b Boundary identifier where to assemble this operator. Can be constructed from an integer.
BoundaryType
Parameters
 op A (pre-) local operator,
LocalOperator,
GridFunctionOperator
Parameters
 row TreePath identifying the sub-basis in the global basis tree corresponding to the row basis.
makeTreePath()
Parameters
 col TreePath identifying the sub-basis in the global basis tree corresponding to the column basis.
makeTreePath()

Example:

auto op = makeOperator(tag::test_trial{}, alpha);

 void addPeriodicBC ( BoundaryType id, WorldMatrix const & A, WorldVector const & b )

Add a periodic boundary conditions to the system, by specifying a face transformation y = A*x + b of coordinates. We assume, that A is orthonormal.

References AMDiS::makeUniquePtr(), and ProblemStat< Traits >::solve().

 void addVectorOperator ( Operator const & op, TreePath path = {} )
inline

Operator evaluated on the whole element Adds an operator to the list of element operators to be assembled in quadrature points inside the element.

Parameters
 op A (pre-) local operator,
LocalOperator,
GridFunctionOperator
Parameters
 path TreePath identifying the sub-basis in the global basis tree corresponding to the row basis.
makeTreePath()

Example:

auto op = makeOperator(tag::test{}, probInstat.getOldSolution(0) / tau);

 void addVectorOperator ( BoundaryType b, Operator const & op, TreePath path = {} )
inline

Operator evaluated on the boundary of the domain with boundary index b

Adds an operator to the list of boundary operators to be assembled in quadrature points on the boundary intersections.

Parameters
 b Boundary identifier where to assemble this operator. Can be constructed from an integer.
BoundaryType
Parameters
 op A (pre-) local operator,
LocalOperator,
GridFunctionOperator
Parameters
 path TreePath identifying the sub-basis in the global basis tree corresponding to the row basis.
makeTreePath()

Example:

auto op = makeOperator(tag::test{}, [g](auto const& x) { return g(x); });

## ◆ initialize()

 void initialize ( Flag initFlag, Self * adoptProblem = nullptr, Flag adoptFlag = INIT_NOTHING )

Initialisation of the problem.

• [GRID_NAME]->global refinements: nr of initial global refinements

References Flag::isSet(), ProblemStat< Traits >::restore(), and AMDiS::test_exit().

Referenced by ProblemStat< Traits >::ProblemStat().

## ◆ restore()

 void restore ( Flag initFlag )

Read the grid and solution from backup files and initialize the problem.

Parameters read in restore() for problem with name 'PROB'

• [PROB]->restore->grid: name of the grid backup file
• [PROB]->restore->solution: name of the solution backup file

Referenced by ProblemStat< Traits >::initialize(), and ProblemStat< Traits >::ProblemStat().

## ◆ setGrid()

 void setGrid ( Grid_ && grid )
inline

Set the grid. Stores pointer and initializes feSpaces matrices and vectors, as well as markers and file-writers. If grid is given as reference, wrap it into a non-destroying shared_ptr

References ProblemStat< Traits >::grid(), and AMDiS::wrap_or_share().

The documentation for this class was generated from the following files: