A scalable matrix-free spectral element approach for unsteady PDE constrained optimization using PETSc/TAO
Introduction
Fitting numerical or experimental observations to determine parameters, identifying boundary conditions that satisfy certain observations, optimizing an objective function of a simulation solution, accelerating simulations through their long transients, such as the spin-up problem [1], and many more computations fall within the field of partial differential equation (PDE)-constrained optimization and inverse problems. Despite their widespread utility, the solution of such problems is plagued by bottlenecks ranging from mathematical issues to high computational costs, high input–output costs, and especially software complexity. Several codes, such as JuMP [2], and Python libraries, such as the dolfin-adjoint project, [3], address these issues; however, they exhibit limitations for large-scale problems.
A unique contribution of this paper is the efficient, scalable application of the transpose of the Jacobian matrix-vector product for spectral elements at a cost not much more than the forward application of the nonlinear operator using tensor contractions. The matrix-free approach avoids the cost and storage required by forming the Jacobian explicitly. Our implementation of the optimization process leverages the extensive range of time integrators available in the Portable, Extensible Toolkit for Scientific in (PETSc) [4] and the optimization algorithms readily available in the Toolkit for Advanced Optimization (TAO) [5]. In particular, we utilize adjoints of numerical integrators as in [6].
Time-dependent PDE-constrained optimization problems can be posed in two ways: either by fully discretizing, in both space and time, the entire Karush–Kuhn–Tucker (KKT) system (that is, solving for all unknowns at all time steps simultaneously, sometimes called the all-at-once approach) [7] or by decoupling the direct problem and its adjoint [8], [9], [10], [11], [12] and solving the optimization problem via a forward/backward time-stepping loop, with appropriate initial and boundary conditions depending on the objective function. This work focuses on the latter, in particular on discrete adjoint approaches, targeting a minimal computational cost implementation of the adjoint equation. Optimization algorithms that involve time integration are computationally expensive, for example, for an optimization that requires iterations, one needs to perform integrations each of time steps, where the backward integration can be more expensive than the forward integration. Employing all possible computational accelerations is crucial since any speedup accumulates significantly with the number of time steps and optimization iterations.
The core strategy presented in this study is to solve the inverse (or PDE-constrained optimization) problem in a purely nonlinear manner. Considerable work has previously relied on linearized adjoints; that is, the model is first linearized, and the adjoints are computed for that linearized problem [13]. Here we showcase the solution of the nonlinear time-dependent viscous Burgers equation utilizing PETSc with TAO.
In previous work [14], we addressed the often-overlooked data intensity and computational intensity aspects of PDE-constrained optimization. The data intensity for nonlinear problems stems from the nature of the backward-in-time component, which depends at every time instance on its forward counterpart. A robust treatment for balancing the compute time versus trajectory storage has been implemented in PETSc, using the checkpointing algorithm revolve [15] as done by Schnaen et al. [14]. Previous work for ordinary differential equations (ODEs) and differential algebraic equations (DAEs) can be found in the work of Zhang and Sandu [16].
It is well known to the PDE-constrained optimization community that continuous derivatives of the adjoint equation differ in nature from their discrete counterpart and may provide different gradients that affect the convergence of the optimization algorithm [17], [18]. We do not consider this issue in this paper; however, we note that the SUNDIALS package [19] provides continuous adjoint capabilities [20].
The paper is organized as follows. The time-dependent PDE-constrained optimization problem is stated in an operator fashion that allows for operators including diffusion, advection, and nonlinear ones such as the operator in Burgers equation. Then the main aspects of a spectral element method are presented, including a new approach for efficient matrix-free application of the transpose Jacobian matrix-vector product. This is followed by a discussion of the discrete adjoint approach. We then present an overview of the PETSc ODE/DAE integrators and their adjoint integrations, followed by a description of TAO and its gradient-based solvers. The results section focuses on the complete solution process for performing PDE-constrained optimization using the spectral element method and PETSc/TAO. We include a scalability study with over 2 billion unknowns and 130,000 cores. The final section briefly summarizes our conclusions and potential future work.
Section snippets
Problem formulation
This work illustrates a highly efficient spatial discretization for both the PDE and its adjoint and, by connecting the various components available in the PETSc software stack, showcase the capability of performing large-scale PDE-constrained optimization. To this end, we present the mathematical framework at the same level of generality as handled by PETSc.
We denote a generic unsteady PDE model bywhere is a stand-in operator
Treatment of partial differential equations
To outline the significant computational difficulties encountered in PDE-constrained optimization and also to showcase the full range of PETSc adjoint capabilities, we consider the viscous Burgers equation, a nonlinear problem in three dimensions. For spatial coordinates the periodic three-dimensional viscous Burgers equation can be stated aswhere represents the viscosity and . By casting the equation in the form of Eq. (2.1) we have
PDE-constrained optimization
Several mathematical approaches are available in PDE-constrained optimization, of which the Lagrange-multiplier framework can be used in both continuous and discrete adjoint-based optimization.
Accuracy
The time integration error in PETSc can be tracked by using the built-in error estimation and error control mechanism. These work by changing the step size to maintain user-specified absolute, , and relative, , tolerances. The error estimate is based on the local truncation error, so for every step the algorithm verifies that the estimated local truncation error satisfies the tolerances provided by the user and computes a new step size. For multistage methods, the local truncation is
Computational results
The matrix-free discretization using spectral elements is illustrated in the viscous Burgers equation. The time integration and the optimization algorithm are performed using the PETSc capabilities supported by TS and TAO. To start, we validate the results against a classical solution and perform a grid convergence study in one dimension. We then present a three-dimensional problem and perform scalability studies, to illustrate both the superiority of the spatial discretization and the
Conclusions
We have demonstrated how PETSc time integrators, its adjoint capability, and the gradient-based optimization capabilities of TAO can be used to solve PDE-constrained optimization systematically problems using the spectral element method with both explicit and implicit time integrators. We provided a new efficient approach to apply the transpose of the Jacobian using tensor contractions for the nonlinear Burgers equation, thus resulting in an adjoint integration time that is not much more
Authors’ contribution
Oana Marin: conceptualization, methodology, software, formal analysis, investigation, writing – original draft, writing – review & editing, visualization. Emil Constantinescu: conceptualization, methodology, writing – review & editing, supervision. Barry Smith: conceptualization, methodology, validation, investigation, writing – review & editing, visualization, project administration, funding acquisition.
Conflict of interest
None declared.
Declaration of Competing Interest
The authors report no declarations of interest.
Acknowledgments
We thank Hong Zhang for the time-integration adjoint capability implemented in PETSc. This material is based upon work supported by the U.S. Department of Energy, Office of Science, Advanced Scientific Computing Research under Contract DE-AC02-06CH11357 and the Exascale Computing Project (Contract No. 17-SC-20-SC). This research was supported by the Exascale Computing Project (17-SC-20-SC), a collaborative effort of the U.S. Department of Energy Office of Science and the National Nuclear
Oana Marin received her Ph.D. degree in applied mathematics, with a specialization in numerical analysis, from the Royal Institute of Technology, Sweden, 2012. She is currently an assistant applied mathematics specialist in the Mathematics and Computer Science Division at Argonne National Laboratory, and on the editorial board of SIAM News. Her research interests include boundary integrals and spectral methods, as well as development and efficient integration of numerical algorithms in
References (36)
Spin up problem and accelerating convergence to steady state
Appl. Math. Modell.
(2013)- et al.
Asynchronous two-level checkpointing scheme for large-scale adjoints in the spectral-element solver Nek5000
Proc. Comput. Sci.
(2016) Generalizing global error estimation for ordinary differential equations by using coupled time-stepping methods
J. Comput. Appl. Math.
(2018)- et al.
JuMP: a modeling language for mathematical optimization
SIAM Rev.
(2017) - et al.
Automated derivation of the adjoint of high-level transient finite element programs
SIAM J. Sci. Comput.
(2013) - et al.
PETSc Users’ Manual, Technical Report ANL-95/11 – Revision 3. 13
(2020) - et al.
Toolkit for Advanced Optimization (TAO) Users’ Manual. Technical Report ANL/MCS-TM-322 – Rev 3. 12
(2019) - et al.
PETSc TSAdjoint: A Discrete Adjoint ODE Solver for First-Order and Second-Order Sensitivity Analysis
(2019) - et al.
Model Problems in PDE-Constrained Optimization. Technical Report. TS-200X-00X-A
(2007) - et al.
Adjoint equations in CFD: duality, boundary conditions and solution behaviour
AIAA Paper 1850
(1997)
Unsteady adjoint method for the optimal control of advection and Burger's equations using high-order spectral difference method
49th AIAA Aerospace Sciences Meeting including the New Horizons Forum and Aerospace Exposition
Perspectives in Flow Control and Optimization
On the properties of Runge-Kutta discrete adjoints
International Conference on Computational Science
Constrained optimization: from Lagrangian mechanics to optimal control and PDE constraints
Optimization with PDE Constraints
Adjoint optimization of natural convection problems: differentially heated cavity
Theoret. Comput. Fluid Dyn.
Algorithm 799: revolve: an implementation of checkpointing for the reverse or adjoint mode of computational differentiation
ACM Trans. Math. Softw.
FATODE: a library for forward, adjoint, and tangent linear integration of ODEs
SIAM J. Sci. Comput.
On reducing computational effort in topology optimization: how far can we go?
Struct. Multidisc. Optim.
Cited by (2)
Moose Optimization Module
2024, SSRN
Oana Marin received her Ph.D. degree in applied mathematics, with a specialization in numerical analysis, from the Royal Institute of Technology, Sweden, 2012. She is currently an assistant applied mathematics specialist in the Mathematics and Computer Science Division at Argonne National Laboratory, and on the editorial board of SIAM News. Her research interests include boundary integrals and spectral methods, as well as development and efficient integration of numerical algorithms in large-scale applications.
Emil M. Constantinescu received his Ph.D. degree in computer science from Virginia Tech, Blacksburg, in 2008. He is currently a computational mathematician in the Mathematics and Computer Science Division at Argonne National Laboratory, and he is on the editorial board of SIAM Journal on Scientific Computing. His research interests include numerical analysis of time-stepping algorithms and their applications to environment and energy systems.
Barry Smith is currently a senior applied mathematician in the Mathematics and Computer Science Division at Argonne National Laboratory. He received his Ph.D. in mathematics from New York University/The Courant Institute in 1990. His focus is on numerical software and methods for partial differential equations and helps develop the Portable Extensible Toolkit for Scientific computing.