URI:
       tGeometryEvolution.hh - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch)
  HTML git clone git://src.adamsgaard.dk/pism
   DIR Log
   DIR Files
   DIR Refs
   DIR LICENSE
       ---
       tGeometryEvolution.hh (7757B)
       ---
            1 /* Copyright (C) 2016, 2017, 2019 PISM Authors
            2  *
            3  * This file is part of PISM.
            4  *
            5  * PISM is free software; you can redistribute it and/or modify it under the
            6  * terms of the GNU General Public License as published by the Free Software
            7  * Foundation; either version 3 of the License, or (at your option) any later
            8  * version.
            9  *
           10  * PISM is distributed in the hope that it will be useful, but WITHOUT ANY
           11  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           12  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
           13  * details.
           14  *
           15  * You should have received a copy of the GNU General Public License
           16  * along with PISM; if not, write to the Free Software
           17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
           18  */
           19 
           20 #ifndef GEOMETRYEVOLUTION_H
           21 #define GEOMETRYEVOLUTION_H
           22 
           23 #include "Geometry.hh"
           24 #include "pism/util/Component.hh"
           25 
           26 namespace pism {
           27 
           28 /*!
           29  * NB! Write this in a way that does not use ghosts of input fields (copy to temp. storage and
           30  * communicate).
           31  *
           32  * The promise:
           33  *
           34  * H_change + Href_change = dt * (SMB_rate + BMB_rate - flux_divergence) + conservation_error
           35  *
           36  * Href == 0 if H > 0
           37  */
           38 class GeometryEvolution : public Component {
           39 public:
           40   GeometryEvolution(IceGrid::ConstPtr grid);
           41   ~GeometryEvolution();
           42 
           43   void init(const InputOptions &opts);
           44 
           45   void flow_step(const Geometry &ice_geometry, double dt,
           46                  const IceModelVec2V    &advective_velocity,
           47                  const IceModelVec2Stag &diffusive_flux,
           48                  const IceModelVec2Int  &velocity_bc_mask,
           49                  const IceModelVec2Int  &thickness_bc_mask);
           50 
           51   void source_term_step(const Geometry &geometry, double dt,
           52                         const IceModelVec2Int &thickness_bc_mask,
           53                         const IceModelVec2S   &surface_mass_flux,
           54                         const IceModelVec2S   &basal_melt_rate);
           55 
           56   void apply_flux_divergence(Geometry &geometry) const;
           57   void apply_mass_fluxes(Geometry &geometry) const;
           58 
           59   const IceModelVec2S& top_surface_mass_balance() const;
           60   const IceModelVec2S& bottom_surface_mass_balance() const;
           61 
           62   const IceModelVec2S& thickness_change_due_to_flow() const;
           63   const IceModelVec2S& area_specific_volume_change_due_to_flow() const;
           64 
           65   const IceModelVec2S& conservation_error() const;
           66 
           67   // diagnostic
           68   const IceModelVec2Stag& flux_staggered() const;
           69   const IceModelVec2S& flux_divergence() const;
           70 
           71   // "regional" setup
           72   virtual void set_no_model_mask(const IceModelVec2Int &mask);
           73 protected:
           74   std::map<std::string,Diagnostic::Ptr> diagnostics_impl() const;
           75 
           76   virtual void init_impl(const InputOptions &opts);
           77 
           78   void update_in_place(double dt,
           79                        const IceModelVec2S& bed_elevation,
           80                        const IceModelVec2S& sea_level,
           81                        const IceModelVec2S& flux_divergence,
           82                        IceModelVec2S& ice_thickness,
           83                        IceModelVec2S& area_specific_volume);
           84 
           85   void residual_redistribution_iteration(const IceModelVec2S& bed_topography,
           86                                          const IceModelVec2S& sea_level,
           87                                          IceModelVec2S& ice_surface_elevation,
           88                                          IceModelVec2S& ice_thickness,
           89                                          IceModelVec2CellType& cell_type,
           90                                          IceModelVec2S& Href,
           91                                          IceModelVec2S& H_residual,
           92                                          bool &done);
           93 
           94   virtual void compute_interface_fluxes(const IceModelVec2CellType &cell_type,
           95                                         const IceModelVec2S        &ice_thickness,
           96                                         const IceModelVec2V        &velocity,
           97                                         const IceModelVec2Int      &velocity_bc_mask,
           98                                         const IceModelVec2Stag     &diffusive_flux,
           99                                         IceModelVec2Stag           &output);
          100 
          101   virtual void compute_flux_divergence(const IceModelVec2Stag &flux_staggered,
          102                                        const IceModelVec2Int &thickness_bc_mask,
          103                                        IceModelVec2S &flux_fivergence);
          104 
          105   virtual void ensure_nonnegativity(const IceModelVec2S &ice_thickness,
          106                                     const IceModelVec2S &area_specific_volume,
          107                                     IceModelVec2S &thickness_change,
          108                                     IceModelVec2S &area_specific_volume_change,
          109                                     IceModelVec2S &conservation_error);
          110 
          111   virtual void set_no_model_mask_impl(const IceModelVec2Int &mask);
          112 
          113   // note: cells with area_specific_volume > 0 do not experience changes due to surface and basal
          114   // mass balance sources
          115   virtual void compute_surface_and_basal_mass_balance(double dt,
          116                                                       const IceModelVec2Int      &thickness_bc_mask,
          117                                                       const IceModelVec2S        &ice_thickness,
          118                                                       const IceModelVec2CellType &cell_type,
          119                                                       const IceModelVec2S        &surface_mass_flux,
          120                                                       const IceModelVec2S        &basal_melt_rate,
          121                                                       IceModelVec2S              &effective_SMB,
          122                                                       IceModelVec2S              &effective_BMB);
          123 protected:
          124   struct Impl;
          125   Impl *m_impl;
          126 };
          127 
          128 class RegionalGeometryEvolution : public GeometryEvolution {
          129 public:
          130   RegionalGeometryEvolution(IceGrid::ConstPtr grid);
          131 
          132 protected:
          133   void set_no_model_mask_impl(const IceModelVec2Int &mask);
          134 
          135   void compute_interface_fluxes(const IceModelVec2CellType &cell_type,
          136                                 const IceModelVec2S        &ice_thickness,
          137                                 const IceModelVec2V        &velocity,
          138                                 const IceModelVec2Int      &velocity_bc_mask,
          139                                 const IceModelVec2Stag     &diffusive_flux,
          140                                 IceModelVec2Stag           &output);
          141 
          142   void compute_surface_and_basal_mass_balance(double dt,
          143                                               const IceModelVec2Int      &thickness_bc_mask,
          144                                               const IceModelVec2S        &ice_thickness,
          145                                               const IceModelVec2CellType &cell_type,
          146                                               const IceModelVec2S        &surface_mass_flux,
          147                                               const IceModelVec2S        &basal_melt_rate,
          148                                               IceModelVec2S              &effective_SMB,
          149                                               IceModelVec2S              &effective_BMB);
          150 private:
          151   IceModelVec2Int m_no_model_mask;
          152 };
          153 
          154 /*!
          155  * Compute the grounding line flux.
          156  *
          157  * The units of `result` are "kg m-2". Negative flux corresponds to ice moving into
          158  * the ocean, i.e. from grounded to floating areas.
          159  *
          160  * This convention makes it easier to compare this quantity to the surface mass balance or
          161  * calving fluxes.
          162  */
          163 void grounding_line_flux(const IceModelVec2CellType &cell_type,
          164                          const IceModelVec2Stag &flux,
          165                          double dt,
          166                          InsertMode flag,
          167                          IceModelVec2S &result);
          168 
          169 double total_grounding_line_flux(const IceModelVec2CellType &cell_type,
          170                                  const IceModelVec2Stag &flux,
          171                                  double dt);
          172 } // end of namespace pism
          173 
          174 #endif /* GEOMETRYEVOLUTION_H */