#include <ExplicitVectorOperators_fwd.hpp>
A class for evaluating typical operators needed in spatial discretization.
This class represents vector differential operators, discretely approximated with shape functions that are stored in given shape storage. These shape functions are used to construct approximations of common operators such as gradient, Laplacian, divergence, ... that can be applied to vector fields at given points.
3d
complex-valued field over 2d domain with double
shapes: the result is a 3x2
complex matrix.shape_storage_type | Storage class for shapes. Must satisfy the Shape storage concept. |
Usage example:
Definition at line 38 of file ExplicitVectorOperators_fwd.hpp.
Public Member Functions | |
ExplicitVectorOperators () | |
Construct empty explicit vector operators. More... | |
ExplicitVectorOperators (const shape_storage_t &ss) | |
Construct explicit vector operators over given shape storage. More... | |
void | setShapes (const shape_storage_t &shape_storage_) |
Sets a new shape storage from which this operators are generated. More... | |
bool | hasShapes () const |
Returns true if operators have a non-null pointer to storage and false otherwise. More... | |
template<class vector_field_t > | |
vector_type< vector_field_t >::type | lap (const vector_field_t &u, int node) const |
Returns Laplacian of vector field u in node with index node . More... | |
template<typename op_family_t , typename vector_field_t > | |
vector_type< vector_field_t >::type | apply (const vector_field_t &u, int node, typename op_family_t::operator_t o) const |
Returns an approximation of applying the requested operator to each component of field u at node node . More... | |
template<typename op_family_t , typename vector_field_t > | |
vector_type< vector_field_t >::type | apply (const vector_field_t &u, int node) const |
Overload for default constructible operator. More... | |
template<class vector_field_t > | |
Eigen::Matrix< typename vector_type< vector_field_t >::type::scalar_t, vector_type< vector_field_t >::type::dim, dim > | grad (const vector_field_t &u, int node) const |
Returns gradient of vector field u in node with index node . More... | |
template<class vector_field_t > | |
vector_type< vector_field_t >::type::scalar_t | div (const vector_field_t &u, int node) const |
Returns divergence of a vector field u in in node with index node . More... | |
template<class vector_field_t > | |
vector_type< vector_field_t >::type | curl (const vector_field_t &u, int node) const |
Returns curl of a vector field u in node with index node . More... | |
template<class vector_field_t > | |
vector_type< vector_field_t >::type | graddiv (const vector_field_t &u, int node) const |
Returns gradient of divergence of a vector field u in in node with index node . More... | |
template<class vector_field_t > | |
vector_type< vector_field_t >::type | neumann (const vector_field_t &u, int node, const vector_t &normal, typename vector_type< vector_field_t >::type val) const |
This is a vectorised version of ExplicitOperators::neumann. More... | |
Public Types | |
enum | { dim = shape_storage_t::dim } |
Store dimension of the domain. More... | |
typedef shape_storage_type | shape_storage_t |
Type of shape storage. More... | |
typedef shape_storage_t::vector_t | vector_t |
Vector type. More... | |
typedef shape_storage_t::scalar_t | scalar_t |
Scalar type. More... | |
Friends | |
template<typename S > | |
std::ostream & | operator<< (std::ostream &os, const ExplicitVectorOperators< S > &op) |
Output basic info about given operators. More... | |
Private Attributes | |
const shape_storage_t * | ss |
Pointer to shape storage, but name is shortened for readability. More... | |
anonymous enum |
Store dimension of the domain.
Enumerator | |
---|---|
dim | Dimensionality of the function domain. |
Definition at line 44 of file ExplicitVectorOperators_fwd.hpp.
|
inline |
Construct empty explicit vector operators.
Definition at line 52 of file ExplicitVectorOperators_fwd.hpp.
|
inlineexplicit |
Construct explicit vector operators over given shape storage.
The pointer to given storage is stored as a non-owning pointer. It is the user's responsibility that given storage is valid throughout the use use of this class.
This class is usually constructed directly from shape storage using the explicitVectorOperators()
member function.
Definition at line 61 of file ExplicitVectorOperators_fwd.hpp.
|
inline |
Overload for default constructible operator.
Definition at line 110 of file ExplicitVectorOperators_fwd.hpp.
vector_type<vector_field_t>::type mm::ExplicitVectorOperators< shape_storage_type >::apply | ( | const vector_field_t & | u, |
int | node, | ||
typename op_family_t::operator_t | o | ||
) | const |
Returns an approximation of applying the requested operator to each component of field u
at node node
.
u | Field to which the operator is applied. |
node | Node at which the derived field is evaluated. |
o | The operator to apply. |
op_family_t
type. The first weights computed for family of type op_family_t
are used.Usage example:
vector_type<vector_field_t>::type mm::ExplicitVectorOperators< shape_storage_type >::curl | ( | const vector_field_t & | u, |
int | node | ||
) | const |
Returns curl of a vector field u
in node with index node
.
u
, where dim = 3
and \(\vec{u} = [u, v, w]\). The return value is \( \curl \vec{u} = \[\dpar{w}{y} - \dpar{v}{z}, \dpar{u}{z} - \dpar{w}{x}, \dpar{v}{x} - \dpar{u}{y}\] \) evaluated in point with index node
, where derivatives are approximated using shape functions from ss. Static-assertion | fails if u is not three dimensional. |
vector_type<vector_field_t>::type::scalar_t mm::ExplicitVectorOperators< shape_storage_type >::div | ( | const vector_field_t & | u, |
int | node | ||
) | const |
Returns divergence of a vector field u
in in node with index node
.
u
, e.g. when dim = 3
and \(\vec{u} = [u, v, w]\), the returned value is \( \nabla\cdot \vec{u} = \dpar{u}{x} + \dpar{v}{y} + \dpar{w}{z} \) evaluated in point with index node
, where derivatives are approximated using shape functions from ss. Static-assertion | fails if the dimension of u is not equal to domain dimension. |
Eigen::Matrix<typename vector_type<vector_field_t>::type::scalar_t, vector_type<vector_field_t>::type::dim, dim> mm::ExplicitVectorOperators< shape_storage_type >::grad | ( | const vector_field_t & | u, |
int | node | ||
) | const |
Returns gradient of vector field u
in node with index node
.
The field u
and the domain can have different dimensions.
u
, e.g. when dim(u) = 3
and and \(\vec{u} = [u, v, w]\) and the domain dimension is 2, the returned value is \[ \nabla \vec{u} = \begin{bmatrix} \dpar{u}{x}, \dpar{u}{y} \\ \dpar{v}{x}, \dpar{v}{y} \\ \dpar{w}{x}, \dpar{w}{y} \end{bmatrix} \]
evaluated in point with indexnode
, where derivatives are approximated using shape functions from ss. vector_type<vector_field_t>::type mm::ExplicitVectorOperators< shape_storage_type >::graddiv | ( | const vector_field_t & | u, |
int | node | ||
) | const |
Returns gradient of divergence of a vector field u
in in node with index node
.
u
, e.g. when dim = 3
and \(\vec{u} = [u, v, w]\), the returned value is \[ \nabla(\nabla\cdot \vec{u}) = \begin{bmatrix} \dpar{^2u}{x^2} + \dpar{^2v}{x\partial y} + \dpar{^2w}{x\partial z} \\ \dpar{^2u}{x\partial y} + \dpar{^2v}{^2y} + \dpar{^2w}{y\partial z} \\ \dpar{^2u}{x\partial z} + \dpar{^2v}{y\partial z} + \dpar{^2w}{^2z} \end{bmatrix} \]
evaluated in point with indexnode
, where derivatives are approximated using shape functions from ss. Static-assertion | fails if the dimension of u is not equal to domain dimension. |
|
inline |
Returns true
if operators have a non-null pointer to storage and false
otherwise.
Definition at line 72 of file ExplicitVectorOperators_fwd.hpp.
|
inline |
Returns Laplacian of vector field u
in node with index node
.
u
, e.g. when dim = 3
and \(\vec{u} = [u, v, w]\), the returned value is \( \nabla^2 \vec{u} = [ \dpar{^2 u}{x^2} + \dpar{^2 u}{y^2} + \dpar{^2 u}{z^2}, \dpar{^2 v}{x^2} + \dpar{^2 v}{y^2} + \dpar{^2 v}{z^2}, \dpar{^2 w}{x^2} + \dpar{^2 w}{y^2} + \dpar{^2 w}{z^2} ]^T\) evaluated in point with index node
where derivatives are approximated using shape functions from ss. Static-assertion | fails if the dimension of u is not equal to domain dimension. |
Definition at line 87 of file ExplicitVectorOperators_fwd.hpp.
vector_type<vector_field_t>::type mm::ExplicitVectorOperators< shape_storage_type >::neumann | ( | const vector_field_t & | u, |
int | node, | ||
const vector_t & | normal, | ||
typename vector_type< vector_field_t >::type | val | ||
) | const |
This is a vectorised version of ExplicitOperators::neumann.
Calculates a new field value a
for u
at node
, such that the Neumann boundary condition du/dn(node) = val
holds. Denote given index node
by \(i\) and val
by \(\vec v\). The function returns such \(\vec a\), that by setting \( \vec{u}(i) = \vec{a}\) we satisfy the condition \( \dpar{\vec u}{\vec n}(i) = \vec v\). This is done using the following formula:
\[ \vec{a} = \frac{ \vec{v} - \sum\limits_{i=1}^{s} \sum\limits_{d=1}^{dim} n_d \chi_{\dpar{}{ x_d}}(i)\ \vec{u}(i) }{\sum\limits_{d=1}^{dim} n_d \chi_{\dpar{}{ x_d}}(0)}, \]
where \(\chi_{\dpar{}{ x_d}}\) represents the formula for the shape function of first derivative wrt. \(d\).
u | Scalar field to evaluate. |
node | Index of the node, whose value should be changed to satisfy the boundary condition. |
normal | Vector \(\vec{n}\) with the same dimensionality as the problem domain giving the direction of the derivation. Usually the unit normal vector. |
val | The value that \(\dpar{ \vec u}{ \vec n}\) should be equal to. |
Assertion | fails if node 's first support node is not node . |
Assertion | fails if node 's value has negligible effect on the derivation, because no value could change the value of \(\dpar{\vec u}{\vec n}\). |
Static-assertion | fails if the dimension of u is not equal to domain dimension. |
|
inline |
Sets a new shape storage from which this operators are generated.
As in the constructor, the pointer to given storage is stored as a non-owning pointer. It is the user's responsibility that given storage is valid throughout the use use of this class.
shape_storage_ | New shape storage. |
Definition at line 69 of file ExplicitVectorOperators_fwd.hpp.
|
friend |
Output basic info about given operators.
Definition at line 151 of file ExplicitVectorOperators.hpp.
|
private |
Pointer to shape storage, but name is shortened for readability.
Definition at line 48 of file ExplicitVectorOperators_fwd.hpp.