17 InputParameters params = validParams<Kernel>();
19 params.addClassDescription(
"This class computes various strong and weak components of the "
20 "incompressible navier stokes equations which can then be assembled "
21 "together in child classes.");
23 params.addRequiredCoupledVar(
"u",
"x-velocity");
24 params.addCoupledVar(
"v", 0,
"y-velocity");
25 params.addCoupledVar(
"w", 0,
"z-velocity");
26 params.addRequiredCoupledVar(
"p",
"pressure");
28 params.addParam<RealVectorValue>(
29 "gravity", RealVectorValue(0, 0, 0),
"Direction of the gravity vector");
31 params.addParam<MaterialPropertyName>(
"mu_name",
"mu",
"The name of the dynamic viscosity");
32 params.addParam<MaterialPropertyName>(
"rho_name",
"rho",
"The name of the density");
34 params.addParam<Real>(
"alpha", 1.,
"Multiplicative factor on the stabilization parameter tau.");
35 params.addParam<
bool>(
36 "laplace",
true,
"Whether the viscous term of the momentum equations is in laplace form.");
37 params.addParam<
bool>(
"convective_term",
true,
"Whether to include the convective term.");
38 params.addParam<
bool>(
"transient_term",
40 "Whether there should be a transient term in the momentum residuals.");
47 _second_phi(_assembly.secondPhi()),
50 _u_vel(coupledValue(
"u")),
51 _v_vel(coupledValue(
"v")),
52 _w_vel(coupledValue(
"w")),
53 _p(coupledValue(
"p")),
56 _grad_u_vel(coupledGradient(
"u")),
57 _grad_v_vel(coupledGradient(
"v")),
58 _grad_w_vel(coupledGradient(
"w")),
59 _grad_p(coupledGradient(
"p")),
62 _second_u_vel(coupledSecond(
"u")),
63 _second_v_vel(coupledSecond(
"v")),
64 _second_w_vel(coupledSecond(
"w")),
67 _u_vel_dot(_is_transient ? coupledDot(
"u") : _zero),
68 _v_vel_dot(_is_transient ? coupledDot(
"v") : _zero),
69 _w_vel_dot(_is_transient ? coupledDot(
"w") : _zero),
72 _d_u_vel_dot_du(_is_transient ? coupledDotDu(
"u") : _zero),
73 _d_v_vel_dot_dv(_is_transient ? coupledDotDu(
"v") : _zero),
74 _d_w_vel_dot_dw(_is_transient ? coupledDotDu(
"w") : _zero),
77 _u_vel_var_number(coupled(
"u")),
78 _v_vel_var_number(coupled(
"v")),
79 _w_vel_var_number(coupled(
"w")),
80 _p_var_number(coupled(
"p")),
82 _gravity(getParam<RealVectorValue>(
"gravity")),
85 _mu(getMaterialProperty<Real>(
"mu_name")),
86 _rho(getMaterialProperty<Real>(
"rho_name")),
88 _alpha(getParam<Real>(
"alpha")),
89 _laplace(getParam<bool>(
"laplace")),
90 _convective_term(getParam<bool>(
"convective_term")),
91 _transient_term(getParam<bool>(
"transient_term"))
107 RealVectorValue d_U_d_comp(0, 0, 0);
108 d_U_d_comp(comp) = _phi[_j][_qp];
110 RealVectorValue convective_term =
_rho[_qp] * RealVectorValue(d_U_d_comp *
_grad_u_vel[_qp],
113 convective_term(comp) +=
_rho[_qp] * U * _grad_phi[_j][_qp];
115 return convective_term;
136 RealVectorValue viscous_term(0, 0, 0);
145 RealVectorValue viscous_term(0, 0, 0);
148 for (
unsigned i = 0; i < 3; i++)
204 return _mu[_qp] * _grad_phi[_j][_qp];
210 return _mu[_qp] * _grad_phi[_j][_qp];
228 return _grad_phi[_j][_qp];
234 return -_phi[_j][_qp];
252 Real base =
_rho[_qp] * _phi[_j][_qp];
265 mooseError(
"comp must be 0, 1, or 2");
272 Real nu =
_mu[_qp] /
_rho[_qp];
274 Real h = _current_elem->hmax();
276 return _alpha / std::sqrt(transient_part + (2. * U.norm() / h) * (2. * U.norm() / h) +
277 9. * (4. * nu / (h * h)) * (4. * nu / (h * h)));
283 Real nu =
_mu[_qp] /
_rho[_qp];
285 Real h = _current_elem->hmax();
287 if (nu < std::numeric_limits<Real>::epsilon())
291 Real alpha = U.norm() * h / (2 * nu);
292 xi = 1. / std::tanh(alpha) - 1. / alpha;
294 return h / (2 * U.norm()) * xi;
300 Real nu =
_mu[_qp] /
_rho[_qp];
302 Real h = _current_elem->hmax();
304 return -
_alpha / 2. *
std::pow(transient_part + (2. * U.norm() / h) * (2. * U.norm() / h) +
305 9. * (4. * nu / (h * h)) * (4. * nu / (h * h)),
307 2. * (2. * U.norm() / h) * 2. / h * U(comp) * _phi[_j][_qp] /
308 (U.norm() + std::numeric_limits<double>::epsilon());