www.mooseframework.org
NSInternalEnergyAux.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 // Navier-Stokes includes
11 #include "NSInternalEnergyAux.h"
12 #include "NS.h"
13 
14 // MOOSE includes
15 #include "MooseMesh.h"
16 
17 registerMooseObject("NavierStokesApp", NSInternalEnergyAux);
18 
21 {
23 
24  params.addClassDescription("Auxiliary kernel for computing the internal energy of the fluid.");
25  params.addRequiredCoupledVar(NS::density, "density");
26  params.addRequiredCoupledVar(NS::velocity_x, "x-velocity");
27  params.addCoupledVar(NS::velocity_y, "y-velocity"); // Only required in >= 2D
28  params.addCoupledVar(NS::velocity_z, "z-velocity"); // Only required in 3D...
29  params.addRequiredCoupledVar(NS::total_energy_density, "total energy");
30 
31  return params;
32 }
33 
35  : AuxKernel(parameters),
36  _rho(coupledValue(NS::density)),
37  _u_vel(coupledValue(NS::velocity_x)),
38  _v_vel(_mesh.dimension() >= 2 ? coupledValue(NS::velocity_y) : _zero),
39  _w_vel(_mesh.dimension() == 3 ? coupledValue(NS::velocity_z) : _zero),
40  _rho_et(coupledValue(NS::total_energy_density))
41 {
42 }
43 
44 Real
46 {
47  const RealVectorValue vel(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
48 
49  return _rho_et[_qp] / _rho[_qp] - 0.5 * vel.norm_sq();
50 }
static const std::string total_energy_density
Definition: NS.h:63
Auxiliary kernel for computing the internal energy of the fluid.
static const std::string velocity_z
Definition: NS.h:48
static const std::string density
Definition: NS.h:33
registerMooseObject("NavierStokesApp", NSInternalEnergyAux)
const VariableValue & _rho
static const std::string velocity_x
Definition: NS.h:46
virtual Real computeValue()
const VariableValue & _u_vel
auto norm_sq() const -> decltype(std::norm(Real()))
const VariableValue & _w_vel
static const std::string velocity_y
Definition: NS.h:47
void addCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
const VariableValue & _rho_et
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const VariableValue & _v_vel
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()
NSInternalEnergyAux(const InputParameters &parameters)
static InputParameters validParams()