Ejemplo n.º 1
0
    def _allocExtraSSACoefficients(self):
        """Allocate storage for SSA coefficients."""
        vecs = self.modeldata.vecs
        if util.fileHasVariable(self.boot_file, 'ssa_driving_stress_x'):
            vecs.add(model.createDrivingStressXVec(self.grid))

        if util.fileHasVariable(self.boot_file, 'ssa_driving_stress_y'):
            vecs.add(model.createDrivingStressYVec(self.grid))

        no_model_mask = None
        # For a regional run we'll need no_model_mask, usurfstore, thkstore
        if self.is_regional:
            no_model_mask = model.createNoModelMaskVec(self.grid)
            vecs.add(no_model_mask, 'no_model_mask')
            vecs.add(model.createIceSurfaceStoreVec(self.grid))
            vecs.add(model.createIceThicknessStoreVec(self.grid))

        if self.config.get_boolean('stress_balance.ssa.dirichlet_bc'):
            vecs.add(
                model.create2dVelocityVec(
                    self.grid,
                    name='_ssa_bc',
                    desc='SSA velocity boundary condition',
                    intent='intent'), "vel_ssa_bc")

            if self.is_regional:
                vecs.add(no_model_mask, 'bc_mask')
            else:
                vecs.add(model.createBCMaskVec(self.grid), 'bc_mask')

        if self.phi_to_tauc:
            vecs.add(PISM.model.createBasalMeltRateVec(self.grid))
            vecs.add(PISM.model.createTillPhiVec(self.grid))
            vecs.add(PISM.model.createBasalWaterVec(self.grid))
Ejemplo n.º 2
0
    def _allocExtraSSACoefficients(self):
        """Allocate storage for SSA coefficients."""
        vecs = self.modeldata.vecs
        if util.fileHasVariable(self.boot_file, 'ssa_driving_stress_x'):
            vecs.add(model.createDrivingStressXVec(self.grid))

        if util.fileHasVariable(self.boot_file, 'ssa_driving_stress_y'):
            vecs.add(model.createDrivingStressYVec(self.grid))

        no_model_mask = None
        # For a regional run we'll need no_model_mask, usurfstore, thkstore
        if self.is_regional:
            no_model_mask = model.createNoModelMaskVec(self.grid)
            vecs.add(no_model_mask, 'no_model_mask')
            vecs.add(model.createIceSurfaceStoreVec(self.grid))
            vecs.add(model.createIceThicknessStoreVec(self.grid))

        if self.config.get_boolean('ssa_dirichlet_bc'):
            vecs.add(model.create2dVelocityVec(self.grid, name='_ssa_bc',
                                               desc='SSA velocity boundary condition',
                                               intent='intent'),
                     "vel_ssa_bc")

            if self.is_regional:
                vecs.add(no_model_mask, 'bc_mask')
            else:
                vecs.add(model.createBCMaskVec(self.grid), 'bc_mask')

        if self.phi_to_tauc:
            vecs.add(PISM.model.createBasalMeltRateVec(self.grid))
            vecs.add(PISM.model.createTillPhiVec(self.grid))
            vecs.add(PISM.model.createBasalWaterVec(self.grid))
Ejemplo n.º 3
0
    def write(self, filename):
        """Override of :meth:`SSARun.write`.  Does all of the above, and saves a copy of the exact solution."""
        SSARun.write(self, filename)

        grid = self.grid
        exact = model.create2dVelocityVec(grid, name="_exact", desc="SSA exact solution", intent="diagnostic")
        exact.begin_access()
        for (i, j) in grid.points():
            exact[i, j] = self.exactSolution(i, j, grid.x(i), grid.y(j))
        exact.end_access()
        exact.write(filename)
Ejemplo n.º 4
0
    def write(self, filename):
        """Override of :meth:`SSARun.write`.  Does all of the above, and saves a copy of the exact solution."""
        SSARun.write(self, filename)

        grid = self.grid
        exact = model.create2dVelocityVec(grid,
                                          name="_exact",
                                          desc="SSA exact solution",
                                          intent="diagnostic")
        exact.begin_access()
        for (i, j) in grid.points():
            exact[i, j] = self.exactSolution(i, j, grid.x(i), grid.y(j))
        exact.end_access()
        exact.write(filename)
Ejemplo n.º 5
0
    def _allocateBCs(self, velname='_bc', maskname='bc_mask'):
        """Helper method that allocates standard Dirichlet data
            :cpp:class:`IceModelVec` variable and stores them in
            :attr:`modeldata` ``.vecs``:

          * ``vel_bc``
          * ``bc_mask``

        """
        vecs = self.modeldata.vecs
        vecs.add(
            model.create2dVelocityVec(self.grid,
                                      name=velname,
                                      desc='SSA velocity boundary condition',
                                      intent='intent'), "vel_bc")
        vecs.add(model.createBCMaskVec(self.grid, name=maskname), "bc_mask")
Ejemplo n.º 6
0
    def _allocateBCs(self, velname='_bc', maskname='bc_mask'):
        """Helper method that allocates standard Dirichlet data
            :cpp:class:`IceModelVec` variable and stores them in
            :attr:`modeldata` ``.vecs``:

          * ``vel_bc``
          * ``bc_mask``

        """
        vecs = self.modeldata.vecs
        vecs.add(model.create2dVelocityVec(self.grid,
                                           name=velname,
                                           desc='SSA velocity boundary condition',
                                           intent='intent'),
                 "vel_bc")
        vecs.add(model.createBCMaskVec(self.grid, name=maskname),
                 "bc_mask")