v0.15.5
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 960 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 962 of file FreeSurfaceOps.hpp.

967 : AssemblyDomainEleOp(field_name, field_name, AssemblyDomainEleOp::OPROW),
968 uPtr(u_ptr), dotHPtr(dot_h_ptr), hPtr(h_ptr), gradHPtr(grad_h_ptr),
969 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 971 of file FreeSurfaceOps.hpp.

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

◆ gradGPtr

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

Definition at line 1074 of file FreeSurfaceOps.hpp.

◆ gradHPtr

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

Definition at line 1073 of file FreeSurfaceOps.hpp.

◆ hPtr

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

Definition at line 1072 of file FreeSurfaceOps.hpp.

◆ uPtr

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

Definition at line 1070 of file FreeSurfaceOps.hpp.


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