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.
monolithic_dem_coupled_wall_condition.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: Guillermo Casas gcasas@gmail.com
11 //
12 
13 #ifndef KRATOS_MONOLITHIC_DEM_COUPLED_WALL_CONDITION_H
14 #define KRATOS_MONOLITHIC_DEM_COUPLED_WALL_CONDITION_H
15 
16 // System includes
17 #include <string>
18 #include <iostream>
19 
20 
21 // External includes
22 
23 
24 // Project includes
25 #include "includes/define.h"
26 #include "includes/serializer.h"
27 #include "includes/condition.h"
28 #include "includes/process_info.h"
29 
30 // Application includes
33 #include "includes/cfd_variables.h"
34 
35 //Other Applications includes
38 
39 namespace Kratos
40 {
43 
46 
50 
54 
58 
62 
64 
73 template< unsigned int TDim, unsigned int TNumNodes = TDim >
74 class KRATOS_API(SWIMMING_DEM_APPLICATION) MonolithicDEMCoupledWallCondition : public MonolithicWallCondition < TDim, TNumNodes >
75 {
76 public:
80 
81  typedef Node NodeType;
82 
84 
86 
88 
89  typedef Vector VectorType;
90 
91  typedef Matrix MatrixType;
92 
93  typedef std::size_t IndexType;
94 
95  typedef std::size_t SizeType;
96 
97  typedef std::vector<std::size_t> EquationIdVectorType;
98 
99  typedef std::vector< Dof<double>::Pointer > DofsVectorType;
100 
102 
104 
108 
110 
114  MonolithicWallCondition< TDim, TNumNodes >(NewId)
115  {
116  }
117 
119 
124  const NodesArrayType& ThisNodes):
125  MonolithicWallCondition< TDim, TNumNodes >(NewId,ThisNodes)
126  {
127  }
128 
130 
135  GeometryType::Pointer pGeometry):
136  MonolithicWallCondition< TDim, TNumNodes >(NewId,pGeometry)
137  {
138  }
139 
141 
147  GeometryType::Pointer pGeometry,
148  PropertiesType::Pointer pProperties):
149  MonolithicWallCondition< TDim, TNumNodes >(NewId,pGeometry,pProperties)
150  {
151  }
152 
155  MonolithicWallCondition< TDim, TNumNodes >(rOther)
156  {
157  }
158 
161 
162 
166 
169  {
170  Condition::operator=(rOther);
171 
172  return *this;
173  }
174 
178 
180 
185  Condition::Pointer Create(IndexType NewId, NodesArrayType const& ThisNodes, PropertiesType::Pointer pProperties) const override
186  {
187  return Condition::Pointer(new MonolithicDEMCoupledWallCondition(NewId, this->GetGeometry().Create(ThisNodes), pProperties));
188  }
189  Condition::Pointer Create(IndexType NewId,
190  GeometryType::Pointer pGeom,
191  PropertiesType::Pointer pProperties) const override
192  {
193  return Kratos::make_intrusive< MonolithicDEMCoupledWallCondition >(NewId, pGeom, pProperties);
194  }
195 
197 
200  void CalculateLocalSystem(MatrixType& rLeftHandSideMatrix,
201  VectorType& rRightHandSideVector,
202  const ProcessInfo& rCurrentProcessInfo) override
203  {
204  const SizeType BlockSize = (rCurrentProcessInfo[FRACTIONAL_STEP] == 1) ? TDim + 1 : TDim;
205  const SizeType LocalSize = BlockSize * TNumNodes;
206 
207  if (rLeftHandSideMatrix.size1() != LocalSize)
208  rLeftHandSideMatrix.resize(LocalSize,LocalSize);
209 
210  if (rRightHandSideVector.size() != LocalSize)
211  rRightHandSideVector.resize(LocalSize);
212 
213  noalias(rLeftHandSideMatrix) = ZeroMatrix(LocalSize,LocalSize);
214  noalias(rRightHandSideVector) = ZeroVector(LocalSize);
215 
216  }
217 
219 
222  void CalculateLeftHandSide(MatrixType& rLeftHandSideMatrix, const ProcessInfo& rCurrentProcessInfo) override
223  {
224  const SizeType BlockSize = (rCurrentProcessInfo[FRACTIONAL_STEP] == 1) ? TDim + 1 : TDim;
225  const SizeType LocalSize = BlockSize * TNumNodes;
226 
227  if (rLeftHandSideMatrix.size1() != LocalSize)
228  rLeftHandSideMatrix.resize(LocalSize,LocalSize);
229 
230  noalias(rLeftHandSideMatrix) = ZeroMatrix(LocalSize,LocalSize);
231  }
232 
234 
237  void CalculateRightHandSide(VectorType& rRightHandSideVector, const ProcessInfo& rCurrentProcessInfo) override
238  {
239  if (rCurrentProcessInfo[FRACTIONAL_STEP] == 1){
240  const SizeType BlockSize = TDim + 1;
241  const SizeType LocalSize = BlockSize * TNumNodes;
242 
243  if (rRightHandSideVector.size() != LocalSize)
244  rRightHandSideVector.resize(LocalSize);
245 
246  noalias(rRightHandSideVector) = ZeroVector(LocalSize);
247  }
248 
249  else {
250  const unsigned int BlockSize = TDim;
251  const SizeType LocalSize = BlockSize * TNumNodes;
252 
253  if (rRightHandSideVector.size() != LocalSize)
254  rRightHandSideVector.resize(LocalSize);
255 
256  noalias(rRightHandSideVector) = ZeroVector(LocalSize);
257 
258 // const unsigned int LocalSize = TDim;
259 
260 // const GeometryType& rGeom = this->GetGeometry();
261 // const GeometryType::IntegrationPointsArrayType& IntegrationPoints = rGeom.IntegrationPoints(GeometryData::IntegrationMethod::GI_GAUSS_2);
262 // const unsigned int NumGauss = IntegrationPoints.size();
263 
264 // MatrixType NContainer = rGeom.ShapeFunctionsValues(GeometryData::IntegrationMethod::GI_GAUSS_2);
265 
266 // array_1d<double,3> Normal;
267 // this->CalculateNormal(Normal); //this already contains the area
268 // double A = std::sqrt(Normal[0]*Normal[0]+Normal[1]*Normal[1]+Normal[2]*Normal[2]);
269 // Normal /= A;
270 
271 // // CAUTION: "Jacobian" is 2.0*A for triangles but 0.5*A for lines
272 // double J = (TDim == 2) ? 0.5*A : 2.0*A;
273 
274 // for (unsigned int g = 0; g < NumGauss; g++)
275 // {
276 // Vector N = row(NContainer,g);
277 // double Weight = J * IntegrationPoints[g].Weight();
278 
279 // // Neumann boundary condition
280 // for (unsigned int i = 0; i < TNumNodes; i++)
281 // {
282 // //unsigned int row = i*LocalSize;
283 // const NodeType& rConstNode = this->GetGeometry()[i];
284 // const array_1d<double,3>& rVel = this->GetGeometry()[j].FastGetSolutionStepValue(VELOCITY);
285 
286 // for (unsigned int j = 0; j < TNumNodes; j++)
287 // {
288 // unsigned int row = j*LocalSize;
289 // for (unsigned int d = 0; d < TDim;d++)
290 // rLocalVector[row+d] -= Weight*DN[j]*N[i]*rVel[d]*Normal[d];
291 // }
292 // }
293 // }
294  }
295  }
296 
297 
299 
303  void EquationIdVector(EquationIdVectorType& rResult, const ProcessInfo& rCurrentProcessInfo) const override;
304 
305 
307 
311  void GetDofList(DofsVectorType& ConditionDofList, const ProcessInfo& CurrentProcessInfo) const override;
312 
316 
317 
321 
322 
326 
328  virtual std::string Info() const override
329  {
330  std::stringstream buffer;
331  buffer << "MonolithicDEMCoupledWallCondition" << TDim << "D";
332  return buffer.str();
333  }
334 
336  virtual void PrintInfo(std::ostream& rOStream) const override
337  {
338  rOStream << "MonolithicDEMCoupledWallCondition";
339  }
340 
342  virtual void PrintData(std::ostream& rOStream) const override{}
343 
344 
348 
349 
351 
352 protected:
355 
356 
360 
361 
365 
366 
370 
374 
375 
379 
380 
384 
385 
387 
388 private:
391 
392 
396 
397 
401 
402  friend class Serializer;
403 
404  virtual void save(Serializer& rSerializer) const override
405  {
407  }
408 
409  virtual void load(Serializer& rSerializer) override
410  {
412  }
413 
417 
418 
422 
423 
427 
428 
432 
433 
437 
438 
440 
441 }; // Class MonolithicDEMCoupledWallCondition
442 
443 
445 
448 
449 
453 
454 
456 template< unsigned int TDim, unsigned int TNumNodes >
457 inline std::istream& operator >> (std::istream& rIStream,
459 {
460  return rIStream;
461 }
462 
464 template< unsigned int TDim, unsigned int TNumNodes >
465 inline std::ostream& operator << (std::ostream& rOStream,
467 {
468  rThis.PrintInfo(rOStream);
469  rOStream << std::endl;
470  rThis.PrintData(rOStream);
471 
472  return rOStream;
473 }
474 
476 
478 
479 
480 } // namespace Kratos.
481 
482 #endif // KRATOS_MONOLITHIC_DEM_COUPLED_WALL_CONDITION_H
Base class for all Conditions.
Definition: condition.h:59
std::size_t SizeType
Definition: condition.h:94
std::vector< std::size_t > EquationIdVectorType
Definition: condition.h:98
std::vector< DofType::Pointer > DofsVectorType
Definition: condition.h:100
Condition & operator=(Condition const &rOther)
Assignment operator.
Definition: condition.h:181
std::size_t IndexType
Definition: flags.h:74
Geometry base class.
Definition: geometry.h:71
This object defines an indexed object.
Definition: indexed_object.h:54
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
Implements a wall condition for the monolithic formulation.
Definition: monolithic_dem_coupled_wall_condition.h:75
std::size_t SizeType
Definition: monolithic_dem_coupled_wall_condition.h:95
PointerVectorSet< Dof< double >, IndexedObject > DofsArrayType
Definition: monolithic_dem_coupled_wall_condition.h:101
Geometry< NodeType > GeometryType
Definition: monolithic_dem_coupled_wall_condition.h:85
void CalculateLeftHandSide(MatrixType &rLeftHandSideMatrix, const ProcessInfo &rCurrentProcessInfo) override
Return a matrix of the correct size, filled with zeros (for compatibility with time schemes).
Definition: monolithic_dem_coupled_wall_condition.h:222
std::size_t IndexType
Definition: monolithic_dem_coupled_wall_condition.h:93
void GetDofList(DofsVectorType &ConditionDofList, const ProcessInfo &CurrentProcessInfo) const override
Returns a list of the element's Dofs.
Properties PropertiesType
Definition: monolithic_dem_coupled_wall_condition.h:83
MonolithicDEMCoupledWallCondition & operator=(MonolithicDEMCoupledWallCondition const &rOther)
Assignment operator.
Definition: monolithic_dem_coupled_wall_condition.h:168
void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Return local right hand side of the correct size, filled with zeros (for compatibility with time sche...
Definition: monolithic_dem_coupled_wall_condition.h:237
Node NodeType
Definition: monolithic_dem_coupled_wall_condition.h:81
virtual void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: monolithic_dem_coupled_wall_condition.h:336
MonolithicDEMCoupledWallCondition(IndexType NewId, const NodesArrayType &ThisNodes)
Constructor using an array of nodes.
Definition: monolithic_dem_coupled_wall_condition.h:123
std::vector< Dof< double >::Pointer > DofsVectorType
Definition: monolithic_dem_coupled_wall_condition.h:99
Vector VectorType
Definition: monolithic_dem_coupled_wall_condition.h:89
MonolithicDEMCoupledWallCondition(IndexType NewId, GeometryType::Pointer pGeometry)
Constructor using Geometry.
Definition: monolithic_dem_coupled_wall_condition.h:134
Matrix MatrixType
Definition: monolithic_dem_coupled_wall_condition.h:91
void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &rCurrentProcessInfo) const override
Provides the global indices for each one of this element's local rows.
Condition::Pointer Create(IndexType NewId, GeometryType::Pointer pGeom, PropertiesType::Pointer pProperties) const override
It creates a new condition pointer.
Definition: monolithic_dem_coupled_wall_condition.h:189
virtual ~MonolithicDEMCoupledWallCondition()
Destructor.
Definition: monolithic_dem_coupled_wall_condition.h:160
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(MonolithicDEMCoupledWallCondition)
Geometry< NodeType >::PointsArrayType NodesArrayType
Definition: monolithic_dem_coupled_wall_condition.h:87
void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Return local contributions of the correct size, filled with zeros (for compatibility with time scheme...
Definition: monolithic_dem_coupled_wall_condition.h:200
virtual void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: monolithic_dem_coupled_wall_condition.h:342
Condition::Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, PropertiesType::Pointer pProperties) const override
Create a new MonolithicDEMCoupledWallCondition object.
Definition: monolithic_dem_coupled_wall_condition.h:185
virtual std::string Info() const override
Turn back information as a string.
Definition: monolithic_dem_coupled_wall_condition.h:328
MonolithicDEMCoupledWallCondition(IndexType NewId=0)
Default constructor.
Definition: monolithic_dem_coupled_wall_condition.h:113
MonolithicDEMCoupledWallCondition(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties)
Constructor using Properties.
Definition: monolithic_dem_coupled_wall_condition.h:146
std::vector< std::size_t > EquationIdVectorType
Definition: monolithic_dem_coupled_wall_condition.h:97
MonolithicDEMCoupledWallCondition(MonolithicDEMCoupledWallCondition const &rOther)
Copy constructor.
Definition: monolithic_dem_coupled_wall_condition.h:154
Implements a wall condition for the monolithic formulation.
Definition: monolithic_wall_condition.h:70
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
Modeler::Pointer Create(const std::string &ModelerName, Model &rModel, const Parameters ModelParameters)
Checks if the modeler is registered.
Definition: modeler_factory.cpp:30
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
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