v0.13.1
Public Member Functions | Public Attributes | List of all members
ConvectiveMassElement::OpEshelbyDynamicMaterialMomentumJacobian Struct Reference

#include <users_modules/basic_finite_elements/src/ConvectiveMassElement.hpp>

Inheritance diagram for ConvectiveMassElement::OpEshelbyDynamicMaterialMomentumJacobian:
[legend]
Collaboration diagram for ConvectiveMassElement::OpEshelbyDynamicMaterialMomentumJacobian:
[legend]

Public Member Functions

 OpEshelbyDynamicMaterialMomentumJacobian (const std::string field_name, BlockData &data, CommonData &common_data, int tag, bool jacobian=true)
 
MoFEMErrorCode doWork (int row_side, EntityType row_type, EntitiesFieldData::EntData &row_data)
 

Public Attributes

BlockDatadAta
 
CommonDatacommonData
 
int tAg
 
bool jAcobian
 
bool fieldDisp
 
VectorBoundedArray< adouble, 3 > a
 
VectorBoundedArray< adouble, 3 > v
 
VectorBoundedArray< adouble, 3 > a_T
 
MatrixBoundedArray< adouble, 9 > g
 
MatrixBoundedArray< adouble, 9 > H
 
MatrixBoundedArray< adouble, 9 > invH
 
MatrixBoundedArray< adouble, 9 > h
 
MatrixBoundedArray< adouble, 9 > F
 
MatrixBoundedArray< adouble, 9 > G
 
VectorDouble active
 

Detailed Description

Definition at line 347 of file ConvectiveMassElement.hpp.

Constructor & Destructor Documentation

◆ OpEshelbyDynamicMaterialMomentumJacobian()

ConvectiveMassElement::OpEshelbyDynamicMaterialMomentumJacobian::OpEshelbyDynamicMaterialMomentumJacobian ( const std::string  field_name,
BlockData data,
CommonData common_data,
int  tag,
bool  jacobian = true 
)

Member Function Documentation

◆ doWork()

MoFEMErrorCode ConvectiveMassElement::OpEshelbyDynamicMaterialMomentumJacobian::doWork ( int  row_side,
EntityType  row_type,
EntitiesFieldData::EntData row_data 
)

Definition at line 1247 of file ConvectiveMassElement.cpp.

1249 {
1251
1252 if (dAta.tEts.find(getNumeredEntFiniteElementPtr()->getEnt()) ==
1253 dAta.tEts.end()) {
1255 }
1256
1257 // do it only once, no need to repeat this for edges,faces or tets
1258 if (row_type != MBVERTEX)
1260
1261 int nb_dofs = row_data.getIndices().size();
1262 if (nb_dofs == 0)
1264
1265 try {
1266
1267 a.resize(3);
1268 v.resize(3);
1269 g.resize(3, 3);
1270 G.resize(3, 3);
1271 h.resize(3, 3);
1272 F.resize(3, 3);
1273 H.resize(3, 3);
1274 H.clear();
1275 invH.resize(3, 3);
1276 invH.clear();
1277 for (int dd = 0; dd < 3; dd++) {
1278 H(dd, dd) = 1;
1279 invH(dd, dd) = 1;
1280 }
1281
1282 int nb_gauss_pts = row_data.getN().size1();
1283 commonData.valT.resize(nb_gauss_pts);
1284 commonData.jacTRowPtr.resize(nb_gauss_pts);
1285 commonData.jacT.resize(nb_gauss_pts);
1286
1287 int nb_active_vars = 0;
1288 for (int gg = 0; gg < nb_gauss_pts; gg++) {
1289
1290 if (gg == 0) {
1291
1292 trace_on(tAg);
1293
1294 for (int nn1 = 0; nn1 < 3; nn1++) { // 0
1295 a[nn1] <<=
1297 [gg][nn1];
1298 nb_active_vars++;
1299 }
1300
1301 for (int nn1 = 0; nn1 < 3; nn1++) { // 3
1302 v[nn1] <<=
1304 nb_active_vars++;
1305 }
1306 for (int nn1 = 0; nn1 < 3; nn1++) { // 3+3
1307 for (int nn2 = 0; nn2 < 3; nn2++) {
1308 g(nn1, nn2) <<=
1310 nn1, nn2);
1311 nb_active_vars++;
1312 }
1313 }
1314 for (int nn1 = 0; nn1 < 3; nn1++) { // 3+3+9
1315 for (int nn2 = 0; nn2 < 3; nn2++) {
1316 h(nn1, nn2) <<=
1318 nn2);
1319 nb_active_vars++;
1320 if (fieldDisp) {
1321 if (nn1 == nn2) {
1322 h(nn1, nn2) += 1;
1323 }
1324 }
1325 }
1326 }
1328 for (int nn1 = 0; nn1 < 3; nn1++) { // 3+3+9+9
1329 for (int nn2 = 0; nn2 < 3; nn2++) {
1330 H(nn1, nn2) <<=
1332 nn2);
1333 nb_active_vars++;
1334 }
1335 }
1336 }
1337 adouble detH;
1338 detH = 1;
1340 detH = determinantTensor3by3(H);
1341 }
1342 CHKERR invertTensor3by3(H, detH, invH);
1343
1347
1348 a_T.resize(3);
1349
1355
1356 auto t_a = FTensor::Tensor1<adouble *, 3>{&a[0], &a[1], &a[2]};
1357 auto t_v = FTensor::Tensor1<adouble *, 3>{&v[0], &v[1], &v[2]};
1358 auto t_a_T = FTensor::Tensor1<adouble *, 3>{&a_T[0], &a_T[1], &a_T[2]};
1359
1360 t_F(i, j) = t_h(i, k) * t_invH(k, j);
1361 t_G(i, j) = t_g(i, k) * t_invH(k, j);
1362 t_a_T(i) = t_F(k, i) * t_a(k) + t_G(k, i) * t_v(k);
1363 const auto rho0 = dAta.rho0;
1364 t_a_T(i) = -rho0 * detH;
1365
1366 commonData.valT[gg].resize(3);
1367 for (int nn = 0; nn < 3; nn++) {
1368 a_T[nn] >>= (commonData.valT[gg])[nn];
1369 }
1370 trace_off();
1371 }
1372
1373 active.resize(nb_active_vars);
1374 int aa = 0;
1375 for (int nn1 = 0; nn1 < 3; nn1++) { // 0
1376 active[aa++] =
1378 .dataAtGaussPts["DOT_" + commonData.spatialVelocities][gg][nn1];
1379 }
1380
1381 for (int nn1 = 0; nn1 < 3; nn1++) { // 3
1382 active[aa++] =
1384 }
1385 for (int nn1 = 0; nn1 < 3; nn1++) { // 3+3
1386 for (int nn2 = 0; nn2 < 3; nn2++) {
1387 active[aa++] =
1389 nn2);
1390 }
1391 }
1392 for (int nn1 = 0; nn1 < 3; nn1++) { // 3+3+9
1393 for (int nn2 = 0; nn2 < 3; nn2++) {
1394 if (fieldDisp && nn1 == nn2) {
1395 active[aa++] =
1397 nn1, nn2) +
1398 1;
1399 } else {
1400 active[aa++] =
1402 nn2);
1403 }
1404 }
1405 }
1407 for (int nn1 = 0; nn1 < 3; nn1++) { // 3+3+9+9
1408 for (int nn2 = 0; nn2 < 3; nn2++) {
1409 active[aa++] =
1411 nn2);
1412 }
1413 }
1414 }
1415
1416 if (!jAcobian) {
1417 VectorDouble &res = commonData.valT[gg];
1418 if (gg > 0) {
1419 res.resize(3);
1420 int r;
1421 r = ::function(tAg, 3, nb_active_vars, &active[0], &res[0]);
1422 if (r != 3) { // function is locally analytic
1423 SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
1424 "ADOL-C function evaluation with error r = %d", r);
1425 }
1426 }
1427 double val = getVolume() * getGaussPts()(3, gg);
1428 res *= val;
1429 } else {
1430 commonData.jacTRowPtr[gg].resize(3);
1431 commonData.jacT[gg].resize(3, nb_active_vars);
1432 for (int nn1 = 0; nn1 < 3; nn1++) {
1433 (commonData.jacTRowPtr[gg])[nn1] = &(commonData.jacT[gg](nn1, 0));
1434 }
1435 int r;
1436 r = jacobian(tAg, 3, nb_active_vars, &active[0],
1437 &(commonData.jacTRowPtr[gg])[0]);
1438 if (r != 3) {
1439 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
1440 "ADOL-C function evaluation with error");
1441 }
1442 double val = getVolume() * getGaussPts()(3, gg);
1443 commonData.jacT[gg] *= val;
1444 }
1445 }
1446
1447 } catch (const std::exception &ex) {
1448 std::ostringstream ss;
1449 ss << "throw in method: " << ex.what() << std::endl;
1450 SETERRQ(PETSC_COMM_SELF, 1, ss.str().c_str());
1451 }
1452
1454}
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
@ MOFEM_OPERATION_UNSUCCESSFUL
Definition: definitions.h:34
#define CHKERR
Inline error check.
Definition: definitions.h:535
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
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)
Definition: ddTensor0.hpp:33
UBlasVector< double > VectorDouble
Definition: Types.hpp:68
auto getFTensor2FromArray3by3(ublas::matrix< T, L, A > &data, const FTensor::Number< S > &, const size_t rr)
Definition: Templates.hpp:972
MoFEMErrorCode invertTensor3by3(ublas::matrix< T, L, A > &jac_data, ublas::vector< T, A > &det_data, ublas::matrix< T, L, A > &inv_jac_data)
Calculate inverse of tensor rank 2 at integration points.
Definition: Templates.hpp:1204
static auto determinantTensor3by3(T &t)
Calculate the determinant of a 3x3 matrix or a tensor of rank 2.
Definition: Templates.hpp:1193
const double r
rate factor
std::vector< std::vector< double * > > jacTRowPtr
std::map< std::string, std::vector< VectorDouble > > dataAtGaussPts
std::map< std::string, std::vector< MatrixDouble > > gradAtGaussPts
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
const VectorInt & getIndices() const
Get global indices of dofs on entity.

Member Data Documentation

◆ a

VectorBoundedArray<adouble, 3> ConvectiveMassElement::OpEshelbyDynamicMaterialMomentumJacobian::a

Definition at line 362 of file ConvectiveMassElement.hpp.

◆ a_T

VectorBoundedArray<adouble, 3> ConvectiveMassElement::OpEshelbyDynamicMaterialMomentumJacobian::a_T

Definition at line 362 of file ConvectiveMassElement.hpp.

◆ active

VectorDouble ConvectiveMassElement::OpEshelbyDynamicMaterialMomentumJacobian::active

Definition at line 364 of file ConvectiveMassElement.hpp.

◆ commonData

CommonData& ConvectiveMassElement::OpEshelbyDynamicMaterialMomentumJacobian::commonData

Definition at line 352 of file ConvectiveMassElement.hpp.

◆ dAta

BlockData& ConvectiveMassElement::OpEshelbyDynamicMaterialMomentumJacobian::dAta

Definition at line 351 of file ConvectiveMassElement.hpp.

◆ F

MatrixBoundedArray<adouble, 9> ConvectiveMassElement::OpEshelbyDynamicMaterialMomentumJacobian::F

Definition at line 363 of file ConvectiveMassElement.hpp.

◆ fieldDisp

bool ConvectiveMassElement::OpEshelbyDynamicMaterialMomentumJacobian::fieldDisp

Definition at line 355 of file ConvectiveMassElement.hpp.

◆ g

MatrixBoundedArray<adouble, 9> ConvectiveMassElement::OpEshelbyDynamicMaterialMomentumJacobian::g

Definition at line 363 of file ConvectiveMassElement.hpp.

◆ G

MatrixBoundedArray<adouble, 9> ConvectiveMassElement::OpEshelbyDynamicMaterialMomentumJacobian::G

Definition at line 363 of file ConvectiveMassElement.hpp.

◆ H

MatrixBoundedArray<adouble, 9> ConvectiveMassElement::OpEshelbyDynamicMaterialMomentumJacobian::H

Definition at line 363 of file ConvectiveMassElement.hpp.

◆ h

MatrixBoundedArray<adouble, 9> ConvectiveMassElement::OpEshelbyDynamicMaterialMomentumJacobian::h

Definition at line 363 of file ConvectiveMassElement.hpp.

◆ invH

MatrixBoundedArray<adouble, 9> ConvectiveMassElement::OpEshelbyDynamicMaterialMomentumJacobian::invH

Definition at line 363 of file ConvectiveMassElement.hpp.

◆ jAcobian

bool ConvectiveMassElement::OpEshelbyDynamicMaterialMomentumJacobian::jAcobian

Definition at line 354 of file ConvectiveMassElement.hpp.

◆ tAg

int ConvectiveMassElement::OpEshelbyDynamicMaterialMomentumJacobian::tAg

Definition at line 353 of file ConvectiveMassElement.hpp.

◆ v

VectorBoundedArray<adouble, 3> ConvectiveMassElement::OpEshelbyDynamicMaterialMomentumJacobian::v

Definition at line 362 of file ConvectiveMassElement.hpp.


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