14 #if !defined(KRATOS_RESIDUALBASED_SIMPLE_STEADY_SCHEME )
15 #define KRATOS_RESIDUALBASED_SIMPLE_STEADY_SCHEME
33 template<
class TSparseSpace,
class TDenseSpace >
60 double PressureRelaxationFactor,
61 unsigned int DomainSize)
62 :
Scheme<TSparseSpace, TDenseSpace>(),
63 mVelocityRelaxationFactor(VelocityRelaxationFactor),
64 mPressureRelaxationFactor(PressureRelaxationFactor),
65 mRotationTool(DomainSize,DomainSize+1,SLIP)
69 double VelocityRelaxationFactor,
70 double PressureRelaxationFactor,
71 unsigned int DomainSize,
72 Process::Pointer pTurbulenceModel)
73 :
Scheme<TSparseSpace, TDenseSpace>(),
74 mVelocityRelaxationFactor(VelocityRelaxationFactor),
75 mPressureRelaxationFactor(PressureRelaxationFactor),
76 mRotationTool(DomainSize,DomainSize+1,SLIP),
77 mpTurbulenceModel(pTurbulenceModel)
89 return mVelocityRelaxationFactor;
94 mVelocityRelaxationFactor =
factor;
99 return mPressureRelaxationFactor;
104 mPressureRelaxationFactor =
factor;
117 TSparseSpace::InplaceMult(rDx, mVelocityRelaxationFactor);
119 mpDofUpdater->UpdateDofs(rDofSet,rDx);
141 if (SteadyLHS.size1() != 0)
142 noalias(LHS_Contribution) += SteadyLHS;
145 mRotationTool.
Rotate(LHS_Contribution,RHS_Contribution,rCurrentElement.
GetGeometry());
166 if (SteadyLHS.size1() != 0)
167 noalias(LHS_Contribution) += SteadyLHS;
170 mRotationTool.
Rotate(LHS_Contribution,RHS_Contribution,rCurrentCondition.
GetGeometry());
191 rCurrentProcessInfo);
211 rCurrentProcessInfo);
221 if (mpTurbulenceModel)
223 mpTurbulenceModel->Execute();
229 if (CurrentProcessInfo[OSS_SWITCH] == 1.0) {
232 <<
"Computing OSS projections" << std::endl;
236 #pragma omp parallel for
237 for (
int i = 0;
i < number_of_nodes;
i++) {
240 it_node->FastGetSolutionStepValue(DIVPROJ) = 0.0;
241 it_node->FastGetSolutionStepValue(NODAL_AREA) = 0.0;
247 #pragma omp parallel for private(output)
248 for (
int i = 0;
i < number_of_elements;
i++) {
250 it_elem->Calculate(ADVPROJ,
output,CurrentProcessInfo);
257 #pragma omp parallel for
258 for (
int i = 0;
i < number_of_nodes;
i++) {
260 if (it_node->FastGetSolutionStepValue(NODAL_AREA) == 0.0)
261 it_node->FastGetSolutionStepValue(NODAL_AREA) = 1.0;
262 const double area_inverse = 1.0 / it_node->FastGetSolutionStepValue(NODAL_AREA);
263 it_node->FastGetSolutionStepValue(ADVPROJ) *= area_inverse;
264 it_node->FastGetSolutionStepValue(DIVPROJ) *= area_inverse;
279 itNode != rModelPart.
NodesEnd(); ++itNode)
281 itNode->FastGetSolutionStepValue(REACTION_X,0) = 0.0;
282 itNode->FastGetSolutionStepValue(REACTION_Y,0) = 0.0;
283 itNode->FastGetSolutionStepValue(REACTION_Z,0) = 0.0;
286 for (ModelPart::ElementsContainerType::ptr_iterator itElem = rModelPart.
Elements().ptr_begin();
287 itElem != rModelPart.
Elements().ptr_end(); ++itElem)
289 (*itElem)->CalculateLocalSystem(LHS_Contribution,RHS_Contribution,rCurrentProcessInfo);
291 (*itElem)->CalculateLocalVelocityContribution(SteadyLHS,RHS_Contribution,rCurrentProcessInfo);
296 unsigned int index = 0;
298 for (
unsigned int i = 0;
i < NumNodes;
i++)
300 rGeom[
i].FastGetSolutionStepValue(REACTION_X,0) -= RHS_Contribution[index++];
301 rGeom[
i].FastGetSolutionStepValue(REACTION_Y,0) -= RHS_Contribution[index++];
302 if (Dimension == 3) rGeom[
i].FastGetSolutionStepValue(REACTION_Z,0) -= RHS_Contribution[index++];
324 double mVelocityRelaxationFactor;
325 double mPressureRelaxationFactor;
327 Process::Pointer mpTurbulenceModel;
328 typename TSparseSpace::DofUpdaterPointerType mpDofUpdater = TSparseSpace::CreateDofUpdater();
virtual bool AssembleCurrentData(Variable< int > const &ThisVariable)
Definition: communicator.cpp:502
virtual int MyPID() const
Definition: communicator.cpp:91
Base class for all Conditions.
Definition: condition.h:59
virtual void CalculateLocalVelocityContribution(MatrixType &rDampingMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Definition: condition.h:922
std::vector< std::size_t > EquationIdVectorType
Definition: condition.h:98
virtual void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &rCurrentProcessInfo) const
Definition: condition.h:260
virtual void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Definition: condition.h:408
Base class for all Elements.
Definition: element.h:60
virtual void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &rCurrentProcessInfo) const
Definition: element.h:258
virtual void CalculateLocalVelocityContribution(MatrixType &rDampingMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:972
virtual void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:405
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
GeometryType & GetGeometry()
Returns the reference of the geometry.
Definition: geometrical_object.h:158
Geometry base class.
Definition: geometry.h:71
SizeType PointsNumber() const
Definition: geometry.h:528
SizeType WorkingSpaceDimension() const
Definition: geometry.h:1287
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
Communicator & GetCommunicator()
Definition: model_part.h:1821
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
SizeType NumberOfElements(IndexType ThisIndex=0) const
Definition: model_part.h:1027
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
SizeType NumberOfNodes(IndexType ThisIndex=0) const
Definition: model_part.h:341
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
Definition: residualbased_simple_steady_scheme.h:34
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: residualbased_simple_steady_scheme.h:176
BaseType::TSystemVectorType TSystemVectorType
Definition: residualbased_simple_steady_scheme.h:47
void SetVelocityRelaxationFactor(double factor)
Definition: residualbased_simple_steady_scheme.h:92
void CalculateSystemContributions(Element &rCurrentElement, LocalSystemMatrixType &LHS_Contribution, LocalSystemVectorType &RHS_Contribution, Element::EquationIdVectorType &EquationId, const ProcessInfo &CurrentProcessInfo) override
This function is designed to be called in the builder and solver to introduce the selected time integ...
Definition: residualbased_simple_steady_scheme.h:126
void CalculateSystemContributions(Condition &rCurrentCondition, LocalSystemMatrixType &LHS_Contribution, LocalSystemVectorType &RHS_Contribution, Condition::EquationIdVectorType &EquationId, const ProcessInfo &CurrentProcessInfo) override
Functions totally analogous to the precedent but applied to the "condition" objects.
Definition: residualbased_simple_steady_scheme.h:151
BaseType::DofsArrayType DofsArrayType
Definition: residualbased_simple_steady_scheme.h:43
~ResidualBasedSimpleSteadyScheme() override
Definition: residualbased_simple_steady_scheme.h:81
BaseType::TSystemMatrixType TSystemMatrixType
Definition: residualbased_simple_steady_scheme.h:45
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: residualbased_simple_steady_scheme.h:49
void SetPressureRelaxationFactor(double factor)
Definition: residualbased_simple_steady_scheme.h:102
double GetVelocityRelaxationFactor() const
Definition: residualbased_simple_steady_scheme.h:87
KRATOS_CLASS_POINTER_DEFINITION(ResidualBasedSimpleSteadyScheme)
void FinalizeNonLinIteration(ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
Function to be called when it is needed to finalize an iteration. It is designed to be called at the ...
Definition: residualbased_simple_steady_scheme.h:216
void FinalizeSolutionStep(ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
Function called once at the end of a solution step, after convergence is reached if an iterative proc...
Definition: residualbased_simple_steady_scheme.h:269
void CalculateRHSContribution(Condition &rCurrentCondition, LocalSystemVectorType &rRHS_Contribution, Element::EquationIdVectorType &rEquationId, const ProcessInfo &rCurrentProcessInfo) override
Functions totally analogous to the precedent but applied to the "condition" objects.
Definition: residualbased_simple_steady_scheme.h:196
void Update(ModelPart &rModelPart, DofsArrayType &rDofSet, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
Performing the update of the solution.
Definition: residualbased_simple_steady_scheme.h:107
ResidualBasedSimpleSteadyScheme(double VelocityRelaxationFactor, double PressureRelaxationFactor, unsigned int DomainSize, Process::Pointer pTurbulenceModel)
Definition: residualbased_simple_steady_scheme.h:68
Scheme< TSparseSpace, TDenseSpace > BaseType
Definition: residualbased_simple_steady_scheme.h:41
Element::GeometryType GeometryType
Definition: residualbased_simple_steady_scheme.h:53
ResidualBasedSimpleSteadyScheme(double VelocityRelaxationFactor, double PressureRelaxationFactor, unsigned int DomainSize)
Definition: residualbased_simple_steady_scheme.h:59
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: residualbased_simple_steady_scheme.h:51
double GetPressureRelaxationFactor() const
Definition: residualbased_simple_steady_scheme.h:97
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
virtual void EquationId(const Element &rElement, Element::EquationIdVectorType &rEquationId, const ProcessInfo &rCurrentProcessInfo)
This method gets the eqaution id corresponding to the current element.
Definition: scheme.h:636
typename TSparseSpace::VectorType TSystemVectorType
Vector type definition.
Definition: scheme.h:74
typename TDenseSpace::VectorType LocalSystemVectorType
Local system vector type definition.
Definition: scheme.h:80
virtual void FinalizeSolutionStep(ModelPart &rModelPart, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b)
Function called once at the end of a solution step, after convergence is reached if an iterative proc...
Definition: scheme.h:294
typename TDenseSpace::MatrixType LocalSystemMatrixType
Local system matrix type definition.
Definition: scheme.h:77
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_INFO_IF(label, conditional)
Definition: logger.h:251
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
output
Definition: generate_frictional_mortar_condition.py:444
integer i
Definition: TensorModule.f:17
float factor
for node in (self.combined_model_part).Nodes: pold = node.GetSolutionStepValue(PRESSURE,...
Definition: ulf_PGLASS.py:254