HArD::Core2D
Hybrid Arbitrary Degree::Core 2D - Library to implement 2D schemes with edge and cell polynomials as unknowns
Loading...
Searching...
No Matches
TestCaseStefanPME.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_STEFANPME_HPP
22#define _TEST_CASE_STEFANPME_HPP
23
24#include <functional>
25#include <memory>
26#include <string>
27#include <vector>
28
29#include <Eigen/Dense>
30#include "TestCase.hpp"
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> iTCS
58 );
59
61 double sol(
62 const double x,
63 const double y
64 );
65
67 Eigen::Vector2d grad_sol(
68 const double x,
69 const double y,
70 const Cell* cell
71 );
72
74 Eigen::Matrix2d hess_sol(
75 const double x,
76 const double y,
77 const Cell* cell
78 );
79
80
82 Eigen::Matrix2d diff(
83 const double x,
84 const double y,
85 const Cell* cell
86 );
87
89 Eigen::Vector2d div_diff(
90 const double x,
91 const double y,
92 const Cell* cell
93 );
94
96 double source(
97 const double x,
98 const double y,
99 const Cell* cell
100 );
101
103 inline double get_lambda();
104
106 void validate();
107
109 inline size_t get_deg_diff();
110
111 // Re-center and radial coordinates
112 Eigen::Vector2d translate(double x, double y) const { return Eigen::Vector2d(x,y) - center;};
113 double radial(const double x, const double y) const { return translate(x,y).norm();};
114
115private:
116 // Parameters: id of test case, pi
117 const std::vector<int> m_iTCS;
118 const double pi = acos(-1);
119 const double sqrt2 = std::pow(2,0.5);
120 const double gamma = 1.0/3.0;
121 const double eps = 1e-5; // constant for rotating diffusion case
122
123 size_t _deg_diff;
124 // Generic parameter (e.g. for changing anisotropy etc.)
125 double _lambda;
126
127 // For classical test cases (positive id solutions)
128 TestCase m_tcase;
129
130 // Parameter for compactly-supported solution
131 const double rho = std::pow(0.3, 2);
132 const Eigen::Vector2d center = Eigen::Vector2d(0.5, 0.5);
133
134
135};
136
137inline size_t TestCaseStefanPME::get_deg_diff() { return _deg_diff; };
138inline double TestCaseStefanPME::get_lambda() { return _lambda; };
139
141
142#endif //_TEST_CASE_STEFANPME_HPP
The TestCaseStefanPME class provides definition of test cases (exact solution, diffusion) for the Ste...
Definition TestCaseStefanPME.hpp:52
Eigen::Matrix2d hess_sol(const double x, const double y, const Cell *cell)
Returns the Hessian of the exact solution at the points x, y.
Definition TestCaseStefanPME.cpp:103
double radial(const double x, const double y) const
Definition TestCaseStefanPME.hpp:113
void validate()
Check if the provided test cases are valid (within range, and combination of solution/diffusion valid...
Definition TestCaseStefanPME.cpp:209
double source(const double x, const double y, const Cell *cell)
Returns the source term at the points x, y.
Definition TestCaseStefanPME.cpp:198
double get_lambda()
Returns the value of the parameter lambda.
Definition TestCaseStefanPME.hpp:138
Eigen::Vector2d translate(double x, double y) const
Definition TestCaseStefanPME.hpp:112
Eigen::Vector2d div_diff(const double x, const double y, const Cell *cell)
Returns the divergence by row of the diffusion matrix at the points x, y.
Definition TestCaseStefanPME.cpp:174
Eigen::Vector2d grad_sol(const double x, const double y, const Cell *cell)
Returns the gradient of the exact solution at the points x, y.
Definition TestCaseStefanPME.cpp:70
size_t get_deg_diff()
Returns the degree of the diffusion tensor (useful to set up quadrature rules of proper degree)
Definition TestCaseStefanPME.hpp:137
double sol(const double x, const double y)
Returns the exact solution at the points x, y.
Definition TestCaseStefanPME.cpp:40
Eigen::Matrix2d diff(const double x, const double y, const Cell *cell)
Returns the diffusion matrix at the points x, y.
Definition TestCaseStefanPME.cpp:139
The TestCase class provides definition of test cases.
Definition TestCase.hpp:164
Definition ddr-klplate.hpp:27