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.
herschel_bulkley_fluid.h
Go to the documentation of this file.
1 #ifndef KRATOS_HERSCHEL_BULKLEY_FLUID_H
2 #define KRATOS_HERSCHEL_BULKLEY_FLUID_H
3 
4 #include "includes/define.h"
5 #include "includes/element.h"
6 #include "includes/serializer.h"
8 
9 namespace Kratos {
10 
13 
16 
20 
24 
28 
32 
33 template< class TBaseElement,
34  class TShapeFunctionValues = typename TBaseElement::ShapeFunctionsType,
35  class TShapeFunctionGradients = typename TBaseElement::ShapeFunctionDerivativesType >
36 class HerschelBulkleyFluid : public TBaseElement
37 {
38 public:
39 
42 
43  // Pointer types for HerschelBulkleyFluid
45 
47  typedef Node NodeType;
48 
51 
54 
56 
58  typedef Vector VectorType;
59 
61  typedef Matrix MatrixType;
62 
63  typedef std::size_t IndexType;
64 
65  typedef std::size_t SizeType;
66 
67  typedef std::vector<std::size_t> EquationIdVectorType;
68 
69  typedef std::vector< Dof<double>::Pointer > DofsVectorType;
70 
72 
75 
78 
81 
85 
87 
91  TBaseElement(NewId)
92  {}
93 
95 
99  HerschelBulkleyFluid(IndexType NewId, const NodesArrayType& ThisNodes) :
100  TBaseElement(NewId, ThisNodes)
101  {}
102 
104 
108  HerschelBulkleyFluid(IndexType NewId, GeometryType::Pointer pGeometry) :
109  TBaseElement(NewId, pGeometry)
110  {}
111 
113 
118  HerschelBulkleyFluid(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties) :
119  TBaseElement(NewId, pGeometry, pProperties)
120  {}
121 
124  {}
125 
129 
130 
134 
135 
137 
144  Element::Pointer Create(IndexType NewId,
145  NodesArrayType const& ThisNodes,
146  PropertiesType::Pointer pProperties) const override
147  {
148  return Kratos::make_intrusive<HerschelBulkleyFluid<TBaseElement> >(NewId, this->GetGeometry().Create(ThisNodes), pProperties);
149  }
150 
152 
157  Element::Pointer Create(
158  IndexType NewId,
159  GeometryType::Pointer pGeom,
160  PropertiesType::Pointer pProperties) const override
161  {
162  return Kratos::make_intrusive< HerschelBulkleyFluid<TBaseElement> >(NewId,pGeom,pProperties);
163  }
164 
168 
169 
173 
174 
178 
180  std::string Info() const override
181  {
182  std::stringstream buffer;
183  buffer << "HerschelBulkleyFluid " ;
184  buffer << TBaseElement::Info();
185  return buffer.str();
186  }
187 
189  void PrintInfo(std::ostream& rOStream) const override
190  {
191  rOStream << "HerschelBulkleyFluid ";
192  TBaseElement::PrintInfo(rOStream);
193  }
194 
196  void PrintData(std::ostream& rOStream) const override {}
197 
198 
202 
203 
205 
206 
207 protected:
208 
211 
212 
216 
217 
221 
222 
226 
241  double EffectiveViscosity(double Density,
242  const TShapeFunctionValues &rN,
243  const TShapeFunctionGradients &rDN_DX,
244  double ElemSize,
245  const ProcessInfo &rProcessInfo) override
246  {
247  double GammaDot = this->EquivalentStrainRate(rDN_DX);
248 
249  double YieldStress = rProcessInfo[YIELD_STRESS];
250  double m = rProcessInfo[REGULARIZATION_COEFFICIENT];
251  double k = rProcessInfo[POWER_LAW_K];
252  double n = rProcessInfo[POWER_LAW_N];
253 
254  double DynamicViscosity;
255 
256  if (GammaDot > 1e-12) // Normal behaviour
257  {
258  DynamicViscosity = k*std::pow(GammaDot,n-1);
259  double Regularization = 1.0 - std::exp(-m*GammaDot);
260  DynamicViscosity += Regularization * YieldStress / GammaDot;
261  }
262  else // fallback to avoid division by zero
263  {
264  // Fall back to Newtonian behaviour
265  DynamicViscosity = k;
266  }
267 
268  return DynamicViscosity;
269  }
270 
271 
275 
276 
280 
281 
285 
286 
288 
289  private:
292 
293 
297 
298 
302 
303  friend class Serializer;
304 
305  void save(Serializer& rSerializer) const override
306  {
307  KRATOS_SERIALIZE_SAVE_BASE_CLASS(rSerializer, TBaseElement );
308  }
309 
310  void load(Serializer& rSerializer) override
311  {
312  KRATOS_SERIALIZE_LOAD_BASE_CLASS(rSerializer, TBaseElement );
313  }
314 
318 
319 
323 
324 
328 
329 
333 
334 
338 
341 
344 
345 
347 
348  }; // Class ClassName
349 
351 
354 
355 
359 
360 
362 template< class TBaseElement >
363 inline std::istream& operator >> (std::istream& rIStream,
365 {
366  return rIStream;
367 }
368 
370 template< class TBaseElement >
371 inline std::ostream& operator << (std::ostream& rOStream,
373 {
374  rThis.PrintInfo(rOStream);
375  rOStream << std::endl;
376  rThis.PrintData(rOStream);
377 
378  return rOStream;
379 }
380 
382 
384 
385 } // namespace Kratos.
386 
387 #endif // KRATOS_HERSCHEL_BULKLEY_FLUID_H
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
Geometry base class.
Definition: geometry.h:71
Definition: herschel_bulkley_fluid.h:37
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: herschel_bulkley_fluid.h:189
Node NodeType
Node type (default is: Node)
Definition: herschel_bulkley_fluid.h:47
Element::Pointer Create(IndexType NewId, GeometryType::Pointer pGeom, PropertiesType::Pointer pProperties) const override
Create a new element of this type.
Definition: herschel_bulkley_fluid.h:157
std::size_t IndexType
Definition: herschel_bulkley_fluid.h:63
std::size_t SizeType
Definition: herschel_bulkley_fluid.h:65
Kratos::Matrix ShapeFunctionDerivativesType
Type for a matrix containing the shape function gradients.
Definition: herschel_bulkley_fluid.h:77
HerschelBulkleyFluid(IndexType NewId=0)
Default constuctor.
Definition: herschel_bulkley_fluid.h:90
HerschelBulkleyFluid(IndexType NewId, GeometryType::Pointer pGeometry)
Constructor using a geometry object.
Definition: herschel_bulkley_fluid.h:108
Element::Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, PropertiesType::Pointer pProperties) const override
Create a new element of this type.
Definition: herschel_bulkley_fluid.h:144
Kratos::Vector ShapeFunctionsType
Type for shape function values container.
Definition: herschel_bulkley_fluid.h:74
std::vector< Dof< double >::Pointer > DofsVectorType
Definition: herschel_bulkley_fluid.h:69
Properties PropertiesType
Definition: herschel_bulkley_fluid.h:55
~HerschelBulkleyFluid() override
Destructor.
Definition: herschel_bulkley_fluid.h:123
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 Herschel-Bu...
Definition: herschel_bulkley_fluid.h:241
Vector VectorType
Vector type for local contributions to the linear system.
Definition: herschel_bulkley_fluid.h:58
HerschelBulkleyFluid(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties)
Constuctor using geometry and properties.
Definition: herschel_bulkley_fluid.h:118
Geometry< NodeType > GeometryType
Geometry type (using with given NodeType)
Definition: herschel_bulkley_fluid.h:50
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(HerschelBulkleyFluid)
std::string Info() const override
Turn back information as a string.
Definition: herschel_bulkley_fluid.h:180
Geometry< NodeType >::PointsArrayType NodesArrayType
Definition of nodes container type, redefined from GeometryType.
Definition: herschel_bulkley_fluid.h:53
PointerVectorSet< Dof< double >, IndexedObject > DofsArrayType
Definition: herschel_bulkley_fluid.h:71
GeometryType::ShapeFunctionsGradientsType ShapeFunctionDerivativesArrayType
Type for an array of shape function gradient matrices.
Definition: herschel_bulkley_fluid.h:80
std::vector< std::size_t > EquationIdVectorType
Definition: herschel_bulkley_fluid.h:67
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: herschel_bulkley_fluid.h:196
HerschelBulkleyFluid(IndexType NewId, const NodesArrayType &ThisNodes)
Constructor using an array of nodes.
Definition: herschel_bulkley_fluid.h:99
Matrix MatrixType
Matrix type for local contributions to the linear system.
Definition: herschel_bulkley_fluid.h:61
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 n
manufactured solution and derivatives (u=0 at z=0 dudz=0 at z=domain_height)
Definition: ode_solve.py:402
int k
Definition: quadrature.py:595
int m
Definition: run_marine_rain_substepping.py:8
e
Definition: run_cpp_mpi_tests.py:31