112 host_t<DFieldRTheta> allfdistribu,
114 double dt)
const override
117 std::unique_ptr<IInterpolatorRTheta>
const interpolator_ptr = m_interpolator.
preallocate();
120 host_t<FieldMemRTheta<CoordRTheta>> feet_rp(get_idx_range(advection_field_xy));
121 ddc::for_each(get_idx_range(advection_field_xy), [&](IdxRTheta
const irp) {
122 feet_rp(irp) = ddc::coordinate(irp);
126 m_find_feet(get_field(feet_rp), advection_field_xy, dt);
129 (*interpolator_ptr)(allfdistribu, get_const_field(feet_rp));
152 host_t<DFieldRTheta> allfdistribu,
154 CoordXY
const& advection_field_xy_center,
155 double dt)
const override
157 Kokkos::Profiling::pushRegion(
"PolarAdvection");
158 IdxRangeRTheta grid(get_idx_range<GridR, GridTheta>(allfdistribu));
160 const int npoints_p = IdxRangeTheta(grid).size();
161 IdxRangeRTheta
const grid_without_Opoint(grid.remove_first(IdxStepRTheta(1, 0)));
162 IdxRangeRTheta
const Opoint_grid(grid.take_first(IdxStepRTheta(1, npoints_p)));
166 host_t<DVectorFieldMemRTheta<X, Y>> advection_field_xy(grid);
170 ddc::for_each(grid_without_Opoint, [&](IdxRTheta
const irp) {
171 CoordRTheta
const coord_rp(ddc::coordinate(irp));
173 std::array<std::array<double, 2>, 2> J;
174 m_mapping.jacobian_matrix(coord_rp, J);
175 std::array<std::array<double, 2>, 2> G;
176 metric_tensor(G, coord_rp);
178 ddcHelper::get<X>(advection_field_xy)(irp)
179 = ddcHelper::get<R>(advection_field_rp)(irp) * J[1][1] / std::sqrt(G[1][1])
180 + ddcHelper::get<Theta>(advection_field_rp)(irp) * -J[1][0]
181 / std::sqrt(G[0][0]);
182 ddcHelper::get<Y>(advection_field_xy)(irp)
183 = ddcHelper::get<R>(advection_field_rp)(irp) * -J[0][1] / std::sqrt(G[1][1])
184 + ddcHelper::get<Theta>(advection_field_rp)(irp) * J[0][0]
185 / std::sqrt(G[0][0]);
188 ddc::for_each(Opoint_grid, [&](IdxRTheta
const irp) {
189 ddcHelper::get<X>(advection_field_xy)(irp) = CoordX(advection_field_xy_center);
190 ddcHelper::get<Y>(advection_field_xy)(irp) = CoordY(advection_field_xy_center);
194 std::unique_ptr<IInterpolatorRTheta>
const interpolator_ptr = m_interpolator.
preallocate();
197 host_t<FieldMemRTheta<CoordRTheta>> feet_rp(grid);
198 ddc::for_each(grid, [&](IdxRTheta
const irp) { feet_rp(irp) = ddc::coordinate(irp); });
201 m_find_feet(get_field(feet_rp), get_const_field(advection_field_xy), dt);
204 (*interpolator_ptr)(allfdistribu, get_const_field(feet_rp));
205 Kokkos::Profiling::popRegion();