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
UNO.hh
Go to the documentation of this file.
1/* Copyright (C) 2020, 2021, 2022 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_UNO_2D_H
21#define PISM_UNO_2D_H
22
23#include "pism/util/array/Scalar.hh"
24#include "pism/util/array/Vector.hh"
25#include "pism/util/array/Staggered.hh"
26
27namespace pism {
28
29class Grid;
30
31namespace array {
32class CellType1;
33} // end of namespace array
34
36
37/*!
38 * Implementation of Upwind Nonoscillatory advection schemes UNO2 and UNO3.
39 *
40 * See J.-G. Li, “Upstream Nonoscillatory Advection Schemes,” Monthly Weather Review, vol.
41 * 136, Art. no. 12, Dec. 2008.
42 *
43 * Three more schemes (first-order upwinding, Lax-Wendroff and Fromm) can be stated in the
44 * same framework and so we implement them as well since this requires very little effort
45 * and simplifies testing and comparisons.
46 */
47class UNO {
48public:
49 UNO(std::shared_ptr<const Grid> grid, UNOType type);
50
51 void update(double dt,
52 const array::CellType1 &cell_type,
53 const array::Scalar &x,
54 const array::Vector &velocity,
55 bool nonnegative = false);
56
57 const array::Scalar& x() const;
58
59private:
60 void compute_interface_fluxes(const array::CellType1 &cell_type,
61 const array::Vector1 &velocity,
62 const array::Scalar2 &x_old,
63 double dt,
64 array::Staggered &result) const;
65
66 typedef double (*MidFluxApproximation)(const double *, const double *, size_t, double, double, double);
67
69
70 // interface fluxes (on the staggered grid; ghosted)
72
73 // ghosted copy of the input velocity field used to compute interface velocities
75
76 // temporary storage for the old state of the advected quantity (ghosted, width=2)
77 //
78 // used to perform the step using flux divergence *and* to compute interface fluxes
79 // (this requires a wide stencil)
81
82 // resulting advected quantity (not ghosted)
84};
85
86} // end of namespace pism
87
88#endif /* PISM_UNO_2D_H */
void compute_interface_fluxes(const array::CellType1 &cell_type, const array::Vector1 &velocity, const array::Scalar2 &x_old, double dt, array::Staggered &result) const
Definition UNO.cc:207
array::Staggered1 m_q
Definition UNO.hh:71
const array::Scalar & x() const
Definition UNO.cc:172
void update(double dt, const array::CellType1 &cell_type, const array::Scalar &x, const array::Vector &velocity, bool nonnegative=false)
Definition UNO.cc:305
double(* MidFluxApproximation)(const double *, const double *, size_t, double, double, double)
Definition UNO.hh:66
MidFluxApproximation m_approx
Definition UNO.hh:68
array::Staggered1 m_q_limited
Definition UNO.hh:71
array::Scalar m_x
Definition UNO.hh:83
array::Scalar2 m_x_ghosted
Definition UNO.hh:80
array::Vector1 m_v_ghosted
Definition UNO.hh:74
A class for storing and accessing internal staggered-grid 2D fields. Uses dof=2 storage....
Definition Staggered.hh:37
UNOType
Definition UNO.hh:35
@ PISM_UNO_2
Definition UNO.hh:35
@ PISM_UNO_LAX_WENDROFF
Definition UNO.hh:35
@ PISM_UNO_UPWIND1
Definition UNO.hh:35
@ PISM_UNO_3
Definition UNO.hh:35
@ PISM_UNO_FROMM
Definition UNO.hh:35