Saddle-Point
Loading...
Searching...
No Matches
Solution< dim, n_equations > Class Template Reference

Vector-valued manufactured solution used by the saddle-point program. More...

Inheritance diagram for Solution< dim, n_equations >:
Collaboration diagram for Solution< dim, n_equations >:

Public Member Functions

 Solution ()
 Construct a Solution with n_equations components.
 
virtual void vector_value (const Point< dim > &p, Vector< double > &values) const override
 Evaluate the manufactured solution at a single point.
 
virtual void vector_gradient (const Point< dim > &p, std::vector< Tensor< 1, dim, double > > &gradients) const override
 Evaluate the gradient of every component at a single point.
 

Detailed Description

template<int dim, int n_equations>
class Solution< dim, n_equations >

Vector-valued manufactured solution used by the saddle-point program.

The Solution class provides a closed-form expression for both components \((p,u)\) of the manufactured solution that the numerical scheme is supposed to recover. It is used in three different places inside the program:

  1. as the Dirichlet boundary data inside SaddlePointProblem::setup_system (so that the discrete solution interpolates the manufactured values on \(\partial\Omega\)),
  2. inside SaddlePointProblem::compute_error to evaluate the \(L^2\) and \(H^1\) errors of the numerical solution against the manufactured one, and
  3. inside SaddlePointProblem::output_exact_results to write the manufactured solution to a .vtu file for visual comparison.

The currently active test case (test case 2) sets

  • first component: \(p(x,y) = e^{x}\cos y\),
  • second component: \(u(x,y) = -2xy\).

Test cases 1 and 3 (using sine functions) are present in the source but commented out; see the inline source.

Template Parameters
dimSpatial dimension (assumed to be 2 in the manufactured expressions).
n_equationsNumber of components in the vector solution (set to 2 from the outside).

Constructor & Destructor Documentation

◆ Solution()

template<int dim, int n_equations>
Solution< dim, n_equations >::Solution ( )
inline

Construct a Solution with n_equations components.

Forwards n_equations to the base-class constructor so that Function<dim>::n_components returns the correct value.

Member Function Documentation

◆ vector_gradient()

template<int dim, int n_equations>
void Solution< dim, n_equations >::vector_gradient ( const Point< dim > &  p,
std::vector< Tensor< 1, dim, double > > &  gradients 
) const
overridevirtual

Evaluate the gradient of every component at a single point.

Writes one Tensor<1,dim> per component into gradients.

Parameters
[in]pPoint at which the gradients are evaluated.
[out]gradientsVector that is first resized to n_equations and then filled with the gradient of each component.

◆ vector_value()

template<int dim, int n_equation>
void Solution< dim, n_equation >::vector_value ( const Point< dim > &  p,
Vector< double > &  values 
) const
overridevirtual

Evaluate the manufactured solution at a single point.

Writes the vector value \((p(x,y), u(x,y))\) into values.

Parameters
[in]pPoint at which the manufactured solution is evaluated.
[out]valuesVector of length n_equations that will hold the component values on exit.

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