v0.15.5
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
FreeSurfaceOps::OpWettingAngleLhs Struct Reference

[OpNormalConstrainLhs] More...

#include "tutorials/vec-5_free_surface/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

[OpNormalConstrainLhs]

[OpWettingAngleLhs]

Boundary wetting-angle LHS (linearization)

Parameters
field_nameName of the field associated with the operator
grad_h_ptrPointer to the gradient of the free surface height matrix
col_ind_ptrPointer to the column indices vector
col_diff_base_ptrPointer to the column difference base functions vector
ents_ptrPointer to the range of entities (edges) to consider
wetting_angleContact wetting angle in degrees
Returns
MoFEMErrorCode

Linearization of the wetting-angle boundary term (3.1d - Gamma part) used to assemble the corresponding Jacobian contributions for G (and coupling into H).

δ R_g / δ h = ∫_Γ s ε² (∇h / ||∇h||) · ∇(δ h) cos(α) dΓ

Examples
mofem/tutorials/vec-5_free_surface/free_surface.cpp.

Definition at line 340 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 342 of file FreeSurfaceOps.hpp.

348 : BoundaryEleOp(row_field_name, BoundaryEleOp::OPROW),
349 gradHPtr(grad_h_ptr), colIndicesPtr(col_ind_ptr),
350 colDiffBaseFunctionsPtr(col_diff_base_ptr), entsPtr(ents_ptr),
BoundaryEle::UserDataOperator BoundaryEleOp
auto wetting_angle
Wetting angle function (placeholder)
boost::shared_ptr< MatrixDouble > gradHPtr
boost::shared_ptr< std::vector< VectorInt > > colIndicesPtr
boost::shared_ptr< std::vector< MatrixDouble > > colDiffBaseFunctionsPtr
boost::shared_ptr< Range > entsPtr

Member Function Documentation

◆ doWork()

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

Definition at line 353 of file FreeSurfaceOps.hpp.

354 {
356 if (entsPtr) {
357 if (entsPtr->find(BoundaryEleOp::getFEEntityHandle()) == entsPtr->end())
359 }
360 const double area = getMeasure();
361
362 const auto row_size = data.getIndices().size();
363 if (row_size == 0)
365
366 auto integrate = [&](auto col_indicies, auto &col_diff_base_functions) {
368
369 const auto col_size = col_indicies.size();
370
371 locMat.resize(row_size, col_size, false);
372 locMat.clear();
373 int nb_gp = getGaussPts().size2();
374 int nb_rows = data.getIndices().size();
375
376 auto t_w = getFTensor0IntegrationWeight();
377 auto t_coords = getFTensor1CoordsAtGaussPts();
378 auto t_grad_h = getFTensor1FromMat<SPACE_DIM>(*gradHPtr);
379 auto t_row_base = data.getFTensor0N();
380 int nb_row_base_functions = data.getN().size2();
381
382 auto s = wetting_angle_sub_stepping(getFEMethod()->ts_step);
383
384 for (int gg = 0; gg != nb_gp; ++gg) {
385
386 const double r = t_coords(0);
387 const double alpha = t_w * area * cylindrical(r);
388 const double h_grad_norm = sqrt(t_grad_h(i) * t_grad_h(i) + eps);
389 const double one_over_h_grad_norm = 1. / h_grad_norm;
390 const double beta = s * alpha * eta2 * one_over_h_grad_norm *
391 std::cos(M_PI * wettingAngle / 180); // s * α * η² * (1/||∇h||) * cos(angle)
392
393 int rr = 0;
394 for (; rr != nb_rows; ++rr) {
395 const double delta = beta * t_row_base; // β * N_row
396
397 auto ptr = &col_diff_base_functions(gg, 0);
398 auto t_col_diff_base = getFTensor1FromPtr<SPACE_DIM>(ptr);
399
400 for (int cc = 0; cc != col_size; ++cc) {
401 locMat(rr, cc) += t_col_diff_base(i) * (delta * t_grad_h(i));
402 ++t_col_diff_base;
403 }
404 ++t_row_base;
405 }
406
407 for (; rr < nb_row_base_functions; ++rr) {
408 ++t_row_base;
409 }
410
411 ++t_grad_h;
412 ++t_w;
413 ++t_coords;
414 }
415
417 };
418
419 for (auto c = 0; c != colIndicesPtr->size(); ++c) {
420
421 auto &col_ind = (*colIndicesPtr)[c];
422 if (col_ind.size()) {
423 auto &diff_base = (*colDiffBaseFunctionsPtr)[c];
424
425 CHKERR integrate(col_ind, diff_base);
426
427 CHKERR MatSetValues(getKSPB(), data.getIndices().size(),
428 &*data.getIndices().begin(), col_ind.size(),
429 &*col_ind.begin(), &locMat(0, 0), ADD_VALUES);
430 }
431 }
432
434 }
static const double eps
#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.
auto cylindrical
[cylindrical]
double eta2
auto wetting_angle_sub_stepping
[cylindrical]
FTensor::Index< 'i', SPACE_DIM > i
const double c
speed of light (cm/ns)
MoFEMErrorCode MatSetValues(Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const double *ptr, InsertMode iora)
Assemble PETSc matrix.
int r
Definition sdf.py:205
static constexpr double delta

Member Data Documentation

◆ colDiffBaseFunctionsPtr

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

Definition at line 443 of file FreeSurfaceOps.hpp.

◆ colIndicesPtr

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

Definition at line 442 of file FreeSurfaceOps.hpp.

◆ entsPtr

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

Definition at line 440 of file FreeSurfaceOps.hpp.

◆ gradHPtr

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

Definition at line 439 of file FreeSurfaceOps.hpp.

◆ locMat

MatrixDouble FreeSurfaceOps::OpWettingAngleLhs::locMat
private

Definition at line 437 of file FreeSurfaceOps.hpp.

◆ wettingAngle

double FreeSurfaceOps::OpWettingAngleLhs::wettingAngle
private

Definition at line 441 of file FreeSurfaceOps.hpp.


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