22#include "pism/stressbalance/ssa/SSA.hh"
23#include "pism/util/fem/Element.hh"
24#include "pism/util/fem/ElementIterator.hh"
25#include "pism/util/petscwrappers/SNES.hh"
26#include "pism/util/TerminationReason.hh"
27#include "pism/util/Mask.hh"
31namespace stressbalance {
40 SSAFEM(std::shared_ptr<const Grid>
g);
81 double *hardness)
const;
96 double *nuH,
double *dnuH,
97 double *beta,
double *dbeta);
148 Vector2d const *
const * residual_global);
This class represents a 2D vector field (such as ice velocity) at a certain grid point.
A storage vector combining related fields in a struct.
Manages iterating over element indices.
The mapping from global to local degrees of freedom.
Q1 element with sides parallel to X and Y axes.
std::shared_ptr< TerminationReason > solve_with_reason(const Inputs &inputs)
void PointwiseNuHAndBeta(double thickness, double hardness, int mask, double tauc, const Vector2d &U, const Vector2d &U_x, const Vector2d &U_y, double *nuH, double *dnuH, double *beta, double *dbeta)
Compute the "(regularized effective viscosity) x (ice thickness)" and effective viscous bed strength ...
void driving_stress(const fem::Element &E, const Coefficients *x, Vector2d *result) const
const array::Scalar * m_driving_stress_x
void cache_inputs(const Inputs &inputs)
Initialize stored data from the coefficients in the SSA. Called by SSAFEM::solve.
static PetscErrorCode function_callback(DMDALocalInfo *info, Vector2d const *const *velocity, Vector2d **residual, CallbackData *fe)
SNES callbacks.
double m_beta_ice_free_bedrock
static void explicit_driving_stress(const fem::Element &E, const Coefficients *x, Vector2d *result)
CallbackData m_callback_data
virtual ~SSAFEM()=default
void compute_local_jacobian(Vector2d const *const *velocity, Mat J)
Implements the callback for computing the Jacobian.
array::Vector1 m_boundary_integral
Boundary integral (CFBC contribution to the residual).
static PetscErrorCode jacobian_callback(DMDALocalInfo *info, Vector2d const *const *velocity, Mat A, Mat J, CallbackData *fe)
void monitor_jacobian(Mat Jac)
void monitor_function(Vector2d const *const *velocity_global, Vector2d const *const *residual_global)
virtual void solve(const Inputs &inputs)
fem::Q1Element2 m_q1_element
virtual void init_impl()
Initialize a generic regular-grid SSA solver.
std::shared_ptr< TerminationReason > solve_nocache()
void cache_residual_cfbc(const Inputs &inputs)
Compute and cache residual contributions from the integral over the lateral boundary.
void compute_local_function(Vector2d const *const *velocity, Vector2d **residual)
Implements the callback for computing the residual.
fem::ElementIterator m_element_index
void quad_point_values(const fem::Element &E, const Coefficients *x, int *mask, double *thickness, double *tauc, double *hardness) const
Compute quadrature point values of various coefficients given a quadrature Q and nodal values.
const array::Scalar * m_driving_stress_y
array::Scalar1 m_node_type
Storage for node types (interior, boundary, exterior).
array::Vector1 m_bc_values
array::Array2D< Coefficients > m_coefficients
PISM's SSA solver: the finite element method implementation written by Jed and David.
const array::Vector1 & velocity() const
Get the thickness-advective 2D velocity.
Adaptor for gluing SNESDAFormFunction callbacks to an SSAFEM.
double thickness
ice thickness
double tauc
basal yield stress
double sea_level
sea level
Vector2d driving_stress
prescribed gravitational driving stress
double hardness
ice hardness