https://mooseframework.inl.gov
ADHeatStructureHeatSource.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 
12 registerMooseObject("ThermalHydraulicsApp", ADHeatStructureHeatSource);
13 
16 {
18  params.addClassDescription("Adds a heat source term for the energy equation");
19  params.addRequiredParam<Real>("power_fraction", "The fraction of power used");
20  params.addRequiredCoupledVar("total_power", "Total reactor power");
21  params.addRequiredParam<Real>("num_units", "The number of units");
22  params.addRequiredParam<FunctionName>("power_shape_function",
23  "The name of the function that defines the power shape");
24  params.addRequiredParam<PostprocessorName>("power_shape_integral_pp",
25  "Power shape integral post-processor name");
26  params.addParam<Real>("scale", 1.0, "Scaling factor for residual");
27  params.declareControllable("power_fraction");
28  return params;
29 }
30 
32  : ADKernel(parameters),
33  _power_fraction(getParam<Real>("power_fraction")),
34  _total_power(coupledScalarValue("total_power")),
35  _power_shape_function(getFunction("power_shape_function")),
36  _power_shape_integral(getPostprocessorValue("power_shape_integral_pp")),
37  _scale(getParam<Real>("scale")),
38  _num_units(getParam<Real>("num_units"))
39 {
40 }
41 
42 ADReal
44 {
45  const ADReal power = _power_fraction * _total_power[0];
46  const ADReal power_density =
48  return -_scale * power_density * _test[_i][_qp];
49 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const ADTemplateVariableTestValue< T > & _test
DualNumber< Real, DNDerivativeType, true > ADReal
void addRequiredParam(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
registerMooseObject("ThermalHydraulicsApp", ADHeatStructureHeatSource)
unsigned int _i
static InputParameters validParams()
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
const VariableValue & _total_power
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
ADHeatStructureHeatSource(const InputParameters &parameters)
void addClassDescription(const std::string &doc_string)
virtual Real value(Real t, const Point &p) const
const PostprocessorValue & _power_shape_integral
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})
const MooseArray< Point > & _q_point
unsigned int _qp