Skip to content

Commit

Permalink
Merge pull request #11025 from KratosMultiphysics/2F_hydraulic_applic…
Browse files Browse the repository at this point in the history
…ation_solver

Adding a new two fluid solver for hydraulic application
  • Loading branch information
uxuech authored Sep 22, 2023
2 parents 76c698f + 513313a commit 13b795a
Show file tree
Hide file tree
Showing 26 changed files with 15,911 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,41 @@ void TwoFluidNavierStokesAlphaMethod<TElementData>::CalculateOnIntegrationPoints
// Iterate over integration points to evaluate the artificial viscosity at each Gauss point
for (unsigned int g = 0; g < number_of_gauss_points; ++g){
this->UpdateIntegrationPointData(data, g, gauss_weights[g], row(shape_functions, g), shape_derivatives[g]);
rOutput[g] = CalculateArtificialDynamicViscositySpecialization(data);
rOutput[g] = this->GetValue(ARTIFICIAL_DYNAMIC_VISCOSITY);
}
}
else{
BaseType::CalculateOnIntegrationPoints(rVariable, rOutput, rCurrentProcessInfo);
}
}

template <class TElementData>
void TwoFluidNavierStokesAlphaMethod<TElementData>::Calculate(
const Variable<double> &rVariable,
double &rOutput,
const ProcessInfo &rCurrentProcessInfo)
{
// Create new temporary data container
TElementData data;
data.Initialize(*this, rCurrentProcessInfo);

// Get Shape function data
Vector gauss_weights;
Matrix shape_functions;
ShapeFunctionDerivativesArrayType shape_derivatives;
this->CalculateGeometryData(gauss_weights, shape_functions, shape_derivatives);
const unsigned int number_of_gauss_points = gauss_weights.size();
rOutput = 0.0;
if (rVariable == ARTIFICIAL_DYNAMIC_VISCOSITY){
// Iterate over integration points to evaluate the artificial viscosity at each Gauss point
for (unsigned int g = 0; g < number_of_gauss_points; ++g)
{
this->UpdateIntegrationPointData(data, g, gauss_weights[g], row(shape_functions, g), shape_derivatives[g]);
rOutput += CalculateArtificialDynamicViscositySpecialization(data);
}
rOutput /= number_of_gauss_points;
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// Public Inquiry

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@ class TwoFluidNavierStokesAlphaMethod : public TwoFluidNavierStokes<TElementData
const Variable<double> &rVariable,
std::vector<double> &rOutput,
const ProcessInfo &rCurrentProcessInfo) override;


void Calculate(
const Variable<double> &rVariable,
double &rOutput,
const ProcessInfo &rCurrentProcessInfo) override;
///@}
///@name Inquiry
///@{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ PYBIND11_MODULE(KratosFluidDynamicsApplication,m)

KRATOS_REGISTER_IN_PYTHON_VARIABLE(m,FIC_BETA);
KRATOS_REGISTER_IN_PYTHON_VARIABLE(m,VOLUME_ERROR);
KRATOS_REGISTER_IN_PYTHON_VARIABLE(m, CONVECTION_SCALAR);
KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(m, CONVECTION_VELOCITY);
KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(m, CONVECTION_SCALAR_GRADIENT);
KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(m, AUXILIAR_VECTOR_VELOCITY);

// Adjoint variables
KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(m, ADJOINT_FLUID_VECTOR_1 )
KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(m, ADJOINT_FLUID_VECTOR_2 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ void KratosFluidDynamicsApplication::Register() {
KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(COARSE_VELOCITY);

KRATOS_REGISTER_VARIABLE(VOLUME_ERROR);
KRATOS_REGISTER_VARIABLE(CONVECTION_SCALAR);
KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(CONVECTION_VELOCITY);
KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(CONVECTION_SCALAR_GRADIENT);
KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(AUXILIAR_VECTOR_VELOCITY);
KRATOS_REGISTER_VARIABLE(FIC_BETA);

// Wall modelling
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(COARSE_VELOCITY)

KRATOS_CREATE_VARIABLE(double,FIC_BETA)
KRATOS_CREATE_VARIABLE(double,VOLUME_ERROR)
KRATOS_CREATE_VARIABLE(double, CONVECTION_SCALAR)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(CONVECTION_VELOCITY)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(CONVECTION_SCALAR_GRADIENT)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(AUXILIAR_VECTOR_VELOCITY)

// Wall modelling
KRATOS_CREATE_VARIABLE(bool, SLIP_TANGENTIAL_CORRECTION_SWITCH)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS( FLUID_DYNAMICS_APPLICATIO
KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS( FLUID_DYNAMICS_APPLICATION, COARSE_VELOCITY)
KRATOS_DEFINE_APPLICATION_VARIABLE( FLUID_DYNAMICS_APPLICATION, double,FIC_BETA)
KRATOS_DEFINE_APPLICATION_VARIABLE( FLUID_DYNAMICS_APPLICATION, double,VOLUME_ERROR)
KRATOS_DEFINE_APPLICATION_VARIABLE(FLUID_DYNAMICS_APPLICATION, double, CONVECTION_SCALAR)
KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(FLUID_DYNAMICS_APPLICATION, CONVECTION_VELOCITY)
KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(FLUID_DYNAMICS_APPLICATION, CONVECTION_SCALAR_GRADIENT)
KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(FLUID_DYNAMICS_APPLICATION, AUXILIAR_VECTOR_VELOCITY)
KRATOS_DEFINE_APPLICATION_VARIABLE( FLUID_DYNAMICS_APPLICATION, Vector, FLUID_STRESS )
KRATOS_DEFINE_APPLICATION_VARIABLE( FLUID_DYNAMICS_APPLICATION, Vector, GAPS )
KRATOS_DEFINE_APPLICATION_VARIABLE( FLUID_DYNAMICS_APPLICATION, double, DIVERGENCE)
Expand Down
Loading

0 comments on commit 13b795a

Please sign in to comment.