www.mooseframework.org
JouleHeatingSource.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 "JouleHeatingSource.h"
11 
12 registerMooseObject("HeatTransferApp", JouleHeatingSource);
13 
16 {
17  InputParameters params =
19  params.addCoupledVar("elec", "Electric potential for joule heating.");
20  params.addParam<MaterialPropertyName>(
21  "electrical_conductivity",
22  "electrical_conductivity",
23  "Material property providing electrical conductivity of the material.");
24  params.addClassDescription("Calculates the heat source term corresponding to electrostatic Joule "
25  "heating.");
26  return params;
27 }
28 
31  _grad_elec(coupledGradient("elec")),
32  _elec_var(coupled("elec")),
33  _elec_cond(getMaterialProperty<Real>("electrical_conductivity")),
34  _delec_cond_dT(getMaterialPropertyDerivative<Real>("electrical_conductivity", _var.name())),
35  _delec_cond_darg(_coupled_moose_vars.size())
36 {
37  for (unsigned int i = 0; i < _delec_cond_darg.size(); ++i)
38  _delec_cond_darg[i] = &getMaterialPropertyDerivative<Real>("electrical_conductivity",
39  _coupled_moose_vars[i]->name());
40 }
41 
42 void
44 {
45  validateNonlinearCoupling<Real>("electrical_conductivity");
46 }
47 
48 Real
50 {
51  return -_elec_cond[_qp] * _grad_elec[_qp] * _grad_elec[_qp] * _test[_i][_qp];
52 }
53 
54 Real
56 {
57  return -_delec_cond_dT[_qp] * _grad_elec[_qp] * _grad_elec[_qp] * _phi[_j][_qp] * _test[_i][_qp];
58 }
59 
60 Real
62 {
63  const unsigned int cvar = mapJvarToCvar(jvar);
64 
65  if (jvar == _elec_var)
66  return -2 * _elec_cond[_qp] * _grad_elec[_qp] * _grad_phi[_j][_qp] * _test[_i][_qp] -
67  (*_delec_cond_darg[cvar])[_qp] * _grad_elec[_qp] * _grad_elec[_qp] * _phi[_j][_qp] *
68  _test[_i][_qp];
69 
70  return -(*_delec_cond_darg[cvar])[_qp] * _grad_elec[_qp] * _grad_elec[_qp] * _phi[_j][_qp] *
71  _test[_i][_qp];
72 }
JouleHeatingSource(const InputParameters &parameters)
const VariableGradient & _grad_elec
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
virtual void initialSetup()
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
const MaterialProperty< Real > & _delec_cond_dT
const MaterialProperty< Real > & _elec_cond
virtual Real computeQpResidual()
virtual Real computeQpJacobian()
const std::string name
Definition: Setup.h:20
const unsigned int _elec_var
static InputParameters validParams()
This kernel calculates the heat source term corresponding to joule heating, Q = J * E = elec_cond * g...
void addCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< const MaterialProperty< Real > * > _delec_cond_darg
void addClassDescription(const std::string &doc_string)
registerMooseObject("HeatTransferApp", JouleHeatingSource)