www.mooseframework.org
DistributedPower.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
14 template <>
15 InputParameters
17 {
18  InputParameters params = validParams<Kernel>();
19 
20  // The acceleration vector.
21  params.addParam<RealVectorValue>(
22  "acceleration",
23  RealVectorValue(0, 0, 0),
24  "The acceleration components for an applied distributed force in an element.");
25 
26  // Momentum components.
27  params.addRequiredCoupledVar("rho_u", "x-component of the momentum vector");
28  params.addCoupledVar("rho_v", "y-component of the momentum vector");
29  params.addCoupledVar("rho_w", "z-component of the momentum vector");
30 
31  return params;
32 }
33 
34 DistributedPower::DistributedPower(const InputParameters & parameters)
35  : Kernel(parameters),
36  // acceleration vector
37  _acceleration(getParam<RealVectorValue>("acceleration")),
38 
39  // momentum components
40  _rhou_var_number(coupled("rho_u")),
41  _rhov_var_number(isCoupled("rho_v") ? coupled("rho_v") : libMesh::invalid_uint),
42  _rhow_var_number(isCoupled("rho_w") ? coupled("rho_w") : libMesh::invalid_uint),
43  _rho_u(coupledValue("rho_u")),
44  _rho_v(isCoupled("rho_v") ? coupledValue("rho_v") : _zero),
45  _rho_w(isCoupled("rho_w") ? coupledValue("rho_w") : _zero)
46 {
47 }
48 
49 Real
51 {
52  RealVectorValue rhou_vec(_rho_u[_qp], _rho_v[_qp], _rho_w[_qp]);
53  // -rhou dot acceleration
54  return -rhou_vec * _acceleration * _test[_i][_qp];
55 }
56 
57 Real
59 {
60  return 0.;
61 }
62 
63 Real
65 {
66  if (jvar == _rhou_var_number)
67  return -_phi[_j][_qp] * _acceleration(0) * _test[_i][_qp];
68  if (jvar == _rhov_var_number)
69  return -_phi[_j][_qp] * _acceleration(1) * _test[_i][_qp];
70  if (jvar == _rhow_var_number)
71  return -_phi[_j][_qp] * _acceleration(2) * _test[_i][_qp];
72 
73  return 0;
74 }
DistributedPower::DistributedPower
DistributedPower(const InputParameters &parameters)
Definition: DistributedPower.C:34
libMesh
Definition: RANFSNormalMechanicalContact.h:24
DistributedPower::_rho_w
const VariableValue & _rho_w
Definition: DistributedPower.h:42
DistributedPower::_rhov_var_number
unsigned int _rhov_var_number
Definition: DistributedPower.h:38
DistributedPower::computeQpJacobian
virtual Real computeQpJacobian()
Definition: DistributedPower.C:58
DistributedPower::_rho_u
const VariableValue & _rho_u
Definition: DistributedPower.h:40
DistributedPower::_rhou_var_number
unsigned int _rhou_var_number
Definition: DistributedPower.h:37
DistributedPower::_rhow_var_number
unsigned int _rhow_var_number
Definition: DistributedPower.h:39
DistributedPower::_acceleration
RealVectorValue _acceleration
Definition: DistributedPower.h:36
registerMooseObject
registerMooseObject("NavierStokesApp", DistributedPower)
DistributedPower::computeQpOffDiagJacobian
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: DistributedPower.C:64
DistributedPower
The DistributedPower kernel computes the kinetic energy contribution of the body force due to total e...
Definition: DistributedPower.h:26
DistributedPower::_rho_v
const VariableValue & _rho_v
Definition: DistributedPower.h:41
DistributedPower::computeQpResidual
virtual Real computeQpResidual()
Definition: DistributedPower.C:50
validParams< DistributedPower >
InputParameters validParams< DistributedPower >()
Definition: DistributedPower.C:16
DistributedPower.h