23 call sll_s_fft_exec_r2c_1d(self%fwx, self%d_dx, self%tmp_x); \
24 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); \
25 call sll_s_fft_exec_c2r_1d(self%bwx, self%tmp_x, self%d_dx); \
26 self%d_dx = self%d_dx/nc_x
30 call sll_s_fft_exec_r2c_1d(self%fwy, self%d_dy, self%tmp_y); \
31 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); \
32 call sll_s_fft_exec_c2r_1d(self%bwy, self%tmp_y, self%d_dy); \
33 self%d_dy = self%d_dy/nc_y
60 #include "sll_memory.h"
61 #include "sll_working_precision.h"
62 #include "sll_maxwell_solvers_macros.h"
94 sll_int32 :: polarization
98 sll_real64 :: eta1_min
99 sll_real64 :: eta1_max
100 sll_real64 :: delta_eta1
101 sll_real64 :: eta2_min
102 sll_real64 :: eta2_max
103 sll_real64 :: delta_eta2
104 sll_real64,
pointer :: d_dx(:)
105 sll_real64,
pointer :: d_dy(:)
106 sll_real64,
pointer :: kx(:)
107 sll_real64,
pointer :: ky(:)
112 sll_comp64,
pointer :: tmp_x(:)
113 sll_comp64,
pointer :: tmp_y(:)
131 sll_real64,
intent(in) :: xmin
132 sll_real64,
intent(in) :: xmax
133 sll_real64,
intent(in) :: ymin
134 sll_real64,
intent(in) :: ymax
135 sll_int32,
intent(in) :: nc_x
136 sll_int32,
intent(in) :: nc_y
137 sll_int32,
intent(in) :: polarization
148 self%polarization = polarization
153 sll_allocate(self%d_dx(nc_x), error)
154 sll_allocate(self%d_dy(nc_y), error)
156 sll_allocate(self%tmp_x(nc_x/2 + 1), error)
157 sll_allocate(self%tmp_y(nc_y/2 + 1), error)
164 sll_allocate(self%kx(nc_x/2 + 1), error)
165 sll_allocate(self%ky(nc_y/2 + 1), error)
167 dx = (xmax - xmin)/nc_x
168 dy = (ymax - ymin)/nc_y
174 self%kx(i) = (i - 1)*kx0
178 self%ky(j) = (j - 1)*ky0
189 sll_real64,
intent(inout),
dimension(:, :) :: fx
190 sll_real64,
intent(inout),
dimension(:, :) :: fy
191 sll_real64,
intent(inout),
dimension(:, :) :: fz
192 sll_real64,
intent(in) :: dt
194 IF (self%polarization == tm_polarization)
then
200 IF (self%polarization == te_polarization)
then
211 sll_real64,
dimension(:, :),
intent(inout) :: fx
212 sll_real64,
dimension(:, :),
intent(inout) :: fy
213 sll_real64,
dimension(:, :),
intent(inout) :: fz
214 sll_real64,
intent(in) :: dt
216 if (self%polarization == tm_polarization)
then
220 if (self%polarization == te_polarization)
then
228 sll_real64,
dimension(:, :),
intent(inout) :: fx
229 sll_real64,
dimension(:, :),
intent(inout) :: fy
230 sll_real64,
dimension(:, :),
intent(inout) :: fz
231 sll_real64,
intent(in) :: dt
232 sll_real64,
dimension(:, :),
optional :: sx
233 sll_real64,
dimension(:, :),
optional :: sy
235 if (self%polarization == tm_polarization .and. &
236 present(sx) .and. .not.
present(sy))
then
238 else if (self%polarization == te_polarization .and. &
239 present(sx) .and.
present(sy))
then
249 sll_real64,
dimension(:, :),
intent(inout) :: hx
250 sll_real64,
dimension(:, :),
intent(inout) :: hy
251 sll_real64,
dimension(:, :),
intent(inout) :: ez
254 sll_real64,
intent(in) :: dt
266 hx(i, 1:nc_y) = hx(i, 1:nc_y) - dt_mu*self%d_dy
271 hy(1:nc_x, j) = hy(1:nc_x, j) + dt_mu*self%d_dx
274 if (
size(hx, 2) == nc_y + 1) hx(:, nc_y + 1) = hx(:, 1)
275 if (
size(hy, 1) == nc_x + 1) hy(nc_x + 1, :) = hy(1, :)
283 sll_real64,
dimension(:, :),
intent(inout) :: ex
284 sll_real64,
dimension(:, :),
intent(inout) :: ey
285 sll_real64,
dimension(:, :),
intent(inout) :: hz
288 sll_real64,
intent(in) :: dt
300 hz(i, 1:nc_y) = hz(i, 1:nc_y) + dt_mu*self%d_dy
305 hz(1:nc_x, j) = hz(1:nc_x, j) - dt_mu*self%d_dx
308 if (
size(hz, 1) == nc_x + 1) hz(nc_x + 1, :) = hz(1, :)
309 if (
size(hz, 2) == nc_y + 1) hz(:, nc_y + 1) = hz(:, 1)
319 sll_real64,
dimension(:, :) :: hx
320 sll_real64,
dimension(:, :) :: hy
321 sll_real64,
dimension(:, :) :: ez
323 sll_real64,
dimension(:, :),
optional :: jz
335 ez(1:nc_x, j) = ez(1:nc_x, j) + dt_e*self%d_dx
340 ez(i, 1:nc_y) = ez(i, 1:nc_y) - dt_e*self%d_dy
343 if (
present(jz))
then
347 if (
size(ez, 1) == nc_x + 1) ez(nc_x + 1, :) = ez(1, :)
348 if (
size(ez, 2) == nc_y + 1) ez(:, nc_y + 1) = ez(:, 1)
356 sll_real64,
dimension(:, :) :: ex
357 sll_real64,
dimension(:, :) :: ey
358 sll_real64,
dimension(:, :) :: hz
360 sll_real64,
dimension(:, :),
optional :: jx
361 sll_real64,
dimension(:, :),
optional :: jy
375 ey(1:nc_x, j) = ey(1:nc_x, j) - dt_e*self%d_dx
380 ex(i, 1:nc_y) = ex(i, 1:nc_y) + dt_e*self%d_dy
383 If (
present(jx) .and.
present(jy))
then
388 if (
size(ex, 1) == nc_x + 1) ex(nc_x + 1, :) = ex(1, :)
389 if (
size(ey, 2) == nc_y + 1) ey(:, nc_y + 1) = ey(:, 1)
Fortran module where set some physical and mathematical constants.
real(kind=f64), parameter, public sll_p_pi
subroutine, public sll_s_fft_exec_r2c_1d(plan, array_in, array_out)
Compute fast Fourier transform in real to complex mode.
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_exec_c2r_1d(plan, array_in, array_out)
Compute fast Fourier transform in complex to real mode.
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 2D with periodic boundary conditions with PSTD method.
subroutine faraday_tm_2d_pstd(self, hx, hy, ez, dt)
Solve faraday equation (hx,hy,ez)
subroutine, public sll_s_free_maxwell_2d_pstd(self)
delete maxwell solver object
subroutine, public sll_s_solve_faraday_2d_pstd(self, fx, fy, fz, dt)
Solve Faraday equation.
subroutine ampere_te_2d_pstd(self, ex, ey, hz, dt, jx, jy)
Solve ampere maxwell equation (ex,ey,hz)
subroutine faraday_te_2d_pstd(self, ex, ey, hz, dt)
Solve faraday equation (ex,ey,hz)
subroutine ampere_tm_2d_pstd(self, hx, hy, ez, dt, jz)
Solve ampere maxwell equation (hx,hy,ez)
subroutine, public sll_s_solve_maxwell_2d_pstd(self, fx, fy, fz, dt)
self routine exists only for testing purpose. Use ampere and faraday in your appication.
subroutine, public sll_s_maxwell_2d_pstd_init(self, xmin, xmax, nc_x, ymin, ymax, nc_y, polarization)
Solve maxwell solver 2d cartesian periodic with PSTD scheme.
subroutine, public sll_s_solve_ampere_2d_pstd(self, fx, fy, fz, dt, sx, sy)
Type for FFT plan in SeLaLib.