tDrainageCalculator.hh - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch)
HTML git clone git://src.adamsgaard.dk/pism
DIR Log
DIR Files
DIR Refs
DIR LICENSE
---
tDrainageCalculator.hh (1940B)
---
1 // Copyright (C) 2009-2011, 2013, 2014, 2015, 2016, 2017 Andreas Aschwanden, 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 __DrainageCalculator_hh
20 #define __DrainageCalculator_hh
21
22 #include "pism/util/ConfigInterface.hh"
23
24 namespace pism {
25 namespace energy {
26
27 //! Compute the rate of drainage D(omega) for temperate ice.
28 class DrainageCalculator {
29
30 public:
31 DrainageCalculator(const Config &config) {
32 OM1 = config.get_number("energy.drainage_target_water_fraction"); // 0.01
33 OM2 = 2.0 * OM1;
34 OM3 = 3.0 * OM1;
35 DR3 = config.get_number("energy.drainage_maximum_rate"); // 0.05 year-1
36 DR2 = 0.1 * DR3;
37 }
38 virtual ~DrainageCalculator() {}
39
40 //! Return D(omega), as in figure in [\ref AschwandenBuelerKhroulevBlatter].
41 virtual double get_drainage_rate(double omega) {
42 if (omega > OM1) {
43 if (omega > OM2) {
44 if (omega > OM3) {
45 return DR3;
46 } else {
47 return DR2 + (DR3 - DR2) * (omega - OM2) / OM1;
48 }
49 } else {
50 return DR2 * (omega - OM1) / OM1;
51 }
52 } else {
53 return 0.0;
54 }
55 }
56
57 private:
58 double OM1, OM2, OM3, DR2, DR3;
59 };
60
61
62 } // end of namespace energy
63 } // end of namespace pism
64
65 #endif // __DrainageCalculator_hh
66