Skip to content

Commit

Permalink
Address Peter's reviews- tests and doc #28951
Browse files Browse the repository at this point in the history
  • Loading branch information
freiler committed Nov 11, 2024
1 parent 597925a commit 247b20c
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 23 deletions.
2 changes: 1 addition & 1 deletion framework/include/linearfvkernels/LinearFVSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ class LinearFVSource : public LinearFVElementalKernel
const Moose::Functor<Real> & _source_density;

/// Scale factor
const Real & _scale;
const Real _scale;
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

This kernel adds the contributions of the energy advection term to the matrix and right hand side of the energy equation system for the finite volume SIMPLE segregated solver [SIMPLE.md].

This term is described by $\nabla \cdot \left(\rho\vec{u} c_p T \right)$ present in the energy equation conservation for an incompressible/weakly-compressible formulation. Currently, the kernel only supports constant specific heat values for $c_p$ and solves for a temperature variable. The specific heat value needs to be prescribed, otherwise it will default to its default value of $c_p=1$.
This term is described by $\nabla \cdot \left(\rho\vec{u} c_p T \right)$ present in the energy equation conservation for an incompressible/weakly-compressible formulation. Currently, the kernel only supports +constant specific heat values+ for $c_p$ and solves for a temperature variable. The specific heat value needs to be prescribed, otherwise it will default to its default value of $c_p=1$.

For FV, the integral of the advection term over a cell can be expressed as:

\begin{equation}
\int\limits_{V_C} \nabla \cdot \left(\rho\vec{u} c_p T \right) dV \approx \sum\limits_f (\rho \vec{u}\cdot \vec{n})_{RC} c_p T_f |S_f| \,
\end{equation}

where $T_f$ is a face temperature. The temperature acts as the advected quantity and an interpolation scheme (e.g. upwind) can be used to copmute the face value. This kernel adds the face contribution for each face $f$ to the right hand side and matrix.
where $T_f$ is a face temperature. The temperature acts as the advected quantity and an interpolation scheme (e.g. upwind) can be used to compute the face value. This kernel adds the face contribution for each face $f$ to the right hand side and matrix.

The face mass flux $(\rho \vec{u}\cdot \vec{n})_{RC}$ is provided by the [RhieChowMassFlux.md] object which uses pressure
gradients and the discrete momentum equation to compute face velocities and mass fluxes.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# LinearFVMomentumBoussinesq

This kernel adds the contributions of the Boussinesq buoyancy treatment for density through a force/source term to the right hand side of the momentum equation system for the finite volume SIMPLE segregated solver [SIMPLE.md].
This kernel adds the contributions of the Boussinesq buoyancy treatment for density through a force/source term to the right hand side of the momentum equation system for the finite volume SIMPLE segregated solver [SIMPLE.md]. The Boussinesq buoyancy treatment is applicable for low changes in density, and assumes constant density value in all other equation terms.

This term is described by $-\rho_{ref}\alpha\vec{g}(T - T_{ref})$ present in the momentum equation conservation when describing an incompressible fluid, where $\rho_{ref}$ is the reference density, $\alpha$ is the thermal expansion coefficient, $\vec{g}$ is the gravity vector, $T$ is the temperature, and $T_{ref}$ is a reference temperature. The Boussinesq buoyancy model assumes the changes in density as a function of temperature are linear and relevant only in the buoyant force term of the equation system. The Boussinesq kernel allows for modeling natural convection.

This term deals only with the force due to the variation in density $\Delta \rho \vec{g}$, with the fluid density being $\rho = \rho_{ref}+\Delta\rho$. Thus, with no extra added terms to the conventional incompressible Navier Stokes equations, the system will solve for dynamic pressure.
This term deals only with the force due to the variation in density $\Delta \rho \vec{g}$, with the fluid density being $\rho = \rho_{ref}+\Delta\rho$. Thus, with no extra added terms to the conventional incompressible Navier Stokes equations, the system will solve for the total pressure minus the hydrostatic pressure.
For natural convection simulations, it is advisable to compute relevant dimensionless numbers such as the Rayleigh number or the Richardson number to decide on the need for turbulence models, mesh refinement and stability considerations.

!syntax parameters /LinearFVKernels/LinearFVMomentumBoussinesq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ class LinearFVMomentumBoussinesq : public LinearFVElementalKernel

protected:
/// Fluid Temperature
MooseLinearVariableFV<Real> & getTemperatureVariable(const std::string & vname);
const MooseLinearVariableFV<Real> & getTemperatureVariable(const std::string & vname);

/// Index x|y|z of the momentum equation component
const unsigned int _index;
/// Pointer to the linear finite volume temperature variable
MooseLinearVariableFV<Real> & _temperature_var;
const MooseLinearVariableFV<Real> & _temperature_var;
/// The gravity vector
const RealVectorValue _gravity;
/// The thermal expansion coefficient
const Moose::Functor<Real> & _alpha;
/// Reference temperature at which the value of _rho was measured
/// Reference temperature at which the reference value of the density (_rho) was measured
const Real _ref_temperature;
/// the density
const Moose::Functor<Real> & _rho;
Expand Down
1 change: 0 additions & 1 deletion modules/navier_stokes/src/executioners/SIMPLE.C
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,6 @@ SIMPLE::execute()
_energy_equation_relaxation,
_energy_linear_control,
_energy_l_abs_tol);

}
_problem.execute(EXEC_NONLINEAR);
// Printing residuals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,11 @@ LinearFVMomentumBoussinesq::LinearFVMomentumBoussinesq(const InputParameters & p
_ref_temperature(getParam<Real>("ref_temperature")),
_rho(getFunctor<Real>(NS::density))
{
_temperature_var.computeCellGradients();
if (!_rho.isConstant())
paramError(NS::density, "The density in the boussinesq term is not constant!");
}

MooseLinearVariableFV<Real> &
const MooseLinearVariableFV<Real> &
LinearFVMomentumBoussinesq::getTemperatureVariable(const std::string & vname)
{
auto * ptr = dynamic_cast<MooseLinearVariableFV<Real> *>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ alpha_b = 1e-4
[mesh]
type = CartesianMeshGenerator
dim = 2
dx = '1.5'
dy = '0.3'
ix = '55'
iy = '20'
dx = '1.'
dy = '0.2'
ix = '10'
iy = '5'
[]
[]

Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ walls = 'right left top bottom'
xmax = 1
ymin = 0
ymax = 1
nx = 40
ny = 40
nx = 30
ny = 30
[]
[]

Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Tests]
design = 'LinearFVEnergyAdvection.md LinearFVMomentumBoussinesq.md'
issues = '#28951'
[diff_heated_cavity_linear_segregated]
type = 'Exodiff'
input = 'diff_heated_cavity_linear_segregated.i'
exodiff = 'diff_heated_cavity_linear_segregated_out.e'
requirement = 'The system shall be able to use the density Boussinesq approximation to solve for a differentially heated 2D cavity.'
[]
[]
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,4 @@
rel_err = 1.0E-7
method = opt
[]
[diff_heated_cavity_linear_segregated]
type = 'Exodiff'
input = 'diff_heated_cavity_linear_segregated.i'
exodiff = 'diff_heated_cavity_linear_segregated_out.e'
requirement = 'The system shall be able to use the density Boussinesq approximation to solve for a differentially heated 2D cavity.'
[]
[]

0 comments on commit 247b20c

Please sign in to comment.