cad 2011 slides

Upload: mikexander

Post on 06-Apr-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 CAD 2011 Slides

    1/74

    Computing and CAD IIProfessor Jan K. Sykulski

    Computing and CADProfessor Jan Sykulski

    FIEEE, FIET, FInstP, FBCS, CEng, CITP

    Electrical Power Engineering

    School of Electronics & Computer Science

    University of Southampton, UK

    Computing and CAD IIProfessor Jan K. Sykulski

    Resources

    Core Resources

    Hammond P and Sykulski J K:Engineering Electromagnetism

    Oxford University Press 1994

  • 8/3/2019 CAD 2011 Slides

    2/74

  • 8/3/2019 CAD 2011 Slides

    3/74

    Computing and CAD IIProfessor Jan K. Sykulski

    Tubes and Slices

    trR

    11

    m

    m

    l

    S

    lm

    S

    lm

    S

    R

    m

    i

    m

    i

    11

    11

    S

    lm

    m

    S

    lrt

    m conductors in parallel:

    S

    lR

    n conductors in series: srR

    S

    n

    l

    rs

    n

    n

    S

    l

    S

    nl

    R

    n

    i

    1

    S

    lR

    Computing and CAD IIProfessor Jan K. Sykulski

    If tubes and slices are in correct position

    there is negligible effect as they are not disturbing the field.

    If they are not in correct position:

    tubes increase resistance giving R+ upper bound

    slices decrease resistance giving R lower bound

    Only in undisturbed field R = R+

    otherwise R < R < R+

  • 8/3/2019 CAD 2011 Slides

    4/74

    Computing and CAD IIProfessor Jan K. Sykulski

    Example

    I

    Ia

    a

    a2a

    slicestubes

    2a

    Computing and CAD IIProfessor Jan K. Sykulski

    Example

    I

    Ia

    a

    a2a

    slicestubes

    +

    2a

    depthunitpera

    aR 2

    2 depthunitper

    a

    a

    a

    aR 5.1

    2

    2a2a

    a a

    a

    a

  • 8/3/2019 CAD 2011 Slides

    5/74

    Computing and CAD IIProfessor Jan K. Sykulski

    Example

    I

    Ia

    a

    a2a

    )(22

    tubesdepthunitpera

    aR

    )(5.12

    slicesdepthunitpera

    a

    a

    aR

    2a

    depthunitperRR

    Rave 75.12

    5.12

    2

    )!(25.075.1: guaranteeddepthunitperRAnswer

    depthunitperRprogramelementfiniteafromresultAccurate 73.1:)(

    Computing and CAD IIProfessor Jan K. Sykulski

    Tubes and Slices

    t

    is

    jij

    r

    RwhereRIPower

    1

    1

    2

    1

    1

    s

    kt

    l lsr

    RwhereR

    VPower

    1

    1

    2

    1

    1

    Tubes:

    Slices:

    where for each r:

    S

    l

    S

    lr

  • 8/3/2019 CAD 2011 Slides

    6/74

    Computing and CAD IIProfessor Jan K. Sykulski

    Tubes and Slices

    I I

    2

    RRR

    ave

    Computing and CAD IIProfessor Jan K. Sykulski

    Tubes and Slices

    Constructionlines

  • 8/3/2019 CAD 2011 Slides

    7/74

    Computing and CAD IIProfessor Jan K. Sykulski

    Tubes and Slices

    Coarse

    tube/slicelines

    Computing and CAD IIProfessor Jan K. Sykulski

    Tubes and Slices

    Improvedtube/slicelines

  • 8/3/2019 CAD 2011 Slides

    8/74

    Computing and CAD IIProfessor Jan K. Sykulski

    Tubes and Slices

    Finite

    elementsolution

    Computing and CAD IIProfessor Jan K. Sykulski

    Tubes and Slices

    Resistance(per unit depth)

    [value material resistivity]

    Guaranteedaccuracy

    Actual error

    Hand calculation 2.7333 22.0 % 12.4 %

    TAS coarse 2.4388 9.5 % 0.3 %

    TAS refined 2.4324 4.0 % 0.3 %

    Finite elements 2.4316 0.9 % -

  • 8/3/2019 CAD 2011 Slides

    9/74

    Computing and CAD IIProfessor Jan K. Sykulski

    Classification ofmethods of fieldmodelling:

    analogue methods

    analytical solutions

    numerical methods

    (algebraical computation)

    graphical computation

    The most popularmethods:

    separation of variables

    images

    analogue techniques

    conformal transformations

    Laplace transforms

    transmission-line

    modelling

    finite differences

    finite elements

    boundary elements integral formulations

    tubes and slices

    ...

    Computing and CAD IIProfessor Jan K. Sykulski

    Review of field equations0

    2

    2

    2

    2

    2

    2

    z

    V

    y

    V

    x

    VLaplaces equation: where V is a function of position V(x,y,z)

    often written for convenience as:

    In two-dimensional problems (2D): 02

    2

    2

    2

    y

    V

    x

    Vwhere V(x,y)

    V could be an electrostatic potential or magnetostatic potential.

    02 V

    Some fields (e.g. a magnetic field) may be described using a vector potential:

    02 A where A(x,y,z) = Ax(x,y,z)i + Ay(x,y,z)j + Az(x,y,z)k

    02 xA

    02 zA

    02

    yA

  • 8/3/2019 CAD 2011 Slides

    10/74 1

    Computing and CAD IIProfessor Jan K. Sykulski

    Review of field equations

    Laplaces equation: 02 V

    02 A

    In two-dimensional problems (2D): kkA AAz kJ zJas

    where ),( yxA

    02 A

    02

    2

    2

    2

    y

    A

    x

    Aor

    Computing and CAD IIProfessor Jan K. Sykulski

    Review of field equationsLaplaces equation: 0

    2 V

    02 A

    Poissons equation:

    Helmholtz equation:

    Diffusion equation:

    Wave equation:

    fV 2

    022 VkV

    t

    V

    hV

    2

    2 1

    2

    222

    t

    VV

    FA 2

    fVkV 22

    homogeneous

    non-homogeneous

  • 8/3/2019 CAD 2011 Slides

    11/74

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite-difference method

    02

    boundarytheoneverywheredefined

    n

    or

    Equation specified inside:

    A unique solution exists!

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite-difference method

    i,j

  • 8/3/2019 CAD 2011 Slides

    12/74 1

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite-difference method

    i,j

    0:2'2

    2

    2

    22

    yxDinequationsLaplace

    ...

    !3!2,

    3

    33

    ,

    2

    22

    ,

    ,,1

    jijiji

    jijix

    x

    x

    x

    xx

    ...

    !3!2,

    3

    33

    ,

    2

    22

    ,

    ,,1

    jijiji

    jijix

    x

    x

    x

    xx

    Adding:

    4,

    2

    22

    ,,1,1 2 xOx

    x

    ji

    jijiji

    where O{(x)4} represents terms containing fourth and higher order powers ofx.

    Neglecting these terms yields:

    2,1,,1

    ,

    2

    2 2

    xx

    jijiji

    ji

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite-difference method

    i,j

    0:2'2

    2

    2

    2

    2

    yxDinequationsLaplace

    2,1,,1

    ,

    2

    2 2

    xx

    jijiji

    ji

    Similarly, under the same assumptions, in the y direction:

    21,,1,

    ,2

    2 2

    yy

    jijiji

    ji

    02121

    1,,1,2,1,,12

    jijijijijiji

    yx

  • 8/3/2019 CAD 2011 Slides

    13/74 1

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite-difference method

    i,j

    0:2'2

    2

    2

    22

    yxDinequationsLaplace

    02121

    1,,1,2,1,,12

    jijijijijiji

    yx

    If for convenience we choose a square mesh,

    so thatx = y :

    04 ,1,1,,1,1 jijijijiji

    or

    1,1,,1,1,

    4

    1 jijijijiji

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite-difference method

    0:2'2

    2

    2

    2

    2

    yxDinequationsLaplace

    02121

    1,,1,2,1,,12

    jijijijijiji

    yx

    A five-point computation scheme:

    04 ,1,1,,1,1 jijijijiji

    or

    1,1,,1,1,

    4

    1 jijijijiji

    If for convenience we choose a square mesh,

    so thatx = y :

    4

    1

    11

    1

    i 1 i +1i

    j 1

    j +1

    j

  • 8/3/2019 CAD 2011 Slides

    14/74 1

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite-difference method Example

    x

    y

    2 2

    2

    2

    4 4

    V= 100 V

    V= 0

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite-difference method Example

    x

    y V= 100 V V= 100 V

    V= 0

    V= 0

    y

    x

    0

    x

    V

    0

    y

    V

  • 8/3/2019 CAD 2011 Slides

    15/74 1

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite-difference method Example

    x

    y V= 100 V

    V= 0

    y

    x

    tube

    tube

    slice

    slice

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite-difference method Example

    x

    y V= 100 V V= 100 V

    V= 0

    V= 0

    y

    x

    0

    x

    V

    0

    y

    V

    V= 100 V

    V= 0

    1 2 3 4

    5

    2

    4Fictitious nodes

  • 8/3/2019 CAD 2011 Slides

    16/74 1

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite-difference method ExampleV= 100 V

    V= 0

    1 2 3 4

    5

    2

    4

    040100122 VVV

    040100231 VVV

    040100342

    VVV

    04100100453 VVV

    041000544 VVV

    100

    200

    100

    100

    100

    42000

    14100

    01410

    00141

    00024

    5

    4

    3

    2

    1

    V

    V

    V

    V

    V

    Ax=b

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite-difference method ExampleV= 100 V

    V= 0

    1 2 3 4

    5

    2

    4

    040100122

    VVV

    040100231 VVV

    040100342

    VVV

    04100100453

    VVV

    041000544

    VVV

    1,1,,1,1,41

    jijijijiji VVVVV

    4

    1

    11

    1

  • 8/3/2019 CAD 2011 Slides

    17/74 1

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite-difference method ExampleV= 100 V

    V= 0

    1 2 3 4

    5

    2

    4

    040100122 VVV

    040100231 VVV

    040100342

    VVV

    04100100453 VVV

    041000544 VVV

    1,1,,1,1,

    4

    1 jijijijiji VVVVV

    10024

    121

    VV

    1004

    1312

    VVV

    1004

    1423

    VVV

    2004

    1534

    VVV

    10024

    145

    VV

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite-difference method ExampleV= 100 V

    V= 0

    1 2 3 4

    5

    2

    4 10024

    121

    VV

    1004

    1312

    VVV

    1004

    1423

    VVV

    2004

    1534

    VVV

    10024

    145

    VV

    v1=0.0; v2=0.0; v3=0.0; v4=0.0; v5=0.0; iter=0;

    A simple iterative scheme:

    .

    .

    do {

    v1 = 0.25*(2*v2 +100);

    v2 = 0.25*(v1 + v3 +100);

    v3 = 0.25*(v2 + v4 +100);

    v4 = 0.25*(v3 + v5 +200);

    v5 = 0.25*(2*v4 +100);

    iter += 1;

    printf (%3d %6.2f %6.2f %6.2f %6.2f

    %6.2f\n,iter,v1,v2,v3,v4,v5):

    } while (iter < 20);

    .

  • 8/3/2019 CAD 2011 Slides

    18/74 1

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite-difference method ExampleV= 100 V

    V= 0

    An improved iterative scheme:

    introduce an array v[i,j] sweep the nodes in i (1 toM) andj (1 to N)

    i

    j

    identify the Neumann boundary nodes

    and apply the formula with fictitious nodes

    1,1,,1,

    24

    1 jijijiji VVVV

    1,,1,1, 241 jijijiji VVVV

    identify the special nodes

    and apply special formulae

    N

    M1

    1

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite-difference method ExampleV= 100 V

    V= 0

    An improved iterative scheme:

    introduce an array v[i,j]

    sweep the nodes in i (1 toM) andj (1 to N)

    i

    j

    identify the Neumann boundary nodes

    and apply the formula with fictitious nodes

    3,2,12,1, 41

    iiiji VVVV

    1004

    11,1,,1,

    jMjMjMji VVVV

    identify the special nodes

    and apply special formulae

    identify the nodes next to a boundary

    and apply relevant formulae

    1004

    11,,1,1,

    NiNiNiji VVVV

    M

    N

    11

  • 8/3/2019 CAD 2011 Slides

    19/74 1

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite-difference method ExampleV= 100 V

    V= 0

    An improved iterative scheme:

    introduce an array v[i,j] sweep the nodes in i (1 toM) andj (1 to N)

    i

    j

    identify the Neumann boundary nodes

    and apply the formula with fictitious nodes

    identify the special nodes

    and apply special formulae

    identify the nodes next to a boundary

    and apply relevant formulae

    M

    N

    11

    apply five-point formula to all other nodes 1,1,,1,1,

    4

    1 jijijijiji VVVVV

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite-difference method ExampleV= 100 V

    V= 0

    An improved iterative scheme:

    introduce an array v[i,j]

    sweep the nodes in i (1 toM) andj (1 to N)

    i

    j

    identify the Neumann boundary nodes

    and apply the formula with fictitious nodes

    identify the special nodes

    and apply special formulae

    identify the nodes next to a boundary

    and apply relevant formulae

    M

    N

    11

    apply five-point formula to all other nodes Can we accelerate

    the convergence?

  • 8/3/2019 CAD 2011 Slides

    20/74 2

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite-difference method Example

    i

    j i,j

    kji

    k

    ji

    k

    ji

    k

    ji

    k

    jiVVVVV

    1,,1

    )1(

    1,

    )1(

    ,1

    )1(

    ,

    4

    1

    New value availableOld value

    New Old

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite-difference method Example

    i

    j i,j

    kji

    k

    ji

    k

    ji

    k

    ji

    k

    ji VVVVV 1,,1)1(

    1,

    )1(

    ,1

    )1(

    ,4

    1

    k

    ji

    k

    ji

    k

    ji VV ,)1(

    ,

    )1(

    ,

    where k is an iteration count

    Let

    where is a residual

    or)1(

    ,,

    )1(

    ,

    kjik

    ji

    k

    ji VV

    Let

    )1(,,

    )1(,

    kji

    kji

    kji VV 1 < 2

    kji

    k

    ji

    k

    ji

    k

    ji

    k

    ji

    k

    ji

    k

    ji VVVVVVV ,1,,1)1(

    1,

    )1(

    ,1,

    )1(

    ,4

    1

    kjik jikjik jikjikji VVVVVV 1,,1)1( 1,)1( ,1,)1(,4

    11

    or

    five-point formulaover-relaxation

    SORSuccessive Over-Relaxation

  • 8/3/2019 CAD 2011 Slides

    21/74 2

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite-difference method ExampleV= 100 V

    V= 0

    An improved iterative scheme:

    introduce an array v[i,j] sweep the nodes in i (1 toM) andj (1 to N)

    i

    j

    identify the Neumann boundary nodes

    and apply the formula with fictitious nodes

    identify the special nodes

    and apply special formulae

    identify the nodes next to a boundary

    and apply relevant formulae

    M

    N

    11

    apply five-point formula to all other nodes

    apply SOR to accelerate convergence

    kjik

    ji

    k

    ji

    k

    ji

    k

    ji VVVVV 1,,1)1(

    1,

    )1(

    ,1

    )1(

    ,4

    1

    k

    ji

    k

    ji

    k

    ji VV ,)1(

    ,

    )1(

    ,

    )1(

    ,,

    )1(

    ,

    kjikjikji VV 1 < 2

    choose optimum value for

    Choosing opt problem dependent

    schemes for estimating opt

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite-difference method ExampleV= 100 V

    V= 0

    An improved iterative scheme:

    introduce an array v[i,j]

    sweep the nodes in i (1 toM) andj (1 to N)

    i

    j

    identify the Neumann boundary nodes

    and apply the formula with fictitious nodes

    identify the special nodes

    and apply special formulae

    identify the nodes next to a boundary

    and apply relevant formulae

    M

    N

    11

    apply five-point formula to all other nodes

    apply SOR to accelerate convergence

    k

    ji

    k

    ji

    k

    ji

    k

    ji

    k

    jiVVVVV

    1,,1

    )1(

    1,

    )1(

    ,1

    )1(

    , 4

    1

    k

    ji

    k

    ji

    k

    jiVV

    ,

    )1(

    ,

    )1(

    ,

    choose optimum value for

    monitor errors to terminate iterations%)1..(100

    max

    max

    )1(

    ,,

    gecriterionlocalV

    k

    jiji

    local

    %)5.0..(100

    1

    max

    ,

    )1(

    ,

    gecriterionglobalV

    NM ji

    k

    ji

    global

  • 8/3/2019 CAD 2011 Slides

    22/74 2

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite-difference method ExampleV= 100 V

    V= 0

    1 2 3 4

    5

    2

    4

    100

    200

    100

    100

    100

    42000

    14100

    01410

    00141

    00024

    5

    4

    3

    2

    1

    V

    V

    V

    V

    V

    Other methods of solvingAx=b exist

    SOR particularly easy to implement in FD

    Matrix sparsity may be explored

    Matrix symmetry may be an issue

    The pros and cons of the FD scheme

    intuitive and easy to implement

    SOR natural for a five point scheme writing a code relatively straightforward

    FD grid difficult to fit into practical devices

    curved boundaries awkward to handle mesh grading difficult

    boundary conditions require special schemes

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite-difference methodThe FD scheme for diffusion and wave problems (time derivatives)

    Diffusion equation in 1D: Wave equation in 1D:t

    V

    x

    V

    2

    2

    The time derivatives can be obtained with the aid of Taylors series:

    t

    VV

    t

    V kiki

    ,1,

    2

    2

    2

    2

    t

    V

    x

    V

    21,,1,

    2

    2 2

    t

    VVV

    t

    V kikiki

    tVV

    xVVV kikikikiki

    ,1,

    2

    ,1,,1 2 2

    1,,1,

    2

    ,1,,1 22t

    VVVx

    VVV kikikikikiki

    A new value of the potential (at a new time instant k+1)

  • 8/3/2019 CAD 2011 Slides

    23/74 2

    Computing and CAD IIProfessor Jan K. Sykulski

    The FD method for diffusion problem

    t

    x

    time

    space

    t= 0

    x = 0 x =L

    Boundary

    and initial conditions specified

    tVV

    x

    VVV kikikikiki

    ,1,2

    ,1,,12

    FD scheme:

    i,k+1

    i1,k i+1,ki,k

    xt

    Computing and CAD IIProfessor Jan K. Sykulski

    The FD method for wave problem

    t

    x

    time

    space

    t= 0

    x = 0 x =L

    Boundary

    and initial conditions specified

    FD scheme:

    i,k+1

    i1,k i+1,ki,k

    xt

    21,,1,

    2

    ,1,,122

    t

    VVV

    x

    VVV kikikikikiki

    i,k1

    Stability condition:

    1

    12

    x

    t

    To achieve good accuracy

    x must be small.

    But this necessitates very small

    time steps tand thus the scheme

    may be computationally inefficient.

  • 8/3/2019 CAD 2011 Slides

    24/74 2

    Computing and CAD IIProfessor Jan K. Sykulski

    The FD method for diffusion problem

    t

    x

    time

    space

    t= 0

    x = 0 x =L

    Boundary

    and initial conditions specified

    tVV

    x

    VVV kikikikiki

    ,1,2

    ,1,,12

    FD scheme:

    i,k+1

    i1,k i+1,ki,k

    xt

    Stability condition:

    21

    2

    x

    t

    To achieve good accuracy

    x must be small.

    But this necessitates very small

    time steps tand thus the scheme

    may be computationally inefficient.

    Explicit scheme.

    Computing and CAD IIProfessor Jan K. Sykulski

    The FD method for diffusion problemCrank & Nicolson (1947) introduced a scheme which is always convergent.

    is replaced by the mean of FD representations on time rows kandk+1:2

    2

    x

    V

    tVV

    x

    VVV

    x

    VVV kikikikikikikiki

    ,1,2

    ,1,,1

    2

    1,11,1,1 22

    2

    1

    so that kikikikikiki rVrVrrVrVVrrV ,1,,11,11,1,1 2222 where 2xt

    r

    We have 3 unknowns on the left and three known values on the right.

    With N nodes for each time row, N simultaneous equations need to be solved at each time step.

    Implicit scheme.

  • 8/3/2019 CAD 2011 Slides

    25/74 2

    Computing and CAD IIProfessor Jan K. Sykulski

    The FD method for diffusion problemA weighted average approximation:

    tVV

    x

    VVVRx

    VVVRkikikikikikikiki

    ,1,

    2

    ,1,,1

    2

    1,11,1,1 2)1(2

    where 0 R 1 R = 0 explicit scheme

    R = Crank - Nicolson

    R = 1 fully implicit

    backward scheme

    ImplicitExplicit Fully implicit

    Computing and CAD IIProfessor Jan K. Sykulski

    The FD method for diffusion problemA weighted average approximation:

    Rxt

    r212

    12

    tVV

    x

    VVVR

    x

    VVVR

    kikikikikikikiki

    ,1,2

    ,1,,1

    2

    1,11,1,1 2)1(

    2

    where 0 R 1 R = 0 explicit scheme

    R = Crank - Nicolson

    R = 1 fully implicit

    backward scheme

    ImplicitExplicit Fully implicit

    0 R < stable if

    R 1 unconditionally stable

  • 8/3/2019 CAD 2011 Slides

    26/74 2

    Computing and CAD IIProfessor Jan K. Sykulski

    The FD method for 2D problems

    Diffusion equation in 2D:t

    V

    y

    V

    x

    V

    2

    2

    2

    2

    i.e. solution on a rectangle.

    x

    y

    x

    y

    t

    time

    t

    Computing and CAD IIProfessor Jan K. Sykulski

    The FD method for 2D problemsExplicit scheme computationally laborious as very small t needed.

    x

    yt

    time

  • 8/3/2019 CAD 2011 Slides

    27/74 2

    Computing and CAD IIProfessor Jan K. Sykulski

    The FD method for 2D problems

    Crank- Nicolson MN simultaneous equations need to ne solved on each time step.

    x

    yt

    time

    Computing and CAD IIProfessor Jan K. Sykulski

    The FD method for 2D problemsAlternating Direction Implicit (ADI) method 25 times faster than explicit

    x

    yt

    time

    7 times faster than Crank-Nicolson

    and then the other way round. This process is repeated sequentially.

    One second derivative, say in x, replaced by implicitscheme, whereas the other one by explicit.

  • 8/3/2019 CAD 2011 Slides

    28/74 2

    Computing and CAD IIProfessor Jan K. Sykulski

    The pros and cons of the FD scheme

    intuitive and easy to implement

    SOR natural for a five point scheme writing a code relatively straightforward

    FD grid difficult to fit into practical devices

    curved boundaries awkward to handle mesh grading difficult

    boundary conditions require special schemes

    FD method: Alternative formulations

    Other issues:

    material boundaries and interfaces conducting and magnetic materials

    current carrying conductors

    induced eddy currents magnetic non-linearity

    Computing and CAD IIProfessor Jan K. Sykulski

    FD method: Alternative formulationsHelmholtz equation in x,y, coordinates

    sJAjy

    A

    yx

    A

    x

    where reluctivity

    1 and(x,y).

    x

    y

    1

    2

    3

    4

    0

    JNE ,NE,NEJNW ,NW,NW

    JSW ,SW,SW JSE ,SE,SE

    a

    bcd

    e

    f g h

    h1h3

    h4

    h2

    NW

    SE

    AjJx

    A

    y

    Acurl sz

    jior its curl form

  • 8/3/2019 CAD 2011 Slides

    29/74 2

    Computing and CAD IIProfessor Jan K. Sykulski

    FD method: Alternative formulationsApply Stokes theorem

    x

    y

    1

    2

    3

    4

    0

    JNE ,NE,NEJNW ,NW,NW

    JSW ,SW,SW JSE ,SE,SE

    a

    bcd

    e

    f g h

    h1h3

    h4

    h2

    NW

    SE

    AjJx

    A

    y

    Acurl sz

    ji

    lFsF ddcurland perform surface integration over the cell bdfg:

    dydxAjJdx

    A

    y

    AN

    S

    E

    W

    s

    lji

    where E=h1/2, N=h2/2, W=h3/2 and S=h4/2.

    On ab the contribution to the integral is:

    dyx

    Ady

    x

    A

    y

    A

    Ex

    N

    NE

    N

    00

    jji

    and the following approximation may be used:

    )(1

    01 NOh

    AAxA

    Ex

    and thus:

    1

    01

    0h

    AANdy

    x

    A

    y

    A NEN

    jji

    Computing and CAD IIProfessor Jan K. Sykulski

    FD method: Alternative formulations

    x

    y

    1

    2

    3

    4

    0

    JNE ,NE,NEJNW ,NW,NW

    JSW ,SW,SW JSE ,SE,SE

    a

    bcd

    e

    f g h

    h1h3

    h4

    h2

    NW

    SE

    dydxAjJdx

    A

    y

    AN

    S

    E

    W

    s

    ljiOn ab the contribution

    to the integral is:

    The complete line integral is therefore:

    lji dx

    A

    y

    A

    04321 A 44332211 AAAA

    where:

    1

    1h

    SN SENE

    2

    2h

    WENWNE

    3

    3h

    SN SWNW

    4

    4h

    WE SWSE

    1

    01

    0h

    AANdy

    x

    A

    y

    A NEN

    jji

  • 8/3/2019 CAD 2011 Slides

    30/74 3

    Computing and CAD IIProfessor Jan K. Sykulski

    FD method: Alternative formulations

    x

    y

    1

    2

    3

    4

    0

    JNE ,NE,NEJNW ,NW,NW

    JSW ,SW,SW JSE ,SE,SE

    a

    bcd

    e

    f g h

    h1h3

    h4

    h2

    NW

    SE

    dydxAjJdx

    A

    y

    AN

    S

    E

    W

    s

    lji

    The complete line integral:

    For the surface integral of the RHS consider the first quadrant:

    dydxAjNEJdydxAjJN E

    NENE

    N E

    s 0 00 0

    0

    0 0

    ANEdydxA

    N E

    200

    0 KOy

    Ay

    x

    AxAA

    A double Taylor expansion about node 0yields:

    and neglecting higher terms:

    4433221104321 AAAAAdx

    A

    y

    A

    lji

    Computing and CAD IIProfessor Jan K. Sykulski

    FD method: Alternative formulations

    x

    y

    1

    2

    3

    4

    0

    JNE ,NE,NEJNW ,NW,NW

    JSW ,SW,SW JSE ,SE,SE

    a

    bcd

    e

    f g h

    h1h3

    h4

    h2

    NW

    SE

    dydxAjJdx

    A

    y

    AN

    S

    E

    W

    s

    ljiAssembling all the pieces

    and expressing in terms of A0:

    04321

    0443322110

    Qj

    IAAAAA

    where

    SWSENWNE SWJSEJNWJNEJI 0

    SWSENWNE

    SWSENWNEQ 0

    and

    1

    1h

    SN SENE

    2

    2h

    WENWNE

    3

    3h

    SN SWNW

    4

    4h

    WE SWSE

  • 8/3/2019 CAD 2011 Slides

    31/74 3

    Computing and CAD IIProfessor Jan K. Sykulski

    FD method: Alternative formulations

    Assembling all the pieces

    and expressing in terms of A0:

    where

    SWSENWNE SWJSEJNWJNEJI 0

    SWSENWNE SWSENWNEQ 0

    and

    11 h

    SN SENE

    2

    2 h

    WE NWNE

    3

    3h

    SNSWNW

    4

    4h

    WE SWSE

    Assume: h1 = h2 = h3 = h4

    J = 0= 0

    = constant

    1 = 2 = 3= 4

    Q0 = 0

    I0 = 0

    04321

    0443322110

    Qj

    IAAAAA

    4

    43210

    AAAAA

    a five point computational scheme

    Computing and CAD IIProfessor Jan K. Sykulski

    FD method: Alternative formulationsGenerally:

    04321

    0443322110

    Qj

    IAAAAA

    where

    SWSENWNE SWJSEJNWJNEJI 0

    SWSENWNE

    SWSENWNEQ 0

    and

    1

    1h

    SN SENE

    2

    2h

    WENWNE

    3

    3h

    SN SWNW

    4

    4h

    WE SWSE

  • 8/3/2019 CAD 2011 Slides

    32/74 3

    Computing and CAD IIProfessor Jan K. Sykulski

    FD method: Alternative formulationsThree-dimensional FD solution of Laplacian and Poissonian problems

    (O) outside

    (I) inside(E) east

    (W) west

    (N) north

    (S) south

    1

    2

    3

    45

    6

    0

    div B = 0 and H = grad V

    div (H) = div ( grad V) = 0

    Apply Gauss theorem

    to the small volume surrounding node 0.

    sFF ddvdiv

    04

    1

    4

    1

    4

    4

    1

    4

    1

    4

    4

    2

    1

    4

    4

    2

    1

    4

    )303101

    6

    06

    303101

    5

    05

    316315

    0

    04

    6530

    3

    03

    316315

    0

    02

    6510

    1

    01

    SESWONEONWO

    SEISWINEINWI

    SEONEOSEINEI

    SEOSWOSEISWI

    SWONWOSWINWI

    NWONEONWINEI

    hrhhrhh

    VV

    hrhhrhh

    VV

    hhhhhhr

    VV

    hhhrh

    VV

    hhhhhhr

    VV

    hhhrh

    VV

    A seven-point computational scheme

    to calculate V0 in terms of the potentials

    in the six surrounding nodes.

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element methodThe pros and cons of the FD scheme

    intuitive and easy to implement

    SOR natural for a five point scheme

    writing a code relatively straightforward

    FD grid difficult to fit into practical devices

    curved boundaries awkward to handle mesh grading difficult

    boundary conditions require special schemes

    The FE scheme

    less intuitive

    much more difficult to implement

    writing a code challanging

    FE mesh easy to fit into practical devices

    curved boundaries simple to handle mesh grading possible and effective

    boundary conditions naturally satisfied

  • 8/3/2019 CAD 2011 Slides

    33/74 3

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element method

    The similarities and differences between FD and FE methods

    both rely on discrete representation of the solution

    a grid or mesh of nodes is needed

    for better accuracy a fine grid/mesh is required

    both lead to a large system of equations Ax=b

    solution of this equation is computationally expensive

    local and global errors need to be monitored

    visualisation and post-processing challenging because of large amounts of data

    But:

    FD solution defined on a set of nodes only, FE solution described everywhere

    FD grid restricted because of parallel lines, FE mesh flexible

    boundary conditions in FE naturally satisfiedNote:

    if FD grid and FE mesh matching identical final system of equations

    Computing and CAD IIProfessor Jan K. Sykulski

    Coarse mesh

    -6-4

    -20

    24

    6

    -6-4

    -20

    24

    60

    5

    10

    15

    20

    The finite element method

  • 8/3/2019 CAD 2011 Slides

    34/74 3

    Computing and CAD IIProfessor Jan K. Sykulski

    Mesh refinement

    -6-4

    -20

    24

    6

    -6-4

    -20

    24

    60

    5

    10

    15

    20

    -6-4

    -20

    24

    6

    -6-4

    -20

    24

    60

    5

    10

    15

    20

    -6-4

    -20

    24

    6

    -6-4

    -20

    24

    60

    5

    10

    15

    20

    The finite element method

    Computing and CAD IIProfessor Jan K. Sykulski

    2D mesh

  • 8/3/2019 CAD 2011 Slides

    35/74 3

    Computing and CAD IIProfessor Jan K. Sykulski

    3D meshes

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element method

    02

    2

    2

    22

    y

    V

    x

    VV

    Consider Laplacian equation in 2D for an electrostatic system

    where the electric fieldE is given by

    jiE

    y

    V

    x

    VVVgrad

    The stored field energy:

    dVdy

    V

    x

    V

    dEdW

    2

    22

    2

    2

    1

    2

    1

    2

    1

    2

    1

    DE

    The principle of equilibrium requires that the potential distribution must be such as to

    minimise the stored field energy. This minimum-energy principle is mathematically equivalent

    to our original differential equation in the sense that that a potential distribution which

    satisfies Laplaces equation will also minimise the energy, and vice versa.

    where integration is carried out over a 2D region, and is thud taken per unit length/depth.

  • 8/3/2019 CAD 2011 Slides

    36/74 3

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element method

    ...22

    fyexdxycybxaV

    Consider a single element and the following approximating polynomial

    We choose as many terms as there are nodes in the element:

    First order triangle

    Second order triangle

    Rectangle

    1

    2

    3

    1

    2

    3

    4

    56

    1 2

    34

    cybxaV

    22fyexdxycybxaV

    dxycybxaV

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element methodFirst order triangular element

    1

    2

    3

    cybxaV

    In the three vertices (nodes) the potential is

    333

    222

    111

    cybxaV

    cybxaV

    cybxaV

    or

    c

    b

    a

    yx

    yx

    yx

    V

    V

    V

    33

    22

    11

    3

    2

    1

    1

    1

    1

    and rearranging

    3

    2

    1

    1

    33

    22

    11

    11

    1

    VV

    V

    yxyx

    yx

    cb

    a

    and substituting back yields:

    3

    2

    1

    1

    33

    22

    11

    1

    1

    1

    1

    V

    V

    V

    yx

    yx

    yx

    yxV or

    3

    1

    ,i

    ii yxVV

  • 8/3/2019 CAD 2011 Slides

    37/74 3

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element methodFirst order triangular element

    1

    2

    3

    3

    2

    1

    1

    33

    22

    11

    1

    1

    1

    1

    VV

    V

    yxyx

    yx

    yxV 3

    1

    ,i

    ii yxVV

    where

    yxxxyyyxyxA

    2332233212

    1

    yxxxyyyxyxA

    3113311322

    1

    yxxxyyyxyxA

    1221122132

    1

    where A is the element area

    At the vertices:

    12

    2

    2

    1,

    1231322332111 A

    Ayxxxyyyxyx

    Ayx

    02

    1, 2232322332221 yxxxyyyxyx

    Ayx

    02

    1, 3233322332331 yxxxyyyxyx

    Ayx

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element methodFirst order triangular element

    1

    2

    3

    3

    2

    1

    1

    33

    22

    11

    1

    1

    1

    1

    V

    V

    V

    yx

    yx

    yx

    yxV

    3

    1

    ,i

    ii yxVV

    where

    yxxxyyyxyxA

    2332233212

    1

    yxxxyyyxyxA

    3113311322

    1

    yxxxyyyxyxA

    122112213

    2

    1

    where A is the element area

    In general

    jiyx jji 0,

    ji 1

    x

    y

    1

    2

    3

    1

    1

    Each function vanishes at all vertices but one,

    where it assumes the value of one.

    23

  • 8/3/2019 CAD 2011 Slides

    38/74 3

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element methodFirst order triangular element

    1

    2

    3

    3

    1

    ,

    i

    ii yxVV

    e

    edSVW

    2)(

    2

    1

    We can now associate energy with each element,

    and remembering that in 2D this energy will be

    taken per unit length/depth we write

    where integration is performed over the element area.

    Using

    3

    1

    ,i

    ii yxVV we find

    3

    1

    ,i

    ii yxVV

    so that the element energy becomesj

    i j

    j

    e

    ii

    eVdSVW

    3

    1

    3

    1

    )(

    2

    1

    which may be written in a compact form VNVWeTe )()(

    2

    1

    where [V] is the vector of vertex values of potential, the superscript T denotes transposition,

    and the 33 square element matrix [N](e) is defined bydSN j

    e

    i

    e

    ji )(

    ,

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element methodFirst order triangular element

    1

    2

    3

    3

    1

    ,i

    ii yxVV

    dSN je

    i

    e

    ji )(

    ,

    VNVW eTe )()(2

    1

    yxxxyyyxyxA

    2332233212

    1

    yxxxyyyxyxA

    3113311322

    1

    yxxxyyyxyxA

    1221122132

    1

    jiji2332

    111

    2

    1xxyy

    Ayx

    jiji3113

    222

    2

    1xxyy

    Ayx

    jiji1221

    333

    2

    1xxyy

    Ayx

  • 8/3/2019 CAD 2011 Slides

    39/74 3

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element methodFirst order triangular element

    1

    2

    3

    3

    1

    ,

    i

    ii yxVV

    dSN je

    i

    e

    ji )(

    ,

    VNVW eTe )()( 21

    jiji2332

    111

    2

    1xxyy

    Ayx

    jiji3113

    222

    2

    1xxyy

    Ayx

    jiji1221

    333

    2

    1xxyy

    Ayx

    The scalar product of two vectors, say a andb,

    in a Cartesian coordinate system in 2D:

    jijiba yxyx bbaa

    jjijjiii yyxyyxxx babababa

    yyxx baba

    223

    2

    32

    )(

    1,14

    1xxyy

    AN

    e

    31231332

    )(

    2,14

    1xxxxyyyy

    AN

    e

    12232132

    )(

    3,14

    1xxxxyyyy

    AN

    e

    23313213

    )(

    1,24

    1xxxxyyyy

    AN

    e

    231

    2

    13

    )(

    2,24

    1xxyy

    AN

    e

    12312113

    )(

    3,24

    1xxxxyyyy

    AN

    e

    23123221)(

    1,341 xxxxyyyyA

    N e

    31121321

    )(

    2,34

    1xxxxyyyy

    AN

    e

    212

    2

    21

    )(

    3,34

    1xxyy

    AN

    e

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element methodFirst order triangular element

    1

    2

    3

    3

    1

    ,i

    ii yxVV

    VNVW eTe )()(2

    1

    223

    2

    32

    )(

    1,14

    1xxyy

    AN

    e

    31231332

    )(

    2,14

    1xxxxyyyy

    AN

    e

    12232132

    )(

    3,14

    1xxxxyyyy

    AN

    e

    23313213

    )(

    1,24

    1xxxxyyyy

    AN

    e

    2312

    13

    )(

    2,241 xxyyA

    Ne

    12312113

    )(

    3,24

    1xxxxyyyy

    AN

    e

    23123221

    )(

    1,34

    1xxxxyyyy

    AN

    e

    31121321

    )(

    2,34

    1xxxxyyyy

    AN

    e

    212

    2

    21

    )(

    3,34

    1xxyy

    AN

    e

    This completes the specification for an

    arbitrary element in the finite-element mesh.

    The total energy associated with the entire

    region will be found as the sum of individual

    element energies:

    elementsAlleWW )(

  • 8/3/2019 CAD 2011 Slides

    40/74 4

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element methodFirst order triangular element

    1

    2

    3

    3

    1

    ,

    i

    ii yxVV

    VNVW eTe )()( 21

    This completes the specification for an

    arbitrary element in the finite-element mesh.

    The total energy associated with the entire

    region will be found as the sum of individual

    element energies:

    elementsAll

    eWW

    )(

    When assembling elements we notice that

    some nodes will be shared between elements.The global matrix must reflect the way in

    which individual elements are linked.

    12

    3

    1

    4

    3

    8

    5

    6

    7

    2

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element method Example

    x

    y

    0 2

    1

    V= 0 V= 100

    0

    y

    V

    0

    y

    V

    x

    y

    V= 0 V= 100

    1 2

    3

    11

    1

    2

    2

    2 3

    3

    3

    A

    B CD

    1

    2 34

    56

    Node

    number x-coordinate y-coordinate Potential

    1 1 0 ?

    2 1 1 ?

    3 2 1 100

    4 0 1 0

    5 2 0 100

    6 0 0 0

    Element Vertex 1 Vertex 2 Vertex 3

    A 6 1 2

    B 6 4 2

    C 1 2 3

    D 1 5 3

  • 8/3/2019 CAD 2011 Slides

    41/74 4

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element method Example

    x

    y

    V= 0 V= 100

    1 2

    3

    11

    1

    2

    2

    2 3

    3

    3

    A

    B CD

    1

    234

    56

    Node

    number x-coordinate y-coordinate Potential

    1 1 0 ?

    2 1 1 ?

    3 2 1 100

    4 0 1 0

    5 2 0 100

    6 0 0 0

    Element Vertex 1 Vertex 2 Vertex 3

    A 6 1 2

    B 6 4 2

    C 1 2 3

    D 1 5 3

    The element matrices may now be determined.

    For each element we need the 33 matrix

    based on the coordinates of the vertices andthe size of the element.

    223

    2

    32

    )(

    1,14

    1xxyy

    AN

    e

    31231332

    )(

    2,14

    1xxxxyyyy

    AN e

    12232132

    )(

    3,14

    1xxxxyyyy

    AN

    e

    23313213

    )(

    1,24

    1xxxxyyyy

    AN

    e

    231

    2

    13

    )(

    2,24

    1xxyy

    AN

    e

    12312113

    )(

    3,24

    1xxxxyyyy

    AN

    e

    23123221)(

    1,34

    1xxxxyyyy

    AN e

    31121321

    )(

    2,34

    1xxxxyyyy

    AN e

    212

    2

    21

    )(

    3,34

    1xxyy

    AN

    e

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element method Example

    x

    y

    V= 0 V= 100

    1 2

    3

    11

    1

    2

    2

    2 3

    3

    3

    A

    B CD

    1

    2 34

    56

    Node

    number x-coordinate y-coordinate Potential

    1 1 0 ?

    2 1 1 ?

    3 2 1 100

    4 0 1 0

    5 2 0 100

    6 0 0 0

    Element Vertex 1 Vertex 2 Vertex 3

    A 6 1 2

    B 6 4 2

    C 1 2 3

    D 1 5 3

    The element matrices may now be determined.

    For example, for element A:

    01

    11

    10

    2112

    1331

    3223

    yyxx

    yyxx

    yyxx

    and the element area A=0.5.

  • 8/3/2019 CAD 2011 Slides

    42/74 4

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element method Example

    x

    y

    V= 0 V= 100

    1 2

    3

    11

    1

    2

    2

    2 3

    3

    3

    A

    B CD

    1

    234

    56

    Node

    number x-coordinate y-coordinate Potential

    1 1 0 ?

    2 1 1 ?

    3 2 1 100

    4 0 1 0

    5 2 0 100

    6 0 0 0

    Element Vertex 1 Vertex 2 Vertex 3

    A 6 1 2

    B 6 4 2

    C 1 2 3

    D 1 5 3

    The element matrices may now be determined.

    For example, for element A:

    223

    2

    32

    )(

    1,14

    1xxyy

    AN

    A

    01

    1110

    2112

    1331

    3223

    yyxx

    yyxxyyxx and the element

    area A=0.5.

    Thus:

    2

    101

    2

    1 22

    31231332

    )(

    2,14

    1xxxxyyyy

    AN

    A

    2

    11011

    2

    1

    and so on giving the matrix for elementA as

    2

    1

    2

    10

    211

    21

    02

    1

    2

    1

    AN

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element method Example

    x

    y

    V= 0 V= 100

    1 2

    3

    11

    1

    2

    2

    2 3

    3

    3

    A

    B CD

    1

    2 34

    56

    Node

    number x-coordinate y-coordinate Potential

    1 1 0 ?

    2 1 1 ?

    3 2 1 100

    4 0 1 0

    5 2 0 100

    6 0 0 0

    Element Vertex 1 Vertex 2 Vertex 3

    A 6 1 2

    B 6 4 2

    C 1 2 3

    D 1 5 3

    This process needs to be repeated for each

    element of the; however, careful inspection of

    elementsB, CandD reveals that, in our

    example, all four elements matrices are the

    same, i.e.:

    This is of course a happy coincidence, or

    rather a clever use of proportions and local

    node numbering, to save some work.

    In general the element matrices

    are all different !

    2

    1

    2

    10

    2

    11

    2

    1

    02

    1

    2

    1

    DCBANNNN

  • 8/3/2019 CAD 2011 Slides

    43/74 4

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element method Example

    x

    y

    V= 0 V= 100

    1 2

    3

    11

    1

    2

    2

    2 3

    3

    3

    A

    B CD

    1

    234

    56

    A global matrix may now be assembled.

    Initially all entries are zero.

    000000

    000000

    000000

    000000

    000000

    000000

    N

    Element Vertex 1 Vertex 2 Vertex 3

    A 6 1 2

    B 6 4 2

    C 1 2 3

    D 1 5 3

    2

    1

    2

    10

    2

    11

    2

    1

    0

    2

    1

    2

    1

    DCBANNNN

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element method Example

    x

    y

    V= 0 V= 100

    1 2

    3

    11

    1

    2

    2

    2 3

    3

    3

    A

    B CD

    1

    2 34

    56

    A global matrix may now be assembled.

    For element A:

    2

    10000

    2

    1000000

    000000

    000000

    00002

    1

    2

    121000

    211

    N

    222126

    121116

    626166

    NNN

    NNN

    NNN

    NA

    Element Vertex 1 Vertex 2 Vertex 3

    A 6 1 2

    B 6 4 2

    C 1 2 3

    D 1 5 3

    2

    1

    2

    10

    2

    11

    2

    1

    02

    1

    2

    1

    DCBANNNN

  • 8/3/2019 CAD 2011 Slides

    44/74 4

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element method Example

    x

    y

    V= 0 V= 100

    1 2

    3

    11

    1

    2

    2

    2 3

    3

    3

    A

    B CD

    1

    234

    56

    A global matrix may now be assembled.

    For element B:

    2

    1

    2

    10

    2

    100

    2

    1000000

    2

    10102

    10

    000000

    002

    10

    2

    1

    2

    1

    2

    12

    1000

    2

    11

    N

    222426

    424446

    626466

    NNN

    NNN

    NNN

    NB

    Element Vertex 1 Vertex 2 Vertex 3

    A 6 1 2

    B 6 4 2

    C 1 2 3

    D 1 5 3

    2

    1

    2

    10

    2

    11

    2

    1

    0

    2

    1

    2

    1

    DCBANNNN

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element method Example

    x

    y

    V= 0 V= 100

    1 2

    3

    11

    1

    2

    2

    2 3

    3

    3

    A

    B CD

    1

    2 34

    56

    A global matrix may now be assembled.

    For element C:

    2

    1

    2

    10

    2

    100

    2

    1000000

    2

    1010

    2

    10

    0002

    1

    2

    10

    002

    1

    2

    11

    2

    1

    2

    1

    2

    1

    2

    12

    1

    0002

    1

    2

    1

    2

    1

    1

    N

    333231

    232221

    131211

    NNN

    NNN

    NNN

    NC

    2

    1

    2

    10

    2

    11

    2

    1

    02

    1

    2

    1

    DCBANNNN

    Element Vertex 1 Vertex 2 Vertex 3

    A 6 1 2

    B 6 4 2

    C 1 2 3

    D 1 5 3

  • 8/3/2019 CAD 2011 Slides

    45/74 4

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element method Example

    x

    y

    V= 0 V= 100

    1 2

    3

    11

    1

    2

    2

    2 3

    3

    3

    A

    B CD

    1

    234

    56

    Element Vertex 1 Vertex 2 Vertex 3

    A 6 1 2

    B 6 4 2

    C 1 2 3

    D 1 5 3

    A global matrix may now be assembled.

    For element D:

    2

    1

    2

    10

    2

    100

    2

    1

    0102

    10

    2

    12

    10102

    10

    02

    10

    2

    1

    2

    1

    2

    10

    002

    1

    2

    11

    2

    1

    2

    1

    2

    1

    2

    12

    1

    2

    100

    2

    1

    2

    1

    2

    1

    2

    11

    N

    333531

    535551

    131511

    NNN

    NNN

    NNN

    ND

    2

    1

    2

    10

    2

    11

    2

    1

    02

    1

    2

    1

    DCBANNNN

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element method Example

    x

    y

    V= 0 V= 100

    1 2

    3

    11

    1

    2

    2

    2 3

    3

    3

    A

    B CD

    1

    2 34

    56

    105.0005.0

    0105.005.0

    5.00105.00

    05.0015.00

    005.05.021

    5.05.00012

    N

    2

    1

    2

    10

    2

    100

    2

    1

    0102

    10

    2

    12

    1010

    2

    10

    02

    10

    2

    1

    2

    1

    2

    10

    002

    1

    2

    112

    1

    2

    1

    2

    1

    2

    1

    2

    1

    2

    100

    2

    1

    2

    1

    2

    1

    2

    11

    N

  • 8/3/2019 CAD 2011 Slides

    46/74 4

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element method Example

    x

    y

    V= 0 V= 100

    1 2

    3

    11

    1

    2

    2

    2 3

    3

    3

    A

    B CD

    1

    234

    56

    105.0005.0

    0105.005.0

    5.00105.00

    05.0015.00

    005.05.021

    5.05.00012

    N

    To minimise the total energy we must differentiate

    with respect to a typical value of Vkand equate to

    zero:

    VNVW T2

    1

    0

    kV

    W

    where k refers to node numbers in the global

    numbering system. However, some nodes will

    have a prescribed potential (e.g. on the

    boundary) and we can differentiate only with

    respect to free nodes.

    0][

    ][

    ][][

    ][][][][

    ][

    p

    f

    pppf

    fpffT

    p

    T

    f

    kfkV

    V

    NN

    NNVV

    VV

    W

    Differentiation with respect to the free potentials

    results in the following matrix equation:

    0][

    ][]][][[

    p

    ffpff

    V

    VNN

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element method Example

    x

    y

    V= 0 V= 100

    1 2

    3

    11

    1

    2

    2

    2 3

    3

    3

    A

    B CD

    1

    2 34

    56

    0][

    ][]][][[

    p

    ffpff

    V

    VNN

    105.0005.0

    0105.005.0

    5.00105.00

    05.0015.00

    005.05.021

    5.05.00012

    N

    ]][[]][[ pfpfff VNVN

    ]][[][][1

    pfpfff VNNV

    Formal solution:

    In our example:

    502

    502

    21

    21

    VV

    VV

    5021

    VV

    6

    5

    43

    2

    1

    005.05.0

    5.05.000

    21

    12

    V

    V

    V

    V

    V

    V

  • 8/3/2019 CAD 2011 Slides

    47/74 4

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element method Example

    x

    y

    V= 0 V= 100

    1 2

    3

    11

    1

    2

    2

    2 3

    3

    3

    A

    B CD

    1

    234

    56

    105.0005.0

    0105.005.0

    5.00105.00

    05.0015.00

    005.05.021

    5.05.00012

    N

    ]][[]][[ pfpfff VNVN

    ]][[][][1

    pfpfff VNNV

    Final equation:

    Formal solution:

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element method Example

    x

    y

    V= 0 V= 100

    1 2

    3

    11

    1

    2

    2

    2 3

    3

    3

    A

    B CD

    1

    2 34

    56

    105.0005.0

    0105.005.0

    5.00105.00

    05.0015.00

    005.05.021

    5.05.00012

    N

    ]][[]][[ pfpfff VNVN

    bxA

    Final equation:

    This is in the form:

    Comments:

    [Nff] (orA) may be a very large matrix

    b is given by sources (boundary conditions)

    A is normally sparse (we cannot see this here)

    A is often symmetrical

  • 8/3/2019 CAD 2011 Slides

    48/74 4

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element method Example 2Consider a topologically regular mesh:

    1

    2

    3

    4

    5

    21

    22

    23

    24

    25

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    17

    18

    19

    20

    All these meshes are topologically identical!

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element method Example 2

    1

    2

    3

    4

    5

    121

    22

    23

    24

    25

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    17

    18

    19

    20The global matrix may be partitioned as follows:

    ][][][

    ][][][

    ][][][

    ][

    pppfpp

    fpfffp

    pppfpp

    NNN

    NNN

    NNN

    N

    The [Nff] sub-matrix is of particular interest:

    6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

    6 0 0 0 0 0 0 0 0 0 0 0

    7 0 0 0 0 0 0 0 0 0

    8 0 0 0 0 0 0 0 0 0

    9 0 0 0 0 0 0 0 0 010 0 0 0 0 0 0 0 0 0 0 0

    11 0 0 0 0 0 0 0 0 0

    12 0 0 0 0 0 0

    13 0 0 0 0 0

    14 0 0 0 0 0 0

    15 0 0 0 0 0 0 0 0 0

    16 0 0 0 0 0 0 0 0 0 0 0

    17 0 0 0 0 0 0 0 0 0

    18 0 0 0 0 0 0 0 0 0

    19 0 0 0 0 0 0 0 0 0

    20 0 0 0 0 0 0 0 0 0 0 0

  • 8/3/2019 CAD 2011 Slides

    49/74 4

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element method Example 2

    1

    2

    3

    4

    5

    121

    22

    23

    24

    25

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    17

    18

    19

    20The non-zero elements may be numbered:

    6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

    6 0 0 0 0 0 0 0 0 0 0 0

    7 0 0 0 0 0 0 0 0 0

    8 0 0 0 0 0 0 0 0 0

    9 0 0 0 0 0 0 0 0 0

    10 0 0 0 0 0 0 0 0 0 0 0

    11 0 0 0 0 0 0 0 0 0

    12 0 0 0 0 0 0

    13 0 0 0 0 0

    14 0 0 0 0 0 0

    15 0 0 0 0 0 0 0 0 0

    16 0 0 0 0 0 0 0 0 0 0 0

    17 0 0 0 0 0 0 0 0 0

    18 0 0 0 0 0 0 0 0 0

    19 0 0 0 0 0 0 0 0 0

    20 0 0 0 0 0 0 0 0 0 0 0

    15274553

    1426354452

    1325344351

    1224334250

    113241

    10234049

    922313948

    821303847

    720293746

    62836

    519

    418

    317

    216

    1

    The matrix is symmetrical.

    Only 53 values need to be stored(instead of 1515=225)

    Computing and CAD IIProfessor Jan K. Sykulski

    The finite element method Example 2

    1

    2

    3

    4

    5

    121

    22

    23

    24

    25

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    17

    18

    19

    20The non-zero elements may be numbered:

    15274553

    1426354452

    1325344351

    1224334250

    113241

    10234049

    922313948

    821303847

    720293746

    62836

    519

    418

    317

    216

    1

    For example:

    272625242322212019181716

    151413121110987654321

    4553

    354452

    344351

    334250

    3241

    4049

    313948

    303847

    293746

    2836

    +

    60 values stored rather than 1515=225.

  • 8/3/2019 CAD 2011 Slides

    50/74 5

    Computing and CAD IIProfessor Jan K. Sykulski

    The art of sparse matrices Example

    1

    2

    3 4

    56

    7

    8

    9

    The matrix:

    Due to symmetry, half of this 99 matrix needs to be stored and there are 25 non-zero elements.

    A simple storage scheme places the non-zero elements in a linear array and complements this

    array with two integer arrays which store the corresponding row and column numbers.

    11 21 51 22 32 42 52 33 43 44 54 74 84 55 65 75 66 76 96 77 87 97 88 98 99

    1 2 5 2 3 4 5 3 4 4 5 7 8 5 6 7 6 7 9 7 8 9 8 9 9

    1 1 1 2 2 2 2 3 3 4 4 4 4 5 5 5 6 6 6 7 7 7 8 8 9

    elements

    row

    column

    11 21 51 22 32 42 52 33 43 44 54 74 84 55 65 75 66 76 96 77 87 97 88 98 99

    1 2 5 2 3 4 5 3 4 4 5 7 8 5 6 7 6 7 9 7 8 9 8 9 9

    elements

    row

    1 4 8 10 14 17 20 23 25 pointers identifying the beginning points of columns.

    99989796

    888784

    77767574

    6665

    55545251

    444342

    3332

    2221

    11

    Computing and CAD IIProfessor Jan K. Sykulski

    The art of sparse matrices Example

    1

    2

    3 4

    56

    7

    8

    9

    The matrix:

    A profile storage scheme:

    11 21 22 32 33 42 43 44 51 52 . 54 55 65 66 74 75 76 77 84 . . 87 88 96 97 98 99

    1 1 2 2 1 5 4 4 6

    1 3 5 8 13 15 19 24 28

    column number of the beginning of each row.

    the diagonal element which forms the end of each row.

    Strictly speaking the second integer array is not necessary as the ending of a row is always

    on the main diagonal. However, the addressing functions become much more complicated.

    99989796

    888784

    77767574

    6665

    55545251

    444342

    3332

    2221

    11

  • 8/3/2019 CAD 2011 Slides

    51/74 5

    Computing and CAD IIProfessor Jan K. Sykulski

    Solving Ax = b

    All numerical schemes (except TAS) lead to Ax = b

    FD and FE formulations result in very large systems of equations

    The A matrix is very sparse

    A is often symmetrical

    Efficient storage systems are required

    Fast and accurate computation is needed

    Computing and CAD IIProfessor Jan K. Sykulski

    Solving Ax = b ExampleElimination method

    Gaussian elimination:

    addand3

    1

    addand3

    2

    222

    1132

    1223

    321

    321

    321

    xxx

    xxx

    xxx

    addand7

    4

    1874

    2177

    1223

    32

    32

    321

    xx

    xx

    xxx

    Forward elimination

    23 x

    12 x

    4221

    2177

    1223

    3

    32

    321

    x

    xx

    xxx 31 x Backward substitution

    Two steps:

    1

    2

  • 8/3/2019 CAD 2011 Slides

    52/74 5

    Computing and CAD IIProfessor Jan K. Sykulski

    Solving Ax = b ExampleElimination method

    Gaussian elimination in matrix notation:

    2

    11

    12

    122

    321

    213

    3

    2

    1

    x

    x

    x Compose anaugmented matrix

    and apply elementary

    raw transformations:

    Elementary Row and Column operations (transformations):1. Interchanging two rows or columns,2. Adding a multiple of one row or column to another,3. Multiplying any row or column by a nonzero element.

    2122

    11321

    12213

    :bA

    Computing and CAD IIProfessor Jan K. Sykulski

    Solving Ax = b ExampleElimination method

    Gaussian elimination in matrix notation:

    2

    11

    12

    122

    321

    213

    3

    2

    1

    x

    x

    x Compose anaugmented matrix

    and apply elementary

    raw transformations:

    2122

    11321

    12213

    :bA

    2122

    11321

    12213

    18740

    21770

    12213

    422100

    21770

    12213

    13

    12

    )2(3

    )1(3

    RR

    RR

    23 47 RR

    422100

    210210

    16802163

    422100210210

    1890063

    2100

    1010

    3001

    23

    13

    3

    212

    RR

    RR

    12 RR

    21/1

    21/1

    63/1

    2

    1

    3

    xHence:

  • 8/3/2019 CAD 2011 Slides

    53/74 5

    Computing and CAD IIProfessor Jan K. Sykulski

    Solving Ax = b ExampleElimination method

    2122

    1132112213

    18740

    2177012213

    422100

    21770

    12213

    13

    12

    )2(3

    )1(3

    RR

    RR

    23 47 RR

    422100

    210210

    16802163

    422100210210

    1890063

    23

    13

    3

    212

    RR

    RR

    12 RR

    21/1

    21/1

    63/1

    2100

    1010

    3001

    Forward elimination

    Backward substitutionNotes: watch for zeros on the diagonal interchanging rows

    multiplications lead to very large numbers subtractR1ai1/a11 fromRi, etc

    rearrange equations so that largest coefficient is on diagonal at each step pivoting scaling dividing each row by the magnitude of the largest coefficient

    so that all coefficients have the same order of magnitude reduce round-off errors

    Computing and CAD IIProfessor Jan K. Sykulski

    Solving Ax = bElimination method

    Steps:1. Augmentnn matrix into n(n+1) matrix andscale.

    2. Change rows so that a11 has the largest magnitude.

    3. SubtractR1ai1/a11from rows 2 to n.

    4. Repeat 2 and 3 for subsequent rows:

    Rjaij/ajj for rows i=j+1 to n.

    5. Solvexn=bn/ann6. Solve xn1,xn2,xn3 x2,x1 where

    nnnnnn

    n

    n

    b

    b

    b

    x

    x

    x

    aaa

    aaa

    aaa

    2

    1

    2

    1

    21

    22221

    11211

    nnnnn

    n

    n

    baaa

    baaa

    baaa

    21

    222221

    111211

    nnn

    n

    n

    ba

    baa

    baaa

    ''00

    '''0

    ''''

    2222

    111211

    n

    ij

    jijiii

    i xaba

    x

    1

    '''1

  • 8/3/2019 CAD 2011 Slides

    54/74 5

    Computing and CAD IIProfessor Jan K. Sykulski

    Solving Ax = b A = LUTriangular decomposition

    100

    101

    0

    00

    2

    112

    21

    2221

    11

    21

    22221

    11211

    n

    n

    nnnnnnnn

    n

    nuuu

    lll

    lll

    aaa

    aaaaaa

    LUA

    nnnn

    n

    n

    lll

    ull

    uul

    21

    22221

    11211

    1

    2

    1

    1

    ,...,2,1,

    j

    k

    niijkjikijij ulal

    njjil

    ula

    uii

    i

    k

    kjikij

    ij ,...,3,2,

    1

    1

    111 ii aljFor

    11

    1

    11

    111

    a

    a

    l

    auiFor

    jjj

    Computing and CAD IIProfessor Jan K. Sykulski

    Solving Ax = b A = LUTriangular decomposition

    100

    10

    1

    0

    00

    2

    112

    21

    2221

    11

    21

    22221

    11211

    n

    n

    nnnnnnnn

    n

    n

    u

    uu

    lll

    ll

    l

    aaa

    aaa

    aaa

    LUA

    nnnn

    n

    n

    lll

    ull

    uul

    21

    22221

    11211

    1

    1

    ,...,2,1,

    j

    k

    niijkjikijij ulal

    njjil

    ula

    uii

    i

    k

    kjikij

    ij ,...,3,2,

    1

    1

    The RHS ( ofAx = b ):

    nil

    blb

    bl

    bb

    ii

    i

    k

    kiki

    i ,...,3,2,

    '

    ''

    1

    1

    11

    11

    Backward substitution:

  • 8/3/2019 CAD 2011 Slides

    55/74 5

    Computing and CAD IIProfessor Jan K. Sykulski

    Solving Ax = b ExampleTriangular decomposition

    bAx

    122

    321213

    A

    2

    1112

    b

    100

    1103/23/11

    13/42

    03/71003

    1

    1

    ,...,2,1,

    j

    k

    niijkjikijij ulal

    njjil

    ula

    u ii

    i

    k

    kjikij

    ij ,...,3,2,

    1

    1

    Computing and CAD IIProfessor Jan K. Sykulski

    Solving Ax = b ExampleTriangular decomposition

    bAx

    122

    321

    213

    A

    2

    11

    12

    b

    100

    110

    3/23/11

    13/42

    03/71

    003

    2

    3

    4

    'b

    nil

    blb

    bl

    bb

    ii

    i

    k

    kiki

    i ,...,3,2,

    '

    ''

    1

    1

    11

    11

  • 8/3/2019 CAD 2011 Slides

    56/74 5

    Computing and CAD IIProfessor Jan K. Sykulski

    Solving Ax = b ExampleTriangular decomposition

    bAx

    122

    321213

    A

    2

    1112

    b

    100

    1103/23/11

    13/42

    03/71003

    2

    34

    'b

    2100

    3110

    43/23/11

    2

    121313

    313/123/243/13/24

    3

    32

    231

    x

    xx

    xxx

    Augmenting b to U gives:

    Getting b is in fact:

    213/42

    1103/71

    12003

    :bL

    and forward substitution yields:

    21/33/4422'

    33/7/41113/7/'111'

    43/12'

    3

    12

    1

    b

    bb

    b

    Computing and CAD IIProfessor Jan K. Sykulski

    Solving Ax = b ExampleTriangular decomposition

    bAx

    122

    321

    213

    A

    2

    11

    12

    b

    100

    110

    3/23/11

    13/42

    03/71

    003

    2

    3

    4

    'b

    2100

    3110

    43/23/11

    2

    121313

    313/123/243/13/24

    3

    32

    231

    x

    xx

    xxx

    213/42

    1103/71

    12003

    :bL 21/33/4422'

    33/7/41113/7/'111'

    43/12'

    3

    12

    1

    b

    bb

    b

    Forward substitution

    Backward substitution

  • 8/3/2019 CAD 2011 Slides

    57/74 5

    Computing and CAD IIProfessor Jan K. Sykulski

    Solving Ax = b ExampleTriangular decomposition

    bAx

    122

    321213

    A

    2

    1112

    b

    100

    1103/23/11

    13/42

    03/71003

    2

    34

    'b

    2100

    3110

    43/23/11

    ':bU

    2

    121313

    313/123/243/13/24

    3

    32

    231

    x

    xx

    xxx

    213/42

    1103/71

    12003

    :bL 21/33/4422'

    33/7/41113/7/'111'

    43/12'

    3

    12

    1

    b

    bb

    b

    First find b from Lb=b byforward substitution, then

    Compute x from Ux=b bybackward substitution

    Computing and CAD IIProfessor Jan K. Sykulski

    Solving Ax = bCholesky decomposition

    If matrix A is symmetric: aij = aji

    andpositive definite: TA > 0 for all vectors

    (in other words A has all positive eigenvalues)

    then a Cholesky decomposition (which is twice as fast a LU) gives:

    TLLA

    1

    1

    2

    i

    kikiiii LaL

    NiijLLaL

    L

    i

    k

    jkikijii

    ji ,...,2,11

    1

    1

    Cholesky decomposition is extremely stable numerically, even without any pivoting.

  • 8/3/2019 CAD 2011 Slides

    58/74 5

    Computing and CAD IIProfessor Jan K. Sykulski

    Errors ExampleConsider

    2

    2

    01.199.0

    99.001.1

    y

    x with obvious solution x = 1y = 1

    Graphically:

    x x

    y y

    ?

    Ill conditioned problems

    Computing and CAD IIProfessor Jan K. Sykulski

    Errors Example 2Consider

    66.2

    35.2

    880.0

    47.154.083.0

    78.156.033.4

    53.205.102.3

    3

    2

    1

    x

    x

    x

    with a solution

    1

    2

    1

    x

    Gaussian elimination, using pivoting and three digits rounded gives:

    00962.000362.000

    65.677.344.10

    23.778.156.033.4

    66.2

    35.2

    880.0

    x?

  • 8/3/2019 CAD 2011 Slides

    59/74 5

    Computing and CAD IIProfessor Jan K. Sykulski

    Errors Example 3

    Consider

    1440.0

    8642.0

    1441.02161.0

    8646.02969.1

    2

    1

    x

    x

    Let

    4870.0

    9911.0x be assumed to be a possible solution.

    Calculate a residual vector:

    8

    8

    10

    10xAbr

    The actual solution is:

    2

    2x and not a single figure in is meaningful!x

    The size of the residual vector may not be a sufficient indication of the error in x !

    Computing and CAD IIProfessor Jan K. Sykulski

    Matrix and vector norms

    Anorm is a measure of the magnitude (not size !) of a matrix.

    A norm must satisfy the following conditions:

    BAAB

    BABA

    AkkA

    AifonlyandifAandA

    .4

    .3

    .2

    000.1

    Errors Norms

    n

    j

    ijni

    aA

    11max

    2/1

    1 1

    2

    m

    i

    n

    j

    ijeaA

    For example

    maximum row-sum norm

    Euclidean norm

    Example

    547424

    745

    16A

    69.14e

    A

  • 8/3/2019 CAD 2011 Slides

    60/74 6

    Computing and CAD IIProfessor Jan K. Sykulski

    Condition numbers

    Errors Condition numbers

    1 AAAcond

    Let and where is an error and is an approximate solution.

    A residual may be defined as

    It can be shown that

    The relative error can be as great as the relative residual times the condition number!

    Let (where ).

    It can be shown that

    The error can be as large as relative errors in coefficients of A times the condition number!

    What can we do? estimate condition number (e.g. LINPACK estimate)

    improve the solution through iterative refinement

    Computing and CAD IIProfessor Jan K. Sykulski

    Solving Ax = b Iterative methodsGaussSeidel iteration

    1. Rearrange the rows so that diagonal elements are dominating

    2. Assume initial vector of solution

    3. Apply

    N

    ij

    kj

    ii

    iji

    j

    kj

    ii

    ij

    ii

    iki x

    a

    ax

    a

    a

    a

    bx

    1

    )(1

    1

    )1(1

    SOR iteration 21

    1 )(1

    1

    )1()(1

    wherexaxab

    axx

    N

    ij

    kjij

    i

    j

    kjiji

    ii

    ki

    ki

    Example:

    1

    1

    1

    1

    1

    1

    1

    1

    4111

    1411

    1141

    1114

    xgivingx

    1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9

    No of iterations

    Error < 10524 18 13 11

    min14 18 24 35 55 100

  • 8/3/2019 CAD 2011 Slides

    61/74 6

    Computing and CAD IIProfessor Jan K. Sykulski

    x

    y V= 100 V V= 100 V

    V= 0

    V= 0

    y

    x

    0

    x

    V

    0

    y

    V

    Solving Ax = b SOR

    1. GaussSeidel iterations

    ( = 1)

    2. SOR withopt = 1.885

    Computing and CAD IIProfessor Jan K. Sykulski

    Solving Ax = b SOR = 1 opt = 1.885

    Iteration count: 4

  • 8/3/2019 CAD 2011 Slides

    62/74 6

    Computing and CAD IIProfessor Jan K. Sykulski

    Solving Ax = b SOR = 1 opt = 1.885

    Prescribed accuracy achieved

    in 106iterations.

    Iteration count: 106

    Computing and CAD IIProfessor Jan K. Sykulski

    Solving Ax = b SOR = 1 opt = 1.885

    Iteration count: 690

    Prescribed accuracy achieved

    in 106iterations.

    Prescribed accuracy achieved

    in 690 iterations.

  • 8/3/2019 CAD 2011 Slides

    63/74 6

    Computing and CAD IIProfessor Jan K. Sykulski

    Solving Ax = b SORAssume a linear initial solution: Final solution:

    Prescribed accuracy achieved

    in51 iterations(instead of106when a zero

    solution was initially used).

    Computing and CAD IIProfessor Jan K. Sykulski

    Solving Ax = b SORAssume a linear initial solution: Final solution:

    5 iterations needed to keep the local error below 1%

    24 iterations needed to keep the local error below 0.2%

    51 iterations needed to keep the local error below 0.05%

    81 iterations needed to keep the local error below 0.01%

  • 8/3/2019 CAD 2011 Slides

    64/74 6

    Computing and CAD IIProfessor Jan K. Sykulski

    Solving Ax = b Conjugate Gradient MethodConjugate Gradient Method

    Minimise which leads to a condition: bxxAxx TTf 21 0 bxAf

    Computing and CAD IIProfessor Jan K. Sykulski

    Solving Ax = b Conjugate Gradient MethodConjugate Gradient Method

    Minimise which leads to a condition: bxxAxx TTf 2

    10 bxAf

  • 8/3/2019 CAD 2011 Slides

    65/74 6

    Computing and CAD IIProfessor Jan K. Sykulski

    Solving Ax = b Conjugate Gradient MethodConjugate Gradient Method

    Minimise which leads to a condition: bxxAxx TTf 21 0 bxAf

    Computing and CAD IIProfessor Jan K. Sykulski

    Solving Ax = b Comparison of methodsIncomplete Cholesky Conjugate Gradient (ICCG) Method

    Comparison of methods

    Test problem:

    If the coefficient matrix is symmetric, positive definite and sparse:

    incomplete Cholesky preconditioning

    conjugate gradient iterative solution

    Poissons equation over a unit square

    uniform mesh of first order triangles with n points

    nnodes

    mbandwidth

    Gausselimination

    Gauss-Seidel SOR ICCG

    m2n mniter n lognoperation

    count (time)

    36 8 1 2 1 1 time inarbitrary

    units441 23 33 619 123 28

    961 33 152 - 536 70

  • 8/3/2019 CAD 2011 Slides

    66/74 6

    Computing and CAD IIProfessor Jan K. Sykulski

    A typical CAD system for electromagnetics

    Pre-processor

    Geometrical data

    Material propertiesExcitation sourcesBoundary conditions

    Mesh

    Solver Ax=b

    Post-processorField plots, forces,stored energy,losses, errors, etc

    Data

    files

    Resultsfiles

    CAD

    Designer

    From design system Model

    Back to design system Solution

    Computing and CAD IIProfessor Jan K. Sykulski

    Coinrecognitionsensor

  • 8/3/2019 CAD 2011 Slides

    67/74 6

    Computing and CAD IIProfessor Jan K. Sykulski

    Multiphysics problems

    The current and resultant Joule heating in an electric switch contactare modelled as the switch is actuated. Mechanical, thermal andcurrent flow are modelled using direct coupled field elements.

    Computing and CAD IIProfessor Jan K. Sykulski

    Optimization techniques

    Deterministic Stochastic

    Always follows same

    path from same initial

    conditions

    Finds local minimum

    Fast: 5 to 100 evaluations

    Initial conditions do not

    determine path of

    optimization

    Attempt to find globalminimum

    Slow: hundreds or thousandsof evaluations

  • 8/3/2019 CAD 2011 Slides

    68/74 6

    Computing and CAD IIProfessor Jan K. Sykulski

    Local

    Global

    Start

    Optimization techniques

    Deterministic Stochastic

    Global

    Local

    Computing and CAD IIProfessor Jan K. Sykulski

    Optimization techniques

    Deterministic Stochastic

    DirectSearch

    IndirectSearch

    Simulatedannealing

    Evolutionstrategy

    Rosenbrocks

    methodPatternsearch

    Simplexmethod

    Powells

    conjugatedirection

    ...

    Steepest decent

    Newtons method

    Variable-metricprocedure

    Conjugategradient

    Trust regionmethod

    ...

  • 8/3/2019 CAD 2011 Slides

    69/74 6

    Computing and CAD IIProfessor Jan K. Sykulski

    Single-minimum objective function

    Optimization

    Computing and CAD IIProfessor Jan K. Sykulski

    Optimization

    Multiple-minima objective function

  • 8/3/2019 CAD 2011 Slides

    70/74 7

    Computing and CAD IIProfessor Jan K. Sykulski

    C-core shaped magnet

    100351

    BBBmaxF i

    ,iC

    DE Differential Evolution

    ES Evolution Strategy

    GBA Gradient Based Method

    Method Starting Optimum n

    DE1 9 random 0.0803 720

    DE2 13 random 0.0704 881

    ES 0.7532 / 0.4344 / 0.6411 0.0642 450

    GBA 0.7532 0.0855 188

    ES/DE/MQ 0.7532 0.0718 118

    Computing and CAD IIProfessor Jan K. Sykulski

    Magnetiser

    59

    1

    2,, BBk

    kcalculatedkdesiredf

    kokdesired 90sinBB ma x, 591 k

    Method Starting Optimum n

    DE1 11 random 1.235E-5 987

    DE2 11 random 5.423E-5 1035

    ES 1.457E-3 1.187E-5 433

    ES 9.486E-2 1.318E-4 351

    GBA 1.457E-3 1.238E-4 41

    GBA 9.486E-2 2.433E-4 281

    ES/DE/MQ 1.457E-3 1.961E-5 234

    ES/DE/MQ 9.486E-2 2.125E-5 206

    NF/GA/SQP 6.570E-5 189

    Unconstrained optimisation

    Method Optimum N

    ES/DE/MQ 1.58E-5 246

    NF/GA/SQP 4.65E-5 155

    Constrained optimisation

    NF Neuro-Fuzzy modelling

    GA Genetic Algorithm

    SQP Sequential Quadratic Programming

  • 8/3/2019 CAD 2011 Slides

    71/74 7

    Computing and CAD IIProfessor Jan K. Sykulski

    Yoke

    MagnetPole piece

    Optimized shimming magnet distribution of MRI system

    Simplified axi-symmetric model

    3 mm

    15 mm

    Shimming magnet (Br=0.222 T)

    n

    si

    zozi pPyxBBF )(),()( ,245

    1

    MM

    Objective function:

    Computing and CAD IIProfessor Jan K. Sykulski

    +Ms -Ms

    Changes of shimming magnet distributionduring optimisation

    Convergence

    Flux distributions

    1 iteration

    10 iterations

    3 iterations

    3 iterations

  • 8/3/2019 CAD 2011 Slides

    72/74 7

    Computing and CAD IIProfessor Jan K. Sykulski

    Pareto Optimisation

    F1

    F2

    UTOPIA

    NADIR

    DISTOPIA

    Objective

    domain

    searchspace

    POF Pareto Optimal Front

    POF

    F2max

    F2min

    F1min

    F1max

    Computing and CAD IIProfessor Jan K. Sykulski

    Designer

    Company design sheets and priorknowledge

    Optimisation and designprograms

    Experts on finite element analysis

  • 8/3/2019 CAD 2011 Slides

    73/74 7

    Computing and CAD IIProfessor Jan K. Sykulski

    Input data

    Output data

    Materialslibrary

    Induction Motor

    Design Routines

    FEsoftware

    Optimisation

    Analytical & Control Software

    Industrially

    oriented systemfor inductionmotor design

    MATLAB

    FE software

    Excel

    Computing and CAD IIProfessor Jan K. Sykulski

    Hierarchical (three-layer) structure

    Knowledge base

    Approximate solutions

    (e.g. equivalent circuits, semi-empirical, design sheets)

    Extensive optimisation Large design space

    2D finite element, static or steady-state

    Constrained optimisation, coupling Medium design space

    3D finite-element, transient

    Fine tuning of the design Small design space

  • 8/3/2019 CAD 2011 Slides

    74/74

    Computing and CAD IIProfessor Jan K. Sykulski

    Current and future developments

    adaptive meshing

    reliable error estimation high speed computing

    efficient handling of non-linearity and hysteresis

    modelling of new types of materials

    linear movement and rotation

    combined modelling of fields and circuits

    coupled problems (em + stress + temperature, etc)

    optimisation

    integrated design systems

    ... Significant progress has been made Tremendous effort continues Much still needs to be done

    Commercial software