hw1sol - 1 EE256 Numerical Electromagnetics H. O. #20...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 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 = [1 − Δ t τ ] n +1 since we’ll assume that y = 1 . The FOEM solutions are plotted with the exact solution in figure 1. The error formula used was: error = v u u t Σ 10 τ Δ t n =0 [ y n exact − y n f oem ] 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 . τ 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. 2 1 2 3 4 5 6 7 8 9 10-1.5-1-0.5 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 1 2 3 4 5 6 7 8 9 10 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....
View Full Document

This note was uploaded on 01/24/2011 for the course EE 256 at Stanford.

Page1 / 17

hw1sol - 1 EE256 Numerical Electromagnetics H. O. #20...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online