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.
fs_strategy_for_chimera.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 //
8 // License: BSD License
9 // Kratos default license: kratos/license.txt
10 //
11 // Authors: Aditya Ghantasala, https://github.com/adityaghantasala
12 // Navaneeth K Narayanan
13 // Rishith Ellath Meethal
14 //
15 
16 #ifndef KRATOS_FS_STRATEGY_FOR_CHIMERA_H
17 #define KRATOS_FS_STRATEGY_FOR_CHIMERA_H
18 
19 #include "includes/define.h"
20 #include "utilities/openmp_utils.h"
21 // FluidDynamicsApp Includes
23 // Application includes
26 
27 
28 
29 namespace Kratos {
30 
33 
36 
37 
41 
43 
44 
47 
48 
52 
53 
54 
58 
59 template<class TSparseSpace,
60 class TDenseSpace,
61 class TLinearSolver
62 >
63 class FractionalStepStrategyForChimera : public FractionalStepStrategy<TSparseSpace,TDenseSpace,TLinearSolver>
64 {
65 public:
68 
71 
73 
75 
79 
81  SolverSettingsType& rSolverConfig,
82  bool PredictorCorrector):
83  BaseType(rModelPart,rSolverConfig,PredictorCorrector)
84  {
85  KRATOS_WARNING("FractionalStepStrategyForChimera") << "This constructor is deprecated. Use the one with the \'CalculateReactionsFlag\' instead." << std::endl;
86  this->InitializeStrategy(rSolverConfig,PredictorCorrector);
87  }
88 
90  ModelPart &rModelPart,
91  SolverSettingsType &rSolverConfig,
92  bool PredictorCorrector,
93  bool CalculateReactionsFlag)
94  : BaseType(rModelPart, rSolverConfig, PredictorCorrector, CalculateReactionsFlag)
95  {
96  this->InitializeStrategy(rSolverConfig,PredictorCorrector);
97  }
98 
101 
102 
105 
108 
109 
110 
114 
115 
119 
123 
124 
128 
129 
133 
135  std::string Info() const override
136  {
137  std::stringstream buffer;
138  buffer << "FractionalStepStrategyForChimera" ;
139  return buffer.str();
140  }
141 
143  void PrintInfo(std::ostream& rOStream) const override {rOStream << "FractionalStepStrategyForChimera";}
144 
146  void PrintData(std::ostream& rOStream) const override {}
147 
148 
152 
153 
155 
156 protected:
157 
160 
161 
165 
166 
170 
171 
175 
176 
180 
181  std::tuple<bool,double> SolveStep() override
182  {
183 
184  double start_solve_time = OpenMPUtils::GetCurrentTime();
185  ModelPart& r_model_part = BaseType::GetModelPart();
186 
187  // 1. Fractional step momentum iteration
188  r_model_part.GetProcessInfo().SetValue(FRACTIONAL_STEP,1);
189 
190  bool converged = false;
191 
192  for(std::size_t it = 0; it < BaseType::mMaxVelocityIter; ++it)
193  {
194  KRATOS_INFO("FRACTIONAL STEP :: ")<<it+1<<std::endl;
195  // build momentum system and solve for fractional step velocity increment
196  r_model_part.GetProcessInfo().SetValue(FRACTIONAL_STEP,1);
197  double norm_dv = BaseType::mpMomentumStrategy->Solve();
198 
199  // Check convergence
200  converged = BaseType::CheckFractionalStepConvergence(norm_dv);
201 
202  if (converged)
203  {
204  KRATOS_INFO_IF("FractionalStepStrategyForChimera ", BaseType::GetEchoLevel() > 0 )<<
205  "Fractional velocity converged in " << it+1 << " iterations." << std::endl;
206  break;
207  }
208  }
209 
210  KRATOS_INFO_IF("FractionalStepStrategyForChimera ", (BaseType::GetEchoLevel() > 0) && !converged)<<
211  "Fractional velocity iterations did not converge "<< std::endl;
212 
213  // Compute projections (for stabilization)
214  r_model_part.GetProcessInfo().SetValue(FRACTIONAL_STEP,4);
215  ComputeSplitOssProjections(r_model_part);
216 
217  // 2. Pressure solution (store pressure variation in PRESSURE_OLD_IT)
218  r_model_part.GetProcessInfo().SetValue(FRACTIONAL_STEP,5);
219 
220  #pragma omp parallel
221  {
222  ModelPart::NodeIterator nodes_begin;
223  ModelPart::NodeIterator nodes_end;
224  OpenMPUtils::PartitionedIterators(r_model_part.Nodes(),nodes_begin,nodes_end);
225 
226  for (ModelPart::NodeIterator it_node = nodes_begin; it_node != nodes_end; ++it_node)
227  {
228  const double old_press = it_node->FastGetSolutionStepValue(PRESSURE);
229  it_node->FastGetSolutionStepValue(PRESSURE_OLD_IT) = -old_press;
230  }
231  }
232 
233  KRATOS_INFO_IF("FractionalStepStrategyForChimera ", BaseType::GetEchoLevel() > 0 )<<
234  "Calculating Pressure."<< std::endl;
235  //double norm_dp = 0;
236  double norm_dp = BaseType::mpPressureStrategy->Solve();
237 
238 #pragma omp parallel
239  {
240  ModelPart::NodeIterator nodes_begin;
241  ModelPart::NodeIterator nodes_end;
242  OpenMPUtils::PartitionedIterators(r_model_part.Nodes(),nodes_begin,nodes_end);
243 
244  for (ModelPart::NodeIterator it_node = nodes_begin; it_node != nodes_end; ++it_node)
245  it_node->FastGetSolutionStepValue(PRESSURE_OLD_IT) += it_node->FastGetSolutionStepValue(PRESSURE);
246 
247  }
248 
249  // 3. Compute end-of-step velocity
250  KRATOS_INFO_IF("FractionalStepStrategyForChimera ", BaseType::GetEchoLevel() > 0 )<<"Updating Velocity." << std::endl;
251  r_model_part.GetProcessInfo().SetValue(FRACTIONAL_STEP,6);
253 
254  // Additional steps
255  for (std::vector<Process::Pointer>::iterator iExtraSteps = BaseType::mExtraIterationSteps.begin();
256  iExtraSteps != BaseType::mExtraIterationSteps.end(); ++iExtraSteps)
257  (*iExtraSteps)->Execute();
258 
259  const double stop_solve_time = OpenMPUtils::GetCurrentTime();
260  KRATOS_INFO_IF("FractionalStepStrategyForChimera", BaseType::GetEchoLevel() >= 1) << "Time for solving step : " << stop_solve_time - start_solve_time << std::endl;
261 
262  // Set the output tuple as the fractional velocity convergence and pressure norm
263  return std::make_tuple(converged, norm_dp);
264  }
265 
266 
267 
268  void ComputeSplitOssProjections(ModelPart& rModelPart) override
269  {
270  const array_1d<double,3> zero(3,0.0);
271 
272  array_1d<double,3> out(3,0.0);
273 
274 #pragma omp parallel
275  {
276  ModelPart::NodeIterator nodes_begin;
277  ModelPart::NodeIterator nodes_end;
278  OpenMPUtils::PartitionedIterators(rModelPart.Nodes(),nodes_begin,nodes_end);
279 
280  for ( ModelPart::NodeIterator it_node = nodes_begin; it_node != nodes_end; ++it_node )
281  {
282  it_node->FastGetSolutionStepValue(CONV_PROJ) = zero;
283  it_node->FastGetSolutionStepValue(PRESS_PROJ) = zero;
284  it_node->FastGetSolutionStepValue(DIVPROJ) = 0.0;
285  it_node->FastGetSolutionStepValue(NODAL_AREA) = 0.0;
286  }
287  }
288 
289 #pragma omp parallel
290  {
291  ModelPart::ElementIterator elem_begin;
293  OpenMPUtils::PartitionedIterators(rModelPart.Elements(),elem_begin,elem_end);
294 
295  for ( ModelPart::ElementIterator it_elem = elem_begin; it_elem != elem_end; ++it_elem )
296  {
297  it_elem->Calculate(CONV_PROJ,out,rModelPart.GetProcessInfo());
298  }
299  }
300 
301  rModelPart.GetCommunicator().AssembleCurrentData(CONV_PROJ);
302  rModelPart.GetCommunicator().AssembleCurrentData(PRESS_PROJ);
303  rModelPart.GetCommunicator().AssembleCurrentData(DIVPROJ);
304  rModelPart.GetCommunicator().AssembleCurrentData(NODAL_AREA);
305 
306  // If there are periodic conditions, add contributions from both sides to the periodic nodes
307  //PeriodicConditionProjectionCorrection(rModelPart);
308  ChimeraProjectionCorrection(rModelPart);
309 #pragma omp parallel
310  {
311  ModelPart::NodeIterator nodes_begin;
312  ModelPart::NodeIterator nodes_end;
313  OpenMPUtils::PartitionedIterators(rModelPart.Nodes(),nodes_begin,nodes_end);
314 
315  for ( ModelPart::NodeIterator it_node = nodes_begin; it_node != nodes_end; ++it_node )
316  {
317  const double nodal_area = it_node->FastGetSolutionStepValue(NODAL_AREA);
318  if( nodal_area > mAreaTolerance )
319  {
320  it_node->FastGetSolutionStepValue(CONV_PROJ) /= nodal_area;
321  it_node->FastGetSolutionStepValue(PRESS_PROJ) /= nodal_area;
322  it_node->FastGetSolutionStepValue(DIVPROJ) /= nodal_area;
323  }
324  }
325  }
326 
327 
328  //For correcting projections for chimera
329  auto &r_pre_modelpart = rModelPart.GetSubModelPart(rModelPart.Name()+"fs_pressure_model_part");
330  const auto& r_constraints_container = r_pre_modelpart.MasterSlaveConstraints();
331  for(const auto& constraint : r_constraints_container)
332  {
333  const auto& master_dofs = constraint.GetMasterDofsVector();
334  const auto& slave_dofs = constraint.GetSlaveDofsVector();
335  ModelPart::MatrixType r_relation_matrix;
336  ModelPart::VectorType r_constant_vector;
337  constraint.CalculateLocalSystem(r_relation_matrix,r_constant_vector,rModelPart.GetProcessInfo());
338 
339  IndexType slave_i = 0;
340  for(const auto& slave_dof : slave_dofs)
341  {
342  const auto slave_node_id = slave_dof->Id(); // DOF ID is same as node ID
343  auto& r_slave_node = rModelPart.Nodes()[slave_node_id];
344  IndexType master_j = 0;
345  for(const auto& master_dof : master_dofs)
346  {
347  const auto master_node_id = master_dof->Id();
348  const double weight = r_relation_matrix(slave_i, master_j);
349  auto& r_master_node = rModelPart.Nodes()[master_node_id];
350  auto& conv_proj = r_slave_node.FastGetSolutionStepValue(CONV_PROJ);
351  auto& pres_proj = r_slave_node.FastGetSolutionStepValue(PRESS_PROJ);
352  auto& dive_proj = r_slave_node.FastGetSolutionStepValue(DIVPROJ);
353  auto& nodal_area = r_slave_node.FastGetSolutionStepValue(NODAL_AREA);
354  conv_proj += (r_master_node.FastGetSolutionStepValue(CONV_PROJ))*weight;
355  pres_proj += (r_master_node.FastGetSolutionStepValue(PRESS_PROJ))*weight;
356  dive_proj += (r_master_node.FastGetSolutionStepValue(DIVPROJ))*weight;
357  nodal_area += (r_master_node.FastGetSolutionStepValue(NODAL_AREA))*weight;
358 
359  ++master_j;
360  }
361  ++slave_i;
362  }
363  }
364  }
365 
367  {
368  ModelPart& r_model_part = BaseType::GetModelPart();
369 
370  const array_1d<double,3> zero(3,0.0);
371  array_1d<double,3> out(3,0.0);
372 
373 #pragma omp parallel
374  {
375  ModelPart::NodeIterator nodes_begin;
376  ModelPart::NodeIterator nodes_end;
377  OpenMPUtils::PartitionedIterators(r_model_part.Nodes(),nodes_begin,nodes_end);
378 
379  for ( ModelPart::NodeIterator it_node = nodes_begin; it_node != nodes_end; ++it_node )
380  {
381  it_node->FastGetSolutionStepValue(FRACT_VEL) = zero;
382  }
383  }
384 
385 #pragma omp parallel
386  {
387  ModelPart::ElementIterator elem_begin;
389  OpenMPUtils::PartitionedIterators(r_model_part.Elements(),elem_begin,elem_end);
390 
391  for ( ModelPart::ElementIterator it_elem = elem_begin; it_elem != elem_end; ++it_elem )
392  {
393  it_elem->Calculate(VELOCITY,out,r_model_part.GetProcessInfo());
394  }
395  }
396 
397  r_model_part.GetCommunicator().AssembleCurrentData(FRACT_VEL);
398  //PeriodicConditionVelocityCorrection(r_model_part);
399 
400  // Force the end of step velocity to verify slip conditions in the model
403 
404  if (BaseType::mDomainSize == 2) InterpolateVelocity<2>(r_model_part);
405  if (BaseType::mDomainSize == 3) InterpolateVelocity<3>(r_model_part);
406 
407  }
408 
410  {
411  auto &r_pre_modelpart = rModelPart.GetSubModelPart(rModelPart.Name()+"fs_pressure_model_part");
412  const auto& r_constraints_container = r_pre_modelpart.MasterSlaveConstraints();
413  for(const auto& constraint : r_constraints_container)
414  {
415  const auto& slave_dofs = constraint.GetSlaveDofsVector();
416  for(const auto& slave_dof : slave_dofs)
417  {
418  const auto slave_node_id = slave_dof->Id(); // DOF ID is same as node ID
419  auto& r_slave_node = rModelPart.Nodes()[slave_node_id];
420  r_slave_node.GetValue(NODAL_AREA)= 0;
421  r_slave_node.GetValue(CONV_PROJ)= array_1d<double,3>(3,0.0);
422  r_slave_node.GetValue(PRESS_PROJ)= array_1d<double,3>(3,0.0);
423  r_slave_node.GetValue(DIVPROJ)= 0 ;
424  }
425  }
426 
427  for(const auto& constraint : r_constraints_container)
428  {
429  const auto& master_dofs = constraint.GetMasterDofsVector();
430  const auto& slave_dofs = constraint.GetSlaveDofsVector();
431  ModelPart::MatrixType r_relation_matrix;
432  ModelPart::VectorType r_constant_vector;
433  constraint.CalculateLocalSystem(r_relation_matrix,r_constant_vector,rModelPart.GetProcessInfo());
434 
435  IndexType slave_i = 0;
436  for(const auto& slave_dof : slave_dofs)
437  {
438  const IndexType slave_node_id = slave_dof->Id(); // DOF ID is same as node ID
439  auto& r_slave_node = rModelPart.Nodes()[slave_node_id];
440  IndexType master_j = 0;
441  for(const auto& master_dof : master_dofs)
442  {
443  const IndexType master_node_id = master_dof->Id();
444  const double weight = r_relation_matrix(slave_i, master_j);
445  auto& r_master_node = rModelPart.Nodes()[master_node_id];
446 
447  r_slave_node.GetValue(NODAL_AREA) +=(r_master_node.FastGetSolutionStepValue(NODAL_AREA))*weight;
448  r_slave_node.GetValue(CONV_PROJ) +=(r_master_node.FastGetSolutionStepValue(CONV_PROJ))*weight;
449  r_slave_node.GetValue(PRESS_PROJ) +=(r_master_node.FastGetSolutionStepValue(PRESS_PROJ))*weight;
450  r_slave_node.GetValue(DIVPROJ) +=(r_master_node.FastGetSolutionStepValue(DIVPROJ))*weight;
451 
452  ++master_j;
453  }
454  ++slave_i;
455  }
456  }
457 
458  rModelPart.GetCommunicator().AssembleNonHistoricalData(NODAL_AREA);
459  rModelPart.GetCommunicator().AssembleNonHistoricalData(CONV_PROJ);
460  rModelPart.GetCommunicator().AssembleNonHistoricalData(PRESS_PROJ);
461  rModelPart.GetCommunicator().AssembleNonHistoricalData(DIVPROJ);
462 
463  for (auto it_node = rModelPart.NodesBegin(); it_node != rModelPart.NodesEnd(); it_node++)
464  {
465  if (it_node->GetValue(NODAL_AREA) > mAreaTolerance)
466  {
467  it_node->FastGetSolutionStepValue(NODAL_AREA) = it_node->GetValue(NODAL_AREA);
468  it_node->FastGetSolutionStepValue(CONV_PROJ) = it_node->GetValue(CONV_PROJ);
469  it_node->FastGetSolutionStepValue(PRESS_PROJ) = it_node->GetValue(PRESS_PROJ);
470  it_node->FastGetSolutionStepValue(DIVPROJ) = it_node->GetValue(DIVPROJ);
471  // reset for next iteration
472  it_node->GetValue(NODAL_AREA) = 0.0;
473  it_node->GetValue(CONV_PROJ) = array_1d<double,3>(3,0.0);
474  it_node->GetValue(PRESS_PROJ) = array_1d<double,3>(3,0.0);
475  it_node->GetValue(DIVPROJ) = 0.0;
476  }
477  }
478  }
479 
481  {
482  auto &r_pre_modelpart = rModelPart.GetSubModelPart(rModelPart.Name()+"fs_pressure_model_part");
483  const auto& r_constraints_container = r_pre_modelpart.MasterSlaveConstraints();
484  for(const auto& constraint : r_constraints_container)
485  {
486  const auto& slave_dofs = constraint.GetSlaveDofsVector();
487  for(const auto& slave_dof : slave_dofs)
488  {
489  const auto slave_node_id = slave_dof->Id(); // DOF ID is same as node ID
490  auto& r_slave_node = rModelPart.Nodes()[slave_node_id];
491  r_slave_node.FastGetSolutionStepValue(FRACT_VEL_X)=0;
492  r_slave_node.FastGetSolutionStepValue(FRACT_VEL_Y)=0;
493  }
494  }
495 
496  for(const auto& constraint : r_constraints_container)
497  {
498  const auto& master_dofs = constraint.GetMasterDofsVector();
499  const auto& slave_dofs = constraint.GetSlaveDofsVector();
500  ModelPart::MatrixType r_relation_matrix;
501  ModelPart::VectorType r_constant_vector;
502  constraint.CalculateLocalSystem(r_relation_matrix,r_constant_vector,rModelPart.GetProcessInfo());
503 
504  IndexType slave_i = 0;
505  for(const auto& slave_dof : slave_dofs)
506  {
507  const auto slave_node_id = slave_dof->Id(); // DOF ID is same as node ID
508  auto& r_slave_node = rModelPart.Nodes()[slave_node_id];
509  IndexType master_j = 0;
510  for(const auto& master_dof : master_dofs)
511  {
512  const auto master_node_id = master_dof->Id();
513  const double weight = r_relation_matrix(slave_i, master_j);
514  auto& r_master_node = rModelPart.Nodes()[master_node_id];
515 
516  r_slave_node.GetValue(FRACT_VEL) +=(r_master_node.FastGetSolutionStepValue(FRACT_VEL))*weight;
517 
518  ++master_j;
519  }
520  ++slave_i;
521  }
522  }
523 
524  rModelPart.GetCommunicator().AssembleNonHistoricalData(FRACT_VEL);
525 
526  for (typename ModelPart::NodeIterator it_node = rModelPart.NodesBegin(); it_node != rModelPart.NodesEnd(); it_node++)
527  {
528  array_1d<double,3>& r_delta_vel = it_node->GetValue(FRACT_VEL);
529  if ( r_delta_vel[0]*r_delta_vel[0] + r_delta_vel[1]*r_delta_vel[1] + r_delta_vel[2]*r_delta_vel[2] != 0.0)
530  {
531  it_node->FastGetSolutionStepValue(FRACT_VEL) = it_node->GetValue(FRACT_VEL);
532  r_delta_vel = array_1d<double,3>(3,0.0);
533  }
534  }
535  }
536 
537 
541 
542 
546 
547 
551 
552 
554 
555 private:
558 
559 
563  const double mAreaTolerance=1E-12;
564 
568 
569 
573 
574  template <int TDim>
575  void InterpolateVelocity(ModelPart& rModelPart)
576  {
577 #pragma omp parallel
578  {
579  ModelPart::NodeIterator nodes_begin;
580  ModelPart::NodeIterator nodes_end;
581  OpenMPUtils::PartitionedIterators(rModelPart.Nodes(), nodes_begin, nodes_end);
582 
583  for (ModelPart::NodeIterator it_node = nodes_begin; it_node != nodes_end; ++it_node) {
584  const double NodalArea = it_node->FastGetSolutionStepValue(NODAL_AREA);
585  if (NodalArea > mAreaTolerance) {
586  if (!it_node->IsFixed(VELOCITY_X))
587  it_node->FastGetSolutionStepValue(VELOCITY_X) +=
588  it_node->FastGetSolutionStepValue(FRACT_VEL_X) / NodalArea;
589  if (!it_node->IsFixed(VELOCITY_Y))
590  it_node->FastGetSolutionStepValue(VELOCITY_Y) +=
591  it_node->FastGetSolutionStepValue(FRACT_VEL_Y) / NodalArea;
592  if constexpr (TDim > 2)
593  if (!it_node->IsFixed(VELOCITY_Z))
594  it_node->FastGetSolutionStepValue(VELOCITY_Z) +=
595  it_node->FastGetSolutionStepValue(FRACT_VEL_Z) / NodalArea;
596  }
597  }
598  }
599 
600  auto& r_pre_modelpart =
601  rModelPart.GetSubModelPart(rModelPart.Name()+"fs_pressure_model_part");
602  const auto& r_constraints_container = r_pre_modelpart.MasterSlaveConstraints();
603  for (const auto& constraint : r_constraints_container) {
604  const auto& slave_dofs = constraint.GetSlaveDofsVector();
605  for (const auto& slave_dof : slave_dofs) {
606  const auto slave_node_id =
607  slave_dof->Id(); // DOF ID is same as node ID
608  auto& r_slave_node = rModelPart.Nodes()[slave_node_id];
609  r_slave_node.FastGetSolutionStepValue(VELOCITY_X) = 0;
610  r_slave_node.FastGetSolutionStepValue(VELOCITY_Y) = 0;
611  if constexpr (TDim > 2)
612  r_slave_node.FastGetSolutionStepValue(VELOCITY_Z) = 0;
613  }
614  }
615 
616  for (const auto& constraint : r_constraints_container) {
617  const auto& master_dofs = constraint.GetMasterDofsVector();
618  const auto& slave_dofs = constraint.GetSlaveDofsVector();
619  ModelPart::MatrixType r_relation_matrix;
620  ModelPart::VectorType r_constant_vector;
621  constraint.CalculateLocalSystem(r_relation_matrix, r_constant_vector,
622  rModelPart.GetProcessInfo());
623 
624  IndexType slave_i = 0;
625  for (const auto& slave_dof : slave_dofs) {
626  const auto slave_node_id =
627  slave_dof->Id(); // DOF ID is same as node ID
628  auto& r_slave_node = rModelPart.Nodes()[slave_node_id];
629  IndexType master_j = 0;
630  for (const auto& master_dof : master_dofs) {
631  const auto master_node_id = master_dof->Id();
632  const double weight = r_relation_matrix(slave_i, master_j);
633  auto& r_master_node = rModelPart.Nodes()[master_node_id];
634 
635  r_slave_node.FastGetSolutionStepValue(VELOCITY_X) +=
636  (r_master_node.FastGetSolutionStepValue(VELOCITY_X)) * weight;
637  r_slave_node.FastGetSolutionStepValue(VELOCITY_Y) +=
638  (r_master_node.FastGetSolutionStepValue(VELOCITY_Y)) * weight;
639  if constexpr (TDim > 2)
640  r_slave_node.FastGetSolutionStepValue(VELOCITY_Z) +=
641  (r_master_node.FastGetSolutionStepValue(VELOCITY_Z)) * weight;
642 
643  ++master_j;
644  }
645  ++slave_i;
646  }
647  }
648  }
649 
650  void InitializeStrategy(SolverSettingsType& rSolverConfig,
651  bool PredictorCorrector)
652  {
653  KRATOS_TRY;
654 
655  BaseType::mTimeOrder = rSolverConfig.GetTimeOrder();
656 
657  // Check that input parameters are reasonable and sufficient.
658  BaseType::Check();
659 
660  //ModelPart& rModelPart = BaseType::GetModelPart();
661 
662  BaseType::mDomainSize = rSolverConfig.GetDomainSize();
663 
664  BaseType::mPredictorCorrector = PredictorCorrector;
665 
666  BaseType::mUseSlipConditions = rSolverConfig.UseSlipConditions();
667 
668  BaseType::mReformDofSet = rSolverConfig.GetReformDofSet();
669 
670  BaseType::SetEchoLevel(rSolverConfig.GetEchoLevel());
671 
672  // Initialize strategies for each step
673  bool HaveVelStrategy = rSolverConfig.FindStrategy(SolverSettingsType::Velocity,BaseType::mpMomentumStrategy);
674 
675  if (HaveVelStrategy)
676  {
677  rSolverConfig.FindTolerance(SolverSettingsType::Velocity,BaseType::mVelocityTolerance);
678  rSolverConfig.FindMaxIter(SolverSettingsType::Velocity,BaseType::mMaxVelocityIter);
679  KRATOS_INFO("FractionalStepStrategyForChimera ")<<"Velcoity strategy successfully set !"<<std::endl;
680  }
681  else
682  {
683  KRATOS_THROW_ERROR(std::runtime_error,"FS_Strategy error: No Velocity strategy defined in FractionalStepSettings","");
684  }
685 
686  bool HavePressStrategy = rSolverConfig.FindStrategy(SolverSettingsType::Pressure,BaseType::mpPressureStrategy);
687 
688  if (HavePressStrategy)
689  {
690  rSolverConfig.FindTolerance(SolverSettingsType::Pressure,BaseType::mPressureTolerance);
691  rSolverConfig.FindMaxIter(SolverSettingsType::Pressure,BaseType::mMaxPressureIter);
692 
693  KRATOS_INFO("FractionalStepStrategyForChimera ")<<"Pressure strategy successfully set !"<<std::endl;
694  }
695  else
696  {
697  KRATOS_THROW_ERROR(std::runtime_error,"FS_Strategy error: No Pressure strategy defined in FractionalStepSettings","");
698  }
699 
700  // Check input parameters
701  BaseType::Check();
702 
703  KRATOS_CATCH("");
704  }
705 
706 
710 
711 
715 
716 
720 
722 
723 };
724 
728 
729 
731 
733 
734 } // namespace Kratos.
735 
736 #endif // KRATOS_FS_STRATEGY_FOR_CHIMERA_H
virtual bool AssembleNonHistoricalData(Variable< int > const &ThisVariable)
Definition: communicator.cpp:527
virtual bool AssembleCurrentData(Variable< int > const &ThisVariable)
Definition: communicator.cpp:502
void SetValue(const Variable< TDataType > &rThisVariable, TDataType const &rValue)
Sets the value for a given variable.
Definition: data_value_container.h:320
Helper class to define solution strategies for FS_Strategy.
Definition: fractional_step_settings_for_chimera.h:78
Definition: fs_strategy_for_chimera.h:64
std::string Info() const override
Turn back information as a string.
Definition: fs_strategy_for_chimera.h:135
void ChimeraProjectionCorrection(ModelPart &rModelPart)
Definition: fs_strategy_for_chimera.h:409
void ComputeSplitOssProjections(ModelPart &rModelPart) override
Definition: fs_strategy_for_chimera.h:268
FractionalStepSettingsForChimera< TSparseSpace, TDenseSpace, TLinearSolver > SolverSettingsType
Definition: fs_strategy_for_chimera.h:74
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: fs_strategy_for_chimera.h:143
KRATOS_CLASS_POINTER_DEFINITION(FractionalStepStrategyForChimera)
Counted pointer of FractionalStepStrategyForChimera.
std::tuple< bool, double > SolveStep() override
Definition: fs_strategy_for_chimera.h:181
FractionalStepStrategyForChimera(ModelPart &rModelPart, SolverSettingsType &rSolverConfig, bool PredictorCorrector)
Definition: fs_strategy_for_chimera.h:80
FractionalStepStrategyForChimera(FractionalStepStrategyForChimera const &rOther)=delete
Copy constructor.
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: fs_strategy_for_chimera.h:146
void CalculateEndOfStepVelocity() override
Definition: fs_strategy_for_chimera.h:366
FractionalStepStrategyForChimera & operator=(FractionalStepStrategyForChimera const &rOther)=delete
Assignment operator.
~FractionalStepStrategyForChimera()=default
Destructor.
void ChimeraVelocityCorrection(ModelPart &rModelPart)
Definition: fs_strategy_for_chimera.h:480
FractionalStepStrategy< TSparseSpace, TDenseSpace, TLinearSolver > BaseType
Definition: fs_strategy_for_chimera.h:72
FractionalStepStrategyForChimera(ModelPart &rModelPart, SolverSettingsType &rSolverConfig, bool PredictorCorrector, bool CalculateReactionsFlag)
Definition: fs_strategy_for_chimera.h:89
Fractional-step strategy for incompressible Navier-Stokes formulation This strategy implements a spli...
Definition: fractional_step_strategy.h:77
double mVelocityTolerance
Definition: fractional_step_strategy.h:413
unsigned int mMaxPressureIter
Definition: fractional_step_strategy.h:421
int Check() override
Function to perform expensive checks.
Definition: fractional_step_strategy.h:183
std::vector< Process::Pointer > mExtraIterationSteps
Definition: fractional_step_strategy.h:441
StrategyPointerType mpMomentumStrategy
Scheme for the solution of the momentum equation.
Definition: fractional_step_strategy.h:436
void EnforceSlipCondition(const Kratos::Flags &rSlipWallFlag)
Substract wall-normal component of velocity update to ensure that the final velocity satisfies slip c...
Definition: fractional_step_strategy.h:730
double mPressureTolerance
Definition: fractional_step_strategy.h:415
bool CheckFractionalStepConvergence(const double NormDv)
Definition: fractional_step_strategy.h:578
StrategyPointerType mpPressureStrategy
Scheme for the solution of the mass equation.
Definition: fractional_step_strategy.h:439
void SetEchoLevel(int Level) override
This sets the level of echo for the solving strategy.
Definition: fractional_step_strategy.h:341
bool mReformDofSet
Definition: fractional_step_strategy.h:431
unsigned int mMaxVelocityIter
Definition: fractional_step_strategy.h:419
bool mPredictorCorrector
Definition: fractional_step_strategy.h:427
unsigned int mTimeOrder
Definition: fractional_step_strategy.h:425
bool mUseSlipConditions
Definition: fractional_step_strategy.h:429
unsigned int mDomainSize
Definition: fractional_step_strategy.h:423
static std::string Name()
Returns the name of the class as used in the settings (snake_case format)
Definition: implicit_solving_strategy.h:188
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
MasterSlaveConstraintContainerType & MasterSlaveConstraints(IndexType ThisIndex=0)
Definition: model_part.h:654
Communicator & GetCommunicator()
Definition: model_part.h:1821
std::string & Name()
Definition: model_part.h:1811
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
MeshType::NodeIterator NodeIterator
Definition: model_part.h:134
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
MeshType::ElementIterator ElementIterator
Definition: model_part.h:174
ModelPart & GetSubModelPart(std::string const &SubModelPartName)
Definition: model_part.cpp:2029
NodeIterator NodesEnd(IndexType ThisIndex=0)
Definition: model_part.h:497
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
static void PartitionedIterators(TVector &rVector, typename TVector::iterator &rBegin, typename TVector::iterator &rEnd)
Generate a partition for an std::vector-like array, providing iterators to the begin and end position...
Definition: openmp_utils.h:179
@ Velocity
Definition: solver_settings.h:66
@ Pressure
Definition: solver_settings.h:66
Solving strategy base class This is the base class from which we will derive all the strategies (impl...
Definition: solving_strategy.h:64
ModelPart & GetModelPart()
Operations to get the pointer to the model.
Definition: solving_strategy.h:350
int GetEchoLevel()
This returns the level of echo for the solving strategy.
Definition: solving_strategy.h:271
#define KRATOS_THROW_ERROR(ExceptionType, ErrorMessage, MoreInfo)
Definition: define.h:77
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
std::size_t IndexType
The definition of the index type.
Definition: key_hash.h:35
#define KRATOS_INFO(label)
Definition: logger.h:250
#define KRATOS_INFO_IF(label, conditional)
Definition: logger.h:251
#define KRATOS_WARNING(label)
Definition: logger.h:265
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
E
Definition: generate_hyper_elastic_simo_taylor_neo_hookean.py:26
out
Definition: isotropic_damage_automatic_differentiation.py:200
tuple const
Definition: ode_solve.py:403
zero
Definition: test_pureconvectionsolver_benchmarking.py:94