Simulation Core
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

239 linhas
11 KiB

  1. subroutine ROP_MainCalculation
  2. use sROP_Other_Variables
  3. use sROP_Variables
  4. use CStringConfigurationVariables
  5. use CformationVariables
  6. ! use CSimulationVariables
  7. use CDataDisplayConsoleVariables
  8. use CDrillingConsoleVariables
  9. use CmudPropertiesVariables
  10. use CHoistingVariables
  11. ! use CDrillingConsole
  12. use CPathGenerationVariables
  13. use RTable_VARIABLES, only: RTable
  14. use TD_DrillStemComponents
  15. use TD_WellGeometry
  16. use PressureDisplayVARIABLES
  17. use MudSystemVARIABLES
  18. use FricPressDropVars
  19. use CReservoirVariables
  20. use CWarningsVariables
  21. use TopDrive_VARIABLES, only: TDS
  22. use TD_GeneralData
  23. implicit none
  24. Integer :: i , zero_ROPcount
  25. !Real(8) :: ROP_Bit%SetROPGauge
  26. zero_ROPcount = 0
  27. ROP_Bit%NoOfFormations = Formation%Count
  28. ROP_Bit%DrillingVerticalDepth = TD_WellGeneral%WellTotalVerticalLength
  29. !===> MaximumWellDepthExceeded Warning
  30. if ( ROP_Bit%DrillingVerticalDepth>=(Formation%Formations(Formation%Count)%Top+Formation%Formations(Formation%Count)%Thickness) ) then
  31. ROP_Bit%RateOfPenetration = 0.0d0
  32. Call Set_ROP(ROP_Bit%RateOfPenetration)
  33. Call Activate_MaximumWellDepthExceeded()
  34. return
  35. end if
  36. !=====================================
  37. if ( ROP_Spec%FormationNumber/=0 .and. DrillingConsole%HideDrillingBrake==1 ) then ! Hide Drilling Brake Mode
  38. ROP_Spec%FormationNumber = ROP_Spec%FormationNumber
  39. else
  40. do i= 1,ROP_Bit%NoOfFormations
  41. ROP_Spec%FormationTopDepth = Formation%Formations(i)%Top
  42. if (ROP_Bit%DrillingVerticalDepth>=ROP_Spec%FormationTopDepth) then
  43. ROP_Spec%FormationNumber = i
  44. end if
  45. end do
  46. end if
  47. !!===> Hide Drilling Brake Mode
  48. !if ( ROP_Spec%FormationNumber==FormationNo .and. HideDrillingBrake==1 ) then !????????????
  49. ! ROP_Spec%FormationNumber = FormationNo-1
  50. !end if
  51. !!=============================
  52. !ROP_Spec%BitClass = BitDefinition%BitCode !????????????
  53. call Bit_Specification
  54. ! $$$$$**$$$$$**$$$$$**$$$$$**$$$$$** Variables Initialization: *$$$$$**$$$$$**$$$$$**$$$$$**$$$$$
  55. ROP_Spec%DiameterOfBit = StringConfiguration%BitDefinition%BitSize ! unit : [in.] (Typical Range: 3.0 to 30.0)
  56. ROP_Spec%NumberOfBitNozzles = StringConfiguration%BitDefinition%BitNozzleNo ! (Typical Values: 1 to 10)
  57. ROP_Spec%DiameterOfBitNozzle = StringConfiguration%BitDefinition%BitNozzleSize ! unit : [inch] *** basic input: [1/32 in.] (Typical Range: 8.0 to 32.0)
  58. ROP_Spec%CriticalMudDensity = Formation%Formations(ROP_Spec%FormationNumber)%PorePressureGradient/.465d0*9.d0 ! ????????? delete ,unit : [ppg] or [lb/gal] (Typical Range: 0 to 10.0)
  59. ROP_Bit%FormationMudDensity = Formation%Formations(ROP_Spec%FormationNumber)%PorePressureGradient/0.052d0
  60. ROP_Bit%BottomHolePressure = PressureGauges(3) !5200 [psi]
  61. ROP_Bit%ECD = ROP_Bit%BottomHolePressure/(0.052*ROP_Bit%DrillingVerticalDepth)
  62. ROP_Spec%CriticalWeightOnBit = (Formation%Formations(ROP_Spec%FormationNumber)%ThresholdWeight/5.d0)-(.06d0*(Formation%Formations(ROP_Spec%FormationNumber)%ThresholdWeight-10.d0)) ! unit : [klb/in] (Typical Range: 0 to 10 ----> 0.6 to 2)
  63. !IF (ALLOCATED(FlowEl)) THEN
  64. ! ROP_Bit%MudViscosity = FlowEl(NoHorizontalEl + NoStringEl)%mueff !13.5 [cP]
  65. ROP_Bit%MudDensity = MudSystem%BitMudDensity ! [ppg]
  66. !ELSE
  67. ROP_Bit%MudViscosity = 13.5 ! [cP]
  68. !ROP_Bit%MudDensity = 9.2 ! [ppg]
  69. !END IF
  70. ROP_Bit%MudFlowrate = MudSystem%StringFlowRateFinal ! [gpm]
  71. ROP_Spec%ReynoldsNumber = ROP_Bit%MudFlowrate*ROP_Bit%MudDensity/(ROP_Bit%MudViscosity*ROP_Spec%NumberOfBitNozzles*ROP_Spec%DiameterOfBitNozzle) ! unit : [dimensionless] (Typical Range: 0.1 to 1000.0)
  72. ! $$$$$**$$$$$**$$$$$**$$$$$**$$$$ End of Variable Initialization $$$$$**$$$$$**$$$$$**$$$$$**$$$$$
  73. ! -----**-----**-----**-----**-----* ROP_bit%RateofPenetration Model Coefficients: *-----**-----**-----**-----**-----
  74. ROP_Spec%a1 = log(Formation%Formations(ROP_Spec%FormationNumber)%Drillablity)
  75. ROP_Spec%a2 = 1.2799d-04
  76. ROP_Spec%a3 = 1.7952d-04
  77. ROP_Spec%a4 = 4.0656d-05
  78. ROP_Spec%a5 = 2.9021d-01
  79. ROP_Spec%a6 = 9.4882d-02
  80. ROP_Spec%a7 = 2.1837d-01
  81. ROP_Spec%a8 = 4.4915d-01
  82. ROP_Spec%dt = 0.1d0 ![s]
  83. ROP_Spec%TouH = Formation%Formations(ROP_Spec%FormationNumber)%Abrasiveness*3600.d0 ! [hr]--->[s] ( Typical Range: 1<Abrasiveness<100 )
  84. ! -----**-----**-----**-----**--- End of ROP_bit%RateofPenetration Model Coefficients ---**-----**-----**-----**-----
  85. ! $$$$$**$$$$$**$$$$$**$$$$$**$$$$$** Main Calculations: *$$$$$**$$$$$**$$$$$**$$$$$**$$$$$
  86. ROP_Spec%f1 = Formation%Formations(ROP_Spec%FormationNumber)%Drillablity ! 1<=Drillability<=100 [ft/h]
  87. ROP_Spec%f2 = exp(2.303d0*ROP_Spec%a2*(10000.d0 - ROP_Bit%DrillingVerticalDepth)) ! First Compaction Vairable
  88. ROP_Spec%f3 = exp(2.303d0*ROP_Spec%a3*(ROP_Bit%DrillingVerticalDepth**0.69d0)*(ROP_Bit%FormationMudDensity-9.d0)) ! Second Compaction Vairable
  89. if ( (2.303d0*ROP_Spec%a4*ROP_Bit%DrillingVerticalDepth*(ROP_Bit%FormationMudDensity-ROP_Bit%ECD))>=0.d0 ) then
  90. ROP_Spec%f4 = exp(2.303d0*ROP_Spec%a4*ROP_Bit%DrillingVerticalDepth*(ROP_Bit%FormationMudDensity-ROP_Bit%ECD)) ! Underbalance Drilling Variable
  91. else
  92. ROP_Spec%f4 = 1.0d0
  93. end if
  94. if (TD_String%WeightOnBit>0.d0) then
  95. ROP_Bit%WeightOnBit = TD_String%WeightOnBit/1000.d0 ![klb]
  96. else
  97. ROP_Bit%WeightOnBit = 0.d0
  98. end if
  99. if ( (ROP_Bit%WeightOnBit/ROP_Spec%DiameterOfBit)<ROP_Spec%CriticalWeightOnBit ) then
  100. ROP_Spec%f5 = 0.0d0
  101. else
  102. ROP_Spec%f5 = ( ((ROP_Bit%WeightOnBit/ROP_Spec%DiameterOfBit)-ROP_Spec%CriticalWeightOnBit)/(4.d0-ROP_Spec%CriticalWeightOnBit) )**ROP_Spec%a5
  103. end if
  104. if (Hoisting%DriveType==1 .and. RTable%Speed>0.d0) then
  105. ROP_Bit%RotarySpeed = RTable%Speed ![rpm]
  106. else if (Hoisting%DriveType==0 .and. (TDS%Speed>0. .or. RTable%Speed>0.)) then
  107. ROP_Bit%RotarySpeed = TDS%Speed+RTable%Speed ![rpm]
  108. else
  109. ROP_Bit%RotarySpeed = 0.0d0
  110. end if
  111. ROP_Spec%f6 = (ROP_Bit%RotarySpeed/100.d0)**ROP_Spec%a6
  112. ROP_Spec%f7 = exp(-ROP_Spec%a7*ROP_Bit%BitWearing)
  113. Call JetImpactForce
  114. ROP_Spec%f8 = ROP_Bit%JetImpactForce/1000.d0
  115. ROP_Bit%RateOfPenetration = (ROP_Spec%f1*ROP_Spec%f2*ROP_Spec%f3*ROP_Spec%f4*ROP_Spec%f5*ROP_Spec%f6*ROP_Spec%f7*ROP_Spec%f8) ![ft/h]
  116. ROP_Bit%RateOfPenetration = (DINT(ROP_Bit%RateOfPenetration*10.d0))/10.d0
  117. if ( (TD_WellGeneral%WellTotalLength==PathGeneration%Items(PathGeneration%ItemCount)%MeasuredDepth) ) then
  118. ROP_Bit%SetROPGauge = ROP_Bit%RateOfPenetration
  119. Call Set_ROP(ROP_Bit%SetROPGauge) ![ft/h]
  120. ROP_Bit%OldROPValue(4) = ROP_Bit%RateOfPenetration
  121. !print* , 'first rop=' , ROP_Bit%OldROPValue , ROP_Bit%RateOfPenetration ,&
  122. ! zero_ROPcount , ROP_Bit%SetROPGauge , ROP_Bit%OldROPDepth , TD_WellGeneral%WellTotalLength , PathGenerations(PathGenerationCount)%MeasuredDepth
  123. else if ( ((TD_WellGeneral%WellTotalLength+(ROP_Bit%RateOfPenetration*TD_General%TimeStep/3600.d0))-ROP_Bit%OldROPDepth)>=0.1 ) then
  124. do i= 1,4
  125. if ( ROP_Bit%OldROPValue(i)==0. ) then
  126. zero_ROPcount = zero_ROPcount+1
  127. end if
  128. end do
  129. ROP_Bit%SetROPGauge = (ROP_Bit%RateOfPenetration+ROP_Bit%OldROPValue(1)+ROP_Bit%OldROPValue(2)+ROP_Bit%OldROPValue(3)+ROP_Bit%OldROPValue(4))/sngl(5-zero_ROPcount)
  130. Call Set_ROP(ROP_Bit%SetROPGauge) ![ft/h]
  131. do i= 2,4
  132. ROP_Bit%OldROPValue(i-1) = ROP_Bit%OldROPValue(i)
  133. end do
  134. ROP_Bit%OldROPValue(4) = ROP_Bit%RateOfPenetration
  135. ROP_Bit%OldROPDepth = TD_WellGeneral%WellTotalLength+(ROP_Bit%RateOfPenetration*TD_General%TimeStep/3600.d0)
  136. !print* , 'new rop=' , ROP_Bit%OldROPValue , ROP_Bit%RateOfPenetration ,&
  137. ! zero_ROPcount , ROP_Bit%SetROPGauge , ROP_Bit%OldROPDepth , TD_WellGeneral%WellTotalLength , PathGenerations(PathGenerationCount)%MeasuredDepth
  138. else
  139. Call Set_ROP(ROP_Bit%SetROPGauge) ![ft/h]
  140. !print* , 'old rop=' , ROP_Bit%OldROPValue , ROP_Bit%RateOfPenetration ,&
  141. ! zero_ROPcount , ROP_Bit%SetROPGauge , ROP_Bit%OldROPDepth , TD_WellGeneral%WellTotalLength , PathGenerations(PathGenerationCount)%MeasuredDepth
  142. end if
  143. if (ROP_Bit%RotarySpeed > 0.d0) THEN
  144. ROP_Bit%BitTorque = ( 3.79d0 + 19.17d0*sqrt( ROP_Bit%RateOfPenetration / (ROP_Bit%RotarySpeed*ROP_Spec%DiameterOfBit)) ) * ROP_Spec%DiameterOfBit * ROP_Bit%WeightOnBit * ( 1.d0 / ( 1.d0 + 0.00021d0*ROP_Bit%DrillingVerticalDepth) )
  145. !ROP_Bit%BitTorque = ROP_Bit%BitTorque/3. !bi dalil taghsim bar 3 shode(chon adad bozorg bude), baadan az rabete check shavad (seyyed gofte)
  146. else
  147. ROP_Bit%BitTorque = 0.d0
  148. end if
  149. if ( (ROP_Bit%WeightOnBit/ROP_Spec%DiameterOfBit)<(ROP_Spec%wdmax) ) then
  150. ROP_Bit%BitWearing = ROP_Bit%BitWearing +( (ROP_Spec%dt*ROP_Spec%H3/ROP_Spec%TouH)*((ROP_Bit%RotarySpeed/100.d0)**ROP_Spec%H1)*((ROP_Spec%wdmax-4.d0)/(ROP_Spec%wdmax-(ROP_Bit%WeightOnBit/ROP_Spec%DiameterOfBit)))*((1.d0+(ROP_Spec%H2/2.d0))/(1.d0+(ROP_Spec%H2*ROP_Bit%BitWearing))) )
  151. else
  152. ROP_Bit%BitWearing = 1.0d0 !( Typical Range: 0<=ROP_Bit%BitWearing<=1 )
  153. end if
  154. ROP_Bit%BearingWear = ROP_Bit%BearingWear+(ROP_Spec%dt/3600.d0)*(ROP_Bit%RotarySpeed/100.d0/ROP_Spec%BrCoef)*((ROP_Bit%WeightOnBit/4.d0/ROP_Spec%DiameterOfBit)**1.5d0)
  155. !print*, 'ROP_Bit%RateOfPenetration=', ROP_Bit%RateOfPenetration
  156. !!print*, 'ROP_Bit%FormationMudDensity=', ROP_Bit%FormationMudDensity
  157. !!print*, 'ROP_Bit%ECD=', ROP_Bit%ECD
  158. !!print*, 'ROP_Bit%DrillingVerticalDepth=', ROP_Bit%DrillingVerticalDepth
  159. !!print*, 'power=', (2.303*ROP_Spec%a4*ROP_Bit%DrillingVerticalDepth*(ROP_Bit%FormationMudDensity-ROP_Bit%ECD))
  160. !print*, 'ROP_Bit%RotarySpeed=', ROP_Bit%RotarySpeed
  161. !!
  162. !print*, 'ROP_Spec%f1=', ROP_Spec%f1
  163. !print*, 'ROP_Spec%f2=', ROP_Spec%f2
  164. !print*, 'ROP_Spec%f3=', ROP_Spec%f3
  165. !print*, 'ROP_Spec%f4=', ROP_Spec%f4
  166. !print*, 'ROP_Spec%f5=', ROP_Spec%f5
  167. !print*, 'ROP_Spec%f6=', ROP_Spec%f6
  168. !print*, 'ROP_Spec%f7=', ROP_Spec%f7
  169. !print*, 'ROP_Spec%f8=', ROP_Spec%f8
  170. !print*, '***********************'
  171. end subroutine