tSurfaceModel.hh - 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
---
tSurfaceModel.hh (4310B)
---
1 // Copyright (C) 2008-2018 Ed Bueler, Constantine Khroulev, Ricarda Winkelmann,
2 // Gudfinna Adalgeirsdottir and Andy Aschwanden
3 //
4 // This file is part of PISM.
5 //
6 // PISM is free software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the Free Software
8 // Foundation; either version 3 of the License, or (at your option) any later
9 // version.
10 //
11 // PISM is distributed in the hope that it will be useful, but WITHOUT ANY
12 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 // details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with PISM; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20 #ifndef __PISMSurfaceModel_hh
21 #define __PISMSurfaceModel_hh
22
23 /*!
24 * This file should contain the class definition and nothing else.
25 * Implementations should go in separate files.
26 */
27
28 #include "pism/util/Component.hh"
29
30 namespace pism {
31
32 namespace atmosphere {
33 class AtmosphereModel;
34 }
35
36 class Geometry;
37 class IceModelVec2S;
38
39 //! @brief Surface models and modifiers: provide top-surface
40 //! temperature, mass flux, liquid water fraction, mass and thickness of the surface
41 //! layer.
42 namespace surface {
43
44 //! \brief The interface of PISM's surface models.
45 class SurfaceModel : public Component {
46 public:
47 SurfaceModel(IceGrid::ConstPtr g);
48 SurfaceModel(IceGrid::ConstPtr g, std::shared_ptr<SurfaceModel> input);
49 SurfaceModel(IceGrid::ConstPtr g, std::shared_ptr<atmosphere::AtmosphereModel> atmosphere);
50
51 virtual ~SurfaceModel();
52
53 void init(const Geometry &geometry);
54
55 // the interface:
56 void update(const Geometry &geometry, double t, double dt);
57
58 const IceModelVec2S& accumulation() const;
59 const IceModelVec2S& layer_mass() const;
60 const IceModelVec2S& layer_thickness() const;
61 const IceModelVec2S& liquid_water_fraction() const;
62 const IceModelVec2S& mass_flux() const;
63 const IceModelVec2S& melt() const;
64 const IceModelVec2S& runoff() const;
65 const IceModelVec2S& temperature() const;
66
67 protected:
68
69 virtual const IceModelVec2S& accumulation_impl() const;
70 virtual const IceModelVec2S& layer_mass_impl() const;
71 virtual const IceModelVec2S& layer_thickness_impl() const;
72 virtual const IceModelVec2S& liquid_water_fraction_impl() const;
73 virtual const IceModelVec2S& mass_flux_impl() const;
74 virtual const IceModelVec2S& melt_impl() const;
75 virtual const IceModelVec2S& runoff_impl() const;
76 virtual const IceModelVec2S& temperature_impl() const;
77
78 virtual void init_impl(const Geometry &geometry);
79 virtual void update_impl(const Geometry &geometry, double t, double dt);
80
81 virtual void define_model_state_impl(const File &output) const;
82 virtual void write_model_state_impl(const File &output) const;
83
84 virtual MaxTimestep max_timestep_impl(double my_t) const;
85
86 virtual DiagnosticList diagnostics_impl() const;
87 virtual TSDiagnosticList ts_diagnostics_impl() const;
88
89 void dummy_accumulation(const IceModelVec2S& smb, IceModelVec2S& result);
90 void dummy_melt(const IceModelVec2S& smb, IceModelVec2S& result);
91 void dummy_runoff(const IceModelVec2S& smb, IceModelVec2S& result);
92
93 static IceModelVec2S::Ptr allocate_layer_mass(IceGrid::ConstPtr grid);
94 static IceModelVec2S::Ptr allocate_layer_thickness(IceGrid::ConstPtr grid);
95 static IceModelVec2S::Ptr allocate_liquid_water_fraction(IceGrid::ConstPtr grid);
96 static IceModelVec2S::Ptr allocate_mass_flux(IceGrid::ConstPtr grid);
97 static IceModelVec2S::Ptr allocate_temperature(IceGrid::ConstPtr grid);
98 static IceModelVec2S::Ptr allocate_accumulation(IceGrid::ConstPtr grid);
99 static IceModelVec2S::Ptr allocate_melt(IceGrid::ConstPtr grid);
100 static IceModelVec2S::Ptr allocate_runoff(IceGrid::ConstPtr grid);
101
102 protected:
103 IceModelVec2S::Ptr m_liquid_water_fraction;
104 IceModelVec2S::Ptr m_layer_mass;
105 IceModelVec2S::Ptr m_layer_thickness;
106 IceModelVec2S::Ptr m_accumulation;
107 IceModelVec2S::Ptr m_melt;
108 IceModelVec2S::Ptr m_runoff;
109
110 std::shared_ptr<SurfaceModel> m_input_model;
111 std::shared_ptr<atmosphere::AtmosphereModel> m_atmosphere;
112 };
113
114 } // end of namespace surface
115 } // end of namespace pism
116
117 #endif // __PISMSurfaceModel_hh