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.
bingham_fluid.h
Go to the documentation of this file.
1 #ifndef KRATOS_BINGHAM_FLUID_H
2 #define KRATOS_BINGHAM_FLUID_H
3 
4 #include "includes/define.h"
5 #include "includes/element.h"
6 #include "includes/serializer.h"
7 
8 namespace Kratos {
9 
12 
15 
19 
23 
27 
31 
32 template< class TBaseElement,
33  class TShapeFunctionValues = typename TBaseElement::ShapeFunctionsType,
34  class TShapeFunctionGradients = typename TBaseElement::ShapeFunctionDerivativesType >
35 class BinghamFluid : public TBaseElement
36 {
37 public:
38 
41 
42  // Pointer types for BinghamFluid
44 
46  typedef Node NodeType;
47 
50 
53 
55 
57  typedef Vector VectorType;
58 
60  typedef Matrix MatrixType;
61 
62  typedef std::size_t IndexType;
63 
64  typedef std::size_t SizeType;
65 
66  typedef std::vector<std::size_t> EquationIdVectorType;
67 
68  typedef std::vector< Dof<double>::Pointer > DofsVectorType;
69 
71 
74 
77 
80 
84 
86 
89  explicit BinghamFluid(IndexType NewId = 0) :
90  TBaseElement(NewId)
91  {}
92 
94 
98  BinghamFluid(IndexType NewId, const NodesArrayType& ThisNodes) :
99  TBaseElement(NewId, ThisNodes)
100  {}
101 
103 
107  BinghamFluid(IndexType NewId, GeometryType::Pointer pGeometry) :
108  TBaseElement(NewId, pGeometry)
109  {}
110 
112 
117  BinghamFluid(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties) :
118  TBaseElement(NewId, pGeometry, pProperties)
119  {}
120 
122  ~BinghamFluid() override
123  {}
124 
128 
129 
133 
134 
136 
143  Element::Pointer Create(IndexType NewId,
144  NodesArrayType const& ThisNodes,
145  PropertiesType::Pointer pProperties) const override
146  {
147  return Kratos::make_intrusive< BinghamFluid<TBaseElement> >(NewId, this->GetGeometry().Create(ThisNodes), pProperties);
148  }
149 
151 
156  Element::Pointer Create(
157  IndexType NewId,
158  GeometryType::Pointer pGeom,
159  PropertiesType::Pointer pProperties) const override
160  {
161  return Kratos::make_intrusive< BinghamFluid<TBaseElement> >(NewId,pGeom,pProperties);
162  }
163 
167 
168 
172 
173 
177 
179  std::string Info() const override
180  {
181  std::stringstream buffer;
182  buffer << "BinghamFluid " ;
183  buffer << TBaseElement::Info();
184  return buffer.str();
185  }
186 
188  void PrintInfo(std::ostream& rOStream) const override
189  {
190  rOStream << "BinghamFluid ";
191  TBaseElement::PrintInfo(rOStream);
192  }
193 
195  void PrintData(std::ostream& rOStream) const override {}
196 
197 
201 
202 
204 
205 
206 protected:
207 
210 
211 
215 
216 
220 
221 
225 
251  double EffectiveViscosity(double Density,
252  const TShapeFunctionValues &rN,
253  const TShapeFunctionGradients &rDN_DX,
254  double ElemSize,
255  const ProcessInfo &rProcessInfo) override
256  {
257  // Read the viscosity for the fluidified phase from the nodes
258  // In Kratos, the viscosity is assumed to be given in kinematic units (m^2/s)
259  double DynamicViscosity;
260  this->EvaluateInPoint(DynamicViscosity,VISCOSITY,rN);
261  DynamicViscosity *= Density;
262 
263  double GammaDot = this->EquivalentStrainRate(rDN_DX);
264 
265  double YieldStress = rProcessInfo[YIELD_STRESS];
266 
267  double m = rProcessInfo[REGULARIZATION_COEFFICIENT];
268 
269  if (GammaDot > 1e-12) // Normal behaviour
270  {
271  double Regularization = 1.0 - std::exp(-m*GammaDot);
272  DynamicViscosity += Regularization * YieldStress / GammaDot;
273  }
274  else // fallback to avoid division by zero
275  {
276  // In this case dynamic viscosity goes to infinity,
277  // understand the following as a large number times yield stress
278  DynamicViscosity += m*YieldStress;
279  }
280 
281  return DynamicViscosity;
282  }
283 
284 
288 
289 
293 
294 
298 
299 
301 
302  private:
305 
306 
310 
311 
315 
316  friend class Serializer;
317 
318  void save(Serializer& rSerializer) const override
319  {
320  KRATOS_SERIALIZE_SAVE_BASE_CLASS(rSerializer, TBaseElement );
321  }
322 
323  void load(Serializer& rSerializer) override
324  {
325  KRATOS_SERIALIZE_LOAD_BASE_CLASS(rSerializer, TBaseElement );
326  }
327 
331 
332 
336 
337 
341 
342 
346 
347 
351 
353  BinghamFluid& operator=(BinghamFluid const& rOther){ return *this; }
354 
356  BinghamFluid(BinghamFluid const& rOther){}
357 
358 
360 
361  }; // Class ClassName
362 
364 
367 
368 
372 
373 
375 template< class TBaseElement >
376 inline std::istream& operator >> (std::istream& rIStream,
378 {
379  return rIStream;
380 }
381 
383 template< class TBaseElement >
384 inline std::ostream& operator << (std::ostream& rOStream,
385  const BinghamFluid<TBaseElement>& rThis)
386 {
387  rThis.PrintInfo(rOStream);
388  rOStream << std::endl;
389  rThis.PrintData(rOStream);
390 
391  return rOStream;
392 }
393 
395 
397 
398 } // namespace Kratos.
399 
400 #endif // KRATOS_BINGHAM_FLUID_H
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
Definition: bingham_fluid.h:36
Properties PropertiesType
Definition: bingham_fluid.h:54
Matrix MatrixType
Matrix type for local contributions to the linear system.
Definition: bingham_fluid.h:60
PointerVectorSet< Dof< double >, IndexedObject > DofsArrayType
Definition: bingham_fluid.h:70
Kratos::Vector ShapeFunctionsType
Type for shape function values container.
Definition: bingham_fluid.h:73
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: bingham_fluid.h:195
double EffectiveViscosity(double Density, const TShapeFunctionValues &rN, const TShapeFunctionGradients &rDN_DX, double ElemSize, const ProcessInfo &rProcessInfo) override
EffectiveViscosity Calculate the effective viscosity at given integration point using the Bingham con...
Definition: bingham_fluid.h:251
Geometry< NodeType > GeometryType
Geometry type (using with given NodeType)
Definition: bingham_fluid.h:49
std::string Info() const override
Turn back information as a string.
Definition: bingham_fluid.h:179
~BinghamFluid() override
Destructor.
Definition: bingham_fluid.h:122
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(BinghamFluid)
Vector VectorType
Vector type for local contributions to the linear system.
Definition: bingham_fluid.h:57
GeometryType::ShapeFunctionsGradientsType ShapeFunctionDerivativesArrayType
Type for an array of shape function gradient matrices.
Definition: bingham_fluid.h:79
Node NodeType
Node type (default is: Node)
Definition: bingham_fluid.h:46
std::size_t SizeType
Definition: bingham_fluid.h:64
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: bingham_fluid.h:188
Element::Pointer Create(IndexType NewId, GeometryType::Pointer pGeom, PropertiesType::Pointer pProperties) const override
Create a new element of this type.
Definition: bingham_fluid.h:156
BinghamFluid(IndexType NewId, const NodesArrayType &ThisNodes)
Constructor using an array of nodes.
Definition: bingham_fluid.h:98
Element::Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, PropertiesType::Pointer pProperties) const override
Create a new element of this type.
Definition: bingham_fluid.h:143
BinghamFluid(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties)
Constuctor using geometry and properties.
Definition: bingham_fluid.h:117
std::vector< Dof< double >::Pointer > DofsVectorType
Definition: bingham_fluid.h:68
BinghamFluid(IndexType NewId, GeometryType::Pointer pGeometry)
Constructor using a geometry object.
Definition: bingham_fluid.h:107
Geometry< NodeType >::PointsArrayType NodesArrayType
Definition of nodes container type, redefined from GeometryType.
Definition: bingham_fluid.h:52
Kratos::Matrix ShapeFunctionDerivativesType
Type for a matrix containing the shape function gradients.
Definition: bingham_fluid.h:76
BinghamFluid(IndexType NewId=0)
Default constuctor.
Definition: bingham_fluid.h:89
std::size_t IndexType
Definition: bingham_fluid.h:62
std::vector< std::size_t > EquationIdVectorType
Definition: bingham_fluid.h:66
Geometry base class.
Definition: geometry.h:71
This object defines an indexed object.
Definition: indexed_object.h:54
This class defines the node.
Definition: node.h:65
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
A sorted associative container similar to an STL set, but uses a vector to store pointers to its data...
Definition: pointer_vector_set.h:72
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
Properties encapsulates data shared by different Elements or Conditions. It can store any type of dat...
Definition: properties.h:69
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
#define KRATOS_SERIALIZE_SAVE_BASE_CLASS(Serializer, BaseType)
Definition: define.h:812
#define KRATOS_SERIALIZE_LOAD_BASE_CLASS(Serializer, BaseType)
Definition: define.h:815
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
def load(f)
Definition: ode_solve.py:307
int m
Definition: run_marine_rain_substepping.py:8
e
Definition: run_cpp_mpi_tests.py:31