35.2.1. Model Considerations for Using Adjoint Solver

The current adjoint solver implementation provides basic adjoint solutions that accompany a conventionally-computed flow solution provided certain criteria are met.

35.2.1.1. Basic Assumptions and Consistency Checks

The adjoint solver is implemented on the following basis:

  • The flow state is for a steady single-phase flow, or ideal gas, that is either laminar or turbulent.

  • For turbulent flows, a frozen turbulence assumption is made, in which the effect of changes to the state of the turbulence is not taken into account when computing sensitivities.

  • For turbulent flows, the k-ε and k-ω models are supported.

  • For moving (that is, non-inertial) reference frame problems, the single reference frame (SRF) and multiple reference frame (MRF) approaches are supported (as long as the absolute velocity formulation is used), while the mixing plane model (MPM) is not. Note that for the MRF approach, the adjoint solver does not support having a zone with a frame of motion that is relative to an already moving reference frame.

  • Solid zones are supported, as long as they do not use a moving reference frame approach.

  • The adjoint solver uses methods that are first order accurate in space by default. If desired, you can select second order accurate methods (see Using the Adjoint Solution Methods Dialog Box).

  • The boundary conditions are only of the following types:

    • Wall (not including thin walls or shells)

    • Velocity inlet

    • Mass-flow inlet

    • Pressure inlet

    • Pressure outlet

    • Symmetry

    • Rotational and translation periodic

  • Constant and user-defined sources are supported for the momentum and energy equations; for details on the latter, see User-Defined Sources. Note that temperature dependency is not taken into account with the adjoint solver.

It is important to note that these requirements are not strict conditions for the conventional flow solver, but rather modeling limitations for the adjoint solver.

When the adjoint solver is initialized or an observable is evaluated, and before iterations are performed, a series of checks is performed to determine the suitability of the existing flow solution for analysis with the adjoint solver. Two types of message may appear:

  • Warning message: There are certain physics models and boundary condition types that are not explicitly modeled in the adjoint solver, but their absence does not disallow you from proceeding with the calculation. In this case, a warning message will be printed that explains the nature of the inconsistency.

    Checking adjoint setup...
     -- Warning: Model is active but not included in adjoint calculation: P1 radiation model Done
    

    The adjoint solver will still run in this case but the quality of the adjoint solution data can be expected to be poorer as a result of the inconsistency. This is because in such cases the unsupported settings will revert to corresponding supported settings for the adjoint solver. Though the calculation will proceed, it is important to note that the results produced should be considered on this basis. When reverting back to the fluid calculation, the original settings will be preserved and the modified settings are not migrated onto the original case. The warning indicates that the setting change will be made automatically and specifically for the adjoint solution.

  • Error message: There are some model and boundary conditions that are incompatible with the computation of an adjoint solution with the current adjoint solver implementation. In this case, an explanatory error message will be printed in the console window.

    Checking adjoint setup...
     ** Unable to proceed: Model is active but not compatible with adjoint calculation:
      Transition SST turbulence model 
    Done 
    

    The adjoint solver will not run in this case and changes must be made manually to the settings identified in the console before the solver can be run.

35.2.1.2. User-Defined Sources

User-defined sources for the momentum and/or energy equations that are defined in compiled UDFs can be accounted for in the application of the adjoint solver, provided that the source derivatives with respect to flow variables and cell centroid coordinates are provided. This is achieved by creating the source term UDF definition in the usual fashion, with the exception that a special UDF macro is used, DEFINE_SOURCE_AE (The suffix _AE denotes Adjoint Enabled).

DEFINE_SOURCE_AE (name, c, t, dS, eqn)

Argument Type

Description

symbol name

UDF name

cell_t c

Index that identifies cell on which the source term is to be applied

Thread *t

Pointer to cell thread

real dS[]

Array that contains the derivative of the source term with respect to the dependent variable of the transport equation, as well as the flow variables and cell centroid position

int eqn

Equation number

Function returns

real

Consider a source that may depend on velocity, pressure, and cell-centroid coordinates:

where , , and are the Cartesian velocity components in the cell, is the pressure in the cell, and are the cell centroid coordinates as defined by the C_CENTROID macro. If the source strength depends on one or more of these quantities, then the derivatives of the source strength with respect to those variables must be computed and filled in as entries to the dS[] array. In particular,

must be defined in the UDF if there is a dependency of the source upon them. The specification of this derivative information is essential for sensitivities, including shape sensitivity, to be computed correctly by the adjoint solver.


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