v0.9.0
Public Member Functions | Public Attributes | List of all members
MoFEM::HelmholtzElement::OpImpedanceLhs_imreC 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_imreC:
[legend]

Public Member Functions

 OpImpedanceLhs_imreC (const string re_field_name, const string im_field_name, ImpedanceData &data, BlockData &block_data, MatrixDouble &ho_coords, bool _ho_geometry=false)
 
 OpImpedanceLhs_imreC (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 1399 of file HelmholtzElementObsolete.hpp.

Constructor & Destructor Documentation

◆ OpImpedanceLhs_imreC() [1/2]

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

◆ OpImpedanceLhs_imreC() [2/2]

MoFEM::HelmholtzElement::OpImpedanceLhs_imreC::OpImpedanceLhs_imreC ( 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_imreC::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 1423 of file HelmholtzElementObsolete.hpp.

1427  {
1428  PetscFunctionBegin;
1429 
1430  try {
1431 
1432  if(row_data.getIndices().size()==0) PetscFunctionReturn(0);
1433  if(col_data.getIndices().size()==0) PetscFunctionReturn(0);
1434 
1435  int nb_row = row_data.getIndices().size();
1436  int nb_col = col_data.getIndices().size();
1437  K.resize(nb_row,nb_col);
1438  bzero(&*K.data().begin(),nb_row*nb_col*sizeof(double));
1439 
1440  for(unsigned int gg = 0;gg<row_data.getN().size1();gg++) {
1441 
1442  double waveNumber = blockData.aNgularfreq/blockData.sPeed;
1443  double val = getGaussPts()(2,gg);
1444 
1445  unsigned int nb_gauss_pts = row_data.getN().size1();
1446  double impedanceConst = -dAta.sIgma*waveNumber;
1447  if(hoCoords.size1() == nb_gauss_pts) {
1448  double area = norm_2(getNormals_at_GaussPt(gg))*0.5;
1449  val *= area;
1450  } else {
1451  val *= getArea();
1452  }
1453  noalias(K) += val*impedanceConst*outer_prod( row_data.getN(gg,nb_row),col_data.getN(gg,nb_col) );
1454 
1455  }
1456 
1457  PetscErrorCode ierr;
1458  if(!useTsB) {
1459  const_cast<FEMethod*>(getFEMethod())->ts_B = A; //to change the pointer getFEMethod()'s private member ts_B value with A.
1460  } //getFEMethod() belong to class MoFEM::Interface::FEMethod
1461  ierr = MatSetValues(
1462  (getFEMethod()->ts_B),
1463  nb_row,&row_data.getIndices()[0], //MatSetValues(A,i,m,j,n,value,INSERT_VALUES,ierr), i*j the size of input matrix,
1464  nb_col,&col_data.getIndices()[0], // m and n - the position of parent matrix to allowed the input matrix.
1465  &K(0,0),ADD_VALUES); CHKERRQ(ierr);
1466  if(row_side != col_side || row_type != col_type) {
1467  transK.resize(nb_col,nb_row);
1468  noalias(transK) = trans( K );
1469  ierr = MatSetValues(
1470  (getFEMethod()->ts_B),
1471  nb_col,&col_data.getIndices()[0],
1472  nb_row,&row_data.getIndices()[0],
1473  &transK(0,0),ADD_VALUES); CHKERRQ(ierr);
1474  }
1475 
1476 
1477  } catch (const std::exception& ex) {
1478  ostringstream ss;
1479  ss << "throw in method: " << ex.what() << endl;
1480  SETERRQ(PETSC_COMM_SELF,1,ss.str().c_str());
1481  }
1482 
1483  PetscFunctionReturn(0);
1484  }
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_imreC::A

Definition at line 1412 of file HelmholtzElementObsolete.hpp.

◆ blockData

BlockData& MoFEM::HelmholtzElement::OpImpedanceLhs_imreC::blockData

Definition at line 1402 of file HelmholtzElementObsolete.hpp.

◆ dAta

ImpedanceData& MoFEM::HelmholtzElement::OpImpedanceLhs_imreC::dAta

Definition at line 1401 of file HelmholtzElementObsolete.hpp.

◆ ho_geometry

bool MoFEM::HelmholtzElement::OpImpedanceLhs_imreC::ho_geometry

Definition at line 1404 of file HelmholtzElementObsolete.hpp.

◆ hoCoords

MatrixDouble& MoFEM::HelmholtzElement::OpImpedanceLhs_imreC::hoCoords

Definition at line 1403 of file HelmholtzElementObsolete.hpp.

◆ K

MatrixDouble MoFEM::HelmholtzElement::OpImpedanceLhs_imreC::K

Definition at line 1418 of file HelmholtzElementObsolete.hpp.

◆ transK

MatrixDouble MoFEM::HelmholtzElement::OpImpedanceLhs_imreC::transK

Definition at line 1418 of file HelmholtzElementObsolete.hpp.

◆ useTsB

bool MoFEM::HelmholtzElement::OpImpedanceLhs_imreC::useTsB

Definition at line 1405 of file HelmholtzElementObsolete.hpp.


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