tschoof.py - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch)
 (HTM) git clone git://src.adamsgaard.dk/pism
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
       tschoof.py (1228B)
       ---
            1 class SchoofSSA1dExact:
            2 
            3     """
            4     schoof_ssa_exact
            5     Returns certain exact solutions of the ssa equation found in 
            6     Schoof, A Variational Approach to Ice Stream Flow, 2006, pp 237-238.
            7 
            8     The PDE is:
            9 
           10     -d/dy (Bh/2 |1/2 du/dy|^(-2/3) du/dy) = f (1-|y/L|^m)
           11 
           12     on the domain -3L <= y <= 3L with periodic boundary conditions.  The resulting $u$
           13     is the downstream velocity on an infinite slab.
           14 
           15     """
           16 
           17     def __init__(self, L, m, B=1, h=1, f=1):
           18         self.L = float(L)
           19         self.m = float(m)
           20         self.f = float(f)
           21         self.h = float(h)
           22         self.B = float(B)
           23         self.scale = 2 * (f / (B * h)) ** 3.
           24 
           25     def eval(self, x):
           26         L = self.L
           27         m = self.m
           28         W = (m + 1.) ** (1. / m)
           29         u = abs(x / self.L)
           30         if u > W:
           31             v = 0
           32         else:
           33             v = -L ** 4 * ((u ** 4 - (m + 1) ** (4. / m)) / 4 -
           34                            3 * (u ** (m + 4) - (m + 1) ** (1 + 4. / m)) / ((m + 1) * (m + 4)) +
           35                            3 * (u ** (2 * m + 4) - (m + 1) ** (2 + 4. / m)) / ((m + 1) ** 2 * (2 * m + 4.)) -
           36                            (u ** (3 * m + 4) - (m + 1) ** (3 + 4. / m)) / ((m + 1) ** 3 * (3 * m + 4)))
           37 
           38         v *= self.scale
           39         return v