7#ifndef XDIVDIV_TEST_HPP
8#define XDIVDIV_TEST_HPP
12#include <boost/math/constants/constants.hpp>
14#include <Eigen/Sparse>
15#include <unsupported/Eigen/SparseExtra>
41 std::ostream & output = std::cout
88 std::ostream & m_output;
102 static const double PI = boost::math::constants::pi<double>();
113 return sin(
PI*x(0))*sin(
PI*x(1));
118 return 4.*pow(
PI, 4)*sin(
PI*x(0))*sin(
PI*x(1));
124 M.row(0) << -sin(
PI*x(0))*sin(
PI*x(1)), cos(
PI*x(0))*cos(
PI*x(1));
125 M.row(1) << cos(
PI*x(0))*cos(
PI*x(1)), -sin(
PI*x(0))*sin(
PI*x(1));
127 return -pow(
PI, 2) * M;
133 Eigen::Vector2d grad_sigma11 {
134 -cos(
PI*x(0))*sin(
PI*x(1)), -sin(
PI*x(0))*cos(
PI*x(1))
136 grad_sigma11 *= -pow(
PI, 3);
138 Eigen::Vector2d grad_sigma12 {
139 -sin(
PI*x(0))*cos(
PI*x(1)), -sin(
PI*x(1))*cos(
PI*x(0))
141 grad_sigma12 *= -pow(
PI, 3);
143 Eigen::Vector2d grad_sigma22 {
144 -cos(
PI*x(0))*sin(
PI*x(1)), -sin(
PI*x(0))*cos(
PI*x(1))
146 grad_sigma22 *= -pow(
PI, 3);
148 Eigen::Vector2d tE = E.tangent();
149 Eigen::Vector2d nE = E.normal();
151 Eigen::Matrix2d dtE_sigma;
152 dtE_sigma.row(0) << grad_sigma11.dot(tE), grad_sigma12.dot(tE);
153 dtE_sigma.row(1) << grad_sigma12.dot(tE), grad_sigma22.dot(tE);
155 Eigen::Vector2d div_sigma {
156 grad_sigma11(0) + grad_sigma12(1),
157 grad_sigma12(0) + grad_sigma22(1)
160 return (dtE_sigma*nE).dot(tE) + div_sigma.dot(nE);
194 Eigen::Vector2d grad_sigma11 {
197 grad_sigma11 *= -pow(
PI, 3);
199 Eigen::Vector2d grad_sigma12 {
202 grad_sigma12 *= -pow(
PI, 3);
204 Eigen::Vector2d grad_sigma22 {
207 grad_sigma22 *= -pow(
PI, 3);
209 Eigen::Vector2d tE = E.tangent();
210 Eigen::Vector2d nE = E.normal();
212 Eigen::Matrix2d dtE_sigma;
213 dtE_sigma.row(0) << grad_sigma11.dot(tE), grad_sigma12.dot(tE);
214 dtE_sigma.row(1) << grad_sigma12.dot(tE), grad_sigma22.dot(tE);
216 Eigen::Vector2d div_sigma {
217 grad_sigma11(0) + grad_sigma12(1),
218 grad_sigma12(0) + grad_sigma22(1)
221 return (dtE_sigma*nE).dot(tE) + div_sigma.dot(nE);
229 return pow(x(0),2)*pow(1.-x(0),2) + pow(x(1),2)*pow(1.-x(1),2);
242 2.*(pow(x(0),2)+4.*x(0)*(x(0)-1.)+pow(1.-x(0),2)), 0.,
243 0., 2.*(pow(x(1),2)+4.*x(1)*(x(1)-1.)+pow(1.-x(1),2));
251 Eigen::Vector2d grad_sigma11 { -24.*x(0)+12., 0. };
252 Eigen::Vector2d grad_sigma12 { 0., 0. };
253 Eigen::Vector2d grad_sigma22 { 0., -24.*x(1)+12. };
255 Eigen::Vector2d tE = E.tangent();
256 Eigen::Vector2d nE = E.normal();
258 Eigen::Matrix2d dtE_sigma;
260 grad_sigma11.dot(tE), grad_sigma12.dot(tE),
261 grad_sigma12.dot(tE), grad_sigma22.dot(tE);
263 Eigen::Vector2d div_sigma {
264 grad_sigma11(0) + grad_sigma12(1),
265 grad_sigma12(0) + grad_sigma22(1)
268 return (dtE_sigma*nE).dot(tE) + div_sigma.dot(nE);
276 return pow(x(0),2)*pow(1.-x(0),2)*pow(x(1),2)*pow(1.-x(1),2);
281 return 24*pow(x(0), 2)*pow(x(0) - 1, 2) + 32*x(0)*x(1)*(x(0) - 1)*(x(1) - 1) + 8*x(0)*x(1)*(x(0) - 1)*(4*x(1) - 2) + 8*x(0)*x(1)*(4*x(0) - 2)*(x(1) - 1) + 8*x(0)*x(1)*(x(0)*x(1) + x(0)*(x(1) - 1) + x(1)*(x(0) - 1) + (x(0) - 1)*(x(1) - 1)) + 8*x(0)*(x(0) - 1)*(x(1) - 1)*(4*x(1) - 2) + 8*x(0)*(x(1) - 1)*(x(0)*x(1) + x(0)*(x(1) - 1) + x(1)*(x(0) - 1) + (x(0) - 1)*(x(1) - 1)) + 24*pow(x(1), 2)*pow(x(1) - 1, 2) + 8*x(1)*(x(0) - 1)*(4*x(0) - 2)*(x(1) - 1) + 8*x(1)*(x(0) - 1)*(x(0)*x(1) + x(0)*(x(1) - 1) + x(1)*(x(0) - 1) + (x(0) - 1)*(x(1) - 1)) + 2*(4*x(0) - 4)*(x(1) - 1)*(x(0)*x(1) + x(0)*(x(1) - 1) + x(1)*(x(0) - 1) + (x(0) - 1)*(x(1) - 1));
287 M.row(0) << 2*pow(x(1), 2)*pow(x(1) - 1, 2)*(pow(x(0), 2) + 4*x(0)*(x(0) - 1) + pow(x(0) - 1, 2)), 4*x(0)*x(1)*(x(0) - 1)*(x(1) - 1)*(x(0)*x(1) + x(0)*(x(1) - 1) + x(1)*(x(0) - 1) + (x(0) - 1)*(x(1) - 1));
288 M.row(1) << 4*x(0)*x(1)*(x(0) - 1)*(x(1) - 1)*(x(0)*x(1) + x(0)*(x(1) - 1) + x(1)*(x(0) - 1) + (x(0) - 1)*(x(1) - 1)), 2*pow(x(0), 2)*pow(x(0) - 1, 2)*(pow(x(1), 2) + 4*x(1)*(x(1) - 1) + pow(x(1) - 1, 2));
295 Eigen::Vector2d grad_sigma11 {
296 2*pow(x(1), 2)*(12*x(0) - 6)*pow(x(1) - 1, 2),
297 2*pow(x(1), 2)*(2*x(1) - 2)*(pow(x(0), 2) + 4*x(0)*(x(0) - 1) + pow(x(0) - 1, 2)) + 4*x(1)*pow(x(1) - 1, 2)*(pow(x(0), 2) + 4*x(0)*(x(0) - 1) + pow(x(0) - 1, 2))
300 Eigen::Vector2d grad_sigma12 {
301 4*x(0)*x(1)*(x(0) - 1)*(x(1) - 1)*(4*x(1) - 2) + 4*x(0)*x(1)*(x(1) - 1)*(x(0)*x(1) + x(0)*(x(1) - 1) + x(1)*(x(0) - 1) + (x(0) - 1)*(x(1) - 1)) + 4*x(1)*(x(0) - 1)*(x(1) - 1)*(x(0)*x(1) + x(0)*(x(1) - 1) + x(1)*(x(0) - 1) + (x(0) - 1)*(x(1) - 1)),
302 4*x(0)*x(1)*(x(0) - 1)*(4*x(0) - 2)*(x(1) - 1) + 4*x(0)*x(1)*(x(0) - 1)*(x(0)*x(1) + x(0)*(x(1) - 1) + x(1)*(x(0) - 1) + (x(0) - 1)*(x(1) - 1)) + 4*x(0)*(x(0) - 1)*(x(1) - 1)*(x(0)*x(1) + x(0)*(x(1) - 1) + x(1)*(x(0) - 1) + (x(0) - 1)*(x(1) - 1))
305 Eigen::Vector2d grad_sigma22 {
306 2*pow(x(0), 2)*(2*x(0) - 2)*(pow(x(1), 2) + 4*x(1)*(x(1) - 1) + pow(x(1) - 1, 2)) + 4*x(0)*pow(x(0) - 1, 2)*(pow(x(1), 2) + 4*x(1)*(x(1) - 1) + pow(x(1) - 1, 2)),
307 2*pow(x(0), 2)*pow(x(0) - 1, 2)*(12*x(1) - 6)
315 Eigen::Vector2d tE = E.tangent();
316 Eigen::Vector2d nE = E.normal();
318 Eigen::Matrix2d dtE_sigma;
319 dtE_sigma.row(0) << grad_sigma11.dot(tE), grad_sigma12.dot(tE);
320 dtE_sigma.row(1) << grad_sigma12.dot(tE), grad_sigma22.dot(tE);
322 Eigen::Vector2d div_sigma {
323 grad_sigma11(0) + grad_sigma12(1),
324 grad_sigma12(0) + grad_sigma22(1)
327 return (dtE_sigma*nE).dot(tE) + div_sigma.dot(nE);
Construct all polynomial spaces for the plates sequence.
Definition platescore.hpp:25
Discrete Hdivdiv space.
Definition xdivdiv.hpp:20
Eigen::Vector2d VectorRd
Definition basis.hpp:55
size_t dimension() const
Returns the dimension of the global space (all DOFs for all geometric entities)
Definition localdofspace.hpp:61
static KirchhoffLove::DeflectionType trigonometric_u
Definition ddr-klplate.hpp:197
static KirchhoffLove::DeflectionType biquartic_u
Definition ddr-klplate.hpp:346
Eigen::SparseMatrix< double > SystemMatrixType
Definition ddr-klplate.hpp:37
static const double PI
Definition ddr-klplate.hpp:187
std::function< double(const Eigen::Vector2d &)> ForcingTermType
Definition ddr-klplate.hpp:39
std::function< Eigen::Matrix2d(const Eigen::Vector2d &)> MomentTensorType
Definition ddr-klplate.hpp:42
static KirchhoffLove::DeflectionType quartic_u
Definition ddr-klplate.hpp:270
std::function< double(const Eigen::Vector2d &, const Edge &)> MomentTensorEdgeDerivativeType
Definition ddr-klplate.hpp:43
std::function< double(const Eigen::Vector2d &)> DeflectionType
Definition ddr-klplate.hpp:40
bool use_threads
Definition HHO_DiffAdvecReac.hpp:47
std::size_t n_cells() const
number of cells in the mesh.
Definition Mesh2D.hpp:63
const Mesh & mesh() const
Return a const reference to the mesh.
Definition platescore.hpp:66
const size_t & degree() const
Return the polynomial degree.
Definition platescore.hpp:72
Definition ddr-klplate.hpp:27
static KirchhoffLove::MomentTensorType trigonometric_sigma
Definition xdivdiv-test.hpp:122
static KirchhoffLove::MomentTensorEdgeDerivativeType biquartic_sigma_DE
Definition xdivdiv-test.hpp:293
static KirchhoffLove::MomentTensorEdgeDerivativeType quartic_sigma_DE
Definition xdivdiv-test.hpp:249
static KirchhoffLove::DeflectionType simple_u
Definition xdivdiv-test.hpp:167
static QuadRot::ForcingTermType trigonometric_f
Definition ddr-quadrot.hpp:367
static KirchhoffLove::ForcingTermType simple_f
Definition xdivdiv-test.hpp:177
static QuadRot::ForcingTermType quartic_f
Definition ddr-quadrot.hpp:327
static KirchhoffLove::MomentTensorType simple_sigma
Definition xdivdiv-test.hpp:182
static KirchhoffLove::MomentTensorEdgeDerivativeType trigonometric_sigma_DE
Definition xdivdiv-test.hpp:131
static KirchhoffLove::MomentTensorEdgeDerivativeType simple_sigma_DE
Definition xdivdiv-test.hpp:192
static KirchhoffLove::MomentTensorType quartic_sigma
Definition xdivdiv-test.hpp:238
static KirchhoffLove::ForcingTermType biquartic_f
Definition xdivdiv-test.hpp:280
static KirchhoffLove::MomentTensorType biquartic_sigma
Definition xdivdiv-test.hpp:285
Assemble a Kirchhoff-Love plate problem.
Definition ddr-klplate.hpp:36
Eigen::VectorXd & systemVector()
Returns the linear system right-hand side vector.
Definition xdivdiv-test.hpp:71
double & stabilizationParameter()
Returns the stabilization parameter.
Definition xdivdiv-test.hpp:81
Eigen::SparseMatrix< double > SystemMatrixType
Definition xdivdiv-test.hpp:29
std::function< double(const Eigen::Vector2d &)> ForcingTermType
Definition xdivdiv-test.hpp:31
const SystemMatrixType & systemMatrix() const
Returns the linear system matrix.
Definition xdivdiv-test.hpp:56
const Eigen::VectorXd & systemVector() const
Returns the linear system right-hand side vector.
Definition xdivdiv-test.hpp:66
SystemMatrixType & systemMatrix()
Returns the linear system matrix.
Definition xdivdiv-test.hpp:61
std::function< Eigen::Matrix2d(const Eigen::Vector2d &)> MomentTensorType
Definition xdivdiv-test.hpp:33
const XDivDiv & xDivDiv() const
Returns the space XDivDiv.
Definition xdivdiv-test.hpp:51
std::function< double(const Eigen::Vector2d &, const Edge &)> MomentTensorEdgeDerivativeType
Definition xdivdiv-test.hpp:34
const double & stabilizationParameter() const
Returns the stabilization parameter.
Definition xdivdiv-test.hpp:76
std::function< double(const Eigen::Vector2d &)> DeflectionType
Definition xdivdiv-test.hpp:32
size_t dimensionSpace() const
Returns the dimension of the rotation + displacement space (with BC)
Definition xdivdiv-test.hpp:45
Basis dimensions for various polynomial spaces on edges/faces/elements (when relevant): Pk,...
Definition polynomialspacedimension.hpp:55