PISM, A Parallel Ice Sheet Model  stable v2.1.1 committed by Constantine Khrulev on 2024-12-04 13:36:58 -0900
IPGroundedIceH1NormFunctional.hh
Go to the documentation of this file.
1 // Copyright (C) 2013, 2014, 2015, 2016, 2017, 2022 David Maxwell and Constantine Khroulev
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 #ifndef IPGROUNDEDICEH1NORMFUNCTIONAL_HH_Q4IZKJOR
20 #define IPGROUNDEDICEH1NORMFUNCTIONAL_HH_Q4IZKJOR
21 
22 #include "pism/inverse/functional/IPFunctional.hh"
23 #include "pism/util/Mask.hh"
24 
25 namespace pism {
26 
27 namespace array {
28 class CellType1;
29 class CellType2;
30 class CellType;
31 } // end of namespace array
32 
33 namespace inverse {
34 
35 //! Implements a functional corresponding to (the square of) an \f$H^1\f$ norm of a scalar valued function over a region with only grounded ice.
36 /*! The functional is, in continuous terms
37  \f[
38  J(f) = \int_{\Omega_g} c_{H^1} \left|\nabla f\right|^2 + c_{L^2}f^2 \; dA
39  \f]
40  where \f$\Omega_g\f$ is a subset of the square domain consisting of grounded ice.
41  Numerically it is implemented using Q1 finite elements. Only those elements where all nodes
42  have grounded ice are included in the integration, which alleviates edge effects due to steep
43  derivatives in parameters that can occur at the transition between icy/non-icy regions.
44  Integration can be 'restricted', in a sense, to a subset of the domain
45  using a projection that forces \f$f\f$ to equal zero at nodes specified
46  by the constructor argument \a dirichletLocations.
47 */
49 public:
50  IPGroundedIceH1NormFunctional2S(std::shared_ptr<const Grid> grid, double cL2,
51  double cH1, array::CellType1 &ice_mask,
52  array::Scalar *dirichletLocations=NULL)
53  : IPInnerProductFunctional<array::Scalar>(grid),
54  m_cL2(cL2),
55  m_cH1(cH1),
56  m_dirichletIndices(dirichletLocations),
57  m_ice_mask(ice_mask) {};
59 
60  virtual void valueAt(array::Scalar &x, double *OUTPUT);
61  virtual void dot(array::Scalar &a, array::Scalar &b, double *OUTPUT);
62  virtual void gradientAt(array::Scalar &x, array::Scalar &gradient);
63 
64  virtual void assemble_form(Mat J);
65 
66 protected:
67 
68  double m_cL2, m_cH1;
71 
72 private:
75 };
76 
77 } // end of namespace inverse
78 } // end of namespace pism
79 
80 #endif /* end of include guard: IPGROUNDEDICEH1NORMFUNCTIONAL_HH_Q4IZKJOR */
IPGroundedIceH1NormFunctional2S(IPGroundedIceH1NormFunctional2S const &)
virtual void valueAt(array::Scalar &x, double *OUTPUT)
Computes the value of the functional at the vector x.
IPGroundedIceH1NormFunctional2S(std::shared_ptr< const Grid > grid, double cL2, double cH1, array::CellType1 &ice_mask, array::Scalar *dirichletLocations=NULL)
virtual void gradientAt(array::Scalar &x, array::Scalar &gradient)
Computes the gradient of the functional at the vector x.
IPGroundedIceH1NormFunctional2S & operator=(IPGroundedIceH1NormFunctional2S const &)
virtual void dot(array::Scalar &a, array::Scalar &b, double *OUTPUT)
Computes the inner product .
Implements a functional corresponding to (the square of) an norm of a scalar valued function over a ...
Abstract base class for IPFunctionals arising from an inner product.
Definition: IPFunctional.hh:94
const int J[]
Definition: ssafd_code.cc:34