Fenics Discontinuous Galerkin

download Fenics Discontinuous Galerkin

of 20

description

discontinuous galerkin in FEniCS

Transcript of Fenics Discontinuous Galerkin

  • FEniCS CourseLecture 10: Discontinuous Galerkinmethods for elliptic equations

    ContributorsAndre Massing

    1 / 10

  • The discontinuous Galerkin (DG) method uses

    discontinuous basis functions

    u

    uh

    t

    Vh = Pk(Th) = {vh L2() : vh|T P k(T ) T Th}

    2 / 10

  • The discontinuous Galerkin (DG) method uses

    discontinuous basis functions

    u

    uh

    t

    Vh = Pk(Th) = {vh L2() : vh|T P k(T ) T Th}

    2 / 10

  • The discontinuous Galerkin (DG) method uses

    discontinuous basis functions

    u

    uh

    t

    Vh = Pk(Th) = {vh L2() : vh|T P k(T ) T Th}

    2 / 10

  • The DG method eases mesh adaptivity

    u

    uh

    t

    3 / 10

  • The DG method eases mesh adaptivity

    u

    uh

    t

    3 / 10

  • The DG method eases mesh adaptivity

    u

    uh

    t

    3 / 10

  • The DG method eases space adaptivity

    u

    uh

    t

    4 / 10

  • The DG method eases space adaptivity

    u

    uh

    t

    4 / 10

  • The DG method eases space adaptivity

    u

    uh

    t

    4 / 10

  • DG-FEM Notation

    Interface facets

    Average v = 12(v+ + v)Jump [v] = (v+ v)

    Boundary facet

    v = [v] = v

    Jump identity

    [(hv)wh] = [hv]wh+ hv[wh]5 / 10

  • The symmetric interior penalty method (SIP)

    ah(uh, vh) =TT

    Tuh vh dx

    FF

    Fuh n[vh] dS Consistency

    FF

    Fvh n[uh] dS Symmetry

    +FF

    hF

    F

    [uh][vh] dS Penalty

    6 / 10

  • The symmetric interior penalty method (SIP)

    ah(uh, vh) =TT

    Tuh vh dx

    FF

    Fuh n[vh] dS Consistency

    FF

    Fvh n[uh] dS Symmetry

    +FF

    hF

    F

    [uh][vh] dS Penalty

    6 / 10

  • The symmetric interior penalty method (SIP)

    ah(uh, vh) =TT

    Tuh vh dx

    FF

    Fuh n[vh] dS Consistency

    FF

    Fvh n[uh] dS Symmetry

    +FF

    hF

    F

    [uh][vh] dS Penalty

    6 / 10

  • The symmetric interior penalty method (SIP)

    ah(uh, vh) =TT

    Tuh vh dx

    FF

    Fuh n[vh] dS Consistency

    FF

    Fvh n[uh] dS Symmetry

    +FF

    hF

    F

    [uh][vh] dS Penalty

    lh(vh) =

    fvh dx

    FFb

    Fvh ng dS +

    FFb

    hF

    Fgvh dS

    6 / 10

  • The symmetric interior penalty method (SIP)

    ah(uh, vh) =TT

    Tuh vh dx

    FF

    Fuh n[vh] dS Consistency

    FF

    Fvh n[uh] dS Symmetry

    +FF

    hF

    F

    [uh][vh] dS Penalty

    lh(vh) =

    fvh dx

    FFb

    Fvh ng dS +

    FFb

    hF

    Fgvh dS

    6 / 10

  • Split of SIP form into interior and boundary

    contribution

    ah(uh, vh) =TT

    Tuh vh dx

    FFi

    Fuh n[vh] dS Consistency

    FFi

    Fvh n[uh] dS Symmetry

    +FFi

    hF

    F

    [uh][vh] dS Penalty

    FFb

    Fuh nvh ds

    Consistency

    FFb

    Fvh nuh ds

    Symmetry

    +FFb

    hF

    Fuhvh ds

    Penalty7 / 10

  • Useful FEniCS tools (I)

    Access facet normals and local mesh size:

    n = FacetNormal(mesh)

    h = CellSize(mesh)

    Restriction:

    f = Function(V)

    f(+)

    grad(f)(+)

    8 / 10

  • Useful FEniCS tools (II)

    Average and jump:

    # define it yourself

    h_avg = (h(+) + h(-))/2

    # or use built -in expression

    avg(h)

    jump(v)

    jump(v, n)

    Integration on interior facets:

    ... *dS

    alpha/h_avg*dot(jump(v, n), jump(u, n))*dS

    9 / 10

  • Exercise

    Solve our favorite Poisson problem given

    Domain: = [0, 1] [0, 1], D =

    Source and boundary values:

    f(x, y) = 200 cos(10pix) cos(10piy)

    gD(x, y) = cos(10pix) cos(10piy)

    Mission: Solve this PDE numerically by using the SIP method.Print the errornorm for both the L2 and the H1 norm for variousmesh sizes. For a UnitSquareMesh(128,128) the error should be0.0009166 and 0.1962, respectively.

    Extra mission: Implement the NIP variant, solve the sameproblem and compare the H1 and L2 error for a range ofmeshes UnitSquareMesh(N,N), N = 2j , j = 2, , 7. Can youdetermine the order of convergence?

    10 / 10