v0.15.0
Loading...
Searching...
No Matches
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 1245 of file ConvectiveMassElement.cpp.

1246 {
1248
1249 if (dAta.tEts.find(getNumeredEntFiniteElementPtr()->getEnt()) ==
1250 dAta.tEts.end()) {
1252 }
1253
1254 // do it only once, no need to repeat this for edges,faces or tets
1255 if (row_type != MBVERTEX)
1257
1258 int nb_dofs = row_data.getIndices().size();
1259 if (nb_dofs == 0)
1261
1262 try {
1263
1264 a.resize(3);
1265 v.resize(3);
1266 g.resize(3, 3);
1267 G.resize(3, 3);
1268 h.resize(3, 3);
1269 F.resize(3, 3);
1270 H.resize(3, 3);
1271 H.clear();
1272 invH.resize(3, 3);
1273 invH.clear();
1274 for (int dd = 0; dd < 3; dd++) {
1275 H(dd, dd) = 1;
1276 invH(dd, dd) = 1;
1277 }
1278
1279 int nb_gauss_pts = row_data.getN().size1();
1280 commonData.valT.resize(nb_gauss_pts);
1281 commonData.jacTRowPtr.resize(nb_gauss_pts);
1282 commonData.jacT.resize(nb_gauss_pts);
1283
1284 int nb_active_vars = 0;
1285 for (int gg = 0; gg < nb_gauss_pts; gg++) {
1286
1287 if (gg == 0) {
1288
1289 trace_on(tAg);
1290
1291 for (int nn1 = 0; nn1 < 3; nn1++) { // 0
1292 a[nn1] <<=
1294 [gg][nn1];
1295 nb_active_vars++;
1296 }
1297
1298 for (int nn1 = 0; nn1 < 3; nn1++) { // 3
1299 v[nn1] <<=
1301 nb_active_vars++;
1302 }
1303 for (int nn1 = 0; nn1 < 3; nn1++) { // 3+3
1304 for (int nn2 = 0; nn2 < 3; nn2++) {
1305 g(nn1, nn2) <<=
1307 nn1, nn2);
1308 nb_active_vars++;
1309 }
1310 }
1311 for (int nn1 = 0; nn1 < 3; nn1++) { // 3+3+9
1312 for (int nn2 = 0; nn2 < 3; nn2++) {
1313 h(nn1, nn2) <<=
1315 nn2);
1316 nb_active_vars++;
1317 if (fieldDisp) {
1318 if (nn1 == nn2) {
1319 h(nn1, nn2) += 1;
1320 }
1321 }
1322 }
1323 }
1325 for (int nn1 = 0; nn1 < 3; nn1++) { // 3+3+9+9
1326 for (int nn2 = 0; nn2 < 3; nn2++) {
1327 H(nn1, nn2) <<=
1329 nn2);
1330 nb_active_vars++;
1331 }
1332 }
1333 }
1334 adouble detH;
1335 detH = 1;
1337 detH = determinantTensor3by3(H);
1338 }
1339 CHKERR invertTensor3by3(H, detH, invH);
1340
1341 FTensor::Index<'i', 3> i;
1342 FTensor::Index<'j', 3> j;
1343 FTensor::Index<'k', 3> k;
1344
1345 a_T.resize(3);
1346
1351 auto t_G = getFTensor2FromArray3by3(G, FTensor::Number<0>(), 0);
1352
1353 auto t_a = FTensor::Tensor1<adouble *, 3>{&a[0], &a[1], &a[2]};
1354 auto t_v = FTensor::Tensor1<adouble *, 3>{&v[0], &v[1], &v[2]};
1355 auto t_a_T = FTensor::Tensor1<adouble *, 3>{&a_T[0], &a_T[1], &a_T[2]};
1356
1357 t_F(i, j) = t_h(i, k) * t_invH(k, j);
1358 t_G(i, j) = t_g(i, k) * t_invH(k, j);
1359 t_a_T(i) = t_F(k, i) * t_a(k) + t_G(k, i) * t_v(k);
1360 const auto rho0 = dAta.rho0;
1361 t_a_T(i) = -rho0 * detH;
1362
1363 commonData.valT[gg].resize(3);
1364 for (int nn = 0; nn < 3; nn++) {
1365 a_T[nn] >>= (commonData.valT[gg])[nn];
1366 }
1367 trace_off();
1368 }
1369
1370 active.resize(nb_active_vars);
1371 int aa = 0;
1372 for (int nn1 = 0; nn1 < 3; nn1++) { // 0
1373 active[aa++] =
1375 .dataAtGaussPts["DOT_" + commonData.spatialVelocities][gg][nn1];
1376 }
1377
1378 for (int nn1 = 0; nn1 < 3; nn1++) { // 3
1379 active[aa++] =
1381 }
1382 for (int nn1 = 0; nn1 < 3; nn1++) { // 3+3
1383 for (int nn2 = 0; nn2 < 3; nn2++) {
1384 active[aa++] =
1386 nn2);
1387 }
1388 }
1389 for (int nn1 = 0; nn1 < 3; nn1++) { // 3+3+9
1390 for (int nn2 = 0; nn2 < 3; nn2++) {
1391 if (fieldDisp && nn1 == nn2) {
1392 active[aa++] =
1394 nn1, nn2) +
1395 1;
1396 } else {
1397 active[aa++] =
1399 nn2);
1400 }
1401 }
1402 }
1404 for (int nn1 = 0; nn1 < 3; nn1++) { // 3+3+9+9
1405 for (int nn2 = 0; nn2 < 3; nn2++) {
1406 active[aa++] =
1408 nn2);
1409 }
1410 }
1411 }
1412
1413 if (!jAcobian) {
1414 VectorDouble &res = commonData.valT[gg];
1415 if (gg > 0) {
1416 res.resize(3);
1417 int r;
1418 r = ::function(tAg, 3, nb_active_vars, &active[0], &res[0]);
1419 if (r != 3) { // function is locally analytic
1420 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
1421 "ADOL-C function evaluation with error r = %d", r);
1422 }
1423 }
1424 double val = getVolume() * getGaussPts()(3, gg);
1425 res *= val;
1426 } else {
1427 commonData.jacTRowPtr[gg].resize(3);
1428 commonData.jacT[gg].resize(3, nb_active_vars);
1429 for (int nn1 = 0; nn1 < 3; nn1++) {
1430 (commonData.jacTRowPtr[gg])[nn1] = &(commonData.jacT[gg](nn1, 0));
1431 }
1432 int r;
1433 r = jacobian(tAg, 3, nb_active_vars, &active[0],
1434 &(commonData.jacTRowPtr[gg])[0]);
1435 if (r != 3) {
1436 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
1437 "ADOL-C function evaluation with error");
1438 }
1439 double val = getVolume() * getGaussPts()(3, gg);
1440 commonData.jacT[gg] *= val;
1441 }
1442 }
1443
1444 } catch (const std::exception &ex) {
1445 std::ostringstream ss;
1446 ss << "throw in method: " << ex.what() << std::endl;
1447 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "%s", ss.str().c_str());
1448 }
1449
1451}
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ MOFEM_OPERATION_UNSUCCESSFUL
Definition definitions.h:34
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
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
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.
auto getFTensor2FromArray3by3(ublas::matrix< T, L, A > &data, const FTensor::Number< S > &, const size_t rr, const size_t cc=0)
static auto determinantTensor3by3(T &t)
Calculate the determinant of a 3x3 matrix or a tensor of rank 2.
int r
Definition sdf.py:8
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: