https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ReflectionCoefficient.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{
21 "CURRENTLY ONLY FOR 1D PLANE WAVE SOLVES. Calculate power reflection coefficient "
22 "for impinging wave on a surface. Assumes that wave of form F = F_incoming + R*F_reflected");
24 "field_real", "The name of the real field variable this postprocessor operates on.");
25 params.addRequiredCoupledVar("field_imag", "Coupled imaginary field variable.");
26 params.addRequiredRangeCheckedParam<Real>("theta", "theta>=0", "Wave incidence angle");
27 params.addRequiredRangeCheckedParam<Real>("length", "length>0", "Domain length");
28 params.addRequiredRangeCheckedParam<Real>("k", "k>0", "Wave number");
29 params.addRangeCheckedParam<Real>(
30 "incoming_field_magnitude", 1.0, "incoming_field_magnitude>0", "Incoming field magnitude");
31 return params;
32}
33
35 : SidePostprocessor(parameters),
36 MooseVariableInterface<Real>(this, false, "field_real"),
37 _qp(0),
38 _coupled_real(coupledValue("field_real")),
39 _coupled_imag(coupledValue("field_imag")),
40 _theta(getParam<Real>("theta")),
41 _length(getParam<Real>("length")),
42 _k(getParam<Real>("k")),
43 _incoming_mag(getParam<Real>("incoming_field_magnitude"))
44{
45 if (_mesh.dimension() > 1)
46 mooseError("This object does not support two and three-dimensional meshes.");
47}
48
49void
54
55void
60
66
67void
69{
70 const auto & pps = static_cast<const ReflectionCoefficient &>(y);
71 Real temp_rc = _reflection_coefficient;
72 _reflection_coefficient = std::max(temp_rc, pps._reflection_coefficient);
73}
74
75void
80
81Real
83{
84 std::complex<double> field(_coupled_real[_qp], _coupled_imag[_qp]);
85
86 std::complex<double> incoming_wave =
87 _incoming_mag * std::exp(EM::j * _k * _length * std::cos(_theta * libMesh::pi / 180.));
88 std::complex<double> reversed_wave =
89 _incoming_mag * std::exp(-EM::j * _k * _length * std::cos(_theta * libMesh::pi / 180.));
90
91 std::complex<double> reflection_coefficient_complex = (field - incoming_wave) / reversed_wave;
92
93 return std::pow(std::abs(reflection_coefficient_complex), 2);
94}
const std::vector< double > y
Real PostprocessorValue
registerMooseObject("ElectromagneticsApp", ReflectionCoefficient)
void addRequiredRangeCheckedParam(const std::string &name, const std::string &parsed_function, const std::string &doc_string)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
void mooseError(Args &&... args) const
virtual unsigned int dimension() const
CURRENTLY ONLY FOR 1D PLANE WAVE SOLVES.
virtual PostprocessorValue getValue() const override
virtual void execute() override
unsigned int _qp
quadrature point
const Real _incoming_mag
Incoming field magnitude.
virtual void finalize() override
virtual void initialize() override
const VariableValue & _coupled_real
Real component of the coupled field variable.
virtual void threadJoin(const UserObject &y) override
const Real _length
Domain length.
const VariableValue & _coupled_imag
Imaginary component of the coupled field variable.
const Real _k
Wave number.
static InputParameters validParams()
const Real _theta
Wave incidence angle.
virtual Real computeReflection()
compute reflection coefficient
Real _reflection_coefficient
Value of the reflection coefficient.
ReflectionCoefficient(const InputParameters &parameters)
static InputParameters validParams()
MooseMesh & _mesh
void gatherMax(T &value)
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
const Real pi