KASKADE 7 development version
Loading...
Searching...
No Matches

Classes to define groups of variables. More...

Classes

struct  Kaskade::VariableDescription< spaceId, components, Id >
 A class storing elementary information about a single variable.This includes the number of components, the id and name of the variable, and the index of the associated FEFunctionSpace from which the variable comes. More...
struct  Kaskade::Variable< A, B >
 A class defining elementary information about a single variable. More...
class  Kaskade::VariableSet< VSDescriptions >
 A class for storing a heterogeneous collection of FunctionSpaceElement s. More...
class  Kaskade::VariableSetDescription< SpaceList, VariableList >
 A class that stores information about a set of variables. More...

Typedefs

template<class AnsatzVariables, class TestVariables>
using Kaskade::AllSystemBlocks
 A type list of all possible variable combinations of the ansatz and test variables provided.
template<class VariableSet, class Method>
using EvaluateVariables
 The type of evaluated variables as returned by evaluateVariables.
using Kaskade::ValueMethod = decltype(valueMethod)
 The type of the valueMethod helper functor.
using Kaskade::DerivativeMethod = decltype(derivativeMethod)
 The type of the derivativeMethod helper functor.

Functions

template<class Variables, class Functions, class Evaluators, class Method>
auto Kaskade::evaluateFunctions (Functions const &fs, Evaluators const &eval, Method const &method=Method())
 A function evaulating all functions in a variable set using the provided method.
template<class VariableSet, class Method>
auto Kaskade::evaluateVariables (VariableSet const &vars, typename VariableSet::Descriptions::Evaluators const &eval, Method const &method=Method())
 A function evaulating all functions in a variable set using the provided method.
template<class ... Spaces>
auto makeSpaceList (Spaces *... spaces)
 Creates a list of finite element spaces in the required format. Usage example (for Stokes flow):
template<class SpaceList, class VariableList>
VariableSetDescription< SpaceList, VariableList > makeVariableSetDescription (SpaceList const &spaces, VariableList const &vars)
 Creates a variable set description from given spaces and variables.

Variables

template<class VarSetDesc, int varIdx>
constexpr int spaceIndex = VarSetDesc::template spaceIndex<varIdx>
 The index of the finite element space of the variable with given index within the list of spaces.
constexpr auto valueMethod = [](auto const& f, auto const& eval) { return f.value(eval); }
 Helper method for evaluating whole variable sets.
constexpr auto derivativeMethod = [](auto const& f, auto const& eval) { return f.derivative(eval); }
 Helper method for evaluating whole variable sets.

Detailed Description

Classes to define groups of variables.

Defining variables and sets of variables

In a PDE system, several variables occur. In the Stokes equation, e.g., velocity and pressure. In optimal control, it is the state \( y \), the control \( u \) , and one or more multipliers, e.g., \( \lambda \). These variables can live in different spaces, or in the same. In optimal control of elliptic equations, it is usually \( y,\lambda \in H^1(\Omega) \) and \( u \in L^2(\Omega)\).

For setting up the PDE problem, we need to define which variables occur, and in which space each lives. First we define the spaces that are involved:

auto spaces = makeSpaceList(&h1Space,&l2Space);

Next we define the variables that occur, and tell which space they live in by indexing into the space list. Additionally, the number of components are required, and a name can be given:

auto variables = boost::fusion::make_vector( Variable<SpaceIndex<0>,Components<3>>("y"),
Variable<SpaceIndex<1>,Components<1>>("u"),
Variable<SpaceIndex<0>,Components<3>>("lambda"));

As a treat, you don't have to remember whether SpaceIndex or Components comes first - they can be switched.

And finally, both are tied together:

auto variableSetDescription = makeVariableSetDescription(spaceList,variables);

This variable set description tells the assembler how to treat the problem, and usually tells the problem definition the finite element spaces in which the variables live.

Accessing variables and associated spaces

At some point usually one needs the index or type of the space to which a variable in a variable set belongs. This is provided by spaceIndex and Space, respectively:

int spaceIdx = spaceIndex<VariableSetDescription,varIdx>;
using SpaceType = Space<VariableSetDescription,varIdx>;

In domain and boundary caches, all or some of the variables need to be evaluated from a sequence of evaluators, usually in the evaluateA method. This is provided by the value and derivative methods of the variable set:

auto u = vars.template value<uIdx>(evaluators);
auto du = vars.template derivative<uIdx>(evaluators);

Typedef Documentation

◆ AllSystemBlocks

template<class AnsatzVariables, class TestVariables>
using Kaskade::AllSystemBlocks
Initial value:
decltype(Variables_Detail::makeAllSystemBlocks(AnsatzVariables(),
TestVariables()))

A type list of all possible variable combinations of the ansatz and test variables provided.

Template Parameters
AnsatzVariablesa boost::fusion vector of VariableDescription<> types, as can be obtained from VariableSetDescriptions::Variables.
TestVariablesa boost::fusion vector of VariableDescription<> types, as can be obtained from VariableSetDescriptions::Variables.

This is a boost::fusion vector of std::pair<VariableDescription<>,VariableDescription> entries, the first entry referring to the test variable, the second to the ansatz variable.

Definition at line 996 of file variables.hh.

◆ DerivativeMethod

The type of the derivativeMethod helper functor.

Definition at line 1110 of file variables.hh.

◆ EvaluateVariables

template<class VariableSet, class Method>
using EvaluateVariables
Initial value:
decltype(evaluateVariables(std::declval<VariableSet>(),
std::declval<typename VariableSet::Descriptions::Evaluators>(),
std::declval<Method>()))

The type of evaluated variables as returned by evaluateVariables.

This is a boost::fusion sequence of functions' values resulting from evaluating all functions in a given variable set.

Template Parameters
VariableSetthe type of the variable set (i.e. VariableSet<...>)
Methoda polymorphic Functor type with call operator (Function const&, Evaluator const&) used for evaluating.

Definition at line 1077 of file variables.hh.

◆ ValueMethod

using Kaskade::ValueMethod = decltype(valueMethod)

The type of the valueMethod helper functor.

Definition at line 1104 of file variables.hh.

Function Documentation

◆ evaluateFunctions()

template<class Variables, class Functions, class Evaluators, class Method>
auto Kaskade::evaluateFunctions ( Functions const & fs,
Evaluators const & eval,
Method const & method = Method() )

A function evaulating all functions in a variable set using the provided method.

Template Parameters
Variablesa heterogeneous sequence of variable descriptions (defines the mapping of functions to evaluators)
Functionsa heterogeneous sequence of FE functions (or function views)
Evaluatorsthe heterogeneous container of evaluators for the variable set
Methoda polymorphic Functor type with call operator (Function const&, Evaluator const&)
Parameters
fsthe functions to be evaluated.
evalthe evaluators to be used for function evaluation
methodthe functor performing the actual evaluation

evaluateVariables valueMethod ValueMethod derivativeMethod DerivativeMethod

Definition at line 1019 of file variables.hh.

Referenced by evaluateVariables(), and Kaskade::GridIterateDetail::gridIterateRange().

◆ evaluateVariables()

template<class VariableSet, class Method>
auto Kaskade::evaluateVariables ( VariableSet const & vars,
typename VariableSet::Descriptions::Evaluators const & eval,
Method const & method = Method() )

A function evaulating all functions in a variable set using the provided method.

Template Parameters
VariableSetthe type of the variable set to be evaluated (i.e. VariableSet<...>)
Methoda polymorphic Functor type with call operator (Function const&, Evaluator const&)
Parameters
varsthe variable set to be evaluated.
evala heterogeneous sequence of evaluators to be used for function evaluation
methodthe functor performing the actual evaluation (usually valueMethod or derivativeMethod)
Returns
a boost::fusion::vector containing the results of variable evaluation
See also
EvaluateVariables, evaluateFunctions, valueMethod, ValueMethod, derivativeMethod, DerivativeMethod

Definition at line 1059 of file variables.hh.

Referenced by Kaskade::SemiImplicitEulerStep< PE >::DomainCache::evaluateAt().

◆ makeSpaceList()

template<class ... Spaces>
auto makeSpaceList ( Spaces *... spaces)
related

Creates a list of finite element spaces in the required format. Usage example (for Stokes flow):

auto spaces = makeSpaceList(&velocitySpace,&pressureSpace);
Spaces spaces
A heterogeneous sequence of pointers to (const) spaces involved.
Definition variables.hh:838
auto makeSpaceList(Spaces *... spaces)
Creates a list of finite element spaces in the required format. Usage example (for Stokes flow):
Definition variables.hh:923

This creates a boost::fusion vector of pointers to const spaces, as expected by VariableSetDescription.

Definition at line 923 of file variables.hh.

◆ makeVariableSetDescription()

template<class SpaceList, class VariableList>
VariableSetDescription< SpaceList, VariableList > makeVariableSetDescription ( SpaceList const & spaces,
VariableList const & vars )
related

Creates a variable set description from given spaces and variables.

Parameters
spacesa boost::fusion vector of pointers to the (const) spaces referenced by the variables
varsa boost::fusion sequence of Variable objects describing the variables in the set
auto variableSetDescription = makeVariableSetDescription(makeSpaceList(&velocitySpace,&pressureSpace),
boost::fusion::make_vector(Variable<SpaceIndex<0>,Components<2>>("u"),
VariableSetDescription< SpaceList, VariableList > makeVariableSetDescription(SpaceList const &spaces, VariableList const &vars)
Creates a variable set description from given spaces and variables.
Definition variables.hh:942
A class defining elementary information about a single variable.
Definition variables.hh:121
DEPRECATED, use components instead.
Definition variables.hh:714
DEPRECATED, use spaceIndex instead.
Definition variables.hh:738

Definition at line 942 of file variables.hh.

Variable Documentation

◆ derivativeMethod

auto derivativeMethod = [](auto const& f, auto const& eval) { return f.derivative(eval); }
constexpr

Helper method for evaluating whole variable sets.

Use this in calling evaluateVariables when evaluating the functions' derivatives.

Definition at line 1098 of file variables.hh.

◆ spaceIndex

template<class SpaceList, class VariableList>
template<int idx>
template<class VarSetDesc, int varIdx>
int spaceIndex = VarSetDesc::template spaceIndex<varIdx>
related

The index of the finite element space of the variable with given index within the list of spaces.

Definition at line 905 of file variables.hh.

◆ valueMethod

auto valueMethod = [](auto const& f, auto const& eval) { return f.value(eval); }
constexpr

Helper method for evaluating whole variable sets.

Use this in calling evaluateVariables when evaluating the functions' values.

Definition at line 1089 of file variables.hh.

Referenced by Kaskade::SemiImplicitEulerStep< PE >::DomainCache::evaluateAt(), and Kaskade::GridIterateDetail::gridIterateRange().