示例#1
0
    def __init__(self,nx=31,ny=31,dx=50e3,dy=50e3):
        
        # Set up two grids
        self.mainGrid = pg.Grid(nx,  ny,  dx,dy)
        self.veloGrid = pg.Grid(nx-1,ny-1,dx,dy,dx/2.0,dy/2.0)

        # Create main arrays
        self.thck  = pg.newArray(self.mainGrid) # Thickness
        self.topg  = pg.newArray(self.mainGrid) # Basal topg
        self.usrf  = pg.newArray(self.mainGrid) # Surface elevation
        self.lsrf  = pg.newArray(self.mainGrid) # Lower surface elevation
        self.flwa  = pg.newArray(self.veloGrid) # Vertically-integrated flow-law
        self.diffu = pg.newArray(self.veloGrid) # Diffusivity
        self.uvel  = pg.newArray(self.veloGrid) # x-velocity (depth-mean)
        self.vvel  = pg.newArray(self.veloGrid) # y-velocity (depth-mean)

        # For now, set flowlaw to a constant
        self.flwa[:] = 1e-16

        # Solvers
        self.thckSolver = None
        self.tempSolver = None
示例#2
0
    def __init__(self, nx=31, ny=31, dx=50e3, dy=50e3):

        # Set up two grids
        self.mainGrid = pg.Grid(nx, ny, dx, dy)
        self.veloGrid = pg.Grid(nx - 1, ny - 1, dx, dy, dx / 2.0, dy / 2.0)

        # Create main arrays
        self.thck = pg.newArray(self.mainGrid)  # Thickness
        self.topg = pg.newArray(self.mainGrid)  # Basal topg
        self.usrf = pg.newArray(self.mainGrid)  # Surface elevation
        self.lsrf = pg.newArray(self.mainGrid)  # Lower surface elevation
        self.flwa = pg.newArray(
            self.veloGrid)  # Vertically-integrated flow-law
        self.diffu = pg.newArray(self.veloGrid)  # Diffusivity
        self.uvel = pg.newArray(self.veloGrid)  # x-velocity (depth-mean)
        self.vvel = pg.newArray(self.veloGrid)  # y-velocity (depth-mean)

        # For now, set flowlaw to a constant
        self.flwa[:] = 1e-16

        # Solvers
        self.thckSolver = None
        self.tempSolver = None
示例#3
0
    def __init__(self, mainGrid, veloGrid, output=False, dt=10.0):
        self.mainGrid = mainGrid
        self.veloGrid = veloGrid

        # Declare some internal arrays
        self.stagthck = pg.newArray(self.veloGrid)  # Thickness on velo grid
        self.dusrfdew = pg.newArray(self.veloGrid)  # Horizontal derivs of usrf
        self.dusrfdns = pg.newArray(self.veloGrid)
        self.dthckdew = pg.newArray(self.veloGrid)  # Horizontal derivs of thck
        self.dthckdns = pg.newArray(self.veloGrid)
        self.mask = pg.newArray(self.mainGrid, dtype=np.int32)  # Mask

        # Parameters
        self.pmax = 50  # Maximum number of Picard iterations
        self.linear = True  # Linear model
        self.alpha = 0.5  # Still not sure what this does
        self.fc2_3 = (1.0 - self.alpha) / self.alpha
        self.fc2_4 = 1.0 / self.alpha
        self.tol = 1e-13

        # Set timestep
        self.setTimestep(dt)

        # Diagnostic output
        self.output = output
        if self.output:
            self.f = nc.NetCDFFile("SIAsolver.nc", "w")
            self.f.createDimension("x0", self.mainGrid.nx)
            self.f.createDimension("y0", self.mainGrid.ny)
            self.f.createDimension("x1", self.veloGrid.nx)
            self.f.createDimension("y1", self.veloGrid.ny)
            self.f.createDimension("t", None)

            self.maskvar = self.f.createVariable("mask", "i",
                                                 ("t", "x0", "y0"))
            self.stagvar = self.f.createVariable("stagthck", "d",
                                                 ("t", "x1", "y1"))
            self.du1var = self.f.createVariable("dusrfdew", "d",
                                                ("t", "x1", "y1"))
            self.du2var = self.f.createVariable("dusrfdns", "d",
                                                ("t", "x1", "y1"))
            self.dt1var = self.f.createVariable("dthckdew", "d",
                                                ("t", "x1", "y1"))
            self.dt2var = self.f.createVariable("dthckdns", "d",
                                                ("t", "x1", "y1"))

            self.nccount = 0
    def __init__(self,mainGrid,veloGrid,output=False,dt=10.0):
        self.mainGrid = mainGrid
        self.veloGrid = veloGrid

        # Declare some internal arrays
        self.stagthck = pg.newArray(self.veloGrid) # Thickness on velo grid
        self.dusrfdew = pg.newArray(self.veloGrid) # Horizontal derivs of usrf
        self.dusrfdns = pg.newArray(self.veloGrid) 
        self.dthckdew = pg.newArray(self.veloGrid) # Horizontal derivs of thck
        self.dthckdns = pg.newArray(self.veloGrid)
        self.mask     = pg.newArray(self.mainGrid,dtype=np.int32) # Mask

        # Parameters
        self.pmax = 50     # Maximum number of Picard iterations
        self.linear = True # Linear model
        self.alpha = 0.5   # Still not sure what this does
        self.fc2_3 = (1.0 - self.alpha) / self.alpha
        self.fc2_4 =  1.0 / self.alpha
        self.tol = 1e-13

        # Set timestep
        self.setTimestep(dt)

        # Diagnostic output
        self.output = output
        if self.output:
            self.f=nc.NetCDFFile("SIAsolver.nc","w")
            self.f.createDimension("x0",self.mainGrid.nx)
            self.f.createDimension("y0",self.mainGrid.ny)
            self.f.createDimension("x1",self.veloGrid.nx)
            self.f.createDimension("y1",self.veloGrid.ny)
            self.f.createDimension("t",None)

            self.maskvar = self.f.createVariable("mask","i",("t","x0","y0"))
            self.stagvar = self.f.createVariable("stagthck","d",("t","x1","y1"))
            self.du1var  = self.f.createVariable("dusrfdew","d",("t","x1","y1"))
            self.du2var  = self.f.createVariable("dusrfdns","d",("t","x1","y1"))
            self.dt1var  = self.f.createVariable("dthckdew","d",("t","x1","y1"))
            self.dt2var  = self.f.createVariable("dthckdns","d",("t","x1","y1"))

            self.nccount = 0