9 #ifndef KRATOS_TWO_STEP_V_P_THERMAL_STRATEGY_H
10 #define KRATOS_TWO_STEP_V_P_THERMAL_STRATEGY_H
28 #include "custom_utilities/solver_settings.h"
67 template <
class TSparseSpace,
108 typename TLinearSolver::Pointer pVelocityLinearSolver,
109 typename TLinearSolver::Pointer pPressureLinearSolver,
110 bool ReformDofSet =
true,
111 double VelTol = 0.0001,
112 double PresTol = 0.0001,
113 int MaxPressureIterations = 1,
114 unsigned int TimeOrder = 2,
115 unsigned int DomainSize = 2) :
BaseType(rModelPart,
116 pVelocityLinearSolver,
117 pPressureLinearSolver,
121 MaxPressureIterations,
132 bool CalculateNormDxFlag =
true;
142 typename SchemeType::Pointer pScheme;
152 vel_build->SetCalculateReactionsFlag(
false);
158 pressure_build->SetCalculateReactionsFlag(
false);
175 std::string
Info()
const override
177 std::stringstream buffer;
178 buffer <<
"TwoStepVPThermalStrategy";
185 rOStream <<
"TwoStepVPThermalStrategy";
228 double currentTime = rCurrentProcessInfo[TIME];
229 double timeInterval = rCurrentProcessInfo[DELTA_TIME];
230 bool timeIntervalChanged = rCurrentProcessInfo[TIME_INTERVAL_CHANGED];
231 unsigned int stepsWithChangedDt = rCurrentProcessInfo[STEPS_WITH_CHANGED_DT];
232 bool converged =
false;
236 KRATOS_INFO(
"\nSolution with two_step_vp_thermal_strategy at t=") << currentTime <<
"s" << std::endl;
238 if ((timeIntervalChanged ==
true && currentTime > 10 * timeInterval) || stepsWithChangedDt > 0)
240 maxNonLinearIterations *= 2;
242 if (currentTime < 10 * timeInterval)
245 std::cout <<
"within the first 10 time steps, I consider the given iteration number x3" << std::endl;
246 maxNonLinearIterations *= 3;
248 if (currentTime < 20 * timeInterval && currentTime >= 10 * timeInterval)
251 std::cout <<
"within the second 10 time steps, I consider the given iteration number x2" << std::endl;
252 maxNonLinearIterations *= 2;
254 bool momentumConverged =
true;
255 bool continuityConverged =
false;
256 bool fixedTimeStep =
false;
258 double pressureNorm = 0;
259 double velocityNorm = 0;
263 for (
unsigned int it = 0; it < maxNonLinearIterations; ++it)
265 momentumConverged = this->
SolveMomentumIteration(it, maxNonLinearIterations, fixedTimeStep, velocityNorm);
269 if (fixedTimeStep ==
false)
273 if (it == maxNonLinearIterations - 1 || ((continuityConverged && momentumConverged) && it > 2))
278 if ((continuityConverged && momentumConverged) && it > 2)
280 rCurrentProcessInfo.
SetValue(BAD_VELOCITY_CONVERGENCE,
false);
281 rCurrentProcessInfo.
SetValue(BAD_PRESSURE_CONVERGENCE,
false);
284 KRATOS_INFO(
"TwoStepVPThermalStrategy") <<
"V-P thermal strategy converged in " << it + 1 <<
" iterations." << std::endl;
288 if (fixedTimeStep ==
true)
295 std::cout <<
"Convergence tolerance not reached." << std::endl;
315 itElem->InitializeNonLinearIteration(rCurrentProcessInfo);
323 "list_of_variables": ["MECHANICAL_DISSIPATION"]
326 extrapolation_process.Execute();
331 node.FastGetSolutionStepValue(HEAT_FLUX) =
node.GetValue(this_var);
339 int StrategyLevel = Level > 0 ? Level - 1 : 0;
Current class provides an implementation for the base builder and solving operations.
Definition: builder_and_solver.h:64
virtual int MyPID() const
Definition: communicator.cpp:91
void SetValue(const Variable< TDataType > &rThisVariable, TDataType const &rValue)
Sets the value for a given variable.
Definition: data_value_container.h:320
Short class definition.
Definition: gauss_seidel_linear_strategy.h:83
Implicit solving strategy base class This is the base class from which we will derive all the implici...
Definition: implicit_solving_strategy.h:61
KratosComponents class encapsulates a lookup table for a family of classes in a generic way.
Definition: kratos_components.h:49
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
Communicator & GetCommunicator()
Definition: model_part.h:1821
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
MeshType::ElementIterator ElementIterator
Definition: model_part.h:174
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
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
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
Current class provides an implementation for standard builder and solving operations.
Definition: residualbased_block_builder_and_solver.h:82
This class provides the implementation of a static scheme.
Definition: residualbased_incrementalupdate_static_scheme.h:57
This class provides the implementation of the basic tasks that are needed by the solution strategy.
Definition: scheme.h:56
TDenseSpace::MatrixType LocalSystemMatrixType
Definition: solving_strategy.h:79
TSparseSpace::DataType TDataType
Definition: solving_strategy.h:69
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
TSparseSpace::MatrixType TSystemMatrixType
Definition: solving_strategy.h:71
TSparseSpace::VectorType TSystemVectorType
Definition: solving_strategy.h:73
TDenseSpace::VectorType LocalSystemVectorType
Definition: solving_strategy.h:81
Helper class to define solution strategies for TwoStepVPStrategy.
Definition: solver_settings.h:57
Definition: two_step_v_p_strategy.h:71
bool SolveContinuityIteration(unsigned int it, unsigned int maxIt, double &NormP) override
Definition: two_step_v_p_strategy.h:457
int Check() override
Function to perform expensive checks.
Definition: two_step_v_p_strategy.h:158
bool SolveMomentumIteration(unsigned int it, unsigned int maxIt, bool &fixedTimeStep, double &velocityNorm) override
Calculate the coefficients for time iteration.
Definition: two_step_v_p_strategy.h:407
void Clear() override
Clears the internal storage.
Definition: two_step_v_p_strategy.h:331
bool mReformDofSet
Definition: two_step_v_p_strategy.h:767
unsigned int mMaxPressureIter
Definition: two_step_v_p_strategy.h:761
void SetEchoLevel(int Level) override
This sets the level of echo for the solving strategy.
Definition: two_step_v_p_strategy.h:341
ImplicitSolvingStrategy< TSparseSpace, TDenseSpace, TLinearSolver >::Pointer StrategyPointerType
Definition: two_step_v_p_strategy.h:91
Definition: two_step_v_p_thermal_strategy.h:71
BaseType::TSystemMatrixType TSystemMatrixType
Definition: two_step_v_p_thermal_strategy.h:83
void SetEchoLevel(int Level) override
This sets the level of echo for the solving strategy.
Definition: two_step_v_p_thermal_strategy.h:336
BaseType::TDataType TDataType
Definition: two_step_v_p_thermal_strategy.h:79
BaseType::TSystemVectorType TSystemVectorType
Definition: two_step_v_p_thermal_strategy.h:85
bool SolveSolutionStep() override
Calculate the coefficients for time iteration.
Definition: two_step_v_p_thermal_strategy.h:224
StrategyPointerType mpPressureStrategy
Scheme for the solution of the mass equation.
Definition: two_step_v_p_thermal_strategy.h:378
ImplicitSolvingStrategy< TSparseSpace, TDenseSpace, TLinearSolver >::Pointer StrategyPointerType
Definition: two_step_v_p_thermal_strategy.h:91
TwoStepVPThermalStrategy(TwoStepVPThermalStrategy const &rOther)
Copy constructor.
Definition: two_step_v_p_thermal_strategy.h:404
KRATOS_CLASS_POINTER_DEFINITION(TwoStepVPThermalStrategy)
virtual ~TwoStepVPThermalStrategy()
Destructor.
Definition: two_step_v_p_thermal_strategy.h:164
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: two_step_v_p_thermal_strategy.h:89
TwoStepVPThermalStrategy & operator=(TwoStepVPThermalStrategy const &rOther)
Assignment operator.
Definition: two_step_v_p_thermal_strategy.h:401
TwoStepVPSolverSettings< TSparseSpace, TDenseSpace, TLinearSolver > SolverSettingsType
Definition: two_step_v_p_thermal_strategy.h:93
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: two_step_v_p_thermal_strategy.h:189
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: two_step_v_p_thermal_strategy.h:87
BaseType::DofsArrayType DofsArrayType
Definition: two_step_v_p_thermal_strategy.h:81
std::string Info() const override
Turn back information as a string.
Definition: two_step_v_p_thermal_strategy.h:175
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: two_step_v_p_thermal_strategy.h:183
void UpdateThermalStressStrain()
Definition: two_step_v_p_thermal_strategy.h:303
TwoStepVPThermalStrategy(ModelPart &rModelPart, typename TLinearSolver::Pointer pVelocityLinearSolver, typename TLinearSolver::Pointer pPressureLinearSolver, bool ReformDofSet=true, double VelTol=0.0001, double PresTol=0.0001, int MaxPressureIterations=1, unsigned int TimeOrder=2, unsigned int DomainSize=2)
Definition: two_step_v_p_thermal_strategy.h:107
StrategyPointerType mpMomentumStrategy
Scheme for the solution of the momentum equation.
Definition: two_step_v_p_thermal_strategy.h:375
TwoStepVPStrategy< TSparseSpace, TDenseSpace, TLinearSolver > BaseType
Definition: two_step_v_p_thermal_strategy.h:77
Definition: v_p_strategy.h:59
virtual void CalculateTemporalVariables()
Definition: v_p_strategy.h:274
void UpdateTopology(ModelPart &rModelPart, unsigned int echoLevel)
Definition: v_p_strategy.h:107
void SetBlockedAndIsolatedFlags()
Definition: v_p_strategy.h:116
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_INFO(label)
Definition: logger.h:250
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
Temp
Definition: PecletTest.py:105
ReformDofAtEachIteration
Definition: test_pureconvectionsolver_benchmarking.py:131
Definition: mesh_converter.cpp:38