https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
14 MDFluidEnergyDirichletBC,
15 "02/01/2024 00:00",
17
20{
22
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
56bool
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)
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
73bool
78
79Real
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
91Real
96
97Real
99{
100 return 0.0;
101}
registerMooseObject("NavierStokesApp", INSFEFluidEnergyDirichletBC)
registerMooseObjectRenamed("NavierStokesApp", MDFluidEnergyDirichletBC, "02/01/2024 00:00", INSFEFluidEnergyDirichletBC)
virtual Real value(Real t, const Point &p) const
A conditional Dirichlet BC for the energy (temperature) equation.
virtual Real computeQpResidual() override
virtual Real computeQpJacobian() override
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
INSFEFluidEnergyDirichletBC(const InputParameters &parameters)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void addCoupledVar(const std::string &name, const std::string &doc_string)
void mooseError(Args &&... args) const
bool isParamValid(const std::string &name) const
const Node *const & _current_node
const VariableValue & _u
static InputParameters validParams()
const unsigned int _qp
Real & _t