Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/ConfigParser/config_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ConfigParser
bool cacheDensityProfileCoefficients() const;
bool cacheDomainGeometry() const;

const PolarGrid<Kokkos::HostSpace>& grid() const;
const PolarGrid<DefaultMemorySpace>& grid() const;

// Full Multigrid Method
bool FMG() const;
Expand Down Expand Up @@ -96,7 +96,7 @@ class ConfigParser
bool cache_density_profile_coefficients_;
bool cache_domain_geometry_;
// Grid configuration
PolarGrid<Kokkos::HostSpace> grid_;
PolarGrid<DefaultMemorySpace> grid_;
// Multigrid settings
ExtrapolationType extrapolation_;
int max_levels_;
Expand Down
2 changes: 1 addition & 1 deletion include/GMGPolar/gmgpolar.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class GMGPolar : public IGMGPolar
// Public due to cuda restrictions
public:
template <concepts::BoundaryConditions BoundaryConditions, concepts::SourceTerm SourceTerm>
void build_rhs_f(const Level<DomainGeometry, DensityProfileCoefficients>& level, HostVector<double> rhs_f,
void build_rhs_f(const Level<DomainGeometry, DensityProfileCoefficients>& level, Vector<double> rhs_f,
const BoundaryConditions& boundary_conditions, const SourceTerm& source_term);
void discretize_rhs_f(const Level<DomainGeometry, DensityProfileCoefficients>& level, HostVector<double> rhs_f);

Expand Down
10 changes: 5 additions & 5 deletions include/GMGPolar/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,10 @@ void GMGPolar<DomainGeometry, DensityProfileCoefficients>::discretize_rhs_f(
template <concepts::DomainGeometry DomainGeometry, concepts::DensityProfileCoefficients DensityProfileCoefficients>
template <concepts::BoundaryConditions BoundaryConditions, concepts::SourceTerm SourceTerm>
void GMGPolar<DomainGeometry, DensityProfileCoefficients>::build_rhs_f(
const Level<DomainGeometry, DensityProfileCoefficients>& level, HostVector<double> rhs_f,
const Level<DomainGeometry, DensityProfileCoefficients>& level, Vector<double> rhs_f,
const BoundaryConditions& boundary_conditions, const SourceTerm& source_term)
{
const PolarGrid<Kokkos::HostSpace> grid(level.grid());
const PolarGrid<DefaultMemorySpace>& grid(level.grid());
assert(std::ssize(rhs_f) == grid.numberOfNodes());

const bool DirBC_Interior = DirBC_Interior_;
Expand All @@ -352,7 +352,7 @@ void GMGPolar<DomainGeometry, DensityProfileCoefficients>::build_rhs_f(
// ----------------------------------------- //
Kokkos::parallel_for(
"build_rhs_f: Circular",
Kokkos::MDRangePolicy<Kokkos::DefaultHostExecutionSpace, Kokkos::Rank<2>>(
Kokkos::MDRangePolicy<Kokkos::DefaultExecutionSpace, Kokkos::Rank<2>>(
{0, 0}, {grid.numberSmootherCircles(), grid.ntheta()}),
KOKKOS_LAMBDA(const int i_r, const int i_theta) {
const double radius = grid.radius(i_r);
Expand All @@ -373,8 +373,8 @@ void GMGPolar<DomainGeometry, DensityProfileCoefficients>::build_rhs_f(
// --------------------------------------- //
Kokkos::parallel_for(
"build_rhs_f: Radial",
Kokkos::MDRangePolicy<Kokkos::DefaultHostExecutionSpace, Kokkos::Rank<2>>({0, grid.numberSmootherCircles()},
{grid.ntheta(), grid.nr()}),
Kokkos::MDRangePolicy<Kokkos::DefaultExecutionSpace, Kokkos::Rank<2>>({0, grid.numberSmootherCircles()},
{grid.ntheta(), grid.nr()}),
KOKKOS_LAMBDA(const int i_theta, const int i_r) {
const double radius = grid.radius(i_r);
const double theta = grid.theta(i_theta);
Expand Down
5 changes: 4 additions & 1 deletion include/GMGPolar/solver.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ void GMGPolar<DomainGeometry, DensityProfileCoefficients>::solve(const BoundaryC
/* ------------------------------------- */
/* Build rhs_f on Level 0 (finest Level) */
/* ------------------------------------- */
build_rhs_f(levels_[0], levels_[0].rhs(), boundary_conditions, source_term);
HostVector<double> rhs_f_host = levels_[0].rhs();
auto rhs_f = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), rhs_f_host);
build_rhs_f(levels_[0], rhs_f, boundary_conditions, source_term);
Kokkos::deep_copy(rhs_f_host, rhs_f);

/* ---------------- */
/* Discretize rhs_f */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ namespace gmgpolar
class CartesianR2_Poisson_CircularGeometry
{
public:
explicit CartesianR2_Poisson_CircularGeometry(PolarGrid<Kokkos::HostSpace> const& grid, double Rmax);
explicit CartesianR2_Poisson_CircularGeometry(PolarGrid<DefaultMemorySpace> const& grid, double Rmax);
KOKKOS_DEFAULTED_FUNCTION
CartesianR2_Poisson_CircularGeometry(const CartesianR2_Poisson_CircularGeometry&) = default;

KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const;

private:
PolarGrid<Kokkos::HostSpace> grid_;
PolarGrid<DefaultMemorySpace> grid_;
const double Rmax = 1.3;
};
} // namespace gmgpolar
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ namespace gmgpolar
class CartesianR2_Poisson_CzarnyGeometry
{
public:
explicit CartesianR2_Poisson_CzarnyGeometry(PolarGrid<Kokkos::HostSpace> const& grid, double Rmax,
explicit CartesianR2_Poisson_CzarnyGeometry(PolarGrid<DefaultMemorySpace> const& grid, double Rmax,
double inverse_aspect_ratio_epsilon, double ellipticity_e);
KOKKOS_DEFAULTED_FUNCTION CartesianR2_Poisson_CzarnyGeometry(const CartesianR2_Poisson_CzarnyGeometry&) = default;

KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const;

private:
PolarGrid<Kokkos::HostSpace> grid_;
PolarGrid<DefaultMemorySpace> grid_;
const double Rmax = 1.3;
const double inverse_aspect_ratio_epsilon = 0.3;
const double ellipticity_e = 1.4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ namespace gmgpolar
class CartesianR2_Poisson_ShafranovGeometry
{
public:
explicit CartesianR2_Poisson_ShafranovGeometry(PolarGrid<Kokkos::HostSpace> const& grid, double Rmax,
explicit CartesianR2_Poisson_ShafranovGeometry(PolarGrid<DefaultMemorySpace> const& grid, double Rmax,
double elongation_kappa, double shift_delta);
KOKKOS_DEFAULTED_FUNCTION
CartesianR2_Poisson_ShafranovGeometry(const CartesianR2_Poisson_ShafranovGeometry&) = default;

KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const;

private:
PolarGrid<Kokkos::HostSpace> grid_;
PolarGrid<DefaultMemorySpace> grid_;
const double Rmax = 1.3;
const double elongation_kappa = 0.3;
const double shift_delta = 0.2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ namespace gmgpolar
class CartesianR2_SonnendruckerGyro_CircularGeometry
{
public:
explicit CartesianR2_SonnendruckerGyro_CircularGeometry(PolarGrid<Kokkos::HostSpace> const& grid, double Rmax);
explicit CartesianR2_SonnendruckerGyro_CircularGeometry(PolarGrid<DefaultMemorySpace> const& grid, double Rmax);
KOKKOS_DEFAULTED_FUNCTION
CartesianR2_SonnendruckerGyro_CircularGeometry(const CartesianR2_SonnendruckerGyro_CircularGeometry&) = default;

KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const;

private:
PolarGrid<Kokkos::HostSpace> grid_;
PolarGrid<DefaultMemorySpace> grid_;
const double Rmax = 1.3;
};
} // namespace gmgpolar
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ namespace gmgpolar
class CartesianR2_SonnendruckerGyro_CzarnyGeometry
{
public:
explicit CartesianR2_SonnendruckerGyro_CzarnyGeometry(PolarGrid<Kokkos::HostSpace> const& grid, double Rmax,
explicit CartesianR2_SonnendruckerGyro_CzarnyGeometry(PolarGrid<DefaultMemorySpace> const& grid, double Rmax,
double inverse_aspect_ratio_epsilon, double ellipticity_e);
KOKKOS_DEFAULTED_FUNCTION
CartesianR2_SonnendruckerGyro_CzarnyGeometry(const CartesianR2_SonnendruckerGyro_CzarnyGeometry&) = default;

KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const;

private:
PolarGrid<Kokkos::HostSpace> grid_;
PolarGrid<DefaultMemorySpace> grid_;
const double Rmax = 1.3;
const double inverse_aspect_ratio_epsilon = 0.3;
const double ellipticity_e = 1.4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ namespace gmgpolar
class CartesianR2_SonnendruckerGyro_ShafranovGeometry
{
public:
explicit CartesianR2_SonnendruckerGyro_ShafranovGeometry(PolarGrid<Kokkos::HostSpace> const& grid, double Rmax,
explicit CartesianR2_SonnendruckerGyro_ShafranovGeometry(PolarGrid<DefaultMemorySpace> const& grid, double Rmax,
double elongation_kappa, double shift_delta);
KOKKOS_DEFAULTED_FUNCTION
CartesianR2_SonnendruckerGyro_ShafranovGeometry(const CartesianR2_SonnendruckerGyro_ShafranovGeometry&) = default;

KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const;

private:
PolarGrid<Kokkos::HostSpace> grid_;
PolarGrid<DefaultMemorySpace> grid_;
const double Rmax = 1.3;
const double elongation_kappa = 0.3;
const double shift_delta = 0.2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ namespace gmgpolar
class CartesianR2_Sonnendrucker_CircularGeometry
{
public:
explicit CartesianR2_Sonnendrucker_CircularGeometry(PolarGrid<Kokkos::HostSpace> const& grid, double Rmax);
explicit CartesianR2_Sonnendrucker_CircularGeometry(PolarGrid<DefaultMemorySpace> const& grid, double Rmax);
KOKKOS_DEFAULTED_FUNCTION
CartesianR2_Sonnendrucker_CircularGeometry(const CartesianR2_Sonnendrucker_CircularGeometry&) = default;

KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const;

private:
PolarGrid<Kokkos::HostSpace> grid_;
PolarGrid<DefaultMemorySpace> grid_;
const double Rmax = 1.3;
};
} // namespace gmgpolar
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ namespace gmgpolar
class CartesianR2_Sonnendrucker_CzarnyGeometry
{
public:
explicit CartesianR2_Sonnendrucker_CzarnyGeometry(PolarGrid<Kokkos::HostSpace> const& grid, double Rmax,
explicit CartesianR2_Sonnendrucker_CzarnyGeometry(PolarGrid<DefaultMemorySpace> const& grid, double Rmax,
double inverse_aspect_ratio_epsilon, double ellipticity_e);
KOKKOS_DEFAULTED_FUNCTION
CartesianR2_Sonnendrucker_CzarnyGeometry(const CartesianR2_Sonnendrucker_CzarnyGeometry&) = default;

KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const;

private:
PolarGrid<Kokkos::HostSpace> grid_;
PolarGrid<DefaultMemorySpace> grid_;
const double Rmax = 1.3;
const double inverse_aspect_ratio_epsilon = 0.3;
const double ellipticity_e = 1.4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ namespace gmgpolar
class CartesianR2_Sonnendrucker_ShafranovGeometry
{
public:
explicit CartesianR2_Sonnendrucker_ShafranovGeometry(PolarGrid<Kokkos::HostSpace> const& grid, double Rmax,
explicit CartesianR2_Sonnendrucker_ShafranovGeometry(PolarGrid<DefaultMemorySpace> const& grid, double Rmax,
double elongation_kappa, double shift_delta);
KOKKOS_DEFAULTED_FUNCTION
CartesianR2_Sonnendrucker_ShafranovGeometry(const CartesianR2_Sonnendrucker_ShafranovGeometry&) = default;

KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const;

private:
PolarGrid<Kokkos::HostSpace> grid_;
PolarGrid<DefaultMemorySpace> grid_;
const double Rmax = 1.3;
const double elongation_kappa = 0.3;
const double shift_delta = 0.2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ namespace gmgpolar
class CartesianR2_ZoniGyro_CircularGeometry
{
public:
explicit CartesianR2_ZoniGyro_CircularGeometry(PolarGrid<Kokkos::HostSpace> const& grid, double Rmax);
explicit CartesianR2_ZoniGyro_CircularGeometry(PolarGrid<DefaultMemorySpace> const& grid, double Rmax);
KOKKOS_DEFAULTED_FUNCTION
CartesianR2_ZoniGyro_CircularGeometry(const CartesianR2_ZoniGyro_CircularGeometry&) = default;

KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const;

private:
PolarGrid<Kokkos::HostSpace> grid_;
PolarGrid<DefaultMemorySpace> grid_;
const double Rmax = 1.3;
};
} // namespace gmgpolar
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ namespace gmgpolar
class CartesianR2_ZoniGyro_CzarnyGeometry
{
public:
explicit CartesianR2_ZoniGyro_CzarnyGeometry(PolarGrid<Kokkos::HostSpace> const& grid, double Rmax,
explicit CartesianR2_ZoniGyro_CzarnyGeometry(PolarGrid<DefaultMemorySpace> const& grid, double Rmax,
double inverse_aspect_ratio_epsilon, double ellipticity_e);
KOKKOS_DEFAULTED_FUNCTION CartesianR2_ZoniGyro_CzarnyGeometry(const CartesianR2_ZoniGyro_CzarnyGeometry&) = default;

KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const;

private:
PolarGrid<Kokkos::HostSpace> grid_;
PolarGrid<DefaultMemorySpace> grid_;
const double Rmax = 1.3;
const double inverse_aspect_ratio_epsilon = 0.3;
const double ellipticity_e = 1.4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ namespace gmgpolar
class CartesianR2_ZoniGyro_ShafranovGeometry
{
public:
explicit CartesianR2_ZoniGyro_ShafranovGeometry(PolarGrid<Kokkos::HostSpace> const& grid, double Rmax,
explicit CartesianR2_ZoniGyro_ShafranovGeometry(PolarGrid<DefaultMemorySpace> const& grid, double Rmax,
double elongation_kappa, double shift_delta);
KOKKOS_DEFAULTED_FUNCTION
CartesianR2_ZoniGyro_ShafranovGeometry(const CartesianR2_ZoniGyro_ShafranovGeometry&) = default;

KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const;

private:
PolarGrid<Kokkos::HostSpace> grid_;
PolarGrid<DefaultMemorySpace> grid_;
const double Rmax = 1.3;
const double elongation_kappa = 0.3;
const double shift_delta = 0.2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ namespace gmgpolar
class CartesianR2_ZoniShiftedGyro_CircularGeometry
{
public:
explicit CartesianR2_ZoniShiftedGyro_CircularGeometry(PolarGrid<Kokkos::HostSpace> const& grid, double Rmax);
explicit CartesianR2_ZoniShiftedGyro_CircularGeometry(PolarGrid<DefaultMemorySpace> const& grid, double Rmax);
KOKKOS_DEFAULTED_FUNCTION
CartesianR2_ZoniShiftedGyro_CircularGeometry(const CartesianR2_ZoniShiftedGyro_CircularGeometry&) = default;

KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const;

private:
PolarGrid<Kokkos::HostSpace> grid_;
PolarGrid<DefaultMemorySpace> grid_;
const double Rmax = 1.3;
};
} // namespace gmgpolar
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ namespace gmgpolar
class CartesianR2_ZoniShiftedGyro_CzarnyGeometry
{
public:
explicit CartesianR2_ZoniShiftedGyro_CzarnyGeometry(PolarGrid<Kokkos::HostSpace> const& grid, double Rmax,
explicit CartesianR2_ZoniShiftedGyro_CzarnyGeometry(PolarGrid<DefaultMemorySpace> const& grid, double Rmax,
double inverse_aspect_ratio_epsilon, double ellipticity_e);
KOKKOS_DEFAULTED_FUNCTION
CartesianR2_ZoniShiftedGyro_CzarnyGeometry(const CartesianR2_ZoniShiftedGyro_CzarnyGeometry&) = default;

KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const;

private:
PolarGrid<Kokkos::HostSpace> grid_;
PolarGrid<DefaultMemorySpace> grid_;
const double Rmax = 1.3;
const double inverse_aspect_ratio_epsilon = 0.3;
const double ellipticity_e = 1.4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ namespace gmgpolar
class CartesianR2_ZoniShiftedGyro_ShafranovGeometry
{
public:
explicit CartesianR2_ZoniShiftedGyro_ShafranovGeometry(PolarGrid<Kokkos::HostSpace> const& grid, double Rmax,
explicit CartesianR2_ZoniShiftedGyro_ShafranovGeometry(PolarGrid<DefaultMemorySpace> const& grid, double Rmax,
double elongation_kappa, double shift_delta);
KOKKOS_DEFAULTED_FUNCTION
CartesianR2_ZoniShiftedGyro_ShafranovGeometry(const CartesianR2_ZoniShiftedGyro_ShafranovGeometry&) = default;

KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const;

private:
PolarGrid<Kokkos::HostSpace> grid_;
PolarGrid<DefaultMemorySpace> grid_;
const double Rmax = 1.3;
const double elongation_kappa = 0.3;
const double shift_delta = 0.2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ namespace gmgpolar
class CartesianR2_ZoniShifted_CircularGeometry
{
public:
explicit CartesianR2_ZoniShifted_CircularGeometry(PolarGrid<Kokkos::HostSpace> const& grid, double Rmax);
explicit CartesianR2_ZoniShifted_CircularGeometry(PolarGrid<DefaultMemorySpace> const& grid, double Rmax);
KOKKOS_DEFAULTED_FUNCTION
CartesianR2_ZoniShifted_CircularGeometry(const CartesianR2_ZoniShifted_CircularGeometry&) = default;

KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const;

private:
PolarGrid<Kokkos::HostSpace> grid_;
PolarGrid<DefaultMemorySpace> grid_;
const double Rmax = 1.3;
};
} // namespace gmgpolar
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ namespace gmgpolar
class CartesianR2_ZoniShifted_CzarnyGeometry
{
public:
explicit CartesianR2_ZoniShifted_CzarnyGeometry(PolarGrid<Kokkos::HostSpace> const& grid, double Rmax,
explicit CartesianR2_ZoniShifted_CzarnyGeometry(PolarGrid<DefaultMemorySpace> const& grid, double Rmax,
double inverse_aspect_ratio_epsilon, double ellipticity_e);
KOKKOS_DEFAULTED_FUNCTION
CartesianR2_ZoniShifted_CzarnyGeometry(const CartesianR2_ZoniShifted_CzarnyGeometry&) = default;

KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const;

private:
PolarGrid<Kokkos::HostSpace> grid_;
PolarGrid<DefaultMemorySpace> grid_;
const double Rmax = 1.3;
const double inverse_aspect_ratio_epsilon = 0.3;
const double ellipticity_e = 1.4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ namespace gmgpolar
class CartesianR2_ZoniShifted_ShafranovGeometry
{
public:
explicit CartesianR2_ZoniShifted_ShafranovGeometry(PolarGrid<Kokkos::HostSpace> const& grid, double Rmax,
explicit CartesianR2_ZoniShifted_ShafranovGeometry(PolarGrid<DefaultMemorySpace> const& grid, double Rmax,
double elongation_kappa, double shift_delta);
KOKKOS_DEFAULTED_FUNCTION
CartesianR2_ZoniShifted_ShafranovGeometry(const CartesianR2_ZoniShifted_ShafranovGeometry&) = default;

KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const;

private:
PolarGrid<Kokkos::HostSpace> grid_;
PolarGrid<DefaultMemorySpace> grid_;
const double Rmax = 1.3;
const double elongation_kappa = 0.3;
const double shift_delta = 0.2;
Expand Down
Loading
Loading