HArD::Core2D
Hybrid Arbitrary Degree::Core 2D - Library to implement 2D schemes with edge and cell polynomials as unknowns
Loading...
Searching...
No Matches
TestCaseTransient.hpp
Go to the documentation of this file.
1// Class to provide various test cases (diffusion, exact solution, and their derivatives)
2//
3//
4// Author: Jerome Droniou (jerome.droniou@monash.edu)
5//
6
7/*
8*
9* This library was developed around HHO methods, although some parts of it have a more
10* general purpose. If you use this code or part of it in a scientific publication,
11* please mention the following book as a reference for the underlying principles
12* of HHO schemes:
13*
14* The Hybrid High-Order Method for Polytopal Meshes: Design, Analysis, and Applications.
15* D. A. Di Pietro and J. Droniou. 2019, 516p.
16* url: https://hal.archives-ouvertes.fr/hal-02151813.
17*
18*/
19
20
21#ifndef _TEST_CASE_TRANSIENT_HPP
22#define _TEST_CASE_TRANSIENT_HPP
23
24#include <functional>
25#include <memory>
26#include <string>
27#include <vector>
28#include "basis.hpp"
29
30#include <Eigen/Dense>
31
32//namespace HArDCore2D { // Forward declaration
33// class Cell;
34//}
35
36using namespace HArDCore2D;
37
38
44// ----------------------------------------------------------------------------
45// Class definition
46// ----------------------------------------------------------------------------
47
48// @addtogroup TestCases
50
53
54public:
57 const std::vector<int> iTC,
58 const double mPME
59 );
60
62 std::function<double(const double &, const VectorRd &)> solution();
63
67 std::function<VectorRd(const double&, const VectorRd&, const Cell*)> grad_solution();
68
71 std::function<Eigen::Matrix2d(const double&, const VectorRd&, const Cell*)> hess_solution();
72
74 std::function<double(const double &, const VectorRd &)> delt_solution();
75
77 Eigen::Matrix2d diff(
78 const double x,
79 const double y,
80 const Cell* cell
81 );
82
84 Eigen::Vector2d div_diff(
85 const double x,
86 const double y,
87 const Cell* cell
88 );
89
92 const double t,
93 const double x,
94 const double y,
95 const Cell* cell
96 );
97
99 inline double get_lambda();
100
102 void validate();
103
105 inline size_t get_deg_diff();
106
107private:
108 // Parameters: id of test case, pi
109 const std::vector<int> m_iTC;
110 const double pi = acos(-1);
111 const double sqrt2 = std::pow(2,0.5);
112 const double eps = 1e-5; // constant for rotating diffusion case
113
114 size_t _deg_diff;
115 // Generic parameter (e.g. for changing anisotropy etc.)
116 double _lambda;
117
118 // Coefficients for Barenblatt: initial time, C_B, gamma
119 double m_t0 = 0.1;
120 double m_CB = 0.005;
121 double m_mPME;
122 double m_alpha;
123 double m_rho;
124 double m_gamma;
125
126};
127
128inline size_t TestCaseTransient::get_deg_diff() { return _deg_diff; };
129inline double TestCaseTransient::get_lambda() { return _lambda; };
130
132
133#endif //_TEST_CASE_TRANSIENT_HPP
The TestCaseTransient class provides definition of test cases.
Definition TestCaseTransient.hpp:52
double minus_div_diff_grad(const double t, const double x, const double y, const Cell *cell)
Returns -div(diff \nabla) of the exact solution at the point t, x, y.
Definition TestCaseTransient.cpp:239
double get_lambda()
Returns the value of the parameter lambda.
Definition TestCaseTransient.hpp:129
Eigen::Vector2d div_diff(const double x, const double y, const Cell *cell)
Returns the divergence by row of the diffusion matrix at the point x, y.
Definition TestCaseTransient.cpp:215
std::function< VectorRd(const double &, const VectorRd &, const Cell *)> grad_solution()
Definition TestCaseTransient.cpp:80
std::function< Eigen::Matrix2d(const double &, const VectorRd &, const Cell *)> hess_solution()
Note: the Hessian for the Barenblatt solution is NOT computed (left at 0) as it is not useful to comp...
Definition TestCaseTransient.cpp:117
std::function< double(const double &, const VectorRd &)> solution()
Returns the exact solution at time t and point p.
Definition TestCaseTransient.cpp:38
Eigen::Matrix2d diff(const double x, const double y, const Cell *cell)
Returns the diffusion matrix at the point x, y (not depending on time for the moment)
Definition TestCaseTransient.cpp:180
std::function< double(const double &, const VectorRd &)> delt_solution()
Returns the time derivative of the exact solution at time t and point p.
Definition TestCaseTransient.cpp:148
size_t get_deg_diff()
Returns the degree of the diffusion tensor (useful to set up quadrature rules of proper degree)
Definition TestCaseTransient.hpp:128
void validate()
Check if the provided test cases are valid (within range, and combination of solution/diffusion valid...
Definition TestCaseTransient.cpp:250
Eigen::Vector2d VectorRd
Definition basis.hpp:55
Definition ddr-klplate.hpp:27