diff --git a/include/GMGPolar/setup.h b/include/GMGPolar/setup.h index abcdcb14..250ef397 100644 --- a/include/GMGPolar/setup.h +++ b/include/GMGPolar/setup.h @@ -42,14 +42,14 @@ void GMGPolar::setup() auto finest_levelCache = std::make_unique>( *finest_grid, density_profile_coefficients_, domain_geometry_, cache_density_profile_coefficients_, - cache_domain_geometry_); + cache_domain_geometry_, 0); levels_.emplace_back(0, std::move(finest_grid), std::move(finest_levelCache), extrapolation_, FMG_, PCG_FMG_); for (int level_depth = 1; level_depth < number_of_levels_; level_depth++) { auto current_grid = std::make_unique(coarseningGrid(levels_[level_depth - 1].grid())); auto current_levelCache = std::make_unique>( *current_grid, density_profile_coefficients_, domain_geometry_, cache_density_profile_coefficients_, - cache_domain_geometry_); + cache_domain_geometry_, level_depth); levels_.emplace_back(level_depth, std::move(current_grid), std::move(current_levelCache), extrapolation_, FMG_, PCG_FMG_); } diff --git a/include/InputFunctions/DensityProfileCoefficients/poissonCoefficients.h b/include/InputFunctions/DensityProfileCoefficients/poissonCoefficients.h index 6f5d2e97..d3e00d8c 100644 --- a/include/InputFunctions/DensityProfileCoefficients/poissonCoefficients.h +++ b/include/InputFunctions/DensityProfileCoefficients/poissonCoefficients.h @@ -1,4 +1,5 @@ #pragma once +#include "../../PolarGrid/polargrid.h" #include #include @@ -11,15 +12,15 @@ namespace gmgpolar class PoissonCoefficients { public: - PoissonCoefficients() = default; - explicit PoissonCoefficients(double Rmax, double alpha); + explicit PoissonCoefficients(const PolarGrid& grid, double Rmax, double alpha); - KOKKOS_FUNCTION double alpha(double r, double theta) const; - KOKKOS_FUNCTION double beta(double r, double theta) const; + KOKKOS_FUNCTION double alpha(int i_r, int i_theta) const; + KOKKOS_FUNCTION double beta(int i_r, int i_theta) const; KOKKOS_FUNCTION double getAlphaJump() const; private: + PolarGrid grid_; const double Rmax = 1.3; const double alpha_jump = 0.5 * 1.3; }; diff --git a/include/InputFunctions/DensityProfileCoefficients/sonnendruckerCoefficients.h b/include/InputFunctions/DensityProfileCoefficients/sonnendruckerCoefficients.h index 2b8953b8..842a75b1 100644 --- a/include/InputFunctions/DensityProfileCoefficients/sonnendruckerCoefficients.h +++ b/include/InputFunctions/DensityProfileCoefficients/sonnendruckerCoefficients.h @@ -1,4 +1,5 @@ #pragma once +#include "../../PolarGrid/polargrid.h" #include #include @@ -11,15 +12,15 @@ namespace gmgpolar class SonnendruckerCoefficients { public: - SonnendruckerCoefficients() = default; - explicit SonnendruckerCoefficients(double Rmax, double alpha); + explicit SonnendruckerCoefficients(const PolarGrid& grid, double Rmax, double alpha); - KOKKOS_FUNCTION double alpha(double r, double theta) const; - KOKKOS_FUNCTION double beta(double r, double theta) const; + KOKKOS_FUNCTION double alpha(int i_r, int i_theta) const; + KOKKOS_FUNCTION double beta(int i_r, int i_theta) const; KOKKOS_FUNCTION double getAlphaJump() const; private: + PolarGrid grid_; const double Rmax = 1.3; const double alpha_jump = 0.66 * 1.3; }; diff --git a/include/InputFunctions/DensityProfileCoefficients/sonnendruckerGyroCoefficients.h b/include/InputFunctions/DensityProfileCoefficients/sonnendruckerGyroCoefficients.h index 6207372e..6926663a 100644 --- a/include/InputFunctions/DensityProfileCoefficients/sonnendruckerGyroCoefficients.h +++ b/include/InputFunctions/DensityProfileCoefficients/sonnendruckerGyroCoefficients.h @@ -1,4 +1,5 @@ #pragma once +#include "../../PolarGrid/polargrid.h" #include #include @@ -11,15 +12,15 @@ namespace gmgpolar class SonnendruckerGyroCoefficients { public: - SonnendruckerGyroCoefficients() = default; - explicit SonnendruckerGyroCoefficients(double Rmax, double alpha); + explicit SonnendruckerGyroCoefficients(const PolarGrid& grid, double Rmax, double alpha); - KOKKOS_FUNCTION double alpha(double r, double theta) const; - KOKKOS_FUNCTION double beta(double r, double theta) const; + KOKKOS_FUNCTION double alpha(int i_r, int i_theta) const; + KOKKOS_FUNCTION double beta(int i_r, int i_theta) const; KOKKOS_FUNCTION double getAlphaJump() const; private: + PolarGrid grid_; const double Rmax = 1.3; const double alpha_jump = 0.66 * 1.3; }; diff --git a/include/InputFunctions/DensityProfileCoefficients/zoniCoefficients.h b/include/InputFunctions/DensityProfileCoefficients/zoniCoefficients.h index d4845af1..462d3dcd 100644 --- a/include/InputFunctions/DensityProfileCoefficients/zoniCoefficients.h +++ b/include/InputFunctions/DensityProfileCoefficients/zoniCoefficients.h @@ -1,4 +1,5 @@ #pragma once +#include "../../PolarGrid/polargrid.h" #include #include @@ -11,15 +12,15 @@ namespace gmgpolar class ZoniCoefficients { public: - ZoniCoefficients() = default; - explicit ZoniCoefficients(double Rmax, double alpha); + explicit ZoniCoefficients(const PolarGrid& grid, double Rmax, double alpha); - KOKKOS_FUNCTION double alpha(double r, double theta) const; - KOKKOS_FUNCTION double beta(double r, double theta) const; + KOKKOS_FUNCTION double alpha(int i_r, int i_theta) const; + KOKKOS_FUNCTION double beta(int i_r, int i_theta) const; KOKKOS_FUNCTION double getAlphaJump() const; private: + PolarGrid grid_; const double Rmax = 1.3; const double alpha_jump = 0.4837 * 1.3; }; diff --git a/include/InputFunctions/DensityProfileCoefficients/zoniGyroCoefficients.h b/include/InputFunctions/DensityProfileCoefficients/zoniGyroCoefficients.h index 9f48a6ee..d0ac8e84 100644 --- a/include/InputFunctions/DensityProfileCoefficients/zoniGyroCoefficients.h +++ b/include/InputFunctions/DensityProfileCoefficients/zoniGyroCoefficients.h @@ -1,4 +1,5 @@ #pragma once +#include "../../PolarGrid/polargrid.h" #include #include @@ -11,15 +12,15 @@ namespace gmgpolar class ZoniGyroCoefficients { public: - ZoniGyroCoefficients() = default; - explicit ZoniGyroCoefficients(double Rmax, double alpha); + explicit ZoniGyroCoefficients(const PolarGrid& grid, double Rmax, double alpha); - KOKKOS_FUNCTION double alpha(double r, double theta) const; - KOKKOS_FUNCTION double beta(double r, double theta) const; + KOKKOS_FUNCTION double alpha(int i_r, int i_theta) const; + KOKKOS_FUNCTION double beta(int i_r, int i_theta) const; KOKKOS_FUNCTION double getAlphaJump() const; private: + PolarGrid grid_; const double Rmax = 1.3; const double alpha_jump = 0.4837 * 1.3; }; diff --git a/include/InputFunctions/DensityProfileCoefficients/zoniShiftedCoefficients.h b/include/InputFunctions/DensityProfileCoefficients/zoniShiftedCoefficients.h index 3a590a23..b203de5c 100644 --- a/include/InputFunctions/DensityProfileCoefficients/zoniShiftedCoefficients.h +++ b/include/InputFunctions/DensityProfileCoefficients/zoniShiftedCoefficients.h @@ -1,4 +1,5 @@ #pragma once +#include "../../PolarGrid/polargrid.h" #include #include @@ -11,15 +12,15 @@ namespace gmgpolar class ZoniShiftedCoefficients { public: - ZoniShiftedCoefficients() = default; - explicit ZoniShiftedCoefficients(double Rmax, double alpha); + explicit ZoniShiftedCoefficients(const PolarGrid& grid, double Rmax, double alpha); - KOKKOS_FUNCTION double alpha(double r, double theta) const; - KOKKOS_FUNCTION double beta(double r, double theta) const; + KOKKOS_FUNCTION double alpha(int i_r, int i_theta) const; + KOKKOS_FUNCTION double beta(int i_r, int i_theta) const; KOKKOS_FUNCTION double getAlphaJump() const; private: + PolarGrid grid_; const double Rmax = 1.3; const double alpha_jump = 0.678 * 1.3; }; diff --git a/include/InputFunctions/DensityProfileCoefficients/zoniShiftedGyroCoefficients.h b/include/InputFunctions/DensityProfileCoefficients/zoniShiftedGyroCoefficients.h index 9f18ea0d..473cb1ed 100644 --- a/include/InputFunctions/DensityProfileCoefficients/zoniShiftedGyroCoefficients.h +++ b/include/InputFunctions/DensityProfileCoefficients/zoniShiftedGyroCoefficients.h @@ -1,4 +1,5 @@ #pragma once +#include "../../PolarGrid/polargrid.h" #include #include @@ -11,15 +12,15 @@ namespace gmgpolar class ZoniShiftedGyroCoefficients { public: - ZoniShiftedGyroCoefficients() = default; - explicit ZoniShiftedGyroCoefficients(double Rmax, double alpha); + explicit ZoniShiftedGyroCoefficients(const PolarGrid& grid, double Rmax, double alpha); - KOKKOS_FUNCTION double alpha(double r, double theta) const; - KOKKOS_FUNCTION double beta(double r, double theta) const; + KOKKOS_FUNCTION double alpha(int i_r, int i_theta) const; + KOKKOS_FUNCTION double beta(int i_r, int i_theta) const; KOKKOS_FUNCTION double getAlphaJump() const; private: + PolarGrid grid_; const double Rmax = 1.3; const double alpha_jump = 0.678 * 1.3; }; diff --git a/include/InputFunctions/densityProfileCoefficients.h b/include/InputFunctions/densityProfileCoefficients.h index 86aa4ad3..4aeb757e 100644 --- a/include/InputFunctions/densityProfileCoefficients.h +++ b/include/InputFunctions/densityProfileCoefficients.h @@ -4,9 +4,9 @@ namespace concepts { template -concept DensityProfileCoefficients = requires(const T coeffs, double r, double theta) { - { coeffs.alpha(r, theta) } -> std::convertible_to; - { coeffs.beta(r, theta) } -> std::convertible_to; +concept DensityProfileCoefficients = requires(const T coeffs, int i_r, int i_theta) { + { coeffs.alpha(i_r, i_theta) } -> std::convertible_to; + { coeffs.beta(i_r, i_theta) } -> std::convertible_to; { coeffs.getAlphaJump() } -> std::convertible_to; }; diff --git a/include/Level/level.h b/include/Level/level.h index 7b8a8d8a..101a37f9 100644 --- a/include/Level/level.h +++ b/include/Level/level.h @@ -136,7 +136,7 @@ class LevelCache public: explicit LevelCache(const PolarGrid& grid, const DensityProfileCoefficients& density_profile_coefficients, const DomainGeometry& domain_geometry, const bool cache_density_profile_coefficients, - const bool cache_domain_geometry); + const bool cache_domain_geometry, const int level_depth); const DomainGeometry& domainGeometry() const; const DensityProfileCoefficients& densityProfileCoefficients() const; @@ -155,8 +155,10 @@ class LevelCache double theta, double& coeff_beta, double& arr, double& att, double& art, double& detDF) const { - coeff_beta = cache_density_profile_coefficients_ ? coeff_beta_[global_index] - : density_profile_coefficients_.beta(r, theta); + const int i_r_glob = i_r << level_depth_; + const int i_theta_glob = i_theta << level_depth_; + coeff_beta = cache_density_profile_coefficients_ ? coeff_beta_[global_index] + : density_profile_coefficients_.beta(i_r_glob, i_theta_glob); if (cache_domain_geometry_) { arr = arr_[global_index]; @@ -165,14 +167,16 @@ class LevelCache detDF = detDF_[global_index]; } else { - double coeff_alpha = cache_density_profile_coefficients_ ? coeff_alpha_[global_index] - : density_profile_coefficients_.alpha(r, theta); + double coeff_alpha = cache_density_profile_coefficients_ + ? coeff_alpha_[global_index] + : density_profile_coefficients_.alpha(i_r_glob, i_theta_glob); compute_jacobian_elements(domain_geometry_, r, theta, coeff_alpha, arr, att, art, detDF); } } private: + const int level_depth_; const DomainGeometry domain_geometry_; const DensityProfileCoefficients density_profile_coefficients_; diff --git a/include/Level/levelCache.inl b/include/Level/levelCache.inl index cd8273f3..20a66e1d 100644 --- a/include/Level/levelCache.inl +++ b/include/Level/levelCache.inl @@ -6,7 +6,7 @@ template static void cache_density_profile_coefficients(const PolarGrid& grid, const DensityProfileCoefficients& density_profile_coefficients, const Vector& coeff_alpha, const Vector& coeff_beta, - const bool cache_domain_geometry) + const bool cache_domain_geometry, int level_depth) { Kokkos::parallel_for( "Cache density profile coefficients", @@ -16,13 +16,13 @@ static void cache_density_profile_coefficients(const PolarGrid& grid, ), // Kokkos lambda function to execute for each point in the index space KOKKOS_LAMBDA(const int i_r, const int i_theta) { - const double r = grid.radius(i_r); - const double theta = grid.theta(i_theta); - const int index = grid.index(i_r, i_theta); + const int index = grid.index(i_r, i_theta); + const int i_r_glob = i_r << level_depth; + const int i_theta_glob = i_theta << level_depth; if (!cache_domain_geometry) { - coeff_alpha(index) = density_profile_coefficients.alpha(r, theta); + coeff_alpha(index) = density_profile_coefficients.alpha(i_r_glob, i_theta_glob); } - coeff_beta(index) = density_profile_coefficients.beta(r, theta); + coeff_beta(index) = density_profile_coefficients.beta(i_r_glob, i_theta_glob); }); } @@ -30,7 +30,7 @@ template & vec_arr, const Vector& vec_att, const Vector& vec_art, - const Vector& vec_detDF) + const Vector& vec_detDF, int level_depth) { // We split the loops into two regions to better respect the // access patterns of the smoother and improve cache locality @@ -47,7 +47,9 @@ static void cache_domain_geometry(const PolarGrid& grid, const DensityProfileCoe const double r = grid.radius(i_r); const double theta = grid.theta(i_theta); const int index = grid.index(i_r, i_theta); - const double coeff_alpha = density_profile_coefficients.alpha(r, theta); + const int i_r_glob = i_r << level_depth; + const int i_theta_glob = i_theta << level_depth; + const double coeff_alpha = density_profile_coefficients.alpha(i_r_glob, i_theta_glob); double arr, att, art, detDF; compute_jacobian_elements(domain_geometry, r, theta, coeff_alpha, arr, att, art, detDF); @@ -68,7 +70,9 @@ static void cache_domain_geometry(const PolarGrid& grid, const DensityProfileCoe const double theta = grid.theta(i_theta); const double r = grid.radius(i_r); const int index = grid.index(i_r, i_theta); - const double coeff_alpha = density_profile_coefficients.alpha(r, theta); + const int i_r_glob = i_r << level_depth; + const int i_theta_glob = i_theta << level_depth; + const double coeff_alpha = density_profile_coefficients.alpha(i_r_glob, i_theta_glob); double arr, att, art, detDF; compute_jacobian_elements(domain_geometry, r, theta, coeff_alpha, arr, att, art, detDF); @@ -85,8 +89,9 @@ template ::LevelCache( const PolarGrid& grid, const DensityProfileCoefficients& density_profile_coefficients, const DomainGeometry& domain_geometry, const bool cache_density_profile_coefficients, - const bool cache_domain_geometry) - : domain_geometry_(domain_geometry) + const bool cache_domain_geometry, const int level_depth) + : level_depth_(level_depth) + , domain_geometry_(domain_geometry) , density_profile_coefficients_(density_profile_coefficients) , cache_density_profile_coefficients_(cache_density_profile_coefficients) // If the domain geometry is cached, we don't need to cache the alpha coefficient @@ -103,14 +108,14 @@ LevelCache::LevelCache( // repeated expensive evaluations during runtime computations if (cache_density_profile_coefficients_) { level_cache_helpers::cache_density_profile_coefficients(grid, density_profile_coefficients, coeff_alpha_, - coeff_beta_, cache_domain_geometry); + coeff_beta_, cache_domain_geometry, level_depth); } // Pre-compute and store Jacobian matrix elements (arr, att, art, detDF) at all grid nodes // to avoid repeated coordinate transformation calculations during domain operations if (cache_domain_geometry_) { level_cache_helpers::cache_domain_geometry(grid, density_profile_coefficients, domain_geometry, arr_, att_, - art_, detDF_); + art_, detDF_, level_depth); } Kokkos::fence(); } diff --git a/src/ConfigParser/select_test_case.cpp b/src/ConfigParser/select_test_case.cpp index d11b1ba1..e2bb1317 100644 --- a/src/ConfigParser/select_test_case.cpp +++ b/src/ConfigParser/select_test_case.cpp @@ -65,18 +65,18 @@ void ConfigParser::selectTestCase(GeometryType geometry_type, ProblemType proble switch (alpha_type) { case AlphaCoeff::POISSON: density_profile_coefficients_ = - std::make_unique(PoissonCoefficients(Rmax, alpha_jump)); + std::make_unique(PoissonCoefficients(grid_, Rmax, alpha_jump)); break; case AlphaCoeff::SONNENDRUCKER: switch (beta_type) { case BetaCoeff::ZERO: density_profile_coefficients_ = - std::make_unique(SonnendruckerCoefficients(Rmax, alpha_jump)); + std::make_unique(SonnendruckerCoefficients(grid_, Rmax, alpha_jump)); break; case BetaCoeff::ALPHA_INVERSE: - density_profile_coefficients_ = - std::make_unique(SonnendruckerGyroCoefficients(Rmax, alpha_jump)); + density_profile_coefficients_ = std::make_unique( + SonnendruckerGyroCoefficients(grid_, Rmax, alpha_jump)); break; default: throw std::runtime_error("Invalid beta.\n"); @@ -87,11 +87,11 @@ void ConfigParser::selectTestCase(GeometryType geometry_type, ProblemType proble switch (beta_type) { case BetaCoeff::ZERO: density_profile_coefficients_ = - std::make_unique(ZoniCoefficients(Rmax, alpha_jump)); + std::make_unique(ZoniCoefficients(grid_, Rmax, alpha_jump)); break; case BetaCoeff::ALPHA_INVERSE: density_profile_coefficients_ = - std::make_unique(ZoniGyroCoefficients(Rmax, alpha_jump)); + std::make_unique(ZoniGyroCoefficients(grid_, Rmax, alpha_jump)); break; default: throw std::runtime_error("Invalid beta.\n"); @@ -102,11 +102,11 @@ void ConfigParser::selectTestCase(GeometryType geometry_type, ProblemType proble switch (beta_type) { case BetaCoeff::ZERO: density_profile_coefficients_ = - std::make_unique(ZoniShiftedCoefficients(Rmax, alpha_jump)); + std::make_unique(ZoniShiftedCoefficients(grid_, Rmax, alpha_jump)); break; case BetaCoeff::ALPHA_INVERSE: - density_profile_coefficients_ = - std::make_unique(ZoniShiftedGyroCoefficients(Rmax, alpha_jump)); + density_profile_coefficients_ = std::make_unique( + ZoniShiftedGyroCoefficients(grid_, Rmax, alpha_jump)); break; default: throw std::runtime_error("Invalid beta.\n"); diff --git a/src/InputFunctions/DensityProfileCoefficients/poissonCoefficients.cpp b/src/InputFunctions/DensityProfileCoefficients/poissonCoefficients.cpp index 0d6adc6f..4108147d 100644 --- a/src/InputFunctions/DensityProfileCoefficients/poissonCoefficients.cpp +++ b/src/InputFunctions/DensityProfileCoefficients/poissonCoefficients.cpp @@ -1,18 +1,19 @@ #include using namespace gmgpolar; -PoissonCoefficients::PoissonCoefficients(double Rmax, double alpha_jump) - : Rmax(Rmax) +PoissonCoefficients::PoissonCoefficients(const PolarGrid& grid, double Rmax, double alpha_jump) + : grid_(grid) + , Rmax(Rmax) , alpha_jump(alpha_jump) { } -KOKKOS_FUNCTION double PoissonCoefficients::alpha(double r, double theta) const +KOKKOS_FUNCTION double PoissonCoefficients::alpha(int i_r, int i_theta) const { return 1.0; } -KOKKOS_FUNCTION double PoissonCoefficients::beta(double r, double theta) const +KOKKOS_FUNCTION double PoissonCoefficients::beta(int i_r, int i_theta) const { return 0.0; } diff --git a/src/InputFunctions/DensityProfileCoefficients/sonnendruckerCoefficients.cpp b/src/InputFunctions/DensityProfileCoefficients/sonnendruckerCoefficients.cpp index b5c2cda9..cdb699a0 100644 --- a/src/InputFunctions/DensityProfileCoefficients/sonnendruckerCoefficients.cpp +++ b/src/InputFunctions/DensityProfileCoefficients/sonnendruckerCoefficients.cpp @@ -1,18 +1,20 @@ #include using namespace gmgpolar; -SonnendruckerCoefficients::SonnendruckerCoefficients(double Rmax, double alpha_jump) - : Rmax(Rmax) +SonnendruckerCoefficients::SonnendruckerCoefficients(const PolarGrid& grid, double Rmax, double alpha_jump) + : grid_(grid) + , Rmax(Rmax) , alpha_jump(alpha_jump) { } -KOKKOS_FUNCTION double SonnendruckerCoefficients::alpha(double r, double theta) const +KOKKOS_FUNCTION double SonnendruckerCoefficients::alpha(int i_r, int i_theta) const { + double r = grid_.radius(i_r); return 0.452961672473868 - 0.348432055749129 * atan(14.4444444444444 * (r / Rmax) - 11.1111111111111); } -KOKKOS_FUNCTION double SonnendruckerCoefficients::beta(double r, double theta) const +KOKKOS_FUNCTION double SonnendruckerCoefficients::beta(int i_r, int i_theta) const { return 0.0; } diff --git a/src/InputFunctions/DensityProfileCoefficients/sonnendruckerGyroCoefficients.cpp b/src/InputFunctions/DensityProfileCoefficients/sonnendruckerGyroCoefficients.cpp index 7add013c..85f34978 100644 --- a/src/InputFunctions/DensityProfileCoefficients/sonnendruckerGyroCoefficients.cpp +++ b/src/InputFunctions/DensityProfileCoefficients/sonnendruckerGyroCoefficients.cpp @@ -1,19 +1,22 @@ #include using namespace gmgpolar; -SonnendruckerGyroCoefficients::SonnendruckerGyroCoefficients(double _Rmax, double _alpha_jump) - : Rmax(_Rmax) +SonnendruckerGyroCoefficients::SonnendruckerGyroCoefficients(const PolarGrid& grid, double _Rmax, double _alpha_jump) + : grid_(grid) + , Rmax(_Rmax) , alpha_jump(_alpha_jump) { } -KOKKOS_FUNCTION double SonnendruckerGyroCoefficients::alpha(double r, double theta) const +KOKKOS_FUNCTION double SonnendruckerGyroCoefficients::alpha(int i_r, int i_theta) const { + double r = grid_.radius(i_r); return 0.452961672473868 - 0.348432055749129 * atan(14.4444444444444 * (r / Rmax) - 11.1111111111111); } -KOKKOS_FUNCTION double SonnendruckerGyroCoefficients::beta(double r, double theta) const +KOKKOS_FUNCTION double SonnendruckerGyroCoefficients::beta(int i_r, int i_theta) const { + double r = grid_.radius(i_r); return pow((0.452961672473868 - 0.348432055749129 * atan(14.4444444444444 * (r / Rmax) - 11.1111111111111)), (double)((-1))); } diff --git a/src/InputFunctions/DensityProfileCoefficients/zoniCoefficients.cpp b/src/InputFunctions/DensityProfileCoefficients/zoniCoefficients.cpp index fb01e3a5..dd5a30ed 100644 --- a/src/InputFunctions/DensityProfileCoefficients/zoniCoefficients.cpp +++ b/src/InputFunctions/DensityProfileCoefficients/zoniCoefficients.cpp @@ -1,18 +1,20 @@ #include using namespace gmgpolar; -ZoniCoefficients::ZoniCoefficients(double Rmax, double alpha_jump) - : Rmax(Rmax) +ZoniCoefficients::ZoniCoefficients(const PolarGrid& grid, double Rmax, double alpha_jump) + : grid_(grid) + , Rmax(Rmax) , alpha_jump(alpha_jump) { } -KOKKOS_FUNCTION double ZoniCoefficients::alpha(double r, double theta) const +KOKKOS_FUNCTION double ZoniCoefficients::alpha(int i_r, int i_theta) const { + double r = grid_.radius(i_r); return exp(-tanh(10.0 * (r / Rmax) - 5.0)); } -KOKKOS_FUNCTION double ZoniCoefficients::beta(double r, double theta) const +KOKKOS_FUNCTION double ZoniCoefficients::beta(int i_r, int i_theta) const { return 0.0; } diff --git a/src/InputFunctions/DensityProfileCoefficients/zoniGyroCoefficients.cpp b/src/InputFunctions/DensityProfileCoefficients/zoniGyroCoefficients.cpp index 3ef74da8..c0ccf662 100644 --- a/src/InputFunctions/DensityProfileCoefficients/zoniGyroCoefficients.cpp +++ b/src/InputFunctions/DensityProfileCoefficients/zoniGyroCoefficients.cpp @@ -1,19 +1,22 @@ #include using namespace gmgpolar; -ZoniGyroCoefficients::ZoniGyroCoefficients(double Rmax, double alpha_jump) - : Rmax(Rmax) +ZoniGyroCoefficients::ZoniGyroCoefficients(const PolarGrid& grid, double Rmax, double alpha_jump) + : grid_(grid) + , Rmax(Rmax) , alpha_jump(alpha_jump) { } -KOKKOS_FUNCTION double ZoniGyroCoefficients::alpha(double r, double theta) const +KOKKOS_FUNCTION double ZoniGyroCoefficients::alpha(int i_r, int i_theta) const { + double r = grid_.radius(i_r); return exp(-tanh(10.0 * (r / Rmax) - 5.0)); } -KOKKOS_FUNCTION double ZoniGyroCoefficients::beta(double r, double theta) const +KOKKOS_FUNCTION double ZoniGyroCoefficients::beta(int i_r, int i_theta) const { + double r = grid_.radius(i_r); return exp(tanh(10.0 * (r / Rmax) - 5.0)); } diff --git a/src/InputFunctions/DensityProfileCoefficients/zoniShiftedCoefficients.cpp b/src/InputFunctions/DensityProfileCoefficients/zoniShiftedCoefficients.cpp index 7c0d8fda..70ee74a4 100644 --- a/src/InputFunctions/DensityProfileCoefficients/zoniShiftedCoefficients.cpp +++ b/src/InputFunctions/DensityProfileCoefficients/zoniShiftedCoefficients.cpp @@ -1,18 +1,20 @@ #include #include using namespace gmgpolar; -ZoniShiftedCoefficients::ZoniShiftedCoefficients(double Rmax, double alpha_jump) - : Rmax(Rmax) +ZoniShiftedCoefficients::ZoniShiftedCoefficients(const PolarGrid& grid, double Rmax, double alpha_jump) + : grid_(grid) + , Rmax(Rmax) , alpha_jump(alpha_jump) { } -KOKKOS_FUNCTION double ZoniShiftedCoefficients::alpha(double r, double theta) const +KOKKOS_FUNCTION double ZoniShiftedCoefficients::alpha(int i_r, int i_theta) const { + double r = grid_.radius(i_r); return exp(-tanh(20.0 * (r / Rmax) - 14.0)); } -KOKKOS_FUNCTION double ZoniShiftedCoefficients::beta(double r, double theta) const +KOKKOS_FUNCTION double ZoniShiftedCoefficients::beta(int i_r, int i_theta) const { return 0.0; } diff --git a/src/InputFunctions/DensityProfileCoefficients/zoniShiftedGyroCoefficients.cpp b/src/InputFunctions/DensityProfileCoefficients/zoniShiftedGyroCoefficients.cpp index 5503e964..e81f626a 100644 --- a/src/InputFunctions/DensityProfileCoefficients/zoniShiftedGyroCoefficients.cpp +++ b/src/InputFunctions/DensityProfileCoefficients/zoniShiftedGyroCoefficients.cpp @@ -1,19 +1,22 @@ #include using namespace gmgpolar; -ZoniShiftedGyroCoefficients::ZoniShiftedGyroCoefficients(double Rmax, double alpha_jump) - : Rmax(Rmax) +ZoniShiftedGyroCoefficients::ZoniShiftedGyroCoefficients(const PolarGrid& grid, double Rmax, double alpha_jump) + : grid_(grid) + , Rmax(Rmax) , alpha_jump(alpha_jump) { } -KOKKOS_FUNCTION double ZoniShiftedGyroCoefficients::alpha(double r, double theta) const +KOKKOS_FUNCTION double ZoniShiftedGyroCoefficients::alpha(int i_r, int i_theta) const { + double r = grid_.radius(i_r); return exp(-tanh(20.0 * (r / Rmax) - 14.0)); } -KOKKOS_FUNCTION double ZoniShiftedGyroCoefficients::beta(double r, double theta) const +KOKKOS_FUNCTION double ZoniShiftedGyroCoefficients::beta(int i_r, int i_theta) const { + double r = grid_.radius(i_r); return exp(tanh(20.0 * (r / Rmax) - 14.0)); } diff --git a/src/convergence_order.cpp b/src/convergence_order.cpp index e63d68b1..7aab0b52 100644 --- a/src/convergence_order.cpp +++ b/src/convergence_order.cpp @@ -53,23 +53,23 @@ int main(int argc, char* argv[]) /* Example 1: Polar Solution -> Higher Order 4.0 */ const double alpha_jump = 0.4837 * Rmax; ShafranovGeometry domain_geometry(Rmax, elongation_kappa, shift_delta); - ZoniGyroCoefficients coefficients(Rmax, alpha_jump); PolarR6_Boundary_ShafranovGeometry boundary_conditions(Rmax, elongation_kappa, shift_delta); PolarR6_ShafranovGeometry exact_solution(Rmax, elongation_kappa, shift_delta); + using DensityProfileCoefficients = ZoniGyroCoefficients; /* Example 2: Cartesian Solution -> Lower Order 3.5 */ // const double alpha_jump = 0.66 * Rmax; // CzarnyGeometry domain_geometry(Rmax, inverse_aspect_ratio_epsilon, ellipticity_e); - // SonnendruckerGyroCoefficients coefficients(Rmax, alpha_jump); // CartesianR2_Boundary_CzarnyGeometry boundary_conditions(Rmax, inverse_aspect_ratio_epsilon, ellipticity_e); // CartesianR2_CzarnyGeometry exact_solution(Rmax, inverse_aspect_ratio_epsilon, ellipticity_e); + // using DensityProfileCoefficients = SonnendruckerGyroCoefficients; /* Example 3: Refined Solution -> Lower Order 3.5 */ // const double alpha_jump = 0.9 * Rmax; // Refinement where the solution is most complex // ShafranovGeometry domain_geometry(Rmax, elongation_kappa, shift_delta); - // ZoniShiftedGyroCoefficients coefficients(Rmax, alpha_jump); // Refined_Boundary_ShafranovGeometry boundary_conditions(Rmax, elongation_kappa, shift_delta); // Refined_ShafranovGeometry exact_solution(Rmax, elongation_kappa, shift_delta); + // using DensityProfileCoefficients = ZoniShiftedGyroCoefficients; std::vector table_nr(MAX_DIVIDE_BY_2); std::vector table_ntheta(MAX_DIVIDE_BY_2); @@ -87,6 +87,7 @@ int main(int argc, char* argv[]) std::optional splitting_radius = std::nullopt; PolarGrid grid(R0, Rmax, nr_exp, ntheta_exp, refinement_radius, anisotropic_factor, divideBy2, splitting_radius); + DensityProfileCoefficients coefficients(grid, Rmax, alpha_jump); GMGPolar solver(grid, domain_geometry, coefficients); PolarR6_ZoniGyro_ShafranovGeometry source_term(grid, Rmax, elongation_kappa, shift_delta); diff --git a/src/strong_scaling.cpp b/src/strong_scaling.cpp index f5ed1f7e..dbd9d89c 100644 --- a/src/strong_scaling.cpp +++ b/src/strong_scaling.cpp @@ -18,23 +18,23 @@ void runTest(int divideBy2, std::ostream& outfile) /* Example 1: Polar Solution -> Higher Order 4.0 */ // const double alpha_jump = 0.4837 * Rmax; // ShafranovGeometry domain_geometry(Rmax, elongation_kappa, shift_delta); - // ZoniGyroCoefficients coefficients(Rmax, alpha_jump); // PolarR6_Boundary_ShafranovGeometry boundary_conditions(Rmax, elongation_kappa, shift_delta); // PolarR6_ShafranovGeometry exact_solution(Rmax, elongation_kappa, shift_delta); + // using DensityProfileCoefficients = ZoniGyroCoefficients; /* Example 2: Cartesian Solution -> Lower Order 3.5 */ const double alpha_jump = 0.66 * Rmax; CzarnyGeometry domain_geometry(Rmax, inverse_aspect_ratio_epsilon, ellipticity_e); - SonnendruckerGyroCoefficients coefficients(Rmax, alpha_jump); CartesianR2_Boundary_CzarnyGeometry boundary_conditions(Rmax, inverse_aspect_ratio_epsilon, ellipticity_e); CartesianR2_CzarnyGeometry exact_solution(Rmax, inverse_aspect_ratio_epsilon, ellipticity_e); + using DensityProfileCoefficients = SonnendruckerGyroCoefficients; /* Example 3: Refined Solution -> Lower Order 3.5 */ // const double alpha_jump = 0.9 * Rmax; // Refinement where the solution is most complex // ShafranovGeometry domain_geometry(Rmax, elongation_kappa, shift_delta); - // ZoniShiftedGyroCoefficients coefficients(Rmax, alpha_jump); // Refined_Boundary_ShafranovGeometry boundary_conditions(Rmax, elongation_kappa, shift_delta); // Refined_ShafranovGeometry exact_solution(Rmax, elongation_kappa, shift_delta); + // using DensityProfileCoefficients = ZoniShiftedGyroCoefficients; std::string geometry_string = ""; if (typeid(domain_geometry) == typeid(CircularGeometry)) { @@ -84,6 +84,7 @@ void runTest(int divideBy2, std::ostream& outfile) double refinement_radius = alpha_jump; std::optional splitting_radius = std::nullopt; PolarGrid grid(R0, Rmax, nr_exp, ntheta_exp, refinement_radius, anisotropic_factor, divideBy2, splitting_radius); + DensityProfileCoefficients coefficients(grid, Rmax, alpha_jump); GMGPolar solver(grid, domain_geometry, coefficients); // PolarR6_ZoniGyro_ShafranovGeometry source_term(grid, Rmax, elongation_kappa, shift_delta); diff --git a/src/weak_scaling.cpp b/src/weak_scaling.cpp index 9f07e604..ff07b1a3 100644 --- a/src/weak_scaling.cpp +++ b/src/weak_scaling.cpp @@ -21,20 +21,21 @@ void runTest(int divideBy2, std::ostream& outfile) // ZoniGyroCoefficients coefficients(Rmax, alpha_jump); // PolarR6_Boundary_ShafranovGeometry boundary_conditions(Rmax, elongation_kappa, shift_delta); // PolarR6_ShafranovGeometry exact_solution(Rmax, elongation_kappa, shift_delta); + // using DensityProfileCoefficients = ZoniGyroCoefficients; /* Example 2: Cartesian Solution -> Lower Order 3.5 */ const double alpha_jump = 0.66 * Rmax; CzarnyGeometry domain_geometry(Rmax, inverse_aspect_ratio_epsilon, ellipticity_e); - SonnendruckerGyroCoefficients coefficients(Rmax, alpha_jump); CartesianR2_Boundary_CzarnyGeometry boundary_conditions(Rmax, inverse_aspect_ratio_epsilon, ellipticity_e); CartesianR2_CzarnyGeometry exact_solution(Rmax, inverse_aspect_ratio_epsilon, ellipticity_e); + using DensityProfileCoefficients = SonnendruckerGyroCoefficients; /* Example 3: Refined Solution -> Lower Order 3.5 */ // const double alpha_jump = 0.9 * Rmax; // Refinement where the solution is most complex // ShafranovGeometry domain_geometry(Rmax, elongation_kappa, shift_delta); - // ZoniShiftedGyroCoefficients coefficients(Rmax, alpha_jump); // Refined_Boundary_ShafranovGeometry boundary_conditions(Rmax, elongation_kappa, shift_delta); // Refined_ShafranovGeometry exact_solution(Rmax, elongation_kappa, shift_delta); + // using DensityProfileCoefficients = ZoniShiftedGyroCoefficients; std::string geometry_string = ""; if (typeid(domain_geometry) == typeid(CircularGeometry)) { @@ -84,6 +85,7 @@ void runTest(int divideBy2, std::ostream& outfile) double refinement_radius = alpha_jump; std::optional splitting_radius = std::nullopt; PolarGrid grid(R0, Rmax, nr_exp, ntheta_exp, refinement_radius, anisotropic_factor, divideBy2, splitting_radius); + DensityProfileCoefficients coefficients(grid, Rmax, alpha_jump); GMGPolar solver(grid, domain_geometry, coefficients); // PolarR6_ZoniGyro_ShafranovGeometry source_term(grid, Rmax, elongation_kappa, shift_delta); diff --git a/tests/DirectSolver/directSolver.cpp b/tests/DirectSolver/directSolver.cpp index 8c1b2e9d..d4ab15d7 100644 --- a/tests/DirectSolver/directSolver.cpp +++ b/tests/DirectSolver/directSolver.cpp @@ -49,12 +49,14 @@ TEST(DirectSolverTest, directSolver_DirBC_Interior) double kappa_eps = 0.3; double delta_e = 1.4; + auto grid = std::make_unique(radii, angles); + using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = true; @@ -62,9 +64,8 @@ TEST(DirectSolverTest, directSolver_DirBC_Interior) bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, false); @@ -97,6 +98,8 @@ TEST(DirectSolverTest, directSolver_AcrossOrigin) std::vector angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; + auto grid = std::make_unique(radii, angles); + double Rmax = radii.back(); double kappa_eps = 0.3; double delta_e = 1.4; @@ -106,7 +109,7 @@ TEST(DirectSolverTest, directSolver_AcrossOrigin) double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = false; @@ -114,9 +117,8 @@ TEST(DirectSolverTest, directSolver_AcrossOrigin) bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -157,20 +159,21 @@ TEST(DirectSolverTest_CircularGeometry, DirectSolverDirBC_Interior_CircularGeome 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; double Rmax = radii.back(); + auto grid = std::make_unique(radii, angles); + using DomainGeometryType = CircularGeometry; DomainGeometryType domain_geometry(Rmax); double alpha_jump = 0.66 * Rmax; using DensityProfileCoefficientsType = SonnendruckerGyroCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = true; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; - auto grid = std::make_unique(radii, angles); auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -196,6 +199,8 @@ TEST(DirectSolverTest_CircularGeometry, DirectSolverAcrossOrigin_CircularGeometr std::vector angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; + auto grid = std::make_unique(radii, angles); + double Rmax = radii.back(); using DomainGeometryType = CircularGeometry; @@ -203,15 +208,14 @@ TEST(DirectSolverTest_CircularGeometry, DirectSolverAcrossOrigin_CircularGeometr double alpha_jump = 0.66 * Rmax; using DensityProfileCoefficientsType = SonnendruckerGyroCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = false; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; - auto grid = std::make_unique(radii, angles); auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -241,6 +245,8 @@ TEST(DirectSolverTest_ShafranovGeometry, DirectSolverDirBC_Interior_ShafranovGeo std::vector angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; + auto grid = std::make_unique(radii, angles); + double Rmax = radii.back(); double kappa_eps = 0.3; double delta_e = 0.2; @@ -250,15 +256,14 @@ TEST(DirectSolverTest_ShafranovGeometry, DirectSolverDirBC_Interior_ShafranovGeo double alpha_jump = 0.4837 * Rmax; using DensityProfileCoefficientsType = ZoniGyroCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = true; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; - auto grid = std::make_unique(radii, angles); auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -284,6 +289,8 @@ TEST(DirectSolverTest_ShafranovGeometry, DirectSolverAcrossOrigin_ShafranovGeome std::vector angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; + auto grid = std::make_unique(radii, angles); + double Rmax = radii.back(); double kappa_eps = 0.3; double delta_e = 0.2; @@ -293,15 +300,14 @@ TEST(DirectSolverTest_ShafranovGeometry, DirectSolverAcrossOrigin_ShafranovGeome double alpha_jump = 0.4837 * Rmax; using DensityProfileCoefficientsType = ZoniGyroCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = false; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; - auto grid = std::make_unique(radii, angles); auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -331,6 +337,8 @@ TEST(DirectSolverTest_CzarnyGeometry, DirectSolverDirBC_Interior_CzarnyGeometry) std::vector angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; + auto grid = std::make_unique(radii, angles); + double Rmax = radii.back(); double kappa_eps = 0.3; double delta_e = 1.4; @@ -340,15 +348,14 @@ TEST(DirectSolverTest_CzarnyGeometry, DirectSolverDirBC_Interior_CzarnyGeometry) double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = true; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; - auto grid = std::make_unique(radii, angles); auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -374,6 +381,8 @@ TEST(DirectSolverTest_CzarnyGeometry, DirectSolverAcrossOrigin_CzarnyGeometry) std::vector angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; + auto grid = std::make_unique(radii, angles); + double Rmax = radii.back(); double kappa_eps = 0.3; double delta_e = 1.4; @@ -383,15 +392,14 @@ TEST(DirectSolverTest_CzarnyGeometry, DirectSolverAcrossOrigin_CzarnyGeometry) double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = false; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; - auto grid = std::make_unique(radii, angles); auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -421,6 +429,8 @@ TEST(DirectSolverTest_CulhamGeometry, DirectSolverDirBC_Interior_CulhamGeometry) std::vector angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; + auto grid = std::make_unique(radii, angles); + double Rmax = radii.back(); using DomainGeometryType = CulhamGeometry; @@ -428,15 +438,14 @@ TEST(DirectSolverTest_CulhamGeometry, DirectSolverDirBC_Interior_CulhamGeometry) double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedGyroCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = true; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; - auto grid = std::make_unique(radii, angles); auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -462,6 +471,8 @@ TEST(DirectSolverTest_CulhamGeometry, DirectSolverAcrossOrigin_CulhamGeometry) std::vector angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; + auto grid = std::make_unique(radii, angles); + double Rmax = radii.back(); using DomainGeometryType = CulhamGeometry; @@ -469,15 +480,14 @@ TEST(DirectSolverTest_CulhamGeometry, DirectSolverAcrossOrigin_CulhamGeometry) double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedGyroCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = false; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; - auto grid = std::make_unique(radii, angles); auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -515,6 +525,8 @@ TEST(DirectSolverTest_CircularGeometry, DirectSolverAcrossOriginHigherPrecision_ std::vector angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; + auto grid = std::make_unique(radii, angles); + double Rmax = radii.back(); using DomainGeometryType = CircularGeometry; @@ -522,15 +534,14 @@ TEST(DirectSolverTest_CircularGeometry, DirectSolverAcrossOriginHigherPrecision_ double alpha_jump = 0.66 * Rmax; using DensityProfileCoefficientsType = SonnendruckerGyroCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = false; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; - auto grid = std::make_unique(radii, angles); auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -556,6 +567,8 @@ TEST(DirectSolverTest_CircularGeometry, DirectSolverAcrossOriginHigherPrecision2 std::vector angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; + auto grid = std::make_unique(radii, angles); + double Rmax = radii.back(); using DomainGeometryType = CircularGeometry; @@ -563,15 +576,14 @@ TEST(DirectSolverTest_CircularGeometry, DirectSolverAcrossOriginHigherPrecision2 double alpha_jump = 0.66 * Rmax; using DensityProfileCoefficientsType = SonnendruckerGyroCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = false; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; - auto grid = std::make_unique(radii, angles); auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -600,20 +612,21 @@ TEST(DirectSolverTakeTest_CircularGeometry, DirectSolverDirBC_Interior_CircularG 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; double Rmax = radii.back(); + auto grid = std::make_unique(radii, angles); + using DomainGeometryType = CircularGeometry; DomainGeometryType domain_geometry(Rmax); double alpha_jump = 0.66 * Rmax; using DensityProfileCoefficientsType = SonnendruckerGyroCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = true; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -639,6 +652,8 @@ TEST(DirectSolverTakeTest_CircularGeometry, DirectSolverAcrossOrigin_CircularGeo std::vector angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; + auto grid = std::make_unique(radii, angles); + double Rmax = radii.back(); using DomainGeometryType = CircularGeometry; @@ -646,15 +661,14 @@ TEST(DirectSolverTakeTest_CircularGeometry, DirectSolverAcrossOrigin_CircularGeo double alpha_jump = 0.66 * Rmax; using DensityProfileCoefficientsType = SonnendruckerGyroCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = false; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -684,6 +698,8 @@ TEST(DirectSolverTakeTest_ShafranovGeometry, DirectSolverDirBC_Interior_Shafrano std::vector angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; + auto grid = std::make_unique(radii, angles); + double Rmax = radii.back(); double kappa_eps = 0.3; double delta_e = 0.2; @@ -693,15 +709,14 @@ TEST(DirectSolverTakeTest_ShafranovGeometry, DirectSolverDirBC_Interior_Shafrano double alpha_jump = 0.4837 * Rmax; using DensityProfileCoefficientsType = ZoniGyroCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = true; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -727,6 +742,8 @@ TEST(DirectSolverTakeTest_ShafranovGeometry, DirectSolverAcrossOrigin_ShafranovG std::vector angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; + auto grid = std::make_unique(radii, angles); + double Rmax = radii.back(); double kappa_eps = 0.3; double delta_e = 0.2; @@ -736,15 +753,14 @@ TEST(DirectSolverTakeTest_ShafranovGeometry, DirectSolverAcrossOrigin_ShafranovG double alpha_jump = 0.4837 * Rmax; using DensityProfileCoefficientsType = ZoniGyroCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = false; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -774,6 +790,8 @@ TEST(DirectSolverTakeTest_CzarnyGeometry, DirectSolverDirBC_Interior_CzarnyGeome std::vector angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; + auto grid = std::make_unique(radii, angles); + double Rmax = radii.back(); double kappa_eps = 0.3; double delta_e = 1.4; @@ -783,15 +801,14 @@ TEST(DirectSolverTakeTest_CzarnyGeometry, DirectSolverDirBC_Interior_CzarnyGeome double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = true; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -817,6 +834,8 @@ TEST(DirectSolverTakeTest_CzarnyGeometry, DirectSolverAcrossOrigin_CzarnyGeometr std::vector angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; + auto grid = std::make_unique(radii, angles); + double Rmax = radii.back(); double kappa_eps = 0.3; double delta_e = 1.4; @@ -826,15 +845,14 @@ TEST(DirectSolverTakeTest_CzarnyGeometry, DirectSolverAcrossOrigin_CzarnyGeometr double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = false; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -864,6 +882,8 @@ TEST(DirectSolverTakeTest_CulhamGeometry, DirectSolverDirBC_Interior_CulhamGeome std::vector angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; + auto grid = std::make_unique(radii, angles); + double Rmax = radii.back(); using DomainGeometryType = CulhamGeometry; @@ -871,15 +891,14 @@ TEST(DirectSolverTakeTest_CulhamGeometry, DirectSolverDirBC_Interior_CulhamGeome double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedGyroCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = true; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -905,6 +924,8 @@ TEST(DirectSolverTakeTest_CulhamGeometry, DirectSolverAcrossOrigin_CulhamGeometr std::vector angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; + auto grid = std::make_unique(radii, angles); + double Rmax = radii.back(); using DomainGeometryType = CulhamGeometry; @@ -912,15 +933,14 @@ TEST(DirectSolverTakeTest_CulhamGeometry, DirectSolverAcrossOrigin_CulhamGeometr double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedGyroCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = false; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -956,6 +976,8 @@ TEST(DirectSolverTakeTest_CircularGeometry, DirectSolverAcrossOriginHigherPrecis std::vector angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; + auto grid = std::make_unique(radii, angles); + double Rmax = radii.back(); using DomainGeometryType = CircularGeometry; @@ -963,15 +985,14 @@ TEST(DirectSolverTakeTest_CircularGeometry, DirectSolverAcrossOriginHigherPrecis double alpha_jump = 0.66 * Rmax; using DensityProfileCoefficientsType = SonnendruckerGyroCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = false; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -997,6 +1018,8 @@ TEST(DirectSolverTakeTest_CircularGeometry, DirectSolverAcrossOriginHigherPrecis std::vector angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; + auto grid = std::make_unique(radii, angles); + double Rmax = radii.back(); using DomainGeometryType = CircularGeometry; @@ -1004,15 +1027,14 @@ TEST(DirectSolverTakeTest_CircularGeometry, DirectSolverAcrossOriginHigherPrecis double alpha_jump = 0.66 * Rmax; using DensityProfileCoefficientsType = SonnendruckerGyroCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = false; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); diff --git a/tests/ExtrapolatedSmoother/extrapolated_smoother.cpp b/tests/ExtrapolatedSmoother/extrapolated_smoother.cpp index abaea91f..3b57cef3 100644 --- a/tests/ExtrapolatedSmoother/extrapolated_smoother.cpp +++ b/tests/ExtrapolatedSmoother/extrapolated_smoother.cpp @@ -45,7 +45,7 @@ TEST(ExtrapolatedSmootherTest, extrapolatedSmoother_DirBC_Interior) double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*tmp_grid, Rmax, alpha_jump); bool DirBC_Interior = true; @@ -54,7 +54,7 @@ TEST(ExtrapolatedSmootherTest, extrapolatedSmoother_DirBC_Interior) bool cache_domain_geometry = true; auto levelCache = std::make_unique>( - *tmp_grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *tmp_grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(tmp_grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -106,7 +106,7 @@ TEST(ExtrapolatedSmootherTest, extrapolatedSmoother_AcossOrigin) double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*tmp_grid, Rmax, alpha_jump); bool DirBC_Interior = false; @@ -115,7 +115,7 @@ TEST(ExtrapolatedSmootherTest, extrapolatedSmoother_AcossOrigin) bool cache_domain_geometry = true; auto levelCache = std::make_unique>( - *tmp_grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *tmp_grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(tmp_grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -168,7 +168,7 @@ void ExtrapolatedSmootherTest_ExtrapolatedSmootherDirBC_Interior() double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*tmp_grid, Rmax, alpha_jump); bool DirBC_Interior = true; @@ -176,7 +176,7 @@ void ExtrapolatedSmootherTest_ExtrapolatedSmootherDirBC_Interior() bool cache_domain_geometry = false; auto levelCache = std::make_unique>( - *tmp_grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *tmp_grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(tmp_grid), std::move(levelCache), ExtrapolationType::IMPLICIT_EXTRAPOLATION, 0); @@ -259,7 +259,7 @@ void ExtrapolatedSmootherTest_ExtrapolatedSmootherAcrossOrigin() double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*tmp_grid, Rmax, alpha_jump); bool DirBC_Interior = false; @@ -267,7 +267,7 @@ void ExtrapolatedSmootherTest_ExtrapolatedSmootherAcrossOrigin() bool cache_domain_geometry = false; auto levelCache = std::make_unique>( - *tmp_grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *tmp_grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(tmp_grid), std::move(levelCache), ExtrapolationType::IMPLICIT_EXTRAPOLATION, 0); @@ -351,7 +351,7 @@ void ExtrapolatedSmootherTest_ExtrapolatedSmootherDirBC_Interior_SmallestGrid() double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*tmp_grid, Rmax, alpha_jump); bool DirBC_Interior = true; @@ -359,7 +359,7 @@ void ExtrapolatedSmootherTest_ExtrapolatedSmootherDirBC_Interior_SmallestGrid() bool cache_domain_geometry = false; auto levelCache = std::make_unique>( - *tmp_grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *tmp_grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(tmp_grid), std::move(levelCache), ExtrapolationType::IMPLICIT_EXTRAPOLATION, 0); @@ -443,7 +443,7 @@ void ExtrapolatedSmootherTest_ExtrapolatedSmootherAcrossOrigin_SmallestGrid() double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*tmp_grid, Rmax, alpha_jump); bool DirBC_Interior = false; @@ -451,7 +451,7 @@ void ExtrapolatedSmootherTest_ExtrapolatedSmootherAcrossOrigin_SmallestGrid() bool cache_domain_geometry = false; auto levelCache = std::make_unique>( - *tmp_grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *tmp_grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(tmp_grid), std::move(levelCache), ExtrapolationType::IMPLICIT_EXTRAPOLATION, 0); @@ -536,7 +536,7 @@ void ExtrapolatedSmootherTest_ExtrapolatedSmootherTakeDirBC_Interior() double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*tmp_grid, Rmax, alpha_jump); bool DirBC_Interior = true; @@ -544,7 +544,7 @@ void ExtrapolatedSmootherTest_ExtrapolatedSmootherTakeDirBC_Interior() bool cache_domain_geometry = true; auto levelCache = std::make_unique>( - *tmp_grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *tmp_grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(tmp_grid), std::move(levelCache), ExtrapolationType::IMPLICIT_EXTRAPOLATION, 0); @@ -627,7 +627,7 @@ void ExtrapolatedSmootherTest_ExtrapolatedSmootherTakeAcrossOrigin() double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*tmp_grid, Rmax, alpha_jump); bool DirBC_Interior = false; @@ -635,7 +635,7 @@ void ExtrapolatedSmootherTest_ExtrapolatedSmootherTakeAcrossOrigin() bool cache_domain_geometry = true; auto levelCache = std::make_unique>( - *tmp_grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *tmp_grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(tmp_grid), std::move(levelCache), ExtrapolationType::IMPLICIT_EXTRAPOLATION, 0); @@ -717,7 +717,7 @@ void ExtrapolatedSmootherTest_ExtrapolatedSmootherTakeDirBC_Interior_SmallestGri double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*tmp_grid, Rmax, alpha_jump); bool DirBC_Interior = true; @@ -725,7 +725,7 @@ void ExtrapolatedSmootherTest_ExtrapolatedSmootherTakeDirBC_Interior_SmallestGri bool cache_domain_geometry = true; auto levelCache = std::make_unique>( - *tmp_grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *tmp_grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(tmp_grid), std::move(levelCache), ExtrapolationType::IMPLICIT_EXTRAPOLATION, 0); @@ -807,7 +807,7 @@ void ExtrapolatedSmootherTest_ExtrapolatedSmootherTakeAcrossOrigin_SmallestGrid( double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*tmp_grid, Rmax, alpha_jump); bool DirBC_Interior = false; @@ -815,7 +815,7 @@ void ExtrapolatedSmootherTest_ExtrapolatedSmootherTakeAcrossOrigin_SmallestGrid( bool cache_domain_geometry = true; auto levelCache = std::make_unique>( - *tmp_grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *tmp_grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(tmp_grid), std::move(levelCache), ExtrapolationType::IMPLICIT_EXTRAPOLATION, 0); diff --git a/tests/GMGPolar/convergence_order.cpp b/tests/GMGPolar/convergence_order.cpp index c2c6a77f..1e83f56d 100644 --- a/tests/GMGPolar/convergence_order.cpp +++ b/tests/GMGPolar/convergence_order.cpp @@ -228,7 +228,8 @@ void test_convergence(double non_uniformity) PolarGrid grid_refined(radii_refined, angles_refined); const double alpha_jump = 0.0; // Unused value - typename TestFixture::DensityProfileCoefficients coefficients(Rmax, alpha_jump); + typename TestFixture::DensityProfileCoefficients coefficients(grid, Rmax, alpha_jump); + typename TestFixture::DensityProfileCoefficients coefficients_refined(grid_refined, Rmax, alpha_jump); typename TestFixture::BoundaryConditions boundary_conditions(Rmax, kappa_eps, delta_e); typename TestFixture::SourceTerm source_term(grid, Rmax, kappa_eps, delta_e); typename TestFixture::SourceTerm source_term_refined(grid_refined, Rmax, kappa_eps, delta_e); @@ -237,8 +238,8 @@ void test_convergence(double non_uniformity) auto [euclid_error, inf_error] = get_gmgpolar_error(grid, domain_geometry, coefficients, boundary_conditions, source_term, solution, TestFixture::extrapolation); auto [euclid_error_refined, inf_error_refined] = - get_gmgpolar_error(grid_refined, domain_geometry, coefficients, boundary_conditions, source_term_refined, - solution, TestFixture::extrapolation); + get_gmgpolar_error(grid_refined, domain_geometry, coefficients_refined, boundary_conditions, + source_term_refined, solution, TestFixture::extrapolation); double euclid_order = log(euclid_error / euclid_error_refined) / log(2); double inf_order = log(inf_error / inf_error_refined) / log(2); diff --git a/tests/GMGPolar/pcg_tests.cpp b/tests/GMGPolar/pcg_tests.cpp index c89a1eed..f6f4e8e8 100644 --- a/tests/GMGPolar/pcg_tests.cpp +++ b/tests/GMGPolar/pcg_tests.cpp @@ -637,7 +637,7 @@ void run_gmgpolar() const double ellipticity_e = 1.4; typename TestFixture::DomainGeometry domain(TestFixture::Rmax, inverse_aspect_ratio_epsilon, ellipticity_e); - typename TestFixture::DensityProfileCoefficients profile_coefficients(TestFixture::Rmax, 0.0); + typename TestFixture::DensityProfileCoefficients profile_coefficients(grid, TestFixture::Rmax, 0.0); typename TestFixture::BoundaryConditions boundary_conditions(TestFixture::Rmax, inverse_aspect_ratio_epsilon, ellipticity_e); typename TestFixture::SourceTerm source_term(grid, TestFixture::Rmax, inverse_aspect_ratio_epsilon, ellipticity_e); diff --git a/tests/GMGPolar/solve_tests.cpp b/tests/GMGPolar/solve_tests.cpp index 3dd836d7..55bf49da 100644 --- a/tests/GMGPolar/solve_tests.cpp +++ b/tests/GMGPolar/solve_tests.cpp @@ -646,7 +646,7 @@ void run_gmgpolar() const double ellipticity_e = 1.4; typename TestFixture::DomainGeometry domain(TestFixture::Rmax, inverse_aspect_ratio_epsilon, ellipticity_e); - typename TestFixture::DensityProfileCoefficients profile_coefficients(TestFixture::Rmax, 0.0); + typename TestFixture::DensityProfileCoefficients profile_coefficients(grid, TestFixture::Rmax, 0.0); typename TestFixture::BoundaryConditions boundary_conditions(TestFixture::Rmax, inverse_aspect_ratio_epsilon, ellipticity_e); typename TestFixture::SourceTerm source_term(grid, TestFixture::Rmax, inverse_aspect_ratio_epsilon, ellipticity_e); diff --git a/tests/Residual/residual.cpp b/tests/Residual/residual.cpp index 926cf3a9..5ebdc7ff 100644 --- a/tests/Residual/residual.cpp +++ b/tests/Residual/residual.cpp @@ -38,7 +38,6 @@ TEST(OperatorATest, applyA_DirBC_Interior) double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - ZoniShiftedCoefficients coefficients(Rmax, alpha_jump); bool DirBC_Interior = true; @@ -46,9 +45,10 @@ TEST(OperatorATest, applyA_DirBC_Interior) bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique(radii, angles); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, false); @@ -93,7 +93,6 @@ TEST(OperatorATest, applyA_AcrossOrigin) double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); bool DirBC_Interior = false; @@ -101,9 +100,10 @@ TEST(OperatorATest, applyA_AcrossOrigin) bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique(radii, angles); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, false); diff --git a/tests/Smoother/smoother.cpp b/tests/Smoother/smoother.cpp index 726502ef..43425290 100644 --- a/tests/Smoother/smoother.cpp +++ b/tests/Smoother/smoother.cpp @@ -44,7 +44,7 @@ void SmootherTest_smoother_DirBC_Interior() double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = true; @@ -53,7 +53,7 @@ void SmootherTest_smoother_DirBC_Interior() bool cache_domain_geometry = true; auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -107,7 +107,7 @@ void SmootherTest_smoother_AcrossOrigin() double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = false; @@ -116,7 +116,7 @@ void SmootherTest_smoother_AcrossOrigin() bool cache_domain_geometry = true; auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -173,14 +173,14 @@ void SmootherTest_SmootherDirBC_Interior() double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = true; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -250,14 +250,14 @@ void SmootherTest_SmootherAcrossOrigin() double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = false; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -326,14 +326,14 @@ void SmootherTest_SmootherDirBC_Interior_SmallestGrid() double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = true; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -402,14 +402,14 @@ void SmootherTest_SmootherAcrossOrigin_SmallestGrid() double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = false; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -481,14 +481,14 @@ void SmootherTest_SmootherTakeDirBC_Interior() double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = true; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -558,14 +558,14 @@ void SmootherTest_SmootherTakeAcrossOrigin() double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = false; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -634,14 +634,14 @@ void SmootherTest_SmootherTakeDirBC_Interior_SmallestGrid() double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = true; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0); @@ -710,14 +710,14 @@ void SmootherTest_SmootherTakeAcrossOrigin_SmallestGrid() double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; - DensityProfileCoefficientsType coefficients(Rmax, alpha_jump); + DensityProfileCoefficientsType coefficients(*grid, Rmax, alpha_jump); bool DirBC_Interior = false; bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; auto levelCache = std::make_unique>( - *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); + *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry, 0); Level level(0, std::move(grid), std::move(levelCache), ExtrapolationType::NONE, 0);