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.
apply_perturbation_function_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 #ifndef KRATOS_APPLY_PERTURBATION_FUNCTION_PROCESS_H_INCLUDED
14 #define KRATOS_APPLY_PERTURBATION_FUNCTION_PROCESS_H_INCLUDED
15 
16 
17 // System includes
18 
19 
20 // External includes
21 
22 
23 // Project includes
24 #include "includes/model_part.h"
25 #include "processes/process.h"
27 
28 
29 namespace Kratos
30 {
33 
36 
40 
44 
48 
52 
58 template<class TVarType>
59 class KRATOS_API(SHALLOW_WATER_APPLICATION) ApplyPerturbationFunctionProcess : public Process
60 {
61 public:
64 
65  typedef std::size_t IndexType;
66  typedef Node NodeType;
67  typedef Node::Pointer NodePointerType;
69  typedef NodesArrayType::iterator NodeIteratorType;
70 
73 
77 
80  ModelPart& rThisModelPart,
81  NodePointerType pNode,
82  TVarType& rThisVariable,
83  Parameters& rThisParameters);
84 
87  ModelPart& rThisModelPart,
88  NodesArrayType& rSourcePoints,
89  TVarType& rThisVariable,
90  Parameters& rThisParameters);
91 
94 
98 
99  /*
100  * @brief This operator is provided to call the process as a function and simply calls the Execute method.
101  */
102  void operator()()
103  {
104  Execute();
105  }
106 
110 
114  void Execute() override;
115 
119  int Check() override;
120 
125  void ExecuteBeforeSolutionLoop() override;
126 
130 
131 
135 
136 
140 
142  virtual std::string Info() const override
143  {
144  std::stringstream buffer;
145  buffer << "ApplyPerturbationFunctionProcess" ;
146  return buffer.str();
147  }
148 
150  virtual void PrintInfo(std::ostream& rOStream) const override {rOStream << "ApplyPerturbationFunctionProcess";}
151 
153  virtual void PrintData(std::ostream& rOStream) const override {}
154 
155 
159 
160 
162 
163 protected:
166 
167 
171 
172 
176 
177 
181 
182 
186 
187 
191 
192 
196 
197 
199 
200 private:
203 
204 
208 
209  ModelPart& mrModelPart;
210  NodesArrayType mSourcePoints;
211  TVarType& mrVariable;
212  double mDefaultValue;
213  double mInfluenceDistance;
214  double mPerturbation;
215  double mHalfWaveNumber;
216 
220 
221 
225 
226  void ValidateParameters(Parameters& rParameters);
227 
228  double ComputeDistance(NodeType& rNode);
229 
230  double PointPointSquareDistance(array_1d<double, 3>& rCoordA, array_1d<double, 3>& rCoordB);
231 
232  double ComputeInitialValue(double& rDistance);
233 
237 
238 
242 
243 
247 
249  // ApplyPerturbationFunctionProcess& operator=(ApplyPerturbationFunctionProcess const& rOther);
250 
252  // ApplyPerturbationFunctionProcess(ApplyPerturbationFunctionProcess const& rOther);
253 
254 
256 
257 }; // Class ApplyPerturbationFunctionProcess
258 
260 
263 
264 
268 
269 // /// input stream function
270 // inline std::istream& operator >> (std::istream& rIStream,
271 // ApplyPerturbationFunctionProcess& rThis);
272 
273 // /// output stream function
274 // inline std::ostream& operator << (std::ostream& rOStream,
275 // const ApplyPerturbationFunctionProcess& rThis)
276 // {
277 // rThis.PrintInfo(rOStream);
278 // rOStream << std::endl;
279 // rThis.PrintData(rOStream);
280 
281 // return rOStream;
282 // }
283 
285 
287 
288 } // namespace Kratos.
289 
290 #endif // KRATOS_APPLY_PERTURBATION_FUNCTION_PROCESS_H_INCLUDED defined
This process assigns a default value or a perturbation if the node is close to an influence area.
Definition: apply_perturbation_function_process.h:60
std::size_t IndexType
Definition: apply_perturbation_function_process.h:65
NodesArrayType::iterator NodeIteratorType
Definition: apply_perturbation_function_process.h:69
Node::Pointer NodePointerType
Definition: apply_perturbation_function_process.h:67
Node NodeType
Definition: apply_perturbation_function_process.h:66
ModelPart::NodesContainerType NodesArrayType
Definition: apply_perturbation_function_process.h:68
virtual void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: apply_perturbation_function_process.h:150
void operator()()
Definition: apply_perturbation_function_process.h:102
virtual void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: apply_perturbation_function_process.h:153
virtual std::string Info() const override
Turn back information as a string.
Definition: apply_perturbation_function_process.h:142
~ApplyPerturbationFunctionProcess() override
Destructor.
Definition: apply_perturbation_function_process.h:93
KRATOS_CLASS_POINTER_DEFINITION(ApplyPerturbationFunctionProcess)
Pointer definition of ApplyPerturbationFunctionProcess.
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
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
double ComputeDistance(const T1 &rCoords1, const T2 &rCoords2)
Definition: mapper_utilities.h:207
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
ModelPart::NodesContainerType NodesArrayType
Definition: gid_gauss_point_container.h:42