PISM, A Parallel Ice Sheet Model 2.3.0-79cae578d committed by Constantine Khrulev on 2026-03-22
Loading...
Searching...
No Matches
IceModel.hh
Go to the documentation of this file.
1// Copyright (C) 2004-2026 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/Config.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
56namespace pism {
57
58namespace ocean {
59class OceanModel;
60class PyOceanModel;
61namespace sea_level {
62class SeaLevel;
63}
64}
65
66namespace surface {
67class SurfaceModel;
68}
69
70namespace hydrology {
71class Hydrology;
72}
73
74namespace calving {
75class EigenCalving;
76class vonMisesCalving;
77class FloatKill;
78class HayhurstCalving;
79class CalvingAtThickness;
80class IcebergRemover;
81}
82
83class FractureDensity;
84
85namespace energy {
86class BedThermalUnit;
87class Inputs;
88class EnergyModelStats;
89class EnergyModel;
90}
91
92namespace frontalmelt {
93 class FrontalMelt;
94}
95
96namespace bed {
97class BedDef;
98}
99
100namespace array {
101class Forcing;
102class CellType;
103}
104
105class Grid;
106class AgeModel;
107class Isochrones;
108class Component;
109class FrontRetreat;
110class PrescribedRetreat;
111class ScalarForcing;
112
113class OutputWriter;
114
116
118
119//! The base class for PISM. Contains all essential variables, parameters, and flags for modelling
120//! an ice sheet.
121class IceModel {
122public:
123 IceModel(std::shared_ptr<Grid> grid, const std::shared_ptr<Context> &context);
124
125 // the destructor must be virtual merely because some members are virtual
126 virtual ~IceModel();
127
128 std::shared_ptr<Grid> grid() const;
129 std::shared_ptr<Context> ctx() const;
130
131 void init(DiagnosticReport report_type = DIAG_NONE);
132
133 /** Run PISM in the "standalone" mode. */
135
136 /** Advance the current PISM run to a specific time */
137 IceModelTerminationReason run_to(double run_end);
138
139 void list_diagnostics(DiagnosticReport report_type) const;
140
141 void write_final_output();
142
143 const array::Scalar &calving() const;
144 const array::Scalar &frontal_melt() const;
145 const array::Scalar &forced_retreat() const;
146
148 const ocean::OceanModel* ocean_model() const;
152 const bed::BedDef* bed_deformation_model() const;
153
154 /*!
155 * Replace the ocean model with an implementation in Python.
156 */
157 void set_python_ocean_model(std::shared_ptr<ocean::PyOceanModel> model);
158
159 const Geometry& geometry() const;
161
162 double dt() const;
163
164protected:
165 virtual void allocate_submodels();
166 virtual void allocate_stressbalance();
167 virtual void allocate_age_model();
168 virtual void allocate_isochrones();
169 virtual void allocate_bed_deformation();
170 virtual void allocate_bedrock_thermal_unit();
171 virtual void allocate_energy_model();
172 virtual void allocate_subglacial_hydrology();
173 virtual void allocate_basal_yield_stress();
174 virtual void allocate_couplers();
175 virtual void allocate_geometry_evolution();
176 virtual void allocate_iceberg_remover();
177
179
181
183
184 virtual void model_state_setup(InputOptions input_options);
185 virtual void misc_setup(InputOptions input_options, DiagnosticReport report_type);
186 virtual void init_calving();
187 virtual void init_frontal_melt();
188 virtual void init_front_retreat();
189 virtual void update_diagnostics(double t, double dt);
190
191 virtual std::map<std::string, Diagnostic::Ptr> allocate_spatial_diagnostics();
192 virtual std::map<std::string, TSDiagnostic::Ptr> allocate_scalar_diagnostics();
194
195 void init_outputs(InputOptions options, DiagnosticReport report_type);
196
197 /*!
198 * Return the set of names of diagnostic quantities corresponding to a `keyword` (none,
199 * small, medium, big_2d, big).
200 */
201 virtual std::set<std::string> output_variables(const std::string &keyword);
202
203 /*!
204 * Return the set of all the diagnostic variables corresponding to the set of requested
205 * diagnostic *quantities* in `variable_names` (one quantity may map to two or more
206 * variables, e.g. velocities (2 or 3 vector components) of quantities on the staggered
207 * grid (2 grid offsets)).
208 */
209 virtual std::set<VariableMetadata>
210 diagnostic_variables(const std::set<std::string> &variable_names) const;
211
212 /*!
213 * Return the set of "state" variables, i.e. variables that describe the state of
214 * IceModel and of all its sub-models.
215 */
216 virtual std::set<VariableMetadata> state_variables() const;
217
218 /*!
219 * Return the set of "state" variables needed by the provided set of 2D and 3D
220 * diagnostic quantities.
221 */
222 std::set<VariableMetadata>
223 state_variables_diagnostics(const std::set<std::string> &variable_names) const;
224
225 /*!
226 * Return the set of "common" variables (i.e. ones written to most files): step counter,
227 * model-years-per-processor-hour, wall clock time since start, configuration
228 * parameters, grid mapping (if known).
229 */
230 std::set<VariableMetadata> common_metadata() const;
231
232 //! Name of the output file
233 std::string m_output_filename;
234
235 // Set of diagnostic quantities to put in the output file:
236 std::set<std::string> m_output_vars;
237
238 //! Set of variables that will be written to the output file
239 std::set<VariableMetadata> m_output_file_contents;
240
241 void init_final_output();
242
243 virtual double step(bool do_mass_continuity, bool do_skip);
244 virtual void pre_step_hook();
245 virtual void post_step_hook();
246
247 void reset_counters();
248
249 virtual void bootstrap_2d(const File &input_file);
250
251 virtual void compute_lat_lon();
252
253 virtual void restart_2d(const File &input_file, unsigned int record);
254 virtual void initialize_2d();
255
256 void define_time(const OutputFile &file, bool with_bounds = false) const;
257 void define_variables(const OutputFile &file, const std::set<VariableMetadata> &variables) const;
258
259 virtual void write_state(const OutputFile &file) const;
260
261 /*!
262 * Write state variables of diagnostic quantities in `variable_names` to `file`.
263 */
264 void write_state_diagnostics(const OutputFile &file,
265 const std::set<std::string> &variable_names) const;
266
267 void write_run_stats(const OutputFile &file) const;
268
269 void write_diagnostics(const OutputFile &file,
270 const std::set<std::string> &variable_names) const;
271
272 std::string save_state_on_error(const std::string &suffix,
273 const std::set<std::string> &additional_variables);
274
275 //! Computational grid
276 const std::shared_ptr<Grid> m_grid;
277 //! Configuration flags and parameters
278 std::shared_ptr<Config> m_config;
279 //! Execution context
280 std::shared_ptr<Context> m_ctx;
281 //! Unit system
283 //! Logger
284 std::shared_ptr<Logger> m_log;
285 //! Time manager
286 std::shared_ptr<Time> m_time;
287
288 std::shared_ptr<OutputWriter> m_output_writer;
289 std::shared_ptr<OutputWriter> m_snapshot_writer;
290 std::shared_ptr<OutputWriter> m_spatial_writer;
291
292 //! stores global attributes saved in a PISM output file
294 std::string m_output_history;
295
296 //! the list of sub-models, for writing model states and obtaining diagnostics
297 std::map<std::string,const Component*> m_submodels;
298
299 std::unique_ptr<hydrology::Hydrology> m_subglacial_hydrology;
300 std::shared_ptr<YieldStress> m_basal_yield_stress_model;
301
302 std::shared_ptr<array::Forcing> m_surface_input_for_hydrology;
303
304 std::shared_ptr<energy::BedThermalUnit> m_btu;
305 std::shared_ptr<energy::EnergyModel> m_energy_model;
306
307 std::shared_ptr<AgeModel> m_age_model;
308 std::shared_ptr<Isochrones> m_isochrones;
309
310 std::shared_ptr<calving::IcebergRemover> m_iceberg_remover;
311 std::shared_ptr<calving::FloatKill> m_float_kill_calving;
312 std::shared_ptr<calving::CalvingAtThickness> m_thickness_threshold_calving;
313 std::shared_ptr<calving::EigenCalving> m_eigen_calving;
314 std::shared_ptr<calving::HayhurstCalving> m_hayhurst_calving;
315 std::shared_ptr<calving::vonMisesCalving> m_vonmises_calving;
316 std::shared_ptr<PrescribedRetreat> m_prescribed_retreat;
317
318 // scalar time-dependent scaling for retreat rates coming from eigen calving, von Mises
319 // calving, or Hayhurst calving
320 std::unique_ptr<ScalarForcing> m_calving_rate_factor;
321
322 std::shared_ptr<FrontRetreat> m_front_retreat;
323
324 std::shared_ptr<surface::SurfaceModel> m_surface;
325 std::shared_ptr<ocean::OceanModel> m_ocean;
326 std::shared_ptr<frontalmelt::FrontalMelt> m_frontal_melt;
327 std::shared_ptr<ocean::sea_level::SeaLevel> m_sea_level;
328
329 std::shared_ptr<bed::BedDef> m_beddef;
330
331 // state variables and some diagnostics/internals
332
334 std::unique_ptr<GeometryEvolution> m_geometry_evolution;
336
337 //! ghosted
339 //! rate of production of basal meltwater (ice-equivalent); no ghosts
341 //! temperature at the top surface of the bedrock thermal layer
343
344 std::shared_ptr<FractureDensity> m_fracture;
345
346 //! mask to determine Dirichlet boundary locations for the sliding velocity
348 //! Dirichlet boundary velocities
350
351 //! Mask prescribing locations where ice thickness is held constant
353
354 // parameters
355 //! mass continuity time step, s
356 double m_dt;
357 //! time of last update for enthalpy/temperature
359 //! enthalpy/temperature and age time-steps
361
362 unsigned int m_skip_countdown;
363
365
366 std::string m_stdout_flags;
367
368 unsigned int m_step_counter;
369
370 // see iceModel.cc
371 virtual void allocate_storage();
372
374 double dt;
375 std::string reason;
376 unsigned int skip_counter;
377 };
378 virtual TimesteppingInfo max_timestep(unsigned int counter);
379
381 virtual unsigned int skip_counter(double input_dt, double input_dt_diffusivity);
382
383 // see energy.cc
384 virtual void bedrock_thermal_model_step(double t, double dt);
385 virtual void energy_step(double t, double dt);
386
387 virtual void hydrology_step(double t, double dt);
388
389 virtual void combine_basal_melt_rate(const Geometry &geometry,
390 const array::Scalar &shelf_base_mass_flux,
391 const array::Scalar &grounded_basal_melt_rate,
392 array::Scalar &result);
393
396
397 /*!
398 * Compute the mask (`result`) identifying "open ocean" cells, i.e. "ice free ocean"
399 * cells that are reachable from open ocean cells at an edge of the domain.
400 *
401 * Here `result` is ghosted so that we can pass it to the connected component labeling
402 * algorithm.
403 */
404 void identify_open_ocean(const array::CellType &cell_type, array::Scalar1 &result);
405
406 virtual void front_retreat_step(double t, double dt);
407
408 void compute_geometry_change(const array::Scalar &thickness,
409 const array::Scalar &Href,
410 const array::Scalar &thickness_old,
411 const array::Scalar &Href_old,
412 bool add_values,
413 array::Scalar &output);
414
415 // see iMIO.cc
416 virtual void regrid();
417
418 // see iMfractures.cc
419 virtual void update_fracture_density(double dt);
420
421 // see iMreport.cc
422 virtual double compute_temperate_base_fraction(double ice_area);
423 virtual double compute_original_ice_fraction(double ice_volume);
424 virtual void print_summary(bool tempAndAge, double dt);
425 virtual void print_summary_line(bool printPrototype, bool tempAndAge,
426 double delta_t,
427 double volume, double area,
428 double meltfrac, double max_diffusivity);
429
430
431 // see iMutil.cc
432 virtual int process_signals();
433 virtual void append_history(const std::string &string);
434
435 // working space (a convenience)
436 static const int m_n_work2d = 4;
437 mutable std::vector<std::shared_ptr<array::Scalar2>> m_work2d;
438
439 std::shared_ptr<stressbalance::StressBalance> m_stress_balance;
440
442 ThicknessChanges(const std::shared_ptr<const Grid> &grid);
443
444 // calving during the last time step
446
447 // frontal melt during the last time step
449
450 // parameterized retreat
452 };
453
455
456 /*!
457 * The set of variables that the "state" of IceModel consists of.
458 */
459 std::set<array::Array*> m_model_state;
460 //! Available spatially-variable diagnostics
461 std::map<std::string,Diagnostic::Ptr> m_available_spatial_diagnostics;
462 //! Available scalar diagnostics
463 std::map<std::string,TSDiagnostic::Ptr> m_available_scalar_diagnostics;
464
465 // This is related to the snapshot saving feature
467 std::shared_ptr<OutputFile> m_snapshot_file;
469 std::vector<double> m_snapshot_times;
470 unsigned int m_current_snapshot;
471 //! set of diagnostics to write to snapshot files (one diagnostic may correspond to
472 //! multiple NetCDF variables)
473 std::set<std::string> m_snapshot_vars;
474 //! set of variables that will be written to snapshot files
475 std::set<VariableMetadata> m_snapshot_file_contents;
476 void init_snapshots();
477 void write_snapshot();
479
480 //! file to write scalar time-series to
481 std::shared_ptr<OutputFile> m_scalar_file;
482 //! requested times for scalar time-series
483 std::shared_ptr<std::vector<double>> m_scalar_times;
484 std::set<std::string> m_scalar_vars;
488
489 // spatially-varying time-series
491 std::vector<double> m_spatial_times;
494 std::set<std::string> m_spatial_vars;
495
496 //! set of variables that will be written to extra files
497 std::set<VariableMetadata> m_spatial_file_contents;
498
499 std::shared_ptr<OutputFile> m_spatial_file;
503
504 // automatic checkpoints
507 std::set<std::string> m_checkpoint_vars;
508 //! set of variables that will be written to checkpoint files
509 std::set<VariableMetadata> m_checkpoint_file_contents;
510 void init_checkpoints();
511 bool write_checkpoint();
512
513 // last time at which PISM hit a multiple of X years, see the configuration parameter
514 // time_stepping.hit_multiples
516
517 // diagnostic viewers; see iMviewers.cc
518 virtual void update_viewers();
519 virtual void view_field(const array::Array *field);
520 std::map<std::string,
521 std::vector<std::shared_ptr<petsc::Viewer> > > m_viewers;
522
523private:
524 double m_start_time; // this is used in the wall-clock-time checkpoint code
525};
526
527MaxTimestep reporting_max_timestep(const std::vector<double> &times,
528 double t,
529 double eps,
530 const std::string &description);
531
532void bedrock_surface_temperature(const array::Scalar &sea_level,
533 const array::CellType &cell_type,
534 const array::Scalar &bed_topography,
535 const array::Scalar &ice_thickness,
536 const array::Scalar &basal_enthalpy,
537 const array::Scalar &ice_surface_temperature,
538 array::Scalar &result);
539
540} // end of namespace pism
541
542#endif /* PISM_ICEMODEL_H */
High-level PISM I/O class.
Definition File.hh:57
std::string m_adaptive_timestep_reason
Definition IceModel.hh:364
unsigned int m_current_snapshot
Definition IceModel.hh:470
std::map< std::string, const Component * > m_submodels
the list of sub-models, for writing model states and obtaining diagnostics
Definition IceModel.hh:297
virtual energy::Inputs energy_model_inputs()
Definition IceModel.cc:365
std::set< std::string > m_snapshot_vars
Definition IceModel.hh:473
virtual int process_signals()
Catch signals -USR1, -USR2 and -TERM.
Definition utilities.cc:48
virtual void hydrology_step(double t, double dt)
Definition IceModel.cc:692
void enforce_consistency_of_geometry(ConsistencyFlag flag)
Update the surface elevation and the flow-type mask when the geometry has changed.
Definition IceModel.cc:302
virtual double compute_temperate_base_fraction(double ice_area)
virtual void allocate_bed_deformation()
MaxTimestep scalar_diagnostics_max_timestep(double t)
Computes the maximum time-step we can take and still hit all -scalar_times.
std::string m_snapshots_filename
Definition IceModel.hh:466
const Geometry & geometry() const
Definition IceModel.cc:903
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)
double m_start_time
Definition IceModel.hh:524
void init_checkpoints()
Initialize checkpointing (snapshot-on-wallclock-time) mechanism.
std::shared_ptr< stressbalance::StressBalance > m_stress_balance
Definition IceModel.hh:439
std::shared_ptr< Isochrones > m_isochrones
Definition IceModel.hh:308
IceModelTerminationReason run()
Definition IceModel.cc:753
virtual void init_calving()
Initialize calving mechanisms.
std::shared_ptr< ocean::OceanModel > m_ocean
Definition IceModel.hh:325
virtual void post_step_hook()
Virtual. Does nothing in IceModel. Derived classes can do more computation in each time step.
Definition IceModel.cc:725
const ocean::OceanModel * ocean_model() const
Definition IceModel.cc:915
virtual void view_field(const array::Array *field)
Definition viewers.cc:33
std::shared_ptr< surface::SurfaceModel > m_surface
Definition IceModel.hh:324
void define_variables(const OutputFile &file, const std::set< VariableMetadata > &variables) const
Definition output.cc:206
bool m_split_snapshots
Definition IceModel.hh:468
virtual void compute_lat_lon()
void write_snapshot()
Writes a snapshot of the model state (if necessary)
unsigned int m_step_counter
Definition IceModel.hh:368
std::set< std::string > m_spatial_vars
Definition IceModel.hh:494
virtual stressbalance::Inputs stress_balance_inputs()
Definition IceModel.cc:339
std::shared_ptr< FractureDensity > m_fracture
Definition IceModel.hh:344
std::shared_ptr< Config > m_config
Configuration flags and parameters.
Definition IceModel.hh:278
virtual void bootstrap_2d(const File &input_file)
virtual std::map< std::string, Diagnostic::Ptr > allocate_spatial_diagnostics()
ThicknessChanges m_thickness_change
Definition IceModel.hh:454
double m_dt_TempAge
enthalpy/temperature and age time-steps
Definition IceModel.hh:360
MaxTimestep spatial_diagnostics_max_timestep(double t)
Computes the maximum time-step we can take and still hit all -spatial_times.
virtual ~IceModel()
Definition IceModel.cc:182
Geometry m_geometry
Definition IceModel.hh:333
virtual void update_fracture_density(double dt)
const GeometryEvolution & geometry_evolution() const
Definition IceModel.cc:907
void define_time(const OutputFile &file, bool with_bounds=false) const
Definition output.cc:73
const stressbalance::StressBalance * stress_balance() const
Definition IceModel.cc:911
bool m_new_bed_elevation
Definition IceModel.hh:335
void write_run_stats(const OutputFile &file) const
Definition output.cc:182
std::vector< double > m_snapshot_times
Definition IceModel.hh:469
static const int m_n_work2d
Definition IceModel.hh:436
std::shared_ptr< YieldStress > m_basal_yield_stress_model
Definition IceModel.hh:300
std::shared_ptr< calving::IcebergRemover > m_iceberg_remover
Definition IceModel.hh:310
MaxTimestep snapshots_max_timestep(double my_t)
Computes the maximum time-step we can take and still hit all -save_times.
virtual void initialize_2d()
double m_timestep_hit_multiples_last_time
Definition IceModel.hh:515
virtual double compute_original_ice_fraction(double ice_volume)
std::shared_ptr< Context > m_ctx
Execution context.
Definition IceModel.hh:280
std::shared_ptr< frontalmelt::FrontalMelt > m_frontal_melt
Definition IceModel.hh:326
std::shared_ptr< Logger > m_log
Logger.
Definition IceModel.hh:284
std::set< VariableMetadata > m_spatial_file_contents
set of variables that will be written to extra files
Definition IceModel.hh:497
array::Scalar m_basal_melt_rate
rate of production of basal meltwater (ice-equivalent); no ghosts
Definition IceModel.hh:340
std::shared_ptr< Grid > grid() const
Return the grid used by this model.
Definition utilities.cc:111
double m_last_checkpoint_time
Definition IceModel.hh:506
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...
std::set< std::string > m_scalar_vars
Definition IceModel.hh:484
virtual std::set< VariableMetadata > diagnostic_variables(const std::set< std::string > &variable_names) const
virtual MaxTimestep max_timestep_diffusivity()
Compute the maximum time step allowed by the diffusive SIA.
std::shared_ptr< OutputFile > m_snapshot_file
Definition IceModel.hh:467
std::shared_ptr< array::Forcing > m_surface_input_for_hydrology
Definition IceModel.hh:302
unsigned int m_next_spatial_index
Definition IceModel.hh:492
std::set< VariableMetadata > m_output_file_contents
Set of variables that will be written to the output file.
Definition IceModel.hh:239
std::shared_ptr< std::vector< double > > m_scalar_times
requested times for scalar time-series
Definition IceModel.hh:483
double m_t_TempAge
time of last update for enthalpy/temperature
Definition IceModel.hh:358
void list_diagnostics(DiagnosticReport report_type) const
array::Scalar m_bedtoptemp
temperature at the top surface of the bedrock thermal layer
Definition IceModel.hh:342
virtual void allocate_stressbalance()
Decide which stress balance model to use.
std::set< VariableMetadata > state_variables_diagnostics(const std::set< std::string > &variable_names) const
const energy::EnergyModel * energy_balance_model() const
Definition IceModel.cc:923
virtual std::set< VariableMetadata > state_variables() const
Definition output.cc:217
std::shared_ptr< calving::EigenCalving > m_eigen_calving
Definition IceModel.hh:313
virtual void update_diagnostics(double t, double dt)
std::unique_ptr< ScalarForcing > m_calving_rate_factor
Definition IceModel.hh:320
std::shared_ptr< OutputWriter > m_snapshot_writer
Definition IceModel.hh:289
std::string save_state_on_error(const std::string &suffix, const std::set< std::string > &additional_variables)
Definition output.cc:250
void init_outputs(InputOptions options, DiagnosticReport report_type)
VariableMetadata m_output_global_attributes
stores global attributes saved in a PISM output file
Definition IceModel.hh:293
std::shared_ptr< OutputWriter > m_spatial_writer
Definition IceModel.hh:290
std::shared_ptr< Time > m_time
Time manager.
Definition IceModel.hh:286
const array::Scalar & frontal_melt() const
Definition IceModel.cc:945
virtual void allocate_iceberg_remover()
const array::Scalar & forced_retreat() const
Definition IceModel.cc:952
std::vector< std::shared_ptr< array::Scalar2 > > m_work2d
Definition IceModel.hh:437
double dt() const
Definition IceModel.cc:151
std::shared_ptr< calving::CalvingAtThickness > m_thickness_threshold_calving
Definition IceModel.hh:312
std::shared_ptr< calving::FloatKill > m_float_kill_calving
Definition IceModel.hh:311
virtual void allocate_subglacial_hydrology()
Decide which subglacial hydrology model to use.
std::shared_ptr< PrescribedRetreat > m_prescribed_retreat
Definition IceModel.hh:316
void write_spatial_diagnostics()
Write spatially-variable diagnostic quantities.
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:196
std::set< std::string > m_checkpoint_vars
Definition IceModel.hh:507
array::Scalar2 m_velocity_bc_mask
mask to determine Dirichlet boundary locations for the sliding velocity
Definition IceModel.hh:347
void reset_counters()
Definition IceModel.cc:155
void init_scalar_diagnostics()
Initializes the code writing scalar time-series.
std::shared_ptr< calving::HayhurstCalving > m_hayhurst_calving
Definition IceModel.hh:314
std::vector< double > m_spatial_times
Definition IceModel.hh:491
virtual void allocate_basal_yield_stress()
Decide which basal yield stress model to use.
std::string m_stdout_flags
Definition IceModel.hh:366
std::unique_ptr< GeometryEvolution > m_geometry_evolution
Definition IceModel.hh:334
virtual void energy_step(double t, double dt)
Manage the solution of the energy equation, and related parallel communication.
Definition energy.cc:60
std::map< std::string, Diagnostic::Ptr > m_available_spatial_diagnostics
Available spatially-variable diagnostics.
Definition IceModel.hh:461
std::set< VariableMetadata > common_metadata() const
Definition output.cc:81
void write_state_diagnostics(const OutputFile &file, const std::set< std::string > &variable_names) const
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
virtual std::map< std::string, TSDiagnostic::Ptr > allocate_scalar_diagnostics()
std::shared_ptr< OutputFile > m_spatial_file
Definition IceModel.hh:499
void write_diagnostics(const OutputFile &file, const std::set< std::string > &variable_names) const
Writes variables listed in variable_names to file.
virtual void allocate_energy_model()
std::set< VariableMetadata > m_snapshot_file_contents
set of variables that will be written to snapshot files
Definition IceModel.hh:475
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 front_retreat_step(double t, double dt)
void init(DiagnosticReport report_type=DIAG_NONE)
Manage the initialization of the IceModel object.
Definition IceModel.cc:837
std::shared_ptr< energy::BedThermalUnit > m_btu
Definition IceModel.hh:304
std::string m_spatial_filename
Definition IceModel.hh:490
virtual void model_state_setup(InputOptions input_options)
Sets the starting values of model state variables.
std::set< array::Array * > m_model_state
Definition IceModel.hh:459
array::Scalar1 m_ice_thickness_bc_mask
Mask prescribing locations where ice thickness is held constant.
Definition IceModel.hh:352
std::shared_ptr< AgeModel > m_age_model
Definition IceModel.hh:307
virtual void init_front_retreat()
std::map< std::string, std::vector< std::shared_ptr< petsc::Viewer > > > m_viewers
Definition IceModel.hh:521
const bed::BedDef * bed_deformation_model() const
Definition IceModel.cc:931
virtual void allocate_bedrock_thermal_unit()
Decide which bedrock thermal unit to use.
virtual void bedrock_thermal_model_step(double t, double dt)
Definition energy.cc:38
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:505
void init_spatial_diagnostics()
Initialize the code saving spatially-variable diagnostic quantities.
virtual void regrid()
Manage regridding based on user options.
const units::System::Ptr m_sys
Unit system.
Definition IceModel.hh:282
std::map< std::string, TSDiagnostic::Ptr > m_available_scalar_diagnostics
Available scalar diagnostics.
Definition IceModel.hh:463
array::Vector2 m_velocity_bc_values
Dirichlet boundary velocities.
Definition IceModel.hh:349
virtual void allocate_geometry_evolution()
void write_final_output()
Save model state in NetCDF format.
Definition output.cc:155
void init_snapshots()
Initializes the snapshot-saving mechanism.
std::shared_ptr< ocean::sea_level::SeaLevel > m_sea_level
Definition IceModel.hh:327
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()
std::shared_ptr< OutputWriter > m_output_writer
Definition IceModel.hh:288
void scalar_diagnostics_flush_buffers()
Flush scalar time-series.
virtual double step(bool do_mass_continuity, bool do_skip)
The contents of the main PISM time-step.
Definition IceModel.cc:401
virtual void update_viewers()
Update the runtime graphical viewers.
Definition viewers.cc:58
const array::Scalar & calving() const
Definition IceModel.cc:938
void init_final_output()
Definition output.cc:114
std::string m_output_filename
Name of the output file.
Definition IceModel.hh:233
virtual void pre_step_hook()
Virtual. Does nothing in IceModel. Derived classes can do more computation in each time step.
Definition IceModel.cc:720
unsigned int m_skip_countdown
Definition IceModel.hh:362
IceModelTerminationReason run_to(double run_end)
Definition IceModel.cc:739
std::shared_ptr< Context > ctx() const
Return the context this model is running in.
Definition utilities.cc:116
std::string m_output_history
Definition IceModel.hh:294
virtual YieldStressInputs yield_stress_inputs()
Definition IceModel.cc:387
virtual void misc_setup(InputOptions input_options, DiagnosticReport report_type)
Miscellaneous initialization tasks plus tasks that need the fields that can come from regridding.
virtual void write_state(const OutputFile &file) const
Definition output.cc:240
virtual void allocate_couplers()
virtual void append_history(const std::string &string)
Get time and user/host name and add it to the given string.
Definition utilities.cc:106
const YieldStress * basal_yield_stress_model() const
Definition IceModel.cc:927
std::unique_ptr< hydrology::Hydrology > m_subglacial_hydrology
Definition IceModel.hh:299
std::shared_ptr< calving::vonMisesCalving > m_vonmises_calving
Definition IceModel.hh:315
std::shared_ptr< OutputFile > m_scalar_file
file to write scalar time-series to
Definition IceModel.hh:481
std::set< std::string > m_output_vars
Definition IceModel.hh:236
const energy::BedThermalUnit * bedrock_thermal_model() const
Definition IceModel.cc:919
std::set< VariableMetadata > m_checkpoint_file_contents
set of variables that will be written to checkpoint files
Definition IceModel.hh:509
virtual void print_summary(bool tempAndAge, double dt)
Definition printout.cc:89
void set_python_ocean_model(std::shared_ptr< ocean::PyOceanModel > model)
Definition IceModel.cc:963
virtual void allocate_isochrones()
virtual void init_frontal_melt()
double m_dt
mass continuity time step, s
Definition IceModel.hh:356
std::shared_ptr< energy::EnergyModel > m_energy_model
Definition IceModel.hh:305
const std::shared_ptr< Grid > m_grid
Computational grid.
Definition IceModel.hh:276
void identify_open_ocean(const array::CellType &cell_type, array::Scalar1 &result)
std::shared_ptr< bed::BedDef > m_beddef
Definition IceModel.hh:329
double m_last_spatial_time
Definition IceModel.hh:493
virtual TimesteppingInfo max_timestep(unsigned int counter)
Use various stability criteria to determine the time step for an evolution run.
virtual void allocate_submodels()
Allocate PISM's sub-models implementing some physical processes.
std::shared_ptr< FrontRetreat > m_front_retreat
Definition IceModel.hh:322
array::Scalar2 m_basal_yield_stress
ghosted
Definition IceModel.hh:338
void deallocate_unused_diagnostics()
Combines the max. time step with the flag indicating if a restriction is active. Makes is possible to...
The PISM basal yield stress model interface (virtual base class)
Abstract class for reading, writing, allocating, and accessing a DA-based PETSc Vec (2D and 3D fields...
Definition Array.hh:209
"Cell type" mask. Adds convenience methods to array::Scalar.
Definition CellType.hh:30
PISM bed deformation model (base class).
Definition BedDef.hh:37
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:38
The class defining PISM's interface to the shallow stress balance code.
std::shared_ptr< System > Ptr
Definition Units.hh:47
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:43
double ice_area(const Geometry &geometry, double thickness_threshold)
Computes ice area, in m^2.
Definition Geometry.cc:359
DiagnosticReport
Definition IceModel.hh:117
@ DIAG_JSON
Definition IceModel.hh:117
@ DIAG_SPATIAL
Definition IceModel.hh:117
@ DIAG_NONE
Definition IceModel.hh:117
@ DIAG_ALL
Definition IceModel.hh:117
@ DIAG_SCALAR
Definition IceModel.hh:117
IceModelTerminationReason
Definition IceModel.hh:115
@ PISM_SIGNAL
Definition IceModel.hh:115
@ PISM_DONE
Definition IceModel.hh:115
@ PISM_CHEKPOINT
Definition IceModel.hh:115
double ice_volume(const Geometry &geometry, double thickness_threshold)
Computes the ice volume, in m^3.
Definition Geometry.cc:277
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