Skip to content

Jacobian not recorded correctly in AD preaccumulation region #2368

@joshkellyjak

Description

@joshkellyjak

Describe the bug

You will have to bear with me, I might get some of this wrong, I am not entirely sure what is going on here so I will try and include as much information as possible. Using the tape tagging method developed by @oleburghardt in #2343 and presented at the most recent SU2 Conference, a run of the full tape reveals that a variable used in a preaccumulation output is not properly recorded. The variable is the val in the function PassiveAssign in CSysMatrix.hpp line 215.

FORCEINLINE static ScalarType PassiveAssign(const SrcType& val) { return SU2_TYPE::GetValue(val); }

Following the call stack of the error reveals that the problem variables in val are the jacobian components calculated in the Roe and JST scheme (these are the two options I have tested). It is possible to resolve this error by simply moving the stopping of the preaccumulation region from before the call to updateLinearSystem in the ComputeFlux method of both these schemes, to after, as show below.

`/--- Update the vector and system matrix. ---/

updateLinearSystem(iEdge, iPoint, jPoint, implicit, updateType,
                   updateMask, flux, jac_i, jac_j, vector, matrix);

/*--- Stop preaccumulation. ---*/

stopPreacc(flux);`

However, whilst this resolve the error in this location, the next error appears in the Giles boundary condition. Here the two jacobian components within the residual object are not recorded correctly in the preaccumulation output region also. This in CEulerSolver.cpp:6556.

`/--- Compute the residual using an upwind scheme ---/
auto residual = conv_numerics->ComputeResidual(config);

  /*--- Update residual value ---*/
  LinSysRes.AddBlock(iPoint, residual);`

I have tried simpy adding these components as preacc outputs however they are SIMD arrays and the datatype cannot be converted using the existing implementation.

I am not sure what is going on here, or the next steps to resolve this problem. Any further assistance would be greatly appreciated, thank you :)

Bug report checklist
Please make sure that you have followed the checklist below, many common problems can be solved by:

Desktop (please complete the following information):

  • OS: [MacOS Sonoma 14.6.1]
  • C++ compiler and version: [clang 14.0.3 "Apple clang version 14.0.3 (clang-1403.0.22.14.1)]
  • MPI implementation and version: [OpenMPI 5.0.3]
  • SU2 Version: [v8.0.1]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions