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.
embedded_postprocess_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: Ruben Zorrilla
11 //
12 //
13 
14 #ifndef KRATOS_EMBEDDED_POSTPROCESS_PROCESS_H
15 #define KRATOS_EMBEDDED_POSTPROCESS_PROCESS_H
16 
17 // System includes
18 #include <string>
19 #include <iostream>
20 
21 // External includes
22 
23 // Project includes
24 #include "processes/process.h"
25 #include "includes/define.h"
26 #include "includes/model_part.h"
27 #include "includes/cfd_variables.h"
28 #include "utilities/openmp_utils.h"
29 
30 // Application includes
31 
32 
33 namespace Kratos
34 {
37 
40 
44 
48 
52 
56 
59 {
60 public:
63 
66 
70 
73  {
74 
75  }
76 
79 
83 
87 
91 
93  {
94  const array_1d<double, 3> aux_zero = ZeroVector(3);
96 
97  // Simple check
98  if( mrModelPart.NodesBegin()->SolutionStepsDataHas( DISTANCE ) == false )
99  KRATOS_ERROR << "Nodes do not have DISTANCE variable!";
100  if( mrModelPart.NodesBegin()->SolutionStepsDataHas( PRESSURE ) == false )
101  KRATOS_ERROR << "Nodes do not have PRESSURE variable!";
102  if( mrModelPart.NodesBegin()->SolutionStepsDataHas( VELOCITY ) == false )
103  KRATOS_ERROR << "Nodes do not have VELOCITY variable!";
104  if( mrModelPart.NodesBegin()->SolutionStepsDataHas( EMBEDDED_WET_PRESSURE ) == false )
105  KRATOS_ERROR << "Nodes do not have EMBEDDED_WET_PRESSURE variable!";
106  if( mrModelPart.NodesBegin()->SolutionStepsDataHas( EMBEDDED_WET_VELOCITY ) == false )
107  KRATOS_ERROR << "Nodes do not have EMBEDDED_WET_VELOCITY variable!";
108 
109  // Embedded postprocess variables set
110  #pragma omp parallel for
111  for (int k = 0; k < static_cast<int>(rNodes.size()); ++k)
112  {
113  ModelPart::NodesContainerType::iterator itNode = rNodes.begin() + k;
114  const double dist = itNode->FastGetSolutionStepValue(DISTANCE);
115  double& emb_wet_pres = itNode->FastGetSolutionStepValue(EMBEDDED_WET_PRESSURE);
116  array_1d<double, 3>& emb_wet_vel = itNode->FastGetSolutionStepValue(EMBEDDED_WET_VELOCITY);
117 
118  if (dist >= 0.0)
119  {
120  emb_wet_pres = itNode->FastGetSolutionStepValue(PRESSURE); // Store the positive distance nodes PRESSURE in EMBEDDED_WET_PRESSURE variable
121  emb_wet_vel = itNode->FastGetSolutionStepValue(VELOCITY); // Store the positive distance nodes VELOCITY in EMBEDDED_WET_VELOCITY variable
122  }
123  else
124  {
125  emb_wet_pres = 0.0; // The negative distance nodes EMBEDDED_WET_PRESSURE is set to zero for visualization purposes
126  emb_wet_vel = aux_zero; // The negative distance nodes EMBEDDED_WET_VELOCITY is set to zero for visualization purposes
127  }
128  }
129  }
130 
134 
138 
140  std::string Info() const override
141  {
142  std::stringstream buffer;
143  buffer << "EmbeddedPostprocessProcess" ;
144  return buffer.str();
145  }
146 
148  void PrintInfo(std::ostream& rOStream) const override {rOStream << "EmbeddedPostprocessProcess";}
149 
151  void PrintData(std::ostream& rOStream) const override {}
152 
153 
157 
158 
160 
161 protected:
164 
168 
170 
174 
175 
179 
180 
184 
185 
189 
190 
194 
195 
197 
198 private:
201 
202 
206 
207 
211 
212 
216 
217 
221 
222 
226 
227 
231 
233  EmbeddedPostprocessProcess() = delete;
234 
236  EmbeddedPostprocessProcess& operator=(EmbeddedPostprocessProcess const& rOther) = delete;
237 
240 
241 
243 
244 }; // Class EmbeddedPostprocessProcess
245 
249 
253 
255 
257 
258 }; // namespace Kratos.
259 
260 #endif // KRATOS_EMBEDDED_POSTPROCESS_PROCESS_H
Utility to filter the embedded velocity and pressure values.
Definition: embedded_postprocess_process.h:59
ModelPart & mrModelPart
Definition: embedded_postprocess_process.h:169
KRATOS_CLASS_POINTER_DEFINITION(EmbeddedPostprocessProcess)
Pointer definition of EmbeddedPostprocessProcess.
EmbeddedPostprocessProcess(ModelPart &rModelPart)
Constructor.
Definition: embedded_postprocess_process.h:72
void ExecuteFinalizeSolutionStep() override
This function will be executed at every time step AFTER performing the solve phase.
Definition: embedded_postprocess_process.h:92
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: embedded_postprocess_process.h:151
~EmbeddedPostprocessProcess() override
Destructor.
Definition: embedded_postprocess_process.h:78
std::string Info() const override
Turn back information as a string.
Definition: embedded_postprocess_process.h:140
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: embedded_postprocess_process.h:148
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
The base class for all processes in Kratos.
Definition: process.h:49
#define KRATOS_ERROR
Definition: exception.h:161
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
float dist
Definition: edgebased_PureConvection.py:89
int k
Definition: quadrature.py:595