petsc-master 2020-11-28
Report Typos and Errors

MAT

  • ex74.c Solves the constant-coefficient 1D heat equation
    with an Implicit Runge-Kutta method using MatKAIJ.

    du d^2 u
    -- = a ----- ; 0 <= x <= 1;
    dt dx^2

    with periodic boundary conditions

    2nd order central discretization in space:

    [ d^2 u ] u_{i+1} - 2u_i + u_{i-1}
    [ ----- ] = ------------------------
    [ dx^2 ]i h^2

    i = grid index; h = x_{i+1}-x_i (Uniform)
    0 <= i < n h = 1.0/n

    Thus,

    du
    -- = Ju; J = (a/h^2) tridiagonal(1,-2,1)_n
    dt

    Implicit Runge-Kutta method:

    U^(k) = u^n + dt \\sum_i a_{ki} JU^{i}
    u^{n+1} = u^n + dt \\sum_i b_i JU^{i}

    i = 1,...,s (s -> number of stages)

    At each time step, we solve

    [ 1 ] 1
    [ -- I \\otimes A^{-1} - J \\otimes I ] U = -- u^n \\otimes A^{-1}
    [ dt ] dt

    where A is the Butcher tableaux of the implicit
    Runge-Kutta method,

    with MATKAIJ and KSP.

    Available IRK Methods:
    gauss n-stage Gauss method