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

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

Inherits UserDataOperator.

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

Public Member Functions

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

Public Attributes

BlockDatadAta
 
CommonDatacommonData
 
bool useTsF
 
Vec F
 
VectorDouble dNdT_Re
 
VectorDouble Nf
 

Detailed Description

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

Definition at line 429 of file HelmholtzElementObsolete.hpp.

Constructor & Destructor Documentation

◆ OpHelmholtzRhs_Re() [1/2]

MoFEM::HelmholtzElement::OpHelmholtzRhs_Re::OpHelmholtzRhs_Re ( const string  re_field_name,
const string  im_field_name,
BlockData data,
CommonData common_data 
)

◆ OpHelmholtzRhs_Re() [2/2]

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

Member Function Documentation

◆ doWork()

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

calculate helmholtz operator apply on lift.

F = int diffN^T gard_T0 - N^T k T0 dOmega^2

Definition at line 453 of file HelmholtzElementObsolete.hpp.

454  {
455  PetscFunctionBegin;
456 
457  if(dAta.tEts.find(getMoFEMFEPtr()->get_ent()) == dAta.tEts.end()) {
458  PetscFunctionReturn(0);
459  }
460 
461  try {
462 
463  if(data.getIndices().size()==0) PetscFunctionReturn(0);
464  if(dAta.tEts.find(getMoFEMFEPtr()->get_ent())==dAta.tEts.end()) PetscFunctionReturn(0);
465 
466  PetscErrorCode ierr;
467 
468  /* moFEM tip: use "row_data.getIndices().size()" instead of "row_data.getN().size2()" for nb_row_dofs
469  the former can cause problems with mix approximation orders */
470 
471  int nb_row_dofs = data.getIndices().size();
472  Nf.resize(nb_row_dofs);
473  bzero(&*Nf.data().begin(),data.getIndices().size()*sizeof(FieldData));
474 
475  //wave number K is the propotional to the frequency of incident wave
476  //and represents number of waves per wave length 2Pi - 2Pi/K
477  double wAvenumber = dAta.aNgularfreq/dAta.sPeed;
478  double wAvenUmber = pow(wAvenumber,2.0);
479  dNdT_Re.resize(nb_row_dofs);
480 
481  for(unsigned int gg = 0;gg<data.getN().size1();gg++) {
482 
483  double val = getVolume()*getGaussPts()(3,gg);
484 
485  if(getHoGaussPtsDetJac().size()>0) {
486  val *= getHoGaussPtsDetJac()[gg]; ///< higher order geometry
487  }
488 
489  dNdT_Re.clear();
490  /* k^2 N^T q */
491  double const_kT_Re = wAvenUmber*commonData.pressureReAtGaussPts[gg];
492  /* diffN^T diffN q */
493  ublas::noalias(dNdT_Re) = prod(data.getDiffN(gg,nb_row_dofs),commonData.getGradReAtGaussPts(gg));
494  /* diffN^T diffN q - k^2 N^T N q lift of helmholtz operator*/
495 
496  cblas_daxpy(nb_row_dofs, -const_kT_Re, &data.getN(gg,nb_row_dofs)[0], 1, &dNdT_Re[0], 1);
497  /* insufficient, FIX ME*/
498 
499  ublas::noalias(Nf) += val*(dNdT_Re);
500 
501  }
502 
503  if(useTsF) {
504  ierr = VecSetValues(getFEMethod()->ts_F,data.getIndices().size(),
505  &data.getIndices()[0],&Nf[0],ADD_VALUES); CHKERRQ(ierr);
506  } else {
507  ierr = VecSetValues(F,data.getIndices().size(),
508  &data.getIndices()[0],&Nf[0],ADD_VALUES); CHKERRQ(ierr);
509 
510  }
511 
512  } catch (const std::exception& ex) {
513  ostringstream ss;
514  ss << "throw in method: " << ex.what() << endl;
515  SETERRQ(PETSC_COMM_SELF,1,ss.str().c_str());
516  }
517 
518  PetscFunctionReturn(0);
519  }
void cblas_daxpy(const int N, const double alpha, const double *X, const int incX, double *Y, const int incY)
Definition: cblas_daxpy.c:11
ublas::matrix_row< MatrixDouble > getGradReAtGaussPts(const int gg)
Range tEts
constatins elements in block set
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_Re::commonData

Definition at line 432 of file HelmholtzElementObsolete.hpp.

◆ dAta

BlockData& MoFEM::HelmholtzElement::OpHelmholtzRhs_Re::dAta

Definition at line 431 of file HelmholtzElementObsolete.hpp.

◆ dNdT_Re

VectorDouble MoFEM::HelmholtzElement::OpHelmholtzRhs_Re::dNdT_Re

Definition at line 445 of file HelmholtzElementObsolete.hpp.

◆ F

Vec MoFEM::HelmholtzElement::OpHelmholtzRhs_Re::F

Definition at line 439 of file HelmholtzElementObsolete.hpp.

◆ Nf

VectorDouble MoFEM::HelmholtzElement::OpHelmholtzRhs_Re::Nf

Definition at line 446 of file HelmholtzElementObsolete.hpp.

◆ useTsF

bool MoFEM::HelmholtzElement::OpHelmholtzRhs_Re::useTsF

Definition at line 433 of file HelmholtzElementObsolete.hpp.


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