CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Discrete Adjoint derivative computation - help understanding Finite Difference (https://www.cfd-online.com/Forums/main/237499-discrete-adjoint-derivative-computation-help-understanding-finite-difference.html)

topheruk29 July 21, 2021 06:54

Discrete Adjoint derivative computation - help understanding Finite Difference
 
I am looking for some guidance on the implementation of the Discrete Adjoint method, specifically the computation of the partial derivatives via Finite Differencing.

source(s):
DAFoam: An Open-Source Adjoint Framework for Multidisciplinary Design Optimization with OpenFOAM
https://arc.aiaa.org/doi/10.2514/1.J058853

The first major step in solving the Discrete Adjoint is computing the partial derivatives of the vector of flow residuals (\textbf{R}) with respect to the vector state variables (\textbf{w}). This is possible via Finite Difference:

Set \textbf{w}=[u,v,w,p,\nu,\phi] and \textbf{R}=[R_u,R_v,R_w,R_p,R_\nu,R_\phi],

\left(\frac{\partial\textbf{R}}{\partial\textbf{w}}\right)_{ij}=\frac{R_i(\textbf{w}+\epsilon\textbf{e}_{j})-R_i(\textbf{w})}{\epsilon}

where the subscripts i and j are the row and column indices, respectively, \epsilon is the step size, and \textbf{e}_j is a unit vector with unity in row j. As I understand it, this involves sequentially perturbing each element of the state variable vector in a reference cell and recomputing the residual vector. This should produce a n_{\textbf{w}}\times n_{\textbf{w}} matrix, with n_{\textbf{w}} calls to residual function (equal to the number of columns). Is this correct?

In the DAFoam implementation, a graph-colouring method is used to accelerate the computation of the partial derivatives via Finite Difference. This works by exploiting the sparsity of a Jacobian matrix to simultaneously perturb sets of columns that influence independent rows. An example is given for a 5\times 5 diagonal Jacobian matrix but I am not sure what step this relates to in the context of computing the partial derivates for \frac{\partial\textbf{R}}{\partial\textbf{w}}, particularly for a 3D problem.

Assumptions:
1. For an unperturbed and converged flow solution, each cell contains a 1\times n_{\textbf{w}} vector of flow variables and a 1\times n_{\textbf{w}} vector of residuals.


Questions:
1. when the source(s) discusses graph-colouring, what matrix are they referring to? Is the n_{\textbf{w}}\times n_{\textbf{w}} Jacobian of \frac{\partial\textbf{R}}{\partial\textbf{w}} in each cell?
2. when perturbing a flow variable e.g. the u-component of velocity, is \epsilon added to the reference value in a specific cell only, or does this perturbation affect the reference values in neighbouring cells?
3. how does perturbing a flow variable in a cell influence other rows in the matrix?

Appreciate any input,

Chris


All times are GMT -4. The time now is 00:12.