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.9 KiB

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