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.
temporal_method.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 //
12 
13 #if !defined(KRATOS_TEMPORAL_METHOD_H_INCLUDED)
14 #define KRATOS_TEMPORAL_METHOD_H_INCLUDED
15 
16 // System includes
17 
18 // External includes
19 
20 // Project includes
21 #include "includes/define.h"
22 #include "includes/model_part.h"
23 #include "includes/variables.h"
24 
25 // Application includes
26 
27 // Application method includes
28 
29 namespace Kratos
30 {
33 
36 
37 namespace TemporalMethods
38 {
40 {
41 public:
44 
45  TemporalMethod(ModelPart& rModelPart, const int EchoLevel)
46  : mrModelPart(rModelPart), mEchoLevel(EchoLevel)
47  {
48  }
49 
50  virtual ~TemporalMethod() = default;
51 
53  {
55 
56  KRATOS_ERROR << "Calling base class InitializeStatisticsVariables. "
57  "Please implement it in derrived class.\n";
58 
59  KRATOS_CATCH("");
60  }
61 
62  virtual void InitializeStatisticsMethod(double IntegrationStartTime)
63  {
64  mIntegrationStartTime = IntegrationStartTime;
65  const ProcessInfo& r_process_info = this->GetModelPart().GetProcessInfo();
66  if (!r_process_info[IS_RESTARTED])
67  {
69  }
70  }
71 
72  virtual void CalculateStatistics()
73  {
75 
76  KRATOS_ERROR << "Calling base class CalculateStatistics. "
77  "Please implement it in derrived class.\n";
78 
79  KRATOS_CATCH("");
80  }
81 
83  {
84  return mrModelPart;
85  }
86 
87  double GetTotalTime() const
88  {
90 
91  const ProcessInfo& r_process_info = this->GetModelPart().GetProcessInfo();
92  const double current_time = r_process_info[TIME];
93  const double total_time = current_time - mIntegrationStartTime;
94 
95  KRATOS_ERROR_IF(total_time < 0.0)
96  << "Total integration time should be greater than or equal to "
97  "zero. [ "
98  "total_time = "
99  << total_time << ", TIME = " << current_time << " ].\n";
100 
101  return total_time;
102 
103  KRATOS_CATCH("");
104  }
105 
106  double GetDeltaTime() const
107  {
108  const ProcessInfo& r_process_info = this->GetModelPart().GetProcessInfo();
109  return r_process_info[DELTA_TIME];
110  }
111 
112  int GetEchoLevel() const
113  {
114  return mEchoLevel;
115  }
116 
117 private:
118  ModelPart& mrModelPart;
119  int mEchoLevel;
120  double mIntegrationStartTime;
121 };
122 } // namespace TemporalMethods
123 } // namespace Kratos
124 #endif // KRATOS_TEMPORAL_METHOD_H_INCLUDED
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
Definition: temporal_method.h:40
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
TemporalMethod(ModelPart &rModelPart, const int EchoLevel)
Definition: temporal_method.h:45
virtual void InitializeStatisticsVariables()
Definition: temporal_method.h:52
double GetDeltaTime() const
Definition: temporal_method.h:106
int GetEchoLevel() const
Definition: temporal_method.h:112
KRATOS_CLASS_POINTER_DEFINITION(TemporalMethod)
Pointer definition of RansApplyFlagProcess.
ModelPart & GetModelPart() const
Definition: temporal_method.h:82
virtual void CalculateStatistics()
Definition: temporal_method.h:72
double GetTotalTime() const
Definition: temporal_method.h:87
virtual void InitializeStatisticsMethod(double IntegrationStartTime)
Definition: temporal_method.h:62
static int EchoLevel
Definition: co_sim_EMPIRE_API.h:42
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21