PISM, A Parallel Ice Sheet Model  stable v2.1.1 committed by Constantine Khrulev on 2024-12-04 13:36:58 -0900
IceEISModel.cc
Go to the documentation of this file.
1 // Copyright (C) 2004-2018, 2021, 2022, 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 #include <gsl/gsl_math.h> // M_PI
20 
21 #include "pism/icemodel/IceEISModel.hh"
22 
23 #include "pism/util/Context.hh"
24 #include "pism/util/Grid.hh"
25 
26 #include "pism/coupler/ocean/Constant.hh"
27 #include "pism/coupler/ocean/Initialization.hh"
28 
29 #include "pism/coupler/SeaLevel.hh"
30 #include "pism/coupler/ocean/sea_level/Initialization.hh"
31 
32 #include "pism/coupler/surface/EISMINTII.hh"
33 #include "pism/coupler/surface/Initialization.hh"
34 
35 #include "pism/earth/BedDef.hh"
36 
37 namespace pism {
38 
39 IceEISModel::IceEISModel(std::shared_ptr<Grid> g,
40  std::shared_ptr<Context> context,
41  char experiment)
42  : IceModel(g, context), m_experiment(experiment) {
43 }
44 
46 
47  // Climate will always come from intercomparison formulas.
48  if (not m_surface) {
49  auto surface = std::make_shared<surface::EISMINTII>(m_grid, m_experiment);
50  m_surface.reset(new surface::InitializationHelper(m_grid, surface));
51  m_submodels["surface process model"] = m_surface.get();
52  }
53 
54  if (not m_ocean) {
55  auto ocean = std::make_shared<ocean::Constant>(m_grid);
57  m_submodels["ocean model"] = m_ocean.get();
58  }
59 
60  if (not m_sea_level) {
61  auto sea_level = std::make_shared<ocean::sea_level::SeaLevel>(m_grid);
63  m_submodels["sea level forcing"] = m_sea_level.get();
64  }
65 }
66 
68  // computation based on code by Tony Payne, 6 March 1997:
69  // http://homepages.vub.ac.be/~phuybrec/eismint/topog2.f
70 
71  auto grid = result.grid();
72 
73  const double
74  b0 = 1000.0, // plateau elevation
75  L = 750.0e3, // half-width of computational domain
76  w = 200.0e3, // trough width
77  slope = b0 / L,
78  dx61 = (2.0 * L) / 60; // = 25.0e3
79 
80  array::AccessScope list(result);
81  for (auto p = grid->points(); p; p.next()) {
82  const int i = p.i(), j = p.j();
83 
84  const double nsd = i * grid->dx(), ewd = j * grid->dy();
85  if ((nsd >= (27 - 1) * dx61) && (nsd <= (35 - 1) * dx61) &&
86  (ewd >= (31 - 1) * dx61) && (ewd <= (61 - 1) * dx61)) {
87  result(i,j) = 1000.0 - std::max(0.0, slope * (ewd - L) * cos(M_PI * (nsd - L) / w));
88  } else {
89  result(i,j) = 1000.0;
90  }
91  }
92 }
93 
95  // computation based on code by Tony Payne, 6 March 1997:
96  // http://homepages.vub.ac.be/~phuybrec/eismint/topog2.f
97 
98  auto grid = result.grid();
99 
100  const double slope = 250.0;
101  const double w = 150.0e3; // mound width
102 
103  array::AccessScope list(result);
104  for (auto p = grid->points(); p; p.next()) {
105  const int i = p.i(), j = p.j();
106 
107  const double nsd = i * grid->dx(), ewd = j * grid->dy();
108  result(i,j) = fabs(slope * sin(M_PI * ewd / w) + slope * cos(M_PI * nsd / w));
109  }
110 }
111 
113 
114  m_log->message(2,
115  "initializing variables from EISMINT II experiment %c formulas... \n",
116  m_experiment);
117 
118  // set bed topography
119  switch (m_experiment) {
120  case 'I':
121  case 'J':
123  break;
124  case 'K':
125  case 'L':
127  break;
128  default:
130  break;
131  }
132 
134 
135  // set uplift
136  array::Scalar bed_uplift(m_grid, "uplift");
137  bed_uplift.set(0.0);
138 
139  // start with zero ice
141 
142  m_beddef->bootstrap(m_geometry.bed_elevation, bed_uplift, m_geometry.ice_thickness,
144 }
145 
146 void IceEISModel::bootstrap_2d(const File &input_file) {
147  (void) input_file;
149  "EISMINT II mode does not support bootstrapping");
150 }
151 
152 
153 } // end of namespace pism
High-level PISM I/O class.
Definition: File.hh:56
array::Scalar1 sea_level_elevation
Definition: Geometry.hh:48
array::Scalar2 ice_thickness
Definition: Geometry.hh:51
array::Scalar2 bed_elevation
Definition: Geometry.hh:47
void bootstrap_2d(const File &input_file)
Definition: IceEISModel.cc:146
void allocate_couplers()
Definition: IceEISModel.cc:45
IceEISModel(std::shared_ptr< Grid > g, std::shared_ptr< Context > ctx, char experiment)
Definition: IceEISModel.cc:39
std::map< std::string, const Component * > m_submodels
the list of sub-models, for writing model states and obtaining diagnostics
Definition: IceModel.hh:259
std::shared_ptr< ocean::OceanModel > m_ocean
Definition: IceModel.hh:287
std::shared_ptr< surface::SurfaceModel > m_surface
Definition: IceModel.hh:286
Geometry m_geometry
Definition: IceModel.hh:295
const Logger::Ptr m_log
Logger.
Definition: IceModel.hh:249
std::shared_ptr< ocean::sea_level::SeaLevel > m_sea_level
Definition: IceModel.hh:289
const std::shared_ptr< Grid > m_grid
Computational grid.
Definition: IceModel.hh:241
std::shared_ptr< bed::BedDef > m_beddef
Definition: IceModel.hh:291
static RuntimeError formatted(const ErrorLocation &location, const char format[],...) __attribute__((format(printf
build a RuntimeError with a formatted message
Makes sure that we call begin_access() and end_access() for all accessed array::Arrays.
Definition: Array.hh:65
std::shared_ptr< const Grid > grid() const
Definition: Array.cc:132
void set(double c)
Result: v[j] <- c for all j.
Definition: Array.cc:707
#define PISM_ERROR_LOCATION
static const double L
Definition: exactTestL.cc:40
static const double b0
Definition: exactTestL.cc:41
double max(const array::Scalar &input)
Finds maximum over all the values in an array::Scalar object. Ignores ghosts.
Definition: Scalar.cc:165
bool ocean(int M)
An ocean cell (floating ice or ice-free).
Definition: Mask.hh:40
void generate_trough_topography(array::Scalar &result)
Definition: IceEISModel.cc:67
static const double g
Definition: exactTestP.cc:36
void generate_mound_topography(array::Scalar &result)
Definition: IceEISModel.cc:94