https://mooseframework.inl.gov
ADMatWaveReaction.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 "ADMatWaveReaction.h"
11 #include "ElectromagneticEnums.h"
13 #include "Function.h"
14 #include <complex>
15 
16 registerMooseObject("ElectromagneticsApp", ADMatWaveReaction);
17 
20 {
22  params.addClassDescription(
23  "Calculates the current source term in the Helmholtz wave equation using "
24  "the dielectric formulation of the current.");
25  params.addRequiredCoupledVar("E_real", "The real component of the electric field.");
26  params.deprecateParam("E_real", "field_real", "10/01/2025");
27  params.addRequiredCoupledVar("field_real", "The real component of the electric field.");
28  params.addRequiredCoupledVar("E_imag", "The imaginary component of the electric field.");
29  params.deprecateParam("E_imag", "field_imag", "10/01/2025");
30  params.addRequiredCoupledVar("field_imag", "The imaginary component of the electric field.");
31 
32  params.addParam<MaterialPropertyName>(
33  "wave_coef_real",
34  "wave_equation_coefficient_real",
35  "The real component of the coefficient for the Helmholtz wave equation.");
36  params.addParam<MaterialPropertyName>(
37  "wave_coef_imag",
38  "wave_equation_coefficient_imaginary",
39  "The imaginary component of the coefficient for the Helmholtz wave equation.");
40 
41  MooseEnum component("real imaginary");
42  params.addParam<MooseEnum>("component", component, "Component of field (real or imaginary).");
43  return params;
44 }
45 
47  : ADVectorKernel(parameters),
48  _field_real(adCoupledVectorValue("field_real")),
49  _field_imag(adCoupledVectorValue("field_imag")),
50 
51  _coef_real(getADMaterialProperty<Real>("wave_coef_real")),
52  _coef_imag(getADMaterialProperty<Real>("wave_coef_imag")),
53 
54  _component(getParam<MooseEnum>("component"))
55 {
56 }
57 
58 ADReal
60 {
61  // TODO: In the future, need to add an AD capability to std::complex
62  if (_component == EM::REAL)
63  return -_test[_i][_qp] *
65  else
66  return -_test[_i][_qp] *
68 }
const ADVectorVariableValue & _field_imag
Vector variable of the imaginary component of the electric field.
const ADMaterialProperty< Real > & _coef_imag
The imaginary component of the coefficient for the Helmholtz wave equation.
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
ADMatWaveReaction(const InputParameters &parameters)
static const std::string component
Definition: NS.h:153
const ADTemplateVariableTestValue< T > & _test
DualNumber< Real, DNDerivativeType, true > ADReal
const ADVectorVariableValue & _field_real
Vector variable of the real component of the electric field.
void deprecateParam(const std::string &old_name, const std::string &new_name, const std::string &removal_date)
virtual ADReal computeQpResidual() override
registerMooseObject("ElectromagneticsApp", ADMatWaveReaction)
unsigned int _i
static InputParameters validParams()
Calculates the current source term in the Helmholtz wave equation using the dielectric formulation of...
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)
const ADMaterialProperty< Real > & _coef_real
The real component of the coefficient for the Helmholtz wave equation.
MooseEnum _component
Component of the field vector (real or imaginary)
unsigned int _qp