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

Lhs for U dH. More...

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

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

Public Member Functions

 OpLhsU_dH (const std::string field_name_u, const std::string field_name_h, boost::shared_ptr< MatrixDouble > dot_u_ptr, boost::shared_ptr< MatrixDouble > u_ptr, boost::shared_ptr< MatrixDouble > grad_u_ptr, boost::shared_ptr< VectorDouble > h_ptr, boost::shared_ptr< VectorDouble > g_ptr)
 
MoFEMErrorCode iNtegrate (EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 

Private Attributes

boost::shared_ptr< MatrixDouble > dotUPtr
 
boost::shared_ptr< MatrixDouble > uPtr
 
boost::shared_ptr< MatrixDouble > gradUPtr
 
boost::shared_ptr< VectorDouble > hPtr
 
boost::shared_ptr< VectorDouble > gPtr
 

Detailed Description

Lhs for U dH.

Examples
free_surface.cpp.

Definition at line 416 of file FreeSurfaceOps.hpp.

Constructor & Destructor Documentation

◆ OpLhsU_dH()

FreeSurfaceOps::OpLhsU_dH::OpLhsU_dH ( const std::string  field_name_u,
const std::string  field_name_h,
boost::shared_ptr< MatrixDouble >  dot_u_ptr,
boost::shared_ptr< MatrixDouble >  u_ptr,
boost::shared_ptr< MatrixDouble >  grad_u_ptr,
boost::shared_ptr< VectorDouble >  h_ptr,
boost::shared_ptr< VectorDouble >  g_ptr 
)
inline

Definition at line 418 of file FreeSurfaceOps.hpp.

424 : AssemblyDomainEleOp(field_name_u, field_name_h,
425 AssemblyDomainEleOp::OPROWCOL),
426 dotUPtr(dot_u_ptr), uPtr(u_ptr), gradUPtr(grad_u_ptr), hPtr(h_ptr),
427 gPtr(g_ptr) {
428 sYmm = false;
429 assembleTranspose = false;
430 }
FormsIntegrators< DomainEleOp >::Assembly< A >::OpBase AssemblyDomainEleOp
Definition: plastic.cpp:48
boost::shared_ptr< VectorDouble > gPtr
boost::shared_ptr< VectorDouble > hPtr
boost::shared_ptr< MatrixDouble > uPtr
boost::shared_ptr< MatrixDouble > gradUPtr
boost::shared_ptr< MatrixDouble > dotUPtr

Member Function Documentation

◆ iNtegrate()

MoFEMErrorCode FreeSurfaceOps::OpLhsU_dH::iNtegrate ( EntitiesFieldData::EntData &  row_data,
EntitiesFieldData::EntData &  col_data 
)
inline

Definition at line 432 of file FreeSurfaceOps.hpp.

433 {
435
436 const double vol = getMeasure();
437 auto t_dot_u = getFTensor1FromMat<U_FIELD_DIM>(*dotUPtr);
438 auto t_u = getFTensor1FromMat<U_FIELD_DIM>(*uPtr);
439 auto t_grad_u = getFTensor2FromMat<U_FIELD_DIM, SPACE_DIM>(*gradUPtr);
440 auto t_h = getFTensor0FromVec(*hPtr);
441 auto t_g = getFTensor0FromVec(*gPtr);
442 auto t_coords = getFTensor1CoordsAtGaussPts();
443
444 auto t_row_base = row_data.getFTensor0N();
445 auto t_row_diff_base = row_data.getFTensor1DiffN<SPACE_DIM>();
446
447 auto t_w = getFTensor0IntegrationWeight();
448
451 FTensor::Tensor1<double, U_FIELD_DIM> t_inertia_force_dh;
455
456 t_buoyancy_dh(i) = 0;
457
458 for (int gg = 0; gg != nbIntegrationPts; gg++) {
459
460 const double r = t_coords(0);
461 const double alpha = t_w * vol * cylindrical(r);
462
463 const double rho = phase_function(t_h, rho_diff, rho_ave);
464 const double rho_dh = d_phase_function_h(t_h, rho_diff);
465 const double mu_dh = d_phase_function_h(t_h, mu_diff);
466
467 auto t_D_dh = get_D(2 * mu_dh);
468
469 t_inertia_force_dh(i) = (alpha * rho_dh) * t_dot_u(i);
470 t_buoyancy_dh(SPACE_DIM - 1) = -(alpha * a0) * (rho + rho_dh * t_h);
471 t_convection_dh(i) = (rho_dh * alpha) * (t_u(j) * t_grad_u(i, j));
472 const double t_phase_force_g_dh = -alpha * kappa * t_g;
473 t_forces_dh(i) =
474 t_inertia_force_dh(i) + t_buoyancy_dh(i) + t_convection_dh(i);
475
476 t_stress_dh(i, j) = alpha * (t_D_dh(i, j, k, l) * t_grad_u(k, l));
477
478 int rr = 0;
479 for (; rr != nbRows / U_FIELD_DIM; ++rr) {
480
481 auto t_mat =
482 getFTensor1FromMat<U_FIELD_DIM, 1>(locMat, rr * U_FIELD_DIM);
483 auto t_col_base = col_data.getFTensor0N(gg, 0);
484 auto t_col_diff_base = col_data.getFTensor1DiffN<SPACE_DIM>(gg, 0);
485
486 for (int cc = 0; cc != nbCols; ++cc) {
487
488 const double bb = t_row_base * t_col_base;
489 t_mat(i) += t_forces_dh(i) * bb;
490 t_mat(i) += (t_phase_force_g_dh * t_row_base) * t_col_diff_base(i);
491 t_mat(i) += (t_row_diff_base(j) * t_col_base) * t_stress_dh(i, j);
492
493 // When we move to C++17 add if constexpr()
494 if constexpr (coord_type == CYLINDRICAL) {
495 t_mat(0) += (bb * (alpha / t_coords(0))) * (2 * mu_dh * t_u(0));
496 }
497
498 ++t_mat;
499 ++t_col_base;
500 ++t_col_diff_base;
501 }
502
503 ++t_row_base;
504 ++t_row_diff_base;
505 }
506
507 for (; rr < nbRowBaseFunctions; ++rr) {
508 ++t_row_diff_base;
509 ++t_row_base;
510 }
511
512 ++t_dot_u;
513 ++t_u;
514 ++t_grad_u;
515 ++t_h;
516 ++t_g;
517 ++t_coords;
518 ++t_w;
519 }
520
522 }
constexpr int SPACE_DIM
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
@ CYLINDRICAL
Definition: definitions.h:117
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
auto cylindrical
constexpr int U_FIELD_DIM
constexpr double rho_ave
constexpr CoordinateTypes coord_type
select coordinate system <CARTESIAN, CYLINDRICAL>;
constexpr double mu_diff
auto d_phase_function_h
auto phase_function
constexpr double rho_diff
auto get_D
const double kappa
constexpr double a0
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
int r
Definition: sdf.py:5
double rho
Definition: plastic.cpp:101

Member Data Documentation

◆ dotUPtr

boost::shared_ptr<MatrixDouble> FreeSurfaceOps::OpLhsU_dH::dotUPtr
private

Definition at line 525 of file FreeSurfaceOps.hpp.

◆ gPtr

boost::shared_ptr<VectorDouble> FreeSurfaceOps::OpLhsU_dH::gPtr
private

Definition at line 529 of file FreeSurfaceOps.hpp.

◆ gradUPtr

boost::shared_ptr<MatrixDouble> FreeSurfaceOps::OpLhsU_dH::gradUPtr
private

Definition at line 527 of file FreeSurfaceOps.hpp.

◆ hPtr

boost::shared_ptr<VectorDouble> FreeSurfaceOps::OpLhsU_dH::hPtr
private

Definition at line 528 of file FreeSurfaceOps.hpp.

◆ uPtr

boost::shared_ptr<MatrixDouble> FreeSurfaceOps::OpLhsU_dH::uPtr
private

Definition at line 526 of file FreeSurfaceOps.hpp.


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