Page 155 - Basic Structured Grid Generation
P. 155

144  Basic Structured Grid Generation

                        take the two-dimensional form of Laplace’s Equation as an example. The subdirec-
                        tory Book/p.d.Equation on the accompanying disk, as listed in the last section of this
                        chapter, contains two files, the first of which, Conjugate.Laplace.f, simply shows how
                        to solve Laplace’s Equation
                                                             2
                                                       2
                                                      ∂ ϕ   ∂ ϕ
                                                          +     = 0
                                                      ∂x 2  ∂y 2
                        in a square solution domain using the Conjugate Gradient method. Exact solutions,
                                    x
                        such as u = e sin y, with appropriate boundary conditions, may be used to assess the
                        numerical accuracy of the method.
                          For non-rectangular domains we need to be able to transform the equation to gen-
                                                                                2
                        eral curvilinear co-ordinates ξ, η. A convenient expression for ∇ ϕ was obtained in
                        eqn (1.173), with the addition of eqns (1.174) and (1.175). The file laplacian.general.f
                        contains a program which solves the discretized form of these equations using SOR.
                        First we set
                                         √                 √              √
                                      g 11 / g = g oo ,  −2g 12 / g = g ot ,  g 22 / g = g tt ,
                                      √   2            √   2
                                        g∇ ξ = Delzi,   g∇ η = Delet


                        so that eqns (1.174) and (1.175) can be written
                                       (x η y ξξ − y η x ξξ )  (x η y ξη − y η x ξη )  (x η y ηη − y η x ηη )
                             Delzi = g tt   √        + g ot    √        + g oo    √        ,
                                              g                  g                  g
                                       (y ξ x ξξ − x ξ y ξξ )  (y ξ x ξη − x ξ y ξη )  (y ξ x ηη − x ξ y ηη )
                             Delet = g tt   √        + g ot    √        + g oo    √        .
                                              g                  g                  g

                        Discretization of eqn (1.173) can now be represented by
                                      $                                      %
                                       (g tt ∗ ϕ) j+1,k − 2(g tt ∗ ϕ) j,k + (g tt ∗ ϕ) j−1,k
                                           $                                      %
                                         + (g oo ∗ ϕ) j,k+1 − 2(g oo ∗ ϕ) j,k + (g oo ∗ ϕ) j,k−1
                                               $
                                         + 0.25 (g ot ∗ ϕ) j+1,k+1 + (g ot ∗ ϕ) j−1,k−1
                                                                          %
                                           −(g ot ∗ ϕ) j+1,k−1 − (g ot ∗ ϕ) j−1,k+1
                                              $                             %
                                         + 0.5 (Delzi ∗ ϕ) j+1,k − (Delzi ∗ ϕ) j−1,k
                                              $                             %
                                         + 0.5 (Delet ∗ ϕ) j,k+1 − (Delet ∗ ϕ) j,k−1 = 0  (5.115)
                        in the transformed domain of curvilinear co-ordinates.
                          Taking terms containing ϕ j,k to one side of the equation, we can generate a ‘tem-
                        porary’ value
                                   !                                                      "
                              t      (g tt ∗ ϕ) j+1,k + (g tt ∗ ϕ) j−1,k + (g oo ∗ ϕ) j,k+1 + (g oo ∗ ϕ) j,k−1
                             ϕ j,k  =
                                                       2[(g tt ) j,k + (g oo ) j,k ]
                                        !                              "
                                         (Delzi ∗ ϕ) j+1,k − (Delzi ∗ ϕ) j−1,k
                                   +0.5
                                               2[(g tt ) j,k + (g oo ) j,k ]
   150   151   152   153   154   155   156   157   158   159   160