v0.16.0
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
FreeSurfaceOps::OpRhsH< I > Struct Template Reference

Rhs for H (phase-field residual) More...

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

Inheritance diagram for FreeSurfaceOps::OpRhsH< I >:
[legend]
Collaboration diagram for FreeSurfaceOps::OpRhsH< I >:
[legend]

Public Member Functions

 OpRhsH (const std::string field_name, boost::shared_ptr< MatrixDouble > u_ptr, boost::shared_ptr< VectorDouble > dot_h_ptr, boost::shared_ptr< VectorDouble > h_ptr, boost::shared_ptr< MatrixDouble > grad_h_ptr, boost::shared_ptr< MatrixDouble > grad_g_ptr)
 
MoFEMErrorCode iNtegrate (EntitiesFieldData::EntData &data)
 

Private Attributes

boost::shared_ptr< MatrixDouble > uPtr
 
boost::shared_ptr< VectorDouble > dotHPtr
 
boost::shared_ptr< VectorDouble > hPtr
 
boost::shared_ptr< MatrixDouble > gradHPtr
 
boost::shared_ptr< MatrixDouble > gradGPtr
 

Detailed Description

template<bool I>
struct FreeSurfaceOps::OpRhsH< I >

Rhs for H (phase-field residual)

Parameters
field_nameName of the field associated with the operator
u_ptrPointer to the velocity matrix (U)
dot_h_ptrPointer to the free surface height time derivative vector (∂H/∂t)
h_ptrPointer to the free surface height vector (H)
grad_h_ptrPointer to the free surface height gradient matrix (∇H)
grad_g_ptrPointer to the chemical potential gradient matrix (∇G)
Returns
MoFEMErrorCode

Maps the conserved phase evolution (Lovric 3.1c): R_h = ∫_Ω v(∂h/∂t + u·∇h) + ∇v·(M(h) ∇g)) dΩ

The template boolean I selects initialization (I=true) vs evolution (I=false).

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

Definition at line 964 of file FreeSurfaceOps.hpp.

Constructor & Destructor Documentation

◆ OpRhsH()

template<bool I>
FreeSurfaceOps::OpRhsH< I >::OpRhsH ( const std::string  field_name,
boost::shared_ptr< MatrixDouble >  u_ptr,
boost::shared_ptr< VectorDouble >  dot_h_ptr,
boost::shared_ptr< VectorDouble >  h_ptr,
boost::shared_ptr< MatrixDouble >  grad_h_ptr,
boost::shared_ptr< MatrixDouble >  grad_g_ptr 
)
inline

Definition at line 966 of file FreeSurfaceOps.hpp.

971 : AssemblyDomainEleOp(field_name, field_name, AssemblyDomainEleOp::OPROW),
972 uPtr(u_ptr), dotHPtr(dot_h_ptr), hPtr(h_ptr), gradHPtr(grad_h_ptr),
973 gradGPtr(grad_g_ptr) {}
constexpr auto field_name
boost::shared_ptr< VectorDouble > hPtr
boost::shared_ptr< MatrixDouble > gradGPtr
boost::shared_ptr< MatrixDouble > uPtr
boost::shared_ptr< VectorDouble > dotHPtr
boost::shared_ptr< MatrixDouble > gradHPtr
FormsIntegrators< DomainEleOp >::Assembly< A >::OpBase AssemblyDomainEleOp

Member Function Documentation

◆ iNtegrate()

template<bool I>
MoFEMErrorCode FreeSurfaceOps::OpRhsH< I >::iNtegrate ( EntitiesFieldData::EntData &  data)
inline

Definition at line 975 of file FreeSurfaceOps.hpp.

975 {
977
978 const double vol = getMeasure();
979 auto t_w = getFTensor0IntegrationWeight();
980 auto t_coords = getFTensor1CoordsAtGaussPts();
981 auto t_base = data.getFTensor0N();
982 auto t_diff_base = data.getFTensor1DiffN<SPACE_DIM>();
983
984#ifndef NDEBUG
985 if (data.getDiffN().size1() != data.getN().size1())
986 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "wrong size 1");
987 if (data.getDiffN().size2() != data.getN().size2() * SPACE_DIM) {
988 MOFEM_LOG("SELF", Sev::error)
989 << "Side " << rowSide << " " << CN::EntityTypeName(rowType);
990 MOFEM_LOG("SELF", Sev::error) << data.getN();
991 MOFEM_LOG("SELF", Sev::error) << data.getDiffN();
992 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "wrong size 2");
993 }
994#endif
995
996 if constexpr (I) {
997 // Find h ∈ H¹(Ω) to minimise ∫(h - h_init)² dΩ + ∫∇v·(M ∇g) dΩ
998
999 auto t_h = getFTensor0FromVec(*hPtr);
1000 auto t_grad_g = getFTensor1FromMat<SPACE_DIM>(*gradGPtr);
1001
1002 for (int gg = 0; gg != nbIntegrationPts; ++gg) {
1003
1004 const double r = t_coords(0);
1005 const double alpha = t_w * vol * cylindrical(r);
1006
1007 const double set_h = init_h(t_coords(0), t_coords(1), t_coords(2));
1008 const double m = get_M(set_h) * alpha;
1009
1010 int bb = 0;
1011 for (; bb != nbRows; ++bb) {
1012 locF[bb] += (t_base * alpha) * (t_h - set_h); // minimize ∫(h - h_init)² dΩ
1013 locF[bb] += (t_diff_base(i) * m) * t_grad_g(i);
1014 ++t_base;
1015 ++t_diff_base;
1016 }
1017
1018 for (; bb < nbRowBaseFunctions; ++bb) {
1019 ++t_base;
1020 ++t_diff_base;
1021 }
1022
1023 ++t_h;
1024 ++t_grad_g;
1025
1026 ++t_coords;
1027 ++t_w;
1028 }
1029
1030 } else {
1031
1032 auto t_dot_h = getFTensor0FromVec(*dotHPtr);
1033 auto t_h = getFTensor0FromVec(*hPtr);
1034 auto t_u = getFTensor1FromMat<U_FIELD_DIM>(*uPtr);
1035 auto t_grad_h = getFTensor1FromMat<SPACE_DIM>(*gradHPtr);
1036 auto t_grad_g = getFTensor1FromMat<SPACE_DIM>(*gradGPtr);
1037
1038 for (int gg = 0; gg != nbIntegrationPts; ++gg) {
1039
1040 const double r = t_coords(0);
1041 const double alpha = t_w * vol * cylindrical(r);
1042
1043 const double m = get_M(t_h) * alpha;
1044
1045 int bb = 0;
1046 for (; bb != nbRows; ++bb) {
1047 locF[bb] += (t_base * alpha) * (t_dot_h); // time derivative ∂h/∂t
1048 locF[bb] += (t_base * alpha) * (t_grad_h(i) * t_u(i)); // convection u·∇h
1049 locF[bb] += (t_diff_base(i) * t_grad_g(i)) * m; // mobility/divergence (M ∇g)
1050 ++t_base;
1051 ++t_diff_base;
1052 }
1053
1054 for (; bb < nbRowBaseFunctions; ++bb) {
1055 ++t_base;
1056 ++t_diff_base;
1057 }
1058
1059 ++t_dot_h;
1060 ++t_h;
1061 ++t_grad_g;
1062 ++t_u;
1063 ++t_grad_h;
1064
1065 ++t_coords;
1066 ++t_w;
1067 }
1068 }
1069
1071 }
constexpr int SPACE_DIM
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
auto cylindrical
[cylindrical]
auto init_h
Initialisation function.
auto get_M
#define MOFEM_LOG(channel, severity)
Log.
FTensor::Index< 'i', SPACE_DIM > i
int r
Definition sdf.py:205
constexpr IntegrationType I
FTensor::Index< 'm', 3 > m

Member Data Documentation

◆ dotHPtr

template<bool I>
boost::shared_ptr<VectorDouble> FreeSurfaceOps::OpRhsH< I >::dotHPtr
private

Definition at line 1075 of file FreeSurfaceOps.hpp.

◆ gradGPtr

template<bool I>
boost::shared_ptr<MatrixDouble> FreeSurfaceOps::OpRhsH< I >::gradGPtr
private

Definition at line 1078 of file FreeSurfaceOps.hpp.

◆ gradHPtr

template<bool I>
boost::shared_ptr<MatrixDouble> FreeSurfaceOps::OpRhsH< I >::gradHPtr
private

Definition at line 1077 of file FreeSurfaceOps.hpp.

◆ hPtr

template<bool I>
boost::shared_ptr<VectorDouble> FreeSurfaceOps::OpRhsH< I >::hPtr
private

Definition at line 1076 of file FreeSurfaceOps.hpp.

◆ uPtr

template<bool I>
boost::shared_ptr<MatrixDouble> FreeSurfaceOps::OpRhsH< I >::uPtr
private

Definition at line 1074 of file FreeSurfaceOps.hpp.


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