https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
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
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
51Real
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
59Real
64
65Real
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}
registerMooseObject("NavierStokesApp", DistributedPower)
The DistributedPower kernel computes the kinetic energy contribution of the body force due to total e...
static InputParameters validParams()
RealVectorValue _acceleration
const VariableValue & _rho_u
virtual Real computeQpResidual()
virtual Real computeQpJacobian()
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
const VariableValue & _rho_v
unsigned int _rhou_var_number
unsigned int _rhow_var_number
const VariableValue & _rho_w
unsigned int _rhov_var_number
DistributedPower(const InputParameters &parameters)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
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)
void addCoupledVar(const std::string &name, const std::string &doc_string)
unsigned int _qp
unsigned int _j
unsigned int _i
const VariablePhiValue & _phi
const VariableTestValue & _test
static InputParameters validParams()
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...