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
9.1 KiB

  1. subroutine FillingWell_By_BellNipple ! is called in subroutine CirculationCodeSelect
  2. ! this subroutine is for lines: 1) BellNippleToWell-NonFullWell : MUD(8)%Q
  3. ! 2) PumpsToWell_KillLine : MUD(10)%Q
  4. Use GeoElements_FluidModule
  5. USE CMudPropertiesVariables
  6. USE MudSystemVARIABLES
  7. USE Pumps_VARIABLES
  8. use CDrillWatchVariables
  9. !use CTanksVariables, TripTankVolume2 => DrillingWatch%TripTankVolume, TripTankDensity2 => TripTankDensity
  10. USE sROP_Other_Variables
  11. USE sROP_Variables
  12. Use KickVariables
  13. implicit none
  14. real(8) deltaV,Xposition,FillingDensity
  15. integer kloc,SectionPosition
  16. ! Well Is Not Full
  17. if (MudSystem%Ann_MudOrKick%Last() == 104) then ! Last Element is air we must observe: Ann_Mud_Forehead_X%Last()=0.0
  18. write(*,*) 'FillingWell_By_BellNipple-Last Element is air'
  19. !write(*,*) '*Ann_Mud_Forehead_X%Last()=' , Ann_Mud_Forehead_X%Last()
  20. !write(*,*) '*Ann_MudOrKick%Last()=' , Ann_MudOrKick%Last()
  21. FillingDensity= MudSystem%BellNippleDensity
  22. !****************************
  23. if ( MudSystem%Ann_MudDischarged_Volume%Last() > (((MUD(8)%Q+MUD(10)%Q)/60.)*MudSystem%DeltaT_Mudline)) then ! air baghi mimune
  24. kloc= MudSystem%Ann_MudDischarged_Volume%Length()-1
  25. deltaV= ((MUD(8)%Q+MUD(10)%Q)/60.)*MudSystem%DeltaT_Mudline
  26. MudSystem%Ann_MudDischarged_Volume%Array(MudSystem%Ann_MudDischarged_Volume%Length())= MudSystem%Ann_MudDischarged_Volume%Array(MudSystem%Ann_MudDischarged_Volume%Length()) - deltaV
  27. !========================ANNULUS ENTRANCE====================
  28. if (ABS(MudSystem%Ann_Density%Array(kloc) - FillingDensity) >= MudSystem%DensityMixTol) then ! new mud is pumped
  29. call MudSystem%Ann_Density%AddTo (kloc, FillingDensity)
  30. call MudSystem%Ann_MudDischarged_Volume%AddTo (kloc, 0.0d0)
  31. call MudSystem%Ann_Mud_Forehead_X%AddTo (kloc, 0.0d0)
  32. call MudSystem%Ann_Mud_Forehead_section%AddTo (kloc, 1)
  33. call MudSystem%Ann_Mud_Backhead_X%AddTo (kloc, 0.0d0)
  34. call MudSystem%Ann_Mud_Backhead_section%AddTo (kloc, MudSystem%NoPipeSections)
  35. call MudSystem%Ann_RemainedVolume_in_LastSection%AddTo (kloc, 0.0d0)
  36. call MudSystem%Ann_EmptyVolume_inBackheadLocation%AddTo (kloc, 0.0d0)
  37. call MudSystem%Ann_MudOrKick%AddTo (kloc, 0)
  38. call MudSystem%Ann_CuttingMud%AddTo (kloc,0)
  39. !AnnulusSuctionDensity_Old= Hz_Density_Utube
  40. endif
  41. !========================ANNULUS====================
  42. MudSystem%Ann_MudDischarged_Volume%Array(kloc)= MudSystem%Ann_MudDischarged_Volume%Array(kloc)+ deltaV !(gal)
  43. else ! ( Ann_MudDischarged_Volume%Last() <= (((MUD(8)%Q+MUD(10)%Q)/60.)*DeltaT_Mudline)) then ! air baghi namune
  44. kloc= MudSystem%Ann_MudDischarged_Volume%Length()-1
  45. deltaV= MudSystem%Ann_MudDischarged_Volume%Last()
  46. if (ABS(MudSystem%Ann_Density%Array(kloc)-FillingDensity)< MudSystem%DensityMixTol .and. MudSystem%Ann_CuttingMud%Array(kloc)==0) then ! .OR. (Ann_MudDischarged_Volume%Array(kloc)< 42.) ) then ! 1-Pockets are Merged
  47. MudSystem%Ann_Density%Array(kloc)= (MudSystem%Ann_Density%Array(kloc)*MudSystem%Ann_MudDischarged_Volume%Array(kloc)+FillingDensity*deltaV)/(MudSystem%Ann_MudDischarged_Volume%Array(kloc)+deltaV)
  48. MudSystem%Ann_MudDischarged_Volume%Array(kloc)= MudSystem%Ann_MudDischarged_Volume%Array(kloc)+deltaV
  49. MudSystem%Ann_Mud_Forehead_X%Array(kloc)= MudSystem%Xend_PipeSection(MudSystem%NoPipeSections)
  50. MudSystem%Ann_Mud_Forehead_section%Array(kloc)= MudSystem%NoPipeSections
  51. !Ann_Mud_Backhead_X%Array(kloc)= no change
  52. !Ann_Mud_Backhead_section%Array(kloc)= no change
  53. MudSystem%Ann_RemainedVolume_in_LastSection%Array(kloc)= (0.0)
  54. MudSystem%Ann_EmptyVolume_inBackheadLocation%Array(kloc)= (0.0)
  55. call MudSystem%Ann_MudDischarged_Volume%Remove (kloc+1)
  56. call MudSystem%Ann_Mud_Backhead_X%Remove (kloc+1)
  57. call MudSystem%Ann_Mud_Backhead_section%Remove (kloc+1)
  58. call MudSystem%Ann_Mud_Forehead_X%Remove (kloc+1)
  59. call MudSystem%Ann_Mud_Forehead_section%Remove (kloc+1)
  60. call MudSystem%Ann_Density%Remove (kloc+1)
  61. call MudSystem%Ann_RemainedVolume_in_LastSection%Remove (kloc+1)
  62. call MudSystem%Ann_EmptyVolume_inBackheadLocation%Remove (kloc+1)
  63. call MudSystem%Ann_MudOrKick%Remove (kloc+1)
  64. call MudSystem%Ann_CuttingMud%Remove (kloc+1)
  65. else ! 2-Merging conditions are not meeted, so new pocket== air is replaced with filling mud
  66. MudSystem%Ann_Density%Array(kloc+1) =FillingDensity
  67. MudSystem%Ann_MudOrKick%Array(kloc+1)= 0
  68. endif
  69. endif
  70. ! end condition (Ann_MudOrKick%Last() == 104) ! Last Element is air
  71. !**********************************************************************************************************************************************************
  72. else ! (Ann_MudOrKick%Last() == 0) then ! Last Element is NOT air- so we must observe: Ann_Mud_Forehead_X%Last()/=0.0
  73. !write(*,*) 'FillingWell_By_BellNipple-Last Element is NOT air'
  74. !
  75. !write(*,*) '*Ann_Mud_Forehead_X%Last()=' , Ann_Mud_Forehead_X%Last()
  76. !write(*,*) '*Ann_MudOrKick%Last()=' , Ann_MudOrKick%Last()
  77. deltaV= ((MUD(8)%Q+MUD(10)%Q)/60.)*MudSystem%DeltaT_Mudline
  78. kloc= MudSystem%Ann_MudDischarged_Volume%Length()
  79. !========================ANNULUS ENTRANCE====================
  80. if (ABS(MudSystem%Ann_Density%Last() - FillingDensity) >= MudSystem%DensityMixTol .or. MudSystem%Ann_CuttingMud%Last()==1) then ! .OR. (Ann_MudDischarged_Volume%Array(kloc)>42.) ) then ! new mud is pumped
  81. Xposition= MudSystem%Ann_Mud_Forehead_X%Last()
  82. SectionPosition= MudSystem%Ann_Mud_Forehead_section%Last()
  83. call MudSystem%Ann_Density%Add (FillingDensity)
  84. call MudSystem%Ann_MudDischarged_Volume%Add (0.0d0)
  85. call MudSystem%Ann_Mud_Forehead_X%Add (Xposition)
  86. call MudSystem%Ann_Mud_Forehead_section%Add (SectionPosition)
  87. call MudSystem%Ann_Mud_Backhead_X%Add (Xposition)
  88. call MudSystem%Ann_Mud_Backhead_section%Add (SectionPosition)
  89. call MudSystem%Ann_RemainedVolume_in_LastSection%Add (0.0d0)
  90. call MudSystem%Ann_EmptyVolume_inBackheadLocation%Add (0.0d0)
  91. call MudSystem%Ann_MudOrKick%Add (0)
  92. call MudSystem%Ann_CuttingMud%Add (0)
  93. !AnnulusSuctionDensity_Old= Hz_Density_Utube
  94. !endif
  95. !========================ANNULUS====================
  96. MudSystem%Ann_MudDischarged_Volume%Array(MudSystem%Ann_MudDischarged_Volume%Length())= MudSystem%Ann_MudDischarged_Volume%Array(MudSystem%Ann_MudDischarged_Volume%Length())+ deltaV !(gal)
  97. else ! Merged with last Mud
  98. MudSystem%Ann_Density%Array(kloc)= (MudSystem%Ann_Density%Array(kloc)*MudSystem%Ann_MudDischarged_Volume%Array(kloc)+FillingDensity*deltaV)/(MudSystem%Ann_MudDischarged_Volume%Array(kloc)+deltaV)
  99. MudSystem%Ann_MudDischarged_Volume%Array(kloc)= MudSystem%Ann_MudDischarged_Volume%Array(kloc)+deltaV
  100. !Ann_Mud_Forehead_X%Array(kloc)= Xend_PipeSection(NoPipeSections)
  101. !Ann_Mud_Forehead_section%Array(kloc)= NoPipeSections
  102. !Ann_Mud_Backhead_X%Array(kloc)= no change
  103. !Ann_Mud_Backhead_section%Array(kloc)= no change
  104. MudSystem%Ann_RemainedVolume_in_LastSection%Array(kloc)= (0.0)
  105. MudSystem%Ann_EmptyVolume_inBackheadLocation%Array(kloc)= (0.0)
  106. endif
  107. endif
  108. end subroutine FillingWell_By_BellNipple