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