Simulation Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

215 lines
7.9 KiB

  1. subroutine Kick_Influx ! is called in subroutine CirculationCodeSelect
  2. Use GeoElements_FluidModule
  3. USE CMudPropertiesVariables
  4. USE MudSystemVARIABLES
  5. USE Pumps_VARIABLES
  6. use CDrillWatchVariables
  7. !use CTanksVariables, TripTankVolume2 => DrillingWatch%TripTankVolume, TripTankDensity2 => TripTankDensity
  8. USE sROP_Other_Variables
  9. USE sROP_Variables
  10. Use KickVariables
  11. implicit none
  12. !===========================================================WELL============================================================
  13. !===========================================================WELL============================================================
  14. !write(*,*) 'Kick Influx'
  15. !=================== Bottom Hole Kick Influx ENTRANCE(due to Kick) ===================
  16. MudSystemDotKick_Density= 2
  17. MudSystemDotNewInflux_Density= MudSystemDotKick_Density
  18. if ( MudSystemDotNewInfluxElementCreated==0 ) then ! new kick is pumped- (it is set to zero in sheykh subroutine after a new kick influx)
  19. call MudSystemDotOp_Density%AddToFirst (MudSystemDotNewInflux_Density)
  20. call MudSystemDotOp_MudDischarged_Volume%AddToFirst (0.0d0)
  21. call MudSystemDotOp_Mud_Forehead_X%AddToFirst (MudSystemDotXstart_OpSection(1))
  22. call Op_Mud_Forehead_section%AddToFirst (1)
  23. call MudSystemDotOp_Mud_Backhead_X%AddToFirst (MudSystemDotXstart_OpSection(1))
  24. call Op_Mud_Backhead_section%AddToFirst (1)
  25. call MudSystemDotOp_RemainedVolume_in_LastSection%AddToFirst (0.0d0)
  26. call MudSystemDotOp_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0)
  27. call Op_MudOrKick%AddToFirst (MudSystemDotNewInfluxNumber) ! KickNumber= NewInfluxNumber
  28. MudSystemDotNewInfluxElementCreated= 1
  29. endif
  30. MudSystemDotOp_MudDischarged_Volume%Array(1)= MudSystemDotOp_MudDischarged_Volume%Array(1)+ ((GasKickPumpFlowRate/60.0d0)*DeltaT_Mudline) !(gal) due to KickFlux
  31. !write(*,*) 'kick volume ok=' , Op_MudDischarged_Volume%Array(1)
  32. end subroutine Kick_Influx
  33. subroutine Instructor_CirculationMud_Edit ! is called in subroutine CirculationCodeSelect
  34. Use KickVariables
  35. Use MudSystemVARIABLES
  36. USE TD_DrillStemComponents
  37. Use CUnityInputs
  38. Use CUnityOutputs
  39. USE CKellyConnectionEnumVariables
  40. USE UTUBEVARS
  41. use sROP_Variables
  42. use sROP_Other_Variables
  43. use CDownHoleVariables
  44. implicit none
  45. if ( DownHole%AnnDrillMud == .true. .and. (Rate_of_Penetration>0. .and. MudSystemDotDeltaVolumeOp>0.0) ) then
  46. do MudSystemDotimud= 1, Ann_Density%Length()
  47. if ( Ann_MudOrKick%Array(MudSystemDotimud) == 0 ) then
  48. Ann_Density%Array(MudSystemDotimud)= (St_Density%Last() * MudSystemDotAnnulusFlowRate + 141.4296E-4*Rate_of_Penetration*Diameter_of_Bit**2)/(MudSystemDotAnnulusFlowRate+6.7995E-4*Rate_of_Penetration*Diameter_of_Bit**2)
  49. Ann_CuttingMud%Array(MudSystemDotimud)= 1
  50. endif
  51. enddo
  52. endif
  53. if ( DownHole%AnnCirculateMud == .true. ) then
  54. do MudSystemDotimud= 1, Ann_Density%Length()
  55. if ( Ann_MudOrKick%Array(MudSystemDotimud) == 0 ) then
  56. Ann_Density%Array(MudSystemDotimud)= ActiveTankDensity
  57. Ann_CuttingMud%Array(MudSystemDotimud)= 0
  58. endif
  59. enddo
  60. do MudSystemDotimud= 1, St_Density%Length()
  61. St_Density%Array(MudSystemDotimud)= ActiveTankDensity
  62. enddo
  63. endif
  64. end subroutine Instructor_CirculationMud_Edit
  65. subroutine ShoeLostSub ! is called in subroutine CirculationCodeSelect
  66. Use KickVariables
  67. Use MudSystemVARIABLES
  68. USE TD_DrillStemComponents
  69. Use CUnityInputs
  70. Use CUnityOutputs
  71. USE CKellyConnectionEnumVariables
  72. USE UTUBEVARS
  73. use sROP_Variables
  74. use sROP_Other_Variables
  75. use CDownHoleVariables
  76. use CShoeVariables
  77. USE PressureDisplayVARIABLES
  78. Use CWarningsVariables
  79. implicit none
  80. MudSystemDotShoeLost= .false.
  81. MudSystemDotKickexpansion_DueToMudLost= .false.
  82. MudSystemDotShoeMudPressure= PressureGauges(5)
  83. MudSystemDotUGBOSuccessionCounter = MudSystemDotUGBOSuccessionCounter + 1
  84. !write(*,*) 'check point 1'
  85. if (Shoe%InactiveFracture == .FALSE. .AND. ((MudSystemDotShoeMudPressure >= MudSystemDotFormationLostPressure) .or. MudSystemDotShoeFractured )) then
  86. !write(*,*) 'check point 2 ,UGBOSuccessionCounter' , UGBOSuccessionCounter
  87. ! if ShoeFractured changed to true , then time counter is not needed more
  88. if ( MudSystemDotUGBOSuccessionCounter /= MudSystemDotUGBOSuccessionCounterOld+1 .and. MudSystemDotShoeFractured==.false. ) then
  89. MudSystemDotUGBOSuccessionCounter = 0 ! also in starup
  90. MudSystemDotUGBOSuccessionCounterOld = 0 ! also in starup
  91. return
  92. else
  93. MudSystemDotUGBOSuccessionCounterOld= MudSystemDotUGBOSuccessionCounter
  94. endif
  95. if ( MudSystemDotUGBOSuccessionCounter < 10 .and. MudSystemDotShoeFractured==.false.) then
  96. return
  97. endif
  98. !write(*,*) 'check point 3 ,UGBOSuccessionCounter' , UGBOSuccessionCounter
  99. MudSystemDotShoeFractured= .true.
  100. MudSystemDotShoeMudViscosity= MAX(MudSystemDotShoeMudViscosity, 12.d0)
  101. !write(*,*) 'ShoeMudDensity , ShoeMudViscosity' , ShoeMudDensity , ShoeMudViscosity
  102. MudSystemDotShoeLostCoef = 10.**(-8) * 1.15741d0 * 7.08d0 * 1000000.d0 * 1.d0 * MudSystemDotShoeMudDensity / &
  103. (MudSystemDotShoeMudViscosity * LOG(10000.d0))
  104. !write(*,*) 'lost parameters 1' , ShoeMudPressure , FormationLostPressure
  105. MudSystemDotQlost = MAX( (MudSystemDotShoeLostCoef * (MudSystemDotShoeMudPressure - (MudSystemDotFormationLostPressure/2.0))) , 0.d0 )
  106. if (MudSystemDotQlost > 0.0) then
  107. MudSystemDotShoeLost= .true.
  108. else
  109. MudSystemDotShoeLost= .false.
  110. endif
  111. !write(*,*) 'Qlost=' , Qlost, ShoeMudPressure, FormationLostPressure
  112. call Activate_UndergroundBlowout()
  113. do MudSystemDotimud= 1, Ann_Mud_Forehead_X%Length()
  114. IF ( MudSystemDotShoeLost .and. Shoe%ShoeDepth < Ann_Mud_Backhead_X%Array(MudSystemDotimud) .and. Shoe%ShoeDepth >= Ann_Mud_Forehead_X%Array(MudSystemDotimud) &
  115. .and. Ann_MudOrKick%Array(MudSystemDotimud) == 0 .and. WellHeadIsOpen == .FALSE. ) then
  116. MudSystemDotKickexpansion_DueToMudLost= .true.
  117. write(*,*) 'Kickexpansion_DueToMudLost'
  118. EXIT
  119. ENDIF
  120. enddo
  121. endif
  122. if (UndergroundBlowout == .false.) MudSystemDotShoeLost= .false.
  123. end subroutine ShoeLostSub