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.
calculate_embedded_nodal_variable_from_skin_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 
14 #if !defined(KRATOS_CALCULATE_EMBEDDED_VARIABLE_FROM_SKIN_PROCESS_INCLUDED )
15 #define KRATOS_CALCULATE_EMBEDDED_VARIABLE_FROM_SKIN_PROCESS_INCLUDED
16 
17 // System includes
18 
19 
20 // External includes
21 
22 
23 // Project includes
24 #include "containers/model.h"
25 #include "includes/define.h"
26 #include "includes/key_hash.h"
27 #include "includes/kratos_flags.h"
30 #include "processes/process.h"
37 
38 namespace Kratos
39 {
40 
43 
44 
48 
49 
53 
54 
58 
59 
63 
64 template< class TVarType >
66 {
67 public:
68 
71 
72 
75 
78 
82 
83 
87 
88 
92 
101  static inline const Variable<TVarType> &GetUnknownVariable();
102 
108  static inline void AddUnknownVariable(ModelPart &rModelPart);
109 
115  static inline void AddUnknownVariableDofs(ModelPart &rModelPart);
116 
118 };
119 
120 template <>
122 {
123  return KratosComponents<Variable<double>>::Get("NODAL_MAUX");
124 }
125 
126 template <>
128 {
129  return KratosComponents<Variable<array_1d<double, 3>>>::Get("NODAL_VAUX");
130 }
131 
132 template <>
134 {
135  rModelPart.AddNodalSolutionStepVariable(NODAL_MAUX);
136 }
137 
138 template <>
140 {
141  rModelPart.AddNodalSolutionStepVariable(NODAL_VAUX);
142 }
143 
144 template <>
146 {
147  VariableUtils().AddDof(NODAL_MAUX, rModelPart);
148 }
149 
150 template <>
151 inline void EmbeddedNodalVariableFromSkinTypeHelperClass<array_1d<double, 3>>::AddUnknownVariableDofs(ModelPart &rModelPart)
152 {
153  VariableUtils().AddDof(NODAL_VAUX_X, rModelPart);
154  VariableUtils().AddDof(NODAL_VAUX_Y, rModelPart);
155  VariableUtils().AddDof(NODAL_VAUX_Z, rModelPart);
156 }
157 
158 template <class TVarType, class TSparseSpace, class TDenseSpace, class TLinearSolver>
160 {
161 public:
162 
165 
166  typedef typename TLinearSolver::Pointer LinearSolverPointerType;
170  typedef typename FindIntersectedGeometricalObjectsProcess::UniquePointer FindIntersectedGeometricalObjectsProcessPointerType;
171 
172  typedef std::unordered_set<std::pair<std::size_t, std::size_t>, PairHasher<std::size_t, std::size_t>, PairComparor<std::size_t, std::size_t>> EdgesSetType;
173 
176 
179 
183 
191  Model &rModel,
192  Parameters rSettings)
194  rModel.GetModelPart(rSettings["base_model_part_name"].GetString()),
195  rModel.GetModelPart(rSettings["skin_model_part_name"].GetString()),
197  {
198  }
199 
213  ModelPart &rBaseModelPart,
214  ModelPart &rSkinModelPart,
215  Parameters LinearSolverSettings,
216  const Variable<TVarType> &rSkinVariable,
217  const Variable<TVarType> &rEmbeddedNodalVariable,
218  const double GradientPenaltyCoefficient = 0.0,
219  const unsigned int BufferPosition = 0,
220  const std::string& AuxPartName = "IntersectedElementsModelPart",
221  const std::size_t EchoLevel = 0)
222  : Process()
223  , mEchoLevel(EchoLevel)
224  , mBufferPosition(BufferPosition),
225  mAuxModelPartName(AuxPartName),
226  mGradientPenaltyCoefficient(GradientPenaltyCoefficient),
227  mrBaseModelPart(rBaseModelPart),
228  mrSkinModelPart(rSkinModelPart),
229  mrSkinVariable(rSkinVariable),
230  mrEmbeddedNodalVariable(rEmbeddedNodalVariable)
231  {
232  KRATOS_TRY
233 
234  // Check the process settings
235  KRATOS_ERROR_IF(!(mBufferPosition < rBaseModelPart.GetBufferSize())) <<
236  "Asked for buffer position " << mBufferPosition << " buf base model part buffer size is " << rBaseModelPart.GetBufferSize() << std::endl;
237  KRATOS_ERROR_IF(!(mBufferPosition < rSkinModelPart.GetBufferSize())) <<
238  "Asked for buffer position " << mBufferPosition << " buf skin model part buffer size is " << rSkinModelPart.GetBufferSize() << std::endl;
239 
240  // Check that there is at least one element and node in the model
241  int n_loc_mesh_nodes = mrBaseModelPart.GetCommunicator().pLocalMesh()->NumberOfNodes();
242  int n_loc_mesh_elements = mrBaseModelPart.GetCommunicator().pLocalMesh()->NumberOfElements();
243  KRATOS_ERROR_IF(mrBaseModelPart.GetCommunicator().GetDataCommunicator().SumAll(n_loc_mesh_nodes) == 0) << "The base model part has no nodes." << std::endl;
244  KRATOS_ERROR_IF(mrBaseModelPart.GetCommunicator().GetDataCommunicator().SumAll(n_loc_mesh_elements) == 0) << "The base model Part has no elements." << std::endl;
245 
246  // Check that the base model part is conformed by simplex elements
247  const auto &r_aux_geom = (mrBaseModelPart.ElementsBegin())->GetGeometry();
248  const unsigned int dim = r_aux_geom.WorkingSpaceDimension();
249  if(dim == 2){
250  KRATOS_ERROR_IF(r_aux_geom.GetGeometryFamily() != GeometryData::KratosGeometryFamily::Kratos_Triangle) <<
251  "In 2D the element type is expected to be a triangle." << std::endl;
252  } else if(dim == 3) {
253  KRATOS_ERROR_IF(r_aux_geom.GetGeometryFamily() != GeometryData::KratosGeometryFamily::Kratos_Tetrahedra) <<
254  "In 3D the element type is expected to be a tetrahedron" << std::endl;
255  } else {
256  KRATOS_ERROR << "Wrong geometry WorkingSpaceDimension(). Expected 2 or 3 and obtained: " << dim;
257  }
258 
259  // Construct the linear solver pointer
261  mpLinearSolver = linear_solver_factory.Create(LinearSolverSettings);
262 
263  KRATOS_CATCH("")
264  }
265 
268  {
269  Model& current_model = mrBaseModelPart.GetModel();
270  if(current_model.HasModelPart(mAuxModelPartName)) {
271  current_model.DeleteModelPart(mAuxModelPartName);
272  }
273  };
274 
278 
279  void operator()()
280  {
281  Execute();
282  }
283 
287 
289  {
290  Model &current_model = mrBaseModelPart.GetModel();
291  return current_model.GetModelPart(mAuxModelPartName);
292  }
293 
294  void Execute() override
295  {
296  KRATOS_TRY;
297  // Generate an auxilary model part and populate it by elements of type DistanceCalculationElementSimplex
298  this->GenerateIntersectedEdgesElementsModelPart();
299 
300  // Set the linear strategy to solve the regression problem
301  this->SetLinearStrategy();
302 
303  // Solve the regression problem
304  mpSolvingStrategy->Solve();
305 
306  // Copy the obtained values from the unknown variable to the user-defined variable
307  this->SetObtainedEmbeddedNodalValues();
308 
309  KRATOS_CATCH("")
310  }
311 
312  void Clear() override
313  {
314  Model& current_model = mrBaseModelPart.GetModel();
315  ModelPart& r_intersected_edges_model_part = current_model.GetModelPart( mAuxModelPartName );
316  r_intersected_edges_model_part.Nodes().clear();
317  r_intersected_edges_model_part.Elements().clear();
318  r_intersected_edges_model_part.Conditions().clear();
319 
320  mpSolvingStrategy->Clear();
321  }
322 
331  {
332  Parameters default_settings(R"(
333  {
334  "echo_level" : 0,
335  "base_model_part_name": "",
336  "skin_model_part_name": "",
337  "skin_variable_name": "",
338  "embedded_nodal_variable_name": "",
339  "buffer_position": 0,
340  "gradient_penalty_coefficient": 0.0,
341  "aux_model_part_name": "IntersectedElementsModelPart",
342  "linear_solver_settings": {
343  "preconditioner_type": "amg",
344  "solver_type": "amgcl",
345  "smoother_type": "ilu0",
346  "krylov_type": "cg",
347  "max_iteration": 1000,
348  "verbosity": 0,
349  "tolerance": 1e-8,
350  "scaling": false,
351  "block_size": 1,
352  "use_block_matrices_if_possible": true
353  }
354  }
355  )");
356 
357  return default_settings;
358  }
359 
363  const Parameters GetDefaultParameters() const override
364  {
365  return StaticGetDefaultParameters();
366  }
367 
371 
375 
379 
381  std::string Info() const override
382  {
383  return "CalculateEmbeddedNodalVariableFromSkinProcess";
384  }
385 
387  void PrintInfo(std::ostream& rOStream) const override
388  {
389  rOStream << "CalculateEmbeddedNodalVariableFromSkinProcess";
390  }
391 
393  void PrintData(std::ostream& rOStream) const override
394  {
395  }
396 
400 
402 protected:
405 
406 
410 
411  const std::size_t mEchoLevel;
412  const unsigned int mBufferPosition;
413  const std::string mAuxModelPartName;
415 
418 
421 
422  LinearSolverPointerType mpLinearSolver = nullptr;
423  SolvingStrategyPointerType mpSolvingStrategy = nullptr;
424 
426 
430 
431 
435 
437  {
438  KRATOS_TRY
439 
440  // Compute element intersections
441  this->CalculateIntersections();
442 
443  Model& current_model = mrBaseModelPart.GetModel();
444  if(current_model.HasModelPart(mAuxModelPartName)) {
445  current_model.DeleteModelPart(mAuxModelPartName);
446  }
447 
448  // Generate the auxiliary model part
449  ModelPart& r_int_elems_model_part = current_model.CreateModelPart(mAuxModelPartName);
450 
451  r_int_elems_model_part.Nodes().clear();
452  r_int_elems_model_part.Elements().clear();
453  r_int_elems_model_part.Conditions().clear();
454 
455  r_int_elems_model_part.SetBufferSize(1);
456  r_int_elems_model_part.CreateNewProperties(0, 0);
457 
458  // Set the gradient penalty coefficient in the auxiliary model part process info
459  r_int_elems_model_part.GetProcessInfo()[GRADIENT_PENALTY_COEFFICIENT] = mGradientPenaltyCoefficient;
460 
461  // Add the minimization problem auxiliary variables
462  this->AddIntersectedElementsVariables(r_int_elems_model_part);
463 
464  // Add intersected elements
465  this->AddIntersectedElementsModelPartElements(r_int_elems_model_part);
466 
467  // Add DOFs to intersected elements model part
468  this->AddIntersectedElementsModelPartDOFs(r_int_elems_model_part);
469 
470  KRATOS_CATCH("")
471  }
472 
474  {
476  const auto &r_int_elems_model_part = (mrBaseModelPart.GetModel()).GetModelPart(mAuxModelPartName);
477 
478  block_for_each(r_int_elems_model_part.Nodes(), [&](Node& rNode){
479  auto &r_emb_nod_val = (mrBaseModelPart.GetNode(rNode.Id())).FastGetSolutionStepValue(mrEmbeddedNodalVariable, mBufferPosition);
480  r_emb_nod_val = rNode.FastGetSolutionStepValue(rUnknownVariable);
481  });
482  }
483 
484  inline void AddIntersectedElementsVariables(ModelPart &rModelPart) const
485  {
487  }
488 
490  {
492  }
493 
495  {
496  // Initialize the VISITED flag in the origin model part
497  // It will be used to mark the nodes already added to the intersected elements model part
498  VariableUtils().SetFlag(VISITED, false, mrBaseModelPart.Nodes());
499 
500  // Initialize the INTERFACE flag in the origin model part
501  // It will be used to mark the elements that have any intersection with the skin model part
502  VariableUtils().SetFlag(INTERFACE, false, mrBaseModelPart.Elements());
503 
504  // Create element edges map
505  EdgesSetType edges_set;
506 
507  // Get the base model part intersections
508  auto &r_int_obj_vect = mpFindIntersectedGeometricalObjectsProcess->GetIntersections();
509 
510  // Get the unknown variable from Kratos components
512 
513  // Temporary container of nodes
514  // This is intentionally done to add the nodes at once and avoid the sort at each CreateNewNode call
515  std::unordered_map<unsigned int, Node::Pointer> map_of_nodes;
516 
517  // Loop the base model part elements
518  std::size_t new_elem_id = 1;
519  for (unsigned int i_elem = 0; i_elem < mrBaseModelPart.NumberOfElements(); ++i_elem) {
520  auto it_elem = mrBaseModelPart.ElementsBegin() + i_elem;
521  // Check if the current element has intersections
522  if (r_int_obj_vect[i_elem].size() != 0) {
523  // Initialize the element values
524  auto &r_geom = it_elem->GetGeometry();
525  const auto edges = r_geom.GenerateEdges();
526 
527  // Loop the edges
528  for (unsigned int i_edge = 0; i_edge < r_geom.EdgesNumber(); ++i_edge) {
529  // Check if the current edge is already stored
530  auto &r_i_edge_geom = edges[i_edge];
531  auto i_edge_pair = this->SetEdgePair(r_i_edge_geom);
532 
533  if (edges_set.find(i_edge_pair) == edges_set.end()) {
534  // Initialize edge values
535  double i_edge_d = 0.0; // Average normalized distance from lower id. node
536  unsigned int n_int_obj = 0; // Number edge of intersecting entities
537  TVarType i_edge_val = mrEmbeddedNodalVariable.Zero(); // Average edge variable value
538 
539  // Check the edge intersection against all the candidates
540  for (auto &r_int_obj : r_int_obj_vect[i_elem]) {
541  Point intersection_point;
542  const bool is_intersected = this->ComputeEdgeIntersection(
543  r_int_obj.GetGeometry(),
544  r_i_edge_geom[0],
545  r_i_edge_geom[1],
546  intersection_point);
547 
548  // Compute the variable value in the intersection point
549  if (is_intersected) {
550  n_int_obj++;
551  Vector int_obj_N;
552  array_1d<double,3> local_coords;
553  r_int_obj.GetGeometry().PointLocalCoordinates(local_coords, intersection_point);
554  r_int_obj.GetGeometry().ShapeFunctionsValues(int_obj_N, local_coords);
555  for (unsigned int i_node = 0; i_node < r_int_obj.GetGeometry().PointsNumber(); ++i_node) {
556  i_edge_val += r_int_obj.GetGeometry()[i_node].FastGetSolutionStepValue(mrSkinVariable, mBufferPosition) * int_obj_N[i_node];
557  }
558  i_edge_d += intersection_point.Distance(r_i_edge_geom[0]) / r_i_edge_geom.Length();
559  }
560  }
561 
562  // Check if the edge is intersected
563  if (n_int_obj != 0) {
564  // Flag the edge parent element if the edge is intersected by any entity
565  it_elem->Set(INTERFACE, true);
566 
567  // Add the average edge value (there might exist cases in where
568  // more than one geometry intersects the edge of interest).
569  i_edge_d /= n_int_obj;
570  i_edge_val /= n_int_obj;
571 
572  // If not added yet, add the edge nodes
573  this->AddEdgeNodes(r_i_edge_geom, rModelPart, map_of_nodes);
574 
575  // Create a new element with the intersected edge geometry and fake properties
576  auto p_element = Kratos::make_intrusive<EmbeddedNodalVariableCalculationElementSimplex<TVarType>>(
577  new_elem_id,
578  this->pSetEdgeElementGeometry(map_of_nodes, r_i_edge_geom, i_edge_pair),
579  rModelPart.pGetProperties(0));
580 
581  // Save the edge values in the new element
582  p_element->SetValue(DISTANCE, i_edge_d);
583  p_element->SetValue(rUnknownVariable, i_edge_val);
584 
585  // Update the id. counter
586  new_elem_id++;
587 
588  // Add the new edge element to the hash map
589  edges_set.insert(i_edge_pair);
590 
591  // Add the new edge element to the intersected elements model part
592  rModelPart.Elements().push_back(p_element);
593  }
594  }
595  }
596  }
597  }
598 
599 
600  // Populate the modelpart with all the nodes in NodesMap
601  // Note that a temporary vector is created from the set to add all nodes at once
603  tmp.reserve(rModelPart.NumberOfElements()*2);
604  for(auto& item: map_of_nodes){
605  tmp.push_back(item.second);
606  }
607  rModelPart.AddNodes(tmp.begin(), tmp.end());
608  }
609 
611  {
612  // Create the linear strategy
613  SchemePointerType p_scheme = Kratos::make_shared<ResidualBasedIncrementalUpdateStaticScheme<TSparseSpace, TDenseSpace>>();
614 
615  bool calculate_norm_dx = false;
616  bool calculate_reactions = false;
617  bool reform_dof_at_each_iteration = false;
618  BuilderSolverPointerType p_builder_and_solver = Kratos::make_shared<ResidualBasedBlockBuilderAndSolver<TSparseSpace, TDenseSpace, TLinearSolver>>(mpLinearSolver);
619 
620  Model &current_model = mrBaseModelPart.GetModel();
621  ModelPart &r_aux_model_part = current_model.GetModelPart(mAuxModelPartName);
622 
623  mpSolvingStrategy = Kratos::make_unique<ResidualBasedLinearStrategy<TSparseSpace, TDenseSpace, TLinearSolver>>(
624  r_aux_model_part,
625  p_scheme,
626  p_builder_and_solver,
627  calculate_reactions,
628  reform_dof_at_each_iteration,
629  calculate_norm_dx);
630 
631  mpSolvingStrategy->Check();
632  mpSolvingStrategy->SetEchoLevel(mEchoLevel);
633  }
634 
638 
639 
643 
644 
648 
662  ModelPart &rBaseModelPart,
663  ModelPart &rSkinModelPart,
664  Parameters rSettings)
666  rBaseModelPart,
667  rSkinModelPart,
668  rSettings["linear_solver_settings"],
669  KratosComponents<Variable<TVarType>>::Get(rSettings["skin_variable_name"].GetString()),
670  KratosComponents<Variable<TVarType>>::Get(rSettings["embedded_nodal_variable_name"].GetString()),
671  rSettings["gradient_penalty_coefficient"].GetDouble(),
672  rSettings["buffer_position"].GetInt(),
673  rSettings["aux_model_part_name"].GetString(),
674  rSettings["echo_level"].GetInt())
675  {
676  }
677 
679 private:
682 
683 
687 
688 
692 
693 
697 
698  void CalculateIntersections()
699  {
700  mpFindIntersectedGeometricalObjectsProcess = Kratos::make_unique<FindIntersectedGeometricalObjectsProcess>(mrBaseModelPart, mrSkinModelPart);
701  mpFindIntersectedGeometricalObjectsProcess->ExecuteInitialize();
702  mpFindIntersectedGeometricalObjectsProcess->FindIntersections();
703  }
704 
705  void ClearIntersections()
706  {
707  mpFindIntersectedGeometricalObjectsProcess->Clear();
708  }
709 
710  bool ComputeEdgeIntersection(
711  const Element::GeometryType& rIntObjGeometry,
712  const Element::NodeType& rEdgePoint1,
713  const Element::NodeType& rEdgePoint2,
714  Point& rIntersectionPoint) const
715  {
716  bool intersection_flag = false;
717  const unsigned int work_dim = rIntObjGeometry.WorkingSpaceDimension();
718  if (work_dim == 2){
719  const unsigned int intersection_status = IntersectionUtilities::ComputeLineLineIntersection<Element::GeometryType>(
720  rIntObjGeometry, rEdgePoint1.Coordinates(), rEdgePoint2.Coordinates(), rIntersectionPoint.Coordinates());
721  if (intersection_status == 1 || intersection_status == 3) {
722  intersection_flag = true;
723  }
724  } else if (work_dim == 3){
725  const unsigned int intersection_status = IntersectionUtilities::ComputeTriangleLineIntersection<Element::GeometryType>(
726  rIntObjGeometry, rEdgePoint1.Coordinates(), rEdgePoint2.Coordinates(), rIntersectionPoint.Coordinates());
727  if (intersection_status == 1) {
728  intersection_flag = true;
729  }
730  } else {
731  KRATOS_ERROR << "Working space dimension value equal to " << work_dim << ". Check your skin geometry implementation." << std::endl;
732  }
733 
734  return intersection_flag;
735  }
736 
737  void AddEdgeNodes(
738  const Geometry<Node> &rEdgeGeometry,
739  ModelPart &rModelPart,
740  std::unordered_map<unsigned int, Node::Pointer>& rNodesMap
741  ) const
742  {
743  const auto& rp_var_list = rModelPart.pGetNodalSolutionStepVariablesList();
744  unsigned int buffer_size = rModelPart.GetBufferSize();
745 
746  // Loop the edge nodes
747  for (std::size_t i = 0; i < 2; ++i) {
748  auto p_i_node = rEdgeGeometry(i);
749  // Check if the node has been already added
750  if (!p_i_node->Is(VISITED)) {
751  p_i_node->Set(VISITED, true);
752  auto p_node_copy = Kratos::make_intrusive< Node >(
753  p_i_node->Id(),
754  p_i_node->Coordinates());
755  p_node_copy->SetSolutionStepVariablesList(rp_var_list);
756  p_node_copy->SetBufferSize(buffer_size);
757 
758  rNodesMap[p_i_node->Id()] = p_node_copy;
759  }
760  }
761  }
762 
763  Element::GeometryType::Pointer pSetEdgeElementGeometry(
764  std::unordered_map<unsigned int, Node::Pointer>& rNodesMap,
765  const Element::GeometryType &rCurrentEdgeGeometry,
766  const std::pair<std::size_t, std::size_t> NewEdgeIds) const
767  {
769  points_array.push_back(rNodesMap[std::get<0>(NewEdgeIds)]);
770  points_array.push_back(rNodesMap[std::get<1>(NewEdgeIds)]);
771  return rCurrentEdgeGeometry.Create(points_array);
772  }
773 
774  inline std::pair<std::size_t, std::size_t> SetEdgePair(const Geometry<Node> &rEdgeGeom) const
775  {
776  std::pair<std::size_t, std::size_t> edge_pair(
777  (rEdgeGeom[0].Id() < rEdgeGeom[1].Id()) ? rEdgeGeom[0].Id() : rEdgeGeom[1].Id(),
778  (rEdgeGeom[0].Id() > rEdgeGeom[1].Id()) ? rEdgeGeom[0].Id() : rEdgeGeom[1].Id());
779  return edge_pair;
780  }
781 
785 
786 
790 
791 
795 
797  CalculateEmbeddedNodalVariableFromSkinProcess& operator=(CalculateEmbeddedNodalVariableFromSkinProcess const& rOther) = delete;
798 
800  CalculateEmbeddedNodalVariableFromSkinProcess(CalculateEmbeddedNodalVariableFromSkinProcess const& rOther) = delete;
801 
803 }; // Class CalculateEmbeddedNodalVariableFromSkinProcess
804 
806 
809 
810 
814 
816 template< class TVarType, class TSparseSpace, class TDenseSpace, class TLinearSolver>
817 inline std::istream& operator >> (
818  std::istream& rIStream,
820 
822 template< class TVarType, class TSparseSpace, class TDenseSpace, class TLinearSolver>
823 inline std::ostream& operator << (
824  std::ostream& rOStream,
826 {
827  rThis.PrintInfo(rOStream);
828  rOStream << std::endl;
829  rThis.PrintData(rOStream);
830  return rOStream;
831 }
832 
834 
835 } // namespace Kratos.
836 
837 #endif // KRATOS_CALCULATE_EMBEDDED_VARIABLE_FROM_SKIN_PROCESS_INCLUDED defined
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Current class provides an implementation for the base builder and solving operations.
Definition: builder_and_solver.h:64
Definition: calculate_embedded_nodal_variable_from_skin_process.h:160
const std::string mAuxModelPartName
Definition: calculate_embedded_nodal_variable_from_skin_process.h:413
const std::size_t mEchoLevel
Definition: calculate_embedded_nodal_variable_from_skin_process.h:411
KRATOS_CLASS_POINTER_DEFINITION(CalculateEmbeddedNodalVariableFromSkinProcess)
Pointer definition of CalculateEmbeddedNodalVariableFromSkinProcess.
static Parameters StaticGetDefaultParameters()
Get the Default Settings object This method returns the default parameters for this proces....
Definition: calculate_embedded_nodal_variable_from_skin_process.h:330
CalculateEmbeddedNodalVariableFromSkinProcess(Model &rModel, Parameters rSettings)
Construct a new Calculate Embedded Nodal Variable From Skin Process object Constructor with model and...
Definition: calculate_embedded_nodal_variable_from_skin_process.h:190
void Clear() override
This method clears the assignation of the conditions.
Definition: calculate_embedded_nodal_variable_from_skin_process.h:312
ModelPart & mrSkinModelPart
Definition: calculate_embedded_nodal_variable_from_skin_process.h:417
void AddIntersectedElementsVariables(ModelPart &rModelPart) const
Definition: calculate_embedded_nodal_variable_from_skin_process.h:484
void operator()()
Definition: calculate_embedded_nodal_variable_from_skin_process.h:279
Scheme< TSparseSpace, TDenseSpace >::Pointer SchemePointerType
Definition: calculate_embedded_nodal_variable_from_skin_process.h:167
FindIntersectedGeometricalObjectsProcess::UniquePointer FindIntersectedGeometricalObjectsProcessPointerType
Definition: calculate_embedded_nodal_variable_from_skin_process.h:170
ImplicitSolvingStrategy< TSparseSpace, TDenseSpace, TLinearSolver >::UniquePointer SolvingStrategyPointerType
Definition: calculate_embedded_nodal_variable_from_skin_process.h:169
TLinearSolver::Pointer LinearSolverPointerType
Definition: calculate_embedded_nodal_variable_from_skin_process.h:166
const Variable< TVarType > & mrSkinVariable
Definition: calculate_embedded_nodal_variable_from_skin_process.h:419
std::string Info() const override
Turn back information as a string.
Definition: calculate_embedded_nodal_variable_from_skin_process.h:381
void AddIntersectedElementsModelPartDOFs(ModelPart &rModelPart) const
Definition: calculate_embedded_nodal_variable_from_skin_process.h:489
ModelPart & GetIntersectedEdgesModelPart() const
Definition: calculate_embedded_nodal_variable_from_skin_process.h:288
const Variable< TVarType > & mrEmbeddedNodalVariable
Definition: calculate_embedded_nodal_variable_from_skin_process.h:420
std::unordered_set< std::pair< std::size_t, std::size_t >, PairHasher< std::size_t, std::size_t >, PairComparor< std::size_t, std::size_t > > EdgesSetType
Definition: calculate_embedded_nodal_variable_from_skin_process.h:172
void AddIntersectedElementsModelPartElements(ModelPart &rModelPart) const
Definition: calculate_embedded_nodal_variable_from_skin_process.h:494
void SetObtainedEmbeddedNodalValues() const
Definition: calculate_embedded_nodal_variable_from_skin_process.h:473
FindIntersectedGeometricalObjectsProcessPointerType mpFindIntersectedGeometricalObjectsProcess
Definition: calculate_embedded_nodal_variable_from_skin_process.h:425
const double mGradientPenaltyCoefficient
Definition: calculate_embedded_nodal_variable_from_skin_process.h:414
const unsigned int mBufferPosition
Definition: calculate_embedded_nodal_variable_from_skin_process.h:412
CalculateEmbeddedNodalVariableFromSkinProcess(ModelPart &rBaseModelPart, ModelPart &rSkinModelPart, Parameters rSettings)
Construct a new Calculate Embedded Nodal Variable From Skin Process object Constructor with backgroun...
Definition: calculate_embedded_nodal_variable_from_skin_process.h:661
CalculateEmbeddedNodalVariableFromSkinProcess(ModelPart &rBaseModelPart, ModelPart &rSkinModelPart, Parameters LinearSolverSettings, const Variable< TVarType > &rSkinVariable, const Variable< TVarType > &rEmbeddedNodalVariable, const double GradientPenaltyCoefficient=0.0, const unsigned int BufferPosition=0, const std::string &AuxPartName="IntersectedElementsModelPart", const std::size_t EchoLevel=0)
Construct a new Calculate Embedded Nodal Variable From Skin Process object.
Definition: calculate_embedded_nodal_variable_from_skin_process.h:212
const Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: calculate_embedded_nodal_variable_from_skin_process.h:363
BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::Pointer BuilderSolverPointerType
Definition: calculate_embedded_nodal_variable_from_skin_process.h:168
~CalculateEmbeddedNodalVariableFromSkinProcess() override
Destructor.
Definition: calculate_embedded_nodal_variable_from_skin_process.h:267
void SetLinearStrategy()
Definition: calculate_embedded_nodal_variable_from_skin_process.h:610
void Execute() override
Execute method is used to execute the Process algorithms.
Definition: calculate_embedded_nodal_variable_from_skin_process.h:294
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: calculate_embedded_nodal_variable_from_skin_process.h:393
virtual void GenerateIntersectedEdgesElementsModelPart()
Definition: calculate_embedded_nodal_variable_from_skin_process.h:436
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: calculate_embedded_nodal_variable_from_skin_process.h:387
ModelPart & mrBaseModelPart
Definition: calculate_embedded_nodal_variable_from_skin_process.h:416
Node NodeType
definition of node type (default is: Node)
Definition: element.h:74
Geometry< NodeType > GeometryType
definition of the geometry type with given NodeType
Definition: element.h:83
Definition: calculate_embedded_nodal_variable_from_skin_process.h:66
static const Variable< TVarType > & GetUnknownVariable()
Get the Unknown Variable object This method returns a reference to the unknown variable....
static void AddUnknownVariableDofs(ModelPart &rModelPart)
Add the unknown variable DOFs to a model part This method adds the unknown variable DOFs to the model...
KRATOS_CLASS_POINTER_DEFINITION(EmbeddedNodalVariableFromSkinTypeHelperClass)
Pointer definition of EmbeddedNodalVariableFromSkinTypeHelperClass.
static void AddUnknownVariable(ModelPart &rModelPart)
Add the unknown variable to a model part This method adds the unknown variable to the model part of i...
PointerVector< TPointType > PointsArrayType
Definition: geometry.h:118
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
Here we add the functions needed for the registration of linear solvers.
Definition: linear_solver_factory.h:62
virtual LinearSolver< TSparseSpace, TLocalSpace >::Pointer Create(Kratos::Parameters Settings) const
This method creates a new solver.
Definition: linear_solver_factory.h:100
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
PropertiesType::Pointer pGetProperties(IndexType PropertiesId, IndexType MeshIndex=0)
Returns the Properties::Pointer corresponding to it's identifier.
Definition: model_part.cpp:664
void SetBufferSize(IndexType NewBufferSize)
This method sets the suffer size of the model part database.
Definition: model_part.cpp:2171
virtual int Check() const
run input validation
Definition: model_part.cpp:2204
IndexType GetBufferSize() const
This method gets the suffer size of the model part database.
Definition: model_part.h:1876
ConditionsContainerType & Conditions(IndexType ThisIndex=0)
Definition: model_part.h:1381
PropertiesType::Pointer CreateNewProperties(IndexType PropertiesId, IndexType MeshIndex=0)
Creates a new property in the current mesh.
Definition: model_part.cpp:640
void AddNodalSolutionStepVariable(VariableData const &ThisVariable)
Definition: model_part.h:532
SizeType NumberOfElements(IndexType ThisIndex=0) const
Definition: model_part.h:1027
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
void AddNodes(std::vector< IndexType > const &NodeIds, IndexType ThisIndex=0)
Definition: model_part.cpp:235
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
Model & GetModel()
Definition: model_part.h:323
This class defines the node.
Definition: node.h:65
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
Point class.
Definition: point.h:59
double Distance(const Point &rOtherPoint) const
This method computes the distance between this point and another one.
Definition: point.h:166
void push_back(const TPointerType &x)
Definition: pointer_vector.h:270
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
The base class for all processes in Kratos.
Definition: process.h:49
This class provides the implementation of the basic tasks that are needed by the solution strategy.
Definition: scheme.h:56
const TDataType & Zero() const
This method returns the zero value of the variable type.
Definition: variable.h:346
This class implements a set of auxiliar, already parallelized, methods to perform some common tasks r...
Definition: variable_utils.h:63
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
std::ostream & operator<<(std::ostream &rOStream, const CalculateEmbeddedNodalVariableFromSkinProcess< TVarType, TSparseSpace, TDenseSpace, TLinearSolver > &rThis)
output stream function
Definition: calculate_embedded_nodal_variable_from_skin_process.h:823
std::istream & operator>>(std::istream &rIStream, CalculateEmbeddedNodalVariableFromSkinProcess< TVarType, TSparseSpace, TDenseSpace, TLinearSolver > &rThis)
input stream function
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
static int EchoLevel
Definition: co_sim_EMPIRE_API.h:42
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
void block_for_each(TIterator itBegin, TIterator itEnd, TFunction &&rFunction)
Execute a functor on all items of a range in parallel.
Definition: parallel_utilities.h:299
tuple tmp
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:98
x
Definition: sensitivityMatrix.py:49
int dim
Definition: sensitivityMatrix.py:25
def ValidateAndAssignDefaults(defaults, settings, recursive=False)
Definition: sdof_solver.py:252
integer i
Definition: TensorModule.f:17
This is a key comparer between two indexes pairs.
Definition: key_hash.h:432
This is a hasher for pairs.
Definition: key_hash.h:412