PISM, A Parallel Ice Sheet Model 2.3.0-79cae578d committed by Constantine Khrulev on 2026-03-22
Loading...
Searching...
No Matches
FloatKill.cc
Go to the documentation of this file.
1/* Copyright (C) 2013, 2014, 2015, 2016, 2017, 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/FloatKill.hh"
21
22#include "pism/util/Mask.hh"
23#include "pism/util/Grid.hh"
24#include "pism/util/array/CellType.hh"
25#include "pism/util/Logger.hh"
26
27namespace pism {
28namespace calving {
29
30FloatKill::FloatKill(std::shared_ptr<const Grid> g)
31 : Component(g),
32 m_old_mask(m_grid, "old_mask") {
33 m_margin_only = m_config->get_flag("calving.float_kill.margin_only");
34 m_calve_near_grounding_line = m_config->get_flag("calving.float_kill.calve_near_grounding_line");
35}
36
38 m_log->message(2,
39 "* Initializing calving using the floatation criterion (float_kill)...\n");
40
41 if (m_margin_only) {
42 m_log->message(2,
43 " [only cells at the ice margin are calved during a given time step]\n");
44 }
45
47 m_log->message(2,
48 " [keeping floating cells near the grounding line]\n");
49 }
50}
51
52/**
53 * Updates ice cover mask and the ice thickness using the calving rule
54 * removing all floating ice.
55 *
56 * @param[in,out] pism_mask ice cover (cell type) mask
57 * @param[in,out] ice_thickness ice thickness
58 *
59 * @return 0 on success
60 */
61void FloatKill::update(array::Scalar &cell_type, array::Scalar &ice_thickness) {
62
63 // this call fills ghosts of m_old_mask
64 m_old_mask.copy_from(cell_type);
65
66 array::AccessScope list{&cell_type, &m_old_mask, &ice_thickness};
67
68 const bool dont_calve_near_grounded_ice = not m_calve_near_grounding_line;
69
70 for (auto p : m_grid->points()) {
71 const int i = p.i(), j = p.j();
72
73 if (m_old_mask.floating_ice(i, j)) {
75 continue;
76 }
77
78 if (dont_calve_near_grounded_ice and m_old_mask.next_to_grounded_ice(i, j)) {
79 continue;
80 }
81
82 ice_thickness(i, j) = 0.0;
83 cell_type(i, j) = MASK_ICE_FREE_OCEAN;
84 }
85 }
86
87 cell_type.update_ghosts();
88 ice_thickness.update_ghosts();
89}
90
91} // end of namespace calving
92} // 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
A class defining a common interface for most PISM sub-models.
Definition Component.hh:118
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
void update_ghosts()
Updates ghost points.
Definition Array.cc:645
bool next_to_grounded_ice(int i, int j) const
Definition CellType.hh:96
bool next_to_ice_free_ocean(int i, int j) const
Definition CellType.hh:106
bool floating_ice(int i, int j) const
Definition CellType.hh:50
array::CellType1 m_old_mask
Definition FloatKill.hh:43
virtual void init()
Definition FloatKill.cc:37
FloatKill(std::shared_ptr< const Grid > g)
Definition FloatKill.cc:30
void update(array::Scalar &cell_type, array::Scalar &ice_thickness)
Definition FloatKill.cc:61
static const double g
Definition exactTestP.cc:36
@ MASK_ICE_FREE_OCEAN
Definition Mask.hh:35