PISM, A Parallel Ice Sheet Model  stable v2.1.1 committed by Constantine Khrulev on 2024-12-04 13:36:58 -0900
enthSystem.hh
Go to the documentation of this file.
1 // Copyright (C) 2009-2011, 2013, 2014, 2015, 2016, 2017, 2018, 2020, 2022, 2023 Andreas Aschwanden and Ed Bueler
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 __enthSystem_hh
20 #define __enthSystem_hh
21 
22 #include <vector>
23 
24 #include "pism/util/ColumnSystem.hh"
25 #include "pism/util/EnthalpyConverter.hh"
26 
27 namespace pism {
28 
29 class Config;
30 
31 namespace energy {
32 
33 //! Tridiagonal linear system for conservation of energy in vertical column of ice enthalpy.
34 /*!
35  See the page documenting \ref bombproofenth. The top of
36  the ice has a Dirichlet condition.
37 */
39 
40 public:
41  enthSystemCtx(const std::vector<double>& storage_grid,
42  const std::string &prefix,
43  double dx, double dy, double dt,
44  const Config &config,
45  const array::Array3D &Enth3,
46  const array::Array3D &u3,
47  const array::Array3D &v3,
48  const array::Array3D &w3,
49  const array::Array3D &strain_heating3,
51  ~enthSystemCtx() = default;
52 
53  void init(int i, int j, bool ismarginal, double ice_thickness);
54 
55  double k_from_T(double T) const;
56 
57  void set_surface_heat_flux(double heat_flux);
58  void set_surface_neumann_bc(double dE);
59  void set_surface_dirichlet_bc(double E_surface);
60 
61  void set_basal_dirichlet_bc(double E_basal);
62  void set_basal_heat_flux(double heat_flux);
63  void set_basal_neumann_bc(double dE);
64 
65  virtual void save_system(std::ostream &output, unsigned int M) const;
66 
67  void solve(std::vector<double> &result);
68 
69  double lambda() const {
70  return m_lambda;
71  }
72 
73  double Enth(size_t i) const {
74  return m_Enth[i];
75  }
76 
77  double Enth_s(size_t i) const {
78  return m_Enth_s[i];
79  }
80 protected:
81  // enthalpy in ice at previous time step
82  std::vector<double> m_Enth;
83  // enthalpy level for CTS; function only of pressure
84  std::vector<double> m_Enth_s;
85 
86  // temporary storage for ice enthalpy at (i,j), as well as north,
87  // east, south, and west from (i,j)
88  std::vector<double> m_E_ij, m_E_n, m_E_e, m_E_s, m_E_w;
89 
90  //! strain heating in the ice column
91  std::vector<double> m_strain_heating;
92 
93  //! values of @f$ k \Delta t / (\rho c \Delta x^2) @f$
94  std::vector<double> m_R;
95 
98 
100  m_lambda; //! implicit FD method parameter
101  double m_D0, m_U0, m_B0; // coefficients of the first (basal) equation
102  double m_L_ks, m_D_ks, m_U_ks, m_B_ks; // coefficients of the last (surface) equation
104 
108 
110  EnthalpyConverter::Ptr m_EC; // conductivity has known dependence on T, not enthalpy
111 
112  void compute_enthalpy_CTS();
113  double compute_lambda();
114 
115  void assemble_R();
116  void checkReadyToSolve() const;
117 };
118 
119 } // end of namespace energy
120 } // end of namespace pism
121 
122 #endif // ifndef __enthSystem_hh
A class for storing and accessing PISM configuration flags and parameters.
std::shared_ptr< EnthalpyConverter > Ptr
A virtual class collecting methods common to ice and bedrock 3D fields.
Definition: Array3D.hh:33
Base class for tridiagonal systems in the ice.
void assemble_R()
Assemble the R array. The R value switches at the CTS.
Definition: enthSystem.cc:393
std::vector< double > m_Enth_s
Definition: enthSystem.hh:84
std::vector< double > m_E_ij
Definition: enthSystem.hh:88
const array::Array3D & m_Enth3
Definition: enthSystem.hh:109
std::vector< double > m_E_n
Definition: enthSystem.hh:88
std::vector< double > m_E_w
Definition: enthSystem.hh:88
double Enth(size_t i) const
Definition: enthSystem.hh:73
std::vector< double > m_R
values of
Definition: enthSystem.hh:94
const array::Array3D & m_strain_heating3
Definition: enthSystem.hh:109
std::vector< double > m_Enth
Definition: enthSystem.hh:82
void set_surface_neumann_bc(double dE)
Set enthalpy flux at the surface.
Definition: enthSystem.cc:222
void compute_enthalpy_CTS()
Compute the CTS value of enthalpy in an ice column.
Definition: enthSystem.cc:151
double Enth_s(size_t i) const
Definition: enthSystem.hh:77
EnthalpyConverter::Ptr m_EC
Definition: enthSystem.hh:110
void set_surface_heat_flux(double heat_flux)
Set the top surface heat flux into the ice.
Definition: enthSystem.cc:207
enthSystemCtx(const std::vector< double > &storage_grid, const std::string &prefix, double dx, double dy, double dt, const Config &config, const array::Array3D &Enth3, const array::Array3D &u3, const array::Array3D &v3, const array::Array3D &w3, const array::Array3D &strain_heating3, EnthalpyConverter::Ptr EC)
Definition: enthSystem.cc:31
void init(int i, int j, bool ismarginal, double ice_thickness)
Definition: enthSystem.cc:110
void set_basal_neumann_bc(double dE)
Set enthalpy flux at the base.
Definition: enthSystem.cc:343
std::vector< double > m_E_e
Definition: enthSystem.hh:88
double k_from_T(double T) const
Definition: enthSystem.cc:101
std::vector< double > m_strain_heating
strain heating in the ice column
Definition: enthSystem.hh:91
virtual void save_system(std::ostream &output, unsigned int M) const
Definition: enthSystem.cc:578
void set_basal_heat_flux(double heat_flux)
Set coefficients in discrete equation for Neumann condition at base of ice.
Definition: enthSystem.cc:328
double m_D0
implicit FD method parameter
Definition: enthSystem.hh:101
std::vector< double > m_E_s
Definition: enthSystem.hh:88
void solve(std::vector< double > &result)
Solve the tridiagonal system, in a single column, which determines the new values of the ice enthalpy...
Definition: enthSystem.cc:480
void checkReadyToSolve() const
Definition: enthSystem.cc:261
double compute_lambda()
Compute the lambda for BOMBPROOF.
Definition: enthSystem.cc:170
void set_basal_dirichlet_bc(double E_basal)
Set coefficients in discrete equation for at base of ice.
Definition: enthSystem.cc:278
void set_surface_dirichlet_bc(double E_surface)
Definition: enthSystem.cc:186
Tridiagonal linear system for conservation of energy in vertical column of ice enthalpy.
Definition: enthSystem.hh:38