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.

Kick_Influx.f90 7.1 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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. Kick_Density= 2
  17. NewInflux_Density= Kick_Density
  18. if ( NewInfluxElementCreated==0 ) then ! new kick is pumped- (it is set to zero in sheykh subroutine after a new kick influx)
  19. call Op_Density%AddToFirst (NewInflux_Density)
  20. call Op_MudDischarged_Volume%AddToFirst (0.0d0)
  21. call Op_Mud_Forehead_X%AddToFirst (Xstart_OpSection(1))
  22. call Op_Mud_Forehead_section%AddToFirst (1)
  23. call Op_Mud_Backhead_X%AddToFirst (Xstart_OpSection(1))
  24. call Op_Mud_Backhead_section%AddToFirst (1)
  25. call Op_RemainedVolume_in_LastSection%AddToFirst (0.0d0)
  26. call Op_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0)
  27. call Op_MudOrKick%AddToFirst (NewInfluxNumber) ! KickNumber= NewInfluxNumber
  28. NewInfluxElementCreated= 1
  29. endif
  30. Op_MudDischarged_Volume%Array(1)= Op_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. DeltaVolumeOp>0.0) ) then
  46. do imud= 1, Ann_Density%Length()
  47. if ( Ann_MudOrKick%Array(imud) == 0 ) then
  48. Ann_Density%Array(imud)= (St_Density%Last() * AnnulusFlowRate + 141.4296E-4*Rate_of_Penetration*Diameter_of_Bit**2)/(AnnulusFlowRate+6.7995E-4*Rate_of_Penetration*Diameter_of_Bit**2)
  49. Ann_CuttingMud%Array(imud)= 1
  50. endif
  51. enddo
  52. endif
  53. if ( DownHole%AnnCirculateMud == .true. ) then
  54. do imud= 1, Ann_Density%Length()
  55. if ( Ann_MudOrKick%Array(imud) == 0 ) then
  56. Ann_Density%Array(imud)= ActiveTankDensity
  57. Ann_CuttingMud%Array(imud)= 0
  58. endif
  59. enddo
  60. do imud= 1, St_Density%Length()
  61. St_Density%Array(imud)= 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. ShoeLost= .false.
  81. Kickexpansion_DueToMudLost= .false.
  82. ShoeMudPressure= PressureGauges(5)
  83. UGBOSuccessionCounter = UGBOSuccessionCounter + 1
  84. !write(*,*) 'check point 1'
  85. if (Shoe%InactiveFracture == .FALSE. .AND. ((ShoeMudPressure >= FormationLostPressure) .or. ShoeFractured )) then
  86. !write(*,*) 'check point 2 ,UGBOSuccessionCounter' , UGBOSuccessionCounter
  87. ! if ShoeFractured changed to true , then time counter is not needed more
  88. if ( UGBOSuccessionCounter /= UGBOSuccessionCounterOld+1 .and. ShoeFractured==.false. ) then
  89. UGBOSuccessionCounter = 0 ! also in starup
  90. UGBOSuccessionCounterOld = 0 ! also in starup
  91. return
  92. else
  93. UGBOSuccessionCounterOld= UGBOSuccessionCounter
  94. endif
  95. if ( UGBOSuccessionCounter < 10 .and. ShoeFractured==.false.) then
  96. return
  97. endif
  98. !write(*,*) 'check point 3 ,UGBOSuccessionCounter' , UGBOSuccessionCounter
  99. ShoeFractured= .true.
  100. ShoeMudViscosity= MAX(ShoeMudViscosity, 12.d0)
  101. !write(*,*) 'ShoeMudDensity , ShoeMudViscosity' , ShoeMudDensity , ShoeMudViscosity
  102. ShoeLostCoef = 10.**(-8) * 1.15741d0 * 7.08d0 * 1000000.d0 * 1.d0 * ShoeMudDensity / &
  103. (ShoeMudViscosity * LOG(10000.d0))
  104. !write(*,*) 'lost parameters 1' , ShoeMudPressure , FormationLostPressure
  105. Qlost = MAX( (ShoeLostCoef * (ShoeMudPressure - (FormationLostPressure/2.0))) , 0.d0 )
  106. if (Qlost > 0.0) then
  107. ShoeLost= .true.
  108. else
  109. ShoeLost= .false.
  110. endif
  111. !write(*,*) 'Qlost=' , Qlost, ShoeMudPressure, FormationLostPressure
  112. call Activate_UndergroundBlowout()
  113. do imud= 1, Ann_Mud_Forehead_X%Length()
  114. IF ( ShoeLost .and. Shoe%ShoeDepth < Ann_Mud_Backhead_X%Array(imud) .and. Shoe%ShoeDepth >= Ann_Mud_Forehead_X%Array(imud) &
  115. .and. Ann_MudOrKick%Array(imud) == 0 .and. WellHeadIsOpen == .FALSE. ) then
  116. Kickexpansion_DueToMudLost= .true.
  117. write(*,*) 'Kickexpansion_DueToMudLost'
  118. EXIT
  119. ENDIF
  120. enddo
  121. endif
  122. if (UndergroundBlowout == .false.) ShoeLost= .false.
  123. end subroutine ShoeLostSub