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

[OpRhsU] More...

#include "tutorials/vec-5_free_surface/src/FreeSurfaceOps.hpp"

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

Public Member Functions

 OpLhsU_dU (const std::string field_name, boost::shared_ptr< MatrixDouble > u_ptr, boost::shared_ptr< MatrixDouble > grad_u_ptr, boost::shared_ptr< VectorDouble > h_ptr)
 
MoFEMErrorCode iNtegrate (EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 

Private Attributes

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

Detailed Description

[OpRhsU]

[OpLhsU_dU]

Lhs for U dU (Jacobian block ∂R_U/∂U)

Parameters
field_nameName of the field associated with the operator
u_ptrPointer to the velocity matrix (U)
grad_u_ptrPointer to the velocity gradient matrix (∇U)
h_ptrPointer to the free surface height vector (h)
Returns
MoFEMErrorCode

Implements linearization of momentum residual w.r.t. velocity U:

Matches the Jacobian terms required to solve the implicit momentum equation used when solving the coupled NS–CH system (Lovric 3.1a linearization).

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

Definition at line 604 of file FreeSurfaceOps.hpp.

Constructor & Destructor Documentation

◆ OpLhsU_dU()

FreeSurfaceOps::OpLhsU_dU::OpLhsU_dU ( const std::string  field_name,
boost::shared_ptr< MatrixDouble >  u_ptr,
boost::shared_ptr< MatrixDouble >  grad_u_ptr,
boost::shared_ptr< VectorDouble >  h_ptr 
)
inline

Definition at line 606 of file FreeSurfaceOps.hpp.

610 AssemblyDomainEleOp::OPROWCOL),
611 uPtr(u_ptr), gradUPtr(grad_u_ptr), hPtr(h_ptr) {
612 sYmm = false;
613 assembleTranspose = false;
614 }
constexpr auto field_name
boost::shared_ptr< MatrixDouble > gradUPtr
boost::shared_ptr< MatrixDouble > uPtr
boost::shared_ptr< VectorDouble > hPtr
FormsIntegrators< DomainEleOp >::Assembly< A >::OpBase AssemblyDomainEleOp

Member Function Documentation

◆ iNtegrate()

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

Definition at line 616 of file FreeSurfaceOps.hpp.

617 {
619
620 const double vol = getMeasure();
621 auto t_u = getFTensor1FromMat<U_FIELD_DIM>(*uPtr);
622 auto t_grad_u = getFTensor2FromMat<U_FIELD_DIM, SPACE_DIM>(*gradUPtr);
623 auto t_h = getFTensor0FromVec(*hPtr);
624 auto t_coords = getFTensor1CoordsAtGaussPts();
625
626 auto t_row_base = row_data.getFTensor0N();
627 auto t_row_diff_base = row_data.getFTensor1DiffN<SPACE_DIM>();
628
629 auto t_w = getFTensor0IntegrationWeight();
630
631 auto get_mat = [&](const int rr) {
632 return getFTensor2FromArray<SPACE_DIM, SPACE_DIM, SPACE_DIM>(locMat, rr);
633 };
634
635 auto ts_a = getTSa();
636 constexpr auto t_kd = FTensor::Kronecker_Delta_symmetric<double>(); // t_kd(i,j)=1 iff i=j
637
638 for (int gg = 0; gg != nbIntegrationPts; gg++) {
639
640 const double r = t_coords(0);
641 const double alpha = t_w * vol * cylindrical(r);
642 const double rho = phase_function(t_h, rho_diff, rho_ave);
643 const double mu = phase_function(t_h, mu_diff, mu_ave);
644
645 const double beta0 = alpha * rho;
646 const double beta1 = beta0 * ts_a;
647 auto t_D = get_D(2 * mu); // Fourth-order viscosity tensor
648
649 int rr = 0;
650 for (; rr != nbRows / U_FIELD_DIM; ++rr) {
651
652 auto t_mat = get_mat(rr * U_FIELD_DIM);
653 auto t_col_base = col_data.getFTensor0N(gg, 0);
654 auto t_col_diff_base = col_data.getFTensor1DiffN<SPACE_DIM>(gg, 0);
655
656 // Symmetric on last two indices
657 // ie Christof(i,j,k) == Christof(i,k,j)
659 t_d_stress(l, j, k) = t_D(i, j, k, l) * (alpha * t_row_diff_base(i));
660
661 for (int cc = 0; cc != nbCols / U_FIELD_DIM; ++cc) {// Assemble contributions for each col basis function
662
663 const double bb = t_row_base * t_col_base;
664
665 t_mat(i, j) += (beta1 * bb) * t_kd(i, j); // Derivative of inertia term ρ ∂U/∂t
666 t_mat(i, j) += (beta0 * bb) * t_grad_u(i, j); // Derivative of convection term ρ (U·∇)U
667 t_mat(i, j) +=
668 (beta0 * t_row_base) * t_kd(i, j) * (t_col_diff_base(k) * t_u(k));
669 t_mat(i, j) += t_d_stress(i, j, k) * t_col_diff_base(k); // Derivative of viscous term ∇·(2μD(U))
670
671 if (coord_type == CYLINDRICAL) {
672 t_mat(0, 0) += (bb * (alpha / t_coords(0))) * (2 * mu);
673 }
674
675 ++t_mat;
676 ++t_col_base;
677 ++t_col_diff_base;
678 }
679
680 ++t_row_base;
681 ++t_row_diff_base;
682 }
683
684 for (; rr < nbRowBaseFunctions; ++rr) {
685 ++t_row_diff_base;
686 ++t_row_base;
687 }
688
689 ++t_u;
690 ++t_grad_u;
691 ++t_h;
692
693 ++t_coords;
694 ++t_w;
695 }
696
698 }
constexpr int SPACE_DIM
Kronecker Delta class symmetric.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ CYLINDRICAL
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
auto cylindrical
[cylindrical]
double mu_diff
constexpr int U_FIELD_DIM
double rho_diff
constexpr auto t_kd
double rho_ave
double mu_ave
auto phase_function
Phase-dependent material property interpolation.
auto get_D
Create deviatoric stress tensor.
FTensor::Index< 'i', SPACE_DIM > i
constexpr CoordinateTypes coord_type
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
int r
Definition sdf.py:205
double rho
Definition plastic.cpp:144

Member Data Documentation

◆ gradUPtr

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

Definition at line 702 of file FreeSurfaceOps.hpp.

◆ hPtr

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

Definition at line 703 of file FreeSurfaceOps.hpp.

◆ uPtr

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

Definition at line 701 of file FreeSurfaceOps.hpp.


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