v0.16.0
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 1160 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 1162 of file FreeSurfaceOps.hpp.

1166 AssemblyDomainEleOp::OPROWCOL),
1167 uPtr(u_ptr), hPtr(h_ptr), gradGPtr(grad_g_ptr) {
1168 sYmm = false;
1169 }
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 1171 of file FreeSurfaceOps.hpp.

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

◆ hPtr

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

Definition at line 1296 of file FreeSurfaceOps.hpp.

◆ uPtr

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

Definition at line 1295 of file FreeSurfaceOps.hpp.


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