|
Saddle-Point
|
Analytic right-hand-side function for the saddle-point Laplace problem. More...
#include <rhs_function.h>


Public Types | |
| enum | FunctionType { TYPE_X_Y , TYPE_EXP_COS , TYPE_ZERO , TYPE_SIN_SIN , TYPE_R_COS } |
| Selector for the analytic right-hand-side expression to use. More... | |
Public Member Functions | |
| RHSFunction (FunctionType type) | |
| Construct a single-component RHSFunction of the requested type. | |
| virtual double | value (const Point< dim > &p, const unsigned int component=0) const override |
Evaluate the analytic right-hand side at point p. | |
| virtual Tensor< 1, dim > | gradient (const Point< dim > &p, const unsigned int component=0) const override |
Evaluate the analytic gradient at point p. | |
Analytic right-hand-side function for the saddle-point Laplace problem.
This class is derived from the abstract base class dealii::Function<dim>, which declares the common interface that all "functions of position" have to follow in deal.II. The virtual keyword on the base methods means that the function there can be overridden by derived classes; the override keyword means that we know the function has been declared as part of the base class, so the compiler can verify the signature.
The actual analytic expression is selected at construction time through the FunctionType enum. Several test cases were used during development:
| dim | Spatial dimension (the implementation assumes dim == 2). |
| enum RHSFunction::FunctionType |
Selector for the analytic right-hand-side expression to use.
| Enumerator | |
|---|---|
| TYPE_X_Y | \(f(x,y) = -10\,x\,y\). |
| TYPE_EXP_COS | Reserved for an \(e^x\cos y\) variant (not currently implemented in value()). |
| TYPE_ZERO | The zero function \(f \equiv 0\). |
| TYPE_SIN_SIN | \(f(x,y) = 2\sin(x)\sin(y)\). |
| TYPE_R_COS | Polar test case \((r - 1/r - 1/(r R^2))\cos(\theta/R)\). |
|
inline |
Construct a single-component RHSFunction of the requested type.
| [in] | type | One of FunctionType, selects which analytic expression value() and gradient() will return. |
|
overridevirtual |
Evaluate the analytic gradient at point p.
Returns the analytic gradient of the function selected by FunctionType. For TYPE_SIN_SIN the formula uses the \(\pi\)-scaled variant in the source code; see the inline definition below for the exact expressions.
| [in] | p | Point at which to evaluate the gradient. |
| [in] | component | Component index (unused; the class is scalar). |
p.
|
overridevirtual |
Evaluate the analytic right-hand side at point p.
The actual formula returned depends on the FunctionType passed to the constructor. See the class description for the analytic expressions.
| [in] | p | Point at which to evaluate the function. |
| [in] | component | Component index (unused; the class is scalar). |
p.