MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
pparamnonlinearform.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2024, 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"
20
21namespace 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{
31protected:
35
36public:
37 /// Computes the energy of the system
38 virtual real_t 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
Dynamic 2D array using row-major layout.
Definition array.hpp:372
A class to handle Block systems in a matrix-free implementation.
A class to handle Vectors in a block fashion.
Type
Enumeration defining IDs for some classes derived from Operator.
Definition operator.hpp:284
Abstract parallel finite element space.
Definition pfespace.hpp:29
A class representing a general parametric parallel block nonlinear operator defined on the Cartesian ...
ParFiniteElementSpace * ParFESpace(int k)
Return the k-th parallel FE state space of the ParParametricBNLForm.
virtual BlockOperator & GetGradient(const Vector &x) const
Return the block gradient matrix for the given true-dof vector x.
virtual ~ParParametricBNLForm()
Destructor.
virtual void SetParamFields(const Vector &dv) const
Set the parameters/design fields.
void SetGradientType(Operator::Type tid)
Set the operator type id for the blocks of the parallel gradient matrix/operator. The default type is...
virtual void SetAdjointFields(const Vector &av) const
Set the adjoint fields.
ParFiniteElementSpace * ParParamFESpace(int k)
virtual real_t GetEnergy(const Vector &x) const
Computes the energy of the system.
Array2D< OperatorHandle * > phBlockGrad
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 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!
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!...
virtual void SetStateFields(const Vector &xv) const
Set the state 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 ...
ParParametricBNLForm()
Construct an empty ParParametricBNLForm. Initialize with SetParSpaces().
virtual void SetParamEssentialBC(const Array< Array< int > * > &bdr_attr_is_ess, Array< Vector * > &rhs)
Set the essential boundary conditions on the parametric fields.
const BlockOperator & GetLocalGradient(const Vector &x) const
Return the local block gradient matrix for the given true-dof vector x.
A class representing a general parametric block nonlinear operator defined on the Cartesian product o...
Vector data type.
Definition vector.hpp:80
float real_t
Definition config.hpp:43