1 / 28

Solving Scale Linear Systems ( Example system continued )

Solving Scale Linear Systems ( Example system continued ). Lecture 14 MA/CS 471 Fall 2003. Today. We will discuss direct methods for a slightly larger loop current problem as introduced last time.

raisie
Download Presentation

Solving Scale Linear Systems ( Example system continued )

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Solving Scale Linear Systems (Example system continued) Lecture 14 MA/CS 471 Fall 2003

  2. Today • We will discuss direct methods for a slightly larger loop current problem as introduced last time. • Then we will look at a much larger problem and examine the memory/work requirements for direct methods.

  3. Note • It is important that at least one loop has aresistor that lies only on that loop (i.e. at least one resistor lying on a wire not shared by two loops). • Otherwise the entire circuit will short circuit around the boundary of the entire circuit.. • For example: 9 9 8 8 1W 1W 4W 4W 6W 6W 5 4 5 4 3W 3W 7W 7W 1 1 + - + - 2 3 2 3 1W 1W 2W 2W

  4. Circuit Problem Enlarged 9 8 1W 5W 2W 1W 4W 6W 5 4 3W 7W 1 + - 10V 2 3 1W 5W 2W Problem: Find the current running through each closed loop 1W 4W 6W 11 15 3W 7W 7 + - 20V 17 12 1W 5W 2W 1W 4W 6W 16 6 3W 7W + - 30V 10 14 13 1W 2W

  5. Shortcut to Loop Current Matrix 9 8 1W 5W 2W 1W 4W 6W 5 4 3W 7W 1 + - 10V 2 3 1W 5W • To obtain the n’th row of the • Matrix: • The diagonal entry is equal to the sum of the resistances on the n’th loop • There is an off diagonal entry foreach neighbor of the loop which is equal to:a) –sum(resistances) on shared wire if loop currents are in opposite direction b) sum(resistances) on shared wire if loop currents are in the same direction 2W 1W 4W 6W 11 15 3W 7W 7 + - 20V 17 12 1W 5W 2W 1W 4W 6W 16 6 3W 7W + - 30V 10 14 13 1W 2W

  6. 9 8 1W 5W 2W 1W 4W 6W 5 4 3W 7W 1 + - 2 3 1W 5W 2W 1W 4W 6W 11 15 3W 7W 7 + - 17 12 1W 5W 2W 1W 4W 6W 16 6 3W 7W + - 10 14 13 1W 2W

  7. Using Sparse Matrices in Matlab

  8. Run bigcircuit • Create the list of non-zeros • Convert the list to Matlab’s sparse matrix format • Convert the sparse matrix to a full matrix (just for viewing)

  9. Counting the Non-Zeros with nnz • We can use Matlab’s built in nnz function to find the number of non-zeros: i.e. there are only 58 non-zero entries out of 17x17=289 possible

  10. Now We LU Factorize The Sparse Matrix • Since there are only a few degrees of freedom we will use a direct method to factorize and solve the system. • We can use the built in LU factorization of the matrix… • i.e. find two matrices L & U such that A=LU where L is logically lower triangle and U is logically upper triangle..

  11. LU Factorization of Loop Current Matrix

  12. Solving The System • Now we have factorized the system into A=LU we can solve in three stages. • Build the source vector, v • Solve y = L\v • Solve for the currents I = U\y

  13. Solving for the loop currents using an LU factorization 9 8 1W 5W 2W 1W 4W 6W 5 4 3W 7W 1 + - 10V 2 3 1W 5W 2W 1W 4W 6W 11 15 3W 7W 7 + - 20V 17 12 1W 5W 2W 1W 4W 6W 16 6 3W 7W + - 30V 10 14 13 1W 2W

  14. Solving for the loop currents using an LU factorization 9 8 1W 5W 2W 1W 4W 6W 5 4 3W 7W 1 + - 10V 2 3 1W 5W 2W 1W 4W 6W 11 15 3W 7W 7 + - 20V 17 12 1W 5W 2W 1W 4W 6W 16 6 3W 7W + - 30V 10 14 13 1W 2W

  15. Let’s Renumber • Matlab has a built in routine symrcm which takes a symmetric matrix and returns a permutation array so that if we use this to permute the unknowns (by column and row swaps) the bandwidth of the matrix may be reduced…

  16. Renumbering with symrcm

  17. How Were The Loops Renumbered • We can examine the permutation matrix: • i.e. the old 13 cell becomes the new 1 cell • 6->2, 14->3…

  18. 9 16 8 17 1W 1W 5W 5W 2W 2W 1W 1W 4W 4W 6W 6W 5 4 14 15 3W 3W 7W 7W 1 13 + - + - 2 3 12 10 1W 1W 5W 5W 2W 2W 1W 1W 4W 4W 6W 6W 11 15 9 6 3W 3W 7W 7W 7 11 + - + - 17 5 12 8 1W 1W 5W 5W 2W 2W 1W 1W 4W 4W 6W 6W 16 6 4 2 3W 3W 7W 7W + - + - 10 7 14 3 13 1 1W 1W 2W 2W

  19. Let’s Figure Out the Sequence of Shells in symrcm 16 17 1W 5W 2W 1W 4W 6W 14 15 3W 7W 13 + - 12 10 1W 5W 2W 1W 4W 6W 9 6 3W 7W Level 1 Level 4 11 + - 5 8 1W 5W 2W 1W 4W Level 2 Level 5 6W 4 2 3W 7W + - Level 3 Level 6 7 3 1 1W 2W

  20. Let’s Try LU Factorization of the Reordered Matrix

  21. Effect of Reordering Before After

  22. Notes • We could have also used Cholesky factorization (since the loop current matrix is symmetric). • Just by reordering unknowns we have changed the amount of fill in the L,U factors of the matrix. • Changing the ordering of cells will not change the answer (beyond round off). • However, we have reduced the amount of work required in the backsolves.

  23. Solving The Reordered System

  24. Comparing The Results • We can compare the results from solving using the original matrix and using the reordered matrix: No reordering With reordering

  25. OK – Let’s Get Serious And Look At A Large Circuit Case We can construct a random circuit:

  26. The Sparsity Pattern of a Loop Circuit Matrix for a Random Circuit (with 1000 closed loops)

  27. Notes • For a more realistic circuit (i.e. with less random interconnects) the fill in the L & U matrices will be reduced more after reordering using RCM

  28. Lab Task • Construct a more realistic “random” circuit for an arbitrary N (i.e. design a process which randomly grows a circuit). Use an interconnect of say 4 per cell on average. • Time how long the LU factorization takes for N=10,100,1000,1e4,1e5,1e6,1e7,1e8and plot a graph of time v. N • Calculate the number of non-zeros (i.e. how much memory is taken by the L & U matrices). Plot this as a function of N. • Solve with a random source vector for N=10,100,…,1e6 and time how long the backsolves take and plot a graph of time v. N • Perform a polynomial fit of the timings (estimate the polynomial growth rate with N)… • USE SPARSE MATRICES!. You can use Cholesky if you wish.

More Related