Simulation Core
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

239 righe
11 KiB

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