v0.13.2
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
BCs_RVELagrange_Disp::OpRVEBCsRhsForceExternal_CU Struct Reference

\biref operator to calculate and assemble CU More...

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

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

Public Member Functions

 OpRVEBCsRhsForceExternal_CU (const string field_name, const string lagrang_field_name, Vec f, CommonFunctions &_common_functions, RVEBC_Data &data, bool ho_geometry=false)
 
PetscErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
 

Public Attributes

bool hoGeometry
 
Vec F
 
RVEBC_DatadAta
 
CommonFunctions commonFunctions
 
MatrixDouble K
 
MatrixDouble transK
 
MatrixDouble N_mat_row
 
MatrixDouble N_mat_col
 
VectorDouble CU
 
VectorDouble CTLam
 

Detailed Description

\biref operator to calculate and assemble CU

Definition at line 438 of file BCs_RVELagrange_Disp.hpp.

Constructor & Destructor Documentation

◆ OpRVEBCsRhsForceExternal_CU()

BCs_RVELagrange_Disp::OpRVEBCsRhsForceExternal_CU::OpRVEBCsRhsForceExternal_CU ( const string  field_name,
const string  lagrang_field_name,
Vec  f,
CommonFunctions _common_functions,
RVEBC_Data data,
bool  ho_geometry = false 
)
inline

Definition at line 446 of file BCs_RVELagrange_Disp.hpp.

449 :
450 FaceElementForcesAndSourcesCore::UserDataOperator(
451 lagrang_field_name, field_name, UserDataOperator::OPROWCOL
452 ),
453 dAta(data),hoGeometry(ho_geometry),F(f), commonFunctions(_common_functions){
454 // This will make sure to loop over all entities
455 // (e.g. for order=2 it will make doWork to loop 16 time)
456 sYmm = false;
457 }
constexpr auto field_name

Member Function Documentation

◆ doWork()

PetscErrorCode BCs_RVELagrange_Disp::OpRVEBCsRhsForceExternal_CU::doWork ( int  row_side,
int  col_side,
EntityType  row_type,
EntityType  col_type,
DataForcesAndSourcesCore::EntData &  row_data,
DataForcesAndSourcesCore::EntData &  col_data 
)
inline

Definition at line 462 of file BCs_RVELagrange_Disp.hpp.

467 {
468 PetscFunctionBegin;
469
470 try {
471 int nb_row = row_data.getIndices().size();
472 int nb_col = col_data.getIndices().size();
473
474 if(nb_row == 0) PetscFunctionReturn(0);
475 if(nb_col == 0) PetscFunctionReturn(0);
476
477 auto weak_ptr_dof =
478 getNumeredEntFiniteElementPtr()->getRowDofsByPetscGlobalDofIdx(
479 row_data.getIndices()[0]);
480 const FENumeredDofEntity *dof_ptr;
481 if (auto ptr = weak_ptr_dof.lock())
482 dof_ptr = ptr.get();
483 else
484 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Dof not found");
485
486 int rank = dof_ptr->getNbOfCoeffs();
487
488 for(unsigned int gg = 0;gg<row_data.getN().size1();gg++) {
489 double area;
490 if(hoGeometry) {
491 area = norm_2(getNormalsAtGaussPts(gg))*0.5;
492 } else {
493 area = getArea();
494 }
495 double val = getGaussPts()(2,gg)*area;
496 ierr = commonFunctions.shapeMat(rank, gg, row_data, N_mat_row); CHKERRQ(ierr);
497 ierr = commonFunctions.shapeMat(rank, gg, col_data, N_mat_col); CHKERRQ(ierr);
498
499// cout<<"row_data.getN() "<<row_data.getN()<<endl;
500// cout<<"N_mat_row() "<<N_mat_row<<endl;
501//
502// cout<<"col_data.getN() "<<col_data.getN()<<endl;
503// cout<<"N_mat_col "<<N_mat_col<<endl;
504
505 if(gg==0){
506 K =val* prod(trans(N_mat_row),N_mat_col); //we don't need to define size K
507 } else {
508 K += val*prod(trans(N_mat_row),N_mat_col);
509 }
510 }
511 CU=prod(K, col_data.getFieldData());
512 CTLam=prod(trans(K),row_data.getFieldData());
513
514
515 Vec myF = F;
516 if(F == PETSC_NULL) {
517 myF = getFEMethod()->snes_f;
518 }
519
520 ierr = VecSetValues(myF,row_data.getIndices().size(),&row_data.getIndices()[0],&CU[0],ADD_VALUES); CHKERRQ(ierr);
521 ierr = VecSetValues(myF,col_data.getIndices().size(),&col_data.getIndices()[0],&CTLam[0],ADD_VALUES); CHKERRQ(ierr);
522
523 } catch (const std::exception& ex) {
524 ostringstream ss;
525 ss << "throw in method: " << ex.what() << endl;
526 SETERRQ(PETSC_COMM_SELF,1,ss.str().c_str());
527 }
528
529 PetscFunctionReturn(0);
530 }
static PetscErrorCode ierr
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
const FTensor::Tensor2< T, Dim, Dim > Vec
MoFEMErrorCode VecSetValues(Vec V, const EntitiesFieldData::EntData &data, const double *ptr, InsertMode iora)
Assemble PETSc vector.
PetscErrorCode shapeMat(int rank, unsigned int gg, DataForcesAndSourcesCore::EntData &col_data, MatrixDouble &N_mat)

Member Data Documentation

◆ commonFunctions

CommonFunctions BCs_RVELagrange_Disp::OpRVEBCsRhsForceExternal_CU::commonFunctions

Definition at line 443 of file BCs_RVELagrange_Disp.hpp.

◆ CTLam

VectorDouble BCs_RVELagrange_Disp::OpRVEBCsRhsForceExternal_CU::CTLam

Definition at line 460 of file BCs_RVELagrange_Disp.hpp.

◆ CU

VectorDouble BCs_RVELagrange_Disp::OpRVEBCsRhsForceExternal_CU::CU

Definition at line 460 of file BCs_RVELagrange_Disp.hpp.

◆ dAta

RVEBC_Data& BCs_RVELagrange_Disp::OpRVEBCsRhsForceExternal_CU::dAta

Definition at line 442 of file BCs_RVELagrange_Disp.hpp.

◆ F

Vec BCs_RVELagrange_Disp::OpRVEBCsRhsForceExternal_CU::F

Definition at line 441 of file BCs_RVELagrange_Disp.hpp.

◆ hoGeometry

bool BCs_RVELagrange_Disp::OpRVEBCsRhsForceExternal_CU::hoGeometry

Definition at line 440 of file BCs_RVELagrange_Disp.hpp.

◆ K

MatrixDouble BCs_RVELagrange_Disp::OpRVEBCsRhsForceExternal_CU::K

Definition at line 459 of file BCs_RVELagrange_Disp.hpp.

◆ N_mat_col

MatrixDouble BCs_RVELagrange_Disp::OpRVEBCsRhsForceExternal_CU::N_mat_col

Definition at line 459 of file BCs_RVELagrange_Disp.hpp.

◆ N_mat_row

MatrixDouble BCs_RVELagrange_Disp::OpRVEBCsRhsForceExternal_CU::N_mat_row

Definition at line 459 of file BCs_RVELagrange_Disp.hpp.

◆ transK

MatrixDouble BCs_RVELagrange_Disp::OpRVEBCsRhsForceExternal_CU::transK

Definition at line 459 of file BCs_RVELagrange_Disp.hpp.


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