v0.12.1
Classes | Public Member Functions | Public Attributes | List of all members
MixTransport::MixTransportElement::OpSkeleton Struct Reference

calculate jump on entities More...

#include <users_modules/tutorials/cor-0to1/src/MixTransportElement.hpp>

Inheritance diagram for MixTransport::MixTransportElement::OpSkeleton:
[legend]
Collaboration diagram for MixTransport::MixTransportElement::OpSkeleton:
[legend]

Classes

struct  OpVolSide
 calculate values on adjacent tetrahedra to face More...
 

Public Member Functions

 OpSkeleton (MixTransportElement &ctx, const std::string flux_name)
 
MoFEMErrorCode doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 

Public Attributes

VolumeElementForcesAndSourcesCoreOnSide volSideFe
 volume element to get values from adjacent tets to face More...
 
map< int, VectorDouble > valMap
 
MixTransportElementcTx
 

Detailed Description

calculate jump on entities

Definition at line 1454 of file MixTransportElement.hpp.

Constructor & Destructor Documentation

◆ OpSkeleton()

MixTransport::MixTransportElement::OpSkeleton::OpSkeleton ( MixTransportElement ctx,
const std::string  flux_name 
)

Definition at line 1494 of file MixTransportElement.hpp.

1496  flux_name, UserDataOperator::OPROW),
1497  volSideFe(ctx.mField), cTx(ctx) {
1498  volSideFe.getOpPtrVector().push_back(new OpSkeleton::OpVolSide(valMap));
1499  }
ForcesAndSourcesCore::UserDataOperator UserDataOperator
VolumeElementForcesAndSourcesCoreOnSide volSideFe
volume element to get values from adjacent tets to face

Member Function Documentation

◆ doWork()

MoFEMErrorCode MixTransport::MixTransportElement::OpSkeleton::doWork ( int  side,
EntityType  type,
DataForcesAndSourcesCore::EntData data 
)

Definition at line 1501 of file MixTransportElement.hpp.

1502  {
1504 
1505  if (type == MBTRI) {
1506  EntityHandle fe_ent = getNumeredEntFiniteElementPtr()->getEnt();
1507 
1508  double def_val = 0;
1509  Tag th_error_jump;
1510  CHKERR cTx.mField.get_moab().tag_get_handle(
1511  "ERROR_JUMP", 1, MB_TYPE_DOUBLE, th_error_jump,
1512  MB_TAG_CREAT | MB_TAG_SPARSE, &def_val);
1513  double *error_jump_ptr;
1514  CHKERR cTx.mField.get_moab().tag_get_by_ptr(
1515  th_error_jump, &fe_ent, 1, (const void **)&error_jump_ptr);
1516  *error_jump_ptr = 0;
1517 
1518  // check if this is essential boundary condition
1519  EntityHandle essential_bc_meshset =
1520  cTx.mField.get_finite_element_meshset("MIX_BCFLUX");
1521  if (cTx.mField.get_moab().contains_entities(essential_bc_meshset,
1522  &fe_ent, 1)) {
1523  // essential bc, np jump then, exit and go to next face
1525  }
1526 
1527  // calculate values form adjacent tets
1528  valMap.clear();
1529  CHKERR loopSideVolumes("MIX", volSideFe);
1530  ;
1531 
1532  int nb_gauss_pts = data.getN().size1();
1533 
1534  // it is only one face, so it has to be bc natural boundary condition
1535  if (valMap.size() == 1) {
1536  if (static_cast<int>(valMap.begin()->second.size()) != nb_gauss_pts) {
1537  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
1538  "wrong number of integration points");
1539  }
1540  for (int gg = 0; gg != nb_gauss_pts; gg++) {
1541  double x, y, z;
1542  const double x = getCoordsAtGaussPts()(gg, 0);
1543  const double y = getCoordsAtGaussPts()(gg, 1);
1544  const double z = getCoordsAtGaussPts()(gg, 2);
1545  double value;
1546  CHKERR cTx.getBcOnValues(fe_ent, gg, x, y, z, value);
1547  double w = getGaussPts()(2, gg);
1548  if (static_cast<int>(getNormalsAtGaussPts().size1()) ==
1549  nb_gauss_pts) {
1550  w *= norm_2(getNormalsAtGaussPts(gg)) * 0.5;
1551  } else {
1552  w *= getArea();
1553  }
1554  *error_jump_ptr += w * pow(value - valMap.begin()->second[gg], 2);
1555  }
1556  } else if (valMap.size() == 2) {
1557  for (int gg = 0; gg != nb_gauss_pts; gg++) {
1558  double w = getGaussPts()(2, gg);
1559  if (getNormalsAtGaussPts().size1() == (unsigned int)nb_gauss_pts) {
1560  w *= norm_2(getNormalsAtGaussPts(gg)) * 0.5;
1561  } else {
1562  w *= getArea();
1563  }
1564  double delta = valMap.at(1)[gg] - valMap.at(-1)[gg];
1565  *error_jump_ptr += w * pow(delta, 2);
1566  }
1567  } else {
1568  SETERRQ1(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
1569  "data inconsistency, wrong number of neighbors "
1570  "valMap.size() = %d",
1571  valMap.size());
1572  }
1573  }
1574 
1576  }
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:522
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:421
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:124
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:491
#define CHKERR
Inline error check.
Definition: definitions.h:610
virtual EntityHandle get_finite_element_meshset(const std::string &name) const =0
double w(const double g, const double t)
static constexpr double delta
virtual MoFEMErrorCode getBcOnValues(const EntityHandle ent, const int gg, const double x, const double y, const double z, double &value)
evaluate natural (Dirichlet) boundary conditions
virtual moab::Interface & get_moab()=0

Member Data Documentation

◆ cTx

MixTransportElement& MixTransport::MixTransportElement::OpSkeleton::cTx

Definition at line 1492 of file MixTransportElement.hpp.

◆ valMap

map<int, VectorDouble> MixTransport::MixTransportElement::OpSkeleton::valMap

store values at integration point, key of the map is sense of face in respect to adjacent tetrahedra

Definition at line 1465 of file MixTransportElement.hpp.

◆ volSideFe

VolumeElementForcesAndSourcesCoreOnSide MixTransport::MixTransportElement::OpSkeleton::volSideFe

volume element to get values from adjacent tets to face

Definition at line 1460 of file MixTransportElement.hpp.


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