v0.14.0
heat_equation.cpp
Go to the documentation of this file.
1 /**
2  * \file heat_equation.cpp
3  * \example heat_equation.cpp
4  *
5  * \brief Solve the time-dependent Heat Equation
6  \f[
7  \begin{aligned}
8 \frac{\partial u(\mathbf{x}, t)}{\partial t}-\Delta u(\mathbf{x}, t)
9 &=f(\mathbf{x}, t) & & \forall \mathbf{x} \in \Omega, t \in(0, T), \\
10 u(\mathbf{x}, 0) &=u_{0}(\mathbf{x}) & & \forall \mathbf{x} \in \Omega, \\
11 u(\mathbf{x}, t) &=g(\mathbf{x}, t) & & \forall \mathbf{x} \in \partial \Omega,
12 t \in(0, T). \end{aligned}
13  \f]
14  **/
15 
16 #include <stdlib.h>
17 #include <cmath>
18 #include <BasicFiniteElements.hpp>
19 
20 using namespace MoFEM;
21 
22 static char help[] = "...\n\n";
23 
24 template <int DIM> struct ElementsAndOps {};
25 
26 //! [Define dimension]
27 constexpr int SPACE_DIM = 2; //< Space dimension of problem, mesh
28 //! [Define dimension]
29 
36 
42  PETSC>::LinearForm<GAUSS>::OpBaseTimesScalar<1>;
46  PETSC>::LinearForm<GAUSS>::OpSource<1, 1>;
47 
51  PETSC>::LinearForm<GAUSS>::OpBaseTimesScalar<1>;
53  PETSC>::LinearForm<GAUSS>::OpSource<1, 1>;
54 
55 // Capacity
56 constexpr double c = 1;
57 constexpr double k = 1;
58 constexpr double init_u = 0.;
59 
60 /**
61  * @brief Monitor solution
62  *
63  * This functions is called by TS solver at the end of each step. It is used
64  * to output results to the hard drive.
65  */
66 struct Monitor : public FEMethod {
67 
68  Monitor(SmartPetscObj<DM> dm, boost::shared_ptr<PostProcEle> post_proc)
69  : dM(dm), postProc(post_proc){};
70 
71  MoFEMErrorCode preProcess() { return 0; }
72  MoFEMErrorCode operator()() { return 0; }
73 
74  static constexpr int saveEveryNthStep = 1;
75 
78  if (ts_step % saveEveryNthStep == 0) {
79  CHKERR DMoFEMLoopFiniteElements(dM, "dFE", postProc);
80  CHKERR postProc->writeFile(
81  "out_level_" + boost::lexical_cast<std::string>(ts_step) + ".h5m");
82  }
84  }
85 
86 private:
88  boost::shared_ptr<PostProcEle> postProc;
89 };
90 
91 struct HeatEquation {
92 public:
94 
95  // Declaration of the main function to run analysis
96  MoFEMErrorCode runProgram();
97 
98 private:
99  // Declaration of other main functions called in runProgram()
100  MoFEMErrorCode readMesh();
101  MoFEMErrorCode setupProblem();
102  MoFEMErrorCode setIntegrationRules();
103  MoFEMErrorCode initialCondition();
104  MoFEMErrorCode boundaryCondition();
105  MoFEMErrorCode assembleSystem();
106  MoFEMErrorCode solveSystem();
107  MoFEMErrorCode outputResults();
108 
109  // Main interfaces
111 
112  // Object to mark boundary entities for the assembling of domain elements
113  boost::shared_ptr<std::vector<unsigned char>> boundaryMarker;
114 };
115 
116 HeatEquation::HeatEquation(MoFEM::Interface &m_field) : mField(m_field) {}
117 
120 
121  auto *simple = mField.getInterface<Simple>();
123  CHKERR simple->getOptions();
124  CHKERR simple->loadFile();
125 
127 }
128 
131 
132  auto *simple = mField.getInterface<Simple>();
133  CHKERR simple->addDomainField("U", H1, AINSWORTH_LEGENDRE_BASE, 1);
134  CHKERR simple->addBoundaryField("U", H1, AINSWORTH_LEGENDRE_BASE, 1);
135 
136  int order = 3;
137  CHKERR PetscOptionsGetInt(PETSC_NULL, "", "-order", &order, PETSC_NULL);
138  CHKERR simple->setFieldOrder("U", order);
139 
140  CHKERR simple->setUp();
141 
143 }
144 
147 
148  auto integration_rule = [](int o_row, int o_col, int approx_order) {
149  return 2 * approx_order;
150  };
151 
152  auto *pipeline_mng = mField.getInterface<PipelineManager>();
153  CHKERR pipeline_mng->setDomainRhsIntegrationRule(integration_rule);
154  CHKERR pipeline_mng->setDomainLhsIntegrationRule(integration_rule);
155  CHKERR pipeline_mng->setBoundaryLhsIntegrationRule(integration_rule);
156  CHKERR pipeline_mng->setBoundaryRhsIntegrationRule(integration_rule);
157 
159 }
160 
163 
164  // Get surface entities form blockset, set initial values in those
165  // blocksets. To keep it simple, it is assumed that inital values are on
166  // blockset 1
168  Range inner_surface;
169  CHKERR mField.getInterface<MeshsetsManager>()->getEntitiesByDimension(
170  1, BLOCKSET, 2, inner_surface, true);
171  if (!inner_surface.empty()) {
172  Range inner_surface_verts;
173  CHKERR mField.get_moab().get_connectivity(inner_surface,
174  inner_surface_verts, false);
175  CHKERR mField.getInterface<FieldBlas>()->setField(
176  init_u, MBVERTEX, inner_surface_verts, "U");
177  }
178  }
179 
181 }
182 
185 
186  auto bc_mng = mField.getInterface<BcManager>();
187  auto *simple = mField.getInterface<Simple>();
188  CHKERR bc_mng->pushMarkDOFsOnEntities(simple->getProblemName(), "ESSENTIAL",
189  "U", 0, 0);
190 
191  auto &bc_map = bc_mng->getBcMapByBlockName();
192  boundaryMarker = boost::make_shared<std::vector<char unsigned>>();
193  for (auto b : bc_map) {
194  if (std::regex_match(b.first, std::regex("(.*)ESSENTIAL(.*)"))) {
195  boundaryMarker->resize(b.second->bcMarkers.size(), 0);
196  for (int i = 0; i != b.second->bcMarkers.size(); ++i) {
197  (*boundaryMarker)[i] |= b.second->bcMarkers[i];
198  }
199  }
200  }
201 
203 }
204 
207 
208  auto add_domain_lhs_ops = [&](auto &pipeline) {
210  pipeline.push_back(new OpSetBc("U", true, boundaryMarker));
211  pipeline.push_back(new OpDomainGradGrad(
212  "U", "U", [](double, double, double) -> double { return k; }));
213  auto get_c = [this](const double, const double, const double) {
214  auto pipeline_mng = mField.getInterface<PipelineManager>();
215  auto &fe_domain_lhs = pipeline_mng->getDomainLhsFE();
216  return c * fe_domain_lhs->ts_a;
217  };
218  pipeline.push_back(new OpDomainMass("U", "U", get_c));
219  pipeline.push_back(new OpUnSetBc("U"));
220  };
221 
222  auto add_domain_rhs_ops = [&](auto &pipeline) {
224  pipeline.push_back(new OpSetBc("U", true, boundaryMarker));
225  auto grad_u_at_gauss_pts = boost::make_shared<MatrixDouble>();
226  auto dot_u_at_gauss_pts = boost::make_shared<VectorDouble>();
227  pipeline.push_back(new OpCalculateScalarFieldGradient<SPACE_DIM>(
228  "U", grad_u_at_gauss_pts));
229  pipeline.push_back(
230  new OpCalculateScalarFieldValuesDot("U", dot_u_at_gauss_pts));
231  pipeline.push_back(new OpDomainGradTimesVec(
232  "U", grad_u_at_gauss_pts,
233  [](double, double, double) -> double { return k; }));
234  pipeline.push_back(new OpDomainTimesScalarField(
235  "U", dot_u_at_gauss_pts,
236  [](const double, const double, const double) { return c; }));
237  auto source_term = [&](const double x, const double y, const double z) {
238  auto pipeline_mng = mField.getInterface<PipelineManager>();
239  auto &fe_domain_lhs = pipeline_mng->getDomainRhsFE();
240  const auto t = fe_domain_lhs->ts_t;
241  return 1e1 * pow(M_E, -M_PI * M_PI * t) * sin(1. * M_PI * x) *
242  sin(2. * M_PI * y);
243  };
244  pipeline.push_back(new OpDomainSource("U", source_term));
245  pipeline.push_back(new OpUnSetBc("U"));
246  };
247 
248  auto add_boundary_lhs_ops = [&](auto &pipeline) {
249  pipeline.push_back(new OpSetBc("U", false, boundaryMarker));
250  pipeline.push_back(new OpBoundaryMass(
251  "U", "U", [](const double, const double, const double) { return c; }));
252  pipeline.push_back(new OpUnSetBc("U"));
253  };
254  auto add_boundary_rhs_ops = [&](auto &pipeline) {
255  pipeline.push_back(new OpSetBc("U", false, boundaryMarker));
256  auto u_at_gauss_pts = boost::make_shared<VectorDouble>();
257  auto boundary_function = [&](const double x, const double y,
258  const double z) {
259  auto pipeline_mng = mField.getInterface<PipelineManager>();
260  auto &fe_rhs = pipeline_mng->getBoundaryRhsFE();
261  const auto t = fe_rhs->ts_t;
262  return 0;
263  // abs(0.1 * pow(M_E, -M_PI * M_PI * t) * sin(2. * M_PI * x) *
264  // sin(3. * M_PI * y));
265  };
266  pipeline.push_back(new OpCalculateScalarFieldValues("U", u_at_gauss_pts));
267  pipeline.push_back(new OpBoundaryTimeScalarField(
268  "U", u_at_gauss_pts,
269  [](const double, const double, const double) { return c; }));
270  pipeline.push_back(new OpBoundarySource("U", boundary_function));
271  pipeline.push_back(new OpUnSetBc("U"));
272  };
273 
274  auto pipeline_mng = mField.getInterface<PipelineManager>();
275  add_domain_lhs_ops(pipeline_mng->getOpDomainLhsPipeline());
276  add_domain_rhs_ops(pipeline_mng->getOpDomainRhsPipeline());
277  add_boundary_lhs_ops(pipeline_mng->getOpBoundaryLhsPipeline());
278  add_boundary_rhs_ops(pipeline_mng->getOpBoundaryRhsPipeline());
279 
281 }
282 
283 struct CalcJacobian {
284  static PetscErrorCode set(TS ts, PetscReal t, Vec u, Vec u_t, PetscReal a,
285  Mat A, Mat B, void *ctx) {
287  if (a != lastA) {
288  lastA = a;
289  CHKERR TsSetIJacobian(ts, t, u, u_t, a, A, B, ctx);
290  }
292  }
293 
294 private:
295  static double lastA;
296 };
297 
298 double CalcJacobian::lastA = 0;
299 
302 
303  auto *simple = mField.getInterface<Simple>();
304  auto *pipeline_mng = mField.getInterface<PipelineManager>();
305 
306  auto create_post_process_element = [&]() {
307  auto post_proc_fe = boost::make_shared<PostProcEle>(mField);
308  auto det_ptr = boost::make_shared<VectorDouble>();
309  auto jac_ptr = boost::make_shared<MatrixDouble>();
310  auto inv_jac_ptr = boost::make_shared<MatrixDouble>();
311  post_proc_fe->getOpPtrVector().push_back(new OpCalculateHOJac<2>(jac_ptr));
312  post_proc_fe->getOpPtrVector().push_back(
313  new OpInvertMatrix<2>(jac_ptr, det_ptr, inv_jac_ptr));
314  post_proc_fe->getOpPtrVector().push_back(
315  new OpSetHOInvJacToScalarBases<2>(H1, inv_jac_ptr));
316 
317  auto u_ptr = boost::make_shared<VectorDouble>();
318  post_proc_fe->getOpPtrVector().push_back(
319  new OpCalculateScalarFieldValues("U", u_ptr));
320 
322 
323  post_proc_fe->getOpPtrVector().push_back(
324 
325  new OpPPMap(post_proc_fe->getPostProcMesh(),
326  post_proc_fe->getMapGaussPts(),
327 
328  {{"U", u_ptr}},
329 
330  {}, {}, {}
331 
332  )
333 
334  );
335 
336  return post_proc_fe;
337  };
338 
339  auto set_time_monitor = [&](auto dm, auto solver) {
341  boost::shared_ptr<Monitor> monitor_ptr(
342  new Monitor(dm, create_post_process_element()));
343  boost::shared_ptr<ForcesAndSourcesCore> null;
344  CHKERR DMMoFEMTSSetMonitor(dm, solver, simple->getDomainFEName(),
345  monitor_ptr, null, null);
347  };
348 
349  auto set_fieldsplit_preconditioner = [&](auto solver) {
351  SNES snes;
352  CHKERR TSGetSNES(solver, &snes);
353  KSP ksp;
354  CHKERR SNESGetKSP(snes, &ksp);
355  PC pc;
356  CHKERR KSPGetPC(ksp, &pc);
357  PetscBool is_pcfs = PETSC_FALSE;
358  PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_pcfs);
359 
360  if (is_pcfs == PETSC_TRUE) {
361  auto bc_mng = mField.getInterface<BcManager>();
362  auto name_prb = simple->getProblemName();
363  auto is_all_bc = bc_mng->getBlockIS(name_prb, "ESSENTIAL", "U", 0, 0);
364  int is_all_bc_size;
365  CHKERR ISGetSize(is_all_bc, &is_all_bc_size);
366  MOFEM_LOG("EXAMPLE", Sev::inform)
367  << "Field split block size " << is_all_bc_size;
368  CHKERR PCFieldSplitSetIS(pc, PETSC_NULL,
369  is_all_bc); // boundary block
370  }
372  };
373 
374  /**
375  * That to work, you have to create solver, as follows,
376  \code
377  auto solver = // pipeline_mng->createTSIM( simple->getDM());
378  \endcode
379  That is explicitly use use Simple DM to create solver for DM. Pipeline
380  menage by default creat copy of DM, in case several solvers are used the
381  same DM.
382 
383  Alternatively you can get dm directly from the solver, i.e.
384  \code
385  DM ts_dm;
386  CHKERR TSGetDM(solver, &ts_dm);
387  CHKERR DMTSSetIJacobian(
388  ts_dm, CalcJacobian::set, getDMTsCtx(ts_dm).get());
389  \endcode
390  */
391  auto set_user_ts_jacobian = [&](auto dm) {
393  CHKERR DMTSSetIJacobian(dm, CalcJacobian::set, getDMTsCtx(dm).get());
395  };
396 
397  auto dm = simple->getDM();
398  auto D = createDMVector(dm);
399  CHKERR DMoFEMMeshToLocalVector(dm, D, INSERT_VALUES, SCATTER_FORWARD);
400 
401  auto solver = pipeline_mng->createTSIM(
402  simple->getDM()); // Note DM is set as argument. If DM is not, internal
403  // copy of pipeline DM is created.
404  CHKERR set_user_ts_jacobian(dm);
405  CHKERR set_time_monitor(dm, solver);
406  CHKERR TSSetSolution(solver, D);
407  CHKERR TSSetFromOptions(solver);
408  CHKERR set_fieldsplit_preconditioner(solver);
409  CHKERR TSSetUp(solver);
410 
411  CHKERR TSSolve(solver, D);
412 
414 }
415 
418 
419  // Processes to set output results are integrated in solveSystem()
420 
422 }
423 
426 
427  CHKERR readMesh();
435 
437 }
438 
439 int main(int argc, char *argv[]) {
440 
441  // Initialisation of MoFEM/PETSc and MOAB data structures
442  const char param_file[] = "param_file.petsc";
443  MoFEM::Core::Initialize(&argc, &argv, param_file, help);
444 
445  // Add logging channel for example
446  auto core_log = logging::core::get();
447  core_log->add_sink(
448  LogManager::createSink(LogManager::getStrmWorld(), "EXAMPLE"));
449  LogManager::setLog("EXAMPLE");
450  MOFEM_LOG_TAG("EXAMPLE", "example")
451 
452  // Error handling
453  try {
454  // Register MoFEM discrete manager in PETSc
455  DMType dm_name = "DMMOFEM";
456  CHKERR DMRegister_MoFEM(dm_name);
457 
458  // Create MOAB instance
459  moab::Core mb_instance; // mesh database
460  moab::Interface &moab = mb_instance; // mesh database interface
461 
462  // Create MoFEM instance
463  MoFEM::Core core(moab); // finite element database
464  MoFEM::Interface &m_field = core; // finite element interface
465 
466  // Run the main analysis
467  HeatEquation heat_problem(m_field);
468  CHKERR heat_problem.runProgram();
469  }
470  CATCH_ERRORS;
471 
472  // Finish work: cleaning memory, getting statistics, etc.
474 
475  return 0;
476 }
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
MoFEM::UnknownInterface::getInterface
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Definition: UnknownInterface.hpp:93
OpBoundaryTimeScalarField
FormsIntegrators< BoundaryEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpBaseTimesScalar< 1 > OpBoundaryTimeScalarField
Definition: heat_equation.cpp:51
MoFEM::EntitiesFieldData::EntData
Data on single entity (This is passed as argument to DataOperator::doWork)
Definition: EntitiesFieldData.hpp:128
BoundaryEle
ElementsAndOps< SPACE_DIM >::BoundaryEle BoundaryEle
Definition: child_and_parent.cpp:39
Monitor::Monitor
Monitor(SmartPetscObj< DM > dm, boost::shared_ptr< PostProcEle > post_proc)
Definition: heat_equation.cpp:68
MoFEM::PipelineManager::getDomainRhsFE
boost::shared_ptr< FEMethod > & getDomainRhsFE()
Definition: PipelineManager.hpp:405
MoFEM::CoreTmp< 0 >
Core (interface) class.
Definition: Core.hpp:82
H1
@ H1
continuous field
Definition: definitions.h:85
CalcJacobian::set
static PetscErrorCode set(TS ts, PetscReal t, Vec u, Vec u_t, PetscReal a, Mat A, Mat B, void *ctx)
Definition: heat_equation.cpp:284
OpDomainGradTimesVec
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpGradTimesTensor< 1, 1, SPACE_DIM > OpDomainGradTimesVec
Definition: initial_diffusion.cpp:34
Monitor::preProcess
MoFEMErrorCode preProcess()
function is run at the beginning of loop
Definition: heat_equation.cpp:71
MoFEM::FEMethod
structure for User Loop Methods on finite elements
Definition: LoopMethods.hpp:369
OpDomainTimesScalarField
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpBaseTimesScalar< 1 > OpDomainTimesScalarField
Definition: heat_equation.cpp:42
HeatEquation
Definition: heat_equation.cpp:91
help
static char help[]
Definition: heat_equation.cpp:22
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
OpBoundaryTimeScalarField
FormsIntegrators< BoundaryEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpBaseTimesScalar< 1 > OpBoundaryTimeScalarField
Definition: photon_diffusion.cpp:47
MoFEM::OpSetHOInvJacToScalarBases< 2 >
Definition: HODataOperators.hpp:78
MoFEM::OpCalculateScalarFieldValuesDot
OpCalculateScalarFieldValuesFromPetscVecImpl< PetscData::CTX_SET_X_T > OpCalculateScalarFieldValuesDot
Definition: UserDataOperators.hpp:273
MoFEM::PETSC
@ PETSC
Definition: FormsIntegrators.hpp:105
MoFEM::PipelineManager
PipelineManager interface.
Definition: PipelineManager.hpp:24
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
MoFEM::DMoFEMMeshToLocalVector
PetscErrorCode DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode)
set local (or ghosted) vector values on mesh for partition only
Definition: DMMoFEM.cpp:523
BasicFiniteElements.hpp
MoFEM::PipelineManager::getBoundaryRhsFE
boost::shared_ptr< FEMethod > & getBoundaryRhsFE()
Definition: PipelineManager.hpp:413
MoFEM::CoreTmp< 0 >::Finalize
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition: Core.cpp:112
Monitor::postProcess
MoFEMErrorCode postProcess()
function is run at the end of loop
Definition: heat_equation.cpp:76
MoFEM::Simple
Simple interface for fast problem set-up.
Definition: Simple.hpp:27
HeatEquation::initialCondition
MoFEMErrorCode initialCondition()
Definition: heat_equation.cpp:161
OpDomainMass
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, FIELD_DIM > OpDomainMass
Definition: child_and_parent.cpp:53
HeatEquation::setupProblem
MoFEMErrorCode setupProblem()
Definition: heat_equation.cpp:129
order
constexpr int order
Definition: dg_projection.cpp:18
MoFEM::OpCalculateHOJac< 2 >
Definition: HODataOperators.hpp:273
CalcJacobian
Definition: heat_equation.cpp:283
MoFEM::DeprecatedCoreInterface
Deprecated interface functions.
Definition: DeprecatedCoreInterface.hpp:16
OpDomainSource
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< 1, 1 > OpDomainSource
Definition: heat_equation.cpp:46
OpBoundaryMass
FormsIntegrators< BoundaryEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, SPACE_DIM > OpBoundaryMass
[Only used with Hencky/nonlinear material]
Definition: seepage.cpp:71
c
constexpr double c
Definition: heat_equation.cpp:56
MoFEM::OpCalculateScalarFieldGradient
Get field gradients at integration pts for scalar filed rank 0, i.e. vector field.
Definition: UserDataOperators.hpp:1293
MoFEM::Interface
DeprecatedCoreInterface Interface
Definition: Interface.hpp:2002
MoFEM::PipelineManager::EdgeEle
MoFEM::EdgeElementForcesAndSourcesCore EdgeEle
Definition: PipelineManager.hpp:36
HeatEquation::runProgram
MoFEMErrorCode runProgram()
Definition: heat_equation.cpp:424
MoFEM::PostProcBrokenMeshInMoab
Definition: PostProcBrokenMeshInMoabBase.hpp:667
HeatEquation::boundaryCondition
MoFEMErrorCode boundaryCondition()
Definition: heat_equation.cpp:183
OpBoundaryMass
FormsIntegrators< BoundaryEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, 1 > OpBoundaryMass
Definition: heat_equation.cpp:49
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
MoFEM::createDMVector
auto createDMVector(DM dm)
Get smart vector from DM.
Definition: DMMoFEM.hpp:1099
MoFEM::CoreInterface::get_moab
virtual moab::Interface & get_moab()=0
MoFEM
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
OpDomainTimesScalarField
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpBaseTimesScalar< 1 > OpDomainTimesScalarField
Definition: initial_diffusion.cpp:32
a
constexpr double a
Definition: approx_sphere.cpp:30
MoFEM::BcManager
Simple interface for fast problem set-up.
Definition: BcManager.hpp:25
BoundaryEleOp
k
constexpr double k
Definition: heat_equation.cpp:57
simple
void simple(double P1[], double P2[], double P3[], double c[], const int N)
Definition: acoustic.cpp:69
double
MoFEM::PipelineManager::FaceEle
MoFEM::FaceElementForcesAndSourcesCore FaceEle
Definition: PipelineManager.hpp:35
OpBoundarySource
FormsIntegrators< EdgeEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< 1, 1 > OpBoundarySource
Definition: helmholtz.cpp:31
MoFEM::FormsIntegrators::Assembly
Assembly methods.
Definition: FormsIntegrators.hpp:312
OpPPMap
OpPostProcMapInMoab< SPACE_DIM, SPACE_DIM > OpPPMap
Definition: photon_diffusion.cpp:29
MoFEM::OpCalculateScalarFieldValues
Get value at integration points for scalar field.
Definition: UserDataOperators.hpp:82
HeatEquation::setIntegrationRules
MoFEMErrorCode setIntegrationRules()
Definition: heat_equation.cpp:145
OpDomainGradGrad
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpGradGrad< 1, 1, SPACE_DIM > OpDomainGradGrad
Definition: heat_equation.cpp:40
MoFEM::DMRegister_MoFEM
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition: DMMoFEM.cpp:43
MoFEM::TsSetIJacobian
PetscErrorCode TsSetIJacobian(TS ts, PetscReal t, Vec u, Vec u_t, PetscReal a, Mat A, Mat B, void *ctx)
Set function evaluating jacobian in TS solver.
Definition: TsCtx.cpp:165
HeatEquation::mField
MoFEM::Interface & mField
Definition: heat_equation.cpp:110
CalcJacobian::lastA
static double lastA
Definition: heat_equation.cpp:295
EntData
EntitiesFieldData::EntData EntData
[Define dimension]
Definition: heat_equation.cpp:30
MOFEM_LOG_TAG
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
Definition: LogManager.hpp:339
t
constexpr double t
plate stiffness
Definition: plate.cpp:59
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
BiLinearForm
SPACE_DIM
constexpr int SPACE_DIM
[Define dimension]
Definition: heat_equation.cpp:27
OpGradTimesTensor
FormsIntegrators< DomainEleOp >::Assembly< A >::LinearForm< I >::OpGradTimesTensor< 1, FIELD_DIM, SPACE_DIM > OpGradTimesTensor
Definition: operators_tests.cpp:48
Monitor::operator()
MoFEMErrorCode operator()()
function is run for every finite element
Definition: heat_equation.cpp:72
MoFEM::AddHOOps
Add operators pushing bases from local to physical configuration.
Definition: HODataOperators.hpp:503
integration_rule
auto integration_rule
Definition: free_surface.cpp:185
MoFEM::OpUnSetBc
Definition: FormsIntegrators.hpp:49
ElementsAndOps
Definition: child_and_parent.cpp:18
OpDomainGradTimesVec
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpGradTimesTensor< 1, 1, SPACE_DIM > OpDomainGradTimesVec
Definition: heat_equation.cpp:44
Range
MoFEM::PipelineManager::getDomainLhsFE
boost::shared_ptr< FEMethod > & getDomainLhsFE()
Definition: PipelineManager.hpp:401
DomainEleOp
main
int main(int argc, char *argv[])
Definition: heat_equation.cpp:439
HeatEquation::outputResults
MoFEMErrorCode outputResults()
Definition: heat_equation.cpp:416
MoFEM::CoreTmp< 0 >::Initialize
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
Definition: Core.cpp:72
MOFEM_LOG
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:308
OpDomainGradGrad
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpGradGrad< 1, 1, SPACE_DIM > OpDomainGradGrad
Definition: helmholtz.cpp:25
CATCH_ERRORS
#define CATCH_ERRORS
Catch errors.
Definition: definitions.h:385
MoFEM::Core
CoreTmp< 0 > Core
Definition: Core.hpp:1140
UserDataOperator
ForcesAndSourcesCore::UserDataOperator UserDataOperator
Definition: HookeElement.hpp:75
HeatEquation::solveSystem
MoFEMErrorCode solveSystem()
Definition: heat_equation.cpp:300
BLOCKSET
@ BLOCKSET
Definition: definitions.h:161
Monitor
[Push operators to pipeline]
Definition: adolc_plasticity.cpp:333
approx_order
int approx_order
Definition: test_broken_space.cpp:50
MoFEM::DMMoFEMTSSetMonitor
PetscErrorCode DMMoFEMTSSetMonitor(DM dm, TS ts, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
Set Monitor To TS solver.
Definition: DMMoFEM.cpp:1056
AINSWORTH_LEGENDRE_BASE
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:60
MoFEM::OpSetBc
Set indices on entities on finite element.
Definition: FormsIntegrators.hpp:38
EigenMatrix::Vec
const FTensor::Tensor2< T, Dim, Dim > Vec
Definition: MatrixFunction.hpp:66
MoFEM::MeshsetsManager
Interface for managing meshsets containing materials and boundary conditions.
Definition: MeshsetsManager.hpp:104
HeatEquation::HeatEquation
HeatEquation(MoFEM::Interface &m_field)
Definition: heat_equation.cpp:116
HeatEquation::boundaryMarker
boost::shared_ptr< std::vector< unsigned char > > boundaryMarker
Definition: heat_equation.cpp:113
MoFEM::OpInvertMatrix
Definition: UserDataOperators.hpp:3249
init_u
constexpr double init_u
Definition: heat_equation.cpp:58
ReactionDiffusionEquation::D
const double D
diffusivity
Definition: reaction_diffusion.cpp:20
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453
OpBoundarySource
FormsIntegrators< BoundaryEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< 1, 1 > OpBoundarySource
Definition: heat_equation.cpp:53
DomainEle
ElementsAndOps< SPACE_DIM >::DomainEle DomainEle
Definition: child_and_parent.cpp:34
MoFEM::SmartPetscObj< DM >
HeatEquation::readMesh
MoFEMErrorCode readMesh()
Definition: heat_equation.cpp:118
OpDomainSource
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< 1, FIELD_DIM > OpDomainSource
Definition: child_and_parent.cpp:55
MoFEM::MeshsetsManager::checkMeshset
bool checkMeshset(const int ms_id, const CubitBCType cubit_bc_type) const
check for CUBIT Id and CUBIT type
Definition: MeshsetsManager.cpp:360
HeatEquation::assembleSystem
MoFEMErrorCode assembleSystem()
Definition: heat_equation.cpp:205
MoFEM::DMoFEMLoopFiniteElements
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
Definition: DMMoFEM.cpp:586
MoFEM::PetscOptionsGetInt
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
Definition: DeprecatedPetsc.hpp:142
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
MoFEM::FieldBlas
Basic algebra on fields.
Definition: FieldBlas.hpp:21
MoFEM::getDMTsCtx
auto getDMTsCtx(DM dm)
Get TS context data structure used by DM.
Definition: DMMoFEM.hpp:1141
OpDomainMass
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, 1 > OpDomainMass
Definition: heat_equation.cpp:38
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
MoFEM::OpPostProcMapInMoab
Post post-proc data at points from hash maps.
Definition: PostProcBrokenMeshInMoabBase.hpp:698