24 const auto& ldom = this->layout_mp->getLocalNDIndex();
25 const int nghost = this->A_n.getNghost();
26 const auto aview = this->A_n.getView();
27 const auto anp1view = this->A_np1.getView();
28 const auto anm1view = this->A_nm1.getView();
32 const scalar a1 = scalar(2)
33 * (scalar(1) - Kokkos::pow(this->dt / this->hr_m[0], 2)
34 - Kokkos::pow(this->dt / this->hr_m[1], 2)
35 - Kokkos::pow(this->dt / this->hr_m[2], 2));
36 const scalar a2 = Kokkos::pow(this->dt / this->hr_m[0], 2);
37 const scalar a4 = Kokkos::pow(this->dt / this->hr_m[1], 2);
38 const scalar a6 = Kokkos::pow(this->dt / this->hr_m[2], 2);
39 const scalar a8 = Kokkos::pow(this->dt, 2);
41 true_nr += (nghost * 2);
42 constexpr uint32_t one_if_absorbing_otherwise_0 =
43 boundary_conditions == absorbing
50 KOKKOS_LAMBDA(
const size_t i,
const size_t j,
const size_t k) {
52 const uint32_t ig = i + ldom.first()[0];
53 const uint32_t jg = j + ldom.first()[1];
54 const uint32_t kg = k + ldom.first()[2];
57 uint32_t(ig == one_if_absorbing_otherwise_0)
58 + (uint32_t(jg == one_if_absorbing_otherwise_0) << 1)
59 + (uint32_t(kg == one_if_absorbing_otherwise_0) << 2)
60 + (uint32_t(ig == true_nr[0] - one_if_absorbing_otherwise_0 - 1) << 3)
61 + (uint32_t(jg == true_nr[1] - one_if_absorbing_otherwise_0 - 1) << 4)
62 + (uint32_t(kg == true_nr[2] - one_if_absorbing_otherwise_0 - 1) << 5);
65 SourceVector_t interior = -anm1view(i, j, k) + a1 * aview(i, j, k)
66 + a2 * (aview(i + 1, j, k) + aview(i - 1, j, k))
67 + a4 * (aview(i, j + 1, k) + aview(i, j - 1, k))
68 + a6 * (aview(i, j, k + 1) + aview(i, j, k - 1))
69 + a8 * source_view(i, j, k);
70 anp1view(i, j, k) = interior;
74 this->A_np1.fillHalo();
87 this->layout_mp = &(this->JN_mp->getLayout());
88 this->mesh_mp = &(this->JN_mp->get_mesh());
91 this->hr_m = this->mesh_mp->getMeshSpacing();
92 this->dt = this->hr_m[0] / 2;
93 for (
unsigned int i = 0; i < Dim; ++i) {
94 this->dt = std::min(this->dt, this->hr_m[i] / 2);
96 this->domain_m = this->layout_mp->getDomain();
97 for (
unsigned int i = 0; i < Dim; ++i)
98 this->nr_m[i] = this->domain_m[i].length();
101 this->A_nm1.initialize(*(this->mesh_mp), *(this->layout_mp));
102 this->A_n.initialize(*(this->mesh_mp), *(this->layout_mp));
103 this->A_np1.initialize(*(this->mesh_mp), *(this->layout_mp));
111 if constexpr (boundary_conditions == periodic) {
112 this->setPeriodicBoundaryConditions();
StandardFDTDSolver(SourceField &source, EMField &E, EMField &B)
Constructs a StandardFDTDSolver.
Definition StandardFDTDSolver.hpp:9
RangePolicy< View::rank, typenameView::execution_space, PolicyArgs... >::policy_type getRangePolicy(const View &view, int shift=0)
Definition ParallelDispatch.h:56