v0.9.0
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PoissonExample::Op_g Struct Reference

Assemble constrains vector. More...

#include <users_modules/basic_finite_elements/poisson/src/PoissonOperators.hpp>

Inheritance diagram for PoissonExample::Op_g:
[legend]
Collaboration diagram for PoissonExample::Op_g:
[legend]

Public Types

typedef boost::function< double(const double, const double, const double)> FVal
 

Public Member Functions

 Op_g (FVal f_value, const string field_name="L", const double beta=1)
 
- Public Member Functions inherited from PoissonExample::OpBaseRhs< FaceElementForcesAndSourcesCore::UserDataOperator >
 OpBaseRhs (const std::string field_name)
 
MoFEMErrorCode doWork (int row_side, EntityType row_type, DataForcesAndSourcesCore::EntData &row_data)
 This function is called by finite element. More...
 

Protected Member Functions

MoFEMErrorCode iNtegrate (DataForcesAndSourcesCore::EntData &data)
 Integrate local constrains vector. More...
 
MoFEMErrorCode aSsemble (DataForcesAndSourcesCore::EntData &data)
 assemble constrains vectors More...
 

Protected Attributes

FTensor::Number< 0 > NX
 x-direction index More...
 
FTensor::Number< 1 > NY
 y-direction index More...
 
FTensor::Number< 2 > NZ
 z-direction index More...
 
FVal fValue
 Function pointer evaluating values of "U" at the boundary. More...
 
VectorDouble locVec
 
const double bEta
 
- Protected Attributes inherited from PoissonExample::OpBaseRhs< FaceElementForcesAndSourcesCore::UserDataOperator >
int nbRows
 < error code More...
 
int nbIntegrationPts
 number of integration points More...
 

Detailed Description

Assemble constrains vector.

\[ \mathbf{g} = \int_{\partial\Omega} \boldsymbol\psi \overline{u} \textrm{d}\partial\Omega \]

Examples
analytical_poisson_field_split.cpp.

Definition at line 429 of file PoissonOperators.hpp.

Member Typedef Documentation

◆ FVal

typedef boost::function<double(const double, const double, const double)> PoissonExample::Op_g::FVal
Examples
PoissonOperators.hpp.

Definition at line 433 of file PoissonOperators.hpp.

Constructor & Destructor Documentation

◆ Op_g()

PoissonExample::Op_g::Op_g ( FVal  f_value,
const string  field_name = "L",
const double  beta = 1 
)
Examples
PoissonOperators.hpp.

Definition at line 435 of file PoissonOperators.hpp.

436  : OpBaseRhs<FaceElementForcesAndSourcesCore::UserDataOperator>(
437  field_name),
438  fValue(f_value), bEta(beta) {}
FVal fValue
Function pointer evaluating values of "U" at the boundary.

Member Function Documentation

◆ aSsemble()

MoFEMErrorCode PoissonExample::Op_g::aSsemble ( DataForcesAndSourcesCore::EntData data)
protectedvirtual

assemble constrains vectors

Implements PoissonExample::OpBaseRhs< FaceElementForcesAndSourcesCore::UserDataOperator >.

Examples
PoissonOperators.hpp.

Definition at line 490 of file PoissonOperators.hpp.

490  {
492  const int *indices = &*data.getIndices().data().begin();
493  const double *vals = &*locVec.data().begin();
494  Vec f = getFEMethod()->ksp_f != PETSC_NULL ? getFEMethod()->ksp_f
495  : getFEMethod()->snes_f;
496  CHKERR VecSetValues(f, nbRows, indices, &*vals, ADD_VALUES);
498  }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
MoFEMErrorCode VecSetValues(Vec V, const DataForcesAndSourcesCore::EntData &data, const double *ptr, InsertMode iora)
Assemble PETSc vector.
#define CHKERR
Inline error check.
Definition: definitions.h:596
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ iNtegrate()

MoFEMErrorCode PoissonExample::Op_g::iNtegrate ( DataForcesAndSourcesCore::EntData data)
protectedvirtual

Integrate local constrains vector.

Implements PoissonExample::OpBaseRhs< FaceElementForcesAndSourcesCore::UserDataOperator >.

Reimplemented in PoissonExample::OpResF_Boundary, and PoissonExample::OpRes_g.

Examples
PoissonOperators.hpp.

Definition at line 452 of file PoissonOperators.hpp.

452  {
454  // set size to local vector
455  locVec.resize(nbRows, false);
456  // clear local vector
457  locVec.clear();
458  // get face area
459  const double area = getArea() * bEta;
460  // get integration weight
461  auto t_w = getFTensor0IntegrationWeight();
462  // get base function
463  auto t_l = data.getFTensor0N();
464  // get coordinates at integration point
465  auto t_coords = getFTensor1CoordsAtGaussPts();
466  // make loop over integration points
467  for (int gg = 0; gg != nbIntegrationPts; gg++) {
468  // evaluate function on boundary and scale it by area and integration
469  // weight
470  double alpha =
471  area * t_w * fValue(t_coords(NX), t_coords(NY), t_coords(NZ));
472  // get element of vector
474  &*locVec.data().begin());
475  //
476  for (int rr = 0; rr != nbRows; rr++) {
477  t_a += alpha * t_l;
478  ++t_a;
479  ++t_l;
480  }
481  ++t_w;
482  ++t_coords;
483  }
485  }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
FTensor::Number< 1 > NY
y-direction index
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407
FTensor::Number< 0 > NX
x-direction index
FVal fValue
Function pointer evaluating values of "U" at the boundary.
FTensor::Number< 2 > NZ
z-direction index

Member Data Documentation

◆ bEta

const double PoissonExample::Op_g::bEta
protected
Examples
PoissonOperators.hpp.

Definition at line 447 of file PoissonOperators.hpp.

◆ fValue

FVal PoissonExample::Op_g::fValue
protected

Function pointer evaluating values of "U" at the boundary.

Examples
PoissonOperators.hpp.

Definition at line 444 of file PoissonOperators.hpp.

◆ locVec

VectorDouble PoissonExample::Op_g::locVec
protected
Examples
PoissonOperators.hpp.

Definition at line 446 of file PoissonOperators.hpp.

◆ NX

FTensor::Number<0> PoissonExample::Op_g::NX
protected

x-direction index

Examples
PoissonOperators.hpp.

Definition at line 441 of file PoissonOperators.hpp.

◆ NY

FTensor::Number<1> PoissonExample::Op_g::NY
protected

y-direction index

Examples
PoissonOperators.hpp.

Definition at line 442 of file PoissonOperators.hpp.

◆ NZ

FTensor::Number<2> PoissonExample::Op_g::NZ
protected

z-direction index

Examples
PoissonOperators.hpp.

Definition at line 443 of file PoissonOperators.hpp.


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