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

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

Inherits UserDataOperator.

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

Public Member Functions

 OpHelmholtzRhs_Im (const string re_field_name, const string im_field_name, BlockData &data, CommonData &common_data)
 
 OpHelmholtzRhs_Im (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_Im
 
VectorDouble Nf
 

Detailed Description

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

Definition at line 526 of file HelmholtzElementObsolete.hpp.

Constructor & Destructor Documentation

◆ OpHelmholtzRhs_Im() [1/2]

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

◆ OpHelmholtzRhs_Im() [2/2]

MoFEM::HelmholtzElement::OpHelmholtzRhs_Im::OpHelmholtzRhs_Im ( 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_Im::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 550 of file HelmholtzElementObsolete.hpp.

551  {
552  PetscFunctionBegin;
553 
554  if(dAta.tEts.find(getMoFEMFEPtr()->get_ent()) == dAta.tEts.end()) {
555  PetscFunctionReturn(0);
556  }
557 
558  try {
559 
560  if(data.getIndices().size()==0) PetscFunctionReturn(0);
561  if(dAta.tEts.find(getMoFEMFEPtr()->get_ent())==dAta.tEts.end()) PetscFunctionReturn(0);
562 
563  PetscErrorCode ierr;
564 
565  /* moFEM tip: use "row_data.getIndices().size()" instead of "row_data.getN().size2()" for nb_row_dofs
566  the former can cause problems with mix approximation orders */
567 
568  int nb_row_dofs = data.getIndices().size();
569  Nf.resize(nb_row_dofs);
570  bzero(&*Nf.data().begin(),data.getIndices().size()*sizeof(FieldData));
571 
572 
573  double wAvenumber = dAta.aNgularfreq/dAta.sPeed;
574  double wAvenUmber = pow(wAvenumber,2.0);
575  dNdT_Im.resize(nb_row_dofs);
576 
577  for(unsigned int gg = 0;gg<data.getN().size1();gg++) {
578 
579  double val = getVolume()*getGaussPts()(3,gg);
580 
581  if(getHoGaussPtsDetJac().size()>0) {
582  val *= getHoGaussPtsDetJac()[gg]; ///< higher order geometry
583  }
584 
585  dNdT_Im.clear();
586  /* k^2 N^T q */
587  double const_kT_Im = wAvenUmber*commonData.pressureImAtGaussPts[gg];
588  /* diffN^T diffN q */
589  ublas::noalias(dNdT_Im) = prod(data.getDiffN(gg,nb_row_dofs),commonData.getGradImAtGaussPts(gg));
590  /* diffN^T diffN q - k^2 N^T N q lift of helmholtz operator*/
591 
592  cblas_daxpy(nb_row_dofs, -const_kT_Im, &data.getN(gg,nb_row_dofs)[0], 1, &dNdT_Im[0], 1);
593  /* insufficient, FIX ME*/
594  ublas::noalias(Nf) += val*(dNdT_Im);
595 
596  }
597 
598  if(useTsF) {
599  ierr = VecSetValues(getFEMethod()->ts_F,data.getIndices().size(),
600  &data.getIndices()[0],&Nf[0],ADD_VALUES); CHKERRQ(ierr);
601  } else {
602  ierr = VecSetValues(F,data.getIndices().size(),
603  &data.getIndices()[0],&Nf[0],ADD_VALUES); CHKERRQ(ierr);
604 
605  }
606 
607  } catch (const std::exception& ex) {
608  ostringstream ss;
609  ss << "throw in method: " << ex.what() << endl;
610  SETERRQ(PETSC_COMM_SELF,1,ss.str().c_str());
611  }
612 
613  PetscFunctionReturn(0);
614  }
ublas::matrix_row< MatrixDouble > getGradImAtGaussPts(const int gg)
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
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_Im::commonData

Definition at line 529 of file HelmholtzElementObsolete.hpp.

◆ dAta

BlockData& MoFEM::HelmholtzElement::OpHelmholtzRhs_Im::dAta

Definition at line 528 of file HelmholtzElementObsolete.hpp.

◆ dNdT_Im

VectorDouble MoFEM::HelmholtzElement::OpHelmholtzRhs_Im::dNdT_Im

Definition at line 542 of file HelmholtzElementObsolete.hpp.

◆ F

Vec MoFEM::HelmholtzElement::OpHelmholtzRhs_Im::F

Definition at line 536 of file HelmholtzElementObsolete.hpp.

◆ Nf

VectorDouble MoFEM::HelmholtzElement::OpHelmholtzRhs_Im::Nf

Definition at line 543 of file HelmholtzElementObsolete.hpp.

◆ useTsF

bool MoFEM::HelmholtzElement::OpHelmholtzRhs_Im::useTsF

Definition at line 530 of file HelmholtzElementObsolete.hpp.


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