src/coreprofiles.f90: exit on density fit errors

This commit is contained in:
Michele Guerini Rocco 2023-04-19 14:31:05 +02:00
parent b1accf0ae3
commit 78d8bdbb33
Signed by: rnhmjoj
GPG Key ID: BFBAF4C975F76450

View File

@ -371,12 +371,16 @@ contains
call dens_spline%init(data%psrad, data%derad, n, range=[zero, data%psrad(n)], &
tension=params%sspld, err=err)
! if failed, re-fit with an interpolating spline (zero tension)
! Tension is very small, re-fit with an interpolating spline
if (err == -1) then
call log_warning('density fit failed with error -1: re-fitting with '// &
'zero tension', mod='coreprofiles', proc='density')
call log_warning('re-fitting with density curve with zero tension', &
mod='coreprofiles', proc='density')
call dens_spline%init(data%psrad, data%derad, n, &
range=[zero, data%psrad(n)], tension=zero)
else if (err > 0) then
write (msg, '(a, g0)') 'density fit failed with error ', err
call log_error(msg, mod='coreprofiles', proc='density')
call exit(1)
end if
! Computation of the polynomial tail parameters