PISM, A Parallel Ice Sheet Model 2.3.0-79cae578d committed by Constantine Khrulev on 2026-03-22
Loading...
Searching...
No Matches
EigenCalving.cc
Go to the documentation of this file.
1/* Copyright (C) 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2021, 2022, 2023, 2025 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/frontretreat/calving/EigenCalving.hh"
21
22#include "pism/util/Grid.hh"
23#include "pism/util/error_handling.hh"
24#include "pism/util/array/CellType.hh"
25#include "pism/stressbalance/StressBalance.hh"
26#include "pism/util/Logger.hh"
27
28namespace pism {
29namespace calving {
30
31EigenCalving::EigenCalving(std::shared_ptr<const Grid> grid)
32 : StressCalving(grid, 2) {
33
34 m_K = m_config->get_number("calving.eigen_calving.K");
35
36 m_calving_rate.metadata().set_name("eigen_calving_rate");
38 .long_name("horizontal calving rate due to eigen-calving")
39 .units("m s^-1")
40 .output_units("m year^-1");
41}
42
44
45 m_log->message(2, "* Initializing the 'eigen-calving' mechanism...\n");
46
47 if (fabs(m_grid->dx() - m_grid->dy()) / std::min(m_grid->dx(), m_grid->dy()) > 1e-2) {
48 throw RuntimeError::formatted(PISM_ERROR_LOCATION, "-calving eigen_calving using a non-square grid cell is not implemented (yet);\n"
49 "dx = %f, dy = %f, relative difference = %f",
50 m_grid->dx(), m_grid->dy(),
51 fabs(m_grid->dx() - m_grid->dy()) / std::max(m_grid->dx(), m_grid->dy()));
52 }
53
54 m_strain_rates.set(0.0);
55}
56
57//! \brief Uses principal strain rates to apply "eigencalving" with constant K.
58/*!
59 See equation (26) in [\ref Winkelmannetal2011].
60*/
62 const array::Vector1 &ice_velocity) {
63
64 // make a copy with a wider stencil
65 m_cell_type.copy_from(cell_type);
66 assert(m_cell_type.stencil_width() >= 2);
67
68 // Distance (grid cells) from calving front where strain rate is evaluated
69 int offset = m_stencil_width;
70
71 // eigenCalvOffset allows adjusting the transition from compressive to extensive flow
72 // regime
73 const double eigenCalvOffset = 0.0;
74
77 m_strain_rates.update_ghosts();
78
80
81 // Compute the horizontal calving rate
82 for (auto pt : m_grid->points()) {
83 const int i = pt.i(), j = pt.j();
84
85 // Find partially filled or empty grid boxes on the icefree ocean, which
86 // have floating ice neighbors after the mass continuity step
88
89 // Average of strain-rate eigenvalues in adjacent floating grid cells to be used for
90 // eigen-calving:
91 double
92 eigen1 = 0.0,
93 eigen2 = 0.0;
94 {
95 int N = 0;
96 for (int p = -1; p < 2; p += 2) {
97 const int I = i + p * offset;
98 if (m_cell_type.floating_ice(I, j) and not m_cell_type.ice_margin(I, j)) {
99 eigen1 += m_strain_rates(I, j).eigen1;
100 eigen2 += m_strain_rates(I, j).eigen2;
101 N += 1;
102 }
103 }
104
105 for (int q = -1; q < 2; q += 2) {
106 const int J = j + q * offset;
107 if (m_cell_type.floating_ice(i, J) and not m_cell_type.ice_margin(i, J)) {
108 eigen1 += m_strain_rates(i, J).eigen1;
109 eigen2 += m_strain_rates(i, J).eigen2;
110 N += 1;
111 }
112 }
113
114 if (N > 0) {
115 eigen1 /= N;
116 eigen2 /= N;
117 }
118 }
119
120 // Calving law
121 //
122 // eigen1 * eigen2 has units [s^-2] and calving_rate_horizontal
123 // [m*s^1] hence, eigen_calving_K has units [m*s]
124 if (eigen2 > eigenCalvOffset and eigen1 > 0.0) {
125 // spreading in all directions
126 m_calving_rate(i, j) = m_K * eigen1 * (eigen2 - eigenCalvOffset);
127 } else {
128 m_calving_rate(i, j) = 0.0;
129 }
130
131 } else { // end of "if (ice_free_ocean and next_to_floating)"
132 m_calving_rate(i, j) = 0.0;
133 }
134 } // end of the loop over grid points
135}
136
138 return {{"eigen_calving_rate", Diagnostic::wrap(m_calving_rate)}};
139}
140
141} // end of namespace calving
142} // end of namespace pism
std::shared_ptr< const Config > m_config
configuration database used by this component
Definition Component.hh:160
const std::shared_ptr< const Grid > m_grid
grid used by this component
Definition Component.hh:158
std::shared_ptr< const Logger > m_log
logger (for easy access)
Definition Component.hh:164
static Ptr wrap(const T &input)
static RuntimeError formatted(const ErrorLocation &location, const char format[],...) __attribute__((format(printf
build a RuntimeError with a formatted message
VariableMetadata & long_name(const std::string &input)
VariableMetadata & units(const std::string &input)
VariableMetadata & set_name(const std::string &name)
VariableMetadata & output_units(const std::string &input)
Makes sure that we call begin_access() and end_access() for all accessed array::Arrays.
Definition Array.hh:66
void copy_from(const Array2D< T > &source)
Definition Array2D.hh:101
VariableMetadata & metadata(unsigned int N=0)
Returns a reference to the VariableMetadata object containing metadata for the compoment N.
Definition Array.cc:467
unsigned int stencil_width() const
Get the stencil width of the current Array. Returns 0 if ghosts are not available.
Definition Array.cc:305
bool ice_margin(int i, int j) const
Ice margin (ice-filled with at least one of four neighbors ice-free).
Definition CellType.hh:81
bool next_to_floating_ice(int i, int j) const
Definition CellType.hh:91
bool floating_ice(int i, int j) const
Definition CellType.hh:50
bool ice_free_ocean(int i, int j) const
Definition CellType.hh:58
"Cell type" mask. Adds convenience methods to array::Scalar.
Definition CellType.hh:30
void update(const array::CellType &cell_type, const array::Vector1 &ice_velocity)
Uses principal strain rates to apply "eigencalving" with constant K.
DiagnosticList spatial_diagnostics_impl() const
EigenCalving(std::shared_ptr< const Grid > grid)
array::Array2D< stressbalance::PrincipalStrainRates > m_strain_rates
An abstract class containing fields used by all stress-based calving methods.
#define PISM_ERROR_LOCATION
void compute_2D_principal_strain_rates(const array::Vector1 &V, const array::CellType1 &mask, array::Array2D< PrincipalStrainRates > &result)
Compute eigenvalues of the horizontal, vertically-integrated strain rate tensor.
std::map< std::string, Diagnostic::Ptr > DiagnosticList