https://mooseframework.inl.gov
DistributedPower.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 "DistributedPower.h"
11 
12 registerMooseObject("NavierStokesApp", DistributedPower);
13 
16 {
18 
19  // The acceleration vector.
20  params.addParam<RealVectorValue>(
21  "acceleration",
22  RealVectorValue(0, 0, 0),
23  "The acceleration components for an applied distributed force in an element.");
24 
25  // Momentum components.
26  params.addRequiredCoupledVar("rho_u", "x-component of the momentum vector");
27  params.addCoupledVar("rho_v", "y-component of the momentum vector");
28  params.addCoupledVar("rho_w", "z-component of the momentum vector");
29 
30  params.addClassDescription(
31  "Implements the power term of a specified force in the Navier Stokes energy equation.");
32 
33  return params;
34 }
35 
37  : Kernel(parameters),
38  // acceleration vector
39  _acceleration(getParam<RealVectorValue>("acceleration")),
40 
41  // momentum components
42  _rhou_var_number(coupled("rho_u")),
43  _rhov_var_number(isCoupled("rho_v") ? coupled("rho_v") : libMesh::invalid_uint),
44  _rhow_var_number(isCoupled("rho_w") ? coupled("rho_w") : libMesh::invalid_uint),
45  _rho_u(coupledValue("rho_u")),
46  _rho_v(isCoupled("rho_v") ? coupledValue("rho_v") : _zero),
47  _rho_w(isCoupled("rho_w") ? coupledValue("rho_w") : _zero)
48 {
49 }
50 
51 Real
53 {
54  RealVectorValue rhou_vec(_rho_u[_qp], _rho_v[_qp], _rho_w[_qp]);
55  // -rhou dot acceleration
56  return -rhou_vec * _acceleration * _test[_i][_qp];
57 }
58 
59 Real
61 {
62  return 0.;
63 }
64 
65 Real
67 {
68  if (jvar == _rhou_var_number)
69  return -_phi[_j][_qp] * _acceleration(0) * _test[_i][_qp];
70  if (jvar == _rhov_var_number)
71  return -_phi[_j][_qp] * _acceleration(1) * _test[_i][_qp];
72  if (jvar == _rhow_var_number)
73  return -_phi[_j][_qp] * _acceleration(2) * _test[_i][_qp];
74 
75  return 0;
76 }
const VariableValue & _rho_v
virtual Real computeQpResidual()
static InputParameters validParams()
RealVectorValue _acceleration
virtual Real computeQpJacobian()
const unsigned int invalid_uint
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const VariableValue & _rho_u
The DistributedPower kernel computes the kinetic energy contribution of the body force due to total e...
unsigned int _rhow_var_number
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
static InputParameters validParams()
const VariableTestValue & _test
registerMooseObject("NavierStokesApp", DistributedPower)
unsigned int _i
const VariableValue & _rho_w
unsigned int _rhov_var_number
unsigned int _rhou_var_number
void addCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
unsigned int _j
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
DistributedPower(const InputParameters &parameters)
void addClassDescription(const std::string &doc_string)
const VariablePhiValue & _phi
unsigned int _qp