hw1sol

# hw1sol - 1 EE256 Numerical Electromagnetics Marshall Summer...

This preview shows pages 1–4. Sign up to view the full content.

1 EE256 Numerical Electromagnetics H. O. #20 Marshall 08 July 2008 Summer 2008 Homework #1 Solutions 1 PROBLEM 1 Given the first-order Euler Method (aka FOEM): y n +1 = y n f ( y n , t n t It can be applied to the differential equation ∂y ∂t + y τ = 0 We start with a forward differencing scheme: y n +1 y n Δ t + y n τ = 0 which can be manipulated into the FEOM form y n +1 = y n y n τ Δ t (FOEM form) = [1 Δ t τ ] y n = [1 Δ t τ ] n +1 y 0 = [1 Δ t τ ] n +1 since we’ll assume that y 0 = 1 . The FOEM solutions are plotted with the exact solution in figure 1. The error formula used was: error = Σ 10 τ Δ t n =0 [ y n exact y n foem ] 2 Σ 10 τ Δ t n =0 [ y n exact ] 2 Only the FOEM solution of Δ t = . 1 τ resembles the exact solution. The solution of Δ t = 2 . 0 τ is stable but oscillates. The solution of Δ t = 2 . 5 τ is unstable and is diverging. Both errors for the last two FOEM solutions diverge to infinite as n goes to infinite while the first FOEM solution’s error has pretty much converged by n = 10 τ Δ t and has an error of 3.47 percent.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 0 1 2 3 4 5 6 7 8 9 10 -1.5 -1 -0.5 0 0.5 1 time (tau) y 2.5*tau 2.0*tau .1*tau Figure 1: Problem 1 We then had to determine the value of Δ t where the error was 1 percent. Through some simple trial and error it was found that at . 028 τ the error was .984 percent and at . 029 τ the error was 1.019 percent. We can linear interpolate between these two to get an accurate answer: Δ t = (1 . 984) (1 . 019 . 984) ( . 029 τ . 028 τ ) τ + . 028 τ = . 028457 τ The FOEM solution for Δ t = . 028457 τ is plotted in Figure 2 with the exact solution, and we can see that they overlap very well. 2 PROBLEM 2 It was asked to solve the voltage transmission line equation using: V n +1 i = ( v p Δ t Δ z ) 2 [ V n i +1 + V n i - 1 2 V n i ] + 2 V n i V n - 1 i One thing that I noticed while looking at people’s homework was that many coded up the algorithm as follows: V ( n + 1 , i ) = ( v p Δ t Δ z ) 2 [ V ( n, i + 1) + V ( n, i 1) 2 V ( n, i )] + 2 V ( n, i ) V ( n 1 , i ) where V(n,i) is a two dimensional array in time and space. This works fine for 1-D problems, but when one runs highly resolved problems in 2D and 3D one will run out of RAM very quickly. In general it is good practice to save in RAM only the fields necessary for updating the fields at the next timestep. Another field if one wishes to save it, should be written to a file on the hard disk. For example
3 0 1 2 3 4 5 6 7 8 9 10 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 time (tau) y Figure 2: Problem 1 V new ( i ) = ( v p Δ t Δ z ) 2 [ V now ( i + 1) + V now ( i 1) 2 V now ( i )] + 2 V now ( i ) V old ( i ) where V new ( i ) , V now ( i ) , V old ( i ) are all 1D arrays. This algorithm calculates the fields through time just like the prior algorithm, but it only saves the current 3 spatial distributions in time. The initial voltage distribution for problems 2 and 3 are identical and is displayed in Figure 3.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern