https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
13registerMooseObjectRenamed("NavierStokesApp", MDFluidMassBC, "02/01/2024 00:00", INSFEFluidMassBC);
14
17{
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
39Real
41{
42 RealVectorValue vec_vel(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
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
55Real
60
61Real
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 {
80 RealVectorValue vec_vel(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
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 double rho
registerMooseObjectRenamed("NavierStokesApp", MDFluidMassBC, "02/01/2024 00:00", INSFEFluidMassBC)
registerMooseObject("NavierStokesApp", INSFEFluidMassBC)
virtual Real value(Real t, const Point &p) const
This class couples together all the variables for the 3D fluid equations to allow them to be used in ...
static InputParameters validParams()
const MaterialProperty< Real > & _rho
const SinglePhaseFluidProperties & _eos
A specific BC for the mass (pressure) equation.
const Function * _velocity_fn
std::string _v_pps_name
INSFEFluidMassBC(const InputParameters &parameters)
static InputParameters validParams()
virtual Real computeQpResidual() override
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
virtual Real computeQpJacobian() override
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)
unsigned int _qp
unsigned int _i
unsigned int _j
const MooseArray< Point > & _q_point
const VariableValue & _u
const VariablePhiValue & _phi
const MooseArray< Point > & _normals
const VariableTestValue & _test
void mooseError(Args &&... args) const
virtual const PostprocessorValue & getPostprocessorValueByName(const PostprocessorName &name) const