tIBSurfaceModel.cc - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch)
(HTM) git clone git://src.adamsgaard.dk/pism
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
tIBSurfaceModel.cc (4383B)
---
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 <gsl/gsl_math.h> // GSL_NAN
20
21 #include "pism/util/IceGrid.hh"
22 #include "pism/util/MaxTimestep.hh"
23 #include "pism/util/Vars.hh"
24 #include "pism/util/io/File.hh"
25 #include "pism/util/pism_utilities.hh"
26 #include "pism/icebin/IBSurfaceModel.hh"
27
28 namespace pism {
29 namespace icebin {
30
31 ///// Constant-in-time surface model for accumulation,
32 ///// ice surface temperature parameterized as in PISM-IBSurfaceModel dependent on latitude and surface elevation
33
34
35 IBSurfaceModel::IBSurfaceModel(IceGrid::ConstPtr g)
36 : SurfaceModel(g) {
37
38 printf("BEGIN IBSurfaceModel::allocate_IBSurfaceModel()\n");
39 icebin_wflux.create(m_grid, "icebin_wflux", WITHOUT_GHOSTS);
40 icebin_wflux.set_attrs("climate_state",
41 "constant-in-time ice-equivalent surface mass balance (accumulation/ablation) rate",
42 "kg m-2 s-1", "kg m-2 year-1", "land_ice_surface_specific_mass_balance", 0);
43
44 icebin_deltah.create(m_grid, "icebin_deltah", WITHOUT_GHOSTS);
45 icebin_deltah.set_attrs(
46 "climate_state", "enthalpy of constant-in-time ice-equivalent surface mass balance (accumulation/ablation) rate",
47 "W m-2", "W m-2", "", 0);
48
49 icebin_massxfer.create(m_grid, "icebin_massxfer", WITHOUT_GHOSTS);
50 icebin_massxfer.set_attrs(
51 "climate_state", "enthalpy of constant-in-time ice-equivalent surface mass balance (accumulation/ablation) rate",
52 "kg m-2 s-1", "kg m-2 s-1", "", 0);
53
54
55 icebin_enthxfer.create(m_grid, "icebin_enthxfer", WITHOUT_GHOSTS);
56 icebin_enthxfer.set_attrs("climate_state", "constant-in-time heat flux through top surface",
57 "W m-2", "W m-2", "", 0);
58
59 // This variable is computed from the inputs above.
60 surface_temp.create(m_grid, "surface_temp", WITHOUT_GHOSTS);
61 surface_temp.set_attrs("climate_state", "Temperature to use for Dirichlet B.C. at surface",
62 "K", "K", "", 0);
63
64 printf("END IBSurfaceModel::allocate_IBSurfaceModel()\n");
65 }
66
67 void IBSurfaceModel::init_impl(const Geometry &geometry) {
68 (void) geometry;
69
70 m_log->message(2, "* Initializing the IceBin interface surface model IBSurfaceModel.\n"
71 " IceBin changes its state when surface conditions change.\n");
72
73 // find PISM input file to read data from:
74 m_input_file = process_input_options(m_grid->com, m_config).filename;
75
76 // It doesn't matter what we set this to, it will be re-set later.
77 icebin_wflux.set(0.0);
78 icebin_deltah.set(0.0);
79 icebin_massxfer.set(0.0);
80 icebin_enthxfer.set(0.0);
81 surface_temp.set(0.0);
82
83 _initialized = true;
84 }
85
86 MaxTimestep IBSurfaceModel::max_timestep_impl(double t) const {
87 (void)t;
88 return MaxTimestep("surface icebin");
89 }
90
91 void IBSurfaceModel::update_impl(const Geometry &geometry, double t, double dt) {
92 (void) geometry;
93 (void) t;
94 (void) dt;
95 }
96
97 const IceModelVec2S &IBSurfaceModel::mass_flux_impl() const {
98 return icebin_massxfer;
99 }
100
101 const IceModelVec2S &IBSurfaceModel::temperature_impl() const {
102 return surface_temp;
103 }
104
105 void IBSurfaceModel::define_model_state_impl(const File &output) const {
106 SurfaceModel::define_model_state_impl(output);
107 icebin_enthxfer.define(output);
108 icebin_wflux.define(output);
109 icebin_deltah.define(output);
110 icebin_massxfer.define(output);
111 surface_temp.define(output);
112 }
113
114 void IBSurfaceModel::write_model_state_impl(const File &output) const {
115 SurfaceModel::write_model_state_impl(output);
116 icebin_enthxfer.write(output);
117 icebin_wflux.write(output);
118 icebin_deltah.write(output);
119 icebin_massxfer.write(output);
120 surface_temp.write(output);
121 }
122
123 } // end of namespace surface
124 } // end of namespace pism