v0.13.0
Public Types | Public Member Functions | Private Attributes | List of all members
StdRDOperators::OpAssembleStiffRhs< DIM > Struct Template Reference

#include <users_modules/softmech/chemo_mech/src/rd_stdOperators.hpp>

Inheritance diagram for StdRDOperators::OpAssembleStiffRhs< DIM >:
[legend]
Collaboration diagram for StdRDOperators::OpAssembleStiffRhs< DIM >:
[legend]

Public Types

typedef boost::function< double(const double, const double, const double)> FVal
 
typedef boost::function< FTensor::Tensor1< double, 3 > const double, const double, const double)> FGrad
 

Public Member Functions

 OpAssembleStiffRhs (std::string field, boost::shared_ptr< PreviousData > &data, std::map< int, BlockData > &block_map, FVal exact_value, FVal exact_dot, FVal exact_lap)
 
MoFEMErrorCode doWork (int side, EntityType type, EntData &data)
 

Private Attributes

boost::shared_ptr< PreviousDatacommonData
 
std::map< int, BlockDatasetOfBlock
 
VectorDouble vecF
 
std::string field
 
FVal exactValue
 
FVal exactDot
 
FVal exactLap
 
FTensor::Number< 0 > NX
 
FTensor::Number< 1 > NY
 
FTensor::Number< 2 > NZ
 

Detailed Description

template<int DIM>
struct StdRDOperators::OpAssembleStiffRhs< DIM >

Definition at line 289 of file rd_stdOperators.hpp.

Member Typedef Documentation

◆ FGrad

template<int DIM>
typedef boost::function<FTensor::Tensor1<double, 3> const double, const double, const double)> StdRDOperators::OpAssembleStiffRhs< DIM >::FGrad

Definition at line 294 of file rd_stdOperators.hpp.

◆ FVal

template<int DIM>
typedef boost::function<double(const double, const double, const double)> StdRDOperators::OpAssembleStiffRhs< DIM >::FVal

Definition at line 291 of file rd_stdOperators.hpp.

Constructor & Destructor Documentation

◆ OpAssembleStiffRhs()

template<int DIM>
StdRDOperators::OpAssembleStiffRhs< DIM >::OpAssembleStiffRhs ( std::string  field,
boost::shared_ptr< PreviousData > &  data,
std::map< int, BlockData > &  block_map,
FVal  exact_value,
FVal  exact_dot,
FVal  exact_lap 
)

Member Function Documentation

◆ doWork()

template<int DIM>
MoFEMErrorCode StdRDOperators::OpAssembleStiffRhs< DIM >::doWork ( int  side,
EntityType  type,
EntData data 
)

Definition at line 302 of file rd_stdOperators.hpp.

302  {
304  const int nb_dofs = data.getIndices().size();
305  if (nb_dofs) {
306  auto find_block_data = [&]() {
307  EntityHandle fe_ent = getFEEntityHandle();
308  BlockData *block_raw_ptr = nullptr;
309  for (auto &m : setOfBlock) {
310  if (m.second.block_ents.find(fe_ent) != m.second.block_ents.end()) {
311  block_raw_ptr = &m.second;
312  break;
313  }
314  }
315  return block_raw_ptr;
316  };
317 
318  auto block_data_ptr = find_block_data();
319  if (!block_data_ptr)
320  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Block not found");
321 
322  auto &block_data = *block_data_ptr;
323 
324  vecF.resize(nb_dofs, false);
325  vecF.clear();
326  const int nb_integration_pts = getGaussPts().size2();
327 
328  auto t_dot_val = getFTensor0FromVec(commonData->dot_values);
329  auto t_val = getFTensor0FromVec(commonData->values);
330  auto t_grad = getFTensor1FromMat<DIM>(commonData->grads);
331 
332  auto t_base = data.getFTensor0N();
333  auto t_diff_base = data.getFTensor1DiffN<DIM>();
334  auto t_w = getFTensor0IntegrationWeight();
335 
337 
338  // cout << "B0 : " << block_data.B0 << endl;
339 
340  const double vol = getMeasure();
341 
342  const double ct = getFEMethod()->ts_t;
343  auto t_coords = getFTensor1CoordsAtGaussPts();
344 
345  for (int gg = 0; gg != nb_integration_pts; ++gg) {
346  const double a = vol * t_w;
347 
348  double u_dot = exactDot(t_coords(NX), t_coords(NY), ct);
349  // double u_lap = exactLap(t_coords(NX), t_coords(NY), ct);
350 
351  // double f = u_dot - u_lap;
352  double u_lap =
353  -block_data.B0 * exactLap(t_coords(NX), t_coords(NY), ct);
354  // cout << "B0 : " << block_data.B0 << endl;
355  // double f = u_dot + u_lap;
356  double f = 0.0;
357 
358  for (int rr = 0; rr != nb_dofs; ++rr) {
359  vecF[rr] +=
360  a * (t_base * t_dot_val +
361  (block_data.B0 + B * t_val) * t_diff_base(i) * t_grad(i) -
362  t_base * f);
363  ++t_diff_base;
364  ++t_base;
365  }
366  ++t_dot_val;
367  ++t_grad;
368  ++t_val;
369  ++t_w;
370  ++t_coords;
371  }
372  CHKERR VecSetOption(getFEMethod()->ts_F, VEC_IGNORE_NEGATIVE_INDICES,
373  PETSC_TRUE);
374  CHKERR VecSetValues(getFEMethod()->ts_F, data, &*vecF.begin(),
375  ADD_VALUES);
376  }
378  }
constexpr double a
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:44
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
#define CHKERR
Inline error check.
Definition: definitions.h:548
static auto getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
Definition: Templates.hpp:149
FTensor::Index< 'i', 3 > i
const double B
FTensor::Index< 'm', 3 > m
FTensor::Tensor1< FTensor::PackPtr< double *, Tensor_Dim >, Tensor_Dim > getFTensor1DiffN(const FieldApproximationBase base)
Get derivatives of base functions.
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.
const VectorInt & getIndices() const
Get global indices of dofs on entity.

Member Data Documentation

◆ commonData

template<int DIM>
boost::shared_ptr<PreviousData> StdRDOperators::OpAssembleStiffRhs< DIM >::commonData
private

Definition at line 381 of file rd_stdOperators.hpp.

◆ exactDot

template<int DIM>
FVal StdRDOperators::OpAssembleStiffRhs< DIM >::exactDot
private

Definition at line 387 of file rd_stdOperators.hpp.

◆ exactLap

template<int DIM>
FVal StdRDOperators::OpAssembleStiffRhs< DIM >::exactLap
private

Definition at line 388 of file rd_stdOperators.hpp.

◆ exactValue

template<int DIM>
FVal StdRDOperators::OpAssembleStiffRhs< DIM >::exactValue
private

Definition at line 386 of file rd_stdOperators.hpp.

◆ field

template<int DIM>
std::string StdRDOperators::OpAssembleStiffRhs< DIM >::field
private

Definition at line 384 of file rd_stdOperators.hpp.

◆ NX

template<int DIM>
FTensor::Number<0> StdRDOperators::OpAssembleStiffRhs< DIM >::NX
private

Definition at line 390 of file rd_stdOperators.hpp.

◆ NY

template<int DIM>
FTensor::Number<1> StdRDOperators::OpAssembleStiffRhs< DIM >::NY
private

Definition at line 391 of file rd_stdOperators.hpp.

◆ NZ

template<int DIM>
FTensor::Number<2> StdRDOperators::OpAssembleStiffRhs< DIM >::NZ
private

Definition at line 392 of file rd_stdOperators.hpp.

◆ setOfBlock

template<int DIM>
std::map<int, BlockData> StdRDOperators::OpAssembleStiffRhs< DIM >::setOfBlock
private

Definition at line 382 of file rd_stdOperators.hpp.

◆ vecF

template<int DIM>
VectorDouble StdRDOperators::OpAssembleStiffRhs< DIM >::vecF
private

Definition at line 383 of file rd_stdOperators.hpp.


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