Loading [MathJax]/extensions/tex2jax.js
PISM, A Parallel Ice Sheet Model 2.2.2-d6b3a29ca committed by Constantine Khrulev on 2025-03-28
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
IceModel.hh
Go to the documentation of this file.
1// Copyright (C) 2004-2024 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
57namespace pism {
58
59namespace ocean {
60class OceanModel;
61class PyOceanModel;
62namespace sea_level {
63class SeaLevel;
64}
65}
66
67namespace surface {
68class SurfaceModel;
69}
70
71namespace hydrology {
72class Hydrology;
73}
74
75namespace calving {
76class EigenCalving;
77class vonMisesCalving;
78class FloatKill;
79class HayhurstCalving;
80class CalvingAtThickness;
81class IcebergRemover;
82}
83
84class FractureDensity;
85
86namespace energy {
87class BedThermalUnit;
88class Inputs;
89class EnergyModelStats;
90class EnergyModel;
91}
92
93namespace frontalmelt {
94 class FrontalMelt;
95}
96
97namespace bed {
98class BedDef;
99}
100
101namespace array {
102class Forcing;
103class CellType;
104}
105
106class Grid;
107class AgeModel;
108class Isochrones;
109class Component;
110class FrontRetreat;
111class PrescribedRetreat;
112class ScalarForcing;
113
115
116//! The base class for PISM. Contains all essential variables, parameters, and flags for modelling
117//! an ice sheet.
118class IceModel {
119public:
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
145 const ocean::OceanModel* ocean_model() const;
149 const bed::BedDef* bed_deformation_model() const;
150
151 /*!
152 * Replace the ocean model with an implementation in Python.
153 */
154 void set_python_ocean_model(std::shared_ptr<ocean::PyOceanModel> model);
155
156 const Geometry& geometry() const;
158
159 double dt() const;
160
161protected:
162 virtual void allocate_submodels();
163 virtual void allocate_stressbalance();
164 virtual void allocate_age_model();
165 virtual void allocate_isochrones();
166 virtual void allocate_bed_deformation();
167 virtual void allocate_bedrock_thermal_unit();
168 virtual void allocate_energy_model();
169 virtual void allocate_subglacial_hydrology();
170 virtual void allocate_basal_yield_stress();
171 virtual void allocate_couplers();
172 virtual void allocate_geometry_evolution();
173 virtual void allocate_iceberg_remover();
174
176
178
180
181 virtual void time_setup();
182 virtual void model_state_setup();
183 virtual void misc_setup();
184 virtual void init_diagnostics();
185 virtual void init_calving();
186 virtual void init_frontal_melt();
187 virtual void init_front_retreat();
188 virtual void prune_diagnostics();
189 virtual void update_diagnostics(double dt);
190 virtual void reset_diagnostics();
191
192 virtual void step(bool do_mass_continuity, bool do_skip);
193 virtual void pre_step_hook();
194 virtual void post_step_hook();
195
196 void reset_counters();
197
198 // see iMbootstrap.cc
199 virtual void bootstrap_2d(const File &input_file);
200
201 // see iMoptions.cc
202 virtual void process_options();
203 virtual std::set<std::string> output_variables(const std::string &keyword);
204
205 virtual void compute_lat_lon();
206
207 // see iMIO.cc
208 virtual void restart_2d(const File &input_file, unsigned int record);
209 virtual void initialize_2d();
210
212 virtual void save_variables(const File &file,
213 OutputKind kind,
214 const std::set<std::string> &variables,
215 double time,
216 io::Type default_diagnostics_type = io::PISM_FLOAT) const;
217
218 virtual void define_model_state(const File &file) const;
219 virtual void write_model_state(const File &file) const;
220
223 virtual void write_metadata(const File &file, MappingTreatment mapping_flag,
224 HistoryTreatment history_flag) const;
225
226 virtual void define_diagnostics(const File &file,
227 const std::set<std::string> &variables,
228 io::Type default_type) const;
229 virtual void write_diagnostics(const File &file,
230 const std::set<std::string> &variables) const;
231
232 std::string save_state_on_error(const std::string &suffix,
233 const std::set<std::string> &additional_variables);
234
235 //! Computational grid
236 const std::shared_ptr<Grid> m_grid;
237 //! Configuration flags and parameters
239 //! Execution context
240 std::shared_ptr<Context> m_ctx;
241 //! Unit system
243 //! Logger
245 //! Time manager
247
248 //! stores global attributes saved in a PISM output file
250
251 //! the list of sub-models, for writing model states and obtaining diagnostics
252 std::map<std::string,const Component*> m_submodels;
253
254 std::unique_ptr<hydrology::Hydrology> m_subglacial_hydrology;
255 std::shared_ptr<YieldStress> m_basal_yield_stress_model;
256
257 std::shared_ptr<array::Forcing> m_surface_input_for_hydrology;
258
259 std::shared_ptr<energy::BedThermalUnit> m_btu;
260 std::shared_ptr<energy::EnergyModel> m_energy_model;
261
262 std::shared_ptr<AgeModel> m_age_model;
263 std::shared_ptr<Isochrones> m_isochrones;
264
265 std::shared_ptr<calving::IcebergRemover> m_iceberg_remover;
266 std::shared_ptr<calving::FloatKill> m_float_kill_calving;
267 std::shared_ptr<calving::CalvingAtThickness> m_thickness_threshold_calving;
268 std::shared_ptr<calving::EigenCalving> m_eigen_calving;
269 std::shared_ptr<calving::HayhurstCalving> m_hayhurst_calving;
270 std::shared_ptr<calving::vonMisesCalving> m_vonmises_calving;
271 std::shared_ptr<PrescribedRetreat> m_prescribed_retreat;
272
273 // scalar time-dependent scaling for retreat rates coming from eigen calving, von Mises
274 // calving, or Hayhurst calving
275 std::unique_ptr<ScalarForcing> m_calving_rate_factor;
276
277 std::shared_ptr<FrontRetreat> m_front_retreat;
278
279 std::shared_ptr<surface::SurfaceModel> m_surface;
280 std::shared_ptr<ocean::OceanModel> m_ocean;
281 std::shared_ptr<frontalmelt::FrontalMelt> m_frontal_melt;
282 std::shared_ptr<ocean::sea_level::SeaLevel> m_sea_level;
283
284 std::shared_ptr<bed::BedDef> m_beddef;
285
286 // state variables and some diagnostics/internals
287
289 std::unique_ptr<GeometryEvolution> m_geometry_evolution;
291
292 //! ghosted
294 //! rate of production of basal meltwater (ice-equivalent); no ghosts
296 //! temperature at the top surface of the bedrock thermal layer
298
299 std::shared_ptr<FractureDensity> m_fracture;
300
301 //! mask to determine Dirichlet boundary locations for the sliding velocity
303 //! Dirichlet boundary velocities
305
306 //! Mask prescribing locations where ice thickness is held constant
308
309 // parameters
310 //! mass continuity time step, s
311 double m_dt;
312 //! time of last update for enthalpy/temperature
313 double t_TempAge;
314 //! enthalpy/temperature and age time-steps
316
317 unsigned int m_skip_countdown;
318
320
321 std::string m_stdout_flags;
322
323 unsigned int m_step_counter;
324
325 // see iceModel.cc
326 virtual void allocate_storage();
327
329 double dt;
330 std::string reason;
331 unsigned int skip_counter;
332 };
333 virtual TimesteppingInfo max_timestep(unsigned int counter);
334
336 virtual unsigned int skip_counter(double input_dt, double input_dt_diffusivity);
337
338 // see energy.cc
339 virtual void bedrock_thermal_model_step();
340 virtual void energy_step();
341
342 virtual void hydrology_step();
343
344 virtual void combine_basal_melt_rate(const Geometry &geometry,
345 const array::Scalar &shelf_base_mass_flux,
346 const array::Scalar &grounded_basal_melt_rate,
347 array::Scalar &result);
348
351
352 /*!
353 * Compute the mask (`result`) identifying "open ocean" cells, i.e. "ice free ocean"
354 * cells that are reachable from open ocean cells at an edge of the domain.
355 *
356 * Here `result` is ghosted so that we can pass it to the connected component labeling
357 * algorithm.
358 */
359 void identify_open_ocean(const array::CellType &cell_type, array::Scalar1 &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);
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<stressbalance::StressBalance> m_stress_balance;
396
398 ThicknessChanges(const std::shared_ptr<const Grid> &grid);
399
400 // calving during the last time step
402
403 // frontal melt during the last time step
405
406 // parameterized retreat
408 };
409
411
412 /*!
413 * The set of variables that the "state" of IceModel consists of.
414 */
415 std::set<array::Array*> m_model_state;
416 //! Requested spatially-variable diagnostics.
417 std::map<std::string,Diagnostic::Ptr> m_diagnostics;
418 //! Requested scalar diagnostics.
419 std::map<std::string,TSDiagnostic::Ptr> m_ts_diagnostics;
420
421 // Set of variables to put in the output file:
422 std::set<std::string> m_output_vars;
423
424 // This is related to the snapshot saving feature
426 std::shared_ptr<File> m_snapshot_file;
428 std::vector<double> m_snapshot_times;
429 std::set<std::string> m_snapshot_vars;
430 unsigned int m_current_snapshot;
431 void init_snapshots();
432 void write_snapshot();
433 MaxTimestep save_max_timestep(double my_t);
434
435 //! file to write scalar time-series to
436 std::string m_ts_filename;
437 //! requested times for scalar time-series
438 std::shared_ptr<std::vector<double>> m_ts_times;
439 std::set<std::string> m_ts_vars;
440 void init_timeseries();
441 void flush_timeseries();
442 MaxTimestep ts_max_timestep(double my_t);
443
444 // spatially-varying time-series
446 std::string m_extra_filename;
447 std::vector<double> m_extra_times;
448 unsigned int m_next_extra;
450 std::set<std::string> m_extra_vars;
451 std::unique_ptr<File> m_extra_file;
452 void init_extras();
453 void write_extras();
454 MaxTimestep extras_max_timestep(double my_t);
455
456 // automatic checkpoints
459 std::set<std::string> m_checkpoint_vars;
460 void init_checkpoints();
461 bool write_checkpoint();
462
463 // last time at which PISM hit a multiple of X years, see the configuration parameter
464 // time_stepping.hit_multiples
466
467 // diagnostic viewers; see iMviewers.cc
468 virtual void update_viewers();
469 virtual void view_field(const array::Array *field);
470 std::map<std::string,
471 std::vector<std::shared_ptr<petsc::Viewer> > > m_viewers;
472
473private:
474 double m_start_time; // this is used in the wall-clock-time checkpoint code
475};
476
477void write_run_stats(const File &file, const pism::VariableMetadata &stats);
478
479MaxTimestep reporting_max_timestep(const std::vector<double> &times,
480 double t,
481 double eps,
482 const std::string &description);
483
484void bedrock_surface_temperature(const array::Scalar &sea_level,
485 const array::CellType &cell_type,
486 const array::Scalar &bed_topography,
487 const array::Scalar &ice_thickness,
488 const array::Scalar &basal_enthalpy,
489 const array::Scalar &ice_surface_temperature,
490 array::Scalar &result);
491
492} // end of namespace pism
493
494#endif /* PISM_ICEMODEL_H */
std::shared_ptr< Config > Ptr
High-level PISM I/O class.
Definition File.hh:55
std::string m_adaptive_timestep_reason
Definition IceModel.hh:319
unsigned int m_current_snapshot
Definition IceModel.hh:430
std::map< std::string, const Component * > m_submodels
the list of sub-models, for writing model states and obtaining diagnostics
Definition IceModel.hh:252
virtual energy::Inputs energy_model_inputs()
Definition IceModel.cc:342
std::set< std::string > m_snapshot_vars
Definition IceModel.hh:429
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:279
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.
std::string m_snapshots_filename
Definition IceModel.hh:425
virtual void define_diagnostics(const File &file, const std::set< std::string > &variables, io::Type default_type) const
Definition output.cc:243
const Geometry & geometry() const
Definition IceModel.cc:877
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:474
void init_checkpoints()
Initialize checkpointing (snapshot-on-wallclock-time) mechanism.
std::shared_ptr< stressbalance::StressBalance > m_stress_balance
Definition IceModel.hh:395
std::shared_ptr< Isochrones > m_isochrones
Definition IceModel.hh:263
IceModelTerminationReason run()
Definition IceModel.cc:750
virtual void init_calving()
Initialize calving mechanisms.
std::shared_ptr< ocean::OceanModel > m_ocean
Definition IceModel.hh:280
virtual void post_step_hook()
Virtual. Does nothing in IceModel. Derived classes can do more computation in each time step.
Definition IceModel.cc:722
const ocean::OceanModel * ocean_model() const
Definition IceModel.cc:889
VariableMetadata run_stats() const
Definition utilities.cc:91
std::map< std::string, TSDiagnostic::Ptr > m_ts_diagnostics
Requested scalar diagnostics.
Definition IceModel.hh:419
virtual void energy_step()
Manage the solution of the energy equation, and related parallel communication.
Definition energy.cc:60
unsigned int m_next_extra
Definition IceModel.hh:448
virtual void view_field(const array::Array *field)
Definition viewers.cc:33
std::unique_ptr< File > m_extra_file
Definition IceModel.hh:451
std::shared_ptr< surface::SurfaceModel > m_surface
Definition IceModel.hh:279
void write_extras()
Write spatially-variable diagnostic quantities.
bool m_split_snapshots
Definition IceModel.hh:427
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:323
virtual stressbalance::Inputs stress_balance_inputs()
Definition IceModel.cc:316
std::shared_ptr< FractureDensity > m_fracture
Definition IceModel.hh:299
virtual void bootstrap_2d(const File &input_file)
ThicknessChanges m_thickness_change
Definition IceModel.hh:410
virtual ~IceModel()
Definition IceModel.cc:157
void init()
Manage the initialization of the IceModel object.
Definition IceModel.cc:837
const Time::Ptr m_time
Time manager.
Definition IceModel.hh:246
Geometry m_geometry
Definition IceModel.hh:288
const GeometryEvolution & geometry_evolution() const
Definition IceModel.cc:881
const stressbalance::StressBalance * stress_balance() const
Definition IceModel.cc:885
bool m_new_bed_elevation
Definition IceModel.hh:290
std::vector< double > m_snapshot_times
Definition IceModel.hh:428
virtual void reset_diagnostics()
Definition IceModel.cc:1044
static const int m_n_work2d
Definition IceModel.hh:392
std::shared_ptr< YieldStress > m_basal_yield_stress_model
Definition IceModel.hh:255
std::shared_ptr< calving::IcebergRemover > m_iceberg_remover
Definition IceModel.hh:265
std::shared_ptr< std::vector< double > > m_ts_times
requested times for scalar time-series
Definition IceModel.hh:438
virtual void initialize_2d()
double m_timestep_hit_multiples_last_time
Definition IceModel.hh:465
virtual double compute_original_ice_fraction(double ice_volume)
std::shared_ptr< Context > m_ctx
Execution context.
Definition IceModel.hh:240
std::shared_ptr< frontalmelt::FrontalMelt > m_frontal_melt
Definition IceModel.hh:281
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:295
std::shared_ptr< Grid > grid() const
Return the grid used by this model.
Definition utilities.cc:121
virtual void front_retreat_step()
double m_last_checkpoint_time
Definition IceModel.hh:458
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...
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:244
virtual MaxTimestep max_timestep_diffusivity()
Compute the maximum time step allowed by the diffusive SIA.
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:110
std::shared_ptr< array::Forcing > m_surface_input_for_hydrology
Definition IceModel.hh:257
virtual void print_summary(bool tempAndAge)
Definition printout.cc:89
virtual void update_diagnostics(double dt)
Definition IceModel.cc:1030
array::Scalar m_bedtoptemp
temperature at the top surface of the bedrock thermal layer
Definition IceModel.hh:297
virtual void allocate_stressbalance()
Decide which stress balance model to use.
const energy::EnergyModel * energy_balance_model() const
Definition IceModel.cc:897
std::shared_ptr< calving::EigenCalving > m_eigen_calving
Definition IceModel.hh:268
std::unique_ptr< ScalarForcing > m_calving_rate_factor
Definition IceModel.hh:275
std::string save_state_on_error(const std::string &suffix, const std::set< std::string > &additional_variables)
Definition IceModel.cc:374
VariableMetadata m_output_global_attributes
stores global attributes saved in a PISM output file
Definition IceModel.hh:249
void flush_timeseries()
Flush scalar time-series.
Definition output_ts.cc:124
const array::Scalar & frontal_melt() const
Definition IceModel.cc:919
virtual void allocate_iceberg_remover()
const array::Scalar & forced_retreat() const
Definition IceModel.cc:926
std::vector< std::shared_ptr< array::Scalar2 > > m_work2d
Definition IceModel.hh:393
virtual void process_options()
double dt() const
Definition IceModel.cc:126
std::shared_ptr< calving::CalvingAtThickness > m_thickness_threshold_calving
Definition IceModel.hh:267
std::shared_ptr< calving::FloatKill > m_float_kill_calving
Definition IceModel.hh:266
virtual void allocate_subglacial_hydrology()
Decide which subglacial hydrology model to use.
std::shared_ptr< PrescribedRetreat > m_prescribed_retreat
Definition IceModel.hh:271
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:171
std::set< std::string > m_checkpoint_vars
Definition IceModel.hh:459
array::Scalar2 m_velocity_bc_mask
mask to determine Dirichlet boundary locations for the sliding velocity
Definition IceModel.hh:302
void reset_counters()
Definition IceModel.cc:130
virtual void prepend_history(const std::string &string)
Get time and user/host name and add it to the given string.
Definition utilities.cc:114
std::shared_ptr< calving::HayhurstCalving > m_hayhurst_calving
Definition IceModel.hh:269
virtual void write_model_state(const File &file) const
Definition output.cc:280
virtual void allocate_basal_yield_stress()
Decide which basal yield stress model to use.
std::string m_stdout_flags
Definition IceModel.hh:321
Config::Ptr m_config
Configuration flags and parameters.
Definition IceModel.hh:238
std::unique_ptr< GeometryEvolution > m_geometry_evolution
Definition IceModel.hh:289
virtual void step(bool do_mass_continuity, bool do_skip)
The contents of the main PISM time-step.
Definition IceModel.cc:406
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:449
virtual void allocate_energy_model()
virtual void hydrology_step()
Definition IceModel.cc:689
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:259
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:150
virtual void define_model_state(const File &file) const
Definition output.cc:266
std::set< array::Array * > m_model_state
Definition IceModel.hh:415
array::Scalar1 m_ice_thickness_bc_mask
Mask prescribing locations where ice thickness is held constant.
Definition IceModel.hh:307
std::shared_ptr< AgeModel > m_age_model
Definition IceModel.hh:262
virtual void init_front_retreat()
std::map< std::string, std::vector< std::shared_ptr< petsc::Viewer > > > m_viewers
Definition IceModel.hh:471
const bed::BedDef * bed_deformation_model() const
Definition IceModel.cc:905
std::shared_ptr< File > m_snapshot_file
Definition IceModel.hh:426
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:457
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:256
virtual void regrid()
Manage regridding based on user options.
const units::System::Ptr m_sys
Unit system.
Definition IceModel.hh:242
double t_TempAge
time of last update for enthalpy/temperature
Definition IceModel.hh:313
array::Vector2 m_velocity_bc_values
Dirichlet boundary velocities.
Definition IceModel.hh:304
virtual void prune_diagnostics()
Definition IceModel.cc:974
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:436
MaxTimestep save_max_timestep(double my_t)
Computes the maximum time-step we can take and still hit all -save_times.
virtual void update_fracture_density()
std::map< std::string, Diagnostic::Ptr > m_diagnostics
Requested spatially-variable diagnostics.
Definition IceModel.hh:417
void init_snapshots()
Initializes the snapshot-saving mechanism.
std::shared_ptr< ocean::sea_level::SeaLevel > m_sea_level
Definition IceModel.hh:282
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:912
virtual void pre_step_hook()
Virtual. Does nothing in IceModel. Derived classes can do more computation in each time step.
Definition IceModel.cc:717
std::set< std::string > m_ts_vars
Definition IceModel.hh:439
unsigned int m_skip_countdown
Definition IceModel.hh:317
IceModelTerminationReason run_to(double run_end)
Definition IceModel.cc:736
std::set< std::string > m_extra_vars
Definition IceModel.hh:450
std::shared_ptr< Context > ctx() const
Return the context this model is running in.
Definition utilities.cc:126
virtual YieldStressInputs yield_stress_inputs()
Definition IceModel.cc:364
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:901
std::unique_ptr< hydrology::Hydrology > m_subglacial_hydrology
Definition IceModel.hh:254
std::string m_extra_filename
Definition IceModel.hh:446
std::shared_ptr< calving::vonMisesCalving > m_vonmises_calving
Definition IceModel.hh:270
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:422
std::vector< double > m_extra_times
Definition IceModel.hh:447
const energy::BedThermalUnit * bedrock_thermal_model() const
Definition IceModel.cc:893
void set_python_ocean_model(std::shared_ptr< ocean::PyOceanModel > model)
Definition IceModel.cc:1057
virtual void allocate_isochrones()
double dt_TempAge
enthalpy/temperature and age time-steps
Definition IceModel.hh:315
virtual void init_frontal_melt()
double m_dt
mass continuity time step, s
Definition IceModel.hh:311
std::shared_ptr< energy::EnergyModel > m_energy_model
Definition IceModel.hh:260
const std::shared_ptr< Grid > m_grid
Computational grid.
Definition IceModel.hh:236
void identify_open_ocean(const array::CellType &cell_type, array::Scalar1 &result)
std::shared_ptr< bed::BedDef > m_beddef
Definition IceModel.hh:284
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:277
array::Scalar2 m_basal_yield_stress
ghosted
Definition IceModel.hh:293
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...
std::shared_ptr< Time > Ptr
Definition Time.hh:62
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:207
"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: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:336
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:254
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:143