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("HeatConductionApp", JouleHeatingSource);
13 
15 
16 InputParameters
18 {
19  InputParameters params = HeatSource::validParams();
20  params.addCoupledVar("elec", "Electric potential for joule heating.");
21  params.addCoupledVar("args", "Vector of arguments of the diffusivity");
22  params.addParam<MaterialPropertyName>(
23  "electrical_conductivity",
24  "electrical_conductivity",
25  "Material property providing electrical conductivity of the material.");
26  return params;
27 }
28 
29 JouleHeatingSource::JouleHeatingSource(const InputParameters & parameters)
30  : DerivativeMaterialInterface<JvarMapKernelInterface<HeatSource>>(parameters),
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 }
HeatSource::validParams
static InputParameters validParams()
Definition: HeatSource.C:17
JouleHeatingSource::computeQpResidual
virtual Real computeQpResidual()
Definition: JouleHeatingSource.C:49
JouleHeatingSource::_delec_cond_dT
const MaterialProperty< Real > & _delec_cond_dT
Definition: JouleHeatingSource.h:44
JouleHeatingSource::_elec_cond
const MaterialProperty< Real > & _elec_cond
Definition: JouleHeatingSource.h:43
HeatSource
Definition: HeatSource.h:20
JouleHeatingSource::_elec_var
const unsigned int _elec_var
Definition: JouleHeatingSource.h:41
JouleHeatingSource
This kernel calculates the heat source term corresponding to joule heating, Q = J * E = elec_cond * g...
Definition: JouleHeatingSource.h:26
JouleHeatingSource::validParams
static InputParameters validParams()
Definition: JouleHeatingSource.C:17
registerMooseObject
registerMooseObject("HeatConductionApp", JouleHeatingSource)
JouleHeatingSource::JouleHeatingSource
JouleHeatingSource(const InputParameters &parameters)
Definition: JouleHeatingSource.C:29
name
const std::string name
Definition: Setup.h:21
JouleHeatingSource::initialSetup
virtual void initialSetup()
Definition: JouleHeatingSource.C:43
JouleHeatingSource::computeQpOffDiagJacobian
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: JouleHeatingSource.C:61
JouleHeatingSource::_grad_elec
const VariableGradient & _grad_elec
Definition: JouleHeatingSource.h:40
JouleHeatingSource.h
defineLegacyParams
defineLegacyParams(JouleHeatingSource)
JouleHeatingSource::computeQpJacobian
virtual Real computeQpJacobian()
Definition: JouleHeatingSource.C:55
JouleHeatingSource::_delec_cond_darg
std::vector< const MaterialProperty< Real > * > _delec_cond_darg
Definition: JouleHeatingSource.h:45