KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
time_averaging_process.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Suneth Warnakulasuriya (https://github.com/sunethwarna)
11 // Riccardo Tosi
12 //
13 
14 #if !defined(KRATOS_TIME_AVERAGING_PROCESS_H_INCLUDED)
15 #define KRATOS_TIME_AVERAGING_PROCESS_H_INCLUDED
16 
17 // System includes
18 #include <functional>
19 #include <string>
20 #include <vector>
21 
22 // External includes
23 
24 // Project includes
25 #include "containers/model.h"
26 #include "processes/process.h"
27 
28 namespace Kratos
29 {
32 
35 
39 
43 
47 
51 
52 class KRATOS_API(KRATOS_CORE) TimeAveragingProcess : public Process
53 {
54 public:
57 
60 
63 
67 
69 
70  TimeAveragingProcess(Model& rModel, Parameters rParameters);
71 
73  ~TimeAveragingProcess() override;
74 
78 
82 
83  int Check() override;
84 
85  void ExecuteInitialize() override;
86 
87  void ExecuteFinalizeSolutionStep() override;
88 
92  const Parameters GetDefaultParameters() const override;
93 
97 
101 
105 
107  std::string Info() const override;
108 
110  void PrintInfo(std::ostream& rOStream) const override;
111 
113  void PrintData(std::ostream& rOStream) const override;
114 
118 
120 
121 protected:
124 
128 
132 
136 
140 
144 
148 
150 
151 private:
154 
158 
159  Model& mrModel;
160  Parameters mrParameters;
161 
162  std::string mModelPartName;
163  std::string mIntegrationControlVariableName;
164  enum TimeAveragingContainers
165  {
166  NodalHistorical,
167  NodalNonHistorical,
168  ElementalNonHistorical
169  };
170  TimeAveragingContainers mTimeAveragingContainer;
171  enum TimeAveragingMethods
172  {
173  Average,
174  RootMeanSquare
175  };
176  TimeAveragingMethods mTimeAveragingMethod;
177 
178  std::vector<std::string> mVariableNamesList;
179  std::vector<std::string> mAveragedVariableNamesList;
180 
181  int mEchoLevel;
182 
183  double mCurrentTime;
184 
188 
192  bool IsIntegrationStep() const;
193 
194  template <typename TDataType>
195  void CalculateTimeIntegratedNodalHistoricalQuantity(ModelPart::NodesContainerType& rNodes,
196  const Variable<TDataType>& rVariable,
197  const Variable<TDataType>& rAveragedVariable,
198  const double DeltaTime) const;
199 
200  template <typename TDataType, typename TContainerType>
201  void CalculateTimeIntegratedNonHistoricalQuantity(
202  TContainerType& rContainer,
203  const Variable<TDataType>& rVariable,
204  const Variable<TDataType>& rAveragedVariable,
205  const double DeltaTime) const;
206 
207  template <typename TDataType>
208  void AverageMethod(const TDataType& rTemporalVariable,
209  TDataType& rAveragedVariable,
210  const double DeltaTime) const;
211 
212  template <typename TDataType>
213  void RootMeanSquareMethod(const TDataType& rTemporalVariable,
214  TDataType& rAveragedVariable,
215  const double DeltaTime) const;
216 
217  template <typename TDataType>
218  std::function<void(const TDataType&, TDataType&, const double)> GetTimeAveragingMethod() const;
219 
223 
227 
231 
233  TimeAveragingProcess& operator=(TimeAveragingProcess const& rOther);
234 
236  TimeAveragingProcess(TimeAveragingProcess const& rOther);
237 
239 
240 }; // Class TimeAveragingProcess
241 
243 
246 
250 
252 inline std::ostream& operator<<(std::ostream& rOStream, const TimeAveragingProcess& rThis);
253 
255 
257 
258 } // namespace Kratos.
259 
260 #endif // KRATOS_TIME_AVERAGING_PROCESS_H_INCLUDED defined
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
void ExecuteFinalizeSolutionStep() override
this function will be executed at every time step AFTER performing the solve phase
Definition: periodic_interface_process.hpp:55
void ExecuteInitialize() override
Definition: periodic_interface_process.hpp:37
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
Base class for all Elements.
Definition: element.h:60
This class aims to manage different model parts across multi-physics simulations.
Definition: model.h:60
Element ElementType
Definition: model_part.h:120
Node NodeType
Definition: model_part.h:117
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
This class defines the node.
Definition: node.h:65
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
The base class for all processes in Kratos.
Definition: process.h:49
Definition: time_averaging_process.h:53
KRATOS_CLASS_POINTER_DEFINITION(TimeAveragingProcess)
Pointer definition of TimeAveragingProcess.
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
def Average(vector_container, current_values, k_calc, pp)
Definition: initial_time_bounds.py:102