https://mooseframework.inl.gov
Loading...
Searching...
No Matches
JouleHeatingSource.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 "JouleHeatingSource.h"
11
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 mooseDeprecated("The non-AD version of JouleHeatingSource will be deprecated in the near future "
42 "(10/01/2025) in favor of exclusively using the AD version of "
43 "JouleHeatingSource, since the ADJouleHeatingSource can calculate both "
44 "electrostatic and electromagnetic Joule heating.");
45}
46
47void
49{
50 validateNonlinearCoupling<Real>("electrical_conductivity");
51}
52
53Real
55{
56 return -_elec_cond[_qp] * _grad_elec[_qp] * _grad_elec[_qp] * _test[_i][_qp];
57}
58
59Real
61{
62 return -_delec_cond_dT[_qp] * _grad_elec[_qp] * _grad_elec[_qp] * _phi[_j][_qp] * _test[_i][_qp];
63}
64
65Real
67{
68 const unsigned int cvar = mapJvarToCvar(jvar);
69
70 if (jvar == _elec_var)
71 return -2 * _elec_cond[_qp] * _grad_elec[_qp] * _grad_phi[_j][_qp] * _test[_i][_qp] -
72 (*_delec_cond_darg[cvar])[_qp] * _grad_elec[_qp] * _grad_elec[_qp] * _phi[_j][_qp] *
73 _test[_i][_qp];
74
75 return -(*_delec_cond_darg[cvar])[_qp] * _grad_elec[_qp] * _grad_elec[_qp] * _phi[_j][_qp] *
76 _test[_i][_qp];
77}
registerMooseObject("HeatTransferApp", JouleHeatingSource)
void mooseDeprecated(Args &&... args)
const std::string name
Definition Setup.h:21
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)
NOTE: The non-AD version of JouleHeatingSource will be deprecated in the near future (10/01/2025) in ...
virtual void initialSetup()
const unsigned int _elec_var
const MaterialProperty< Real > & _elec_cond
std::vector< const MaterialProperty< Real > * > _delec_cond_darg
const MaterialProperty< Real > & _delec_cond_dT
const VariableGradient & _grad_elec
static InputParameters validParams()
virtual Real computeQpResidual()
JouleHeatingSource(const InputParameters &parameters)
virtual Real computeQpJacobian()
virtual Real computeQpOffDiagJacobian(unsigned int jvar)