20 call sll_s_fft_exec_r2c_1d(self%fwx, self%d_dx, self%tmp_x); \
21 self%tmp_x(2:nc_x/2 + 1) = -cmplx(0.0_f64, self%kx(2:nc_x/2 + 1), kind=f64)*self%tmp_x(2:nc_x/2 + 1); \
22 call sll_s_fft_exec_c2r_1d(self%bwx, self%tmp_x, self%d_dx); \
23 self%d_dx = self%d_dx/nc_x
27 call sll_s_fft_exec_r2c_1d(self%fwy, self%d_dy, self%tmp_y); \
28 self%tmp_y(2:nc_y/2 + 1) = -cmplx(0.0_f64, self%ky(2:nc_y/2 + 1), kind=f64)*self%tmp_y(2:nc_y/2 + 1); \
29 call sll_s_fft_exec_c2r_1d(self%bwy, self%tmp_y, self%d_dy); \
30 self%d_dy = self%d_dy/nc_y
34 call sll_s_fft_exec_r2c_1d(self%fwz, self%d_dz, self%tmp_z); \
35 self%tmp_z(2:nc_z/2 + 1) = -cmplx(0.0_f64, self%kz(2:nc_z/2 + 1), kind=f64)*self%tmp_z(2:nc_z/2 + 1); \
36 call sll_s_fft_exec_c2r_1d(self%bwz, self%tmp_z, self%d_dz); \
37 self%d_dz = self%d_dz/nc_z
67 #include "sll_memory.h"
68 #include "sll_working_precision.h"
69 #include "sll_maxwell_solvers_macros.h"
83 sll_real64,
dimension(:),
pointer :: d_dx
84 sll_real64,
dimension(:),
pointer :: d_dy
85 sll_real64,
dimension(:),
pointer :: d_dz
86 sll_real64,
dimension(:),
pointer :: kx
87 sll_real64,
dimension(:),
pointer :: ky
88 sll_real64,
dimension(:),
pointer :: kz
95 sll_comp64,
pointer :: tmp_x(:)
96 sll_comp64,
pointer :: tmp_y(:)
97 sll_comp64,
pointer :: tmp_z(:)
98 sll_int32 :: polarization
111 sll_real64,
intent(in) :: xmin
112 sll_real64,
intent(in) :: xmax
113 sll_real64,
intent(in) :: ymin
114 sll_real64,
intent(in) :: ymax
115 sll_real64,
intent(in) :: zmin
116 sll_real64,
intent(in) :: zmax
117 sll_int32,
intent(in) :: nc_x
118 sll_int32,
intent(in) :: nc_y
119 sll_int32,
intent(in) :: nc_z
138 sll_allocate(self%tmp_x(1:nc_x/2 + 1), error); self%tmp_x = (0.0_f64, 0.0_f64)
139 sll_allocate(self%tmp_y(1:nc_y/2 + 1), error); self%tmp_y = (0.0_f64, 0.0_f64)
140 sll_allocate(self%tmp_z(1:nc_z/2 + 1), error); self%tmp_z = (0.0_f64, 0.0_f64)
142 sll_clear_allocate(self%d_dx(1:nc_x), error)
143 sll_clear_allocate(self%d_dy(1:nc_y), error)
144 sll_clear_allocate(self%d_dz(1:nc_z), error)
153 sll_allocate(self%kx(nc_x/2 + 1), error)
154 sll_allocate(self%ky(nc_y/2 + 1), error)
155 sll_allocate(self%kz(nc_z/2 + 1), error)
157 dx = (xmax - xmin)/real(nc_x,f64)
158 dy = (ymax - ymin)/real(nc_y,f64)
159 dz = (zmax - zmin)/real(nc_z,f64)
161 kx0 = 2._f64*
sll_p_pi/(real(nc_x,f64)*dx)
162 ky0 = 2._f64*
sll_p_pi/(real(nc_y,f64)*dy)
163 kz0 = 2._f64*
sll_p_pi/(real(nc_z,f64)*dz)
167 self%kx(i) = real(i - 1, f64)*kx0
171 self%ky(j) = real(j - 1, f64)*ky0
175 self%kz(k) = real(k - 1, f64)*kz0
184 sll_real64,
dimension(:, :, :),
intent(inout) :: ex
185 sll_real64,
dimension(:, :, :),
intent(inout) :: ey
186 sll_real64,
dimension(:, :, :),
intent(inout) :: ez
187 sll_real64,
dimension(:, :, :),
intent(inout) :: hx
188 sll_real64,
dimension(:, :, :),
intent(inout) :: hy
189 sll_real64,
dimension(:, :, :),
intent(inout) :: hz
193 sll_real64,
intent(in) :: dt
206 d_dy(ez(i, 1:nc_y, k))
207 hx(i, 1:nc_y, k) = hx(i, 1:nc_y, k) - dt_mu*self%d_dy
208 d_dy(ex(i, 1:nc_y, k))
209 hz(i, 1:nc_y, k) = hz(i, 1:nc_y, k) + dt_mu*self%d_dy
213 hx(:, nc_y + 1, :) = hx(:, 1, :)
214 hz(:, nc_y + 1, :) = hz(:, 1, :)
218 d_dz(ey(i, j, 1:nc_z))
219 hx(i, j, 1:nc_z) = hx(i, j, 1:nc_z) + dt_mu*self%d_dz
220 d_dz(ex(i, j, 1:nc_z))
221 hy(i, j, 1:nc_z) = hy(i, j, 1:nc_z) - dt_mu*self%d_dz
225 hx(:, :, nc_z + 1) = hx(:, :, 1)
226 hy(:, :, nc_z + 1) = hy(:, :, 1)
230 d_dx(ez(1:nc_x, j, k))
231 hy(1:nc_x, j, k) = hy(1:nc_x, j, k) + dt_mu*self%d_dx
232 d_dx(ey(1:nc_x, j, k))
233 hz(1:nc_x, j, k) = hz(1:nc_x, j, k) - dt_mu*self%d_dx
237 hy(nc_x + 1, :, :) = hy(1, :, :)
238 hz(nc_x + 1, :, :) = hz(1, :, :)
243 subroutine sll_s_maxwell_3d_pstd_ampere(self, hx, hy, hz, ex, ey, ez, dt, jx, jy, jz)
246 sll_real64,
dimension(:, :, :) :: hx
247 sll_real64,
dimension(:, :, :) :: hy
248 sll_real64,
dimension(:, :, :) :: hz
249 sll_real64,
dimension(:, :, :) :: ex
250 sll_real64,
dimension(:, :, :) :: ey
251 sll_real64,
dimension(:, :, :) :: ez
253 sll_real64,
dimension(:, :, :),
optional :: jx
254 sll_real64,
dimension(:, :, :),
optional :: jy
255 sll_real64,
dimension(:, :, :),
optional :: jz
272 d_dy(hz(i, 1:nc_y, k))
273 ex(i, 1:nc_y, k) = ex(i, 1:nc_y, k) + dt_e*self%d_dy
274 d_dy(hx(i, 1:nc_y, k))
275 ez(i, 1:nc_y, k) = ez(i, 1:nc_y, k) - dt_e*self%d_dy
279 ex(:, nc_y + 1, :) = ex(:, 1, :)
280 ez(:, nc_y + 1, :) = ez(:, 1, :)
284 d_dz(hy(i, j, 1:nc_z))
285 ex(i, j, 1:nc_z) = ex(i, j, 1:nc_z) - dt_e*self%d_dz
286 d_dz(hx(i, j, 1:nc_z))
287 ey(i, j, 1:nc_z) = ey(i, j, 1:nc_z) + dt_e*self%d_dz
291 ex(:, :, nc_z + 1) = ex(:, :, 1)
292 ey(:, :, nc_z + 1) = ey(:, :, 1)
296 d_dx(hz(1:nc_x, j, k))
297 ey(1:nc_x, j, k) = ey(1:nc_x, j, k) - dt_e*self%d_dx
298 d_dx(hy(1:nc_x, j, k))
299 ez(1:nc_x, j, k) = ez(1:nc_x, j, k) + dt_e*self%d_dx
303 ey(nc_x + 1, :, :) = ey(1, :, :)
304 ez(nc_x + 1, :, :) = ez(1, :, :)
306 if (
present(jx) .and.
present(jy) .and.
present(jz))
then
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.
subroutine, public sll_s_fft_init_r2c_1d(plan, nx, array_in, array_out, normalized, aligned, optimization)
Create new 1d real to complex plan for forward FFT.
subroutine, public sll_s_fft_init_c2r_1d(plan, nx, array_in, array_out, normalized, aligned, optimization)
Create new 1d complex to real plan for backward FFT.
Implements the Maxwell solver in 3D with periodic boundary conditions with PSTD method.
subroutine sll_s_maxwell_3d_pstd_faraday(self, ex, ey, ez, hx, hy, hz, dt)
Solve faraday equation (hx,hy,ez)
subroutine sll_s_maxwell_3d_pstd_init(self, xmin, xmax, nc_x, ymin, ymax, nc_y, zmin, zmax, nc_z)
Initialize 3d maxwell solver on cartesian mesh with PSTD scheme.
subroutine sll_s_maxwell_3d_pstd_ampere(self, hx, hy, hz, ex, ey, ez, dt, jx, jy, jz)
Solve ampere maxwell equation (hx,hy,ez)
subroutine sll_s_maxwell_3d_pstd_free(self)
delete maxwell solver object
Type for FFT plan in SeLaLib.