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.
edge_based_gradient_recovery_process.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: Ruben Zorrilla
11 //
12 
13 #if !defined(KRATOS_EDGE_BASED_GRADIENT_RECOVERY_PROCESS_INCLUDED)
14 #define KRATOS_EDGE_BASED_GRADIENT_RECOVERY_PROCESS_INCLUDED
15 
16 // System includes
17 
18 // External includes
19 
20 // Project includes
21 #include "includes/define.h"
28 
29 namespace Kratos
30 {
31 
34 
38 
42 
46 
50 
51 namespace
52 {
53 
54 template<class TDataType, bool TIsHistorical>
55 struct GradientDataHandler final
56 {
59 
60  using NodeType = typename ModelPart::NodeType;
61 
62  static constexpr bool IsDataTypeScalar = std::is_same<TDataType, double>();
63 
64  using GradientDataType = typename std::conditional<IsDataTypeScalar, array_1d<double,3>, Matrix>::type;
65 
69 
70  static double GetOrigin(
71  const NodeType& rNode,
72  const Variable<TDataType>& rOriginVar,
73  const std::size_t Component = 0);
74 
75  static void SetGradient(
76  NodeType& rNode,
77  const Variable<GradientDataType>& rGradientVar,
78  const array_1d<double,3>& rGradientValue,
79  const std::size_t Component = 0);
80 
82 };
83 
84 template<>
85 double GradientDataHandler<double, true>::GetOrigin(
86  const NodeType& rNode,
87  const Variable<double>& rOriginVar,
88  const std::size_t Component)
89 {
90  return rNode.FastGetSolutionStepValue(rOriginVar);
91 }
92 
93 template<>
94 double GradientDataHandler<double, false>::GetOrigin(
95  const NodeType& rNode,
96  const Variable<double>& rOriginVar,
97  const std::size_t Component)
98 {
99  return rNode.GetValue(rOriginVar);
100 }
101 
102 template<>
103 double GradientDataHandler<array_1d<double,3>, true>::GetOrigin(
104  const NodeType& rNode,
105  const Variable<array_1d<double,3>>& rOriginVar,
106  const std::size_t Component)
107 {
108  return rNode.FastGetSolutionStepValue(rOriginVar)[Component];
109 }
110 
111 template<>
112 double GradientDataHandler<array_1d<double,3>, false>::GetOrigin(
113  const NodeType& rNode,
114  const Variable<array_1d<double,3>>& rOriginVar,
115  const std::size_t Component)
116 {
117  return rNode.GetValue(rOriginVar)[Component];
118 }
119 
120 template<>
121 void GradientDataHandler<double, true>::SetGradient(
122  NodeType& rNode,
123  const Variable<array_1d<double,3>>& rGradientVar,
124  const array_1d<double,3>& rGradientValue,
125  const std::size_t Component)
126 {
127  noalias(rNode.FastGetSolutionStepValue(rGradientVar)) = rGradientValue;
128 }
129 
130 template<>
131 void GradientDataHandler<double, false>::SetGradient(
132  NodeType& rNode,
133  const Variable<array_1d<double,3>>& rGradientVar,
134  const array_1d<double,3>& rGradientValue,
135  const std::size_t Component)
136 {
137  noalias(rNode.GetValue(rGradientVar)) = rGradientValue;
138 }
139 
140 template<>
141 void GradientDataHandler<array_1d<double,3>, true>::SetGradient(
142  NodeType& rNode,
143  const Variable<Matrix>& rGradientVar,
144  const array_1d<double,3>& rGradientComponentValue,
145  const std::size_t Component)
146 {
147  auto &r_grad = rNode.FastGetSolutionStepValue(rGradientVar);
148  if (r_grad.size1() != 3 || r_grad.size2() != 3) {
149  r_grad = ZeroMatrix(3,3);
150  }
151 
152  for (std::size_t i = 0; i < 3; ++i) {
153  r_grad(Component, i) = rGradientComponentValue[i];
154  }
155 }
156 
157 template<>
158 void GradientDataHandler<array_1d<double,3>, false>::SetGradient(
159  NodeType& rNode,
160  const Variable<Matrix>& rGradientVar,
161  const array_1d<double,3>& rGradientComponentValue,
162  const std::size_t Component)
163 {
164  auto &r_grad = rNode.GetValue(rGradientVar);
165  if (r_grad.size1() != 3 || r_grad.size2() != 3) {
166  r_grad = ZeroMatrix(3,3);
167  }
168 
169  for (std::size_t i = 0; i < 3; ++i) {
170  r_grad(Component, i) = rGradientComponentValue[i];
171  }
172 }
173 
174 }
175 
185 template<class TDataType, class TSparseSpace, class TDenseSpace, class TLinearSolver>
187 {
188 public:
189 
192 
193  static constexpr bool IsDataTypeScalar = std::is_same<TDataType, double>();
194 
195  using GradientDataType = typename std::conditional<IsDataTypeScalar, array_1d<double,3>, Matrix>::type;
196 
197  using NodeType = typename ModelPart::NodeType;
198 
199  using OriginGetFunctionType = std::function<double(
200  const NodeType&,
201  const Variable<TDataType>&,
202  const std::size_t)>;
203 
204  using GradientSetFunctionType = std::function<void(
205  NodeType &rNode,
207  const array_1d<double, 3>&,
208  const std::size_t)>;
209 
211 
213 
217 
220 
224 
233  Model& rModel,
234  typename TLinearSolver::Pointer pLinearSolver,
235  Parameters ThisParameters)
236  : EdgeBasedGradientRecoveryProcess(rModel, ThisParameters)
237  {
238  auto p_builder_solver = Kratos::make_shared< ResidualBasedBlockBuilderAndSolver<TSparseSpace,TDenseSpace,TLinearSolver>>(pLinearSolver);
239  InitializeGradientRecoveryStrategy(p_builder_solver);
240  }
241 
244 
247  {
249  }
250 
254 
255 
259 
260  int Check() override
261  {
262  if (mSettings["is_historical_origin_variable"].GetBool()) {
264  }
265  if (mSettings["is_historical_gradient_variable"].GetBool()) {
267  }
268 
269  return 0;
270  }
271 
272  void Execute() override
273  {
274  KRATOS_TRY;
275 
276  // Do the gradient recovery procedure
277  // Note that we intentionally avoid calling the Check() and Finalize() methods in case
278  // the Execute() is called many times as these two perform expensive operations.
282 
283  KRATOS_CATCH("")
284  }
285 
286  void ExecuteInitialize() override
287  {
288  // Fill the auxiliary convection model part if not done yet
291  }
292 
293  // Set the gradient penalty coefficient in the gradient model part ProcessInfo container
294  auto& r_process_info = mpGradientRecoveryModelPart->GetProcessInfo();
295  r_process_info.SetValue(GRADIENT_PENALTY_COEFFICIENT, mSettings["gradient_penalty_coefficient"].GetDouble());
296 
297  // Initialize gradient variables in the non-historical case
298  // Note that does the threadsafe memory allocation
299  if (!mSettings["is_historical_gradient_variable"].GetBool()) {
301  }
302  }
303 
305  {
306  // Set the getter functions according to the origin and gradient variables databases
307  OriginGetFunctionType origin_value_getter;
308  if (mSettings["is_historical_origin_variable"].GetBool()) {
309  origin_value_getter = GradientDataHandler<TDataType, true>::GetOrigin;
310  } else {
311  origin_value_getter = GradientDataHandler<TDataType, false>::GetOrigin;
312  }
313 
314  GradientSetFunctionType gradient_value_setter;
315  if (mSettings["is_historical_gradient_variable"].GetBool()) {
316  gradient_value_setter = GradientDataHandler<TDataType, true>::SetGradient;
317  } else {
318  gradient_value_setter = GradientDataHandler<TDataType, false>::SetGradient;
319  }
320 
321  const std::size_t n_components = IsDataTypeScalar ? 1 : mpOriginModelPart->GetProcessInfo().GetValue(DOMAIN_SIZE);
322  for (std::size_t d = 0; d < n_components; ++d) {
323  CalculateGradientComponent(origin_value_getter, gradient_value_setter, d);
324  }
325  }
326 
328  {
329  if (mSettings["reform_gradient_model_part_at_each_step"].GetBool()) {
330  Clear();
331  }
332  }
333 
334  void ExecuteFinalize() override
335  {
336  Clear();
337  }
338 
339  void Clear() override
340  {
341  // Empty the model part
342  // Note that we call the Clear to avoid emptying the ProcessInfo
344  mModelPartIsInitialized = false;
345 
346  // Clear the linear strategy
347  mpSolvingStrategy->Clear();
348  }
349 
350  const Parameters GetDefaultParameters() const override
351  {
352  Parameters default_parameters = Parameters(R"({
353  "echo_level" : 0,
354  "model_part_name" : "",
355  "gradient_recovery_model_part_name" : "",
356  "origin_variable" : "",
357  "gradient_variable" : "",
358  "gradient_penalty_coefficient" : 1.0e-6,
359  "calculate_nodal_neighbours" : true,
360  "is_historical_origin_variable" : true,
361  "is_historical_gradient_variable": true,
362  "reform_gradient_model_part_at_each_step" : false
363  })");
364 
365  return default_parameters;
366  }
367 
371 
375 
379 
381  std::string Info() const override {
382  return "EdgeBasedGradientRecoveryProcess";
383  }
384 
386  void PrintInfo(std::ostream& rOStream) const override {
387  rOStream << "EdgeBasedGradientRecoveryProcess";
388  }
389 
391  void PrintData(std::ostream& rOStream) const override {
392  }
393 
397 
399 protected:
402 
406 
408 
410 
412 
414 
416 
418 
419  typename SolvingStrategyType::UniquePointer mpSolvingStrategy;
420 
422 
423  std::string mElementRegisterName;
424 
426 
430 
434 
436  Model& rModel,
437  Parameters ThisParameters)
438  : Process()
439  , mrModel(rModel)
440  {
441  // Validate the common settings as well as the element formulation specific ones
443 
444  // Checks and assign all the required member variables
445  CheckAndAssignSettings(ThisParameters);
446 
447  // Save validated parameters
448  mSettings = ThisParameters;
449  }
450 
451  virtual void InitializeGradientRecoveryModelPart(ModelPart& rOriginModelPart)
452  {
453  KRATOS_TRY
454 
455  // Set the model part for the gradient recovery
458  }
460 
461  // Add NODAL_VAUX variable to calculate the gradient with it
462  // Note that NODAL_MAUX is not used as the element retreives it from the non-historical database
464 
465  // Emulate the origin model part nodes in the gradient model part
466  auto& r_gradient_mp = *mpGradientRecoveryModelPart;
467  for (const auto& r_orig_node : rOriginModelPart.Nodes()) {
468  auto p_new_node = r_gradient_mp.CreateNewNode(r_orig_node.Id(), r_orig_node);
469  }
470 
471  // Ensure that the nodes have the auxiliary gradient variable as a DOF
474  if (mpOriginModelPart->GetProcessInfo().GetValue(DOMAIN_SIZE) == 3) {
476  }
477 
478  // Calculate the nodal neighbours in the origin model part
479  if (mSettings["calculate_nodal_neighbours"].GetBool()) {
480  FindGlobalNodalNeighboursProcess neigh_proc(rOriginModelPart);
481  neigh_proc.Execute();
482  }
483 
484  // Initialize flags in origin model part
485  VariableUtils().SetFlag(VISITED, false, rOriginModelPart.Nodes());
486 
487  // Generating the edge elements
488  // Note that we take advantage of the fact that the neighbour connectivities are the same
489  std::size_t id = 0;
490  const auto p_prop_0 = r_gradient_mp.CreateNewProperties(0);
491  const std::size_t n_nodes = rOriginModelPart.NumberOfNodes();
492  for (std::size_t i_node = 0; i_node < n_nodes; ++i_node) {
493  // Get origin node neighbours to create the edge elements
494  const auto it_node_orig_mp = rOriginModelPart.NodesBegin() + i_node;
495  auto& r_orig_neigh = it_node_orig_mp->GetValue(NEIGHBOUR_NODES);
496  for (auto& r_neigh : r_orig_neigh) {
497  if (!r_neigh.Is(VISITED)) {
498  std::vector<std::size_t> aux_ids = {it_node_orig_mp->Id(), r_neigh.Id()};
499  r_gradient_mp.CreateNewElement(mElementRegisterName, ++id, aux_ids, p_prop_0);
500  }
501  }
502 
503  // Flag the current node as visited to avoid creating the same edge twice
504  it_node_orig_mp->Set(VISITED, true);
505  }
506 
507  // Set the edges model part initialization flag to avoid creating it twice
509 
510  KRATOS_CATCH("")
511  }
512 
516 
520 
524 
526 private:
529 
533 
537 
541 
547  void CheckAndAssignSettings(const Parameters ThisParameters)
548  {
549  mSettings = ThisParameters;
550 
551  // Set the origin and gradient variables pointers
552  mpOriginVar = &KratosComponents<Variable<TDataType>>::Get(ThisParameters["origin_variable"].GetString());
553  mpGradientVar = &KratosComponents<Variable<GradientDataType>>::Get(ThisParameters["gradient_variable"].GetString());
554 
555  // Check user-defined origin model part
556  KRATOS_ERROR_IF(ThisParameters["model_part_name"].GetString() == "") << "Empty 'model_part_name'. This needs to be provided." << std::endl;
557  mpOriginModelPart = &(mrModel.GetModelPart(ThisParameters["model_part_name"].GetString()));
558 
559  // Set the gradient recovery element name
560  KRATOS_ERROR_IF_NOT(mpOriginModelPart->GetProcessInfo().Has(DOMAIN_SIZE)) << "No 'DOMAIN_SIZE' in origin model part ProcessInfo container." << std::endl;
561  const std::size_t domain_size = mpOriginModelPart->GetProcessInfo().GetValue(DOMAIN_SIZE);
562  mElementRegisterName = "EdgeBasedGradientRecoveryElement" + std::to_string(domain_size) + "D2N";
563 
564  // Check origin model part content
565  KRATOS_ERROR_IF(mpOriginModelPart->GetCommunicator().GlobalNumberOfNodes() == 0) << "The origin model part has no nodes." << std::endl;
566  if(domain_size == 2){
568  "In 2D the element type is expected to be a triangle. Quadrilateral elements require extra artificial edges (not implemented yet)." << std::endl;
569  } else if(domain_size == 3) {
571  "In 3D the element type is expected to be a tetrahedra. Hexahedral elements require extra artificial edges (not implemented yet)." << std::endl;
572  }
573 
574  // Check and set the gradient model part name
575  if (ThisParameters["gradient_recovery_model_part_name"].GetString() == "") {
576  mGradientModelPartName = mpOriginModelPart->Name() + "GradientRecoveryPart";
577  } else {
578  mGradientModelPartName = ThisParameters["gradient_recovery_model_part_name"].GetString();
579  }
580  }
581 
582  void InitializeGradientRecoveryStrategy(BuilderAndSolverPointerType pBuilderAndSolver)
583  {
584  // Generate an auxilary model part and populate it by elements of type DistanceCalculationElementSimplex
586 
587  // Create and initialize the linear strategy
588  bool calculate_norm_dx = false;
589  bool calculate_reactions = false;
590  bool reform_dof_at_each_iteration = false;
591  auto p_scheme = Kratos::make_shared<ResidualBasedIncrementalUpdateStaticScheme<TSparseSpace,TDenseSpace>>();
592  mpSolvingStrategy = Kratos::make_unique<ResidualBasedLinearStrategy<TSparseSpace,TDenseSpace,TLinearSolver>>(
594  p_scheme,
595  pBuilderAndSolver,
596  calculate_reactions,
597  reform_dof_at_each_iteration,
598  calculate_norm_dx);
599  mpSolvingStrategy->SetEchoLevel(mSettings["echo_level"].GetInt());
600  mpSolvingStrategy->Check();
601  mpSolvingStrategy->Initialize();
602  }
603 
604  void CalculateGradientComponent(
605  const OriginGetFunctionType& rOriginValueGetter,
606  const GradientSetFunctionType& rGradientValueSetter,
607  const std::size_t Component)
608  {
609  // Set the origin variable in the edge-based nodes
610  const std::size_t n_nodes = mpOriginModelPart->NumberOfNodes();
611  IndexPartition<std::size_t>(n_nodes).for_each([&](std::size_t i_node){
612  const auto it_orig_node = mpOriginModelPart->NodesBegin() + i_node;
613  auto it_grad_node = mpGradientRecoveryModelPart->NodesBegin() + i_node;
614  const double orig_val = rOriginValueGetter(*it_orig_node, *mpOriginVar, Component);
615  it_grad_node->SetValue(NODAL_MAUX, orig_val);
616  });
617 
618  // Solve the gradient recovery global problem
619  mpSolvingStrategy->InitializeSolutionStep();
620  mpSolvingStrategy->Predict();
621  mpSolvingStrategy->SolveSolutionStep();
622  mpSolvingStrategy->FinalizeSolutionStep();
623 
624  // Transfer the gradient solution to the origin mesh
625  IndexPartition<std::size_t>(n_nodes).for_each([&](std::size_t i_node){
626  auto it_orig_node = mpOriginModelPart->NodesBegin() + i_node;
627  const auto it_grad_node = mpGradientRecoveryModelPart->NodesBegin() + i_node;
628  const array_1d<double,3>& grad_val = it_grad_node->FastGetSolutionStepValue(NODAL_VAUX);
629  rGradientValueSetter(*it_orig_node, *mpGradientVar, grad_val, Component);
630  });
631  }
632 
636 
640 
644 
647 
649 }; // Class EdgeBasedGradientRecoveryProcess
650 
654 
658 
660 template <class TDataType, class TSparseSpace, class TDenseSpace, class TLinearSolver>
661 inline std::istream& operator>>(
662  std::istream& rIStream,
664 
666 template <class TDataType, class TSparseSpace, class TDenseSpace, class TLinearSolver>
667 inline std::ostream& operator<<(
668  std::ostream& rOStream,
670 {
671  rThis.PrintInfo(rOStream);
672  rOStream << std::endl;
673  rThis.PrintData(rOStream);
674 
675  return rOStream;
676 }
678 
679 } // namespace Kratos.
680 
681 #endif // KRATOS_EDGE_BASED_GRADIENT_RECOVERY_PROCESS_INCLUDED defined
Current class provides an implementation for the base builder and solving operations.
Definition: builder_and_solver.h:64
SizeType GlobalNumberOfNodes() const
Definition: communicator.cpp:101
bool Has(const Variable< TDataType > &rThisVariable) const
Checks if the data container has a value associated with a given variable.
Definition: data_value_container.h:382
void SetValue(const Variable< TDataType > &rThisVariable, TDataType const &rValue)
Sets the value for a given variable.
Definition: data_value_container.h:320
TDataType & GetValue(const Variable< TDataType > &rThisVariable)
Gets the value associated with a given variable.
Definition: data_value_container.h:268
Edge-based gradient recovery process This process implements the edge-based gradient recovery process...
Definition: edge_based_gradient_recovery_process.h:187
KRATOS_CLASS_POINTER_DEFINITION(EdgeBasedGradientRecoveryProcess)
Pointer definition of EdgeBasedGradientRecoveryProcess.
typename ModelPart::NodeType NodeType
Definition: edge_based_gradient_recovery_process.h:197
bool mModelPartIsInitialized
Definition: edge_based_gradient_recovery_process.h:417
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: edge_based_gradient_recovery_process.h:386
std::string mGradientModelPartName
Definition: edge_based_gradient_recovery_process.h:421
virtual void InitializeGradientRecoveryModelPart(ModelPart &rOriginModelPart)
Definition: edge_based_gradient_recovery_process.h:451
void ExecuteFinalize() override
This function is designed for being called at the end of the computations.
Definition: edge_based_gradient_recovery_process.h:334
const Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: edge_based_gradient_recovery_process.h:350
void Execute() override
Execute method is used to execute the Process algorithms.
Definition: edge_based_gradient_recovery_process.h:272
void ExecuteFinalizeSolutionStep() override
This function will be executed at every time step AFTER performing the solve phase.
Definition: edge_based_gradient_recovery_process.h:327
EdgeBasedGradientRecoveryProcess(EdgeBasedGradientRecoveryProcess const &rOther)=delete
Copy constructor.
const Variable< GradientDataType > * mpGradientVar
Definition: edge_based_gradient_recovery_process.h:415
static constexpr bool IsDataTypeScalar
Definition: edge_based_gradient_recovery_process.h:193
ModelPart * mpOriginModelPart
Definition: edge_based_gradient_recovery_process.h:409
~EdgeBasedGradientRecoveryProcess() override
Destructor.
Definition: edge_based_gradient_recovery_process.h:246
std::string Info() const override
Turn back information as a string.
Definition: edge_based_gradient_recovery_process.h:381
int Check() override
This function is designed for being called after ExecuteInitialize ONCE to verify that the input is c...
Definition: edge_based_gradient_recovery_process.h:260
Model & mrModel
Definition: edge_based_gradient_recovery_process.h:407
ModelPart * mpGradientRecoveryModelPart
Definition: edge_based_gradient_recovery_process.h:411
std::function< void(NodeType &rNode, const Variable< GradientDataType > &, const array_1d< double, 3 > &, const std::size_t)> GradientSetFunctionType
Definition: edge_based_gradient_recovery_process.h:208
EdgeBasedGradientRecoveryProcess(Model &rModel, Parameters ThisParameters)
Definition: edge_based_gradient_recovery_process.h:435
void ExecuteInitializeSolutionStep() override
This function will be executed at every time step BEFORE performing the solve phase.
Definition: edge_based_gradient_recovery_process.h:304
void Clear() override
This method clears the assignation of the conditions.
Definition: edge_based_gradient_recovery_process.h:339
const Variable< TDataType > * mpOriginVar
Definition: edge_based_gradient_recovery_process.h:413
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: edge_based_gradient_recovery_process.h:391
typename BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::Pointer BuilderAndSolverPointerType
Definition: edge_based_gradient_recovery_process.h:212
std::string mElementRegisterName
Definition: edge_based_gradient_recovery_process.h:423
Parameters mSettings
Definition: edge_based_gradient_recovery_process.h:425
SolvingStrategyType::UniquePointer mpSolvingStrategy
Definition: edge_based_gradient_recovery_process.h:419
std::function< double(const NodeType &, const Variable< TDataType > &, const std::size_t)> OriginGetFunctionType
Definition: edge_based_gradient_recovery_process.h:202
void ExecuteInitialize() override
This function is designed for being called at the beginning of the computations right after reading t...
Definition: edge_based_gradient_recovery_process.h:286
EdgeBasedGradientRecoveryProcess(Model &rModel, typename TLinearSolver::Pointer pLinearSolver, Parameters ThisParameters)
Construct a new Edge Based Gradient Recovery Process object Level set convection proces model constru...
Definition: edge_based_gradient_recovery_process.h:232
typename std::conditional< IsDataTypeScalar, array_1d< double, 3 >, Matrix >::type GradientDataType
Definition: edge_based_gradient_recovery_process.h:195
Short class definition.
Definition: find_global_nodal_neighbours_process.h:40
void Execute() override
Execute method is used to execute the Process algorithms.
Definition: find_global_nodal_neighbours_for_entities_process.cpp:76
Implicit solving strategy base class This is the base class from which we will derive all the implici...
Definition: implicit_solving_strategy.h:61
KratosComponents class encapsulates a lookup table for a family of classes in a generic way.
Definition: kratos_components.h:49
This class aims to manage different model parts across multi-physics simulations.
Definition: model.h:60
ModelPart & GetModelPart(const std::string &rFullModelPartName)
This method returns a model part given a certain name.
Definition: model.cpp:107
ModelPart & CreateModelPart(const std::string &ModelPartName, IndexType NewBufferSize=1)
This method creates a new model part contained in the current Model with a given name and buffer size...
Definition: model.cpp:37
void DeleteModelPart(const std::string &ModelPartName)
This method deletes a modelpart with a given name.
Definition: model.cpp:64
bool HasModelPart(const std::string &rFullModelPartName) const
This method checks if a certain a model part exists given a certain name.
Definition: model.cpp:178
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ElementIterator ElementsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1169
NodeType::Pointer CreateNewNode(int Id, double x, double y, double z, VariablesList::Pointer pNewVariablesList, IndexType ThisIndex=0)
Definition: model_part.cpp:270
Communicator & GetCommunicator()
Definition: model_part.h:1821
std::string & Name()
Definition: model_part.h:1811
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
void AddNodalSolutionStepVariable(VariableData const &ThisVariable)
Definition: model_part.h:532
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
Node NodeType
Definition: model_part.h:117
void Clear()
Definition: model_part.cpp:66
SizeType NumberOfNodes(IndexType ThisIndex=0) const
Definition: model_part.h:341
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
This class defines the node.
Definition: node.h:65
TVariableType::Type & FastGetSolutionStepValue(const TVariableType &rThisVariable)
Definition: node.h:435
TVariableType::Type & GetValue(const TVariableType &rThisVariable)
Definition: node.h:466
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
void ValidateAndAssignDefaults(const Parameters &rDefaultParameters)
This function is designed to verify that the parameters under testing match the form prescribed by th...
Definition: kratos_parameters.cpp:1306
std::string GetString() const
This method returns the string contained in the current Parameter.
Definition: kratos_parameters.cpp:684
The base class for all processes in Kratos.
Definition: process.h:49
Variable class contains all information needed to store and retrive data from a data container.
Definition: variable.h:63
This class implements a set of auxiliar, already parallelized, methods to perform some common tasks r...
Definition: variable_utils.h:63
int CheckVariableExists(const TVarType &rVariable, const NodesContainerType &rNodes)
Checks if all the nodes of a node set has the specified variable.
Definition: variable_utils.h:1051
void SetNonHistoricalVariableToZero(const Variable< TType > &rVariable, TContainerType &rContainer)
Sets the nodal value of any variable to zero.
Definition: variable_utils.h:724
void AddDof(const TVarType &rVar, ModelPart &rModelPart)
This function add dofs to the nodes in a model part. It is useful since addition is done in parallel.
Definition: variable_utils.h:1361
void SetFlag(const Flags &rFlag, const bool FlagValue, TContainerType &rContainer)
Sets a flag according to a given status over a given container.
Definition: variable_utils.h:900
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
static constexpr bool IsDataTypeScalar
Definition: edge_based_gradient_recovery_process.h:62
#define KRATOS_ERROR_IF_NOT(conditional)
Definition: exception.h:163
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
Internals::Matrix< double, AMatrix::dynamic, AMatrix::dynamic > Matrix
Definition: amatrix_interface.h:470
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
TABLE_NUMBER_ANGULAR_VELOCITY TABLE_NUMBER_MOMENT I33 BEAM_INERTIA_ROT_UNIT_LENGHT_Y KRATOS_DEFINE_APPLICATION_VARIABLE(DEM_APPLICATION, double, BEAM_INERTIA_ROT_UNIT_LENGHT_Z) typedef std double
Definition: DEM_application_variables.h:182
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
int domain_size
Definition: face_heat.py:4
type
Definition: generate_gid_list_file.py:35
int n_nodes
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:15
int d
Definition: ode_solve.py:397
integer i
Definition: TensorModule.f:17