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

#include <tutorials/vec-5/src/FreeSurfaceOps.hpp>

Inheritance diagram for FreeSurfaceOps::OpWettingAngleLhs:
[legend]
Collaboration diagram for FreeSurfaceOps::OpWettingAngleLhs:
[legend]

Public Member Functions

 OpWettingAngleLhs (const std::string row_field_name, boost::shared_ptr< MatrixDouble > grad_h_ptr, boost::shared_ptr< std::vector< VectorInt >> col_ind_ptr, boost::shared_ptr< std::vector< MatrixDouble >> col_diff_base_ptr, boost::shared_ptr< Range > ents_ptr=nullptr, double wetting_angle=0)
 
MoFEMErrorCode doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 

Private Attributes

MatrixDouble locMat
 
boost::shared_ptr< MatrixDouble > gradHPtr
 
boost::shared_ptr< RangeentsPtr
 
double wettingAngle
 
boost::shared_ptr< std::vector< VectorInt > > colIndicesPtr
 
boost::shared_ptr< std::vector< MatrixDouble > > colDiffBaseFunctionsPtr
 

Detailed Description

Examples
free_surface.cpp.

Definition at line 246 of file FreeSurfaceOps.hpp.

Constructor & Destructor Documentation

◆ OpWettingAngleLhs()

FreeSurfaceOps::OpWettingAngleLhs::OpWettingAngleLhs ( const std::string  row_field_name,
boost::shared_ptr< MatrixDouble >  grad_h_ptr,
boost::shared_ptr< std::vector< VectorInt >>  col_ind_ptr,
boost::shared_ptr< std::vector< MatrixDouble >>  col_diff_base_ptr,
boost::shared_ptr< Range ents_ptr = nullptr,
double  wetting_angle = 0 
)
inline

Definition at line 248 of file FreeSurfaceOps.hpp.

254  : BoundaryEleOp(row_field_name, BoundaryEleOp::OPROW),
255  gradHPtr(grad_h_ptr), colIndicesPtr(col_ind_ptr),
256  colDiffBaseFunctionsPtr(col_diff_base_ptr), entsPtr(ents_ptr),

Member Function Documentation

◆ doWork()

MoFEMErrorCode FreeSurfaceOps::OpWettingAngleLhs::doWork ( int  side,
EntityType  type,
DataForcesAndSourcesCore::EntData data 
)
inline

Definition at line 259 of file FreeSurfaceOps.hpp.

260  {
262  if (entsPtr) {
263  if (entsPtr->find(BoundaryEleOp::getFEEntityHandle()) == entsPtr->end())
265  }
266  const double area = getMeasure();
267 
268  const auto row_size = data.getIndices().size();
269  if (row_size == 0)
271 
272  auto integrate = [&](auto col_indicies, auto &col_diff_base_functions) {
274 
275  const auto col_size = col_indicies.size();
276 
277  locMat.resize(row_size, col_size, false);
278  locMat.clear();
279  int nb_gp = getGaussPts().size2();
280  int nb_rows = data.getIndices().size();
281 
282  auto t_w = getFTensor0IntegrationWeight();
283  auto t_coords = getFTensor1CoordsAtGaussPts();
284  auto t_grad_h = getFTensor1FromMat<SPACE_DIM>(*gradHPtr);
285  auto t_row_base = data.getFTensor0N();
286  int nb_row_base_functions = data.getN().size2();
287 
288  auto s = wetting_angle_sub_stepping(getFEMethod()->ts_step);
289 
290  for (int gg = 0; gg != nb_gp; ++gg) {
291 
292  const double r = t_coords(0);
293  const double alpha = t_w * area * cylindrical(r);
294  const double h_grad_norm = sqrt(t_grad_h(i) * t_grad_h(i) + eps);
295  const double one_over_h_grad_norm = 1. / h_grad_norm;
296  const double beta = s * alpha * eta2 * one_over_h_grad_norm *
297  std::cos(M_PI * wettingAngle / 180);
298 
299  int rr = 0;
300  for (; rr != nb_rows; ++rr) {
301  const double delta = beta * t_row_base;
302 
303  auto ptr = &col_diff_base_functions(gg, 0);
304  auto t_col_diff_base = getFTensor1FromPtr<SPACE_DIM>(ptr);
305 
306  for (int cc = 0; cc != col_size; ++cc) {
307  locMat(rr, cc) += t_col_diff_base(i) * (delta * t_grad_h(i));
308  ++t_col_diff_base;
309  }
310  ++t_row_base;
311  }
312 
313  for (; rr < nb_row_base_functions; ++rr) {
314  ++t_row_base;
315  }
316 
317  ++t_grad_h;
318  ++t_w;
319  ++t_coords;
320  }
321 
323  };
324 
325  for (auto c = 0; c != colIndicesPtr->size(); ++c) {
326 
327  auto &col_ind = (*colIndicesPtr)[c];
328  if (col_ind.size()) {
329  auto &diff_base = (*colDiffBaseFunctionsPtr)[c];
330 
331  CHKERR integrate(col_ind, diff_base);
332 
333  CHKERR MatSetValues(getKSPB(), data.getIndices().size(),
334  &*data.getIndices().begin(), col_ind.size(),
335  &*col_ind.begin(), &locMat(0, 0), ADD_VALUES);
336  }
337  }
338 
340  }

Member Data Documentation

◆ colDiffBaseFunctionsPtr

boost::shared_ptr<std::vector<MatrixDouble> > FreeSurfaceOps::OpWettingAngleLhs::colDiffBaseFunctionsPtr
private

Definition at line 349 of file FreeSurfaceOps.hpp.

◆ colIndicesPtr

boost::shared_ptr<std::vector<VectorInt> > FreeSurfaceOps::OpWettingAngleLhs::colIndicesPtr
private

Definition at line 348 of file FreeSurfaceOps.hpp.

◆ entsPtr

boost::shared_ptr<Range> FreeSurfaceOps::OpWettingAngleLhs::entsPtr
private

Definition at line 346 of file FreeSurfaceOps.hpp.

◆ gradHPtr

boost::shared_ptr<MatrixDouble> FreeSurfaceOps::OpWettingAngleLhs::gradHPtr
private

Definition at line 345 of file FreeSurfaceOps.hpp.

◆ locMat

MatrixDouble FreeSurfaceOps::OpWettingAngleLhs::locMat
private

Definition at line 343 of file FreeSurfaceOps.hpp.

◆ wettingAngle

double FreeSurfaceOps::OpWettingAngleLhs::wettingAngle
private

Definition at line 347 of file FreeSurfaceOps.hpp.


The documentation for this struct was generated from the following file:
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
MoFEM::MatSetValues
MoFEMErrorCode MatSetValues(Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const double *ptr, InsertMode iora)
Assemble PETSc matrix.
Definition: EntitiesFieldData.hpp:1644
sdf.r
int r
Definition: sdf.py:8
cylindrical
auto cylindrical
Definition: free_surface.cpp:187
FreeSurfaceOps::OpWettingAngleLhs::entsPtr
boost::shared_ptr< Range > entsPtr
Definition: FreeSurfaceOps.hpp:346
c
const double c
speed of light (cm/ns)
Definition: initial_diffusion.cpp:39
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
FreeSurfaceOps::OpWettingAngleLhs::colDiffBaseFunctionsPtr
boost::shared_ptr< std::vector< MatrixDouble > > colDiffBaseFunctionsPtr
Definition: FreeSurfaceOps.hpp:349
wetting_angle
auto wetting_angle
Definition: free_surface.cpp:310
delta
static constexpr double delta
Definition: prism_elements_from_surface.cpp:18
eta2
double eta2
Definition: free_surface.cpp:171
BoundaryEleOp
BoundaryEle::UserDataOperator BoundaryEleOp
Definition: child_and_parent.cpp:40
wetting_angle_sub_stepping
auto wetting_angle_sub_stepping
Definition: free_surface.cpp:194
FreeSurfaceOps::OpWettingAngleLhs::wettingAngle
double wettingAngle
Definition: FreeSurfaceOps.hpp:347
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
eps
static const double eps
Definition: check_base_functions_derivatives_on_tet.cpp:11
FreeSurfaceOps::OpWettingAngleLhs::gradHPtr
boost::shared_ptr< MatrixDouble > gradHPtr
Definition: FreeSurfaceOps.hpp:345
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
FreeSurfaceOps::OpWettingAngleLhs::locMat
MatrixDouble locMat
Definition: FreeSurfaceOps.hpp:343
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
FreeSurfaceOps::OpWettingAngleLhs::colIndicesPtr
boost::shared_ptr< std::vector< VectorInt > > colIndicesPtr
Definition: FreeSurfaceOps.hpp:348