v0.13.0
Public Member Functions | Public Attributes | List of all members
PeriodicNitscheConstrains::MyNitscheVolume Struct Reference

#include <users_modules/homogenisation/src/NitschePeriodicMethod.hpp>

Inheritance diagram for PeriodicNitscheConstrains::MyNitscheVolume:
[legend]
Collaboration diagram for PeriodicNitscheConstrains::MyNitscheVolume:
[legend]

Public Member Functions

 MyNitscheVolume (MoFEM::Interface &m_field, NitscheMethod::BlockData &block_data, NitscheMethod::CommonData &common_data, CommonData &periodic_common_data)
 
PetscErrorCode iNitialise ()
 
PetscErrorCode doAdditionalJobWhenGuassPtsAreCalulated ()
 
- Public Member Functions inherited from NitscheMethod::MyVolumeFE
 MyVolumeFE (MoFEM::Interface &m_field, BlockData &block_data, CommonData &common_data)
 
int getRule (int order)
 
MoFEMErrorCode setGaussPts (int order)
 
- Public Member Functions inherited from MoFEM::VolumeElementForcesAndSourcesCoreSwitch< SWITCH >
 VolumeElementForcesAndSourcesCoreSwitch (Interface &m_field, const EntityType type=MBTET)
 
MoFEMErrorCode operator() ()
 function is run for every finite element More...
 
- Public Member Functions inherited from MoFEM::VolumeElementForcesAndSourcesCoreBase
template<int SWITCH>
MoFEMErrorCode opSwitch ()
 
- Public Member Functions inherited from MoFEM::ForcesAndSourcesCore
 ForcesAndSourcesCore (Interface &m_field)
 
boost::ptr_vector< UserDataOperator > & getOpPtrVector ()
 Use to push back operator for row operator. More...
 
auto & getElementPolynomialBase ()
 Get the Entity Polynomial Base object. More...
 
auto & getUserPolynomialBase ()
 Get the User Polynomial Base object. More...
 
virtual MoFEMErrorCode preProcess ()
 function is run at the beginning of loop More...
 
virtual MoFEMErrorCode postProcess ()
 function is run at the end of loop More...
 
int getMaxDataOrder () const
 Get max order of approximation for data fields. More...
 
int getMaxRowOrder () const
 Get max order of approximation for field in rows. More...
 
int getMaxColOrder () const
 Get max order of approximation for field in columns. More...
 
auto & getEntData (const FieldSpace space, const EntityType type, const int side)
 Get the entity data. More...
 
auto & getDataOnElementBySpaceArray ()
 Get data on entities and space. More...
 
auto & getDerivedDataOnElement ()
 Get derived data on entities and space. More...
 
- Public Member Functions inherited from MoFEM::FEMethod
MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const
 
 FEMethod ()=default
 
auto getDataDofsPtr () const
 
auto getDataVectorDofsPtr () const
 
const FieldEntity_vector_viewgetDataFieldEnts () const
 
boost::shared_ptr< FieldEntity_vector_view > & getDataFieldEntsPtr () const
 
auto & getRowFieldEnts () const
 
auto & getRowFieldEntsPtr () const
 
auto & getColFieldEnts () const
 
auto & getColFieldEntsPtr () const
 
auto getRowDofsPtr () const
 
auto getColDofsPtr () const
 
auto getNumberOfNodes () const
 
EntityHandle getFEEntityHandle () const
 
MoFEMErrorCode getNodeData (const std::string field_name, VectorDouble &data, const bool reset_dofs=true)
 
- Public Member Functions inherited from MoFEM::BasicMethod
 BasicMethod ()
 
virtual ~BasicMethod ()=default
 
int getNinTheLoop () const
 get number of evaluated element in the loop More...
 
int getLoopSize () const
 get loop size More...
 
auto getLoHiFERank () const
 Get lo and hi processor rank of iterated entities. More...
 
auto getLoFERank () const
 Get upper rank in loop for iterating elements. More...
 
auto getHiFERank () const
 Get upper rank in loop for iterating elements. More...
 
unsigned int getFieldBitNumber (std::string field_name) const
 
MoFEMErrorCode copyBasicMethod (const BasicMethod &basic)
 Copy data from other base method to this base method. More...
 
boost::weak_ptr< CacheTuplegetCacheWeakPtr () const
 Get the cache weak ptr object. More...
 
- Public Member Functions inherited from MoFEM::KspMethod
 KspMethod ()
 
virtual ~KspMethod ()=default
 
MoFEMErrorCode copyKsp (const KspMethod &ksp)
 copy data form another method More...
 
- Public Member Functions inherited from MoFEM::PetscData
 PetscData ()
 
virtual ~PetscData ()=default
 
MoFEMErrorCode copyPetscData (const PetscData &petsc_data)
 
- Public Member Functions inherited from MoFEM::UnknownInterface
template<class IFACE >
MoFEMErrorCode registerInterface (bool error_if_registration_failed=true)
 Register interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface refernce to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get reference to interface. More...
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface. More...
 
virtual ~UnknownInterface ()=default
 
- Public Member Functions inherited from MoFEM::SnesMethod
 SnesMethod ()
 
virtual ~SnesMethod ()=default
 
MoFEMErrorCode copySnes (const SnesMethod &snes)
 Copy snes data. More...
 
- Public Member Functions inherited from MoFEM::TSMethod
 TSMethod ()
 
virtual ~TSMethod ()=default
 
MoFEMErrorCode copyTs (const TSMethod &ts)
 Copy TS solver data. More...
 

Public Attributes

CommonDataperiodicCommonData
 
PeriodicFace periodicFace
 
PeriodicVolume periodicVolume
 
bool iNit
 
AdaptiveKDTree tRee
 
EntityHandle treeRootSet
 
- Public Attributes inherited from NitscheMethod::MyVolumeFE
BlockDatablockData
 
CommonDatacommonData
 
MyFace faceFE
 
int addToRule
 
- Public Attributes inherited from MoFEM::VolumeElementForcesAndSourcesCoreBase
std::string meshPositionsFieldName
 
- Public Attributes inherited from MoFEM::ForcesAndSourcesCore
InterfacemField
 
RuleHookFun getRuleHook
 Hook to get rule. More...
 
GaussHookFun setRuleHook
 Set function to calculate integration rule. More...
 
MatrixDouble gaussPts
 Matrix of integration points. More...
 
- Public Attributes inherited from MoFEM::FEMethod
std::string feName
 Name of finite element. More...
 
boost::shared_ptr< const NumeredEntFiniteElementnumeredEntFiniteElementPtr
 
boost::function< bool(FEMethod *fe_method_ptr)> exeTestHook
 Tet if element is run by hook. More...
 
- Public Attributes inherited from MoFEM::BasicMethod
int nInTheLoop
 number currently of processed method More...
 
int loopSize
 local number oe methods to process More...
 
std::pair< int, int > loHiFERank
 Llo and hi processor rank of iterated entities. More...
 
int rAnk
 processor rank More...
 
int sIze
 number of processors in communicator More...
 
const RefEntity_multiIndexrefinedEntitiesPtr
 container of mofem dof entities More...
 
const RefElement_multiIndexrefinedFiniteElementsPtr
 container of mofem finite element entities More...
 
const ProblemproblemPtr
 raw pointer to problem More...
 
const Field_multiIndexfieldsPtr
 raw pointer to fields container More...
 
const FieldEntity_multiIndexentitiesPtr
 raw pointer to container of field entities More...
 
const DofEntity_multiIndexdofsPtr
 raw pointer container of dofs More...
 
const FiniteElement_multiIndexfiniteElementsPtr
 raw pointer to container finite elements More...
 
const EntFiniteElement_multiIndexfiniteElementsEntitiesPtr
 
const FieldEntityEntFiniteElementAdjacencyMap_multiIndexadjacenciesPtr
 
boost::function< MoFEMErrorCode()> preProcessHook
 Hook function for pre-processing. More...
 
boost::function< MoFEMErrorCode()> postProcessHook
 Hook function for post-processing. More...
 
boost::function< MoFEMErrorCode()> operatorHook
 Hook function for operator. More...
 
boost::movelib::unique_ptr< boolvecAssembleSwitch
 
boost::movelib::unique_ptr< boolmatAssembleSwitch
 
boost::weak_ptr< CacheTuplecacheWeakPtr
 
- Public Attributes inherited from MoFEM::KspMethod
KSPContext ksp_ctx
 Context. More...
 
KSP ksp
 KSP solver. More...
 
Vec & ksp_f
 
Mat & ksp_A
 
Mat & ksp_B
 
- Public Attributes inherited from MoFEM::PetscData
Switches data_ctx
 
Vec f
 
Mat A
 
Mat B
 
Vec x
 
Vec x_t
 
Vec x_tt
 
- Public Attributes inherited from MoFEM::SnesMethod
SNESContext snes_ctx
 
SNES snes
 snes solver More...
 
Vec & snes_x
 state vector More...
 
Vec & snes_f
 residual More...
 
Mat & snes_A
 jacobian matrix More...
 
Mat & snes_B
 preconditioner of jacobian matrix More...
 
- Public Attributes inherited from MoFEM::TSMethod
TS ts
 time solver More...
 
TSContext ts_ctx
 
PetscInt ts_step
 time step More...
 
PetscReal ts_a
 shift for U_t (see PETSc Time Solver) More...
 
PetscReal ts_aa
 shift for U_tt shift for U_tt More...
 
PetscReal ts_t
 time More...
 
Vec & ts_u
 state vector More...
 
Vec & ts_u_t
 time derivative of state vector More...
 
Vec & ts_u_tt
 second time derivative of state vector More...
 
Vec & ts_F
 residual vector More...
 
Mat & ts_A
 
Mat & ts_B
 Preconditioner for ts_A. More...
 

Additional Inherited Members

- Public Types inherited from MoFEM::VolumeElementForcesAndSourcesCoreSwitch< SWITCH >
using UserDataOperator = VolumeElementForcesAndSourcesCoreBase::UserDataOperator
 
- Public Types inherited from MoFEM::VolumeElementForcesAndSourcesCoreBase
enum  Switches { NO_TRANSFORM = 1 << 1 | 1 << 2 }
 
- Public Types inherited from MoFEM::ForcesAndSourcesCore
typedef boost::function< int(int order_row, int order_col, int order_data)> RuleHookFun
 
typedef boost::function< MoFEMErrorCode(ForcesAndSourcesCore *fe_raw_ptr, int order_row, int order_col, int order_data)> GaussHookFun
 
- Public Types inherited from MoFEM::KspMethod
enum  KSPContext { CTX_SETFUNCTION , CTX_OPERATORS , CTX_KSPNONE }
 pass information about context of KSP/DM for with finite element is computed More...
 
- Public Types inherited from MoFEM::PetscData
enum  DataContext {
  CTX_SET_NONE = 0 , CTX_SET_F = 1 << 0 , CTX_SET_A = 1 << 1 , CTX_SET_B = 1 << 2 ,
  CTX_SET_X = 1 << 3 , CTX_SET_X_T = 1 << 4 , CTX_SET_X_TT = 1 << 6 , CTX_SET_TIME = 1 << 7
}
 
using Switches = std::bitset< 8 >
 
- Public Types inherited from MoFEM::SnesMethod
enum  SNESContext { CTX_SNESSETFUNCTION , CTX_SNESSETJACOBIAN , CTX_SNESNONE }
 
- Public Types inherited from MoFEM::TSMethod
enum  TSContext {
  CTX_TSSETRHSFUNCTION , CTX_TSSETRHSJACOBIAN , CTX_TSSETIFUNCTION , CTX_TSSETIJACOBIAN ,
  CTX_TSTSMONITORSET , CTX_TSNONE
}
 
- Static Public Member Functions inherited from MoFEM::UnknownInterface
static MoFEMErrorCode getLibVersion (Version &version)
 Get library version. More...
 
static MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version)
 Get database major version. More...
 
static MoFEMErrorCode setFileVersion (moab::Interface &moab, Version version=Version(MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD))
 Get database major version. More...
 
static MoFEMErrorCode getInterfaceVersion (Version &version)
 Get database major version. More...
 
- Static Public Attributes inherited from MoFEM::PetscData
static constexpr Switches CtxSetNone = PetscData::Switches(CTX_SET_NONE)
 
static constexpr Switches CtxSetF = PetscData::Switches(CTX_SET_F)
 
static constexpr Switches CtxSetA = PetscData::Switches(CTX_SET_A)
 
static constexpr Switches CtxSetB = PetscData::Switches(CTX_SET_B)
 
static constexpr Switches CtxSetX = PetscData::Switches(CTX_SET_X)
 
static constexpr Switches CtxSetX_T = PetscData::Switches(CTX_SET_X_T)
 
static constexpr Switches CtxSetX_TT = PetscData::Switches(CTX_SET_X_TT)
 
static constexpr Switches CtxSetTime = PetscData::Switches(CTX_SET_TIME)
 
- Protected Member Functions inherited from MoFEM::VolumeElementForcesAndSourcesCoreBase
 VolumeElementForcesAndSourcesCoreBase (Interface &m_field, const EntityType type=MBTET)
 
virtual MoFEMErrorCode setIntegrationPts ()
 Set integration points. More...
 
virtual MoFEMErrorCode calculateVolumeAndJacobian ()
 Calculate element volume and Jacobian. More...
 
virtual MoFEMErrorCode calculateCoordinatesAtGaussPts ()
 Calculate coordinate at integration points. More...
 
virtual MoFEMErrorCode getSpaceBaseAndOrderOnElement ()
 Determine approximation space and order of base functions. More...
 
virtual MoFEMErrorCode transformBaseFunctions ()
 Transform base functions based on geometric element Jacobian. More...
 
- Protected Member Functions inherited from MoFEM::ForcesAndSourcesCore
MoFEMErrorCode getEntitySense (const EntityType type, boost::ptr_vector< EntitiesFieldData::EntData > &data) const
 get sense (orientation) of entity More...
 
MoFEMErrorCode getEntityDataOrder (const EntityType type, const FieldSpace space, boost::ptr_vector< EntitiesFieldData::EntData > &data) const
 Get the entity data order. More...
 
template<EntityType type>
MoFEMErrorCode getEntitySense (EntitiesFieldData &data) const
 Get the entity sense (orientation) More...
 
template<EntityType type>
MoFEMErrorCode getEntityDataOrder (EntitiesFieldData &data, const FieldSpace space) const
 Get the entity data order for given space. More...
 
MoFEMErrorCode getFaceNodes (EntitiesFieldData &data) const
 Get nodes on faces. More...
 
MoFEMErrorCode getSpacesAndBaseOnEntities (EntitiesFieldData &data) const
 Get field approximation space and base on entities. More...
 
virtual int getRule (int order_row, int order_col, int order_data)
 another variant of getRule More...
 
virtual MoFEMErrorCode setGaussPts (int order_row, int order_col, int order_data)
 set user specific integration rule More...
 
MoFEMErrorCode calHierarchicalBaseFunctionsOnElement (const FieldApproximationBase b)
 Calculate base functions. More...
 
MoFEMErrorCode calHierarchicalBaseFunctionsOnElement ()
 Calculate base functions. More...
 
MoFEMErrorCode calBernsteinBezierBaseFunctionsOnElement ()
 Calculate Bernstein-Bezier base. More...
 
MoFEMErrorCode createDataOnElement (EntityType type)
 Create a entity data on element object. More...
 
MoFEMErrorCode loopOverOperators ()
 Iterate user data operators. More...
 
template<typename EXTRACTOR >
MoFEMErrorCode getNodesIndices (const int bit_number, FieldEntity_vector_view &ents_field, VectorInt &nodes_indices, VectorInt &local_nodes_indices, EXTRACTOR &&extractor) const
 get node indices More...
 
MoFEMErrorCode getRowNodesIndices (EntitiesFieldData &data, const int bit_number) const
 get row node indices from FENumeredDofEntity_multiIndex More...
 
MoFEMErrorCode getColNodesIndices (EntitiesFieldData &data, const int bit_number) const
 get col node indices from FENumeredDofEntity_multiIndex More...
 
template<typename EXTRACTOR >
MoFEMErrorCode getEntityIndices (EntitiesFieldData &data, const int bit_number, FieldEntity_vector_view &ents_field, const EntityType type_lo, const EntityType type_hi, EXTRACTOR &&extractor) const
 
MoFEMErrorCode getEntityRowIndices (EntitiesFieldData &data, const int bit_number, const EntityType type_lo=MBVERTEX, const EntityType type_hi=MBPOLYHEDRON) const
 
MoFEMErrorCode getEntityColIndices (EntitiesFieldData &data, const int bit_number, const EntityType type_lo=MBVERTEX, const EntityType type_hi=MBPOLYHEDRON) const
 
MoFEMErrorCode getNoFieldIndices (const int bit_number, boost::shared_ptr< FENumeredDofEntity_multiIndex > dofs, VectorInt &nodes_indices) const
 get NoField indices More...
 
MoFEMErrorCode getNoFieldRowIndices (EntitiesFieldData &data, const int bit_number) const
 get col NoField indices More...
 
MoFEMErrorCode getNoFieldColIndices (EntitiesFieldData &data, const int bit_number) const
 get col NoField indices More...
 
MoFEMErrorCode getNoFieldFieldData (const int bit_number, VectorDouble &ent_field_data, VectorDofs &ent_field_dofs, VectorFieldEntities &ent_field) const
 Get field data on nodes. More...
 
MoFEMErrorCode getNoFieldFieldData (EntitiesFieldData &data, const int bit_number) const
 
MoFEMErrorCode getNodesFieldData (EntitiesFieldData &data, const int bit_number) const
 Get data on nodes. More...
 
MoFEMErrorCode getEntityFieldData (EntitiesFieldData &data, const int bit_number, const EntityType type_lo=MBVERTEX, const EntityType type_hi=MBPOLYHEDRON) const
 
MoFEMErrorCode getProblemNodesIndices (const std::string &field_name, const NumeredDofEntity_multiIndex &dofs, VectorInt &nodes_indices) const
 get indices of nodal indices which are declared for problem but not this particular element More...
 
MoFEMErrorCode getProblemTypeIndices (const std::string &field_name, const NumeredDofEntity_multiIndex &dofs, EntityType type, int side_number, VectorInt &indices) const
 get indices by type (generic function) which are declared for problem but not this particular element More...
 
MoFEMErrorCode getProblemNodesRowIndices (const std::string &field_name, VectorInt &nodes_indices) const
 
MoFEMErrorCode getProblemTypeRowIndices (const std::string &field_name, EntityType type, int side_number, VectorInt &indices) const
 
MoFEMErrorCode getProblemNodesColIndices (const std::string &field_name, VectorInt &nodes_indices) const
 
MoFEMErrorCode getProblemTypeColIndices (const std::string &field_name, EntityType type, int side_number, VectorInt &indices) const
 
- Protected Attributes inherited from MoFEM::VolumeElementForcesAndSourcesCoreBase
VectorDouble coords
 
MatrixDouble3by3 jAc
 
MatrixDouble3by3 invJac
 
OpSetInvJacH1 opSetInvJacH1
 
OpSetContravariantPiolaTransform opContravariantPiolaTransform
 
OpSetCovariantPiolaTransform opCovariantPiolaTransform
 
OpSetInvJacHdivAndHcurl opSetInvJacHdivAndHcurl
 
double & vOlume
 
int num_nodes
 
const EntityHandleconn
 
FTensor::Tensor2< double *, 3, 3 > tJac
 
FTensor::Tensor2< double *, 3, 3 > tInvJac
 
- Protected Attributes inherited from MoFEM::ForcesAndSourcesCore
const std::array< boost::shared_ptr< EntitiesFieldData >, LASTSPACEdataOnElement
 Entity data on element entity rows fields. More...
 
const std::array< boost::shared_ptr< EntitiesFieldData >, LASTSPACEderivedDataOnElement
 Entity data on element entity columns fields. More...
 
EntitiesFieldDatadataNoField
 
EntitiesFieldDatadataH1
 
EntitiesFieldDatadataHcurl
 
EntitiesFieldDatadataHdiv
 
EntitiesFieldDatadataL2
 
boost::ptr_vector< UserDataOperatoropPtrVector
 Vector of finite element users data operators. More...
 
EntityType lastEvaluatedElementEntityType
 Last evaluated type of element entity. More...
 
MatrixDouble coordsAtGaussPts
 coordinated at gauss points More...
 
double elementMeasure
 

Detailed Description

Definition at line 289 of file NitschePeriodicMethod.hpp.

Constructor & Destructor Documentation

◆ MyNitscheVolume()

PeriodicNitscheConstrains::MyNitscheVolume::MyNitscheVolume ( MoFEM::Interface m_field,
NitscheMethod::BlockData block_data,
NitscheMethod::CommonData common_data,
CommonData periodic_common_data 
)

Definition at line 298 of file NitschePeriodicMethod.hpp.

303  :
304  NitscheMethod::MyVolumeFE(m_field,block_data,common_data),
305  periodicCommonData(periodic_common_data),
306  periodicFace(m_field,periodic_common_data),
307  periodicVolume(m_field,periodic_common_data),
308  iNit(false),
309  tRee(&m_field.get_moab()) {
310  periodicFace.getOpPtrVector().push_back(
311  new OpGetFaceData(periodic_common_data)
312  );
313  }
virtual moab::Interface & get_moab()=0
Definition of volume element.

Member Function Documentation

◆ doAdditionalJobWhenGuassPtsAreCalulated()

PetscErrorCode PeriodicNitscheConstrains::MyNitscheVolume::doAdditionalJobWhenGuassPtsAreCalulated ( )
virtual

Reimplemented from NitscheMethod::MyVolumeFE.

Definition at line 325 of file NitschePeriodicMethod.hpp.

325  {
326  PetscFunctionBegin;
327 
328 
329 
330 
331  if(!iNit) {
332  ierr = iNitialise(); CHKERRQ(ierr);
333  iNit = true;
334  }
335 
336  //cerr << "part1\n";
337  try {
338  const double tol = 1e-18;
347  periodicCommonData.sTress.clear();
350  int gg = 0;
351  for(int ff = 0;ff<4;ff++) {
352  if(commonData.facesFePtr[ff]==NULL) continue;
353  for(unsigned int fgg = 0;fgg<commonData.faceGaussPts[ff].size2();fgg++,gg++) {
354  VectorDouble& ray = commonData.rAy[ff];
356  3,ublas::shallow_array_adaptor<double>(
357  3,&commonData.hoCoordsAtGaussPts[ff](fgg,0)
358  )
359  );
360  vector<EntityHandle> triangles_out;
361  vector<double> distance_out;
362  rval = tRee.ray_intersect_triangles(
363  treeRootSet,tol,&ray[0],&coords[0],triangles_out,distance_out
364  ); CHKERRQ_MOAB(rval);
365  double diffNTRI[6];
366  ierr = ShapeDiffMBTRI(diffNTRI); CHKERRQ(ierr);
367  vector<EntityHandle> triangles_out_on_other_side;
368  vector<double> distance_out_on_other_side;
369  {
370  vector<EntityHandle>::iterator hit = triangles_out.begin();
371  vector<double>::iterator dit = distance_out.begin();
372  for(;dit!=distance_out.end();dit++,hit++) {
373  const EntityHandle* conn;
374  int number_nodes;
375  rval = mField.get_moab().get_connectivity(*hit,conn,number_nodes,true); CHKERRQ_MOAB(rval);
376  double coords[9];
377  rval = mField.get_moab().get_coords(conn,number_nodes,coords); CHKERRQ_MOAB(rval);
378  double normal[3];
379  ierr = ShapeFaceNormalMBTRI(diffNTRI,coords,normal); CHKERRQ(ierr);
380  *dit *= cblas_ddot(3,normal,1,&ray[0],1)/cblas_dnrm2(3,normal,1);
381  if(*dit>tol) {
382  triangles_out_on_other_side.push_back(*hit);
383  distance_out_on_other_side.push_back(*dit);
384  }
385  }
386  }
387  vector<double>::iterator max_dit = max_element(
388  distance_out_on_other_side.begin(),distance_out_on_other_side.end()
389  );
390  EntityHandle other_face = triangles_out_on_other_side[
391  std::distance(distance_out_on_other_side.begin(),max_dit)
392  ];
393  VectorDouble other_coords = coords+ray*(*max_dit);
394  periodicCommonData.dIstance[other_face] = *max_dit;
395  VectorDouble local_coords;
396  local_coords.resize(2);
397  {
398  const EntityHandle* conn;
399  int number_nodes;
400  rval = mField.get_moab().get_connectivity(other_face,conn,number_nodes,false); CHKERRQ_MOAB(rval);
401 
402  {
403  double face_coords[18];
404  rval = mField.get_moab().get_coords(conn,number_nodes,face_coords); CHKERRQ_MOAB(rval);
405 
406  VectorDouble res,d_local_coords;
407  res.resize(3,false);
408  d_local_coords.resize(2,false);
409 
410  double N[number_nodes];
411  double diffNTRI[number_nodes*2];
412  double nrm2,nrm2_res;
413  const double eps = 1e-14;
414  const int max_it = 10;
415 
416  int it = 0;
417  local_coords.clear();
418  do {
419  if(number_nodes == 3) {
420  ierr = ShapeMBTRI(N,&local_coords[0],&local_coords[1],1); CHKERRQ(ierr);
421  } else if(number_nodes == 6) {
422  ierr = ShapeMBTRIQ(N,&local_coords[0],&local_coords[1],1); CHKERRQ(ierr);
423  } else {
424  SETERRQ(PETSC_COMM_SELF,MOFEM_NOT_IMPLEMENTED,"not implemented");
425  }
426  res.clear();
427  for(int dd = 0;dd<3;dd++) {
428  res[dd] += cblas_ddot(number_nodes,N,1,&face_coords[dd],3)-other_coords[dd];
429  }
430  nrm2_res = cblas_dnrm2(3,&res[0],1);
431  if(number_nodes == 3) {
432  ierr = ShapeDiffMBTRI(diffNTRI); CHKERRQ(ierr);
433  } else {
434  ierr = ShapeDiffMBTRIQ(diffNTRI,&local_coords[0],&local_coords[1],1); CHKERRQ(ierr);
435  }
436  MatrixDouble A;
437  A.resize(3,2);
438  for(int dd = 0;dd<3;dd++) {
439  A(dd,0) = cblas_ddot(number_nodes,&diffNTRI[0],2,&face_coords[dd],3);
440  A(dd,1) = cblas_ddot(number_nodes,&diffNTRI[1],2,&face_coords[dd],3);
441  }
442  MatrixDouble ATA;
443  ATA = prod(trans(A),A);
444  VectorDouble ATres;
445  ATres = prod(trans(A),res);
446  double det = (ATA(0,0)*ATA(1,1)-ATA(0,1)*ATA(1,0));
447  d_local_coords[0] = -(ATA(1,1)*ATres[0]-ATA(0,1)*ATres[1])/det;
448  d_local_coords[1] = -(ATA(0,0)*ATres[1]-ATA(1,0)*ATres[0])/det;
449  local_coords += d_local_coords;
450  nrm2 = cblas_dnrm2(2,&d_local_coords[0],1);
451  if((it++)>max_it) {
452  cerr << "Warrning: max_it reached in PeriodicNitscheConstrains:: ... ::doAdditionalJobWhenGuassPtsAreCalulated\n";
453  cerr << "nrm2 " << nrm2 << " nrm2_res " << nrm2_res << endl;
454  cerr << "res " << res << endl;
455  cerr << "other_coords " << other_coords << endl;
456  break;
457  }
458  } while(nrm2>eps || nrm2_res>eps);
459  if(local_coords[0]<-eps) {
460  SETERRQ1(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"local_coords[0]=%6.4e<eps",local_coords[0]);
461  }
462  if(local_coords[1]<-eps) {
463  SETERRQ1(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"local_coords[1]=%6.4e<eps",local_coords[1]);
464  }
465  if(local_coords[0]>1+eps) {
466  SETERRQ1(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"local_coords[0]=%6.4e>1+eps",local_coords[0]);
467  }
468  if(local_coords[1]>1+eps) {
469  SETERRQ1(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"local_coords[1]=%6.4e>1+eps",local_coords[1]);
470  }
471  if(local_coords[0]+local_coords[1]>1+eps) {
472  SETERRQ1(
473  PETSC_COMM_SELF,
475  "local_coords[0]+local_coords[1]>1",
476  local_coords[0]+local_coords[1]
477  );
478  }
479  }
480 
481  }
482  periodicCommonData.localCoordsMap[other_face].push_back(local_coords);
483  periodicCommonData.inTetFaceGaussPtsNumber[other_face].push_back(gg);
484  }
485  }
488  periodicCommonData.sTress.resize(gg);
491 
492  } catch (const std::exception& ex) {
493  ostringstream ss;
494  ss << "throw in method: " << ex.what() << endl;
495  SETERRQ(PETSC_COMM_SELF,1,ss.str().c_str());
496  }
497 
498  try {
499  for(
500  map<EntityHandle,vector<int> >::iterator mit = periodicCommonData.inTetFaceGaussPtsNumber.begin();
502  mit++
503  ) {
504  //cerr << mit->first << " " << mit->second.size() << endl;
505  NumeredEntFiniteElement_multiIndex::index<Composite_Name_And_Ent_mi_tag>::type::iterator it;
507  problemPtr->numeredFiniteElements)
508  .get<Composite_Name_And_Ent_mi_tag>()
509  .find(
510  boost::make_tuple(blockData.faceElemName, mit->first));
512  problemPtr->numeredFiniteElements)
513  .get<Composite_Name_And_Ent_mi_tag>()
514  .end()) {
515  SETERRQ1(
516  PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"No finite element found < %s >",
517  blockData.faceElemName.c_str()
518  );
519  }
520  //cerr << *it << endl;
521  boost::shared_ptr<const NumeredEntFiniteElement> face_ptr = *it;
522  periodicFace.copyBasicMethod(*this);
524  periodicFace.nInTheLoop = 0;
525  periodicFace.numeredEntFiniteElementPtr = face_ptr;
526  periodicFace.dataPtr = face_ptr->sPtr->data_dofs;
527  periodicFace.rowPtr = face_ptr->rows_dofs;
528  periodicFace.colPtr = face_ptr->cols_dofs;
529  ierr = periodicFace(); CHKERRQ(ierr);
530 
531  Range tets;
532  ierr = mField.get_adjacencies_equality(mit->first,3,tets); CHKERRQ(ierr);
533  if(tets.size()!=1) {
534  SETERRQ1(
535  PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"Expected one tet, but is %d",
536  tets.size()
537  );
538  }
540  problemPtr->numeredFiniteElements)
541  .get<Composite_Name_And_Ent_mi_tag>()
542  .find(boost::make_tuple(periodicCommonData.volumeElemName,
543  tets[0]));
545  problemPtr->numeredFiniteElements)
546  .get<Composite_Name_And_Ent_mi_tag>()
547  .end()) {
548  SETERRQ1(
549  PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"No finite element found < %s >",
551  );
552  }
553  boost::shared_ptr<const NumeredEntFiniteElement> tet_ptr = *it;
554  periodicVolume.copyBasicMethod(*this);
556  periodicVolume.nInTheLoop = 0;
557  periodicVolume.numeredEntFiniteElementPtr = tet_ptr;
558  periodicVolume.dataPtr = face_ptr->sPtr->data_dofs;
559  periodicVolume.rowPtr = face_ptr->rows_dofs;
560  periodicVolume.colPtr = face_ptr->cols_dofs;
561  periodicVolume.forFace = mit->first;
562  ierr = periodicVolume(); CHKERRQ(ierr);
563 
564  }
565  } catch (const std::exception& ex) {
566  ostringstream ss;
567  ss << "throw in method: " << ex.what() << endl;
568  SETERRQ(PETSC_COMM_SELF,1,ss.str().c_str());
569  }
570 
571  PetscFunctionReturn(0);
572  }
NumeredEntFiniteElement_multiIndex & returnNumeredEntFiniteElement_multiIndex(T &fes)
static const double eps
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:467
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:44
@ MOFEM_NOT_IMPLEMENTED
Definition: definitions.h:45
PetscErrorCode ShapeDiffMBTRIQ(double *diffN, const double *X, const double *Y, const int G_DIM)
Definition: fem_tools.c:807
PetscErrorCode ShapeFaceNormalMBTRI(double *diffN, const double *coords, double *normal)
Definition: fem_tools.c:241
PetscErrorCode ShapeDiffMBTRI(double *diffN)
calculate derivatives of shape functions
Definition: fem_tools.c:206
PetscErrorCode ShapeMBTRIQ(double *N, const double *X, const double *Y, const int G_DIM)
Definition: fem_tools.c:792
PetscErrorCode ShapeMBTRI(double *N, const double *X, const double *Y, const int G_DIM)
calculate shape functions on triangle
Definition: fem_tools.c:194
static const double face_coords[4][9]
double tol
FTensor::Tensor1< double, SPACE_DIM > normal(FTensor::Tensor1< T1, 3 > &t_coords, FTensor::Tensor1< T2, SPACE_DIM > &t_disp)
Definition: ContactOps.hpp:77
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
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:87
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:85
VectorShallowArrayAdaptor< double > VectorAdaptor
Definition: Types.hpp:126
UBlasMatrix< double > MatrixDouble
Definition: Types.hpp:88
UBlasVector< double > VectorDouble
Definition: Types.hpp:79
const int N
Definition: speed_test.cpp:3
const Problem * problemPtr
raw pointer to problem
string faceElemName
name of element face
std::vector< boost::shared_ptr< const NumeredEntFiniteElement > > facesFePtr
std::vector< VectorDouble > rAy
std::vector< MatrixDouble > hoCoordsAtGaussPts
std::vector< MatrixDouble > faceGaussPts
map< EntityHandle, vector< VectorDouble > > localCoordsMap
map< EntityHandle, vector< int > > inTetFaceGaussPtsNumber
map< EntityHandle, vector< int > > inTetTetGaussPtsNumber

◆ iNitialise()

PetscErrorCode PeriodicNitscheConstrains::MyNitscheVolume::iNitialise ( )

Definition at line 316 of file NitschePeriodicMethod.hpp.

316  {
317  PetscFunctionBegin;
318 
319  treeRootSet = 0;
321  //cerr << blockData.fAces << endl;
322  PetscFunctionReturn(0);
323  }

Member Data Documentation

◆ iNit

bool PeriodicNitscheConstrains::MyNitscheVolume::iNit

Definition at line 295 of file NitschePeriodicMethod.hpp.

◆ periodicCommonData

CommonData& PeriodicNitscheConstrains::MyNitscheVolume::periodicCommonData

Definition at line 291 of file NitschePeriodicMethod.hpp.

◆ periodicFace

PeriodicFace PeriodicNitscheConstrains::MyNitscheVolume::periodicFace

Definition at line 292 of file NitschePeriodicMethod.hpp.

◆ periodicVolume

PeriodicVolume PeriodicNitscheConstrains::MyNitscheVolume::periodicVolume

Definition at line 293 of file NitschePeriodicMethod.hpp.

◆ tRee

AdaptiveKDTree PeriodicNitscheConstrains::MyNitscheVolume::tRee

Definition at line 296 of file NitschePeriodicMethod.hpp.

◆ treeRootSet

EntityHandle PeriodicNitscheConstrains::MyNitscheVolume::treeRootSet

Definition at line 315 of file NitschePeriodicMethod.hpp.


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