MFEM v4.8.0
Finite element discretization library
Loading...
Searching...
No Matches
bilininteg_elasticity_kernels.cpp
Go to the documentation of this file.
1// Copyright (c) 2010-2025, 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
13
14namespace mfem
15{
16
17namespace internal
18{
19
20void ElasticityComponentAddMultPA(const int dim, const int nDofs,
21 const FiniteElementSpace &fespace, const CoefficientVector &lambda,
22 const CoefficientVector &mu, const GeometricFactors &geom,
23 const DofToQuad &maps, const Vector &x, QuadratureFunction &QVec, Vector &y,
24 const int i_block, const int j_block)
25{
26 const int id = (dim << 8)| (i_block << 4) | j_block;
27 switch (id)
28 {
29 case 0x200:
30 ElasticityAddMultPA_<2,0,0>(nDofs, fespace, lambda, mu, geom, maps, x, QVec, y);
31 break;
32 case 0x211:
33 ElasticityAddMultPA_<2,1,1>(nDofs, fespace, lambda, mu, geom, maps, x, QVec, y);
34 break;
35 case 0x201:
36 ElasticityAddMultPA_<2,0,1>(nDofs, fespace, lambda, mu, geom, maps, x, QVec, y);
37 break;
38 case 0x210:
39 ElasticityAddMultPA_<2,1,0>(nDofs, fespace, lambda, mu, geom, maps, x, QVec, y);
40 break;
41 case 0x300:
42 ElasticityAddMultPA_<3,0,0>(nDofs, fespace, lambda, mu, geom, maps, x, QVec, y);
43 break;
44 case 0x311:
45 ElasticityAddMultPA_<3,1,1>(nDofs, fespace, lambda, mu, geom, maps, x, QVec, y);
46 break;
47 case 0x322:
48 ElasticityAddMultPA_<3,2,2>(nDofs, fespace, lambda, mu, geom, maps, x, QVec, y);
49 break;
50 case 0x301:
51 ElasticityAddMultPA_<3,0,1>(nDofs, fespace, lambda, mu, geom, maps, x, QVec, y);
52 break;
53 case 0x302:
54 ElasticityAddMultPA_<3,0,2>(nDofs, fespace, lambda, mu, geom, maps, x, QVec, y);
55 break;
56 case 0x312:
57 ElasticityAddMultPA_<3,1,2>(nDofs, fespace, lambda, mu, geom, maps, x, QVec, y);
58 break;
59 case 0x310:
60 ElasticityAddMultPA_<3,1,0>(nDofs, fespace, lambda, mu, geom, maps, x, QVec, y);
61 break;
62 case 0x320:
63 ElasticityAddMultPA_<3,2,0>(nDofs, fespace, lambda, mu, geom, maps, x, QVec, y);
64 break;
65 case 0x321:
66 ElasticityAddMultPA_<3,2,1>(nDofs, fespace, lambda, mu, geom, maps, x, QVec, y);
67 break;
68 default:
69 MFEM_ABORT("Invalid configuration.");
70 }
71}
72
73void ElasticityAddMultPA(const int dim, const int nDofs,
74 const FiniteElementSpace &fespace, const CoefficientVector &lambda,
75 const CoefficientVector &mu, const GeometricFactors &geom,
76 const DofToQuad &maps, const Vector &x, QuadratureFunction &QVec, Vector &y)
77{
78 switch (dim)
79 {
80 case 2:
81 ElasticityAddMultPA_<2>(nDofs, fespace, lambda, mu, geom, maps, x, QVec, y);
82 break;
83 case 3:
84 ElasticityAddMultPA_<3>(nDofs, fespace, lambda, mu, geom, maps, x, QVec, y);
85 break;
86 default:
87 MFEM_ABORT("Only dimensions 2 and 3 supported.");
88 }
89}
90
91void ElasticityAssembleDiagonalPA(const int dim, const int nDofs,
92 const CoefficientVector &lambda,
93 const CoefficientVector &mu, const GeometricFactors &geom,
94 const DofToQuad &maps, QuadratureFunction &QVec, Vector &diag)
95{
96 switch (dim)
97 {
98 case 2:
99 ElasticityAssembleDiagonalPA_<2>(nDofs, lambda, mu, geom, maps, QVec, diag);
100 break;
101 case 3:
102 ElasticityAssembleDiagonalPA_<3>(nDofs, lambda, mu, geom, maps, QVec, diag);
103 break;
104 default:
105 MFEM_ABORT("Only dimensions 2 and 3 supported.");
106 }
107}
108
109void ElasticityAssembleEA(const int dim, const int i_block, const int j_block,
110 const int nDofs, const IntegrationRule &ir,
111 const CoefficientVector &lambda,
112 const CoefficientVector &mu, const GeometricFactors &geom,
113 const DofToQuad &maps, Vector &emat)
114{
115 switch (dim)
116 {
117 case 2:
118 ElasticityAssembleEA_<2>(i_block, j_block, nDofs, ir, lambda, mu, geom, maps,
119 emat);
120 break;
121 case 3:
122 ElasticityAssembleEA_<3>(i_block, j_block, nDofs, ir, lambda, mu, geom, maps,
123 emat);
124 break;
125 default:
126 MFEM_ABORT("Only dimensions 2 and 3 supported.");
127 }
128}
129
130} // namespace internal
131
132} // namespace mfem
Header for small strain, isotropic, linear elasticity kernels.
int dim
Definition ex24.cpp:53
real_t mu
Definition ex25.cpp:140