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.
mass_conservation_check_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: Simon Wenczowski
11 //
12 //
13 
14 #ifndef KRATOS_MASS_CONSERVATION_CHECK_PROCESS_H
15 #define KRATOS_MASS_CONSERVATION_CHECK_PROCESS_H
16 
17 // System includes
18 #include <string>
19 
20 // External includes
21 
22 // Project includes
23 #include "processes/process.h"
27 
28 // Application includes
29 
30 
31 namespace Kratos
32 {
35 
38 
42 
46 
50 
54 
57 
58 class KRATOS_API(FLUID_DYNAMICS_APPLICATION) MassConservationCheckProcess : public Process
59 {
60 public:
63 
66 
67  typedef Node NodeType;
69 
73 
84  ModelPart& rModelPart,
85  const bool PerformCorrections,
86  const int CorrectionFreq,
87  const bool WriteToLogFile,
88  const std::string& LogFileName);
89 
97  ModelPart& rModelPart,
98  Parameters& rParameters);
99 
102 
106 
110 
114 
120  double ComputePositiveVolume();
121 
127  double ComputeNegativeVolume();
128 
134  double ComputeInterfaceArea();
135 
142  double ComputeFlowOverBoundary( const Kratos::Flags boundaryFlag );
143 
149  std::string Initialize();
150 
156  std::string ExecuteInTimeStep();
157 
158  // ///@}
159  // ///@name Inquiry
160  // ///@{
161 
162  // ///@}
163  // ///@name Input and output
164  // ///@{
165 
167  std::string Info() const override
168  {
169  std::stringstream buffer;
170  buffer << "MassConservationCheckProcess";
171  return buffer.str();
172  }
173 
175  void PrintInfo(std::ostream& rOStream) const override {rOStream << "MassConservationCheckProcess";}
176 
178  void PrintData(std::ostream& rOStream) const override {}
179 
180 
184 
186 
187 private:
190 
191 
195 
196  // Reference to the model part
197  const ModelPart& mrModelPart;
198 
199  // Process parameters
200  int mCorrectionFreq = 1;
201  bool mWriteToLogFile = true;
202  bool mPerformCorrections = true;
203  std::string mLogFileName = "mass_conservation.log";
204 
205  // Inital volume with negative distance field ("water" volume)
206  double mInitialNegativeVolume = -1.0;
207  // Inital volume with positive distance field ("air" volume)
208  double mInitialPositiveVolume = -1.0;
209 
210  // Balance parameter resulting from an integration of the net inflow into the domain over time
211  // The initial value is the "mInitialNegativeVolume" meaning "water" is considered here
212  double mTheoreticalNegativeVolume = -1.0;
213 
214  // Net inflow into the domain (please consider that inflow at the outlet and outflow at the inlet are possible)
215  double mQNet0 = 0.0; // for the current time step (t)
216  double mQNet1 = 0.0; // for the past time step (t - 1)
217  double mQNet2 = 0.0; // for the past time step (t - 2)
218 
222 
226 
234  void ComputeVolumesAndInterface( double& positiveVolume, double& negativeVolume, double& interfaceArea );
235 
242  void CalculateNormal2D( array_1d<double,3>& An, const Geometry<Node >& pGeometry );
243 
250  void CalculateNormal3D( array_1d<double,3>& An, const Geometry<Node >& pGeometry );
251 
257  void ShiftDistanceField( double deltaDist );
258 
265  Triangle2D3<Node>::Pointer GenerateAuxTriangle( const Geometry<Node >& rGeom );
266 
276  void GenerateAuxLine( const Geometry<Node >& rGeom,
277  const Vector& distance,
278  Line3D2<IndexedPoint>::Pointer& p_aux_line,
279  array_1d<double, 3>& aux_velocity1,
280  array_1d<double, 3>& aux_velocity2 );
281 
285 
286 
290 
291 
295 
297  // DistanceModificationProcess() = delete;
298 
300  // DistanceModificationProcess& operator=(DistanceModificationProcess const& rOther) = delete;
301 
303  // DistanceModificationProcess(DistanceModificationProcess const& rOther) = delete;
304 
306 
307 }; // Class DistanceModificationProcess
308 
312 
316 
318 
320 
321 }; // namespace Kratos.
322 
323 #endif // KRATOS_MASS_CONSERVATION_CHECK_PROCESS_H
Definition: flags.h:58
Geometry base class.
Definition: geometry.h:71
An two node 3D line geometry with linear shape functions.
Definition: line_3d_2.h:64
Definition: mass_conservation_check_process.h:59
KRATOS_CLASS_POINTER_DEFINITION(MassConservationCheckProcess)
Pointer definition of DistanceModificationProcess.
Node NodeType
Definition: mass_conservation_check_process.h:67
Geometry< NodeType > GeometryType
Definition: mass_conservation_check_process.h:68
std::string Info() const override
Turn back information as a string.
Definition: mass_conservation_check_process.h:167
~MassConservationCheckProcess() override
Destructor.
Definition: mass_conservation_check_process.h:101
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: mass_conservation_check_process.h:175
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: mass_conservation_check_process.h:178
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
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
A three node 2D triangle geometry with linear shape functions.
Definition: triangle_2d_3.h:74
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21