Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 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 : 19 : InputParameters 20 19 : NSInternalEnergyAux::validParams() 21 : { 22 19 : InputParameters params = AuxKernel::validParams(); 23 : 24 19 : params.addClassDescription("Auxiliary kernel for computing the internal energy of the fluid."); 25 19 : params.addRequiredCoupledVar(NS::density, "density"); 26 19 : params.addRequiredCoupledVar(NS::velocity_x, "x-velocity"); 27 19 : params.addCoupledVar(NS::velocity_y, "y-velocity"); // Only required in >= 2D 28 19 : params.addCoupledVar(NS::velocity_z, "z-velocity"); // Only required in 3D... 29 19 : params.addRequiredCoupledVar(NS::total_energy_density, "total energy"); 30 : 31 19 : return params; 32 0 : } 33 : 34 10 : NSInternalEnergyAux::NSInternalEnergyAux(const InputParameters & parameters) 35 : : AuxKernel(parameters), 36 20 : _rho(coupledValue(NS::density)), 37 10 : _u_vel(coupledValue(NS::velocity_x)), 38 10 : _v_vel(_mesh.dimension() >= 2 ? coupledValue(NS::velocity_y) : _zero), 39 10 : _w_vel(_mesh.dimension() == 3 ? coupledValue(NS::velocity_z) : _zero), 40 20 : _rho_et(coupledValue(NS::total_energy_density)) 41 : { 42 10 : } 43 : 44 : Real 45 284625 : NSInternalEnergyAux::computeValue() 46 : { 47 284625 : const RealVectorValue vel(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]); 48 : 49 284625 : return _rho_et[_qp] / _rho[_qp] - 0.5 * vel.norm_sq(); 50 : }