mdolab / mdolab/adflow

Complex step residuals will underflow with small complex step sizes

Open
#131 1 comment 1 reaction 2 assignees View on GitHub

@anilyil is already working on this.

Since Mar 11, 2021.

Dominant language
Fortran
Stars
332
Forks
124
PR merge metrics
No merged PRs in 30d

Description

Description

The PR #130 makes several changes to the adflow behavior in complex mode. One of these is how the complex residuals are reported. We now report the real and complex residuals separately, and use the L2 norm for both. As a result, the complex part of the residual is squared for each cell, summed up over all cells, and then we take the square root.

Recently, @joanibal realized that we could use complex step sizes of around 1e-200 to eliminate any complex-step related errors in the real part of the solution. With this method, the error terms drop out due to underflow. However, as a side effect, the L2 norm computation of the complex residuals will also underflow with a step size of this magnitude.

This issue is purely with how the residuals are reported. The complex code will still work and generate the correct derivatives. However, the complex residuals will be exactly zero for these step sizes for all iterations, which make convergence monitoring difficult.

In a separate PR, we should have a few fixes on this:

  1. Update all complex-step values to 1e-200 in the tests we already have.
  2. Modify the residual norm computation so that the complex residual does not underflow with this value. We can have a reference complex-step multiplier in the code to scale the values before and after the L2 norm computation to avoid this. Or we can just use a 1-norm for the complex residual.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.