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

Lhs for U dH (Jacobian block ∂R_U/∂H) More...

#include "tutorials/vec-5_free_surface/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 (Jacobian block ∂R_U/∂H)

Parameters
field_name_uName of the field associated with the row operator (U)
field_name_hName of the field associated with the column operator (H)
dot_u_ptrPointer to the velocity time derivative matrix (∂U/∂t)
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)
g_ptrPointer to the chemical potential vector (g)
Returns
MoFEMErrorCode

This operator builds the sensitivity of the momentum residual to changes in the phase field h (paper 3.2a cross-coupling). It implements:

In code: rho_dh = d_phase_function_h(t_h, rho_diff), mu_dh = d_phase_function_h(t_h, mu_diff)

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

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

762 : AssemblyDomainEleOp(field_name_u, field_name_h,
763 AssemblyDomainEleOp::OPROWCOL),
764 dotUPtr(dot_u_ptr), uPtr(u_ptr), gradUPtr(grad_u_ptr), hPtr(h_ptr),
765 gPtr(g_ptr) {
766 sYmm = false;
767 assembleTranspose = false;
768 }
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
FormsIntegrators< DomainEleOp >::Assembly< A >::OpBase AssemblyDomainEleOp

Member Function Documentation

◆ iNtegrate()

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

Definition at line 770 of file FreeSurfaceOps.hpp.

771 {
773
774 const double vol = getMeasure();
775 auto t_dot_u = getFTensor1FromMat<U_FIELD_DIM>(*dotUPtr);
776 auto t_u = getFTensor1FromMat<U_FIELD_DIM>(*uPtr);
777 auto t_grad_u = getFTensor2FromMat<U_FIELD_DIM, SPACE_DIM>(*gradUPtr);
778 auto t_h = getFTensor0FromVec(*hPtr);
779 auto t_g = getFTensor0FromVec(*gPtr);
780 auto t_coords = getFTensor1CoordsAtGaussPts();
781
782 auto t_row_base = row_data.getFTensor0N();
783 auto t_row_diff_base = row_data.getFTensor1DiffN<SPACE_DIM>();
784
785 auto t_w = getFTensor0IntegrationWeight();
786
789 FTensor::Tensor1<double, U_FIELD_DIM> t_inertia_force_dh;
794
795 t_buoyancy_dh(i) = 0;
796 t_gravity_dh(i) = 0;
797
798 for (int gg = 0; gg != nbIntegrationPts; gg++) {
799
800 const double r = t_coords(0);
801 const double alpha = t_w * vol * cylindrical(r);
802
803 const double rho_dh = d_phase_function_h(t_h, rho_diff); // dρ/dh
804 const double mu_dh = d_phase_function_h(t_h, mu_diff); // dμ/dh
805
806 auto t_D_dh = get_D(2 * mu_dh);
807
808 t_inertia_force_dh(i) = (alpha * rho_dh) * t_dot_u(i); // dρ/dh * ∂U/∂t
809 // t_buoyancy_dh(SPACE_DIM - 1) = -(alpha * a0) * (rho + rho_dh * t_h);
810 t_gravity_dh(SPACE_DIM - 1) = (alpha * rho_dh * a0); // dρ/dh * a_0
811 t_convection_dh(i) = (rho_dh * alpha) * (t_u(j) * t_grad_u(i, j)); // dρ/dh * (U·∇)U
812 const double t_phase_force_g_dh = -alpha * kappa * t_g; // -κ g
813 t_forces_dh(i) = t_inertia_force_dh(i) + t_buoyancy_dh(i) +
814 t_gravity_dh(i) + t_convection_dh(i); // Total dR_U/dh force
815
816 t_stress_dh(i, j) = alpha * (t_D_dh(i, j, k, l) * t_grad_u(k, l)); // d(∇·(2μD(U)))/dh
817
818 int rr = 0;
819 for (; rr != nbRows / U_FIELD_DIM; ++rr) {
820
821 auto t_mat =
822 getFTensor1FromMat<U_FIELD_DIM, 1>(locMat, rr * U_FIELD_DIM);
823 auto t_col_base = col_data.getFTensor0N(gg, 0);
824 auto t_col_diff_base = col_data.getFTensor1DiffN<SPACE_DIM>(gg, 0);
825
826 for (int cc = 0; cc != nbCols; ++cc) {
827
828 const double bb = t_row_base * t_col_base;
829 t_mat(i) += t_forces_dh(i) * bb; // Assemble total dR_U/dh force contribution
830 t_mat(i) += (t_phase_force_g_dh * t_row_base) * t_col_diff_base(i); // -κ g ∇h term
831 t_mat(i) += (t_row_diff_base(j) * t_col_base) * t_stress_dh(i, j); // Viscous term contribution via dμ/dh
832
833 if (coord_type == CYLINDRICAL) {
834 t_mat(0) += (bb * (alpha / t_coords(0))) * (2 * mu_dh * t_u(0));
835 }
836
837 ++t_mat;
838 ++t_col_base;
839 ++t_col_diff_base;
840 }
841
842 ++t_row_base;
843 ++t_row_diff_base;
844 }
845
846 for (; rr < nbRowBaseFunctions; ++rr) {
847 ++t_row_diff_base;
848 ++t_row_base;
849 }
850
851 ++t_dot_u;
852 ++t_u;
853 ++t_grad_u;
854 ++t_h;
855 ++t_g;
856 ++t_coords;
857 ++t_w;
858 }
859
861 }
constexpr int SPACE_DIM
#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 kappa
double mu_diff
constexpr int U_FIELD_DIM
double rho_diff
auto d_phase_function_h
Derivative of phase function with respect to h.
auto get_D
Create deviatoric stress tensor.
constexpr double a0
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

Member Data Documentation

◆ dotUPtr

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

Definition at line 864 of file FreeSurfaceOps.hpp.

◆ gPtr

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

Definition at line 868 of file FreeSurfaceOps.hpp.

◆ gradUPtr

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

Definition at line 866 of file FreeSurfaceOps.hpp.

◆ hPtr

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

Definition at line 867 of file FreeSurfaceOps.hpp.

◆ uPtr

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

Definition at line 865 of file FreeSurfaceOps.hpp.


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