pml_mapping_functions.h
Go to the documentation of this file.
1 // LIC// ====================================================================
2 // LIC// This file forms part of oomph-lib, the object-oriented,
3 // LIC// multi-physics finite-element library, available
4 // LIC// at http://www.oomph-lib.org.
5 // LIC//
6 // LIC// Copyright (C) 2006-2024 Matthias Heil and Andrew Hazel
7 // LIC//
8 // LIC// This library is free software; you can redistribute it and/or
9 // LIC// modify it under the terms of the GNU Lesser General Public
10 // LIC// License as published by the Free Software Foundation; either
11 // LIC// version 2.1 of the License, or (at your option) any later version.
12 // LIC//
13 // LIC// This library is distributed in the hope that it will be useful,
14 // LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // LIC// Lesser General Public License for more details.
17 // LIC//
18 // LIC// You should have received a copy of the GNU Lesser General Public
19 // LIC// License along with this library; if not, write to the Free Software
20 // LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 // LIC// 02110-1301 USA.
22 // LIC//
23 // LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
24 // LIC//
25 // LIC//====================================================================
26 #ifndef OOMPH_PML_MAPPING_FUNCTIONS_HEADER
27 #define OOMPH_PML_MAPPING_FUNCTIONS_HEADER
28 
29 // Config header generated by autoconfig
30 #ifdef HAVE_CONFIG_H
31 #include <oomph-lib-config.h>
32 #endif
33 
34 #include "complex_matrices.h"
35 #include "oomph_utilities.h"
36 
37 namespace oomph
38 {
39  //
40  //=======================================================================
41  /// Class to hold the mapping function (gamma) for the Pml which defines
42  /// how the coordinates are transformed in the Pml. This class holds
43  /// the one dimensional or uniaxial case which is the most common
44  //=======================================================================
45  class PMLMapping
46  {
47  public:
48  /// Default constructor (empty)
50 
51  /// Pure virtual to return Pml mapping gamma, where gamma is the
52  /// \f$d\tilde x / d x\f$ as function of \f$\nu\f$ where \f$\nu = x - h\f$
53  /// where h is the vector from the origin to the start of the Pml
54  virtual std::complex<double> gamma(const double& nu_i,
55  const double& pml_width_i,
56  const double& wavenumber_squared,
57  const double& alpha_shift = 0.0) = 0;
58  };
59 
60  //=======================================================================
61  /// A mapping function propsed by Bermudez et al, appears to be the best
62  /// for the Helmholtz equations and so this will be the default mapping
63  /// (see definition of PmlHelmholtzEquations)
64  //=======================================================================
66  {
67  public:
68  /// Default constructor (empty)
70 
71  /// Overwrite the pure Pml mapping coefficient function to return the
72  /// coeffcients proposed by Bermudez et al
73  std::complex<double> gamma(const double& nu_i,
74  const double& pml_width_i,
75  const double& wavenumber_squared,
76  const double& alpha_shift = 0.0)
77  {
78  /// return \f$\gamma=1 + (1/k)(i/|outer_boundary - x|)\f$
79  return 1.0 + MathematicalConstants::I / sqrt(wavenumber_squared) *
80  (1.0 / std::fabs(pml_width_i - nu_i));
81  }
82  };
83 
84  //=======================================================================
85  /// A mapping function proposed by Bermudez et al, similar to the one above
86  /// but is continuous across the inner Pml boundary
87  /// appears to be the best for TimeHarmonicLinearElasticity
88  /// and so this will be the default mapping
89  //=======================================================================
91  {
92  public:
93  /// Default constructor (empty)
95 
96  /// Overwrite the pure Pml mapping coefficient function to return the
97  /// coeffcients proposed by Bermudez et al
98  std::complex<double> gamma(const double& nu_i,
99  const double& pml_width_i,
100  const double& wavenumber_squared,
101  const double& alpha_shift = 0.0)
102  {
103  /// return \f$\gamma=1 + (i/k)(1/|outer_boundary - x|-1/|pml width|)\f$
104  return 1.0 + MathematicalConstants::I / sqrt(wavenumber_squared) *
105  (1.0 / std::fabs(pml_width_i - nu_i) -
106  1.0 / std::fabs(pml_width_i));
107  }
108  };
109 
110 } // namespace oomph
111 
112 #endif
A mapping function propsed by Bermudez et al, appears to be the best for the Helmholtz equations and ...
BermudezPMLMapping()
Default constructor (empty)
std::complex< double > gamma(const double &nu_i, const double &pml_width_i, const double &wavenumber_squared, const double &alpha_shift=0.0)
Overwrite the pure Pml mapping coefficient function to return the coeffcients proposed by Bermudez et...
A mapping function proposed by Bermudez et al, similar to the one above but is continuous across the ...
ContinuousBermudezPMLMapping()
Default constructor (empty)
std::complex< double > gamma(const double &nu_i, const double &pml_width_i, const double &wavenumber_squared, const double &alpha_shift=0.0)
Overwrite the pure Pml mapping coefficient function to return the coeffcients proposed by Bermudez et...
Class to hold the mapping function (gamma) for the Pml which defines how the coordinates are transfor...
virtual std::complex< double > gamma(const double &nu_i, const double &pml_width_i, const double &wavenumber_squared, const double &alpha_shift=0.0)=0
Pure virtual to return Pml mapping gamma, where gamma is the as function of where where h is the v...
PMLMapping()
Default constructor (empty)
const std::complex< double > I(0.0, 1.0)
The imaginary unit.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...