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.
alm_variables_calculation_process.h
Go to the documentation of this file.
1 // KRATOS ______ __ __ _____ __ __ __
2 // / ____/___ ____ / /_____ ______/ /_/ ___// /________ _______/ /___ ___________ _/ /
3 // / / / __ \/ __ \/ __/ __ `/ ___/ __/\__ \/ __/ ___/ / / / ___/ __/ / / / ___/ __ `/ /
4 // / /___/ /_/ / / / / /_/ /_/ / /__/ /_ ___/ / /_/ / / /_/ / /__/ /_/ /_/ / / / /_/ / /
5 // \____/\____/_/ /_/\__/\__,_/\___/\__//____/\__/_/ \__,_/\___/\__/\__,_/_/ \__,_/_/ MECHANICS
6 //
7 // License: BSD License
8 // license: ContactStructuralMechanicsApplication/license.txt
9 //
10 // Main authors: Vicente Mataix Ferrandiz
11 //
12 
13 #pragma once
14 
15 // System includes
16 
17 // External includes
18 
19 // Project includes
21 #include "processes/process.h"
22 #include "includes/model_part.h"
23 #include "geometries/point.h"
24 
25 namespace Kratos
26 {
29 
33 
37 
41 
49 class KRATOS_API(CONTACT_STRUCTURAL_MECHANICS_APPLICATION) ALMVariablesCalculationProcess
50  : public Process
51 {
52 public:
55 
58 
60  using SizeType = std::size_t;
61 
63  using IndexType= std::size_t;
64 
67 
70 
73 
77 
80  ModelPart& rThisModelPart,
81  Variable<double>& rNodalLengthVariable = NODAL_H,
82  Parameters ThisParameters = Parameters(R"({})")
83  ):mrThisModelPart(rThisModelPart),
84  mrNodalLengthVariable(rNodalLengthVariable)
85  {
87 
88  ThisParameters.ValidateAndAssignDefaults(GetDefaultParameters());
89 
90  // Assign members variables from parameters
91  mFactorStiffness = ThisParameters["stiffness_factor"].GetDouble();
92  mPenaltyScale = ThisParameters["penalty_scale_factor"].GetDouble();
93  mComputeScaleFactor = ThisParameters["compute_scale_factor"].GetBool();
94  mComputePenalty = ThisParameters["compute_penalty"].GetBool();
95 
96  KRATOS_ERROR_IF_NOT(rThisModelPart.HasNodalSolutionStepVariable( rNodalLengthVariable )) << "Missing variable " << rNodalLengthVariable;
97 
98  KRATOS_CATCH("")
99  }
100 
102  ~ALMVariablesCalculationProcess() override = default;
103 
107 
111 
115 
119  void operator()()
120  {
121  Execute();
122  }
123 
127 
131  void Execute() override;
132 
136  const Parameters GetDefaultParameters() const override
137  {
138  const Parameters default_parameters = Parameters(R"(
139  {
140  "stiffness_factor" : 10.0,
141  "penalty_scale_factor" : 1.0,
142  "compute_scale_factor" : true,
143  "compute_penalty" : true
144  })" );
145 
146  return default_parameters;
147  }
148 
152 
156 
160 
162  std::string Info() const override
163  {
164  return "ALMVariablesCalculationProcess";
165  }
166 
168  void PrintInfo(std::ostream& rOStream) const override
169  {
170  rOStream << "ALMVariablesCalculationProcess";
171  }
172 
174  void PrintData(std::ostream& rOStream) const override
175  {
176  }
177 
179 private:
182 
186 
187  ModelPart& mrThisModelPart;
188  Variable<double>& mrNodalLengthVariable;
189  double mFactorStiffness;
190  double mPenaltyScale;
191  bool mComputeScaleFactor;
192  bool mComputePenalty;
193 
197 
201 
205 
209 
213 
216 
218  //ALMVariablesCalculationProcess(ALMVariablesCalculationProcess const& rOther);
219 
221 
222 }; // Class ALMVariablesCalculationProcess
223 
227 
231 
233 inline std::istream& operator >> (std::istream& rIStream,
235 
237 inline std::ostream& operator << (std::ostream& rOStream,
238  const ALMVariablesCalculationProcess& rThis)
239 {
240  rThis.PrintInfo(rOStream);
241  rOStream << std::endl;
242  rThis.PrintData(rOStream);
243 
244  return rOStream;
245 }
246 
247 }
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
This process calculates the variables related with the ALM.
Definition: alm_variables_calculation_process.h:51
~ALMVariablesCalculationProcess() override=default
Destructor.
ALMVariablesCalculationProcess(ModelPart &rThisModelPart, Variable< double > &rNodalLengthVariable=NODAL_H, Parameters ThisParameters=Parameters(R"({})"))
Default constructor.
Definition: alm_variables_calculation_process.h:79
std::string Info() const override
Turn back information as a string.
Definition: alm_variables_calculation_process.h:162
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: alm_variables_calculation_process.h:168
KRATOS_CLASS_POINTER_DEFINITION(ALMVariablesCalculationProcess)
Pointer definition of ALMVariablesCalculationProcess.
ModelPart::ConditionsContainerType ConditionsArrayType
Conditions container definition.
Definition: alm_variables_calculation_process.h:72
ModelPart::NodesContainerType NodesArrayType
Nodes container definition.
Definition: alm_variables_calculation_process.h:69
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: alm_variables_calculation_process.h:174
void operator()()
Executes the process.
Definition: alm_variables_calculation_process.h:119
std::size_t SizeType
Size type definition.
Definition: alm_variables_calculation_process.h:60
const Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: alm_variables_calculation_process.h:136
std::size_t IndexType
Definition: flags.h:74
Geometry base class.
Definition: geometry.h:71
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
MeshType::ConditionsContainerType ConditionsContainerType
Condintions container. A vector set of Conditions with their Id's as key.
Definition: model_part.h:183
bool HasNodalSolutionStepVariable(VariableData const &ThisVariable) const
Definition: model_part.h:544
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
The base class for all processes in Kratos.
Definition: process.h:49
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR_IF_NOT(conditional)
Definition: exception.h:163
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