https://mooseframework.inl.gov
Loading...
Searching...
No Matches
WaveEquationCoefficient.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
12#include <complex>
13
15
18{
20 params.addClassDescription("Material for use as coefficient $a k^2 \\mu_r \\epsilon_r$ (where a "
21 "is a scalar coefficient) "
22 "in standard-form Helmholtz wave equation applications with "
23 "derivatives calculated using automatic differentiation.");
24 params.addRequiredParam<MaterialPropertyName>("eps_rel_real",
25 "Relative permittivity, real component.");
26 params.addRequiredParam<MaterialPropertyName>("eps_rel_imag",
27 "Relative permittivity, imaginary component.");
28 params.addRequiredParam<MaterialPropertyName>("mu_rel_real",
29 "Relative permeability, real component.");
30 params.addRequiredParam<MaterialPropertyName>("mu_rel_imag",
31 "Relative permeability, imaginary component.");
32 params.addRequiredParam<MaterialPropertyName>("k_real", "Wave number, real component.");
33 params.addParam<MaterialPropertyName>("k_imag", 0, "Wave number, imaginary component.");
34 params.addParam<Real>("coef", 1.0, "Real-valued function coefficient.");
35 params.addParam<MaterialPropertyName>(
36 "prop_name_real",
37 "wave_equation_coefficient_real",
38 "User-specified material property name for the real component.");
39 params.addParam<MaterialPropertyName>(
40 "prop_name_imaginary",
41 "wave_equation_coefficient_imaginary",
42 "User-specified material property name for the imaginary component.");
43 return params;
44}
45
47 : ADMaterial(parameters),
48 _eps_r_real(getADMaterialProperty<Real>("eps_rel_real")),
49 _eps_r_imag(getADMaterialProperty<Real>("eps_rel_imag")),
50 _mu_r_real(getADMaterialProperty<Real>("mu_rel_real")),
51 _mu_r_imag(getADMaterialProperty<Real>("mu_rel_imag")),
52 _k_real(getADMaterialProperty<Real>("k_real")),
53 _k_imag(getADMaterialProperty<Real>("k_imag")),
54 _coef(getParam<Real>("coef")),
55 _prop_name_real(getParam<MaterialPropertyName>("prop_name_real")),
56 _prop_name_imag(getParam<MaterialPropertyName>("prop_name_imaginary")),
57 _prop_real(declareADProperty<Real>(_prop_name_real)),
58 _prop_imag(declareADProperty<Real>(_prop_name_imag))
59{
60}
61
62void
64{
65 ADReal k_sq_real = (_k_real[_qp] * _k_real[_qp]) - (_k_imag[_qp] * _k_imag[_qp]);
66 ADReal k_sq_imag = 2.0 * _k_real[_qp] * _k_imag[_qp];
67
68 ADReal mu_eps_real = (_mu_r_real[_qp] * _eps_r_real[_qp]) - (_mu_r_imag[_qp] * _eps_r_imag[_qp]);
69 ADReal mu_eps_imag = (_mu_r_real[_qp] * _eps_r_imag[_qp]) + (_mu_r_imag[_qp] * _eps_r_real[_qp]);
70
71 _prop_real[_qp] = _coef * ((k_sq_real * mu_eps_real) - (k_sq_imag * mu_eps_imag));
72 _prop_imag[_qp] = _coef * ((k_sq_real * mu_eps_imag) + (k_sq_imag * mu_eps_real));
73}
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("ElectromagneticsApp", WaveEquationCoefficient)
void addRequiredParam(const std::string &name, const std::string &doc_string)
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)
unsigned int _qp
static InputParameters validParams()
Material for use as coefficient $a k^2 mu_r epsilon_r$ (where a is a scalar coefficient) in standard-...
ADMaterialProperty< Real > & _prop_real
Material property for the real component.
static InputParameters validParams()
const ADMaterialProperty< Real > & _k_imag
Imaginary component of the wave number (also known as the attenuation constant)
ADMaterialProperty< Real > & _prop_imag
Material property for the imaginary component.
Real _coef
Real-valued coefficient (defaults to 1)
const ADMaterialProperty< Real > & _mu_r_real
Real component of the relative magnetic permeability.
const ADMaterialProperty< Real > & _eps_r_real
Real component of the relative electric permittivity.
virtual void computeQpProperties() override
const ADMaterialProperty< Real > & _eps_r_imag
Imaginary component of the relative electric permittivity.
const ADMaterialProperty< Real > & _mu_r_imag
Real component of the relative magnetic permeability.
WaveEquationCoefficient(const InputParameters &parameters)
const ADMaterialProperty< Real > & _k_real
Real component of the wave number.