18 call sll_s_fft_exec_r2c_1d(plan%fwx, plan%d_dx, plan%fft_x_array); \
19 plan%fft_x_array(2:ncx/2 + 1) = -cmplx(0.0_f64, plan%kx(2:ncx/2 + 1), kind=f64)*plan%fft_x_array(2:ncx/2 + 1); \
20 call sll_s_fft_exec_c2r_1d(plan%bwx, plan%fft_x_array, plan%d_dx); \
21 plan%d_dx = plan%d_dx/plan%ncx
25 call sll_s_fft_exec_r2c_1d(plan%fwy, plan%d_dy, plan%fft_y_array); \
26 plan%fft_y_array(2:ncy/2 + 1) = -cmplx(0.0_f64, plan%ky(2:ncy/2 + 1), kind=f64)*plan%fft_y_array(2:ncy/2 + 1); \
27 call sll_s_fft_exec_c2r_1d(plan%bwy, plan%fft_y_array, plan%d_dy); \
28 plan%d_dy = plan%d_dy/plan%ncy
37 #include "sll_memory.h"
38 #include "sll_working_precision.h"
39 #include "sll_maxwell_solvers_macros.h"
58 use sll_m_remapper,
only: &
59 sll_o_apply_remap_2d, &
60 sll_o_compute_local_sizes, &
62 sll_o_new_remap_plan, &
63 sll_t_remap_plan_2d_real64, &
89 sll_real64,
dimension(:),
pointer :: d_dx
90 sll_real64,
dimension(:),
pointer :: d_dy
91 sll_comp64,
dimension(:),
pointer :: fft_x_array
92 sll_comp64,
dimension(:),
pointer :: fft_y_array
95 type(sll_t_layout_2d),
pointer :: layout_x
96 type(sll_t_layout_2d),
pointer :: layout_y
97 type(sll_t_remap_plan_2d_real64),
pointer :: rmp_xy
98 type(sll_t_remap_plan_2d_real64),
pointer :: rmp_yx
99 sll_real64,
dimension(:, :),
pointer :: fz_x
100 sll_real64,
dimension(:, :),
pointer :: fz_y
101 sll_real64,
dimension(:),
pointer :: kx
102 sll_real64,
dimension(:),
pointer :: ky
112 layout_x, layout_y, ncx, ncy, Lx, Ly)
result(plan)
116 type(sll_t_layout_2d),
pointer :: layout_x
117 type(sll_t_layout_2d),
pointer :: layout_y
136 print *,
'This test needs to run with numbers of cells which are', &
138 print *,
'Exiting...'
142 sll_allocate(plan, error)
143 sll_clear_allocate(plan%d_dx(1:ncx), error)
144 sll_clear_allocate(plan%d_dy(1:ncy), error)
149 sll_allocate(plan%fft_x_array(ncx/2 + 1), error)
150 sll_allocate(plan%fft_y_array(ncy/2 + 1), error)
158 plan%layout_x => layout_x
159 call sll_o_compute_local_sizes(plan%layout_x, nx_loc, ny_loc)
160 sll_clear_allocate(plan%fz_x(1:nx_loc, 1:ny_loc), error)
163 plan%layout_y => layout_y
164 call sll_o_compute_local_sizes(plan%layout_y, nx_loc, ny_loc)
165 sll_clear_allocate(plan%fz_y(1:nx_loc, 1:ny_loc), error)
167 plan%rmp_xy => sll_o_new_remap_plan(plan%layout_x, plan%layout_y, plan%fz_x)
168 plan%rmp_yx => sll_o_new_remap_plan(plan%layout_y, plan%layout_x, plan%fz_y)
170 sll_allocate(plan%kx(ncx/2 + 1), error)
171 sll_allocate(plan%ky(ncy/2 + 1), error)
177 plan%kx(i) = (i - 1)*kx0
181 plan%ky(j) = (j - 1)*ky0
194 sll_real64,
dimension(:, :) :: ex
195 sll_real64,
dimension(:, :) :: ey
202 sll_real64,
intent(in) :: dt
220 call sll_o_compute_local_sizes(plan%layout_x, nx_loc, ny_loc)
223 plan%fz_x(:, j) = plan%fz_x(:, j) - dt_mu*plan%d_dx
226 call sll_o_apply_remap_2d(plan%rmp_xy, plan%fz_x, plan%fz_y)
228 call sll_o_compute_local_sizes(plan%layout_y, nx_loc, ny_loc)
231 plan%fz_y(i, :) = plan%fz_y(i, :) + dt_mu*plan%d_dy
241 sll_real64,
dimension(:, :),
intent(inout) :: ex
242 sll_real64,
dimension(:, :),
intent(inout) :: ey
243 sll_real64,
dimension(:, :),
optional :: jx
244 sll_real64,
dimension(:, :),
optional :: jy
245 sll_real64,
intent(in) :: dt
253 sll_int32 :: ncx, ncy
267 call sll_o_compute_local_sizes(plan%layout_y, nx_loc, ny_loc)
269 d_dy(plan%fz_y(i, 1:ncy))
270 ex(i, :) = ex(i, :) + dt_e*plan%d_dy
273 if (
present(jx))
then
277 ex(:, :) = ex(:, :) - dt_e*jx(:, :)
280 call sll_o_apply_remap_2d(plan%rmp_xy, plan%fz_x, plan%fz_y)
282 call sll_o_compute_local_sizes(plan%layout_x, nx_loc, ny_loc)
284 d_dx(plan%fz_x(1:ncx, j))
285 ey(:, j) = ey(:, j) - dt_e*plan%d_dx
288 if (
present(jy))
then
292 ey(:, :) = ey(:, :) - dt*jy(:, :)/plan%e_0
302 sll_real64,
dimension(:, :) :: bx
303 sll_real64,
dimension(:, :) :: by
304 sll_real64,
dimension(:, :),
optional :: jz
311 sll_real64,
intent(in) :: dt
329 call sll_o_compute_local_sizes(plan%layout_x, nx_loc, ny_loc)
332 plan%fz_x(:, j) = plan%fz_x(:, j) + dt_e*plan%d_dx
335 call sll_o_apply_remap_2d(plan%rmp_xy, plan%fz_x, plan%fz_y)
337 call sll_o_compute_local_sizes(plan%layout_y, nx_loc, ny_loc)
340 plan%fz_y(i, :) = plan%fz_y(i, :) - dt_e*plan%d_dy
343 if (
present(jz))
then
347 plan%fz_y = plan%fz_y - dt_e*jz
357 sll_real64,
dimension(:, :),
intent(inout) :: bx
358 sll_real64,
dimension(:, :),
intent(inout) :: by
359 sll_real64,
intent(in) :: dt
367 sll_int32 :: ncx, ncy
382 call sll_o_compute_local_sizes(plan%layout_y, nx_loc, ny_loc)
384 d_dy(plan%fz_y(i, 1:ncy))
385 bx(i, :) = bx(i, :) - dt_mu*plan%d_dy
388 call sll_o_apply_remap_2d(plan%rmp_xy, plan%fz_x, plan%fz_y)
390 call sll_o_compute_local_sizes(plan%layout_x, nx_loc, ny_loc)
392 d_dx(plan%fz_x(1:ncx, j))
393 by(:, j) = by(:, j) + dt_mu*plan%d_dx
404 if (.not.
associated(plan))
then
405 print *,
'ERROR, delete_maxwell_3d_periodic_plan_par(): ', &
406 'passed plan is not associated.'
415 call sll_o_delete(plan%rmp_xy)
416 call sll_o_delete(plan%rmp_yx)
417 call sll_o_delete(plan%layout_x)
418 call sll_o_delete(plan%layout_y)
424 type(sll_t_layout_2d),
pointer :: layout
425 sll_real64,
dimension(:, :) :: array
426 sll_int32,
dimension(2) :: n
429 call sll_o_compute_local_sizes(layout, n(1), n(2))
432 if (n(i) /=
size(array, i))
then
433 print *,
'ERROR: solve_maxwell_2d_periodic_cartesian_par()', &
434 'size of either ex,ey or bz does not match expected size. '
436 print *,
'solve_maxwell_2d_periodic_cartesian_par(): ', &
437 'mismatch in direction x'
439 print *,
'solve_maxwell_2d_periodic_cartesian_par(): ', &
440 'mismatch in direction y'
442 print *,
'Exiting...'
integer(kind=i32) function, public sll_f_get_collective_rank(col)
Determines the rank of the calling process in the communicator.
type(sll_t_collective_t), pointer, public sll_v_world_collective
Control of subset assignment. Processes with the same color are in the same new communicator.
integer(kind=i32) function, public sll_f_get_collective_size(col)
Determines the size of the group associated with a communicator.
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.
Selalib periodic 2D maxwell solver for cartesian coordinates.
subroutine, public sll_s_delete_maxwell_2d_periodic_plan_cartesian_par(plan)
Delete maxwell solver object.
type(sll_t_maxwell_2d_periodic_plan_cartesian_par) function, pointer, public sll_f_new_maxwell_2d_periodic_plan_cartesian_par(layout_x, layout_y, ncx, ncy, Lx, Ly)
Presently, this function receives the geometric information as individual arguments....
subroutine, public sll_s_ampere_te(plan, dt, ex, ey, jx, jy)
Solve Ampere-Maxwell equation (TE mode)
subroutine faraday_tm(plan, dt, bx, by)
Solve Ampere-Maxwell equation (TE mode)
subroutine verify_argument_sizes_par(layout, array)
Check array size.
subroutine ampere_tm(plan, dt, bx, by, jz)
Solve Ampere-Maxwell equation (TE mode)
subroutine, public sll_s_faraday_te(plan, dt, ex, ey)
Solve faraday equation (TE mode)
Some common numerical utilities.
logical function, public sll_f_is_power_of_two(n)
Check if an integer is equal to.
Type for FFT plan in SeLaLib.
Maxwell solver 2D object, PSTD scheme.