subroutine from_sol_to_temp_strand(me,sim)
type(strand_t), intent(inout) :: me
type(simulation_t), intent(in) :: sim
integer :: jj
real(dp) :: B,St,Tc,Tc0,Bc,Bc0,Jc0,Jop,TcS
me%err = 0_dp
me%err_den = 0_dp
do jj=1,me%SC_Prop%NbCells
me%StVar%SCtemp(jj)=me%StVar%SCtemp(jj)+me%big%bvS(jj) ! update of strand temperature by the solution
B = me%scen%Bfield(jj)
St = me%mat_supc%strain(B,me%scen%ElCur)
TC = me%mat_supc%critical_temperature(B,St)
Tc0 = me%mat_supc%critical_temperature(0.0_dp,St)
Bc = me%mat_supc%critical_field(me%StVar%SCtemp(jj),St)
Bc0 = me%mat_supc%critical_field(0.0_dp,St)
Jc0 = me%mat_supc%critical_current_density(0.0_dp,B,St,Tc0,Bc)
Jop = abs(me%scen%ElCur)/me%ct(SUPC)%area
TcS=me%mat_supc%current_sharing_temperature(B,St,Jop,Bc0,Jc0,Tc,Tc0,Bc)
! Write to HDF5
me%hdf%data(jj,1) = me%StVar%SCtemp(jj)
me%hdf%data(jj,2) = me%scen%Bfield(jj)
me%hdf%data(jj,3) = St
me%hdf%data(jj,4) = TcS
me%hdf%data(jj,5) = TcS-me%StVar%SCtemp(jj)
! For step management
if(.not. sim%explicit) then
me%err = me%err + ( (1.0_dp/6.0_dp) * (sim%dtPrev1+sim%dt) * ( &
(me%StVar %SCtemp(jj)-me%StVarOld %SCtemp(jj)) / sim%dt - &
(me%StVarOld %SCtemp(jj)-me%StVarOld2%SCtemp(jj)) * (sim%dt+sim%dtPrev1) / sim%dtPrev1**2 + &
(me%StVarOld2%SCtemp(jj)-me%StVarOld3%SCtemp(jj)) * sim%dt/sim%dtPrev1 / sim%dtPrev2 ))**2
me%err_den = me%err_den + (me%StVarOld%SCtemp(jj))**2
endif
enddo
end subroutine from_sol_to_temp_strand