200 likes | 207 Views
Learn about FDTD method for solving Maxwell's Equations, implement 1D simulations, incorporate absorbing boundary conditions with code examples, and analyze field components.
E N D
EEE 431Computational Methods in Electrodynamics Lecture 10 By Dr. Rasime Uyguroglu Rasime.uyguroglu@emu.edu.tr
FINITE DIFFERENCE TIME DOMAIN METHOD (FDTD) • One dimensional free space formulation: • Assume a plane wave with the electric filed having Ex, magnetic field having Hy components and traveling in the z direction.
FINITE DIFFERENCE TIME DOMAIN METHOD (FDTD) • Maxwell’s Equations become:
FINITE DIFFERENCE TIME DOMAIN METHOD (FDTD) • Taking central difference approximation for both temporal and spectral derivatives:
FINITE DIFFERENCE TIME DOMAIN METHOD (FDTD) • The coefficients can be written as:
FINITE DIFFERENCE TIME DOMAIN METHOD (FDTD) • /* 1D FDTD simulation with a hard source. */ • #include <stdio.h> • #include <math.h> • #define KE 200 • int main() • { • double ez[KE]={0.}, hy[KE]={0.}, imp=377.0,s=0.5; • int n, nTime=250, k; • FILE *fp,*fp1; • fp1=fopen("E.dat","w"); • /* do time stepping */ • for (n=0; n<nTime; n++) { • /* update magnetic field */ • for (k=0; k<KE-1; k++) • hy[k] = hy[k] + s*(ez[k+1] - ez[k])/imp; • /* update electric field */ • for (k=1; k<KE; k++) • ez[k] = ez[k] + s*imp*(hy[k] - hy[k-1]); • /* source point */ • ez[0] = exp(-(n-30.)*(n-30)/100); • fprintf(fp1,"%g\n",ez[50]); • } • fclose(fp1); • return 0; • }
FINITE DIFFERENCE TIME DOMAIN METHOD (FDTD) • Source at k=0, field at k=50 w.r.t. the time, 250 time steps.
FINITE DIFFERENCE TIME DOMAIN METHOD (FDTD) • Source at k=100,Ex at k=100
FINITE DIFFERENCE TIME DOMAIN METHOD (FDTD) • Ez w.r.t. space steps
FINITE DIFFERENCE TIME DOMAIN METHOD (FDTD) • Ez w.r.t. the time steps.
FINITE DIFFERENCE TIME DOMAIN METHOD (FDTD) • Ez w.r.t. the time steps
FINITE DIFFERENCE TIME DOMAIN METHOD (FDTD) with ABC’s • Using the boundary condition discussed in Lecture 9 : • Store a value of Ex(1) for two time steps and then put it in Ex(0).
FINITE DIFFERENCE TIME DOMAIN METHOD (FDTD) with ABC’s • A.B.C.in C computer code assume that the domain ends at k=KE:
FINITE DIFFERENCE TIME DOMAIN METHOD (FDTD) with ABC’s • Ez w.r.t. the time steps
FINITE DIFFERENCE TIME DOMAIN METHOD (FDTD) with ABC’s • /* 1D FDTD simulation with ABC. */ • #include <stdio.h> • #include <math.h> • #define KE 200 • int main() • { • double ez[KE]={0.}, hy[KE]={0.}, imp=377.0,s=0.5; • int n, nTime=1000, k; • float ez_low_m1=0,ez_low_m2=0,ez_high_m1=0,ez_high_m2=0; • FILE *fp,*fp1; • fp1=fopen("E.dat","w"); • /* do time stepping */ • for (n=0; n<nTime; n++) { • // printf( " %6.2f\n",nTime);
FINITE DIFFERENCE TIME DOMAIN METHOD (FDTD) with ABC’s • /* update magnetic field */ • for (k=0; k<KE-1; k++) • hy[k] = hy[k] + s*(ez[k+1] - ez[k])/imp; • /* update electric field */ • for (k=1; k<KE; k++) • ez[k] = ez[k] + s*imp*(hy[k] - hy[k-1]); • /*Absorbing Boundary Conditions*/ • ez[0] = ez_low_m2; • ez_low_m2 = ez_low_m1; • ez_low_m1 = ez[1]; • ez[KE-1] = ez_high_m2; • ez_high_m2 = ez_high_m1; • ez_high_m1 = ez[KE-2];
FINITE DIFFERENCE TIME DOMAIN METHOD (FDTD) with ABC’s • /* hardwire a source node */ • ez[100] = exp(-(n-30.)*(n-30)/100); • fprintf(fp1,"%g\n",ez[50]); • if(n==150){ • fp=fopen("Ez.dat","w"); • for (k=1;k<=KE;k++) • {fprintf(fp,"%6.2f\n",ez[k]);} • fclose(fp); • /* Write Hy in a file "Hy"*/ • fp=fopen("Hy.dat","w"); • for(k=1;k<=KE;k++) • {fprintf(fp," %6.2f\n",hy[k]);} • fclose(fp);} • } • fclose(fp1); • return 0; • }
FINITE DIFFERENCE TIME DOMAIN METHOD (FDTD) with ABC’s • Ez with ABC and without ABC