5 #include <sll/mapping/cartesian_to_pseudo_cartesian.hpp>
6 #include <sll/mapping/circular_to_cartesian.hpp>
8 #include "ddc_alias_inline_functions.hpp"
9 #include "ddc_aliases.hpp"
10 #include "geometry_pseudo_cartesian.hpp"
11 #include "ifoot_finder.hpp"
12 #include "vector_mapper.hpp"
24 template <
class TimeStepper,
class AdvectionDomain,
class Mapping>
31 using X_adv =
typename AdvectionDomain::X_adv;
35 using Y_adv =
typename AdvectionDomain::Y_adv;
40 TimeStepper
const& m_time_stepper;
45 SplineRThetaBuilder
const& m_builder_advection_field;
46 SplineRThetaEvaluatorConstBound
const& m_evaluator_advection_field;
79 TimeStepper
const& time_stepper,
82 SplineRThetaBuilder
const& builder_advection_field,
83 SplineRThetaEvaluatorConstBound
const& evaluator_advection_field,
84 double epsilon = 1e-12)
85 : m_time_stepper(time_stepper)
86 , m_advection_domain(advection_domain)
88 , m_builder_advection_field(builder_advection_field)
89 , m_evaluator_advection_field(evaluator_advection_field)
110 host_t<FieldRTheta<CoordRTheta>> feet,
112 double dt)
const final
114 host_t<VectorSplineCoeffsMem2D<X_adv, Y_adv>> advection_field_in_adv_domain_coefs(
115 get_spline_idx_range(m_builder_advection_field));
118 auto advection_field_in_adv_domain = create_geometry_mirror_view(
119 Kokkos::DefaultHostExecutionSpace(),
124 m_builder_advection_field(
125 ddcHelper::get<X_adv>(advection_field_in_adv_domain_coefs),
126 ddcHelper::get<X_adv>(get_const_field(advection_field_in_adv_domain)));
127 m_builder_advection_field(
128 ddcHelper::get<Y_adv>(advection_field_in_adv_domain_coefs),
129 ddcHelper::get<Y_adv>(get_const_field(advection_field_in_adv_domain)));
135 host_t<ConstFieldRTheta<CoordRTheta>>)>
136 dy = [&](host_t<DVectorFieldRTheta<X_adv, Y_adv>> updated_advection_field,
137 host_t<ConstFieldRTheta<CoordRTheta>> feet) {
138 m_evaluator_advection_field(
139 get_field(ddcHelper::get<X_adv>(updated_advection_field)),
140 get_const_field(feet),
142 ddcHelper::get<X_adv>(advection_field_in_adv_domain_coefs)));
143 m_evaluator_advection_field(
144 get_field(ddcHelper::get<Y_adv>(updated_advection_field)),
145 get_const_field(feet),
147 ddcHelper::get<Y_adv>(advection_field_in_adv_domain_coefs)));
152 void(host_t<FieldRTheta<CoordRTheta>>,
155 update_function = [&](host_t<FieldRTheta<CoordRTheta>> feet,
156 host_t<DConstVectorFieldRTheta<X_adv, Y_adv>> advection_field,
159 m_advection_domain.advect_feet(feet, advection_field, dt);
162 unify_value_at_center_pt(feet);
169 m_time_stepper.update(Kokkos::DefaultHostExecutionSpace(), feet, dt, dy, update_function);
190 void is_unified(Field<T, IdxRangeRTheta, Kokkos::HostSpace>
const& values)
const
192 IdxRangeR
const r_idx_range = get_idx_range<GridR>(values);
193 IdxRangeTheta
const theta_idx_range = get_idx_range<GridTheta>(values);
194 if (std::fabs(ddc::coordinate(r_idx_range.front())) < 1e-15) {
195 ddc::for_each(theta_idx_range, [&](
const IdxTheta ip) {
197 values(r_idx_range.front(), ip)
198 - values(r_idx_range.front(), theta_idx_range.front()))
200 std::cout <<
"WARNING ! -> Discontinous at the center point." << std::endl;
202 assert(values(r_idx_range.front(), ip)
203 == values(r_idx_range.front(), theta_idx_range.front()));
223 void unify_value_at_center_pt(FieldRTheta<T> values)
const
225 IdxRangeR
const r_idx_range = get_idx_range<GridR>(values);
226 IdxRangeTheta
const theta_idx_range = get_idx_range<GridTheta>(values);
227 if (std::fabs(ddc::coordinate(r_idx_range.front())) < 1e-15) {
228 ddc::for_each(theta_idx_range, [&](
const IdxTheta ip) {
229 values(r_idx_range.front(), ip)
230 = values(r_idx_range.front(), theta_idx_range.front());
Define a domain for the advection.
Definition: advection_domain.hpp:40
A class for describing the circular 2D mapping.
Definition: circular_to_cartesian.hpp:45
A class which holds multiple (scalar) fields in order to represent a vector field.
Definition: vector_field.hpp:64