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

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

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

Public Member Functions

 OpMassLhs_dM_dv (const std::string vel_field, const std::string field_name, BlockData &data, CommonData &common_data, Range *forcesonlyonentities_ptr=NULL)
 
virtual MoFEMErrorCode getJac (EntitiesFieldData::EntData &col_data, int gg)
 
MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 

Public Attributes

BlockDatadAta
 
CommonDatacommonData
 
Range forcesOnlyOnEntities
 
MatrixDouble k
 
MatrixDouble jac
 

Detailed Description

Definition at line 222 of file ConvectiveMassElement.hpp.

Constructor & Destructor Documentation

◆ OpMassLhs_dM_dv()

ConvectiveMassElement::OpMassLhs_dM_dv::OpMassLhs_dM_dv ( const std::string  vel_field,
const std::string  field_name,
BlockData data,
CommonData common_data,
Range forcesonlyonentities_ptr = NULL 
)

Definition at line 440 of file ConvectiveMassElement.cpp.

444 vel_field, field_name,
445 ForcesAndSourcesCore::UserDataOperator::OPROWCOL),
446 dAta(data), commonData(common_data) {
447 sYmm = false;
448 if (forcesonlyonentities_ptr != NULL) {
449 forcesOnlyOnEntities = *forcesonlyonentities_ptr;
450 }
451}
ForcesAndSourcesCore::UserDataOperator UserDataOperator
constexpr auto field_name

Member Function Documentation

◆ doWork()

MoFEMErrorCode ConvectiveMassElement::OpMassLhs_dM_dv::doWork ( int  row_side,
int  col_side,
EntityType  row_type,
EntityType  col_type,
EntitiesFieldData::EntData row_data,
EntitiesFieldData::EntData col_data 
)

Definition at line 522 of file ConvectiveMassElement.cpp.

525 {
527
528 if (dAta.tEts.find(getNumeredEntFiniteElementPtr()->getEnt()) ==
529 dAta.tEts.end()) {
531 }
532
533 int nb_row = row_data.getIndices().size();
534 int nb_col = col_data.getIndices().size();
535 if (nb_row == 0)
537 if (nb_col == 0)
539
540 auto base = row_data.getFTensor0N();
541 int nb_base_functions = row_data.getN().size2();
542
543 {
544
545 k.resize(nb_row, nb_col);
546 k.clear();
547 jac.resize(3, nb_col);
548
549 for (unsigned int gg = 0; gg < row_data.getN().size1(); gg++) {
550
551 try {
552 CHKERR getJac(col_data, gg);
553 } catch (const std::exception &ex) {
554 std::ostringstream ss;
555 ss << "throw in method: " << ex.what() << std::endl;
556 SETERRQ(PETSC_COMM_SELF, 1, ss.str().c_str());
557 }
558
561
562 {
563 int dd1 = 0;
564 // integrate element stiffness matrix
565 for (; dd1 < nb_row / 3; dd1++) {
567 &jac(0, 0), &jac(0, 1), &jac(0, 2), &jac(1, 0), &jac(1, 1),
568 &jac(1, 2), &jac(2, 0), &jac(2, 1), &jac(2, 2), 3);
569 for (int dd2 = 0; dd2 < nb_col / 3; dd2++) {
571 &k(3 * dd1 + 0, 3 * dd2 + 0), &k(3 * dd1 + 0, 3 * dd2 + 1),
572 &k(3 * dd1 + 0, 3 * dd2 + 2), &k(3 * dd1 + 1, 3 * dd2 + 0),
573 &k(3 * dd1 + 1, 3 * dd2 + 1), &k(3 * dd1 + 1, 3 * dd2 + 2),
574 &k(3 * dd1 + 2, 3 * dd2 + 0), &k(3 * dd1 + 2, 3 * dd2 + 1),
575 &k(3 * dd1 + 2, 3 * dd2 + 2));
576 t_k(i, j) += base * t_jac(i, j);
577 ++t_jac;
578 }
579 ++base;
580 // for(int rr1 = 0;rr1<3;rr1++) {
581 // for(int dd2 = 0;dd2<nb_col;dd2++) {
582 // k(3*dd1+rr1,dd2) += row_data.getN()(gg,dd1)*jac(rr1,dd2);
583 // }
584 // }
585 }
586 for (; dd1 != nb_base_functions; dd1++) {
587 ++base;
588 }
589 }
590 }
591
592 if (!forcesOnlyOnEntities.empty()) {
593 VectorInt indices = row_data.getIndices();
594 VectorDofs &dofs = row_data.getFieldDofs();
595 VectorDofs::iterator dit = dofs.begin();
596 for (int ii = 0; dit != dofs.end(); dit++, ii++) {
597 if (forcesOnlyOnEntities.find((*dit)->getEnt()) ==
598 forcesOnlyOnEntities.end()) {
599 indices[ii] = -1;
600 }
601 }
602 CHKERR MatSetValues(getFEMethod()->ts_B, nb_row, &indices[0], nb_col,
603 &col_data.getIndices()[0], &k(0, 0), ADD_VALUES);
604 } else {
605 CHKERR MatSetValues(getFEMethod()->ts_B, nb_row,
606 &row_data.getIndices()[0], nb_col,
607 &col_data.getIndices()[0], &k(0, 0), ADD_VALUES);
608 }
609 }
611}
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
#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
UBlasVector< int > VectorInt
Definition: Types.hpp:67
ublas::vector< FEDofEntity *, DofsAllocator > VectorDofs
virtual MoFEMErrorCode getJac(EntitiesFieldData::EntData &col_data, int gg)
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
const VectorDofs & getFieldDofs() const
get dofs data stature FEDofEntity
const VectorInt & getIndices() const
Get global indices of dofs on entity.

◆ getJac()

MoFEMErrorCode ConvectiveMassElement::OpMassLhs_dM_dv::getJac ( EntitiesFieldData::EntData col_data,
int  gg 
)
virtual

Reimplemented in ConvectiveMassElement::OpMassLhs_dM_dx, ConvectiveMassElement::OpMassLhs_dM_dX, ConvectiveMassElement::OpVelocityLhs_dV_dv, ConvectiveMassElement::OpVelocityLhs_dV_dx, ConvectiveMassElement::OpVelocityLhs_dV_dX, ConvectiveMassElement::OpEshelbyDynamicMaterialMomentumLhs_dv, ConvectiveMassElement::OpEshelbyDynamicMaterialMomentumLhs_dx, and ConvectiveMassElement::OpEshelbyDynamicMaterialMomentumLhs_dX.

Definition at line 453 of file ConvectiveMassElement.cpp.

454 {
456 int nb_col = col_data.getIndices().size();
457 jac.clear();
458 if (!nb_col)
463 FTensor::Tensor2<double *, 3, 3> t_jac(&jac(0, 0), &jac(0, 1), &jac(0, 2),
464 &jac(1, 0), &jac(1, 1), &jac(1, 2),
465 &jac(2, 0), &jac(2, 1), &jac(2, 2), 3);
467 &commonData.jacMass[gg](0, 0), &commonData.jacMass[gg](0, 1),
468 &commonData.jacMass[gg](0, 2), &commonData.jacMass[gg](1, 0),
469 &commonData.jacMass[gg](1, 1), &commonData.jacMass[gg](1, 2),
470 &commonData.jacMass[gg](2, 0), &commonData.jacMass[gg](2, 1),
471 &commonData.jacMass[gg](2, 2));
472 double *base_ptr = const_cast<double *>(&col_data.getN(gg)[0]);
473 FTensor::Tensor0<double *> base(base_ptr, 1);
474 if (commonData.dataAtGaussPts["DOT_" + commonData.meshPositions].size() ==
475 0) {
476 for (int dd = 0; dd < nb_col / 3; dd++) {
477 t_jac(i, j) += t_mass1(i, j) * base * getFEMethod()->ts_a;
478 ++base;
479 ++t_jac;
480 }
481 } else {
482 const int s = 3 + 9;
484 // T* d000, T* d001, T* d002,
485 // T* d010, T* d011, T* d012,
486 // T* d020, T* d021, T* d022,
487 // T* d100, T* d101, T* d102,
488 // T* d110, T* d111, T* d112,
489 // T* d120, T* d121, T* d122,
490 // T* d200, T* d201, T* d202,
491 // T* d210, T* d211, T* d212,
492 // T* d220, T* d221, T* d222,
493 &commonData.jacMass[gg](0, s + 0), &commonData.jacMass[gg](0, s + 1),
494 &commonData.jacMass[gg](0, s + 2), &commonData.jacMass[gg](0, s + 3),
495 &commonData.jacMass[gg](0, s + 4), &commonData.jacMass[gg](0, s + 5),
496 &commonData.jacMass[gg](0, s + 6), &commonData.jacMass[gg](0, s + 7),
497 &commonData.jacMass[gg](0, s + 8), &commonData.jacMass[gg](1, s + 0),
498 &commonData.jacMass[gg](1, s + 1), &commonData.jacMass[gg](1, s + 2),
499 &commonData.jacMass[gg](1, s + 3), &commonData.jacMass[gg](1, s + 4),
500 &commonData.jacMass[gg](1, s + 5), &commonData.jacMass[gg](1, s + 6),
501 &commonData.jacMass[gg](1, s + 7), &commonData.jacMass[gg](1, s + 8),
502 &commonData.jacMass[gg](2, s + 0), &commonData.jacMass[gg](2, s + 1),
503 &commonData.jacMass[gg](2, s + 2), &commonData.jacMass[gg](2, s + 3),
504 &commonData.jacMass[gg](2, s + 4), &commonData.jacMass[gg](2, s + 5),
505 &commonData.jacMass[gg](2, s + 6), &commonData.jacMass[gg](2, s + 7),
506 &commonData.jacMass[gg](2, s + 8));
507
508 double *diff_ptr =
509 const_cast<double *>(&(col_data.getDiffN(gg, nb_col / 3)(0, 0)));
510 FTensor::Tensor1<double *, 3> diff(diff_ptr, &diff_ptr[1], &diff_ptr[2], 3);
511 for (int dd = 0; dd < nb_col / 3; dd++) {
512 t_jac(i, j) += t_mass1(i, j) * base * getFEMethod()->ts_a;
513 t_jac(i, j) += t_mass3(i, j, k) * diff(k);
514 ++base;
515 ++diff;
516 ++t_jac;
517 }
518 }
520}
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
std::map< std::string, std::vector< VectorDouble > > dataAtGaussPts
MatrixDouble & getDiffN(const FieldApproximationBase base)
get derivatives of base functions

Member Data Documentation

◆ commonData

CommonData& ConvectiveMassElement::OpMassLhs_dM_dv::commonData

Definition at line 227 of file ConvectiveMassElement.hpp.

◆ dAta

BlockData& ConvectiveMassElement::OpMassLhs_dM_dv::dAta

Definition at line 226 of file ConvectiveMassElement.hpp.

◆ forcesOnlyOnEntities

Range ConvectiveMassElement::OpMassLhs_dM_dv::forcesOnlyOnEntities

Definition at line 228 of file ConvectiveMassElement.hpp.

◆ jac

MatrixDouble ConvectiveMassElement::OpMassLhs_dM_dv::jac

Definition at line 234 of file ConvectiveMassElement.hpp.

◆ k

MatrixDouble ConvectiveMassElement::OpMassLhs_dM_dv::k

Definition at line 234 of file ConvectiveMassElement.hpp.


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