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

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

Inherits UserDataOperator.

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

Public Member Functions

 OpHelmholtzRhs_impedance (const string re_field_name, const string im_field_name, BlockData &data, CommonData &common_data, bool use_real)
 
 OpHelmholtzRhs_impedance (const string re_field_name, const string im_field_name, Vec _F, BlockData &data, CommonData &common_data, bool use_real)
 
PetscErrorCode doWork (int side, EntityType type, DataForcesAndSurcesCore::EntData &data)
 calculate helmholtz operator apply on lift. More...
 

Public Attributes

BlockDatadAta
 
CommonDatacommonData
 
bool useTsF
 
bool useReal
 
Vec F
 
VectorDouble Nf
 

Detailed Description

\biref operator to calculate right hand side of stiffness terms \infroup mofem_helmholtz_elem

Definition at line 622 of file HelmholtzElementObsolete.hpp.

Constructor & Destructor Documentation

◆ OpHelmholtzRhs_impedance() [1/2]

MoFEM::HelmholtzElement::OpHelmholtzRhs_impedance::OpHelmholtzRhs_impedance ( const string  re_field_name,
const string  im_field_name,
BlockData data,
CommonData common_data,
bool  use_real 
)

◆ OpHelmholtzRhs_impedance() [2/2]

MoFEM::HelmholtzElement::OpHelmholtzRhs_impedance::OpHelmholtzRhs_impedance ( const string  re_field_name,
const string  im_field_name,
Vec  _F,
BlockData data,
CommonData common_data,
bool  use_real 
)

Member Function Documentation

◆ doWork()

PetscErrorCode MoFEM::HelmholtzElement::OpHelmholtzRhs_impedance::doWork ( int  side,
EntityType  type,
DataForcesAndSurcesCore::EntData data 
)

calculate helmholtz operator apply on lift.

F = int i K T N^T dS

Definition at line 648 of file HelmholtzElementObsolete.hpp.

649  {
650  PetscFunctionBegin;
651 
652  try {
653 
654  if(data.getIndices().size()==0) PetscFunctionReturn(0);
655  if(dAta.tRis.find(getMoFEMFEPtr()->get_ent())==dAta.tRis.end()) PetscFunctionReturn(0);
656 
657  PetscErrorCode ierr;
658 
659  /* moFEM tip: use "row_data.getIndices().size()" instead of "row_data.getN().size2()" for nb_row_dofs
660  the former can cause problems with mix approximation orders */
661 
662  const FENumeredDofMoFEMEntity *dof_ptr;
663  ierr = getMoFEMFEPtr()->get_row_dofs_by_petsc_gloabl_dof_idx(data.getIndices()[0],&dof_ptr); CHKERRQ(ierr);
664  int rank = dof_ptr->get_max_rank();
665  int nb_row_dofs = data.getIndices().size()/rank;
666 
667  Nf.resize(nb_row_dofs);
668  bzero(&*Nf.data().begin(),data.getIndices().size()*sizeof(FieldData));
669 
670  //wave number K is the propotional to the frequency of incident wave
671  //and represents number of waves per wave length 2Pi - 2Pi/K
672  double k = dAta.aNgularfreq/dAta.sPeed;
673  bool ho_geometry = true; //FIXME
674 
675  for(unsigned int gg = 0;gg<data.getN().size1();gg++) {
676 
677  double val = getGaussPts()(2,gg);
678 
679  if(ho_geometry) {
680  double area = norm_2(getNormals_at_GaussPt(gg))*0.5;
681  val *= area;
682  } else {
683  val *= getArea();
684  }
685 
686 
687  if(useReal) {
688 
689  ublas::noalias(Nf) += val*( - k*commonData.pressureImAtGaussPts(gg)*data.getN(gg,nb_row_dofs));
690 
691  } else{
692 
693  ublas::noalias(Nf) += val*(k*commonData.pressureReAtGaussPts(gg)*data.getN(gg,nb_row_dofs));
694 
695 
696  }
697 
698 
699  }
700 
701  if(useTsF) {
702  ierr = VecSetValues(getFEMethod()->ts_F,data.getIndices().size(),
703  &data.getIndices()[0],&Nf[0],ADD_VALUES); CHKERRQ(ierr);
704  } else {
705  ierr = VecSetValues(F,data.getIndices().size(),
706  &data.getIndices()[0],&Nf[0],ADD_VALUES); CHKERRQ(ierr);
707 
708  }
709 
710  } catch (const std::exception& ex) {
711  ostringstream ss;
712  ss << "throw in method: " << ex.what() << endl;
713  SETERRQ(PETSC_COMM_SELF,1,ss.str().c_str());
714  }
715 
716  PetscFunctionReturn(0);
717  }
CHKERRQ(ierr)
MoFEMErrorCode VecSetValues(Vec V, const DataForcesAndSourcesCore::EntData &data, const double *ptr, InsertMode iora)
Assemble PETSc vector.
double FieldData
Field data type.
Definition: Types.hpp:36

Member Data Documentation

◆ commonData

CommonData& MoFEM::HelmholtzElement::OpHelmholtzRhs_impedance::commonData

Definition at line 625 of file HelmholtzElementObsolete.hpp.

◆ dAta

BlockData& MoFEM::HelmholtzElement::OpHelmholtzRhs_impedance::dAta

Definition at line 624 of file HelmholtzElementObsolete.hpp.

◆ F

Vec MoFEM::HelmholtzElement::OpHelmholtzRhs_impedance::F

Definition at line 633 of file HelmholtzElementObsolete.hpp.

◆ Nf

VectorDouble MoFEM::HelmholtzElement::OpHelmholtzRhs_impedance::Nf

Definition at line 638 of file HelmholtzElementObsolete.hpp.

◆ useReal

bool MoFEM::HelmholtzElement::OpHelmholtzRhs_impedance::useReal

Definition at line 627 of file HelmholtzElementObsolete.hpp.

◆ useTsF

bool MoFEM::HelmholtzElement::OpHelmholtzRhs_impedance::useTsF

Definition at line 626 of file HelmholtzElementObsolete.hpp.


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