Adjoint of Physics Solution

The fundamental task in solving the adjoint of the modeled physical phenomena is to compute the cost function sensitivity with respect to the mesh, d L T d X .

The cost function sensitivity with respect to the mesh is the product of the two rightmost terms in Eqn. (5067):

Figure 1. EQUATION_DISPLAY
dLTdX=LTX+QTXLTQ
(5075)

where the calculation of this sensitivity takes place in two steps:

  1. Iteratively solving the adjoint solution, providing the sensitivity of the report objective with respect to the residuals of the governing equations, d L T d R .
  2. Computing the product of the residuals with respect to the mesh, R T X , with the adjoint solution and adding it to the explicit mesh dependency of the objective, L T X . This second step is performed as a one-off operation after the adjoint solution is converged.

These steps require the differentiation of the primal solution process, including the solution of the flow equations, energy equations and the turbulence equations when applicable. The derivation of the coupled flow model is described below. The derivation of the coupled solid energy model follows a similar pattern.

Primal Solution

The aim of the iterative solvers within Simcenter STAR-CCM+ is to advance a set of variables so that they may satisfy some set of discretized governing equations. For example, the governing equations for the Coupled Flow Model are the Navier -Stokes equations Eqn. (5076).

The preconditioned Navier-Stokes equations are described as:

Figure 2. EQUATION_DISPLAY
Γ t V Q d V + [ F G ] d A = V H d V
(5076)

where Γ is the preconditioning matrix, F and G are the inviscid and viscous fluxes, respectively, and H are the body forces.

For generality, suppose there are N different iterative solvers, each concerned with advancing a sub set of variables such that they satisfy some governing equations. In the case of a turbulent flow problem, these solvers would be the Coupled Implicit Solver, a Turbulence Solver and a Turbulent Viscosity Solver for example. For the i t h solver, the set of variables is referred to as Q i and the discretized governing equations can be represented in residual form as R i . Because the solvers are coupled, this residual can be a function of all variables in the simulation. Using this notation, the primal solution boils down to solving the following set of coupled non-linear equations:

Figure 3. EQUATION_DISPLAY
R1(Q1,Q2,Qi,,QN,X)=0R2(Q1,Q2,Qi,,QN,X)=0Ri(Q1,Q2,Qi,,QN,X)=0RN(Q1,Q2,Qi,,QN,X)=0
(5077)

For a steady problem, this process takes on the form of a non-linear block Gauss-Seidel method with each solver building its residual based on the latest variable values and advancing its set of variables based on a local preconditioner [ P i ] . For solver i , the update for non-linear iteration k is given as:

Figure 4. EQUATION_DISPLAY
Rik=Ri(Q1k+1,Q2k+1,Qik,,QNk)Qik+1=Qik[Pi]1Rik
(5078)

In the case of the Coupled Flow Model, the preconditioner is an approximate linearization of the Navier-Stokes equations w.r.t the flow variables (P, U, V, W, T), defined below:

Figure 5. EQUATION_DISPLAY
[P]=VδtΓ+jNf(FjQGjQ)Aj
(5079)

Adjoint Solution

To derive the steady adjoint solution, the coupled non-linear equations defined in the primal solution must be differentiated and transposed. To determine the derivative w.r.t X , the chain rule is applied to each primal residual equation:

Figure 6. EQUATION_DISPLAY
dR1dX+R1Q1Q1X+R1Q2Q2X++R1QiQiX++R1QNQNX=0dR2dX+R2Q1Q1X+R2Q2Q2X++R2QiQiX++R2QNQNX=0dRidX+RiQ1Q1X+RiQ2Q2X++RiQiQiX++RiQNQNX=0dRNdX+RNQ1Q1X+RNQ2Q2X++RNQiQiX++RNQNQNX=0
(5080)
The result of the above differentiation is a large, fully coupled linear system between all the solvers:
Figure 7. EQUATION_DISPLAY
[RQ]QX=RX
(5081)

Unlike the preconditioner matrix used to advance the primal, the linearizations in the above process are exact and account for 2nd order terms.

Figure 8. EQUATION_DISPLAY
QTX=RTX[RQ]T
(5082)

As the inverse calculation for [ R Q ] T is computationally expensive, Eqn. (5081) is multiplied with the previously calculated result of L Q T (see Solution Analysis):

Figure 9. EQUATION_DISPLAY
d L d X T = L X T R X T [ R Q ] T L Q T
(5083)

where R X T is known because R is known. The last two terms define the adjoint solution variable, ΛQ:

Figure 10. EQUATION_DISPLAY
ΛQ=[RQ]TLQT
(5084)

which can be interpreted as d L d R T .

To avoid calculating and assembling a large, complex matrix, the adjoint solution process utilizes algorithms which only require matrix vector products, namely Restarted GMRES and Defect correction. The defection-correction can be written as:

Figure 11. EQUATION_DISPLAY
[P]TδΛQ=LQ[RQ]ΛQ=RΛQ(ΛbfQ)
(5085)

For GMRES, the system is solved directly and Eqn. (5085) is used as a preconditioner within the GMRES algorithm. To implement a sweep of defect correction across multiple solvers, the primal solution process is applied in reverse order and each adjoint solver operates on a column of the overall matrix. At each iteration, the solver computes an adjoint residual and advances its adjoint variables using the transpose of the local preconditioner. The only departure from the primal structure is that the adjoint is advanced in a block Jacobi-like manner, where all solvers use the adjoint solution from the previous iteration when computing their adjoint residuals. Advancing the solution in this way saves memory when solving for multiple adjoint solutions.

Figure 12. EQUATION_DISPLAY
RΛQ,ik=R1QiΛQ,1k+R2QiΛQ,2k++RiQiΛQ,ik++RNQiΛQ,NkΛQ,ik+1=ΛQ,ik[Pi]TRΛQ,ik
(5086)

The above process represents the fully coupled adjoint solution for the primal process. For example, if the primal consists of a flow solution using the SA turbulence model, the above represents the implementation when the Adjoint SA model is selected. It is also possible to introduce a frozen treatment for a particular solver. This is the treatment applied to turbulence solvers when the Adjoint Frozen Turbulence Model is selected. When a solver is frozen, the row representing that solvers residual and the column representing that solvers variables are removed from the linear system of Eqn. (5081).

The practical consequence of this removal is that the corresponding adjoint solvers can be left out of the process, enhancing the robustness and performance of the adjoint solution process at the expense of accuracy.