tIPGroundedIceH1NormFunctional.hh - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch)
HTML git clone git://src.adamsgaard.dk/pism
DIR Log
DIR Files
DIR Refs
DIR LICENSE
---
tIPGroundedIceH1NormFunctional.hh (3082B)
---
1 // Copyright (C) 2013, 2014, 2015, 2016, 2017 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 "IPFunctional.hh"
23 #include "pism/util/Mask.hh"
24
25 namespace pism {
26
27 class IceModelVec2CellType;
28
29 namespace inverse {
30
31 //! 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.
32 /*! The functional is, in continuous terms
33 \f[
34 J(f) = \int_{\Omega_g} c_{H^1} \left|\nabla f\right|^2 + c_{L^2}f^2 \; dA
35 \f]
36 where \f$\Omega_g\f$ is a subset of the square domain consisting of grounded ice.
37 Numerically it is implemented using Q1 finite elements. Only those elements where all nodes
38 have grounded ice are included in the integration, which alleviates edge effects due to steep
39 derivatives in parameters that can occur at the transition between icy/non-icy regions.
40 Integration can be 'restricted', in a sense, to a subset of the domain
41 using a projection that forces \f$f\f$ to equal zero at nodes specified
42 by the constructor argument \a dirichletLocations.
43 */
44 class IPGroundedIceH1NormFunctional2S : public IPInnerProductFunctional<IceModelVec2S> {
45 public:
46 IPGroundedIceH1NormFunctional2S(IceGrid::ConstPtr grid, double cL2,
47 double cH1, IceModelVec2CellType &ice_mask,
48 IceModelVec2Int *dirichletLocations=NULL)
49 : IPInnerProductFunctional<IceModelVec2S>(grid),
50 m_cL2(cL2),
51 m_cH1(cH1),
52 m_dirichletIndices(dirichletLocations),
53 m_ice_mask(ice_mask) {};
54 virtual ~IPGroundedIceH1NormFunctional2S() {};
55
56 virtual void valueAt(IceModelVec2S &x, double *OUTPUT);
57 virtual void dot(IceModelVec2S &a, IceModelVec2S &b, double *OUTPUT);
58 virtual void gradientAt(IceModelVec2S &x, IceModelVec2S &gradient);
59
60 virtual void assemble_form(Mat J);
61
62 protected:
63
64 double m_cL2, m_cH1;
65 IceModelVec2Int *m_dirichletIndices;
66 IceModelVec2CellType &m_ice_mask;
67
68 private:
69 IPGroundedIceH1NormFunctional2S(IPGroundedIceH1NormFunctional2S const &);
70 IPGroundedIceH1NormFunctional2S & operator=(IPGroundedIceH1NormFunctional2S const &);
71 };
72
73 } // end of namespace inverse
74 } // end of namespace pism
75
76 #endif /* end of include guard: IPGROUNDEDICEH1NORMFUNCTIONAL_HH_Q4IZKJOR */