12 #if !defined(KRATOS_RESIDUALBASED_CONVECTION_DIFFUSION_STRATEGY_NONLINEAR )
13 #define KRATOS_RESIDUALBASED_CONVECTION_DIFFUSION_STRATEGY_NONLINEAR
86 template<
class TSparseSpace,
138 typename TLinearSolver::Pointer pNewLinearSolver,
154 ConvectionDiffusionSettings::Pointer my_settings = rCurrentProcessInfo.
GetValue(CONVECTION_DIFFUSION_SETTINGS);
159 typename SchemeType::Pointer pscheme =
typename SchemeType::Pointer
162 bool CalculateReactions =
false;
163 bool CalculateNormDxFlag =
true;
176 CalculateNormDxFlag));
177 mstep1->SetEchoLevel(2);
201 double Dt = rCurrentProcessInfo[DELTA_TIME];
202 int stationary= rCurrentProcessInfo[STATIONARY];
204 unsigned int iter = 0;
206 bool is_converged =
false;
207 double dT_norm = 0.0;
213 is_converged =
false;
216 while (iter++ < mmax_iter && is_converged ==
false)
218 rCurrentProcessInfo[FRACTIONAL_STEP] = 1;
219 dT_norm = mstep1->Solve();
225 ratio = dT_norm / T_norm;
228 std::cout <<
"T_norm = " << T_norm <<
" dT_norm = " << dT_norm << std::endl;
237 std::cout <<
" iter = " << iter <<
" ratio = " << ratio << std::endl;
244 if (mtime_order == 2)
249 double dt_old = rCurrentProcessInfo.GetPreviousTimeStepInfo(1)[DELTA_TIME];
251 double rho = dt_old /
Dt;
254 rCurrentProcessInfo[BDF_COEFFICIENTS].resize(3);
255 Vector& BDFcoeffs = rCurrentProcessInfo[BDF_COEFFICIENTS];
258 BDFcoeffs[2] =
coeff;
262 rCurrentProcessInfo[BDF_COEFFICIENTS].resize(2);
263 Vector& BDFcoeffs = rCurrentProcessInfo[BDF_COEFFICIENTS];
264 BDFcoeffs[0] = 1.0 /
Dt;
265 BDFcoeffs[1] = -1.0 /
Dt;
270 is_converged =
false;
274 while (iter++ < mmax_iter && is_converged ==
false)
276 rCurrentProcessInfo[FRACTIONAL_STEP] = 1;
277 dT_norm = mstep1->Solve();
283 ratio = dT_norm / T_norm;
286 std::cout <<
"T_norm = " << T_norm <<
" dT_norm = " << dT_norm << std::endl;
295 std::cout <<
" iter = " << iter <<
" ratio = " << ratio << std::endl;
313 ConvectionDiffusionSettings::Pointer my_settings = rCurrentProcessInfo.
GetValue(CONVECTION_DIFFUSION_SETTINGS);
320 norm += pow(
i->FastGetSolutionStepValue(rUnknownVar), 2);
339 ConvectionDiffusionSettings::Pointer my_settings = rCurrentProcessInfo.
GetValue(CONVECTION_DIFFUSION_SETTINGS);
341 const Variable<double>& rProjectionVariable = my_settings->GetProjectionVariable();
347 if ((
i->GetValue(NEIGHBOUR_ELEMENTS)).size() != 0)
351 (
i)->FastGetSolutionStepValue(rProjectionVariable) = 0.00;
352 (
i)->FastGetSolutionStepValue(NODAL_AREA) = 0.00;
356 (
i)->FastGetSolutionStepValue(NODAL_AREA) = 1.00;
362 rCurrentProcessInfo[FRACTIONAL_STEP] = 2;
373 double& conv_proj = (
i)->FastGetSolutionStepValue(rProjectionVariable);
374 double temp = 1.00 / (
i)->FastGetSolutionStepValue(NODAL_AREA);
383 mstep1->SetEchoLevel(Level);
396 ConvectionDiffusionSettings::Pointer my_settings = rCurrentProcessInfo.
GetValue(CONVECTION_DIFFUSION_SETTINGS);
399 const Variable<double>& rDiffusionVar = my_settings->GetDiffusionVariable();
400 const Variable<double>& rSourceVar = my_settings->GetVolumeSourceVariable();
402 const Variable<double>& rProjectionVariable = my_settings->GetProjectionVariable();
406 KRATOS_THROW_ERROR(std::logic_error,
"Add ----UnknownVar---- variable!!!!!! ERROR",
"");
408 KRATOS_THROW_ERROR(std::logic_error,
"Add ----rDensityVar---- variable!!!!!! ERROR",
"");
410 KRATOS_THROW_ERROR(std::logic_error,
"Add ----rDiffusionVar---- variable!!!!!! ERROR",
"");
412 KRATOS_THROW_ERROR(std::logic_error,
"Add ----rSourceVar---- variable!!!!!! ERROR",
"");
414 KRATOS_THROW_ERROR(std::logic_error,
"Add ----rMeshVelocityVar---- variable!!!!!! ERROR",
"");
416 KRATOS_THROW_ERROR(std::logic_error,
"Add ----rProjectionVariable---- variable!!!!!! ERROR",
"");
506 typename BaseType::Pointer mstep1;
509 unsigned int mmax_iter;
Current class provides an implementation for the base builder and solving operations.
Definition: builder_and_solver.h:64
TDataType & GetValue(const Variable< TDataType > &rThisVariable)
Gets the value associated with a given variable.
Definition: data_value_container.h:268
Implicit solving strategy base class This is the base class from which we will derive all the implici...
Definition: implicit_solving_strategy.h:61
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ElementIterator ElementsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1169
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
ElementIterator ElementsEnd(IndexType ThisIndex=0)
Definition: model_part.h:1179
MeshType::ElementIterator ElementIterator
Definition: model_part.h:174
NodeIterator NodesEnd(IndexType ThisIndex=0)
Definition: model_part.h:497
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
This strategy is used to solve convection-diffusion problem.
Definition: residualbased_convdiff_strategy_nonlinear.h:92
double CalculateTemperatureNorm()
calculation of temperature norm
Definition: residualbased_convdiff_strategy_nonlinear.h:306
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: residualbased_convdiff_strategy_nonlinear.h:114
BaseType::TDataType TDataType
Definition: residualbased_convdiff_strategy_nonlinear.h:102
BaseType::TSystemVectorType TSystemVectorType
Definition: residualbased_convdiff_strategy_nonlinear.h:110
BaseType::DofsArrayType DofsArrayType
Definition: residualbased_convdiff_strategy_nonlinear.h:106
virtual ~ResidualBasedConvectionDiffusionStrategyNonLinear()
Definition: residualbased_convdiff_strategy_nonlinear.h:185
ResidualBasedConvectionDiffusionStrategyNonLinear(ModelPart &model_part, typename TLinearSolver::Pointer pNewLinearSolver, bool ReformDofAtEachIteration=true, int time_order=2, int max_iter=30, double toll=1e-6)
Constructor.
Definition: residualbased_convdiff_strategy_nonlinear.h:136
int Check() override
Function to perform expensive checks.
Definition: residualbased_convdiff_strategy_nonlinear.h:391
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: residualbased_convdiff_strategy_nonlinear.h:112
void SetEchoLevel(int Level) override
This sets the level of echo for the solving strategy.
Definition: residualbased_convdiff_strategy_nonlinear.h:381
void Clear() override
Clears the internal storage.
Definition: residualbased_convdiff_strategy_nonlinear.h:386
KRATOS_CLASS_POINTER_DEFINITION(ResidualBasedConvectionDiffusionStrategyNonLinear)
ImplicitSolvingStrategy< TSparseSpace, TDenseSpace, TLinearSolver > BaseType
Definition: residualbased_convdiff_strategy_nonlinear.h:100
void CalculateProjection()
calculation of projection
Definition: residualbased_convdiff_strategy_nonlinear.h:332
double Solve() override
Definition: residualbased_convdiff_strategy_nonlinear.h:195
BaseType::TSystemMatrixType TSystemMatrixType
Definition: residualbased_convdiff_strategy_nonlinear.h:108
Definition: residualbased_elimination_builder_and_solver_componentwise.h:95
This class provides the implementation of a static scheme.
Definition: residualbased_incrementalupdate_static_scheme.h:57
This is a very simple strategy to solve linearly the problem.
Definition: residualbased_linear_strategy.h:64
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
virtual void InitializeSolutionStep()
Performs all the required operations that should be done (for each step) before solving the solution ...
Definition: solving_strategy.h:224
TSparseSpace::DataType TDataType
Definition: solving_strategy.h:69
ModelPart & GetModelPart()
Operations to get the pointer to the model.
Definition: solving_strategy.h:350
TSparseSpace::MatrixType TSystemMatrixType
Definition: solving_strategy.h:71
TSparseSpace::VectorType TSystemVectorType
Definition: solving_strategy.h:73
TDenseSpace::VectorType LocalSystemVectorType
Definition: solving_strategy.h:81
#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
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
int time_order
Definition: ProjectParameters.py:51
list coeff
Definition: bombardelli_test.py:41
model_part
Definition: face_heat.py:14
Dt
Definition: face_heat.py:78
rho
Definition: generate_droplet_dynamics.py:86
int max_iter
Definition: hinsberg_optimization.py:139
float temp
Definition: rotating_cone.py:85
integer i
Definition: TensorModule.f:17
ReformDofAtEachIteration
Definition: test_pureconvectionsolver_benchmarking.py:131
e
Definition: run_cpp_mpi_tests.py:31