https://mooseframework.inl.gov
ElectromagneticHeatingMaterial.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 
11 #include "FormulationEnums.h"
12 
14 
17 {
19  params.addClassDescription(
20  "Material class used to provide the electric field as a material property and computes the "
21  "residual contributions for electromagnetic/electrostatic heating objects.");
22  params.addCoupledVar(
23  "electric_field",
24  "The electric field vector or electrostatic potential scalar to produce the field.");
25  params.addCoupledVar(
26  "complex_electric_field",
27  "The complex component of the electric field vector for the time-harmonic formulation.");
28  params.addParam<std::string>("electric_field_material_name",
29  "electric_field",
30  "User-specified material property name for the field.");
31  params.addParam<std::string>("electric_field_heating_name",
32  "electric_field_heating",
33  "User-specified material property name for the Joule heating.");
34  params.addParam<Real>("heating_scaling", 1.0, "Coefficient to multiply by heating term.");
35  params.addParam<MaterialPropertyName>(
36  "electrical_conductivity",
37  "electrical_conductivity",
38  "Material property providing electrical conductivity of the material.");
39  MooseEnum formulation("time frequency", "time");
40  MooseEnum solver("electrostatic electromagnetic", "electrostatic");
41  params.addParam<MooseEnum>(
42  "formulation",
43  formulation,
44  "The domain formulation of the Joule heating, time or frequency (default = time).");
45  params.addParam<MooseEnum>(
46  "solver", solver, "Electrostatic or electromagnetic field solver (default = electrostatic).");
47  return params;
48 }
49 
51  : ADMaterial(parameters),
52  _electric_field_var(*getFieldVar("electric_field", 0)),
53  _is_vector(_electric_field_var.isVector()),
54  _efield(_is_vector ? adCoupledVectorValue("electric_field") : _ad_grad_zero),
55  _efield_complex(_is_vector ? adCoupledVectorValue("complex_electric_field") : _ad_grad_zero),
56  _grad_potential(_is_vector ? _ad_grad_zero : adCoupledGradient("electric_field")),
57  _electric_field(
58  declareADProperty<RealVectorValue>(getParam<std::string>("electric_field_material_name"))),
59  _electric_field_complex(declareADProperty<RealVectorValue>(
60  getParam<std::string>("electric_field_material_name") + "_complex")),
61  _electric_field_heating(
62  declareADProperty<Real>(getParam<std::string>("electric_field_heating_name"))),
63  _heating_scaling(getParam<Real>("heating_scaling")),
64  _elec_cond(getADMaterialProperty<Real>("electrical_conductivity")),
65  _formulation(getParam<MooseEnum>("formulation")),
66  _solver(getParam<MooseEnum>("solver"))
67 {
70  {
71  mooseError("The frequency domain is selected, but the solver type is electrostatic! Please "
72  "check input file.");
73  }
74 
76  {
77  mooseError("The solver type is electromagnetic, but only a scalar potential is provided! "
78  "Please check input file.");
79  }
80 
82  {
83  mooseError("The frequency domain is selected, but only a scalar potential is provided! "
84  "Please check input file.");
85  }
86 }
87 
88 void
90 {
93 }
94 
95 void
97 {
100  else
102 
105 }
106 
107 void
109 {
114  else
117 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const ADVectorVariableValue & _efield
The electric field defined from a vector variable.
ADMaterialProperty< RealVectorValue > & _electric_field_complex
Complex electric field material property.
virtual void computeFieldValue()
Function that defines the field depending on supplied variable type.
unsigned int _qp
ADMaterialProperty< RealVectorValue > & _electric_field
Electric field material property.
static InputParameters validParams()
const ADVariableGradient & _grad_potential
The electric field defined from the gradient of a scalar variable.
ElectromagneticHeatingMaterial(const InputParameters &parameters)
registerMooseObject("HeatTransferApp", ElectromagneticHeatingMaterial)
Material class used to provide the electric field as a material property and computes the residual co...
void addCoupledVar(const std::string &name, const std::string &doc_string)
const Real & _heating_scaling
Coefficient to multiply by heating term.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const ADMaterialProperty< Real > & _elec_cond
Real component of the material conductivity (in S/m)
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
virtual void computeJouleHeating()
Function that defines the residual for Joule heating.
const ADVectorVariableValue & _efield_complex
The complex component of the electric field, needed for time-harmonic formulations.
ADMaterialProperty< Real > & _electric_field_heating
Joule heating residual material property.
MooseEnum _formulation
The domain formulation of the EM residuals (either TIME or FREQUENCY)
MooseEnum _solver
The solver formulation the electric field (either ELECTROSTATIC or ELECTROMAGNETIC) ...
const bool _is_vector
True if the supplied variable is a vector.