4#include "ddc_alias_inline_functions.hpp"
5#include "ddc_aliases.hpp"
6#include "ddc_helper.hpp"
7#include "itimestepper.hpp"
8#include "vector_field_common.hpp"
35 class ExecSpace = Kokkos::DefaultExecutionSpace>
50 IdxRange
const m_idx_range;
60 explicit RK3(IdxRange idx_range) : m_idx_range(idx_range) {}
78 ExecSpace
const& exec_space,
85 Kokkos::SpaceAccessibility<ExecSpace, typename FieldMem::memory_space>::accessible,
86 "MemorySpace has to be accessible for ExecutionSpace.");
88 Kokkos::SpaceAccessibility<ExecSpace, typename DerivFieldMem::memory_space>::
90 "MemorySpace has to be accessible for ExecutionSpace.");
91 using element_type =
typename DerivField::element_type;
93 FieldMem y_prime_alloc(m_idx_range);
99 ValField y_prime = get_field(y_prime_alloc);
103 DerivField k_total = get_field(k_total_alloc);
110 dy_calculator(k1, get_const_field(y));
114 y_update(y_prime, get_const_field(k1), 0.5 * dt);
117 dy_calculator(k2, get_const_field(y_prime));
125 KOKKOS_LAMBDA(std::array<element_type, 2> k) {
return 2 * k[1] - k[0]; },
133 y_update(y_prime, get_const_field(k_total), dt);
136 dy_calculator(k3, get_const_field(y_prime));
144 KOKKOS_LAMBDA(std::array<element_type, 3> k) {
return k[0] + 4 * k[1] + k[2]; },
150 y_update(y, get_const_field(k_total), dt / 6.);
See DerivFieldMemImplementation.
Definition derivative_field.hpp:10
See DerivFieldImplementation.
Definition derivative_field.hpp:20
The superclass from which all timestepping methods inherit.
Definition itimestepper.hpp:23
typename FieldMem::discrete_domain_type IdxRange
The type of the index range on which the values of the function are defined.
Definition itimestepper.hpp:46
typename DerivFieldMem::span_type DerivField
The type of the derivatives of the function being evolved.
Definition itimestepper.hpp:56
void assemble_k_total(ExecSpace const &exec_space, DerivField k_total, FuncType func, T... k) const
A method to assemble multiple derivative fields into one.
Definition itimestepper.hpp:182
typename DerivFieldMem::view_type DerivConstField
The constant type of the derivatives values of the function being evolved.
Definition itimestepper.hpp:59
typename FieldMem::span_type ValField
The type of the values of the function being evolved.
Definition itimestepper.hpp:50
void update(ValField y, double dt, std::function< void(DerivField, ValConstField)> dy_calculator) const
Carry out one step of the timestepping scheme.
Definition itimestepper.hpp:78
void copy(ValField copy_to, ValConstField copy_from) const
Make a copy of the values of the function being evolved.
Definition itimestepper.hpp:147
typename FieldMem::view_type ValConstField
The constant type of the values of the function being evolved.
Definition itimestepper.hpp:53
A class which provides an implementation of a third-order Runge-Kutta method.
Definition rk3.hpp:37
void update(ExecSpace const &exec_space, ValField y, double dt, std::function< void(DerivField, ValConstField)> dy_calculator, std::function< void(ValField, DerivConstField, double)> y_update) const final
Carry out one step of the Runge-Kutta scheme.
Definition rk3.hpp:77
typename DerivFieldMem::view_type DerivConstField
The constant type of the derivatives values of the function being evolved.
Definition itimestepper.hpp:59
RK3(IdxRange idx_range)
Create a RK3 object.
Definition rk3.hpp:60
typename FieldMem::span_type ValField
The type of the values of the function being evolved.
Definition itimestepper.hpp:50
typename FieldMem::view_type ValConstField
The constant type of the values of the function being evolved.
Definition itimestepper.hpp:53