Skip to content

Commit

Permalink
Apply suggestions from code review @tanoret idaholab#27800 idaholab#2…
Browse files Browse the repository at this point in the history
…7887 idaholab#27888

Co-authored-by: Mauricio Tano <mauriciotano@gmail.com>

Addressing tanoret review changes idaholab#27800 idaholab#27887 idaholab#27888
  • Loading branch information
freiler authored and Freile committed Jun 17, 2024
1 parent 523ec4b commit ca966fb
Show file tree
Hide file tree
Showing 15 changed files with 53 additions and 363 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Computes the dimensionless wall distance $y^+$ for RANS models.

Four different formulations are supported as defined by the "wall_treatment" parameter.
Four different formulations are supported as defined by the [!param](/AuxKernels/RANSYPlusAux/wall_treatment) parameter.
Details on each of the four formulations can be found in
[INSFVTurbulentViscosityWallFunction](source/fvbcs/INSFVTurbulentViscosityWallFunction.md).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,23 @@ $\mu_w = \mu + \mu_t $ , such that the wall shear stress $\tau_w$ is accurately
without the need of fully resolving the gradients at the near wall region.

\begin{equation}
\tau_w = /frac{ \mu_w $u_p$}{y_p}
\tau_w = /frac{ \mu_w u_p}{y_p}
\end{equation}

To obtain the relationship between the wall shear stress and the dimensionless wall distance,
four different formulations are supportedas defined by the
[!param](/FVBCs/INSFVTurbulentViscosityWallFunction/wall_treatment) parameter.
where:

To define a proper grid spacing during the meshing process, we recommend using the Auxiliary Kernel
- $\mu_w = \mu + \mu_t$ is the total viscosity evaluated at the wall face
- $\mu_t$ is the turbulent viscosity, evaluated at the wall for the purpose of this boundary condition
- $\mu$ is the kinematic viscosity, evaluated at the wall for the purpose of this boundary condition
- $\tau_w$ is the wall-shear stress
- $u_p$ is the wall-parallel velocity at the centroid
- $y_p$ is the wall normal distance to the centroid

To impose a correct boundary condition for $\mu_t$, as seen in the Equation above, we need to compute $\tau_w$ using analytical
relationships between the wall shear stress and the dimensionless wall distance $y^+$. For this purpose, four different
formulations are supported as defined by the [!param](/FVBCs/INSFVTurbulentViscosityWallFunction/wall_treatment) parameter.

To set the grid spacing for the first cell near the wall in your mesh, we recommend using the Auxiliary Kernel
[RANSYPlusAux.md]
to estimate the dimensionless wall distance $y^+$.

Expand All @@ -46,6 +55,7 @@ for the turbulent viscosity.
where:

- $\rho$ is the density
- $\mu$ is the kinematic viscosity
- $u_{\tau} = \sqrt{\frac{\tau_w}{\rho}}$ is the friction velocity and $\tau_w$ is the wall friction
- $y_p$ is the distance from the boundary to the center of the near-wall cell
- $u_p$ is the parallel velocity to the boundary computed at the center of the near-wall cell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A different treatment is used for the bulk and the near wall regions.

## Bulk formulation:

The turbulent production $G_\epsilon$ is modeled as follows:
The production of turbulent kinetic energy dissipation $G_\epsilon$ is modeled as follows:

\begin{equation}
G_{\epsilon} = C_{1,\epsilon} \frac{\epsilon}{k} G_k \,,
Expand All @@ -29,6 +29,7 @@ where:

- $C_{2,\epsilon} = 1.92$ is a closure parameter,
- $\epsilon$ is the solution variable, i.e., the dissipation rate of the turbulent kinetic energy,
- $k$ is the turbulent kinetic energy,
- $t_k = \frac{k}{\epsilon}$ is the turbulent time scale; if the [!param](/FVKernels/INSFVTKEDSourceSink/linearized_model) is `true`, this timescale is computed from the previous iteration; if [!param](/FVKernels/INSFVTKEDSourceSink/linearized_model) is `false`, in a nonlinear solve, this timescale is aded to the Jacobian.

## Wall formulation:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ G_k = min \left( G_k , C_{PL} \rho \epsilon \right) \,,

where:

- $C_{PL}$ it the limiter constant, and set to a recommended value of 10 .
- $C_{PL}$ it the limiter constant, and set by default to a recommended value of 10 \cite{durbin1996k}.

## Wall formulation:

Expand All @@ -59,6 +59,8 @@ incremental fixed-point search algorithm.
The cells belonging to the `sub-laminar` boundary layers are defined as those
for which $y^+ < 11.25$.
The ones belonging to the `logarithmic` boundary layer are those for which $y^+ \ge 11.25$.
The imposed threshold of $y^+ = 11.25$ is given by the value of $y^+$ at which the `sub-laminar`
and `logarithmic` boundary profiles intersect.

In the `sub-laminar` region production of turbulent kinetic energy is negligible, therefore, if $y^+ \lt 11.25$:

Expand All @@ -69,7 +71,7 @@ G_k = 0.0 \,,
In the `logarithmic` boundary layers the production term is no longer negligible and is defined as:

\begin{equation}
G_k = \tau_w ||\nabla \vec{u}|| = \left( \mu_t + \mu \right) ||\nabla \vec{u}|| \frac{ C_{\mu}^{0.25} \sqrt(k)}{\kappa y_p} \,,
G_k = \tau_w ||\nabla \vec{u}|| = \mu_w ||\nabla \vec{u}|| \frac{ C_{\mu}^{0.25} \sqrt(k)}{\kappa y_p} \,,
\end{equation}

where:
Expand All @@ -84,7 +86,7 @@ The formulation assumes that the near wall value is already imposed in the $\mu_
When solving a linear problem, instead of the nonlinear formulation, the production term is formulated as:

\begin{equation}
G_k = \left( \mu_t + \mu \right) ||\nabla \vec{u}|| \frac{ C_{\mu}^{0.25} k}{\sqrt{k_{old}} \kappa y_p} \,.
G_k = \mu_w ||\nabla \vec{u}|| \frac{ C_{\mu}^{0.25} k}{\sqrt{k_{old}} \kappa y_p} \,.
\end{equation}

where:
Expand Down
87 changes: 0 additions & 87 deletions modules/navier_stokes/include/auxkernels/kEpsilonViscosityAux.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,90 +79,3 @@ class kEpsilonViscosityAux : public AuxKernel
std::map<const Elem *, std::vector<const FaceInfo *>> _face_infos;
///@}
};

// WORKING VERSION //

//* This file is part of the MOOSE framework
//* https://www.mooseframework.org
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html

// #pragma once

// #include "AuxKernel.h"
// #include "INSFVVelocityVariable.h"

// /**
// * Computes the turbuent viscosity for the k-Epsilon model.
// * Implements two near-wall treatments: equilibrium and non-equilibrium wall functions.
// */
// class kEpsilonViscosityAux : public AuxKernel
// {
// public:
// static InputParameters validParams();

// virtual void initialSetup() override;

// kEpsilonViscosityAux(const InputParameters & parameters);

// protected:
// virtual Real computeValue() override;

// /// Local method to find friction velocity.
// /// This method may need to be reimplemented for each new turbulence model
// ADReal findUStarLocalMethod(const ADReal & u, const Real & dist);

// /// The dimension of the domain
// const unsigned int _dim;

// /// x-velocity
// const Moose::Functor<ADReal> & _u_var;
// /// y-velocity
// const Moose::Functor<ADReal> * _v_var;
// /// z-velocity
// const Moose::Functor<ADReal> * _w_var;

// /// Turbulent kinetic energy
// const Moose::Functor<ADReal> & _k;
// /// Turbulent kinetic energy dissipation rate
// const Moose::Functor<ADReal> & _epsilon;

// /// Density
// const Moose::Functor<ADReal> & _rho;
// /// Dynamic viscosity
// const Moose::Functor<ADReal> & _mu;

// /// C-mu closure coefficient
// const Real _C_mu;

// /// Wall boundaries
// const std::vector<BoundaryName> & _wall_boundary_names;

// /// If the user wants the linearized computation of y_plus
// const bool _linearized_yplus;

// /// If the user wants to enable bulk wall treatment
// const bool _bulk_wall_treatment;

// /// IF the user requested non-equilibrium wall treatment
// const bool _non_equilibrium_treatment;

// // -- Parameters of the wall function method

// /// Maximum number of iterations to find the friction velocity
// static constexpr int _MAX_ITERS_U_TAU{50};

// /// Relative tolerance to find the friction velocity
// static constexpr Real _REL_TOLERANCE{1e-4};

// ///@{
// /// Maps for wall bounded elements
// std::map<const Elem *, bool> _wall_bounded;
// std::map<const Elem *, std::vector<Real>> _dist;
// std::map<const Elem *, std::vector<const FaceInfo *>> _face_infos;
// ///@}
// };
2 changes: 2 additions & 0 deletions modules/navier_stokes/include/base/NS.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ static const std::string TKED = "epsilon";
// Turbulence constants
static constexpr Real von_karman_constant = 0.4187;
static constexpr Real E_turb_constant = 9.793;
// Lower limit for mu_t
static constexpr Real mu_t_low_limit = 1.0e-12;
}

namespace NS_DEFAULT_VALUES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,57 +51,3 @@ class INSFVTurbulentViscosityWallFunction : public FVDirichletBCBase
/// Method used for wall treatment
const MooseEnum _wall_treatment;
};

// //* This file is part of the MOOSE framework
// //* https://www.mooseframework.org
// //*
// //* All rights reserved, see COPYRIGHT for full restrictions
// //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
// //*
// //* Licensed under LGPL 2.1, please see LICENSE for details
// //* https://www.gnu.org/licenses/lgpl-2.1.html

// #pragma once

// #include "FVDirichletBCBase.h"
// #include "FVFluxBC.h"

// /**
// * Applies a wall function to the turbulent viscosity field
// */
// class INSFVTurbulentViscosityWallFunction : public FVDirichletBCBase
// {
// public:
// INSFVTurbulentViscosityWallFunction(const InputParameters & parameters);

// static InputParameters validParams();

// ADReal boundaryValue(const FaceInfo & fi) const override;

// private:
// /// the dimension of the domain
// const unsigned int _dim;

// /// x-velocity
// const Moose::Functor<ADReal> & _u_var;
// /// y-velocity
// const Moose::Functor<ADReal> * _v_var;
// /// z-velocity
// const Moose::Functor<ADReal> * _w_var;

// /// Density
// const Moose::Functor<ADReal> & _rho;
// /// Dynamic viscosity
// const Moose::Functor<ADReal> & _mu;
// /// Turbulent dynamic viscosity
// const Moose::Functor<ADReal> & _mu_t;

// /// Turbulent kinetic energy
// const Moose::Functor<ADReal> & _k;

// /// C_mu turbulent coefficient
// const Real _C_mu;

// /// Method used for wall treatment
// const MooseEnum _wall_treatment;
// };
94 changes: 0 additions & 94 deletions modules/navier_stokes/include/fvkernels/INSFVTKEDSourceSink.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,97 +88,3 @@ class INSFVTKEDSourceSink : public FVElementalKernel
std::map<const Elem *, std::vector<const FaceInfo *>> _face_infos;
///@}
};

// //* This file is part of the MOOSE framework
// //* https://www.mooseframework.org
// //*
// //* All rights reserved, see COPYRIGHT for full restrictions
// //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
// //*
// //* Licensed under LGPL 2.1, please see LICENSE for details
// //* https://www.gnu.org/licenses/lgpl-2.1.html

// #pragma once

// #include "FVElementalKernel.h"
// #include "MathFVUtils.h"
// #include "INSFVMomentumResidualObject.h"
// #include "INSFVVelocityVariable.h"

// /**
// * Computes the source and sink terms for the turbulent kinetic energy dissipation rate.
// */
// class INSFVTKEDSourceSink : public FVElementalKernel
// {
// public:
// static InputParameters validParams();

// virtual void initialSetup() override;

// INSFVTKEDSourceSink(const InputParameters & parameters);

// protected:
// ADReal computeQpResidual() override;

// protected:
// /// The dimension of the simulation
// const unsigned int _dim;

// /// x-velocity
// const Moose::Functor<ADReal> & _u_var;
// /// y-velocity
// const Moose::Functor<ADReal> * _v_var;
// /// z-velocity
// const Moose::Functor<ADReal> * _w_var;

// /// Turbulent kinetic energy
// const Moose::Functor<ADReal> & _k;

// /// Density
// const Moose::Functor<ADReal> & _rho;

// /// Dynamic viscosity
// const Moose::Functor<ADReal> & _mu;

// /// Turbulent dynamic viscosity
// const Moose::Functor<ADReal> & _mu_t;

// /// Wall boundaries
// const std::vector<BoundaryName> & _wall_boundary_names;

// /// Maximum mixing length allowed for the domain
// const Real _max_mixing_length;

// /// If the user wants to use the linearized model
// const bool _linearized_model;

// /// No equilibrium treatement
// const bool _non_equilibrium_treatment;

// /// Value of the first epsilon closure coefficient
// const Real _C1_eps;

// /// Value of the second epsilon closure coefficient
// const Real _C2_eps;

// /// C_mu constant
// const Real _C_mu;

// // Production Limiter Constant
// const Real _C_pl;

// /// Stored strain rate
// std::map<const Elem *, Real> _symmetric_strain_tensor_norm_old;
// /// Map for the previous destruction field
// std::map<const Elem *, Real> _old_destruction;

// /// Map for the previous nonlienar iterate
// std::map<const Elem *, Real> _pevious_nl_sol;

// ///@{
// /** Maps for wall treatment */
// std::map<const Elem *, bool> _wall_bounded;
// std::map<const Elem *, std::vector<Real>> _dist;
// std::map<const Elem *, std::vector<const FaceInfo *>> _face_infos;
// ///@}
// };
Loading

0 comments on commit ca966fb

Please sign in to comment.