subroutine TD_ForceUpD(i,TD_SemiMudVisc)
    
   Use TD_DrillStemComponents
   use SimulationVariables !@
   use SimulationVariables !@
   use SimulationVariables !@
   use SimulationVariables
   
   
   implicit none
   
    Integer :: i
    Real(8) :: TD_SemiMudVisc
    
    
    If (i==1) then
       data%State%TD_DrillStems(1)%Force1 = -data%State%TD_String%WeightOnBit
       data%State%TD_DrillStems(i)%Force2 = (data%State%TD_DrillStems(i)%Force1 * exp((TD_SemiMudVisc*data%State%TD_DrillStems(i)%MudVisCorrectCoef)*(data%State%TD_DrillStems(i)%EndAngle-data%State%TD_DrillStems(i)%StartAngle))) + &
                            (((data%State%TD_DrillStems(i)%WeightperLength * data%State%TD_DrillStems(i)%RCurvature) / (1 + (TD_SemiMudVisc*data%State%TD_DrillStems(i)%MudVisCorrectCoef)**2)) * &
                            (((1-(TD_SemiMudVisc*data%State%TD_DrillStems(i)%MudVisCorrectCoef)**2)*(sin(data%State%TD_DrillStems(i)%EndAngle) - &
                            (exp((TD_SemiMudVisc*data%State%TD_DrillStems(i)%MudVisCorrectCoef)*(data%State%TD_DrillStems(i)%EndAngle-data%State%TD_DrillStems(i)%StartAngle)) * sin(data%State%TD_DrillStems(i)%StartAngle))))) - &
                            (2.0d0* (TD_SemiMudVisc*data%State%TD_DrillStems(i)%MudVisCorrectCoef)*(cos(data%State%TD_DrillStems(i)%EndAngle) - &
                            (exp((TD_SemiMudVisc*data%State%TD_DrillStems(i)%MudVisCorrectCoef)*(data%State%TD_DrillStems(i)%EndAngle-data%State%TD_DrillStems(i)%StartAngle))* &
                            cos(data%State%TD_DrillStems(i)%StartAngle)))))
       
       
       if (data%State%TD_DrillStems(i)%ComponentType==0) then
           data%State%TD_DrillStems(i)%Torque = data%State%TD_String%BitTorque
       else
           data%State%TD_DrillStems(i)%Torque = (data%State%TD_DrillStems(i)%MudViscosity * data%State%TD_DrillStems(i)%RtoolJoint * (data%State%TD_DrillStems(i)%Force1 + (data%State%TD_DrillStems(i)%WeightperLength * &
                            data%State%TD_DrillStems(i)%RCurvature * sin(data%State%TD_DrillStems(i)%StartAngle))) * &
                            (data%State%TD_DrillStems(i)%EndAngle-data%State%TD_DrillStems(i)%StartAngle)) - &
                            (2.0d0 * data%State%TD_DrillStems(i)%MudViscosity * data%State%TD_DrillStems(i)%RtoolJoint * &
                            data%State%TD_DrillStems(i)%WeightperLength * data%State%TD_DrillStems(i)%RCurvature * &
                            (cos(data%State%TD_DrillStems(i)%EndAngle) - cos(data%State%TD_DrillStems(i)%StartAngle)))
       end if
       
       
       
       return
    End If
    
    
    
!=========> F1 Calculation
   data%State%TD_DrillStems(i)%Force1 = data%State%TD_DrillStems(i-1)%Force2
   
    
!=========> F2 Calculation
    data%State%TD_DrillStems(i)%Force2 = (data%State%TD_DrillStems(i)%Force1 * exp((TD_SemiMudVisc*data%State%TD_DrillStems(i)%MudVisCorrectCoef)*(data%State%TD_DrillStems(i)%EndAngle-data%State%TD_DrillStems(i)%StartAngle))) + &
                            (((data%State%TD_DrillStems(i)%WeightperLength * data%State%TD_DrillStems(i)%RCurvature) / (1 + (TD_SemiMudVisc*data%State%TD_DrillStems(i)%MudVisCorrectCoef)**2)) * &
                            (((1-(TD_SemiMudVisc*data%State%TD_DrillStems(i)%MudVisCorrectCoef)**2)*(sin(data%State%TD_DrillStems(i)%EndAngle) - &
                            (exp((TD_SemiMudVisc*data%State%TD_DrillStems(i)%MudVisCorrectCoef)*(data%State%TD_DrillStems(i)%EndAngle-data%State%TD_DrillStems(i)%StartAngle)) * sin(data%State%TD_DrillStems(i)%StartAngle))))) - &
                            (2.0d0* (TD_SemiMudVisc*data%State%TD_DrillStems(i)%MudVisCorrectCoef)*(cos(data%State%TD_DrillStems(i)%EndAngle) - &
                            (exp((TD_SemiMudVisc*data%State%TD_DrillStems(i)%MudVisCorrectCoef)*(data%State%TD_DrillStems(i)%EndAngle-data%State%TD_DrillStems(i)%StartAngle))* &
                            cos(data%State%TD_DrillStems(i)%StartAngle)))))
        
        !Strains(i)%Dl = TDForces(i)%Force * (Elements(i)%Length) / &
        !                     (Elements(i)%Area * Element%ElasticModule)
        !
        data%State%TD_DrillStems(i)%Torque = (data%State%TD_DrillStems(i)%MudViscosity * data%State%TD_DrillStems(i)%RtoolJoint * (data%State%TD_DrillStems(i)%Force1 + (data%State%TD_DrillStems(i)%WeightperLength * &
                            data%State%TD_DrillStems(i)%RCurvature * sin(data%State%TD_DrillStems(i)%StartAngle))) * &
                            (data%State%TD_DrillStems(i)%EndAngle-data%State%TD_DrillStems(i)%StartAngle)) - &
                            (2.0d0 * data%State%TD_DrillStems(i)%MudViscosity * data%State%TD_DrillStems(i)%RtoolJoint * &
                            data%State%TD_DrillStems(i)%WeightperLength * data%State%TD_DrillStems(i)%RCurvature * &
                            (cos(data%State%TD_DrillStems(i)%EndAngle) - cos(data%State%TD_DrillStems(i)%StartAngle)))
    !return
    
end subroutine