15 #if !defined(KRATOS_SPALART_ALLMARAS_TURBULENCE_H_INCLUDED )
16 #define KRATOS_SPALART_ALLMARAS_TURBULENCE_H_INCLUDED
72 template<
class TSparseSpace,
101 typename TLinearSolver::Pointer pLinearSolver,
102 unsigned int DomainSize,
104 unsigned int MaxIter,
106 unsigned int TimeOrder)
117 if (!(rModelPart.
NodesBegin()->SolutionStepsDataHas(DISTANCE)))
119 if (!(rModelPart.
NodesBegin()->SolutionStepsDataHas(VELOCITY)))
121 if (!(rModelPart.
NodesBegin()->SolutionStepsDataHas(MOLECULAR_VISCOSITY)))
122 KRATOS_THROW_ERROR(std::logic_error,
"Variable is not in the model part:", MOLECULAR_VISCOSITY);
123 if (!(rModelPart.
NodesBegin()->SolutionStepsDataHas(TURBULENT_VISCOSITY)))
124 KRATOS_THROW_ERROR(std::logic_error,
"Variable is not in the model part:", TURBULENT_VISCOSITY);
125 if (!(rModelPart.
NodesBegin()->SolutionStepsDataHas(MESH_VELOCITY)))
126 KRATOS_THROW_ERROR(std::logic_error,
"Variable is not in the model part:", MESH_VELOCITY);
127 if (!(rModelPart.
NodesBegin()->SolutionStepsDataHas(VISCOSITY)))
128 KRATOS_THROW_ERROR(std::logic_error,
"Variable is not in the model part:", VISCOSITY);
129 if (!(rModelPart.
NodesBegin()->SolutionStepsDataHas(NODAL_AREA)))
130 KRATOS_THROW_ERROR(std::logic_error,
"Variable is not in the model part:", NODAL_AREA);
131 if (!(rModelPart.
NodesBegin()->SolutionStepsDataHas(TEMP_CONV_PROJ)))
132 KRATOS_THROW_ERROR(std::logic_error,
"Variable is not in the model part:", TEMP_CONV_PROJ);
145 std::string ElementName;
147 ElementName = std::string(
"SpalartAllmaras2D");
149 ElementName = std::string(
"SpalartAllmaras3D");
156 Properties::Pointer properties = iii->pGetProperties();
157 Element::Pointer p_element = rReferenceElement.
Create(iii->Id(), iii->GetGeometry(), properties);
168 const double DefaultAitkenOmega = 1.0;
173 const double NearlyZero = 1.0e-20;
180 bool CalculateReactions =
false;
214 KRATOS_THROW_ERROR(std::logic_error,
"Variable is not in the model part:", FRACT_VEL);
216 #pragma omp parallel for
220 it->FastGetSolutionStepValue(VELOCITY) = it->FastGetSolutionStepValue(FRACT_VEL);
230 double molecular_viscosity =
i->FastGetSolutionStepValue(MOLECULAR_VISCOSITY);
231 double turbulent_viscosity =
i->FastGetSolutionStepValue(TURBULENT_VISCOSITY);
233 if(turbulent_viscosity < 0)
235 i->FastGetSolutionStepValue(TURBULENT_VISCOSITY) = 1
e-9;
236 i->FastGetSolutionStepValue(VISCOSITY) = molecular_viscosity;
240 const double cv1_3 = 7.1*7.1*7.1;
242 double xi = turbulent_viscosity / molecular_viscosity;
243 double xi_3 = xi*xi*xi;
244 double fv1 = xi_3 / (xi_3 + cv1_3);
246 double viscosity = fv1 * turbulent_viscosity + molecular_viscosity;
247 i->FastGetSolutionStepValue(VISCOSITY) =
viscosity;
327 std::string
Info()
const override
329 std::stringstream buffer;
330 buffer <<
"SpalartAllmarasTurbulenceModel";
338 rOStream <<
"SpalartAllmarasTurbulenceModel";
435 double Dt = rCurrentProcessInfo[DELTA_TIME];
439 double dt_old = rCurrentProcessInfo.GetPreviousTimeStepInfo(1)[DELTA_TIME];
441 double rho = dt_old /
Dt;
444 Vector& BDFcoeffs = rCurrentProcessInfo[BDF_COEFFICIENTS];
448 BDFcoeffs[2] =
coeff;
452 Vector& BDFcoeffs = rCurrentProcessInfo[BDF_COEFFICIENTS];
454 BDFcoeffs[0] = 1.0 /
Dt;
455 BDFcoeffs[1] = -1.0 /
Dt;
466 int current_fract_step = rCurrentProcessInfo[FRACTIONAL_STEP];
467 rCurrentProcessInfo[FRACTIONAL_STEP] = 2;
469 CalculateProjection();
471 rCurrentProcessInfo[FRACTIONAL_STEP] = 1;
474 rCurrentProcessInfo[FRACTIONAL_STEP] = current_fract_step;
513 double CalculateVarNorm()
524 norm += pow(
i->FastGetSolutionStepValue(TURBULENT_VISCOSITY), 2);
534 void CalculateProjection()
544 (
i)->FastGetSolutionStepValue(TEMP_CONV_PROJ) = 0.00;
545 (
i)->FastGetSolutionStepValue(NODAL_AREA) = 0.00;
561 rComm.AssembleCurrentData(TEMP_CONV_PROJ);
567 const double NodalArea =
i->FastGetSolutionStepValue(NODAL_AREA);
570 double& rConvProj =
i->FastGetSolutionStepValue(TEMP_CONV_PROJ);
571 rConvProj /= NodalArea;
625 template<
class TSparseSpace,
637 template<
class TSparseSpace,
645 rOStream << std::endl;
Current class provides an implementation for the base builder and solving operations.
Definition: builder_and_solver.h:64
virtual bool AssembleCurrentData(Variable< int > const &ThisVariable)
Definition: communicator.cpp:502
This is the base class to define the different convergence criterion considered.
Definition: convergence_criteria.h:58
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
Implicit solving strategy base class This is the base class from which we will derive all the implici...
Definition: implicit_solving_strategy.h:61
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
static const TComponentType & Get(const std::string &rName)
Retrieves a component with the specified name.
Definition: kratos_components.h:114
This class aims to manage different model parts across multi-physics simulations.
Definition: model.h:60
void DeleteModelPart(const std::string &ModelPartName)
This method deletes a modelpart with a given name.
Definition: model.cpp:64
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
void SetProperties(PropertiesContainerType::Pointer pOtherProperties, IndexType ThisIndex=0)
Definition: model_part.h:1013
ProcessInfo::Pointer pGetProcessInfo()
Definition: model_part.h:1756
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
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
PropertiesContainerType::Pointer pProperties(IndexType ThisIndex=0)
Definition: model_part.h:1008
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
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
Model & GetModel()
Definition: model_part.h:323
VariablesList & GetNodalSolutionStepVariablesList()
Definition: model_part.h:549
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
Definition: residualbased_elimination_builder_and_solver_componentwise.h:95
A scheme for the solution of a problem using Aitken iterations.
Definition: residualbased_incremental_aitken_static_scheme.h:55
This is the base Newton Raphson strategy.
Definition: residualbased_newton_raphson_strategy.h:66
This is a convergence criteria that considers the residual as criteria.
Definition: residual_criteria.h:60
This class provides the implementation of the basic tasks that are needed by the solution strategy.
Definition: scheme.h:56
An impelementation of the Spalart-Allmaras turbulence model for incompressible flows.
Definition: spalart_allmaras_turbulence_model.h:77
std::string Info() const override
Turn back information as a string.
Definition: spalart_allmaras_turbulence_model.h:327
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: spalart_allmaras_turbulence_model.h:336
unsigned int mdomain_size
Definition: spalart_allmaras_turbulence_model.h:366
double mtol
Definition: spalart_allmaras_turbulence_model.h:367
unsigned int mmax_it
Definition: spalart_allmaras_turbulence_model.h:368
SpalartAllmarasTurbulenceModel(ModelPart &rModelPart)
Protected constructor, initializing only the references (for derived classes)
Definition: spalart_allmaras_turbulence_model.h:398
void SetMaxIterations(unsigned int max_it)
Definition: spalart_allmaras_turbulence_model.h:254
void ActivateDES(double CDES)
Definition: spalart_allmaras_turbulence_model.h:272
void Execute() override
Solve an iteration of the turbulent viscosity.
Definition: spalart_allmaras_turbulence_model.h:207
SpalartAllmarasTurbulenceModel(ModelPart &rModelPart, typename TLinearSolver::Pointer pLinearSolver, unsigned int DomainSize, double NonLinearTol, unsigned int MaxIter, bool ReformDofSet, unsigned int TimeOrder)
Constructor for the Spalart-Allmaras turbulence model.
Definition: spalart_allmaras_turbulence_model.h:99
~SpalartAllmarasTurbulenceModel() override
Destructor.
Definition: spalart_allmaras_turbulence_model.h:190
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: spalart_allmaras_turbulence_model.h:343
void AdaptForFractionalStep()
Definition: spalart_allmaras_turbulence_model.h:263
bool madapt_for_fractional_step
Definition: spalart_allmaras_turbulence_model.h:370
ModelPart & mrSpalartModelPart
Definition: spalart_allmaras_turbulence_model.h:365
unsigned int mtime_order
Definition: spalart_allmaras_turbulence_model.h:369
KRATOS_CLASS_POINTER_DEFINITION(SpalartAllmarasTurbulenceModel)
Pointer definition of SpalartAllmarasTurbulenceModel.
ImplicitSolvingStrategy< TSparseSpace, TDenseSpace, TLinearSolver >::Pointer mpSolutionStrategy
Definition: spalart_allmaras_turbulence_model.h:371
ModelPart & mr_model_part
Definition: spalart_allmaras_turbulence_model.h:364
#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
void InitializeSolutionStep(ConstructionUtility &rThisUtil, std::string ThermalSubModelPartName, std::string MechanicalSubModelPartName, std::string HeatFluxSubModelPartName, std::string HydraulicPressureSubModelPartName, bool thermal_conditions, bool mechanical_conditions, int phase)
Definition: add_custom_utilities_to_python.cpp:45
void MoveMesh(Scheme< SparseSpaceType, LocalSpaceType > &dummy, ModelPart::NodesContainerType &rNodes)
Definition: add_strategies_to_python.cpp:175
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
Internals::Matrix< double, AMatrix::dynamic, 1 > Vector
Definition: amatrix_interface.h:472
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
list coeff
Definition: bombardelli_test.py:41
ProcessInfo
Definition: edgebased_PureConvection.py:116
float viscosity
Definition: edgebased_var.py:8
Dt
Definition: face_heat.py:78
rho
Definition: generate_droplet_dynamics.py:86
integer i
Definition: TensorModule.f:17
def CreateModelPart(model_part)
Definition: test_utilities.py:61
e
Definition: run_cpp_mpi_tests.py:31