35.2.3. Solving the Adjoint

Once an observable is defined as described in Defining Observables, the solution of the adjoint for that observable can be computed based on the current flow solution. The steps for solving the adjoint are similar to those for solving the flow and are detailed in the following sections:

35.2.3.1. Using the Adjoint Solution Methods Dialog Box

You can specify the methods used for computing the adjoint solutions in the Adjoint Solution Methods dialog box. To open the Adjoint Solution Methods dialog box, click Methods... in the Design ribbon tab (Adjoint-Based group box).

 Design → Adjoint-Based → Methods...

Figure 35.6:  Adjoint Solution Methods Dialog Box

Adjoint Solution Methods Dialog Box

The Adjoint Solution Methods dialog box shows a side-by-side comparison of the schemes used for the flow solver and for the adjoint solver. Using the same scheme for the adjoint solution and the flow solution yields the most accurate discrete derivative calculation when the adjoint solution is converged. However, not all schemes used for the flow solver are supported for the adjoint solver. In these cases an alternate adjoint scheme must be used. This does not typically lead to severe deterioration of the adjoint results quality. Even if the same scheme is available for the adjoint solver this is not always practical because stability may be reduced with some schemes. Therefore, you can use the drop-down lists under Adjoint Solver to select alternate schemes as needed.

In some cases it may not be desirable to solve the energy adjoint even if energy is solved in the flow solver. For example, consider an incompressible flow where the specified observable does not involve thermal quantities. In this case the adjoint for the energy equation is identically zero, but its inclusion would add an unnecessary numerical burden. You can disable the Adjoint Energy option to avoid solving the energy adjoint.

If the primary flow is a compressible ideal gas, you can specify that the physics of the compressible flow are modeled in the adjoint solver by enabling the Adjoint Ideal Gas option. Enabling this option automatically enables the Adjoint Energy option as well. If the flow is not a compressible ideal gas, it will be treated as being incompressible for the purposes of the adjoint calculation.

Clicking Default will configure the adjoint solver to use the default low-order schemes (Standard for pressure and First Order Upwind for momentum), which are chosen for their stability. Clicking Best Match will attempt to match the adjoint schemes to the flow schemes that should in general provide more accurate calculations at convergence. Where they cannot be matched, the default scheme will be used.

35.2.3.2. Using the Adjoint Solution Controls Dialog Box

The advancement of the adjoint solution to reach a converged solution is an essential part of the analysis. The solution algorithm for the adjoint solver is similar to the coupled pressure-based solver that is available for conventional flow computations in ANSYS Fluent.

By default, the adjoint solver advancement settings will be automatically adjusted during calculation to encourage convergence, with initial values determined by the state of the flow solution. If needed, you can adjust the advancement controls in the Adjoint Solution Controls dialog box.

To open the Adjoint Solution Controls dialog box, click Solver Controls... in the Design ribbon tab (Adjoint-Based group box).

 Design → Adjoint-Based → Solver Controls...

Options
Solution-Based Controls Initialization

When enabled, the advancement controls are selected automatically when the adjoint solution is initialized based on the state of the flow.

Auto-Adjust Controls

When enabled, the convergence of the AMG solver and the adjoint residuals are monitored during solution advancement. Based on the trends observed, the advancement controls are automatically adjusted to encourage reliable solution advancement and convergence. This is especially useful when a new type of problem is being solved for which appropriate settings are not initially clear. The advancement will begin with either user-specified settings or those from Solution-Based Controls Initialization. You can enable or disable Auto-Adjust Controls at any time during the solution.

If Auto-Adjust Controls is enabled, messages will appear as the calculation progresses indicating the adjustments that are being made.

Use Stabilized Scheme

When enabled, stabilization will be applied to the adjoint solution. Click Settings... to specify the stabilization type and settings. The details of these settings are described in Stabilized Scheme Settings. A stabilized solution scheme will be required to obtain adjoint solutions for problems at high Reynolds number in which there is strong shear and/or complex geometry.

Show Advancement Controls

Toggles the visibility of the various advancement controls for direct user-specification.

Advancement Controls
Apply Preconditioning

Enables solution preconditioning. This is needed for most cases involving turbulent flow. If preconditioning is enabled, the following controls are available:

Courant Number

A higher number corresponds to a more aggressive advancement of the computation at the risk of instability. Disabling preconditioning corresponds to an infinite Courant number.

Artificial Compressibiilty

A nonzero value introduces artificial compressibility into the computation of the adjoint continuity equation. A value of 1.0 or less is reasonable.

Flow Rate Courant Scaling , Energy Equation Scaling

These values should be larger than zero (default values are 1). A smaller value implies a less aggressive algorithm that encourages stability of the AMG linear solver.

Under-Relaxation Factors
Adjoint Momentum , Adjoint Continuity , Adjoint Local Flow Rate , Adjoint Energy

Each of these can be set to a value between 0.0 to 1.0. A higher value leads to a more aggressive algorithm that is less likely to be stable. A value of 1.0 for each can be used for some simple cases without difficulty.

Algebraic Multigrid
Tolerance

The tolerance used for judging convergence.

Maximum Iterations

The maximum number of inner iterations of the AMG solver.

Show Iterations

If enabled, a more verbose iteration history is printed in the text console during iterations. The details of the inner iteration can be useful when deciding on appropriate Courant Number, Artificial Compressibility, and Flow Rate Courant Scaling. If many inner iterations are needed, or if the inner iterations diverge, this signals that a reduction in Courant Number may be needed. Alternatively, an increase in Artificial Compressibility or a reduction in the Flow Rate Courant Scaling may be sufficient for the AMG iterations to converge.

35.2.3.2.1. Stabilized Scheme Settings

If you choose to use one of the stabilization schemes (Adjoint Solver Stabilization) you will need to specify the scheme and settings in the Stabilized Scheme Settings dialog box (accessed by enabling Use Stabilized Scheme and clicking Settings... in the Adjoint Solution Controls dialog box).

The stabilization scheme settings are described in the following sections:

35.2.3.2.1.1. Modal Stabilization Scheme

The behavior of the modal scheme is as follows. As the calculation progresses the solution is monitored for unstable growing patterns or modes as the adjoint solution is corrected by the primary advancement algorithm. The first stage of the stabilization scheme involves a lightweight monitoring process to screen for any unstable patterns. If the calculation is progressing in a stable manner there is no indication even that the stabilization scheme is operating. If a candidate instability appears then it is monitored. In the event that unstable behavior that cannot be handled by the primary advancement scheme becomes evident a more intensive process is activated. Unstable patterns are refined using a fixed point iteration scheme so that they can be handled cleanly and advanced in a stable manner using an alternative to the primary advancement scheme.

The settings for the modal scheme are described below.

Figure 35.7:  Stabilized Scheme Settings for Modal Scheme

Stabilized Scheme Settings for Modal Scheme

Coherence Threshold

controls the preliminary screening for growth. It defines the threshold for relative variance of growth between iterations at which a more detailed search is activated. A smaller value will tend to delay the activation of the more detailed search for unstable growth at the risk of allowing unstable growth to continue for more iterations.

Max. Fixed Point Iterations

is the maximum number of iterations taken to refine the unstable pattern during the more detailed search.

Mode Purity Threshold

is the tolerance for an acceptable unstable pattern. A smaller value will lead to a more pure unstable mode being identified. This may occur at the expense of a larger number of fixed point iterations. If the purity threshold is not met after the maximum specified number of iterations then the unstable pattern is rejected.

Conjugate Pair Threshold

is the threshold for inclusion of a second unstable mode alongside a candidate mode, forming a conjugate pair. This corresponds to a pseudo-time-periodic instability, versus purely exponential growth. Such instabilities can occur in some cases. Increasing this value will increase the occurrence of a second mode being included.

Maximum Number of Cells

is the largest number of cells allowed for an unstable pattern that will be handled by the stabilization scheme. The problematic instabilities for an adjoint solver are often localized in space to a small number of cells out of the entire flow domain. However, there can be transiently growing corrections to the adjoint solution that masquerade as unstable patterns. This cell limit suppresses such false patterns from consideration.

Mode Norm Cutoff

serves to identify the main body of an unstable pattern and exclude the peripheral spatial parts of the mode that are of small amplitude. If the norm cutoff were set to zero, all unstable modes would involve all cells in the domain. Therefore, reducing this value increases the number of cells that are included in an unstable mode.

Regularization

acts to regularize the advancement of the unstable mode components. The stiffness of the adjoint governing equations can give rise to difficulty in discerning the unstable pattern from nearby stable patterns. Increasing the regularization tends to overcome this difficulty and adds stability to the calculation at the expense of potentially slower convergence. Valid values are between 0 and 1.

Print Mode Information

enables printing of stabilization information to the console.

When using the modal stabilization scheme, the following behavior can be observed:

  • When the primary advancement scheme is proceeding in a stable manner, the stabilization scheme will remain idle and no output will be generated.

  • When a candidate unstable pattern appears it will be tracked and a message will appear with information about the detected mode:

    Mode growth:    1.34390e+00  Coherence:    8.28546e-02

    In the above example, the message indicates that an unstable pattern that grows by more than 34% in one iteration is present. The value of the Coherence corresponds to the variance in growth between iterations.

  • When a candidate unstable pattern is identified that meets the coherence threshold, the secondary refinement stage is activated:

    Mode growth:    1.35752e+00  Coherence:    3.95870e-02
    Growing pattern cell count: 929
    Isolating new mode
    Iteration: 0  Growth rate:    1.42665e+00   Residual:    5.88196e-02
    Iteration: 1  Growth rate:    1.41329e+00   Residual:    1.34600e-02
    Iteration: 2  Growth rate:    1.41227e+00   Residual:    2.25348e-02
    New growing mode with 597 cells
    

    If the growing pattern cell count exceeds Maximum Number of Cells the refinement procedure is postponed. Likewise, if after refinement the number of cells involved exceeds the specified limit the mode is rejected. Each iteration corresponds to a refinement of the unstable pattern. The adjoint solution itself is not advanced during this process. The residual corresponds to the purity of the mode and must eventually fall below the Mode Purity Threshold for the mode to be accepted. A minimum of 3 iterations is taken so that the occurrence or absence of a conjugate pair can be verified.

  • The presence of the sometimes violent unstable growth that can occur gives a jagged appearance to the adjoint residual plots. However, the underlying trend of the residual plots should correspond to a converging adjoint solution process.

The unstable patterns of solution advancement are specific to the flow solution, choice of discretization schemes, and solution advancement controls for the adjoint solver. If any of these values changes, then the unstable modal patterns must be recomputed so that the stabilization scheme will function to full effect. In the event that any of these parameters is changed and the adjoint solution is restarted a mode recalibration process will be initiated. It should be noted that if there are many unstable modes that have been identified then this recalibration may take some time.

In contrast, the patterns of unstable growth are not specific to the observable that has been selected. Given that there is computational effort needed to identify the instabilities, a separate initialization process is available just for the unstable modal patterns. This allows the adjoint solution itself to be initialized for a new observable while retaining the knowledge of how to stabilize the solution advancement. A much smoother path to solution for the second and subsequent observables is then achieved.

35.2.3.2.1.2. Spatial Stabilization Scheme

The spatial scheme operates by identifying parts of the domain where unstable growth is occurring and applying a more stable scheme. The unstable mode tracking and handling is done in an automated manner. Several settings are exposed, but are recommended for expert users only. When the stabilized scheme is used and the Settings… button is selected, the following dialog box will appear (Figure 35.8: Stabilized Scheme Settings for Spatial Scheme):

Figure 35.8:  Stabilized Scheme Settings for Spatial Scheme

Stabilized Scheme Settings for Spatial Scheme

The four items on the left side of the dialog box relate to unstable mode tracking and selection, while the items on the right provide options for the response once a mode is identified. The values have the following meaning:

Tracking History Length

defines the number of iterations that are employed in the unstable mode identification process. A range between 2 and 5 may be chosen. The longer the tracking history, the better the quality of the identification process.

Resolution Threshold

defines a threshold for the separation between modes based on their amplitudes. A value of 0.1 implies that the second most-dominant mode must be 0.1 of the amplitude of the primary mode before an unstable mode can be considered as being adequately resolved.

Coherence Threshold

defines a threshold that must be met for the closeness of the mode to pure exponential growth as the iterations progress. A smaller number means that a tighter tolerance must be met before an unstable mode is considered as having been identified.

Growth Threshold

defines the growth rate threshold for unstable modes that must be met before the algorithm responds to the presence of the mode. The growth threshold defines the number of iterations that would have to take place for the mode to grow by one order of magnitude. That is, a value of 0.01 signifies that a mode that would grow one order of magnitude or more in 100 iterations will be handled. A negative value for this threshold is not recommended as multiple stable modes may be tracked.

Maximum Number of Cells

defines a limit on the number of cells for which stabilization will be applied when an unstable mode is located.

Mode Amplitude Cutoff

defines the fraction of the peak mode amplitude beyond which cells will be included for stabilization.

Solution Blending

defines an under-relaxation factor for blending the stabilized part of the scheme with the standard advancement scheme. A default of 0.1 is chosen. The value should lie between 0 and 1.

Print Mode Information

(when enabled) leads to details of the unstable mode tracking process being printed in the console window. The following is an example of what is printed when a mode is resolved partially:

Mode present> Growth :    2.38166e-01  Coherence  :    1.27858e+00
Resolution Threshold :    1.00000e-01  Resolution :    1.32611e-01

The following is an example of what is printed when a mode becomes more fully resolved:

	Mode present> Growth :    1.35318e-01  Coherence  :    2.84133e-04
	Resolution Threshold :    1.00000e-01  Resolution :    2.75312e-04
	Growth Threshold     :    5.60193e-02  Growth     :    1.35318e-01
	Coherence Threshold  :    1.00000e-02  Coherence  :    2.84133e-04
	Local stabilization required: Instability detected in 5 cells

The final line only appears when a coherent and resolved instability has been identified successfully. Subsequently, the solution advancement algorithm automatically adjusts to eliminate this unstable behavior.

Print Local Solve Residuals

(when enabled) leads to details of the residuals for the local solution process being printed in the console window. An example of what is printed is given below:

Iter   Adjoint-continuity  Adjoint-xMom     Adjoint-yMom      Adjoint-Flowrate
	....
  27       1.76334e-03      1.57503e-01      1.26984e-01        2.92618e-01
Local (%)     61.02095         57.41937         62.09185           99.99136

The percentage residual indicates the fraction of the total residual that is associated with the local solution process.

Default

provides a set of default values for the various fields in the dialog box.

35.2.3.2.1.3. Dissipation Scheme

The dissipation scheme operates by introducing nonlinear damping strategically into the calculation domain. The strategy is intended to provide minimal intervention in order to damp the growth of instabilities that lead to adjoint solution divergence. A marker is tracked, based on the state of the adjoint solution, and the damping is applied directly to the adjoint solution in regions where the marker becomes large.

Figure 35.9:  Stabilized Scheme Settings for Dissipation Scheme

Stabilized Scheme Settings for Dissipation Scheme

The following parameters can be set:

Damping Factor

The overall level of dissipation is proportional to this value although the damping level is determined ultimately through a nonlinear process.

Damping Relaxation

The damping relaxation can be used to control the rate at which the dissipation is updated as the adjoint solution progresses. As you decrease the value from 1, the rate at which the dissipation is updated is decreased.

Damping Order

The spatial order of the dissipation. A higher order leads to more intense and localized damping. This can typically be set to be one order larger than the adjoint calculation spatial order.

Suppression

As part of the dissipation scheme, the growth of instabilities is stopped by the effect of the dissipation; enabling the Suppression option ensures that these undesirable patterns will then also decay as the calculation progresses.

Since the order of discretization of the dissipation scheme is usually set higher than the adjoint, the formal order of accuracy of the adjoint solution is unaffected by the addition of dissipation. However, regions of intense dissipation can appear for some cases when using this scheme. This can sometimes appear as isolated spots and streaks in the adjoint solution on surfaces. The scale of these features is such that they are often easily smoothed during postprocessing to generated design changes.

35.2.3.3. Working with Adjoint Residual Monitors

The progress of the iterations of the adjoint solver and the monitoring of the convergence is controlled in the Adjoint Residual Monitors dialog box. This dialog box is accessed by clicking Monitors... in the Design ribbon tab (Adjoint-Based group box).

 Design → Adjoint-Based → Monitors...

Figure 35.10:  Adjoint Residual Monitors Dialog Box

Adjoint Residual Monitors Dialog Box

The steps to define the monitor behavior are as follows:

  1. Decide whether or not the residuals are to be printed in the console by setting the Print to Console check box as desired.

  2. Decide whether or not the residuals are to be plotted in the main window by setting the Plot check box as desired.

  3. Set the id of the window in which the adjoint residuals are to appear in the Window field.

  4. Set how many iterations are to be shown in the residual curves that are plotted in the Iterations to Plot field.

  5. Enable and/or disable those values that are to be used as criteria for convergence, and set the Criteria in each case. The options are to test the residuals for the Adjoint continuity and/or Adjoint velocity and/or Adjoint local flow rate equations.

Click the OK or Apply buttons to confirm that the settings are acceptable. Clicking Plot will cause existing adjoint residuals to be plotted in the main graphics window.

35.2.3.4. Running the Adjoint Calculation

Initialization and execution of the adjoint solver is accomplished in the Run Adjoint Calculation dialog box. This dialog box is accessed by clicking Calculate... in the Design ribbon tab (Adjoint-Based group box).

 Design → Adjoint-Based → Calculate...

Figure 35.11:  Run Adjoint Calculation Dialog Box

Run Adjoint Calculation Dialog Box

The function of this dialog box is as follows:

Initialize

sets the value of the adjoint velocity and pressure to zero everywhere in the problem domain.

Initialize Stabilization

clears all of the unstable modes that have been identified in calculations using the modal stabilization scheme, but leaves the adjoint solution unchanged. Only available when Modal is selected in the Stabilized Scheme Settings dialog box.

Calculate

advances the adjoint solver by the Number of Iterations specified in the adjacent field.

Depending on the monitor settings, the residuals may be printed in the console and/or plotted in the main graphics window.


Release 18.2 - © ANSYS, Inc. All rights reserved.