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
BlatterISMIPHOM.cc
Go to the documentation of this file.
1/* Copyright (C) 2020, 2021, 2023, 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#include "pism/stressbalance/blatter/ismip-hom/BlatterISMIPHOM.hh"
21
22#include "pism/util/node_types.hh"
23
24namespace pism {
25namespace stressbalance {
26
27static double A_surface(double x, double y, double L) {
28 (void) y;
29 (void) L;
30 double alpha = 0.5 * (M_PI / 180.0); // 0.5 degrees
31 return -x * tan(alpha);
32}
33
34static double A_bed(double x, double y, double L) {
35 double omega = 2 * M_PI / L;
36 return A_surface(x, y, L) - 1000.0 + 500.0 * sin(omega * x) * sin(omega * y);
37}
38
39static double B_bed(double x, double y, double L) {
40 (void) y;
41 double omega = 2 * M_PI / L;
42 return A_surface(x, y, L) - 1000.0 + 500.0 * sin(omega * x);
43}
44
45static double C_surface(double x, double y, double L) {
46 (void) y;
47 (void) L;
48 double alpha = 0.1 * (M_PI / 180.0); // 0.1 degrees
49 return -x * tan(alpha);
50}
51
52static double C_bed(double x, double y, double L) {
53 return C_surface(x, y, L) - 1000.0;
54}
55
56BlatterISMIPHOM::BlatterISMIPHOM(std::shared_ptr<const Grid> grid,
57 int Mz,
58 int coarsening_factor,
59 ISMIPHOMTest test)
60 : Blatter(grid, Mz, coarsening_factor),
61 m_test(test),
62 m_L(2.0 * grid->Lx()) {
63
64 char testname[] = "ABCD";
65 m_log->message(2, "Running ISMIP-HOM Experiment %c (L = %d km)...\n",
66 testname[m_test],
67 (int)(m_L * 1e-3));
68
69 switch (m_test) {
70 case HOM_A:
71 m_b = A_bed;
72 m_s = A_surface;
73 break;
74 case HOM_B:
75 m_b = B_bed;
76 // test B surface is the same as for test A
77 m_s = A_surface;
78 break;
79 case HOM_C:
80 case HOM_D:
81 // test D geometry is the same as for test C
82 m_b = C_bed;
83 m_s = C_surface;
84 break;
85 default:
86 m_b = nullptr;
87 m_s = nullptr;
88 break;
89 }
90}
91
93 Parameters **P,
94 int i,
95 int j,
96 int *node_type,
97 double *bottom_elevation,
98 double *ice_thickness,
99 double *surface_elevation,
100 double *sea_level) const {
101 (void) P;
102
103 // This method is called before we get a chance to "reset" the current element, so the
104 // element argument does not yet know about its physical coordinates. This is why we
105 // have to compute x and y "by hand".
106 double
107 x_min = m_grid->x0() - m_grid->Lx(),
108 y_min = m_grid->y0() - m_grid->Ly(),
109 dx = m_grid->dx(),
110 dy = m_grid->dy();
111
112 for (int n = 0; n < fem::q13d::n_chi; ++n) {
113 auto I = element.local_to_global(i, j, 0, n);
114
115 double
116 x = x_min + I.i * dx,
117 y = y_min + I.j * dy;
118
119 node_type[n] = NODE_INTERIOR;
120 bottom_elevation[n] = m_b(x, y, m_L);
121 ice_thickness[n] = m_s(x, y, m_L) - m_b(x, y, m_L);
122
123 if (surface_elevation != nullptr) {
124 surface_elevation[n] = m_s(x, y, m_L);
125 }
126
127 if (sea_level != nullptr) {
128 // set sea level low enough to ensure that all ice is grounded
129 sea_level[n] = bottom_elevation[n] - 1.0;
130 }
131 }
132}
133
134
135} // end of namespace stressbalance
136} // end of namespace pism
const Logger::ConstPtr m_log
logger (for easy access)
Definition Component.hh:162
const std::shared_ptr< const Grid > m_grid
grid used by this component
Definition Component.hh:156
GlobalIndex local_to_global(int i, int j, int k, unsigned int n) const
Definition Element.hh:305
3D Q1 element
Definition Element.hh:358
void nodal_parameter_values(const fem::Q1Element3 &element, Parameters **P, int i, int j, int *node_type, double *bottom, double *thickness, double *surface, double *sea_level) const
BlatterISMIPHOM(std::shared_ptr< const Grid > grid, int Mz, int coarsening_factor, ISMIPHOMTest test)
static const double L
Definition exactTestL.cc:40
#define n
Definition exactTestM.c:37
const int n_chi
Number of shape functions on a Q1 element.
Definition FEM.hh:213
static double A_surface(double x, double y, double L)
static double C_surface(double x, double y, double L)
static double A_bed(double x, double y, double L)
static double C_bed(double x, double y, double L)
static double B_bed(double x, double y, double L)
@ NODE_INTERIOR
Definition node_types.hh:34