v0.15.0
Loading...
Searching...
No Matches
OpULhs_dU Struct Reference
Inheritance diagram for OpULhs_dU:
[legend]
Collaboration diagram for OpULhs_dU:
[legend]

Public Member Functions

 OpULhs_dU (const std::string field_name_row, const std::string field_name_col, boost::shared_ptr< MatrixDouble > u_ptr, boost::shared_ptr< MatrixDouble > grad_u_ptr)
 
MoFEMErrorCode iNtegrate (EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 

Private Attributes

boost::shared_ptr< MatrixDoubleuPtr
 
boost::shared_ptr< MatrixDoubleuGradPtr
 

Detailed Description

Examples
shallow_wave.cpp.

Definition at line 168 of file shallow_wave.cpp.

Constructor & Destructor Documentation

◆ OpULhs_dU()

OpULhs_dU::OpULhs_dU ( const std::string field_name_row,
const std::string field_name_col,
boost::shared_ptr< MatrixDouble > u_ptr,
boost::shared_ptr< MatrixDouble > grad_u_ptr )
inline
Examples
shallow_wave.cpp.

Definition at line 170 of file shallow_wave.cpp.

173 : AssemblyDomainEleOp(field_name_row, field_name_col,
174 AssemblyDomainEleOp::OPROWCOL),
175 uPtr(u_ptr), uGradPtr(grad_u_ptr) {
176 this->sYmm = false;
177 }
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::OpBase AssemblyDomainEleOp
boost::shared_ptr< MatrixDouble > uPtr
boost::shared_ptr< MatrixDouble > uGradPtr

Member Function Documentation

◆ iNtegrate()

MoFEMErrorCode OpULhs_dU::iNtegrate ( EntitiesFieldData::EntData & row_data,
EntitiesFieldData::EntData & col_data )
inline
Examples
shallow_wave.cpp.

Definition at line 179 of file shallow_wave.cpp.

180 {
182
183 const double vol = getMeasure();
184 auto t_w = getFTensor0IntegrationWeight();
185 auto t_row_base = row_data.getFTensor0N();
186 auto t_row_diff_base = row_data.getFTensor1DiffN<3>();
187 auto t_coords = getFTensor1CoordsAtGaussPts();
188 auto t_normal = getFTensor1NormalsAtGaussPts();
189
190 auto t_u = getFTensor1FromMat<3>(*uPtr);
191 auto t_grad_u = getFTensor2FromMat<3, 3>(*uGradPtr);
192
193 auto get_t_mat = [&](const int rr) {
195 &locMat(rr + 0, 0), &locMat(rr + 0, 1), &locMat(rr + 0, 2),
196
197 &locMat(rr + 1, 0), &locMat(rr + 1, 1), &locMat(rr + 1, 2),
198
199 &locMat(rr + 2, 0), &locMat(rr + 2, 1), &locMat(rr + 2, 2)};
200 };
201
202 const auto ts_a = getFEMethod()->ts_a;
203
204 for (int gg = 0; gg != nbIntegrationPts; gg++) {
205
206 const auto a = std::sqrt(t_coords(i) * t_coords(i));
207 const auto sin_fi = t_coords(2) / a;
208 const auto f = 2 * omega * sin_fi;
209
211 t_r(i) = t_normal(i);
212 t_r.normalize();
213
214 constexpr auto t_kd = FTensor::Kronecker_Delta<double>();
216 t_P(i, j) = t_r(i) * t_r(j);
217 t_Q(i, j) = t_kd(i, j) - t_P(i, j);
218
220 t_A(i, m) = levi_civita(i, j, m) * t_r(j);
221
223 t_rhs_du(m, j) =
224 t_Q(m, i) * (ts_a * t_kd(i, j) + t_grad_u(i, j) + f * t_A(i, j)) +
225 t_P(m, j);
226
227 const double alpha = t_w * vol;
228
229 int rr = 0;
230 for (; rr != nbRows / 3; rr++) {
231
232 auto t_col_base = col_data.getFTensor0N(gg, 0);
233 auto t_col_diff_base = col_data.getFTensor1DiffN<3>(gg, 0);
234 auto t_mat = get_t_mat(3 * rr);
235
236 for (int cc = 0; cc != nbCols / 3; cc++) {
237 t_mat(i, j) += (alpha * t_row_base * t_col_base) * t_rhs_du(i, j);
238 t_mat(i, j) += (alpha * mu) * t_Q(i, j) *
239 (t_row_diff_base(m) * t_col_diff_base(m));
240 ++t_col_diff_base;
241 ++t_col_base;
242 ++t_mat;
243 }
244 ++t_row_base;
245 ++t_row_diff_base;
246 }
247 for (; rr < nbRowBaseFunctions; ++rr) {
248 ++t_row_base;
249 ++t_row_diff_base;
250 }
251
252 ++t_w;
253 ++t_coords;
254 ++t_normal;
255 ++t_u;
256 ++t_grad_u;
257 }
258
260 }
constexpr double a
Kronecker Delta class.
Tensor1< T, Tensor_Dim > normalize()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
constexpr auto t_kd
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
FTensor::Tensor1< FTensor::PackPtr< T *, S >, Tensor_Dim > getFTensor1FromMat(ublas::matrix< T, L, A > &data)
Get tensor rank 1 (vector) form data matrix.
FTensor::Tensor2< FTensor::PackPtr< double *, 1 >, Tensor_Dim1, Tensor_Dim2 > getFTensor2FromMat(MatrixDouble &data)
Get tensor rank 2 (matrix) form data matrix.
constexpr double mu
FTensor::Index< 'j', 3 > j
constexpr double omega
FTensor::Index< 'i', 3 > i
FTensor::Index< 'm', 3 > m
FTensor::Tensor1< FTensor::PackPtr< double *, Tensor_Dim >, Tensor_Dim > getFTensor1DiffN(const FieldApproximationBase base)
Get derivatives of base functions.
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.

Member Data Documentation

◆ uGradPtr

boost::shared_ptr<MatrixDouble> OpULhs_dU::uGradPtr
private
Examples
shallow_wave.cpp.

Definition at line 264 of file shallow_wave.cpp.

◆ uPtr

boost::shared_ptr<MatrixDouble> OpULhs_dU::uPtr
private
Examples
shallow_wave.cpp.

Definition at line 263 of file shallow_wave.cpp.


The documentation for this struct was generated from the following file: