www.mooseframework.org
NSThermalBC.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
8 // Navier-Stokes includes
9 #include "NSThermalBC.h"
10 #include "NS.h"
11 
12 // FluidProperties includes
14 
15 template <>
16 InputParameters
18 {
19  InputParameters params = validParams<NodalBC>();
20  params.addClassDescription("NS thermal BC.");
21  params.addRequiredCoupledVar(NS::density, "density");
22  params.addRequiredParam<Real>("initial", "Initial temperature");
23  params.addRequiredParam<Real>("final", "Final temperature");
24  params.addRequiredParam<Real>("duration",
25  "Time over which temperature ramps up from initial to final");
26  params.addRequiredParam<UserObjectName>("fluid_properties",
27  "The name of the user object for fluid properties");
28  return params;
29 }
30 
31 NSThermalBC::NSThermalBC(const InputParameters & parameters)
32  : NodalBC(parameters),
33  _rho_var(coupled(NS::density)),
34  _rho(coupledValue(NS::density)),
35  _initial(getParam<Real>("initial")),
36  _final(getParam<Real>("final")),
37  _duration(getParam<Real>("duration")),
38  _fp(getUserObject<IdealGasFluidProperties>("fluid_properties"))
39 {
40 }
41 
42 Real
44 {
45  Real value;
46 
47  // For constant temperature, set _initial = _final, or set _duration=0 and set _final.
48  //
49  // T(t) = T_i + (T_f - T_i) * sin (pi/2 * t/t_d)
50  if (_t < _duration)
51  value = _initial + (_final - _initial) * std::sin((0.5 * libMesh::pi) * _t / _duration);
52  else
53  value = _final;
54 
55  // For the total energy, the essential BC is:
56  // rho*E = rho*(c_v*T + |u|^2/2)
57  //
58  // or, in residual form, (In general, this BC is coupled to the velocity variables.)
59  // rho*E - rho*(c_v*T + |u|^2/2) = 0
60  //
61  // ***at a no-slip wall*** this further reduces to (no coupling to velocity variables):
62  // rho*E - rho*cv*T = 0
63 
64  // std::ios_base::fmtflags flags = Moose::out.flags();
65  // Moose::out << std::scientific << std::setprecision(16);
66  // Moose::out << "rho*E =" << _u[_qp] << std::endl;
67  // Moose::out << "(_p[_qp] * _c_v[_qp] * value)=" << (_p[_qp] * _c_v[_qp] * value) << std::endl;
68  // //Moose::out << "_c_v[_qp] =" << _c_v[_qp] << std::endl;
69  // Moose::out.flags(flags);
70  return _u[_qp] - (_rho[_qp] * _fp.cv() * value);
71 }
Definition: NS.h:13
Real _initial
Definition: NSThermalBC.h:32
virtual Real computeQpResidual()
Definition: NSThermalBC.C:43
const std::string density
Definition: NS.h:15
Real _duration
Definition: NSThermalBC.h:34
virtual Real cv(Real v=0., Real u=0.) const override
Isochoric specific heat.
const VariableValue & _rho
Definition: NSThermalBC.h:30
const IdealGasFluidProperties & _fp
Definition: NSThermalBC.h:37
InputParameters validParams< NSThermalBC >()
Definition: NSThermalBC.C:17
Ideal gas fluid properties.
NSThermalBC(const InputParameters &parameters)
Definition: NSThermalBC.C:31