PISM, A Parallel Ice Sheet Model 2.3.0-79cae578d committed by Constantine Khrulev on 2026-03-22
Loading...
Searching...
No Matches
BlatterTestXY.cc
Go to the documentation of this file.
1/* Copyright (C) 2020, 2022, 2023, 2025 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/verification/BlatterTestXY.hh"
21
22#include "pism/rheology/IsothermalGlen.hh"
23
24#include "pism/stressbalance/blatter/verification/manufactured_solutions.hh"
25
26namespace pism {
27namespace stressbalance {
28
29BlatterTestXY::BlatterTestXY(std::shared_ptr<const Grid> grid, int Mz, int coarsening_factor)
30 : Blatter(grid, Mz, coarsening_factor) {
31
32 // use the isothermal Glen flow law
33 double n = m_config->get_number("stress_balance.blatter.Glen_exponent");
35
36 // make sure we use the same Glen exponent
37 assert(m_flow_law->exponent() == 3.0);
38
39 // store constant hardness (enthalpy and pressure values are irrelevant)
40 m_B = m_flow_law->hardness(1e5, 0);
41}
42
44 const int *node_type,
45 const double *ice_bottom,
46 const double *sea_level) {
47 (void) face;
48 (void) node_type;
49 (void) ice_bottom;
50 (void) sea_level;
51
52 return false;
53}
54
55bool BlatterTestXY::dirichlet_node(const DMDALocalInfo &info, const fem::Element3::GlobalIndex& I) {
56 // use Dirichlet BC on the whole map-plane boundary
57 return (I.i == 0 or I.i == info.mx - 1 or
58 I.j == 0 or I.j == info.my - 1);
59}
60
61Vector2d BlatterTestXY::u_bc(double x, double y, double z) const {
62 (void) z;
63
64 return blatter_xy_exact(x, y);
65}
66
68 const double *surface,
69 const double *bed,
70 Vector2d *residual) {
71 (void) surface;
72 (void) bed;
73
74 // compute x and y coordinates of quadrature points
75 double
76 *x = m_work[0],
77 *y = m_work[1];
78 {
79 double
80 *x_nodal = m_work[2],
81 *y_nodal = m_work[3];
82
83 for (int n = 0; n < element.n_chi(); ++n) {
84 x_nodal[n] = element.x(n);
85 y_nodal[n] = element.y(n);
86 }
87
88 element.evaluate(x_nodal, x);
89 element.evaluate(y_nodal, y);
90 }
91
92 // loop over all quadrature points
93 for (unsigned int q = 0; q < element.n_pts(); ++q) {
94 auto W = element.weight(q) / m_scaling;
95
96 // loop over all test functions
97 for (int t = 0; t < element.n_chi(); ++t) {
98 const auto &psi = element.chi(q, t);
99
100 residual[t] += W * psi.val * blatter_xy_source(x[q], y[q], m_B);
101 }
102 }
103}
104
105} // end of namespace stressbalance
106} // end of namespace pism
std::shared_ptr< const Config > m_config
configuration database used by this component
Definition Component.hh:160
This class represents a 2D vector field (such as ice velocity) at a certain grid point.
Definition Vector2d.hh:29
void evaluate(const T *x, T *vals, T *dx, T *dy, T *dz) const
Given nodal values, compute the values and partial derivatives at the quadrature points.
Definition Element.hh:285
int n_chi() const
Definition Element.hh:65
double weight(unsigned int q) const
Weight of the quadrature point q
Definition Element.hh:85
const Germ & chi(unsigned int q, unsigned int k) const
Definition Element.hh:73
unsigned int n_pts() const
Number of quadrature points.
Definition Element.hh:80
double y(int n) const
Definition Element.hh:376
double x(int n) const
Definition Element.hh:371
3D Q1 element
Definition Element.hh:358
Isothermal Glen ice allowing extra customization.
double m_B
constant ice hardness
void residual_source_term(const fem::Q1Element3 &element, const double *surface, const double *bed, Vector2d *residual)
bool marine_boundary(int face, const int *node_type, const double *ice_bottom, const double *sea_level)
Vector2d u_bc(double x, double y, double z) const
BlatterTestXY(std::shared_ptr< const Grid > grid, int Mz, int coarsening_factor)
bool dirichlet_node(const DMDALocalInfo &info, const fem::Element3::GlobalIndex &I)
double m_work[m_n_work][m_Nq]
Definition Blatter.hh:109
std::shared_ptr< rheology::FlowLaw > m_flow_law
std::shared_ptr< EnthalpyConverter > m_EC
#define n
Definition exactTestM.c:37
Vector2d blatter_xy_source(double x, double y, double B)
Vector2d blatter_xy_exact(double x, double y)