11#include <boost/math/constants/constants.hpp>
13#include <Eigen/Sparse>
14#include <unsupported/Eigen/SparseExtra>
42 const double young_modulus,
43 const double poisson_ratio
67 RMNorms(
double norm_rotation,
double norm_displacement,
double norm_kirchoff):
71 energy(std::sqrt( std::pow(norm_rotation, 2)+std::pow(norm_displacement, 2)+std::pow(norm_kirchoff, 2) ) )
105 std::ostream & output = std::cout
140inline const std::vector<std::pair<size_t,size_t>> &
locUKN()
const {
160 std::vector<size_t> I_T(dim_T);
161 size_t dim_vsxgrad = m_vsxgrad.
dimension();
162 auto it_I_T = std::copy(I_vsxgrad_T.begin(), I_vsxgrad_T.end(), I_T.begin());
163 std::transform(I_xhess_T.begin(), I_xhess_T.end(), it_I_T, [&dim_vsxgrad](
const size_t & index) { return index + dim_vsxgrad; });
234 const Eigen::VectorXd &
v
238 template<
typename outValue,
typename Fct>
239 std::function<outValue(
const Eigen::Vector2d &)>
contractPara(
const Fct &F)
const
241 std::function<outValue(
const Eigen::Vector2d &)> f = [
this, &F](
const Eigen::Vector2d &
x)->outValue {
return F(m_para,
x);};
248 std::pair<Eigen::MatrixXd, Eigen::VectorXd>
249 _compute_local_contribution(
259 void _assemble_local_contribution(
261 const std::pair<Eigen::MatrixXd, Eigen::VectorXd> & lsT,
262 std::list<Eigen::Triplet<double> > & A1,
263 Eigen::VectorXd & b1,
264 std::list<Eigen::Triplet<double> > & A2
269 std::ostream & m_output;
276 Eigen::VectorXd m_bdryValues;
280 std::vector<std::pair<size_t,size_t>> m_locUKN;
281 Eigen::VectorXi m_DOFtoUKN;
288 static const double PI = boost::math::constants::pi<double>();
306 return Eigen::Matrix2d::Zero();
332 pow(
x(1),3)*pow(
x(1)-1,3)*pow(
x(0),2)*pow(
x(0)-1,2)*(2*
x(0)-1),
333 pow(
x(0),3)*pow(
x(0)-1,3)*pow(
x(1),2)*pow(
x(1)-1,2)*(2*
x(1)-1)
339 const double x0 =
x(0);
340 const double x1 =
x(1);
344 std::pow(x0, 2) * std::pow(x0 - 1.0, 2) * (2.0 * x0 - 1.0);
347 2.0 * x0 * std::pow(x0 - 1.0, 2) * (2.0 * x0 - 1.0)
348 + std::pow(x0, 2) * 2.0 * (x0 - 1.0) * (2.0 * x0 - 1.0)
349 + std::pow(x0, 2) * std::pow(x0 - 1.0, 2) * 2.0;
352 std::pow(x1, 3) * std::pow(x1 - 1.0, 3);
355 3.0 * std::pow(x1, 2) * std::pow(x1 - 1.0, 3)
356 + 3.0 * std::pow(x1, 3) * std::pow(x1 - 1.0, 2);
360 std::pow(x0, 3) * std::pow(x0 - 1.0, 3);
363 3.0 * std::pow(x0, 2) * std::pow(x0 - 1.0, 3)
364 + 3.0 * std::pow(x0, 3) * std::pow(x0 - 1.0, 2);
367 std::pow(x1, 2) * std::pow(x1 - 1.0, 2) * (2.0 * x1 - 1.0);
370 2.0 * x1 * std::pow(x1 - 1.0, 2) * (2.0 * x1 - 1.0)
371 + std::pow(x1, 2) * 2.0 * (x1 - 1.0) * (2.0 * x1 - 1.0)
372 + std::pow(x1, 2) * std::pow(x1 - 1.0, 2) * 2.0;
374 Eigen::Matrix2d G = Eigen::Matrix2d::Zero();
388 val += (1./3.)*pow(
x(0),3)*pow(
x(0)-1,3)*pow(
x(1),3)*pow(
x(1)-1,3);
390 val -= ( 2*pow(para.
t,2) / (5*(1.-para.
nu)) ) *
391 ( pow(
x(1),3)*pow(
x(1)-1,3)*
x(0)*(
x(0)-1)*(5*
x(0)*
x(0)-5*
x(0)+1)
392 + pow(
x(0),3)*pow(
x(0)-1,3)*
x(1)*(
x(1)-1)*(5*
x(1)*
x(1)-5*
x(1)+1) );
401 val += 12*
x(1)*(
x(1)-1)*(5*
x(0)*
x(0)-5*
x(0)+1) *
402 ( 2*
x(1)*
x(1)*(
x(1)-1)*(
x(1)-1) +
x(0)*(
x(0)-1)*(5*
x(1)*
x(1)-5*
x(1)+1) );
403 val += 12*
x(0)*(
x(0)-1)*(5*
x(1)*
x(1)-5*
x(1)+1) *
404 ( 2*
x(0)*
x(0)*(
x(0)-1)*(
x(0)-1) +
x(1)*(
x(1)-1)*(5*
x(0)*
x(0)-5*
x(0)+1) );
406 return val * para.
E / (12* (1.-para.
nu*para.
nu) );
412 const double t2 = para.
t * para.
t;
413 const double c = 2.0 * t2 / (5.0 * (1.0 - para.
nu));
415 const double x0 =
x(0);
416 const double x1 =
x(1);
418 const double P0 = pow(x0,3) * pow(x0 - 1.0,3);
419 const double P1 = pow(x1,3) * pow(x1 - 1.0,3);
422 3.0 * pow(x0,2) * pow(x0 - 1.0,3)
423 + 3.0 * pow(x0,3) * pow(x0 - 1.0,2);
426 3.0 * pow(x1,2) * pow(x1 - 1.0,3)
427 + 3.0 * pow(x1,3) * pow(x1 - 1.0,2);
429 const double Q0 = x0 * (x0 - 1.0) * (5.0*x0*x0 - 5.0*x0 + 1.0);
430 const double Q1 = x1 * (x1 - 1.0) * (5.0*x1*x1 - 5.0*x1 + 1.0);
433 (x0 - 1.0) * (5.0*x0*x0 - 5.0*x0 + 1.0)
434 + x0 * (5.0*x0*x0 - 5.0*x0 + 1.0)
435 + x0 * (x0 - 1.0) * (10.0*x0 - 5.0);
438 (x1 - 1.0) * (5.0*x1*x1 - 5.0*x1 + 1.0)
439 + x1 * (5.0*x1*x1 - 5.0*x1 + 1.0)
440 + x1 * (x1 - 1.0) * (10.0*x1 - 5.0);
447 (1.0 / 3.0) * dP0 * P1
448 - c * ( P1 * dQ0 + dP0 * Q1 );
452 (1.0 / 3.0) * P0 * dP1
453 - c * ( dP1 * Q0 + P0 * dQ1 );
461 static std::function<double(
const VectorRd &)>
477 static std::function<double(
const VectorRd &)>
480 static std::function<double(
const VectorRd &)>
485 return VectorRd((1.-
x(0))*exp(-
x(0))*cos(
x(1)), -
x(0)*exp(-
x(0))*sin(
x(1)));
491 H.row(0) << (
x(0)-2.)*exp(-
x(0))*cos(
x(1)), -(1.-
x(0))*exp(-
x(0))*sin(
x(1));
492 H.row(1) << -(1.-
x(0))*exp(-
x(0))*sin(
x(1)), -
x(0)*exp(-
x(0))*cos(
x(1));
496 static std::function<double(
const VectorRd &)>
538 -2.0 * pow(
PI,3) * cos(
PI*
x(0)) * sin(
PI*
x(1)),
539 -2.0 * pow(
PI,3) * sin(
PI*
x(0)) * cos(
PI*
x(1))
546 2.0 * exp(-
x(0)) * cos(
x(1)),
547 2.0 * exp(-
x(0)) * sin(
x(1))
576 return Eigen::Matrix2d::Zero();
606 double coef = 12.*(1-pow(para.
nu,2))/ (para.
E * 4.*pow(
PI, 4));
612 double coef = 12.*(1-pow(para.
nu,2))/ (para.
E * 4.*pow(
PI, 4));
613 Eigen::Matrix2d H = Eigen::Matrix2d::Zero();
621 double coef = 12.*(1-pow(para.
nu,2))/ (para.
E * 4.*pow(
PI, 4));
622 return coef * sin(
PI*
x(0))*sin(
PI*
x(1));
626 double coef = 12. * (1 - pow(para.
nu, 2)) / (para.
E * 4. * pow(
PI, 4));
628 grad(0) = coef *
PI * cos(
PI *
x(0)) * sin(
PI *
x(1));
629 grad(1) = coef *
PI * sin(
PI *
x(0)) * cos(
PI *
x(1));
635 return sin(
PI*
x(0))*sin(
PI*
x(1));
The BoundaryConditions class provides definition of boundary conditions.
Definition BoundaryConditions.hpp:45
const size_t n_dir_vertices() const
Returns the number of Dirichlet vertices.
Definition BoundaryConditions.hpp:75
const size_t n_dir_edges() const
Returns the number of Dirichlet edges.
Definition BoundaryConditions.hpp:70
Construct all polynomial spaces for the DDR sequence.
Definition ddrcore.hpp:63
Construct all polynomial spaces for the DDR sequence.
Definition serendipity_problem.hpp:20
Definition vsxcurl.hpp:11
Vector version of sXgrad, the arbitrary order space with nodal primal unknowns.
Definition vsxgrad.hpp:33
Discrete H2 space: local operators, L2 product and global interpolator.
Definition xhess_full.hpp:21
Create grid points x
Definition generate_cartesian_mesh.m:22
const double & stabilizationParameter() const
Returns the stabilization parameter.
Definition bgg-rmplate.hpp:223
std::function< Eigen::Vector2d(const RMParameters &, const Eigen::Vector2d &)> SolutionRotationType
Definition bgg-rmplate.hpp:89
double E
Definition bgg-rmplate.hpp:56
std::vector< size_t > globalDOFIndices(const Cell &T) const
Create the vector of DOF indices for cell T, which combines the DOFs for the spaces VSXgrad and Xhess...
Definition bgg-rmplate.hpp:155
static std::function< double(const VectorRd &)> an_V
Definition bgg-rmplate.hpp:481
std::function< Eigen::Matrix2d(const RMParameters &, const Eigen::Vector2d &)> GradientRotationType
Definition bgg-rmplate.hpp:90
static ReissnerMindlin::SolutionRotationType ukn_theta
Definition bgg-rmplate.hpp:570
static ReissnerMindlin::SolutionDisplacementType an_LAPL_v
Definition bgg-rmplate.hpp:516
static ReissnerMindlin::GradientRotationType ukn_grad_theta
Definition bgg-rmplate.hpp:575
static ReissnerMindlin::SolutionRotationType an_GRAD_LAPL_v
Definition bgg-rmplate.hpp:552
static std::function< double(const VectorRd &)> an_LAPL_g
Definition bgg-rmplate.hpp:478
std::function< outValue(const Eigen::Vector2d &)> contractPara(const Fct &F) const
Takes a function dependent on RMParameter and a position x, and returns a function depending only on ...
Definition bgg-rmplate.hpp:239
static std::function< VectorRd(const VectorRd &)> an_GRAD_g
Definition bgg-rmplate.hpp:465
static ReissnerMindlin::GradientRotationType an_HESS_v
Definition bgg-rmplate.hpp:511
std::function< double(const RMParameters &, const Eigen::Vector2d &)> ForcingTermType
Definition bgg-rmplate.hpp:88
static ReissnerMindlin::SolutionRotationType polynomial_theta
Definition bgg-rmplate.hpp:330
std::function< Eigen::Vector2d(const RMParameters &, const Eigen::Vector2d &)> GradientDisplacementType
Definition bgg-rmplate.hpp:92
static ReissnerMindlin::SolutionRotationType constant_theta
Definition bgg-rmplate.hpp:300
static KirchhoffLove::SolutionDisplacementType constant_u
Definition bgg-klplate.hpp:223
static ReissnerMindlin::ForcingTermType kir_f
Definition bgg-rmplate.hpp:634
double nu
Definition bgg-rmplate.hpp:57
RMNorms computeNorms(const Eigen::VectorXd &v) const
Compute the discrete norms: rotation, displacement, Kirchoff term, and complete energy.
Definition bgg-rmplate.cpp:610
const RMParameters & para() const
Returns the parameters.
Definition bgg-rmplate.hpp:168
Eigen::VectorXd & systemVector()
Returns the linear system right-hand side vector.
Definition bgg-rmplate.hpp:208
static ReissnerMindlin::SolutionDisplacementType kir_u
Definition bgg-rmplate.hpp:620
static KirchhoffLove::GradientDisplacementType polynomial_grad_u
Definition bgg-klplate.hpp:246
double displacement
Norm of displacement.
Definition bgg-rmplate.hpp:77
const SystemMatrixType & bdryMatrix() const
Returns the Matrix for BC.
Definition bgg-rmplate.hpp:213
std::function< double(const RMParameters &, const Eigen::Vector2d &)> SolutionDisplacementType
Definition bgg-rmplate.hpp:91
const BoundaryConditions & BC_u() const
Returns the boundary conditions for u.
Definition bgg-rmplate.hpp:150
static std::function< double(const VectorRd &)> an_LAPL_V
Definition bgg-rmplate.hpp:497
static ReissnerMindlin::GradientDisplacementType ukn_grad_u
Definition bgg-rmplate.hpp:585
const Eigen::VectorXi & DOFtoUKN() const
Returns the map from global DOFs to system unknowns.
Definition bgg-rmplate.hpp:145
const std::vector< std::pair< size_t, size_t > > & locUKN() const
Returns the location of the unknowns among the DOFs.
Definition bgg-rmplate.hpp:140
const Eigen::VectorXd & bdryValues() const
Returns the boundary values.
Definition bgg-rmplate.hpp:218
static std::function< MatrixRd(const VectorRd &)> an_HESS_g
Definition bgg-rmplate.hpp:470
static const double PI
Definition bgg-klplate.hpp:214
static ReissnerMindlin::SolutionDisplacementType analytical_u
Definition bgg-rmplate.hpp:525
static ReissnerMindlin::GradientRotationType kir_grad_theta
Definition bgg-rmplate.hpp:611
size_t nb_bdryDOFs() const
Returns the nb of DOFs for BC.
Definition bgg-rmplate.hpp:125
double beta1
Definition bgg-rmplate.hpp:59
static ReissnerMindlin::GradientRotationType constant_grad_theta
Definition bgg-rmplate.hpp:305
const Eigen::VectorXd & systemVector() const
Returns the linear system right-hand side vector.
Definition bgg-rmplate.hpp:203
const VSXCurl & vsxCurl() const
Returns the space VSXCurl.
Definition bgg-rmplate.hpp:180
static std::function< MatrixRd(const VectorRd &)> an_HESS_V
Definition bgg-rmplate.hpp:489
static ReissnerMindlin::ForcingTermType analytical_f
Definition bgg-rmplate.hpp:530
const XHessFull & xHess() const
Returns the space XHess.
Definition bgg-rmplate.hpp:187
Eigen::SparseMatrix< double > SystemMatrixType
Definition bgg-rmplate.hpp:86
static KirchhoffLove::ForcingTermType constant_f
Definition bgg-klplate.hpp:233
const SystemMatrixType & systemMatrix() const
Returns the linear system matrix.
Definition bgg-rmplate.hpp:193
static ReissnerMindlin::GradientRotationType analytical_grad_theta
Definition bgg-rmplate.hpp:522
static ReissnerMindlin::SolutionDisplacementType ukn_u
Definition bgg-rmplate.hpp:580
void assembleLinearSystem(const ForcingTermType &f, const SolutionRotationType &theta, const GradientRotationType &grad_theta, const SolutionDisplacementType &u, const GradientDisplacementType &grad_u)
Assemble the global system
Definition bgg-rmplate.cpp:421
static KirchhoffLove::ForcingTermType polynomial_f
Definition bgg-klplate.hpp:254
static ReissnerMindlin::SolutionRotationType kir_theta
Definition bgg-rmplate.hpp:605
double kappa
Definition bgg-rmplate.hpp:60
double t
Definition bgg-rmplate.hpp:55
static std::function< VectorRd(const VectorRd &)> an_GRAD_LAPL_g
Definition bgg-rmplate.hpp:536
static ReissnerMindlin::GradientDisplacementType analytical_grad_u
Definition bgg-rmplate.hpp:558
static ReissnerMindlin::ForcingTermType ukn_f
Definition bgg-rmplate.hpp:592
static std::function< double(const VectorRd &)> an_g
Definition bgg-rmplate.hpp:462
RMNorms(double norm_rotation, double norm_displacement, double norm_kirchoff)
Constructor.
Definition bgg-rmplate.hpp:67
static KirchhoffLove::GradientDisplacementType constant_grad_u
Definition bgg-klplate.hpp:228
SystemMatrixType & systemMatrix()
Returns the linear system matrix.
Definition bgg-rmplate.hpp:198
size_t sizeSystem() const
Returns the size of the system without BC.
Definition bgg-rmplate.hpp:134
size_t dimensionSpace() const
Returns the dimension of the rotation + displacement space (with BC)
Definition bgg-rmplate.hpp:119
static ReissnerMindlin::SolutionRotationType analytical_theta
Definition bgg-rmplate.hpp:520
static std::function< VectorRd(const VectorRd &)> an_GRAD_LAPL_V
Definition bgg-rmplate.hpp:544
static ReissnerMindlin::SolutionRotationType an_GRAD_v
Definition bgg-rmplate.hpp:506
static ReissnerMindlin::GradientDisplacementType kir_grad_u
Definition bgg-rmplate.hpp:625
double beta0
Definition bgg-rmplate.hpp:58
double kirchoff
Norm of kirchoff term.
Definition bgg-rmplate.hpp:78
static KirchhoffLove::SolutionDisplacementType polynomial_u
Definition bgg-klplate.hpp:241
static ReissnerMindlin::GradientRotationType polynomial_grad_theta
Definition bgg-rmplate.hpp:338
static std::function< VectorRd(const VectorRd &)> an_GRAD_V
Definition bgg-rmplate.hpp:484
double rotation
Norm of rotation.
Definition bgg-rmplate.hpp:76
const VSXGrad & vsxGrad() const
Returns the space VSXGrad.
Definition bgg-rmplate.hpp:174
RMParameters(const double thickness, const double young_modulus, const double poisson_ratio)
Constructor.
Definition bgg-rmplate.hpp:41
double & stabilizationParameter()
Returns the stabilization parameter.
Definition bgg-rmplate.hpp:228
double energy
Total energy.
Definition bgg-rmplate.hpp:79
static ReissnerMindlin::SolutionDisplacementType an_v
Definition bgg-rmplate.hpp:501
Eigen::Vector2d VectorRd
Definition basis.hpp:55
Eigen::Matrix2d MatrixRd
Definition basis.hpp:54
std::vector< size_t > globalDOFIndices(const Cell &T) const
Definition globaldofspace.cpp:98
size_t dimension() const
Returns the dimension of the global space (all DOFs for all geometric entities)
Definition variabledofspace.hpp:129
size_t numLocalDofsEdge(const size_t iE) const
Returns the number of local DOFs on edge of index iE.
Definition variabledofspace.hpp:77
std::vector< size_t > globalDOFIndices(const Cell &T) const
Returns a vector listing the global DOFs attached to the element T: vertex DOFs, edge DOFs,...
Definition variabledofspace.cpp:149
size_t dimensionCell(const Cell &T) const
Returns the dimension of the local space on the cell T (including faces, edges and vertices)
Definition variabledofspace.hpp:165
size_t numLocalDofsVertex() const
Returns the number of local vertex DOFs.
Definition localdofspace.hpp:39
size_t numLocalDofsVertex(const size_t iV) const
Returns the number of local DOFs on vertex of index iV.
Definition variabledofspace.hpp:64
size_t dimensionCell(const Cell &T) const
Returns the dimension of the local space on the cell T (including faces, edges and vertices)
Definition localdofspace.hpp:112
size_t dimension() const
Returns the dimension of the global space (all DOFs for all geometric entities)
Definition localdofspace.hpp:61
size_t numLocalDofsEdge() const
Returns the number of local edge DOFs.
Definition localdofspace.hpp:45
const EdgeBases & edgeBases(size_t iE) const
Return edge bases for edge iE.
Definition ddrcore.hpp:136
std::unique_ptr< PolyBasisEdgeType > Polyk
Definition ddrcore.hpp:108
bool use_threads
Definition HHO_DiffAdvecReac.hpp:45
if(strcmp(field, 'real')) % real valued entries T
Definition mmread.m:93
Definition mhd-solutions.hpp:9
static auto v
Definition ddrcore-test.hpp:32
Structure to store component norms (for rotation, displacement, Kirchoff term and total energy)
Definition bgg-rmplate.hpp:65
Structure to store model data.
Definition bgg-rmplate.hpp:39
Assemble a RM problem.
Definition bgg-rmplate.hpp:85