Loading [MathJax]/jax/output/HTML-CSS/config.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
SSAFD.hh
Go to the documentation of this file.
1// Copyright (C) 2004--2024 Jed Brown, Ed Bueler and Constantine Khroulev
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 _SSAFD_H_
20#define _SSAFD_H_
21
22#include <array>
23
24#include "pism/stressbalance/ssa/SSAFDBase.hh"
25
26#include "pism/util/petscwrappers/Viewer.hh"
27#include "pism/util/petscwrappers/KSP.hh"
28#include "pism/util/petscwrappers/Mat.hh"
29#include "pism/util/array/Staggered.hh"
30
31namespace pism {
32namespace stressbalance {
33
34
35//! PISM's SSA solver: the finite difference implementation.
36class SSAFD : public SSAFDBase {
37public:
38 SSAFD(std::shared_ptr<const Grid> g, bool regional_mode);
39 virtual ~SSAFD() = default;
40
41protected:
42
43 void init_impl();
44
45 void pc_setup_bjacobi();
46
47 void pc_setup_asm();
48
49 void solve(const Inputs &inputs);
50
51 void picard_iteration(const Inputs &inputs, double nuH_regularization,
52 double nuH_iter_failure_underrelax);
53
54 void picard_manager(const Inputs &inputs, double nuH_regularization,
55 double nuH_iter_failure_underrelax);
56
57 void picard_strategy_regularization(const Inputs &inputs);
58
59 std::array<double, 2> compute_nuH_norm(const array::Staggered &nuH,
60 array::Staggered &nuH_old);
61
62 void assemble_matrix(const Inputs &inputs, const array::Vector1 &velocity,
63 const array::Staggered1 &nuH, const array::CellType1 &cell_type, Mat A);
64
65 void write_system_petsc(const std::string &namepart);
66
67 void update_nuH_viewers(const array::Staggered &nuH);
68
70
73
75
78
79 std::shared_ptr<petsc::Viewer> m_nuh_viewer;
80
82
83 class KSPFailure : public RuntimeError {
84 public:
85 KSPFailure(const char* reason);
86 };
87
88 class PicardFailure : public RuntimeError {
89 public:
90 PicardFailure(const std::string &message);
91 };
92};
93
94} // end of namespace stressbalance
95} // end of namespace pism
96
97#endif /* _SSAFD_H_ */
A class for storing and accessing internal staggered-grid 2D fields. Uses dof=2 storage....
Definition Staggered.hh:37
void assemble_matrix(const Inputs &inputs, const array::Vector1 &velocity, const array::Staggered1 &nuH, const array::CellType1 &cell_type, Mat A)
Definition SSAFD.cc:197
void init_impl()
Initialize a generic regular-grid SSA solver.
Definition SSAFD.cc:176
void picard_strategy_regularization(const Inputs &inputs)
Old SSAFD recovery strategy: increase the SSA regularization parameter.
Definition SSAFD.cc:529
std::shared_ptr< petsc::Viewer > m_nuh_viewer
Definition SSAFD.hh:79
virtual ~SSAFD()=default
array::Vector1 m_velocity_old
Definition SSAFD.hh:74
void solve(const Inputs &inputs)
Compute the vertically-averaged horizontal velocity from the shallow shelf approximation.
Definition SSAFD.cc:260
void write_system_petsc(const std::string &namepart)
Definition SSAFD.cc:628
unsigned int m_default_pc_failure_max_count
Definition SSAFD.hh:77
void update_nuH_viewers(const array::Staggered &nuH)
Update the nuH viewer, which shows log10(nu H).
Definition SSAFD.cc:601
std::array< double, 2 > compute_nuH_norm(const array::Staggered &nuH, array::Staggered &nuH_old)
Compute the norm of nu H and the norm of the change in nu H.
Definition SSAFD.cc:577
void picard_iteration(const Inputs &inputs, double nuH_regularization, double nuH_iter_failure_underrelax)
Definition SSAFD.cc:318
void picard_manager(const Inputs &inputs, double nuH_regularization, double nuH_iter_failure_underrelax)
Manages the Picard iteration loop.
Definition SSAFD.cc:350
unsigned int m_default_pc_failure_count
Definition SSAFD.hh:76
array::Staggered1 m_nuH_old
Definition SSAFD.hh:69
PISM's SSA solver: the finite difference implementation.
Definition SSAFD.hh:36
const array::Vector1 & velocity() const
Get the thickness-advective 2D velocity.
static const double g
Definition exactTestP.cc:36