v0.14.0
Public Member Functions | Private Attributes | List of all members
Poisson2DiscontGalerkinOperators::OpL2BoundaryRhs Struct Reference

Operator to evaluate Dirichlet boundary conditions using DG. More...

#include <tutorials/scl-11/src/PoissonDiscontinousGalerkin.hpp>

Inheritance diagram for Poisson2DiscontGalerkinOperators::OpL2BoundaryRhs:
[legend]
Collaboration diagram for Poisson2DiscontGalerkinOperators::OpL2BoundaryRhs:
[legend]

Public Member Functions

 OpL2BoundaryRhs (boost::shared_ptr< FaceSideEle > side_fe_ptr, ScalarFun fun)
 
MoFEMErrorCode doWork (int side, EntityType type, EntData &data)
 

Private Attributes

boost::shared_ptr< FaceSideElesideFEPtr
 pointer to element to get data on edge/face sides More...
 
ScalarFun sourceFun
 pointer to function to evaluate value of function on boundary More...
 
VectorDouble rhsF
 vector to store local operator right hand side More...
 

Detailed Description

Operator to evaluate Dirichlet boundary conditions using DG.

Examples
poisson_2d_dis_galerkin.cpp.

Definition at line 274 of file PoissonDiscontinousGalerkin.hpp.

Constructor & Destructor Documentation

◆ OpL2BoundaryRhs()

Poisson2DiscontGalerkinOperators::OpL2BoundaryRhs::OpL2BoundaryRhs ( boost::shared_ptr< FaceSideEle side_fe_ptr,
ScalarFun  fun 
)
inline
Examples
PoissonDiscontinousGalerkin.hpp.

Definition at line 276 of file PoissonDiscontinousGalerkin.hpp.

277  : BoundaryEleOp(NOSPACE, BoundaryEleOp::OPSPACE), sideFEPtr(side_fe_ptr),
278  sourceFun(fun) {}

Member Function Documentation

◆ doWork()

MoFEMErrorCode Poisson2DiscontGalerkinOperators::OpL2BoundaryRhs::doWork ( int  side,
EntityType  type,
EntData data 
)
inline
Examples
PoissonDiscontinousGalerkin.hpp.

Definition at line 280 of file PoissonDiscontinousGalerkin.hpp.

280  {
282 
283  // get normal of the face or edge
284  CHKERR loopSideFaces("dFE", *sideFEPtr);
285  const auto in_the_loop =
286  sideFEPtr->nInTheLoop; // return number of elements on the side
287 
288  // calculate penalty
289  const double s = getMeasure() / (areaMap[0]);
290  const double p = penalty * s;
291 
292  // get normal of the face or edge
293  auto t_normal = getFTensor1Normal();
294  t_normal.normalize();
295 
296  auto t_w = getFTensor0IntegrationWeight();
297 
298  const size_t nb_rows = indicesRowSideMap[0].size();
299 
300  if (!nb_rows)
302 
303  // resize local operator vector
304  rhsF.resize(nb_rows, false);
305  rhsF.clear();
306 
307  const size_t nb_integration_pts = getGaussPts().size2();
308  const size_t nb_row_base_functions = rowBaseSideMap[0].size2();
309 
310  // shape funcs
311  auto t_row_base = get_ntensor(rowBaseSideMap[0]);
312  auto t_diff_row_base = get_diff_ntensor(rowDiffBaseSideMap[0]);
313  auto t_coords = getFTensor1CoordsAtGaussPts();
314 
315  const auto sense_row = senseMap[0];
316  const double beta = static_cast<double>(nitsche) / (in_the_loop + 1);
317 
318  for (size_t gg = 0; gg != nb_integration_pts; ++gg) {
319  const double alpha = getMeasure() * t_w;
320 
321  const double source_val =
322  -p * sourceFun(t_coords(0), t_coords(1), t_coords(2));
323 
324  auto t_f = rhsF.data().begin();
325 
326  size_t rr = 0;
327  for (; rr != nb_rows; ++rr) {
328 
330  t_vn_plus(i) = beta * (phi * t_diff_row_base(i) / p);
332  t_vn(i) = t_row_base * t_normal(i) * sense_row - t_vn_plus(i);
333 
334  // assemble operator local vactor
335  *t_f -= alpha * t_vn(i) * (source_val * t_normal(i));
336 
337  ++t_row_base;
338  ++t_diff_row_base;
339  ++t_f;
340  }
341 
342  for (; rr < nb_row_base_functions; ++rr) {
343  ++t_row_base;
344  ++t_diff_row_base;
345  }
346 
347  ++t_w;
348  ++t_coords;
349  }
350 
351  // assemble local operator vector to global vector
352  CHKERR ::VecSetValues(getKSPf(), indicesRowSideMap[0].size(),
353  &*indicesRowSideMap[0].begin(), &*rhsF.data().begin(),
354  ADD_VALUES);
355 
357  }

Member Data Documentation

◆ rhsF

VectorDouble Poisson2DiscontGalerkinOperators::OpL2BoundaryRhs::rhsF
private

vector to store local operator right hand side

Examples
PoissonDiscontinousGalerkin.hpp.

Definition at line 363 of file PoissonDiscontinousGalerkin.hpp.

◆ sideFEPtr

boost::shared_ptr<FaceSideEle> Poisson2DiscontGalerkinOperators::OpL2BoundaryRhs::sideFEPtr
private

pointer to element to get data on edge/face sides

Examples
PoissonDiscontinousGalerkin.hpp.

Definition at line 361 of file PoissonDiscontinousGalerkin.hpp.

◆ sourceFun

ScalarFun Poisson2DiscontGalerkinOperators::OpL2BoundaryRhs::sourceFun
private

pointer to function to evaluate value of function on boundary

Examples
PoissonDiscontinousGalerkin.hpp.

Definition at line 362 of file PoissonDiscontinousGalerkin.hpp.


The documentation for this struct was generated from the following file:
NOSPACE
@ NOSPACE
Definition: definitions.h:83
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
Poisson2DiscontGalerkinOperators::indicesRowSideMap
std::array< VectorInt, 2 > indicesRowSideMap
indices on rows for left hand-side
Definition: PoissonDiscontinousGalerkin.hpp:23
FTensor::Tensor1
Definition: Tensor1_value.hpp:8
Poisson2DiscontGalerkinOperators::OpL2BoundaryRhs::rhsF
VectorDouble rhsF
vector to store local operator right hand side
Definition: PoissonDiscontinousGalerkin.hpp:363
phi
static double phi
Definition: poisson_2d_dis_galerkin.cpp:30
Poisson2DiscontGalerkinOperators::OpL2BoundaryRhs::sideFEPtr
boost::shared_ptr< FaceSideEle > sideFEPtr
pointer to element to get data on edge/face sides
Definition: PoissonDiscontinousGalerkin.hpp:361
Poisson2DiscontGalerkinOperators::i
FTensor::Index< 'i', SPACE_DIM > i
Definition: PoissonDiscontinousGalerkin.hpp:18
Poisson2DiscontGalerkinOperators::rowBaseSideMap
std::array< MatrixDouble, 2 > rowBaseSideMap
Definition: PoissonDiscontinousGalerkin.hpp:26
Poisson2DiscontGalerkinOperators::get_diff_ntensor
auto get_diff_ntensor(T &base_mat)
Definition: PoissonDiscontinousGalerkin.hpp:100
MoFEM::VecSetValues
MoFEMErrorCode VecSetValues(Vec V, const EntitiesFieldData::EntData &data, const double *ptr, InsertMode iora)
Assemble PETSc vector.
Definition: EntitiesFieldData.hpp:1589
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
BoundaryEleOp
BoundaryEle::UserDataOperator BoundaryEleOp
Definition: child_and_parent.cpp:40
Poisson2DiscontGalerkinOperators::get_ntensor
auto get_ntensor(T &base_mat)
Definition: PoissonDiscontinousGalerkin.hpp:90
nitsche
static double nitsche
Definition: poisson_2d_dis_galerkin.cpp:32
Poisson2DiscontGalerkinOperators::rowDiffBaseSideMap
std::array< MatrixDouble, 2 > rowDiffBaseSideMap
Definition: PoissonDiscontinousGalerkin.hpp:28
penalty
constexpr double penalty
Definition: shallow_wave.cpp:75
Poisson2DiscontGalerkinOperators::areaMap
std::array< double, 2 > areaMap
Definition: PoissonDiscontinousGalerkin.hpp:30
Poisson2DiscontGalerkinOperators::OpL2BoundaryRhs::sourceFun
ScalarFun sourceFun
pointer to function to evaluate value of function on boundary
Definition: PoissonDiscontinousGalerkin.hpp:362
fun
auto fun
Function to approximate.
Definition: dg_projection.cpp:36
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
Poisson2DiscontGalerkinOperators::senseMap
std::array< int, 2 > senseMap
Definition: PoissonDiscontinousGalerkin.hpp:31