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.
variational_distance_calculation_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: Riccardo Rossi
11 // Ruben Zorrilla
12 //
13 //
14 
15 
16 #if !defined(KRATOS_VARIATIONAL_DISTANCE_CALCULATION_PROCESS_INCLUDED )
17 #define KRATOS_VARIATIONAL_DISTANCE_CALCULATION_PROCESS_INCLUDED
18 
19 // System includes
20 #include <string>
21 #include <iostream>
22 #include <algorithm>
23 
24 // External includes
25 
26 // Project includes
27 #include "includes/define.h"
28 #include "containers/model.h"
29 #include "includes/kratos_flags.h"
32 #include "processes/process.h"
38 
39 namespace Kratos
40 {
41 
44 
48 
52 
56 
60 
62 
68 template< unsigned int TDim, class TSparseSpace, class TDenseSpace, class TLinearSolver >
70 {
71 public:
72 
73  KRATOS_DEFINE_LOCAL_FLAG(PERFORM_STEP1);
74  KRATOS_DEFINE_LOCAL_FLAG(DO_EXPENSIVE_CHECKS);
75  KRATOS_DEFINE_LOCAL_FLAG(CALCULATE_EXACT_DISTANCES_TO_PLANE);
76 
79 
81  typedef typename SchemeType::Pointer SchemePointerType;
84 
87 
90 
94 
124  ModelPart& rBaseModelPart,
125  typename TLinearSolver::Pointer pLinearSolver,
126  unsigned int MaxIterations = 10,
127  Flags Options = CALCULATE_EXACT_DISTANCES_TO_PLANE.AsFalse(),
128  std::string AuxPartName = "RedistanceCalculationPart",
129  double Coefficient1 = 0.01,
130  double Coefficient2 = 0.1)
131  :
133  mMaxIterations(MaxIterations),
134  mrModel( rBaseModelPart.GetModel() ),
135  mrBaseModelPart (rBaseModelPart),
136  mOptions( Options ),
137  mAuxModelPartName( AuxPartName ),
138  mCoefficient1(Coefficient1),
139  mCoefficient2(Coefficient2)
140  {
141  KRATOS_TRY
142 
143  ValidateInput();
144 
145  // Generate an auxilary model part and populate it by elements of type DistanceCalculationElementSimplex
146  ReGenerateDistanceModelPart(rBaseModelPart);
147 
148  auto p_builder_solver = Kratos::make_shared<ResidualBasedBlockBuilderAndSolver<TSparseSpace, TDenseSpace, TLinearSolver> >(pLinearSolver);
149 
150  InitializeSolutionStrategy(p_builder_solver);
151 
152  KRATOS_CATCH("")
153  }
154 
156 
165  ModelPart& rBaseModelPart,
166  typename TLinearSolver::Pointer pLinearSolver,
167  BuilderSolverPointerType pBuilderAndSolver,
168  unsigned int MaxIterations = 10,
169  Flags Options = CALCULATE_EXACT_DISTANCES_TO_PLANE.AsFalse(),
170  std::string AuxPartName = "RedistanceCalculationPart",
171  double Coefficient1 = 0.01,
172  double Coefficient2 = 0.1)
173  :
175  mMaxIterations(MaxIterations),
176  mrModel( rBaseModelPart.GetModel() ),
177  mrBaseModelPart (rBaseModelPart),
178  mOptions( Options ),
179  mAuxModelPartName( AuxPartName ),
180  mCoefficient1(Coefficient1),
181  mCoefficient2(Coefficient2)
182  {
183  KRATOS_TRY
184 
185  ValidateInput();
186 
187  // Generate an auxilary model part and populate it by elements of type DistanceCalculationElementSimplex
188  ReGenerateDistanceModelPart(rBaseModelPart);
189 
190  InitializeSolutionStrategy(pBuilderAndSolver);
191 
192  KRATOS_CATCH("")
193  }
194 
197  {
198  Clear();
199  };
200 
204 
205  void operator()()
206  {
207  Execute();
208  }
209 
213 
214  void Execute() override
215  {
216  KRATOS_TRY;
217 
218  if(mDistancePartIsInitialized == false){
220  }
221 
222  ModelPart& r_distance_model_part = mrModel.GetModelPart( mAuxModelPartName );
223 
224  // TODO: check flag PERFORM_STEP1
225  // Step1 - solve a poisson problem with a source term which depends on the sign of the existing distance function
226  r_distance_model_part.pGetProcessInfo()->SetValue(FRACTIONAL_STEP,1);
227 
228  // Unfix the distances
229  const int nnodes = static_cast<int>(r_distance_model_part.NumberOfNodes());
230 
231  block_for_each(r_distance_model_part.Nodes(), [](Node& rNode){
232  double& d = rNode.FastGetSolutionStepValue(DISTANCE);
233 
234  // Free the DISTANCE values
235  rNode.Free(DISTANCE);
236  // Set the fix flag to 0
237  rNode.Set(BLOCKED, false);
238 
239  // Save the distances
240  rNode.SetValue(DISTANCE, d);
241 
242  if(d == 0){
243  d = 1.0e-15;
244  rNode.Set(BLOCKED, true);
245  rNode.Fix(DISTANCE);
246  } else {
247  if(d > 0.0){
248  d = 1.0e15; // Set to a large number, to make sure that that the minimal distance is computed according to CaculateTetrahedraDistances
249  } else {
250  d = -1.0e15;
251  }
252  }
253  });
254 
255  block_for_each(r_distance_model_part.Elements(), [this](Element& rElem){
256  array_1d<double,TDim+1> distances;
257  auto& geom = rElem.GetGeometry();
258 
259  for(unsigned int i=0; i<TDim+1; i++){
260  distances[i] = geom[i].GetValue(DISTANCE);
261  }
262 
263  const array_1d<double,TDim+1> original_distances = distances;
264 
265  // The element is cut by the interface
266  if(this->IsSplit(distances)){
267  // Compute the unsigned distance using GeometryUtils
268  if (mOptions.Is(CALCULATE_EXACT_DISTANCES_TO_PLANE)) {
269  GeometryUtils::CalculateExactDistancesToPlane(geom, distances);
270  }
271  else {
272  if constexpr (TDim==3){
273  GeometryUtils::CalculateTetrahedraDistances(geom, distances);
274  }
275  else {
276  GeometryUtils::CalculateTriangleDistances(geom, distances);
277  }
278  }
279 
280  // Assign the sign using the original distance values
281  for(unsigned int i = 0; i < TDim+1; ++i){
282  if(original_distances[i] < 0){
283  distances[i] = -distances[i];
284  }
285  }
286 
287  for(unsigned int i = 0; i < TDim+1; ++i){
288  double &d = geom[i].FastGetSolutionStepValue(DISTANCE);
289  geom[i].SetLock();
290  if(std::abs(d) > std::abs(distances[i])){
291  d = distances[i];
292  }
293  geom[i].Set(BLOCKED, true);
294  geom[i].Fix(DISTANCE);
295  geom[i].UnSetLock();
296  }
297  }
298  });
299 
300  // SHALL WE SYNCHRONIZE SOMETHING IN HERE?¿?¿??¿ WE'VE CHANGED THE NODAL DISTANCE VALUES FROM THE ELEMENTS...
301  this->SynchronizeFixity();
302  this->SynchronizeDistance();
303 
304  // Compute the maximum and minimum distance for the fixed nodes
305  double max_dist = 0.0;
306  double min_dist = 0.0;
307  for(int i_node = 0; i_node < nnodes; ++i_node){
308  auto it_node = r_distance_model_part.NodesBegin() + i_node;
309  if(it_node->IsFixed(DISTANCE)){
310  const double& d = it_node->FastGetSolutionStepValue(DISTANCE);
311  if(d > max_dist){
312  max_dist = d;
313  }
314  if(d < min_dist){
315  min_dist = d;
316  }
317  }
318  }
319 
320  // Synchronize the maximum and minimum distance values
321  const auto &r_communicator = r_distance_model_part.GetCommunicator().GetDataCommunicator();
322  max_dist = r_communicator.MaxAll(max_dist);
323  min_dist = r_communicator.MinAll(min_dist);
324 
325  // Assign the max dist to all of the non-fixed positive nodes
326  // and the minimum one to the non-fixed negatives
327  block_for_each(r_distance_model_part.Nodes(), [&min_dist, &max_dist](Node& rNode){
328  if(!rNode.IsFixed(DISTANCE)){
329  double& d = rNode.FastGetSolutionStepValue(DISTANCE);
330  if(d>0){
331  d = max_dist;
332  } else {
333  d = min_dist;
334  }
335  }
336  });
337  mpSolvingStrategy->Solve();
338 
339  // Step2 - minimize the target residual
340  r_distance_model_part.pGetProcessInfo()->SetValue(FRACTIONAL_STEP,2);
341  for(unsigned int it = 0; it<mMaxIterations; it++){
342  mpSolvingStrategy->Solve();
343  }
344 
345  // Unfix the distances
346  VariableUtils().ApplyFixity(DISTANCE, false, r_distance_model_part.Nodes());
347  VariableUtils().SetFlag(BOUNDARY, false, r_distance_model_part.Nodes());
348  VariableUtils().SetFlag(BLOCKED, false, r_distance_model_part.Nodes());
349 
350  KRATOS_CATCH("")
351  }
352 
353  void Clear() override
354  {
355  if(mrModel.HasModelPart( mAuxModelPartName ))
356  mrModel.DeleteModelPart( mAuxModelPartName );
357  mDistancePartIsInitialized = false;
358 
359  mpSolvingStrategy->Clear();
360 
361  }
362 
366 
370 
374 
376  std::string Info() const override
377  {
378  return "VariationalDistanceCalculationProcess";
379  }
380 
382  void PrintInfo(std::ostream& rOStream) const override
383  {
384  rOStream << "VariationalDistanceCalculationProcess";
385  }
386 
388  void PrintData(std::ostream& rOStream) const override
389  {
390  }
391 
395 
397 protected:
400 
401 
405 
407  unsigned int mMaxIterations;
408 
412  std::string mAuxModelPartName;
413 
416 
417  typename SolvingStrategyType::UniquePointer mpSolvingStrategy;
418 
422 
426 
428  {
429  const DataCommunicator& r_comm = mrBaseModelPart.GetCommunicator().GetDataCommunicator();
430  int num_elements = mrBaseModelPart.NumberOfElements();
431  int num_nodes = mrBaseModelPart.NumberOfNodes();
432 
433  if (num_elements > 0)
434  {
435  const auto geometry_family = mrBaseModelPart.ElementsBegin()->GetGeometry().GetGeometryFamily();
436  KRATOS_ERROR_IF( (TDim == 2) && (geometry_family != GeometryData::KratosGeometryFamily::Kratos_Triangle) )
437  << "In 2D the element type is expected to be a triangle." << std::endl;
438  KRATOS_ERROR_IF( (TDim == 3) && (geometry_family != GeometryData::KratosGeometryFamily::Kratos_Tetrahedra) )
439  << "In 3D the element type is expected to be a tetrahedron" << std::endl;
440  }
441 
442  KRATOS_ERROR_IF(r_comm.SumAll(num_nodes) == 0) << "The model part has no nodes." << std::endl;
443  KRATOS_ERROR_IF(r_comm.SumAll(num_elements) == 0) << "The model Part has no elements." << std::endl;
444 
445  // Check that required nodal variables are present
446  VariableUtils().CheckVariableExists<Variable<double > >(DISTANCE, mrBaseModelPart.Nodes());
447  }
448 
450  {
451  // Generate a linear strategy
452  auto p_scheme = Kratos::make_shared< ResidualBasedIncrementalUpdateStaticScheme< TSparseSpace,TDenseSpace > >();
453 
454  ModelPart& r_distance_model_part = mrModel.GetModelPart( mAuxModelPartName );
455 
456  bool CalculateReactions = false;
457  bool ReformDofAtEachIteration = false;
458  bool CalculateNormDxFlag = false;
459 
460  mpSolvingStrategy = Kratos::make_unique<ResidualBasedLinearStrategy<TSparseSpace, TDenseSpace, TLinearSolver> >(
461  r_distance_model_part,
462  p_scheme,
463  pBuilderAndSolver,
464  CalculateReactions,
466  CalculateNormDxFlag);
467 
468  // TODO: check flag DO_EXPENSIVE_CHECKS
469  mpSolvingStrategy->Check();
470  }
471 
472  virtual void ReGenerateDistanceModelPart(ModelPart& rBaseModelPart)
473  {
474  KRATOS_TRY
475 
476  if(mrModel.HasModelPart( mAuxModelPartName ))
477  mrModel.DeleteModelPart( mAuxModelPartName );
478 
479  // Ensure that the nodes have distance as a DOF
480  VariableUtils().AddDof<Variable<double> >(DISTANCE, rBaseModelPart);
481 
482  // Generate
483  ModelPart& r_distance_model_part = mrModel.CreateModelPart( mAuxModelPartName );
484 
485  Element::Pointer p_distance_element = Kratos::make_intrusive<DistanceCalculationElementSimplex<TDim> >();
486 
487  r_distance_model_part.GetNodalSolutionStepVariablesList() = rBaseModelPart.GetNodalSolutionStepVariablesList();
488 
490  modeler.GenerateModelPart(rBaseModelPart, r_distance_model_part, *p_distance_element);
491 
492  // Using the conditions to mark the boundary with the flag boundary
493  // Note that we DO NOT add the conditions to the model part
494  VariableUtils().SetFlag<ModelPart::NodesContainerType>(BOUNDARY, false, r_distance_model_part.Nodes());
495  // Note that above we have assigned the same geometry. Thus the flag is
496  // set in the distance model part despite we are iterating the base one
497  for (auto it_cond = rBaseModelPart.ConditionsBegin(); it_cond != rBaseModelPart.ConditionsEnd(); ++it_cond){
498  Geometry< Node >& geom = it_cond->GetGeometry();
499  for(unsigned int i=0; i<geom.size(); i++){
500  geom[i].Set(BOUNDARY,true);
501  }
502  }
503 
504  rBaseModelPart.GetCommunicator().SynchronizeOrNodalFlags(BOUNDARY);
505 
506  r_distance_model_part.GetProcessInfo().SetValue(VARIATIONAL_REDISTANCE_COEFFICIENT_FIRST, mCoefficient1);
507  r_distance_model_part.GetProcessInfo().SetValue(VARIATIONAL_REDISTANCE_COEFFICIENT_SECOND, mCoefficient2);
508 
509  mDistancePartIsInitialized = true;
510 
511  KRATOS_CATCH("")
512  }
513 
517 
521 
525 
527 private:
530 
534 
538 
542 
543  bool IsSplit(const array_1d<double,TDim+1> &rDistances){
544  unsigned int positives = 0, negatives = 0;
545 
546  for(unsigned int i = 0; i < TDim+1; ++i){
547  if(rDistances[i] >= 0){
548  ++positives;
549  } else {
550  ++negatives;
551  }
552  }
553 
554  if (positives > 0 && negatives > 0){
555  return true;
556  }
557 
558  return false;
559  }
560 
561  void SynchronizeDistance(){
562  ModelPart& r_distance_model_part = mrModel.GetModelPart( mAuxModelPartName );
563  auto &r_communicator = r_distance_model_part.GetCommunicator();
564 
565  // Only required in the MPI case
566  if(r_communicator.TotalProcesses() != 1){
567  int nnodes = static_cast<int>(r_distance_model_part.NumberOfNodes());
568 
569  // Set the distance absolute value
570  #pragma omp parallel for
571  for(int i_node = 0; i_node < nnodes; ++i_node){
572  auto it_node = r_distance_model_part.NodesBegin() + i_node;
573  it_node->FastGetSolutionStepValue(DISTANCE) = std::abs(it_node->FastGetSolutionStepValue(DISTANCE));
574  }
575 
576  // Synchronize the unsigned value to minimum
577  r_communicator.SynchronizeCurrentDataToMin(DISTANCE);
578 
579  // Set the distance sign again by retrieving it from the non-historical database
580  #pragma omp parallel for
581  for(int i_node = 0; i_node < nnodes; ++i_node){
582  auto it_node = r_distance_model_part.NodesBegin() + i_node;
583  if(it_node->GetValue(DISTANCE) < 0.0){
584  it_node->FastGetSolutionStepValue(DISTANCE) = -it_node->FastGetSolutionStepValue(DISTANCE);
585  }
586  }
587  }
588  }
589 
590  void SynchronizeFixity(){
591  ModelPart& r_distance_model_part = mrModel.GetModelPart( mAuxModelPartName );
592  auto &r_communicator = r_distance_model_part.GetCommunicator();
593 
594  // Only required in the MPI case
595  if(r_communicator.TotalProcesses() != 1){
596  int nnodes = static_cast<int>(r_distance_model_part.NumberOfNodes());
597 
598  // Synchronize the fixity flag variable to minium
599  // (true means fixed and false means free)
600  r_communicator.SynchronizeOrNodalFlags(BLOCKED);
601 
602  // Set the fixity according to the synchronized flag
603  #pragma omp parallel for
604  for(int i_node = 0; i_node < nnodes; ++i_node){
605  auto it_node = r_distance_model_part.NodesBegin() + i_node;
606  if (it_node->Is(BLOCKED)){
607  it_node->Fix(DISTANCE);
608  }
609  }
610  }
611  }
612 
616 
620 
624 
626  VariationalDistanceCalculationProcess& operator=(VariationalDistanceCalculationProcess const& rOther);
627 
629  //VariationalDistanceCalculationProcess(VariationalDistanceCalculationProcess const& rOther);
630 
632 }; // Class VariationalDistanceCalculationProcess
633 
634 //avoiding using the macro since this has a template parameter. If there was no template plase use the KRATOS_CREATE_LOCAL_FLAG macro
635 template< unsigned int TDim,class TSparseSpace, class TDenseSpace, class TLinearSolver >
636 const Kratos::Flags VariationalDistanceCalculationProcess<TDim,TSparseSpace,TDenseSpace,TLinearSolver>::PERFORM_STEP1(Kratos::Flags::Create(0));
637 
638 template< unsigned int TDim,class TSparseSpace, class TDenseSpace, class TLinearSolver >
639 const Kratos::Flags VariationalDistanceCalculationProcess<TDim,TSparseSpace,TDenseSpace,TLinearSolver>::DO_EXPENSIVE_CHECKS(Kratos::Flags::Create(1));
640 
641 template< unsigned int TDim,class TSparseSpace, class TDenseSpace, class TLinearSolver >
642 const Kratos::Flags VariationalDistanceCalculationProcess<TDim,TSparseSpace,TDenseSpace,TLinearSolver>::CALCULATE_EXACT_DISTANCES_TO_PLANE(Kratos::Flags::Create(2));
643 
645 
648 
649 
653 
654 
656 template< unsigned int TDim, class TSparseSpace, class TDenseSpace, class TLinearSolver>
657 inline std::istream& operator >> (std::istream& rIStream,
659 
661 template< unsigned int TDim, class TSparseSpace, class TDenseSpace, class TLinearSolver>
662 inline std::ostream& operator << (std::ostream& rOStream,
664 {
665  rThis.PrintInfo(rOStream);
666  rOStream << std::endl;
667  rThis.PrintData(rOStream);
668 
669  return rOStream;
670 }
672 
673 
674 } // namespace Kratos.
675 
676 #endif // KRATOS_VARIATIONAL_DISTANCE_CALCULATION_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
virtual bool SynchronizeOrNodalFlags(const Flags &TheFlags)
Definition: communicator.cpp:623
virtual const DataCommunicator & GetDataCommunicator() const
Definition: communicator.cpp:340
A tool to generate a copy of a ModelPart, sharing the same nodes as the original.
Definition: connectivity_preserve_modeler.h:41
void GenerateModelPart(ModelPart &OriginModelPart, ModelPart &DestinationModelPart, const Element &rReferenceElement, const Condition &rReferenceBoundaryCondition) override
Generate a copy of rOriginModelPart in rDestinationModelPart, using the given element and condtion ty...
Definition: connectivity_preserve_modeler.cpp:27
Serial (do-nothing) version of a wrapper class for MPI communication.
Definition: data_communicator.h:318
Definition: flags.h:58
Flags AsFalse() const
Definition: flags.h:241
static Flags Create(IndexType ThisPosition, bool Value=true)
Definition: flags.h:138
Geometry base class.
Definition: geometry.h:71
SizeType size() const
Definition: geometry.h:518
Implicit solving strategy base class This is the base class from which we will derive all the implici...
Definition: implicit_solving_strategy.h:61
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
ConditionIterator ConditionsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1361
ProcessInfo::Pointer pGetProcessInfo()
Definition: model_part.h:1756
Communicator & GetCommunicator()
Definition: model_part.h:1821
SizeType NumberOfElements(IndexType ThisIndex=0) const
Definition: model_part.h:1027
SizeType NumberOfNodes(IndexType ThisIndex=0) const
Definition: model_part.h:341
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
VariablesList & GetNodalSolutionStepVariablesList()
Definition: model_part.h:549
ConditionIterator ConditionsEnd(IndexType ThisIndex=0)
Definition: model_part.h:1371
This class defines the node.
Definition: node.h:65
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
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 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
Short class definition.
Definition: variational_distance_calculation_process.h:70
bool mDistancePartIsInitialized
Definition: variational_distance_calculation_process.h:406
SolvingStrategyType::UniquePointer mpSolvingStrategy
Definition: variational_distance_calculation_process.h:417
unsigned int mMaxIterations
Definition: variational_distance_calculation_process.h:407
std::string mAuxModelPartName
Definition: variational_distance_calculation_process.h:412
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: variational_distance_calculation_process.h:388
KRATOS_DEFINE_LOCAL_FLAG(CALCULATE_EXACT_DISTANCES_TO_PLANE)
std::string Info() const override
Turn back information as a string.
Definition: variational_distance_calculation_process.h:376
BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::Pointer BuilderSolverPointerType
Definition: variational_distance_calculation_process.h:82
Model & mrModel
Definition: variational_distance_calculation_process.h:409
VariationalDistanceCalculationProcess(ModelPart &rBaseModelPart, typename TLinearSolver::Pointer pLinearSolver, unsigned int MaxIterations=10, Flags Options=CALCULATE_EXACT_DISTANCES_TO_PLANE.AsFalse(), std::string AuxPartName="RedistanceCalculationPart", double Coefficient1=0.01, double Coefficient2=0.1)
Definition: variational_distance_calculation_process.h:123
void Execute() override
Execute method is used to execute the Process algorithms.
Definition: variational_distance_calculation_process.h:214
double mCoefficient1
Definition: variational_distance_calculation_process.h:414
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: variational_distance_calculation_process.h:382
void operator()()
Definition: variational_distance_calculation_process.h:205
virtual void ReGenerateDistanceModelPart(ModelPart &rBaseModelPart)
Definition: variational_distance_calculation_process.h:472
VariationalDistanceCalculationProcess(ModelPart &rBaseModelPart, typename TLinearSolver::Pointer pLinearSolver, BuilderSolverPointerType pBuilderAndSolver, unsigned int MaxIterations=10, Flags Options=CALCULATE_EXACT_DISTANCES_TO_PLANE.AsFalse(), std::string AuxPartName="RedistanceCalculationPart", double Coefficient1=0.01, double Coefficient2=0.1)
Constructor with custom Builder And Solver.
Definition: variational_distance_calculation_process.h:164
void ValidateInput()
Definition: variational_distance_calculation_process.h:427
Flags mOptions
Definition: variational_distance_calculation_process.h:411
~VariationalDistanceCalculationProcess() override
Destructor.
Definition: variational_distance_calculation_process.h:196
ImplicitSolvingStrategy< TSparseSpace, TDenseSpace, TLinearSolver > SolvingStrategyType
Definition: variational_distance_calculation_process.h:83
KRATOS_CLASS_POINTER_DEFINITION(VariationalDistanceCalculationProcess)
Pointer definition of VariationalDistanceCalculationProcess.
ModelPart & mrBaseModelPart
Definition: variational_distance_calculation_process.h:410
double mCoefficient2
Definition: variational_distance_calculation_process.h:415
Scheme< TSparseSpace, TDenseSpace > SchemeType
Definition: variational_distance_calculation_process.h:80
void Clear() override
This method clears the assignation of the conditions.
Definition: variational_distance_calculation_process.h:353
void InitializeSolutionStrategy(BuilderSolverPointerType pBuilderAndSolver)
Definition: variational_distance_calculation_process.h:449
SchemeType::Pointer SchemePointerType
Definition: variational_distance_calculation_process.h:81
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
std::ostream & operator<<(std::ostream &rOStream, const VariationalDistanceCalculationProcess< TDim, TSparseSpace, TDenseSpace, TLinearSolver > &rThis)
output stream function
Definition: variational_distance_calculation_process.h:662
std::istream & operator>>(std::istream &rIStream, VariationalDistanceCalculationProcess< TDim, TSparseSpace, TDenseSpace, TLinearSolver > &rThis)
input stream function
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
Kratos::ModelPart ModelPart
Definition: kratos_wrapper.h:31
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
int d
Definition: ode_solve.py:397
int nnodes
Definition: sensitivityMatrix.py:24
integer i
Definition: TensorModule.f:17
ReformDofAtEachIteration
Definition: test_pureconvectionsolver_benchmarking.py:131