5#ifndef WAVESIMC_COEFF_HPP
6#define WAVESIMC_COEFF_HPP
8#include "CustomLibraries/np.hpp"
21 boost::multi_array<double, 2>
get_sigma_1(boost::multi_array<double, 1> x,
double dx,
int nx,
int nz,
22 double c_max,
int n = 15,
double R = 1e-3,
double m = 2.0)
24 boost::multi_array<double, 2> sigma_1(boost::extents[nx][nz]);
25 const double PML_width = n * dx;
27 const double sigma_max = -c_max * log(R) * (m + 1.0) /
np::pow(PML_width, m + 1.0);
29 const double x_0 =
np::max(x) - PML_width;
31 boost::multi_array<double, 1> polynomial(boost::extents[nx]);
33 for (
int i = 0; i < nx; i++)
38 polynomial[nx - 1 - i] = polynomial[i];
46 for (
int i = 0; i < nx; i++)
47 for (
int j = 0; j < nz; j++)
48 sigma_1[i][j] = polynomial[i];
56 boost::multi_array<double, 2>
get_sigma_2(boost::multi_array<double, 1> z,
double dz,
int nx,
int nz,
57 double c_max,
int n = 10,
double R = 1e-3,
double m = 2.0)
59 boost::multi_array<double, 2> sigma_2(boost::extents[nx][nz]);
60 const double PML_width = n * dz;
61 const double sigma_max = -c_max * log(R) * (m + 1.0) /
np::pow(PML_width, m + 1.0);
63 const double z_0 =
np::max(z) - PML_width;
65 boost::multi_array<double, 1> polynomial(boost::extents[nz]);
66 for (
int j = 0; j < nz; j++)
71 polynomial[nz - 1 - j] = polynomial[j];
79 for (
int i = 0; i < nx; i++)
80 for (
int j = 0; j < nz; j++)
81 sigma_2[i][j] = polynomial[j];
boost::multi_array< double, 2 > get_sigma_2(boost::multi_array< double, 1 > z, double dz, int nx, int nz, double c_max, int n=10, double R=1e-3, double m=2.0)
boost::multi_array< double, 2 > get_sigma_1(boost::multi_array< double, 1 > x, double dx, int nx, int nz, double c_max, int n=15, double R=1e-3, double m=2.0)
::value constexpr boost::multi_array< T, ND > pow(const boost::multi_array< T, ND > &input_array, const T exponent)
Implements the numpy pow function on multi arrays.
::value constexpr T abs(T input)
Implements the numpy abs function for a scalar.
::value constexpr T max(boost::multi_array< T, ND > const &input_array)
Implements the numpy max function for an n-dimensionl multi array.