PISM, A Parallel Ice Sheet Model 2.3.0-79cae578d committed by Constantine Khrulev on 2026-03-22
Loading...
Searching...
No Matches
BlatterMod.cc
Go to the documentation of this file.
1/* Copyright (C) 2020, 2021, 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 <algorithm> // std::min, std::max
21
22#include "pism/stressbalance/blatter/BlatterMod.hh"
23
24#include "pism/rheology/FlowLawFactory.hh"
25
26#include "pism/geometry/Geometry.hh"
27#include "pism/stressbalance/StressBalance.hh" // Inputs
28#include "pism/util/pism_utilities.hh" // GlobalMax
29
30namespace pism {
31namespace stressbalance {
32
33BlatterMod::BlatterMod(std::shared_ptr<Blatter> solver)
34 : SSB_Modifier(solver->grid()),
35 m_solver(solver) {
36
38 ice_factory.remove(ICE_GOLDSBY_KOHLSTEDT);
39 m_flow_law = ice_factory.create(m_config->get_string("stress_balance.blatter.flow_law"),
40 m_config->get_number("stress_balance.blatter.Glen_exponent"));
41}
42
44 // empty
45}
46
47/*!
48 * Post-process ice velocity computed by the Blatter solver.
49 *
50 * - transfers velocity from the sigma grid onto PISM's vertical grid
51 *
52 * - estimates the maximum diffusivity used to compute the time step restriction
53 */
54void BlatterMod::update(const array::Vector &sliding_velocity,
55 const Inputs &inputs,
56 bool full_update) {
57 (void) sliding_velocity;
58 (void) full_update;
59
60 // transfer velocity onto the PISM vertical grid, setting m_u and m_v
62
63 // estimate max diffusivity to use in adaptive time stepping
65 inputs.geometry->ice_thickness,
67
69}
70
71/*!
72 * Copy ice velocity from the sigma vertical grid onto PISM's vertical grid.
73 *
74 * Uses constant extrapolation above the ice surface.
75 */
76void BlatterMod::transfer(const array::Scalar &ice_thickness) {
77
78 auto u_sigma = m_solver->velocity_u_sigma();
79 auto v_sigma = m_solver->velocity_v_sigma();
80
81 const auto &zlevels = m_u.levels();
82 int Mz = zlevels.size();
83
84 array::AccessScope list{&m_u, &m_v, u_sigma.get(), v_sigma.get(), &ice_thickness};
85
86 for (auto p : m_grid->points()) {
87 const int i = p.i(), j = p.j();
88
89 auto *u = m_u.get_column(i, j);
90 auto *v = m_v.get_column(i, j);
91
92 double H = ice_thickness(i, j);
93
94 if (H > 0.0) {
95 for (int k = 0; k < Mz; ++k) {
96 double sigma = std::min(zlevels[k] / H, 1.0);
97
98 u[k] = u_sigma->interpolate(i, j, sigma);
99 v[k] = v_sigma->interpolate(i, j, sigma);
100 }
101 } else {
102 m_u.set_column(i, j, 0.0);
103 m_v.set_column(i, j, 0.0);
104 }
105 }
106
109}
110
111/*!
112 * Estimate max SIA-type diffusivity assuming that `Q = -D \nabla h`.
113 */
115 const array::Scalar &ice_thickness,
116 const array::Scalar1 &surface) {
117 const double eps = 1e-3;
118 double
119 dx = m_grid->dx(),
120 dy = m_grid->dy();
121
122 array::AccessScope list{&velocity, &ice_thickness, &surface};
123
124 m_D_max = 0.0;
125 for (auto p : m_grid->points()) {
126 const int i = p.i(), j = p.j();
127
128 auto h = surface.star(i, j);
129 auto H = ice_thickness(i, j);
130
131 if (H > 0.0) {
132 Vector2d grad_h = {(h.e - h.w) / (2.0 * dx),
133 (h.n - h.s) / (2.0 * dy)};
134
135 double D = H * velocity(i, j).magnitude() / (grad_h.magnitude() + eps);
136
137 m_D_max = std::max(D, m_D_max);
138 }
139 }
140
142}
143
144} // end of namespace stressbalance
145} // end of namespace pism
#define ICE_GOLDSBY_KOHLSTEDT
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
array::Scalar2 ice_surface_elevation
Definition Geometry.hh:57
array::Scalar2 ice_thickness
Definition Geometry.hh:51
double magnitude() const
Magnitude.
Definition Vector2d.hh:40
This class represents a 2D vector field (such as ice velocity) at a certain grid point.
Definition Vector2d.hh:29
Makes sure that we call begin_access() and end_access() for all accessed array::Arrays.
Definition Array.hh:66
stencils::Star< T > star(int i, int j) const
Definition Array2D.hh:107
void set_column(int i, int j, double c)
Set all values of scalar quantity to given a single value in a particular column.
Definition Array3D.cc:56
double * get_column(int i, int j)
Definition Array3D.cc:127
const std::vector< double > & levels() const
Definition Array.cc:142
void set(double c)
Result: v[j] <- c for all j.
Definition Array.cc:659
void update_ghosts()
Updates ghost points.
Definition Array.cc:645
void remove(const std::string &name)
std::shared_ptr< FlowLaw > create(const std::string &type_name, double exponent)
std::shared_ptr< Blatter > m_solver
Definition BlatterMod.hh:45
void update(const array::Vector &sliding_velocity, const Inputs &inputs, bool full_update)
Definition BlatterMod.cc:54
void transfer(const array::Scalar &ice_thickness)
Definition BlatterMod.cc:76
BlatterMod(std::shared_ptr< Blatter > solver)
Definition BlatterMod.cc:33
void compute_max_diffusivity(const array::Vector &velocity, const array::Scalar &ice_thickness, const array::Scalar1 &surface)
std::shared_ptr< EnthalpyConverter > m_EC
std::shared_ptr< rheology::FlowLaw > m_flow_law
Shallow stress balance modifier (such as the non-sliding SIA).
void GlobalMax(MPI_Comm comm, double *local, double *result, int count)
static const double k
Definition exactTestP.cc:42