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
IP_H1NormFunctional.hh
Go to the documentation of this file.
1// Copyright (C) 2012, 2013, 2014, 2015, 2020, 2024 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 IP_H1NORMFUNCTIONAL_HH_TF8AKRNQ
20#define IP_H1NORMFUNCTIONAL_HH_TF8AKRNQ
21
22#include "pism/inverse/functional/IPFunctional.hh"
23#include "pism/util/array/Scalar.hh"
24
25namespace pism {
26namespace inverse {
27
28
29//! Implements a functional corresponding to (the square of) an \f$H^1\f$ norm of a scalar valued function.
30/*! The functional is, in continuous terms
31 \f[
32 J(f) = \int_{\Omega} c_{H^1} \left|\nabla f\right|^2 + c_{L^2}f^2 \; dA
33 \f]
34 where \f$\Omega\f$ is the square domain. Numerically it is implemented using
35 Q1 finite elements. Integration can be 'restricted', in a sense, to a subset of the domain
36 using a projection that forces \f$f\f$ to equal zero at nodes specified
37 by the constructor argument \a dirichletLocations.
38*/
39class IP_H1NormFunctional2S : public IPInnerProductFunctional<array::Scalar> {
40public:
41 /*!
42 * @param[in] grid computational grid
43 * @param[in] cL2 The constant \f$c_{L^2}\f$.
44 * @param[in] cH1 The constant \f$c_{H^1}\f$.
45 * @param[in] dirichletLocations Nodes where the function will be set to zero prior to integration.
46 */
47 IP_H1NormFunctional2S(std::shared_ptr<const Grid> grid,
48 double cL2,
49 double cH1,
50 array::Scalar *dirichletLocations=NULL)
51 : IPInnerProductFunctional<array::Scalar>(grid),
52 m_cL2(cL2),
53 m_cH1(cH1),
54 m_dirichletIndices(dirichletLocations) {};
56
57 virtual void valueAt(array::Scalar &x, double *OUTPUT);
58 virtual void dot(array::Scalar &a, array::Scalar &b, double *OUTPUT);
59 virtual void gradientAt(array::Scalar &x, array::Scalar &gradient);
60 virtual void assemble_form(Mat J);
61
62protected:
63
64 double m_cL2, m_cH1;
66
67private:
70};
71
72} // end of namespace inverse
73} // end of namespace pism
74
75#endif /* end of include guard: H1NORMFUNCTIONAL_HH_TF8AKRNQ */
Abstract base class for IPFunctionals arising from an inner product.
virtual void dot(array::Scalar &a, array::Scalar &b, double *OUTPUT)
Computes the inner product .
IP_H1NormFunctional2S(IP_H1NormFunctional2S const &)
IP_H1NormFunctional2S(std::shared_ptr< const Grid > grid, double cL2, double cH1, array::Scalar *dirichletLocations=NULL)
IP_H1NormFunctional2S & operator=(IP_H1NormFunctional2S const &)
virtual void gradientAt(array::Scalar &x, array::Scalar &gradient)
virtual void valueAt(array::Scalar &x, double *OUTPUT)
Implements a functional corresponding to (the square of) an norm of a scalar valued function.