Simulation Core
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 
 

337 строки
19 KiB

  1. SUBROUTINE PressureAnnAndOHDistribution
  2. !! Record of revisions
  3. !! Date Programmer Discription of change
  4. !! ------ ------------ -----------------------
  5. !! 1396/07/30 Sheikh Original code
  6. !!
  7. USE FricPressDropVars
  8. USE MudSystemVARIABLES
  9. USE PressureDisplayVARIABLES
  10. USE GeoElements_FluidModule
  11. USE Fluid_Flow_Startup_Vars
  12. USE KickVariables
  13. USE CMudPropertiesVariables
  14. USE TD_WellGeometry
  15. USE CReservoirVariables
  16. use MudSystemModule
  17. USE CHOKEVARIABLES
  18. USE CChokeManifoldVariables
  19. USE VARIABLES
  20. USE CError
  21. USE , INTRINSIC :: IEEE_ARITHMETIC
  22. IMPLICIT NONE
  23. INTEGER :: i , j , k , l
  24. INTEGER :: ifric
  25. REAL :: Fraction
  26. KBOP = 0.0
  27. IF (WellHeadOpen .OR. NoGasPocket == 0) THEN !! (mud circulation is normal wellhead may be open or closed) OR (kick is in the well and well head is open)
  28. !!!!! Determining flow rate in each section
  29. i = AnnulusFirstEl
  30. j = OpenholeFirstEl - 1
  31. !!!!!!!!!!!!!!!!!!!!!!!!! flowrates due to external sources like pump and tripping
  32. !WRITE (*,*) 'MudSystem%StringFlowRate', MudSystem%StringFlowRate
  33. FlowEl(AnnulusFirstEl : OpenholeFirstEl - 1)%FlowRate = (ClingingFactor * FlowEl(AnnulusFirstEl : OpenholeFirstEl - 1)%Area + FlowEl(StringFirstEl)%Area) * DrillStringSpeed * ConvMintoSec * Convft3toUSgal ! flowrate in annulus due to tripping
  34. FlowEl(AnnulusFirstEl : OpenholeFirstEl - 1)%FlowRate = FlowEl(AnnulusFirstEl : OpenholeFirstEl - 1)%FlowRate + REAL(MudSystem%MudVolume_InjectedToBH) * ConvMintoSec / dt ! flowrate in annulus due to pump
  35. !WRITE (*,*) 'Drillstring speed (ft/s)' , FlowEl(j)%FlowRate
  36. !IF (NoWellToChokeEl > 0) THEN ! flowrate in choke line
  37. ! FlowEl(NoHorizontalEl + NoStringEl + NoAnnulusEl + 1 : NoHorizontalEl + NoStringEl + NoAnnulusEl + NoWellToChokeEl)%FlowRate = MudSystem%AnnulusFlowRate + (DeltaVolumePipe * ConvMinToSec / dt)
  38. !END IF
  39. IF (MudSystem%ShoeFractured) THEN ! reduction of flowrate due to formation fracture and lost circulation
  40. !WRITE (*,*) ' SHoe fractured', PressureGauges(5), FlowEl(ShoeFlowElNo)%FlowRate
  41. IF (ShoeFlowElNo > AnnulusLastEl) THEN ! shoe is in openhole
  42. FlowEl(ShoeFlowElNo : NumbEl)%FlowRate = - MudSystem%Qlost
  43. FlowEl(AnnulusFirstEl : OpenholeFirstEl - 1)%FlowRate = FlowEl(AnnulusFirstEl : OpenholeFirstEl - 1)%FlowRate - MudSystem%Qlost
  44. ELSE ! shoe is in annulus
  45. FlowEl(ShoeFlowElNo : OpenholeFirstEl - 1)%FlowRate = FlowEl(ShoeFlowElNo : OpenholeFirstEl - 1)%FlowRate - MudSystem%Qlost
  46. END IF
  47. END IF
  48. !!!!!!!!!!!!!!!!!!!!!!!!!
  49. !!!!!!!!!!!!!!!!!!!!!!!!! initial guess flowrates for opening BOP or choke line
  50. IF (WellHeadWasOpen == .FALSE. .AND. NoGasPocket > 0 .AND. KickIteration == 1) THEN
  51. IF (ChokeKroneckerDelta == 1) THEN ! flow on choke line
  52. IF (TotalOpenChokeArea < 0.01 * Choke%ChokeAreaFullyOpen) THEN
  53. WRITE (*,*) 'density , TotalOpenChokeArea' , DownHole%Density, TotalOpenChokeArea
  54. TotalOpenChokeArea = 0.01 * Choke%ChokeAreaFullyOpen
  55. END IF
  56. Kchoke = (ChokeDensity / ((2.0 * 89158.0) * (0.26 * 0.61 * TotalOpenChokeArea)**2)) * 4.0 ! *4.d0: seyyed gofte
  57. GasPocketFlowInduced%Array(:) = MIN((0.6 / NoGasPocket * SQRT(PressureGauges(2) / Kchoke)) , (0.05 * GasPocketNewVol%Array(:) * ConvFt3toUSgal / 60 / dt))
  58. WRITE (*,*) ' PressureGauges(2) , Kchoke' , PressureGauges(2) , Kchoke
  59. WRITE (*,*) 'Initial guess after opening choke =', GasPocketFlowInduced%Array(1)
  60. WRITE (*,*) ' valve 49 ', Manifold%Valve(49)%Status
  61. WRITE (*,*) ' valve 47 ', Manifold%Valve(47)%Status
  62. WRITE (*,*) ' valve 26 ', Manifold%Valve(26)%Status
  63. WRITE (*,*) ' valve 30 ', Manifold%Valve(30)%Status
  64. WRITE (*,*) ' valve 34 ', Manifold%Valve(34)%Status
  65. WRITE (*,*) ' valve 63 ', Manifold%Valve(63)%Status
  66. WRITE (*,*) ' valve 28 ', Manifold%Valve(28)%Status
  67. WRITE (*,*) ' valve 33 ', Manifold%Valve(33)%Status
  68. WRITE (*,*) ' valve 62 ', Manifold%Valve(62)%Status
  69. WRITE (*,*) ' valve 36 ', Manifold%Valve(36)%Status
  70. WRITE (*,*) ' valve 38 ', Manifold%Valve(38)%Status
  71. ELSE ! flow through bell nipple
  72. k = NoHorizontalEl + NoStringEl + NoAnnulusEl
  73. KBOP = FlowEl(AnnulusLastEl)%Density / ((2.0 * 89158.0) * (0.26 * 0.61 * ShearRam%MinimumOpenArea_InBOP)**2)
  74. GasPocketFlowInduced%Array(:) = MIN((0.1 / NoGasPocket * SQRT(PressureGauges(6) / KBOP)) , (0.05 * GasPocketNewVol%Array(:) * ConvFt3toUSgal / 60 / dt))
  75. WRITE (*,*) 'PressureGauges(6), KBOP', PressureGauges(6), KBOP
  76. WRITE (*,*) 'Initial guess after opening BOP =', GasPocketFlowInduced%Array(1)
  77. END IF
  78. END IF
  79. !!!!!!!!!!!!!!!!!!!!!!!!!
  80. !!!!!!!!!!!!!!!!!!!!!!!!! flowrates due to expansion of gas pockets or kick influx
  81. !i = AnnulusFirstEl
  82. !j = OpenholeFirstEl - 1
  83. IF (NoGasPocket > 0) THEN
  84. DO l = 1 , NoGasPocket !GasPocketFlowEl
  85. k = GasPocketFlowEl(l , 1)
  86. !WRITE (*,*) 'GasPocketFlowEl(l , 1)', l, k, j
  87. IF (k == 0) CALL ERRORSTOP('GasPocketFlowEl(l , 1) == 0', l)
  88. IF (k >= OpenholeFirstEl) THEN ! gas pocket is in open hole only
  89. FlowEl(k : NumbEl)%FlowRate = FlowEl(k : NumbEl)%FlowRate + GasPocketFlowInduced%Array(l) ! openhole elements above pocket
  90. FlowEl(AnnulusFirstEl : OpenholeFirstEl - 1)%FlowRate = FlowEl(AnnulusFirstEl : OpenholeFirstEl - 1)%FlowRate + GasPocketFlowInduced%Array(l) ! annulus and choke line elements
  91. ELSE IF (k < OpenholeFirstEl) THEN ! gas pocket is in annulus ond/or choke line only
  92. FlowEl(k : OpenholeFirstEl - 1)%FlowRate = FlowEl(k : OpenholeFirstEl - 1)%FlowRate + GasPocketFlowInduced%Array(l) ! annulus or choke line elements above pocket
  93. END IF
  94. END DO
  95. END IF
  96. !IF (ChokeKroneckerDelta == 1 .AND. ABS(FlowEl(i + NoAnnulusEl)%FlowRate / 600.0 - Ann_Saved_MudDischarged_Volume_Final) > 0.05) THEN
  97. ! WRITE (*,*) 'Difference between flowrates', FlowEl(i + NoAnnulusEl + 1)%FlowRate / 600.0, Ann_Saved_MudDischarged_Volume_Final
  98. !END IF
  99. !!!!!!!!!!!!!!!!!!!!!!!!!
  100. !!!!! END - Determining flow rate in each section
  101. !!!!!!!!!!!!!!!!!!!!!!!!! effect of surge and swab on frictional pressure drop direction
  102. DO l = AnnulusFirstEl , OpenholeFirstEl - 1
  103. IF (FlowEl(l)%FlowRate < 0.0) THEN
  104. FlowEl(l)%FrictionDirection = -1
  105. IF (FlowEl(l)%FlowRate > -1.0 * PressFlowrateTolerance .AND. ALLOCATED(GasPocketWeight%Array)) FlowEl(l)%FlowRate = - PressFlowrateTolerance
  106. ELSE
  107. FlowEl(l)%FrictionDirection = 1
  108. IF (FlowEl(l)%FlowRate < PressFlowrateTolerance .AND. ALLOCATED(GasPocketWeight%Array)) FlowEl(l)%FlowRate = PressFlowrateTolerance
  109. END IF
  110. END DO
  111. !!!!!!!!!!!!!!!!!!!!!!!!!
  112. !!!!!!!!!!!!!!!!!!!!!!!!! Calculating Back Pressure, in well to pit path back pressure = 0
  113. ! in well to choke manifold path back pressure is equal to pressure before choke not casing pressure
  114. IF (ChokeKroneckerDelta == 1) THEN
  115. IF (FlowEl(OpenholeFirstEl - 1)%FlowRate < 0.0) THEN
  116. WRITE (*,*) ' Negative choke flowrate'
  117. FlowEl(OpenholeFirstEl - 1)%FlowRate = MAX((REAL(MudSystem%MudVolume_InjectedToBH) * ConvMintoSec / dt) , 10.0)
  118. END IF
  119. !Kchoke = ChokeDensity / ((2. * 89158.0) * (0.26 * 0.61 * TotalOpenChokeArea)**2)
  120. MudSystem%deltaPchoke = (Kchoke * FlowEl(OpenholeFirstEl - 1)%FlowRate * ABS(FlowEl(OpenholeFirstEl - 1)%FlowRate)) * 1.d0
  121. !WRITE (*,*) '**deltaPchoke , Kchoke, choke flowrate' , deltaPchoke , Kchoke, FlowEl(i)%FlowRate
  122. !WRITE (*,*) '**TotalOpenChokeArea , Total Open Choke Area Percent' , TotalOpenChokeArea , TotalOpenChokeArea / 4.0 * ChokeAreaFullyOpen
  123. IF (MudSystem%deltaPchoke < 0.d0) MudSystem%deltaPchoke = 0.d0
  124. BackPressure = REAL(MudSystem%deltaPchoke)
  125. !WRITE (*,*) ' Choke inlet FlowRate, Density, pressure' , FlowEl(j)%FlowRate, FlowEl(j)%Density, FlowEl(j)%StartPress
  126. !WRITE (*,*) ' Choke outlet Density' , FlowEl(i)%Density
  127. !WRITE (*,*) ' deltaPchoke , choke flowrate' , deltaPchoke , FlowEl(i)%FlowRate
  128. !WRITE (*,*) 'Total Open Choke Area Percent' , TotalOpenChokeArea / 4.0 * ChokeAreaFullyOpen
  129. ELSE
  130. BackPressure = 0.0
  131. END IF
  132. IF (IEEE_IS_NaN(BackPressure)) CALL ErrorStop('NaN in calculating back pressure' , FlowEl(j)%FlowRate)
  133. !write(*,*) 'BackPressure=' , BackPressure
  134. !!!!!!!!!!!!!!!!!!!!!!!!! when flow passes through choke manifold, solution process may be unstable
  135. IF (ChokeKroneckerDelta == 1) THEN ! thus we should stabilize solution
  136. IF (TotalOpenChokeArea > 0.5 * Choke%ChokeAreaFullyOpen) THEN
  137. KickCorrectionUnderRelaxation = 0.6
  138. ELSE IF (TotalOpenChokeArea > 0.1 * Choke%ChokeAreaFullyOpen) THEN
  139. KickCorrectionUnderRelaxation = 0.5
  140. ELSE ! TotalOpenChokeArea < 0.1 * ChokeAreaFullyOpen
  141. KickCorrectionUnderRelaxation = 0.4
  142. END IF
  143. ELSE
  144. KickCorrectionUnderRelaxation = 0.6
  145. END IF
  146. !!!!!!!!!!!!!!!!!!!!!!!!!
  147. !!!!!!!!!!!!!!!!!!!!!!!!! calculating frictional pressure drop in annulus, chooke line and open hole elements
  148. DO ifric = AnnulusFirstEl , NumbEl
  149. CALL FricPressDrop(ifric)
  150. !WRITE (*,*) ' element No, FlowRate , Density, FricPressLoss', ifric, FlowEl(ifric)%FlowRate, FlowEl(ifric)%Density, FlowEl(ifric)%FricPressLoss
  151. IF (IEEE_IS_NaN(FlowEl(ifric)%FricPressLoss)) THEN
  152. WRITE (*,*) 'H, S, A, Ch, O', NoHorizontalEl , NoStringEl , NoAnnulusEl , NoWellToChokeEl , NoOpenHoleEl
  153. WRITE (*,*) 'Ann/Op start, end, density, Q, mu, Type' , FlowEl(ifric)%StartX, FlowEl(ifric)%EndX, FlowEl(ifric)%Density, FlowEl(ifric)%FlowRate, FlowEl(ifric)%mueff, FlowEl(ifric)%MaterialType
  154. CALL ErrorStop('NaN in calculating pressure drop' , ifric)
  155. END IF
  156. END DO
  157. !IF (ChokeKroneckerDelta == 1) THEN
  158. !WRITE (*,*) ' velocity and flowrate', FlowEl(i)%vel, FlowEl(i)%flowrate
  159. !WRITE (*,*) ' Theta600, Theta300', FlowEl(i)%Theta600 , FlowEl(i)%Theta300
  160. !WRITE (*,*) ' kIndex , nIndex', FlowEl(i)%kIndex, FlowEl(i)%nIndex
  161. !WRITE (*,*) ' last el. mueff, gen. Rey.', i, FlowEl(i)%mueff, FlowEl(i)%GenRe
  162. !END IF
  163. !!!!!!!!!!!!!!!!!!!!!!!!! Pressure distribution in annulus
  164. j = OpenholeFirstEl - 1
  165. FlowEl(OpenholeFirstEl - 1)%EndPress = BackPressure
  166. FlowEl(OpenholeFirstEl - 1)%StartPress = FlowEl(OpenholeFirstEl - 1)%EndPress + FlowEl(OpenholeFirstEl - 1)%FricPressLoss + FlowEl(OpenholeFirstEl - 1)%StaticPressDiff
  167. !write(*,*) 'FlowEl(j)%StartPress=' ,j, FlowEl(j)%StartPress
  168. !write(*,*) 'FlowEl(j)%Length=' ,j, FlowEl(j)%Length, FlowEl(j)%EndX
  169. !write(*,*) 'FlowEl(i)%dPdLFric=' ,i, FlowEl(i)%dPdLFric
  170. DO l = OpenholeFirstEl - 2 , AnnulusFirstEl , -1
  171. !WRITE (*,*) '123'
  172. FlowEl(l)%EndPress = FlowEl(l + 1)%StartPress
  173. FlowEl(l)%StartPress = FlowEl(l)%EndPress + FlowEl(l)%FricPressLoss + FlowEl(l)%StaticPressDiff
  174. !WRITE(*,*) "ANNULUS: bottom , top Pressure", l , FlowEl(l)%StartPress , FlowEl(l)%EndPress , FlowEl(l)%fricPressLoss
  175. !WRITE(*,*) "ANNULUS: Start , End X", FlowEl(l)%StartX , FlowEl(l)%EndX
  176. !write(*,*) 'FlowEl(i)%StartPress=' ,i, FlowEl(i)%StartPress
  177. !WRITE (*,*) ' FlowEl(i)%GenRe, FlowEl(i)%ReCritLam ' , FlowEl(i)%GenRe , FlowEl(i)%ReCritLam
  178. END DO
  179. !!!!!!!!!!!!!!!!! Pressure distribution in Open Hole
  180. FlowEl(NumbEl)%EndPress = FlowEl(AnnulusFirstEl)%StartPress
  181. FlowEl(NumbEl)%StartPress = FlowEl(NumbEl)%EndPress + FlowEl(NumbEl)%FricPressLoss + FlowEl(NumbEl)%StaticPressDiff
  182. !WRITE (*,*) 'op top and op down' , FlowEl(NumbEl)%EndPress, FlowEl(j + 1)%StartPress
  183. !write(*,*) 'FlowEl(NumbEl)%dPdLFric=' , FlowEl(NumbEl)%dPdLFric
  184. !write(*,*) 'FlowEl(NumbEl)%dPdLGrav=' , FlowEl(NumbEl)%dPdLGrav
  185. DO l = NumbEl - 1 , OpenholeFirstEl , -1
  186. !WRITE(*,*) ' ope'
  187. FlowEl(l)%EndPress = FlowEl(l + 1)%StartPress
  188. !IF (FlowEl(i)%FlowRate < 0.0d0) THEN
  189. ! FlowEl(i)%StartPress = FlowEl(i)%EndPress - FlowEl(i)%FricPressLoss + FlowEl(i)%StaticPressDiff
  190. !ELSE
  191. FlowEl(l)%StartPress = FlowEl(l)%EndPress + FlowEl(l)%FricPressLoss + FlowEl(l)%StaticPressDiff
  192. !WRITE (*,*) ' Length, static, frictional open' , FlowEl(i)%Length, FlowEl(i)%StaticPressDiff, FlowEl(i)%FricPressLoss
  193. !END IF
  194. END DO
  195. ELSE ! wellhead is closed and kick is in the well
  196. !WRITE (*,*) ' well head is closed'
  197. k = GasPocketFlowEl(NoGasPocket , 1)
  198. !WRITE (*,*) 'k, Pocket Press', k, GasPocketOldPress%Array(NoGasPocket) - StandardPress
  199. i = AnnulusFirstEl
  200. j = OpenholeFirstEl - 1
  201. FlowEl(k)%StartPress = GasPocketOldPress%Array(NoGasPocket) - StandardPress
  202. FlowEl(k)%EndPress = GasPocketOldPress%Array(NoGasPocket) - StandardPress
  203. IF (k > OpenholeFirstEl - 1) THEN ! Top pocket StartX is in Open hole
  204. !WRITE (*,*) 'here 1'
  205. DO l = k - 1 , OpenholeFirstEl , -1 ! below elements in openhole
  206. !WRITE (*,*) 'here 1-1'
  207. FlowEl(l)%EndPress = FlowEl(l + 1)%StartPress
  208. FlowEl(l)%StartPress = FlowEl(l)%EndPress + FlowEl(l)%StaticPressDiff
  209. END DO
  210. DO l = k + 1 , NumbEl ! Above elements in openhole
  211. !WRITE (*,*) 'here 1-2'
  212. FlowEl(l)%StartPress = FlowEl(l - 1)%EndPress
  213. FlowEl(l)%EndPress = FlowEl(l)%StartPress - FlowEl(l)%StaticPressDiff
  214. END DO
  215. FlowEl(AnnulusFirstEl)%StartPress = FlowEl(NumbEl)%EndPress
  216. FlowEl(AnnulusFirstEl)%EndPress = FlowEl(AnnulusFirstEl)%StartPress - FlowEl(AnnulusFirstEl)%StaticPressDiff
  217. DO l = AnnulusFirstEl + 1 , OpenholeFirstEl - 1
  218. FlowEl(l)%StartPress = FlowEl(l - 1)%EndPress
  219. FlowEl(l)%EndPress = FlowEl(l)%StartPress - FlowEl(l)%StaticPressDiff
  220. END DO
  221. ELSE ! Top pocket StartX is in annulus or choke line
  222. DO l = k - 1 , AnnulusFirstEl , -1 ! below elements in annnulus
  223. FlowEl(l)%EndPress = FlowEl(l + 1)%StartPress
  224. FlowEl(l)%StartPress = FlowEl(l)%EndPress + FlowEl(l)%StaticPressDiff
  225. END DO
  226. DO l = k + 1 , OpenholeFirstEl - 1 ! Above elements in annulus
  227. FlowEl(l)%StartPress = FlowEl(l - 1)%EndPress
  228. FlowEl(l)%EndPress = FlowEl(l)%StartPress - FlowEl(l)%StaticPressDiff
  229. END DO
  230. FlowEl(NumbEl)%EndPress = FlowEl(AnnulusFirstEl)%StartPress
  231. FlowEl(NumbEl)%StartPress = FlowEl(NumbEl)%EndPress + FlowEl(NumbEl)%StaticPressDiff
  232. DO l = NumbEl - 1 , OpenholeFirstEl , -1
  233. FlowEl(l)%EndPress = FlowEl(l + 1)%StartPress
  234. FlowEl(l)%StartPress = FlowEl(l)%EndPress + FlowEl(l)%StaticPressDiff
  235. END DO
  236. END IF
  237. !
  238. ! !WRITE (*,*) ' first annulus bottom pressure ' , FlowEl(NoHorizontalEl + NoStringEl + 1)%StartPress
  239. ! !WRITE (*,*) ' last OpenHole bottom pressure' , FlowEl(NumbEl)%StartPress
  240. ! !WRITE (*,*) ' Gas Pocket pressure' , GasPocket%NewPress
  241. END IF
  242. !!!!!!!!!!!!!!!!!!!!!! checking pressure for preventing NaN in pressures
  243. DO l = OpenholeFirstEl - 1 , AnnulusFirstEl , -1 ! annulus or choke elements
  244. !WRITE (*,*) 'start, end' , FlowEl(i)%StartX, FlowEl(i)%EndX
  245. IF (IEEE_IS_NaN(FlowEl(l)%EndPress)) THEN
  246. WRITE (*,*) 'H, S, A, Ch, O', NoHorizontalEl , NoStringEl , NoAnnulusEl , NoWellToChokeEl , NoOpenHoleEl
  247. WRITE (*,*) 'Ann/Ch start, end, density, Q, mu' , FlowEl(l)%StartX, FlowEl(l)%EndX, FlowEl(l)%Density, FlowEl(l)%FlowRate, FlowEl(l)%mueff, FlowEl(l)%MaterialType
  248. CALL ERRORSTOP('NaN in EndPress', l)
  249. END IF
  250. END DO
  251. DO l = NumbEl , OpenholeFirstEl - 1 , -1 ! op elements
  252. !WRITE (*,*) 'start, end' , FlowEl(i)%StartX, FlowEl(i)%EndX
  253. IF (IEEE_IS_NaN(FlowEl(l)%EndPress)) THEN
  254. WRITE (*,*) 'H, S, A, Ch, O', NoHorizontalEl , NoStringEl , NoAnnulusEl , NoWellToChokeEl , NoOpenHoleEl
  255. WRITE (*,*) 'Op start, end, density, Q, mu' , FlowEl(l)%StartX, FlowEl(l)%EndX, FlowEl(l)%Density, FlowEl(l)%FlowRate, FlowEl(l)%mueff, FlowEl(l)%MaterialType
  256. CALL ERRORSTOP('NaN in EndPress', l)
  257. END IF
  258. END DO
  259. !!!!!!!!!!!!!!!!!!!!!!
  260. !!!!!!!!!!!!!!!!!!!!!!
  261. BottomHolePress = FlowEl(OpenholeFirstEl)%StartPress
  262. !DO i = 1 , NoGasPocket
  263. ! WRITE (*,*) ' Pocket, Pressure, Vol, Flow Induced, FlowElPress', i, REAL(GasPocketNewPress%Array(i)), REAL(GasPocketNewVol%Array(i)), GasPocketFlowInduced%Array(i), FlowEl(GasPocketFlowEl(i , 1))%StartPress
  264. !END DO
  265. !WRITE (*,*) ' BottomHolePress =' , BottomHolePress
  266. !!!!!!!!!!!!!!!!!!!!!!
  267. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  268. !IF (ChokeKroneckerDelta == 1) THEN
  269. ! WRITE (*,*) ' ChokeLine flowrate' , FlowEl(NoHorizontalEl + NoStringEl + NoAnnulusEl + NoWellToChokeEl)%FlowRate , MudSystem%StringFlowRate
  270. ! !i = NoHorizontalEl + NoStringEl + NoAnnulusEl
  271. ! !j = NoHorizontalEl + NoStringEl + NoAnnulusEl + NoWellToChokeEl
  272. ! !WRITE (*,*) ' Well Outlet and Chokeline Outlet Pressure' , FlowEl(i)%EndPress, FlowEl(j)%EndPress
  273. !END IF
  274. !IF (GasPocket%ElementNo == 0) THEN
  275. ! KickUnknownVector(2) = BottomHolePress
  276. !!ELSE
  277. !! KickUnknownVector(2) = FlowEl(GasPocket%ElementNo)%StartPress
  278. !END IF
  279. !IF (WellHeadOpen)
  280. ! GasPocket%NewPress = KickUnknownVector(2)
  281. !END IF
  282. !WRITE (*,*) 'Ann End'
  283. END SUBROUTINE