KASKADE 7 development version
Classes | Typedefs | Functions | Variables

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, C >
 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 VariableSet , class Method >
using EvaluateVariables = decltype(evaluateVariables(std::declval< VariableSet >(), std::declval< typename VariableSet::Descriptions::Evaluators >(), std::declval< Method >()))
 The type of evaluated variables as returned by evaluateVariables. More...
 
using Kaskade::ValueMethod = decltype(valueMethod)
 The type of the valueMethod helper functor. More...
 
using Kaskade::DerivativeMethod = decltype(derivativeMethod)
 The type of the derivativeMethod helper functor. More...
 

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. More...
 
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. More...
 
template<class ... Spaces>
auto makeSpaceList (Spaces *... spaces)
 Creates a list of finite element spaces in the required format. Usage example (for Stokes flow): More...
 
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. More...
 

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. More...
 
constexpr auto valueMethod = [](auto const& f, auto const& eval) { return f.value(eval); }
 Helper method for evaluating whole variable sets. More...
 
constexpr auto derivativeMethod = [](auto const& f, auto const& eval) { return f.derivative(eval); }
 Helper method for evaluating whole variable sets. More...
 

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);
auto makeSpaceList(Spaces *... spaces)
Creates a list of finite element spaces in the required format. Usage example (for Stokes flow):
Definition: variables.hh:892

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);
VariableSetDescription< SpaceList, VariableList > makeVariableSetDescription(SpaceList const &spaces, VariableList const &vars)
Creates a variable set description from given spaces and variables.
Definition: variables.hh:911

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

◆ DerivativeMethod

using Kaskade::DerivativeMethod = typedef decltype(derivativeMethod)

The type of the derivativeMethod helper functor.

Definition at line 1039 of file variables.hh.

◆ EvaluateVariables

template<class VariableSet , class Method >
using EvaluateVariables = 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 1006 of file variables.hh.

◆ ValueMethod

using Kaskade::ValueMethod = typedef decltype(valueMethod)

The type of the valueMethod helper functor.

Definition at line 1033 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 948 of file variables.hh.

◆ 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 988 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:807

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

Definition at line 892 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"),
A class defining elementary information about a single variable.
Definition: variables.hh:128
DEPRECATED, use components instead.
Definition: variables.hh:696
DEPRECATED, use spaceIndex instead.
Definition: variables.hh:720

Definition at line 911 of file variables.hh.

Variable Documentation

◆ derivativeMethod

constexpr 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 1027 of file variables.hh.

◆ spaceIndex

template<class SpaceList , class VariableList >
template<int idx>
template<class VarSetDesc , int varIdx>
constexpr 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 874 of file variables.hh.

◆ valueMethod

constexpr 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 1018 of file variables.hh.

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