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
SSAFD_SNES.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_SSAFD_SNES_H
21#define PISM_SSAFD_SNES_H
22
23#include "pism/stressbalance/ssa/SSAFDBase.hh"
24
25#include "pism/util/petscwrappers/SNES.hh"
26#include "pism/util/petscwrappers/DM.hh"
27// #include "pism/util/petscwrappers/Vec.hh"
28
29namespace pism {
30namespace stressbalance {
31
32class SSAFD_SNES : public SSAFDBase {
33public:
34 SSAFD_SNES(std::shared_ptr<const Grid> grid, bool regional_mode);
35
36 void solve(const Inputs &inputs);
37
38 double tolerance() const;
39
40 const array::Vector &residual() const;
41private:
43
44 //! residual (diagnostic)
46
49
50 struct CallbackData {
51 DM da;
53 const Inputs *inputs;
54 };
55
57
58 void compute_jacobian(const Inputs &inputs, Vector2d const *const * velocity, Mat J);
59
60 static PetscErrorCode function_callback(DMDALocalInfo *info,
61 Vector2d const *const * velocity,
62 Vector2d **result,
63 CallbackData *);
64 static PetscErrorCode jacobian_callback(DMDALocalInfo *info,
65 Vector2d const *const * velocity,
66 Mat A, Mat J,
67 CallbackData *data);
68};
69
70} // namespace stressbalance
71} // namespace pism
72
73#endif /* PISM_SSAFD_SNES_H */
std::shared_ptr< const Grid > grid() const
Definition Component.cc:105
This class represents a 2D vector field (such as ice velocity) at a certain grid point.
Definition Vector2d.hh:29
std::shared_ptr< Wrapper > Ptr
Definition Wrapper.hh:30
const array::Vector & residual() const
DiagnosticList diagnostics_impl() const
void solve(const Inputs &inputs)
static PetscErrorCode jacobian_callback(DMDALocalInfo *info, Vector2d const *const *velocity, Mat A, Mat J, CallbackData *data)
static PetscErrorCode function_callback(DMDALocalInfo *info, Vector2d const *const *velocity, Vector2d **result, CallbackData *)
void compute_jacobian(const Inputs &inputs, Vector2d const *const *velocity, Mat J)
array::Vector m_residual
residual (diagnostic)
Definition SSAFD_SNES.hh:45
const array::Vector1 & velocity() const
Get the thickness-advective 2D velocity.
std::map< std::string, Diagnostic::Ptr > DiagnosticList