Skip to content

Commit

Permalink
Characteristics advection non-periodic (#521)
Browse files Browse the repository at this point in the history
  • Loading branch information
blegouix authored Jul 8, 2024
1 parent 09e6d1e commit d024c1e
Showing 1 changed file with 31 additions and 19 deletions.
50 changes: 31 additions & 19 deletions examples/characteristics_advection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,41 @@
#include <ddc/kernels/splines.hpp>

#include <Kokkos_Core.hpp>

#define PERIODIC_DOMAIN // Comment this to run non-periodic simulation

//! [includes]
static constexpr std::size_t s_degree_x = 3;

//! [X-dimension]
/// Our first continuous dimension
struct X
{
#ifdef PERIODIC_DOMAIN
static constexpr bool PERIODIC = true;
#else
static constexpr bool PERIODIC = false;
#endif
};
//! [X-dimension]

//! [boundary-condition]
#ifdef PERIODIC_DOMAIN
static constexpr ddc::BoundCond BoundCond = ddc::BoundCond::PERIODIC;
using ExtrapolationRule = ddc::PeriodicExtrapolationRule<X>;
#else
static constexpr ddc::BoundCond BoundCond = ddc::BoundCond::GREVILLE;
using ExtrapolationRule = ddc::NullExtrapolationRule;
#endif
//! [boundary-condition]

//! [X-discretization]
/// A uniform discretization of X
struct BSplinesX : ddc::UniformBSplines<X, s_degree_x>
{
};
using GrevillePoints = ddc::GrevilleInterpolationPoints<
BSplinesX,
ddc::BoundCond::PERIODIC,
ddc::BoundCond::PERIODIC>;
using GrevillePoints = ddc::
GrevilleInterpolationPoints<BSplinesX, BoundCond, BoundCond>;
struct DDimX : GrevillePoints::interpolation_mesh_type
{
};
Expand Down Expand Up @@ -129,16 +144,15 @@ int main(int argc, char** argv)
ddc::Coordinate<X>(x_start),
ddc::Coordinate<X>(x_end),
nb_x_points);
ddc::init_discrete_space<DDimX>(
ddc::GrevilleInterpolationPoints<
BSplinesX,
ddc::BoundCond::PERIODIC,
ddc::BoundCond::PERIODIC>::get_sampling<DDimX>());
ddc::init_discrete_space<DDimX>(ddc::GrevilleInterpolationPoints<
BSplinesX,
BoundCond,
BoundCond>::get_sampling<DDimX>());

auto const x_domain = ddc::GrevilleInterpolationPoints<
BSplinesX,
ddc::BoundCond::PERIODIC,
ddc::BoundCond::PERIODIC>::get_domain<DDimX>();
BoundCond,
BoundCond>::get_domain<DDimX>();
//! [X-global-domain]
// Initialization of the global domain in Y
auto const y_domain
Expand Down Expand Up @@ -215,25 +229,23 @@ int main(int argc, char** argv)
Kokkos::DefaultExecutionSpace::memory_space,
BSplinesX,
DDimX,
ddc::BoundCond::PERIODIC,
ddc::BoundCond::PERIODIC,
BoundCond,
BoundCond,
ddc::SplineSolver::GINKGO,
DDimX,
DDimY>
spline_builder(x_mesh);
ddc::PeriodicExtrapolationRule<X> periodic_extrapolation;
ExtrapolationRule extrapolation_rule;
ddc::SplineEvaluator<
Kokkos::DefaultExecutionSpace,
Kokkos::DefaultExecutionSpace::memory_space,
BSplinesX,
DDimX,
ddc::PeriodicExtrapolationRule<X>,
ddc::PeriodicExtrapolationRule<X>,
ExtrapolationRule,
ExtrapolationRule,
DDimX,
DDimY>
spline_evaluator(
periodic_extrapolation,
periodic_extrapolation);
spline_evaluator(extrapolation_rule, extrapolation_rule);
//! [instantiate solver]

//! [instantiate intermediate chunks]
Expand Down

0 comments on commit d024c1e

Please sign in to comment.