Your outer loop contains the statement
The second time you execute the outer loop, the statement
will therefore be equivalent to
and since sol was also assigned in the first loop iteration, then rhs(sol)(0) will evaluate, and return 1.0, so that this is equivalent to
which is of course meaningless as boundary condition.
'Minimal change' fix is probably to add the statement
immediately prior to the 'end do' statement of the outer loop. Loop will now execute - does for me anyway.
NB Suggest you change the semicolons on the 'end do' statements to colons - otherwise you are going to generate an awful lot of verbiage you don't really need
Answers I obtained for F, F1, S, S1, T, T1 are 247, 500, 271, 500, 1322, 4000 respectively. Obviously I have no idea whether these are correct (or what you expect), since I have not reallly anysed what you are trying to achieve