www.mooseframework.org
JouleHeatingSource.C
Go to the documentation of this file.
1 #include "JouleHeatingSource.h"
2 
3 template <>
4 InputParameters
6 {
7  InputParameters params = validParams<HeatSource>();
8  params.addCoupledVar("elec", "Electric potential for joule heating.");
9  params.addCoupledVar("args", "Vector of arguments of the diffusivity");
10  params.addParam<MaterialPropertyName>(
11  "electrical_conductivity",
12  "electrical_conductivity",
13  "Material property providing electrical conductivity of the material.");
14  return params;
15 }
16 
17 JouleHeatingSource::JouleHeatingSource(const InputParameters & parameters)
18  : DerivativeMaterialInterface<JvarMapKernelInterface<HeatSource>>(parameters),
19  _grad_elec(coupledGradient("elec")),
20  _elec_var(coupled("elec")),
21  _elec_cond(getMaterialProperty<Real>("electrical_conductivity")),
22  _delec_cond_dT(getMaterialPropertyDerivative<Real>("electrical_conductivity", _var.name())),
23  _delec_cond_darg(_coupled_moose_vars.size())
24 {
25  for (unsigned int i = 0; i < _delec_cond_darg.size(); ++i)
26  _delec_cond_darg[i] = &getMaterialPropertyDerivative<Real>("electrical_conductivity",
27  _coupled_moose_vars[i]->name());
28 }
29 
30 void
32 {
33  validateNonlinearCoupling<Real>("electrical_conductivity");
34 }
35 
36 Real
38 {
39  return -_elec_cond[_qp] * _grad_elec[_qp] * _grad_elec[_qp] * _test[_i][_qp];
40 }
41 
42 Real
44 {
45  return -_delec_cond_dT[_qp] * _grad_elec[_qp] * _grad_elec[_qp] * _phi[_j][_qp] * _test[_i][_qp];
46 }
47 
48 Real
50 {
51  const unsigned int cvar = mapJvarToCvar(jvar);
52 
53  if (jvar == _elec_var)
54  return -2 * _elec_cond[_qp] * _grad_elec[_qp] * _grad_phi[_j][_qp] * _test[_i][_qp] -
55  (*_delec_cond_darg[cvar])[_qp] * _grad_elec[_qp] * _grad_elec[_qp] * _phi[_j][_qp] *
56  _test[_i][_qp];
57 
58  return -(*_delec_cond_darg[cvar])[_qp] * _grad_elec[_qp] * _grad_elec[_qp] * _phi[_j][_qp] *
59  _test[_i][_qp];
60 }
JouleHeatingSource(const InputParameters &parameters)
const VariableGradient & _grad_elec
virtual void initialSetup()
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
InputParameters validParams< HeatSource >()
Definition: HeatSource.C:11
const MaterialProperty< Real > & _delec_cond_dT
const MaterialProperty< Real > & _elec_cond
virtual Real computeQpResidual()
virtual Real computeQpJacobian()
const unsigned int _elec_var
InputParameters validParams< JouleHeatingSource >()
std::vector< const MaterialProperty< Real > * > _delec_cond_darg