OGS
ProcessLib::NonLinearBMatrix Namespace Reference

Functions

template<int DisplacementDim, int NPOINTS, typename BMatrixType , typename GradientVectorType , typename N_Type , typename DNDX_Type >
BMatrixType computeBMatrix (DNDX_Type const &dNdx, N_Type const &N, GradientVectorType const &grad_u, const double radius, const bool is_axially_symmetric)

◆ computeBMatrix()

template<int DisplacementDim, int NPOINTS, typename BMatrixType , typename GradientVectorType , typename N_Type , typename DNDX_Type >
 BMatrixType ProcessLib::NonLinearBMatrix::computeBMatrix ( DNDX_Type const & dNdx, N_Type const & N, GradientVectorType const & grad_u, const double radius, const bool is_axially_symmetric )

Fills a non linear B-matrix based on given shape function dN/dx values and displacement gradient.

Definition at line 29 of file NonLinearBMatrix.h.

34{
35 static_assert(0 < DisplacementDim && DisplacementDim <= 3,
36 "NonLinearBMatrix::computeBMatrix: DisplacementDim must be "
37 "in range [1,3].");
38
39 BMatrixType B = BMatrixType::Zero(
41 NPOINTS * DisplacementDim);
42
43 switch (DisplacementDim)
44 {
45 case 3:
46 for (int i = 0; i < NPOINTS; ++i)
47 {
48 B(0, i) = dNdx(0, i) * grad_u[0];
49 B(1, i) = dNdx(1, i) * grad_u[1];
50 B(2, i) = dNdx(2, i) * grad_u[2];
51
52 B(0, NPOINTS + i) = dNdx(0, i) * grad_u[3];
53 B(1, NPOINTS + i) = dNdx(1, i) * grad_u[4];
54 B(2, NPOINTS + i) = dNdx(2, i) * grad_u[5];
55
56 B(0, 2 * NPOINTS + i) = dNdx(0, i) * grad_u[6];
57 B(1, 2 * NPOINTS + i) = dNdx(1, i) * grad_u[7];
58 B(2, 2 * NPOINTS + i) = dNdx(2, i) * grad_u[8];
59
60 B(3, i) = (dNdx(1, i) * grad_u[0] + dNdx(0, i) * grad_u[1]) /
61 std::sqrt(2);
62 B(4, i) = (dNdx(2, i) * grad_u[1] + dNdx(1, i) * grad_u[2]) /
63 std::sqrt(2);
64 B(5, i) = (dNdx(2, i) * grad_u[0] + dNdx(0, i) * grad_u[2]) /
65 std::sqrt(2);
66
67 B(3, NPOINTS + i) =
69 std::sqrt(2);
70 B(4, NPOINTS + i) =
72 std::sqrt(2);
73 B(5, NPOINTS + i) =
75 std::sqrt(2);
76
77 B(3, 2 * NPOINTS + i) =
79 std::sqrt(2);
80 B(4, 2 * NPOINTS + i) =
82 std::sqrt(2);
83 B(5, 2 * NPOINTS + i) =
85 std::sqrt(2);
86 }
87 break;
88 case 2:
89 for (int i = 0; i < NPOINTS; ++i)
90 {
91 B(0, i) = dNdx(0, i) * grad_u[0];
92 B(1, i) = dNdx(1, i) * grad_u[1];
93 // B(2, i) = 0;
94
95 B(0, NPOINTS + i) = dNdx(0, i) * grad_u[2];
96 B(1, NPOINTS + i) = dNdx(1, i) * grad_u[3];
97 // B(2, NPOINTS + i) = 0;
98
99 B(3, i) = (dNdx(1, i) * grad_u[0] + dNdx(0, i) * grad_u[1]) /
100 std::sqrt(2);
101 B(3, NPOINTS + i) =
103 std::sqrt(2);
104 }
105 if (is_axially_symmetric)
106 {
107 for (int i = 0; i < NPOINTS; ++i)
108 {