PISM, A Parallel Ice Sheet Model  stable v2.1.1 committed by Constantine Khrulev on 2024-12-04 13:36:58 -0900
EnthalpyModel_Regional.cc
Go to the documentation of this file.
1 /* Copyright (C) 2016, 2017, 2019, 2020, 2022, 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 
20 #include "pism/regional/EnthalpyModel_Regional.hh"
21 
22 namespace pism {
23 namespace energy {
24 
26  std::shared_ptr<const Grid> grid,
27  std::shared_ptr<const stressbalance::StressBalance> stress_balance)
28  : EnthalpyModel(grid, stress_balance), m_basal_melt_rate_stored(m_grid, "bmr_stored") {
29  // Note that the name of this variable (bmr_stored) does not matter: it is
30  // *never* read or written. We make a copy of basal_melt_rate_grounded instead.
32  .long_name("time-independent basal melt rate in the no-model-strip")
33  .units("m s-1");
34 }
35 
36 void EnthalpyModel_Regional::restart_impl(const File &input_file, int record) {
37  EnthalpyModel::restart_impl(input_file, record);
38 
40 }
41 
43  const array::Scalar &ice_thickness,
44  const array::Scalar &surface_temperature,
45  const array::Scalar &climatic_mass_balance,
46  const array::Scalar &basal_heat_flux) {
47 
48  EnthalpyModel::bootstrap_impl(input_file, ice_thickness, surface_temperature,
49  climatic_mass_balance, basal_heat_flux);
50 
52 }
53 
55  const array::Scalar &ice_thickness,
56  const array::Scalar &surface_temperature,
57  const array::Scalar &climatic_mass_balance,
58  const array::Scalar &basal_heat_flux) {
59 
61  ice_thickness,
62  surface_temperature,
63  climatic_mass_balance,
64  basal_heat_flux);
65 
67 }
68 
69 
70 void EnthalpyModel_Regional::update_impl(double t, double dt,
71  const Inputs &inputs) {
72 
73  unsigned int Mz = m_grid->Mz();
74 
75  EnthalpyModel::update_impl(t, dt, inputs);
76 
77  const array::Scalar &no_model_mask = *inputs.no_model_mask;
78 
79  // The update_impl() call above sets m_work; ghosts are communicated
80  // later (in EnergyModel::update()).
81  array::AccessScope list{&no_model_mask, &m_work, &m_ice_enthalpy,
83 
84  for (auto p = m_grid->points(); p; p.next()) {
85  const int i = p.i(), j = p.j();
86 
87  if (no_model_mask(i, j) > 0.5) {
88  double *new_enthalpy = m_work.get_column(i, j);
89  double *old_enthalpy = m_ice_enthalpy.get_column(i, j);
90 
91  // enthalpy
92  for (unsigned int k = 0; k < Mz; ++k) {
93  new_enthalpy[k] = old_enthalpy[k];
94  }
95 
96  // basal melt rate
98  }
99  }
100 }
101 
102 } // end of namespace energy
103 } // end of namespace pism
const std::shared_ptr< const Grid > m_grid
grid used by this component
Definition: Component.hh:156
High-level PISM I/O class.
Definition: File.hh:56
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
void copy_from(const Array2D< T > &source)
Definition: Array2D.hh:73
double * get_column(int i, int j)
Definition: Array3D.cc:120
SpatialVariableMetadata & metadata(unsigned int N=0)
Returns a reference to the SpatialVariableMetadata object containing metadata for the compoment N.
Definition: Array.cc:553
const array::Scalar & basal_melt_rate() const
Basal melt rate in grounded areas. (It is set to zero elsewhere.)
Definition: EnergyModel.cc:307
array::Array3D m_ice_enthalpy
Definition: EnergyModel.hh:141
array::Scalar m_basal_melt_rate
Definition: EnergyModel.hh:143
virtual void initialize_impl(const array::Scalar &basal_melt_rate, const array::Scalar &ice_thickness, const array::Scalar &surface_temperature, const array::Scalar &climatic_mass_balance, const array::Scalar &basal_heat_flux)
virtual void restart_impl(const File &input_file, int record)
EnthalpyModel_Regional(std::shared_ptr< const Grid > grid, std::shared_ptr< const stressbalance::StressBalance > stress_balance)
virtual void bootstrap_impl(const File &input_file, const array::Scalar &ice_thickness, const array::Scalar &surface_temperature, const array::Scalar &climatic_mass_balance, const array::Scalar &basal_heat_flux)
virtual void initialize_impl(const array::Scalar &basal_melt_rate, const array::Scalar &ice_thickness, const array::Scalar &surface_temperature, const array::Scalar &climatic_mass_balance, const array::Scalar &basal_heat_flux)
virtual void restart_impl(const File &input_file, int record)
virtual void bootstrap_impl(const File &input_file, const array::Scalar &ice_thickness, const array::Scalar &surface_temperature, const array::Scalar &climatic_mass_balance, const array::Scalar &basal_heat_flux)
virtual void update_impl(double t, double dt, const Inputs &inputs)=0
The enthalpy-based energy balance model.
const array::Scalar * no_model_mask
Definition: EnergyModel.hh:58
static const double k
Definition: exactTestP.cc:42