MFEM v4.10.0
Finite element discretization library
Loading...
Searching...
No Matches
bilininteg_elasticity_pa.cpp
Go to the documentation of this file.
1// Copyright (c) 2010-2026, Lawrence Livermore National Security, LLC. Produced
2// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3// LICENSE and NOTICE for details. LLNL-CODE-806117.
4//
5// This file is part of the MFEM library. For more information and source code
6// availability visit https://mfem.org.
7//
8// MFEM is free software; you can redistribute it and/or modify it under the
9// terms of the BSD-3 license. We welcome feedback and contributions, see file
10// CONTRIBUTING.md for details.
11
12#include "../bilininteg.hpp"
13#include "../qfunction.hpp"
15
16namespace mfem
17{
18
19void ElasticityIntegrator::SetUpQuadratureSpaceAndCoefficients(
20 const FiniteElementSpace &fes)
21{
22 if (IntRule == nullptr)
23 {
24 // This is where it's assumed that all elements are the same.
25 const auto &T = *fes.GetMesh()->GetTypicalElementTransformation();
26 int quad_order = 2 * T.OrderGrad(fes.GetTypicalFE());
27 IntRule = &IntRules.Get(T.GetGeometryType(), quad_order);
28 }
29
30 Mesh &mesh = *fespace->GetMesh();
31
32 q_space.reset(new QuadratureSpace(mesh, *IntRule));
33 lambda_quad.reset(new CoefficientVector(lambda, *q_space,
35 mu_quad.reset(new CoefficientVector(mu, *q_space, CoefficientStorage::FULL));
36 q_vec.reset(new QuadratureFunction(*q_space, vdim*vdim));
37}
38
40{
41 MFEM_VERIFY(fes.GetOrdering() == Ordering::byNODES,
42 "Elasticity PA only implemented for byNODES ordering.");
43
44 fespace = &fes;
45 Mesh &mesh = *fespace->GetMesh();
46 MFEM_VERIFY(fespace->GetVDim() == mesh.Dimension(), "");
47 vdim = fespace->GetVDim();
48 ndofs = fespace->GetTypicalFE()->GetDof();
49
50 SetUpQuadratureSpaceAndCoefficients(fes);
51
52 auto ordering = GetEVectorOrdering(*fespace);
53 auto mode = ordering == ElementDofOrdering::NATIVE ? DofToQuad::FULL :
55 maps = &fespace->GetTypicalFE()->GetDofToQuad(*IntRule, mode);
57}
58
60{
61 internal::ElasticityAssembleDiagonalPA(vdim, ndofs, *lambda_quad, *mu_quad,
62 *geom, *maps, *IntRule, diag);
63}
64
66{
67 internal::ElasticityAddMultPA(vdim, ndofs, *fespace, *lambda_quad, *mu_quad,
68 *geom, *maps, x, *q_vec, y);
69}
70
72{
73 AddMultPA(x, y); // Operator is symmetric
74}
75
77{
78 fespace = &fes;
79
80 // Avoid projecting the coefficients more than once. If the coefficients
81 // change, the parent ElasticityIntegrator must be reassembled.
82 if (!parent.q_space)
83 {
84 parent.SetUpQuadratureSpaceAndCoefficients(fes);
85 }
86 else
87 {
88 IntRule = parent.IntRule;
89 }
90
91 auto ordering = GetEVectorOrdering(*fespace);
92 auto mode = ordering == ElementDofOrdering::NATIVE ? DofToQuad::FULL :
94 geom = fes.GetMesh()->GetGeometricFactors(*IntRule,
96 maps = &fespace->GetTypicalFE()->GetDofToQuad(*IntRule, mode);
97}
98
100{
101 internal::ElasticityComponentAddMultPA(
102 parent.vdim, parent.ndofs, *fespace, *parent.lambda_quad, *parent.mu_quad,
103 *geom, *maps, x, *parent.q_vec, y, i_block, j_block);
104}
105
107 Vector &y) const
108{
109 // Each block in the operator is symmetric, so we can just switch the roles
110 // of i_block and j_block
111 internal::ElasticityComponentAddMultPA(
112 parent.vdim, parent.ndofs, *fespace, *parent.lambda_quad, *parent.mu_quad,
113 *geom, *maps, x, *parent.q_vec, y, j_block, i_block);
114}
115
116} // namespace mfem
Header for small strain, isotropic, linear elasticity kernels.
@ FULL
Full multidimensional representation which does not use tensor product structure. The ordering of the...
Definition fe_base.hpp:158
@ LEXICOGRAPHIC_FULL
Full multidimensional representation which does not use tensor product structure. The ordering of the...
Definition fe_base.hpp:170
void AssemblePA(const FiniteElementSpace &fes) override
Method defining partial assembly.
void AddMultTransposePA(const Vector &x, Vector &y) const override
Method for partially assembled transposed action.
void AddMultPA(const Vector &x, Vector &y) const override
Method for partially assembled action.
void AddMultTransposePA(const Vector &x, Vector &y) const override
Method for partially assembled transposed action.
void AddMultPA(const Vector &x, Vector &y) const override
Method for partially assembled action.
void AssemblePA(const FiniteElementSpace &fes) override
Method defining partial assembly.
void AssembleDiagonalPA(Vector &diag) override
Assemble diagonal and add it to Vector diag.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition fespace.hpp:210
Ordering::Type GetOrdering() const
Return the ordering method.
Definition fespace.hpp:852
Mesh * GetMesh() const
Returns the mesh.
Definition fespace.hpp:639
int GetVDim() const
Returns the vector dimension of the finite element space.
Definition fespace.hpp:817
const FiniteElement * GetTypicalFE() const
Return GetFE(0) if the local mesh is not empty; otherwise return a typical FE based on the Geometry t...
Definition fespace.cpp:3896
virtual const DofToQuad & GetDofToQuad(const IntegrationRule &ir, DofToQuad::Mode mode) const
Return a DofToQuad structure corresponding to the given IntegrationRule using the given DofToQuad::Mo...
Definition fe_base.cpp:373
int GetDof() const
Returns the number of degrees of freedom in the finite element.
Definition fe_base.hpp:410
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
const IntegrationRule * IntRule
Mesh data type.
Definition mesh.hpp:67
int Dimension() const
Dimension of the reference space used within the elements.
Definition mesh.hpp:1314
const GeometricFactors * GetGeometricFactors(const IntegrationRule &ir, const int flags, MemoryType d_mt=MemoryType::DEFAULT)
Return the mesh geometric factors corresponding to the given integration rule.
Definition mesh.cpp:958
Vector data type.
Definition vector.hpp:82
@ FULL
Store the coefficient as a full QuadratureFunction.
ElementDofOrdering GetEVectorOrdering(const FiniteElementSpace &fes)
Return LEXICOGRAPHIC if mesh contains only one topology and the elements are tensor elements,...
Definition fespace.cpp:4836
@ NATIVE
Native ordering as defined by the FiniteElement.
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
Definition intrules.hpp:549