https://mooseframework.inl.gov
INSFEFluidMassBC.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 
10 #include "INSFEFluidMassBC.h"
11 
12 registerMooseObject("NavierStokesApp", INSFEFluidMassBC);
13 registerMooseObjectRenamed("NavierStokesApp", MDFluidMassBC, "02/01/2024 00:00", INSFEFluidMassBC);
14 
17 {
19  params.addClassDescription(
20  "Specifies flow of mass through a boundary given a velocity function or postprocessor");
21  params.addParam<FunctionName>("v_fn", "Velocity function with time at the boundary");
22  params.addParam<std::string>("v_pps",
23  "The Postprocessor name to setup the velocity boundary value.");
24 
25  return params;
26 }
27 
29  : INSFEFluidIntegratedBCBase(parameters),
30  _has_vfn(parameters.isParamValid("v_fn")),
31  _has_vpps(parameters.isParamValid("v_pps")),
32  _velocity_fn(_has_vfn ? &getFunction("v_fn") : NULL),
33  _v_pps_name(_has_vpps ? getParam<std::string>("v_pps") : "")
34 {
35  if (_has_vfn && _has_vpps)
36  mooseError("'v_fn' and 'v_pps' cannot be BOTH specified in INSFEFluidMassBC.");
37 }
38 
39 Real
41 {
43 
44  Real v_bc = 0;
45  if (_has_vfn)
46  v_bc = -_velocity_fn->value(_t, _q_point[_qp]); // normals[i] at inlet is negative.
47  else if (_has_vpps)
49  else
50  v_bc = vec_vel * _normals[_qp];
51 
52  return _rho[_qp] * v_bc * _test[_i][_qp];
53 }
54 
55 Real
57 {
58  return 0;
59 }
60 
61 Real
63 {
64  unsigned m = this->mapVarNumber(jvar);
65 
66  switch (m)
67  {
68  case 1:
69  case 2:
70  case 3:
71  {
72  if (_has_vfn || _has_vpps)
73  return 0.;
74  else
75  return _rho[_qp] * _phi[_j][_qp] * _normals[_qp](m - 1) * _test[_i][_qp];
76  }
77 
78  case 4:
79  {
81  Real rho, drho_dp, drho_dT;
82  _eos.rho_from_p_T(_u[_qp], _temperature[_qp], rho, drho_dp, drho_dT);
83  return drho_dT * _phi[_j][_qp] * vec_vel * _normals[_qp] * _test[_i][_qp];
84  }
85 
86  default:
87  return 0;
88  }
89 }
const VariableTestValue & _test
INSFEFluidMassBC(const InputParameters &parameters)
unsigned int _j
const MooseArray< Point > & _normals
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
unsigned int _i
const VariablePhiValue & _phi
unsigned int _qp
A specific BC for the mass (pressure) equation.
static InputParameters validParams()
std::string _v_pps_name
static InputParameters validParams()
This class couples together all the variables for the 3D fluid equations to allow them to be used in ...
const MooseArray< Point > & _q_point
registerMooseObject("NavierStokesApp", INSFEFluidMassBC)
const SinglePhaseFluidProperties & _eos
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
virtual const PostprocessorValue & getPostprocessorValueByName(const PostprocessorName &name) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const MaterialProperty< Real > & _rho
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
virtual Real computeQpResidual() override
registerMooseObjectRenamed("NavierStokesApp", MDFluidMassBC, "02/01/2024 00:00", INSFEFluidMassBC)
virtual Real value(Real t, const Point &p) const
virtual Real computeQpJacobian() override
const VariableValue & _u
const Function * _velocity_fn