HArD::Core2D
Hybrid Arbitrary Degree::Core 2D - Library to implement 2D schemes with edge and cell polynomials as unknowns
Loading...
Searching...
No Matches
ddr-klplate.hpp
Go to the documentation of this file.
1// Implementation of the discrete de Rham sequence for the Kirchhoff-Love plate problem.
2//
3// Authors: Daniele Di Pietro (daniele.di-pietro@umontpellier.fr) and Jerome Droniou (jerome.droniou@monash.edu)
4//
5
6#ifndef DDR_KLPLATE_HPP
7#define DDR_KLPLATE_HPP
8
9#include <iostream>
10
11#include <boost/math/constants/constants.hpp>
12
13#include <Eigen/Sparse>
14#include <unsupported/Eigen/SparseExtra>
15
16#include <mesh.hpp>
17#include <xdivdiv.hpp>
18
20
26namespace HArDCore2D
27{
28
36 {
37 typedef Eigen::SparseMatrix<double> SystemMatrixType;
38
39 typedef std::function<double(const Eigen::Vector2d &)> ForcingTermType;
40 typedef std::function<double(const Eigen::Vector2d &)> DeflectionType;
41 typedef std::function<Eigen::Vector2d(const Eigen::Vector2d &)> GradientDeflectionType;
42 typedef std::function<Eigen::Matrix2d(const Eigen::Vector2d &)> MomentTensorType;
43 typedef std::function<double(const Eigen::Vector2d &, const Edge &)> MomentTensorEdgeDerivativeType;
44
46
49 const PlatesCore & platescore,
50 const ConstitutiveLawType & law,
51 bool use_threads,
52 std::ostream & output = std::cout
53 );
54
56 inline size_t dimensionSpace() const
57 {
58 return m_xdivdiv.dimension() + m_Pkm2_Th.dimension();
59 }
60
62 inline size_t nbSCDOFs() const
63 {
64 return m_platescore.mesh().n_cells() * m_nloc_sc_sigma;
65 }
66
68 inline size_t sizeSystem() const
69 {
70 return dimensionSpace() - nbSCDOFs();
71 }
72
74 inline const XDivDiv & xDivDiv() const {
75 return m_xdivdiv;
76 }
77
79 inline const GlobalDOFSpace polykm2Th() const {
80 return m_Pkm2_Th;
81 }
82
84 inline const SystemMatrixType & systemMatrix() const {
85 return m_A;
86 }
87
90 return m_A;
91 }
92
94 inline const Eigen::VectorXd & systemVector() const {
95 return m_b;
96 }
97
99 inline Eigen::VectorXd & systemVector() {
100 return m_b;
101 }
102
104 inline const SystemMatrixType & scMatrix() const {
105 return m_sc_A;
106 }
107
109 inline Eigen::VectorXd & scVector() {
110 return m_sc_b;
111 }
112
114 inline const double & stabilizationParameter() const {
115 return m_stab_par;
116 }
117
119 inline double & stabilizationParameter() {
120 return m_stab_par;
121 }
122
125 const ForcingTermType & f,
126 const DeflectionType & u,
127 const GradientDeflectionType & grad_u
128 );
129
131 Eigen::VectorXd interpolateDeflection(
132 const DeflectionType & u,
133 int deg_quad = -1
134 ) const;
135
137 double computeNorm(
138 const Eigen::VectorXd & v
139 ) const;
140
141
142 private:
143 const PlatesCore & m_platescore;
145 bool m_use_threads;
146 std::ostream & m_output;
147
148 XDivDiv m_xdivdiv;
149 GlobalDOFSpace m_Pkm2_Th;
150
151 const size_t m_nloc_sc_sigma; // Number of DOFs statically condensed in each cell
152 SystemMatrixType m_A; // Matrix and RHS of statically condensed system
153 Eigen::VectorXd m_b;
154 SystemMatrixType m_sc_A; // Static condensation operator and RHS (to recover statically condensed DOFs)
155 Eigen::VectorXd m_sc_b;
156
157 double m_stab_par;
158
160 std::pair<Eigen::MatrixXd, Eigen::VectorXd>
161 _compute_local_contribution(
162 size_t iT,
163 const ForcingTermType & f,
164 const DeflectionType & u,
165 const GradientDeflectionType & grad_u
166 );
167
169 LocalStaticCondensation _compute_static_condensation(const size_t & iT) const;
170
172 void _assemble_local_contribution(
173 size_t iT,
174 const std::pair<Eigen::MatrixXd, Eigen::VectorXd> & lsT,
175 std::list<Eigen::Triplet<double> > & Ah_sys,
176 Eigen::VectorXd & bh_sys,
177 std::list<Eigen::Triplet<double> > & Ah_sc,
178 Eigen::VectorXd & bh_sc
179 );
180
181 };
182
183 //------------------------------------------------------------------------------
184 // Exact solutions
185 //------------------------------------------------------------------------------
186
187 static const double PI = boost::math::constants::pi<double>();
188 using std::sin;
189 using std::cos;
190 using std::exp;
191 using std::pow;
192
193 //------------------------------------------------------------------------------
194 // Trigonometric
195
197 trigonometric_u = [](const VectorRd & x) -> double {
198 return sin(PI*x(0))*sin(PI*x(1));
199 };
200
203 return PI * VectorRd(sin(PI*x(1))*cos(PI*x(0)), sin(PI*x(0))*cos(PI*x(1)));
204 };
205
207 trigonometric_hess_u = [](const VectorRd & x) -> Eigen::Matrix2d {
208 Eigen::Matrix2d M;
209 M.row(0) << -sin(PI*x(0))*sin(PI*x(1)), cos(PI*x(0))*cos(PI*x(1));
210 M.row(1) << cos(PI*x(0))*cos(PI*x(1)), -sin(PI*x(0))*sin(PI*x(1));
211
212 return pow(PI, 2) * M;
213 };
214
216 trigonometric_dx_hess_u = [](const VectorRd & x) -> Eigen::Matrix2d {
217 Eigen::Matrix2d M;
218 M.row(0) << -cos(PI*x(0))*sin(PI*x(1)), -sin(PI*x(0))*cos(PI*x(1));
219 M.row(1) << -sin(PI*x(0))*cos(PI*x(1)), -cos(PI*x(0))*sin(PI*x(1));
220
221 return pow(PI, 3) * M;
222 };
223
224
226 trigonometric_dy_hess_u = [](const VectorRd & x) -> Eigen::Matrix2d {
227 Eigen::Matrix2d M;
228 M.row(0) << -sin(PI*x(0))*cos(PI*x(1)), -cos(PI*x(0))*sin(PI*x(1));
229 M.row(1) << -cos(PI*x(0))*sin(PI*x(1)), -sin(PI*x(0))*cos(PI*x(1));
230
231 return pow(PI, 3) * M;
232 };
233
236
237 Eigen::Vector2d G {
240 };
241
242 return G;
243 };
244
246 trigonometric_hess_u_DE = [](const VectorRd & x, const Edge & E) -> double {
247
248 Eigen::Vector2d tE = E.tangent();
249 Eigen::Vector2d nE = E.normal();
250
251 Eigen::Matrix2d dtE_hess = trigonometric_dx_hess_u(x) * tE.x() + trigonometric_dy_hess_u(x) * tE.y();
252
253 Eigen::Vector2d div_hess {
256 };
257
258 return (dtE_hess*nE).dot(tE) + div_hess.dot(nE);
259 };
260
262 trigonometric_divdiv_hess_u = [](const VectorRd & x) -> double {
263 return 4.*pow(PI, 4)*sin(PI*x(0))*sin(PI*x(1));
264 };
265
266 //------------------------------------------------------------------------------
267 // Quartic
268
270 quartic_u = [](const VectorRd & x) -> double {
271 return pow(x(0),2)*pow(1.-x(0),2) + pow(x(1),2)*pow(1.-x(1),2);
272 };
273
275 quartic_grad_u = [](const VectorRd & x) -> VectorRd {
276 return VectorRd(pow(x(0), 2)*(2*x(0) - 2) + 2*x(0)*pow(1 - x(0), 2), pow(x(1), 2)*(2*x(1) - 2) + 2*x(1)*pow(1 - x(1), 2));
277 };
278
280 quartic_hess_u = [](const VectorRd & x) -> Eigen::Matrix2d {
281
282 Eigen::Matrix2d M;
283 M <<
284 2.*(pow(x(0),2)+4.*x(0)*(x(0)-1.)+pow(1.-x(0),2)), 0.,
285 0., 2.*(pow(x(1),2)+4.*x(1)*(x(1)-1.)+pow(1.-x(1),2));
286
287 return M;
288 };
289
291 quartic_dx_hess_u = [](const VectorRd & x) -> Eigen::Matrix2d {
292 Eigen::Matrix2d M;
293 M.row(0) << 24*x(0) - 12, 0;
294 M.row(1) << 0., 0.;
295
296 return M;
297 };
298
299
301 quartic_dy_hess_u = [](const VectorRd & x) -> Eigen::Matrix2d {
302 Eigen::Matrix2d M;
303 M.row(0) << 0., 0.;
304 M.row(1) << 0., 24*x(1) - 12;
305
306 return M;
307 };
308
311
312 Eigen::Vector2d G {
313 quartic_dx_hess_u(x)(0,0)+quartic_dx_hess_u(x)(1,1),
315 };
316
317 return G;
318 };
319
321 quartic_hess_u_DE = [](const VectorRd & x, const Edge & E) -> double {
322
323 Eigen::Vector2d tE = E.tangent();
324 Eigen::Vector2d nE = E.normal();
325
326 Eigen::Matrix2d dtE_hess = quartic_dx_hess_u(x) * tE.x() + quartic_dy_hess_u(x) * tE.y();
327
328 Eigen::Vector2d div_hess {
329 quartic_dx_hess_u(x)(0,0) + quartic_dy_hess_u(x)(0,1),
330 quartic_dx_hess_u(x)(1,0) + quartic_dy_hess_u(x)(1,1),
331 };
332
333 return (dtE_hess*nE).dot(tE) + div_hess.dot(nE);
334 };
335
336
338 quartic_divdiv_hess_u = [](const VectorRd & x) -> double {
339 return 48.;
340 };
341
342 //------------------------------------------------------------------------------
343 // Biquartic
344
346 biquartic_u = [](const VectorRd & x) -> double {
347 return pow(x(0),2)*pow(1.-x(0),2)*pow(x(1),2)*pow(1.-x(1),2);
348 };
349
351 biquartic_grad_u = [](const VectorRd & x) -> VectorRd {
352 return VectorRd(pow(x(0), 2)*pow(x(1), 2)*pow(1 - x(1), 2)*(2*x(0) - 2) + 2*x(0)*pow(x(1), 2)*pow(1 - x(0), 2)*pow(1 - x(1), 2), pow(x(0), 2)*pow(x(1), 2)*pow(1 - x(0), 2)*(2*x(1) - 2) + 2*pow(x(0), 2)*x(1)*pow(1 - x(0), 2)*pow(1 - x(1), 2));
353 };
354
356 biquartic_hess_u = [](const VectorRd & x) -> Eigen::Matrix2d {
357 Eigen::Matrix2d M;
358 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));
359 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));
360 return M;
361 };
362
364 biquartic_dx_hess_u = [](const VectorRd & x) -> Eigen::Matrix2d {
365 Eigen::Matrix2d M;
366 M.row(0) << 2*pow(x(1), 2)*(12*x(0) - 6)*pow(x(1) - 1, 2), 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));
367 M.row(1) << 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)), 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));
368
369 return M;
370 };
371
372
374 biquartic_dy_hess_u = [](const VectorRd & x) -> Eigen::Matrix2d {
375 Eigen::Matrix2d M;
376 M.row(0) << 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)), 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));
377 M.row(1) << 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)), 2*pow(x(0), 2)*pow(x(0) - 1, 2)*(12*x(1) - 6);
378
379 return M;
380 };
381
384
385 Eigen::Vector2d G {
388 };
389
390 return G;
391 };
392
394 biquartic_hess_u_DE = [](const VectorRd & x, const Edge & E) -> double {
395
396 Eigen::Vector2d tE = E.tangent();
397 Eigen::Vector2d nE = E.normal();
398
399 Eigen::Matrix2d dtE_hess = biquartic_dx_hess_u(x) * tE.x() + biquartic_dy_hess_u(x) * tE.y();
400
401 Eigen::Vector2d div_hess {
404 };
405
406 return (dtE_hess*nE).dot(tE) + div_hess.dot(nE);
407 };
408
410 biquartic_divdiv_hess_u = [](const VectorRd & x) -> double {
411 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));
412 };
413
414
415} // end of namespace HArDCore2D
416
417#endif
Base class for global DOF spaces. Provides functions to manipulate global DOFs (the local version bei...
Definition globaldofspace.hpp:16
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::ForcingTermType trigonometric_divdiv_hess_u
Definition ddr-klplate.hpp:262
static KirchhoffLove::GradientDeflectionType trigonometric_grad_Delta_u
Definition ddr-klplate.hpp:235
Eigen::VectorXd & systemVector()
Returns the linear system right-hand side vector.
Definition ddr-klplate.hpp:99
XDivDiv::ConstitutiveLawType ConstitutiveLawType
Definition ddr-klplate.hpp:45
double & stabilizationParameter()
Returns the stabilization parameter.
Definition ddr-klplate.hpp:119
const SystemMatrixType & scMatrix() const
Returns the static condensation recovery operator.
Definition ddr-klplate.hpp:104
static KirchhoffLove::MomentTensorType trigonometric_hess_u
Definition ddr-klplate.hpp:207
static KirchhoffLove::MomentTensorType quartic_dx_hess_u
Definition ddr-klplate.hpp:291
static KirchhoffLove::MomentTensorType quartic_dy_hess_u
Definition ddr-klplate.hpp:301
static KirchhoffLove::DeflectionType biquartic_u
Definition ddr-klplate.hpp:346
double computeNorm(const Eigen::VectorXd &v) const
Compute the discrete norm.
Definition ddr-klplate.cpp:512
const GlobalDOFSpace polykm2Th() const
Returns the space .
Definition ddr-klplate.hpp:79
static KirchhoffLove::ForcingTermType biquartic_divdiv_hess_u
Definition ddr-klplate.hpp:410
static KirchhoffLove::MomentTensorType biquartic_dx_hess_u
Definition ddr-klplate.hpp:364
static KirchhoffLove::MomentTensorType biquartic_dy_hess_u
Definition ddr-klplate.hpp:374
static KirchhoffLove::MomentTensorEdgeDerivativeType quartic_hess_u_DE
Definition ddr-klplate.hpp:321
std::function< Eigen::Vector2d(const Eigen::Vector2d &)> GradientDeflectionType
Definition ddr-klplate.hpp:41
Eigen::SparseMatrix< double > SystemMatrixType
Definition ddr-klplate.hpp:37
static const double PI
Definition ddr-klplate.hpp:187
size_t nbSCDOFs() const
Returns the number of statically condensed DOFs (here, the cell moments DOFs)
Definition ddr-klplate.hpp:62
std::function< double(const Eigen::Vector2d &)> ForcingTermType
Definition ddr-klplate.hpp:39
const SystemMatrixType & systemMatrix() const
Returns the linear system matrix.
Definition ddr-klplate.hpp:84
const Eigen::VectorXd & systemVector() const
Returns the linear system right-hand side vector.
Definition ddr-klplate.hpp:94
SystemMatrixType & systemMatrix()
Returns the linear system matrix.
Definition ddr-klplate.hpp:89
std::function< Eigen::Matrix2d(const Eigen::Vector2d &)> MomentTensorType
Definition ddr-klplate.hpp:42
const XDivDiv & xDivDiv() const
Returns the space XDivDiv.
Definition ddr-klplate.hpp:74
Eigen::VectorXd interpolateDeflection(const DeflectionType &u, int deg_quad=-1) const
Interpolate deflection.
Definition ddr-klplate.cpp:483
static KirchhoffLove::MomentTensorType quartic_hess_u
Definition ddr-klplate.hpp:280
static KirchhoffLove::MomentTensorType biquartic_hess_u
Definition ddr-klplate.hpp:356
static KirchhoffLove::GradientDeflectionType quartic_grad_u
Definition ddr-klplate.hpp:275
size_t sizeSystem() const
Returns the size of the statically condensed system.
Definition ddr-klplate.hpp:68
static KirchhoffLove::DeflectionType quartic_u
Definition ddr-klplate.hpp:270
std::function< double(const Eigen::Vector2d &, const Edge &)> MomentTensorEdgeDerivativeType
Definition ddr-klplate.hpp:43
static KirchhoffLove::GradientDeflectionType biquartic_grad_Delta_u
Definition ddr-klplate.hpp:383
static KirchhoffLove::ForcingTermType quartic_divdiv_hess_u
Definition ddr-klplate.hpp:338
static KirchhoffLove::GradientDeflectionType quartic_grad_Delta_u
Definition ddr-klplate.hpp:310
static KirchhoffLove::GradientDeflectionType biquartic_grad_u
Definition ddr-klplate.hpp:351
const double & stabilizationParameter() const
Returns the stabilization parameter.
Definition ddr-klplate.hpp:114
void assembleLinearSystem(const ForcingTermType &f, const DeflectionType &u, const GradientDeflectionType &grad_u)
Assemble the global system.
Definition ddr-klplate.cpp:446
static KirchhoffLove::MomentTensorEdgeDerivativeType trigonometric_hess_u_DE
Definition ddr-klplate.hpp:246
static KirchhoffLove::MomentTensorEdgeDerivativeType biquartic_hess_u_DE
Definition ddr-klplate.hpp:394
std::function< double(const Eigen::Vector2d &)> DeflectionType
Definition ddr-klplate.hpp:40
static KirchhoffLove::MomentTensorType trigonometric_dy_hess_u
Definition ddr-klplate.hpp:226
Eigen::VectorXd & scVector()
Returns the static condensation rhs.
Definition ddr-klplate.hpp:109
static KirchhoffLove::GradientDeflectionType trigonometric_grad_u
Definition ddr-klplate.hpp:202
static KirchhoffLove::MomentTensorType trigonometric_dx_hess_u
Definition ddr-klplate.hpp:216
size_t dimensionSpace() const
Returns the dimension of the moment + deflection space.
Definition ddr-klplate.hpp:56
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
std::function< Eigen::Matrix2d(const Eigen::Matrix2d &)> ConstitutiveLawType
Definition xdivdiv.hpp:24
Definition ddr-klplate.hpp:27
static auto v
Definition ddrcore-test.hpp:32
Assemble a Kirchhoff-Love plate problem.
Definition ddr-klplate.hpp:36
Structure to store information for, and perform, local static condensation.
Definition local_static_condensation.hpp:25