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.
flux_corrected_shallow_water_scheme.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: Miguel Maso Sotomayor
11 //
12 
13 #ifndef KRATOS_FLUX_CORRECTED_SHALLOW_WATER_SCHEME_H_INCLUDED
14 #define KRATOS_FLUX_CORRECTED_SHALLOW_WATER_SCHEME_H_INCLUDED
15 
16 // System includes
17 
18 // External includes
19 
20 // Project includes
25 
26 namespace Kratos
27 {
42 
54 template<class TSparseSpace, class TDenseSpace>
56  : public ShallowWaterResidualBasedBDFScheme<TSparseSpace, TDenseSpace>
57 {
58 public:
62 
64 
66 
68 
70 
71  typedef typename BaseType::Pointer BaseTypePointer;
72 
74 
76 
78 
80 
82 
83  typedef typename ModelPart::NodeType NodeType;
84 
88 
89  // Constructor
90  explicit FluxCorrectedShallowWaterScheme(const std::size_t Order = 2, bool UpdateVelocities = false)
92  , mLimiters()
93  {}
94 
95  // Constructor with parameters
97  : SWBaseType(GetOrder(ThisParameters), GetUpdateVelocities(ThisParameters))
98  , mLimiters(GetLimiterParameters(ThisParameters))
99  {}
100 
101  // Copy Constructor
103  : SWBaseType(rOther), mLimiters(rOther.mLimiters)
104  {}
105 
110  {
112  }
113 
114  // Destructor
116 
120 
124 
130  void Initialize(ModelPart& rModelPart) override
131  {
132  // Memory allocation
134  mMl.resize(num_threads);
135 
136  // Initialization of non-historical variables
137  block_for_each(rModelPart.Nodes(), [&](NodeType& r_node){
138  r_node.SetValue(POSITIVE_FLUX, ZeroVector(mLimiters.size()));
139  r_node.SetValue(NEGATIVE_FLUX, ZeroVector(mLimiters.size()));
140  r_node.SetValue(POSITIVE_RATIO, 1.0);
141  r_node.SetValue(NEGATIVE_RATIO, 1.0);
142  });
143  block_for_each(rModelPart.Elements(), [&](Element& r_elem){
144  r_elem.SetValue(CUMULATIVE_CORRECTIONS, ZeroVector(3*r_elem.GetGeometry().size()));
145  });
146  block_for_each(rModelPart.Conditions(), [&](Condition& r_cond){
147  r_cond.SetValue(CUMULATIVE_CORRECTIONS, ZeroVector(3*r_cond.GetGeometry().size()));
148  });
149 
150  // Initialization and execution of nodal neighbours search
152 
153  // Finalization of initialize
154  SWBaseType::Initialize(rModelPart);
155  }
156 
165  ModelPart& rModelPart,
166  TSystemMatrixType& rA,
167  TSystemVectorType& rDx,
169  ) override
170  {
171  SWBaseType::InitializeSolutionStep(rModelPart, rA, rDx, rb);
172 
173  block_for_each(rModelPart.Elements(), [&](Element& r_elem){
174  r_elem.GetValue(CUMULATIVE_CORRECTIONS) = ZeroVector(3*r_elem.GetGeometry().size());
175  });
176  block_for_each(rModelPart.Conditions(), [&](Condition& r_cond){
177  r_cond.GetValue(CUMULATIVE_CORRECTIONS) = ZeroVector(3*r_cond.GetGeometry().size());
178  });
179  }
180 
189  ModelPart& rModelPart,
190  TSystemMatrixType& rA,
191  TSystemVectorType& rDx,
193  ) override
194  {
195  SWBaseType::InitializeNonLinIteration(rModelPart, rA, rDx, rb);
196 
197  block_for_each(rModelPart.Nodes(), [&](NodeType& r_node){
198  r_node.GetValue(POSITIVE_FLUX) = ZeroVector(mLimiters.size());
199  r_node.GetValue(NEGATIVE_FLUX) = ZeroVector(mLimiters.size());
200  r_node.GetValue(POSITIVE_RATIO) = 1.0;
201  r_node.GetValue(NEGATIVE_RATIO) = 1.0;
202  });
203 
204  block_for_each(rModelPart.Elements(), [&](Element& r_elem){
205  ComputeAntiFluxes(r_elem, rModelPart.GetProcessInfo());
206  });
207 
208  block_for_each(rModelPart.Nodes(), [&](NodeType& r_node){
209  ComputeLimiters(r_node);
210  });
211  }
212 
222  Element& rCurrentElement,
223  LocalSystemMatrixType& rLHS_Contribution,
224  LocalSystemVectorType& rRHS_Contribution,
225  Element::EquationIdVectorType& rEquationId,
226  const ProcessInfo& rCurrentProcessInfo
227  ) override
228  {
229  KRATOS_TRY;
230 
232 
233  rCurrentElement.CalculateLocalSystem(rLHS_Contribution, rRHS_Contribution, rCurrentProcessInfo);
234 
235  rCurrentElement.EquationIdVector(rEquationId, rCurrentProcessInfo);
236 
237  rCurrentElement.CalculateMassMatrix(mrMc[t], rCurrentProcessInfo);
238 
239  rCurrentElement.CalculateDampingMatrix(mrD[t], rCurrentProcessInfo);
240 
241  rCurrentElement.GetValuesVector(mrUn0[t]);
242 
243  rCurrentElement.GetFirstDerivativesVector(mrDotUn0[t]);
244 
246 
247  AddMonotonicDynamicsToLHS(rLHS_Contribution, mrD[t], mMl[t]);
248 
249  AddMonotonicDynamicsToRHS(rRHS_Contribution, mrD[t], mMl[t], mrUn0[t], mrDotUn0[t]);
250 
252  rCurrentElement,
253  rLHS_Contribution,
254  rRHS_Contribution,
255  mrMc[t],
256  mMl[t],
257  mrD[t],
258  mrUn0[t],
259  mrDotUn0[t]);
260 
261  SWBaseType::mRotationTool.Rotate(rLHS_Contribution, rRHS_Contribution, rCurrentElement.GetGeometry());
262  SWBaseType::mRotationTool.ApplySlipCondition(rLHS_Contribution, rRHS_Contribution, rCurrentElement.GetGeometry());
263 
264  KRATOS_CATCH("FluxCorrectedShallowWaterScheme.CalculateSystemContributions");
265  }
266 
275  Element& rCurrentElement,
276  LocalSystemVectorType& rRHS_Contribution,
277  Element::EquationIdVectorType& rEquationId,
278  const ProcessInfo& rCurrentProcessInfo
279  ) override
280  {
281  KRATOS_TRY;
282 
284 
285  rCurrentElement.CalculateRightHandSide(rRHS_Contribution,rCurrentProcessInfo);
286 
287  rCurrentElement.CalculateMassMatrix(mrMc[t], rCurrentProcessInfo);
288 
289  rCurrentElement.CalculateDampingMatrix(mrD[t],rCurrentProcessInfo);
290 
291  rCurrentElement.EquationIdVector(rEquationId,rCurrentProcessInfo);
292 
293  rCurrentElement.GetValuesVector(mrUn0[t]);
294 
295  rCurrentElement.GetFirstDerivativesVector(mrDotUn0[t]);
296 
298 
299  AddMonotonicDynamicsToRHS(rRHS_Contribution, mrD[t], mrMc[t], mrUn0[t], mrDotUn0[t]);
300 
302  rCurrentElement,
303  rRHS_Contribution,
304  mrMc[t],
305  mMl[t],
306  mrD[t],
307  mrUn0[t],
308  mrDotUn0[t]);
309 
310  SWBaseType::mRotationTool.Rotate(rRHS_Contribution, rCurrentElement.GetGeometry());
311  SWBaseType::mRotationTool.ApplySlipCondition(rRHS_Contribution, rCurrentElement.GetGeometry());
312 
313  KRATOS_CATCH("FluxCorrectedShallowWaterScheme.Calculate_RHS_Contribution");
314  }
315 
325  Condition& rCurrentCondition,
326  LocalSystemMatrixType& rLHS_Contribution,
327  LocalSystemVectorType& rRHS_Contribution,
328  Element::EquationIdVectorType& rEquationId,
329  const ProcessInfo& rCurrentProcessInfo
330  ) override
331  {
332  KRATOS_TRY;
333 
335 
336  rCurrentCondition.CalculateLocalSystem(rLHS_Contribution, rRHS_Contribution, rCurrentProcessInfo);
337 
338  rCurrentCondition.EquationIdVector(rEquationId, rCurrentProcessInfo);
339 
340  rCurrentCondition.CalculateMassMatrix(mrMc[t], rCurrentProcessInfo);
341 
342  rCurrentCondition.CalculateDampingMatrix(mrD[t], rCurrentProcessInfo);
343 
344  rCurrentCondition.GetValuesVector(mrUn0[t]);
345 
346  rCurrentCondition.GetFirstDerivativesVector(mrDotUn0[t]);
347 
349 
350  AddMonotonicDynamicsToLHS(rLHS_Contribution, mrD[t], mrMc[t]);
351 
352  AddMonotonicDynamicsToRHS(rRHS_Contribution, mrD[t], mrMc[t], mrUn0[t], mrDotUn0[t]);
353 
355  rCurrentCondition,
356  rLHS_Contribution,
357  rRHS_Contribution,
358  mrMc[t],
359  mMl[t],
360  mrD[t],
361  mrUn0[t],
362  mrDotUn0[t]);
363 
364  SWBaseType::mRotationTool.Rotate(rLHS_Contribution, rRHS_Contribution, rCurrentCondition.GetGeometry());
365  SWBaseType::mRotationTool.ApplySlipCondition(rLHS_Contribution, rRHS_Contribution, rCurrentCondition.GetGeometry());
366 
367  KRATOS_CATCH("FluxCorrectedShallowWaterScheme.CalculateSystemContributions");
368  }
369 
378  Condition& rCurrentCondition,
379  LocalSystemVectorType& rRHS_Contribution,
380  Element::EquationIdVectorType& rEquationId,
381  const ProcessInfo& rCurrentProcessInfo
382  ) override
383  {
384  KRATOS_TRY;
385 
387 
388  rCurrentCondition.CalculateRightHandSide(rRHS_Contribution, rCurrentProcessInfo);
389 
390  rCurrentCondition.EquationIdVector(rEquationId, rCurrentProcessInfo);
391 
392  rCurrentCondition.CalculateMassMatrix(mrMc[t], rCurrentProcessInfo);
393 
394  rCurrentCondition.CalculateDampingMatrix(mrD[t], rCurrentProcessInfo);
395 
396  rCurrentCondition.GetValuesVector(mrUn0[t]);
397 
398  rCurrentCondition.GetFirstDerivativesVector(mrDotUn0[t]);
399 
401 
402  AddMonotonicDynamicsToRHS(rRHS_Contribution, mrD[t], mrMc[t], mrUn0[t], mrDotUn0[t]);
403 
405  rCurrentCondition,
406  rRHS_Contribution,
407  mrMc[t],
408  mMl[t],
409  mrD[t],
410  mrUn0[t],
411  mrDotUn0[t]);
412 
413  SWBaseType::mRotationTool.Rotate(rRHS_Contribution, rCurrentCondition.GetGeometry());
414  SWBaseType::mRotationTool.ApplySlipCondition(rRHS_Contribution, rCurrentCondition.GetGeometry());
415 
416  KRATOS_CATCH("FluxCorrectedShallowWaterScheme.Calculate_RHS_Contribution");
417  }
418 
422 
426 
430 
432  std::string Info() const override
433  {
434  return "FluxCorrectedShallowWaterScheme";
435  }
436 
440 
441 protected:
442 
445 
449 
450  std::vector<Matrix> mMl;
451 
452  std::vector<Vector>& mrDotUn0 = BDFBaseType::mVector.dotun0;
453  std::vector<Vector>& mrUn0 = BDFBaseType::mVector.dot2un0;
454  std::vector<Matrix>& mrMc = ImplicitBaseType::mMatrix.M;
455  std::vector<Matrix>& mrD = ImplicitBaseType::mMatrix.D;
456 
458 
462 
466 
474  LocalSystemMatrixType& rLHS_Contribution,
477  )
478  {
479  // Adding mass contribution to the dynamic stiffness
480  if (rM.size1() != 0) { // if M matrix declared
481  noalias(rLHS_Contribution) += rM * BDFBaseType::mBDF[0];
482  }
483 
484  // Adding monotonic diffusion
485  if (rD.size1() != 0) { // if D matrix declared
486  noalias(rLHS_Contribution) += rD;
487  }
488  }
489 
499  LocalSystemVectorType& rRHS_Contribution,
503  LocalSystemVectorType& rDotU
504  )
505  {
506  // Adding inertia contribution
507  if (rM.size1() != 0) {
508  noalias(rRHS_Contribution) -= prod(rM, rDotU);
509  }
510 
511  // Adding monotonic diffusion
512  if (rD.size1() != 0) {
513  noalias(rRHS_Contribution) -= prod(rD, rU);
514  }
515  }
516 
517  template<class EntityType>
518  void ComputeAntiFluxes(EntityType& rEntity, const ProcessInfo& rProcessInfo)
519  {
521 
522  rEntity.CalculateMassMatrix(mrMc[t], rProcessInfo);
523 
524  rEntity.CalculateDampingMatrix(mrD[t], rProcessInfo);
525 
526  rEntity.GetValuesVector(mrUn0[t]);
527 
528  rEntity.GetFirstDerivativesVector(mrDotUn0[t]);
529 
531 
532  auto aec = prod(mrD[t], mrUn0[t]) + prod(mMl[t] - mrMc[t], mrDotUn0[t]);
533 
534  auto r_geom = rEntity.GetGeometry();
535  for (IndexType i = 0; i < r_geom.size(); ++i)
536  {
537  for (IndexType limiter = 0; limiter < mLimiters.size(); ++limiter)
538  {
539  const auto flux = mLimiters.ComputeUnlimitedFlux(aec, r_geom[i], i, limiter);
540  r_geom[i].SetLock();
541  if (flux > 0.0) {
542  r_geom[i].GetValue(POSITIVE_FLUX)[limiter] += flux;
543  } else {
544  r_geom[i].GetValue(NEGATIVE_FLUX)[limiter] += flux;
545  }
546  r_geom[i].UnSetLock();
547  }
548  }
549  }
550 
552  {
553  double& pos_ratio = rNode.GetValue(POSITIVE_RATIO); // the variable is initialized to 1.0
554  double& neg_ratio = rNode.GetValue(NEGATIVE_RATIO); // the variable is initialized to 1.0
555 
556  for (IndexType limiter = 0; limiter < mLimiters.size(); ++limiter)
557  {
558  const auto incr = mLimiters.ComputeAllowableIncrements(rNode, limiter);
559  const double pos_flux = rNode.GetValue(POSITIVE_FLUX)[limiter];
560  const double neg_flux = rNode.GetValue(NEGATIVE_FLUX)[limiter];
561  if (pos_flux > 0.0) {
562  pos_ratio = std::min(pos_ratio, incr.max / pos_flux);
563  }
564  if (neg_flux < 0.0) {
565  neg_ratio = std::min(neg_ratio, incr.min / neg_flux);
566  }
567  }
568  }
569 
570  template<class EntityType>
572  EntityType& rEntity,
573  LocalSystemVectorType& rRHS,
574  const LocalSystemMatrixType& rMc,
575  const LocalSystemMatrixType& rMl,
576  const LocalSystemMatrixType& rD,
577  const LocalSystemVectorType& rU,
578  const LocalSystemVectorType& rDotU)
579  {
580  if (rD.size1() != 0) {
581  // Construction of the incremental element contribution of anti-fluxes
582  auto& cum = rEntity.GetValue(CUMULATIVE_CORRECTIONS);
583  auto aec = prod(rD, rU) + prod(rMl - rMc, rDotU);
584  auto delta = aec - cum;
585 
586  // Getting the most restrictive limiter
587  double c = 1.0;
588  for (auto& r_node : rEntity.GetGeometry())
589  {
590  c = std::min({c, r_node.GetValue(POSITIVE_RATIO), r_node.GetValue(NEGATIVE_RATIO)});
591  }
592 
593  // Adding the limited anti-diffusion
594  cum += c * delta;
595  rRHS += cum;
596  }
597  }
598 
599  template<class EntityType>
601  EntityType& rEntity,
602  LocalSystemMatrixType& rLHS,
603  LocalSystemVectorType& rRHS,
604  const LocalSystemMatrixType& rMc,
605  const LocalSystemMatrixType& rMl,
606  const LocalSystemMatrixType& rD,
607  const LocalSystemVectorType& rU,
608  const LocalSystemVectorType& rDotU)
609  {
610  AddFluxCorrection(rEntity, rRHS, rMc, rMl, rD, rU, rDotU);
611  }
612 
614  const LocalSystemMatrixType& rConsistentMassMatrix,
615  LocalSystemMatrixType& rLumpedMassMatrix)
616  {
617  const IndexType size = rConsistentMassMatrix.size1();
618 
619  if (rLumpedMassMatrix.size1() != size) {
620  rLumpedMassMatrix.resize(size,size,false);
621  }
622 
623  for (IndexType i = 0; i < size; ++i)
624  {
625  double l = 0.0;
626  for (IndexType j = 0; j < size; ++j)
627  {
628  l += rConsistentMassMatrix(i,j);
629  rLumpedMassMatrix(i,j) = 0.0;
630  }
631  rLumpedMassMatrix(i,i) = l;
632  }
633  }
634 
635  static void ValidateThisParameters(Parameters& rThisParameters) {
636  Parameters default_parameters(R"({
637  "order" : 2,
638  "update_velocities" : false,
639  "limiting_variables" : ["HEIGHT"]
640  })");
641  rThisParameters.ValidateAndAssignDefaults(default_parameters);
642  }
643 
644  static std::size_t GetOrder(Parameters& rThisParameters) {
645  ValidateThisParameters(rThisParameters);
646  return rThisParameters["order"].GetInt();
647  }
648 
649  static bool GetUpdateVelocities(Parameters& rThisParameters) {
650  ValidateThisParameters(rThisParameters);
651  return rThisParameters["update_velocities"].GetBool();
652  }
653 
654  static Parameters GetLimiterParameters(Parameters& rThisParameters) {
655  ValidateThisParameters(rThisParameters);
656  Parameters limiter_parameters;
657  limiter_parameters.AddValue("limiting_variables", rThisParameters["limiting_variables"]);
658  return limiter_parameters;
659  }
660 
664 
668 
673 
674 }; // Class FluxCorrectedShallowWaterScheme
675 
679 
683 
685 
686 } // Namespace Kratos
687 
688 #endif // KRATOS_FLUX_CORRECTED_SHALLOW_WATER_SCHEME_H_INCLUDED defined
Base class for all Conditions.
Definition: condition.h:59
virtual void GetFirstDerivativesVector(Vector &values, int Step=0) const
Definition: condition.h:313
virtual void CalculateMassMatrix(MatrixType &rMassMatrix, const ProcessInfo &rCurrentProcessInfo)
Definition: condition.h:574
virtual void CalculateDampingMatrix(MatrixType &rDampingMatrix, const ProcessInfo &rCurrentProcessInfo)
Definition: condition.h:586
virtual void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &rCurrentProcessInfo) const
Definition: condition.h:260
virtual void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Definition: condition.h:440
virtual void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Definition: condition.h:408
virtual void GetValuesVector(Vector &values, int Step=0) const
Definition: condition.h:303
virtual void Rotate(TLocalMatrixType &rLocalMatrix, TLocalVectorType &rLocalVector, GeometryType &rGeometry) const
Rotate the local system contributions so that they are oriented with each node's normal.
Definition: coordinate_transformation_utilities.h:447
Base class for all Elements.
Definition: element.h:60
virtual void GetFirstDerivativesVector(Vector &values, int Step=0) const
Definition: element.h:310
virtual void CalculateMassMatrix(MatrixType &rMassMatrix, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:570
virtual void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:437
virtual void CalculateDampingMatrix(MatrixType &rDampingMatrix, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:583
virtual void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &rCurrentProcessInfo) const
Definition: element.h:258
virtual void GetValuesVector(Vector &values, int Step=0) const
Definition: element.h:300
virtual void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:405
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
Short class definition.
Definition: find_global_nodal_neighbours_process.h:40
void Execute() override
Execute method is used to execute the Process algorithms.
Definition: find_global_nodal_neighbours_for_entities_process.cpp:76
virtual void ApplySlipCondition(TLocalMatrixType &rLocalMatrix, TLocalVectorType &rLocalVector, GeometryType &rGeometry) const override
Apply slip boundary conditions to the rotated local contributions. @detail This function takes the lo...
Definition: flow_rate_slip_utility.h:99
BDF integration scheme (for dynamic problems) with flux correction for extra diffusion to ensure mono...
Definition: flux_corrected_shallow_water_scheme.h:57
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: flux_corrected_shallow_water_scheme.h:79
void InitializeSolutionStep(ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
It initializes the cumulative corrections variable.
Definition: flux_corrected_shallow_water_scheme.h:164
void Initialize(ModelPart &rModelPart) override
This is the place to initialize the Scheme.
Definition: flux_corrected_shallow_water_scheme.h:130
void InitializeNonLinIteration(ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
It initializes a non-linear iteration (for the element)
Definition: flux_corrected_shallow_water_scheme.h:188
void CalculateSystemContributions(Element &rCurrentElement, LocalSystemMatrixType &rLHS_Contribution, LocalSystemVectorType &rRHS_Contribution, Element::EquationIdVectorType &rEquationId, const ProcessInfo &rCurrentProcessInfo) override
This function is designed to be called in the builder and solver to introduce the selected time integ...
Definition: flux_corrected_shallow_water_scheme.h:221
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: flux_corrected_shallow_water_scheme.h:81
SWBaseType::BDFBaseType BDFBaseType
Definition: flux_corrected_shallow_water_scheme.h:65
std::vector< Matrix > & mrMc
Definition: flux_corrected_shallow_water_scheme.h:454
BaseTypePointer Clone() override
Definition: flux_corrected_shallow_water_scheme.h:109
std::vector< Vector > & mrDotUn0
Definition: flux_corrected_shallow_water_scheme.h:452
void CalculateRHSContribution(Element &rCurrentElement, LocalSystemVectorType &rRHS_Contribution, Element::EquationIdVectorType &rEquationId, const ProcessInfo &rCurrentProcessInfo) override
This function is designed to calculate just the RHS contribution.
Definition: flux_corrected_shallow_water_scheme.h:274
KRATOS_CLASS_POINTER_DEFINITION(FluxCorrectedShallowWaterScheme)
void CalculateRHSContribution(Condition &rCurrentCondition, LocalSystemVectorType &rRHS_Contribution, Element::EquationIdVectorType &rEquationId, const ProcessInfo &rCurrentProcessInfo) override
This function is designed to calculate just the RHS contribution.
Definition: flux_corrected_shallow_water_scheme.h:377
static void ValidateThisParameters(Parameters &rThisParameters)
Definition: flux_corrected_shallow_water_scheme.h:635
BaseType::Pointer BaseTypePointer
Definition: flux_corrected_shallow_water_scheme.h:71
BDFBaseType::ImplicitBaseType ImplicitBaseType
Definition: flux_corrected_shallow_water_scheme.h:67
FluxCorrectedShallowWaterScheme(const std::size_t Order=2, bool UpdateVelocities=false)
Definition: flux_corrected_shallow_water_scheme.h:90
ShallowWaterResidualBasedBDFScheme< TSparseSpace, TDenseSpace > SWBaseType
Definition: flux_corrected_shallow_water_scheme.h:63
std::string Info() const override
Turn back information as a string.
Definition: flux_corrected_shallow_water_scheme.h:432
std::vector< Matrix > & mrD
Definition: flux_corrected_shallow_water_scheme.h:455
ModelPart::NodeType NodeType
Definition: flux_corrected_shallow_water_scheme.h:83
~FluxCorrectedShallowWaterScheme() override
Definition: flux_corrected_shallow_water_scheme.h:115
std::vector< Vector > & mrUn0
Definition: flux_corrected_shallow_water_scheme.h:453
static std::size_t GetOrder(Parameters &rThisParameters)
Definition: flux_corrected_shallow_water_scheme.h:644
FluxCorrectedShallowWaterScheme(FluxCorrectedShallowWaterScheme &rOther)
Definition: flux_corrected_shallow_water_scheme.h:102
ImplicitBaseType::BaseType BaseType
Definition: flux_corrected_shallow_water_scheme.h:69
BaseType::TSystemVectorType TSystemVectorType
Definition: flux_corrected_shallow_water_scheme.h:77
void AddFluxCorrection(EntityType &rEntity, LocalSystemVectorType &rRHS, const LocalSystemMatrixType &rMc, const LocalSystemMatrixType &rMl, const LocalSystemMatrixType &rD, const LocalSystemVectorType &rU, const LocalSystemVectorType &rDotU)
Definition: flux_corrected_shallow_water_scheme.h:571
void AddMonotonicDynamicsToRHS(LocalSystemVectorType &rRHS_Contribution, LocalSystemMatrixType &rD, LocalSystemMatrixType &rM, LocalSystemVectorType &rU, LocalSystemVectorType &rDotU)
It adds the dynamic RHS contribution of the elements.
Definition: flux_corrected_shallow_water_scheme.h:498
static bool GetUpdateVelocities(Parameters &rThisParameters)
Definition: flux_corrected_shallow_water_scheme.h:649
std::vector< Matrix > mMl
Definition: flux_corrected_shallow_water_scheme.h:450
BaseType::DofsArrayType DofsArrayType
Definition: flux_corrected_shallow_water_scheme.h:73
void AddMonotonicDynamicsToLHS(LocalSystemMatrixType &rLHS_Contribution, LocalSystemMatrixType &rD, LocalSystemMatrixType &rM)
It adds the dynamic LHS contribution of the elements.
Definition: flux_corrected_shallow_water_scheme.h:473
void AddFluxCorrection(EntityType &rEntity, LocalSystemMatrixType &rLHS, LocalSystemVectorType &rRHS, const LocalSystemMatrixType &rMc, const LocalSystemMatrixType &rMl, const LocalSystemMatrixType &rD, const LocalSystemVectorType &rU, const LocalSystemVectorType &rDotU)
Definition: flux_corrected_shallow_water_scheme.h:600
void CalculateSystemContributions(Condition &rCurrentCondition, LocalSystemMatrixType &rLHS_Contribution, LocalSystemVectorType &rRHS_Contribution, Element::EquationIdVectorType &rEquationId, const ProcessInfo &rCurrentProcessInfo) override
This function is designed to be called in the builder and solver to introduce the selected time integ...
Definition: flux_corrected_shallow_water_scheme.h:324
void ComputeLumpedMassMatrix(const LocalSystemMatrixType &rConsistentMassMatrix, LocalSystemMatrixType &rLumpedMassMatrix)
Definition: flux_corrected_shallow_water_scheme.h:613
BaseType::TSystemMatrixType TSystemMatrixType
Definition: flux_corrected_shallow_water_scheme.h:75
void ComputeAntiFluxes(EntityType &rEntity, const ProcessInfo &rProcessInfo)
Definition: flux_corrected_shallow_water_scheme.h:518
FluxCorrectedShallowWaterScheme(Parameters ThisParameters)
Definition: flux_corrected_shallow_water_scheme.h:96
void ComputeLimiters(NodeType &rNode)
Definition: flux_corrected_shallow_water_scheme.h:551
FluxLimiter< LocalSystemVectorType > mLimiters
Definition: flux_corrected_shallow_water_scheme.h:457
static Parameters GetLimiterParameters(Parameters &rThisParameters)
Definition: flux_corrected_shallow_water_scheme.h:654
double ComputeUnlimitedFlux(const TLocalVectorType &rContributions, const NodeType &rNode, IndexType iNode, IndexType iVar)
Definition: flux_limiter.h:121
IndexType size()
Definition: flux_limiter.h:119
AllowableIncrements ComputeAllowableIncrements(const NodeType &rNode, IndexType iVar)
Definition: flux_limiter.h:125
GeometryType & GetGeometry()
Returns the reference of the geometry.
Definition: geometrical_object.h:158
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ConditionsContainerType & Conditions(IndexType ThisIndex=0)
Definition: model_part.h:1381
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
This class defines the node.
Definition: node.h:65
TVariableType::Type & GetValue(const TVariableType &rThisVariable)
Definition: node.h:466
static int ThisThread()
Wrapper for omp_get_thread_num().
Definition: openmp_utils.h:108
static int GetNumThreads()
Returns the current number of threads.
Definition: parallel_utilities.cpp:34
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
int GetInt() const
This method returns the integer contained in the current Parameter.
Definition: kratos_parameters.cpp:666
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
void AddValue(const std::string &rEntry, const Parameters &rOtherValue)
This method sets a non-existing parameter with a given parameter.
Definition: kratos_parameters.cpp:455
bool GetBool() const
This method returns the boolean contained in the current Parameter.
Definition: kratos_parameters.cpp:675
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
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
BDF integration scheme (for dynamic problems)
Definition: residual_based_bdf_scheme.h:83
GeneralVectors mVector
The BDF coefficients.
Definition: residual_based_bdf_scheme.h:357
ImplicitBaseType::LocalSystemVectorType LocalSystemVectorType
Definition: residual_based_bdf_scheme.h:105
void InitializeSolutionStep(ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
It initializes time step solution. Only for reasons if the time step solution is restarted.
Definition: residual_based_bdf_scheme.h:236
BaseType::Pointer BaseTypePointer
Definition: residual_based_bdf_scheme.h:91
ImplicitBaseType::TSystemVectorType TSystemVectorType
Definition: residual_based_bdf_scheme.h:103
Vector mBDF
The integration order.
Definition: residual_based_bdf_scheme.h:356
ImplicitBaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: residual_based_bdf_scheme.h:107
ImplicitBaseType::TSystemMatrixType TSystemMatrixType
Definition: residual_based_bdf_scheme.h:101
This is the base class for the implicit time schemes.
Definition: residual_based_implicit_time_scheme.h:55
GeneralMatrices mMatrix
Definition: residual_based_implicit_time_scheme.h:351
std::size_t IndexType
Index type definition.
Definition: residual_based_implicit_time_scheme.h:89
This class provides the implementation of the basic tasks that are needed by the solution strategy.
Definition: scheme.h:56
typename TSparseSpace::MatrixType TSystemMatrixType
Matrix type definition.
Definition: scheme.h:71
typename TSparseSpace::VectorType TSystemVectorType
Vector type definition.
Definition: scheme.h:74
typename TDenseSpace::VectorType LocalSystemVectorType
Local system vector type definition.
Definition: scheme.h:80
typename TDenseSpace::MatrixType LocalSystemMatrixType
Local system matrix type definition.
Definition: scheme.h:77
BDF integration scheme (for dynamic problems)
Definition: shallow_water_residual_based_bdf_scheme.h:57
void Initialize(ModelPart &rModelPart) override
Initialize the nodal area and the derivatives recovery.
Definition: shallow_water_residual_based_bdf_scheme.h:317
void UpdateVelocities(ModelPart &rModelPart)
Updating the velocities.
Definition: shallow_water_residual_based_bdf_scheme.h:513
FlowRateSlipToolType mRotationTool
Definition: shallow_water_residual_based_bdf_scheme.h:469
void InitializeNonLinIteration(ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
Calculate the global projection of the dispersive field.
Definition: shallow_water_residual_based_bdf_scheme.h:332
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
static double min(double a, double b)
Definition: GeometryFunctions.h:71
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
AMatrix::MatrixProductExpression< TExpression1Type, TExpression2Type > prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:568
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
c
Definition: generate_weakly_compressible_navier_stokes_element.py:108
int t
Definition: ode_solve.py:392
int j
Definition: quadrature.py:648
def num_threads
Definition: script.py:75
integer i
Definition: TensorModule.f:17
double precision, dimension(3, 3), public delta
Definition: TensorModule.f:16
integer l
Definition: TensorModule.f:17
std::vector< Vector > dot2un0
First derivative.
Definition: residual_based_bdf_scheme.h:352
std::vector< Vector > dotun0
Definition: residual_based_bdf_scheme.h:351
std::vector< Matrix > M
Definition: residual_based_implicit_time_scheme.h:347
std::vector< Matrix > D
First derivative matrix (usually mass matrix)
Definition: residual_based_implicit_time_scheme.h:348