NuTo
Numerics Tool
TimeDependentProblem.h
Go to the documentation of this file.
1 #pragma once
4 #include "nuto/base/Group.h"
7 
9 
10 namespace NuTo
11 {
12 
19 {
20 public:
21  // let us call these "time dependent functions"
22  using GradientFunction = std::function<DofVector<double>(const CellIpData&, double t, double dt)>;
23  using HessianFunction = std::function<DofMatrix<double>(const CellIpData&, double t, double dt)>;
24  using UpdateFunction = std::function<void(const CellIpData&, double t, double dt)>;
25 
27 
28  DofVector<double> RenumberDofs(Constraint::Constraints constraints, std::vector<DofType> dofTypes,
29  DofVector<double> oldDofValues);
30 
34 
35  DofVector<double> Gradient(const DofVector<double>& dofValues, std::vector<DofType> dofs, double t, double dt);
36  DofMatrixSparse<double> Hessian0(const DofVector<double>& dofValues, std::vector<DofType> dofs, double t, double dt);
37 
38  void UpdateHistory(const DofVector<double>& dofValues, std::vector<DofType> dofs, double t, double dt);
39 
40 private:
41  SimpleAssembler mAssembler;
42  NodalValueMerger mMerger;
43 
44  using GradientPair = std::pair<Group<CellInterface>, GradientFunction>;
45  using Hessian0Pair = std::pair<Group<CellInterface>, HessianFunction>;
46  using UpdatePair = std::pair<Group<CellInterface>, UpdateFunction>;
47 
48  std::vector<GradientPair> mGradientFunctions;
49  std::vector<Hessian0Pair> mHessian0Functions;
50  std::vector<UpdatePair> mUpdateFunctions;
51 
52 
53  /*
54  *
55  *
56  *
57  *
58  *
59  * We better hide these two beauties in the basement of this class
60  *
61  *
62  *
63  *
64  *
65  *
66  *
67  *
68  */
69 
70 public:
72  template <typename TObject, typename TReturn>
73  static auto Bind_dt(TObject& object, TReturn (TObject::*f)(const CellIpData&, double dt))
74  {
75  return [&object, f](const CellIpData& cellIpData, double, double dt) { return (object.*f)(cellIpData, dt); };
76  }
77 
79  template <typename TObject, typename TReturn>
80  static auto Bind_t(TObject& object, TReturn (TObject::*f)(const NuTo::CellIpData&, double t))
81  {
82  return [&object, f](const CellIpData& cellIpData, double t, double) { return (object.*f)(cellIpData, t); };
83  }
84 
86  template <typename TObject, typename TReturn>
87  static auto Bind(TObject& object, TReturn (TObject::*f)(const NuTo::CellIpData&))
88  {
89  return [&object, f](const CellIpData& cellIpData, double, double) { return (object.*f)(cellIpData); };
90  }
91 };
92 } /* NuTo */
static auto Bind(TObject &object, TReturn(TObject::*f)(const NuTo::CellIpData &))
binds nothing
Definition: TimeDependentProblem.h:87
void AddUpdateFunction(Group< CellInterface > group, UpdateFunction f)
Definition: TimeDependentProblem.cpp:44
Performs our good old "NodeMerge" and should be replaced by any solution from issue #141 PDE nodal va...
Definition: NodalValueMerger.h:8
Definition: SimpleAssembler.h:11
static auto Bind_t(TObject &object, TReturn(TObject::*f)(const NuTo::CellIpData &, double t))
binds a t dependent integrand to a time dependent function
Definition: TimeDependentProblem.h:80
void AddGradientFunction(Group< CellInterface > group, GradientFunction f)
Definition: TimeDependentProblem.cpp:34
Similar to NuTo::CellData.
Definition: CellIpData.h:14
DofVector< double > Gradient(const DofVector< double > &dofValues, std::vector< DofType > dofs, double t, double dt)
Definition: TimeDependentProblem.cpp:56
TimeDependentProblem(MeshFem *rMesh)
Definition: TimeDependentProblem.cpp:6
std::function< DofMatrix< double >(const CellIpData &, double t, double dt)> HessianFunction
Definition: TimeDependentProblem.h:23
stores constraint equations, separated by their dof type
Definition: Constraints.h:47
std::function< void(const CellIpData &, double t, double dt)> UpdateFunction
Definition: TimeDependentProblem.h:24
Equation system that contains R(u, u&#39;) + M u&#39;&#39; = 0 with R = Gradient dR/du = Hessian0 dR/du&#39; = Hessia...
Definition: TimeDependentProblem.h:18
std::function< DofVector< double >(const CellIpData &, double t, double dt)> GradientFunction
Definition: TimeDependentProblem.h:22
contains the nodes, elements and interpolations for a classic finite element mesh ...
Definition: MeshFem.h:16
DofVector< double > RenumberDofs(Constraint::Constraints constraints, std::vector< DofType > dofTypes, DofVector< double > oldDofValues)
Definition: TimeDependentProblem.cpp:11
DofMatrixSparse< double > Hessian0(const DofVector< double > &dofValues, std::vector< DofType > dofs, double t, double dt)
Definition: TimeDependentProblem.cpp:67
dof container that is also capable of performing calculations.
Definition: DofMatrixContainer.h:13
void AddHessian0Function(Group< CellInterface > group, HessianFunction f)
Definition: TimeDependentProblem.cpp:39
Definition: Exception.h:6
void UpdateHistory(const DofVector< double > &dofValues, std::vector< DofType > dofs, double t, double dt)
Definition: TimeDependentProblem.cpp:78
static auto Bind_dt(TObject &object, TReturn(TObject::*f)(const CellIpData &, double dt))
binds a dt dependent integrand to a time dependent function
Definition: TimeDependentProblem.h:73