v0.9.0
Public Member Functions | Public Attributes | List of all members
MoFEM::HelmholtzElement::OpImpedanceLhs_reimC Struct Reference

\biref operator to calculate Impedance on body surface and assemble to imaginary lhs of equations More...

#include <users_modules/helmholtz/src/HelmholtzElementObsolete.hpp>

Inherits UserDataOperator.

Collaboration diagram for MoFEM::HelmholtzElement::OpImpedanceLhs_reimC:
[legend]

Public Member Functions

 OpImpedanceLhs_reimC (const string re_field_name, const string im_field_name, ImpedanceData &data, BlockData &block_data, MatrixDouble &ho_coords, bool _ho_geometry=false)
 
 OpImpedanceLhs_reimC (const string re_field_name, const string im_field_name, Mat _A, ImpedanceData &data, BlockData &block_data, MatrixDouble &ho_coords, 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 helmholtz Impedance term in the imaginary lhs of equations More...
 

Public Attributes

ImpedanceDatadAta
 
BlockDatablockData
 
MatrixDoublehoCoords
 
bool ho_geometry
 
bool useTsB
 
Mat A
 
MatrixDouble K
 
MatrixDouble transK
 

Detailed Description

\biref operator to calculate Impedance on body surface and assemble to imaginary lhs of equations

Definition at line 1309 of file HelmholtzElementObsolete.hpp.

Constructor & Destructor Documentation

◆ OpImpedanceLhs_reimC() [1/2]

MoFEM::HelmholtzElement::OpImpedanceLhs_reimC::OpImpedanceLhs_reimC ( const string  re_field_name,
const string  im_field_name,
ImpedanceData data,
BlockData block_data,
MatrixDouble ho_coords,
bool  _ho_geometry = false 
)

◆ OpImpedanceLhs_reimC() [2/2]

MoFEM::HelmholtzElement::OpImpedanceLhs_reimC::OpImpedanceLhs_reimC ( const string  re_field_name,
const string  im_field_name,
Mat  _A,
ImpedanceData data,
BlockData block_data,
MatrixDouble ho_coords,
bool  _ho_geometry = false 
)

Member Function Documentation

◆ doWork()

PetscErrorCode MoFEM::HelmholtzElement::OpImpedanceLhs_reimC::doWork ( int  row_side,
int  col_side,
EntityType  row_type,
EntityType  col_type,
DataForcesAndSurcesCore::EntData row_data,
DataForcesAndSurcesCore::EntData col_data 
)

calculate helmholtz Impedance term in the imaginary lhs of equations

K = intS N^T i sIgma K N dS

Definition at line 1333 of file HelmholtzElementObsolete.hpp.

1337  {
1338  PetscFunctionBegin;
1339 
1340  try {
1341 
1342  if(row_data.getIndices().size()==0) PetscFunctionReturn(0);
1343  if(col_data.getIndices().size()==0) PetscFunctionReturn(0);
1344 
1345  int nb_row = row_data.getIndices().size();
1346  int nb_col = col_data.getIndices().size();
1347  K.resize(nb_row,nb_col);
1348  bzero(&*K.data().begin(),nb_row*nb_col*sizeof(double));
1349 
1350  for(unsigned int gg = 0;gg<row_data.getN().size1();gg++) { /* Integrate the shape functions in one element */
1351  double waveNumber = blockData.aNgularfreq/blockData.sPeed;
1352  double val = getGaussPts()(2,gg);
1353 
1354  unsigned int nb_gauss_pts = row_data.getN().size1();
1355  double impedanceConst = dAta.sIgma*waveNumber;
1356  if(hoCoords.size1() == nb_gauss_pts) {
1357  double area = norm_2(getNormals_at_GaussPt(gg))*0.5;
1358  val *= area;
1359  } else {
1360  val *= getArea();
1361  }
1362  noalias(K) += val*impedanceConst*outer_prod( row_data.getN(gg,nb_row),col_data.getN(gg,nb_col) );
1363 
1364  }
1365 
1366  PetscErrorCode ierr;
1367  if(!useTsB) {
1368  const_cast<FEMethod*>(getFEMethod())->ts_B = A; //to change the pointer getFEMethod()'s private member ts_B value with A.
1369  } //getFEMethod() belong to class MoFEM::Interface::FEMethod
1370  ierr = MatSetValues(
1371  (getFEMethod()->ts_B),
1372  nb_row,&row_data.getIndices()[0], //MatSetValues(A,i,m,j,n,value,INSERT_VALUES,ierr), i*j the size of input matrix,
1373  nb_col,&col_data.getIndices()[0], // m and n - the position of parent matrix to allowed the input matrix.
1374  &K(0,0),ADD_VALUES); CHKERRQ(ierr);
1375  if(row_side != col_side || row_type != col_type) {
1376  transK.resize(nb_col,nb_row);
1377  noalias(transK) = trans( K );
1378  ierr = MatSetValues(
1379  (getFEMethod()->ts_B),
1380  nb_col,&col_data.getIndices()[0],
1381  nb_row,&row_data.getIndices()[0],
1382  &transK(0,0),ADD_VALUES); CHKERRQ(ierr);
1383  }
1384 
1385 
1386  } catch (const std::exception& ex) {
1387  ostringstream ss;
1388  ss << "throw in method: " << ex.what() << endl;
1389  SETERRQ(PETSC_COMM_SELF,1,ss.str().c_str());
1390  }
1391 
1392  PetscFunctionReturn(0);
1393  }
CHKERRQ(ierr)
MoFEMErrorCode MatSetValues(Mat M, const DataForcesAndSourcesCore::EntData &row_data, const DataForcesAndSourcesCore::EntData &col_data, const double *ptr, InsertMode iora)
Assemble PETSc matrix.

Member Data Documentation

◆ A

Mat MoFEM::HelmholtzElement::OpImpedanceLhs_reimC::A

Definition at line 1322 of file HelmholtzElementObsolete.hpp.

◆ blockData

BlockData& MoFEM::HelmholtzElement::OpImpedanceLhs_reimC::blockData

Definition at line 1312 of file HelmholtzElementObsolete.hpp.

◆ dAta

ImpedanceData& MoFEM::HelmholtzElement::OpImpedanceLhs_reimC::dAta

Definition at line 1311 of file HelmholtzElementObsolete.hpp.

◆ ho_geometry

bool MoFEM::HelmholtzElement::OpImpedanceLhs_reimC::ho_geometry

Definition at line 1314 of file HelmholtzElementObsolete.hpp.

◆ hoCoords

MatrixDouble& MoFEM::HelmholtzElement::OpImpedanceLhs_reimC::hoCoords

Definition at line 1313 of file HelmholtzElementObsolete.hpp.

◆ K

MatrixDouble MoFEM::HelmholtzElement::OpImpedanceLhs_reimC::K

Definition at line 1328 of file HelmholtzElementObsolete.hpp.

◆ transK

MatrixDouble MoFEM::HelmholtzElement::OpImpedanceLhs_reimC::transK

Definition at line 1328 of file HelmholtzElementObsolete.hpp.

◆ useTsB

bool MoFEM::HelmholtzElement::OpImpedanceLhs_reimC::useTsB

Definition at line 1315 of file HelmholtzElementObsolete.hpp.


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