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.
pressure_calculate_process_axisym.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3 KratosULFApplication
4 A library based on:
5 Kratos
6 A General Purpose Software for Multi-Physics Finite Element Analysis
7 Version 1.0 (Released on march 05, 2007).
8 
9 Copyright 2007
10 Pooyan Dadvand, Riccardo Rossi, Pawel Ryzhakov
11 pooyan@cimne.upc.edu
12 rrossi@cimne.upc.edu
13 - CIMNE (International Center for Numerical Methods in Engineering),
14 Gran Capita' s/n, 08034 Barcelona, Spain
15 
16 
17 Permission is hereby granted, free of charge, to any person obtaining
18 a copy of this software and associated documentation files (the
19 "Software"), to deal in the Software without restriction, including
20 without limitation the rights to use, copy, modify, merge, publish,
21 distribute, sublicense and/or sell copies of the Software, and to
22 permit persons to whom the Software is furnished to do so, subject to
23 the following condition:
24 
25 Distribution of this code for any commercial purpose is permissible
26 ONLY BY DIRECT ARRANGEMENT WITH THE COPYRIGHT OWNERS.
27 
28 The above copyright notice and this permission notice shall be
29 included in all copies or substantial portions of the Software.
30 
31 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
32 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
34 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
35 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
36 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
37 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38 
39 ==============================================================================
40 */
41 
42 
43 //
44 // Project Name: Kratos
45 // Last Modified by: $Author: rrossi $
46 // Date: $Date: 2007-05-16 13:59:01 $
47 // Revision: $Revision: 1.4 $ 12 November 2007 - 3D added
48 //
49 //
50 // THIS PROCESS is INVENTED in order to CALCULATE THE PRESSURE and
51 //STORE it node-wise.
52 //THIS IS FOR THE METHOD, where we do not calculate pressure force...
53 
54 #if !defined(KRATOS_PRESSURE_CALCULATE_PROCESS_AXISYM_INCLUDED )
55 #define KRATOS_PRESSURE_CALCULATE_PROCESS_AXISYM_INCLUDED
56 
57 
58 
59 // System includes
60 #include <string>
61 #include <iostream>
62 #include <algorithm>
63 
64 // External includes
65 
66 
67 // Project includes
68 #include "includes/define.h"
69 #include "processes/process.h"
70 #include "includes/node.h"
71 #include "includes/element.h"
72 #include "includes/model_part.h"
73 #include "utilities/geometry_utilities.h"
74 #include "ULF_application.h"
75 
76 
77 namespace Kratos
78 {
79 
82 
86 
87 
91 
95 
99 
101 
108  : public Process
109 {
110 public:
113 
116 
120 
123  : mr_model_part(model_part),mdomain_size(domain_size)
124  {
125  }
126 
129  {
130  }
131 
132 
136 
137  void operator()()
138  {
139  Execute();
140  }
141 
142 
146 
147  void Execute() override
148  {
149  KRATOS_TRY
150 
151  ProcessInfo& proc_info = mr_model_part.GetProcessInfo();
152  double dummy;
153  //first initialize the pressure force to the old value
154 
155  //set the pressure to the old value
156  for(ModelPart::NodesContainerType::iterator in = mr_model_part.NodesBegin() ;
157  in != mr_model_part.NodesEnd() ; ++in)
158  {
159  in->FastGetSolutionStepValue(PRESSURE)=0.0;
160  }
161 
162  for(ModelPart::ElementsContainerType::iterator im = mr_model_part.ElementsBegin() ;
163  im != mr_model_part.ElementsEnd() ; ++im)
164  {
165  im->Calculate(PRESSURE,dummy,proc_info);
166  }
167  KRATOS_WATCH("Execute of Pressure Calulate Process");
168  /* //
169  if(mdomain_size == 2)
170  {
171  boost::numeric::ublas::bounded_matrix<double,3,2> DN_Dx;
172  array_1d<double,3> N;
173 
174  for(ModelPart::ElementsContainerType::iterator im = mr_model_part.ElementsBegin() ;
175  im != mr_model_part.ElementsEnd() ; ++im)
176  {
177  //get the geometry
178  Geometry< Node >& geom = im->GetGeometry();
179 
180  //calculate derivatives
181  double Area;
182  GeometryUtils::CalculateGeometryData(geom, DN_Dx, N, Area);
183 
184  //calculate the divergence
185  const array_1d<double,3>& v0 = geom[0].FastGetSolutionStepValue(VELOCITY);
186  const array_1d<double,3>& v1 = geom[1].FastGetSolutionStepValue(VELOCITY);
187  const array_1d<double,3>& v2 = geom[2].FastGetSolutionStepValue(VELOCITY);
188 
189  double div_v = DN_Dx(0,0)*v0[0] + DN_Dx(0,1)*v0[1]
190  + DN_Dx(1,0)*v1[0] + DN_Dx(1,1)*v1[1]
191  + DN_Dx(2,0)*v2[0] + DN_Dx(2,1)*v2[1];
192  double dp_el = K * dt * div_v * Area;
193 
194  geom[0].FastGetSolutionStepValue(PRESSURE) += dp_el*0.333333333333333333;
195  geom[1].FastGetSolutionStepValue(PRESSURE) += dp_el*0.333333333333333333;
196  geom[2].FastGetSolutionStepValue(PRESSURE) += dp_el*0.333333333333333333;
197  }
198  }
199  else
200  {
201  KRATOS_ERROR(std::logic_error,"pressure calculation 3D not implemented","");
202  */
203 
204  //divide by nodal area
205 
206  for(ModelPart::NodesContainerType::iterator in = mr_model_part.NodesBegin() ;
207  in != mr_model_part.NodesEnd() ; ++in)
208  {
209  if( (in->GetValue(NEIGHBOUR_ELEMENTS)).size() != 0)
210  {
211  const double& ar=in->FastGetSolutionStepValue(NODAL_AREA);
212 
213 
214 
216 
217 
218  in->FastGetSolutionStepValue(PRESSURE)/=ar;
219 
220  //double r=in->X();
221  //if (r<0.00001)
222  // r=0.00001;
223  //in->FastGetSolutionStepValue(PRESSURE)/=r;
224 
225  in->FastGetSolutionStepValue(PRESSURE)+=in->FastGetSolutionStepValue(PRESSURE,1);
226 
228 
229 // in->FastGetSolutionStepValue(PRESSURE)+=in->FastGetSolutionStepValue(PRESSURE,1);
230  //here we set 0 -pressure to the lonely nodes
231  }
232  else
233  in->FastGetSolutionStepValue(PRESSURE)=0.0;
234  }
235 
236 
237  KRATOS_CATCH("")
238  }
239 
240 
244 
245 
249 
250 
254 
256  std::string Info() const override
257  {
258  return "PressureCalculateProcessAxisym";
259  }
260 
262  void PrintInfo(std::ostream& rOStream) const override
263  {
264  rOStream << "PressureCalculateProcessAxisym";
265  }
266 
268  void PrintData(std::ostream& rOStream) const override
269  {
270  }
271 
272 
276 
277 
279 
280 protected:
283 
284 
288 
289 
293 
294 
298 
299 
303 
304 
308 
309 
313 
314 
316 
317 private:
320 
321 
325  ModelPart& mr_model_part;
326  double m_min_h;
327  unsigned int mdomain_size;
328 
329 
333 
334 
338 
339 
343 
344 
348 
349 
353 
355 // PressureCalculateProcessAxisym& operator=(PressureCalculateProcessAxisym const& rOther);
356 
358 // PressureCalculateProcessAxisym(PressureCalculateProcessAxisym const& rOther);
359 
360 
362 
363 }; // Class PressureCalculateProcessAxisym
364 
366 
369 
370 
374 
375 
377 inline std::istream& operator >> (std::istream& rIStream,
379 
381 inline std::ostream& operator << (std::ostream& rOStream,
382  const PressureCalculateProcessAxisym& rThis)
383 {
384  rThis.PrintInfo(rOStream);
385  rOStream << std::endl;
386  rThis.PrintData(rOStream);
387 
388  return rOStream;
389 }
391 
392 
393 } // namespace Kratos.
394 
395 #endif // KRATOS_PRESSURE_CONTRIBUTION_PROCESS_AXISYM_INCLUDED defined
396 
397 
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ElementIterator ElementsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1169
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
ElementIterator ElementsEnd(IndexType ThisIndex=0)
Definition: model_part.h:1179
NodeIterator NodesEnd(IndexType ThisIndex=0)
Definition: model_part.h:497
Short class definition.
Definition: pressure_calculate_process_axisym.h:109
KRATOS_CLASS_POINTER_DEFINITION(PressureCalculateProcessAxisym)
Pointer definition of PressureCalculateProcessAxisym.
void Execute() override
Execute method is used to execute the Process algorithms.
Definition: pressure_calculate_process_axisym.h:147
~PressureCalculateProcessAxisym() override
Destructor.
Definition: pressure_calculate_process_axisym.h:128
std::string Info() const override
Turn back information as a string.
Definition: pressure_calculate_process_axisym.h:256
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: pressure_calculate_process_axisym.h:262
void operator()()
Definition: pressure_calculate_process_axisym.h:137
PressureCalculateProcessAxisym(ModelPart &model_part, unsigned int domain_size)
Default constructor.
Definition: pressure_calculate_process_axisym.h:122
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: pressure_calculate_process_axisym.h:268
The base class for all processes in Kratos.
Definition: process.h:49
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_WATCH(variable)
Definition: define.h:806
#define KRATOS_TRY
Definition: define.h:109
im
Definition: GenerateCN.py:100
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
int domain_size
Definition: face_heat.py:4
model_part
Definition: face_heat.py:14
dummy
Definition: script.py:194