https://mooseframework.inl.gov
Loading...
Searching...
No Matches
VectorTransientAbsorbingBC.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
13#include "Function.h"
14#include <complex>
15
17
20{
23 "First order transient absorbing boundary condition for vector variables.");
24 params.addParam<FunctionName>("admittance",
25 1 / (EM::mu_0 * EM::c),
26 "Intrinsic admittance of the infinite medium (default is "
27 "$\\sqrt{\\frac{\\epsilon_0}{\\mu_0}} = \\frac{1}{\\mu_0 c}$, or "
28 "the admittance of free space).");
29 MooseEnum component("real imaginary");
30 params.addParam<MooseEnum>(
31 "component", component, "Variable field component (real or imaginary).");
32 params.addRequiredCoupledVar("coupled_field", "Coupled field variable.");
33 return params;
34}
35
37 : VectorIntegratedBC(parameters),
38
39 _admittance(getFunction("admittance")),
40
41 _component(getParam<MooseEnum>("component")),
42
43 _coupled_val(coupledVectorValue("coupled_field")),
44 _coupled_var_num(coupled("coupled_field")),
45
46 _u_dot(dot()),
47 _coupled_dot(coupledVectorDot("coupled_field")),
48 _du_dot_du(dotDu()),
49 _coupled_dot_du(coupledVectorDotDu("coupled_field"))
50{
51}
52
53Real
55{
56 // Initialize field_dot components
57 std::complex<double> field_dot_0(0, 0);
58 std::complex<double> field_dot_1(0, 0);
59 std::complex<double> field_dot_2(0, 0);
60
61 // Create E_dot for residual based on component parameter
62 if (_component == EM::REAL)
63 {
64 field_dot_0.real(_u_dot[_qp](0));
65 field_dot_0.imag(_coupled_dot[_qp](0));
66
67 field_dot_1.real(_u_dot[_qp](1));
68 field_dot_1.imag(_coupled_dot[_qp](1));
69
70 field_dot_2.real(_u_dot[_qp](2));
71 field_dot_2.imag(_coupled_dot[_qp](2));
72 }
73 else
74 {
75 field_dot_0.real(_coupled_dot[_qp](0));
76 field_dot_0.imag(_u_dot[_qp](0));
77
78 field_dot_1.real(_coupled_dot[_qp](1));
79 field_dot_1.imag(_u_dot[_qp](1));
80
81 field_dot_2.real(_coupled_dot[_qp](2));
82 field_dot_2.imag(_u_dot[_qp](2));
83 }
84 VectorValue<std::complex<double>> field_dot(field_dot_0, field_dot_1, field_dot_2);
85
86 // Calculate solution field contribution to BC residual
87 std::complex<double> p_dot_test = EM::mu_0 * _admittance.value(_t, _q_point[_qp]) *
88 _test[_i][_qp].cross(_normals[_qp]) *
89 _normals[_qp].cross(field_dot);
90
91 std::complex<double> res = -p_dot_test;
92
93 if (_component == EM::REAL)
94 return res.real();
95 else
96 return res.imag();
97}
98
99Real
101{
102 RealVectorValue prefix =
104
105 return prefix * _normals[_qp].cross(_du_dot_du[_qp] * _phi[_j][_qp]);
106}
107
108Real
110{
111 if (jvar == _coupled_var_num)
112 {
113 RealVectorValue prefix =
115
116 return prefix * _normals[_qp].cross(_coupled_dot_du[_qp] * _phi[_j][_qp]);
117 }
118 else
119 return 0.0;
120}
registerMooseObject("ElectromagneticsApp", VectorTransientAbsorbingBC)
virtual Real value(Real t, const Point &p) const
void addRequiredCoupledVar(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
unsigned int _i
unsigned int _j
const MooseArray< Point > & _q_point
static InputParameters validParams()
const MooseArray< Point > & _normals
const VectorVariablePhiValue & _phi
const VectorVariableTestValue & _test
First order transient absorbing boundary condition for nonlinear vector variables.
const MooseEnum _component
Variable field component (real or imaginary)
static InputParameters validParams()
const VectorVariableValue & _coupled_dot
Coupled vector field variable time derivative.
VectorTransientAbsorbingBC(const InputParameters &parameters)
virtual Real computeQpResidual() override
const VectorVariableValue & _u_dot
Vector field variable time derivative.
const VariableValue & _du_dot_du
Vector field variable dot du.
const VariableValue & _coupled_dot_du
Coupled vector field variable dot du.
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
const unsigned int _coupled_var_num
Coupled field vector variable id.
virtual Real computeQpJacobian() override
const Function & _admittance
Intrinsic impedance of the infinite medium (default is the admittance of free space)
static const Real mu_0
Magnetic permeability of free space in SI units (H/m)
static const Real c
Speed of light in vacuum in SI units (m/s)