Loading [MathJax]/extensions/tex2jax.js
PISM, A Parallel Ice Sheet Model 2.2.2-d6b3a29ca committed by Constantine Khrulev on 2025-03-28
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SSAFDBase.hh
Go to the documentation of this file.
1/* Copyright (C) 2024 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#ifndef PISM_SSAFDBASE_H
21#define PISM_SSAFDBASE_H
22
23#include <petscmat.h>
24
25#include "pism/stressbalance/ssa/SSA.hh"
26#include "pism/util/array/Staggered.hh"
27
28namespace pism {
29namespace stressbalance {
30
31/*!
32 * A base class containing the FD discretization of the SSA system.
33 *
34 * Does *not* include any implementation details related to non-linear iterations.
35 */
36class SSAFDBase : public SSA {
37public:
38 SSAFDBase(std::shared_ptr<const Grid> g, bool regional_mode);
39
41
42 const array::Vector &driving_stress() const;
43
44 void compute_residual(const Inputs &inputs, const array::Vector2 &velocity, array::Vector &result);
45
46protected:
48
49 void initialize_iterations(const Inputs &inputs);
50
51 void compute_nuH(const array::Scalar1 &ice_thickness, const array::CellType2 &cell_type,
52 const pism::Vector2d *const *velocity, const array::Staggered &hardness,
53 double nuH_regularization, array::Staggered1 &result);
54
55 void compute_nuH_everywhere(const array::Scalar1 &ice_thickness,
56 const pism::Vector2d *const *velocity,
57 const array::Staggered &hardness, double nuH_regularization,
58 array::Staggered &result);
59
60 void compute_nuH_cfbc(const array::Scalar1 &ice_thickness,
61 const array::CellType2 &cell_type,
62 const pism::Vector2d* const* velocity,
63 const array::Staggered &hardness, double nuH_regularization,
64 array::Staggered &result);
65
66 void compute_driving_stress(const array::Scalar &ice_thickness,
67 const array::Scalar1 &surface_elevation,
68 const array::CellType1 &cell_type,
69 const array::Scalar1 *no_model_mask, const EnthalpyConverter &EC,
70 array::Vector &result) const;
71
72 void adjust_driving_stress(const array::Scalar &ice_thickness,
73 const array::Scalar1 &surface_elevation,
74 const array::CellType1 &cell_type, const array::Scalar1 *no_model_mask,
76
77 void compute_average_ice_hardness(const array::Scalar1 &thickness, const array::Array3D &enthalpy,
78 const array::CellType1 &cell_type, array::Staggered &result) const;
79
80 void assemble_rhs(const Inputs &inputs, const array::CellType1 &cell_type,
81 const array::Vector &driving_stress, double bc_scaling, array::Vector &result) const;
82
83 void fd_operator(const Geometry &geometry, const array::Scalar *bc_mask, double bc_scaling,
84 const array::Scalar &basal_yield_stress,
85 IceBasalResistancePlasticLaw *basal_sliding_law,
86 const pism::Vector2d *const *velocity, const array::Staggered1 &nuH,
87 const array::CellType1 &cell_type, Mat *A, Vector2d **Ax) const;
88
89 void fracture_induced_softening(const array::Scalar1 &fracture_density,
90 double n_glen,
91 array::Staggered &ice_hardness);
92
93 void compute_residual(const Inputs &inputs, const pism::Vector2d *const *velocity,
94 pism::Vector2d **result);
95
96 struct Work {
97 // u_x on the i offset
98 double u_x;
99 // v_x on the i offset
100 double v_x;
101 // weight for the i offset
102 double w_i;
103 // u_y on the j offset
104 double u_y;
105 // v_y on the j offset
106 double v_y;
107 // weight for the j offset
108 double w_j;
109 };
110
111 //! temprary storage used to compute the nuH term (ghosted, but ghost values are
112 //! computed "redundantly" and not communicated)
114
115 //! ice hardness
117
118 //! viscosity times thickness
120
122
123 //! right hand side
125
126 //! driving stress
128
129 //! scaling used for diagonal matrix elements at Dirichlet BC locations
130 const double m_bc_scaling;
131
132 //! if true, the driving stress is adjusted to avoid issues at domain boundaries in
133 //! "regional" model configurations
134 const bool m_regional_mode;
135};
136
137}
138} // namespace pism
139
140#endif /* PISM_SSAFDBASE_H */
Converts between specific enthalpy and temperature or liquid content.
Class containing physical constants and the constitutive relation describing till for SSA.
This class represents a 2D vector field (such as ice velocity) at a certain grid point.
Definition Vector2d.hh:29
A storage vector combining related fields in a struct.
Definition Array2D.hh:32
A virtual class collecting methods common to ice and bedrock 3D fields.
Definition Array3D.hh:33
A class for storing and accessing internal staggered-grid 2D fields. Uses dof=2 storage....
Definition Staggered.hh:37
void compute_driving_stress(const array::Scalar &ice_thickness, const array::Scalar1 &surface_elevation, const array::CellType1 &cell_type, const array::Scalar1 *no_model_mask, const EnthalpyConverter &EC, array::Vector &result) const
Compute the gravitational driving stress.
Definition SSAFDBase.cc:143
void assemble_rhs(const Inputs &inputs, const array::CellType1 &cell_type, const array::Vector &driving_stress, double bc_scaling, array::Vector &result) const
Computes the right-hand side ("rhs") of the linear problem for the Picard iteration and finite-differ...
Definition SSAFDBase.cc:304
array::Vector m_taud
driving stress
Definition SSAFDBase.hh:127
const array::Staggered & integrated_viscosity() const
void compute_nuH_cfbc(const array::Scalar1 &ice_thickness, const array::CellType2 &cell_type, const pism::Vector2d *const *velocity, const array::Staggered &hardness, double nuH_regularization, array::Staggered &result)
Compute the product of ice viscosity and thickness on the staggered grid. Used when CFBC is enabled.
array::Staggered m_hardness
ice hardness
Definition SSAFDBase.hh:116
void fd_operator(const Geometry &geometry, const array::Scalar *bc_mask, double bc_scaling, const array::Scalar &basal_yield_stress, IceBasalResistancePlasticLaw *basal_sliding_law, const pism::Vector2d *const *velocity, const array::Staggered1 &nuH, const array::CellType1 &cell_type, Mat *A, Vector2d **Ax) const
Assemble the left-hand side matrix for the KSP-based, Picard iteration, and finite difference impleme...
Definition SSAFDBase.cc:549
void initialize_iterations(const Inputs &inputs)
void fracture_induced_softening(const array::Scalar1 &fracture_density, double n_glen, array::Staggered &ice_hardness)
Correct vertically-averaged hardness using a parameterization of the fracture-induced softening.
array::Staggered1 m_nuH
viscosity times thickness
Definition SSAFDBase.hh:119
const double m_bc_scaling
scaling used for diagonal matrix elements at Dirichlet BC locations
Definition SSAFDBase.hh:130
void adjust_driving_stress(const array::Scalar &ice_thickness, const array::Scalar1 &surface_elevation, const array::CellType1 &cell_type, const array::Scalar1 *no_model_mask, array::Vector &driving_stress) const
void compute_average_ice_hardness(const array::Scalar1 &thickness, const array::Array3D &enthalpy, const array::CellType1 &cell_type, array::Staggered &result) const
Computes vertically-averaged ice hardness on the staggered grid.
Definition SSAFDBase.cc:983
DiagnosticList diagnostics_impl() const
array::Vector m_rhs
right hand side
Definition SSAFDBase.hh:124
void compute_nuH(const array::Scalar1 &ice_thickness, const array::CellType2 &cell_type, const pism::Vector2d *const *velocity, const array::Staggered &hardness, double nuH_regularization, array::Staggered1 &result)
array::Array2D< Work > m_work
Definition SSAFDBase.hh:113
void compute_nuH_everywhere(const array::Scalar1 &ice_thickness, const pism::Vector2d *const *velocity, const array::Staggered &hardness, double nuH_regularization, array::Staggered &result)
Compute the product of ice thickness and effective viscosity (on the staggered grid).
void compute_residual(const Inputs &inputs, const array::Vector2 &velocity, array::Vector &result)
const array::Vector & driving_stress() const
PISM's SSA solver.
Definition SSA.hh:110
const array::Vector1 & velocity() const
Get the thickness-advective 2D velocity.
static const double g
Definition exactTestP.cc:36
std::map< std::string, Diagnostic::Ptr > DiagnosticList