v0.15.0
Loading...
Searching...
No Matches
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
 
ScalarFun sourceFun
 pointer to function to evaluate value of function on boundary
 
VectorDouble rhsF
 vector to store local operator right hand side
 

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) {}
BoundaryEle::UserDataOperator BoundaryEleOp
@ NOSPACE
Definition definitions.h:83
auto fun
Function to approximate.
ScalarFun sourceFun
pointer to function to evaluate value of function on boundary
boost::shared_ptr< FaceSideEle > sideFEPtr
pointer to element to get data on edge/face sides

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 }
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
std::array< MatrixDouble, 2 > rowBaseSideMap
std::array< VectorInt, 2 > indicesRowSideMap
indices on rows for left hand-side
std::array< MatrixDouble, 2 > rowDiffBaseSideMap
static double nitsche
static double penalty
static double phi
VectorDouble rhsF
vector to store local operator right hand side

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: