https://mooseframework.inl.gov
INSFEFluidEnergyDirichletBC.C
Go to the documentation of this file.
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 
11 
13 registerMooseObjectRenamed("NavierStokesApp",
14  MDFluidEnergyDirichletBC,
15  "02/01/2024 00:00",
17 
20 {
22 
23  params.addClassDescription(
24  "Imposes a Dirichlet condition on temperature at inlets. Is not applied at outlets");
25  params.addRequiredCoupledVar("u", "velocity in x-direction");
26  params.addCoupledVar("v", "velocity in y-direction"); // required in 2D/3D
27  params.addCoupledVar("w", "velocity in z-direction"); // required in 3D
28 
29  params.addParam<FunctionName>("v_fn", "Velocity function with time at the boundary");
30 
31  params.addParam<Real>("T_scale", 1.0, "Coefficient to multiply the temperature with");
32  params.addParam<FunctionName>("T_fn", "A function that describes the temperature");
33  params.addCoupledVar("T_scalar", "A scalar value is multiplied by the temperature");
34 
35  params.addRequiredParam<VectorValue<Real>>("out_norm", "out norm of the boundary");
36 
37  return params;
38 }
39 
41  : NodalBC(parameters),
42  _out_norm(getParam<VectorValue<Real>>("out_norm")),
43  _u_vel(coupledValueOld("u")),
44  _v_vel(_mesh.dimension() >= 2 ? coupledValueOld("v") : _zero),
45  _w_vel(_mesh.dimension() == 3 ? coupledValueOld("w") : _zero),
46  _T_scale(getParam<Real>("T_scale")),
47  _T_scalar(isParamValid("T_scalar") ? coupledScalarValue("T_scalar") : _zero),
48  _has_vbc(isParamValid("v_fn")),
49  _velocity_fn(_has_vbc ? &getFunction("v_fn") : NULL),
50  _T_fn(isParamValid("T_fn") ? &getFunction("T_fn") : NULL)
51 {
52  if (isParamValid("T_scalar") == isParamValid("T_fn"))
53  mooseError("Please provide one and only one of 'T_scalar' and 'T_fn'");
54 }
55 
56 bool
58 {
59  RealVectorValue vec_vel(_u_vel[0], _v_vel[0], _w_vel[0]);
60 
61  Real v_bc = 0.0;
62  if (_has_vbc)
63  v_bc = -_velocity_fn->value(_t, *_current_node);
64  else
65  v_bc = vec_vel * _out_norm;
66 
67  if (v_bc < 0.) // Inlet
68  return true;
69  else
70  return false;
71 }
72 
73 bool
75 {
76  return isInlet();
77 }
78 
79 Real
81 {
82  if (isInlet())
83  {
84  Real T_bc = isParamValid("T_scalar") ? _T_scalar[0] : _T_fn->value(_t, *_current_node);
85  return _u[_qp] - _T_scale * T_bc;
86  }
87  else
88  return 0.0;
89 }
90 
91 Real
93 {
94  return isInlet() ? 1.0 : 0.0;
95 }
96 
97 Real
99 {
100  return 0.0;
101 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const Node *const & _current_node
registerMooseObject("NavierStokesApp", INSFEFluidEnergyDirichletBC)
registerMooseObjectRenamed("NavierStokesApp", MDFluidEnergyDirichletBC, "02/01/2024 00:00", INSFEFluidEnergyDirichletBC)
virtual Real computeQpResidual() override
const unsigned int _qp
void addRequiredParam(const std::string &name, const std::string &doc_string)
virtual Real computeQpJacobian() override
bool isParamValid(const std::string &name) const
INSFEFluidEnergyDirichletBC(const InputParameters &parameters)
Real & _t
A conditional Dirichlet BC for the energy (temperature) equation.
void addCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static InputParameters validParams()
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
virtual Real value(Real t, const Point &p) const
static InputParameters validParams()
const VariableValue & _u