Browse Source

Warnings DS added

najafi
mahmood19227 1 year ago
parent
commit
5258fea44b
62 changed files with 406 additions and 6124 deletions
  1. +147
    -145
      CSharp/Warnings/CWarningsVariables.f90
  2. +43
    -1
      Data Structures.txt
  3. +120
    -186
      Equipments/ChokeControl/AirPump_Choke_Subs.f90
  4. +78
    -135
      Equipments/ChokeControl/CHOKE.f90
  5. +2
    -2
      Equipments/Drawworks/Drawworks_INPUTS.f90
  6. +1
    -1
      Equipments/MudSystem/Kick_Influx.f90
  7. +3
    -3
      Equipments/Pumps/Pumps_Inputs.f90
  8. BIN
     
  9. +0
    -515
      Equipments/TorqueDrag/TD_DrillingSubs/MeshGeneration_FluidModule.f90
  10. +0
    -314
      Equipments/TorqueDrag/TD_DrillingSubs/TD_AddComponents.f90
  11. +0
    -180
      Equipments/TorqueDrag/TD_DrillingSubs/TD_BOPDiamCalculation.f90
  12. +0
    -318
      Equipments/TorqueDrag/TD_DrillingSubs/TD_DrillStemConfiguration.f90
  13. +0
    -359
      Equipments/TorqueDrag/TD_DrillingSubs/TD_RemoveComponents.f90
  14. +0
    -830
      Equipments/TorqueDrag/TD_DrillingSubs/TD_StringConnectionModes.f90
  15. +0
    -28
      Equipments/TorqueDrag/TD_DrillingSubs/TD_WellElementsConfiguration.f90
  16. +0
    -51
      Equipments/TorqueDrag/TD_DrillingSubs/TD_WellGeoConfiguration.f90
  17. +0
    -78
      Equipments/TorqueDrag/TD_DrillingSubs/TVD_Calculator.f90
  18. +0
    -32
      Equipments/TorqueDrag/TD_Forces/TD_BouyancyFactor.f90
  19. +0
    -65
      Equipments/TorqueDrag/TD_Forces/TD_BuildArea/TD_ForceDownB.f90
  20. +0
    -56
      Equipments/TorqueDrag/TD_Forces/TD_BuildArea/TD_ForceDownBRot.f90
  21. +0
    -75
      Equipments/TorqueDrag/TD_Forces/TD_BuildArea/TD_ForceUpB.f90
  22. +0
    -56
      Equipments/TorqueDrag/TD_Forces/TD_BuildArea/TD_ForceUpBRot.f90
  23. +0
    -21
      Equipments/TorqueDrag/TD_Forces/TD_CombinedMotionData.f90
  24. +0
    -61
      Equipments/TorqueDrag/TD_Forces/TD_DropArea/TD_ForceDownD.f90
  25. +0
    -56
      Equipments/TorqueDrag/TD_Forces/TD_DropArea/TD_ForceDownDRot.f90
  26. +0
    -68
      Equipments/TorqueDrag/TD_Forces/TD_DropArea/TD_ForceUpD.f90
  27. +0
    -55
      Equipments/TorqueDrag/TD_Forces/TD_DropArea/TD_ForceUpDRot.f90
  28. +0
    -138
      Equipments/TorqueDrag/TD_Forces/TD_ForceCalculation.f90
  29. +0
    -286
      Equipments/TorqueDrag/TD_Forces/TD_HookLoadCalculation.f90
  30. +0
    -71
      Equipments/TorqueDrag/TD_Forces/TD_StaticHookLoadCalculation.f90
  31. +0
    -64
      Equipments/TorqueDrag/TD_Forces/TD_StraightArea/TD_ForceDownS.f90
  32. +0
    -60
      Equipments/TorqueDrag/TD_Forces/TD_StraightArea/TD_ForceDownSRot.f90
  33. +0
    -65
      Equipments/TorqueDrag/TD_Forces/TD_StraightArea/TD_ForceUpS.f90
  34. +0
    -59
      Equipments/TorqueDrag/TD_Forces/TD_StraightArea/TD_ForceUpSRot.f90
  35. +0
    -54
      Equipments/TorqueDrag/TD_Forces/TD_StrainCalculation.f90
  36. +0
    -42
      Equipments/TorqueDrag/TD_Forces/TD_TorqueCalculation.f90
  37. +0
    -176
      Equipments/TorqueDrag/TD_Forces/TD_ViscousDragForce/TD_ViscousDragForce.f90
  38. +0
    -40
      Equipments/TorqueDrag/TD_Forces/TD_WeightOnBitCalculation.f90
  39. +0
    -120
      Equipments/TorqueDrag/TD_MainCalculations.f90
  40. +0
    -67
      Equipments/TorqueDrag/TD_Modules/GeoElements_FluidModule.f90
  41. +0
    -122
      Equipments/TorqueDrag/TD_Modules/TD_DrillStem.f90
  42. +0
    -53
      Equipments/TorqueDrag/TD_Modules/TD_GeneralData.f90
  43. +0
    -45
      Equipments/TorqueDrag/TD_Modules/TD_StringConnectionData.f90
  44. +0
    -73
      Equipments/TorqueDrag/TD_Modules/TD_WellElements.f90
  45. +0
    -35
      Equipments/TorqueDrag/TD_Modules/TD_WellGeometry.f90
  46. BIN
     
  47. +0
    -145
      Equipments/TorqueDrag/TD_ReadDataSubroutines/TD_DrillStemReadData.f90
  48. +0
    -61
      Equipments/TorqueDrag/TD_ReadDataSubroutines/TD_ForceReadData.f90
  49. +0
    -96
      Equipments/TorqueDrag/TD_ReadDataSubroutines/TD_MudPropertiesReadData.f90
  50. +0
    -26
      Equipments/TorqueDrag/TD_ReadDataSubroutines/TD_PipePropertiesReadData.f90
  51. +0
    -132
      Equipments/TorqueDrag/TD_ReadDataSubroutines/TD_WellElementsReadData.f90
  52. +0
    -111
      Equipments/TorqueDrag/TD_ReadDataSubroutines/TD_WellReadData.f90
  53. +0
    -81
      Equipments/TorqueDrag/TD_StartUp/TD_DrillStemStartUp.f90
  54. +0
    -156
      Equipments/TorqueDrag/TD_StartUp/TD_StartUp.f90
  55. +0
    -46
      Equipments/TorqueDrag/TorqueDragMain.f90
  56. +0
    -0
     
  57. BIN
     
  58. +11
    -3
      Simulator.f90
  59. +1
    -1
      TorqueDrag/TD_DrillingSubs/TD_WellGeoConfiguration.f90
  60. +0
    -5
      TorqueDrag/TD_Modules/TD_DrillStem.f90
  61. BIN
     
  62. BIN
     

+ 147
- 145
CSharp/Warnings/CWarningsVariables.f90 View File

@@ -3,198 +3,200 @@ module CWarningsVariables
implicit none
public
logical :: PumpWithKellyDisconnected
logical :: PumpWithTopdriveDisconnected
logical :: Pump1PopOffValveBlown
logical :: Pump1Failure
logical :: Pump2PopOffValveBlown
logical :: Pump2Failure
logical :: Pump3PopOffValveBlown
logical :: Pump3Failure
logical :: DrawworksGearsAbuse
logical :: RotaryGearsAbuse
logical :: HoistLineBreak
logical :: PartedDrillString
logical :: ActiveTankOverflow
logical :: ActiveTankUnderVolume
logical :: TripTankOverflow
logical :: DrillPipeTwistOff
logical :: DrillPipeParted
logical :: TripWithSlipsSet
logical :: Blowout
logical :: UndergroundBlowout
logical :: MaximumWellDepthExceeded
logical :: CrownCollision
logical :: FloorCollision
logical :: TopdriveRotaryTableConfilict
type:: WarmingsType
logical :: PumpWithKellyDisconnected
logical :: PumpWithTopdriveDisconnected
logical :: Pump1PopOffValveBlown
logical :: Pump1Failure
logical :: Pump2PopOffValveBlown
logical :: Pump2Failure
logical :: Pump3PopOffValveBlown
logical :: Pump3Failure
logical :: DrawworksGearsAbuse
logical :: RotaryGearsAbuse
logical :: HoistLineBreak
logical :: PartedDrillString
logical :: ActiveTankOverflow
logical :: ActiveTankUnderVolume
logical :: TripTankOverflow
logical :: DrillPipeTwistOff
logical :: DrillPipeParted
logical :: TripWithSlipsSet
logical :: Blowout
logical :: UndergroundBlowout
logical :: MaximumWellDepthExceeded
logical :: CrownCollision
logical :: FloorCollision
logical :: TopdriveRotaryTableConfilict
end type WarmingsType
type(WarmingsType)::Warmings
contains
subroutine Activate_PumpWithKellyDisconnected()
implicit none
if(PumpWithKellyDisconnected) return
PumpWithKellyDisconnected = .true.
if(Warmings%PumpWithKellyDisconnected) return
Warmings%PumpWithKellyDisconnected = .true.
call RunPumpWithKellyDisconnected()
end subroutine
subroutine Activate_PumpWithTopdriveDisconnected()
implicit none
if(PumpWithTopdriveDisconnected) return
PumpWithTopdriveDisconnected = .true.
if(Warmings%PumpWithTopdriveDisconnected) return
Warmings%PumpWithTopdriveDisconnected = .true.
call RunPumpWithTopdriveDisconnected()
end subroutine
subroutine Activate_Pump1PopOffValveBlown()
implicit none
if(Pump1PopOffValveBlown) return
Pump1PopOffValveBlown = .true.
if(Warmings%Pump1PopOffValveBlown) return
Warmings%Pump1PopOffValveBlown = .true.
call RunPump1PopOffValveBlown()
end subroutine
subroutine Activate_Pump1Failure()
implicit none
if(Pump1Failure) return
Pump1Failure = .true.
if(Warmings%Pump1Failure) return
Warmings%Pump1Failure = .true.
call RunPump1Failure()
end subroutine
subroutine Activate_Pump2PopOffValveBlown()
implicit none
if(Pump2PopOffValveBlown) return
Pump2PopOffValveBlown = .true.
if(Warmings%Pump2PopOffValveBlown) return
Warmings%Pump2PopOffValveBlown = .true.
call RunPump2PopOffValveBlown()
end subroutine
subroutine Activate_Pump2Failure()
implicit none
if(Pump2Failure) return
Pump2Failure = .true.
if(Warmings%Pump2Failure) return
Warmings%Pump2Failure = .true.
call RunPump2Failure()
end subroutine
subroutine Activate_Pump3PopOffValveBlown()
implicit none
if(Pump3PopOffValveBlown) return
Pump3PopOffValveBlown = .true.
if(Warmings%Pump3PopOffValveBlown) return
Warmings%Pump3PopOffValveBlown = .true.
call RunPump3PopOffValveBlown()
end subroutine
subroutine Activate_Pump3Failure()
implicit none
if(Pump3Failure) return
Pump3Failure = .true.
if(Warmings%Pump3Failure) return
Warmings%Pump3Failure = .true.
call RunPump3Failure()
end subroutine
subroutine Activate_DrawworksGearsAbuse()
implicit none
if(DrawworksGearsAbuse) return
DrawworksGearsAbuse = .true.
if(Warmings%DrawworksGearsAbuse) return
Warmings%DrawworksGearsAbuse = .true.
call RunDrawworksGearsAbuse()
end subroutine
subroutine Activate_RotaryGearsAbuse()
implicit none
if(RotaryGearsAbuse) return
RotaryGearsAbuse = .true.
if(Warmings%RotaryGearsAbuse) return
Warmings%RotaryGearsAbuse = .true.
call RunRotaryGearsAbuse()
end subroutine
subroutine Activate_HoistLineBreak()
implicit none
if(HoistLineBreak) return
HoistLineBreak = .true.
if(Warmings%HoistLineBreak) return
Warmings%HoistLineBreak = .true.
call RunHoistLineBreak()
end subroutine
subroutine Activate_PartedDrillString()
implicit none
if(PartedDrillString) return
PartedDrillString = .true.
if(Warmings%PartedDrillString) return
Warmings%PartedDrillString = .true.
call RunPartedDrillString()
end subroutine
subroutine Activate_ActiveTankOverflow()
implicit none
if(ActiveTankOverflow) return
ActiveTankOverflow = .true.
if(Warmings%ActiveTankOverflow) return
Warmings%ActiveTankOverflow = .true.
call RunActiveTankOverflow()
end subroutine
subroutine Activate_ActiveTankUnderVolume()
implicit none
if(ActiveTankUnderVolume) return
ActiveTankUnderVolume = .true.
if(Warmings%ActiveTankUnderVolume) return
Warmings%ActiveTankUnderVolume = .true.
call RunActiveTankUnderVolume()
end subroutine
subroutine Activate_TripTankOverflow()
implicit none
if(TripTankOverflow) return
TripTankOverflow = .true.
if(Warmings%TripTankOverflow) return
Warmings%TripTankOverflow = .true.
call RunTripTankOverflow()
end subroutine
subroutine Activate_DrillPipeTwistOff()
implicit none
if(DrillPipeTwistOff) return
DrillPipeTwistOff = .true.
if(Warmings%DrillPipeTwistOff) return
Warmings%DrillPipeTwistOff = .true.
call RunDrillPipeTwistOff()
end subroutine
subroutine Activate_DrillPipeParted()
implicit none
if(DrillPipeParted) return
DrillPipeParted = .true.
if(Warmings%DrillPipeParted) return
Warmings%DrillPipeParted = .true.
call RunDrillPipeParted()
end subroutine
subroutine Activate_TripWithSlipsSet()
implicit none
if(TripWithSlipsSet) return
TripWithSlipsSet = .true.
if(Warmings%TripWithSlipsSet) return
Warmings%TripWithSlipsSet = .true.
call RunTripWithSlipsSet()
end subroutine
subroutine Activate_Blowout()
implicit none
if(Blowout) return
Blowout = .true.
if(Warmings%Blowout) return
Warmings%Blowout = .true.
call RunBlowout()
end subroutine
subroutine Activate_UndergroundBlowout()
implicit none
if(UndergroundBlowout) return
UndergroundBlowout = .true.
if(Warmings%UndergroundBlowout) return
Warmings%UndergroundBlowout = .true.
call RunUndergroundBlowout()
end subroutine
subroutine Activate_MaximumWellDepthExceeded()
implicit none
if(MaximumWellDepthExceeded) return
MaximumWellDepthExceeded = .true.
if(Warmings%MaximumWellDepthExceeded) return
Warmings%MaximumWellDepthExceeded = .true.
call RunMaximumWellDepthExceeded()
end subroutine
subroutine Activate_CrownCollision()
implicit none
if(CrownCollision) return
CrownCollision = .true.
if(Warmings%CrownCollision) return
Warmings%CrownCollision = .true.
call RunCrownCollision()
end subroutine
subroutine Activate_FloorCollision()
implicit none
if(FloorCollision) return
FloorCollision = .true.
if(Warmings%FloorCollision) return
Warmings%FloorCollision = .true.
call RunFloorCollision()
end subroutine
subroutine Activate_TopdriveRotaryTableConfilict()
implicit none
if(TopdriveRotaryTableConfilict) return
TopdriveRotaryTableConfilict = .true.
if(Warmings%TopdriveRotaryTableConfilict) return
Warmings%TopdriveRotaryTableConfilict = .true.
call RunTopdriveRotaryTableConfilict()
end subroutine
@@ -225,23 +227,23 @@ module CWarningsVariables
subroutine Deactivate_PumpWithKellyDisconnected()
implicit none
if(.not.PumpWithKellyDisconnected) return
PumpWithKellyDisconnected = .false.
if(.not.Warmings%PumpWithKellyDisconnected) return
Warmings%PumpWithKellyDisconnected = .false.
call RunPumpWithKellyDisconnected()
end subroutine
subroutine Deactivate_PumpWithTopdriveDisconnected()
implicit none
if(.not.PumpWithTopdriveDisconnected) return
PumpWithTopdriveDisconnected = .false.
if(.not.Warmings%PumpWithTopdriveDisconnected) return
Warmings%PumpWithTopdriveDisconnected = .false.
call RunPumpWithTopdriveDisconnected()
end subroutine
subroutine Deactivate_Pump1PopOffValveBlown()
use CManifolds
implicit none
if(.not.Pump1PopOffValveBlown) return
Pump1PopOffValveBlown = .false.
if(.not.Warmings%Pump1PopOffValveBlown) return
Warmings%Pump1PopOffValveBlown = .false.
call ChangeValve(65, .false.)
call RunPump1PopOffValveBlown()
end subroutine
@@ -249,16 +251,16 @@ module CWarningsVariables
subroutine Deactivate_Pump1Failure()
use CManifolds
implicit none
if(.not.Pump1Failure) return
Pump1Failure = .false.
if(.not.Warmings%Pump1Failure) return
Warmings%Pump1Failure = .false.
call RunPump1Failure()
end subroutine
subroutine Deactivate_Pump2PopOffValveBlown()
use CManifolds
implicit none
if(.not.Pump2PopOffValveBlown) return
Pump2PopOffValveBlown = .false.
if(.not.Warmings%Pump2PopOffValveBlown) return
Warmings%Pump2PopOffValveBlown = .false.
call ChangeValve(66, .false.)
call RunPump2PopOffValveBlown()
end subroutine
@@ -266,136 +268,136 @@ module CWarningsVariables
subroutine Deactivate_Pump2Failure()
use CManifolds
implicit none
if(.not.Pump2Failure) return
Pump2Failure = .false.
if(.not.Warmings%Pump2Failure) return
Warmings%Pump2Failure = .false.
call RunPump2Failure()
end subroutine
subroutine Deactivate_Pump3PopOffValveBlown()
use CManifolds
implicit none
if(.not.Pump3PopOffValveBlown) return
Pump3PopOffValveBlown = .false.
if(.not.Warmings%Pump3PopOffValveBlown) return
Warmings%Pump3PopOffValveBlown = .false.
call RunPump3PopOffValveBlown()
end subroutine
subroutine Deactivate_Pump3Failure()
use CManifolds
implicit none
if(.not.Pump3Failure) return
Pump3Failure = .false.
if(.not.Warmings%Pump3Failure) return
Warmings%Pump3Failure = .false.
call RunPump3Failure()
end subroutine
subroutine Deactivate_DrawworksGearsAbuse()
implicit none
if(.not.DrawworksGearsAbuse) return
DrawworksGearsAbuse = .false.
if(.not.Warmings%DrawworksGearsAbuse) return
Warmings%DrawworksGearsAbuse = .false.
call RunDrawworksGearsAbuse()
end subroutine
subroutine Deactivate_RotaryGearsAbuse()
implicit none
if(.not.RotaryGearsAbuse) return
RotaryGearsAbuse = .false.
if(.not.Warmings%RotaryGearsAbuse) return
Warmings%RotaryGearsAbuse = .false.
call RunRotaryGearsAbuse()
end subroutine
subroutine Deactivate_HoistLineBreak()
implicit none
if(.not.HoistLineBreak) return
HoistLineBreak = .false.
if(.not.Warmings%HoistLineBreak) return
Warmings%HoistLineBreak = .false.
call RunHoistLineBreak()
end subroutine
subroutine Deactivate_PartedDrillString()
implicit none
if(.not.PartedDrillString) return
PartedDrillString = .false.
if(.not.Warmings%PartedDrillString) return
Warmings%PartedDrillString = .false.
call RunPartedDrillString()
end subroutine
subroutine Deactivate_ActiveTankOverflow()
implicit none
if(.not.ActiveTankOverflow) return
ActiveTankOverflow = .false.
if(.not.Warmings%ActiveTankOverflow) return
Warmings%ActiveTankOverflow = .false.
call RunActiveTankOverflow()
end subroutine
subroutine Deactivate_ActiveTankUnderVolume()
implicit none
if(.not.ActiveTankUnderVolume) return
ActiveTankUnderVolume = .false.
if(.not.Warmings%ActiveTankUnderVolume) return
Warmings%ActiveTankUnderVolume = .false.
call RunActiveTankUnderVolume()
end subroutine
subroutine Deactivate_TripTankOverflow()
implicit none
if(.not.TripTankOverflow) return
TripTankOverflow = .false.
if(.not.Warmings%TripTankOverflow) return
Warmings%TripTankOverflow = .false.
call RunTripTankOverflow()
end subroutine
subroutine Deactivate_DrillPipeTwistOff()
implicit none
if(.not.DrillPipeTwistOff) return
DrillPipeTwistOff = .false.
if(.not.Warmings%DrillPipeTwistOff) return
Warmings%DrillPipeTwistOff = .false.
call RunDrillPipeTwistOff()
end subroutine
subroutine Deactivate_DrillPipeParted()
implicit none
if(.not.DrillPipeParted) return
DrillPipeParted = .false.
if(.not.Warmings%DrillPipeParted) return
Warmings%DrillPipeParted = .false.
call RunDrillPipeParted()
end subroutine
subroutine Deactivate_TripWithSlipsSet()
implicit none
if(.not.TripWithSlipsSet) return
TripWithSlipsSet = .false.
if(.not.Warmings%TripWithSlipsSet) return
Warmings%TripWithSlipsSet = .false.
call RunTripWithSlipsSet()
end subroutine
subroutine Deactivate_Blowout()
implicit none
if(.not.Blowout) return
Blowout = .false.
if(.not.Warmings%Blowout) return
Warmings%Blowout = .false.
call RunBlowout()
end subroutine
subroutine Deactivate_UndergroundBlowout()
implicit none
if(.not.UndergroundBlowout) return
UndergroundBlowout = .false.
if(.not.Warmings%UndergroundBlowout) return
Warmings%UndergroundBlowout = .false.
call RunUndergroundBlowout()
end subroutine
subroutine Deactivate_MaximumWellDepthExceeded()
implicit none
if(.not.MaximumWellDepthExceeded) return
MaximumWellDepthExceeded = .false.
if(.not.Warmings%MaximumWellDepthExceeded) return
Warmings%MaximumWellDepthExceeded = .false.
call RunMaximumWellDepthExceeded()
end subroutine
subroutine Deactivate_CrownCollision()
implicit none
if(.not.CrownCollision) return
CrownCollision = .false.
if(.not.Warmings%CrownCollision) return
Warmings%CrownCollision = .false.
call RunCrownCollision()
end subroutine
subroutine Deactivate_FloorCollision()
implicit none
if(.not.FloorCollision) return
FloorCollision = .false.
if(.not.Warmings%FloorCollision) return
Warmings%FloorCollision = .false.
call RunFloorCollision()
end subroutine
subroutine Deactivate_TopdriveRotaryTableConfilict()
implicit none
if(.not.TopdriveRotaryTableConfilict) return
TopdriveRotaryTableConfilict = .false.
if(.not.Warmings%TopdriveRotaryTableConfilict) return
Warmings%TopdriveRotaryTableConfilict = .false.
call RunTopdriveRotaryTableConfilict()
end subroutine
@@ -426,168 +428,168 @@ module CWarningsVariables
subroutine RunPumpWithKellyDisconnected()
implicit none
if(associated(PumpWithKellyDisconnectedPtr)) then
call PumpWithKellyDisconnectedPtr(PumpWithKellyDisconnected)
call PumpWithKellyDisconnectedPtr(Warmings%PumpWithKellyDisconnected)
end if
end subroutine
subroutine RunPumpWithTopdriveDisconnected()
implicit none
if(associated(PumpWithTopdriveDisconnectedPtr)) then
call PumpWithTopdriveDisconnectedPtr(PumpWithTopdriveDisconnected)
call PumpWithTopdriveDisconnectedPtr(Warmings%PumpWithTopdriveDisconnected)
end if
end subroutine
subroutine RunPump1PopOffValveBlown()
implicit none
if(associated(Pump1PopOffValveBlownPtr)) then
call Pump1PopOffValveBlownPtr(Pump1PopOffValveBlown)
call Pump1PopOffValveBlownPtr(Warmings%Pump1PopOffValveBlown)
end if
end subroutine
subroutine RunPump1Failure()
implicit none
if(associated(Pump1FailurePtr)) then
call Pump1FailurePtr(Pump1Failure)
call Pump1FailurePtr(Warmings%Pump1Failure)
end if
end subroutine
subroutine RunPump2PopOffValveBlown()
implicit none
if(associated(Pump2PopOffValveBlownPtr)) then
call Pump2PopOffValveBlownPtr(Pump2PopOffValveBlown)
call Pump2PopOffValveBlownPtr(Warmings%Pump2PopOffValveBlown)
end if
end subroutine
subroutine RunPump2Failure()
implicit none
if(associated(Pump2FailurePtr)) then
call Pump2FailurePtr(Pump2Failure)
call Pump2FailurePtr(Warmings%Pump2Failure)
end if
end subroutine
subroutine RunPump3PopOffValveBlown()
implicit none
if(associated(Pump3PopOffValveBlownPtr)) then
call Pump3PopOffValveBlownPtr(Pump3PopOffValveBlown)
call Pump3PopOffValveBlownPtr(Warmings%Pump3PopOffValveBlown)
end if
end subroutine
subroutine RunPump3Failure()
implicit none
if(associated(Pump3FailurePtr)) then
call Pump3FailurePtr(Pump3Failure)
call Pump3FailurePtr(Warmings%Pump3Failure)
end if
end subroutine
subroutine RunDrawworksGearsAbuse()
implicit none
if(associated(DrawworksGearsAbusePtr)) then
call DrawworksGearsAbusePtr(DrawworksGearsAbuse)
call DrawworksGearsAbusePtr(Warmings%DrawworksGearsAbuse)
end if
end subroutine
subroutine RunRotaryGearsAbuse()
implicit none
if(associated(RotaryGearsAbusePtr)) then
call RotaryGearsAbusePtr(RotaryGearsAbuse)
call RotaryGearsAbusePtr(Warmings%RotaryGearsAbuse)
end if
end subroutine
subroutine RunHoistLineBreak()
implicit none
if(associated(HoistLineBreakPtr)) then
call HoistLineBreakPtr(HoistLineBreak)
call HoistLineBreakPtr(Warmings%HoistLineBreak)
end if
end subroutine
subroutine RunPartedDrillString()
implicit none
if(associated(PartedDrillStringPtr)) then
call PartedDrillStringPtr(PartedDrillString)
call PartedDrillStringPtr(Warmings%PartedDrillString)
end if
end subroutine
subroutine RunActiveTankOverflow()
implicit none
if(associated(ActiveTankOverflowPtr)) then
call ActiveTankOverflowPtr(ActiveTankOverflow)
call ActiveTankOverflowPtr(Warmings%ActiveTankOverflow)
end if
end subroutine
subroutine RunActiveTankUnderVolume()
implicit none
if(associated(ActiveTankUnderVolumePtr)) then
call ActiveTankUnderVolumePtr(ActiveTankUnderVolume)
call ActiveTankUnderVolumePtr(Warmings%ActiveTankUnderVolume)
end if
end subroutine
subroutine RunTripTankOverflow()
implicit none
if(associated(TripTankOverflowPtr)) then
call TripTankOverflowPtr(TripTankOverflow)
call TripTankOverflowPtr(Warmings%TripTankOverflow)
end if
end subroutine
subroutine RunDrillPipeTwistOff()
implicit none
if(associated(DrillPipeTwistOffPtr)) then
call DrillPipeTwistOffPtr(DrillPipeTwistOff)
call DrillPipeTwistOffPtr(Warmings%DrillPipeTwistOff)
end if
end subroutine
subroutine RunDrillPipeParted()
implicit none
if(associated(DrillPipePartedPtr)) then
call DrillPipePartedPtr(DrillPipeParted)
call DrillPipePartedPtr(Warmings%DrillPipeParted)
end if
end subroutine
subroutine RunTripWithSlipsSet()
implicit none
if(associated(TripWithSlipsSetPtr)) then
call TripWithSlipsSetPtr(TripWithSlipsSet)
call TripWithSlipsSetPtr(Warmings%TripWithSlipsSet)
end if
end subroutine
subroutine RunBlowout()
implicit none
if(associated(BlowoutPtr)) then
call BlowoutPtr(Blowout)
call BlowoutPtr(Warmings%Blowout)
end if
end subroutine
subroutine RunUndergroundBlowout()
implicit none
if(associated(UndergroundBlowoutPtr)) then
call UndergroundBlowoutPtr(UndergroundBlowout)
call UndergroundBlowoutPtr(Warmings%UndergroundBlowout)
end if
end subroutine
subroutine RunMaximumWellDepthExceeded()
implicit none
if(associated(MaximumWellDepthExceededPtr)) then
call MaximumWellDepthExceededPtr(MaximumWellDepthExceeded)
call MaximumWellDepthExceededPtr(Warmings%MaximumWellDepthExceeded)
end if
end subroutine
subroutine RunCrownCollision()
implicit none
if(associated(CrownCollisionPtr)) then
call CrownCollisionPtr(CrownCollision)
call CrownCollisionPtr(Warmings%CrownCollision)
end if
end subroutine
subroutine RunFloorCollision()
implicit none
if(associated(FloorCollisionPtr)) then
call FloorCollisionPtr(FloorCollision)
call FloorCollisionPtr(Warmings%FloorCollision)
end if
end subroutine
subroutine RunTopdriveRotaryTableConfilict()
implicit none
if(associated(TopdriveRotaryTableConfilictPtr)) then
call TopdriveRotaryTableConfilictPtr(TopdriveRotaryTableConfilict)
call TopdriveRotaryTableConfilictPtr(Warmings%TopdriveRotaryTableConfilict)
end if
end subroutine


+ 43
- 1
Data Structures.txt View File

@@ -56,6 +56,10 @@ CSharp:
UnityOutputs
UnitySignals:
UnitySignals
StudentStation:
StudentStation
Warnings:
Warnings
Problems:
BitProblems
BopProblems
@@ -90,4 +94,42 @@ Equipments:
AirPumpLine
CHOOKE (previously exists)
MudSystem:
MudSystem
Pumps:
MPumps
Pump(1:3)
RotaryTable:
RTable
TopDrive:
TDS
TorqueDrag:
TDGeo
F_String(:)
F_Counts
F_Interval(:)
OD_Annulus(4)
TD_String
TD_DrillStem(:)
TD_DrillStems(:)
TD_Count
G_StringElement
TD_Vol
TD_General
TD_BOP
TD_BOPElement(4)
TD_StConn
TD_Load
TD_WellEl
TD_Casing
TD_Liner
TD_OpenHole
TD_ROPHole
TD_WellGeneral
TD_WellGeo(:)

FluidFlow:

Rop:
ROP_Bit
ROP_Spec

+ 120
- 186
Equipments/ChokeControl/AirPump_Choke_Subs.f90 View File

@@ -106,37 +106,20 @@ SUBROUTINE PIPE_RAMS_CHOKE(CHNUMBER)
INTEGER CHNUMBER
Integer I

loop3: do while (ABS(ChokeControlPanel%ChokeControlLever)==1.0 .AND. ChokeControlPanel%ChokePanelRigAirSwitch == 1 .AND. CHOOKE(CHNUMBER)%FailMalf==0 .AND. AirDrivenPump%ChokeAirFail==0)
if (ChokeControlPanel%ChokeControlLever == 1.0) then
if (ChokeControlPanel%ChokeControlLever == 1.0) then
CHOOKE(CHNUMBER)%ChokeIsClosing = .true.
CHOOKE(CHNUMBER)%ChokeIsOpening = .false.
endif
if (ChokeControlPanel%ChokeControlLever == -1.0) then
CHOOKE(CHNUMBER)%ChokeIsOpening = .true.
CHOOKE(CHNUMBER)%ChokeIsClosing = .false.
endif

AirPumpLine%TIME=AirPumpLine%TIME+AirPumpLine%DeltaT_Choke !overal time (s)



!====================================================
! ********************************
call airpump_code_CHOKE(CHNUMBER)
! *************************
!====================================================

call sleepqq(100)
if (IsStopped == .true.) return
AirPumpLine%TIME=AirPumpLine%TIME+AirPumpLine%DeltaT_Choke !overal time (s)
call airpump_code_CHOKE(CHNUMBER)
call sleepqq(100)
if (IsStopped == .true.) return
end do loop3 !while finished_Choke==0
end
@@ -145,171 +128,122 @@ SUBROUTINE PIPE_RAMS_CHOKE(CHNUMBER)
SUBROUTINE airpump_code_CHOKE(CHNUMBER)
USE CHOKEVARIABLES
USE CChokeManifoldVariables
use CSounds
USE CChokeProblemsVariables
implicit none
Integer I

INTEGER CHNUMBER


AirDrivenPump%QAIR_PUMP=AirPumpLine%QITER+.1 !(gpm) maximum flow for the start
AirPumpLine%diffp_air=-10
AirPumpLine%losses_air=10

!===================================================================
! AIR OPERATED PUMP
! MODEL 10-6000W030 RATIO 55:1
!=================for air consumption at 100 psig===================
do while (AirPumpLine%diffp_air<0)
AirDrivenPump%QAIR_PUMP=AirDrivenPump%QAIR_PUMP-.1
! Qup=AirDrivenPump%QAIR_PUMP;
!cc1 = 1354; cc2 = -2066; cc3 = -2109; cc4 = -513.6; cc5 = 5935 FOR OUTPUT IN GPM
AirPumpLine%P_AIRP=AirDrivenPump%cc1*(AirDrivenPump%QAIR_PUMP**4) + AirDrivenPump%cc2*(AirDrivenPump%QAIR_PUMP**3) + AirDrivenPump%cc3*(AirDrivenPump%QAIR_PUMP**2) + AirDrivenPump%cc4*AirDrivenPump%QAIR_PUMP + AirDrivenPump%cc5 !(psig)
! kinetic_air=sg*wdens*(QAIR_PUMP*6.30902e-5/((1/4.)*pi*(2*0.254e-1)**2))**2/(2*6895) !(psi)

AirPumpLine%diffp_air= AirPumpLine%P_AIRP - AirPumpLine%Pdownstrem

end do !returns Qup



do while (abs((AirPumpLine%diffp_air-AirPumpLine%losses_air)/AirPumpLine%diffp_air)>AirPumpLine%TOL_AIR) !finding correct QAIR_pump for 1 timecounter_ram

if (AirPumpLine%diffp_air-AirPumpLine%losses_air>0) then
AirDrivenPump%QAIR_PUMP=AirDrivenPump%QAIR_PUMP+.005
else
AirDrivenPump%QAIR_PUMP=AirDrivenPump%QAIR_PUMP-.005
endif

!===================================================================
! AIR OPERATED PUMP
! MODEL 10-6000W030 RATIO 55:1
!=================for air consumption at 100 psig===================

AirPumpLine%P_AIRP=AirDrivenPump%cc1*(AirDrivenPump%QAIR_PUMP**4) + AirDrivenPump%cc2*(AirDrivenPump%QAIR_PUMP**3) + AirDrivenPump%cc3*(AirDrivenPump%QAIR_PUMP**2) + AirDrivenPump%cc4*AirDrivenPump%QAIR_PUMP + AirDrivenPump%cc5 !(psig)
!kinetic_air=sg*wdens*(QAIR_PUMP*6.30902e-005/((1/4.)*pi*(2*0.254e-1)**2))**2/(2*6895) !(psi)

AirPumpLine%diffp_air= AirPumpLine%P_AIRP - AirPumpLine%Pdownstrem


!===========================LOSSES====================================
do i=1,AirPumpLine%NO_PIPINGS_AIRPLINE
AirPumpLine%Re_air(i)=AirDrivenPump%QAIR_PUMP*6.30902e-005*AirPumpLine%DIAM_AIR_INCH(I)*0.0254/(AirPumpLine%AREA_AIR(i)*nu)
enddo


do i=1,AirPumpLine%NO_PIPINGS_AIRPLINE
if (AirPumpLine%Re_air(i)<Re_cr) then
AirPumpLine%fric_air(i)=64/AirPumpLine%Re_air(i)
else
AirPumpLine%fric_air(i)=1/(-1.8*log10((AirPumpLine%REL_ROUGHAIR(i)/3.7)**1.11+6.9/AirPumpLine%Re_air(i)))**2
endif
AirPumpLine%fricloss_air(i)=((AirPumpLine%fric_air(i)*(wdens*sg*AirPumpLine%LENGT_AIR(i)*(AirDrivenPump%QAIR_PUMP*6.30902e-005/AirPumpLine%AREA_AIR(i))**2))/(2*AirPumpLine%DIAM_AIR_INCH(I)*0.0254))/6895

enddo




AirPumpLine%pipe_loss1air=sum(AirPumpLine%fricloss_air) !loss before regulator(psi)

do i=1,AirPumpLine%NO_MINORS_AIRPLINE
if (AirPumpLine%LF_AIR(i)/=0) then
AirPumpLine%minlosspa_air(i)=AirPumpLine%LF_AIR(i)*wdens*sg*(AirDrivenPump%QAIR_PUMP*6.30902e-005/AirPumpLine%MINORAREA_AIR(i))**2/2 !(Pa)
AirPumpLine%minloss_air(i)=AirPumpLine%minlosspa_air(i)/6895 !(psi)
elseif (AirPumpLine%CV_AIR(i)/=0) then
AirPumpLine%minlosspa_air(i)=1000*sg*((11.7*AirDrivenPump%QAIR_PUMP*6.30902e-005*3600)/(AirPumpLine%CV_AIR(i)))**2 !(pa)
AirPumpLine%minloss_air(i)=AirPumpLine%minlosspa_air(i)/6895 !(psi)
else
AirPumpLine%minlosspa_air(i)=AirPumpLine%NOTE_AIR(i)*1e5 !(pa)
AirPumpLine%minloss_air(i)=AirPumpLine%minlosspa_air(i)/6895 !(psi)
endif
enddo

USE CHOKEVARIABLES
USE CChokeManifoldVariables
use CSounds
USE CChokeProblemsVariables
implicit none
Integer I

INTEGER CHNUMBER

AirDrivenPump%QAIR_PUMP=AirPumpLine%QITER+.1 !(gpm) maximum flow for the start
AirPumpLine%diffp_air=-10
AirPumpLine%losses_air=10

!===================================================================
! AIR OPERATED PUMP
! MODEL 10-6000W030 RATIO 55:1
!=================for air consumption at 100 psig===================
do while (AirPumpLine%diffp_air<0)
AirDrivenPump%QAIR_PUMP=AirDrivenPump%QAIR_PUMP-.1
! Qup=AirDrivenPump%QAIR_PUMP;
!cc1 = 1354; cc2 = -2066; cc3 = -2109; cc4 = -513.6; cc5 = 5935 FOR OUTPUT IN GPM
AirPumpLine%P_AIRP=AirDrivenPump%cc1*(AirDrivenPump%QAIR_PUMP**4) + AirDrivenPump%cc2*(AirDrivenPump%QAIR_PUMP**3) + AirDrivenPump%cc3*(AirDrivenPump%QAIR_PUMP**2) + AirDrivenPump%cc4*AirDrivenPump%QAIR_PUMP + AirDrivenPump%cc5 !(psig)
! kinetic_air=sg*wdens*(QAIR_PUMP*6.30902e-5/((1/4.)*pi*(2*0.254e-1)**2))**2/(2*6895) !(psi)
AirPumpLine%diffp_air= AirPumpLine%P_AIRP - AirPumpLine%Pdownstrem
end do !returns Qup

do while (abs((AirPumpLine%diffp_air-AirPumpLine%losses_air)/AirPumpLine%diffp_air)>AirPumpLine%TOL_AIR) !finding correct QAIR_pump for 1 timecounter_ram
if (AirPumpLine%diffp_air-AirPumpLine%losses_air>0) then
AirDrivenPump%QAIR_PUMP=AirDrivenPump%QAIR_PUMP+.005
else
AirDrivenPump%QAIR_PUMP=AirDrivenPump%QAIR_PUMP-.005
endif
!===================================================================
! AIR OPERATED PUMP
! MODEL 10-6000W030 RATIO 55:1
!=================for air consumption at 100 psig===================
AirPumpLine%P_AIRP=AirDrivenPump%cc1*(AirDrivenPump%QAIR_PUMP**4) + AirDrivenPump%cc2*(AirDrivenPump%QAIR_PUMP**3) + AirDrivenPump%cc3*(AirDrivenPump%QAIR_PUMP**2) + AirDrivenPump%cc4*AirDrivenPump%QAIR_PUMP + AirDrivenPump%cc5 !(psig)
!kinetic_air=sg*wdens*(QAIR_PUMP*6.30902e-005/((1/4.)*pi*(2*0.254e-1)**2))**2/(2*6895) !(psi)
AirPumpLine%diffp_air= AirPumpLine%P_AIRP - AirPumpLine%Pdownstrem
!===========================LOSSES====================================
do i=1,AirPumpLine%NO_PIPINGS_AIRPLINE
AirPumpLine%Re_air(i)=AirDrivenPump%QAIR_PUMP*6.30902e-005*AirPumpLine%DIAM_AIR_INCH(I)*0.0254/(AirPumpLine%AREA_AIR(i)*nu)
enddo
do i=1,AirPumpLine%NO_PIPINGS_AIRPLINE
if (AirPumpLine%Re_air(i)<Re_cr) then
AirPumpLine%fric_air(i)=64/AirPumpLine%Re_air(i)
else
AirPumpLine%fric_air(i)=1/(-1.8*log10((AirPumpLine%REL_ROUGHAIR(i)/3.7)**1.11+6.9/AirPumpLine%Re_air(i)))**2
endif
AirPumpLine%fricloss_air(i)=((AirPumpLine%fric_air(i)*(wdens*sg*AirPumpLine%LENGT_AIR(i)*(AirDrivenPump%QAIR_PUMP*6.30902e-005/AirPumpLine%AREA_AIR(i))**2))/(2*AirPumpLine%DIAM_AIR_INCH(I)*0.0254))/6895
enddo

AirPumpLine%pipe_loss1air=sum(AirPumpLine%fricloss_air) !loss before regulator(psi)

do i=1,AirPumpLine%NO_MINORS_AIRPLINE
if (AirPumpLine%LF_AIR(i)/=0) then
AirPumpLine%minlosspa_air(i)=AirPumpLine%LF_AIR(i)*wdens*sg*(AirDrivenPump%QAIR_PUMP*6.30902e-005/AirPumpLine%MINORAREA_AIR(i))**2/2 !(Pa)
AirPumpLine%minloss_air(i)=AirPumpLine%minlosspa_air(i)/6895 !(psi)
elseif (AirPumpLine%CV_AIR(i)/=0) then
AirPumpLine%minlosspa_air(i)=1000*sg*((11.7*AirDrivenPump%QAIR_PUMP*6.30902e-005*3600)/(AirPumpLine%CV_AIR(i)))**2 !(pa)
AirPumpLine%minloss_air(i)=AirPumpLine%minlosspa_air(i)/6895 !(psi)
else
AirPumpLine%minlosspa_air(i)=AirPumpLine%NOTE_AIR(i)*1e5 !(pa)
AirPumpLine%minloss_air(i)=AirPumpLine%minlosspa_air(i)/6895 !(psi)
endif
enddo
AirPumpLine%minor_loss1air=sum(AirPumpLine%minloss_air) !loss before regulator(psi)
AirPumpLine%static_loss1air=0
AirPumpLine%losses_air=AirPumpLine%pipe_loss1air+AirPumpLine%minor_loss1air+AirPumpLine%static_loss1air !(psi)
!=========================================================================
end do !returns correct QAIR_PUMP for 1 counter

AirPumpLine%QITER=AirDrivenPump%QAIR_PUMP
AirDrivenPump%QAIR_PUMP=AirDrivenPump%QAIR_PUMP*(ChokeControlPanel%ChokeRateControlKnob/10.) ! final Q (gpm)
Choke%Cumulative_AirVolume_Choke= Choke%Cumulative_AirVolume_Choke + ((AirDrivenPump%QAIR_PUMP * AirPumpLine%DeltaT_Choke / 60.0 ) / (1.5*0.004329004) ) ! =strokes
AirPumpLine%minor_loss1air=sum(AirPumpLine%minloss_air) !loss before regulator(psi)

AirPumpLine%static_loss1air=0

AirPumpLine%losses_air=AirPumpLine%pipe_loss1air+AirPumpLine%minor_loss1air+AirPumpLine%static_loss1air !(psi)
!=========================================================================


end do !returns correct QAIR_PUMP for 1 counter



AirPumpLine%QITER=AirDrivenPump%QAIR_PUMP
AirDrivenPump%QAIR_PUMP=AirDrivenPump%QAIR_PUMP*(ChokeControlPanel%ChokeRateControlKnob/10.) ! final Q (gpm)
Choke%Cumulative_AirVolume_Choke= Choke%Cumulative_AirVolume_Choke + ((AirDrivenPump%QAIR_PUMP * AirPumpLine%DeltaT_Choke / 60.0 ) / (1.5*0.004329004) ) ! =strokes

if ( Choke%Cumulative_AirVolume_Choke > 1.0 ) then
Choke%SoundChokePump= 60
Choke%Cumulative_AirVolume_Choke= Choke%Cumulative_AirVolume_Choke - 1.0
else
Choke%SoundChokePump= 0.0
endif
!SoundChokePump= int (QAIR_PUMP/ (1.5*0.004329004)*DeltaT_Choke/60.0) ! 1.5: Volume per stroke (in^3) , 0.004329004: in^3 to gal , 60:seconds

AirPumpLine%DELTAV_AIR=AirDrivenPump%QAIR_PUMP*AirPumpLine%DeltaT_Choke/60 !(galon) delta_t=1sec , Q(gpm)

if (CHOOKE(CHNUMBER)%ChokeIsClosing) CHOOKE(CHNUMBER)%PassedCourse=CHOOKE(CHNUMBER)%PassedCourse + (AirPumpLine%DELTAV_AIR*3785.412/AirPumpLine%Acylinder)!*(ChokeRateControlKnob/10.) ! 3785.412 : GALON TO CM^3
if (CHOOKE(CHNUMBER)%ChokeIsOpening) CHOOKE(CHNUMBER)%PassedCourse=CHOOKE(CHNUMBER)%PassedCourse - (AirPumpLine%DELTAV_AIR*3785.412/AirPumpLine%Acylinder)!*(ChokeRateControlKnob/10.)


!DeltaT_Choke= 1sec or 2sec


!((((((((IN OUTER LOOP))))))

!===============AIR PUMP OUTPUTS=========================
AirPumpLine%alpha_timeair=AirPumpLine%TIME ! overal time (s)
AirPumpLine%alpha_Pdownstrem=AirPumpLine%Pdownstrem
AirPumpLine%alpha_pairp=AirPumpLine%P_AIRP
AirPumpLine%alpha_Qair=AirDrivenPump%QAIR_PUMP
!write(*,*) 'diffp_air=',diffp_air
!pause
AirPumpLine%alpha_diffpair=AirPumpLine%diffp_air

AirPumpLine%alpha_lossesair=AirPumpLine%losses_air
!========================================================
!OPEN(150,FILE='CHOKE_AIRPUMP_OUTPUTS.DAT')


if (CHOOKE(CHNUMBER)%ChokeIsClosing .AND. CHOOKE(CHNUMBER)%PassedCourse>AirPumpLine%CourseBase) then
CHOOKE(CHNUMBER)%PassedCourse=AirPumpLine%CourseBase
Choke%SoundChokePump= 0.0
endif
if (CHOOKE(CHNUMBER)%ChokeIsOpening .AND. CHOOKE(CHNUMBER)%PassedCourse<0.) then
CHOOKE(CHNUMBER)%PassedCourse=0.
Choke%SoundChokePump= 0.0
endif
call SetSoundChokePump(Choke%SoundChokePump)

CHOOKE(CHNUMBER)%PercentClose= CHOOKE(CHNUMBER)%PassedCourse/AirPumpLine%CourseBase
IF (ChokeControlPanel%Choke1LED==1) THEN
ChokeControlPanel%ChokePosition= (1 - Choke%GaugeChokePositionMailf) * CHOOKE(1)%PercentClose*10
ELSE ! Choke2LED==1
ChokeControlPanel%ChokePosition= (1 - Choke%GaugeChokePositionMailf) * CHOOKE(2)%PercentClose*10
ENDIF
if ( Choke%Cumulative_AirVolume_Choke > 1.0 ) then
Choke%SoundChokePump= 60
Choke%Cumulative_AirVolume_Choke= Choke%Cumulative_AirVolume_Choke - 1.0
else
Choke%SoundChokePump= 0.0
endif
AirPumpLine%DELTAV_AIR=AirDrivenPump%QAIR_PUMP*AirPumpLine%DeltaT_Choke/60 !(galon) delta_t=1sec , Q(gpm)
if (CHOOKE(CHNUMBER)%ChokeIsClosing) CHOOKE(CHNUMBER)%PassedCourse=CHOOKE(CHNUMBER)%PassedCourse + (AirPumpLine%DELTAV_AIR*3785.412/AirPumpLine%Acylinder)!*(ChokeRateControlKnob/10.) ! 3785.412 : GALON TO CM^3
if (CHOOKE(CHNUMBER)%ChokeIsOpening) CHOOKE(CHNUMBER)%PassedCourse=CHOOKE(CHNUMBER)%PassedCourse - (AirPumpLine%DELTAV_AIR*3785.412/AirPumpLine%Acylinder)!*(ChokeRateControlKnob/10.)
!DeltaT_Choke= 1sec or 2sec
!((((((((IN OUTER LOOP))))))
!===============AIR PUMP OUTPUTS=========================
AirPumpLine%alpha_timeair=AirPumpLine%TIME ! overal time (s)
AirPumpLine%alpha_Pdownstrem=AirPumpLine%Pdownstrem
AirPumpLine%alpha_pairp=AirPumpLine%P_AIRP
AirPumpLine%alpha_Qair=AirDrivenPump%QAIR_PUMP
!write(*,*) 'diffp_air=',diffp_air
!pause
AirPumpLine%alpha_diffpair=AirPumpLine%diffp_air
AirPumpLine%alpha_lossesair=AirPumpLine%losses_air
!========================================================
!OPEN(150,FILE='CHOKE_AIRPUMP_OUTPUTS.DAT')

if (CHOOKE(CHNUMBER)%ChokeIsClosing .AND. CHOOKE(CHNUMBER)%PassedCourse>AirPumpLine%CourseBase) then
CHOOKE(CHNUMBER)%PassedCourse=AirPumpLine%CourseBase
Choke%SoundChokePump= 0.0
endif
if (CHOOKE(CHNUMBER)%ChokeIsOpening .AND. CHOOKE(CHNUMBER)%PassedCourse<0.) then
CHOOKE(CHNUMBER)%PassedCourse=0.
Choke%SoundChokePump= 0.0
endif
call SetSoundChokePump(Choke%SoundChokePump)
CHOOKE(CHNUMBER)%PercentClose= CHOOKE(CHNUMBER)%PassedCourse/AirPumpLine%CourseBase
IF (ChokeControlPanel%Choke1LED==1) THEN
ChokeControlPanel%ChokePosition= (1 - Choke%GaugeChokePositionMailf) * CHOOKE(1)%PercentClose*10
ELSE ! Choke2LED==1
ChokeControlPanel%ChokePosition= (1 - Choke%GaugeChokePositionMailf) * CHOOKE(2)%PercentClose*10
ENDIF
!CALL SetHydraulicChock1(nint(MIN(CHOOKE(1)%PercentClose / 0.91 , 1.0)*100))
! CALL SetHydraulicChock2(nint(MIN(CHOOKE(2)%PercentClose / 0.91 , 1.0)*100))


+ 78
- 135
Equipments/ChokeControl/CHOKE.f90 View File

@@ -11,173 +11,116 @@ module ChokeModule
contains
subroutine CHOKE_MainBody
implicit none
Integer I
INTEGER CHNUMBER

!===========================================================================
!StandPipePressureChoke= STGauge_Pressure ! from module mud system
!CasingPressure = CasingPressureDataDisplay
!===========================================================================
!
! HYDRAULIC CHOKE CONTROL
!
!===========================================================================


IF(ChokeControlPanel%ChokeSelectorSwitch== 1) THEN
ChokeControlPanel%Choke1LED=1
ChokeControlPanel%Choke2LED=0
CHNUMBER=1
ELSE
ChokeControlPanel%Choke2LED=1
ChokeControlPanel%Choke1LED=0
CHNUMBER=2
ENDIF

if (ABS(ChokeControlPanel%ChokeControlLever)==1.0 .AND. ChokeControlPanel%ChokePanelRigAirSwitch == 1 .AND. (CHOOKE(1)%FailMalf==0 .OR. CHOOKE(2)%FailMalf==0)) then
CALL PIPE_RAMS_CHOKE(CHNUMBER)
end if


IF (ChokeControlPanel%Choke1LED==1) THEN
ChokeControlPanel%ChokePosition= (1 - Choke%GaugeChokePositionMailf) * CHOOKE(1)%PercentClose*10 ! display monitor
ELSE ! Choke2LED==1
ChokeControlPanel%ChokePosition= (1 - Choke%GaugeChokePositionMailf) * CHOOKE(2)%PercentClose*10 ! display monitor
ENDIF



! =================== calculating Area
! AreaChoke=0.5
! .91 >> 9 percent clearance

CHOOKE(1)%AreaChoke=0.01334635-(0.01334635* MIN(CHOOKE(1)%PercentClose / 0.91 , 1.0)) !ft^2 0.01334635 is ChokeAreaFullyOpen (ft^2)
CHOOKE(2)%AreaChoke=0.01334635-(0.01334635* MIN(CHOOKE(2)%PercentClose/ 0.91 , 1.0)) !ft^2
!write(*,*) 'CHOOKE(1)%AreaChoke= ' , CHOOKE(1)%AreaChoke

Choke%HydraulicChoke1WashoutCoef= Choke%HydraulicChoke1WashoutCoef * CHOOKE(1)%WashoutMalf
Choke%HydraulicChoke1WashoutCoef= MIN( 0.5 , Choke%HydraulicChoke1WashoutCoef+ CHOOKE(1)%WashoutMalf*(0.5/(180.0/AirPumpLine%DeltaT_Choke)) ) ! 0.5 = maximum washout coef , 180.0 sec = 3 min duration time
Choke%HydraulicChoke2WashoutCoef= Choke%HydraulicChoke2WashoutCoef * CHOOKE(2)%WashoutMalf
Choke%HydraulicChoke2WashoutCoef= MIN( 0.5 , Choke%HydraulicChoke2WashoutCoef+ CHOOKE(2)%WashoutMalf*(0.5/(180.0/AirPumpLine%DeltaT_Choke)) ) ! 0.5 = maximum washout coef , 180.0 sec = 3 min duration time

!write(*,*) 'HydraulicChoke1WashoutCoef=' , HydraulicChoke1WashoutCoef
IF (CHOOKE(1)%PlugMalf == 1) THEN
implicit none
Integer I
INTEGER CHNUMBER
!===========================================================================
!StandPipePressureChoke= STGauge_Pressure ! from module mud system
!CasingPressure = CasingPressureDataDisplay
!===========================================================================
!
! HYDRAULIC CHOKE CONTROL
!
!===========================================================================
IF(ChokeControlPanel%ChokeSelectorSwitch== 1) THEN
ChokeControlPanel%Choke1LED=1
ChokeControlPanel%Choke2LED=0
CHNUMBER=1
ELSE
ChokeControlPanel%Choke2LED=1
ChokeControlPanel%Choke1LED=0
CHNUMBER=2
ENDIF
if (ABS(ChokeControlPanel%ChokeControlLever)==1.0 .AND. ChokeControlPanel%ChokePanelRigAirSwitch == 1 .AND. (CHOOKE(1)%FailMalf==0 .OR. CHOOKE(2)%FailMalf==0)) then
CALL PIPE_RAMS_CHOKE(CHNUMBER)
end if
IF (ChokeControlPanel%Choke1LED==1) THEN
ChokeControlPanel%ChokePosition= (1 - Choke%GaugeChokePositionMailf) * CHOOKE(1)%PercentClose*10 ! display monitor
ELSE ! Choke2LED==1
ChokeControlPanel%ChokePosition= (1 - Choke%GaugeChokePositionMailf) * CHOOKE(2)%PercentClose*10 ! display monitor
ENDIF
! =================== calculating Area
! AreaChoke=0.5
! .91 >> 9 percent clearance
CHOOKE(1)%AreaChoke=0.01334635-(0.01334635* MIN(CHOOKE(1)%PercentClose / 0.91 , 1.0)) !ft^2 0.01334635 is ChokeAreaFullyOpen (ft^2)
CHOOKE(2)%AreaChoke=0.01334635-(0.01334635* MIN(CHOOKE(2)%PercentClose/ 0.91 , 1.0)) !ft^2
!write(*,*) 'CHOOKE(1)%AreaChoke= ' , CHOOKE(1)%AreaChoke
Choke%HydraulicChoke1WashoutCoef= Choke%HydraulicChoke1WashoutCoef * CHOOKE(1)%WashoutMalf
Choke%HydraulicChoke1WashoutCoef= MIN( 0.5 , Choke%HydraulicChoke1WashoutCoef+ CHOOKE(1)%WashoutMalf*(0.5/(180.0/AirPumpLine%DeltaT_Choke)) ) ! 0.5 = maximum washout coef , 180.0 sec = 3 min duration time
Choke%HydraulicChoke2WashoutCoef= Choke%HydraulicChoke2WashoutCoef * CHOOKE(2)%WashoutMalf
Choke%HydraulicChoke2WashoutCoef= MIN( 0.5 , Choke%HydraulicChoke2WashoutCoef+ CHOOKE(2)%WashoutMalf*(0.5/(180.0/AirPumpLine%DeltaT_Choke)) ) ! 0.5 = maximum washout coef , 180.0 sec = 3 min duration time
!write(*,*) 'HydraulicChoke1WashoutCoef=' , HydraulicChoke1WashoutCoef
IF (CHOOKE(1)%PlugMalf == 1) THEN
Choke%Present_HydraulicChoke1Plug= Choke%Present_HydraulicChoke1Plug * CHOOKE(1)%PlugMalf
! integer: HydraulicChoke1PluggedPercent,HydraulicChoke1PluggedPercent_Old,PlugTimeCounter,ChokePlugTimeDelay
! real: Present_HydraulicChoke1Plug,DeltaPlug1Percent
!write(*,*) 'HydraulicChoke1PluggedPercent=' , HydraulicChoke1PluggedPercent
if ( (ChokeProblems%HydraulicChoke1PluggedPercent - Choke%HydraulicChoke1PluggedPercent_Old) /= 0) then
Choke%DeltaPlug1Percent = (REAL(ChokeProblems%HydraulicChoke1PluggedPercent)/100.) - Choke%Present_HydraulicChoke1Plug
Choke%Plug1TimeCounter = 0
!write(*,*) 'DeltaPlug1Percent, Present_HydraulicChoke1Plug = ' ,DeltaPlug1Percent , Present_HydraulicChoke1Plug
endif
Choke%Plug1TimeCounter= Choke%Plug1TimeCounter + 1

Choke%HydraulicChoke1PluggedPercent_Old= ChokeProblems%HydraulicChoke1PluggedPercent
if (Choke%Plug1TimeCounter <= Choke%ChokePlugTimeDelay) then !ChokePlugTimeDelay=1800
if (Choke%Plug1TimeCounter <= Choke%ChokePlugTimeDelay) then !ChokePlugTimeDelay=1800
Choke%Present_HydraulicChoke1Plug = Choke%Present_HydraulicChoke1Plug + CHOOKE(1)%PlugMalf* ((Choke%DeltaPlug1Percent / real(Choke%ChokePlugTimeDelay))) ! real(ChokePlugTimeDelay)= 600.0
endif
!write(*,*) 'Present_HydraulicChoke1Plug=' , Present_HydraulicChoke1Plug
ENDIF
IF (CHOOKE(2)%PlugMalf == 1) THEN

!write(*,*) 'Present_HydraulicChoke1Plug=' , Present_HydraulicChoke1Plug
ENDIF
IF (CHOOKE(2)%PlugMalf == 1) THEN
Choke%Present_HydraulicChoke2Plug= Choke%Present_HydraulicChoke2Plug * CHOOKE(2)%PlugMalf
! integer: HydraulicChoke2PluggedPercent,HydraulicChoke2PluggedPercent_Old,PlugTimeCounter,ChokePlugTimeDelay
! real: Present_HydraulicChoke2Plug,DeltaPlug2Percent
if ( (ChokeProblems%HydraulicChoke2PluggedPercent - Choke%HydraulicChoke2PluggedPercent_Old) /= 0 ) then
Choke%DeltaPlug2Percent = (REAL(ChokeProblems%HydraulicChoke2PluggedPercent)/100.) - Choke%Present_HydraulicChoke2Plug
Choke%Plug2TimeCounter = 0
endif
endif
Choke%Plug2TimeCounter= Choke%Plug2TimeCounter + 1

Choke%HydraulicChoke2PluggedPercent_Old= ChokeProblems%HydraulicChoke2PluggedPercent
if (Choke%Plug2TimeCounter <= Choke%ChokePlugTimeDelay) then !ChokePlugTimeDelay=1800
Choke%Present_HydraulicChoke2Plug = Choke%Present_HydraulicChoke2Plug + CHOOKE(2)%PlugMalf *((Choke%DeltaPlug2Percent / real(Choke%ChokePlugTimeDelay))) ! real(ChokePlugTimeDelay)= 1800.0
endif
ENDIF
! fully open area is 123/64 in^2 = 0.01334635 ft^2
CHOOKE(1)%AreaChoke=CHOOKE(1)%AreaChoke+(CHOOKE(1)%WashoutMalf*Choke%HydraulicChoke1WashoutCoef*Choke%ChokeAreaFullyOpen/144.0) ! Initialised in Choke Startup
endif
ENDIF

!write(*,*) 'CHOOKE(1)%WashoutMalf , CHOOKE(1)%AreaChoke=' ,CHOOKE(1)%WashoutMalf , CHOOKE(1)%AreaChoke
CHOOKE(1)%AreaChoke=CHOOKE(1)%AreaChoke-(CHOOKE(1)%PlugMalf* Choke%Present_HydraulicChoke1Plug *CHOOKE(1)%AreaChoke) ! Initialised in Choke Startup
CHOOKE(2)%AreaChoke=CHOOKE(2)%AreaChoke+(CHOOKE(2)%WashoutMalf*Choke%HydraulicChoke2WashoutCoef*Choke%ChokeAreaFullyOpen/144.0) ! Initialised in Choke Startup
CHOOKE(2)%AreaChoke=CHOOKE(2)%AreaChoke-(CHOOKE(2)%PlugMalf* Choke%Present_HydraulicChoke2Plug *CHOOKE(2)%AreaChoke) ! Initialised in Choke Startup
!write(*,*) 'CHOOKE(2)%WashoutMalf , CHOOKE(2)%AreaChoke=' ,CHOOKE(2)%WashoutMalf , CHOOKE(2)%AreaChoke
CHOOKE(1)%AreaChokeFinal= CHOOKE(1)%AreaChoke
CHOOKE(2)%AreaChokeFinal= CHOOKE(2)%AreaChoke
! 144: ft^2 to in^2
CALL SetHydraulicChock1(100 - nint((CHOOKE(1)%AreaChokeFinal/(Choke%ChokeAreaFullyOpen/144.))*100)) ! for manifold valve
CALL SetHydraulicChock2(100 - nint((CHOOKE(2)%AreaChokeFinal/(Choke%ChokeAreaFullyOpen/144.))*100)) ! for manifold valve
!write(*,*) 'CHOOKE(1)%PercentClose=' , CHOOKE(1)%PercentClose ! close percent 0 to 100
!write(*,*) 'ChokePosition=' , ChokePosition ! close position 0 to 10 for display
!write(*,*) 'CHOOKE(1)%AreaChokeFinal=' , CHOOKE(1)%AreaChokeFinal ! Open Area (in^2) with clearance
!write(*,*) '(ChokeAreaFullyOpen/144.)=' , (ChokeAreaFullyOpen/144.)
!write(*,*) 'valve value=' , 100 - nint((CHOOKE(1)%AreaChokeFinal/(ChokeAreaFullyOpen/144.))*100) ! percent close 0 to 100 with clearance
!write(*,*) 'Valve(33)%Status=' , Valve(33)%Status ! T : open , F: close
! =================== calculating Area
!AreaChoke= CHOOKE(1)%AreaChoke !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< badan moteghayer 1 ya 2 shavad
! fully open area is 123/64 in^2 = 0.01334635 ft^2
CHOOKE(1)%AreaChoke=CHOOKE(1)%AreaChoke+(CHOOKE(1)%WashoutMalf*Choke%HydraulicChoke1WashoutCoef*Choke%ChokeAreaFullyOpen/144.0) ! Initialised in Choke Startup
!write(*,*) 'CHOOKE(1)%WashoutMalf , CHOOKE(1)%AreaChoke=' ,CHOOKE(1)%WashoutMalf , CHOOKE(1)%AreaChoke
CHOOKE(1)%AreaChoke=CHOOKE(1)%AreaChoke-(CHOOKE(1)%PlugMalf* Choke%Present_HydraulicChoke1Plug *CHOOKE(1)%AreaChoke) ! Initialised in Choke Startup
CHOOKE(2)%AreaChoke=CHOOKE(2)%AreaChoke+(CHOOKE(2)%WashoutMalf*Choke%HydraulicChoke2WashoutCoef*Choke%ChokeAreaFullyOpen/144.0) ! Initialised in Choke Startup
CHOOKE(2)%AreaChoke=CHOOKE(2)%AreaChoke-(CHOOKE(2)%PlugMalf* Choke%Present_HydraulicChoke2Plug *CHOOKE(2)%AreaChoke) ! Initialised in Choke Startup
!write(*,*) 'CHOOKE(2)%WashoutMalf , CHOOKE(2)%AreaChoke=' ,CHOOKE(2)%WashoutMalf , CHOOKE(2)%AreaChoke
CHOOKE(1)%AreaChokeFinal= CHOOKE(1)%AreaChoke
CHOOKE(2)%AreaChokeFinal= CHOOKE(2)%AreaChoke
! 144: ft^2 to in^2
CALL SetHydraulicChock1(100 - nint((CHOOKE(1)%AreaChokeFinal/(Choke%ChokeAreaFullyOpen/144.))*100)) ! for manifold valve
CALL SetHydraulicChock2(100 - nint((CHOOKE(2)%AreaChokeFinal/(Choke%ChokeAreaFullyOpen/144.))*100)) ! for manifold valve
!write(*,*) 'CHOOKE(1)%PercentClose=' , CHOOKE(1)%PercentClose ! close percent 0 to 100
!write(*,*) 'ChokePosition=' , ChokePosition ! close position 0 to 10 for display
!write(*,*) 'CHOOKE(1)%AreaChokeFinal=' , CHOOKE(1)%AreaChokeFinal ! Open Area (in^2) with clearance
!write(*,*) '(ChokeAreaFullyOpen/144.)=' , (ChokeAreaFullyOpen/144.)
!write(*,*) 'valve value=' , 100 - nint((CHOOKE(1)%AreaChokeFinal/(ChokeAreaFullyOpen/144.))*100) ! percent close 0 to 100 with clearance
!write(*,*) 'Valve(33)%Status=' , Valve(33)%Status ! T : open , F: close
! write(*,*) 'AreaChoke:',AreaChoke

!===========================================================================
! MUD PUMP STROKES
! & TOTAL STROKE- CHOKE CONTROL PANEL
!===========================================================================
! =================== calculating Area
!AreaChoke= CHOOKE(1)%AreaChoke !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< badan moteghayer 1 ya 2 shavad
! write(*,*) 'AreaChoke:',AreaChoke

!===========================================================================
! MUD PUMP STROKES
! & TOTAL STROKE- CHOKE CONTROL PANEL
!===========================================================================
!************************* IN MUD SYSTEM MODULE*************************
!************************* IN MUD SYSTEM MODULE*************************
end subroutine CHOKE_MainBody

end module ChokeModule

+ 2
- 2
Equipments/Drawworks/Drawworks_INPUTS.f90 View File

@@ -49,8 +49,8 @@ subroutine Drawworks_Inputs
!>>> Warnings
Drawworks%CrownCollision = CrownCollision
Drawworks%FloorCollision = FloorCollision
Drawworks%CrownCollision = Warmings%CrownCollision
Drawworks%FloorCollision = Warmings%FloorCollision


+ 1
- 1
Equipments/MudSystem/Kick_Influx.f90 View File

@@ -204,7 +204,7 @@ subroutine ShoeLostSub ! is called in subroutine CirculationCodeSelect
endif
if (UndergroundBlowout == .false.) MudSystem%ShoeLost= .false.
if (Warmings%UndergroundBlowout == .false.) MudSystem%ShoeLost= .false.


+ 3
- 3
Equipments/Pumps/Pumps_Inputs.f90 View File

@@ -29,7 +29,7 @@ subroutine Pumps_Inputs
!PUMP(1)%PowerFailMalf = 0 !??????? motaghayere voroudi (Pump1 Malfunction ----> Power Failure) !dar CPumpProblemsVariables meghdardehi mishavad
PUMP(1)%Failure = Pump1Failure !(Pump1 Warning ----> Failure)
PUMP(1)%Failure = Warmings%Pump1Failure !(Pump1 Warning ----> Failure)
PUMP(1)%N_new = PUMP(1)%Throttle
@@ -60,7 +60,7 @@ subroutine Pumps_Inputs
!PUMP(2)%PowerFailMalf = 0 !??????? motaghayere voroudi (Pump2 Malfunction ----> Power Failure) !dar CPumpProblemsVariables meghdardehi mishavad
PUMP(2)%Failure = Pump2Failure !(Pump2 Warning ----> Failure)
PUMP(2)%Failure = Warmings%Pump2Failure !(Pump2 Warning ----> Failure)
PUMP(2)%N_new = PUMP(2)%Throttle
@@ -89,7 +89,7 @@ subroutine Pumps_Inputs
!PUMP(3)%PowerFailMalf = 0 !??????? motaghayere voroudi (Pump3 Malfunction ----> Power Failure) !dar CPumpProblemsVariables meghdardehi mishavad
PUMP(3)%Failure = Pump3Failure !(Pump1 Warning ----> Failure)
PUMP(3)%Failure = Warmings%Pump3Failure !(Pump1 Warning ----> Failure)
PUMP(3)%N_new = PUMP(3)%Throttle


BIN
View File


+ 0
- 515
Equipments/TorqueDrag/TD_DrillingSubs/MeshGeneration_FluidModule.f90 View File

@@ -1,515 +0,0 @@
subroutine MeshGeneration_FluidModule

Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_StringConnectionData
Use GeoElements_FluidModule
Use CPumpsVariables
Use CStringConfigurationVariables
Use CBopStackVariables
!Use Drawworks_VARIABLES , only: Drawworks

implicit none

Integer :: ii , jj , semijj , kk , k , m , s
Integer :: ElementsCount , StringConfigCount
REAL(8) :: mm , nn , dl , StartAngle , EndAngle
REAL(8) :: A(30) !?????????10
REAL(8) :: TD_ElementLength
A = 0.d0
A(1) = BopStackSpecification%AboveAnnularHeight ! WellHead[ft]
jj = 1

!====================================================
! Mesh Generation of DrillStem Components
!====================================================
!TD_String%StringConfigurationCount = StringConfigurationCount !???????????
StringConfigCount = TD_String%StringConfigurationCount
if (allocated(F_String)) Deallocate(F_String)
if (TD_DrillStem(1)%ComponentType==0) then
Allocate (F_String(StringConfigCount-1))
else
Allocate (F_String(StringConfigCount))
end if
if (TD_DrillStem(1)%ComponentType==0) then
ElementsCount = 1
Do ii=1,(StringConfigCount-1)
F_String(ii)%ID = TD_DrillStem(ii+1)%Id*12.d0 ![inch]
F_String(ii)%OD = TD_DrillStem(ii+1)%Od*12.d0 ![inch]
F_String(ii)%FirstElement = ElementsCount+1
F_String(ii)%LastElement = F_String(ii)%FirstElement+(TD_DrillStem(ii+1)%Numbs-1)
F_String(ii)%ElType = TD_DrillStem(ii+1)%ComponentType
ElementsCount = F_String(ii)%LastElement
End Do
StringConfigCount = StringConfigCount-1
else
ElementsCount = 0
Do ii=1,StringConfigCount
F_String(ii)%ID = TD_DrillStem(ii)%Id*12.d0 ![inch]
F_String(ii)%OD = TD_DrillStem(ii)%Od*12.d0 ![inch]
F_String(ii)%FirstElement = ElementsCount+1
F_String(ii)%LastElement = F_String(ii)%FirstElement+(TD_DrillStem(ii)%Numbs-1)
F_String(ii)%ElType = TD_DrillStem(ii)%ComponentType
ElementsCount = F_String(ii)%LastElement
End Do
end if
Do ii=1,StringConfigCount
F_String(ii)%TopDepth = TD_DrillStems(F_String(ii)%LastElement)%TopDepthIni ![ft]
F_String(ii)%DownDepth = TD_DrillStems(F_String(ii)%FirstElement)%DownDepthIni ![ft]
if (F_String(ii)%DownDepth>A(1)) then
jj = jj+1
A(jj) = F_String(ii)%DownDepth
end if
End Do
!=========> Removed Volume Calculation in DrillStem
TD_ElementLength = F_String(StringConfigCount)%DownDepth-F_String(StringConfigCount)%TopDepth
if ( StringConfigCount==TD_Vol%PreCount ) then
if ( TD_Vol%PreElementLength>TD_ElementLength ) then
TD_Vol%RemoveVolume = (TD_Vol%PreElementLength-TD_ElementLength)*((pi*((F_String(StringConfigCount)%ID/12.d0)**2))/4.d0) ![ft^3]
else
TD_Vol%RemoveVolume = 0.d0
end if
else if ( StringConfigCount<TD_Vol%PreCount ) then
TD_Vol%RemoveVolume = TD_Vol%PreElementVolume
else
TD_Vol%RemoveVolume = 0.d0
end if
TD_Vol%PreCount = StringConfigCount
TD_Vol%PreElementVolume = TD_ElementLength*(((pi*((F_String(StringConfigCount)%ID/12.d0)**2))/4.d0)) ![ft^3]
TD_Vol%PreElementLength = TD_ElementLength
!print*, 'TD_Vol%RemoveVolume=' , TD_Vol%RemoveVolume
!====================================================
! Mesh Generation of Annulus Components
!====================================================
if (TD_Casing(1)%Length>0.) then
jj = jj+1
A(jj) = TD_Casing(1)%DownDepth
OD_Annulus(4)%StartMD = TD_Casing(1)%DownDepth ![ft]
OD_Annulus(4)%EndMD = TD_Casing(1)%TopDepth ![ft]
OD_Annulus(4)%ODValue = TD_Casing(1)%Id*12.d0 ![inch]
!else
! OD_Annulus(4)%StartMD = 0. !????????????????????
! OD_Annulus(4)%EndMD = OD_Annulus(4)%StartMD !????????????????????
! OD_Annulus(4)%ODValue = TD_Casing(1)%Id !????????????????????
end if
if (TD_Liner(1)%Length>0.) then
jj = jj+1
A(jj) = TD_Liner(1)%DownDepth
OD_Annulus(3)%StartMD = TD_Liner(1)%DownDepth ![ft]
OD_Annulus(3)%EndMD = TD_Liner(1)%TopDepth ![ft]
OD_Annulus(3)%ODValue = TD_Liner(1)%Id*12.d0 ![inch]
else
OD_Annulus(3)%StartMD = TD_Casing(1)%DownDepth !????????????????????
OD_Annulus(3)%EndMD = OD_Annulus(3)%StartMD !????????????????????
OD_Annulus(3)%ODValue = OD_Annulus(4)%ODValue !????????????????????
end if
if (TD_OpenHole(1)%Length>0.) then
!jj = jj+1
!A(jj) = TD_OpenHole(1)%DownDepth
OD_Annulus(2)%StartMD = TD_OpenHole(1)%DownDepth ![ft]
OD_Annulus(2)%EndMD = TD_OpenHole(1)%TopDepth ![ft]
OD_Annulus(2)%ODValue = TD_OpenHole(1)%Id*12.d0 ![inch]
do ii = 1,TD_WellGeneral%WellIntervalsCount-1
if ( TD_WellGeo(ii)%DownDepth>TD_OpenHole(1)%TopDepth ) then
jj = jj+1
A(jj) = TD_WellGeo(ii)%DownDepth
end if
end do
else
OD_Annulus(2)%StartMD = TD_Liner(1)%DownDepth !??????????????
OD_Annulus(2)%EndMD = OD_Annulus(2)%StartMD !??????????????
OD_Annulus(2)%ODValue = OD_Annulus(3)%ODValue !??????????????
end if
if (TD_ROPHole(1)%Length>0.) then
jj = jj+1
A(jj) = TD_ROPHole(1)%DownDepth
OD_Annulus(1)%StartMD = TD_ROPHole(1)%DownDepth ![ft]
OD_Annulus(1)%EndMD = TD_ROPHole(1)%TopDepth ![ft]
OD_Annulus(1)%ODValue = TD_ROPHole(1)%Id*12.d0 ![inch]
else
OD_Annulus(1)%StartMD = TD_OpenHole(1)%DownDepth !??????????????
OD_Annulus(1)%EndMD = OD_Annulus(1)%StartMD !??????????????
OD_Annulus(1)%ODValue = OD_Annulus(2)%ODValue !??????????????
end if
!print*, 'A(jj)2=' , A
!====================================================
! Mesh Generation of Well
!====================================================
!Do ii=2,TD_WellGeneral%WellIntervalsCount-1
! jj = jj+1
! A(jj) = TD_WellGeo(ii)%TopDepth
!End Do
!print*, 'A(jj)3=' , A
!print*, 'A=' , A
!print*, 'jj=' , jj
semijj = jj
!print*, 'semijj=' , semijj
Do ii=1,jj
do kk = 1,jj
if ( A(ii)==A(KK) .and. ii/=kk .and. A(KK)/=0. ) then !A(KK)/=0. ?????????????????
!print*, 'indoA=' , semijj , ii , kk , A(KK) , A(ii)
A(kk) = 0.d0
semijj = semijj-1
!print*, 'indoA2=' , semijj , ii , kk , A(KK) , A(ii)
end if
end do
End Do
!print*, 'semijj2=' , semijj
jj = semijj
!print*, 'jj2=' , jj
!print*, 'AA=' , A
if (allocated(TDGeo%MD)) Deallocate(TDGeo%MD)
Allocate (TDGeo%MD(jj))
TDGeo%MD = 0.0d0
Do ii=1,jj
TDGeo%MD(ii)=A(1)
do kk = 2,jj
if (A(KK)>TDGeo%MD(ii)) then
TDGeo%MD(ii) = A(kk)
k=kk
end if
end do
!!TDGeo%MD(ii) = MAXVAL(A)
!!kk = MAXLOC(A)
!!A(kk) = 0.0d0
A(k) = 0.0d0
End Do

!====================================================
! Geometrical Intervals Configuration (for fluid module)
!====================================================
if (allocated(F_Interval)) Deallocate(F_Interval)
Allocate (F_Interval(jj-1+StringConfigCount+1))
!F_Interval = 0.0d0
F_Counts%IntervalsTotalCounts = jj-1+StringConfigCount+1
!=========> String Intervals Configuration
! pump output
ii = 1
F_Interval(ii)%Number = ii
F_Interval(ii)%GeoType = 0
F_Interval(ii)%EndDepth = F_String(StringConfigCount)%TopDepth
F_Interval(ii)%StartDepth = F_String(StringConfigCount)%TopDepth-265.d0
F_Interval(ii)%ID = 0.0d0
F_Interval(ii)%OD = dmax1(PumpsSpecification%MudPump1Output,PumpsSpecification%MudPump2Output) !???????????
F_Interval(ii)%HydDiameter = F_Interval(ii)%OD ![inch]
F_Interval(ii)%Volume = ((pi*((F_Interval(ii)%OD/12.d0)**2))/4.d0) &
*(F_Interval(ii)%EndDepth-F_Interval(ii)%StartDepth)*7.48051948d0 ![gal-us]
Do ii=2,StringConfigCount+1
F_Interval(ii)%Number = ii
F_Interval(ii)%GeoType = 0
F_Interval(ii)%EndDepth = F_String(StringConfigCount+1-ii+1)%DownDepth
F_Interval(ii)%StartDepth = F_String(StringConfigCount+1-ii+1)%TopDepth
F_Interval(ii)%ID = 0.0d0
F_Interval(ii)%OD = F_String(StringConfigCount+1-ii+1)%ID
F_Interval(ii)%HydDiameter = F_Interval(ii)%OD
F_Interval(ii)%Volume = ((pi*((F_Interval(ii)%OD/12.d0)**2))/4.d0) &
*(F_Interval(ii)%EndDepth-F_Interval(ii)%StartDepth)*7.48051948d0 ![gal-us]
End Do
F_Counts%StringIntervalCounts = StringConfigCount+1
!if (F_String(1)%ElType==0) then !bit
! !F_Interval(StringConfigCount)%Number = ii
! F_Interval(StringConfigCount)%EndDepth = F_String(1)%DownDepth
! F_Interval(StringConfigCount)%StartDepth = F_String(1)%TopDepth
! F_Interval(StringConfigCount)%ID = 0.0d0
! F_Interval(StringConfigCount)%OD = F_String(1)%OD
! F_Interval(StringConfigCount)%HydDiameter = F_Interval(StringConfigCount)%OD
! F_Interval(StringConfigCount)%Volume = ((pi*((F_Interval(StringConfigCount)%OD/12.)**2))/4.)*(F_Interval(StringConfigCount)%EndDepth-F_Interval(StringConfigCount)%StartDepth)*7.48051948
!end if

!=========> Annulus Intervals Configuration
F_Counts%BottomHoleIntervalCounts = 0
F_Counts%AnnulusIntervalCounts = 0
Do ii=(StringConfigCount+2),(jj-1+StringConfigCount+1)
F_Interval(ii)%Number = ii
F_Interval(ii)%StartDepth = TDGeo%MD(ii-StringConfigCount-1)
F_Interval(ii)%EndDepth = TDGeo%MD(ii+1-StringConfigCount-1)
if (F_Interval(ii)%EndDepth>=F_Interval(StringConfigCount+1)%EndDepth) then
F_Interval(ii)%GeoType = 1
F_Counts%BottomHoleIntervalCounts = F_Counts%BottomHoleIntervalCounts+1
else
F_Interval(ii)%GeoType = 2
F_Counts%AnnulusIntervalCounts = F_Counts%AnnulusIntervalCounts+1
end if
End Do
!====================================================
! Diameter Calculation of Annulus Intervals
!====================================================
!=========> OD
m = 1
Do ii = (StringConfigCount+2),F_Counts%IntervalsTotalCounts
do kk = m,4
if (F_Interval(ii)%StartDepth<=OD_Annulus(kk)%StartMD .and. F_Interval(ii)%EndDepth>=OD_Annulus(kk)%EndMD) then
F_Interval(ii)%OD = OD_Annulus(kk)%ODValue
m = kk
exit
end if
end do
End Do
!=========> ID
m = 1
Do ii = (StringConfigCount+2),F_Counts%IntervalsTotalCounts
do kk = m,StringConfigCount
if (F_Interval(ii)%StartDepth<=F_String(kk)%DownDepth .and. F_Interval(ii)%EndDepth>=F_String(kk)%TopDepth) then
F_Interval(ii)%ID = F_String(kk)%OD
m = kk
exit
else
F_Interval(ii)%ID = 0.0d0
end if
end do
F_Interval(ii)%HydDiameter = F_Interval(ii)%OD-F_Interval(ii)%ID
F_Interval(ii)%Volume = ((pi*(((F_Interval(ii)%OD/12.d0)**2)-((F_Interval(ii)%ID/12.d0)**2)))/4.d0) &
*abs(F_Interval(ii)%EndDepth-F_Interval(ii)%StartDepth)*7.48051948d0 ![gal-us]
End Do
!print*, 'StringConfigCount=' , StringConfigCount
!print*, 'F_Counts%IntervalsTotalCounts=' , F_Counts%IntervalsTotalCounts
!print*, 'F_Counts%StringIntervalCounts=' , F_Counts%StringIntervalCounts
!print*, 'F_Counts%BottomHoleIntervalCounts=' , F_Counts%BottomHoleIntervalCounts
!print*, 'F_Counts%AnnulusIntervalCounts=' , F_Counts%AnnulusIntervalCounts
!Do ii=1,(F_Counts%IntervalsTotalCounts)
! print*, 'Number/' , 'StartDepth/' , 'EndDepth/'
! print*, 'ID/' , 'OD/' , 'GeoType/'
! print*, 'HydDiameter/' , 'Volume/'
! print*, F_Interval(ii)%Number , F_Interval(ii)%StartDepth , F_Interval(ii)%EndDepth
! print*, F_Interval(ii)%ID , F_Interval(ii)%OD , F_Interval(ii)%GeoType
! print*, F_Interval(ii)%HydDiameter , F_Interval(ii)%Volume
!End Do
!====================================================
! TVD Calculation of Geo Intervals
!====================================================
!=========> Out of Well Intervals
F_Interval(1)%StartTVD = 0.0d0 !??????????????
F_Interval(1)%EndTVD = -TD_StConn%ConnectionHeight
F_Interval(1)%StartAngle = 0.d0 !???????????????????????
F_Interval(1)%EndAngle = 0.d0 !???????????????????????
F_Counts%OutOfWellIntervalCounts = 1
Do ii= 2 , StringConfigCount+1
if ( F_Interval(ii)%StartDepth<=0.d0 ) then
F_Interval(ii)%StartTVD = F_Interval(ii)%StartDepth
F_Interval(ii)%StartAngle = 0.0d0
end if
if ( F_Interval(ii)%EndDepth<=0.d0 ) then
F_Interval(ii)%EndTVD = F_Interval(ii)%EndDepth
F_Interval(ii)%EndAngle = 0.0d0
F_Counts%OutOfWellIntervalCounts = F_Counts%OutOfWellIntervalCounts+1
end if
End Do
!=========>
if (allocated(TDGeo%TVD)) Deallocate(TDGeo%TVD)
Allocate (TDGeo%TVD(jj))
if (allocated(TDGeo%Angle)) Deallocate(TDGeo%Angle)
Allocate (TDGeo%Angle(jj))
TDGeo%TVD(1) = TD_WellGeneral%WellTotalVerticalLength !?????
!print*, 'TD_WellGeneral%WellTotalVerticalLength=' ,TD_WellGeneral%WellTotalVerticalLength
TDGeo%TVD(jj) = BopStackSpecification%AboveAnnularHeight ! WellHead[ft] !0.d0 ????????????????
k = 1
mm = 0.d0
nn = 0.d0
EndAngle = TD_WellGeo(1)%StartAngle !???????????????
TDGeo%Angle(jj) = EndAngle
Do ii = jj-1,1,-1 !???1or2
do kk = k, TD_WellGeneral%WellIntervalsCount
StartAngle = EndAngle
if ( TDGeo%MD(ii)>TD_WellGeo(kk)%TopDepth ) then
if ( TDGeo%MD(ii)>TD_WellGeo(kk)%DownDepth ) then
dl = TD_WellGeo(kk)%DownDepth-nn ![ft]
nn = TD_WellGeo(kk)%DownDepth
if ( TD_WellGeo(kk)%HoleType==0 ) then
EndAngle = StartAngle
!print*, 'StartAngle1=' ,ii , kk, StartAngle
!print*, 'EndAngle1=' ,ii , kk, EndAngle
TDGeo%TVD(ii) = mm+(dl*cos(TD_WellGeo(kk)%StartAngle)) ![ft]
TDGeo%Angle(ii) = EndAngle
!print*, 'TDGeo%TVD(ii)1=' ,ii , kk, TDGeo%TVD(ii)
else if ( TD_WellGeo(kk)%HoleType==1 ) then
EndAngle = StartAngle+(dl/TD_WellGeo(kk)%RCurvature) !?????????????????
!print*, 'StartAngle2=' ,ii , kk, StartAngle
!print*, 'EndAngle2=' ,ii , kk, EndAngle
TDGeo%TVD(ii) = mm+(TD_WellGeo(kk)%RCurvature*sin(abs(EndAngle)-abs(StartAngle))*cos(abs(StartAngle)))-(TD_WellGeo(kk)%RCurvature*(1.-cos(abs(EndAngle)-abs(StartAngle)))*sin(abs(StartAngle)))
!TDGeo%TVD(ii) = mm+(TD_WellGeo(kk)%RCurvature*sin(abs(EndAngle)-abs(StartAngle)))
TDGeo%Angle(ii) = EndAngle
!print*, 'TDGeo%TVD(ii)2=' , ii , kk, TDGeo%TVD(ii)
else if ( TD_WellGeo(kk)%HoleType==2 ) then
EndAngle = StartAngle-(dl/TD_WellGeo(kk)%RCurvature) !?????????????????
!print*, 'StartAngle22=' ,ii , kk, StartAngle
!print*, 'EndAngle22=' ,ii , kk, EndAngle
TDGeo%TVD(ii) = mm+(TD_WellGeo(kk)%RCurvature*sin(abs(abs(EndAngle)-abs(StartAngle)))*cos(abs(StartAngle)))+(TD_WellGeo(kk)%RCurvature*(1.-cos(abs(abs(EndAngle)-abs(StartAngle))))*sin(abs(StartAngle)))
!TDGeo%TVD(ii) = mm+(TD_WellGeo(kk)%RCurvature*sin(abs(EndAngle)-abs(StartAngle)))
TDGeo%Angle(ii) = EndAngle
!print*, 'TDGeo%TVD(ii)22=' , ii , kk, TDGeo%TVD(ii)
end if
mm = TDGeo%TVD(ii)
else
dl = TDGeo%MD(ii)-nn
nn = TDGeo%MD(ii)
if ( TD_WellGeo(kk)%HoleType==0 ) then
EndAngle = StartAngle
!print*, 'StartAngle3=' ,ii , kk, StartAngle
!print*, 'EndAngle3=' ,ii , kk, EndAngle
TDGeo%TVD(ii) = mm+(dl*cos(TD_WellGeo(kk)%StartAngle))
TDGeo%Angle(ii) = EndAngle
!print*, 'TDGeo%TVD(ii)3=' ,ii , kk, TDGeo%TVD(ii)
else if ( TD_WellGeo(kk)%HoleType==1 ) then
EndAngle = StartAngle+(dl/TD_WellGeo(kk)%RCurvature) !???????????????????
!print*, 'StartAngle4=' ,ii , kk, StartAngle
!print*, 'EndAngle4=' ,ii , kk, EndAngle
TDGeo%TVD(ii) = mm+(TD_WellGeo(kk)%RCurvature*sin(abs(EndAngle)-abs(StartAngle))*cos(abs(StartAngle)))-(TD_WellGeo(kk)%RCurvature*(1.-cos(abs(EndAngle)-abs(StartAngle)))*sin(abs(StartAngle)))
TDGeo%Angle(ii) = EndAngle
!TDGeo%TVD(ii) = mm+(TD_WellGeo(kk)%RCurvature*sin(abs(EndAngle)-abs(StartAngle)))
!print*, 'mm=' ,mm
!print*, 'TDGeo%TVD(ii)4=' ,ii , kk, TDGeo%TVD(ii)
else if ( TD_WellGeo(kk)%HoleType==2 ) then
EndAngle = StartAngle-(dl/TD_WellGeo(kk)%RCurvature) !???????????????????
!print*, 'StartAngle44=' ,ii , kk, StartAngle
!print*, 'EndAngle44=' ,ii , kk, EndAngle
TDGeo%TVD(ii) = mm+(TD_WellGeo(kk)%RCurvature*sin(abs(abs(EndAngle)-abs(StartAngle)))*cos(abs(StartAngle)))+(TD_WellGeo(kk)%RCurvature*(1.-cos(abs(abs(EndAngle)-abs(StartAngle))))*sin(abs(StartAngle)))
TDGeo%Angle(ii) = EndAngle
!TDGeo%TVD(ii) = mm+(TD_WellGeo(kk)%RCurvature*sin(abs(EndAngle)-abs(StartAngle)))
!print*, 'mm=' ,mm , (TD_WellGeo(kk)%RCurvature*sin(abs(abs(EndAngle)-abs(StartAngle)))*cos(abs(StartAngle)))+(TD_WellGeo(kk)%RCurvature*(1.-cos(abs(abs(EndAngle)-abs(StartAngle))))*sin(abs(StartAngle)))
!print*, 'TDGeo%TVD(ii)44=' ,ii , kk, TDGeo%TVD(ii)
end if
mm = TDGeo%TVD(ii)
k = kk
exit
end if
end if
end do
End Do
!if (F_Counts%OutOfWellIntervalCounts==1) then
! s = 2
!else
! s = F_Counts%OutOfWellIntervalCounts
!end if
!
Do ii = (F_Counts%OutOfWellIntervalCounts+1),F_Counts%IntervalsTotalCounts
do kk = jj,1,-1
if ( F_Interval(ii)%StartDepth==TDGeo%MD(kk) ) then
F_Interval(ii)%StartTVD = TDGeo%TVD(kk) ![ft]
F_Interval(ii)%StartAngle = TDGeo%Angle(kk) ![rad]
end if
if ( F_Interval(ii)%EndDepth==TDGeo%MD(kk) ) then
F_Interval(ii)%EndTVD = TDGeo%TVD(kk) ![ft]
F_Interval(ii)%EndAngle = TDGeo%Angle(kk) ![rad]
end if
end do
End Do
!Do ii=1,(F_Counts%IntervalsTotalCounts)
! print*, 'F_Interval(ii)%StartTVD=' , ii , F_Interval(ii)%StartTVD
! print*, 'F_Interval(ii)%EndTVD=' , ii , F_Interval(ii)%EndTVD
! print*, 'F_Interval(ii)%StartAngle=' , ii , F_Interval(ii)%StartAngle
! print*, 'F_Interval(ii)%EndAngle=' , ii , F_Interval(ii)%EndAngle
!end do
!
!
!Do ii=1,TD_WellGeneral%WellIntervalsCount
! print*, 'TD_WellGeo(kk)%TopDepth=' , ii , TD_WellGeo(ii)%TopDepth
! print*, 'TD_WellGeo(kk)%DownDepth=' , ii , TD_WellGeo(ii)%DownDepth
! print*, 'TD_WellGeo(kk)%HoleType=' , ii , TD_WellGeo(ii)%HoleType
! print*, 'TD_WellGeo(kk)%RCurvature=' , ii , TD_WellGeo(ii)%RCurvature
! print*, 'TD_WellGeo(kk)%EndAngle=' , ii , TD_WellGeo(ii)%EndAngle
! print*, 'TD_WellGeo(kk)%StartAngle=' , ii , TD_WellGeo(ii)%StartAngle
!end do
end subroutine

+ 0
- 314
Equipments/TorqueDrag/TD_DrillingSubs/TD_AddComponents.f90 View File

@@ -1,314 +0,0 @@
subroutine TD_AddComponents
Use CStringConfigurationVariables
use UnitySignalVariables
! Use CStringUpdateVariables
! Use CSafetyValveEnumVariables
! Use CIbopEnumVariables
! Use COperationConditionEnumVariables
! Use CKellyConnectionEnumVariables
use COperationScenariosVariables!, only: Get_ElevatorConnection
! Use CElevatorConnectionEnumVariables
Use CHoistingVariables
! Use CTdsConnectionModesEnumVariables
! Use CTdsElevatorModesEnumVariables
Use TD_DrillStemComponents
Use TD_WellGeometry
Use TD_GeneralData
Use TD_StringConnectionData
implicit none
integer :: i , kk , TD_NumOfAddedComponents
!====================================================
! Add Single
!====================================================
if ( Get_StringUpdate() == STRING_UPDATE_ADD_SINGLE ) then
kk = 0
Do i= TD_String%DrillStemComponentsNumbs , 1 , -1
if (TD_DrillStems(i)%ComponentType==3) then
kk = i
exit
end if
End Do
! DrillStems Array:
TD_NumOfAddedComponents = 1
Do i= (TD_String%DrillStemComponentsNumbs+1) , (TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents)
TD_DrillStems(i)%ComponentType = 3
TD_DrillStems(i)%Id = TD_DrillStems(kk)%Id
TD_DrillStems(i)%Od = TD_DrillStems(kk)%Od
TD_DrillStems(i)%Area = (pi*((TD_DrillStems(i)%Od**2)-(TD_DrillStems(i)%Id**2)))/4.d0
TD_DrillStems(i)%RtoolJoint = TD_DrillStems(i)%Od*1.3d0/2.d0
TD_DrillStems(i)%ToolJointRange = TD_String%ToolJointRange
TD_DrillStems(i)%Length = TD_DrillStems(kk)%LengthIni
TD_DrillStems(i)%LengthIni = TD_DrillStems(kk)%LengthIni
TD_DrillStems(i)%WeightperLength = TD_DrillStems(kk)%WeightperLength
TD_DrillStems(i)%Weight = TD_DrillStems(i)%WeightperLength*TD_DrillStems(i)%Length
TD_DrillStems(i)%Density = TD_DrillStems(kk)%Density
TD_DrillStems(i)%ElasticModule = TD_DrillStems(kk)%ElasticModule
End Do
TD_String%DrillStemComponentsNumbs = TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents
! DrillStem Array:
i = TD_String%StringConfigurationCount+1
TD_DrillStem(i)%ComponentType = 3
TD_DrillStem(i)%Numbs = 1
TD_DrillStem(i)%Id = TD_DrillStems(kk)%Id ! [ft]
TD_DrillStem(i)%Od = TD_DrillStems(kk)%Od ! [ft]
TD_DrillStem(i)%Length = TD_DrillStems(kk)%LengthIni
TD_DrillStem(i)%WeightperLength = TD_DrillStems(kk)%WeightperLength
TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length
TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount+1
Call Set_StringUpdate(STRING_UPDATE_NEUTRAL)
end if
!====================================================
! Add Stand
!====================================================
if ( Get_StringUpdate() == STRING_UPDATE_ADD_STAND ) then
kk = 0
Do i= TD_String%DrillStemComponentsNumbs , 1 , -1
if (TD_DrillStems(i)%ComponentType==3) then
kk = i
exit
end if
End Do
! DrillStems Array:
TD_NumOfAddedComponents = 3
Do i= (TD_String%DrillStemComponentsNumbs+1) , (TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents)
TD_DrillStems(i)%ComponentType = 3
TD_DrillStems(i)%Id = TD_DrillStems(kk)%Id
TD_DrillStems(i)%Od = TD_DrillStems(kk)%Od
TD_DrillStems(i)%Area = (pi*((TD_DrillStems(i)%Od**2)-(TD_DrillStems(i)%Id**2)))/4.0d0
TD_DrillStems(i)%RtoolJoint = TD_DrillStems(i)%Od*1.30d0/2.0d0
TD_DrillStems(i)%ToolJointRange = TD_String%ToolJointRange
TD_DrillStems(i)%Length = TD_DrillStems(kk)%LengthIni
TD_DrillStems(i)%LengthIni = TD_DrillStems(kk)%LengthIni
TD_DrillStems(i)%WeightperLength = TD_DrillStems(kk)%WeightperLength
TD_DrillStems(i)%Weight = TD_DrillStems(i)%WeightperLength*TD_DrillStems(i)%Length
TD_DrillStems(i)%Density = TD_DrillStems(kk)%Density
TD_DrillStems(i)%ElasticModule = TD_DrillStems(kk)%ElasticModule
End Do
TD_String%DrillStemComponentsNumbs = TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents
! DrillStem Array:
i = TD_String%StringConfigurationCount+1
TD_DrillStem(i)%ComponentType = 3
TD_DrillStem(i)%Numbs = 3
TD_DrillStem(i)%Id = TD_DrillStems(kk)%Id ! [ft]
TD_DrillStem(i)%Od = TD_DrillStems(kk)%Od ! [ft]
TD_DrillStem(i)%Length = TD_DrillStems(kk)%LengthIni
TD_DrillStem(i)%WeightperLength = TD_DrillStems(kk)%WeightperLength
TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length
TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount+1
Call Set_StringUpdate(STRING_UPDATE_NEUTRAL)
end if
!====================================================
! Add IBOP
!====================================================
!if ( Get_Ibop()==IBOP_INSTALL ) then
! TD_Count%IBOPNewAdd = 1
!else
! TD_Count%IBOPNewAdd = 0
! TD_Count%IBOPOldAdd = 0
! end if
if ( Get_Ibop()==IBOP_INSTALL .and. TD_Count%IBOPOldAdd==0 ) then
kk = 0
Do i= TD_String%DrillStemComponentsNumbs , 1 , -1
if (TD_DrillStems(i)%ComponentType==3) then
kk = i
exit
end if
End Do
! DrillStems Array:
TD_NumOfAddedComponents = 1
Do i= (TD_String%DrillStemComponentsNumbs+1) , (TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents)
TD_DrillStems(i)%ComponentType = 5
TD_DrillStems(i)%Id = TD_DrillStems(kk)%Id
TD_DrillStems(i)%Od = TD_DrillStems(kk)%RtoolJoint
TD_DrillStems(i)%Area = (pi*((TD_DrillStems(i)%Od**2)-(TD_DrillStems(i)%Id**2)))/4.0d0
TD_DrillStems(i)%RtoolJoint = TD_DrillStems(kk)%RtoolJoint
TD_DrillStems(i)%ToolJointRange = 0.0d0
TD_DrillStems(i)%Length = TD_StConn%IBOPLength ! [ft]
TD_DrillStems(i)%LengthIni = TD_StConn%IBOPLength ! [ft]
TD_DrillStems(i)%WeightperLength = 55.0d0 ! [lb/ft]
TD_DrillStems(i)%Weight = TD_DrillStems(i)%WeightperLength*TD_DrillStems(i)%Length
TD_DrillStems(i)%Density = TD_DrillStems(kk)%Density !????????????
TD_DrillStems(i)%ElasticModule = TD_DrillStems(kk)%ElasticModule !????????????
End Do
TD_String%DrillStemComponentsNumbs = TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents
! DrillStem Array:
i = TD_String%StringConfigurationCount+1
TD_DrillStem(i)%ComponentType = 5
TD_DrillStem(i)%Numbs = 1
TD_DrillStem(i)%Id = TD_DrillStems(kk)%Id ! [ft]
TD_DrillStem(i)%Od = TD_DrillStems(kk)%RtoolJoint ! [ft]
TD_DrillStem(i)%Length = 1.540d0 ! [ft]
TD_DrillStem(i)%WeightperLength = 55.0d0 ! [lb/ft]
TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length
TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount+1
!TD_Count%IBOPOldAdd = TD_Count%IBOPNewAdd
if ( Get_ElevatorConnection() /= ELEVATOR_CONNECTION_STRING .or. (Get_TdsConnectionModes()/=TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()/=TDS_ELEVATOR_CONNECTION_STRING) ) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight+TD_DrillStem(i)%Length
end if
end if
if ( Get_Ibop()==IBOP_INSTALL ) then
TD_Count%IBOPOldAdd = 1
else
TD_Count%IBOPOldAdd = 0
end if
!====================================================
! Add Safety Valve & Kelly (OPERATION_DRILL)
!====================================================
if ( Hoisting%DriveType==1 .and. Get_OperationCondition()==OPERATION_DRILL .and. Get_KellyConnection() == KELLY_CONNECTION_STRING ) then
TD_Count%KellyNewAdd = 1
else
TD_Count%KellyNewAdd = 0
TD_Count%KellyOldAdd = 0
end if
if ( Hoisting%DriveType==1 .and. Get_OperationCondition()==OPERATION_DRILL .and. Get_KellyConnection() == KELLY_CONNECTION_STRING .and. TD_Count%KellyNewAdd/=TD_Count%KellyOldAdd ) then
! DrillStems Array:
TD_NumOfAddedComponents = 1
Do i= (TD_String%DrillStemComponentsNumbs+1) , (TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents)
TD_DrillStems(i)%ComponentType = 6
TD_DrillStems(i)%Id = TD_StConn%KellyElementID ! [ft]
TD_DrillStems(i)%Od = TD_StConn%KellyElementOD ! [ft]
TD_DrillStems(i)%Area = (pi*((TD_DrillStems(i)%Od**2)-(TD_DrillStems(i)%Id**2)))/4.0d0
TD_DrillStems(i)%RtoolJoint = TD_DrillStems(i)%Od*1.30d0/2.0d0
TD_DrillStems(i)%ToolJointRange = 0.0d0
TD_DrillStems(i)%Length = TD_StConn%KellyElementConst ! [ft]
TD_DrillStems(i)%LengthIni = TD_StConn%KellyElementConst ! [ft]
TD_DrillStems(i)%WeightperLength = 55.0d0 ! [lb/ft]
TD_DrillStems(i)%Weight = TD_DrillStems(i)%WeightperLength*TD_DrillStems(i)%Length
TD_DrillStems(i)%Density = 7850.d0*0.06242796d0 ! [kg/m3]*0.06242796=[lb/ft3]
TD_DrillStems(i)%ElasticModule = 200.0d9*0.02088543d0 ! [lb/ft2] !200GPa=29Mpsi (steel)
End Do
TD_String%DrillStemComponentsNumbs = TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents
! DrillStem Array:
i = TD_String%StringConfigurationCount+1
TD_DrillStem(i)%ComponentType = 6
TD_DrillStem(i)%Numbs = 1
TD_DrillStem(i)%Id = 3.0d0/12.d0 ! [ft]
TD_DrillStem(i)%Od = 5.90d0/12.d0 ! [ft]
TD_DrillStem(i)%Length = TD_StConn%KellyElementConst ! [ft]
TD_DrillStem(i)%WeightperLength = 55.0d0 ! [lb/ft]
TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length
TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount+1
TD_Count%KellyOldAdd = TD_Count%KellyNewAdd
end if
!====================================================
! Add Safety Valve (OPERATION_TRIP)
!====================================================
!if ( Get_OperationCondition()==OPERATION_TRIP .and. Get_SafetyValve()==SAFETY_VALVE_INSTALL ) then
! TD_Count%SafetyValveNewAdd = 1
!else
! TD_Count%SafetyValveNewAdd = 0
! TD_Count%SafetyValveOldAdd = 0
!end if
if ( TD_StConn%KellyDriveTypeMode/=0 .and. TD_StConn%OldOperationCondition/=0 .and. Get_SafetyValve()==SAFETY_VALVE_INSTALL .and. TD_Count%SafetyValveOldAdd==0 ) then
kk = 0
Do i= TD_String%DrillStemComponentsNumbs , 1 , -1
if (TD_DrillStems(i)%ComponentType==3) then
kk = i
exit
end if
End Do
! DrillStems Array:
TD_NumOfAddedComponents = 1
Do i= (TD_String%DrillStemComponentsNumbs+1) , (TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents)
TD_DrillStems(i)%ComponentType = 7
TD_DrillStems(i)%Id = TD_DrillStems(kk)%Id
TD_DrillStems(i)%Od = TD_DrillStems(kk)%RtoolJoint
TD_DrillStems(i)%Area = (pi*((TD_DrillStems(i)%Od**2)-(TD_DrillStems(i)%Id**2)))/4.0d0
TD_DrillStems(i)%RtoolJoint = TD_DrillStems(kk)%RtoolJoint
TD_DrillStems(i)%ToolJointRange = 0.0d0
TD_DrillStems(i)%Length = TD_StConn%SafetyValveLength ! [ft]
TD_DrillStems(i)%LengthIni = TD_StConn%SafetyValveLength ! [ft]
TD_DrillStems(i)%WeightperLength = 55.0d0 ! [lb/ft]
TD_DrillStems(i)%Weight = TD_DrillStems(i)%WeightperLength*TD_DrillStems(i)%Length
TD_DrillStems(i)%Density = TD_DrillStems(kk)%Density !????????????
TD_DrillStems(i)%ElasticModule = TD_DrillStems(kk)%ElasticModule !????????????
End Do
TD_String%DrillStemComponentsNumbs = TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents
! DrillStem Array:
i = TD_String%StringConfigurationCount+1
TD_DrillStem(i)%ComponentType = 7
TD_DrillStem(i)%Numbs = 1
TD_DrillStem(i)%Id = TD_DrillStems(kk)%Id ! [ft]
TD_DrillStem(i)%Od = TD_DrillStems(kk)%RtoolJoint ! [ft]
TD_DrillStem(i)%Length = 1.540d0 ! [ft]
TD_DrillStem(i)%WeightperLength = 55.0d0 ! [lb/ft]
TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length
TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount+1
!TD_Count%SafetyValveOldAdd = TD_Count%SafetyValveNewAdd
if ( Get_ElevatorConnection() /= ELEVATOR_CONNECTION_STRING .or. (Get_TdsConnectionModes()/=TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()/=TDS_ELEVATOR_CONNECTION_STRING) ) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight+TD_DrillStem(i)%Length
end if
end if
if ( Get_SafetyValve()==SAFETY_VALVE_INSTALL ) then
TD_Count%SafetyValveOldAdd = 1
else
TD_Count%SafetyValveOldAdd = 0
end if

end subroutine

+ 0
- 180
Equipments/TorqueDrag/TD_DrillingSubs/TD_BOPDiamCalculation.f90 View File

@@ -1,180 +0,0 @@
subroutine TD_BOPDiamCalculation
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData
Use TD_StringConnectionData
Use CBopStackVariables
Use VARIABLES
Integer :: i , j , n , m , TD_Numbs
Real(8) :: TD_LimitUp , TD_LimitDown , TD_OldFillingValue , TD_AnnTjDiff , TD_AnnularFilling
Real(8) :: TD_ElToolJoints(2,2)
!TD_String%ToolJointRange = 0.4005d0*3.28 ! [ft]
!====================================================
! Read BOP Data
!====================================================
TD_BOP%BOPHeight(5) = BopStackSpecification%AboveAnnularHeight
TD_BOP%BOPHeight(1) = BopStackSpecification%AnnularPreventerHeight
TD_BOP%BOPHeight(2) = BopStackSpecification%UpperRamHeight
TD_BOP%BOPHeight(3) = BopStackSpecification%BlindRamHeight
TD_BOP%BOPHeight(6) = BopStackSpecification%KillHeight
TD_BOP%BOPHeight(4) = BopStackSpecification%LowerRamHeight
TD_BOP%BOPRamDiam(1) = ShearRam%IDAnnularfinal
TD_BOP%BOPRamDiam(2) = ShearRam%IDPipeRam1final
TD_BOP%BOPRamDiam(3) = ShearRam%IDshearBopfinal
TD_BOP%BOPRamDiam(4) = ShearRam%IDPipeRam2final
!====================================================
! Element Counts in BOPStack Domain
!====================================================
!if (TD_String%DrillStemComponentsNumbs>5) then
TD_Numbs = TD_String%DrillStemComponentsNumbs-7 ! 7 Elements from the Top of DrillStem
!else
! TD_Numbs = 1
!end if
!====================================================
! Determination of Elements Diameter in BOPStack Domain
!====================================================

TD_BOP%BOPDiam = 0.d0
TD_OldFillingValue = 0.d0
Do i = TD_String%DrillStemComponentsNumbs,TD_Numbs,-1
TD_LimitUp = TD_DrillStems(i)%TopDepth+TD_DrillStems(i)%ToolJointRange
TD_LimitDown = TD_DrillStems(i)%DownDepth-TD_DrillStems(i)%ToolJointRange
TD_ElToolJoints(1,1) = TD_DrillStems(i)%TopDepth ! TD_ElToolJoints(i,j) , i=top & down tooljoints of element , j=top & down tooljoints Depth
TD_ElToolJoints(1,2) = TD_LimitUp
TD_ElToolJoints(2,1) = TD_LimitDown
TD_ElToolJoints(2,2) = TD_DrillStems(i)%DownDepth
!===> che meghdar az fazaye annular ba tooljoint por mishavad (for BOP Module)
Do m = 1,2
TD_AnnTjDiff = min(TD_ElToolJoints(m,2),(TD_BOP%BOPHeight(1)+TD_BOP%BOPThickness))-max(TD_ElToolJoints(m,1),(TD_BOP%BOPHeight(1)-TD_BOP%BOPThickness))
if (TD_AnnTjDiff<0.) then ! tooljoint is not in the annular range
TD_AnnTjDiff = 0.d0
end if
TD_AnnularFilling = TD_OldFillingValue+(TD_AnnTjDiff/(TD_BOP%BOPThickness*2.d0)) ! 0=<TD_AnnularFilling<=1
TD_OldFillingValue = TD_AnnularFilling
End Do
do j = 1,6
if ( (TD_BOP%BOPHeight(j)-TD_BOP%BOPThickness)>TD_LimitUp .and. (TD_BOP%BOPHeight(j)+TD_BOP%BOPThickness)<TD_LimitDown ) then
TD_BOP%BOPDiam(j) = TD_DrillStems(i)%Od
TD_BOP%BOPElementNo(j) = i
if ( TD_DrillStems(i)%ComponentType==3 .and. j/=1 .and. TD_String%DrillStemRotVelocity==0. ) then
TD_BOP%BOPConnectionPossibility(j) = 1
else if ( j==1 ) then
TD_BOP%BOPConnectionPossibility(j) = 1
else
TD_BOP%BOPConnectionPossibility(j) = 0
end if
!print* , 'T.DP. , B.DP. 1=' , TD_DrillStems(i)%TopDepth , TD_DrillStems(i)%DownDepth
!print* , 'T.R. , B.R. , LimitUp , LimitDown 1=' , (TD_BOP%BOPHeight(j)-TD_BOP%BOPThickness) , (TD_BOP%BOPHeight(j)+TD_BOP%BOPThickness) , TD_LimitUp , TD_LimitDown
!print* , 'stringNo , ramsNo , Possibility , BOPDiam 1=' , i , j , TD_BOP%BOPConnectionPossibility(j) , TD_BOP%BOPDiam(j)
else if ( (TD_BOP%BOPHeight(j)+TD_BOP%BOPThickness)>=TD_DrillStems(i)%TopDepth .and. (TD_BOP%BOPHeight(j)-TD_BOP%BOPThickness)<=TD_DrillStems(i)%DownDepth ) then
TD_BOP%BOPDiam(j) = TD_DrillStems(i)%RtoolJoint*2.d0
TD_BOP%BOPElementNo(j) = i
if ( j==1 ) then
TD_BOP%BOPConnectionPossibility(j) = 1
else
TD_BOP%BOPConnectionPossibility(j) = 0
end if
!print* , 'T.DP. , B.DP. 2=' , TD_DrillStems(i)%TopDepth , TD_DrillStems(i)%DownDepth
!print* , 'T.R. , B.R. , LimitUp , LimitDown 2=' , (TD_BOP%BOPHeight(j)-TD_BOP%BOPThickness) , (TD_BOP%BOPHeight(j)+TD_BOP%BOPThickness) , TD_LimitUp , TD_LimitDown
!print* , 'stringNo , ramsNo , Possibility , BOPDiam 2=' , i , j , TD_BOP%BOPConnectionPossibility(j) , TD_BOP%BOPDiam(j)
end if
end do
End Do
TD_BOP%AnnularFillingFinal = TD_AnnularFilling
TD_BOP%AboveAnnularDiam = TD_BOP%BOPDiam(5)
TD_BOP%AnnularPreventerDiam = TD_BOP%BOPDiam(1)
TD_BOP%UpperRamDiam = TD_BOP%BOPDiam(2)
TD_BOP%BlindRamDiam = TD_BOP%BOPDiam(3)
TD_BOP%KillDiam = TD_BOP%BOPDiam(6)
TD_BOP%LowerRamDiam = TD_BOP%BOPDiam(4)
!print* , 'TD_BOP%BOPElementNo=' , TD_BOP%BOPElementNo
!print* , 'TD_BOP%BOPConnectionPossibility=' , TD_BOP%BOPConnectionPossibility
!print* , 'TD_BOP%BOPDiam=' , TD_BOP%BOPDiam
!!===> BOP RAMs Condition *** TD_BOP%BOPCondition: 0=open , 1=close
!do j = 1,4
! if ( TD_BOP%BOPDiam(j)>=TD_BOP%BOPRamDiam(j) ) then
! TD_BOP%BOPCondition(j) = 1
! else
! TD_BOP%BOPCondition(j) = 0
! end if
!end do
!====================================================
! String Elements Configuration in BOPStack Domain
!====================================================
!if ( allocated(TD_BOPElement) ) deallocate (TD_BOPElement)
!allocate(TD_BOPElement())
n = 0
TD_BOPElement%ElementType = 0.d0
TD_BOPElement%ElementStart = 0.d0
TD_BOPElement%ElementEnd = 0.d0
do k = TD_String%DrillStemComponentsNumbs,TD_Numbs,-1
if( ((TD_DrillStems(k)%TopDepth>=TD_BOP%BOPHeight(5)).and.(TD_DrillStems(k)%TopDepth<=TD_BOP%BOPHeight(4))) .or. ((TD_DrillStems(k)%DownDepth>=TD_BOP%BOPHeight(5)).and.(TD_DrillStems(k)%DownDepth<=TD_BOP%BOPHeight(4))) ) then
n = n+1
TD_BOPElement(n)%ElementType = TD_DrillStems(k)%ComponentType
TD_BOPElement(n)%ElementStart = TD_DrillStems(k)%TopDepth
TD_BOPElement(n)%ElementEnd = TD_DrillStems(k)%DownDepth
else if ( TD_DrillStems(k)%TopDepth<=TD_BOP%BOPHeight(5) .and. TD_DrillStems(k)%DownDepth>=TD_BOP%BOPHeight(4) ) then
n = n+1
TD_BOPElement(n)%ElementType = TD_DrillStems(k)%ComponentType
TD_BOPElement(n)%ElementStart = TD_DrillStems(k)%TopDepth
TD_BOPElement(n)%ElementEnd = TD_DrillStems(k)%DownDepth
end if
end do
Call SetBopElements(TD_BOPElement)
end subroutine

+ 0
- 318
Equipments/TorqueDrag/TD_DrillingSubs/TD_DrillStemConfiguration.f90 View File

@@ -1,318 +0,0 @@
subroutine TD_DrillStemConfiguration

Use CStringConfigurationVariables
use SoftwareInputsVariables
! Use CNearFloorConnection
Use CDataDisplayConsoleVariables
Use CDrillWatchVariables
use UnitySignalVariables
! Use COperationConditionEnumVariables
Use CKellyConnectionEnumVariables
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_StringConnectionData
Use sROP_Variables
implicit none

Integer :: i , j , k , kk , TD_Status

!====================================================
! Drill Stem Components Data Modification
!====================================================
!=====> Drill Stem Total Length&Weight Calculation
TD_String%DrillStemTotalLength = 0.0d0
TD_String%DrillStemTotalLengthIni = 0.0d0
TD_String%DrillStemTotalWeight = 0.0d0
Do i= 1,TD_String%DrillStemComponentsNumbs
TD_String%DrillStemTotalLength = TD_String%DrillStemTotalLength+TD_DrillStems(i)%Length
TD_String%DrillStemTotalLengthIni = TD_String%DrillStemTotalLengthIni+TD_DrillStems(i)%LengthIni
TD_String%DrillStemTotalWeight = TD_String%DrillStemTotalWeight+TD_DrillStems(i)%Weight
End Do
!=====> Top&Down Depth Calculation Of Initial Drill Stem Components (Graphic)
TD_DrillStems(1)%DownDepth = TD_String%DrillStemTotalLength-TD_StConn%ConnectionHeight
TD_String%DrillStemBottom = TD_DrillStems(1)%DownDepth
if ( TD_DrillStems(1)%DownDepth>=TD_WellGeneral%WellTotalLength ) then
!if ( TD_StConn%HookHeight>=TD_StConn%HookHeightOld .and. ROP_Bit%RateOfPenetration==0. ) then
! TD_StConn%GRigidConnectionHeight = TD_StConn%GRigidConnectionHeight
!else
TD_StConn%GRigidConnectionHeight = TD_StConn%GRigidConnectionHeight-(TD_WellGeneral%WellTotalLength-TD_DrillStems(1)%DownDepthIniG)
TD_DrillStems(1)%DownDepthIniG = TD_WellGeneral%WellTotalLength !???????????
! !TD_StConn%GRigidConnectionHeight = TD_StConn%GRigidConnectionHeight
!end if
else
TD_StConn%GRigidConnectionHeight = TD_StConn%ConnectionHeight
TD_DrillStems(1)%DownDepthIniG = TD_String%DrillStemTotalLengthIni-TD_StConn%GRigidConnectionHeight
end if
!TD_DrillStems(1)%DownDepthIniG = TD_String%DrillStemTotalLengthIni-TD_StConn%GRigidConnectionHeight
!if ( TD_DrillStems(1)%DownDepthIniG>TD_WellGeneral%WellTotalLength ) then
! TD_StConn%GRigidConnectionHeight = TD_StConn%GRigidConnectionHeight+(TD_DrillStems(1)%DownDepthIniG-TD_WellGeneral%WellTotalLength)
! TD_DrillStems(1)%DownDepthIniG = TD_WellGeneral%WellTotalLength !???????????
!end if
TD_DrillStems(1)%TopDepthIniG = TD_DrillStems(1)%DownDepthIniG-TD_DrillStems(1)%LengthIni
Do i = 2,TD_String%DrillStemComponentsNumbs
TD_DrillStems(i)%TopDepthIniG = TD_DrillStems(i-1)%TopDepthIniG-TD_DrillStems(i)%LengthIni
TD_DrillStems(i)%DownDepthIniG = TD_DrillStems(i-1)%DownDepthIniG-TD_DrillStems(i-1)%LengthIni
End Do
!=====> Top&Down Depth Calculation Of Initial Drill Stem Components (for fluid module)
if ( TD_DrillStems(1)%DownDepthIniG>=(TD_WellGeneral%WellTotalLength-.1d0) ) then
TD_StConn%RigidConnectionHeight = TD_StConn%GRigidConnectionHeight+(.1d0-(TD_WellGeneral%WellTotalLength-TD_DrillStems(1)%DownDepthIniG))
else
TD_StConn%RigidConnectionHeight = TD_StConn%GRigidConnectionHeight
end if
TD_DrillStems(1)%DownDepthIni = TD_String%DrillStemTotalLengthIni-TD_StConn%RigidConnectionHeight
TD_DrillStems(1)%TopDepthIni = TD_DrillStems(1)%DownDepthIni-TD_DrillStems(1)%LengthIni
Do i = 2,TD_String%DrillStemComponentsNumbs
TD_DrillStems(i)%TopDepthIni = TD_DrillStems(i-1)%TopDepthIni-TD_DrillStems(i)%LengthIni
TD_DrillStems(i)%DownDepthIni = TD_DrillStems(i-1)%DownDepthIni-TD_DrillStems(i-1)%LengthIni
End Do
!=====> Top&Down Depth Calculation Of Drill Stem Components
TD_DrillStems(1)%TopDepth = TD_String%DrillStemTotalLength-TD_DrillStems(1)%Length-TD_StConn%GRigidConnectionHeight
TD_DrillStems(1)%DownDepth = TD_String%DrillStemTotalLength-TD_StConn%GRigidConnectionHeight
Do i = 2,TD_String%DrillStemComponentsNumbs
TD_DrillStems(i)%TopDepth = TD_DrillStems(i-1)%TopDepth-TD_DrillStems(i)%Length
TD_DrillStems(i)%DownDepth = TD_DrillStems(i-1)%DownDepth-TD_DrillStems(i-1)%Length
End Do
!TD_String%DrillStemBottom = TD_DrillStems(1)%DownDepth
!=====> Hole Type & Inclination Determination Of Drill Stem Components
Do i = 1,TD_String%DrillStemComponentsNumbs
if (TD_DrillStems(i)%TopDepth .ge. 0.d0) then
Do j = 1,TD_WellGeneral%WellIntervalsCount
if (TD_DrillStems(i)%TopDepth>TD_WellGeo(j)%TopDepth .and. TD_DrillStems(i)%TopDepth<TD_WellGeo(j)%DownDepth) then
TD_DrillStems(i)%HoleType = TD_WellGeo(j)%HoleType
if (TD_DrillStems(i)%HoleType == 1) then
TD_DrillStems(i)%StartAngle = TD_WellGeo(j)%StartAngle+(((TD_DrillStems(i)%TopDepth-TD_WellGeo(j)%TopDepth)/TD_WellGeo(j)%RCurvature)) ![rad]
TD_DrillStems(i)%EndAngle = TD_WellGeo(j)%StartAngle+(((TD_DrillStems(i)%DownDepth-TD_WellGeo(j)%TopDepth)/TD_WellGeo(j)%RCurvature))
TD_DrillStems(i)%RCurvature = TD_WellGeo(j)%RCurvature
else if (TD_DrillStems(i)%HoleType == 2) then
TD_DrillStems(i)%StartAngle = TD_WellGeo(j)%StartAngle-(((TD_DrillStems(i)%TopDepth-TD_WellGeo(j)%TopDepth)/TD_WellGeo(j)%RCurvature))
TD_DrillStems(i)%EndAngle = TD_WellGeo(j)%StartAngle-(((TD_DrillStems(i)%DownDepth-TD_WellGeo(j)%TopDepth)/TD_WellGeo(j)%RCurvature))
TD_DrillStems(i)%RCurvature = TD_WellGeo(j)%RCurvature
else
TD_DrillStems(i)%StartAngle = TD_WellGeo(j)%EndAngle !Straight
TD_DrillStems(i)%EndAngle = TD_DrillStems(i)%StartAngle
end if
end if
End Do
else
TD_DrillStems(i)%HoleType = 0 !Straight
TD_DrillStems(i)%StartAngle = 0.0d0
TD_DrillStems(i)%EndAngle = 0.0d0
end if
End Do

!=====> Hole(Well) Diameter Determination Of Drill Stem Components
Do i = 1,TD_String%DrillStemComponentsNumbs
If (TD_DrillStems(i)%TopDepth>TD_Casing(1)%TopDepth .and. TD_DrillStems(i)%TopDepth<TD_Casing(1)%DownDepth) then
TD_DrillStems(i)%HoleDiameter = TD_Casing(1)%Id
Else if (TD_Liner(1)%Length/=0.d0 .and. TD_DrillStems(i)%TopDepth>TD_Liner(1)%TopDepth .and. TD_DrillStems(i)%TopDepth<TD_Liner(1)%DownDepth) then
TD_DrillStems(i)%HoleDiameter = TD_Liner(1)%Id
Else if (TD_OpenHole(1)%Length/=0.d0 .and. TD_DrillStems(i)%TopDepth>TD_OpenHole(1)%TopDepth .and. TD_DrillStems(i)%TopDepth<TD_OpenHole(1)%DownDepth) then
TD_DrillStems(i)%HoleDiameter = TD_OpenHole(1)%Id
Else if (TD_ROPHole(1)%Length/=0.d0 .and. TD_DrillStems(i)%TopDepth>TD_ROPHole(1)%TopDepth .and. TD_DrillStems(i)%TopDepth<TD_ROPHole(1)%DownDepth) then
TD_DrillStems(i)%HoleDiameter = TD_ROPHole(1)%Id !????????? check
End If
!=====> Viscosity Correction Coefficient Calculation
if (TD_DrillStems(i)%HoleType == 1 .or. TD_DrillStems(i)%HoleType == 2) then
TD_DrillStems(i)%MudVisCorrectCoef = (2.0d0/pi)*atan(sqrt(TD_DrillStems(i)%HoleDiameter**2-(TD_DrillStems(i)%Od**2)) &
/ (TD_DrillStems(i)%Od))*(4.0d0/pi-1.0d0) + 1.0d0
else if (TD_DrillStems(i)%HoleType == 0) then
TD_DrillStems(i)%MudVisCorrectCoef = 1.d0
end if
End Do
!=====> Out_of_Well Length Of DrillStem
if (TD_DrillStems(TD_String%DrillStemComponentsNumbs)%TopDepth<0.) then
TD_String%OutOfWellLength = abs(TD_DrillStems(TD_String%DrillStemComponentsNumbs)%TopDepth)
else
TD_String%OutOfWellLength = 0.d0
end if
!=====> Near Floor Connection
Do i = TD_String%DrillStemComponentsNumbs, 1, -1
if ( TD_DrillStems(i)%TopDepth<=0.d0 ) then
TD_String%NearFloorConnectionNo = i
TD_String%NearFloorConnectionHeight = abs(TD_DrillStems(i)%TopDepth)
end if
if (TD_DrillStems(i)%TopDepth>0.d0) then
exit
end if
End Do
Call Set_NearFloorConnection(real(TD_String%NearFloorConnectionHeight))
!=====> Graphic Output
kk = 0
k = 0
Do i= 1,TD_String%StringConfigurationCount
k = k+1
if ( TD_DrillStems(k)%DownDepthIniG>0.d0 ) then
kk = kk+1
if (TD_DrillStems(k+TD_DrillStem(i)%Numbs-1)%TopDepthIniG<=0.d0) then
exit
end if
k = k+TD_DrillStem(i)%Numbs-1
end if
End Do
if (allocated(G_StringElement)) deallocate(G_StringElement)
allocate(G_StringElement(kk))
k = 0
Do i= 1,kk
G_StringElement(kk-i+1)%Id = TD_DrillStem(i)%Id
G_StringElement(kk-i+1)%Od = TD_DrillStem(i)%Od
if ( TD_DrillStem(i)%ComponentType>4 ) then
G_StringElement(kk-i+1)%ComponentType = 3
else
G_StringElement(kk-i+1)%ComponentType = TD_DrillStem(i)%ComponentType
end if
G_StringElement(kk-i+1)%TopDepth = TD_DrillStems(k+TD_DrillStem(i)%Numbs)%TopDepthIniG
G_StringElement(kk-i+1)%DownDepth = TD_DrillStems(k+1)%DownDepthIniG
k = k+TD_DrillStem(i)%Numbs
End Do
if (G_StringElement(1)%TopDepth<=0.d0) then
G_StringElement(1)%TopDepth = 0.d0
end if
Call SetString(kk, G_StringElement)
if(TD_DrillStems(1)%DownDepth<0.d0) then
DrillingWatch%BitPosition = TD_DrillStems(1)%DownDepth
else
DrillingWatch%BitPosition = G_StringElement(kk)%DownDepth !???????????
!if ( G_StringElement(kk)%DownDepth>TD_WellGeneral%WellTotalLength ) then
! DrillingWatch%BitPosition = TD_WellGeneral%WellTotalLength !???????????
!end if
end if
!print*, 'kk=' , kk
!Do i=1,kk
! print*, 'Number/' , 'downDepth/' , 'topDepth/'
! print*, 'ID/' , 'OD/' , 'Type/'
! print*, i , G_StringElement(i)%DownDepth , G_StringElement(i)%TopDepth
! print*, G_StringElement(i)%Id , G_StringElement(i)%Od , G_StringElement(i)%ComponentType
!End Do
!print*, 'Top Joint Height before=' , TD_String%TopJointHeight
!=====> Top Joint Height
if ( Get_OperationCondition()==OPERATION_DRILL .and. Get_KellyConnection() == KELLY_CONNECTION_STRING ) then
TD_String%TopJointHeight = abs(TD_DrillStems(TD_String%DrillStemComponentsNumbs-1)%TopDepth)
!print*, 'TopDepth1=' , TD_DrillStems(TD_String%DrillStemComponentsNumbs-1)%TopDepth
!print*, 'numb1=' , TD_String%DrillStemComponentsNumbs-1
!print*, 'TD_String%TopJointHeight=' , TD_String%TopJointHeight
else
TD_String%TopJointHeight = abs(TD_DrillStems(TD_String%DrillStemComponentsNumbs)%TopDepth)
!print*, 'TopDepth2=' , TD_DrillStems(TD_String%DrillStemComponentsNumbs)%TopDepth
!print*, 'numb2=' , TD_String%DrillStemComponentsNumbs
!print*, 'TD_String%TopJointHeight2=' , TD_String%TopJointHeight
end if
!print*, 'TD_String%DrillStemComponentsNumbs=' , TD_String%DrillStemComponentsNumbs
!print*, 'TD_String%TopJointHeight_=' , TD_String%TopJointHeight
!Print*, 'TD_StConn%ConnectionHeight_=' , TD_StConn%ConnectionHeight
!Print*, 'TD_StConn%StringConnectionMode_=' , TD_StConn%StringConnectionMode
!
!print*, 'Top Joint Height after=' , TD_String%TopJointHeight

end subroutine

+ 0
- 359
Equipments/TorqueDrag/TD_DrillingSubs/TD_RemoveComponents.f90 View File

@@ -1,359 +0,0 @@
subroutine TD_RemoveComponents
Use CStringConfigurationVariables
use UnitySignalVariables
! Use CStringUpdateVariables
! Use CSafetyValveEnumVariables
! Use CIbopEnumVariables
! Use COperationConditionEnumVariables
! Use CKellyConnectionEnumVariables
! Use CElevatorConnectionEnumVariables
Use COperationScenariosVariables
! Use CTdsConnectionModesEnumVariables
! Use CTdsElevatorModesEnumVariables
Use CHoistingVariables
Use TD_DrillStemComponents
Use TD_WellGeometry
Use TD_GeneralData
Use TD_StringConnectionData

implicit none
integer :: i , TD_NumOfRemovedComponents
!====================================================
! Remove Safety Valve & Kelly (OPERATION_DRILL)
!====================================================
if ( Hoisting%DriveType==1 .and. Get_OperationCondition()==OPERATION_DRILL .and. Get_KellyConnection() /= KELLY_CONNECTION_STRING ) then
TD_Count%KellyNewRemove = 1
else
TD_Count%KellyNewRemove = 0
TD_Count%KellyOldRemove = 0
end if
if ( Hoisting%DriveType==1 .and. Get_OperationCondition()==OPERATION_DRILL .and. Get_KellyConnection() /= KELLY_CONNECTION_STRING .and. TD_Count%KellyNewRemove/=TD_Count%KellyOldRemove ) then
!print* , 'Remove Safety Valve & Kelly='
TD_NumOfRemovedComponents = 1
Do i= TD_String%DrillStemComponentsNumbs , (TD_String%DrillStemComponentsNumbs-TD_NumOfRemovedComponents+1) , -1
TD_DrillStems(i)%ComponentType = 0 !????????????
TD_DrillStems(i)%Id = 0.
TD_DrillStems(i)%Od = 0.
TD_DrillStems(i)%Area = 0.
TD_DrillStems(i)%RtoolJoint = 0.
TD_DrillStems(i)%ToolJointRange = 0.
TD_DrillStems(i)%Length = 0.
TD_DrillStems(i)%LengthIni = 0.
TD_DrillStems(i)%WeightperLength = 0.
TD_DrillStems(i)%Weight = 0.
End Do
TD_String%DrillStemComponentsNumbs = TD_String%DrillStemComponentsNumbs-TD_NumOfRemovedComponents
i = TD_String%StringConfigurationCount
if ( TD_DrillStem(i)%Numbs>1 ) then
TD_DrillStem(i)%ComponentType = 6
TD_DrillStem(i)%Numbs = TD_DrillStem(i)%Numbs-1
TD_DrillStem(i)%Id = TD_DrillStem(i)%Id ![ft]
TD_DrillStem(i)%Od = TD_DrillStem(i)%Od ![ft]
TD_DrillStem(i)%Length = TD_DrillStem(i)%Length ![ft]
TD_DrillStem(i)%WeightperLength = TD_DrillStem(i)%WeightperLength
TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length
TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount
else if ( TD_DrillStem(i)%Numbs==1 ) then
TD_DrillStem(i)%ComponentType = 6
TD_DrillStem(i)%Numbs = 0
TD_DrillStem(i)%Id = 0.
TD_DrillStem(i)%Od = 0.
TD_DrillStem(i)%Length = 0.
TD_DrillStem(i)%WeightperLength = 0.
TD_DrillStem(i)%TotalLength = 0.
TD_DrillStem(i)%TotalWeight = 0.
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount-1
end if
TD_Count%KellyOldRemove = TD_Count%KellyNewRemove
!print* , 'Remove Safety Valve & Kelly (OPERATION_DRILL)'
end if
!====================================================
! Remove Single
!====================================================
if ( Get_StringUpdate() == STRING_UPDATE_REMOVE_SINGLE ) then
!print* , 'STRING_UPDATE_REMOVE_SINGLE='
TD_NumOfRemovedComponents = 1
Do i= TD_String%DrillStemComponentsNumbs , (TD_String%DrillStemComponentsNumbs-TD_NumOfRemovedComponents+1) , -1
TD_DrillStems(i)%ComponentType = 0 !????????????
TD_DrillStems(i)%Id = 0.
TD_DrillStems(i)%Od = 0.
TD_DrillStems(i)%Area = 0.
TD_DrillStems(i)%RtoolJoint = 0.
TD_DrillStems(i)%ToolJointRange = 0.
TD_DrillStems(i)%Length = 0.
TD_DrillStems(i)%LengthIni = 0.
TD_DrillStems(i)%WeightperLength = 0.
TD_DrillStems(i)%Weight = 0.
End Do
TD_String%DrillStemComponentsNumbs = TD_String%DrillStemComponentsNumbs-TD_NumOfRemovedComponents
i = TD_String%StringConfigurationCount
if ( TD_DrillStem(i)%Numbs>1 ) then
TD_DrillStem(i)%ComponentType = 3
TD_DrillStem(i)%Numbs = TD_DrillStem(i)%Numbs-1
TD_DrillStem(i)%Id = TD_DrillStem(i)%Id ![ft]
TD_DrillStem(i)%Od = TD_DrillStem(i)%Od ![ft]
TD_DrillStem(i)%Length = TD_DrillStem(i)%Length
TD_DrillStem(i)%WeightperLength = TD_DrillStem(i)%WeightperLength
TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length
TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount
else if ( TD_DrillStem(i)%Numbs==1 ) then
TD_DrillStem(i)%ComponentType = 3
TD_DrillStem(i)%Numbs = 0
TD_DrillStem(i)%Id = 0.
TD_DrillStem(i)%Od = 0.
TD_DrillStem(i)%Length = 0.
TD_DrillStem(i)%WeightperLength = 0.
TD_DrillStem(i)%TotalLength = 0.
TD_DrillStem(i)%TotalWeight = 0.
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount-1
end if
Call Set_StringUpdate(STRING_UPDATE_NEUTRAL)
!print* , 'Remove Single'
end if
!====================================================
! Remove Stand
!====================================================
if ( Get_StringUpdate() == STRING_UPDATE_REMOVE_STAND ) then
TD_NumOfRemovedComponents = 3
Do i= TD_String%DrillStemComponentsNumbs , (TD_String%DrillStemComponentsNumbs-TD_NumOfRemovedComponents+1) , -1
TD_DrillStems(i)%ComponentType = 0 !????????????
TD_DrillStems(i)%Id = 0.
TD_DrillStems(i)%Od = 0.
TD_DrillStems(i)%Area = 0.
TD_DrillStems(i)%RtoolJoint = 0.
TD_DrillStems(i)%ToolJointRange = 0.
TD_DrillStems(i)%Length = 0.
TD_DrillStems(i)%LengthIni = 0.
TD_DrillStems(i)%WeightperLength = 0.
TD_DrillStems(i)%Weight = 0.
End Do
TD_String%DrillStemComponentsNumbs = TD_String%DrillStemComponentsNumbs-TD_NumOfRemovedComponents
i = TD_String%StringConfigurationCount
if ( TD_DrillStem(i)%Numbs>3 ) then
TD_DrillStem(i)%ComponentType = 3
TD_DrillStem(i)%Numbs = TD_DrillStem(i)%Numbs-3
TD_DrillStem(i)%Id = TD_DrillStem(i)%Id ![ft]
TD_DrillStem(i)%Od = TD_DrillStem(i)%Od ![ft]
TD_DrillStem(i)%Length = TD_DrillStem(i)%Length
TD_DrillStem(i)%WeightperLength = TD_DrillStem(i)%WeightperLength
TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length
TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount
else if ( TD_DrillStem(i)%Numbs==3 ) then
TD_DrillStem(i)%ComponentType = 3
TD_DrillStem(i)%Numbs = 0
TD_DrillStem(i)%Id = 0.
TD_DrillStem(i)%Od = 0.
TD_DrillStem(i)%Length = 0.
TD_DrillStem(i)%WeightperLength = 0.
TD_DrillStem(i)%TotalLength = 0.
TD_DrillStem(i)%TotalWeight = 0.
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount-1
end if
Call Set_StringUpdate(STRING_UPDATE_NEUTRAL)
!print* , 'Remove Stand'
end if

!====================================================
! Remove IBOP
!====================================================
!if ( Get_Ibop() == IBOP_REMOVE ) then
! TD_Count%IBOPNewRemove = 1
!else
! TD_Count%IBOPNewRemove = 0
! TD_Count%IBOPOldRemove = 0
!end if
if ( Get_Ibop() == IBOP_REMOVE .and. TD_Count%IBOPOldRemove==0 ) then
TD_NumOfRemovedComponents = 1
Do i= TD_String%DrillStemComponentsNumbs , (TD_String%DrillStemComponentsNumbs-TD_NumOfRemovedComponents+1) , -1
TD_DrillStems(i)%ComponentType = 0 !????????????
TD_DrillStems(i)%Id = 0.
TD_DrillStems(i)%Od = 0.
TD_DrillStems(i)%Area = 0.
TD_DrillStems(i)%RtoolJoint = 0.
TD_DrillStems(i)%ToolJointRange = 0.
TD_DrillStems(i)%Length = 0.
TD_DrillStems(i)%LengthIni = 0.
TD_DrillStems(i)%WeightperLength = 0.
TD_DrillStems(i)%Weight = 0.
End Do
TD_String%DrillStemComponentsNumbs = TD_String%DrillStemComponentsNumbs-TD_NumOfRemovedComponents
i = TD_String%StringConfigurationCount
if ( TD_DrillStem(i)%Numbs>1 ) then
TD_DrillStem(i)%ComponentType = 5
TD_DrillStem(i)%Numbs = TD_DrillStem(i)%Numbs-1
TD_DrillStem(i)%Id = TD_DrillStem(i)%Id ![ft]
TD_DrillStem(i)%Od = TD_DrillStem(i)%Od ![ft]
TD_DrillStem(i)%Length = TD_DrillStem(i)%Length ![ft]
TD_DrillStem(i)%WeightperLength = TD_DrillStem(i)%WeightperLength
TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length
TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount
else if ( TD_DrillStem(i)%Numbs==1 ) then
TD_DrillStem(i)%ComponentType = 5
TD_DrillStem(i)%Numbs = 0
TD_DrillStem(i)%Id = 0.
TD_DrillStem(i)%Od = 0.
TD_DrillStem(i)%Length = 0.
TD_DrillStem(i)%WeightperLength = 0.
TD_DrillStem(i)%TotalLength = 0.
TD_DrillStem(i)%TotalWeight = 0.
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount-1
end if

!TD_Count%IBOPOldRemove = TD_Count%IBOPNewRemove
if ( Get_ElevatorConnection() /= ELEVATOR_CONNECTION_STRING .or. (Get_TdsConnectionModes()/=TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()/=TDS_ELEVATOR_CONNECTION_STRING) ) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight-TD_StConn%IBOPLength
end if
!print* , 'Remove IBOP'
end if
if ( Get_Ibop() == IBOP_REMOVE ) then
TD_Count%IBOPOldRemove = 1
else
TD_Count%IBOPOldRemove = 0
end if

!====================================================
! Remove Safety Valve (OPERATION_TRIP)
!====================================================
!if ( TD_StConn%OldOperationCondition==1 .and. TD_StConn%KellyDriveTypeMode==1 .and. Get_SafetyValve() == SAFETY_VALVE_REMOVE ) then
! TD_Count%SafetyValveNewRemove = 1
!else
! TD_Count%SafetyValveNewRemove = 0
! TD_Count%SafetyValveOldRemove = 0
!end if
!print* , 'Get_SafetyValve()=' , Get_SafetyValve()
if ( TD_StConn%KellyDriveTypeMode/=0 .and. TD_StConn%OldOperationCondition/=0 .and. Get_SafetyValve() == SAFETY_VALVE_REMOVE .and. TD_Count%SafetyValveOldRemove==0 ) then
TD_NumOfRemovedComponents = 1
Do i= TD_String%DrillStemComponentsNumbs , (TD_String%DrillStemComponentsNumbs-TD_NumOfRemovedComponents+1) , -1
TD_DrillStems(i)%ComponentType = 0 !????????????
TD_DrillStems(i)%Id = 0.
TD_DrillStems(i)%Od = 0.
TD_DrillStems(i)%Area = 0.
TD_DrillStems(i)%RtoolJoint = 0.
TD_DrillStems(i)%ToolJointRange = 0.
TD_DrillStems(i)%Length = 0.
TD_DrillStems(i)%LengthIni = 0.
TD_DrillStems(i)%WeightperLength = 0.
TD_DrillStems(i)%Weight = 0.
End Do
TD_String%DrillStemComponentsNumbs = TD_String%DrillStemComponentsNumbs-TD_NumOfRemovedComponents
i = TD_String%StringConfigurationCount
if ( TD_DrillStem(i)%Numbs>1 ) then
TD_DrillStem(i)%ComponentType = 7
TD_DrillStem(i)%Numbs = TD_DrillStem(i)%Numbs-1
TD_DrillStem(i)%Id = TD_DrillStem(i)%Id ![ft]
TD_DrillStem(i)%Od = TD_DrillStem(i)%Od ![ft]
TD_DrillStem(i)%Length = TD_DrillStem(i)%Length ![ft]
TD_DrillStem(i)%WeightperLength = TD_DrillStem(i)%WeightperLength
TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length
TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount
else if ( TD_DrillStem(i)%Numbs==1 ) then
TD_DrillStem(i)%ComponentType = 7
TD_DrillStem(i)%Numbs = 0
TD_DrillStem(i)%Id = 0.
TD_DrillStem(i)%Od = 0.
TD_DrillStem(i)%Length = 0.
TD_DrillStem(i)%WeightperLength = 0.
TD_DrillStem(i)%TotalLength = 0.
TD_DrillStem(i)%TotalWeight = 0.
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount-1
end if
!print* , 'Get_OperationCondition()=' , Get_OperationCondition()
!print* , 'TD_StConn%OldOperationCondition=' , TD_StConn%OldOperationCondition
!print* , 'TD_Count%SafetyValveNewRemove=' , TD_Count%SafetyValveNewRemove
!print* , 'TD_Count%SafetyValveOldRemove=' , TD_Count%SafetyValveOldRemove
!TD_Count%SafetyValveOldRemove = TD_Count%SafetyValveNewRemove
if ( Get_ElevatorConnection() /= ELEVATOR_CONNECTION_STRING .or. (Get_TdsConnectionModes()/=TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()/=TDS_ELEVATOR_CONNECTION_STRING) ) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight-TD_StConn%SafetyValveLength
end if
end if
if ( Get_SafetyValve() == SAFETY_VALVE_REMOVE ) then
TD_Count%SafetyValveOldRemove = 1
else
TD_Count%SafetyValveOldRemove = 0
end if
if ( TD_StConn%KellyDriveTypeMode==1 ) then
TD_StConn%OldOperationCondition = 1
else
TD_StConn%OldOperationCondition = 0
end if
!print* , 'TD_StConn%KellyDriveTypeMode=' , TD_StConn%KellyDriveTypeMode
!print* , 'TD_StConn%OldOperationCondition2=' , TD_StConn%OldOperationCondition
!print* , 'TD_Count%SafetyValveNewRemove2=' , TD_Count%SafetyValveNewRemove
!print* , 'TD_Count%SafetyValveOldRemove2=' , TD_Count%SafetyValveOldRemove
end subroutine

+ 0
- 830
Equipments/TorqueDrag/TD_DrillingSubs/TD_StringConnectionModes.f90 View File

@@ -1,830 +0,0 @@
subroutine TD_StringConnectionModes

Use CHoistingVariables
Use CDrillingConsoleVariables
use UnitySignalVariables
! Use CKellyConnectionEnumVariables
! Use CElevatorConnectionEnumVariables
! Use CSlipsEnumVariables
! Use COperationConditionEnumVariables
use SoftwareInputsVariables
! Use CZeroStringSpeed
! Use CTdsConnectionModesEnumVariables
! Use CTdsElevatorModesEnumVariables
Use COperationScenariosVariables
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData
Use TD_StringConnectionData
Use Drawworks_VARIABLES!, only: Drawworks
implicit none
integer :: i , kk
Real(8) :: LengthSum
!!=====> Read Data
!kk = 0
!LengthSum = 0.d0
!
!Do i = TD_String%DrillStemComponentsNumbs , 1 , -1
! if (TD_DrillStems(i)%ComponentType==3) then
! kk = i
! exit
! else if (TD_DrillStems(i)%ComponentType==5 .or. TD_DrillStems(i)%ComponentType==7) then
! LengthSum = LengthSum+TD_DrillStems(i)%LengthIni
! end if
!End Do
!####C_Program -----> Hoisting%DriveType =
! = 0 TopDrive_DriveType
! = 1 Kelly_DriveType
!####C_Program -----> TD_StConn%KellyDriveTypeMode =
! = 0 Drill Mode (Kelly)
! = 1 Trip Mode (Elevator)
! = 2 TopDrive Mode
if ( Hoisting%DriveType==1 .and. Get_OperationCondition()==OPERATION_DRILL ) then
TD_StConn%KellyDriveTypeMode = 0
else if ( Hoisting%DriveType==1 .and. Get_OperationCondition()==OPERATION_TRIP ) then
TD_StConn%KellyDriveTypeMode = 1
else if ( Hoisting%DriveType==0 ) then
TD_StConn%KellyDriveTypeMode = 2
end if
TD_StConn%HookHeight = Drawworks%TDHookHeight ! unit: [ft]
TD_StConn%ElevatorConst = 17.985d0 ! [ft] Elevator Length(14.84) ????????????????? adad ha daghigh shavand
TD_StConn%ElevatorECG = OperationScenario%ECG ! [ft]
TD_StConn%KellyConst = 63.280d0 ! [ft] Kelly Length(61.74) + Safety Valve Length(1.54)
TD_StConn%KellyElementConst = 41.840d0 ! [ft] Kelly Element Length(40.3) + Safety Valve Length(1.54)
TD_StConn%TDSLength = 24.08d0 !??????????????????? ! [ft]
TD_StConn%TDSToolJointLength = 0.77d0 !??????????????????? ! [ft]
TD_StConn%TDSElevatorLength = 26.837d0 !?????? ! TDS with Elevator Length [ft]
TD_StConn%TDSElevatorToolLength= 0.859d0 !??????????????????? ! [ft]
TD_StConn%TDSElevatorECG = 2.454d0 ! [ft]
TD_Load%NumOfCables = Hoisting%NumberOfLine
TD_Load%WeightTB = Hoisting%TravelingBlockWeight ! [lb]
TD_Load%WeightTD = Hoisting%TopDriveWeight ! [lb]
TD_Load%KellyWeight = Hoisting%KellyWeight ! [lb]
!=====> Velocity Calculation
TD_StConn%HookVelocity = (TD_StConn%HookHeight-TD_StConn%HookHeightOld)/TD_General%TimeStep ! [ft/s]
!====================================================
! Add or Remove DrillStem Components
!====================================================
Call TD_AddComponents
Call TD_RemoveComponents
!=====> Read Data
kk = 0
LengthSum = 0.d0

Do i = TD_String%DrillStemComponentsNumbs , 1 , -1
if (TD_DrillStems(i)%ComponentType==3) then
kk = i
exit
else if (TD_DrillStems(i)%ComponentType==5 .or. TD_DrillStems(i)%ComponentType==7) then
LengthSum = LengthSum+TD_DrillStems(i)%LengthIni
end if
End Do
!print*, 'kk' , kk
!print*, 'TD_DrillStems(kk)%LengthIni0=' , TD_DrillStems(kk)%LengthIni

!====================================================
! String Connection Mode Determination
!====================================================
!####TD_StConn%StringConnectionMode =
! = 0 Slips Set ???????
! = 1 Kelly Connected to String
! = 2 Kelly Nothing Connected
! = 3 Kelly Connected to Single
! = 4 Elevator Connected to String
! = 5 Elevator Nothing Connected
! = 6 Elevator Connected to Stand
! = 7 Elevator Connected to Single
! = 8 Elevator Latch String
! = 18 Elevator Latch Single
! = 19 Elevator Latch Stand
! = 9 TDS CONNECTION SPINE
! = 10 TDS CONNECTION STRING
! = 11 TDS CONNECTION NOTHING .and. TDS ELEVATOR LATCH STRING
! = 12 TDS CONNECTION NOTHING .and. TDS ELEVATOR CONNECTION STRING
! = 13 TDS CONNECTION NOTHING .and. TDS ELEVATOR CONNECTION NOTHING
! = 14 TDS CONNECTION NOTHING .and. TDS ELEVATOR CONNECTION STAND
! = 15 TDS CONNECTION NOTHING .and. TDS ELEVATOR CONNECTION SINGLE
! = 16 TDS CONNECTION NOTHING .and. TDS ELEVATOR LATCH SINGLE
! = 17 TDS CONNECTION NOTHING .and. TDS ELEVATOR LATCH STAND
!if (TD_String%DlTouch<=0.) then ![ft]
! if(TD_StConn%HookVelocity<=0.) then
! TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
! TD_StConn%StringVelocity = 0.0d0
! return
! end if
!end if
!=====> Connection Height Determination
if ( TD_StConn%KellyDriveTypeMode==0 ) then
if(Get_KellyConnection() == KELLY_CONNECTION_STRING) then
TD_Count%KellyNewStatus(1) = 1
else
TD_Count%KellyNewStatus(1) = 0
!TD_Count%KellyOldStatus(1) = 0
end if
if(Get_KellyConnection()==KELLY_CONNECTION_NOTHING) then
TD_Count%KellyNewStatus(2) = 1
else
TD_Count%KellyNewStatus(2) = 0
!TD_Count%KellyOldStatus(2) = 0
end if
if(Get_KellyConnection()==KELLY_CONNECTION_SINGLE) then
TD_Count%KellyNewStatus(3) = 1
else
TD_Count%KellyNewStatus(3) = 0
!TD_Count%KellyOldStatus(3) = 0
end if
if ( Get_KellyConnection() == KELLY_CONNECTION_STRING ) then
TD_StConn%StringConnectionMode = 1
!print*, 'TD_StConn%ConnectionHeight10=' , TD_StConn%ConnectionHeight
!print*, 'TD_StConn%KellyElementConst1=' , TD_StConn%KellyElementConst
!print*, 'TD_DrillStems(kk)%LengthIni1=' , TD_DrillStems(kk)%LengthIni
if (TD_Count%KellyOldStatus(2)==1 .and. TD_Count%KellyNewStatus(1)/=TD_Count%KellyOldStatus(1)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight+TD_StConn%KellyElementConst
TD_Count%KellyOldStatus(1) = TD_Count%KellyNewStatus(1)
TD_Count%KellyOldStatus(2) = 0
else if (TD_Count%KellyOldStatus(3)==1 .and. TD_Count%KellyNewStatus(1)/=TD_Count%KellyOldStatus(1)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight+TD_StConn%KellyElementConst+30.d0 !TD_DrillStems(kk)%LengthIni
TD_Count%KellyOldStatus(1) = TD_Count%KellyNewStatus(1)
TD_Count%KellyOldStatus(3) = 0
end if
!print*, 'TD_StConn%ConnectionHeight1=' , TD_StConn%ConnectionHeight
if ( Get_Slips() == SLIPS_SET_END ) then
!!if ( TD_StConn%HookVelocity>0. ) then
!! Print*, '*** UnSet Slips ***' !?????????
!!end if
TD_StConn%KellyConnectionHeight = TD_StConn%HookHeight-(TD_StConn%KellyConst-TD_StConn%KellyElementConst) !?????????
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_StConn%StringVelocity = 0.0d0
else
!if (TD_String%DlTouch<=0. .and. TD_StConn%HookVelocity<=0.) then
! TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
! TD_StConn%StringVelocity = 0.0d0
!else
TD_StConn%KellyConnectionHeight = TD_StConn%HookHeight-(TD_StConn%KellyConst-TD_StConn%KellyElementConst) !??????????
TD_StConn%ConnectionHeight = TD_StConn%KellyConnectionHeight
TD_StConn%StringVelocity = TD_StConn%HookVelocity
!end if
end if
else if ( Get_KellyConnection() == KELLY_CONNECTION_NOTHING ) then
TD_StConn%StringConnectionMode = 2
!print*, 'TD_StConn%ConnectionHeight20=' , TD_StConn%ConnectionHeight
!print*, 'TD_StConn%KellyElementConst2=' , TD_StConn%KellyElementConst
if (TD_Count%KellyOldStatus(1)==1 .and. TD_Count%KellyNewStatus(2)/=TD_Count%KellyOldStatus(2)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight-TD_StConn%KellyElementConst
TD_Count%KellyOldStatus(2) = TD_Count%KellyNewStatus(2)
TD_Count%KellyOldStatus(1) = 0
else if (TD_Count%KellyOldStatus(3)==1 .and. TD_Count%KellyNewStatus(2)/=TD_Count%KellyOldStatus(2)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(2) = TD_Count%KellyNewStatus(2)
TD_Count%KellyOldStatus(3) = 0
else if (TD_Count%KellyOldStatus(5)==1 .and. TD_Count%KellyNewStatus(2)/=TD_Count%KellyOldStatus(2)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(2) = TD_Count%KellyNewStatus(2)
TD_Count%KellyOldStatus(5) = 0
end if
!print*, 'TD_StConn%ConnectionHeight2=' , TD_StConn%ConnectionHeight
TD_StConn%KellyConnectionHeight = TD_StConn%HookHeight-TD_StConn%KellyConst
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_StConn%StringVelocity = 0.0d0
else if ( Get_KellyConnection() == KELLY_CONNECTION_SINGLE ) then
!print*, 'KELLY_CONNECTION_SINGLE' , TD_StConn%ConnectionHeight
TD_StConn%StringConnectionMode = 3
!print*, 'TD_StConn%ConnectionHeight30=' , TD_StConn%ConnectionHeight
!print*, 'TD_StConn%KellyElementConst3=' , TD_StConn%KellyElementConst
!print*, 'TD_DrillStems(kk)%LengthIni3=' , TD_DrillStems(kk)%LengthIni
if (TD_Count%KellyOldStatus(1)==1 .and. TD_Count%KellyNewStatus(3)/=TD_Count%KellyOldStatus(3)) then
!print*, 'KELLY_CONNECTION_SINGLE1' , TD_StConn%ConnectionHeight
!print*, 'TD_StConn%KellyElementConst=' , TD_StConn%KellyElementConst
!print*, 'TD_DrillStems(kk)%LengthIni=' , TD_DrillStems(kk)%LengthIni
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight-TD_StConn%KellyElementConst-30.d0 !TD_DrillStems(kk)%LengthIni
TD_Count%KellyOldStatus(3) = TD_Count%KellyNewStatus(3)
TD_Count%KellyOldStatus(1) = 0
else if (TD_Count%KellyOldStatus(2)==1 .and. TD_Count%KellyNewStatus(3)/=TD_Count%KellyOldStatus(3)) then
!print*, 'KELLY_CONNECTION_SINGLE2' , TD_StConn%ConnectionHeight
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(3) = TD_Count%KellyNewStatus(3)
TD_Count%KellyOldStatus(2) = 0
end if
!print*, 'TD_StConn%ConnectionHeight3=' , TD_StConn%ConnectionHeight
!print*, 'KELLY_CONNECTION_SINGLE3' , TD_StConn%ConnectionHeight
TD_StConn%KellyConnectionHeight = TD_StConn%HookHeight-TD_StConn%KellyConst-TD_DrillStems(kk)%LengthIni
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_StConn%StringVelocity = 0.0d0
!print*, 'KELLY_CONNECTION_SINGLE4' , TD_StConn%ConnectionHeight
end if
!print*, 'KELLY_CONNECTION_SINGLE5' , TD_StConn%ConnectionHeight
else if ( TD_StConn%KellyDriveTypeMode==1 ) then
if(Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING) then
TD_Count%KellyNewStatus(4) = 1
else
TD_Count%KellyNewStatus(4) = 0
!TD_Count%KellyOldStatus(4) = 0
end if
if(Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING) then
TD_Count%KellyNewStatus(5) = 1
else
TD_Count%KellyNewStatus(5) = 0
!TD_Count%KellyOldStatus(5) = 0
end if
if(Get_ElevatorConnection() == ELEVATOR_CONNECTION_STAND) then
TD_Count%KellyNewStatus(6) = 1
else
TD_Count%KellyNewStatus(6) = 0
!TD_Count%KellyOldStatus(6) = 0
end if
if(Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE) then
TD_Count%KellyNewStatus(7) = 1
else
TD_Count%KellyNewStatus(7) = 0
!TD_Count%KellyOldStatus(7) = 0
end if
if(Get_ElevatorConnection() == ELEVATOR_LATCH_STRING) then
TD_Count%KellyNewStatus(8) = 1
else
TD_Count%KellyNewStatus(8) = 0
!TD_Count%KellyOldStatus(8) = 0
end if
if(Get_ElevatorConnection() == ELEVATOR_LATCH_SINGLE) then
TD_Count%KellyNewStatus(18) = 1
else
TD_Count%KellyNewStatus(18) = 0
!TD_Count%KellyOldStatus(18) = 0
end if
if(Get_ElevatorConnection() == ELEVATOR_LATCH_STAND) then
TD_Count%KellyNewStatus(19) = 1
else
TD_Count%KellyNewStatus(19) = 0
!TD_Count%KellyOldStatus(19) = 0
end if
if ( Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING ) then
TD_StConn%StringConnectionMode = 4
if (TD_Count%KellyOldStatus(5)==1 .and. TD_Count%KellyNewStatus(4)/=TD_Count%KellyOldStatus(4)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(4) = TD_Count%KellyNewStatus(4)
TD_Count%KellyOldStatus(5) = 0
else if (TD_Count%KellyOldStatus(6)==1 .and. TD_Count%KellyNewStatus(4)/=TD_Count%KellyOldStatus(4)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight+(3.d0*TD_DrillStems(kk)%LengthIni)
TD_Count%KellyOldStatus(4) = TD_Count%KellyNewStatus(4)
TD_Count%KellyOldStatus(6) = 0
else if (TD_Count%KellyOldStatus(7)==1 .and. TD_Count%KellyNewStatus(4)/=TD_Count%KellyOldStatus(4)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight+TD_DrillStems(kk)%LengthIni
TD_Count%KellyOldStatus(4) = TD_Count%KellyNewStatus(4)
TD_Count%KellyOldStatus(7) = 0
else if (TD_Count%KellyOldStatus(8)==1 .and. TD_Count%KellyNewStatus(4)/=TD_Count%KellyOldStatus(4)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(4) = TD_Count%KellyNewStatus(4)
TD_Count%KellyOldStatus(8) = 0
end if
if ( Get_Slips() == SLIPS_SET_END ) then
!if ( TD_StConn%HookVelocity>0. ) then
! Print*, '*** UnSet Slips ***' !???????????????????
!end if
TD_StConn%ElevatorHeight = TD_StConn%HookHeight-TD_StConn%ElevatorConst !?????????????
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_StConn%StringVelocity = 0.0d0
else
TD_StConn%ElevatorHeight = TD_StConn%HookHeight-TD_StConn%ElevatorConst
TD_StConn%ConnectionHeight = TD_StConn%HookHeight-TD_StConn%ElevatorConst+(LengthSum+TD_StConn%ElevatorECG) !(LengthSum+TD_DrillStems(kk)%ToolJointRange)
TD_StConn%StringVelocity = TD_StConn%HookVelocity
end if
else if ( Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING ) then
TD_StConn%StringConnectionMode = 5
if (TD_Count%KellyOldStatus(4)==1 .and. TD_Count%KellyNewStatus(5)/=TD_Count%KellyOldStatus(5)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(5) = TD_Count%KellyNewStatus(5)
TD_Count%KellyOldStatus(4) = 0
else if (TD_Count%KellyOldStatus(6)==1 .and. TD_Count%KellyNewStatus(5)/=TD_Count%KellyOldStatus(5)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(5) = TD_Count%KellyNewStatus(5)
TD_Count%KellyOldStatus(6) = 0
else if (TD_Count%KellyOldStatus(7)==1 .and. TD_Count%KellyNewStatus(5)/=TD_Count%KellyOldStatus(5)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(5) = TD_Count%KellyNewStatus(5)
TD_Count%KellyOldStatus(7) = 0
else if (TD_Count%KellyOldStatus(8)==1 .and. TD_Count%KellyNewStatus(5)/=TD_Count%KellyOldStatus(5)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(5) = TD_Count%KellyNewStatus(5)
TD_Count%KellyOldStatus(8) = 0
else if (TD_Count%KellyOldStatus(2)==1 .and. TD_Count%KellyNewStatus(5)/=TD_Count%KellyOldStatus(5)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(5) = TD_Count%KellyNewStatus(5)
TD_Count%KellyOldStatus(2) = 0
end if
TD_StConn%ElevatorHeight = TD_StConn%HookHeight-TD_StConn%ElevatorConst
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_StConn%StringVelocity = 0.0d0
else if ( Get_ElevatorConnection() == ELEVATOR_CONNECTION_STAND ) then
TD_StConn%StringConnectionMode = 6
if (TD_Count%KellyOldStatus(4)==1 .and. TD_Count%KellyNewStatus(6)/=TD_Count%KellyOldStatus(6)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight-(3.*TD_DrillStems(kk)%LengthIni)
TD_Count%KellyOldStatus(6) = TD_Count%KellyNewStatus(6)
TD_Count%KellyOldStatus(4) = 0
else if (TD_Count%KellyOldStatus(5)==1 .and. TD_Count%KellyNewStatus(6)/=TD_Count%KellyOldStatus(6)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(6) = TD_Count%KellyNewStatus(6)
TD_Count%KellyOldStatus(5) = 0
else if (TD_Count%KellyOldStatus(7)==1 .and. TD_Count%KellyNewStatus(6)/=TD_Count%KellyOldStatus(6)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(6) = TD_Count%KellyNewStatus(6)
TD_Count%KellyOldStatus(7) = 0
else if (TD_Count%KellyOldStatus(8)==1 .and. TD_Count%KellyNewStatus(6)/=TD_Count%KellyOldStatus(6)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(6) = TD_Count%KellyNewStatus(6)
TD_Count%KellyOldStatus(8) = 0
end if
TD_StConn%ElevatorHeight = TD_StConn%HookHeight-TD_StConn%ElevatorConst-(3.*TD_DrillStems(kk)%LengthIni)
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_StConn%StringVelocity = 0.0d0
else if ( Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE ) then
TD_StConn%StringConnectionMode = 7
if (TD_Count%KellyOldStatus(4)==1 .and. TD_Count%KellyNewStatus(7)/=TD_Count%KellyOldStatus(7)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight-TD_DrillStems(kk)%LengthIni
TD_Count%KellyOldStatus(7) = TD_Count%KellyNewStatus(7)
TD_Count%KellyOldStatus(4) = 0
else if (TD_Count%KellyOldStatus(5)==1 .and. TD_Count%KellyNewStatus(7)/=TD_Count%KellyOldStatus(7)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(7) = TD_Count%KellyNewStatus(7)
TD_Count%KellyOldStatus(5) = 0
else if (TD_Count%KellyOldStatus(6)==1 .and. TD_Count%KellyNewStatus(7)/=TD_Count%KellyOldStatus(7)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(7) = TD_Count%KellyNewStatus(7)
TD_Count%KellyOldStatus(6) = 0
else if (TD_Count%KellyOldStatus(8)==1 .and. TD_Count%KellyNewStatus(7)/=TD_Count%KellyOldStatus(7)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(7) = TD_Count%KellyNewStatus(7)
TD_Count%KellyOldStatus(8) = 0
end if
TD_StConn%ElevatorHeight = TD_StConn%HookHeight-TD_StConn%ElevatorConst-TD_DrillStems(kk)%LengthIni
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_StConn%StringVelocity = 0.0d0
else if ( Get_ElevatorConnection() == ELEVATOR_LATCH_STRING ) then
TD_StConn%StringConnectionMode = 8
if (TD_Count%KellyOldStatus(4)==1 .and. TD_Count%KellyNewStatus(8)/=TD_Count%KellyOldStatus(8)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(8) = TD_Count%KellyNewStatus(8)
TD_Count%KellyOldStatus(4) = 0
else if (TD_Count%KellyOldStatus(5)==1 .and. TD_Count%KellyNewStatus(8)/=TD_Count%KellyOldStatus(8)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(8) = TD_Count%KellyNewStatus(8)
TD_Count%KellyOldStatus(5) = 0
else if (TD_Count%KellyOldStatus(6)==1 .and. TD_Count%KellyNewStatus(8)/=TD_Count%KellyOldStatus(8)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(8) = TD_Count%KellyNewStatus(8)
TD_Count%KellyOldStatus(6) = 0
else if (TD_Count%KellyOldStatus(7)==1 .and. TD_Count%KellyNewStatus(8)/=TD_Count%KellyOldStatus(8)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(8) = TD_Count%KellyNewStatus(8)
TD_Count%KellyOldStatus(7) = 0
end if
TD_StConn%ElevatorHeight = TD_StConn%HookHeight-TD_StConn%ElevatorConst
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_StConn%StringVelocity = 0.0d0
else if ( Get_ElevatorConnection() == ELEVATOR_LATCH_SINGLE ) then
TD_StConn%StringConnectionMode = 18
if (TD_Count%KellyOldStatus(5)==1 .and. TD_Count%KellyNewStatus(18)/=TD_Count%KellyOldStatus(18)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(18) = TD_Count%KellyNewStatus(18)
TD_Count%KellyOldStatus(5) = 0
else if (TD_Count%KellyOldStatus(7)==1 .and. TD_Count%KellyNewStatus(18)/=TD_Count%KellyOldStatus(18)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(18) = TD_Count%KellyNewStatus(18)
TD_Count%KellyOldStatus(7) = 0
else if (TD_Count%KellyOldStatus(8)==1 .and. TD_Count%KellyNewStatus(18)/=TD_Count%KellyOldStatus(18)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(18) = TD_Count%KellyNewStatus(18)
TD_Count%KellyOldStatus(8) = 0
end if
TD_StConn%ElevatorHeight = TD_StConn%HookHeight-TD_StConn%ElevatorConst
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_StConn%StringVelocity = 0.0d0
else if ( Get_ElevatorConnection() == ELEVATOR_LATCH_STAND ) then
TD_StConn%StringConnectionMode = 19
if (TD_Count%KellyOldStatus(5)==1 .and. TD_Count%KellyNewStatus(19)/=TD_Count%KellyOldStatus(19)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(19) = TD_Count%KellyNewStatus(19)
TD_Count%KellyOldStatus(5) = 0
else if (TD_Count%KellyOldStatus(6)==1 .and. TD_Count%KellyNewStatus(19)/=TD_Count%KellyOldStatus(19)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(19) = TD_Count%KellyNewStatus(19)
TD_Count%KellyOldStatus(6) = 0
else if (TD_Count%KellyOldStatus(8)==1 .and. TD_Count%KellyNewStatus(19)/=TD_Count%KellyOldStatus(19)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(19) = TD_Count%KellyNewStatus(19)
TD_Count%KellyOldStatus(8) = 0
end if
TD_StConn%ElevatorHeight = TD_StConn%HookHeight-TD_StConn%ElevatorConst
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_StConn%StringVelocity = 0.0d0
end if
else if ( TD_StConn%KellyDriveTypeMode==2 ) then
if( Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then
TD_Count%KellyNewStatus(9) = 1
else
TD_Count%KellyNewStatus(9) = 0
!TD_Count%KellyOldStatus(9) = 0
end if
if( Get_TdsConnectionModes()==TDS_CONNECTION_STRING ) then
TD_Count%KellyNewStatus(10) = 1
else
TD_Count%KellyNewStatus(10) = 0
!TD_Count%KellyOldStatus(10) = 0
end if
if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_STRING ) then
TD_Count%KellyNewStatus(11) = 1
else
TD_Count%KellyNewStatus(11) = 0
!TD_Count%KellyOldStatus(11) = 0
end if
if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STRING ) then
TD_Count%KellyNewStatus(12) = 1
else
TD_Count%KellyNewStatus(12) = 0
!TD_Count%KellyOldStatus(12) = 0
end if
if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then
TD_Count%KellyNewStatus(13) = 1
else
TD_Count%KellyNewStatus(13) = 0
!TD_Count%KellyOldStatus(13) = 0
end if
if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STAND ) then
TD_Count%KellyNewStatus(14) = 1
else
TD_Count%KellyNewStatus(14) = 0
!TD_Count%KellyOldStatus(14) = 0
end if
if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_SINGLE ) then
TD_Count%KellyNewStatus(15) = 1
else
TD_Count%KellyNewStatus(15) = 0
!TD_Count%KellyOldStatus(15) = 0
end if
if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_SINGLE ) then
TD_Count%KellyNewStatus(16) = 1
else
TD_Count%KellyNewStatus(16) = 0
!TD_Count%KellyOldStatus(16) = 0
end if
if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_STAND ) then
TD_Count%KellyNewStatus(17) = 1
else
TD_Count%KellyNewStatus(17) = 0
!TD_Count%KellyOldStatus(17) = 0
end if
if ( Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then
TD_StConn%StringConnectionMode = 9
if (TD_Count%KellyOldStatus(10)==1 .and. TD_Count%KellyNewStatus(9)/=TD_Count%KellyOldStatus(9)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(9) = TD_Count%KellyNewStatus(9)
TD_Count%KellyOldStatus(10) = 0
else if (TD_Count%KellyOldStatus(11)==1 .and. TD_Count%KellyNewStatus(9)/=TD_Count%KellyOldStatus(9)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(9) = TD_Count%KellyNewStatus(9)
TD_Count%KellyOldStatus(11) = 0
else if (TD_Count%KellyOldStatus(13)==1 .and. TD_Count%KellyNewStatus(9)/=TD_Count%KellyOldStatus(9)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(9) = TD_Count%KellyNewStatus(9)
TD_Count%KellyOldStatus(13) = 0
end if
if ( Get_Slips() == SLIPS_SET_END ) then
!if ( TD_StConn%HookVelocity>0. ) then
! Print*, '*** UnSet Slips ***' !???????????????????
!end if
TD_StConn%TDSHeight = TD_StConn%HookHeight-TD_StConn%TDSLength-TD_StConn%TDSToolJointLength !?????????????
TD_StConn%TDSElevatorHeight = TD_StConn%HookHeight-TD_StConn%TDSElevatorLength !?????????????
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_StConn%StringVelocity = 0.0d0
else
TD_StConn%TDSHeight = TD_StConn%HookHeight-TD_StConn%TDSLength-TD_StConn%TDSToolJointLength !?????????????
TD_StConn%TDSElevatorHeight = TD_StConn%HookHeight-TD_StConn%TDSElevatorLength !?????????????
TD_StConn%ConnectionHeight = TD_StConn%TDSHeight
TD_StConn%StringVelocity = TD_StConn%HookVelocity
end if
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_STRING ) then
TD_StConn%StringConnectionMode = 10
if (TD_Count%KellyOldStatus(9)==1 .and. TD_Count%KellyNewStatus(10)/=TD_Count%KellyOldStatus(10)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(10) = TD_Count%KellyNewStatus(10)
TD_Count%KellyOldStatus(9) = 0
end if
if ( Get_Slips() == SLIPS_SET_END ) then
!if ( TD_StConn%HookVelocity>0. ) then
! Print*, '*** UnSet Slips ***' !???????????????????
!end if
TD_StConn%TDSHeight = TD_StConn%HookHeight-TD_StConn%TDSLength-TD_StConn%TDSToolJointLength !?????????????
TD_StConn%TDSElevatorHeight = TD_StConn%HookHeight-TD_StConn%TDSElevatorLength !?????????????
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_StConn%StringVelocity = 0.0d0
else
TD_StConn%TDSHeight = TD_StConn%HookHeight-TD_StConn%TDSLength-TD_StConn%TDSToolJointLength !?????????????
TD_StConn%TDSElevatorHeight = TD_StConn%HookHeight-TD_StConn%TDSElevatorLength !?????????????
TD_StConn%ConnectionHeight = TD_StConn%TDSHeight
TD_StConn%StringVelocity = TD_StConn%HookVelocity
end if
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_STRING ) then
TD_StConn%StringConnectionMode = 11
if (TD_Count%KellyOldStatus(9)==1 .and. TD_Count%KellyNewStatus(11)/=TD_Count%KellyOldStatus(11)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(11) = TD_Count%KellyNewStatus(11)
TD_Count%KellyOldStatus(9) = 0
else if (TD_Count%KellyOldStatus(12)==1 .and. TD_Count%KellyNewStatus(11)/=TD_Count%KellyOldStatus(11)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(11) = TD_Count%KellyNewStatus(11)
TD_Count%KellyOldStatus(12) = 0
else if (TD_Count%KellyOldStatus(13)==1 .and. TD_Count%KellyNewStatus(11)/=TD_Count%KellyOldStatus(11)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(11) = TD_Count%KellyNewStatus(11)
TD_Count%KellyOldStatus(13) = 0
else if (TD_Count%KellyOldStatus(16)==1 .and. TD_Count%KellyNewStatus(11)/=TD_Count%KellyOldStatus(11)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight+(TD_DrillStems(kk)%LengthIni)
TD_Count%KellyOldStatus(11) = TD_Count%KellyNewStatus(11)
TD_Count%KellyOldStatus(16) = 0
else if (TD_Count%KellyOldStatus(17)==1 .and. TD_Count%KellyNewStatus(11)/=TD_Count%KellyOldStatus(11)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight+(3.d0*TD_DrillStems(kk)%LengthIni)
TD_Count%KellyOldStatus(11) = TD_Count%KellyNewStatus(11)
TD_Count%KellyOldStatus(17) = 0
end if
TD_StConn%TDSHeight = TD_StConn%HookHeight-TD_StConn%TDSLength !?????????????
TD_StConn%TDSElevatorHeight = TD_StConn%HookHeight-TD_StConn%TDSElevatorLength !?????????????
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_StConn%StringVelocity = 0.0d0
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STRING ) then
TD_StConn%StringConnectionMode = 12
if (TD_Count%KellyOldStatus(11)==1 .and. TD_Count%KellyNewStatus(12)/=TD_Count%KellyOldStatus(12)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(12) = TD_Count%KellyNewStatus(12)
TD_Count%KellyOldStatus(11) = 0
else if (TD_Count%KellyOldStatus(14)==1 .and. TD_Count%KellyNewStatus(12)/=TD_Count%KellyOldStatus(12)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight+(3.d0*TD_DrillStems(kk)%LengthIni)
TD_Count%KellyOldStatus(12) = TD_Count%KellyNewStatus(12)
TD_Count%KellyOldStatus(14) = 0
else if (TD_Count%KellyOldStatus(15)==1 .and. TD_Count%KellyNewStatus(12)/=TD_Count%KellyOldStatus(12)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight+(TD_DrillStems(kk)%LengthIni)
TD_Count%KellyOldStatus(12) = TD_Count%KellyNewStatus(12)
TD_Count%KellyOldStatus(15) = 0
end if
if ( Get_Slips() == SLIPS_SET_END ) then
!if ( TD_StConn%HookVelocity>0. ) then
! Print*, '*** UnSet Slips ***' !???????????????????
!end if
TD_StConn%TDSHeight = TD_StConn%HookHeight-TD_StConn%TDSLength !?????????????
TD_StConn%TDSElevatorHeight = TD_StConn%HookHeight-TD_StConn%TDSElevatorLength !?????????????
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_StConn%StringVelocity = 0.0d0
else
TD_StConn%TDSHeight = TD_StConn%HookHeight-TD_StConn%TDSLength !?????????????
TD_StConn%TDSElevatorHeight = TD_StConn%HookHeight-TD_StConn%TDSLength-TD_StConn%TDSElevatorLength !?????????????
TD_StConn%ConnectionHeight = TD_StConn%HookHeight-TD_StConn%TDSElevatorLength+(LengthSum+TD_StConn%TDSElevatorECG) !?????????????
TD_StConn%StringVelocity = TD_StConn%HookVelocity
end if
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then
TD_StConn%StringConnectionMode = 13
if (TD_Count%KellyOldStatus(9)==1 .and. TD_Count%KellyNewStatus(13)/=TD_Count%KellyOldStatus(13)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(13) = TD_Count%KellyNewStatus(13)
TD_Count%KellyOldStatus(9) = 0
else if (TD_Count%KellyOldStatus(11)==1 .and. TD_Count%KellyNewStatus(13)/=TD_Count%KellyOldStatus(13)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(13) = TD_Count%KellyNewStatus(13)
TD_Count%KellyOldStatus(11) = 0
else if (TD_Count%KellyOldStatus(12)==1 .and. TD_Count%KellyNewStatus(13)/=TD_Count%KellyOldStatus(13)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(13) = TD_Count%KellyNewStatus(13)
TD_Count%KellyOldStatus(12) = 0
else if (TD_Count%KellyOldStatus(14)==1 .and. TD_Count%KellyNewStatus(13)/=TD_Count%KellyOldStatus(13)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(13) = TD_Count%KellyNewStatus(13)
TD_Count%KellyOldStatus(14) = 0
else if (TD_Count%KellyOldStatus(15)==1 .and. TD_Count%KellyNewStatus(13)/=TD_Count%KellyOldStatus(13)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(13) = TD_Count%KellyNewStatus(13)
TD_Count%KellyOldStatus(15) = 0
else if (TD_Count%KellyOldStatus(16)==1 .and. TD_Count%KellyNewStatus(13)/=TD_Count%KellyOldStatus(13)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(13) = TD_Count%KellyNewStatus(13)
TD_Count%KellyOldStatus(16) = 0
end if
TD_StConn%TDSHeight = TD_StConn%HookHeight-TD_StConn%TDSLength !?????????????
TD_StConn%TDSElevatorHeight = TD_StConn%HookHeight-TD_StConn%TDSElevatorLength !?????????????
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_StConn%StringVelocity = 0.0d0
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STAND ) then
TD_StConn%StringConnectionMode = 14
if (TD_Count%KellyOldStatus(12)==1 .and. TD_Count%KellyNewStatus(14)/=TD_Count%KellyOldStatus(14)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight-(3.d0*TD_DrillStems(kk)%LengthIni)
TD_Count%KellyOldStatus(14) = TD_Count%KellyNewStatus(14)
TD_Count%KellyOldStatus(12) = 0
else if (TD_Count%KellyOldStatus(13)==1 .and. TD_Count%KellyNewStatus(14)/=TD_Count%KellyOldStatus(14)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(14) = TD_Count%KellyNewStatus(14)
TD_Count%KellyOldStatus(13) = 0
else if (TD_Count%KellyOldStatus(17)==1 .and. TD_Count%KellyNewStatus(14)/=TD_Count%KellyOldStatus(14)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(14) = TD_Count%KellyNewStatus(14)
TD_Count%KellyOldStatus(17) = 0
end if
TD_StConn%TDSHeight = TD_StConn%HookHeight-TD_StConn%TDSLength !?????????????
TD_StConn%TDSElevatorHeight = TD_StConn%HookHeight-TD_StConn%TDSElevatorLength !?????????????
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_StConn%StringVelocity = 0.0d0
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_SINGLE ) then
TD_StConn%StringConnectionMode = 15
if (TD_Count%KellyOldStatus(12)==1 .and. TD_Count%KellyNewStatus(15)/=TD_Count%KellyOldStatus(15)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight-(TD_DrillStems(kk)%LengthIni)
TD_Count%KellyOldStatus(15) = TD_Count%KellyNewStatus(15)
TD_Count%KellyOldStatus(12) = 0
else if (TD_Count%KellyOldStatus(13)==1 .and. TD_Count%KellyNewStatus(15)/=TD_Count%KellyOldStatus(15)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(15) = TD_Count%KellyNewStatus(15)
TD_Count%KellyOldStatus(13) = 0
else if (TD_Count%KellyOldStatus(16)==1 .and. TD_Count%KellyNewStatus(15)/=TD_Count%KellyOldStatus(15)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(15) = TD_Count%KellyNewStatus(15)
TD_Count%KellyOldStatus(16) = 0
end if
TD_StConn%TDSHeight = TD_StConn%HookHeight-TD_StConn%TDSLength !?????????????
TD_StConn%TDSElevatorHeight = TD_StConn%HookHeight-TD_StConn%TDSElevatorLength !?????????????
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_StConn%StringVelocity = 0.0d0
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_SINGLE ) then
TD_StConn%StringConnectionMode = 16
if (TD_Count%KellyOldStatus(11)==1 .and. TD_Count%KellyNewStatus(16)/=TD_Count%KellyOldStatus(16)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight-(TD_DrillStems(kk)%LengthIni)
TD_Count%KellyOldStatus(16) = TD_Count%KellyNewStatus(16)
TD_Count%KellyOldStatus(11) = 0
else if (TD_Count%KellyOldStatus(13)==1 .and. TD_Count%KellyNewStatus(16)/=TD_Count%KellyOldStatus(16)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(16) = TD_Count%KellyNewStatus(16)
TD_Count%KellyOldStatus(13) = 0
else if (TD_Count%KellyOldStatus(15)==1 .and. TD_Count%KellyNewStatus(16)/=TD_Count%KellyOldStatus(16)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_Count%KellyOldStatus(16) = TD_Count%KellyNewStatus(16)
TD_Count%KellyOldStatus(15) = 0
end if
TD_StConn%TDSHeight = TD_StConn%HookHeight-TD_StConn%TDSLength !?????????????
TD_StConn%TDSElevatorHeight = TD_StConn%HookHeight-TD_StConn%TDSElevatorLength !?????????????
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_StConn%StringVelocity = 0.0d0
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_STAND ) then
TD_StConn%StringConnectionMode = 17
if (TD_Count%KellyOldStatus(11)==1 .and. TD_Count%KellyNewStatus(17)/=TD_Count%KellyOldStatus(17)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight-(3.d0*TD_DrillStems(kk)%LengthIni)
TD_Count%KellyOldStatus(17) = TD_Count%KellyNewStatus(17)
TD_Count%KellyOldStatus(11) = 0
else if (TD_Count%KellyOldStatus(14)==1 .and. TD_Count%KellyNewStatus(17)/=TD_Count%KellyOldStatus(17)) then
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight+(3.d0*TD_DrillStems(kk)%LengthIni)
TD_Count%KellyOldStatus(17) = TD_Count%KellyNewStatus(17)
TD_Count%KellyOldStatus(14) = 0
end if
TD_StConn%TDSHeight = TD_StConn%HookHeight-TD_StConn%TDSLength !?????????????
TD_StConn%TDSElevatorHeight = TD_StConn%HookHeight-TD_StConn%TDSElevatorLength !?????????????
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight
TD_StConn%StringVelocity = 0.0d0
end if

end if
!Print*, 'TD_StConn%StringConnectionMode=' , TD_StConn%StringConnectionMode
!print* , 'TD_StConn%ConnectionHeight=' , TD_StConn%ConnectionHeight
!Print*, 'TD_StConn%StringConnectionMode=' , TD_StConn%StringConnectionMode
!print*, 'TD_String%DrillStemComponentsNumbs=' , TD_String%DrillStemComponentsNumbs
!!Print*, 'TD_Count%KellyNewStatus(1)=' , TD_Count%KellyNewStatus(1)
!Print*, 'TD_Count%KellyOldStatus(1)=' , TD_Count%KellyOldStatus(1)
!Print*, 'TD_Count%KellyNewStatus(2)=' , TD_Count%KellyNewStatus(2)
!Print*, 'TD_Count%KellyOldStatus(2)=' , TD_Count%KellyOldStatus(2)
!Print*, 'TD_Count%KellyNewStatus(3)=' , TD_Count%KellyNewStatus(3)
!Print*, 'TD_Count%KellyOldStatus(3)=' , TD_Count%KellyOldStatus(3)
if ( (any(TD_StConn%StringConnectionMode==(/1,9,10/))) .or. DrillingConsole%CloseSafetyValve==.true. ) then !for fluid module
TD_StConn%FluidStringConnectionMode = 1 !string is connected
!else if ( (any(TD_StConn%StringConnectionMode==(/1,9,10/))) .or. DrillingConsole%CloseSafetyValve==.true. ) then
!
else
TD_StConn%FluidStringConnectionMode = 0 !string is not connected
end if
!====================================================
! Zero String Speed
!====================================================
if ( abs(TD_StConn%StringVelocity)<=0.05d0 ) then ! [ft/s]
TD_Load%ZeroStringSpeed = 1
Call Set_ZeroStringSpeed(.true.)
else
TD_Load%ZeroStringSpeed = 0
Call Set_ZeroStringSpeed(.false.)
end if

end subroutine

+ 0
- 28
Equipments/TorqueDrag/TD_DrillingSubs/TD_WellElementsConfiguration.f90 View File

@@ -1,28 +0,0 @@
subroutine TD_WellElementsConfiguration
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry

implicit none

Integer :: i, j

!====================================================
! Modified Well Elements Data
!====================================================
Do i = 1 , TD_WellEl%ROPHoleNumbs
!TD_ROPHole(i)%TopDepth = TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%TopDepth
TD_ROPHole(i)%DownDepth = TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%DownDepth
TD_ROPHole(i)%Length = TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%IntervalLength
TD_ROPHole(i)%Id = TD_ROPHole(i)%Id !!???????????
End Do
end subroutine

+ 0
- 51
Equipments/TorqueDrag/TD_DrillingSubs/TD_WellGeoConfiguration.f90 View File

@@ -1,51 +0,0 @@
subroutine TD_WellGeoConfiguration
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData
Use sROP_Variables
Use CDataDisplayConsoleVariables
Use CWarningsVariables

implicit none

!====================================================
! Well Geometry Data Modification
!====================================================
!=====> ROP Calculation
if ( TD_DrillStems(1)%ComponentType==0 .and. MaximumWellDepthExceeded==.false. ) then
Call ROP_MainCalculation
else
ROP_Bit%RateOfPenetration = 0.d0
Call Set_ROP(ROP_Bit%RateOfPenetration)
end if
!=====> ROPHole Data correction
TD_WellEl%ROP = (ROP_Bit%RateOfPenetration/3600.d0) ! [ft/s]
TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%VerticalDepth = TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%VerticalDepth++((TD_WellEl%ROP*TD_General%TimeStep)*cos(TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%StartAngle))
TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%IntervalLength = TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%IntervalLength+(TD_WellEl%ROP*TD_General%TimeStep) !????????check
TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%DownDepth = TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%TopDepth+TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%IntervalLength
!=====> Well Total Length Calculation
TD_WellGeneral%WellTotalLength = TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%DownDepth
TD_WellGeneral%WellTotalVerticalLength = TD_WellGeneral%WellTotalVerticalLength+((TD_WellEl%ROP*TD_General%TimeStep)*cos(TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%StartAngle))
Call Set_TotalDepth(real(TD_WellGeneral%WellTotalLength,8))
end subroutine

+ 0
- 78
Equipments/TorqueDrag/TD_DrillingSubs/TVD_Calculator.f90 View File

@@ -1,78 +0,0 @@
subroutine TVD_Calculator(MeasuredDepth,VerticalDepth)

Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_StringConnectionData

implicit none

Integer :: kk
REAL(8) :: MeasuredDepth , VerticalDepth
REAL(8) :: mm , nn , dl , StartAngle , EndAngle
if ( MeasuredDepth<=0. ) then
VerticalDepth = MeasuredDepth
!TDGeo%Angle(ii) = 0.d0
return
end if
mm = 0.d0 !last vertical depth
nn = 0.d0 !last measured depth
EndAngle = TD_WellGeo(1)%StartAngle
!TDGeo%Angle(jj) = EndAngle
do kk = 1, TD_WellGeneral%WellIntervalsCount
StartAngle = EndAngle
if ( MeasuredDepth>TD_WellGeo(kk)%TopDepth ) then
if ( MeasuredDepth>TD_WellGeo(kk)%DownDepth ) then
dl = TD_WellGeo(kk)%DownDepth-nn ![ft]
nn = TD_WellGeo(kk)%DownDepth
if ( TD_WellGeo(kk)%HoleType==0 ) then
EndAngle = StartAngle
VerticalDepth = mm+(dl*cos(TD_WellGeo(kk)%StartAngle)) ![ft]
!TDGeo%Angle(ii) = EndAngle
else if ( TD_WellGeo(kk)%HoleType==1 ) then
EndAngle = StartAngle+(dl/TD_WellGeo(kk)%RCurvature) !?????
VerticalDepth = mm+(TD_WellGeo(kk)%RCurvature*sin(abs(EndAngle)-abs(StartAngle))*cos(abs(StartAngle)))-(TD_WellGeo(kk)%RCurvature*(1.-cos(abs(EndAngle)-abs(StartAngle)))*sin(abs(StartAngle)))
!TDGeo%Angle(ii) = EndAngle
else if ( TD_WellGeo(kk)%HoleType==2 ) then
EndAngle = StartAngle-(dl/TD_WellGeo(kk)%RCurvature) !?????
VerticalDepth = mm+(TD_WellGeo(kk)%RCurvature*sin(abs(abs(EndAngle)-abs(StartAngle)))*cos(abs(StartAngle)))+(TD_WellGeo(kk)%RCurvature*(1.-cos(abs(abs(EndAngle)-abs(StartAngle))))*sin(abs(StartAngle)))
!TDGeo%Angle(ii) = EndAngle
end if
mm = VerticalDepth
else
dl = MeasuredDepth-nn
nn = MeasuredDepth
if ( TD_WellGeo(kk)%HoleType==0 ) then
EndAngle = StartAngle
VerticalDepth = mm+(dl*cos(TD_WellGeo(kk)%StartAngle))
!TDGeo%Angle(ii) = EndAngle
else if ( TD_WellGeo(kk)%HoleType==1 ) then
EndAngle = StartAngle+(dl/TD_WellGeo(kk)%RCurvature) !?????
VerticalDepth = mm+(TD_WellGeo(kk)%RCurvature*sin(abs(EndAngle)-abs(StartAngle))*cos(abs(StartAngle)))-(TD_WellGeo(kk)%RCurvature*(1.-cos(abs(EndAngle)-abs(StartAngle)))*sin(abs(StartAngle)))
!TDGeo%Angle(ii) = EndAngle
else if ( TD_WellGeo(kk)%HoleType==2 ) then
EndAngle = StartAngle-(dl/TD_WellGeo(kk)%RCurvature) !?????
VerticalDepth = mm+(TD_WellGeo(kk)%RCurvature*sin(abs(abs(EndAngle)-abs(StartAngle)))*cos(abs(StartAngle)))+(TD_WellGeo(kk)%RCurvature*(1.-cos(abs(abs(EndAngle)-abs(StartAngle))))*sin(abs(StartAngle)))
!TDGeo%Angle(ii) = EndAngle
end if
mm = VerticalDepth
exit
end if
end if
end do
end subroutine

+ 0
- 32
Equipments/TorqueDrag/TD_Forces/TD_BouyancyFactor.f90 View File

@@ -1,32 +0,0 @@
subroutine TD_BouyancyFactor (i)
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData

implicit none
Integer :: i


!====================================================
! Bouyancy Factor Calculation
!====================================================
if ( TD_DrillStems(i)%MudDensityOut==0.d0 .or. TD_DrillStems(i)%MudDensityIn==0.d0 ) then
TD_DrillStems(i)%BouyancyFactor = 0.d0
else
TD_DrillStems(i)%BouyancyFactor = 1.d0-( ((TD_DrillStems(i)%MudDensityOut*(TD_DrillStems(i)%Od**2)/4.0d0) &
-(TD_DrillStems(i)%MudDensityIn*(TD_DrillStems(i)%Id**2)/4.0d0)) &
/(TD_DrillStems(i)%Density*((TD_DrillStems(i)%Od**2-TD_DrillStems(i)%Id**2))/4.0d0) )
end if
end subroutine

+ 0
- 65
Equipments/TorqueDrag/TD_Forces/TD_BuildArea/TD_ForceDownB.f90 View File

@@ -1,65 +0,0 @@
subroutine TD_ForceDownB(i,TD_SemiMudVisc)
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData

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

+ 0
- 56
Equipments/TorqueDrag/TD_Forces/TD_BuildArea/TD_ForceDownBRot.f90 View File

@@ -1,56 +0,0 @@
subroutine TD_ForceDownBRot(i,TD_SemiMudVisc)
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData

implicit none
Integer :: i
Real(8) :: TD_SemiMudVisc
If (i==1) then
TD_DrillStems(1)%Force1 = -TD_String%WeightOnBit
TD_DrillStems(1)%Force2 = TD_DrillStems(1)%Force1 + (TD_DrillStems(1)%Force1 * &
(exp(-(TD_SemiMudVisc*TD_DrillStems(1)%MudVisCorrectCoef)*abs(TD_DrillStems(1)%EndAngle-TD_DrillStems(1)%StartAngle))-1.0d0) * &
sin(TD_DrillStems(1)%CombVelRatio )) + (TD_DrillStems(1)%BouyancyFactor * &
TD_DrillStems(1)%WeightperLength * TD_DrillStems(1)%Length * &
((sin(TD_DrillStems(1)%EndAngle)-sin(TD_DrillStems(1)%StartAngle))/ &
(TD_DrillStems(1)%EndAngle-TD_DrillStems(1)%StartAngle)))
if (TD_DrillStems(i)%ComponentType==0) then
TD_DrillStems(i)%Torque = TD_String%BitTorque
else
TD_DrillStems(i)%Torque = TD_SemiMudVisc*TD_DrillStems(i)%RtoolJoint*TD_DrillStems(i)%Force1* &
abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)*cos(TD_DrillStems(i)%CombVelRatio)
end if
return
End If
!=========> F1 Calculation
TD_DrillStems(i)%Force1 = TD_DrillStems(i-1)%Force2
!=========> F2 Calculation
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%Force1 * &
(exp(-(TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle))-1.0d0) * &
sin(TD_DrillStems(i)%CombVelRatio )) + (TD_DrillStems(i)%BouyancyFactor * &
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * &
((sin(TD_DrillStems(i)%EndAngle)-sin(TD_DrillStems(i)%StartAngle))/ &
(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)))
!
!Strains(i)%Dl = TDForces(i)%Force * (Elements(i)%Length) / &
! (Elements(i)%Area * Element%ElasticModule)
!
TD_DrillStems(i)%Torque = TD_SemiMudVisc*TD_DrillStems(i)%RtoolJoint*TD_DrillStems(i)%Force1* &
abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)*cos(TD_DrillStems(i)%CombVelRatio)
end subroutine

+ 0
- 75
Equipments/TorqueDrag/TD_Forces/TD_BuildArea/TD_ForceUpB.f90 View File

@@ -1,75 +0,0 @@
subroutine TD_ForceUpB(i,TD_SemiMudVisc)
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData
implicit none
Integer :: i
Real(8) :: TD_SemiMudVisc
If (i==1) then
TD_DrillStems(1)%Force1 = -TD_String%WeightOnBit
TD_DrillStems(1)%Force2 = (TD_DrillStems(1)%Force1 * exp((TD_SemiMudVisc*TD_DrillStems(1)%MudVisCorrectCoef)*(TD_DrillStems(1)%EndAngle-TD_DrillStems(1)%StartAngle))) - &
(((TD_DrillStems(1)%WeightperLength * TD_DrillStems(1)%RCurvature) / (1 + (TD_SemiMudVisc*TD_DrillStems(1)%MudVisCorrectCoef)**2)) * &
(((1-(TD_SemiMudVisc*TD_DrillStems(1)%MudVisCorrectCoef)**2)*(sin(TD_DrillStems(1)%EndAngle) - &
(exp((TD_SemiMudVisc*TD_DrillStems(1)%MudVisCorrectCoef)*(TD_DrillStems(1)%EndAngle-TD_DrillStems(1)%StartAngle)) * sin(TD_DrillStems(1)%StartAngle))))) - &
(2.0d0* (TD_SemiMudVisc*TD_DrillStems(1)%MudVisCorrectCoef)*(cos(TD_DrillStems(1)%EndAngle) - &
(exp((TD_SemiMudVisc*TD_DrillStems(1)%MudVisCorrectCoef)*(TD_DrillStems(1)%EndAngle-TD_DrillStems(1)%StartAngle))* &
cos(TD_DrillStems(1)%StartAngle)))))
if (TD_DrillStems(i)%ComponentType==0) then
TD_DrillStems(i)%Torque = TD_String%BitTorque
else
TD_DrillStems(i)%Torque = (TD_DrillStems(i)%MudViscosity * TD_DrillStems(i)%RtoolJoint * (TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%WeightperLength * &
TD_DrillStems(i)%RCurvature * sin(TD_DrillStems(i)%StartAngle))) * &
abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)) + &
(2.0d0 * TD_DrillStems(i)%MudViscosity * TD_DrillStems(i)%RtoolJoint * &
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature * &
(cos(TD_DrillStems(i)%EndAngle) - cos(TD_DrillStems(i)%StartAngle)))
end if
return
End If
!=========> F1 Calculation
TD_DrillStems(i)%Force1 = TD_DrillStems(i-1)%Force2
!=========> F2 Calculation
TD_DrillStems(i)%Force2 = (TD_DrillStems(i)%Force1 * exp((TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle))) - &
(((TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature) / (1 + (TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)**2)) * &
(((1-(TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)**2)*(sin(TD_DrillStems(i)%EndAngle) - &
(exp((TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)) * sin(TD_DrillStems(i)%StartAngle))))) - &
(2.0d0* (TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*(cos(TD_DrillStems(i)%EndAngle) - &
(exp((TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle))* &
cos(TD_DrillStems(i)%StartAngle)))))
!
! Strains(i)%Dl = TDForces(i)%Force * (Elements(i)%Length ) / &
! (Elements(i)%Area * Element%ElasticModule)
!
TD_DrillStems(i)%Torque = (TD_DrillStems(i)%MudViscosity * TD_DrillStems(i)%RtoolJoint * (TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%WeightperLength * &
TD_DrillStems(i)%RCurvature * sin(TD_DrillStems(i)%StartAngle))) * &
abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)) + &
(2.0d0 * TD_DrillStems(i)%MudViscosity * TD_DrillStems(i)%RtoolJoint * &
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature * &
(cos(TD_DrillStems(i)%EndAngle) - cos(TD_DrillStems(i)%StartAngle)))
!!if (TD_DrillStems(i)%Torque>500.) then
! print* , 'TD_String%TotalTorqueb=' , i , TD_String%TotalTorque , TD_DrillStems(i)%Torque , TD_String%WeightOnBit , sin(30.) , sin(3.14/6.)
! print* , 'torquepropertiesb=' , TD_DrillStems(i)%MudViscosity * TD_DrillStems(i)%RtoolJoint , (TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%WeightperLength * &
! TD_DrillStems(i)%RCurvature * sin(TD_DrillStems(i)%StartAngle))) , abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle), &
! 2.0d0 * TD_DrillStems(i)%MudViscosity * TD_DrillStems(i)%RtoolJoint * &
! TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature , (cos(TD_DrillStems(i)%EndAngle) - cos(TD_DrillStems(i)%StartAngle))
! print* , 'propertiesb=' , TD_DrillStems(i)%Force2 , TD_DrillStems(i)%Force1 , TD_DrillStems(i)%MudViscosity , TD_DrillStems(i)%EndAngle , TD_DrillStems(i)%StartAngle , TD_DrillStems(i)%WeightperLength , TD_DrillStems(i)%MudVisCorrectCoef , TD_DrillStems(i)%RCurvature
! !end if
end subroutine

+ 0
- 56
Equipments/TorqueDrag/TD_Forces/TD_BuildArea/TD_ForceUpBRot.f90 View File

@@ -1,56 +0,0 @@
subroutine TD_ForceUpBRot(i,TD_SemiMudVisc)
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData

implicit none
Integer :: i
Real(8) :: TD_SemiMudVisc
If (i==1) then
TD_DrillStems(1)%Force1 = -TD_String%WeightOnBit
TD_DrillStems(1)%Force2 = TD_DrillStems(1)%Force1 + (TD_DrillStems(1)%Force1 * &
(exp(+(TD_SemiMudVisc*TD_DrillStems(1)%MudVisCorrectCoef)*abs(TD_DrillStems(1)%EndAngle-TD_DrillStems(1)%StartAngle))-1.0d0) * &
sin(TD_DrillStems(1)%CombVelRatio )) + (TD_DrillStems(1)%BouyancyFactor * &
TD_DrillStems(1)%WeightperLength * TD_DrillStems(1)%Length * &
((sin(TD_DrillStems(1)%EndAngle)-sin(TD_DrillStems(1)%StartAngle))/ &
(TD_DrillStems(1)%EndAngle-TD_DrillStems(1)%StartAngle)))
if (TD_DrillStems(i)%ComponentType==0) then
TD_DrillStems(i)%Torque = TD_String%BitTorque
else
TD_DrillStems(i)%Torque = TD_SemiMudVisc*TD_DrillStems(i)%RtoolJoint*TD_DrillStems(i)%Force1* &
abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)*cos(TD_DrillStems(i)%CombVelRatio)
end if
return
End If
!=========> F1 Calculation
TD_DrillStems(i)%Force1 = TD_DrillStems(i-1)%Force2
!=========> F2 Calculation
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%Force1 * &
(exp(+(TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle))-1.0d0) * &
sin(TD_DrillStems(i)%CombVelRatio )) + (TD_DrillStems(i)%BouyancyFactor * &
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * &
((sin(TD_DrillStems(i)%EndAngle)-sin(TD_DrillStems(i)%StartAngle))/ &
(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)))
!
!Strains(i)%Dl = TDForces(i)%Force * (Elements(i)%Length) / &
! (Elements(i)%Area * Element%ElasticModule)
!
TD_DrillStems(i)%Torque = TD_SemiMudVisc*TD_DrillStems(i)%RtoolJoint*TD_DrillStems(i)%Force1* &
abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)*cos(TD_DrillStems(i)%CombVelRatio)
end subroutine

+ 0
- 21
Equipments/TorqueDrag/TD_Forces/TD_CombinedMotionData.f90 View File

@@ -1,21 +0,0 @@
subroutine TD_CombinedMotionData (i)
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData

implicit none
Integer :: i
TD_DrillStems(i)%CombVelRatio = atan( TD_String%DrillStemAxialVelocity/TD_String%DrillStemRotVelocity )
end subroutine

+ 0
- 61
Equipments/TorqueDrag/TD_Forces/TD_DropArea/TD_ForceDownD.f90 View File

@@ -1,61 +0,0 @@
subroutine TD_ForceDownD(i,TD_SemiMudVisc)

Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData

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

+ 0
- 56
Equipments/TorqueDrag/TD_Forces/TD_DropArea/TD_ForceDownDRot.f90 View File

@@ -1,56 +0,0 @@
subroutine TD_ForceDownDRot(i,TD_SemiMudVisc)
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData

implicit none
Integer :: i
Real(8) :: TD_SemiMudVisc
If (i==1) then
TD_DrillStems(1)%Force1 = -TD_String%WeightOnBit
TD_DrillStems(1)%Force2 = TD_DrillStems(1)%Force1 + (TD_DrillStems(1)%Force1 * &
(exp(-(TD_SemiMudVisc*TD_DrillStems(1)%MudVisCorrectCoef)*abs(TD_DrillStems(1)%EndAngle-TD_DrillStems(1)%StartAngle))-1.0d0) * &
sin(TD_DrillStems(1)%CombVelRatio )) + (TD_DrillStems(1)%BouyancyFactor * &
TD_DrillStems(1)%WeightperLength * TD_DrillStems(1)%Length * &
((sin(TD_DrillStems(1)%EndAngle)-sin(TD_DrillStems(1)%StartAngle))/ &
(TD_DrillStems(1)%EndAngle-TD_DrillStems(1)%StartAngle)))
if (TD_DrillStems(i)%ComponentType==0) then
TD_DrillStems(i)%Torque = TD_String%BitTorque
else
TD_DrillStems(i)%Torque = TD_SemiMudVisc*TD_DrillStems(i)%RtoolJoint*TD_DrillStems(i)%Force1* &
abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)*cos(TD_DrillStems(i)%CombVelRatio)
end if
return
End If
!=========> F1 Calculation
TD_DrillStems(i)%Force1 = TD_DrillStems(i-1)%Force2
!=========> F2 Calculation
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%Force1 * &
(exp(-(TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle))-1.0d0) * &
sin(TD_DrillStems(i)%CombVelRatio )) + (TD_DrillStems(i)%BouyancyFactor * &
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * &
((sin(TD_DrillStems(i)%EndAngle)-sin(TD_DrillStems(i)%StartAngle))/ &
(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)))
!
!Strains(i)%Dl = TDForces(i)%Force * (Elements(i)%Length) / &
! (Elements(i)%Area * Element%ElasticModule)
!
TD_DrillStems(i)%Torque = TD_SemiMudVisc*TD_DrillStems(i)%RtoolJoint*TD_DrillStems(i)%Force1* &
abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)*cos(TD_DrillStems(i)%CombVelRatio)
end subroutine

+ 0
- 68
Equipments/TorqueDrag/TD_Forces/TD_DropArea/TD_ForceUpD.f90 View File

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

+ 0
- 55
Equipments/TorqueDrag/TD_Forces/TD_DropArea/TD_ForceUpDRot.f90 View File

@@ -1,55 +0,0 @@
subroutine TD_ForceUpDRot(i,TD_SemiMudVisc)
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData

implicit none
Integer :: i
Real(8) :: TD_SemiMudVisc
If (i==1) then
TD_DrillStems(1)%Force1 = -TD_String%WeightOnBit
TD_DrillStems(1)%Force2 = TD_DrillStems(1)%Force1 + (TD_DrillStems(1)%Force1 * &
(exp(+(TD_SemiMudVisc*TD_DrillStems(1)%MudVisCorrectCoef)*abs(TD_DrillStems(1)%EndAngle-TD_DrillStems(1)%StartAngle))-1.0d0) * &
sin(TD_DrillStems(1)%CombVelRatio )) + (TD_DrillStems(1)%BouyancyFactor * &
TD_DrillStems(1)%WeightperLength * TD_DrillStems(1)%Length * &
((sin(TD_DrillStems(1)%EndAngle)-sin(TD_DrillStems(1)%StartAngle))/ &
(TD_DrillStems(1)%EndAngle-TD_DrillStems(1)%StartAngle)))
if (TD_DrillStems(i)%ComponentType==0) then
TD_DrillStems(i)%Torque = TD_String%BitTorque
else
TD_DrillStems(i)%Torque = TD_SemiMudVisc*TD_DrillStems(i)%RtoolJoint*TD_DrillStems(i)%Force1* &
abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)*cos(TD_DrillStems(i)%CombVelRatio)
end if
return
End If
!=========> F1 Calculation
TD_DrillStems(i)%Force1 = TD_DrillStems(i-1)%Force2
!=========> F2 Calculation
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%Force1 * &
(exp(+(TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle))-1.0d0) * &
sin(TD_DrillStems(i)%CombVelRatio )) + (TD_DrillStems(i)%BouyancyFactor * &
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * &
((sin(TD_DrillStems(i)%EndAngle)-sin(TD_DrillStems(i)%StartAngle))/ &
(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)))
!
!Strains(i)%Dl = TDForces(i)%Force * (Elements(i)%Length) / &
! (Elements(i)%Area * Element%ElasticModule)
!
TD_DrillStems(i)%Torque = TD_SemiMudVisc*TD_DrillStems(i)%RtoolJoint*TD_DrillStems(i)%Force1* &
abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)*cos(TD_DrillStems(i)%CombVelRatio)
end subroutine

+ 0
- 138
Equipments/TorqueDrag/TD_Forces/TD_ForceCalculation.f90 View File

@@ -1,138 +0,0 @@
subroutine TD_ForceCalculation
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData

implicit none
Integer :: i
Real(8) :: TD_SemiMudVisc
if (TD_String%DrillStemForceType == 1) then
Do i = 1 , TD_String%DrillStemComponentsNumbs
TD_SemiMudVisc = TD_DrillStems(i)%MudViscosity
if (TD_DrillStems(i)%HoleType == 0) then
Call TD_ForceUpS(i,TD_SemiMudVisc)
else if (TD_DrillStems(i)%HoleType == 1) then
Call TD_ForceUpB(i,TD_SemiMudVisc)
else if (TD_DrillStems(i)%HoleType == 2) then
Call TD_ForceUpD(i,TD_SemiMudVisc)
end if
Call TD_StrainCalculation(i)
Call TD_TorqueCalculation(i)
End Do
else if (TD_String%DrillStemForceType == 2) then
Do i = 1 , TD_String%DrillStemComponentsNumbs
TD_SemiMudVisc = TD_DrillStems(i)%MudViscosity
if (TD_DrillStems(i)%HoleType == 0) then
Call TD_ForceUpSRot(i,TD_SemiMudVisc)
else if (TD_DrillStems(i)%HoleType == 1) then
Call TD_ForceUpBRot(i,TD_SemiMudVisc)
else if (TD_DrillStems(i)%HoleType == 2) then
Call TD_ForceUpDRot(i,TD_SemiMudVisc)
end if
Call TD_StrainCalculation(i)
Call TD_TorqueCalculation(i)
End Do
else if (TD_String%DrillStemForceType == 3) then
Do i = 1 , TD_String%DrillStemComponentsNumbs
TD_SemiMudVisc = TD_DrillStems(i)%MudViscosity
if (TD_DrillStems(i)%HoleType == 0) then
Call TD_ForceDownS(i,TD_SemiMudVisc)
else if (TD_DrillStems(i)%HoleType == 1) then
Call TD_ForceDownB(i,TD_SemiMudVisc)
else if (TD_DrillStems(i)%HoleType == 2) then
Call TD_ForceDownD(i,TD_SemiMudVisc)
end if
Call TD_StrainCalculation(i)
Call TD_TorqueCalculation(i)
End Do
else if (TD_String%DrillStemForceType == 4) then
Do i = 1 , TD_String%DrillStemComponentsNumbs
TD_SemiMudVisc = TD_DrillStems(i)%MudViscosity
if (TD_DrillStems(i)%HoleType == 0) then
Call TD_ForceDownSRot(i,TD_SemiMudVisc)
else if (TD_DrillStems(i)%HoleType == 1) then
Call TD_ForceDownBRot(i,TD_SemiMudVisc)
else if (TD_DrillStems(i)%HoleType == 2) then
Call TD_ForceDownDRot(i,TD_SemiMudVisc)
end if
Call TD_StrainCalculation(i)
Call TD_TorqueCalculation(i)
End Do
else if (TD_String%DrillStemForceType == 5) then
Do i = 1 , TD_String%DrillStemComponentsNumbs
TD_SemiMudVisc = 0.0d0
if (TD_DrillStems(i)%HoleType == 0) then
Call TD_ForceUpS(i,TD_SemiMudVisc)
else if (TD_DrillStems(i)%HoleType == 1) then
Call TD_ForceUpB(i,TD_SemiMudVisc)
else if (TD_DrillStems(i)%HoleType == 2) then
Call TD_ForceUpD(i,TD_SemiMudVisc)
end if
Call TD_StrainCalculation(i)
Call TD_TorqueCalculation(i)
End Do
end if
!-----------------------------------------------------------------------------------
!
!if (TD_String%DrillStemAxialVelocity>0.) then
!
! i = 1
! TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force2 - TD_DrillStems(i)%Drag
! TD_DrillStems(i)%Dl = TD_DrillStems(i)%Force2 * TD_DrillStems(i)%Length / TD_DrillStems(i)%Area / TD_DrillStems(i)%ElasticModule
! TD_DrillStems(i)%DlTotal = TD_DrillStems(i)%Dl
!
! do i = 2 , TD_String%DrillStemComponentsNumbs
! TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force2 - TD_DrillStems(i)%Drag
! TD_DrillStems(i)%Dl = TD_DrillStems(i)%Force2 * TD_DrillStems(i)%Length / TD_DrillStems(i)%Area / TD_DrillStems(i)%ElasticModule
! TD_DrillStems(i)%DlTotal = TD_DrillStems(i-1)%DlTotal + TD_DrillStems(i)%Dl
! end do
! !print*, 'i=' ,i
! !print*, 'TD_String%DrillStemComponentsNumbs=' ,TD_String%DrillStemComponentsNumbs
!
!else if (TD_String%DrillStemAxialVelocity<0.) then
! i = 1
! TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force2 + TD_DrillStems(i)%Drag
! TD_DrillStems(i)%Dl = TD_DrillStems(i)%Force2 * TD_DrillStems(i)%Length / TD_DrillStems(i)%Area / TD_DrillStems(i)%ElasticModule
! TD_DrillStems(i)%DlTotal = TD_DrillStems(i)%Dl
!
! do i = 2 , TD_String%DrillStemComponentsNumbs
! TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force2 + TD_DrillStems(i)%Drag
! TD_DrillStems(i)%Dl = TD_DrillStems(i)%Force2 * TD_DrillStems(i)%Length / TD_DrillStems(i)%Area / TD_DrillStems(i)%ElasticModule
! TD_DrillStems(i)%DlTotal = TD_DrillStems(i-1)%DlTotal + TD_DrillStems(i)%Dl
! end do
!end if
TD_String%DlTotal = TD_DrillStems(TD_String%DrillStemComponentsNumbs)%DlTotal
!!=====> Modified Length of the Drill Stem
! do i = 1 , TD_String%DrillStemComponentsNumbs
! TD_DrillStems(i)%Length = TD_DrillStems(i)%Length + TD_DrillStems(i)%Dl
! end do
end subroutine

+ 0
- 286
Equipments/TorqueDrag/TD_Forces/TD_HookLoadCalculation.f90 View File

@@ -1,286 +0,0 @@
subroutine TD_HookLoadCalculation
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData
Use TD_StringConnectionData
Use Drawworks_VARIABLES, only: Drawworks
Use CDataDisplayConsoleVariables
Use CHoistingVariables
! Use CSlipsEnumVariables
use UnitySignalVariables
Use CBopStackVariables
Use VARIABLES
Use CUnityInputs
implicit none
Integer :: i , kk
Real(8) :: TD_eConst=0.98d0 , TD_SumWeight
!====================================================
! Torque & Hook Load Calculation
!====================================================

!=========> HookLoad
TD_String%HookLoad = TD_DrillStems(TD_String%DrillStemComponentsNumbs)%Force2 ! [lb]
!print* , 'TD_String%HookLoad1=' , TD_String%HookLoad
if ( Drawworks%motion==1 ) then
if ( PipeRam1%Situation_forTD==1 ) then !Upper Ram
TD_String%HookLoad = TD_String%HookLoad+BopStackSpecification%RamStringDrag
end if
if ( PipeRam2%Situation_forTD==1 ) then !Lower Ram
TD_String%HookLoad = TD_String%HookLoad+BopStackSpecification%RamStringDrag
end if
if ( RamLine%ShearBop_Situation_forTD==1 ) then !Blind Ram
TD_String%HookLoad = TD_String%HookLoad+BopStackSpecification%RamStringDrag !????????????????????
end if
if ( Annular%Annular_Situation_forTD==1 ) then !Annular Preventer
TD_String%HookLoad = TD_String%HookLoad+(AnnularComputational%p_annular*BopStackSpecification%AnnularStringDrag)
end if
else if ( Drawworks%motion==-1 ) then
if ( PipeRam1%Situation_forTD==1 ) then !Upper Ram
TD_String%HookLoad = TD_String%HookLoad-BopStackSpecification%RamStringDrag
end if
if ( PipeRam2%Situation_forTD==1 ) then !Lower Ram
TD_String%HookLoad = TD_String%HookLoad-BopStackSpecification%RamStringDrag
end if
if ( RamLine%ShearBop_Situation_forTD==1 ) then !Blind Ram
TD_String%HookLoad = TD_String%HookLoad-BopStackSpecification%RamStringDrag !????????????????????
end if
if ( Annular%Annular_Situation_forTD==1 ) then !Annular Preventer
TD_String%HookLoad = TD_String%HookLoad-(AnnularComputational%p_annular*BopStackSpecification%AnnularStringDrag)
end if
end if
!print* , 'TD_String%HookLoad2=' , TD_String%HookLoad
!if ( UpperRamClose_withPossibility==1 ) then
! if ( Drawworks%motion==1 ) then
! TD_String%HookLoad = TD_String%HookLoad+RamStringDrag
! else if ( Drawworks%motion==-1 ) then
! TD_String%HookLoad = TD_String%HookLoad-RamStringDrag
! end if
!end if
!if ( LowerRamClose_withPossibility==1 ) then
! if ( Drawworks%motion==1 ) then
! TD_String%HookLoad = TD_String%HookLoad+RamStringDrag
! else if ( Drawworks%motion==-1 ) then
! TD_String%HookLoad = TD_String%HookLoad-RamStringDrag
! end if
!end if
!if ( BlindRamClose_withPossibility==1 ) then
! if ( Drawworks%motion==1 ) then
! TD_String%HookLoad = TD_String%HookLoad+RamStringDrag
! else if ( Drawworks%motion==-1 ) then
! TD_String%HookLoad = TD_String%HookLoad-RamStringDrag
! end if
!end if
!if ( AnnularPreventerClose_withPossibility==1 ) then
! if ( Drawworks%motion==1 ) then
! TD_String%HookLoad = TD_String%HookLoad+AnnularStringDrag
! else if ( Drawworks%motion==-1 ) then
! TD_String%HookLoad = TD_String%HookLoad-AnnularStringDrag
! end if
!end if
!=========> Torque
TD_String%StringTorque = TD_String%TotalTorque ![lb.ft] ??????????
!print* , 'TD_String%StringTorque=' , TD_String%StringTorque
!====================================================
! Weight Indicator Calculation
!====================================================
kk = 0
Do i = TD_String%DrillStemComponentsNumbs , 1 , -1
if (TD_DrillStems(i)%ComponentType==3) then
kk = i
exit
end if
End Do
if ( TD_StConn%KellyDriveTypeMode==0 ) then
if ( TD_StConn%StringConnectionMode == 1 ) then
if ( Get_Slips() == SLIPS_SET_END ) then
TD_SumWeight = TD_Load%WeightTB+TD_Load%KellyWeight
else
TD_SumWeight = TD_String%HookLoad+TD_Load%WeightTB+TD_Load%KellyWeight ! TD_String%HookLoad = String Weight
end if
else if ( TD_StConn%StringConnectionMode == 2 ) then
if ( Get_JointConnectionPossible() ) then
TD_SumWeight = TD_Load%WeightTB
else
TD_SumWeight = TD_Load%WeightTB+TD_Load%KellyWeight
end if
else if ( TD_StConn%StringConnectionMode == 3 ) then
if ( Get_JointConnectionPossible() ) then
TD_SumWeight = TD_Load%WeightTB
else
TD_SumWeight = TD_Load%WeightTB+TD_Load%KellyWeight+TD_DrillStems(kk)%Weight
end if
end if
else if ( TD_StConn%KellyDriveTypeMode==1 ) then
if ( TD_StConn%StringConnectionMode == 4 ) then
if ( Get_Slips() == SLIPS_SET_END ) then
TD_SumWeight = TD_Load%WeightTB
else
TD_SumWeight = TD_String%HookLoad+TD_Load%WeightTB
end if
else if ( TD_StConn%StringConnectionMode == 5 ) then
TD_SumWeight = TD_Load%WeightTB
else if ( TD_StConn%StringConnectionMode == 6 ) then
if ( Get_JointConnectionPossible() ) then
TD_SumWeight = TD_Load%WeightTB
else
TD_SumWeight = TD_Load%WeightTB+(3.d0*TD_DrillStems(kk)%Weight)
end if
else if ( TD_StConn%StringConnectionMode == 7 ) then
if ( Get_JointConnectionPossible() ) then
TD_SumWeight = TD_Load%WeightTB
else
TD_SumWeight = TD_Load%WeightTB+TD_DrillStems(kk)%Weight
end if
else if ( TD_StConn%StringConnectionMode == 8 ) then
TD_SumWeight = TD_Load%WeightTB
else if ( TD_StConn%StringConnectionMode == 18 ) then
TD_SumWeight = TD_Load%WeightTB
else if ( TD_StConn%StringConnectionMode == 19 ) then
TD_SumWeight = TD_Load%WeightTB
end if
else if ( TD_StConn%KellyDriveTypeMode==2 ) then
if ( TD_StConn%StringConnectionMode == 9 ) then
if ( Get_Slips() == SLIPS_SET_END ) then
TD_SumWeight = TD_Load%WeightTD
else
TD_SumWeight = TD_String%HookLoad+TD_Load%WeightTD
end if
else if ( TD_StConn%StringConnectionMode == 10 ) then
if ( Get_Slips() == SLIPS_SET_END ) then
TD_SumWeight = TD_Load%WeightTD
else
TD_SumWeight = TD_String%HookLoad+TD_Load%WeightTD
end if
else if ( TD_StConn%StringConnectionMode == 11 ) then
TD_SumWeight = TD_Load%WeightTD
else if ( TD_StConn%StringConnectionMode == 12 ) then
if ( Get_Slips() == SLIPS_SET_END ) then
TD_SumWeight = TD_Load%WeightTD
else
TD_SumWeight = TD_String%HookLoad+TD_Load%WeightTD
end if
else if ( TD_StConn%StringConnectionMode == 13 ) then
TD_SumWeight = TD_Load%WeightTD
else if ( TD_StConn%StringConnectionMode == 14 ) then
TD_SumWeight = TD_Load%WeightTD+(3.d0*TD_DrillStems(kk)%Weight)
else if ( TD_StConn%StringConnectionMode == 15 ) then
TD_SumWeight = TD_Load%WeightTD+(TD_DrillStems(kk)%Weight)
else if ( TD_StConn%StringConnectionMode == 16 ) then
TD_SumWeight = TD_Load%WeightTD
else if ( TD_StConn%StringConnectionMode == 17 ) then
TD_SumWeight = TD_Load%WeightTD
end if
end if
!print* , 'TD_String%HookLoad3=' , TD_String%HookLoad
!if ( Hoisting%DriveType==1 ) then !==> Kelly_DriveType
!
! if ( TD_String%DrillStemForceType==1 .or. TD_String%DrillStemForceType==2 ) then
! TD_Load%WeightIndicator = ( sngl(TD_Load%NumOfCables)*(TD_eConst-1.d0)*(TD_SumWeight) )&
! /( TD_eConst*(1.d0-(1.d0/(TD_eConst**TD_Load%NumOfCables))) )
! else if ( TD_String%DrillStemForceType==3 .or. TD_String%DrillStemForceType==4 ) then
! TD_Load%WeightIndicator = ( sngl(TD_Load%NumOfCables)*(1.d0-TD_eConst)*(TD_SumWeight) )&
! /( 1.d0-(TD_eConst**TD_Load%NumOfCables) )
! else if ( TD_String%DrillStemForceType==5 ) then
TD_Load%WeightIndicator = TD_SumWeight
! end if
!
!
!else if ( Hoisting%DriveType==0 ) then !==> TopDrive_DriveType ??????????????
!
! if ( TD_String%DrillStemForceType==1 .or. TD_String%DrillStemForceType==2 ) then
! TD_Load%WeightIndicator = ( sngl(TD_Load%NumOfCables)*(TD_eConst-1.d0)*(TD_SumWeight) )&
! /( TD_eConst*(1.d0-(1.d0/(TD_eConst**TD_Load%NumOfCables))) )
! else if ( TD_String%DrillStemForceType==3 .or. TD_String%DrillStemForceType==4 ) then
! TD_Load%WeightIndicator = ( sngl(TD_Load%NumOfCables)*(1.d0-TD_eConst)*(TD_SumWeight) )&
! /( 1.d0-(TD_eConst**TD_Load%NumOfCables) )
! else if ( TD_String%DrillStemForceType==5 ) then
! TD_Load%WeightIndicator = TD_SumWeight
! end if
!
!!else
!!TD_Load%WeightIndicator = 0. !?????????????????
!
!end if

TD_Load%DrawworksLoadInput = TD_Load%WeightIndicator/(sngl(TD_Load%NumOfCables)) ! [lb]
!print* , 'TD_String%HookLoad4=' , TD_String%HookLoad
!HookLoadPointer = TD_Load%WeightIndicator/1.0d3 ! [klb]
call Set_HookLoad ((1-TD_General%WeightIndicatorMalf)*AINT(TD_Load%WeightIndicator/1.0d3)) ! [klb]
end subroutine

+ 0
- 71
Equipments/TorqueDrag/TD_Forces/TD_StaticHookLoadCalculation.f90 View File

@@ -1,71 +0,0 @@
subroutine TD_StaticHookLoadCalculation
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData

implicit none
Integer :: i
i = 1
if(TD_DrillStems(i)%HoleType == 0) then
TD_DrillStems(i)%StaticHookLoad = TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * &
TD_DrillStems(i)%BouyancyFactor * cos(TD_DrillStems(i)%StartAngle)
else if (TD_DrillStems(i)%HoleType == 1) then
TD_DrillStems(i)%StaticHookLoad = -(TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature * &
(sin(TD_DrillStems(i)%EndAngle) - sin(TD_DrillStems(i)%StartAngle)))
else if (TD_DrillStems(i)%HoleType == 2) then
TD_DrillStems(i)%StaticHookLoad = (TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature * &
(sin(TD_DrillStems(i)%EndAngle) - sin(TD_DrillStems(i)%StartAngle)))
end if
do i = 2, TD_String%DrillStemComponentsNumbs
if(TD_DrillStems(i)%HoleType == 0) then
TD_DrillStems(i)%StaticHookLoad = TD_DrillStems(i-1)%StaticHookLoad + TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * &
TD_DrillStems(i)%BouyancyFactor * cos(TD_DrillStems(i)%StartAngle)
else if (TD_DrillStems(i)%HoleType == 1) then
TD_DrillStems(i)%StaticHookLoad = TD_DrillStems(i-1)%StaticHookLoad -(TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature * &
(sin(TD_DrillStems(i)%EndAngle) - sin(TD_DrillStems(i)%StartAngle)))
else if (TD_DrillStems(i)%HoleType == 2) then
TD_DrillStems(i)%StaticHookLoad = TD_DrillStems(i-1)%StaticHookLoad +(TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature * &
(sin(TD_DrillStems(i)%EndAngle) - sin(TD_DrillStems(i)%StartAngle)))
end if
end do
!
!---------------------------------------------------------------------------------------------------
!
i = 1
!TD_DrillStems(i)%TotalSHookLoad = TD_DrillStems(i)%StaticHookLoad ????????????????????????????
TD_DrillStems(i)%Dl = TD_DrillStems(i)%StaticHookLoad * TD_DrillStems(i)%Length / TD_DrillStems(i)%Area / TD_DrillStems(i)%ElasticModule
TD_DrillStems(i)%DlTotal = TD_DrillStems(i)%Dl
do i = 2 , TD_String%DrillStemComponentsNumbs
!TD_DrillStems(i)%TotalSHookLoad = TD_DrillStems(i-1)%TotalSHookLoad + TD_DrillStems(i)%StaticHookLoad ?????????????????????????
TD_DrillStems(i)%Dl = TD_DrillStems(i)%StaticHookLoad * TD_DrillStems(i)%Length / TD_DrillStems(i)%Area / TD_DrillStems(i)%ElasticModule
TD_DrillStems(i)%DlTotal = TD_DrillStems(i-1)%DlTotal + TD_DrillStems(i)%Dl
end do
TD_String%StaticHookLoad = TD_DrillStems(TD_String%DrillStemComponentsNumbs)%StaticHookLoad
TD_String%DlMax = TD_DrillStems(TD_String%DrillStemComponentsNumbs)%DlTotal
end subroutine

+ 0
- 64
Equipments/TorqueDrag/TD_Forces/TD_StraightArea/TD_ForceDownS.f90 View File

@@ -1,64 +0,0 @@
subroutine TD_ForceDownS(i,TD_SemiMudVisc)
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData

implicit none
Integer :: i
Real(8) :: TD_SemiMudVisc , TD_SemiAngle
if ( TD_DrillStems(i)%StartAngle<=(pi/180.) ) then
TD_SemiAngle = (pi/180.)
else
TD_SemiAngle = TD_DrillStems(i)%StartAngle
end if
If (i==1) then
TD_DrillStems(1)%Force1 = -TD_String%WeightOnBit
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * &
TD_DrillStems(i)%BouyancyFactor * (cos(TD_DrillStems(i)%StartAngle) - &
(TD_SemiMudVisc * sin(TD_DrillStems(i)%StartAngle))))
if (TD_DrillStems(i)%ComponentType==0) then
TD_DrillStems(i)%Torque = TD_String%BitTorque
else
TD_DrillStems(i)%Torque = TD_SemiMudVisc* TD_DrillStems(i)%BouyancyFactor* &
TD_DrillStems(i)%WeightperLength* TD_DrillStems(i)%Length* TD_DrillStems(i)%RtoolJoint * &
sin(TD_SemiAngle)
end if
return
End If
!=========> F1 Calculation
TD_DrillStems(i)%Force1 = TD_DrillStems(i-1)%Force2
!=========> F2 Calculation
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * &
TD_DrillStems(i)%BouyancyFactor * (cos(TD_DrillStems(i)%StartAngle) - &
(TD_SemiMudVisc * sin(TD_DrillStems(i)%StartAngle))))
!
!
!Strains(i)%Dl = TDForces(i)%Force * (Elements(i)%Length ) / &
! (Elements(i)%Area * Element%ElasticModule)
!
TD_DrillStems(i)%Torque = TD_SemiMudVisc* TD_DrillStems(i)%BouyancyFactor* &
TD_DrillStems(i)%WeightperLength* TD_DrillStems(i)%Length* TD_DrillStems(i)%RtoolJoint * &
sin(TD_SemiAngle)
!
end subroutine

+ 0
- 60
Equipments/TorqueDrag/TD_Forces/TD_StraightArea/TD_ForceDownSRot.f90 View File

@@ -1,60 +0,0 @@
subroutine TD_ForceDownSRot(i,TD_SemiMudVisc)
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData

implicit none
Integer :: i
Real(8) :: TD_SemiMudVisc , TD_SemiAngle
if ( TD_DrillStems(i)%StartAngle<=(pi/180.) ) then
TD_SemiAngle = (pi/180.)
else
TD_SemiAngle = TD_DrillStems(i)%StartAngle
end if
If (i==1) then
TD_DrillStems(1)%Force1 = -TD_String%WeightOnBit
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%BouyancyFactor * TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * &
cos(TD_DrillStems(i)%StartAngle)) - (TD_SemiMudVisc * TD_DrillStems(i)%BouyancyFactor * &
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * &
sin(TD_DrillStems(i)%StartAngle) * sin(TD_DrillStems(i)%CombVelRatio))
if (TD_DrillStems(i)%ComponentType==0) then
TD_DrillStems(i)%Torque = TD_String%BitTorque
else
TD_DrillStems(i)%Torque = TD_DrillStems(i)%RtoolJoint * TD_SemiMudVisc * TD_DrillStems(i)%BouyancyFactor * &
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * sin(TD_SemiAngle) * cos(TD_DrillStems(i)%CombVelRatio)
end if
return
End If
!=========> F1 Calculation
TD_DrillStems(i)%Force1 = TD_DrillStems(i-1)%Force2
!=========> F2 Calculation
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%BouyancyFactor * TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * &
cos(TD_DrillStems(i)%StartAngle)) - (TD_SemiMudVisc * TD_DrillStems(i)%BouyancyFactor * &
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * &
sin(TD_DrillStems(i)%StartAngle) * sin(TD_DrillStems(i)%CombVelRatio))
!
TD_DrillStems(i)%Torque = TD_DrillStems(i)%RtoolJoint * TD_SemiMudVisc * TD_DrillStems(i)%BouyancyFactor * &
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * sin(TD_SemiAngle) * cos(TD_DrillStems(i)%CombVelRatio)
!
!Strains(i)%dL = TDForces(i)%Force * (Elements(i)%Length) / &
! (Elements(i)%Area * Element%ElasticModule)
end subroutine

+ 0
- 65
Equipments/TorqueDrag/TD_Forces/TD_StraightArea/TD_ForceUpS.f90 View File

@@ -1,65 +0,0 @@
subroutine TD_ForceUpS(i,TD_SemiMudVisc)
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData

implicit none
Integer :: i
Real(8) :: TD_SemiMudVisc , TD_SemiAngle
if ( TD_DrillStems(i)%StartAngle<=(pi/180.) ) then
TD_SemiAngle = (pi/180.)
else
TD_SemiAngle = TD_DrillStems(i)%StartAngle
end if
If (i==1) then
TD_DrillStems(1)%Force1 = -TD_String%WeightOnBit
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * &
TD_DrillStems(i)%BouyancyFactor * (cos(TD_DrillStems(i)%StartAngle) + &
(TD_SemiMudVisc * sin(TD_DrillStems(i)%StartAngle))))
if (TD_DrillStems(i)%ComponentType==0) then
TD_DrillStems(i)%Torque = TD_String%BitTorque
else
TD_DrillStems(i)%Torque = TD_DrillStems(i)%MudViscosity* TD_DrillStems(i)%BouyancyFactor* &
TD_DrillStems(i)%WeightperLength* TD_DrillStems(i)%Length* TD_DrillStems(i)%RtoolJoint * &
sin(TD_SemiAngle)
end if
return
End If
!=========> F1 Calculation
TD_DrillStems(i)%Force1 = TD_DrillStems(i-1)%Force2
!=========> F2 Calculation
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * &
TD_DrillStems(i)%BouyancyFactor * (cos(TD_DrillStems(i)%StartAngle) + &
(TD_SemiMudVisc * sin(TD_DrillStems(i)%StartAngle))))
!Strains(i)%Dl = TDForces(i)%Force * (Elements(i)%Length ) / &
! (Elements(i)%Area * Element%ElasticModule)
TD_DrillStems(i)%Torque = TD_DrillStems(i)%MudViscosity* TD_DrillStems(i)%BouyancyFactor* &
TD_DrillStems(i)%WeightperLength* TD_DrillStems(i)%Length* TD_DrillStems(i)%RtoolJoint * &
sin(TD_SemiAngle)
!!if (TD_DrillStems(i)%Torque>500.) then
! print* , 'TD_String%TotalTorque=' , i , TD_String%TotalTorque , TD_DrillStems(i)%Torque , TD_String%WeightOnBit
! print* , 'propertiess=' , TD_DrillStems(i)%Force2 , TD_DrillStems(i)%Force1 , TD_DrillStems(i)%MudViscosity , TD_DrillStems(i)%EndAngle , TD_DrillStems(i)%StartAngle , TD_DrillStems(i)%WeightperLength , TD_DrillStems(i)%MudVisCorrectCoef
! !end if
end subroutine

+ 0
- 59
Equipments/TorqueDrag/TD_Forces/TD_StraightArea/TD_ForceUpSRot.f90 View File

@@ -1,59 +0,0 @@
subroutine TD_ForceUpSRot(i,TD_SemiMudVisc)
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData
implicit none
Integer :: i
Real(8) :: TD_SemiMudVisc , TD_SemiAngle
if ( TD_DrillStems(i)%StartAngle<=(pi/180.d0) ) then
TD_SemiAngle = (pi/180.)
else
TD_SemiAngle = TD_DrillStems(i)%StartAngle
end if
If (i==1) then
TD_DrillStems(1)%Force1 = -TD_String%WeightOnBit
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%BouyancyFactor * TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * &
cos(TD_DrillStems(i)%StartAngle)) + (TD_SemiMudVisc * TD_DrillStems(i)%BouyancyFactor * &
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * &
sin(TD_DrillStems(i)%StartAngle) * sin(TD_DrillStems(i)%CombVelRatio))
if (TD_DrillStems(i)%ComponentType==0) then
TD_DrillStems(i)%Torque = TD_String%BitTorque
else
TD_DrillStems(i)%Torque = TD_DrillStems(i)%RtoolJoint * TD_SemiMudVisc * TD_DrillStems(i)%BouyancyFactor * &
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * sin(TD_SemiAngle) * cos(TD_DrillStems(i)%CombVelRatio)
end if
return
End If
!=========> F1 Calculation
TD_DrillStems(i)%Force1 = TD_DrillStems(i-1)%Force2
!=========> F2 Calculation
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%BouyancyFactor * TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * &
cos(TD_DrillStems(i)%StartAngle)) + (TD_SemiMudVisc * TD_DrillStems(i)%BouyancyFactor * &
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * &
sin(TD_DrillStems(i)%StartAngle) * sin(TD_DrillStems(i)%CombVelRatio))
!
TD_DrillStems(i)%Torque = TD_DrillStems(i)%RtoolJoint * TD_SemiMudVisc * TD_DrillStems(i)%BouyancyFactor * &
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * sin(TD_SemiAngle) * cos(TD_DrillStems(i)%CombVelRatio)
!
!Strains(i)%dL = TDForces(i)%Force * (Elements(i)%Length) / &
! (Elements(i)%Area * Element%ElasticModule)
end subroutine

+ 0
- 54
Equipments/TorqueDrag/TD_Forces/TD_StrainCalculation.f90 View File

@@ -1,54 +0,0 @@
subroutine TD_StrainCalculation(i)
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData

implicit none
Integer :: i
if (TD_String%DrillStemAxialVelocity>=0.d0) then
if (i == 1) then
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force2 + TD_DrillStems(i)%Drag
TD_DrillStems(i)%Dl = (TD_DrillStems(i)%Force2) * TD_DrillStems(i)%Length / TD_DrillStems(i)%Area / TD_DrillStems(i)%ElasticModule
TD_DrillStems(i)%DlTotal = TD_DrillStems(i)%Dl
else
!do i = 2 , TD_String%DrillStemComponentsNumbs
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force2 + TD_DrillStems(i)%Drag
TD_DrillStems(i)%Dl = (TD_DrillStems(i)%Force2) * TD_DrillStems(i)%Length / TD_DrillStems(i)%Area / TD_DrillStems(i)%ElasticModule
TD_DrillStems(i)%DlTotal = TD_DrillStems(i-1)%DlTotal + TD_DrillStems(i)%Dl
!end do
end if
else if (TD_String%DrillStemAxialVelocity<0.) then
if (i == 1) then
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force2 - TD_DrillStems(i)%Drag
TD_DrillStems(i)%Dl = (TD_DrillStems(i)%Force2) * TD_DrillStems(i)%Length / TD_DrillStems(i)%Area / TD_DrillStems(i)%ElasticModule
TD_DrillStems(i)%DlTotal = TD_DrillStems(i)%Dl
else
!do i = 2 , TD_String%DrillStemComponentsNumbs
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force2 - TD_DrillStems(i)%Drag
TD_DrillStems(i)%Dl = (TD_DrillStems(i)%Force2) * TD_DrillStems(i)%Length / TD_DrillStems(i)%Area / TD_DrillStems(i)%ElasticModule
TD_DrillStems(i)%DlTotal = TD_DrillStems(i-1)%DlTotal + TD_DrillStems(i)%Dl
!end do
end if
end if

!=====> Modified Length of Drill Stem
!TD_DrillStems(i)%Length = TD_DrillStems(i)%LengthIni + TD_DrillStems(i)%Dl
TD_DrillStems(i)%Length = TD_DrillStems(i)%LengthIni
end subroutine

+ 0
- 42
Equipments/TorqueDrag/TD_Forces/TD_TorqueCalculation.f90 View File

@@ -1,42 +0,0 @@
subroutine TD_TorqueCalculation(i)
Use CHoistingVariables
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData
Use RTable_VARIABLES, only: RTable
Use TopDrive_VARIABLES, only: TDS

implicit none
Integer :: i
if ( Hoisting%DriveType==1 .and. RTable%Speed==0.d0 ) then
TD_DrillStems(i)%Torque = 0.d0
else if ( Hoisting%DriveType==0 .and. TDS%Speed==0.d0 .and. RTable%Speed==0.d0 ) then
TD_DrillStems(i)%Torque = 0.d0
end if
if ( i==1 ) then
TD_String%TotalTorque = TD_DrillStems(i)%Torque
else
TD_String%TotalTorque = TD_String%TotalTorque + TD_DrillStems(i)%Torque
end if
!if (TD_DrillStems(i)%Torque>500.) then
! print* , 'TD_String%TotalTorque=' , i , TD_String%TotalTorque , TD_DrillStems(i)%Torque
! !print* , 'properties=' , TD_DrillStems(i)%Force1 , TD_DrillStems(i)%MudViscosity , TD_DrillStems(i)%EndAngle , TD_DrillStems(i)%StartAngle , TD_DrillStems(i)%WeightperLength , TD_DrillStems(i)%MudVisCorrectCoef
!end if
end subroutine

+ 0
- 176
Equipments/TorqueDrag/TD_Forces/TD_ViscousDragForce/TD_ViscousDragForce.f90 View File

@@ -1,176 +0,0 @@
subroutine TD_ViscousDragForce
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData

implicit none
Integer :: i
real(8) :: TDden, TDpreup , TDpredown , TDtem , TDmdup , TDmddown
Real(8) :: TD_ThetaCoef1 , TD_ThetaCoef2 , TD_NCoef , TD_KCoef
Real(8) :: TD_DragSum
Do i = 1 , TD_String%DrillStemComponentsNumbs
if ( TD_DrillStems(i)%MudDensityOut==0.d0 .or. TD_DrillStems(i)%MudDensityIn==0.d0 ) then
TD_DrillStems(i)%Drag = 0.d0
cycle
end if
TDmdup = TD_DrillStems(i)%TopDepthIni
Call AnnulusPropertyCalculator ( INT(TDmdup) , TDden , TDpreup , TDtem )
TDmddown = TD_DrillStems(i)%DownDepthIni
Call AnnulusPropertyCalculator ( INT(TDmddown) , TDden , TDpredown , TDtem )
TD_DrillStems(i)%Drag = abs(TDpredown-TDpreup)*(pi*TD_DrillStems(i)%Length*12.d0*TD_DrillStems(i)%Od*12.d0) ![psi]*[inch^2]=[lb] ?????
TD_DrillStems(i)%Drag = 0.0d0 !?????????????????????
End Do

!Do i = 1 , TD_String%DrillStemComponentsNumbs
!
!
! if ( TD_DrillStems(i)%MudDensityOut==0.d0 .or. TD_DrillStems(i)%MudDensityIn==0.d0 ) then
! TD_DrillStems(i)%Drag = 0.d0
! cycle
! end if
!
! !------------------------------------------------------------------------------------
! TD_DrillStems(i)%Od = TD_DrillStems(i)%Od*12.d0 ! [inch]
! TD_DrillStems(i)%HoleDiameter = TD_DrillStems(i)%HoleDiameter*12.d0 ! [inch]
! TD_DrillStems(i)%MudDensityOut = TD_DrillStems(i)%MudDensityOut/7.48051948d0 ! [ppg]
! !------------------------------------------------------------------------------------
!
!
! TD_ThetaCoef1 = TD_DrillStems(i)%MudYieldPoint+TD_DrillStems(i)%MudPlasticVis
! TD_ThetaCoef2 = (2.0d0*TD_DrillStems(i)%MudPlasticVis)+TD_DrillStems(i)%MudYieldPoint
! TD_NCoef = 3.32d0*log10(TD_ThetaCoef2/TD_ThetaCoef1)
! TD_KCoef = (TD_ThetaCoef1)/(511.d0*TD_NCoef)
!
!
!
! If (TD_DrillStems(i)%TopDepth>0.d0) then
!
! TD_DrillStems(i)%PipeVelocity = abs(TD_String%DrillStemAxialVelocity)
!
! TD_DrillStems(i)%DiamRatio = (TD_DrillStems(i)%Od)/TD_DrillStems(i)%HoleDiameter
!
!
! TD_DrillStems(i)%MudClingingConst = ((TD_DrillStems(i)%DiamRatio**2) * (1.0d0 - (2.0d0*log(TD_DrillStems(i)%DiamRatio))) - 1.0d0) &
! / (2.0d0*(1.0d0-(TD_DrillStems(i)%DiamRatio**2))*log(TD_DrillStems(i)%DiamRatio))
!
! TD_DrillStems(i)%AveEffVelocity = TD_DrillStems(i)%PipeVelocity * ( ((TD_DrillStems(i)%DiamRatio**2)/(1.0d0-(TD_DrillStems(i)%DiamRatio**2))) &
! + TD_DrillStems(i)%MudClingingConst)
!
! TD_DrillStems(i)%ReNumber = (926.4*(TD_DrillStems(i)%MudDensityOut * TD_DrillStems(i)%AveEffVelocity * (TD_DrillStems(i)%HoleDiameter - TD_DrillStems(i)%Od))) &
! / TD_DrillStems(i)%MudPlasticVis !Bingham-plastic drilling fluid
! !TD_DrillStems(i)%ReNumber = 10.9d4*( TD_DrillStems(i)%MudDensityOut*(TD_DrillStems(i)%AveEffVelocity**(2-TD_NCoef))/TD_DrillStems(i)%MudPlasticVis ) &
! ! *( (((TD_DrillStems(i)%HoleDiameter - TD_DrillStems(i)%Od)/48.)*(TD_NCoef/((2.*TD_NCoef)+1.)))**TD_NCoef ) !Power-law fluid
!
! if ( TD_DrillStems(i)%ReNumber .le. 2.1d3 ) then !Bingham-plastic drilling fluid
! !if ( TD_DrillStems(i)%ReNumber .le. (3479.-(1370.*TD_NCoef)) ) then !Power-law fluid
!
! TD_DrillStems(i)%FricFactor = 1.60d1/TD_DrillStems(i)%ReNumber
!
! !TD_DrillStems(i)%Dp_Dl = ( TD_KCoef/(14.4d4*(TD_DrillStems(i)%HoleDiameter - TD_DrillStems(i)%Od)) )&
! ! *( ((48./(TD_DrillStems(i)%HoleDiameter - TD_DrillStems(i)%Od))*(((2.*TD_NCoef)+1.)/TD_NCoef))**TD_NCoef ) !Power-law fluid
! TD_DrillStems(i)%Dp_Dl = (TD_DrillStems(i)%FricFactor * (TD_DrillStems(i)%AveEffVelocity**2) * TD_DrillStems(i)%MudDensityOut) &
! / (25.78d0*(TD_DrillStems(i)%HoleDiameter - TD_DrillStems(i)%Od)) !Bingham-plastic drilling fluid
!
! else !Bingham-plastic drilling fluid
! !else if ( TD_DrillStems(i)%ReNumber .gt. (4270.-(1370.*TD_NCoef)) ) then !Power-law fluid
!
! TD_DrillStems(i)%MudClingingConst = (sqrt(( (TD_DrillStems(i)%DiamRatio**4) + TD_DrillStems(i)%DiamRatio ) &
! /(1.0d0 + TD_DrillStems(i)%DiamRatio )) - (TD_DrillStems(i)%DiamRatio**2)) &
! /(1.0d0- (TD_DrillStems(i)%DiamRatio**2))
!
! TD_DrillStems(i)%AveEffVelocity = TD_DrillStems(i)%PipeVelocity * ( ((TD_DrillStems(i)%DiamRatio**2)/(1.0d0-(TD_DrillStems(i)%DiamRatio**2))) &
! + TD_DrillStems(i)%MudClingingConst)
!
! TD_DrillStems(i)%ReNumber = (926.4d0*(TD_DrillStems(i)%MudDensityOut * TD_DrillStems(i)%AveEffVelocity * (TD_DrillStems(i)%HoleDiameter - TD_DrillStems(i)%Od))) &
! / TD_DrillStems(i)%MudPlasticVis !Bingham-plastic drilling fluid
! !TD_DrillStems(i)%ReNumber = 10.9d4*( TD_DrillStems(i)%MudDensityOut*(TD_DrillStems(i)%AveEffVelocity**(2-TD_NCoef))/TD_DrillStems(i)%MudPlasticVis ) &
! ! *( (((TD_DrillStems(i)%HoleDiameter - TD_DrillStems(i)%Od)/48.)*(TD_NCoef/((2.*TD_NCoef)+1.)))**TD_NCoef ) !Power-law fluid
!
! TD_DrillStems(i)%FricFactor = 0.0791d0/(TD_DrillStems(i)%ReNumber**0.25d0)
!
! TD_DrillStems(i)%Dp_Dl = (TD_DrillStems(i)%FricFactor * (TD_DrillStems(i)%AveEffVelocity**2) * TD_DrillStems(i)%MudDensityOut) &
! / (25.78d0*(TD_DrillStems(i)%HoleDiameter - TD_DrillStems(i)%Od)) !Bingham-plastic drilling fluid
! !TD_DrillStems(i)%Dp_Dl = (TD_DrillStems(i)%FricFactor * (TD_DrillStems(i)%AveEffVelocity**2) * TD_DrillStems(i)%MudDensityOut) &
! ! / (21.1*(TD_DrillStems(i)%HoleDiameter - TD_DrillStems(i)%Od)) !Power-law fluid
!
! end if
!
!
! TD_DrillStems(i)%Drag = ( (pi/4.0d0)*TD_DrillStems(i)%Dp_Dl*TD_DrillStems(i)%Length*(TD_DrillStems(i)%Od**2)/10.d0 ) ! drag/10 = because of the value of drag force
!
! Else
! TD_DrillStems(i)%Drag = 0.0d0
!
! End if
!
!
! !------------------------------------------------------------------------------------
! TD_DrillStems(i)%Od = TD_DrillStems(i)%Od/12.d0 ! [ft]
! TD_DrillStems(i)%HoleDiameter = TD_DrillStems(i)%HoleDiameter/12.d0 ! [ft]
! TD_DrillStems(i)%MudDensityOut = TD_DrillStems(i)%MudDensityOut*7.48051948d0 ! [lb/ft3]
! !------------------------------------------------------------------------------------
!
!
!end do
if (TD_DrillStems(1)%ComponentType==0) then
TD_DrillStems(1)%Drag = 50.d0*TD_DrillStems(1)%Od !Od[ft] , Drag[lb]?????
if ( TD_DrillStems(1)%MudDensityOut==0.d0 .or. TD_DrillStems(1)%MudDensityIn==0.d0 ) then
TD_DrillStems(1)%Drag = 0.d0
end if
end if
!!TD_DragSum = 0.
!!Do i = 1 , TD_String%DrillStemComponentsNumbs
!! TD_DragSum = TD_DragSum+TD_DrillStems(i)%Drag
!!end do
! print*, 'TD_NCoef=' , TD_NCoef
! print*, 'TD_KCoef=' , TD_KCoef
!
! print*, 'TD_DrillStems(1)%DiamRatio=' , TD_DrillStems(1)%DiamRatio
! print*, 'TD_DrillStems(1)%Od=' , TD_DrillStems(1)%Od
! print*, 'TD_DrillStems(1)%HoleDiameter=' , TD_DrillStems(1)%HoleDiameter
! !
! print*, 'TD_DrillStems(1)%MudClingingConst=' , TD_DrillStems(1)%MudClingingConst
! !
! print*, 'TD_DrillStems(1)%AveEffVelocity=' , TD_DrillStems(1)%AveEffVelocity
! !
! !print*, 'TD_DrillStems(1)%MudPlasticVis=' , TD_DrillStems(1)%MudPlasticVis
! print*, 'TD_DrillStems(1)%MudDensityOut=' , TD_DrillStems(1)%MudDensityOut
! print*, 'TD_DrillStems(1)%ReNumber=' , TD_DrillStems(1)%ReNumber
! !
! print*, 'TD_DrillStems(1)%FricFactor=' , TD_DrillStems(1)%FricFactor
! print*, 'TD_DrillStems(1)%Dp_Dl=' , TD_DrillStems(1)%Dp_Dl
! print*, 'TD_DrillStems(1)%Drag=' , TD_DrillStems(1)%Drag
! print*, 'TD_DrillStems(2)%Drag=' , TD_DrillStems(2)%Drag
! print*, 'TD_DrillStems(3)%Drag=' , TD_DrillStems(3)%Drag
! print*, 'TD_DragSum=' , TD_DragSum
! print*, 'TD_DrillStems(330)%Drag=' , TD_DrillStems(330)%Drag
! print*, 'TD_DrillStems(331)%Drag=' , TD_DrillStems(331)%Drag
! print*, 'TD_DrillStems(333)%Drag=' , TD_DrillStems(333)%Drag
end subroutine

+ 0
- 40
Equipments/TorqueDrag/TD_Forces/TD_WeightOnBitCalculation.f90 View File

@@ -1,40 +0,0 @@
subroutine TD_WeightOnBitCalculation
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData
Use TD_StringConnectionData
Use CDataDisplayConsoleVariables
implicit none
Integer :: i
!TD_StConn%TouchConnectionHeight = TD_String%DlMax + TD_String%DrillStemTotalLengthIni - TD_WellGeneral%WellTotalLength
TD_StConn%TouchConnectionHeight = TD_String%DrillStemTotalLengthIni - TD_WellGeneral%WellTotalLength
!if (TD_DrillStems(1)%ComponentType == 0) then ?????????????
!if (TD_DrillStems(1)%DownDepth < TD_WellGeneral%WellTotalLength) then
if (TD_StConn%ConnectionHeight < TD_StConn%TouchConnectionHeight) then
TD_String%DlTouch = TD_String%DlMax-(TD_StConn%TouchConnectionHeight-TD_StConn%ConnectionHeight)
TD_String%WeightOnBit = ((TD_String%StaticHookLoad/2.0d0)/TD_String%DlMax)*(TD_String%DlMax-TD_String%DlTouch) !(TD_String%StaticHookLoad/2.0d0) ---> because of Uniform drill stem(drillpipes) ??????????
else
TD_String%WeightOnBit = 0.d0 ![lb]
end if
Call Set_WeightOnBit(AINT(real(TD_String%WeightOnBit,8)))

end subroutine

+ 0
- 120
Equipments/TorqueDrag/TD_MainCalculations.f90 View File

@@ -1,120 +0,0 @@
subroutine TD_MainCalculations
Use CCasingLinerChokeVariables
Use CStringConfigurationVariables
Use CSimulationVariables
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData
Use TD_StringConnectionData
Use FricPressDropVars
Use MudSystemVARIABLES
implicit none
Integer :: i
!Integer :: TD_SolDuration
!integer,dimension(8) :: TD_StartTime , TD_EndTime
TD_General%TimeStep = 0.1d0 ! Unit: [s]
!Call TD_StartUp
!Call TD_WellReadData
!Call TD_WellElementsReadData
!Call TD_DrillStemReadData
!Call TD_PipePropertiesReadData
!!Call TD_WellGeoConfiguration
!!Call TD_WellElementsConfiguration
!!Call TD_StringConnectionModes
!!Call TD_DrillStemConfiguration
!loop1: do
Call TD_WellGeoConfiguration
Call TD_WellElementsConfiguration
Call TD_StringConnectionModes
Call TD_DrillStemConfiguration
Call TD_ForceReadData
!===> Mud properties Read_Data from Fluid Module
!!TD_StringNoHorizontalMudElements = TDNoHorizontalMudElements
!!TD_String%NoStringMudElements = TDNoStringMudElements
!!TD_String%NoCasingMudElements = TDNoCasingMudElements
!!
!!if (allocated(TDDensity_MudElementArray) .and. (TD_StringNoHorizontalMudElements+TD_String%NoStringMudElements+TD_String%NoCasingMudElements)/=0) then
!! if (Allocated(TD_String%FluidMudDensity)) Deallocate(TD_String%FluidMudDensity)
!! Allocate(TD_String%FluidMudDensity(TD_StringNoHorizontalMudElements+TD_String%NoStringMudElements+TD_String%NoCasingMudElements))
!! TD_String%FluidMudDensity(:) = TDDensity_MudElementArray(:)
!!end if
!!
!!if (allocated(TDXend_MudElementArray)) then
!! if (Allocated(TD_String%FluidMudEndX)) Deallocate(TD_String%FluidMudEndX)
!! Allocate(TD_String%FluidMudEndX(TD_StringNoHorizontalMudElements+TD_String%NoStringMudElements+TD_String%NoCasingMudElements))
!! TD_String%FluidMudEndX(:) = TDXend_MudElementArray(:)
!!end if
!!
!!if (allocated(TDXstart_MudElementArray)) then
!! if (Allocated(TD_String%FluidMudStartX)) Deallocate(TD_String%FluidMudStartX)
!! Allocate(TD_String%FluidMudStartX(TD_StringNoHorizontalMudElements+TD_String%NoStringMudElements+TD_String%NoCasingMudElements))
!! TD_String%FluidMudStartX(:) = TDXstart_MudElementArray(:)
!!end if
if (TD_DrillStem(1)%ComponentType==0) then
Do i = 2 , TD_String%DrillStemComponentsNumbs
Call TD_MudPropertiesReadData(i)
Call TD_BouyancyFactor(i)
Call TD_CombinedMotionData(i)
End Do
TD_DrillStems(1)%MudDensityIn = TD_DrillStems(2)%MudDensityIn !(1): bit mud properties
TD_DrillStems(1)%MudDensityOut = TD_DrillStems(2)%MudDensityOut
TD_DrillStems(1)%MudWeight = TD_DrillStems(2)%MudWeight
TD_DrillStems(1)%MudPlasticVis = 5.d0+(5.d0*(TD_DrillStems(1)%MudWeight-8.3d0))
TD_DrillStems(1)%MudViscosity = 0.2d0 !TD_DrillStems(i)%MudPlasticVis
TD_DrillStems(1)%MudYieldPoint = 10.d0+(TD_DrillStems(1)%MudWeight-8.3d0)
Call TD_BouyancyFactor(1)
Call TD_CombinedMotionData(1)
else
Do i = 1 , TD_String%DrillStemComponentsNumbs
Call TD_MudPropertiesReadData(i)
Call TD_BouyancyFactor(i)
Call TD_CombinedMotionData(i)
End Do
end if
!================================================
Call TD_BOPDiamCalculation
Call TD_StaticHookLoadCalculation
Call TD_WeightOnBitCalculation
if (abs(TD_String%DrillStemAxialVelocity)>3.2808d0) then !1[m/s]=3.2808[ft/s]
Call TD_ViscousDragForce
else
TD_DrillStems%Drag = 0.d0
TD_String%DrillStemForceType = 5
end if
Call TD_ForceCalculation
Call TD_HookLoadCalculation
TD_StConn%HookHeightOld = TD_StConn%HookHeight
end subroutine TD_MainCalculations

+ 0
- 67
Equipments/TorqueDrag/TD_Modules/GeoElements_FluidModule.f90 View File

@@ -1,67 +0,0 @@
MODULE GeoElements_FluidModule
IMPLICIT NONE
PUBLIC
!************************************************************************************************************************************
TYPE , PUBLIC :: Geo_Data
REAL(8) , Allocatable :: MD(:) , TVD(:) , Angle(:)
END TYPE Geo_Data
TYPE(Geo_Data) :: TDGeo
!************************************************************************************************************************************

!************************************************************************************************************************************
!====================================================
! Well Geometrical Elements Info (for fluid module)
!====================================================
TYPE , PUBLIC :: F_StringData
INTEGER :: FirstElement , LastElement , ElType
REAL(8) :: ID , OD , TopDepth , DownDepth
END TYPE F_StringData
TYPE(F_StringData) , Allocatable :: F_String(:)
!************************************************************************************************************************************

!************************************************************************************************************************************
TYPE , PUBLIC :: F_IntervalsCountsData
INTEGER :: IntervalsTotalCounts , StringIntervalCounts , BottomHoleIntervalCounts , AnnulusIntervalCounts
INTEGER :: OutOfWellIntervalCounts
END TYPE F_IntervalsCountsData
TYPE(F_IntervalsCountsData):: F_Counts
!************************************************************************************************************************************
!************************************************************************************************************************************
TYPE , PUBLIC :: F_IntervalData
INTEGER :: Number , GeoType
REAL(8) :: ID , OD , StartDepth , EndDepth , HydDiameter , Volume
REAL(8) :: StartTVD , EndTVD , StartAngle , EndAngle
END TYPE F_IntervalData
TYPE(F_IntervalData) , Allocatable :: F_Interval(:)
!####F_Interval(:)%GeoType =
! 0 : String Interval
! 1 : BottomHole Interval
! 2 : Annulus Interval
!************************************************************************************************************************************

!************************************************************************************************************************************
TYPE , PUBLIC :: OD_AnnulusData
REAL(8) :: ODValue , StartMD , EndMD
END TYPE OD_AnnulusData
TYPE(OD_AnnulusData) :: OD_Annulus(4)
!************************************************************************************************************************************

END MODULE GeoElements_FluidModule

+ 0
- 122
Equipments/TorqueDrag/TD_Modules/TD_DrillStem.f90 View File

@@ -1,122 +0,0 @@
MODULE TD_DrillStemComponents
Use CDownHoleVariables
IMPLICIT NONE
PUBLIC
!************************************************************************************************************************************
TYPE, PUBLIC :: TD_StringInfo
INTEGER :: StringConfigurationCount , DrillStemComponentsNumbs , DrillStemForceType
INTEGER :: NoHorizontalMudElements , NoStringMudElements , NoCasingMudElements
REAL(8) :: DrillStemTotalLength , DrillStemTotalLengthIni , OutOfWellLength , DrillStemTotalWeight , DrillStemBottom
REAL(8) :: DrillStemAxialVelocity , DrillStemRotVelocity , TopJointHeight
REAL(8) :: WeightOnBit , BitTorque , TotalTorque , StaticHookLoad , DlMax , DlTotal , DlTouch
REAL(8) :: HookLoad , StringTorque
REAL(8) :: ToolJointRange
real(8) , allocatable :: FluidMudDensity(:) , FluidMudEndX(:) , FluidMudStartX(:)
!====================================================
! Separated Parts of the Drill Stem
INTEGER :: NearFloorConnectionNo
REAL(8) :: NearFloorConnectionHeight
!====================================================
END TYPE TD_StringInfo
TYPE(TD_StringInfo) :: TD_String
!************************************************************************************************************************************

!************************************************************************************************************************************
!====================================================
! Drill Stem Components Info
!====================================================
TYPE, PUBLIC :: TD_DrillStemInfo
INTEGER :: Numbs , ComponentType
REAL(8) :: Length , TopDepth , DownDepth , Od , Id , WeightperLength , TotalLength , TotalWeight
END TYPE TD_DrillStemInfo
TYPE(TD_DrillStemInfo), ALLOCATABLE, DIMENSION(:) :: TD_DrillStem
!************************************************************************************************************************************

!************************************************************************************************************************************
!====================================================
! Separated Parts of the Drill Stem
!====================================================
TYPE , PUBLIC :: TD_SeparatedDrillStemInfo
!=========> Elements Geometry
INTEGER :: HoleType , ComponentType
REAL(8) :: Length , TopDepth , DownDepth , Od , Id , Area , Weight , WeightperLength , StartAngle , EndAngle
REAL(8) :: RCurvature , RtoolJoint , HoleDiameter , ToolJointRange
!=========> Elements initial Geometry
REAL(8) :: LengthIni , TopDepthIni , DownDepthIni , StartAngleIni , EndAngleIni
!=========> Elements initial Geometry (graphic)
REAL(8) :: TopDepthIniG , DownDepthIniG
!=========> Pipes Properties
REAL(8) :: Density , ElasticModule
!=========> Forces Info
REAL(8) :: Force1 , Force2 , Torque , Drag , CombVelRatio
!=========> Mud Properties
REAL(8) :: MudDensityIn , MudDensityOut , MudViscosity , MudVisCorrectCoef , BouyancyFactor , MudWeight , MudPlasticVis , MudYieldPoint
!=========> Viscous Drag Force
REAL(8) :: FricFactor , DiamRatio , MudClingingConst , PipeVelocity , AveEffVelocity , ReNumber , Dp_Dl
!=========> Hook Load
REAL(8) :: StaticHookLoad , TotalSHookLoad , Dl , DlTotal
END TYPE TD_SeparatedDrillStemInfo
TYPE(TD_SeparatedDrillStemInfo), ALLOCATABLE, DIMENSION(:) :: TD_DrillStems
!************************************************************************************************************************************

!************************************************************************************************************************************
!====================================================
! Add&Remove DrillStem Components
!====================================================
TYPE , PUBLIC :: TD_AddRemoveInfo
INTEGER :: IBOPNewAdd , IBOPOldAdd , SafetyValveNewAdd , SafetyValveOldAdd , KellyNewAdd , KellyOldAdd
INTEGER :: IBOPNewRemove , IBOPOldRemove , SafetyValveNewRemove , SafetyValveOldRemove , KellyNewRemove , KellyOldRemove
INTEGER , Dimension(19) :: KellyOldStatus , KellyNewStatus
!integer :: TD_KellyOldStatus1 , TD_KellyNewStatus1 , TD_KellyOldStatus2 , TD_KellyNewStatus2 , TD_KellyOldStatus3 , TD_KellyNewStatus3
!integer :: TD_KellyOldStatus4 , TD_KellyNewStatus4 , TD_KellyOldStatus5 , TD_KellyNewStatus5 , TD_KellyOldStatus6 , TD_KellyNewStatus6
!integer :: TD_KellyOldStatus7 , TD_KellyNewStatus7 , TD_KellyOldStatus8 , TD_KellyNewStatus8
!integer :: TD_KellyOldStatus9 , TD_KellyNewStatus9 , TD_KellyOldStatus10 , TD_KellyNewStatus10
!integer :: TD_KellyOldStatus11 , TD_KellyNewStatus11 , TD_KellyOldStatus12 , TD_KellyNewStatus12
!integer :: TD_KellyOldStatus13 , TD_KellyNewStatus13 , TD_KellyOldStatus14 , TD_KellyNewStatus14
!integer :: TD_KellyOldStatus15 , TD_KellyNewStatus15 , TD_KellyOldStatus16 , TD_KellyNewStatus16 , TD_KellyOldStatus17 , TD_KellyNewStatus17
!integer :: TD_KellyOldStatus18 , TD_KellyNewStatus18 , TD_KellyOldStatus19 , TD_KellyNewStatus19
END TYPE TD_AddRemoveInfo
TYPE(TD_AddRemoveInfo) :: TD_Count
!************************************************************************************************************************************

!************************************************************************************************************************************
!====================================================
! Graphic Output Info
!====================================================
!TYPE, PUBLIC :: CStringComponent
! Integer :: ComponentType
! REAL(8) :: Length , TopDepth , DownDepth , Od , Id
!END TYPE CStringComponent
TYPE(CStringComponents), ALLOCATABLE, DIMENSION(:) :: G_StringElement
!************************************************************************************************************************************

!************************************************************************************************************************************
!====================================================
! Removed-Volume Variables
!====================================================
TYPE , PUBLIC :: TD_RemovedVolumeInfo
Integer :: PreCount
REAL(8) :: RemoveVolume , PreElementVolume , PreElementLength
END TYPE TD_RemovedVolumeInfo
TYPE(TD_RemovedVolumeInfo) :: TD_Vol
!************************************************************************************************************************************

END MODULE TD_DrillStemComponents

+ 0
- 53
Equipments/TorqueDrag/TD_Modules/TD_GeneralData.f90 View File

@@ -1,53 +0,0 @@
MODULE TD_GeneralData
Use CDownHoleTypes
IMPLICIT NONE
PUBLIC
!************************************************************************************************************************************
!====================================================
! General Info
!====================================================
!=====> Time Info
TYPE , PUBLIC :: TD_GeneralInfo
REAL :: TimeStep
!=====> Problems
INTEGER :: WeightIndicatorMalf
END TYPE TD_GeneralInfo
TYPE(TD_GeneralInfo) :: TD_General
!************************************************************************************************************************************

!************************************************************************************************************************************
!=====> BOP Info
TYPE , PUBLIC :: TD_BOPInfo
REAL(8) :: AboveAnnularDiam , AnnularPreventerDiam , UpperRamDiam , LowerRamDiam , BlindRamDiam , KillDiam
REAL(8) , Dimension(6) :: BOPHeight , BOPDiam
REAL(8) , Dimension(4) :: BOPRamDiam
REAL(8) :: BOPThickness , AnnularFillingFinal
INTEGER , Dimension(4) :: BOPCondition
INTEGER , Dimension(6) :: BOPElementNo
INTEGER , Dimension(6) :: BOPConnectionPossibility ! 0:impossible , 1:possible(for DrillPipe Element)
END TYPE TD_BOPInfo
TYPE(TD_BOPInfo) :: TD_BOP
!************************************************************************************************************************************

!************************************************************************************************************************************
!TYPE , PUBLIC :: TD_BOPElementData
! INTEGER :: CType
! REAL(8) :: TopDepth , DownDepth
!END TYPE TD_BOPElementData
TYPE(CBopElement) :: TD_BOPElement(4)
!************************************************************************************************************************************


END MODULE TD_GeneralData

+ 0
- 45
Equipments/TorqueDrag/TD_Modules/TD_StringConnectionData.f90 View File

@@ -1,45 +0,0 @@
MODULE TD_StringConnectionData
IMPLICIT NONE
PUBLIC
!************************************************************************************************************************************
!====================================================
! String Connection Info
!====================================================
TYPE , PUBLIC :: TD_StringconnectionInfo
INTEGER :: StringConnectionMode , KellyDriveTypeMode , OldOperationCondition , FluidStringConnectionMode
REAL(8) :: ConnectionHeight , TouchConnectionHeight , RigidConnectionHeight , GRigidConnectionHeight , StringVelocity
REAL(8) :: HookHeightOld , HookHeight , HookVelocity
REAL(8) :: ElevatorHeight , ElevatorConst
REAL(8) :: SafetyValveLength , IBOPLength , KellyElementID , KellyElementOD
REAL(8) :: KellyConnectionHeight , KellyConst , KellyElementConst
REAL(8) :: TDSHeight , TDSElevatorHeight , TDSLength , TDSElevatorLength , TDSToolJointLength , TDSElevatorToolLength
REAL(8) :: TDSElevatorECG , ElevatorECG
END TYPE TD_StringconnectionInfo
TYPE(TD_StringconnectionInfo) :: TD_StConn
!************************************************************************************************************************************

!************************************************************************************************************************************
!====================================================
! Weight Indicator Info
!====================================================
TYPE , PUBLIC :: TD_LoadInfo
INTEGER :: NumOfCables
REAL(8) :: WeightIndicator
REAL(8) :: WeightTB , WeightTD , KellyWeight
INTEGER :: ZeroStringSpeed
REAL(8) :: DrawworksLoadInput
END TYPE TD_LoadInfo
TYPE(TD_LoadInfo) :: TD_Load
!************************************************************************************************************************************

END MODULE TD_StringConnectionData

+ 0
- 73
Equipments/TorqueDrag/TD_Modules/TD_WellElements.f90 View File

@@ -1,73 +0,0 @@
MODULE TD_WellElements
IMPLICIT NONE
PUBLIC

!************************************************************************************************************************************
TYPE , PUBLIC :: TD_WellElementsInfo
INTEGER :: CasingNumbs
INTEGER :: LinerNumbs
INTEGER :: OpenHoleNumbs
INTEGER :: ROPHoleNumbs
REAL(8) :: ROP
END TYPE TD_WellElementsInfo
TYPE(TD_WellElementsInfo) :: TD_WellEl
!************************************************************************************************************************************


!************************************************************************************************************************************
!====================================================
! Casing Info
!====================================================
TYPE, PUBLIC :: TD_CasingInfo
INTEGER :: HoleType
REAL(8) :: Length , TopDepth , DownDepth , Od , Id , Weight , CollapsePressure , TensileStrength , Roughness
END TYPE TD_CasingInfo
TYPE(TD_CasingInfo), ALLOCATABLE, DIMENSION(:) :: TD_Casing
!************************************************************************************************************************************

!************************************************************************************************************************************
!====================================================
! Liner Info
!====================================================
TYPE, PUBLIC :: TD_LinerInfo
REAL(8) :: Length , TopDepth , DownDepth , Od , Id , Weight , CollapsePressure , TensileStrength , Roughness , HoleType
END TYPE TD_LinerInfo
TYPE(TD_LinerInfo), ALLOCATABLE, DIMENSION(:) :: TD_Liner
!************************************************************************************************************************************

!************************************************************************************************************************************
!====================================================
! Open_Hole Info
!====================================================
TYPE, PUBLIC :: TD_OpenHoleInfo
REAL(8) :: Length , TopDepth , DownDepth , Id , HoleType
END TYPE TD_OpenHoleInfo
TYPE(TD_OpenHoleInfo), ALLOCATABLE, DIMENSION(:) :: TD_OpenHole
!************************************************************************************************************************************

!************************************************************************************************************************************
!====================================================
! ROP_Hole Info
!====================================================
TYPE, PUBLIC :: TD_ROPHoleInfo
REAL(8) :: Length , TopDepth , DownDepth , Id , HoleType
END TYPE TD_ROPHoleInfo
TYPE(TD_ROPHoleInfo), ALLOCATABLE, DIMENSION(:) :: TD_ROPHole
!************************************************************************************************************************************

END MODULE TD_WellElements

+ 0
- 35
Equipments/TorqueDrag/TD_Modules/TD_WellGeometry.f90 View File

@@ -1,35 +0,0 @@
MODULE TD_WellGeometry
IMPLICIT NONE
PUBLIC
REAL(8) , PARAMETER :: pi=3.14159265d0
!************************************************************************************************************************************
!====================================================
! Well Geometry Info
!====================================================
TYPE, PUBLIC :: TD_WellGeneralInfo
INTEGER :: WellIntervalsCount
REAL(8) :: WellTotalLength , WellTotalVerticalLength
END TYPE TD_WellGeneralInfo
TYPE(TD_WellGeneralInfo) :: TD_WellGeneral
!************************************************************************************************************************************

!************************************************************************************************************************************
TYPE, PUBLIC :: TD_WellGeometryData
INTEGER :: HoleType
REAL(8) :: StartAngle , EndAngle , IntervalLength , VerticalDepth , TopDepth , DownDepth , RCurvature
END TYPE TD_WellGeometryData
TYPE(TD_WellGeometryData), Allocatable :: TD_WellGeo(:)
!************************************************************************************************************************************

END MODULE TD_WellGeometry

BIN
View File


+ 0
- 145
Equipments/TorqueDrag/TD_ReadDataSubroutines/TD_DrillStemReadData.f90 View File

@@ -1,145 +0,0 @@
subroutine TD_DrillStemReadData
Use CStringConfigurationVariables
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_StringConnectionData
Use Drawworks_VARIABLES, only: Drawworks

implicit none

Integer :: i
Integer :: TD_FirstIndex , TD_LastIndex
!====================================================
! Set Drill Stem Components Data
!====================================================
TD_String%StringConfigurationCount = StringConfiguration%StringConfigurationCount
TD_String%DrillStemComponentsNumbs = 0
!########## TD_DrillStem%ComponentType ::
!#Bit_ComponentType = 0
!#Stabilizer_ComponentType = 1
!#Collar_ComponentType = 2
!#DrillPipe_ComponentType = 3
!#Heavyweight_ComponentType = 4
!#IBOP = 5
!#Kelly & SafetyValve (DrillMode) = 6
!#SafetyValve (TripMode) = 7
if (Allocated(TD_DrillStem)) deAllocate (TD_DrillStem)
Allocate (TD_DrillStem(TD_String%StringConfigurationCount+100))
Do i=1, TD_String%StringConfigurationCount
TD_DrillStem(i)%ComponentType = StringConfiguration%StringConfigurations(i)%ComponentType
TD_DrillStem(i)%Numbs = StringConfiguration%StringConfigurations(i)%NumberOfJoint
TD_DrillStem(i)%Id = StringConfiguration%StringConfigurations(i)%NominalId/12.d0 ![ft]
TD_DrillStem(i)%Od = StringConfiguration%StringConfigurations(i)%NominalOd/12.d0 ![ft]
TD_DrillStem(i)%Length = StringConfiguration%StringConfigurations(i)%LengthPerJoint ![ft]
TD_DrillStem(i)%WeightperLength = StringConfiguration%StringConfigurations(i)%WeightPerLength ![lb/ft]
TD_DrillStem(i)%TotalLength = StringConfiguration%StringConfigurations(i)%ComponentLength
TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength
TD_String%DrillStemComponentsNumbs = TD_String%DrillStemComponentsNumbs+StringConfiguration%StringConfigurations(i)%NumberOfJoint
!!=========> Set Separated Drill Stem Components Data
! TD_LastIndex = TD_LastIndex+StringConfigurations(i)%NumberOfJoint
!
! TD_DrillStems(TD_FirstIndex:TD_LastIndex)%ComponentType = TD_DrillStem(i)%ComponentType
! TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Id = TD_DrillStem(i)%Id
! TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Od = TD_DrillStem(i)%Od
! TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Length = TD_DrillStem(i)%Length
! TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Weight = TD_DrillStem(i)%Weight
!
! TD_FirstIndex = TD_LastIndex+1
End Do
!===> Initial Values of Removed-Volume Variables
if (TD_DrillStem(1)%ComponentType==0) then
TD_Vol%PreCount = TD_String%StringConfigurationCount-1
else
TD_Vol%PreCount = TD_String%StringConfigurationCount
end if
TD_Vol%PreElementVolume = TD_DrillStem(TD_String%StringConfigurationCount)%TotalLength*(((pi*((TD_DrillStem(TD_String%StringConfigurationCount)%Id)**2))/4.d0)) ![ft^3]
TD_Vol%PreElementLength = TD_DrillStem(TD_String%StringConfigurationCount)%TotalLength

!====================================================
! Set Separated Drill Stem Components Data
!====================================================
TD_FirstIndex = 1
TD_LastIndex = 0
if (Allocated(TD_DrillStems)) deAllocate (TD_DrillStems)
Allocate (TD_DrillStems(TD_String%DrillStemComponentsNumbs+300)) ! +300: because of: Add or Remove DrillStem Components
Call TD_DrillStemStartUp
Do i=1, TD_String%StringConfigurationCount
TD_LastIndex = TD_LastIndex+StringConfiguration%StringConfigurations(i)%NumberOfJoint
TD_DrillStems(TD_FirstIndex:TD_LastIndex)%ComponentType = TD_DrillStem(i)%ComponentType
TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Id = TD_DrillStem(i)%Id
TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Od = TD_DrillStem(i)%Od
TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Area = (pi*((TD_DrillStem(i)%Od**2)-(TD_DrillStem(i)%Id**2)))/4.0d0
if (TD_DrillStem(i)%ComponentType == 3 .or. TD_DrillStem(i)%ComponentType == 4) then
TD_DrillStems(TD_FirstIndex:TD_LastIndex)%RtoolJoint = TD_DrillStem(i)%Od*1.30d0/2.0d0
TD_DrillStems(TD_FirstIndex:TD_LastIndex)%ToolJointRange = TD_String%ToolJointRange
else if (TD_DrillStem(i)%ComponentType == 1 .or. TD_DrillStem(i)%ComponentType == 2) then
TD_DrillStems(TD_FirstIndex:TD_LastIndex)%RtoolJoint = TD_DrillStem(i)%Od/2.0d0
TD_DrillStems(TD_FirstIndex:TD_LastIndex)%ToolJointRange = TD_String%ToolJointRange
else if (TD_DrillStem(i)%ComponentType == 0) then
TD_DrillStems(TD_FirstIndex:TD_LastIndex)%RtoolJoint = TD_DrillStem(i)%Od
TD_DrillStems(TD_FirstIndex:TD_LastIndex)%ToolJointRange = 0.0d0
end if
TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Length = TD_DrillStem(i)%Length
TD_DrillStems(TD_FirstIndex:TD_LastIndex)%LengthIni = TD_DrillStem(i)%Length
TD_DrillStems(TD_FirstIndex:TD_LastIndex)%WeightperLength= TD_DrillStem(i)%WeightperLength
TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Weight = TD_DrillStem(i)%WeightperLength*TD_DrillStem(i)%Length
TD_FirstIndex = TD_LastIndex+1
End Do

!====================================================
! Set Hook Height Data
!====================================================
TD_StConn%HookHeightOld = Drawworks%Hook_Height_ini
TD_StConn%HookHeight = TD_StConn%HookHeightOld
end subroutine

+ 0
- 61
Equipments/TorqueDrag/TD_ReadDataSubroutines/TD_ForceReadData.f90 View File

@@ -1,61 +0,0 @@
subroutine TD_ForceReadData
Use CHoistingVariables
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData
Use TD_StringConnectionData
Use RTable_VARIABLES, only: RTable
Use sROP_Variables
Use TopDrive_VARIABLES, only: TDS

implicit none
integer :: i
TD_String%DrillStemAxialVelocity = TD_StConn%StringVelocity
Do i = 1 , TD_String%DrillStemComponentsNumbs
if ( Hoisting%DriveType==1) then
TD_String%DrillStemRotVelocity = (2.d0*pi*TD_DrillStems(i)%RtoolJoint)*(RTable%Speed)/60.d0 ! RTable%Speed[RPM] ---> TD_String%DrillStemRotVelocity[ft/s]
else if ( Hoisting%DriveType==0) then
TD_String%DrillStemRotVelocity = (2.d0*pi*TD_DrillStems(i)%RtoolJoint)*(TDS%Speed+RTable%Speed)/60.d0 ! TDS%Speed[RPM] ---> TD_String%DrillStemRotVelocity[ft/s]
end if
End Do
TD_String%BitTorque = ROP_Bit%BitTorque

!TD_String%DrillStemAxialVelocity = 0.0 !???????????????????
!TD_String%DrillStemRotVelocity = 0.0 !???????????????????

TD_String%DrillStemForceType = 0
if(TD_String%DrillStemAxialVelocity > 0.) then !??????????????????? check
TD_String%DrillStemForceType = 1
if(TD_String%DrillStemRotVelocity /= 0.d0) TD_String%DrillStemForceType = 2
else if(TD_String%DrillStemAxialVelocity < 0.d0) then
TD_String%DrillStemForceType = 3
if(TD_String%DrillStemRotVelocity /= 0.d0) TD_String%DrillStemForceType = 4
else if(TD_String%DrillStemAxialVelocity == 0.d0) then
TD_String%DrillStemForceType = 5 !no axial motion
end if

end subroutine

+ 0
- 96
Equipments/TorqueDrag/TD_ReadDataSubroutines/TD_MudPropertiesReadData.f90 View File

@@ -1,96 +0,0 @@
subroutine TD_MudPropertiesReadData (i)
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData
Use FricPressDropVars
Use MudSystemVARIABLES

implicit none

Integer :: i , j , TDmd
real(8) :: TDden, TDpre, TDtem
!====================================================
! Set Mud Properties Data
!====================================================
IF ( ALLOCATED(FlowEl) ) THEN
if ( i==2 ) then
TDmd = int(TD_DrillStems(i)%DownDepthIni-1.d0)
else
TDmd = int(TD_DrillStems(i)%DownDepthIni)
end if
Call StringPropertyCalculator (TDmd , TDden, TDpre, TDtem)
TD_DrillStems(i)%MudDensityIn = TDden*7.48051948d0 ! [ppg]*7.48051948=[lb/ft3]
Call AnnulusPropertyCalculator (TDmd , TDden, TDpre, TDtem)
TD_DrillStems(i)%MudDensityOut = TDden*7.48051948d0 ! [ppg]*7.48051948=[lb/ft3]
TD_DrillStems(i)%MudWeight = TDden ! [ppg] ???????????????
ELSE
TD_DrillStems(i)%MudDensityIn = TD_DrillStems(i)%MudDensityIn
TD_DrillStems(i)%MudDensityOut = TD_DrillStems(i)%MudDensityOut
TD_DrillStems(i)%MudWeight = TD_DrillStems(i)%MudWeight
END IF
!TD_DrillStems(i)%Drag =
!IF (ALLOCATED(TD_String%FluidMudDensity) .and. ALLOCATED(TD_String%FluidMudStartX) .and. TD_String%NoStringMudElements/=0) THEN
! Do j = TD_StringNoHorizontalMudElements+1,TD_StringNoHorizontalMudElements+TD_String%NoStringMudElements
! if ( TD_DrillStems(i)%DownDepthIni<=TD_String%FluidMudStartX(j) ) then
! exit
! end if
! TD_DrillStems(i)%MudDensityIn = TD_String%FluidMudDensity(j)*7.48051948d0 !10.*7.48051948 ! [ppg]*7.48051948=[lb/ft3]
! !print*, 'TD_DrillStems(i)%MudDensityIn=' ,TD_DrillStems(i)%MudDensityIn , i
! !print*, 'FlowEl(j)%density=' ,FlowEl(j)%density , i
! End Do
!ELSE
! TD_DrillStems(i)%MudDensityIn = TD_DrillStems(i)%MudDensityIn ! [ppg]*7.48051948=[lb/ft3]
!! !print*, '=================' , i
!END IF
!
!
!
!
!
!
!
!IF (ALLOCATED(TD_String%FluidMudDensity) .and. ALLOCATED(TD_String%FluidMudEndX) .and. TD_String%NoCasingMudElements/=0) THEN
! Do j = (TD_StringNoHorizontalMudElements+TD_String%NoStringMudElements+TD_String%NoCasingMudElements),(TD_StringNoHorizontalMudElements+TD_String%NoStringMudElements+1),-1
! if ( TD_DrillStems(i)%DownDepthIni<=TD_String%FluidMudEndX(j) ) then
! exit
! end if
! TD_DrillStems(i)%MudDensityOut = TD_String%FluidMudDensity(j)*7.48051948d0 !10.*7.48051948 ! [ppg]*7.48051948=[lb/ft3]
! TD_DrillStems(i)%MudWeight = TD_String%FluidMudDensity(j) !10.0 ! [ppg] ???????????????
! End Do
!ELSE
! TD_DrillStems(i)%MudDensityOut = TD_DrillStems(i)%MudDensityOut ! [ppg]*7.48051948=[lb/ft3]
! TD_DrillStems(i)%MudWeight = TD_DrillStems(i)%MudWeight ! [ppg] ???????????????
!END IF
TD_DrillStems(i)%MudPlasticVis = 5.d0+(5.d0*(TD_DrillStems(i)%MudWeight-8.3d0)) ! [cP]
!TD_DrillStems(i)%MudPlasticVis= TD_DrillStems(i)%MudPlasticVis * 6.71968d-4 ! [cP]*6.71968d-4=[lb/(ft.s)]
TD_DrillStems(i)%MudViscosity = 0.2d0 !TD_DrillStems(i)%MudPlasticVis
TD_DrillStems(i)%MudYieldPoint = 10.d0+(TD_DrillStems(i)%MudWeight-8.3d0)
end subroutine

+ 0
- 26
Equipments/TorqueDrag/TD_ReadDataSubroutines/TD_PipePropertiesReadData.f90 View File

@@ -1,26 +0,0 @@
subroutine TD_PipePropertiesReadData
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData

implicit none

Integer :: i
!====================================================
! Set Pipe Properties Data
!====================================================
Do i = 1 , TD_String%DrillStemComponentsNumbs
TD_DrillStems(i)%Density = 7850.d0*0.06242796d0 ![kg/m3]*0.06242796=[lb/ft3]
TD_DrillStems(i)%ElasticModule = 200.0d9*0.02088543d0 ![lb/ft2] !200GPa=29Mpsi (steel)
End Do
end subroutine

+ 0
- 132
Equipments/TorqueDrag/TD_ReadDataSubroutines/TD_WellElementsReadData.f90 View File

@@ -1,132 +0,0 @@
subroutine TD_WellElementsReadData
Use CCasingLinerChokeVariables
use CStringConfigurationVariables
Use TD_WellElements
Use TD_WellGeometry

implicit none

Integer :: i
Real(8) :: TD_OpenHoleLength
!====================================================
! Set Casing Data
!====================================================
TD_WellEl%CasingNumbs = 1
if (Allocated(TD_Casing)) deAllocate (TD_Casing)
Allocate (TD_Casing(TD_WellEl%CasingNumbs))
Do i=1, TD_WellEl%CasingNumbs
TD_Casing(i)%Length = CasingLinerChoke%CasingDepth ! unit: [ft]
TD_Casing(i)%TopDepth = 0.d0
TD_Casing(i)%DownDepth = TD_Casing(i)%Length
TD_Casing(i)%Od = CasingLinerChoke%CasingOd/12.d0 ! unit: [ft]
TD_Casing(i)%Id = CasingLinerChoke%CasingId/12.d0 ! unit: [ft]
TD_Casing(i)%Weight = CasingLinerChoke%CasingWeight
TD_Casing(i)%CollapsePressure = CasingLinerChoke%CasingCollapsePressure
TD_Casing(i)%TensileStrength = CasingLinerChoke%CasingTensileStrength
End Do
!====================================================
! Set Liner Data
!====================================================
TD_WellEl%LinerNumbs = 0
if(CasingLinerChoke%LinerLength > 0.d0) then
TD_WellEl%LinerNumbs = 1
!if (TD_WellEl%LinerNumbs>0) then
if (Allocated(TD_Liner)) deAllocate (TD_Liner)
Allocate (TD_Liner(TD_WellEl%LinerNumbs))
Do i=1, TD_WellEl%LinerNumbs
TD_Liner(i)%TopDepth = CasingLinerChoke%LinerTopDepth ! unit: [ft]
if (TD_Liner(i)%TopDepth<TD_Casing(i)%DownDepth) then
TD_Casing(TD_WellEl%CasingNumbs)%DownDepth = TD_Liner(i)%TopDepth
end if
TD_Liner(i)%Length = CasingLinerChoke%LinerLength ! unit: [ft]
TD_Liner(i)%DownDepth = TD_Liner(i)%TopDepth+TD_Liner(i)%Length
TD_Liner(i)%Od = CasingLinerChoke%LinerOd/12.d0 ! unit: [ft]
TD_Liner(i)%Id = CasingLinerChoke%LinerId/12.d0 ! unit: [ft]
TD_Liner(i)%Weight = CasingLinerChoke%LinerWeight
TD_Liner(i)%CollapsePressure = CasingLinerChoke%LinerCollapsePressure
TD_Liner(i)%TensileStrength = CasingLinerChoke%LinerTensileStrength
End Do
else
if (Allocated(TD_Liner)) deAllocate (TD_Liner)
Allocate (TD_Liner(1))
TD_WellEl%LinerNumbs = 1
TD_Liner%Length = 0.d0
TD_Liner%TopDepth = TD_Casing(TD_WellEl%CasingNumbs)%DownDepth
TD_Liner%DownDepth = TD_Liner%TopDepth
end if
!====================================================
! Set Open_Hole Data
!====================================================
TD_WellEl%OpenHoleNumbs = 0
TD_OpenHoleLength=TD_WellGeneral%WellTotalLength-(TD_Liner(TD_WellEl%LinerNumbs)%DownDepth)
if(TD_OpenHoleLength > 0.d0) TD_WellEl%OpenHoleNumbs=1
if (TD_WellEl%OpenHoleNumbs>0) then
if (Allocated(TD_OpenHole)) deAllocate (TD_OpenHole)
Allocate (TD_OpenHole(TD_WellEl%OpenHoleNumbs)) !!!??????????????????check
Do i = 1, TD_WellEl%OpenHoleNumbs
TD_OpenHole(i)%TopDepth = TD_Liner(TD_WellEl%LinerNumbs)%DownDepth
TD_OpenHole(i)%Length = TD_OpenHoleLength ! unit: [ft]
TD_OpenHole(i)%DownDepth = TD_OpenHole(i)%TopDepth+TD_OpenHole(i)%Length
TD_OpenHole(i)%Id = CasingLinerChoke%OpenHoleId/12.d0 ! unit: [ft]
End Do
else
if (Allocated(TD_OpenHole)) deAllocate (TD_OpenHole)
Allocate (TD_OpenHole(1))
TD_WellEl%OpenHoleNumbs = 1
TD_OpenHole%Length = 0.d0
TD_OpenHole%TopDepth = TD_Liner(TD_WellEl%LinerNumbs)%DownDepth
TD_OpenHole%DownDepth = TD_OpenHole%TopDepth
end if
!====================================================
! Set ROP_Hole Data
!====================================================
TD_WellEl%ROPHoleNumbs = 1
if (Allocated(TD_ROPHole)) deAllocate (TD_ROPHole)
Allocate (TD_ROPHole(TD_WellEl%ROPHoleNumbs))
Do i = 1, TD_WellEl%ROPHoleNumbs
TD_ROPHole(i)%TopDepth = TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%TopDepth
TD_ROPHole(i)%DownDepth = TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%DownDepth
TD_ROPHole(i)%Length = TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%IntervalLength
TD_ROPHole(i)%Id = StringConfiguration%BitDefinition%BitSize/12.d0 ! unit: [ft]
End Do
end subroutine

+ 0
- 111
Equipments/TorqueDrag/TD_ReadDataSubroutines/TD_WellReadData.f90 View File

@@ -1,111 +0,0 @@
subroutine TD_WellReadData

Use CPathGenerationVariables
Use TD_WellGeometry
implicit none

Integer :: i
TD_WellGeneral%WellIntervalsCount = PathGeneration%ItemCount + 1 ! +1 is belong to ROP hole
if (Allocated(TD_WellGeo)) deAllocate (TD_WellGeo)
Allocate (TD_WellGeo(TD_WellGeneral%WellIntervalsCount))
!====================================================
! Set Well Geometry Data
!====================================================
TD_WellGeo(1)%HoleType = PathGeneration%Items(1)%HoleType
TD_WellGeo(1)%StartAngle = 0.d0 ![rad]
TD_WellGeo(1)%EndAngle = PathGeneration%Items(1)%FinalAngle*(pi/180.d0) ![rad]
TD_WellGeo(1)%IntervalLength= PathGeneration%Items(1)%TotalLength ![ft]
!TD_WellGeo(1)%VerticalDepth = PathGenerations(1)%TotalVerticalDepth
TD_WellGeo(1)%TopDepth = 0.d0
TD_WellGeo(1)%DownDepth = PathGeneration%Items(1)%MeasuredDepth
Do i=2,TD_WellGeneral%WellIntervalsCount-1
TD_WellGeo(i)%HoleType = PathGeneration%Items(i)%HoleType
TD_WellGeo(i)%StartAngle = PathGeneration%Items(i-1)%FinalAngle*(pi/180.d0)
TD_WellGeo(i)%EndAngle = PathGeneration%Items(i)%FinalAngle*(pi/180.d0)
TD_WellGeo(i)%IntervalLength= PathGeneration%Items(i)%TotalLength
!TD_WellGeo(i)%VerticalDepth = PathGeneration%Items(i)%TotalVerticalDepth
TD_WellGeo(i)%TopDepth = PathGeneration%Items(i-1)%MeasuredDepth
TD_WellGeo(i)%DownDepth = PathGeneration%Items(i)%MeasuredDepth
!=====> Radius Of Curvature Calculation
if (TD_WellGeo(i)%HoleType/=0) then
TD_WellGeo(i)%RCurvature = ((TD_WellGeo(i)%IntervalLength)/abs(TD_WellGeo(i)%EndAngle-TD_WellGeo(i)%StartAngle))
end if
End Do
!=====> Set ROP Hole Data
TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%HoleType = 0 !Straight
TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%StartAngle = TD_WellGeo(TD_WellGeneral%WellIntervalsCount-1)%EndAngle
TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%EndAngle = TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%StartAngle
TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%IntervalLength= 0.d0
!TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%VerticalDepth = TD_WellGeo(TD_WellGeneral%WellIntervalsCount-1)%VerticalDepth
TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%TopDepth = TD_WellGeo(TD_WellGeneral%WellIntervalsCount-1)%DownDepth
TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%DownDepth = TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%TopDepth+TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%IntervalLength
!=====> Vertical Depth Calculation
if ( TD_WellGeo(1)%HoleType==0 ) then
TD_WellGeo(1)%VerticalDepth = TD_WellGeo(1)%IntervalLength*cos(TD_WellGeo(1)%StartAngle)
else if ( TD_WellGeo(1)%HoleType==1 ) then
TD_WellGeo(1)%VerticalDepth = (TD_WellGeo(1)%RCurvature*sin(abs(TD_WellGeo(1)%EndAngle)-abs(TD_WellGeo(1)%StartAngle))*cos(abs(TD_WellGeo(1)%StartAngle)))-(TD_WellGeo(1)%RCurvature*(1.-cos(abs(TD_WellGeo(1)%EndAngle)-abs(TD_WellGeo(1)%StartAngle)))*sin(abs(TD_WellGeo(1)%StartAngle)))
else if ( TD_WellGeo(1)%HoleType==2 ) then
TD_WellGeo(1)%VerticalDepth = (TD_WellGeo(1)%RCurvature*sin(abs(abs(TD_WellGeo(1)%EndAngle)-abs(TD_WellGeo(1)%StartAngle)))*cos(abs(TD_WellGeo(1)%StartAngle)))+(TD_WellGeo(1)%RCurvature*(1.-cos(abs(abs(TD_WellGeo(1)%EndAngle)-abs(TD_WellGeo(1)%StartAngle))))*sin(abs(TD_WellGeo(1)%StartAngle)))
End if
Do i= 2,TD_WellGeneral%WellIntervalsCount
if ( TD_WellGeo(i)%HoleType==0 ) then
TD_WellGeo(i)%VerticalDepth = TD_WellGeo(i-1)%VerticalDepth+TD_WellGeo(i)%IntervalLength*cos(TD_WellGeo(i)%StartAngle)
else if ( TD_WellGeo(i)%HoleType==1 ) then
TD_WellGeo(i)%VerticalDepth = TD_WellGeo(i-1)%VerticalDepth+(TD_WellGeo(i)%RCurvature*sin(abs(TD_WellGeo(i)%EndAngle)-abs(TD_WellGeo(i)%StartAngle))*cos(abs(TD_WellGeo(i)%StartAngle)))-(TD_WellGeo(i)%RCurvature*(1.-cos(abs(TD_WellGeo(i)%EndAngle)-abs(TD_WellGeo(i)%StartAngle)))*sin(abs(TD_WellGeo(i)%StartAngle)))
else if ( TD_WellGeo(i)%HoleType==2 ) then
TD_WellGeo(i)%VerticalDepth = TD_WellGeo(i-1)%VerticalDepth+(TD_WellGeo(i)%RCurvature*sin(abs(abs(TD_WellGeo(i)%EndAngle)-abs(TD_WellGeo(i)%StartAngle)))*cos(abs(TD_WellGeo(i)%StartAngle)))+(TD_WellGeo(i)%RCurvature*(1.-cos(abs(abs(TD_WellGeo(i)%EndAngle)-abs(TD_WellGeo(i)%StartAngle))))*sin(abs(TD_WellGeo(i)%StartAngle)))
End if
End Do
!Do i=1,TD_WellGeneral%WellIntervalsCount
! print*, 'TD_WellGeo(i)%TopDepth=' , i , TD_WellGeo(i)%TopDepth
! print*, 'TD_WellGeo(i)%DownDepth=' , i , TD_WellGeo(i)%DownDepth
! print*, 'TD_WellGeo(i)%HoleType=' , i , TD_WellGeo(i)%HoleType
! print*, 'TD_WellGeo(i)%RCurvature=' , i , TD_WellGeo(i)%RCurvature
! print*, 'TD_WellGeo(i)%EndAngle=' , i , TD_WellGeo(i)%EndAngle
! print*, 'TD_WellGeo(i)%StartAngle=' , i , TD_WellGeo(i)%StartAngle
! print*, 'TD_WellGeo(i)%VerticalDepth=' , i , TD_WellGeo(i)%VerticalDepth
!end do
!=====> Well Total Length Calculation
TD_WellGeneral%WellTotalLength = TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%DownDepth
TD_WellGeneral%WellTotalVerticalLength = TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%VerticalDepth


end subroutine

+ 0
- 81
Equipments/TorqueDrag/TD_StartUp/TD_DrillStemStartUp.f90 View File

@@ -1,81 +0,0 @@
subroutine TD_DrillStemStartUp
Use CCasingLinerChokeVariables
Use CStringConfigurationVariables
Use CSimulationVariables
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData
Use TD_StringConnectionData

implicit none
TD_String%DrillStemTotalLength = 500.d0 !???????????????????
TD_String%DrillStemTotalLengthIni = 500.d0 !???????????????????
TD_String%OutOfWellLength = 3.48d0
TD_String%DrillStemAxialVelocity = 0.d0
TD_String%DrillStemRotVelocity = 0.d0
TD_String%WeightOnBit = 0.d0
TD_String%BitTorque = 0.d0
TD_String%TotalTorque = 0.d0
TD_String%StaticHookLoad = 0.d0
TD_String%DlMax = 0.d0
TD_String%DlTotal = 0.d0
TD_String%DlTouch = 1.d0 !(=/0.) because of TD_StringConnectionModes subroutine (initial value for first iteration in if condition)
TD_String%HookLoad = 0.d0
TD_String%StringTorque = 0.d0
TD_String%ToolJointRange = 0.4005d0*3.28d0 ![m]*3.28=[ft] , ToolJointLength=400.5mm
TD_Vol%RemoveVolume = 0.0d0
TD_String%DrillStemBottom = TD_String%DrillStemTotalLength-TD_String%OutOfWellLength !????????????
!TD_DrillStems%TopDepth =
!TD_DrillStems%DownDepth =
!TD_DrillStems%StartAngle =
!TD_DrillStems%EndAngle =
TD_DrillStems%Area = 0.d0
TD_DrillStems%RCurvature = 0.d0
TD_DrillStems%RtoolJoint = 0.d0
TD_DrillStems%ToolJointRange = 0.d0
TD_DrillStems%HoleDiameter = 0.d0
TD_DrillStems%Force1 = 0.d0
TD_DrillStems%Force2 = 0.d0
TD_DrillStems%Torque = 0.d0
TD_DrillStems%Drag = 0.d0
TD_DrillStems%CombVelRatio = 0.d0
TD_DrillStems%MudDensityIn = 10.d0*7.48051948d0
TD_DrillStems%MudDensityOut = 10.d0*7.48051948d0
TD_DrillStems%MudViscosity = 0.16d0 !????????????????
TD_DrillStems%MudVisCorrectCoef = 1.d0 !????????????????
TD_DrillStems%MudWeight = 10.d0
!TD_DrillStems%MudPlasticVis = !????????????????
!TD_DrillStems%MudYieldPoint = !????????????????
!TD_DrillStems%FricFactor =
!TD_DrillStems% =
!TD_DrillStems% =
!TD_DrillStems%StaticHookLoad =
!TD_DrillStems%TotalSHookLoad =
!TD_DrillStems%Dl =
!TD_DrillStems%DlTotal =
!if (allocated(TD_String%FluidMudDensity)) deallocate(TD_String%FluidMudDensity)
!if (allocated(TD_String%FluidMudEndX)) deallocate(TD_String%FluidMudEndX)
!if (allocated(TD_String%FluidMudStartX)) deallocate(TD_String%FluidMudStartX)
!Allocate (TD_String%FluidMudDensity(1) , TD_String%FluidMudEndX(1) , TD_String%FluidMudStartX(1))
!TD_String%FluidMudDensity(:) = 10.d0
!TD_String%FluidMudStartX(:) = -268.d0 !??????????
!TD_String%FluidMudEndX(:) = 9990.d0 !??????????
end subroutine

+ 0
- 156
Equipments/TorqueDrag/TD_StartUp/TD_StartUp.f90 View File

@@ -1,156 +0,0 @@
subroutine TD_StartUp
Use CCasingLinerChokeVariables
Use CStringConfigurationVariables
! use CSimulationVariables
use UnitySignalVariables
! Use COperationConditionEnumVariables
Use CHoistingVariables
Use CPathGenerationVariables
Use TD_DrillStemComponents
Use TD_WellElements
Use TD_WellGeometry
Use TD_GeneralData
Use TD_StringConnectionData
Use Drawworks_VARIABLES!, only: Drawworks
Use sROP_Variables
Use sROP_Other_Variables
implicit none
!!====================================================
!! Allocate Modules
!!====================================================
! !=====> Set WellGeo Dimension
! TD_WellGeneral%WellIntervalsCount = PathGeneration%ItemCount + 1 ! +1 is belong to ROP hole
! Allocate (TD_WellGeo(TD_WellGeneral%WellIntervalsCount))
!
! !=====> Set WellGeo Dimension
!=====> Set ROP StartUp
ROP_Bit%BitWearing = 0.d0
ROP_Bit%RateOfPenetration = 0.d0
ROP_Bit%BearingWear = 0.d0
ROP_Spec%FormationNumber = 0
ROP_Bit%OldROPDepth = PathGeneration%Items(PathGeneration%ItemCount)%MeasuredDepth
ROP_Bit%OldROPValue = 0.d0
ROP_Bit%SetROPGauge = 0.d0
!=====> Set BOP StartUp
TD_BOP%BOPCondition = 0
TD_BOP%BOPThickness = (0.13477d0/2.d0)*3.28d0 ![m]*3.28=[ft] , Total Thickness (RAM)= 134.77mm
TD_BOP%AnnularFillingFinal = 0.d0
Drawworks%TDHookHeight = 75.d0 ![ft]
Drawworks%Hook_Height_ini = 75.d0 ![ft]
Drawworks%Hook_Height_final = 75.d0 ![ft]
!=====> String Connection Mode
if ( Get_OperationCondition()==OPERATION_TRIP ) then
TD_StConn%OldOperationCondition = 1
else
TD_StConn%OldOperationCondition = 0
end if
TD_StConn%KellyDriveTypeMode = 0 !Kelly Mode
TD_StConn%FluidStringConnectionMode = 0
TD_StConn%ConnectionHeight = 3.48d0 ![ft]
TD_StConn%RigidConnectionHeight = 3.48d0 ![ft]
TD_StConn%GRigidConnectionHeight = 3.48d0 ![ft]
TD_String%TopJointHeight = 3.48d0 ![ft]
!TD_StConn%TouchConnectionHeight =
TD_StConn%StringVelocity = 0.0d0
TD_StConn%HookHeightOld = 75.d0 ![ft]
TD_StConn%HookHeight = 75.d0 ![ft]
TD_StConn%HookVelocity = 0.0d0
!=====> Element Specification
TD_StConn%HookHeight = Drawworks%TDHookHeight ! unit: [ft]
TD_StConn%ElevatorConst = 17.985 ! [ft] Elevator Length(14.84) ????????????????? adad ha daghigh shavand
TD_StConn%ElevatorECG = 2.217 ! [ft]
TD_StConn%KellyConst = 63.280d0 ! [ft] Kelly Length(61.74) + Safety Valve Length(1.54)
TD_StConn%KellyElementConst = 41.840d0 ! [ft] Kelly Element Length(40.3) + Safety Valve Length(1.54)
TD_StConn%TDSLength = 24.08d0 !??????????????????? ! [ft]
TD_StConn%TDSToolJointLength = 0.77d0 !??????????????????? ! [ft]
TD_StConn%TDSElevatorLength = 26.837d0 !?????? ! TDS with Elevator Length [ft]
TD_StConn%TDSElevatorToolLength= 0.859d0 !??????????????????? ! [ft]
TD_StConn%TDSElevatorECG = 2.454 ! [ft]
TD_Load%NumOfCables = Hoisting%NumberOfLine
TD_Load%WeightTB = Hoisting%TravelingBlockWeight ! [lb]
TD_Load%WeightTD = Hoisting%TopDriveWeight ! [lb]
TD_Load%KellyWeight = Hoisting%KellyWeight ! [lb]
TD_StConn%SafetyValveLength = 1.54d0 ! [ft]
TD_StConn%IBOPLength = 1.54d0 ! [ft]
TD_StConn%KellyElementID = 3.0d0/12.d0 ! [ft]
TD_StConn%KellyElementOD = 5.90d0/12.d0 ! [ft]
TD_Load%DrawworksLoadInput = Hoisting%TravelingBlockWeight/Hoisting%NumberOfLine
TD_Count%IBOPNewAdd = 0
TD_Count%IBOPOldAdd = 0 !Remove
TD_Count%SafetyValveNewAdd = 0
TD_Count%SafetyValveOldAdd = 1 !Install
TD_Count%KellyNewAdd = 0
TD_Count%KellyOldAdd = 0
TD_Count%IBOPNewRemove = 0
TD_Count%IBOPOldRemove = 1 !Remove
TD_Count%SafetyValveNewRemove = 0
TD_Count%SafetyValveOldRemove = 0 !Install
TD_Count%KellyNewRemove = 0
TD_Count%KellyOldRemove = 1
TD_Count%KellyOldStatus(1) = 0
TD_Count%KellyNewStatus(1) = 0
TD_Count%KellyOldStatus(2) = 1 ! Kelly Connected Nothing
TD_Count%KellyNewStatus(2) = 1 ! Kelly Connected Nothing
TD_Count%KellyOldStatus(3) = 0
TD_Count%KellyNewStatus(3) = 0
TD_Count%KellyOldStatus(4) = 0
TD_Count%KellyNewStatus(4) = 0
TD_Count%KellyOldStatus(5) = 0
TD_Count%KellyNewStatus(5) = 0
TD_Count%KellyOldStatus(6) = 0
TD_Count%KellyNewStatus(6) = 0
TD_Count%KellyOldStatus(7) = 0
TD_Count%KellyNewStatus(7) = 0
TD_Count%KellyOldStatus(8) = 0
TD_Count%KellyNewStatus(8) = 0
TD_Count%KellyOldStatus(18) = 0
TD_Count%KellyNewStatus(18) = 0
TD_Count%KellyOldStatus(19) = 0
TD_Count%KellyNewStatus(19) = 0
TD_Count%KellyOldStatus(9) = 0
TD_Count%KellyNewStatus(9) = 0
TD_Count%KellyOldStatus(10) = 0
TD_Count%KellyNewStatus(10) = 0
TD_Count%KellyOldStatus(11) = 0
TD_Count%KellyNewStatus(11) = 0
TD_Count%KellyOldStatus(12) = 0
TD_Count%KellyNewStatus(12) = 0
TD_Count%KellyOldStatus(13) = 1
TD_Count%KellyNewStatus(13) = 1
TD_Count%KellyOldStatus(14) = 0
TD_Count%KellyNewStatus(14) = 0
TD_Count%KellyOldStatus(15) = 0
TD_Count%KellyNewStatus(15) = 0
TD_Count%KellyOldStatus(16) = 0
TD_Count%KellyNewStatus(16) = 0
TD_Count%KellyOldStatus(17) = 0
TD_Count%KellyNewStatus(17) = 0
!=====> Problems
TD_General%WeightIndicatorMalf = 0
end subroutine

+ 0
- 46
Equipments/TorqueDrag/TorqueDragMain.f90 View File

@@ -1,46 +0,0 @@
MODULE TorqueDragMain
USE CPumpsVariables
USE CDrillingConsoleVariables
USE CDataDisplayConsoleVariables
USE CSimulationVariables
USE Pumps_VARIABLES
IMPLICIT NONE
PUBLIC
CONTAINS
subroutine TorqueDrag_Setup()
use CSimulationVariables
implicit none
call OnSimulationInitialization%Add(TorqueDrag_Init)
call OnSimulationStop%Add(TorqueDrag_Init)
call OnTorqueDragStep%Add(TorqueDrag_Step)
call OnTorqueDragOutput%Add(TorqueDrag_Output)
call OnTorqueDragMain%Add(TorqueDragMainBody)
end subroutine
subroutine TorqueDrag_Init
implicit none
end subroutine TorqueDrag_Init
subroutine TorqueDrag_Step
implicit none
end subroutine TorqueDrag_Step
subroutine TorqueDrag_Output
implicit none
end subroutine TorqueDrag_Output
SUBROUTINE TorqueDragMainBody
USE ifport
USE ifmt
USE CSimulationVariables
!USE TDSUP
IMPLICIT NONE
!CALL TD_MainCalculations

END SUBROUTINE TorqueDragMainBody

END MODULE TorqueDragMain

+ 0
- 0
View File


BIN
View File


+ 11
- 3
Simulator.f90 View File

@@ -14,7 +14,9 @@ module Simulator
use BlindRamsMain
use AnnularMain
use TopDriveMain
use CManifolds
use GeoMain
use ChokeControlMain
use COperationScenariosMain
use :: json_module, rk => json_rk
@@ -51,6 +53,9 @@ contains
!! Tarmigh, now is rewritten
call Pump1_Step()
!call Pump2_Step()

!! Rafiee
call ChokeControl_Step()
!! Location ./Equipment/Rotarytable
!! Variables:
@@ -70,7 +75,7 @@ contains
!! Empty nothing called
!! Merged in FluidFlow
call TorqueDrag_Step()
! call TorqueDrag_Step()
!! Location: ./Equipment/MudSystem
!! Variables: MudSystem_variables.f90 and MudSystem.f90
@@ -90,7 +95,7 @@ contains
!! Location ./Equipment/BopStack
!! Variables: VARIABLES,CBopStackVariables,CBopControlPanelVariables,CEquipmentsConstants,CAccumulatorVariables,CSimulationVariables
!! Step function added, only call PIPE_RAMS1 and 2 function
!! Step function added, only call PIPE_RAMS1 and PIPE_RAMS2 function
!! BOP_StartUp commented
!! Rafiee
call KillLine_Step()
@@ -105,13 +110,16 @@ contains
call TopDrive_Step()
!!Empty
call Geo_Step()
! call Geo_Step()
!! Sheikh
!call FluidFlow_Step()
!! Ahmadi
call OperationScenarios_Step()

!!Ahmadi
call PathFinding_Step()
!! Write variables to shared files
call write_variables()


+ 1
- 1
TorqueDrag/TD_DrillingSubs/TD_WellGeoConfiguration.f90 View File

@@ -19,7 +19,7 @@ subroutine TD_WellGeoConfiguration
!=====> ROP Calculation
if ( TD_DrillStems(1)%ComponentType==0 .and. MaximumWellDepthExceeded==.false. ) then
if ( TD_DrillStems(1)%ComponentType==0 .and. Warmings%MaximumWellDepthExceeded==.false. ) then
Call ROP_MainCalculation
else
ROP_Bit%RateOfPenetration = 0.d0


+ 0
- 5
TorqueDrag/TD_Modules/TD_DrillStem.f90 View File

@@ -114,9 +114,4 @@ MODULE TD_DrillStemComponents
END TYPE TD_RemovedVolumeInfo
TYPE(TD_RemovedVolumeInfo) :: TD_Vol
!************************************************************************************************************************************

END MODULE TD_DrillStemComponents

BIN
View File


BIN
View File


Loading…
Cancel
Save