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.
porosity_tools.h
Go to the documentation of this file.
1 #ifndef KRATOS_POROSITY_TOOLS_H
2 #define KRATOS_POROSITY_TOOLS_H
3 // /* External includes */
4 
5 // System includes
6 
7 // Project includes
8 #include "includes/variables.h"
9 
10 /* System includes */
11 #include <limits>
12 #include <iostream>
13 #include <iomanip>
14 
15 /* External includes */
16 #ifdef _OPENMP
17 #include <omp.h>
18 #endif
19 
20 /* Project includes */
21 #include "includes/define.h"
22 #include "includes/model_part.h"
23 #include "utilities/openmp_utils.h"
24 #include "real_field.h"
25 
26 namespace Kratos
27 {
29 {
30 public:
31 typedef ModelPart::NodesContainerType::ContainerType::iterator NodesIteratorType;
32 
34 
36 
37 PorosityUtils(RealField& porosity_field):mPorosityField(porosity_field){}
38 
40 
41 virtual ~PorosityUtils(){}
42 
43 //***************************************************************************************************************
44 //***************************************************************************************************************
45 
46 void CalculatePorosity(ModelPart& r_model_part, const ProcessInfo& r_current_process_info)
47 {
48  double time = r_current_process_info[TIME];
49  const int nnodes = r_model_part.Nodes().size();
50 
51  #pragma omp parallel for
52  for (int i = 0; i < nnodes; ++i){
53  ModelPart::NodeIterator node_it = r_model_part.NodesBegin() + i;
55  coor[0] = node_it->X();
56  coor[1] = node_it->Y();
57  coor[2] = node_it->Z();
58  node_it->FastGetSolutionStepValue(FLUID_FRACTION) = mPorosityField.Evaluate(time, coor);
59  }
60 
61 }
62 
63 //***************************************************************************************************************
64 //***************************************************************************************************************
65 
69 
70 
74 
76 
77 virtual std::string Info() const
78 {
79 return "";
80 }
81 
83 
84 virtual void PrintInfo(std::ostream& rOStream) const
85 {
86 }
87 
89 
90 virtual void PrintData(std::ostream& rOStream) const
91 {
92 }
93 
94 
98 
100 
101 protected:
104 
105 
109 
110 
114 
115 
119 
120 
124 
128 
129 
133 
134 
136 
137 private:
138 
141 
142 
146 RealField mPorosityField;
150 
154 
155 
159 
160 
164 
165 
169 
171 PorosityUtils & operator=(PorosityUtils const& rOther);
172 
173 
175 
176 }; // Class PorosityUtils
177 
178 } // namespace Python.
179 
180 #endif // KRATOS_POROSITY_TOOLS_H
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
MeshType::NodeIterator NodeIterator
Definition: model_part.h:134
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
Definition: porosity_tools.h:29
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: porosity_tools.h:84
virtual ~PorosityUtils()
Destructor.
Definition: porosity_tools.h:41
PorosityUtils(RealField &porosity_field)
Default constructor.
Definition: porosity_tools.h:37
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: porosity_tools.h:90
KRATOS_CLASS_POINTER_DEFINITION(PorosityUtils)
ModelPart::NodesContainerType::ContainerType::iterator NodesIteratorType
Definition: porosity_tools.h:31
virtual std::string Info() const
Turn back information as a stemplate<class T, std::size_t dim> tring.
Definition: porosity_tools.h:77
void CalculatePorosity(ModelPart &r_model_part, const ProcessInfo &r_current_process_info)
Definition: porosity_tools.h:46
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
Definition: real_field.h:29
virtual double Evaluate(const double time, const array_1d< double, 3 > &coor)
Definition: real_field.h:45
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
time
Definition: face_heat.py:85
int nnodes
Definition: sensitivityMatrix.py:24
integer i
Definition: TensorModule.f:17