Finite Difference & FDTD
- Inlämningsdatum 10 nov 2019 av 23.59
- Poäng 1
- Lämnar in en filuppladdning
- Filtyper pdf
Prepare a .pdf file presenting your work in this assignment and upload it to Canvas.
1. The finite difference for Poisson Equation and Capacitance of Square Coaxial Cable
Objective: Reformulate the equations for Poisson Equation as a linear system in matrix form. Your task is to create the A matrix and g vector, and then solve the linear system using Phi = A\g Matlab command
Instructions:
- Check the slides, the Matlab code and Section 3.1.3 of the Textbook where we solved the problem using the Gauss-Seidel iteration that doesn't require matrix formulation
- Formulate the problem as matrix problem (it might be helpful to check the slides on finite differences)
- What is the equivalent of symmetry BC in matrix form?
- Plot the Potential on the grid and compare it with the result of the last iteration from the code we used in class.
- Perform a convergence test and plot it
- Determine experimentally the order of truncation error
2. FDTD
Objective: implement in Matlab the discretization of the second-order (or curl-curl) formulation of Maxwell's equations in 1D for the propagation of two light waves from a pulse source. Compare the results obtained with the Yee Scheme. Determine experimentally the numerical dispersion relations.
Instructions:
- Download and run the code using the Yee scheme describing for the propagation of two light waves from a pulse source. A pulse is initialized in the central point of the simulation domain. The pulse amplitude increases exponentially in time until t=t0 and then decreases exponentially after that.
- Read Section 5.1 of the Textbook
- Remove the calculation of E and H in the code and implement the computation of the E using the curl-curl formulation (Section 5.1 of the Textbook)
- Plot E at different time steps for the two methods using
- a time step matching the Courant condition
- a time step allowing stable simulation but not perfectly matching the Courant condition
- Determine experimentally the dispersion relation using a 2D FFT (space and time) of the history of Ez. For doing that, you can
ExHist = [];
% Start loop
for t=1:nsteps
% E field loop
for k=2:ke-1
Ez(k)=Ez(k)+cc*(Hy(k-1)-Hy(k));
end
% Source
Ez(ks)=exp(-.5*((t-t0)/spread)^2);
% H field loop
for k=1:ke-1
Hy(k)=Hy(k)+cc*(Ez(k)-Ez(k+1));
end
ExHist = [ExHist; Ez];
end
spectrum = fft2(ExHist);
plot_spectrum = log(abs(spectrum));
pcolor(plot_spectrum(1:ke/2,1:nsteps/2))
shading interp
- How do you calculate the x and y-axis values? Hint: You need to check fft2 function online or check the textbook where it presents FFT with Matlab (Sections 4.4.2 and 4.4.3)
- Compare the numerical dispersion relations obtained experimentally with the two methods and with time steps 1) and 2).
- What is the impact of the two techniques on the numerical dispersion relation if any?
- What is the impact of the Courant number on the numerical dispersion relation if any?