58 FFT(std::shared_ptr<LatticeWalberla> lattice,
double permittivity)
62 Vector3<uint_t> dim(m_blocks->getNumberOfXCells(),
63 m_blocks->getNumberOfYCells(),
64 m_blocks->getNumberOfZCells());
65 auto const greens = [dim](uint_t x, uint_t y, uint_t z) -> real_t {
66 if (x == 0u && y == 0u && z == 0u)
69 (std::cos(2. * std::numbers::pi * real_c(x) / real_c(dim[0])) +
70 std::cos(2. * std::numbers::pi * real_c(y) / real_c(dim[1])) +
71 std::cos(2. * std::numbers::pi * real_c(z) / real_c(dim[2])) -
73 real_c(dim[0] * dim[1] * dim[2]);
76 m_potential_field_id = field::addToStorage<PotentialField>(
77 get_lattice().get_blocks(),
"potential field", 0.0, field::fzyx,
80 m_ft = std::make_shared<fft::FourierTransform<PotentialField>>(
81 m_blocks, m_potential_field_id, greens);
83 m_full_communication =
84 std::make_shared<FullCommunicator>(
get_lattice().get_blocks());
85 m_full_communication->addPackInfo(
86 std::make_shared<field::communication::PackInfo<PotentialField>>(
87 m_potential_field_id));
102 bool is_double_precision)
override {
106 const auto density_id = walberla::BlockDataID(
id);
108 auto charge_field =
block.template getData<PotentialField>(charge_id);
109 if (is_double_precision) {
111 block.template getData<walberla::GhostLayerField<double, 1>>(
113 WALBERLA_FOR_ALL_CELLS_XYZ(
114 charge_field, charge_field->get(x, y, z) +=
115 factor * FloatType_c(density_field->get(x, y, z));)
118 block.template getData<walberla::GhostLayerField<float, 1>>(
120 WALBERLA_FOR_ALL_CELLS_XYZ(
121 charge_field, charge_field->get(x, y, z) +=
122 factor * FloatType_c(density_field->get(x, y, z));)