PISM, A Parallel Ice Sheet Model  stable v2.1-1-g6902d5502 committed by Ed Bueler on 2023-12-20 08:38:27 -0800
NullTransportHydrology.cc
Go to the documentation of this file.
1 // Copyright (C) 2012-2014, 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/array/CellType.hh"
20 #include "pism/util/error_handling.hh"
21 #include "pism/icebin/NullTransportHydrology.hh"
22 #include "pism/geometry/Geometry.hh"
23 namespace pism {
24 namespace icebin {
25 
26 
27 NullTransportHydrology::NullTransportHydrology(std::shared_ptr<const pism::Grid> grid)
28  : pism::hydrology::NullTransport(grid), basal_runoff_sum(m_grid, "basal_runoff") {
30  .long_name(
31  "Effective thickness of subglacial water expelled from till (thickness of water, not ice)")
32  .units("m");
33 }
34 
35 
36 //! Update the till water thickness by simply integrating the melt input.
37 /*!
38 Does an explicit (Euler) step of the integration
39  \f[ \frac{\partial W_{til}}{\partial t} = \frac{m}{\rho_w} - C\f]
40 where \f$C=\f$`hydrology_tillwat_decay_rate_null`. Enforces bounds
41 \f$0 \le W_{til} \le W_{til}^{max}\f$ where the upper bound is
42 `hydrology_tillwat_max`. Here \f$m/\rho_w\f$ is `total_input`.
43 
44 There is no attempt to report on conservation errors because the model does
45 not conserve water.
46 
47 There is no tranportable water thickness variable and no interaction with it.
48  */
49 void NullTransportHydrology::update_impl(double t, double dt,
50  const hydrology::Inputs &inputs) {
51  (void) t;
52  const double tillwat_max = m_config->get_number("hydrology.tillwat_max"),
53  C = m_config->get_number("hydrology.tillwat_decay_rate");
54 
55  if (tillwat_max < 0.0) {
57  "hydrology::NullTransport: hydrology.tillwat_max is negative.\n"
58  "This is not allowed.");
59  }
60 
61  const auto &cell_type = inputs.geometry->cell_type;
62 
64 
65  for (Points p(*m_grid); p; p.next()) {
66  const int i = p.i(), j = p.j();
67 
68  if (cell_type.ocean(i, j) || cell_type.ice_free(i, j)) {
69  m_Wtill(i, j) = 0.0;
70  } else {
71  m_Wtill(i, j) += dt * (m_surface_input_rate(i, j) - C);
72  auto Wtil0 = m_Wtill(i, j); // ICEBIN ADDITION
73  m_Wtill(i, j) = std::min(std::max(0.0, m_Wtill(i, j)), tillwat_max);
74  basal_runoff_sum(i, j) += Wtil0 - m_Wtill(i, j); // ICEBIN ADDITION
75  }
76  }
77 }
78 } // end of namespace icebin
79 } // end of namespace pism
const Config::ConstPtr m_config
configuration database used by this component
Definition: Component.hh:158
const std::shared_ptr< const Grid > m_grid
grid used by this component
Definition: Component.hh:156
array::CellType2 cell_type
Definition: Geometry.hh:55
VariableMetadata & long_name(const std::string &input)
VariableMetadata & units(const std::string &input)
Makes sure that we call begin_access() and end_access() for all accessed array::Arrays.
Definition: Array.hh:65
SpatialVariableMetadata & metadata(unsigned int N=0)
Returns a reference to the SpatialVariableMetadata object containing metadata for the compoment N.
Definition: Array.cc:553
array::Scalar m_surface_input_rate
Definition: Hydrology.hh:179
array::Scalar m_Wtill
effective thickness of basal water stored in till
Definition: Hydrology.hh:170
const Geometry * geometry
Definition: Hydrology.hh:37
NullTransportHydrology(std::shared_ptr< const pism::Grid > grid)
void update_impl(double icet, double icedt, const hydrology::Inputs &inputs)
Update the till water thickness by simply integrating the melt input.
#define PISM_ERROR_LOCATION
double max(const array::Scalar &input)
Finds maximum over all the values in an array::Scalar object. Ignores ghosts.
Definition: Scalar.cc:165
double min(const array::Scalar &input)
Finds minimum over all the values in an array::Scalar object. Ignores ghosts.
Definition: Scalar.cc:193
const int C[]
Definition: ssafd_code.cc:44