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.
write_from_sw_at_interface_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: Miguel Maso Sotomayor
11 //
12 
13 #pragma once
14 
15 // System includes
16 
17 
18 // External includes
19 
20 
21 // Project includes
22 #include "containers/model.h"
23 #include "processes/process.h"
26 
27 namespace Kratos
28 {
31 
35 
39 
43 
47 
51 class ModelPart;
52 
60 template<std::size_t TDim>
61 class KRATOS_API(SHALLOW_WATER_APPLICATION) WriteFromSwAtInterfaceProcess : public Process
62 {
63 public:
66 
69 
71  using NodeType = Node;
72 
75 
79 
85 
89  WriteFromSwAtInterfaceProcess(Model& rModel, Parameters ThisParameters = Parameters());
90 
94  ~WriteFromSwAtInterfaceProcess() override = default;
95 
99 
100 
104 
105  struct locator_tls {
108  locator_tls(const int max_results = 10000) {
109  N.resize(TDim+1);
110  results.resize(max_results);
111  }
112  };
113 
114  void Execute() override;
115 
116  int Check() override;
117 
118  const Parameters GetDefaultParameters() const override;
119 
123 
124 
128 
129 
133 
135  std::string Info() const override {
136  std::stringstream buffer;
137  buffer << "WriteFromSwAtInterfaceProcess";
138  return buffer.str();
139  }
140 
142  void PrintInfo(std::ostream& rOStream) const override {
143  rOStream << Info();
144  }
145 
147  void PrintData(std::ostream& rOStream) const override {}
148 
152 
153 
155 
156 private:
159 
160  ModelPart& mrVolumeModelPart;
161  ModelPart& mrInterfaceModelPart;
162  array_1d<double,3> mDirection;
163  bool mStoreHistorical;
164 
165  // Option to print a debug file
166  bool mPrintVelocityProfile;
167 
168  // Option to substitute the boundaries by the neighbor
169  bool mExtrapolateBoundaries;
170  NodeType::Pointer mpFirstBoundaryNode;
171  NodeType::Pointer mpSecondBoundaryNode;
172  NodeType::Pointer mpFirstBoundaryNeighbor;
173  NodeType::Pointer mpSecondBoundaryNeighbor;
174 
178 
179 
183 
184  // void GetBoundingVolumeLimits(double& rMin, double& rMax);
185 
186  void ReadAndSetValues(
187  NodeType& rNode,
190 
191  // array_1d<double,3> InterpolateVelocity(
192  // const Element::Pointer ElementId,
193  // const Vector& rShapeFunctionValues) const;
194 
195  template<class TDataType, class TVarType = Variable<TDataType>>
196  void SetValue(NodeType& rNode, const TVarType& rVariable, TDataType rValue)
197  {
198  if (mStoreHistorical)
199  rNode.FastGetSolutionStepValue(rVariable) = rValue;
200  else
201  rNode.GetValue(rVariable) = rValue;
202  }
203 
204  template<class TDataType, class TVarType = Variable<TDataType>>
205  TDataType GetValue(const NodeType& rNode, const TVarType& rVariable)
206  {
207  if (mStoreHistorical)
208  return rNode.FastGetSolutionStepValue(rVariable);
209  else
210  return rNode.GetValue(rVariable);
211  }
212 
213  // void FindBoundaryNeighbors();
214 
215  void CopyValues(const NodeType& rOriginNode, NodeType& rDestinationNode);
216 
220 
221 
225 
226 
230 
232  WriteFromSwAtInterfaceProcess& operator=(WriteFromSwAtInterfaceProcess const& rOther) = delete;
233 
235  WriteFromSwAtInterfaceProcess(WriteFromSwAtInterfaceProcess const& rOther) = delete;
236 
238 
239 }; // Class WriteFromSwAtInterfaceProcess
240 
242 
245 
246 
250 
251 
253 
254 } // namespace Kratos.
255 
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
This class is designed to allow the fast location of MANY points on the top of a 3D mesh.
Definition: binbased_fast_point_locator.h:68
ConfigureType::ResultContainerType ResultContainerType
Definition: binbased_fast_point_locator.h:81
Geometry base class.
Definition: geometry.h:71
This class aims to manage different model parts across multi-physics simulations.
Definition: model.h:60
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
This class defines the node.
Definition: node.h:65
TVariableType::Type & FastGetSolutionStepValue(const TVariableType &rThisVariable)
Definition: node.h:435
TVariableType::Type & GetValue(const TVariableType &rThisVariable)
Definition: node.h:466
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
Calculate the minimum distance from all the nodes to a boundary condition in 2D.
Definition: write_from_sw_at_interface_process.h:62
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: write_from_sw_at_interface_process.h:142
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: write_from_sw_at_interface_process.h:147
KRATOS_CLASS_POINTER_DEFINITION(WriteFromSwAtInterfaceProcess)
Pointer definition of WriteFromSwAtInterfaceProcess.
WriteFromSwAtInterfaceProcess()=delete
Default constructor.
std::string Info() const override
Turn back information as a string.
Definition: write_from_sw_at_interface_process.h:135
~WriteFromSwAtInterfaceProcess() override=default
Destructor.
Kratos::ModelPart ModelPart
Definition: kratos_wrapper.h:31
Parameters GetValue(Parameters &rParameters, const std::string &rEntry)
Definition: add_kratos_parameters_to_python.cpp:53
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
def SetValue(entity, variable, value)
Definition: coupling_interface_data.py:256
N
Definition: sensitivityMatrix.py:29
Definition: write_from_sw_at_interface_process.h:105
Vector N
Definition: write_from_sw_at_interface_process.h:106
BinBasedFastPointLocator< TDim >::ResultContainerType results
Definition: write_from_sw_at_interface_process.h:107
locator_tls(const int max_results=10000)
Definition: write_from_sw_at_interface_process.h:108