epfl-ecps / channelflow

Channelflow is a software system for numerical analysis of the incompressible fluid flow in channel geometries, written in C++ and MPI-parallelized.
GNU General Public License v2.0
65 stars 29 forks source link

ChebyCoeff::slope_a() type error leads to incorrect result #29

Open jakelangham opened 2 years ago

jakelangham commented 2 years ago

ChebyCoeff::slope_a() for nontrivial profiles typically returns extremely high values - at least for my build environment (gcc 6.4.0).

This is because the loop index n is given as auto, becoming an unsigned int, but its negation is required in the computation leading to an overflow.

I wonder if some compilers behave differently leading to this not being picked up before.

Anyway, this can be fixed quickly by using an int instead, as in ChebyCoeff::slope_b().