fem background

18
24/12/2011 1 FEM Background A very simple finite element problem... p= 2 N k 2 = 4 N/m k 3 = 4 N/m u 1 u 2 u 3 We can write a force balance on each node: Node 1 c k 1 (u 3 -u 1 ) Node 2 k 3 (u 3 -u 2 ) -k 2 (u 2 -u 1 ) k 1 = 6 N/m k 2 (u 2 -u 1 ) Constraint Force Node 3 p -k 1 (u 3 -u 1 ) -k 3 (u 3 -u 2 )

Upload: yaser-akar

Post on 19-Nov-2015

19 views

Category:

Documents


0 download

DESCRIPTION

Comsol Multiphysics CourseChapter3: FEM Background

TRANSCRIPT

  • 24/12/2011

    1

    FEM Background

    A very simple finite element problem...

    p= 2 N k2 = 4 N/m k3 = 4 N/m

    u1 u2 u3

    We can write a force balance on each node:

    Node 1

    c

    k1(u3-u1)

    Node 2

    k3(u3-u2) -k2(u2-u1)

    k1 = 6 N/m

    k2(u2-u1)

    Constraint Force

    Node 3

    p

    -k1(u3-u1)

    -k3(u3-u2)

  • 24/12/2011

    2

    Write the force balance as three equations:

    However, we now have three equations in four unknowns, c, u1, u2, u3

    k1(u3-u1) + k2(u2-u1) = c

    k2(u2-u1) - k3(u3-u2) = 0

    k1(u3-u1) + k3(u3-u2) = p

    (k2)u2 + (k1)u3 = c

    (k2+k3)u2 + (-k3)u3 = 0

    (-k3)u2 + (k1+k3)u3 = p

    Algebra

    Constraint Equations

    System Equations

    k1(u3 - 0 ) + k2(u2 - 0 ) = c

    k2(u2 - 0 ) - k3(u3 - u2) = 0

    k1(u3 - 0 ) + k3(u3 - u2) = p

    Three equations, three

    unknowns: c,u2, u3

    But we also have a constraint, u1=0

    Can now solve the problem

    (k2)u2 + (k1)u3 = c

    (k2+k3)u2 + (-k3)u3 = 0

    (-k3)u2 + (k1+k3)u3 = p

    cu

    ukk

    3

    2

    12

    pu

    u

    kkk

    kkk 0

    3

    2

    313

    332

    Solve the system

    equations first

    Ku=b

    u=K-1b

    k1= 6 N/m

    k2=k3= 4 N/m

    p=2 N

    250.0

    125.0

    3

    2

    u

    u

    Can also solve the

    constraint equations,

    if desired 2

    250.0

    125.064

  • 24/12/2011

    3

    Linear and nonlinear problems

    A linear problem must have all three of these properties:

    1) Applying zero loads results in a zero solution

    2) Doubling the magnitude of the load doubles the magnitude of the solution

    3) Changing the sign of the load changes only the sign of the solution

    load

    solution

    load

    solution

    Linear Non-Linear

    What makes a problem non-linear?

    Material properties that depend upon the solution, k(u)

    Loads that depend upon the solution, b(u)

    u

    k, b

    Linear

    u

    k(u), b(u)

    Weakly Non-linear

    u

    k(u), b(u)

    Strongly Non-linear

    u

    k(u), b(u)

    Outrageously

    Non-linear

    There are no clear distinctions

    between these three cases

  • 24/12/2011

    4

    Not all non-linear problems have a (unique) solution

    load

    solution

    No solution

    load

    solution

    No unique solution

    Two very simple finite element examples

    k = 4 N/m

    u

    p = 2 N

    Force balance on node:

    f (u) = p - ku = 0

    f (u) = 2 - 4 u = 0

    f (u)

    usolution= 0.5

    u

    k = exp(u) N/m

    u

    p = 2 N

    Force balance on node:

    f (u) = p - k u = 0

    f (u) = 2 - exp(u) u = 0

    u

    f (u)

    usolution 0.853

  • 24/12/2011

    5

    First, solve the linear problem

    f (u) = 2 - 4 u = 0

    f (u)

    usolution=0.5

    Algorithm:

    1) Start at a point, e.g. u0 = 0

    2) Find the slope, f(u0)

    3) Solve the problem:

    0

    00

    ' uf

    ufuusolution

    5.04

    20

    solutionu

    (1) (2)

    (3)

    i

    iii

    uf

    ufuu

    '1 This is a single Newton-Raphson iteration:

    For a linear problem, the starting point does not matter

    Solving a FE system matrix is equivalent to taking

    a single Newton-Raphson iteration

    f (u) = 2 - 4 u = 0

    0

    00

    ' uf

    ufuusolution

    5.04

    20

    solutionu

    pu

    u

    kkk

    kkk 0

    3

    2

    313

    332

    0

    00

    3

    2

    313

    332

    u

    u

    kkk

    kkk

    puf

    f (u) = b - Ku, u0 = 0

    K

    b

    K

    Kub0

    uf

    ufuu

    0

    0

    00

    'solution

    bKu1solution

    4 u = 2

  • 24/12/2011

    6

    The non-linear problem is solved the same way

    Algorithm:

    1) Start at a point, e.g. u0 = 0

    2) Linearization point at u0 = 0

    3) Take repeated Newton-

    Raphson iterations

    4) Terminate when:

    f (u) = 2 - exp(u) u

    u

    f (u)

    toleranceuuff iiii /&/ 11

    Similarly, if we have a non-linear system matrix

    f (u) = b(u) - K(u)u

    iiiiii

    iii uuKubuSu

    uf

    ufuu

    1

    1'

    f(u) = S(u)

    Iterate until: toleranceff iiii uu /&/ 11

    p= 2 k2 = exp(u2-u1) k3 = 4

    u1 u2 u3

    k1 = 6 + (u3-u1)2

    S(u) is known as the JACOBIAN

  • 24/12/2011

    7

    The possibility of convergence of a non-linear

    problem is dependent upon the starting point, u0

    Non-linear problems have a radius of convergence

    f (u) = 2 - exp(u) u

    u

    f (u)

    Non-convergent

    if starting on this

    side of the line

    u0= -1

    Finding a good starting point, u0, can

    improve convergence

    f (u) = 2 - exp(u) u

    u

    f (u)

    slow

    convergence

    fast

    convergence

    It is not strictly possible to

    define slow or fast

    convergence

    Finding a good starting point is

    a matter of experience and luck

  • 24/12/2011

    8

    A damping factor, , is used to improve convergence

    u

    f (u)

    i

    iii

    uf

    ufuu

    '1

    choose ( < 1) & ( |fi| )

    recompute fi+1(ui+1)

    end

    |fi|

    undamped |fi+1|

    intermediate |fi+1|

    final |fi+1|

    f (u) = 2 - exp(u) u

    A better solution is to ramp up the load

    f (u)

    f (u) = 2 - exp(u) u k = exp(u) N/m

    u

    p = 2 N

    u

    Recall that: Load

    Load

    f (u) = 1 - exp(u) u = 0

    Almost all problems have a

    zero solution at zero load

    Ramping up the load is a

    physically reasonable approach

  • 24/12/2011

    9

    Ramping up the non-linearity can also work

    f (u)

    f (u) = 2 - exp(u) u = 2 - ku

    u

    Non-linearity

    f (u) = 2 - 1u

    f (u) = 2 - {(1-0.5)+(0.5exp(u)}u

    f (u) = 2 - exp(u) u

    Identify non-linearity

    - kNL = exp(u)

    Linearize around chosen u0 - kLIN = exp(u0=0) = 1

    Use an intermediate value

    - k = (1-)kLIN+kNL - starts at 0

    Use intermediate solution as new u0

    Ramp from 0 to 1

    Example - Heat flow through a square

    T=0K

    q = 100 W/m2

    k, Thermal conductivity

    1x1m square

    Build this 2D model in Heat Transfer,

    Save this model, we will build upon this

    Mesh

    Solution

    Tinitial=0K

    Insulated

    Insulated

  • 24/12/2011

    10

    Study the following cases:

    T

    k

    T

    k = 0.1+exp(-(T/25[K])^2)[W/(m*K)]

    = 1[W/(m*K)]

    T

    k = (1+T/200[K])[W/(m*K)]

    T

    = (0.1+10*(T>25[K]))[W/(m*K)] k

    Questions:

    How many iterations did each case take? Was damping used?

    Tini = 0K, Case 1 = 1, case 2 = 5, case 3 = 7, case 4 = 50 (no convergence)

    Tini = 50K, Case 1 = 1, case 2 = 5, case 3 = 13, case 4 = 50 (no convergence)

    What does the temperature and thermal conductivity solution look like?

    Did they all converge? Why not?

    Try solving case #2 with an initial temperature of 50[K], how does this

    affect the solution? What about the other cases?

    Set back to T=0 afterwards

  • 24/12/2011

    11

    Ramp up the heat load and monitor peak temperature

    T

    k =(1-T/200[K])[W/(m*K)]

    Qin

    Tmax

    ?

    Why does this happen?

    Multiphysics Problems

  • 24/12/2011

    12

    FEA formulation in Multiphysics problems

    Interpreting multiphysics FEA

    Fully-coupled and Segregated Solvers

    Suggestions on convergence of multiphysics problems

    Consider two simple physics, on the same geometry

    q=100 W/m2

    T=0K

    All other surfaces

    insulated

    0

    0

    100

    0

    2

    T

    KT

    Tk

    Tk

    m

    Wn

    in the domain

    right boundary

    left boundary

    other boundaries

    fT = KTuT - bT

    Heat Transfer Electric currents

    All other surfaces

    insulated

    V=1V V=0V

    0

    0

    1

    0

    V

    VV

    VV

    V in the domain

    right boundary

    left boundary

    other boundaries

    fV = KVuV - bV

    k = 1 W/mK = 1S/m

  • 24/12/2011

    13

    Now, consider a coupled multiphysics problem

    = (1-0.001T) S/m

    The temperature solution now affects the

    material properties of the electrical problem

    fT = KTuT - bT fV = KV(uT)uV - bV

    q=100 W/m2

    T=0K

    All other surfaces

    insulated

    All other surfaces

    insulated

    V=1V V=0V k = 1 W/mK

    Heat Transfer Electric currents

    q=100 W/m2

    T=0K

    All other surfaces

    insulated

    V=1V V=0V Q(V)

    k = 1 W/mK (T)

    Consider more couplings between the physics

    fT = KTuT - bT(uv) fV = KV(uT)uV - bV

    Volumetric resistive

    heating due to current

    ubuuKb

    ub

    u

    u

    ufuf

    ufufuf

    V

    VT

    V

    T

    VVTV

    VTTT

    iiii

    iiiiii

    ufuufuu

    ubuuKuSuu

    1

    1

    1

    1

    Same equation

    as before

    Heat Transfer Electric currents

  • 24/12/2011

    14

    Definitions of various types of couplings

    One-way coupled Information passes from one physics to the next, in one direction

    Two-way coupled Information gets passed back and forth between physics

    Load coupled The results from one physics affect only the loading on the other physics

    Material coupled The results from one physics affect the materials properties of other physics

    Non-linear coupled The results of one physics affects both that, and other, physics

    Fully coupled All of the above

    Weakly coupled The physics do not strongly affect the loads/properties in other physics

    Strongly coupled The opposite of weakly coupled

    It is possible to solve multiphysics problems in a

    segregated sense, solving each physics separately

    TVV

    TVT

    V

    T

    VVTV

    VTTT

    uub

    uub

    u

    u

    ufuf

    ufufuf

    ,

    ,

    Assume that these are approximately zero and ignore them

    initialize uT,i, uV,i

    do {

    uT,i+1= uT,i+ST(uT,i, uV,i)-1bT(uT,i, uV,i)

    uV,i+1= uV,i+SV(uT,i+1, uV,i)-1bV(uT,i+1, uV,i)

    i=i+1

    }

    while ( not_converged )

    is damping

  • 24/12/2011

    15

    Solving in a segregated sense has some advantages

    V

    T

    V

    T

    VVTV

    VTTT

    b

    b

    u

    u

    ufuf

    ufufuf

    V

    T

    V

    T

    VV

    TT

    b

    b

    u

    u

    uf0

    0ufuf

    Less memory to store matrices:

    Less memory to solve:

    The Jacobian is O(2) times smaller in memory

    iiiiii ubuuKuSuu

    1

    1

    uT,i+1= uT,i+ST(uT,i, uV,i)-1bT(uT,i, uV,i)

    uV,i+1= uV,i+SV(uT,i+1, uV,i)-1bV(uT,i+1, uV,i)

    Jacobian is exactly 2 times smaller in degrees of freedom

    The optimal iterative solver can be used for each physics

    If the problem is strongly coupled, then the segregated approach

    will not work, and a direct solver is often necessary since the

    iterative solvers are not tuned for a general Jacobian matrix.

    Achieving convergence for multiphysics problems

    Set up the coupled problem and try solving it with a direct solver

    If it is not converging:

    Check initial conditions

    Ramp the loads up

    Ramp up the non-linear effects

    Make sure that the problem is well posed (this can be very difficult!)

    If you are running out of memory, or the solution time is very long:

    Use the segregated solver and select the optimal solver (direct or iterative) for

    each physics, or group of physics, in the problem. FOR 3D, START HERE!

    Upgrade hardware

    Try the PARDISO out-of-core solver

    Perform a mesh refinement study

  • 24/12/2011

    16

    Try yourself: heat and current flow through a

    unit cube

    J=10 A/m2

    VL=0 TL=0

    All other surfaces insulated

    Set up an Inward Current Flow

    on the right side

    k=1 W/mK =1 S/m

    All other surfaces insulated

    Identical to previous problem

    Set up and solve this uncoupled linear problem

    q=100 W/m2

    Heat Transfer Electric currents

    Consider the following multi-physics couplings:

    Volumetric

    Heat Load

    Thermal

    Conductivity

    Electric

    Conductivity

    Normal

    Current Iterations

    Solution

    Times (sec)

    Linear 0 1 1 10 1 3.572

    Non-linear

    uncoupled 0 1-(T/10000) 1-(V/1000) 10 2 9.422

    One-way load

    coupled

    Joule

    Heating 1 1 10 3 27.846

    Two-way load

    coupled

    Joule

    Heating 1 1 10+(T/100) 3 29.703

    Fully coupled Joule

    Heating 1-(V/1000) 1-(T/10000) 10+(T/100) 3 29.469

    Thermal problem Electric problem

  • 24/12/2011

    17

    Try yourself: Ramp up the applied current,

    and monitor peak temperature

    exp(-T/600) exp(-T/600)

    Jin

    Tmax

    ?

    Use the parametric solver

    Ramp up inward current density range(0,2,20)

    Plot the temperature distribution.

    What happens?

    Why?

    Thermal

    Conductivity

    Electric

    Conductivity

    1 1 Case 1

    Case 2

    Hands on exercises: Ramp up the applied

    voltage, and monitor peak temperature

    exp(-T/600) exp(-T/600)

    V

    Tmax

    ?

    Ramp up applied voltage

    How high can it go?

    Why?

    Thermal

    Conductivity

    Electric

    Conductivity

    1 1 Case 1

    Case 2

    Same as before

  • 24/12/2011

    18

    FEM Background