10 #ifdef MOOSE_MFEM_ENABLED 20 params.
addClassDescription(
"Adds the Robin boundary conditions for an electromagnetic problem " 21 "with transverse waves in a rectangular waveguide.");
24 "Vector along the x-axis of the port, where its magnitude is the port length in meters.");
27 "Vector along the y-axis of the port, where its magnitude is the port width in meters.");
28 params.
addParam<
Real>(
"frequency", 1.0,
"Mode frequency in Hz.");
29 params.
addParam<
Real>(
"epsilon", 1.0,
"Electric permittivity constant.");
30 params.
addParam<
Real>(
"mu", 1.0,
"Magnetic permeability constant.");
33 "Whether the boundary attribute passed to this BC corresponds to the input " 34 "port of the waveguide.");
41 _mu(getParam<
Real>(
"mu")),
42 _epsilon(getParam<
Real>(
"epsilon")),
43 _omega(2 * M_PI * getParam<
Real>(
"frequency")),
46 _k0(_omega *
std::
sqrt(_mu * _epsilon)),
47 _kc(M_PI / _a1.Norml2()),
48 _k(
std::complex<mfem::real_t>(0.,
std::
sqrt(_k0 * _k0 - _kc * _kc))),
49 _k_c(normalizedCrossProduct(_a1, _a2) *= _k.
imag()),
50 _k_a(normalizedCrossProduct(_a2, _k_c) *= _kc)
54 if (getParam<bool>(
"input_port"))
56 _u_real = std::make_unique<mfem::VectorFunctionCoefficient>(
57 3, [
this](
const mfem::Vector & x, mfem::Vector & v) {
return RWTE10Real(x, v); });
59 _u_imag = std::make_unique<mfem::VectorFunctionCoefficient>(
60 3, [
this](
const mfem::Vector & x, mfem::Vector & v) {
return RWTE10Imag(x, v); });
68 std::complex<mfem::real_t> zi(0., 1.);
71 std::complex<mfem::real_t> e_mag =
72 e0 *
sin(mfem::InnerProduct(
_k_a, x)) *
exp(-zi * mfem::InnerProduct(
_k_c, x));
74 E[0] = e_mag * e_hat(1);
75 E[1] = e_mag * e_hat(2);
76 E[2] = e_mag * e_hat(0);
82 std::vector<std::complex<mfem::real_t>> eval(x.Size());
84 for (
int i = 0; i < x.Size(); ++i)
85 v(i) = -2 *
_k.imag() * eval[i].imag() /
_mu;
90 std::vector<std::complex<mfem::real_t>> eval(x.Size());
92 for (
int i = 0; i < x.Size(); ++i)
93 v(i) = 2 *
_k.imag() * eval[i].real() /
_mu;
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template * sin(_arg) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(tan
std::unique_ptr< mfem::VectorFunctionCoefficient > _u_imag
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
void RWTE10Imag(const mfem::Vector &x, mfem::Vector &v)
registerMooseObject("MooseApp", MFEMRWTE10IntegratedBC)
std::complex< mfem::real_t > _k
mfem::Vector normalizedCrossProduct(const mfem::Vector &va, const mfem::Vector &vb)
Computes the unit vector in the direction of the cross product of two 3d vectors. ...
static InputParameters validParams()
void RWTE10Real(const mfem::Vector &x, mfem::Vector &v)
MFEMRWTE10IntegratedBC(const InputParameters ¶meters)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template * sqrt(_arg)) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(tanh
void RWTE10(const mfem::Vector &x, std::vector< std::complex< mfem::real_t >> &E)
std::unique_ptr< mfem::ConstantCoefficient > _robin_coef_im
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
boost::multiprecision::float128 imag(const boost::multiprecision::float128)
std::unique_ptr< mfem::VectorFunctionCoefficient > _u_real
static InputParameters validParams()