8 #include "sll_assert.h"
9 #include "sll_memory.h"
10 #include "sll_working_precision.h"
45 sll_comp64,
dimension(:, :, :),
pointer :: hat_rho
46 sll_comp64,
dimension(:, :, :),
pointer :: hat_phi
65 sll_allocate(self%hat_rho(1:nx, 1:ny, 1:nz), ierr)
66 sll_allocate(self%hat_phi(1:nx, 1:ny, 1:nz), ierr)
85 sll_real64,
dimension(:, :, :) :: rho
86 sll_real64,
dimension(:, :, :) :: phi
87 sll_int32 :: nx, ny, nz
89 sll_real64 :: lx, ly, lz
90 sll_real64 :: ind_x, ind_y, ind_z
99 sll_assert(nx ==
size(rho, 1))
100 sll_assert(ny ==
size(rho, 2))
101 sll_assert(nz ==
size(rho, 3))
102 sll_assert(nx ==
size(phi, 1))
103 sll_assert(ny ==
size(phi, 2))
104 sll_assert(nz ==
size(phi, 3))
106 self%hat_phi = cmplx(rho, 0_f64, kind=f64)
108 self%hat_rho = self%hat_rho/cmplx(nx*ny*nz, 0.0, f64)
115 ind_x = real(i - 1, f64)
117 ind_x = real(nx - (i - 1), f64)
120 ind_y = real(j - 1, f64)
122 ind_y = real(ny - (j - 1), f64)
125 ind_z = real(k - 1, f64)
127 ind_z = real(nz - (k - 1), f64)
129 if ((ind_x == 0) .and. (ind_y == 0) .and. (ind_z == 0))
then
130 self%hat_rho(i, j, k) = (0._f64, 0._f64)
132 self%hat_rho(i, j, k) = self%hat_rho(i, j, k)/ &
134 ((real(ind_x, f64)/lx)**2 &
135 + (real(ind_y, f64)/ly)**2 &
136 + (real(ind_z, f64)/lz)**2))
144 phi = real(self%hat_phi, f64)
157 sll_deallocate_array(self%hat_rho, ierr)
158 sll_deallocate_array(self%hat_phi, ierr)
Fortran module where set some physical and mathematical constants.
real(kind=f64), parameter, public sll_p_pi
subroutine, public sll_s_fft_free(plan)
Delete a plan.
integer, parameter, public sll_p_fft_forward
Flag to specify forward FFT (negative sign) [value -1].
subroutine, public sll_s_fft_init_c2c_3d(plan, nx, ny, nz, array_in, array_out, direction, normalized, aligned, optimization)
Create new 3d complex to complex plan.
subroutine, public sll_s_fft_exec_c2c_3d(plan, array_in, array_out)
Compute fast Fourier transform in complex to complex mode.
integer, parameter, public sll_p_fft_backward
Flag to specify backward FFT (positive sign) [value 1].
3D poisson solver with periodic boundary conditions
subroutine, public sll_s_poisson_3d_periodic_init(self, nx, ny, nz, Lx, Ly, Lz)
Allocate a structure to solve Poisson equation on 3d cartesian mesh with periodic boundary conditions...
subroutine, public sll_s_poisson_3d_periodic_solve(self, rho, phi)
Compute the potential from 3d Poisson solver.
subroutine, public sll_s_poisson_3d_periodic_free(self)
Delete the 3d poisson solver object.
Type for FFT plan in SeLaLib.
Structure to solve Poisson equation on 3d domain. Mesh is cartesian and all boundary conditions are p...