PISM, A Parallel Ice Sheet Model  stable v2.1.1 committed by Constantine Khrulev on 2024-12-04 13:36:58 -0900
IBSurfaceModel.cc
Go to the documentation of this file.
1 // Copyright (C) 2008-2016, 2023 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 "pism/util/MaxTimestep.hh"
20 #include "pism/util/io/File.hh"
21 #include "pism/icebin/IBSurfaceModel.hh"
22 
23 namespace pism {
24 namespace icebin {
25 
26 IBSurfaceModel::IBSurfaceModel(std::shared_ptr<const pism::Grid> grid)
27  : SurfaceModel(grid),
28  massxfer(grid, "massxfer"),
29  enthxfer(grid, "enthxfer"),
30  deltah(grid, "deltah"),
31  ice_top_bc_temp(grid, "ice_top_bc_temp"),
32  ice_top_bc_wc(grid, "ice_top_bc_wc") {
33 
35  .long_name("Mass of ice being transferred Stieglitz --> Icebin")
36  .units("kg m-2 s-1")
37  .standard_name("land_ice_surface_specific_mass_balance");
38 
40  .long_name("Enthalpy of ice being transferred Stieglitz --> Icebin")
41  .units("W m-2");
42 
43  // ------- Used only for mass/energy budget
44  deltah.metadata(0)
45  .long_name(
46  "enthalpy of constant-in-time ice-equivalent surface mass balance (accumulation/ablation) rate")
47  .units("W m-2");
48 
49  // ------- Dirichlet Bondary condition derived from deltah
50  ice_top_bc_temp.metadata(0).long_name("Temperature of the Dirichlet B.C.").units("K");
51  ice_top_bc_wc.metadata(0).long_name("Water content of the Dirichlet B.C.").units("1");
52 }
53 
54 void IBSurfaceModel::init_impl(const Geometry &geometry) {
55  (void)geometry;
56 
57  m_log->message(2, "* Initializing the IceBin interface surface model IBSurfaceModel.\n"
58  " IceBin changes its state when surface conditions change.\n");
59 
60  for (auto *v : {&massxfer, &enthxfer, &deltah, &ice_top_bc_temp, &ice_top_bc_wc}) {
61  v->set(0.0);
62  }
63 }
64 
66  (void)t;
67  return {};
68 }
69 
70 void IBSurfaceModel::update_impl(const Geometry &geometry, double t, double dt) {
71  (void)geometry;
72  (void)t;
73  (void)dt;
74 
75  // compute naive estimates of accumulation, melt, and runoff
79 }
80 
82  return ice_top_bc_wc;
83 }
84 
86  return massxfer;
87 }
88 
90  return ice_top_bc_temp;
91 }
92 
94  return *m_accumulation;
95 }
96 
98  return *m_melt;
99 }
100 
102  return *m_runoff;
103 }
104 
106  for (const auto *v : {&massxfer, &enthxfer, &deltah, &ice_top_bc_temp, &ice_top_bc_wc}) {
107  v->define(output, io::PISM_DOUBLE);
108  }
109 }
110 
111 void IBSurfaceModel::write_model_state_impl(const File &output) const {
112  for (const auto *v : {&massxfer, &enthxfer, &deltah, &ice_top_bc_temp, &ice_top_bc_wc}) {
113  v->write(output);
114  }
115 }
116 
117 } // namespace icebin
118 } // namespace pism
const Logger::ConstPtr m_log
logger (for easy access)
Definition: Component.hh:162
High-level PISM I/O class.
Definition: File.hh:56
Combines the max. time step with the flag indicating if a restriction is active. Makes is possible to...
Definition: MaxTimestep.hh:31
VariableMetadata & standard_name(const std::string &input)
VariableMetadata & long_name(const std::string &input)
VariableMetadata & units(const std::string &input)
SpatialVariableMetadata & metadata(unsigned int N=0)
Returns a reference to the SpatialVariableMetadata object containing metadata for the compoment N.
Definition: Array.cc:553
pism::array::Scalar enthxfer
MaxTimestep max_timestep_impl(double t) const
const array::Scalar & liquid_water_fraction_impl() const
pism::array::Scalar massxfer
void define_model_state_impl(const File &output) const
The default (empty implementation).
pism::array::Scalar ice_top_bc_wc
pism::array::Scalar deltah
const array::Scalar & melt_impl() const
const array::Scalar & accumulation_impl() const
const array::Scalar & mass_flux_impl() const
void write_model_state_impl(const File &output) const
The default (empty implementation).
void update_impl(const Geometry &geometry, double my_t, double my_dt)
void init_impl(const Geometry &geometry)
pism::array::Scalar ice_top_bc_temp
const array::Scalar & runoff_impl() const
const array::Scalar & temperature_impl() const
IBSurfaceModel(std::shared_ptr< const pism::Grid > grid)
void dummy_accumulation(const array::Scalar &smb, array::Scalar &result)
std::shared_ptr< array::Scalar > m_melt
std::shared_ptr< array::Scalar > m_runoff
void dummy_melt(const array::Scalar &smb, array::Scalar &result)
std::shared_ptr< array::Scalar > m_accumulation
void dummy_runoff(const array::Scalar &smb, array::Scalar &result)
@ PISM_DOUBLE
Definition: IO_Flags.hh:52