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.
levelset_convection_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 // Mohammad Reza Hashemi
13 //
14 
15 #if !defined(KRATOS_LEVELSET_CONVECTION_PROCESS_INCLUDED )
16 #define KRATOS_LEVELSET_CONVECTION_PROCESS_INCLUDED
17 
18 // System includes
19 #include <string>
20 #include <iostream>
21 #include <algorithm>
22 
23 // External includes
24 
25 // Project includes
27 #include "includes/define.h"
29 #include "includes/kratos_flags.h"
42 
43 namespace Kratos
44 {
47 
51 
55 
59 
63 
65 
68 template< unsigned int TDim, class TSparseSpace, class TDenseSpace, class TLinearSolver >
70  : public Process
71 {
72 private:
75 
76  class ProcessInfoDataContainer
77  {
78  public:
79  ProcessInfoDataContainer(const ProcessInfo& rInputProcessInfo)
80  : DeltaTime(rInputProcessInfo.GetValue(DELTA_TIME))
81  , pUnknownVariable(&((rInputProcessInfo.GetValue(CONVECTION_DIFFUSION_SETTINGS))->GetUnknownVariable()))
82  , pGradientVariable(&((rInputProcessInfo.GetValue(CONVECTION_DIFFUSION_SETTINGS))->GetGradientVariable()))
83  , pConvectionVariable(&((rInputProcessInfo.GetValue(CONVECTION_DIFFUSION_SETTINGS))->GetConvectionVariable()))
84  {}
85 
86  void RestoreProcessInfoData(ProcessInfo& rOutputProcessInfo) const
87  {
88  rOutputProcessInfo.SetValue(DELTA_TIME, DeltaTime);
89  (rOutputProcessInfo.GetValue(CONVECTION_DIFFUSION_SETTINGS))->SetUnknownVariable(*pUnknownVariable);
90  (rOutputProcessInfo.GetValue(CONVECTION_DIFFUSION_SETTINGS))->SetGradientVariable(*pGradientVariable);
91  (rOutputProcessInfo.GetValue(CONVECTION_DIFFUSION_SETTINGS))->SetConvectionVariable(*pConvectionVariable);
92  }
93 
94  private:
95  const double DeltaTime;
96  const Variable<double>* pUnknownVariable;
97  const Variable<array_1d<double,3>>* pGradientVariable;
98  const Variable<array_1d<double,3>>* pConvectionVariable;
99  };
100 
102 
103 public:
104 
107 
111  typedef ComputeGradientProcessType::Pointer ComputeGradientProcessPointerType;
112 
116 
119 
123 
132  Model& rModel,
133  typename TLinearSolver::Pointer pLinearSolver,
134  Parameters ThisParameters)
136  rModel.GetModelPart(ThisParameters["model_part_name"].GetString()),
137  pLinearSolver,
138  ThisParameters)
139  {
140  }
141 
150  ModelPart& rBaseModelPart,
151  typename TLinearSolver::Pointer pLinearSolver,
152  Parameters ThisParameters)
154  rBaseModelPart,
155  ThisParameters)
156  {
157  KRATOS_TRY
158 
159  auto p_builder_solver = Kratos::make_shared< ResidualBasedBlockBuilderAndSolver<TSparseSpace,TDenseSpace,TLinearSolver>>(pLinearSolver);
160  InitializeConvectionStrategy(p_builder_solver);
161 
162  KRATOS_CATCH("")
163  }
164 
167 
170  {
172  }
173 
177 
178  void operator()(){
179  Execute();
180  }
181 
185 
194  void Execute() override
195  {
196  KRATOS_TRY;
197 
198  // Fill the auxiliary convection model part if not done yet
199  if(mDistancePartIsInitialized == false){
201  }
202 
203  // If required, calculate nodal element size
204  // Note that this is done once assuming no mesh deformation
206  ComputeNodalH();
207  mCalculateNodalH = false;
208  }
209 
210  // Evaluate steps needed to achieve target max_cfl
211  const auto n_substep = EvaluateNumberOfSubsteps();
212 
213  // Save the variables to be employed so that they can be restored after the solution
214  const auto process_info_data = ProcessInfoDataContainer(mpDistanceModelPart->GetProcessInfo());
215 
216  // We set these values at every time step as other processes/solvers also use them
217  // Note that this function sets the element related data (e.g. stabilization parameters)
218  auto fill_process_info_function = GetFillProcessInfoFormulationDataFunction();
219  fill_process_info_function(mrBaseModelPart);
220 
221  // Set convection problem data
222  auto& r_conv_process_info = mpDistanceModelPart->GetProcessInfo();
223  const double previous_delta_time = r_conv_process_info.GetValue(DELTA_TIME);
224  const double dt = previous_delta_time / static_cast<double>(n_substep);
225  r_conv_process_info.SetValue(DELTA_TIME, dt);
226  r_conv_process_info.GetValue(CONVECTION_DIFFUSION_SETTINGS)->SetUnknownVariable(*mpLevelSetVar);
227  r_conv_process_info.GetValue(CONVECTION_DIFFUSION_SETTINGS)->SetGradientVariable(*mpLevelSetGradientVar);
228  r_conv_process_info.GetValue(CONVECTION_DIFFUSION_SETTINGS)->SetConvectionVariable(*mpConvectVar);
229 
230  // Save current level set value and current and previous step velocity values
231  // If the nodal stabilization tau is to be used, it is also computed in here
233  [&](int i_node){
234  const auto it_node = mpDistanceModelPart->NodesBegin() + i_node;
235  mVelocity[i_node] = it_node->FastGetSolutionStepValue(*mpConvectVar);
236  mVelocityOld[i_node] = it_node->FastGetSolutionStepValue(*mpConvectVar,1);
237  mOldDistance[i_node] = it_node->FastGetSolutionStepValue(*mpLevelSetVar,1);
238 
239  if (mElementTauNodal) {
240  double velocity_norm = norm_2(mVelocity[i_node]);
241  const double nodal_h = it_node-> GetValue(NODAL_H);
242  const double dynamic_tau = r_conv_process_info.GetValue(DYNAMIC_TAU);
243  const double tau = 1.0 / (dynamic_tau / dt + velocity_norm / std::pow(nodal_h,2));
244  it_node->GetValue(TAU) = tau;
245  }
246  }
247  );
248 
249  for(unsigned int step = 1; step <= n_substep; ++step){
250  KRATOS_INFO_IF("LevelSetConvectionProcess", mLevelSetConvectionSettings["echo_level"].GetInt() > 0) <<
251  "Doing step "<< step << " of " << n_substep << std::endl;
252 
254  mpGradientCalculator->Execute();
255  }
256 
257  // Compute shape functions of old and new step
258  const double Nold = 1.0 - static_cast<double>(step) / static_cast<double>(n_substep);
259  const double Nnew = 1.0 - Nold;
260 
261  const double Nold_before = 1.0 - static_cast<double>(step-1) / static_cast<double>(n_substep);
262  const double Nnew_before = 1.0 - Nold_before;
263 
264  // Emulate clone time step by copying the new distance onto the old one
266  [&](int i_node){
267  auto it_node = mpDistanceModelPart->NodesBegin() + i_node;
268 
269  const array_1d<double,3>& r_v = mVelocity[i_node];
270  const array_1d<double,3>& r_v_old = mVelocityOld[i_node];
271 
272  noalias(it_node->FastGetSolutionStepValue(*mpConvectVar)) = Nold * r_v_old + Nnew * r_v;
273  noalias(it_node->FastGetSolutionStepValue(*mpConvectVar, 1)) = Nold_before * r_v_old + Nnew_before * r_v;
274  it_node->FastGetSolutionStepValue(*mpLevelSetVar, 1) = it_node->FastGetSolutionStepValue(*mpLevelSetVar);
275  }
276  );
277 
278  // Storing the levelset variable for error calculation and Evaluating the limiter
279  if (mEvaluateLimiter) {
280  EvaluateLimiter();
281  }
282 
283  mpSolvingStrategy->InitializeSolutionStep();
284  mpSolvingStrategy->Predict();
285  mpSolvingStrategy->SolveSolutionStep(); // forward convection to reach phi_n+1
286  mpSolvingStrategy->FinalizeSolutionStep();
287 
288  // Error Compensation and Correction
289  if (mIsBfecc) {
291  }
292  }
293 
294  // Reset the processinfo to the original settings
295  process_info_data.RestoreProcessInfoData(mpDistanceModelPart->GetProcessInfo());
296 
297  // Reset the velocities and levelset values to the one saved before the solution process
299  [&](int i_node){
300  auto it_node = mpDistanceModelPart->NodesBegin() + i_node;
301  it_node->FastGetSolutionStepValue(*mpConvectVar) = mVelocity[i_node];
302  it_node->FastGetSolutionStepValue(*mpConvectVar,1) = mVelocityOld[i_node];
303  it_node->FastGetSolutionStepValue(*mpLevelSetVar,1) = mOldDistance[i_node];
304  }
305  );
306 
307  KRATOS_CATCH("")
308  }
309 
310  void Clear() override
311  {
312  mpDistanceModelPart->Nodes().clear();
313  mpDistanceModelPart->Conditions().clear();
314  mpDistanceModelPart->Elements().clear();
315  // mpDistanceModelPart->GetProcessInfo().clear();
317 
318  mpSolvingStrategy->Clear();
319 
320  mVelocity.clear();
321  mVelocityOld.clear();
323 
324  mSigmaPlus.clear();
325  mSigmaMinus.clear();
326  mLimiter.clear();
327 
328  mError.clear();
329  }
330 
331  const Parameters GetDefaultParameters() const override
332  {
333  Parameters default_parameters = Parameters(R"({
334  "model_part_name" : "",
335  "echo_level" : 0,
336  "convection_model_part_name" : "",
337  "levelset_variable_name" : "DISTANCE",
338  "levelset_convection_variable_name" : "VELOCITY",
339  "levelset_gradient_variable_name" : "DISTANCE_GRADIENT",
340  "max_CFL" : 1.0,
341  "max_substeps" : 0,
342  "eulerian_error_compensation" : false,
343  "BFECC_limiter_acuteness" : 2.0,
344  "element_type" : "levelset_convection_supg",
345  "element_settings" : {}
346  })");
347 
348  return default_parameters;
349  }
350 
354 
358 
362 
364  std::string Info() const override {
365  return "LevelSetConvectionProcess";
366  }
367 
369  void PrintInfo(std::ostream& rOStream) const override {
370  rOStream << "LevelSetConvectionProcess";
371  }
372 
374  void PrintData(std::ostream& rOStream) const override {
375  }
376 
380 
382 protected:
385 
389 
391 
393 
395 
396  const Variable<double>* mpLevelSetVar = nullptr;
397 
399 
401 
402  double mMaxAllowedCFL = 1.0;
403 
404  unsigned int mMaxSubsteps = 0;
405 
406  bool mIsBfecc;
407 
409 
411 
412  bool mCalculateNodalH = true;
413 
415 
417 
418  double mPowerBfeccLimiter = 2.0;
419 
421 
423 
425 
427 
429 
431 
432  std::vector<array_1d<double,3>> mVelocity;
433 
434  std::vector<array_1d<double,3>> mVelocityOld;
435 
437 
438  typename SolvingStrategyType::UniquePointer mpSolvingStrategy;
439 
440  std::string mAuxModelPartName;
441 
443 
445 
447 
449 
450 
454 
458 
460  ModelPart& rModelPart,
461  Parameters ThisParameters)
462  : mrBaseModelPart(rModelPart)
463  , mrModel(rModelPart.GetModel())
464  {
465  // Validate the common settings as well as the element formulation specific ones
467  ThisParameters["element_settings"].ValidateAndAssignDefaults(GetConvectionElementDefaultParameters(ThisParameters["element_type"].GetString()));
468 
469  // Checks and assign all the required member variables
470  CheckAndAssignSettings(ThisParameters);
471 
472  // Sets the convection diffusion problem settings
474 
476  mpGradientCalculator = Kratos::make_unique<ComputeGradientProcessType>(
478  *mpLevelSetVar,
480  NODAL_AREA,
481  false);
482  }
483  }
484 
491  {
492  // Get the base model part process info
493  // Note that this will be shared with the auxiliary model part used in the convection resolution
494  auto& r_process_info = mrBaseModelPart.GetProcessInfo();
495 
496  // Allocate if needed the variable CONVECTION_DIFFUSION_SETTINGS of the process info, and create it if it does not exist
497  if(!r_process_info.Has(CONVECTION_DIFFUSION_SETTINGS)){
498  auto p_conv_diff_settings = Kratos::make_shared<ConvectionDiffusionSettings>();
499  r_process_info.SetValue(CONVECTION_DIFFUSION_SETTINGS, p_conv_diff_settings);
500  p_conv_diff_settings->SetUnknownVariable(*mpLevelSetVar);
501  p_conv_diff_settings->SetConvectionVariable(*mpConvectVar);
502  if (mpLevelSetGradientVar) {
503  p_conv_diff_settings->SetGradientVariable(*mpLevelSetGradientVar);
504  }
505  }
506 
507  // This call returns a function pointer with the ProcessInfo filling directives
508  // If the user-defined level set convection requires nothing to be set, the function does nothing
509  auto fill_process_info_function = GetFillProcessInfoFormulationDataFunction();
510  fill_process_info_function(mrBaseModelPart);
511  }
512 
513  virtual void ReGenerateConvectionModelPart(ModelPart& rBaseModelPart){
514 
515  KRATOS_TRY
516 
517  KRATOS_ERROR_IF(mrModel.HasModelPart(mAuxModelPartName)) << "A process or operation using an auxiliar model_part with the name '" << mAuxModelPartName << "' already exists. Please choose another." << std::endl;
518 
520 
521 
522  // Check buffer size
523  const auto base_buffer_size = rBaseModelPart.GetBufferSize();
524  KRATOS_ERROR_IF(base_buffer_size < 2) <<
525  "Base model part buffer size is " << base_buffer_size << ". Set it to a minimum value of 2." << std::endl;
526 
527  // Generate
528  mpDistanceModelPart->Nodes().clear();
529  mpDistanceModelPart->Conditions().clear();
530  mpDistanceModelPart->Elements().clear();
531 
533  mpDistanceModelPart->SetBufferSize(base_buffer_size);
534  for(auto it_properties = rBaseModelPart.PropertiesBegin() ; it_properties != rBaseModelPart.PropertiesEnd() ; ++it_properties){
535  mpDistanceModelPart->AddProperties(*(it_properties).base());
536  }
537  mpDistanceModelPart->Tables() = rBaseModelPart.Tables();
538 
539  // Assigning the nodes to the new model part
540  mpDistanceModelPart->Nodes() = rBaseModelPart.Nodes();
541 
542  // Ensure that the nodes have distance as a DOF
543  VariableUtils().AddDof<Variable<double>>(*mpLevelSetVar, rBaseModelPart);
544 
545  // Generating the elements
546  mpDistanceModelPart->Elements().reserve(rBaseModelPart.NumberOfElements());
547  KRATOS_ERROR_IF(mpConvectionFactoryElement == nullptr) << "Convection factory element has not been set yet." << std::endl;
548  for (auto it_elem = rBaseModelPart.ElementsBegin(); it_elem != rBaseModelPart.ElementsEnd(); ++it_elem){
549  // Create the new element from the factory registered one
550  auto p_element = mpConvectionFactoryElement->Create(
551  it_elem->Id(),
552  it_elem->pGetGeometry(),
553  it_elem->pGetProperties());
554 
555  mpDistanceModelPart->Elements().push_back(p_element);
556  }
557 
558  // Initialize the nodal and elemental databases
560 
561  // Resize the arrays
562  const auto n_nodes = mpDistanceModelPart->NumberOfNodes();
563  mVelocity.resize(n_nodes);
564  mVelocityOld.resize(n_nodes);
566 
567  if (mEvaluateLimiter){
571  }
572 
573  if (mIsBfecc){
575  }
576 
578 
579  KRATOS_CATCH("")
580  }
581 
587  {
588  // If required, initialize the limiter elemental and nodal databases
589  const array_1d<double, 3> aux_zero_vector = ZeroVector(3);
590  if (mConvectionElementType == "LevelSetConvectionElementSimplexAlgebraicStabilization") {
591  block_for_each(mpDistanceModelPart->Elements(), [&](Element &rElement) {rElement.SetValue(LIMITER_COEFFICIENT, 0.0);});
592  }
593 
595  block_for_each(mpDistanceModelPart->Nodes(), [&](Node& rNode){rNode.SetValue(LIMITER_COEFFICIENT, 0.0);});
596  }
597  if(mElementTauNodal){
598  block_for_each(mpDistanceModelPart->Nodes(), [&](Node& rNode){rNode.SetValue(TAU, 0.0);});
599  }
600  }
601 
602  unsigned int EvaluateNumberOfSubsteps(){
603  // First of all compute the maximum local CFL number
604  const double dt = mpDistanceModelPart->GetProcessInfo()[DELTA_TIME];
605  double max_cfl_found = block_for_each<MaxReduction<double>>(mpDistanceModelPart->Elements(), [&](Element& rElement){
606  double vol;
609  auto& r_geom = rElement.GetGeometry();
610  GeometryUtils::CalculateGeometryData(r_geom, DN_DX, N, vol);
611 
612  // Compute h
613  double h=0.0;
614  for(unsigned int i=0; i<TDim+1; i++){
615  double h_inv = 0.0;
616  for(unsigned int k=0; k<TDim; k++){
617  h_inv += DN_DX(i,k)*DN_DX(i,k);
618  }
619  h += 1.0/h_inv;
620  }
621  h = sqrt(h)/static_cast<double>(TDim+1);
622 
623  // Get average velocity at the nodes
625  for(unsigned int i=0; i<TDim+1; i++){
626  vgauss += N[i]* r_geom[i].FastGetSolutionStepValue(*mpConvectVar);
627  }
628 
629  double cfl_local = norm_2(vgauss) / h;
630  return cfl_local;
631  });
632  max_cfl_found *= dt;
633 
634  // Synchronize maximum CFL between processes
635  max_cfl_found = mpDistanceModelPart->GetCommunicator().GetDataCommunicator().MaxAll(max_cfl_found);
636 
637  unsigned int n_steps = static_cast<unsigned int>(max_cfl_found / mMaxAllowedCFL);
638  if(n_steps < 1){
639  n_steps = 1;
640  }
641 
642  // Now we compare with the maximum set
643  if (mMaxSubsteps > 0 && mMaxSubsteps < n_steps){
645  }
646 
647  return n_steps;
648  }
649 
656  {
657  const double epsilon = 1.0e-12;
658 
659  auto& r_default_comm = mpDistanceModelPart->GetCommunicator().GetDataCommunicator();
661 
662  for (int i_node = 0; i_node < static_cast<int>(mpDistanceModelPart->NumberOfNodes()); ++i_node){
663  auto it_node = mpDistanceModelPart->NodesBegin() + i_node;
664  GlobalPointersVector< Node >& global_pointer_list = it_node->GetValue(NEIGHBOUR_NODES);
665 
666  for (unsigned int j = 0; j< global_pointer_list.size(); ++j)
667  {
668  auto& global_pointer = global_pointer_list(j);
669  gp_list.push_back(global_pointer);
670  }
671  }
672 
673  GlobalPointerCommunicator< Node > pointer_comm(r_default_comm, gp_list);
674 
675  auto coordinate_proxy = pointer_comm.Apply(
677  {
678  return global_pointer->Coordinates();
679  }
680  );
681 
683  [&](int i_node){
684  auto it_node = mpDistanceModelPart->NodesBegin() + i_node;
685 
686  it_node->SetValue(*mpLevelSetVar, it_node->FastGetSolutionStepValue(*mpLevelSetVar)); //Store mpLevelSetVar
687 
688  const auto& X_i = it_node->Coordinates();
689  const auto& grad_i = it_node->GetValue(*mpLevelSetGradientVar);
690 
691  double S_plus = 0.0;
692  double S_minus = 0.0;
693 
694  GlobalPointersVector< Node >& global_pointer_list = it_node->GetValue(NEIGHBOUR_NODES);
695 
696  for (unsigned int j = 0; j< global_pointer_list.size(); ++j)
697  {
698  // if (it_node->Id() == j_node->Id())
699  // continue;
700 
701  auto& global_pointer = global_pointer_list(j);
702  auto X_j = coordinate_proxy.Get(global_pointer);
703 
704  S_plus += std::max(0.0, inner_prod(grad_i, X_i-X_j));
705  S_minus += std::min(0.0, inner_prod(grad_i, X_i-X_j));
706  }
707 
708  mSigmaPlus[i_node] = std::min(1.0, (std::abs(S_minus)+epsilon)/(S_plus+epsilon));
709  mSigmaMinus[i_node] = std::min(1.0, (S_plus+epsilon)/(std::abs(S_minus)+epsilon));
710  }
711  );
712 
713  auto combined_proxy = pointer_comm.Apply(
714  [&](GlobalPointer<Node> &global_pointer) -> std::pair<double, array_1d<double,3>> {
715  return std::make_pair(
716  global_pointer->FastGetSolutionStepValue(*mpLevelSetVar),
717  global_pointer->Coordinates());
718  });
719 
720  //Calculating beta_ij in a way that the linearity is preserved on non-symmetrical meshes
722  [&](int i_node){
723  auto it_node = mpDistanceModelPart->NodesBegin() + i_node;
724  const double distance_i = it_node->FastGetSolutionStepValue(*mpLevelSetVar);
725  const auto& X_i = it_node->Coordinates();
726  const auto& grad_i = it_node->GetValue(*mpLevelSetGradientVar);
727 
728  double numerator = 0.0;
729  double denominator = 0.0;
730 
731  GlobalPointersVector< Node >& global_pointer_list = it_node->GetValue(NEIGHBOUR_NODES);
732 
733  for (unsigned int j = 0; j< global_pointer_list.size(); ++j)
734  {
735  auto& global_pointer = global_pointer_list(j);
736  auto result = combined_proxy.Get(global_pointer);
737  const auto X_j = std::get<1>(result);
738  const double distance_j = std::get<0>(result);
739 
740  double beta_ij = 1.0;
741 
742  if (inner_prod(grad_i, X_i-X_j) > 0)
743  beta_ij = mSigmaPlus[i_node];
744  else if (inner_prod(grad_i, X_i-X_j) < 0)
745  beta_ij = mSigmaMinus[i_node];
746 
747  numerator += beta_ij*(distance_i - distance_j);
748  denominator += beta_ij*std::abs(distance_i - distance_j);
749  }
750 
751  const double fraction = std::abs(numerator) / (denominator + epsilon);
752 
753  if (mIsBfecc){
754  mLimiter[i_node] = 1.0 - std::pow(fraction, mPowerBfeccLimiter);
755  }
756 
758  it_node->GetValue(LIMITER_COEFFICIENT) = (1.0 - std::pow(fraction, mPowerElementalLimiter));
759  }
760  }
761  );
762 
765  const auto& r_geometry = rElement.GetGeometry();
766  double elemental_limiter = 1.0;
767  for(unsigned int i_node=0; i_node< TDim+1; ++i_node) {
768  elemental_limiter = std::min(r_geometry[i_node].GetValue(LIMITER_COEFFICIENT), elemental_limiter);
769  }
770  rElement.GetValue(LIMITER_COEFFICIENT) = elemental_limiter;
771  }
772  );
773  }
774  }
775 
783  {
784  block_for_each(mpDistanceModelPart->Nodes(), [this](Node& rNode){
785  noalias(rNode.FastGetSolutionStepValue(*mpConvectVar)) = -1.0 * rNode.FastGetSolutionStepValue(*mpConvectVar);
786  noalias(rNode.FastGetSolutionStepValue(*mpConvectVar, 1)) = -1.0 * rNode.FastGetSolutionStepValue(*mpConvectVar, 1);
787  rNode.FastGetSolutionStepValue(*mpLevelSetVar, 1) = rNode.FastGetSolutionStepValue(*mpLevelSetVar);
788  });
789 
790  mpSolvingStrategy->InitializeSolutionStep();
791  mpSolvingStrategy->Predict();
792  mpSolvingStrategy->SolveSolutionStep(); // backward convetion to obtain phi_n*
793  mpSolvingStrategy->FinalizeSolutionStep();
794 
795  // Calculating the raw error without a limiter, etc.
796  IndexPartition<int>(mpDistanceModelPart->NumberOfNodes()).for_each(
797  [&](int i_node){
798  auto it_node = mpDistanceModelPart->NodesBegin() + i_node;
799  mError[i_node] =
800  0.5*(it_node->GetValue(*mpLevelSetVar) - it_node->FastGetSolutionStepValue(*mpLevelSetVar));
801  });
802 
803  IndexPartition<int>(mpDistanceModelPart->NumberOfNodes()).for_each(
804  [&](int i_node){
805  auto it_node = mpDistanceModelPart->NodesBegin() + i_node;
806  noalias(it_node->FastGetSolutionStepValue(*mpConvectVar)) = -1.0 * it_node->FastGetSolutionStepValue(*mpConvectVar);
807  noalias(it_node->FastGetSolutionStepValue(*mpConvectVar, 1)) = -1.0 * it_node->FastGetSolutionStepValue(*mpConvectVar, 1);
808  const double phi_n_star = it_node->GetValue(*mpLevelSetVar) + mLimiter[i_node]*mError[i_node];
809  it_node->FastGetSolutionStepValue(*mpLevelSetVar) = phi_n_star;
810  it_node->FastGetSolutionStepValue(*mpLevelSetVar, 1) = phi_n_star;
811  });
812 
813  mpSolvingStrategy->InitializeSolutionStep();
814  mpSolvingStrategy->Predict();
815  mpSolvingStrategy->SolveSolutionStep(); // forward convection to obtain the corrected phi_n+1
816  mpSolvingStrategy->FinalizeSolutionStep();
817  }
818 
824  {
825  auto nodal_h_process = FindNodalHProcess<FindNodalHSettings::SaveAsNonHistoricalVariable>(mrBaseModelPart);
826  nodal_h_process.Execute();
827  }
828 
832 
836 
840 
842 private:
845 
849 
853 
857 
863  void CheckAndAssignSettings(const Parameters ThisParameters)
864  {
865  mLevelSetConvectionSettings = ThisParameters;
866 
867  std::string element_register_name = GetConvectionElementRegisteredName(ThisParameters);
868 
869  mpConvectionFactoryElement = &KratosComponents<Element>::Get(element_register_name);
870  mElementRequiresLimiter = ThisParameters["element_settings"].Has("include_anti_diffusivity_terms") ? ThisParameters["element_settings"]["include_anti_diffusivity_terms"].GetBool() : false;
871  mElementTauNodal = ThisParameters["element_settings"].Has("tau_nodal") ? ThisParameters["element_settings"]["tau_nodal"].GetBool() : false;
872 
873  if (ThisParameters["element_settings"].Has("elemental_limiter_acuteness") && mElementRequiresLimiter) {
874  mPowerElementalLimiter = ThisParameters["element_settings"]["elemental_limiter_acuteness"].GetDouble();
875  }
876 
877  if (mConvectionElementType == "LevelSetConvectionElementSimplexAlgebraicStabilization"){
878  ThisParameters["element_settings"]["requires_distance_gradient"].SetBool(mElementRequiresLimiter);
879  }
880 
881  mElementRequiresLevelSetGradient = ThisParameters["element_settings"].Has("requires_distance_gradient") ? ThisParameters["element_settings"]["requires_distance_gradient"].GetBool() : false;
882 
883  // Convection related settings
884  mMaxAllowedCFL = ThisParameters["max_CFL"].GetDouble();
885  mMaxSubsteps = ThisParameters["max_substeps"].GetInt();
886  mIsBfecc = ThisParameters["eulerian_error_compensation"].GetBool();
887  if (mIsBfecc) {
888  mPowerBfeccLimiter = ThisParameters["BFECC_limiter_acuteness"].GetDouble();
889  }
890 
891  mMaxAllowedCFL = ThisParameters["max_CFL"].GetDouble();
892  mpLevelSetVar = &KratosComponents<Variable<double>>::Get(ThisParameters["levelset_variable_name"].GetString());
893  mpConvectVar = &KratosComponents<Variable<array_1d<double,3>>>::Get(ThisParameters["levelset_convection_variable_name"].GetString());
894  if (ThisParameters["convection_model_part_name"].GetString() == "") {
895  mAuxModelPartName = mrBaseModelPart.Name() + "_DistanceConvectionPart";
896  } else {
897  mAuxModelPartName = ThisParameters["convection_model_part_name"].GetString();
898  }
899 
900  // Limiter related settings
901  mpLevelSetGradientVar = (mIsBfecc || mElementRequiresLevelSetGradient) ? &(KratosComponents<Variable<array_1d<double, 3>>>::Get(ThisParameters["levelset_gradient_variable_name"].GetString())) : nullptr;
902  mEvaluateLimiter = (mIsBfecc || mElementRequiresLimiter) ? true : false;
903  }
904 
905  std::string GetConvectionElementRegisteredName(Parameters ThisParameters)
906  {
907  // Convection element formulation settings
908  std::string element_type = ThisParameters["element_type"].GetString();
909  const auto element_list = GetConvectionElementsList();
910  if (std::find(element_list.begin(), element_list.end(), element_type) == element_list.end()) {
911  KRATOS_INFO("") << "Specified \'" << element_type << "\' is not in the available elements list. " <<
912  "Attempting to use custom specified element." << std::endl;
913  mConvectionElementType = element_type;
914  } else {
915  mConvectionElementType = GetConvectionElementName(element_type);
916  }
917  std::string element_register_name = mConvectionElementType + std::to_string(TDim) + "D" + std::to_string(TDim + 1) + "N";
918  if (!KratosComponents<Element>::Has(element_register_name)) {
919  KRATOS_ERROR << "Specified \'" << element_type << "\' is not in the available elements list: " << element_list
920  << " and it is nor registered as a kratos element either. Please check your settings\n";
921  }
922  return element_register_name;
923  }
924 
930  const virtual inline std::vector<std::string> GetConvectionElementsList()
931  {
932  std::vector<std::string> elements_list = {
933  "levelset_convection_supg",
934  "levelset_convection_algebraic_stabilization"
935  };
936  return elements_list;
937  }
938 
945  const virtual std::string GetConvectionElementName(std::string InputName)
946  {
947  const std::map<std::string, std::string> elements_name_map {
948  {"levelset_convection_supg","LevelSetConvectionElementSimplex"},
949  {"levelset_convection_algebraic_stabilization", "LevelSetConvectionElementSimplexAlgebraicStabilization"}
950  };
951  return elements_name_map.at(InputName);
952  }
953 
960  const virtual Parameters GetConvectionElementDefaultParameters(const std::string ElementType)
961  {
962  Parameters default_parameters;
963  if (ElementType == "levelset_convection_supg") {
964  default_parameters = Parameters(R"({
965  "dynamic_tau" : 0.0,
966  "cross_wind_stabilization_factor" : 0.7,
967  "requires_distance_gradient" : false,
968  "time_integration_theta" : 0.5,
969  "tau_nodal": false
970  })");
971  } else if (ElementType == "levelset_convection_algebraic_stabilization") {
972  default_parameters = Parameters(R"({
973  "include_anti_diffusivity_terms" : false,
974  "elemental_limiter_acuteness" : 4.0,
975  "requires_distance_gradient" : false,
976  "time_integration_theta" : 0.5
977  })");
978  }
979 
980  return default_parameters;
981  }
982 
989  const virtual std::function<void(ModelPart&)> GetFillProcessInfoFormulationDataFunction()
990  {
991  std::function<void(ModelPart&)> fill_process_info_function;
992 
993  if (mConvectionElementType == "LevelSetConvectionElementSimplex") {
994  fill_process_info_function = [this](ModelPart &rModelPart) {
995  auto &r_process_info = rModelPart.GetProcessInfo();
996  r_process_info.SetValue(DYNAMIC_TAU, mLevelSetConvectionSettings["element_settings"]["dynamic_tau"].GetDouble());
997  r_process_info.SetValue(CROSS_WIND_STABILIZATION_FACTOR, mLevelSetConvectionSettings["element_settings"]["cross_wind_stabilization_factor"].GetDouble());
998  r_process_info.SetValue(TIME_INTEGRATION_THETA, mLevelSetConvectionSettings["element_settings"]["time_integration_theta"].GetDouble());
999  };
1000  } else if (mConvectionElementType == "LevelSetConvectionElementSimplexAlgebraicStabilization") {
1001  fill_process_info_function = [this](ModelPart &rModelPart) {
1002  auto &r_process_info = rModelPart.GetProcessInfo();
1003  r_process_info.SetValue(TIME_INTEGRATION_THETA, mLevelSetConvectionSettings["element_settings"]["time_integration_theta"].GetDouble());
1004  };
1005  } else {
1006  fill_process_info_function = [](ModelPart &rModelPart) {};
1007  }
1008 
1009  return fill_process_info_function;
1010  }
1011 
1012  void InitializeConvectionStrategy(BuilderAndSolverPointerType pBuilderAndSolver)
1013  {
1014  // Check that there is at least one element and node in the model
1015  KRATOS_ERROR_IF(mrBaseModelPart.NumberOfNodes() == 0) << "The model has no nodes." << std::endl;
1016  KRATOS_ERROR_IF(mrBaseModelPart.NumberOfElements() == 0) << "The model has no elements." << std::endl;
1017 
1018  // Check that the level set and convection variables are in the nodal database
1019  VariableUtils().CheckVariableExists<Variable<double>>(*mpLevelSetVar, mrBaseModelPart.Nodes());
1020  VariableUtils().CheckVariableExists<Variable<array_1d<double,3>>>(*mpConvectVar, mrBaseModelPart.Nodes());
1021 
1022  // Check the base model part element family (only simplex elements are supported)
1023  if constexpr (TDim == 2){
1024  KRATOS_ERROR_IF(mrBaseModelPart.ElementsBegin()->GetGeometry().GetGeometryFamily() != GeometryData::KratosGeometryFamily::Kratos_Triangle) <<
1025  "In 2D the element type is expected to be a triangle" << std::endl;
1026  } else if constexpr (TDim == 3) {
1027  KRATOS_ERROR_IF(mrBaseModelPart.ElementsBegin()->GetGeometry().GetGeometryFamily() != GeometryData::KratosGeometryFamily::Kratos_Tetrahedra) <<
1028  "In 3D the element type is expected to be a tetrahedra" << std::endl;
1029  }
1030 
1031  // Generate an auxilary model part and populate it by elements of type DistanceCalculationElementSimplex
1032  ReGenerateConvectionModelPart(mrBaseModelPart);
1033 
1034  // Generate a linear strategy
1035  bool CalculateReactions = false;
1036  bool ReformDofAtEachIteration = false;
1037  bool CalculateNormDxFlag = false;
1038  auto p_scheme = Kratos::make_shared<ResidualBasedIncrementalUpdateStaticScheme<TSparseSpace,TDenseSpace>>();
1039  mpSolvingStrategy = Kratos::make_unique< ResidualBasedLinearStrategy<TSparseSpace,TDenseSpace,TLinearSolver > >(
1040  *mpDistanceModelPart,
1041  p_scheme,
1042  pBuilderAndSolver,
1043  CalculateReactions,
1045  CalculateNormDxFlag);
1046 
1047  mpSolvingStrategy->SetEchoLevel(mLevelSetConvectionSettings["echo_level"].GetInt());
1048  mpSolvingStrategy->Check();
1049  mpSolvingStrategy->Initialize();
1050  }
1051 
1055 
1059 
1063 
1065  LevelSetConvectionProcess& operator=(LevelSetConvectionProcess const& rOther);
1066 
1068 }; // Class LevelSetConvectionProcess
1069 
1073 
1077 
1079 template< unsigned int TDim, class TSparseSpace, class TDenseSpace, class TLinearSolver>
1080 inline std::istream& operator >> (
1081  std::istream& rIStream,
1083 
1085 template< unsigned int TDim, class TSparseSpace, class TDenseSpace, class TLinearSolver>
1086 inline std::ostream& operator << (
1087  std::ostream& rOStream,
1089 
1090  rThis.PrintInfo(rOStream);
1091  rOStream << std::endl;
1092  rThis.PrintData(rOStream);
1093 
1094  return rOStream;
1095 }
1097 
1098 } // namespace Kratos.
1099 
1100 #endif // KRATOS_LEVELSET_CONVECTION_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 const DataCommunicator & GetDataCommunicator() const
Definition: communicator.cpp:340
Compute Nodal Gradient process.
Definition: compute_nodal_gradient_process.h:123
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
Base class for all Elements.
Definition: element.h:60
virtual Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, PropertiesType::Pointer pProperties) const
It creates a new element pointer.
Definition: element.h:202
Computes NODAL_H.
Definition: find_nodal_h_process.h:69
TVariableType::Type & GetValue(const TVariableType &rThisVariable)
Definition: geometrical_object.h:248
static void CalculateGeometryData(const GeometryType &rGeometry, BoundedMatrix< double, 4, 3 > &rDN_DX, array_1d< double, 4 > &rN, double &rVolume)
This function is designed to compute the shape function derivatives, shape functions and volume in 3D...
Definition: geometry_utilities.h:176
A template class for handling communication related to global pointers.
Definition: pointer_communicator.h:178
ResultsProxy< TPointerDataType, TFunctorType > Apply(TFunctorType &&UserFunctor)
Applies a user-provided function to the global pointers and return a proxy to the results.
Definition: pointer_communicator.h:266
This class is a wrapper for a pointer to a data that is located in a different rank.
Definition: global_pointer.h:44
This class is a vector which stores global pointers.
Definition: global_pointers_vector.h:61
void push_back(TPointerType x)
Definition: global_pointers_vector.h:322
size_type size() const
Definition: global_pointers_vector.h:307
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 is useful for index iteration over containers.
Definition: parallel_utilities.h:451
void for_each(TUnaryFunction &&f)
Definition: parallel_utilities.h:514
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
void clear()
Definition: amatrix_interface.h:284
static bool Has(const std::string &rName)
Check if the given name exists in the set of components.
Definition: kratos_components.h:161
static const TComponentType & Get(const std::string &rName)
Retrieves a component with the specified name.
Definition: kratos_components.h:114
Short class definition.
Definition: levelset_convection_process.h:71
Vector mError
Definition: levelset_convection_process.h:422
std::vector< array_1d< double, 3 > > mVelocityOld
Definition: levelset_convection_process.h:434
Vector mOldDistance
Definition: levelset_convection_process.h:424
void ErrorCalculationAndCorrection()
Eulerian error calculation and correction This function implements the Backward Forward Error Compens...
Definition: levelset_convection_process.h:782
LevelSetConvectionProcess(ModelPart &rBaseModelPart, typename TLinearSolver::Pointer pLinearSolver, Parameters ThisParameters)
Construct a new Level Set Convection Process object Level set convection proces model part constructo...
Definition: levelset_convection_process.h:149
bool mDistancePartIsInitialized
Definition: levelset_convection_process.h:436
Vector mSigmaPlus
Definition: levelset_convection_process.h:426
BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::Pointer BuilderAndSolverPointerType
Definition: levelset_convection_process.h:109
SolvingStrategyType::UniquePointer mpSolvingStrategy
Definition: levelset_convection_process.h:438
LevelSetConvectionProcess(LevelSetConvectionProcess const &rOther)=delete
Copy constructor.
virtual void ReGenerateConvectionModelPart(ModelPart &rBaseModelPart)
Definition: levelset_convection_process.h:513
Parameters mLevelSetConvectionSettings
Definition: levelset_convection_process.h:446
double mPowerBfeccLimiter
Definition: levelset_convection_process.h:418
ComputeGradientProcessType::Pointer ComputeGradientProcessPointerType
Definition: levelset_convection_process.h:111
std::vector< array_1d< double, 3 > > mVelocity
Definition: levelset_convection_process.h:432
const Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: levelset_convection_process.h:331
bool mElementRequiresLimiter
Definition: levelset_convection_process.h:408
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: levelset_convection_process.h:369
Vector mSigmaMinus
Definition: levelset_convection_process.h:428
std::string mConvectionElementType
Definition: levelset_convection_process.h:442
bool mElementRequiresLevelSetGradient
Definition: levelset_convection_process.h:414
double mMaxAllowedCFL
Definition: levelset_convection_process.h:402
std::string Info() const override
Turn back information as a string.
Definition: levelset_convection_process.h:364
bool mElementTauNodal
Definition: levelset_convection_process.h:410
unsigned int mMaxSubsteps
Definition: levelset_convection_process.h:404
void Clear() override
This method clears the assignation of the conditions.
Definition: levelset_convection_process.h:310
const Element * mpConvectionFactoryElement
Definition: levelset_convection_process.h:444
bool mCalculateNodalH
Definition: levelset_convection_process.h:412
void SetConvectionProblemSettings()
Set the level set convection formulation settings This method sets the convection diffusion settings ...
Definition: levelset_convection_process.h:490
Model & mrModel
Definition: levelset_convection_process.h:392
KRATOS_CLASS_POINTER_DEFINITION(LevelSetConvectionProcess)
Pointer definition of LevelSetConvectionProcess.
LevelSetConvectionProcess(ModelPart &rModelPart, Parameters ThisParameters)
Definition: levelset_convection_process.h:459
const Variable< array_1d< double, 3 > > * mpConvectVar
Definition: levelset_convection_process.h:398
LevelSetConvectionProcess(Model &rModel, typename TLinearSolver::Pointer pLinearSolver, Parameters ThisParameters)
Construct a new Level Set Convection Process object Level set convection proces model constructor.
Definition: levelset_convection_process.h:131
ComputeGradientProcessPointerType mpGradientCalculator
Definition: levelset_convection_process.h:448
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: levelset_convection_process.h:374
double mPowerElementalLimiter
Definition: levelset_convection_process.h:420
Vector mLimiter
Definition: levelset_convection_process.h:430
const Variable< array_1d< double, 3 > > * mpLevelSetGradientVar
Definition: levelset_convection_process.h:400
void ComputeNodalH()
Nodal H calculation This function calculates the nodal h by executing a process where the nodal h cal...
Definition: levelset_convection_process.h:823
void InitializeDistanceModelPartDatabases()
Initializes the databases values This function initializes is intended to collect all the database in...
Definition: levelset_convection_process.h:586
void Execute() override
Perform the level-set convection This solver provides a stabilized convection solver based on [Codina...
Definition: levelset_convection_process.h:194
std::string mAuxModelPartName
Definition: levelset_convection_process.h:440
void operator()()
Definition: levelset_convection_process.h:178
const Variable< double > * mpLevelSetVar
Definition: levelset_convection_process.h:396
ComputeNodalGradientProcess< ComputeNodalGradientProcessSettings::SaveAsNonHistoricalVariable > ComputeGradientProcessType
Definition: levelset_convection_process.h:110
ImplicitSolvingStrategy< TSparseSpace, TDenseSpace, TLinearSolver > SolvingStrategyType
Definition: levelset_convection_process.h:108
unsigned int EvaluateNumberOfSubsteps()
Definition: levelset_convection_process.h:602
bool mIsBfecc
Definition: levelset_convection_process.h:406
~LevelSetConvectionProcess() override
Destructor.
Definition: levelset_convection_process.h:169
ModelPart * mpDistanceModelPart
Definition: levelset_convection_process.h:394
void EvaluateLimiter()
Convection limiter evaluation This function implements the limiter evaluation Note that both the stan...
Definition: levelset_convection_process.h:655
bool mEvaluateLimiter
Definition: levelset_convection_process.h:416
ModelPart & mrBaseModelPart
Definition: levelset_convection_process.h:390
This class aims to manage different model parts across multi-physics simulations.
Definition: model.h:60
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
void SetProcessInfo(ProcessInfo::Pointer pNewProcessInfo)
Definition: model_part.h:1766
ProcessInfo::Pointer pGetProcessInfo()
Definition: model_part.h:1756
PropertiesIterator PropertiesBegin(IndexType ThisIndex=0)
Definition: model_part.h:978
Communicator & GetCommunicator()
Definition: model_part.h:1821
void SetBufferSize(IndexType NewBufferSize)
This method sets the suffer size of the model part database.
Definition: model_part.cpp:2171
IndexType GetBufferSize() const
This method gets the suffer size of the model part database.
Definition: model_part.h:1876
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
ConditionsContainerType & Conditions(IndexType ThisIndex=0)
Definition: model_part.h:1381
SizeType NumberOfElements(IndexType ThisIndex=0) const
Definition: model_part.h:1027
void AddProperties(PropertiesType::Pointer pNewProperties, IndexType ThisIndex=0)
Inserts a properties in the current mesh.
Definition: model_part.cpp:582
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
ElementIterator ElementsEnd(IndexType ThisIndex=0)
Definition: model_part.h:1179
TablesContainerType & Tables()
Definition: model_part.h:635
SizeType NumberOfNodes(IndexType ThisIndex=0) const
Definition: model_part.h:341
PropertiesIterator PropertiesEnd(IndexType ThisIndex=0)
Definition: model_part.h:988
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
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
double GetDouble() const
This method returns the double contained in the current Parameter.
Definition: kratos_parameters.cpp:657
int GetInt() const
This method returns the integer contained in the current Parameter.
Definition: kratos_parameters.cpp:666
void SetBool(const bool Value)
This method sets the bool contained in the current Parameter.
Definition: kratos_parameters.cpp:803
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
bool Has(const std::string &rEntry) const
This method checks if the Parameter contains a certain entry.
Definition: kratos_parameters.cpp:520
bool GetBool() const
This method returns the boolean contained in the current Parameter.
Definition: kratos_parameters.cpp:675
The base class for all processes in Kratos.
Definition: process.h:49
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
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
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
std::istream & operator>>(std::istream &rIStream, LevelSetConvectionProcess< TDim, TSparseSpace, TDenseSpace, TLinearSolver > &rThis)
Input stream function.
std::ostream & operator<<(std::ostream &rOStream, const LevelSetConvectionProcess< TDim, TSparseSpace, TDenseSpace, TLinearSolver > &rThis)
Output stream function.
Definition: levelset_convection_process.h:1086
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
#define KRATOS_INFO(label)
Definition: logger.h:250
#define KRATOS_INFO_IF(label, conditional)
Definition: logger.h:251
Kratos::ModelPart ModelPart
Definition: kratos_wrapper.h:31
dt
Definition: DEM_benchmarks.py:173
static double max(double a, double b)
Definition: GeometryFunctions.h:79
static double min(double a, double b)
Definition: GeometryFunctions.h:71
bool Has(const std::string &ModelerName)
Checks if the modeler is registered.
Definition: modeler_factory.cpp:24
Parameters GetValue(Parameters &rParameters, const std::string &rEntry)
Definition: add_kratos_parameters_to_python.cpp:53
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
TExpressionType::data_type norm_2(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression)
Definition: amatrix_interface.h:625
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
TExpression1Type::data_type inner_prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:592
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
list fraction
Definition: angle_finder.py:11
int n_steps
Definition: bombardelli_test.py:27
int step
Definition: face_heat.py:88
float dynamic_tau
Definition: fluid_only_var.py:11
tau
Definition: generate_convection_diffusion_explicit_element.py:115
h
Definition: generate_droplet_dynamics.py:91
vgauss
Definition: generate_stokes_twofluid_element.py:52
int n_nodes
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:15
element_type
Choosing element type for lagrangian_model_part.
Definition: lagrangian_droplet_test.py:56
list element_list
Definition: mesh_to_mdpa_converter.py:43
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
N
Definition: sensitivityMatrix.py:29
integer i
Definition: TensorModule.f:17
ReformDofAtEachIteration
Definition: test_pureconvectionsolver_benchmarking.py:131