A scalable matrix-free spectral element approach for unsteady PDE constrained optimization using PETSc/TAO

https://doi.org/10.1016/j.jocs.2020.101207Get rights and content

Highlights

  • Solving partial differential constrained optimization requires multiple expertise.

  • Adjoints effective for solving partial differential constrained optimization.

  • Math libraries ideal for solving partial differential constrained optimization.

Abstract

We provide a new approach for the efficient matrix-free application of the transpose of the Jacobian for the spectral element method for the adjoint-based solution of partial differential equation (PDE) constrained optimization. This results in optimizations of nonlinear PDEs using explicit integrators where the integration of the adjoint problem is not more expensive than the forward simulation. Solving PDE constrained optimization problems entails combining expertise from multiple areas, including simulation, computation of derivatives, and optimization. The Portable, Extensible Toolkit for Scientific computation (PETSc) together with its companion package, the Toolkit for Advanced Optimization (TAO), is an integrated numerical software library that contains an algorithmic/software stack for solving linear systems, nonlinear systems, ordinary differential equations, differential algebraic equations, and large-scale optimization problems and, as such, is an ideal tool for performing PDE-constrained optimization. This paper describes an efficient approach in which the software stack provided by PETSc/TAO can be used for large-scale nonlinear time-dependent problems. Time integration can involve a range of high-order methods, both implicit and explicit. The PDE-constrained optimization algorithm used is gradient-based and seamlessly integrated with the simulation of the physical problem.

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 m iterations, one needs to perform 2m integrations each of N 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 u·u 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 byu˙=P[u],xΩ,B[u|Ω](x,t)=ub(x,t),xΩ,u(x,0)=u0(x),xΩ,where P[u] 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 x=[x1,x2,x3] the periodic three-dimensional viscous Burgers equation can be stated asu˙=νΔuu·u,where ν represents the viscosity and u=[u1,u2,u3]. By casting the equation in the form of Eq. (2.1) we haveui˙=νΔuij(ujjui),i,j=

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, TolA, and relative, TolR, 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)

  • K. Ou et al.

    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

    (2011)
  • M.D. Gunzburger

    Perspectives in Flow Control and Optimization

    (2002)
  • A. Sandu

    On the properties of Runge-Kutta discrete adjoints

    International Conference on Computational Science

    (2006)
  • M.J. Gander et al.

    Constrained optimization: from Lagrangian mechanics to optimal control and PDE constraints

    Optimization with PDE Constraints

    (2014)
  • C. Saglietti et al.

    Adjoint optimization of natural convection problems: differentially heated cavity

    Theoret. Comput. Fluid Dyn.

    (2016)
  • A. Griewank et al.

    Algorithm 799: revolve: an implementation of checkpointing for the reverse or adjoint mode of computational differentiation

    ACM Trans. Math. Softw.

    (2000)
  • H. Zhang et al.

    FATODE: a library for forward, adjoint, and tangent linear integration of ODEs

    SIAM J. Sci. Comput.

    (2014)
  • O. Amir et al.

    On reducing computational effort in topology optimization: how far can we go?

    Struct. Multidisc. Optim.

    (2011)
  • 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.

    View full text