Simulation Core
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

219 rindas
9.1 KiB

  1. subroutine Kick_Influx ! is called in subroutine CirculationCodeSelect
  2. Use GeoElements_FluidModule
  3. USE CMudPropertiesVariables
  4. USE MudSystemVARIABLES
  5. use SimulationVariables !@@@
  6. use SimulationVariables
  7. use SimulationVariables !@
  8. !use CTanks
  9. ! !@use ConfigurationVariables, TripTankVolume2 => data%Equipments%DrillingWatch%TripTankVolume, TripTankDensity2 => TripTankDensity
  10. USE sROP_Other_Variables
  11. USE sROP_Variables
  12. use KickVARIABLESModule
  13. implicit none
  14. !===========================================================WELL============================================================
  15. !===========================================================WELL============================================================
  16. !write(*,*) 'Kick Influx'
  17. !=================== Bottom Hole Kick Influx ENTRANCE(due to Kick) ===================
  18. data%State%MudSystem%Kick_Density= 2
  19. data%State%MudSystem%NewInflux_Density= data%State%MudSystem%Kick_Density
  20. if ( data%State%MudSystem%NewInfluxElementCreated==0 ) then ! new kick is pumped- (it is set to zero in sheykh subroutine after a new kick influx)
  21. call data%State%MudSystem%Op_Density%AddToFirst (data%State%MudSystem%NewInflux_Density)
  22. call data%State%MudSystem%Op_MudDischarged_Volume%AddToFirst (0.0d0)
  23. call data%State%MudSystem%Op_Mud_Forehead_X%AddToFirst (data%State%MudSystem%Xstart_OpSection(1))
  24. call data%State%MudSystem%Op_Mud_Forehead_section%AddToFirst (1)
  25. call data%State%MudSystem%Op_Mud_Backhead_X%AddToFirst (data%State%MudSystem%Xstart_OpSection(1))
  26. call data%State%MudSystem%Op_Mud_Backhead_section%AddToFirst (1)
  27. call data%State%MudSystem%Op_RemainedVolume_in_LastSection%AddToFirst (0.0d0)
  28. call data%State%MudSystem%Op_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0)
  29. call data%State%MudSystem%Op_MudOrKick%AddToFirst (data%State%MudSystem%NewInfluxNumber) ! KickNumber= NewInfluxNumber
  30. data%State%MudSystem%NewInfluxElementCreated= 1
  31. endif
  32. data%State%MudSystem%Op_MudDischarged_Volume%Array(1)= data%State%MudSystem%Op_MudDischarged_Volume%Array(1)+ ((KickVARIABLES%GasKickPumpFlowRate/60.0d0)*data%State%MudSystem%DeltaT_Mudline) !(gal) due to KickFlux
  33. !write(*,*) 'kick volume ok=' , Op_MudDischarged_Volume%Array(1)
  34. end subroutine Kick_Influx
  35. subroutine Instructor_CirculationMud_Edit ! is called in subroutine CirculationCodeSelect
  36. use KickVARIABLESModule
  37. USE MudSystemVARIABLES
  38. use SimulationVariables !@@@
  39. USE TD_DrillStemComponents
  40. Use CUnityInputs
  41. Use CUnityOutputs
  42. use OperationScenariosModule
  43. use UTUBEVARSModule
  44. use sROP_Variables
  45. use sROP_Other_Variables
  46. use CDownHoleVariables
  47. implicit none
  48. if ( data%Equipments%DownHole%AnnDrillMud == .true. .and. (data%State%ROP_Bit%RateOfPenetration>0. .and. data%State%MudSystem%DeltaVolumeOp>0.0) ) then
  49. do imud= 1, data%State%MudSystem%Ann_Density%Length()
  50. if ( data%State%MudSystem%Ann_MudOrKick%Array(imud) == 0 ) then
  51. data%State%MudSystem%Ann_Density%Array(imud)= (data%State%MudSystem%St_Density%Last() * data%State%MudSystem%AnnulusFlowRate + 141.4296E-4*data%State%ROP_Bit%RateOfPenetration*data%State%ROP_Spec%DiameterOfBit**2)/(data%State%MudSystem%AnnulusFlowRate+6.7995E-4*data%State%ROP_Bit%RateOfPenetration*data%State%ROP_Spec%DiameterOfBit**2)
  52. data%State%MudSystem%Ann_CuttingMud%Array(imud)= 1
  53. endif
  54. enddo
  55. endif
  56. if ( data%Equipments%DownHole%AnnCirculateMud == .true. ) then
  57. do imud= 1, data%State%MudSystem%Ann_Density%Length()
  58. if ( data%State%MudSystem%Ann_MudOrKick%Array(imud) == 0 ) then
  59. data%State%MudSystem%Ann_Density%Array(imud)= data%State%MudSystem%ActiveTankDensity
  60. data%State%MudSystem%Ann_CuttingMud%Array(imud)= 0
  61. endif
  62. enddo
  63. do imud= 1, data%State%MudSystem%St_Density%Length()
  64. data%State%MudSystem%St_Density%Array(imud)= data%State%MudSystem%ActiveTankDensity
  65. enddo
  66. endif
  67. end subroutine Instructor_CirculationMud_Edit
  68. subroutine ShoeLostSub ! is called in subroutine CirculationCodeSelect
  69. use KickVARIABLESModule
  70. USE MudSystemVARIABLES
  71. use SimulationVariables !@@@
  72. USE TD_DrillStemComponents
  73. Use CUnityInputs
  74. Use CUnityOutputs
  75. use OperationScenariosModule
  76. use UTUBEVARSModule
  77. use sROP_Variables
  78. use sROP_Other_Variables
  79. use CDownHoleVariables
  80. use CShoeVariables
  81. use PressureDisplayVARIABLESModule
  82. use CWarnings
  83. implicit none
  84. data%State%MudSystem%ShoeLost= .false.
  85. data%State%MudSystem%Kickexpansion_DueToMudLost= .false.
  86. data%State%MudSystem%ShoeMudPressure= data%State%PressureDisplay%PressureGauges(5)
  87. data%State%MudSystem%UGBOSuccessionCounter = data%State%MudSystem%UGBOSuccessionCounter + 1
  88. !write(*,*) 'check point 1'
  89. if (data%Configuration%Shoe%InactiveFracture == .FALSE. .AND. ((data%State%MudSystem%ShoeMudPressure >= data%State%MudSystem%FormationLostPressure) .or. data%State%MudSystem%ShoeFractured )) then
  90. !write(*,*) 'check point 2 ,UGBOSuccessionCounter' , UGBOSuccessionCounter
  91. ! if ShoeFractured changed to true , then time counter is not needed more
  92. if ( data%State%MudSystem%UGBOSuccessionCounter /= data%State%MudSystem%UGBOSuccessionCounterOld+1 .and. data%State%MudSystem%ShoeFractured==.false. ) then
  93. data%State%MudSystem%UGBOSuccessionCounter = 0 ! also in starup
  94. data%State%MudSystem%UGBOSuccessionCounterOld = 0 ! also in starup
  95. return
  96. else
  97. data%State%MudSystem%UGBOSuccessionCounterOld= data%State%MudSystem%UGBOSuccessionCounter
  98. endif
  99. if ( data%State%MudSystem%UGBOSuccessionCounter < 10 .and. data%State%MudSystem%ShoeFractured==.false.) then
  100. return
  101. endif
  102. !write(*,*) 'check point 3 ,UGBOSuccessionCounter' , UGBOSuccessionCounter
  103. data%State%MudSystem%ShoeFractured= .true.
  104. data%State%MudSystem%ShoeMudViscosity= MAX(data%State%MudSystem%ShoeMudViscosity, 12.d0)
  105. !write(*,*) 'ShoeMudDensity , ShoeMudViscosity' , ShoeMudDensity , ShoeMudViscosity
  106. data%State%MudSystem%ShoeLostCoef = 10.**(-8) * 1.15741d0 * 7.08d0 * 1000000.d0 * 1.d0 * data%State%MudSystem%ShoeMudDensity / &
  107. (data%State%MudSystem%ShoeMudViscosity * LOG(10000.d0))
  108. !write(*,*) 'lost parameters 1' , ShoeMudPressure , FormationLostPressure
  109. data%State%MudSystem%Qlost = MAX( (data%State%MudSystem%ShoeLostCoef * (data%State%MudSystem%ShoeMudPressure - (data%State%MudSystem%FormationLostPressure/2.0))) , 0.d0 )
  110. if (data%State%MudSystem%Qlost > 0.0) then
  111. data%State%MudSystem%ShoeLost= .true.
  112. else
  113. data%State%MudSystem%ShoeLost= .false.
  114. endif
  115. !write(*,*) 'Qlost=' , Qlost, ShoeMudPressure, FormationLostPressure
  116. call Activate_UndergroundBlowout()
  117. do imud= 1, data%State%MudSystem%Ann_Mud_Forehead_X%Length()
  118. IF ( data%State%MudSystem%ShoeLost .and. data%Configuration%Shoe%ShoeDepth < data%State%MudSystem%Ann_Mud_Backhead_X%Array(imud) .and. data%Configuration%Shoe%ShoeDepth >= data%State%MudSystem%Ann_Mud_Forehead_X%Array(imud) &
  119. .and. data%State%MudSystem%Ann_MudOrKick%Array(imud) == 0 .and. data%State%MudSystem%WellHeadIsOpen == .FALSE. ) then
  120. data%State%MudSystem%Kickexpansion_DueToMudLost= .true.
  121. write(*,*) 'Kickexpansion_DueToMudLost'
  122. EXIT
  123. ENDIF
  124. enddo
  125. endif
  126. if (data%Warnings%UndergroundBlowout == .false.) data%State%MudSystem%ShoeLost= .false.
  127. end subroutine ShoeLostSub