2013.01.28-ece595e-l09

Upload: ultrazord

Post on 03-Apr-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 2013.01.28-ECE595E-L09

    1/18

    ECE 595, Section 10Numerical Simulations

    Lecture 9: Programming for Linear

    Algebra

    Prof. Peter Bermel

    January 28, 2013

  • 7/29/2019 2013.01.28-ECE595E-L09

    2/18

    Outline

    Recap from Friday

    Application Examples

    Electrostatic potential (Poissons equation)

    1D array of charge

    2D grid of charge

    Arrays of interacting spins

    1D interaction along a chain

    2D nearest-neighbor coupling

    1/28/2013 ECE 595, Prof. Bermel

  • 7/29/2019 2013.01.28-ECE595E-L09

    3/18

    Recap from Friday

    Eigenproblem Solution Techniques

    Power Methods

    Inverse Iteration

    Atomic Transformations

    Factorization Methods

    Linear algebra software packages

    Basic Linear Algebra Subroutines (BLAS)

    Linear Algebra Package (LAPACK)

    1/28/2013 ECE 595, Prof. Bermel

  • 7/29/2019 2013.01.28-ECE595E-L09

    4/18

    Electrostatic Potential Example

    Consider an array of charges governed by

    Gauss law:

    =

    /

    Using the definition of potential yields

    Poissons equation:

    2

    =

    /

    Consider solving this equation for an arbitrary

    set of charges what to do?

    1/28/2013 ECE 595, Prof. Bermel

  • 7/29/2019 2013.01.28-ECE595E-L09

    5/18

    Electrostatic Potential Example

    Strictly speaking, continuous fields have an

    uncountable number of possible values, and

    cannot be evaluated numerically

    Key is to transform from continuous fieldvalues to those on a grid

    Increase resolution as needed

    1/28/2013 ECE 595, Prof. Bermel

    1 2 3 45 6 7 8 910

  • 7/29/2019 2013.01.28-ECE595E-L09

    6/18

    Electrostatic Potential Solution: 1D

    Approximate Laplacian in 1D with:

    2 1 2 + +12 Where h is the grid spacing

    Sets up the linear algebra problem:2 1 01 2 10 1 2

    0 0 0

    0 0 0

    0 0 0

    0 0 0

    0 0 0

    0 0 0

    2 1 0

    1 2 10 1 2

    123

    21

    =2

    123

    21

    1/28/2013 ECE 595, Prof. Bermel

  • 7/29/2019 2013.01.28-ECE595E-L09

    7/18

    Electrostatic Potential Solution: 1D

    In MATLAB, use:

    1/28/2013 ECE 595, Prof. Bermel

  • 7/29/2019 2013.01.28-ECE595E-L09

    8/18

    Electrostatic Potential Solution: 1D

    Use backslash operator to solve linear algebra

    problems of the form =

    1/28/2013 ECE 595, Prof. Bermel

    Charge distribution

    Electric potential

  • 7/29/2019 2013.01.28-ECE595E-L09

    9/18

    Electrostatic Potential Solution: 2D

    Connections in two directions creates a total of 5 non-vanishingdiagonals in our linear algebra problem:

    4 1 01

    4 1

    0 1 4

    1 0 0

    0 1 0

    0 0 1 1 0 0

    0 1 0

    0 0 1

    4 1 0

    1 4 10 1 4

    123

    21

    = 2

    123

    21

    1/28/2013 ECE 595, Prof. Bermel

  • 7/29/2019 2013.01.28-ECE595E-L09

    10/18

    Electrostatic Potential Solution: 2D

    1/28/2013 ECE 595, Prof. Bermel

    Charge distribution in 2D

    (7x7 grid)Electrostatic potential in 2D

    (7x7 grid)

  • 7/29/2019 2013.01.28-ECE595E-L09

    11/18

    Spin Array Example

    Consider an array of spins , coupled by anexchange interaction

    Ising-model Hamiltonian is given by:

    =

    +

    The brackets often are interpreted to meannearest-neighbor interactions only

    1/28/2013 ECE 595, Prof. Bermel

  • 7/29/2019 2013.01.28-ECE595E-L09

    12/18

    Spin Array Solution: 1D

    Convert Hamiltonian into matrix, assuming nearest neighborinteraction only:

    =

    0 0

    0 0 0

    0 0 0

    0 0 0

    0 0 00 0 0

    0 0 0

    0 0

    Use Schrodinger equation to set up eigenproblem:

    = Choose basis spinor wavefunction :

    = 1, 2, ,

    1/28/2013 ECE 595, Prof. Bermel

  • 7/29/2019 2013.01.28-ECE595E-L09

    13/18

    Spin Array Solution: 1D

    In MATLAB, use the following:

    1/28/2013 ECE 595, Prof. Bermel

  • 7/29/2019 2013.01.28-ECE595E-L09

    14/18

    Spin Array Solution: 1D

    1/28/2013 ECE 595, Prof. Bermel

  • 7/29/2019 2013.01.28-ECE595E-L09

    15/18

    Spin Array Solution: 2D

    Convert Hamiltonian into matrix, assuming nearest neighborinteractions in 2 directions:

    =

    0 0

    0 00 00 0

    0 00 00 0

    0 0

    Use Schrodinger equation to set up eigenproblem:

    = Choose basis spinor wavefunction :

    = 1, 2, ,

    1/28/2013 ECE 595, Prof. Bermel

  • 7/29/2019 2013.01.28-ECE595E-L09

    16/18

    Spin Array Solution: 2D

    In MATLAB, use the following:

    1/28/2013 ECE 595, Prof. Bermel

  • 7/29/2019 2013.01.28-ECE595E-L09

    17/18

    Spin Array Solution: 2D

    1/28/2013 ECE 595, Prof. Bermel

  • 7/29/2019 2013.01.28-ECE595E-L09

    18/18

    Next Class

    Is on Wednesday, Jan. 30

    Will discuss numerical tools for

    simulating eigenproblems further

    1/28/2013 ECE 595, Prof. Bermel