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.
retention_law.h
Go to the documentation of this file.
1 // KRATOS___
2 // // ) )
3 // // ___ ___
4 // // ____ //___) ) // ) )
5 // // / / // // / /
6 // ((____/ / ((____ ((___/ / MECHANICS
7 //
8 // License: geo_mechanics_application/license.txt
9 //
10 // Main authors: Vahid Galavi
11 //
12 
13 #pragma once
14 
15 /* System includes */
16 
17 /* External includes */
18 
19 /* Project includes */
20 #include "geometries/geometry.h"
21 #include "includes/define.h"
22 #include "includes/process_info.h"
23 #include "includes/properties.h"
24 #include "includes/serializer.h"
25 #include <optional>
26 
27 namespace Kratos {
28 
32 class KRATOS_API(GEO_MECHANICS_APPLICATION) RetentionLaw {
33 public:
39  using SizeType = std::size_t;
41 
46 
47  class Parameters {
49 
66  public:
67  Parameters(const Properties& rMaterialProperties,
68  const ProcessInfo& rCurrentProcessInfo)
69  : mrCurrentProcessInfo(rCurrentProcessInfo),
70  mrMaterialProperties(rMaterialProperties){};
71 
72  ~Parameters() = default;
73 
74  void SetFluidPressure(double FluidPressure)
75  {
76  mFluidPressure = FluidPressure;
77  };
78 
79  double GetFluidPressure() const
80  {
81  KRATOS_ERROR_IF_NOT(mFluidPressure.has_value())
82  << "Fluid pressure is not yet set in the retention "
83  "law when trying to retrieve it, aborting.\n";
84  return mFluidPressure.value();
85  }
86 
87  const ProcessInfo& GetProcessInfo() const
88  {
89  return mrCurrentProcessInfo;
90  }
91 
93  {
94  return mrMaterialProperties;
95  }
96 
97  private:
98  std::optional<double> mFluidPressure;
99  const ProcessInfo& mrCurrentProcessInfo;
100  const Properties& mrMaterialProperties;
101 
102  }; // class Parameters end
103 
104  RetentionLaw() = default;
105 
106  virtual ~RetentionLaw() = default;
107 
115  virtual RetentionLaw::Pointer Clone() const = 0;
116 
124  virtual double& CalculateValue(Parameters& rParameters,
125  const Variable<double>& rThisVariable,
126  double& rValue) = 0;
127 
128  virtual double CalculateSaturation(Parameters& rParameters) = 0;
129 
130  virtual double CalculateEffectiveSaturation(Parameters& rParameters) = 0;
131 
132  virtual double CalculateDerivativeOfSaturation(Parameters& rParameters) = 0;
133 
134  virtual double CalculateRelativePermeability(Parameters& rParameters) = 0;
135 
136  virtual double CalculateBishopCoefficient(Parameters& rParameters) = 0;
137 
146  virtual void InitializeMaterial(const Properties& rMaterialProperties,
147  const GeometryType& rElementGeometry,
148  const Vector& rShapeFunctionsValues);
149 
150  virtual void Initialize(Parameters& rParameters);
151 
156  virtual void InitializeSolutionStep(Parameters& rParameters);
157 
162  virtual void FinalizeSolutionStep(Parameters& rParameters);
163 
168  virtual void Finalize(Parameters& rParameters);
169 
178  virtual void ResetMaterial(const Properties& rMaterialProperties,
179  const GeometryType& rElementGeometry,
180  const Vector& rShapeFunctionsValues);
181 
191  virtual int Check(const Properties& rMaterialProperties,
192  const ProcessInfo& rCurrentProcessInfo) = 0;
193 
199  inline static bool HasSameType(const RetentionLaw& rLHS, const RetentionLaw& rRHS)
200  {
201  return (typeid(rLHS) == typeid(rRHS));
202  }
203 
209  inline static bool HasSameType(const RetentionLaw* rLHS, const RetentionLaw* rRHS)
210  {
211  return RetentionLaw::HasSameType(*rLHS, *rRHS);
212  }
213 
215  virtual std::string Info() const
216  {
217  return "RetentionLaw";
218  }
219 
221  virtual void PrintInfo(std::ostream& rOStream) const
222  {
223  rOStream << Info();
224  }
225 
227  virtual void PrintData(std::ostream& rOStream) const
228  {
229  rOStream << "RetentionLaw has no data";
230  }
231 
232 private:
233  friend class Serializer;
234 
235  virtual void save(Serializer& rSerializer) const;
236 
237  virtual void load(Serializer& rSerializer);
238 
239 }; /* Class RetentionLaw */
240 
242 inline std::istream& operator>>(std::istream& rIStream, RetentionLaw& rThis);
243 
245 inline std::ostream& operator<<(std::ostream& rOStream, const RetentionLaw& rThis)
246 {
247  rThis.PrintInfo(rOStream);
248  rOStream << " : " << std::endl;
249  rThis.PrintData(rOStream);
250 
251  return rOStream;
252 }
253 
254 } /* namespace Kratos.*/
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
Geometry base class.
Definition: geometry.h:71
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
Definition: retention_law.h:47
const ProcessInfo & GetProcessInfo() const
Definition: retention_law.h:87
double GetFluidPressure() const
Definition: retention_law.h:79
Parameters(const Properties &rMaterialProperties, const ProcessInfo &rCurrentProcessInfo)
Definition: retention_law.h:67
const Properties & GetMaterialProperties() const
Definition: retention_law.h:92
void SetFluidPressure(double FluidPressure)
Definition: retention_law.h:74
Definition: retention_law.h:32
virtual double CalculateSaturation(Parameters &rParameters)=0
virtual ~RetentionLaw()=default
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: retention_law.h:227
virtual double & CalculateValue(Parameters &rParameters, const Variable< double > &rThisVariable, double &rValue)=0
Calculates the value of a specified variable (double)
KRATOS_CLASS_POINTER_DEFINITION(RetentionLaw)
virtual double CalculateDerivativeOfSaturation(Parameters &rParameters)=0
static bool HasSameType(const RetentionLaw &rLHS, const RetentionLaw &rRHS)
This method is used to check that two Retention Laws are the same type (references)
Definition: retention_law.h:199
virtual RetentionLaw::Pointer Clone() const =0
Clone function (has to be implemented by any derived class)
virtual double CalculateRelativePermeability(Parameters &rParameters)=0
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: retention_law.h:221
std::size_t SizeType
Definition: retention_law.h:39
virtual std::string Info() const
Turn back information as a string.
Definition: retention_law.h:215
static bool HasSameType(const RetentionLaw *rLHS, const RetentionLaw *rRHS)
This method is used to check that tow Retention Laws are the same type (pointers)
Definition: retention_law.h:209
virtual double CalculateEffectiveSaturation(Parameters &rParameters)=0
virtual double CalculateBishopCoefficient(Parameters &rParameters)=0
virtual int Check(const Properties &rMaterialProperties, const ProcessInfo &rCurrentProcessInfo)=0
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
#define KRATOS_ERROR_IF_NOT(conditional)
Definition: exception.h:163
void InitializeSolutionStep(ConstructionUtility &rThisUtil, std::string ThermalSubModelPartName, std::string MechanicalSubModelPartName, std::string HeatFluxSubModelPartName, std::string HydraulicPressureSubModelPartName, bool thermal_conditions, bool mechanical_conditions, int phase)
Definition: add_custom_utilities_to_python.cpp:45
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
#define KRATOS_CLASS_POINTER_DEFINITION(a)
Definition: smart_pointers.h:69