PISM, A Parallel Ice Sheet Model  stable v2.1-1-g6902d5502 committed by Ed Bueler on 2023-12-20 08:38:27 -0800
IceModel.hh
Go to the documentation of this file.
1 // Copyright (C) 2004-2023 Jed Brown, Ed Bueler and Constantine Khroulev
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 #ifndef PISM_ICEMODEL_H
20 #define PISM_ICEMODEL_H
21 
22 //! \file IceModel.hh Definition of class IceModel.
23 /*! \file IceModel.hh
24  IceModel is a big class which is an ice flow model. It contains all parts that
25  are not well-defined, separated components. Such components are better places
26  to put sub-models that have a clear, general interface to the rest of an ice
27  sheet model.
28 
29  IceModel has pointers to well-defined components, when they exist.
30 
31  IceModel generally interprets user options, and initializes components based on
32  such options. It manages the initialization sequences (%e.g. a restart from a
33  file containing a complete model state, versus bootstrapping).
34 */
35 
36 #include <map>
37 #include <set>
38 #include <string>
39 #include <vector>
40 #include <memory>
41 
42 // IceModel owns a bunch of fields, so we have to include this.
43 #include "pism/util/array/Vector.hh"
44 #include "pism/util/ConfigInterface.hh"
45 #include "pism/util/Context.hh"
46 #include "pism/util/Logger.hh"
47 #include "pism/util/Time.hh"
48 #include "pism/util/Diagnostic.hh"
49 #include "pism/util/MaxTimestep.hh"
50 #include "pism/geometry/Geometry.hh"
51 #include "pism/geometry/GeometryEvolution.hh"
52 #include "pism/stressbalance/StressBalance.hh"
53 #include "pism/basalstrength/YieldStress.hh"
54 #include "pism/util/ScalarForcing.hh" // for use with std::unique_ptr
55 #include "pism/util/petscwrappers/Vec.hh"
56 
57 namespace pism {
58 
59 namespace ocean {
60 class OceanModel;
61 class PyOceanModel;
62 namespace sea_level {
63 class SeaLevel;
64 }
65 }
66 
67 namespace surface {
68 class SurfaceModel;
69 }
70 
71 namespace hydrology {
72 class Hydrology;
73 }
74 
75 namespace calving {
76 class EigenCalving;
77 class vonMisesCalving;
78 class FloatKill;
79 class HayhurstCalving;
80 class CalvingAtThickness;
81 class IcebergRemover;
82 }
83 
84 class FractureDensity;
85 
86 namespace energy {
87 class BedThermalUnit;
88 class Inputs;
89 class EnergyModelStats;
90 class EnergyModel;
91 }
92 
93 namespace frontalmelt {
94  class FrontalMelt;
95 }
96 
97 namespace bed {
98 class BedDef;
99 }
100 
101 namespace array {
102 class Forcing;
103 class CellType;
104 }
105 
106 class Grid;
107 class AgeModel;
108 class Isochrones;
109 class Component;
110 class FrontRetreat;
111 class PrescribedRetreat;
112 class ScalarForcing;
113 
115 
116 //! The base class for PISM. Contains all essential variables, parameters, and flags for modelling
117 //! an ice sheet.
118 class IceModel {
119 public:
120  IceModel(std::shared_ptr<Grid> grid, const std::shared_ptr<Context> &context);
121 
122  // the destructor must be virtual merely because some members are virtual
123  virtual ~IceModel();
124 
125  std::shared_ptr<Grid> grid() const;
126  std::shared_ptr<Context> ctx() const;
127 
128  void init();
129 
130  /** Run PISM in the "standalone" mode. */
132 
133  /** Advance the current PISM run to a specific time */
134  IceModelTerminationReason run_to(double run_end);
135 
136  virtual void save_results();
137 
138  void list_diagnostics(const std::string &list_type) const;
139 
140  const array::Scalar &calving() const;
141  const array::Scalar &frontal_melt() const;
142  const array::Scalar &forced_retreat() const;
143 
144  double ice_volume_temperate(double thickness_threshold) const;
145  double ice_volume_cold(double thickness_threshold) const;
146  double temperate_base_area(double thickness_threshold) const;
147  double cold_base_area(double thickness_threshold) const;
148 
150  const ocean::OceanModel* ocean_model() const;
153  const YieldStress* basal_yield_stress_model() const;
154  const bed::BedDef* bed_deformation_model() const;
155 
156  /*!
157  * Replace the ocean model with an implementation in Python.
158  */
159  void set_python_ocean_model(std::shared_ptr<ocean::PyOceanModel> model);
160 
161  const Geometry& geometry() const;
162  const GeometryEvolution& geometry_evolution() const;
163 
164  double dt() const;
165 
166 protected:
167  virtual void allocate_submodels();
168  virtual void allocate_stressbalance();
169  virtual void allocate_age_model();
170  virtual void allocate_isochrones();
171  virtual void allocate_bed_deformation();
172  virtual void allocate_bedrock_thermal_unit();
173  virtual void allocate_energy_model();
174  virtual void allocate_subglacial_hydrology();
175  virtual void allocate_basal_yield_stress();
176  virtual void allocate_couplers();
177  virtual void allocate_geometry_evolution();
178  virtual void allocate_iceberg_remover();
179 
181 
183 
185 
186  virtual void time_setup();
187  virtual void model_state_setup();
188  virtual void misc_setup();
189  virtual void init_diagnostics();
190  virtual void init_calving();
191  virtual void init_frontal_melt();
192  virtual void init_front_retreat();
193  virtual void prune_diagnostics();
194  virtual void update_diagnostics(double dt);
195  virtual void reset_diagnostics();
196 
197  virtual void step(bool do_mass_continuity, bool do_skip);
198  virtual void pre_step_hook();
199  virtual void post_step_hook();
200 
201  void reset_counters();
202 
203  // see iMbootstrap.cc
204  virtual void bootstrap_2d(const File &input_file);
205 
206  // see iMoptions.cc
207  virtual void process_options();
208  virtual std::set<std::string> output_variables(const std::string &keyword);
209 
210  virtual void compute_lat_lon();
211 
212  // see iMIO.cc
213  virtual void restart_2d(const File &input_file, unsigned int record);
214  virtual void initialize_2d();
215 
217  virtual void save_variables(const File &file,
218  OutputKind kind,
219  const std::set<std::string> &variables,
220  double time,
221  io::Type default_diagnostics_type = io::PISM_FLOAT) const;
222 
223  virtual void define_model_state(const File &file) const;
224  virtual void write_model_state(const File &file) const;
225 
228  virtual void write_metadata(const File &file, MappingTreatment mapping_flag,
229  HistoryTreatment history_flag) const;
230 
231  virtual void define_diagnostics(const File &file,
232  const std::set<std::string> &variables,
233  io::Type default_type) const;
234  virtual void write_diagnostics(const File &file,
235  const std::set<std::string> &variables) const;
236 
237  std::string save_state_on_error(const std::string &suffix,
238  const std::set<std::string> &additional_variables);
239 
240  //! Computational grid
241  const std::shared_ptr<Grid> m_grid;
242  //! Configuration flags and parameters
244  //! Execution context
245  const std::shared_ptr<Context> m_ctx;
246  //! Unit system
248  //! Logger
250  //! Time manager
252 
253  const int m_wide_stencil;
254 
255  //! stores global attributes saved in a PISM output file
257 
258  //! the list of sub-models, for writing model states and obtaining diagnostics
259  std::map<std::string,const Component*> m_submodels;
260 
261  std::unique_ptr<hydrology::Hydrology> m_subglacial_hydrology;
262  std::shared_ptr<YieldStress> m_basal_yield_stress_model;
263 
264  std::shared_ptr<array::Forcing> m_surface_input_for_hydrology;
265 
266  std::shared_ptr<energy::BedThermalUnit> m_btu;
267  std::shared_ptr<energy::EnergyModel> m_energy_model;
268 
269  std::shared_ptr<AgeModel> m_age_model;
270  std::shared_ptr<Isochrones> m_isochrones;
271 
272  std::shared_ptr<calving::IcebergRemover> m_iceberg_remover;
273  std::shared_ptr<calving::FloatKill> m_float_kill_calving;
274  std::shared_ptr<calving::CalvingAtThickness> m_thickness_threshold_calving;
275  std::shared_ptr<calving::EigenCalving> m_eigen_calving;
276  std::shared_ptr<calving::HayhurstCalving> m_hayhurst_calving;
277  std::shared_ptr<calving::vonMisesCalving> m_vonmises_calving;
278  std::shared_ptr<PrescribedRetreat> m_prescribed_retreat;
279 
280  // scalar time-dependent scaling for retreat rates coming from eigen calving, von Mises
281  // calving, or Hayhurst calving
282  std::unique_ptr<ScalarForcing> m_calving_rate_factor;
283 
284  std::shared_ptr<FrontRetreat> m_front_retreat;
285 
286  std::shared_ptr<surface::SurfaceModel> m_surface;
287  std::shared_ptr<ocean::OceanModel> m_ocean;
288  std::shared_ptr<frontalmelt::FrontalMelt> m_frontal_melt;
289  std::shared_ptr<ocean::sea_level::SeaLevel> m_sea_level;
290 
291  std::shared_ptr<bed::BedDef> m_beddef;
292 
293  // state variables and some diagnostics/internals
294 
296  std::unique_ptr<GeometryEvolution> m_geometry_evolution;
298 
299  //! ghosted
301  //! rate of production of basal meltwater (ice-equivalent); no ghosts
303  //! temperature at the top surface of the bedrock thermal layer
305 
306  std::shared_ptr<FractureDensity> m_fracture;
307 
308  //! mask to determine Dirichlet boundary locations for the sliding velocity
310  //! Dirichlet boundary velocities
312 
313  //! Mask prescribing locations where ice thickness is held constant
315 
316  // parameters
317  //! mass continuity time step, s
318  double m_dt;
319  //! time of last update for enthalpy/temperature
320  double t_TempAge;
321  //! enthalpy/temperature and age time-steps
322  double dt_TempAge;
323 
324  unsigned int m_skip_countdown;
325 
327 
328  std::string m_stdout_flags;
329 
330  unsigned int m_step_counter;
331 
332  // see iceModel.cc
333  virtual void allocate_storage();
334 
336  double dt;
337  std::string reason;
338  unsigned int skip_counter;
339  };
340  virtual TimesteppingInfo max_timestep(unsigned int counter);
341 
343  virtual unsigned int skip_counter(double input_dt, double input_dt_diffusivity);
344 
345  // see energy.cc
346  virtual void bedrock_thermal_model_step();
347  virtual void energy_step();
348 
349  virtual void hydrology_step();
350 
351  virtual void combine_basal_melt_rate(const Geometry &geometry,
352  const array::Scalar &shelf_base_mass_flux,
353  const array::Scalar &grounded_basal_melt_rate,
354  array::Scalar &result);
355 
358 
359  void identify_open_ocean(const array::CellType &cell_type, array::Scalar &result);
360 
361  virtual void front_retreat_step();
362 
363  void compute_geometry_change(const array::Scalar &thickness,
364  const array::Scalar &Href,
365  const array::Scalar &thickness_old,
366  const array::Scalar &Href_old,
367  bool add_values,
368  array::Scalar &output);
369 
370  // see iMIO.cc
371  virtual void regrid();
372 
373  // see iMfractures.cc
374  virtual void update_fracture_density();
375 
376  // see iMreport.cc
377  virtual double compute_temperate_base_fraction(double ice_area);
378  virtual double compute_original_ice_fraction(double ice_volume);
379  virtual void print_summary(bool tempAndAge);
380  virtual void print_summary_line(bool printPrototype, bool tempAndAge,
381  double delta_t,
382  double volume, double area,
383  double meltfrac, double max_diffusivity);
384 
385 
386  // see iMutil.cc
387  virtual int process_signals();
388  virtual void prepend_history(const std::string &string);
389  VariableMetadata run_stats() const;
390 
391  // working space (a convenience)
392  static const int m_n_work2d = 4;
393  mutable std::vector<std::shared_ptr<array::Scalar2>> m_work2d;
394 
395  std::shared_ptr<petsc::Vec> m_work2d_proc0;
396 
397  std::shared_ptr<stressbalance::StressBalance> m_stress_balance;
398 
400  ThicknessChanges(const std::shared_ptr<const Grid> &grid);
401 
402  // calving during the last time step
404 
405  // frontal melt during the last time step
407 
408  // parameterized retreat
410  };
411 
413 
414  /*!
415  * The set of variables that the "state" of IceModel consists of.
416  */
417  std::set<array::Array*> m_model_state;
418  //! Requested spatially-variable diagnostics.
419  std::map<std::string,Diagnostic::Ptr> m_diagnostics;
420  //! Requested scalar diagnostics.
421  std::map<std::string,TSDiagnostic::Ptr> m_ts_diagnostics;
422 
423  // Set of variables to put in the output file:
424  std::set<std::string> m_output_vars;
425 
426  // This is related to the snapshot saving feature
427  std::string m_snapshots_filename;
429  std::vector<double> m_snapshot_times;
430  std::set<std::string> m_snapshot_vars;
431  unsigned int m_current_snapshot;
432  void init_snapshots();
433  void write_snapshot();
434  MaxTimestep save_max_timestep(double my_t);
435 
436  //! file to write scalar time-series to
437  std::string m_ts_filename;
438  //! requested times for scalar time-series
439  std::shared_ptr<std::vector<double>> m_ts_times;
440  std::set<std::string> m_ts_vars;
441  void init_timeseries();
442  void flush_timeseries();
443  MaxTimestep ts_max_timestep(double my_t);
444 
445  // spatially-varying time-series
447  std::string m_extra_filename;
448  std::vector<double> m_extra_times;
449  unsigned int m_next_extra;
450  double m_last_extra;
451  std::set<std::string> m_extra_vars;
453  std::unique_ptr<File> m_extra_file;
454  void init_extras();
455  void write_extras();
456  MaxTimestep extras_max_timestep(double my_t);
457 
458  // automatic checkpoints
461  std::set<std::string> m_checkpoint_vars;
462  void init_checkpoints();
463  bool write_checkpoint();
464 
465  // last time at which PISM hit a multiple of X years, see the configuration parameter
466  // time_stepping.hit_multiples
468 
469  // diagnostic viewers; see iMviewers.cc
470  virtual void update_viewers();
471  virtual void view_field(const array::Array *field);
472  std::map<std::string,
473  std::vector<std::shared_ptr<petsc::Viewer> > > m_viewers;
474 
475 private:
477  double m_start_time; // this is used in the wall-clock-time checkpoint code
478 };
479 
480 void write_mapping(const File &file, const pism::MappingInfo &info);
481 void write_run_stats(const File &file, const pism::VariableMetadata &stats);
482 
483 MaxTimestep reporting_max_timestep(const std::vector<double> &times,
484  double t,
485  double eps,
486  const std::string &description);
487 
488 void bedrock_surface_temperature(const array::Scalar &sea_level,
489  const array::CellType &cell_type,
490  const array::Scalar &bed_topography,
491  const array::Scalar &ice_thickness,
492  const array::Scalar &basal_enthalpy,
493  const array::Scalar &ice_surface_temperature,
494  array::Scalar &result);
495 
496 } // end of namespace pism
497 
498 #endif /* PISM_ICEMODEL_H */
std::shared_ptr< Config > Ptr
High-level PISM I/O class.
Definition: File.hh:56
std::string m_adaptive_timestep_reason
Definition: IceModel.hh:326
unsigned int m_current_snapshot
Definition: IceModel.hh:431
std::map< std::string, const Component * > m_submodels
the list of sub-models, for writing model states and obtaining diagnostics
Definition: IceModel.hh:259
virtual energy::Inputs energy_model_inputs()
Definition: IceModel.cc:356
std::set< std::string > m_snapshot_vars
Definition: IceModel.hh:430
virtual int process_signals()
Catch signals -USR1, -USR2 and -TERM.
Definition: utilities.cc:47
void enforce_consistency_of_geometry(ConsistencyFlag flag)
Update the surface elevation and the flow-type mask when the geometry has changed.
Definition: IceModel.cc:293
virtual double compute_temperate_base_fraction(double ice_area)
virtual void allocate_bed_deformation()
MaxTimestep extras_max_timestep(double my_t)
Computes the maximum time-step we can take and still hit all -extra_times.
Definition: output_extra.cc:33
std::string m_snapshots_filename
Definition: IceModel.hh:427
virtual void define_diagnostics(const File &file, const std::set< std::string > &variables, io::Type default_type) const
Definition: output.cc:252
const Geometry & geometry() const
Definition: IceModel.cc:893
void compute_geometry_change(const array::Scalar &thickness, const array::Scalar &Href, const array::Scalar &thickness_old, const array::Scalar &Href_old, bool add_values, array::Scalar &output)
virtual void model_state_setup()
Sets the starting values of model state variables.
double m_start_time
Definition: IceModel.hh:477
void init_checkpoints()
Initialize checkpointing (snapshot-on-wallclock-time) mechanism.
double ice_volume_temperate(double thickness_threshold) const
Computes the temperate ice volume, in m^3.
std::shared_ptr< stressbalance::StressBalance > m_stress_balance
Definition: IceModel.hh:397
std::shared_ptr< Isochrones > m_isochrones
Definition: IceModel.hh:270
VariableMetadata m_timestamp
Definition: IceModel.hh:476
IceModelTerminationReason run()
Definition: IceModel.cc:767
virtual void init_calving()
Initialize calving mechanisms.
std::shared_ptr< ocean::OceanModel > m_ocean
Definition: IceModel.hh:287
virtual void post_step_hook()
Virtual. Does nothing in IceModel. Derived classes can do more computation in each time step.
Definition: IceModel.cc:739
const ocean::OceanModel * ocean_model() const
Definition: IceModel.cc:905
VariableMetadata run_stats() const
Definition: utilities.cc:92
std::map< std::string, TSDiagnostic::Ptr > m_ts_diagnostics
Requested scalar diagnostics.
Definition: IceModel.hh:421
virtual void energy_step()
Manage the solution of the energy equation, and related parallel communication.
Definition: energy.cc:60
std::shared_ptr< petsc::Vec > m_work2d_proc0
Definition: IceModel.hh:395
unsigned int m_next_extra
Definition: IceModel.hh:449
virtual void view_field(const array::Array *field)
Definition: viewers.cc:33
std::unique_ptr< File > m_extra_file
Definition: IceModel.hh:453
std::shared_ptr< surface::SurfaceModel > m_surface
Definition: IceModel.hh:286
const Config::Ptr m_config
Configuration flags and parameters.
Definition: IceModel.hh:243
void write_extras()
Write spatially-variable diagnostic quantities.
bool m_split_snapshots
Definition: IceModel.hh:428
virtual void compute_lat_lon()
void write_snapshot()
Writes a snapshot of the model state (if necessary)
Definition: output_save.cc:111
double cold_base_area(double thickness_threshold) const
Computes area of basal ice which is cold, in m^2.
unsigned int m_step_counter
Definition: IceModel.hh:330
bool m_save_extra
Definition: IceModel.hh:446
virtual stressbalance::Inputs stress_balance_inputs()
Definition: IceModel.cc:330
std::shared_ptr< FractureDensity > m_fracture
Definition: IceModel.hh:306
virtual void bootstrap_2d(const File &input_file)
ThicknessChanges m_thickness_change
Definition: IceModel.hh:412
virtual ~IceModel()
Definition: IceModel.cc:171
void init()
Manage the initialization of the IceModel object.
Definition: IceModel.cc:854
const Time::Ptr m_time
Time manager.
Definition: IceModel.hh:251
Geometry m_geometry
Definition: IceModel.hh:295
const GeometryEvolution & geometry_evolution() const
Definition: IceModel.cc:897
const int m_wide_stencil
Definition: IceModel.hh:253
const stressbalance::StressBalance * stress_balance() const
Definition: IceModel.cc:901
bool m_new_bed_elevation
Definition: IceModel.hh:297
std::vector< double > m_snapshot_times
Definition: IceModel.hh:429
virtual void reset_diagnostics()
Definition: IceModel.cc:1063
static const int m_n_work2d
Definition: IceModel.hh:392
std::shared_ptr< YieldStress > m_basal_yield_stress_model
Definition: IceModel.hh:262
std::shared_ptr< calving::IcebergRemover > m_iceberg_remover
Definition: IceModel.hh:272
double temperate_base_area(double thickness_threshold) const
Computes area of basal ice which is temperate, in m^2.
std::shared_ptr< std::vector< double > > m_ts_times
requested times for scalar time-series
Definition: IceModel.hh:439
virtual void initialize_2d()
double m_timestep_hit_multiples_last_time
Definition: IceModel.hh:467
virtual double compute_original_ice_fraction(double ice_volume)
std::shared_ptr< frontalmelt::FrontalMelt > m_frontal_melt
Definition: IceModel.hh:288
void init_extras()
Initialize the code saving spatially-variable diagnostic quantities.
array::Scalar m_basal_melt_rate
rate of production of basal meltwater (ice-equivalent); no ghosts
Definition: IceModel.hh:302
std::shared_ptr< Grid > grid() const
Return the grid used by this model.
Definition: utilities.cc:122
virtual void front_retreat_step()
Definition: frontretreat.cc:86
double m_last_checkpoint_time
Definition: IceModel.hh:460
const std::shared_ptr< Context > m_ctx
Execution context.
Definition: IceModel.hh:245
virtual void save_results()
Save model state in NetCDF format.
Definition: output.cc:98
virtual unsigned int skip_counter(double input_dt, double input_dt_diffusivity)
Compute the skip counter using "long" (usually determined using the CFL stability criterion) and "sho...
Definition: timestepping.cc:75
virtual void misc_setup()
Miscellaneous initialization tasks plus tasks that need the fields that can come from regridding.
const Logger::Ptr m_log
Logger.
Definition: IceModel.hh:249
virtual MaxTimestep max_timestep_diffusivity()
Compute the maximum time step allowed by the diffusive SIA.
Definition: timestepping.cc:50
MaxTimestep ts_max_timestep(double my_t)
Computes the maximum time-step we can take and still hit all -ts_times.
Definition: output_ts.cc:108
std::shared_ptr< array::Forcing > m_surface_input_for_hydrology
Definition: IceModel.hh:264
virtual void print_summary(bool tempAndAge)
Definition: printout.cc:89
virtual void update_diagnostics(double dt)
Definition: IceModel.cc:1049
array::Scalar m_bedtoptemp
temperature at the top surface of the bedrock thermal layer
Definition: IceModel.hh:304
double ice_volume_cold(double thickness_threshold) const
Computes the cold ice volume, in m^3.
virtual void allocate_stressbalance()
Decide which stress balance model to use.
const energy::EnergyModel * energy_balance_model() const
Definition: IceModel.cc:913
std::shared_ptr< calving::EigenCalving > m_eigen_calving
Definition: IceModel.hh:275
std::unique_ptr< ScalarForcing > m_calving_rate_factor
Definition: IceModel.hh:282
std::string save_state_on_error(const std::string &suffix, const std::set< std::string > &additional_variables)
Definition: IceModel.cc:388
VariableMetadata m_output_global_attributes
stores global attributes saved in a PISM output file
Definition: IceModel.hh:256
void flush_timeseries()
Flush scalar time-series.
Definition: output_ts.cc:122
const array::Scalar & frontal_melt() const
Definition: IceModel.cc:935
virtual void allocate_iceberg_remover()
const array::Scalar & forced_retreat() const
Definition: IceModel.cc:942
std::vector< std::shared_ptr< array::Scalar2 > > m_work2d
Definition: IceModel.hh:393
virtual void process_options()
double dt() const
Definition: IceModel.cc:140
std::shared_ptr< calving::CalvingAtThickness > m_thickness_threshold_calving
Definition: IceModel.hh:274
std::shared_ptr< calving::FloatKill > m_float_kill_calving
Definition: IceModel.hh:273
virtual void allocate_subglacial_hydrology()
Decide which subglacial hydrology model to use.
void identify_open_ocean(const array::CellType &cell_type, array::Scalar &result)
Definition: frontretreat.cc:42
std::shared_ptr< PrescribedRetreat > m_prescribed_retreat
Definition: IceModel.hh:278
bool write_checkpoint()
Write a checkpoint (i.e. an intermediate result of a run).
virtual void allocate_storage()
Allocate all Arrays defined in IceModel.
Definition: IceModel.cc:185
std::set< std::string > m_checkpoint_vars
Definition: IceModel.hh:461
array::Scalar2 m_velocity_bc_mask
mask to determine Dirichlet boundary locations for the sliding velocity
Definition: IceModel.hh:309
void reset_counters()
Definition: IceModel.cc:144
virtual void prepend_history(const std::string &string)
Get time and user/host name and add it to the given string.
Definition: utilities.cc:115
std::shared_ptr< calving::HayhurstCalving > m_hayhurst_calving
Definition: IceModel.hh:276
virtual void write_model_state(const File &file) const
Definition: output.cc:289
virtual void allocate_basal_yield_stress()
Decide which basal yield stress model to use.
std::string m_stdout_flags
Definition: IceModel.hh:328
std::unique_ptr< GeometryEvolution > m_geometry_evolution
Definition: IceModel.hh:296
virtual void step(bool do_mass_continuity, bool do_skip)
The contents of the main PISM time-step.
Definition: IceModel.cc:423
virtual void combine_basal_melt_rate(const Geometry &geometry, const array::Scalar &shelf_base_mass_flux, const array::Scalar &grounded_basal_melt_rate, array::Scalar &result)
Combine basal melt rate in grounded and floating areas.
Definition: energy.cc:85
double m_last_extra
Definition: IceModel.hh:450
virtual void allocate_energy_model()
virtual void hydrology_step()
Definition: IceModel.cc:706
virtual void bedrock_thermal_model_step()
Definition: energy.cc:38
virtual void restart_2d(const File &input_file, unsigned int record)
Initialize 2D model state fields managed by IceModel from a file (for re-starting).
virtual void time_setup()
Initialize time from an input file or command-line options.
std::shared_ptr< energy::BedThermalUnit > m_btu
Definition: IceModel.hh:266
virtual void save_variables(const File &file, OutputKind kind, const std::set< std::string > &variables, double time, io::Type default_diagnostics_type=io::PISM_FLOAT) const
Definition: output.cc:169
virtual void define_model_state(const File &file) const
Definition: output.cc:275
std::set< array::Array * > m_model_state
Definition: IceModel.hh:417
array::Scalar1 m_ice_thickness_bc_mask
Mask prescribing locations where ice thickness is held constant.
Definition: IceModel.hh:314
@ DONT_REMOVE_ICEBERGS
Definition: IceModel.hh:356
std::shared_ptr< AgeModel > m_age_model
Definition: IceModel.hh:269
virtual void init_front_retreat()
std::map< std::string, std::vector< std::shared_ptr< petsc::Viewer > > > m_viewers
Definition: IceModel.hh:473
const bed::BedDef * bed_deformation_model() const
Definition: IceModel.cc:921
virtual void allocate_bedrock_thermal_unit()
Decide which bedrock thermal unit to use.
virtual std::set< std::string > output_variables(const std::string &keyword)
Assembles a list of diagnostics corresponding to an output file size.
std::string m_checkpoint_filename
Definition: IceModel.hh:459
virtual void write_diagnostics(const File &file, const std::set< std::string > &variables) const
Writes variables listed in vars to filename, using nctype to write fields stored in dedicated Arrays.
Definition: output.cc:265
virtual void regrid()
Manage regridding based on user options.
const units::System::Ptr m_sys
Unit system.
Definition: IceModel.hh:247
double t_TempAge
time of last update for enthalpy/temperature
Definition: IceModel.hh:320
array::Vector2 m_velocity_bc_values
Dirichlet boundary velocities.
Definition: IceModel.hh:311
virtual void prune_diagnostics()
Definition: IceModel.cc:990
virtual void allocate_geometry_evolution()
void list_diagnostics(const std::string &list_type) const
std::string m_ts_filename
file to write scalar time-series to
Definition: IceModel.hh:437
MaxTimestep save_max_timestep(double my_t)
Computes the maximum time-step we can take and still hit all -save_times.
Definition: output_save.cc:28
virtual void update_fracture_density()
std::map< std::string, Diagnostic::Ptr > m_diagnostics
Requested spatially-variable diagnostics.
Definition: IceModel.hh:419
IceModel(std::shared_ptr< Grid > grid, const std::shared_ptr< Context > &context)
Definition: IceModel.cc:56
void init_snapshots()
Initializes the snapshot-saving mechanism.
Definition: output_save.cc:42
std::shared_ptr< ocean::sea_level::SeaLevel > m_sea_level
Definition: IceModel.hh:289
virtual void print_summary_line(bool printPrototype, bool tempAndAge, double delta_t, double volume, double area, double meltfrac, double max_diffusivity)
Print a line to stdout which summarizes the state of the modeled ice sheet at the end of the time ste...
Definition: printout.cc:164
virtual void allocate_age_model()
virtual void update_viewers()
Update the runtime graphical viewers.
Definition: viewers.cc:58
const array::Scalar & calving() const
Definition: IceModel.cc:928
virtual void pre_step_hook()
Virtual. Does nothing in IceModel. Derived classes can do more computation in each time step.
Definition: IceModel.cc:734
std::set< std::string > m_ts_vars
Definition: IceModel.hh:440
unsigned int m_skip_countdown
Definition: IceModel.hh:324
IceModelTerminationReason run_to(double run_end)
Definition: IceModel.cc:753
std::set< std::string > m_extra_vars
Definition: IceModel.hh:451
std::shared_ptr< Context > ctx() const
Return the context this model is running in.
Definition: utilities.cc:127
virtual YieldStressInputs yield_stress_inputs()
Definition: IceModel.cc:378
virtual void init_diagnostics()
virtual void allocate_couplers()
virtual void write_metadata(const File &file, MappingTreatment mapping_flag, HistoryTreatment history_flag) const
Write time-independent metadata to a file.
Definition: output.cc:72
const YieldStress * basal_yield_stress_model() const
Definition: IceModel.cc:917
std::unique_ptr< hydrology::Hydrology > m_subglacial_hydrology
Definition: IceModel.hh:261
std::string m_extra_filename
Definition: IceModel.hh:447
std::shared_ptr< calving::vonMisesCalving > m_vonmises_calving
Definition: IceModel.hh:277
void init_timeseries()
Initializes the code writing scalar time-series.
Definition: output_ts.cc:45
std::set< std::string > m_output_vars
Definition: IceModel.hh:424
bool m_snapshots_file_is_ready
Definition: IceModel.hh:428
bool m_extra_file_is_ready
Definition: IceModel.hh:446
std::vector< double > m_extra_times
Definition: IceModel.hh:448
const energy::BedThermalUnit * bedrock_thermal_model() const
Definition: IceModel.cc:909
void set_python_ocean_model(std::shared_ptr< ocean::PyOceanModel > model)
Definition: IceModel.cc:1076
virtual void allocate_isochrones()
double dt_TempAge
enthalpy/temperature and age time-steps
Definition: IceModel.hh:322
virtual void init_frontal_melt()
double m_dt
mass continuity time step, s
Definition: IceModel.hh:318
bool m_split_extra
Definition: IceModel.hh:446
std::shared_ptr< energy::EnergyModel > m_energy_model
Definition: IceModel.hh:267
const std::shared_ptr< Grid > m_grid
Computational grid.
Definition: IceModel.hh:241
std::shared_ptr< bed::BedDef > m_beddef
Definition: IceModel.hh:291
virtual TimesteppingInfo max_timestep(unsigned int counter)
Use various stability criteria to determine the time step for an evolution run.
VariableMetadata m_extra_bounds
Definition: IceModel.hh:452
virtual void allocate_submodels()
Allocate PISM's sub-models implementing some physical processes.
std::shared_ptr< FrontRetreat > m_front_retreat
Definition: IceModel.hh:284
bool m_save_snapshots
Definition: IceModel.hh:428
array::Scalar2 m_basal_yield_stress
ghosted
Definition: IceModel.hh:300
std::shared_ptr< Logger > Ptr
Definition: Logger.hh:45
Combines the max. time step with the flag indicating if a restriction is active. Makes is possible to...
Definition: MaxTimestep.hh:31
std::shared_ptr< Time > Ptr
Definition: Time.hh:62
The PISM basal yield stress model interface (virtual base class)
Definition: YieldStress.hh:43
Abstract class for reading, writing, allocating, and accessing a DA-based PETSc Vec (2D and 3D fields...
Definition: Array.hh:208
"Cell type" mask. Adds convenience methods to array::Scalar.
Definition: CellType.hh:30
PISM bed deformation model (base class).
Definition: BedDef.hh:39
Given the temperature of the top of the bedrock, for the duration of one time-step,...
A very rudimentary PISM ocean model.
Definition: OceanModel.hh:33
The class defining PISM's interface to the shallow stress balance code.
std::shared_ptr< System > Ptr
Definition: Units.hh:47
@ PISM_FLOAT
Definition: IO_Flags.hh:51
bool ocean(int M)
An ocean cell (floating ice or ice-free).
Definition: Mask.hh:40
MaxTimestep reporting_max_timestep(const std::vector< double > &times, double t, double eps, const std::string &description)
Definition: output.cc:41
double ice_area(const Geometry &geometry, double thickness_threshold)
Computes ice area, in m^2.
Definition: Geometry.cc:324
void write_mapping(const File &file, const pism::MappingInfo &info)
Definition: output.cc:144
IceModelTerminationReason
Definition: IceModel.hh:114
@ PISM_SIGNAL
Definition: IceModel.hh:114
@ PISM_DONE
Definition: IceModel.hh:114
@ PISM_CHEKPOINT
Definition: IceModel.hh:114
double ice_volume(const Geometry &geometry, double thickness_threshold)
Computes the ice volume, in m^3.
Definition: Geometry.cc:253
void bedrock_surface_temperature(const array::Scalar &sea_level, const array::CellType &cell_type, const array::Scalar &bed_topography, const array::Scalar &ice_thickness, const array::Scalar &basal_enthalpy, const array::Scalar &ice_surface_temperature, array::Scalar &result)
Compute the temperature seen by the top of the bedrock thermal layer.
Definition: energy.cc:121
void write_run_stats(const File &file, const pism::VariableMetadata &stats)
Definition: output.cc:162
ThicknessChanges(const std::shared_ptr< const Grid > &grid)
Definition: IceModel.cc:1069