Hello,
A first analysis shows that the subroutine layer.f is a priori not guilty and is given misleading data. Actually in subroutine bedload_evol.f I see that an available layer of sediment is about 4.98 m, this is in array ELAY%R(628) for example. Then in layer.f only an active layer ELAY0 equal to 0.2 m is considered, and this causes a negative fraction. layer.f finds that we are in case 4 (only one layer eroded) whereas the value of ZFCL_W shows that we have eroded more than one layer, this is due of course to the wrong layer 4.98 m that is initially considered for erosion.
I would hint that there is a misunderstanding somewhere in the data, or a bug, for me ELAY should be, as it appears in bedload_evol, less than ELAY0. However if the data are wrong we should be able to check it and stop the program.
I have now to discuss the matter with my colleagues, so you will have probably to wait for next Thursday to have more details.
With best regards,
Jean-Michel Hervouet