v0.14.0
Public Member Functions | Public Attributes | List of all members
BCs_RVELagrange_Disp::OpRVEBCsRhs Struct Reference

\biref operator to calculate the RHS of the constrain for the RVE boundary conditions More...

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

Inheritance diagram for BCs_RVELagrange_Disp::OpRVEBCsRhs:
[legend]
Collaboration diagram for BCs_RVELagrange_Disp::OpRVEBCsRhs:
[legend]

Public Member Functions

 OpRVEBCsRhs (const string field_name, const string lagrang_field_name, Vec f, VectorDouble given_strain, boost::ptr_vector< MethodForForceScaling > &methods_op, RVEBC_Data &data, bool ho_geometry=false)
 
PetscErrorCode doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 
- Public Member Functions inherited from BCs_RVELagrange_Disp::OpDmatRhs
 OpDmatRhs (const string field_name, const string lagrang_field_name, RVEBC_Data &data, bool ho_geometry=false)
 
PetscErrorCode calculateDmat (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 

Public Attributes

Vec F
 
VectorDouble givenStrain
 
boost::ptr_vector< MethodForForceScaling > & methodsOp
 
- Public Attributes inherited from BCs_RVELagrange_Disp::OpDmatRhs
RVEBC_DatadAta
 
bool hoGeometry
 
VectorDouble f
 
VectorDouble applied_strain
 
MatrixDouble X_mat
 
MatrixDouble N_mat
 
MatrixDouble D_mat
 
int rank
 
int nb_row_dofs
 

Detailed Description

\biref operator to calculate the RHS of the constrain for the RVE boundary conditions

Definition at line 305 of file BCs_RVELagrange_Disp.hpp.

Constructor & Destructor Documentation

◆ OpRVEBCsRhs()

BCs_RVELagrange_Disp::OpRVEBCsRhs::OpRVEBCsRhs ( const string  field_name,
const string  lagrang_field_name,
Vec  f,
VectorDouble  given_strain,
boost::ptr_vector< MethodForForceScaling > &  methods_op,
RVEBC_Data data,
bool  ho_geometry = false 
)
inline

Definition at line 310 of file BCs_RVELagrange_Disp.hpp.

313  :
314  OpDmatRhs(field_name,lagrang_field_name,data,ho_geometry),F(f),givenStrain(given_strain),methodsOp(methods_op) {
315  }

Member Function Documentation

◆ doWork()

PetscErrorCode BCs_RVELagrange_Disp::OpRVEBCsRhs::doWork ( int  side,
EntityType  type,
DataForcesAndSourcesCore::EntData data 
)
inline

Definition at line 317 of file BCs_RVELagrange_Disp.hpp.

317  {
318  PetscFunctionBegin;
319 
320  nb_row_dofs = data.getIndices().size();
321 
322  if(nb_row_dofs ==0) PetscFunctionReturn(0);
323  if(dAta.tRis.find(getNumeredEntFiniteElementPtr()->getEnt())==dAta.tRis.end()) PetscFunctionReturn(0);
324 
325  auto weak_ptr_dof =
326  getNumeredEntFiniteElementPtr()->getRowDofsByPetscGlobalDofIdx(
327  data.getIndices()[0]);
328  const FENumeredDofEntity *dof_ptr;
329  if (auto ptr = weak_ptr_dof.lock())
330  dof_ptr = ptr.get();
331  else
332  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Dof not found");
333 
334  rank = dof_ptr->getNbOfCoeffs();
335  nb_row_dofs /= rank;
336 
337  ierr = calculateDmat(side,type,data); CHKERRQ(ierr);
338 
339  //This is to scale givenStrain vector to apply the strian in steps
340  VectorDouble scaled_given_strain;
341  scaled_given_strain.resize(6);
342  scaled_given_strain=givenStrain;
343 // cout <<"givenStrain Before = "<<scaled_given_strain<<endl;
344  ierr = MethodForForceScaling::applyScale(getFEMethod(),methodsOp,scaled_given_strain); CHKERRQ(ierr);
345 // cout <<"givenStrain After = "<<scaled_given_strain<<endl;
346  f.resize(D_mat.size1(),false);
347  noalias(f) = prod(D_mat, scaled_given_strain);
348  f*=-1;
349 
350 // cout <<"f = "<<f<<endl;
351 // string wait;
352 // cin>>wait;
353 
354  Vec myF = F;
355  if(F == PETSC_NULL) {
356  myF = getFEMethod()->snes_f;
357  }
358 
359  ierr = VecSetValues(myF,data.getIndices().size(),&data.getIndices()[0],&f[0],ADD_VALUES); CHKERRQ(ierr);
360  PetscFunctionReturn(0);
361  }

Member Data Documentation

◆ F

Vec BCs_RVELagrange_Disp::OpRVEBCsRhs::F

Definition at line 306 of file BCs_RVELagrange_Disp.hpp.

◆ givenStrain

VectorDouble BCs_RVELagrange_Disp::OpRVEBCsRhs::givenStrain

Definition at line 307 of file BCs_RVELagrange_Disp.hpp.

◆ methodsOp

boost::ptr_vector<MethodForForceScaling>& BCs_RVELagrange_Disp::OpRVEBCsRhs::methodsOp

Definition at line 308 of file BCs_RVELagrange_Disp.hpp.


The documentation for this struct was generated from the following file:
BCs_RVELagrange_Disp::OpDmatRhs::D_mat
MatrixDouble D_mat
Definition: BCs_RVELagrange_Disp.hpp:234
BCs_RVELagrange_Disp::OpDmatRhs::f
VectorDouble f
Definition: BCs_RVELagrange_Disp.hpp:233
BCs_RVELagrange_Disp::RVEBC_Data::tRis
Range tRis
Definition: BCs_RVELagrange_Disp.hpp:54
MoFEM::VecSetValues
MoFEMErrorCode VecSetValues(Vec V, const EntitiesFieldData::EntData &data, const double *ptr, InsertMode iora)
Assemble PETSc vector.
Definition: EntitiesFieldData.hpp:1576
BCs_RVELagrange_Disp::OpDmatRhs::nb_row_dofs
int nb_row_dofs
Definition: BCs_RVELagrange_Disp.hpp:236
BCs_RVELagrange_Disp::OpRVEBCsRhs::methodsOp
boost::ptr_vector< MethodForForceScaling > & methodsOp
Definition: BCs_RVELagrange_Disp.hpp:308
convert.type
type
Definition: convert.py:64
BCs_RVELagrange_Disp::OpRVEBCsRhs::F
Vec F
Definition: BCs_RVELagrange_Disp.hpp:306
BCs_RVELagrange_Disp::OpDmatRhs::rank
int rank
Definition: BCs_RVELagrange_Disp.hpp:236
BCs_RVELagrange_Disp::OpDmatRhs::calculateDmat
PetscErrorCode calculateDmat(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
Definition: BCs_RVELagrange_Disp.hpp:238
field_name
constexpr auto field_name
Definition: poisson_2d_homogeneous.cpp:13
BCs_RVELagrange_Disp::OpDmatRhs::OpDmatRhs
OpDmatRhs(const string field_name, const string lagrang_field_name, RVEBC_Data &data, bool ho_geometry=false)
Definition: BCs_RVELagrange_Disp.hpp:223
BCs_RVELagrange_Disp::OpDmatRhs::dAta
RVEBC_Data & dAta
Definition: BCs_RVELagrange_Disp.hpp:220
MoFEM::Exceptions::ierr
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:76
BCs_RVELagrange_Disp::OpRVEBCsRhs::givenStrain
VectorDouble givenStrain
Definition: BCs_RVELagrange_Disp.hpp:307
EigenMatrix::Vec
const FTensor::Tensor2< T, Dim, Dim > Vec
Definition: MatrixFunction.hpp:66
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
MoFEM::Types::VectorDouble
UBlasVector< double > VectorDouble
Definition: Types.hpp:68
MethodForForceScaling::applyScale
static MoFEMErrorCode applyScale(const FEMethod *fe, boost::ptr_vector< MethodForForceScaling > &methods_op, VectorDouble &nf)
Definition: MethodForForceScaling.hpp:21