41 #include "sll_memory.h"
42 #include "sll_working_precision.h"
43 #include "sll_maxwell_solvers_macros.h"
79 sll_int32 :: polarization
83 sll_real64 :: eta1_min
84 sll_real64 :: eta1_max
85 sll_real64 :: delta_eta1
86 sll_real64 :: eta2_min
87 sll_real64 :: eta2_max
88 sll_real64 :: delta_eta2
101 y1, y2, nc_y, polarization)
110 sll_int32 :: polarization
115 self%dx = (x2 - x1)/nc_x
116 self%dy = (y2 - y1)/nc_y
122 self%polarization = polarization
136 sll_int32 :: polarization
148 self%polarization = polarization
157 sll_real64,
dimension(:, :) :: fx
158 sll_real64,
dimension(:, :) :: fy
159 sll_real64,
dimension(:, :) :: fz
160 sll_real64,
intent(in) :: dt
177 sll_real64,
dimension(:, :),
target :: fx
178 sll_real64,
dimension(:, :),
target :: fy
179 sll_real64,
dimension(:, :),
target :: fz
180 sll_real64,
intent(in) :: dt
182 sll_real64 :: dex_dy, dey_dx, dez_dx, dez_dy
184 sll_int32 :: i1, j1, i2, j2
185 sll_real64,
dimension(:, :),
pointer :: ex
186 sll_real64,
dimension(:, :),
pointer :: ey
187 sll_real64,
dimension(:, :),
pointer :: ez
188 sll_real64,
dimension(:, :),
pointer :: bx
189 sll_real64,
dimension(:, :),
pointer :: by
190 sll_real64,
dimension(:, :),
pointer :: bz
204 if (self%polarization == te_polarization)
then
206 ex => fx; ey => fy; bz => fz
209 dex_dy = (ex(i, j + 1) - ex(i, j))/dy
210 dey_dx = (ey(i + 1, j) - ey(i, j))/dx
211 bz(i, j) = bz(i, j) + dt*(dex_dy - dey_dx)
217 if (self%polarization == tm_polarization)
then
219 bx => fx; by => fy; ez => fz
222 dez_dy = (ez(i, j) - ez(i, j - 1))/dy
223 bx(i, j) = bx(i, j) - dt*dez_dy
229 dez_dx = (ez(i, j) - ez(i - 1, j))/dx
230 by(i, j) = by(i, j) + dt*dez_dx
244 sll_int32 :: i1, j1, i2, j2
245 sll_real64,
dimension(:, :),
intent(inout),
target :: fx
246 sll_real64,
dimension(:, :),
intent(inout),
target :: fy
247 sll_real64,
dimension(:, :),
intent(inout),
target :: fz
248 sll_real64,
dimension(:, :),
intent(in),
optional :: jx
249 sll_real64,
dimension(:, :),
intent(in),
optional :: jy
251 sll_real64 :: dbz_dx, dbz_dy, dbx_dy, dby_dx
252 sll_real64,
intent(in) :: dt
255 sll_real64,
dimension(:, :),
pointer :: ex
256 sll_real64,
dimension(:, :),
pointer :: ey
257 sll_real64,
dimension(:, :),
pointer :: ez
258 sll_real64,
dimension(:, :),
pointer :: bx
259 sll_real64,
dimension(:, :),
pointer :: by
260 sll_real64,
dimension(:, :),
pointer :: bz
276 if (self%polarization == te_polarization)
then
278 ex => fx; ey => fy; bz => fz
282 dbz_dy = (bz(i, j) - bz(i, j - 1))/dy
283 ex(i, j) = ex(i, j) + dt*csq*dbz_dy
289 dbz_dx = (bz(i, j) - bz(i - 1, j))/dx
290 ey(i, j) = ey(i, j) - dt*csq*dbz_dx
294 if (
present(jx) .and.
present(jy))
then
296 ex(i1:j1, i2 + 1:j2) = ex(i1:j1, i2 + 1:j2) - dt*jx(i1:j1, i2 + 1:j2)/self%e_0
297 ey(i1 + 1:j1, i2:j2) = ey(i1 + 1:j1, i2:j2) - dt*jy(i1 + 1:j1, i2:j2)/self%e_0
303 if (self%polarization == tm_polarization)
then
305 bx => fx; by => fy; ez => fz
309 dbx_dy = (bx(i, j + 1) - bx(i, j))/dy
310 dby_dx = (by(i + 1, j) - by(i, j))/dx
311 ez(i, j) = ez(i, j) - dt*(dbx_dy - dby_dx)
315 if (
present(jx) .and. .not.
present(jy))
then
317 ez(i1:j1 - 1, i2:j2 - 1) = ez(i1:j1 - 1, i2:j2 - 1) - dt*jx(i1:j1 - 1, i2:j2 - 1)/self%e_0
331 sll_int32 :: i1, j1, i2, j2
332 sll_real64,
dimension(:, :),
intent(inout) :: fx
333 sll_real64,
dimension(:, :),
intent(inout) :: fy
334 sll_real64,
dimension(:, :),
intent(inout) :: fz
335 sll_real64 :: dbz_dx, dbz_dy, dez_dx, dez_dy
336 sll_real64,
intent(in) :: dt
350 fz(i1:j1 - 1, j2) = fz(i1:j1 - 1, i2)
351 fz(j1, i2:j2 - 1) = fz(i1, i2:j2 - 1)
353 fz(j1, j2) = fz(i1, i2)
355 if (self%polarization == te_polarization)
then
357 dbz_dy = (fz(i, i2) - fz(i, j2 - 1))/dy
358 fx(i, i2) = fx(i, j2) + dt*csq*dbz_dy
362 dbz_dx = (fz(i1, j) - fz(j1 - 1, j))/dx
363 fy(i1, j) = fy(j1, j) - dt*csq*dbz_dx
367 if (self%polarization == tm_polarization)
then
369 dez_dy = (fz(i, i2) - fz(i, j2 - 1))/dy
370 fx(i, i2) = fx(i, j2) - dt*csq*dez_dy
374 dez_dx = (fz(i1, j) - fz(j1 - 1, j))/dx
375 fy(i1, j) = fy(j1, j) + dt*csq*dez_dx
Initialize maxwell solver 2d with FDTD scheme.
Solve maxwell solver 2d with FDTD scheme.
Solve Ampere-Maxwell equation.
Implements the Maxwell solver in 2D with FDTD method.
subroutine bc_periodic_2d_fdtd(self, fx, fy, fz, dt)
Set boundary conditions.
subroutine initialize_maxwell_2d_fdtd_alt(self, x1, x2, nc_x, y1, y2, nc_y, polarization)
Initilialize the maxwell solver.
subroutine ampere_2d_fdtd(self, fx, fy, fz, dt, jx, jy)
Solve ampere-maxwell equation with FDTD scheme.
subroutine initialize_maxwell_2d_fdtd(self, i1, j1, i2, j2, dx, dy, polarization)
Initilialize the maxwell solver.
subroutine solve_maxwell_2d_fdtd(self, fx, fy, fz, dt)
self routine exists only for testing purpose. Use ampere and faraday in your appication.
subroutine faraday_2d_fdtd(self, fx, fy, fz, dt)
Solve Faraday equation.
Object with data to solve Maxwell equation Maxwell in TE mode: (Ex,Ey,Bz)