42 for (
int ii = 0; ii != 4; ++ii) {
43 t_diff_n[ii](
i) = t_diff_n_tmp(
i);
51 auto get_ksi = [](
const T n0,
const T n1) {
52 if constexpr (ccg_ksi_type == AinsworthHdivOptions::EdgeCoordinate::PAPER) {
54 }
else if constexpr (ccg_ksi_type ==
55 AinsworthHdivOptions::EdgeCoordinate::ENDPOINT_O) {
56 return T(1) - T(2) * n0;
58 }
else if constexpr (ccg_ksi_type ==
59 AinsworthHdivOptions::EdgeCoordinate::ENDPOINT_I) {
60 return T(2) * n1 - T(1);
67 for (
int dd = 0;
dd != 3; ++
dd) {
68 if constexpr (ccg_ksi_type ==
69 AinsworthHdivOptions::EdgeCoordinate::PAPER) {
70 t_diff_ksi(
dd) = t_diff_n[n1](
dd) - t_diff_n[n0](
dd);
71 }
else if constexpr (ccg_ksi_type ==
72 AinsworthHdivOptions::EdgeCoordinate::ENDPOINT_O) {
73 t_diff_ksi(
dd) = -T(2) * t_diff_n[n0](
dd);
74 }
else if constexpr (ccg_ksi_type ==
75 AinsworthHdivOptions::EdgeCoordinate::ENDPOINT_I) {
76 t_diff_ksi(
dd) = T(2) * t_diff_n[n1](
dd);
83 for (
int ii = 0; ii != 3; ++ii)
86 int lp = p >= 2 ? p - 2 + 1 : 0;
94 for (
int ii = 0; ii != 3; ++ii)
97 for (
int gg = 0; gg != gdim; ++gg) {
99 const int node_shift = gg * 4;
101 for (
int ii = 0; ii != 3; ++ii) {
103 auto &t_diff_ksi_ii = t_diff_ksi[ii];
105 auto &diff_l_ii = diff_l[ii];
106 auto &diff2_l_ii = diff2_l[ii];
107 const T ksi_ii =
get_ksi(
N[node_shift],
N[node_shift + ii + 1]);
109 &*l_ii.data().begin(),
110 &*diff_l_ii.data().begin(), 3);
112 for (
int l = 1;
l < lp; ++
l) {
113 const T
a = ((2 * (T)
l + 1) / ((T)
l + 1));
114 const T b = ((T)
l / ((T)
l + 1));
115 for (
int d0 = 0; d0 != 3; ++d0)
116 for (
int d1 = 0; d1 != 3; ++d1) {
117 const int r = 3 * d0 + d1;
118 diff2_l_ii(r,
l + 1) =
a * (t_diff_ksi_ii(d0) * diff_l_ii(d1,
l) +
119 t_diff_ksi_ii(d1) * diff_l_ii(d0,
l) +
120 ksi_ii * diff2_l_ii(r,
l)) -
121 b * diff2_l_ii(r,
l - 1);
126 const T
n[] = {
N[node_shift + 0],
N[node_shift + 1],
N[node_shift + 2],
131 const int tab[4][4] = {
132 {1, 2, 3, 0}, {2, 3, 0, 1}, {3, 0, 1, 2}, {0, 1, 2, 3}};
134 t_bk_diff(
i,
j,
k) = 0;
135 for (
int ii = 0; ii != 4; ++ii) {
136 const int i0 = tab[ii][0];
137 const int i1 = tab[ii][1];
138 const int i2 = tab[ii][2];
139 const int i3 = tab[ii][3];
140 auto &t_diff_n_i0 = t_diff_n[i0];
141 auto &t_diff_n_i1 = t_diff_n[i1];
142 auto &t_diff_n_i2 = t_diff_n[i2];
143 auto &t_diff_n_i3 = t_diff_n[i3];
145 t_k(
i,
j) = t_diff_n_i3(
i) * t_diff_n_i3(
j);
146 const T b =
n[i0] *
n[i1] *
n[i2];
147 t_bk(
i,
j) += b * t_k(
i,
j);
149 t_diff_b(
i) = t_diff_n_i0(
i) *
n[i1] *
n[i2] +
150 t_diff_n_i1(
i) *
n[i0] *
n[i2] +
151 t_diff_n_i2(
i) *
n[i0] *
n[i1];
152 t_bk_diff(
i,
j,
k) += t_k(
i,
j) * t_diff_b(
k);
156 for (
int o = p - 2 + 1; o <= p - 2 + 1; ++o) {
158 for (
int ii = 0; ii <= o; ++ii)
159 for (
int jj = 0; (ii + jj) <= o; ++jj) {
161 const int kk = o - ii - jj;
163 auto get_diff_l = [&](
const int y,
const int i) {
167 auto get_diff2_l = [&](
const int y,
const int i) {
169 diff2_l[y](0,
i), diff2_l[y](1,
i), diff2_l[y](2,
i),
170 diff2_l[y](3,
i), diff2_l[y](4,
i), diff2_l[y](5,
i),
171 diff2_l[y](6,
i), diff2_l[y](7,
i), diff2_l[y](8,
i));
175 auto t_diff_i = get_diff_l(0, ii);
176 auto t_diff2_i = get_diff2_l(0, ii);
178 auto t_diff_j = get_diff_l(1, jj);
179 auto t_diff2_j = get_diff2_l(1, jj);
181 auto t_diff_k = get_diff_l(2, kk);
182 auto t_diff2_k = get_diff2_l(2, kk);
185 t_diff_l2(
i) = t_diff_i(
i) * l_j * l_k + t_diff_j(
i) * l_i * l_k +
186 t_diff_k(
i) * l_i * l_j;
189 t_diff2_i(
i,
j) * l_j * l_k + t_diff_i(
i) * t_diff_j(
j) * l_k +
190 t_diff_i(
i) * l_j * t_diff_k(
j) +
192 t_diff2_j(
i,
j) * l_i * l_k + t_diff_j(
i) * t_diff_i(
j) * l_k +
193 t_diff_j(
i) * l_i * t_diff_k(
j) +
195 t_diff2_k(
i,
j) * l_i * l_j + t_diff_k(
i) * t_diff_i(
j) * l_j +
196 t_diff_k(
i) * l_i * t_diff_j(
j);
198 for (
int dd = 0;
dd != 3; ++
dd) {
201 t_axial_diff(
i,
j) = 0;
202 for (
int mm = 0; mm != 3; ++mm)
203 t_axial_diff(
dd, mm) = t_diff_l2(mm);
210 levi_civita<double>(
i,
j,
m) * t_axial_diff(
m,
k);
212 t_curl_A(
i,
j) = levi_civita<double>(
j,
m, f) * t_A_diff(
i, f,
m);
214 t_curl_A_bK_diff(
i,
j,
k) = t_curl_A(
i,
m) * t_bk_diff(
m,
j,
k);
217 t_axial_diff2(
i,
j,
k) = 0;
218 for (
int mm = 0; mm != 3; ++mm)
219 for (
int nn = 0; nn != 3; ++nn)
220 t_axial_diff2(
dd, mm, nn) = t_diff2_l2(mm, nn);
222 t_A_diff2(
i,
j,
k, f) =
223 levi_civita<double>(
i,
j,
m) * t_axial_diff2(
m,
k, f);
225 t_curl_A_diff2(
i,
j,
k) =
226 levi_civita<double>(
j,
m, f) * t_A_diff2(
i, f,
m,
k);
228 t_curl_A_diff2_bK(
i,
j,
k) = t_curl_A_diff2(
i,
m,
k) * t_bk(
m,
j);
231 levi_civita<double>(
j,
m, f) *
232 (t_curl_A_bK_diff(
i, f,
m) + t_curl_A_diff2_bK(
i, f,
m));
242 "Wrong number of base functions %d != %d", zz,
254 return CGG_BubbleBase_MBTET_Impl<double>(p,
N, diffN, t_phi, gdim);
258 const int p,
const std::complex<double> *
N,
259 const std::complex<double> *diffN,
262 return CGG_BubbleBase_MBTET_Impl<std::complex<double>>(p,
N, diffN, t_phi,
Implementation of tonsorial bubble base div(v) = 0.
#define NBVOLUMETET_CCG_BUBBLE(P)
Bubble function for CGG H div space.
static double get_ksi(const double n0, const double n1)
static FTensor::Tensor1< double, 3 > get_diff_ksi(const double *diffN, const int n0, const int n1)
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ MOFEM_DATA_INCONSISTENCY
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
PetscErrorCode Legendre_polynomials(int p, double s, double *diff_s, double *L, double *diffL, int dim)
Calculate Legendre approximation basis.
Functions to approximate hierarchical spaces.
FTensor::Index< 'i', SPACE_DIM > i
const double n
refractive index of diffusive medium
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
MoFEMErrorCode CGG_BubbleBase_MBTET(const int p, const double *N, const double *diffN, FTensor::Tensor2< FTensor::PackPtr< double *, 9 >, 3, 3 > &phi, const int gdim)
Calculate CGGT tonsorial bubble base.
MoFEMErrorCode CGG_BubbleBase_MBTET_Impl(const int p, const T *N, const T *diffN, Tensor2< PackPtr< T *, 9 >, 3, 3 > &t_phi, const int gdim)
Tensors class implemented by Walter Landry.
constexpr std::enable_if<(Dim0<=2 &&Dim1<=2), Tensor2_Expr< Levi_Civita< T >, T, Dim0, Dim1, i, j > >::type levi_civita(const Index< i, Dim0 > &, const Index< j, Dim1 > &)
levi_civita functions to make for easy adhoc use
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
ublas::vector< T, VecAllocator< T > > UBlasVector
UBlasMatrix< double > MatrixDouble
UBlasVector< double > VectorDouble
ublas::matrix< T, ublas::row_major, VecAllocator< T > > UBlasMatrix
implementation of Data Operators for Forces and Sources
FTensor::Index< 'm', 3 > m
EdgeCoordinate
Auxiliary edge coordinate used in Ainsworth H(div) functions.
static constexpr EdgeCoordinate edge_coordinate
Selected edge coordinate variant.