chalmersplasmatheory/DREAM

Numerical Porblems in NumericBRadialGridGenerator.cpp and SPIHandler.cpp

Closed this issue · 0 comments

Disclaimer: the following numerical problems show up when running DREAM in DEBUG MODE only

NumericBRadialGridGenerator

The problem was found in line 184 :

this->Z = this->addR0DataPoint(this->Z, this->R, this->npsi, this->ntheta, 0);

which shows how the function addR0DataPoint is used within a class method to update the member variable Z. It extends Z by adding a new data point at r=0 for each theta slice, with the value 0 used for these new points (since c is passed as 0, it doesn't check for NaN in this specific call). In the previous version, the last function argument (which is 0) was not specified, which leads to error.

SPIHandler

The problem was found in in line 502 :

timeAveragedDeltaSource[ir*nShard+ip]+=1.0/(rGrid->GetVpVol(ir)*VpVolNormFactor*(rSourceMax-rSourceMin))*(min(rGrid->GetR_f(ir+1),rSourceMax)-max(rGrid->GetR_f(ir),rSourceMin))/rGrid->GetDr(ir);

where rSourceMax and rSourceMin can be the same number, giving as a result a division by ZERO which should be avoided.