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

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

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

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

Public Member Functions

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

Private Attributes

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

Detailed Description

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

Lhs for H dH (Jacobian block ∂R_H/∂H)

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

Linearization of the conserved phase equation (3.1c) w.r.t. H

When I==true the operator builds initialization-mode blocks (uses init_h)

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

Definition at line 1156 of file FreeSurfaceOps.hpp.

Constructor & Destructor Documentation

◆ OpLhsH_dH()

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

Definition at line 1158 of file FreeSurfaceOps.hpp.

1162 AssemblyDomainEleOp::OPROWCOL),
1163 uPtr(u_ptr), hPtr(h_ptr), gradGPtr(grad_g_ptr) {
1164 sYmm = false;
1165 }
constexpr auto field_name
boost::shared_ptr< MatrixDouble > uPtr
boost::shared_ptr< MatrixDouble > gradGPtr
boost::shared_ptr< VectorDouble > hPtr
FormsIntegrators< DomainEleOp >::Assembly< A >::OpBase AssemblyDomainEleOp

Member Function Documentation

◆ iNtegrate()

template<bool I>
MoFEMErrorCode FreeSurfaceOps::OpLhsH_dH< I >::iNtegrate ( EntitiesFieldData::EntData &  row_data,
EntitiesFieldData::EntData &  col_data 
)
inline

Definition at line 1167 of file FreeSurfaceOps.hpp.

1168 {
1170
1171 const double vol = getMeasure();
1172 auto t_w = getFTensor0IntegrationWeight();
1173 auto t_coords = getFTensor1CoordsAtGaussPts();
1174 auto t_row_base = row_data.getFTensor0N();
1175 auto t_row_diff_base = row_data.getFTensor1DiffN<SPACE_DIM>();
1176
1177#ifndef NDEBUG
1178 if (row_data.getDiffN().size1() != row_data.getN().size1())
1179 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "wrong size 1");
1180 if (row_data.getDiffN().size2() != row_data.getN().size2() * SPACE_DIM) {
1181 MOFEM_LOG("SELF", Sev::error)
1182 << "Side " << rowSide << " " << CN::EntityTypeName(rowType);
1183 MOFEM_LOG("SELF", Sev::error) << row_data.getN();
1184 MOFEM_LOG("SELF", Sev::error) << row_data.getDiffN();
1185 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "wrong size 2");
1186 }
1187
1188 if (col_data.getDiffN().size1() != col_data.getN().size1())
1189 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "wrong size 1");
1190 if (col_data.getDiffN().size2() != col_data.getN().size2() * SPACE_DIM) {
1191 MOFEM_LOG("SELF", Sev::error)
1192 << "Side " << rowSide << " " << CN::EntityTypeName(rowType);
1193 MOFEM_LOG("SELF", Sev::error) << col_data.getN();
1194 MOFEM_LOG("SELF", Sev::error) << col_data.getDiffN();
1195 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "wrong size 2");
1196 }
1197#endif
1198
1199 if constexpr (I) {
1200
1201 auto t_h = getFTensor0FromVec(*hPtr);
1202 auto t_grad_g = getFTensor1FromMat<SPACE_DIM>(*gradGPtr);
1203
1204 for (int gg = 0; gg != nbIntegrationPts; gg++) {
1205
1206 const double r = t_coords(0);
1207 const double alpha = t_w * vol * cylindrical(r);
1208
1209 int rr = 0;
1210 for (; rr != nbRows; ++rr) {
1211
1212 auto t_col_base = col_data.getFTensor0N(gg, 0);
1213 auto t_col_diff_base = col_data.getFTensor1DiffN<SPACE_DIM>(gg, 0);
1214
1215 for (int cc = 0; cc != nbCols; ++cc) {
1216
1217 locMat(rr, cc) += (t_row_base * t_col_base * alpha);
1218
1219 ++t_col_base;
1220 ++t_col_diff_base;
1221 }
1222
1223 ++t_row_base;
1224 ++t_row_diff_base;
1225 }
1226
1227 for (; rr < nbRowBaseFunctions; ++rr) {
1228 ++t_row_base;
1229 ++t_row_diff_base;
1230 }
1231
1232 ++t_h;
1233 ++t_grad_g;
1234 ++t_w;
1235 ++t_coords;
1236 }
1237
1238 } else {
1239
1240 auto t_h = getFTensor0FromVec(*hPtr);
1241 auto t_grad_g = getFTensor1FromMat<SPACE_DIM>(*gradGPtr);
1242 auto t_u = getFTensor1FromMat<U_FIELD_DIM>(*uPtr);
1243
1244 auto ts_a = getTSa();
1245
1246 for (int gg = 0; gg != nbIntegrationPts; gg++) {
1247
1248 const double r = t_coords(0);
1249 const double alpha = t_w * vol * cylindrical(r);
1250
1251 auto m_dh = get_M_dh(t_h) * alpha;
1252 int rr = 0;
1253 for (; rr != nbRows; ++rr) {
1254
1255 auto t_col_base = col_data.getFTensor0N(gg, 0);
1256 auto t_col_diff_base = col_data.getFTensor1DiffN<SPACE_DIM>(gg, 0);
1257
1258 for (int cc = 0; cc != nbCols; ++cc) {
1259
1260 locMat(rr, cc) += (t_row_base * t_col_base * alpha) * ts_a; // time-stepping mass term
1261 locMat(rr, cc) +=
1262 (t_row_base * alpha) * (t_col_diff_base(i) * t_u(i)); // convection term u·∇h
1263 locMat(rr, cc) +=
1264 (t_row_diff_base(i) * t_grad_g(i)) * (t_col_base * m_dh); // mobility derivative term M'(h) ∇g
1265
1266 ++t_col_base;
1267 ++t_col_diff_base;
1268 }
1269
1270 ++t_row_base;
1271 ++t_row_diff_base;
1272 }
1273
1274 for (; rr < nbRowBaseFunctions; ++rr) {
1275 ++t_row_base;
1276 ++t_row_diff_base;
1277 }
1278
1279 ++t_u;
1280 ++t_h;
1281 ++t_grad_g;
1282 ++t_w;
1283 ++t_coords;
1284 }
1285 }
1286
1288 }
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 get_M_dh
#define MOFEM_LOG(channel, severity)
Log.
FTensor::Index< 'i', SPACE_DIM > i
int r
Definition sdf.py:205
constexpr IntegrationType I

Member Data Documentation

◆ gradGPtr

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

Definition at line 1293 of file FreeSurfaceOps.hpp.

◆ hPtr

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

Definition at line 1292 of file FreeSurfaceOps.hpp.

◆ uPtr

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

Definition at line 1291 of file FreeSurfaceOps.hpp.


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