MFEM  v4.4.0
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
pparamnonlinearform.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2022, Lawrence Livermore National Security, LLC. Produced
2 // at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3 // LICENSE and NOTICE for details. LLNL-CODE-806117.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability visit https://mfem.org.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
9 // terms of the BSD-3 license. We welcome feedback and contributions, see file
10 // CONTRIBUTING.md for details.
11 
12 #ifndef MFEM_PPRMNONLINEARFORM
13 #define MFEM_PPRMNONLINEARFORM
14 
15 
16 #ifdef MFEM_USE_MPI
17 
18 #include "mfem.hpp"
19 #include "paramnonlinearform.hpp"
20 
21 namespace mfem
22 {
23 
24 /** @brief A class representing a general parametric parallel block nonlinear
25  operator defined on the Cartesian product of multiple
26  ParFiniteElementSpace%s. */
27 /** The ParParametricBNLForm takes as input, and returns as output, vectors on
28  the true dofs. */
30 {
31 protected:
35 
36 public:
37  /// Computes the energy of the system
38  virtual double GetEnergy(const Vector &x) const;
39 
40  /// Construct an empty ParParametricBNLForm. Initialize with SetParSpaces().
42 
43  /** @brief Construct a ParParametricBNLForm on the given set of
44  parametric and state ParFiniteElementSpace%s. */
47 
48  /// Return the @a k-th parallel FE state space of the ParParametricBNLForm.
50  /** @brief Return the @a k-th parallel FE state space of the
51  ParParametricBNLForm (const version). */
52  const ParFiniteElementSpace *ParFESpace(int k) const;
53 
54  /// Return the @a k-th parallel FE parameters space of the
55  /// ParParametricBNLForm.
57  /** @brief Return the @a k-th parallel FE parameters space of the
58  ParParametricBNLForm (const version). */
59  const ParFiniteElementSpace *ParParamFESpace(int k) const;
60 
61  /** @brief Set the parallel FE spaces for the state and the parametric
62  * fields. After a call to SetParSpaces(), the essential b.c. and the
63  * gradient-type (if different from the default) must be set again. */
66 
67  /// Set the state essential BCs. Here, rhs is a true dof vector!
68  virtual void SetEssentialBC(const Array<Array<int> *>&bdr_attr_is_ess,
69  Array<Vector *> &rhs);
70 
71  // Set the essential BCs for the parametric fields. Here, rhs is a true dof
72  // vector!
73  virtual void SetParamEssentialBC(const Array<Array<int> *>&bdr_attr_is_ess,
74  Array<Vector *> &rhs);
75 
76 
77  /** @brief Calculates the residual for a state input given by block T-Vector.
78  * The result is Block T-Vector! The parametric fields should be set in
79  * advance by calling SetParamFields(). */
80  virtual void Mult(const Vector &x, Vector &y) const;
81 
82  /** @brief Calculates the product of the adjoint field and the derivative of
83  * the state residual with respect to the parametric fields. The adjoint and
84  * the state fields should be set in advance by calling SetAdjointFields()
85  * and SetStateFields(). The input and the result are block T-Vectors!*/
86  virtual void ParamMult(const Vector &x, Vector &y) const;
87 
88  /// Return the local block gradient matrix for the given true-dof vector x
89  const BlockOperator &GetLocalGradient(const Vector &x) const;
90 
91  /// Return the block gradient matrix for the given true-dof vector x
92  virtual BlockOperator &GetGradient(const Vector &x) const;
93 
94  /** @brief Set the operator type id for the blocks of the parallel gradient
95  matrix/operator. The default type is Operator::Hypre_ParCSR. */
97 
98  /// Destructor.
99  virtual ~ParParametricBNLForm();
100 
101  /// Set the state fields
102  virtual void SetStateFields(const Vector &xv) const;
103 
104  /// Set the adjoint fields
105  virtual void SetAdjointFields(const Vector &av) const;
106 
107  /// Set the parameters/design fields
108  virtual void SetParamFields(const Vector &dv) const;
109 
110 };
111 
112 }
113 
114 #endif
115 #endif
virtual void SetParamFields(const Vector &dv) const
Set the parameters/design fields.
virtual void ParamMult(const Vector &x, Vector &y) const
Calculates the product of the adjoint field and the derivative of the state residual with respect to ...
virtual void SetEssentialBC(const Array< Array< int > * > &bdr_attr_is_ess, Array< Vector * > &rhs)
Set the state essential BCs. Here, rhs is a true dof vector!
Array2D< OperatorHandle * > phBlockGrad
A class representing a general parametric parallel block nonlinear operator defined on the Cartesian ...
A class to handle Vectors in a block fashion.
Definition: blockvector.hpp:30
virtual void Mult(const Vector &x, Vector &y) const
Calculates the residual for a state input given by block T-Vector. The result is Block T-Vector! The ...
A class representing a general parametric block nonlinear operator defined on the Cartesian product o...
const BlockOperator & GetLocalGradient(const Vector &x) const
Return the local block gradient matrix for the given true-dof vector x.
Abstract parallel finite element space.
Definition: pfespace.hpp:28
ParParametricBNLForm()
Construct an empty ParParametricBNLForm. Initialize with SetParSpaces().
ParFiniteElementSpace * ParFESpace(int k)
Return the k-th parallel FE state space of the ParParametricBNLForm.
void SetParSpaces(Array< ParFiniteElementSpace * > &statef, Array< ParFiniteElementSpace * > &paramf)
Set the parallel FE spaces for the state and the parametric fields. After a call to SetParSpaces()...
virtual ~ParParametricBNLForm()
Destructor.
virtual void SetParamEssentialBC(const Array< Array< int > * > &bdr_attr_is_ess, Array< Vector * > &rhs)
Set the essential boundary conditions on the parametric fields.
void SetGradientType(Operator::Type tid)
Set the operator type id for the blocks of the parallel gradient matrix/operator. The default type is...
Dynamic 2D array using row-major layout.
Definition: array.hpp:351
virtual void SetStateFields(const Vector &xv) const
Set the state fields.
Type
Enumeration defining IDs for some classes derived from Operator.
Definition: operator.hpp:255
virtual void SetAdjointFields(const Vector &av) const
Set the adjoint fields.
virtual double GetEnergy(const Vector &x) const
Computes the energy of the system.
Vector data type.
Definition: vector.hpp:60
A class to handle Block systems in a matrix-free implementation.
ParFiniteElementSpace * ParParamFESpace(int k)
virtual BlockOperator & GetGradient(const Vector &x) const
Return the block gradient matrix for the given true-dof vector x.