MFEM v4.8.0
Finite element discretization library
Loading...
Searching...
No Matches
pparamnonlinearform.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2025, 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 real_t GetEnergy(const Vector &x) const override;
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 void SetEssentialBC(const Array<Array<int> *>&bdr_attr_is_ess,
69 Array<Vector *> &rhs) override;
70
71 // Set the essential BCs for the parametric fields. Here, rhs is a true dof
72 // vector!
73 void SetParamEssentialBC(const Array<Array<int> *>&bdr_attr_is_ess,
74 Array<Vector *> &rhs) override;
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 void Mult(const Vector &x, Vector &y) const override;
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 void ParamMult(const Vector &x, Vector &y) const override;
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 BlockOperator &GetGradient(const Vector &x) const override;
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 void SetStateFields(const Vector &xv) const override;
103
104 /// Set the adjoint fields
105 void SetAdjointFields(const Vector &av) const override;
106
107 /// Set the parameters/design fields
108 void SetParamFields(const Vector &dv) const override;
109};
110
111}
112
113#endif
114#endif
Dynamic 2D array using row-major layout.
Definition array.hpp:392
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.
BlockOperator & GetGradient(const Vector &x) const override
Return the block gradient matrix for the given true-dof vector x.
void ParamMult(const Vector &x, Vector &y) const override
Calculates the product of the adjoint field and the derivative of the state residual with respect to ...
virtual ~ParParametricBNLForm()
Destructor.
void SetGradientType(Operator::Type tid)
Set the operator type id for the blocks of the parallel gradient matrix/operator. The default type is...
ParFiniteElementSpace * ParParamFESpace(int k)
void Mult(const Vector &x, Vector &y) const override
Calculates the residual for a state input given by block T-Vector. The result is Block T-Vector!...
real_t GetEnergy(const Vector &x) const override
Computes the energy of the system.
Array2D< OperatorHandle * > phBlockGrad
void SetStateFields(const Vector &xv) const override
Set the state fields.
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(),...
void SetEssentialBC(const Array< Array< int > * > &bdr_attr_is_ess, Array< Vector * > &rhs) override
Set the state essential BCs. Here, rhs is a true dof vector!
void SetAdjointFields(const Vector &av) const override
Set the adjoint fields.
void SetParamEssentialBC(const Array< Array< int > * > &bdr_attr_is_ess, Array< Vector * > &rhs) override
Set the essential boundary conditions on the parametric fields.
void SetParamFields(const Vector &dv) const override
Set the parameters/design fields.
ParParametricBNLForm()
Construct an empty ParParametricBNLForm. Initialize with SetParSpaces().
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:82
float real_t
Definition config.hpp:43