https://mooseframework.inl.gov
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 
10 #include "ReflectionCoefficient.h"
12 #include <complex>
13 
14 registerMooseObject("ElectromagneticsApp", ReflectionCoefficient);
15 
18 {
20  params.addClassDescription(
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");
23  params.addRequiredCoupledVar(
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 
49 void
51 {
53 }
54 
55 void
57 {
59 }
60 
63 {
65 }
66 
67 void
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 
75 void
77 {
79 }
80 
81 Real
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 }
virtual Real computeReflection()
compute reflection coefficient
unsigned int _qp
quadrature point
const Real _theta
Wave incidence angle.
void addRequiredRangeCheckedParam(const std::string &name, const std::string &parsed_function, const std::string &doc_string)
void gatherMax(T &value)
virtual PostprocessorValue getValue() const override
Real _reflection_coefficient
Value of the reflection coefficient.
const std::vector< double > y
const Real _k
Wave number.
const VariableValue & _coupled_imag
Imaginary component of the coupled field variable.
const Real _incoming_mag
Incoming field magnitude.
CURRENTLY ONLY FOR 1D PLANE WAVE SOLVES.
static InputParameters validParams()
virtual void execute() override
virtual void initialize() override
virtual unsigned int dimension() const
const Real _length
Domain length.
virtual void threadJoin(const UserObject &y) override
virtual void finalize() override
registerMooseObject("ElectromagneticsApp", ReflectionCoefficient)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
MooseMesh & _mesh
Scalar< const PostprocessorValue > PostprocessorValue
static InputParameters validParams()
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
ReflectionCoefficient(const InputParameters &parameters)
MooseUnits pow(const MooseUnits &, int)
const VariableValue & _coupled_real
Real component of the coupled field variable.
const Real pi