v0.14.0
Public Member Functions | Public Attributes | List of all members
BCs_RVELagrange_Periodic::OpRVEHomoStress Struct Reference

\biref operator to calculate the RVE homogenised stress More...

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

Inheritance diagram for BCs_RVELagrange_Periodic::OpRVEHomoStress:
[legend]
Collaboration diagram for BCs_RVELagrange_Periodic::OpRVEHomoStress:
[legend]

Public Member Functions

 OpRVEHomoStress (const string field_name, const string lagrang_field_name, Vec stress_homo, RVEBC_Data_Periodic &data, CommonDataPeriodic &common_data_periodic, CommonFunctionsPeriodic &common_functions_periodic, bool ho_geometry=false)
 
PetscErrorCode doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 
- Public Member Functions inherited from BCs_RVELagrange_Periodic::OpDmatRhs
 OpDmatRhs (const string field_name, const string lagrang_field_name, RVEBC_Data_Periodic &data, CommonDataPeriodic &common_data_periodic, CommonFunctionsPeriodic &common_functions_periodic, bool ho_geometry=false)
 
PetscErrorCode calculateDmat (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 

Public Attributes

Vec Stress_Homo
 
ublas::vector< VectorDouble > Stress_Homo_elem
 
VectorDouble field_data
 
- Public Attributes inherited from BCs_RVELagrange_Periodic::OpDmatRhs
RVEBC_Data_PeriodicdAta
 
bool hoGeometry
 
CommonDataPeriodiccommonDataPeriodic
 
CommonFunctionsPeriodiccommonFunctionsPeriodic
 
ublas::vector< MatrixDouble > X_mat
 
MatrixDouble N_mat
 

Detailed Description

\biref operator to calculate the RVE homogenised stress

Definition at line 1227 of file BCs_RVELagrange_Periodic.hpp.

Constructor & Destructor Documentation

◆ OpRVEHomoStress()

BCs_RVELagrange_Periodic::OpRVEHomoStress::OpRVEHomoStress ( const string  field_name,
const string  lagrang_field_name,
Vec  stress_homo,
RVEBC_Data_Periodic data,
CommonDataPeriodic common_data_periodic,
CommonFunctionsPeriodic common_functions_periodic,
bool  ho_geometry = false 
)
inline

Definition at line 1231 of file BCs_RVELagrange_Periodic.hpp.

1239  :
1240  OpDmatRhs(
1241  field_name,lagrang_field_name,data,common_data_periodic,common_functions_periodic,ho_geometry
1242  ),
1243  Stress_Homo(stress_homo) {
1244  }

Member Function Documentation

◆ doWork()

PetscErrorCode BCs_RVELagrange_Periodic::OpRVEHomoStress::doWork ( int  side,
EntityType  type,
DataForcesAndSourcesCore::EntData data 
)
inline

Definition at line 1249 of file BCs_RVELagrange_Periodic.hpp.

1249  {
1250  PetscFunctionBegin;
1251 
1252  if(data.getIndices().size()==0) PetscFunctionReturn(0);
1253  if(type == MBEDGE && side >= 3) PetscFunctionReturn(0); //ignore second triangel edges (cananical number 6 to 8)
1254  if(type == MBTRI && side == 4) PetscFunctionReturn(0); //ignore second triangel face (cananical number 4)
1255 
1256 
1257  ierr = calculateDmat(side,type,data); CHKERRQ(ierr);
1258 
1259 // cerr << commonDataPeriodic.D_mat[0] << endl;
1260 // cerr << data.getFieldData() << endl;
1261 // cerr << rowFieldName << endl;
1262 // cerr << data.getFieldDofs()[0]->getName() << endl;
1263 // cerr << data.getFieldDofs()[0]->getNbOfCoeffs() << endl;
1264 // cerr << data.getFieldDofs().size() << endl;
1265 // cerr << data.getIndices() << endl;
1266 // */
1267 
1268 
1269  Stress_Homo_elem.resize(2);
1270  if(type == MBVERTEX) {
1271  int nb=data.getFieldData().size()/2; //for one face for nodes only (total indieces are for both faces)
1272  field_data.resize(nb);
1273 
1274  for(int ii=0; ii<nb; ii++){
1275  field_data[ii]=data.getFieldData()[ii];
1276  }
1277  Stress_Homo_elem[0] = prod(trans(commonDataPeriodic.D_mat[0]), -1*field_data); //Lamda=data.getFieldData() is reaction force (so multiply for -1 to get the force)
1278  Stress_Homo_elem[1] = prod(trans(commonDataPeriodic.D_mat[1]), -1*field_data); //Lamda=data.getFieldData() is reaction force (so multiply for -1 to get the force)
1279  }
1280  else{
1281  Stress_Homo_elem[0] = prod(trans(commonDataPeriodic.D_mat[0]), -1*data.getFieldData()); //Lamda=data.getFieldData() is reaction force (so multiply for -1 to get the force)
1282  Stress_Homo_elem[1] = prod(trans(commonDataPeriodic.D_mat[1]), -1*data.getFieldData()); //Lamda=data.getFieldData() is reaction force (so multiply for -1 to get the force)
1283  }
1284 
1285 
1286 // cerr << "field_data "<<field_data << endl;
1287 // cerr << "Stress_Homo_elem[0] "<<Stress_Homo_elem[0] << endl;
1288 // cerr << "Stress_Homo_elem[1] "<<Stress_Homo_elem[1] << endl;
1289 // cerr << "commonDataPeriodic.D_mat[0] "<<commonDataPeriodic.D_mat[0] << endl;
1290 
1291  int Indices6[6]={0, 1, 2, 3, 4, 5};
1292  int Indices3[3]={0, 1, 2};
1293 
1294  int rank = data.getFieldDofs()[0]->getNbOfCoeffs();
1295  switch(rank) {
1296  case 3:
1297  ierr = VecSetValues(Stress_Homo,6,Indices6,&Stress_Homo_elem[0][0],ADD_VALUES); CHKERRQ(ierr);
1298  ierr = VecSetValues(Stress_Homo,6,Indices6,&Stress_Homo_elem[1][0],ADD_VALUES); CHKERRQ(ierr);
1299  break;
1300  case 1:
1301  ierr = VecSetValues(Stress_Homo,3,Indices3,&Stress_Homo_elem[0][0],ADD_VALUES); CHKERRQ(ierr);
1302  ierr = VecSetValues(Stress_Homo,3,Indices3,&Stress_Homo_elem[1][0],ADD_VALUES); CHKERRQ(ierr);
1303  break;
1304  default:
1305  SETERRQ(PETSC_COMM_SELF,1,"not implemented");
1306  }
1307 
1308  PetscFunctionReturn(0);
1309  }

Member Data Documentation

◆ field_data

VectorDouble BCs_RVELagrange_Periodic::OpRVEHomoStress::field_data

Definition at line 1247 of file BCs_RVELagrange_Periodic.hpp.

◆ Stress_Homo

Vec BCs_RVELagrange_Periodic::OpRVEHomoStress::Stress_Homo

Definition at line 1229 of file BCs_RVELagrange_Periodic.hpp.

◆ Stress_Homo_elem

ublas::vector<VectorDouble > BCs_RVELagrange_Periodic::OpRVEHomoStress::Stress_Homo_elem

Definition at line 1246 of file BCs_RVELagrange_Periodic.hpp.


The documentation for this struct was generated from the following file:
BCs_RVELagrange_Periodic::OpDmatRhs::OpDmatRhs
OpDmatRhs(const string field_name, const string lagrang_field_name, RVEBC_Data_Periodic &data, CommonDataPeriodic &common_data_periodic, CommonFunctionsPeriodic &common_functions_periodic, bool ho_geometry=false)
Definition: BCs_RVELagrange_Periodic.hpp:500
BCs_RVELagrange_Periodic::OpDmatRhs::commonDataPeriodic
CommonDataPeriodic & commonDataPeriodic
Definition: BCs_RVELagrange_Periodic.hpp:497
MoFEM::VecSetValues
MoFEMErrorCode VecSetValues(Vec V, const EntitiesFieldData::EntData &data, const double *ptr, InsertMode iora)
Assemble PETSc vector.
Definition: EntitiesFieldData.hpp:1589
BCs_RVELagrange_Periodic::OpDmatRhs::calculateDmat
PetscErrorCode calculateDmat(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
Definition: BCs_RVELagrange_Periodic.hpp:520
convert.type
type
Definition: convert.py:64
BCs_RVELagrange_Periodic::OpRVEHomoStress::Stress_Homo
Vec Stress_Homo
Definition: BCs_RVELagrange_Periodic.hpp:1229
field_name
constexpr auto field_name
Definition: poisson_2d_homogeneous.cpp:13
MoFEM::Exceptions::ierr
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:76
BCs_RVELagrange_Periodic::CommonDataPeriodic::D_mat
ublas::vector< MatrixDouble > D_mat
Definition: BCs_RVELagrange_Periodic.hpp:140
BCs_RVELagrange_Periodic::OpRVEHomoStress::Stress_Homo_elem
ublas::vector< VectorDouble > Stress_Homo_elem
Definition: BCs_RVELagrange_Periodic.hpp:1246
BCs_RVELagrange_Periodic::OpRVEHomoStress::field_data
VectorDouble field_data
Definition: BCs_RVELagrange_Periodic.hpp:1247