v0.15.0
Loading...
Searching...
No Matches
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),
BoundaryEle::UserDataOperator BoundaryEleOp
auto wetting_angle
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 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 }
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
double eta2
auto wetting_angle_sub_stepping
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:8
static constexpr double delta

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: