https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MassDiffusionBaseGasMixDGKernel.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{
16
17 params.addRequiredParam<MaterialPropertyName>("density", "Mixture density material property");
18 params.addRequiredParam<MaterialPropertyName>("diffusion_coefficient",
19 "Diffusion coefficient material property");
20 params.addRequiredParam<MaterialPropertyName>("mass_fraction", "Mass fraction material property");
21
22 params.addRequiredCoupledVar("A_linear", "Cross-sectional area");
23 params.addRequiredParam<MaterialPropertyName>("direction",
24 "Flow channel direction material property");
25
26 params.addClassDescription("Adds mass diffusion for FlowChannelGasMix.");
27
28 return params;
29}
30
32 : ADDGKernel(parameters),
33
34 _rho_elem(getADMaterialProperty<Real>("density")),
35 _rho_neig(getNeighborADMaterialProperty<Real>("density")),
36 _D_elem(getADMaterialProperty<Real>("diffusion_coefficient")),
37 _D_neig(getNeighborADMaterialProperty<Real>("diffusion_coefficient")),
38 _mass_fraction_elem(getADMaterialProperty<Real>("mass_fraction")),
39 _mass_fraction_neig(getNeighborADMaterialProperty<Real>("mass_fraction")),
40
41 _A_linear(adCoupledValue("A_linear")),
42 _dir(getMaterialProperty<RealVectorValue>("direction"))
43{
44}
45
48{
49 const ADReal flux = computeQpFlux();
50 const Real flux_sign_elem = _current_side * 2 - 1.0;
51 return type == Moose::Element ? flux_sign_elem * flux * _A_linear[_qp] * _test[_i][_qp]
52 : -flux_sign_elem * flux * _A_linear[_qp] * _test_neighbor[_i][_qp];
53}
54
55void
57{
58 const Point x_elem = _current_elem->vertex_average();
59 const Point x_neig = _neighbor_elem->vertex_average();
60 dx = (x_neig - x_elem) * _dir[_qp];
61 dx_side = (_q_point[_qp] - x_elem) * _dir[_qp];
62}
63
66 const ADReal & y_neig,
67 Real dx,
68 Real dx_side) const
69{
70 const ADReal dydx = computeGradient(y_elem, y_neig, dx);
71
72 return y_elem + dydx * dx_side;
73}
74
77 const ADReal & y_neig,
78 Real dx) const
79{
80 return (y_neig - y_elem) / dx;
81}
DualNumber< Real, DNDerivativeType, true > ADReal
const VariableTestValue & _test_neighbor
static InputParameters validParams()
const VariableTestValue & _test
unsigned int _i
unsigned int _qp
const unsigned int & _current_side
const MooseArray< Point > & _q_point
const Elem *const & _current_elem
const Elem *const & _neighbor_elem
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
ADReal computeGradient(const ADReal &y_elem, const ADReal &y_neig, Real dx) const
Computes the gradient of a quantity in the channel direction.
const ADVariableValue & _A_linear
Cross-sectional area, linear.
ADReal linearlyInterpolate(const ADReal &y_elem, const ADReal &y_neig, Real dx, Real dx_side) const
Linearly interpolates a quantity to the side position.
const MaterialProperty< RealVectorValue > & _dir
Flow channel direction.
virtual ADReal computeQpResidual(Moose::DGResidualType type) override
MassDiffusionBaseGasMixDGKernel(const InputParameters &parameters)
virtual ADReal computeQpFlux() const =0
Computes the flux that will be applied to both sides for a q-point.
void computePositionChanges(Real &dx, Real &dx_side) const
Computes the changes in position between elements and side.
const std::string & type() const
DGResidualType