PISM, A Parallel Ice Sheet Model  stable v2.0.5 committed by Constantine Khrulev on 2022-10-14 09:56:26 -0800
ConstantPIK.cc
Go to the documentation of this file.
1 // Copyright (C) 2008-2019 PISM Authors
2 //
3 // This file is part of PISM.
4 //
5 // PISM is free software; you can redistribute it and/or modify it under the
6 // terms of the GNU General Public License as published by the Free Software
7 // Foundation; either version 3 of the License, or (at your option) any later
8 // version.
9 //
10 // PISM is distributed in the hope that it will be useful, but WITHOUT ANY
11 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with PISM; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 #include "ConstantPIK.hh"
20 #include "pism/util/io/File.hh"
21 #include "pism/util/Vars.hh"
22 #include "pism/util/IceGrid.hh"
23 #include "pism/util/pism_utilities.hh"
24 #include "pism/util/MaxTimestep.hh"
25 #include "pism/geometry/Geometry.hh"
26 
27 namespace pism {
28 namespace surface {
29 
30 ///// Constant-in-time surface model for accumulation,
31 ///// ice surface temperature parameterized as in PISM-PIK dependent on latitude and surface elevation
32 
33 
34 PIK::PIK(IceGrid::ConstPtr grid, std::shared_ptr<atmosphere::AtmosphereModel> atmosphere)
35  : SurfaceModel(grid) {
36  (void) atmosphere;
37 
40 }
41 
42 void PIK::init_impl(const Geometry &geometry) {
43  (void) geometry;
44 
45  m_log->message(2,
46  "* Initializing the constant-in-time surface processes model PIK.\n"
47  " It reads surface mass balance directly from the file and holds it constant.\n"
48  " Ice upper-surface temperature is parameterized as in Martin et al. 2011, equation (1).\n"
49  " Any choice of atmosphere coupler (option '-atmosphere') is ignored.\n");
50 
52 
53  // read snow precipitation rate from file
54  m_log->message(2,
55  " reading surface mass balance rate 'climatic_mass_balance' from %s ... \n",
56  opts.filename.c_str());
57  if (opts.type == INIT_BOOTSTRAP) {
58  m_mass_flux->regrid(opts.filename, CRITICAL); // fails if not found!
59  } else {
60  m_mass_flux->read(opts.filename, opts.record); // fails if not found!
61  }
62 
63  // parameterizing the ice surface temperature 'ice_surface_temp'
64  m_log->message(2,
65  " parameterizing the ice surface temperature 'ice_surface_temp' ... \n");
66 }
67 
69  (void) t;
70  return MaxTimestep("surface PIK");
71 }
72 
73 void PIK::update_impl(const Geometry &geometry, double t, double dt) {
74  (void) t;
75  (void) dt;
76 
77  const IceModelVec2S
78  &surface_elevation = geometry.ice_surface_elevation,
79  &latitude = geometry.latitude;
80 
81  IceModelVec::AccessList list{ m_temperature.get(), &surface_elevation, &latitude };
82 
83  for (Points p(*m_grid); p; p.next()) {
84  const int i = p.i(), j = p.j();
85  (*m_temperature)(i, j) = 273.15 + 30 - 0.0075 * surface_elevation(i, j) - 0.68775 * latitude(i, j) * (-1.0);
86  }
87 
91 
92 }
93 
95  return *m_mass_flux;
96 }
97 
99  return *m_temperature;
100 }
101 
103  return *m_accumulation;
104 }
105 
107  return *m_melt;
108 }
109 
111  return *m_runoff;
112 }
113 
114 void PIK::define_model_state_impl(const File &output) const {
115  m_mass_flux->define(output);
117 }
118 
119 void PIK::write_model_state_impl(const File &output) const {
120  m_mass_flux->write(output);
122 }
123 
124 } // end of namespace surface
125 } // end of namespace pism
Makes sure that we call begin_access() and end_access() for all accessed IceModelVecs.
Definition: iceModelVec.hh:59
IceGrid::ConstPtr grid() const
Definition: Component.cc:105
const Config::ConstPtr m_config
configuration database used by this component
Definition: Component.hh:138
const Logger::ConstPtr m_log
logger (for easy access)
Definition: Component.hh:142
const IceGrid::ConstPtr m_grid
grid used by this component
Definition: Component.hh:136
High-level PISM I/O class.
Definition: File.hh:51
IceModelVec2S ice_surface_elevation
Definition: Geometry.hh:59
IceModelVec2S latitude
Definition: Geometry.hh:43
std::shared_ptr< const IceGrid > ConstPtr
Definition: IceGrid.hh:233
Combines the max. time step with the flag indicating if a restriction is active. Makes is possible to...
Definition: MaxTimestep.hh:31
const IceModelVec2S & temperature_impl() const
Definition: ConstantPIK.cc:98
MaxTimestep max_timestep_impl(double t) const
Definition: ConstantPIK.cc:68
const IceModelVec2S & accumulation_impl() const
Definition: ConstantPIK.cc:102
const IceModelVec2S & mass_flux_impl() const
Definition: ConstantPIK.cc:94
PIK(IceGrid::ConstPtr g, std::shared_ptr< atmosphere::AtmosphereModel > atmosphere)
Definition: ConstantPIK.cc:34
const IceModelVec2S & melt_impl() const
Definition: ConstantPIK.cc:106
IceModelVec2S::Ptr m_temperature
Definition: ConstantPIK.hh:55
const IceModelVec2S & runoff_impl() const
Definition: ConstantPIK.cc:110
void write_model_state_impl(const File &output) const
The default (empty implementation).
Definition: ConstantPIK.cc:119
IceModelVec2S::Ptr m_mass_flux
Definition: ConstantPIK.hh:54
void define_model_state_impl(const File &output) const
The default (empty implementation).
Definition: ConstantPIK.cc:114
void update_impl(const Geometry &geometry, double t, double dt)
Definition: ConstantPIK.cc:73
void init_impl(const Geometry &geometry)
Definition: ConstantPIK.cc:42
static IceModelVec2S::Ptr allocate_mass_flux(IceGrid::ConstPtr grid)
Definition: SurfaceModel.cc:76
virtual void write_model_state_impl(const File &output) const
The default (empty implementation).
virtual void define_model_state_impl(const File &output) const
The default (empty implementation).
IceModelVec2S::Ptr m_melt
IceModelVec2S::Ptr m_accumulation
static IceModelVec2S::Ptr allocate_temperature(IceGrid::ConstPtr grid)
Definition: SurfaceModel.cc:93
void dummy_accumulation(const IceModelVec2S &smb, IceModelVec2S &result)
IceModelVec2S::Ptr m_runoff
void dummy_runoff(const IceModelVec2S &smb, IceModelVec2S &result)
void dummy_melt(const IceModelVec2S &smb, IceModelVec2S &result)
The interface of PISM's surface models.
Definition: SurfaceModel.hh:45
InputOptions process_input_options(MPI_Comm com, Config::ConstPtr config)
Definition: Component.cc:45
@ INIT_BOOTSTRAP
Definition: Component.hh:39
@ CRITICAL
Definition: IO_Flags.hh:70
InitializationType type
initialization type
Definition: Component.hh:44
std::string filename
name of the input file (if applicable)
Definition: Component.hh:46
unsigned int record
index of the record to re-start from
Definition: Component.hh:48