PISM, A Parallel Ice Sheet Model  stable v2.1-1-g6902d5502 committed by Ed Bueler on 2023-12-20 08:38:27 -0800
timestepping.hh
Go to the documentation of this file.
1 /* Copyright (C) 2016, 2017, 2022, 2023 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 TIMESTEPPING_H
21 #define TIMESTEPPING_H
22 
23 #include "pism/util/MaxTimestep.hh"
24 
25 namespace pism {
26 
27 
28 namespace array {
29 class Array3D;
30 class CellType1;
31 class CellType2;
32 class CellType;
33 class Scalar;
34 class Vector;
35 } // end of namespace array
36 
37 struct CFLData {
38  CFLData();
40  double u_max, v_max, w_max;
41 };
42 
43 /*! @brief Compute the max. time step according to the CFL condition (within the volume of the
44  ice). */
45 /*!
46  * Returns the maximum time step along with maximum speeds along x, y, and z directions within the
47  * ice. Note that PISM uses semi-implicit methods in energy balance and age models, so this code
48  * does *not* use the w component of the velocity field in the computation of the max. time step.
49  * The maximum of the speed along the z axis is computed for reporting.
50  */
51 CFLData max_timestep_cfl_3d(const array::Scalar &ice_thickness,
52  const array::CellType &cell_type,
53  const array::Array3D &u3,
54  const array::Array3D &v3,
55  const array::Array3D &w3);
56 
57 /*! @brief Compute the max. time step according to the CFL condition (within the ice, 2D). */
58 /*!
59  * Returns the maximum time step along with maximum speeds along x and y directions within the
60  * ice.
61  */
62 CFLData max_timestep_cfl_2d(const array::Scalar &ice_thickness,
63  const array::CellType &cell_type,
64  const array::Vector &velocity);
65 
66 /*!
67  * Compute the max. time step according to the max. diffusivity of the SIA flow
68  */
69 MaxTimestep max_timestep_diffusivity(double D_max, double dx, double dy,
70  double adaptive_timestepping_ratio);
71 } // end of namespace pism
72 
73 
74 #endif /* TIMESTEPPING_H */
Combines the max. time step with the flag indicating if a restriction is active. Makes is possible to...
Definition: MaxTimestep.hh:31
A virtual class collecting methods common to ice and bedrock 3D fields.
Definition: Array3D.hh:33
"Cell type" mask. Adds convenience methods to array::Scalar.
Definition: CellType.hh:30
CFLData max_timestep_cfl_2d(const array::Scalar &ice_thickness, const array::CellType &cell_type, const array::Vector &velocity)
Compute the CFL constant associated to first-order upwinding for the sliding contribution to mass con...
CFLData max_timestep_cfl_3d(const array::Scalar &ice_thickness, const array::CellType &cell_type, const array::Array3D &u3, const array::Array3D &v3, const array::Array3D &w3)
Compute the maximum velocities for time-stepping and reporting to user.
Definition: timestepping.cc:44
MaxTimestep max_timestep_diffusivity(double D_max, double dx, double dy, double adaptive_timestepping_ratio)
MaxTimestep dt_max
Definition: timestepping.hh:39