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

\biref operator to calculate the LHS for the RVE bounary conditions More...

#include "users_modules/mofem_um_homogenisation/src/BCs_RVELagrange_Disp.hpp"

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

Public Member Functions

 OpRVEBCsLhs (const string field_name, const string lagrang_field_name, Mat aij, RVEBC_Data &data, bool ho_geometry=false)
 
PetscErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSurcesCore::EntData &row_data, DataForcesAndSurcesCore::EntData &col_data)
 calculate thermal convection term in the lhs of equations
 

Public Attributes

RVEBC_DatadAta
 
bool hoGeometry
 
Mat Aij
 
MatrixDouble K
 
MatrixDouble transK
 

Detailed Description

\biref operator to calculate the LHS for the RVE bounary conditions

Definition at line 101 of file BCs_RVELagrange_Disp.hpp.

Constructor & Destructor Documentation

◆ OpRVEBCsLhs()

BCs_RVELagrange_Disp::OpRVEBCsLhs::OpRVEBCsLhs ( const string  field_name,
const string  lagrang_field_name,
Mat  aij,
RVEBC_Data data,
bool  ho_geometry = false 
)
inline

Definition at line 106 of file BCs_RVELagrange_Disp.hpp.

109 :
110 FaceElementForcesAndSourcesCore::UserDataOperator(
111 lagrang_field_name, field_name, UserDataOperator::OPROWCOL
112 ),
113 dAta(data),hoGeometry(ho_geometry),Aij(aij) {
114 // This will make sure to loop over all entities
115 // (e.g. for order=2 it will make doWork to loop 16 time)
116 sYmm = false;
117 }
constexpr auto field_name
@ OPROWCOL
operator doWork is executed on FE rows &columns

Member Function Documentation

◆ doWork()

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

calculate thermal convection term in the lhs of equations

C = intS N^T N dS

Definition at line 125 of file BCs_RVELagrange_Disp.hpp.

130 {
131 PetscFunctionBegin;
132
133 try {
134 int nb_row = row_data.getIndices().size();
135 int nb_col = col_data.getIndices().size();
136
137 if(nb_row == 0) PetscFunctionReturn(0);
138 if(nb_col == 0) PetscFunctionReturn(0);
139
140
141 const FENumeredDofEntity *dof_ptr;
142 ierr = getNumeredEntFiniteElementPtr()->getRowDofsByPetscGlobalDofIdx(row_data.getIndices()[0],&dof_ptr); CHKERRQ(ierr);
143 int rank = dof_ptr->getNbOfCoeffs();
144
145 K.resize(nb_row/rank,nb_col/rank);
146 K.clear();
147
148 for(unsigned int gg = 0;gg<row_data.getN().size1();gg++) {
149 double area;
150 if(hoGeometry) {
151 area = norm_2(getNormalsAtGaussPt(gg))*0.5;
152 } else {
153 area = getArea();
154 }
155 double val = getGaussPts()(2,gg)*area;
156 noalias(K) += val*outer_prod(
157 row_data.getN(gg,nb_row/rank),col_data.getN(gg,nb_col/rank)
158 );
159 }
160
161 VectorInt row_indices,col_indices;
162 row_indices.resize(nb_row/rank);
163 col_indices.resize(nb_col/rank);
164
165 for(int rr = 0;rr < rank; rr++) {
166 unsigned int nb_rows;
167 unsigned int nb_cols;
168 int *rows;
169 int *cols;
170 if(rank > 1) {
171
172 ublas::noalias(row_indices) = ublas::vector_slice<VectorInt >
173 (row_data.getIndices(), ublas::slice(rr, rank, row_data.getIndices().size()/rank));
174
175 ublas::noalias(col_indices) = ublas::vector_slice<VectorInt >
176 (col_data.getIndices(), ublas::slice(rr, rank, col_data.getIndices().size()/rank));
177
178 nb_rows = row_indices.size();
179 nb_cols = col_indices.size();
180 rows = &*row_indices.data().begin();
181 cols = &*col_indices.data().begin();
182
183 } else {
184
185 nb_rows = row_data.getIndices().size();
186 nb_cols = col_data.getIndices().size();
187 rows = &*row_data.getIndices().data().begin();
188 cols = &*col_data.getIndices().data().begin();
189
190 }
191
192 // Matrix C
193 ierr = MatSetValues(Aij,nb_rows,rows,nb_cols,cols,&K(0,0),ADD_VALUES); CHKERRQ(ierr);
194
195 // Matrix CT
196 transK.resize(nb_col/rank,nb_row/rank);
197 noalias(transK) = trans(K);
198 ierr = MatSetValues(Aij,nb_cols,cols,nb_rows,rows,&transK(0,0),ADD_VALUES); CHKERRQ(ierr);
199
200 }
201
202 } catch (const std::exception& ex) {
203 ostringstream ss;
204 ss << "throw in method: " << ex.what() << endl;
205 SETERRQ(PETSC_COMM_SELF,1,ss.str().c_str());
206 }
207
208 PetscFunctionReturn(0);
209 }
static PetscErrorCode ierr
UBlasVector< int > VectorInt
Definition Types.hpp:67
MoFEMErrorCode MatSetValues(Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const double *ptr, InsertMode iora)
Assemble PETSc matrix.

Member Data Documentation

◆ Aij

Mat BCs_RVELagrange_Disp::OpRVEBCsLhs::Aij

Definition at line 105 of file BCs_RVELagrange_Disp.hpp.

◆ dAta

RVEBC_Data& BCs_RVELagrange_Disp::OpRVEBCsLhs::dAta

Definition at line 103 of file BCs_RVELagrange_Disp.hpp.

◆ hoGeometry

bool BCs_RVELagrange_Disp::OpRVEBCsLhs::hoGeometry

Definition at line 104 of file BCs_RVELagrange_Disp.hpp.

◆ K

MatrixDouble BCs_RVELagrange_Disp::OpRVEBCsLhs::K

Definition at line 119 of file BCs_RVELagrange_Disp.hpp.

◆ transK

MatrixDouble BCs_RVELagrange_Disp::OpRVEBCsLhs::transK

Definition at line 119 of file BCs_RVELagrange_Disp.hpp.


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