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

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

Inherits UserDataOperator.

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

Public Member Functions

 OpImpedanceLhs_D (const string re_field_name, const string im_field_name, ImpedanceData &data, BlockData &block_data, MatrixDouble &ho_coords, bool _ho_geometry=false)
 
 OpImpedanceLhs_D (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 real part of lhs equations More...
 

Public Attributes

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

Detailed Description

Definition at line 1488 of file HelmholtzElementObsolete.hpp.

Constructor & Destructor Documentation

◆ OpImpedanceLhs_D() [1/2]

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

◆ OpImpedanceLhs_D() [2/2]

MoFEM::HelmholtzElement::OpImpedanceLhs_D::OpImpedanceLhs_D ( 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_D::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 real part of lhs equations

K = intS 1/R N^T N dS see <<Plane-wave basis finite elements and boundary elements for three-dimensional wave scattering>> by E. Perrey-Debain, O. Laghrouche, P. Bettess and J. Trevelyan for details.

Definition at line 1514 of file HelmholtzElementObsolete.hpp.

1518  {
1519  PetscFunctionBegin;
1520 
1521  try {
1522 
1523  if(row_data.getIndices().size()==0) PetscFunctionReturn(0);
1524  if(col_data.getIndices().size()==0) PetscFunctionReturn(0);
1525 
1526  int nb_row = row_data.getIndices().size();
1527  int nb_col = col_data.getIndices().size();
1528  K.resize(nb_row,nb_col);
1529  bzero(&*K.data().begin(),nb_row*nb_col*sizeof(double));
1530 
1531  for(unsigned int gg = 0;gg<row_data.getN().size1();gg++) {
1532  double val = getGaussPts()(2,gg);
1533 
1534  unsigned int nb_gauss_pts = row_data.getN().size1();
1535  double x,y,z;
1536  if(hoCoords.size1() == nb_gauss_pts) {
1537  double area = norm_2(getNormals_at_GaussPt(gg))*0.5;
1538  val *= area;
1539  x = hoCoords(gg,0);
1540  y = hoCoords(gg,1);
1541  z = hoCoords(gg,2);
1542  } else {
1543  val *= getArea();
1544  x = getCoordsAtGaussPts()(gg,0);
1545  y = getCoordsAtGaussPts()(gg,1);
1546  z = getCoordsAtGaussPts()(gg,2);
1547  }
1548  double r_inv = 1/(2*(sqrt(pow(x,2.0)+pow(y,2.0)))); //inverse radius
1549  noalias(K) += val*r_inv*outer_prod( row_data.getN(gg,nb_row),col_data.getN(gg,nb_col) );
1550 
1551  }
1552 
1553 
1554  PetscErrorCode ierr;
1555  if(!useTsB) {
1556  const_cast<FEMethod*>(getFEMethod())->ts_B = A;
1557  }
1558  ierr = MatSetValues(
1559  (getFEMethod()->ts_B),
1560  nb_row,&row_data.getIndices()[0],
1561  nb_col,&col_data.getIndices()[0],
1562  &K(0,0),ADD_VALUES); CHKERRQ(ierr);
1563  if(row_side != col_side || row_type != col_type) {
1564  transK.resize(nb_col,nb_row);
1565  noalias(transK) = trans( K );
1566  ierr = MatSetValues(
1567  (getFEMethod()->ts_B),
1568  nb_col,&col_data.getIndices()[0],
1569  nb_row,&row_data.getIndices()[0],
1570  &transK(0,0),ADD_VALUES); CHKERRQ(ierr);
1571  }
1572 
1573 
1574  } catch (const std::exception& ex) {
1575  ostringstream ss;
1576  ss << "throw in method: " << ex.what() << endl;
1577  SETERRQ(PETSC_COMM_SELF,1,ss.str().c_str());
1578  }
1579 
1580  PetscFunctionReturn(0);
1581  }
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_D::A

Definition at line 1501 of file HelmholtzElementObsolete.hpp.

◆ blockData

BlockData& MoFEM::HelmholtzElement::OpImpedanceLhs_D::blockData

Definition at line 1491 of file HelmholtzElementObsolete.hpp.

◆ dAta

ImpedanceData& MoFEM::HelmholtzElement::OpImpedanceLhs_D::dAta

Definition at line 1490 of file HelmholtzElementObsolete.hpp.

◆ ho_geometry

bool MoFEM::HelmholtzElement::OpImpedanceLhs_D::ho_geometry

Definition at line 1493 of file HelmholtzElementObsolete.hpp.

◆ hoCoords

MatrixDouble& MoFEM::HelmholtzElement::OpImpedanceLhs_D::hoCoords

Definition at line 1492 of file HelmholtzElementObsolete.hpp.

◆ K

MatrixDouble MoFEM::HelmholtzElement::OpImpedanceLhs_D::K

Definition at line 1507 of file HelmholtzElementObsolete.hpp.

◆ transK

MatrixDouble MoFEM::HelmholtzElement::OpImpedanceLhs_D::transK

Definition at line 1507 of file HelmholtzElementObsolete.hpp.

◆ useTsB

bool MoFEM::HelmholtzElement::OpImpedanceLhs_D::useTsB

Definition at line 1494 of file HelmholtzElementObsolete.hpp.


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