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
8.6 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 (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= BellNippleDensity
  22. !****************************
  23. if ( MudSystemDotAnn_MudDischarged_Volume%Last() > (((MUD(8)%Q+MUD(10)%Q)/60.)*DeltaT_Mudline)) then ! air baghi mimune
  24. kloc= MudSystemDotAnn_MudDischarged_Volume%Length()-1
  25. deltaV= ((MUD(8)%Q+MUD(10)%Q)/60.)*DeltaT_Mudline
  26. MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotAnn_MudDischarged_Volume%Length())= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotAnn_MudDischarged_Volume%Length()) - deltaV
  27. !========================ANNULUS ENTRANCE====================
  28. if (ABS(Ann_Density%Array(kloc) - FillingDensity) >= MudSystemDotDensityMixTol) then ! new mud is pumped
  29. call Ann_Density%AddTo (kloc, FillingDensity)
  30. call MudSystemDotAnn_MudDischarged_Volume%AddTo (kloc, 0.0d0)
  31. call Ann_Mud_Forehead_X%AddTo (kloc, 0.0d0)
  32. call Ann_Mud_Forehead_section%AddTo (kloc, 1)
  33. call Ann_Mud_Backhead_X%AddTo (kloc, 0.0d0)
  34. call Ann_Mud_Backhead_section%AddTo (kloc, MudSystemDotNoPipeSections)
  35. call Ann_RemainedVolume_in_LastSection%AddTo (kloc, 0.0d0)
  36. call Ann_EmptyVolume_inBackheadLocation%AddTo (kloc, 0.0d0)
  37. call Ann_MudOrKick%AddTo (kloc, 0)
  38. call Ann_CuttingMud%AddTo (kloc,0)
  39. !AnnulusSuctionDensity_Old= Hz_Density_Utube
  40. endif
  41. !========================ANNULUS====================
  42. MudSystemDotAnn_MudDischarged_Volume%Array(kloc)= MudSystemDotAnn_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= MudSystemDotAnn_MudDischarged_Volume%Length()-1
  45. deltaV= MudSystemDotAnn_MudDischarged_Volume%Last()
  46. if (ABS(Ann_Density%Array(kloc)-FillingDensity)< MudSystemDotDensityMixTol .and. Ann_CuttingMud%Array(kloc)==0) then ! .OR. (Ann_MudDischarged_Volume%Array(kloc)< 42.) ) then ! 1-Pockets are Merged
  47. Ann_Density%Array(kloc)= (Ann_Density%Array(kloc)*MudSystemDotAnn_MudDischarged_Volume%Array(kloc)+FillingDensity*deltaV)/(MudSystemDotAnn_MudDischarged_Volume%Array(kloc)+deltaV)
  48. MudSystemDotAnn_MudDischarged_Volume%Array(kloc)= MudSystemDotAnn_MudDischarged_Volume%Array(kloc)+deltaV
  49. Ann_Mud_Forehead_X%Array(kloc)= MudSystemDotXend_PipeSection(MudSystemDotNoPipeSections)
  50. Ann_Mud_Forehead_section%Array(kloc)= MudSystemDotNoPipeSections
  51. !Ann_Mud_Backhead_X%Array(kloc)= no change
  52. !Ann_Mud_Backhead_section%Array(kloc)= no change
  53. Ann_RemainedVolume_in_LastSection%Array(kloc)= (0.0)
  54. Ann_EmptyVolume_inBackheadLocation%Array(kloc)= (0.0)
  55. call MudSystemDotAnn_MudDischarged_Volume%Remove (kloc+1)
  56. call Ann_Mud_Backhead_X%Remove (kloc+1)
  57. call Ann_Mud_Backhead_section%Remove (kloc+1)
  58. call Ann_Mud_Forehead_X%Remove (kloc+1)
  59. call Ann_Mud_Forehead_section%Remove (kloc+1)
  60. call Ann_Density%Remove (kloc+1)
  61. call Ann_RemainedVolume_in_LastSection%Remove (kloc+1)
  62. call Ann_EmptyVolume_inBackheadLocation%Remove (kloc+1)
  63. call Ann_MudOrKick%Remove (kloc+1)
  64. call Ann_CuttingMud%Remove (kloc+1)
  65. else ! 2-Merging conditions are not meeted, so new pocket== air is replaced with filling mud
  66. Ann_Density%Array(kloc+1) =FillingDensity
  67. 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.)*DeltaT_Mudline
  78. kloc= MudSystemDotAnn_MudDischarged_Volume%Length()
  79. !========================ANNULUS ENTRANCE====================
  80. if (ABS(Ann_Density%Last() - FillingDensity) >= MudSystemDotDensityMixTol .or. Ann_CuttingMud%Last()==1) then ! .OR. (Ann_MudDischarged_Volume%Array(kloc)>42.) ) then ! new mud is pumped
  81. Xposition= Ann_Mud_Forehead_X%Last()
  82. SectionPosition= Ann_Mud_Forehead_section%Last()
  83. call Ann_Density%Add (FillingDensity)
  84. call MudSystemDotAnn_MudDischarged_Volume%Add (0.0d0)
  85. call Ann_Mud_Forehead_X%Add (Xposition)
  86. call Ann_Mud_Forehead_section%Add (SectionPosition)
  87. call Ann_Mud_Backhead_X%Add (Xposition)
  88. call Ann_Mud_Backhead_section%Add (SectionPosition)
  89. call Ann_RemainedVolume_in_LastSection%Add (0.0d0)
  90. call Ann_EmptyVolume_inBackheadLocation%Add (0.0d0)
  91. call Ann_MudOrKick%Add (0)
  92. call Ann_CuttingMud%Add (0)
  93. !AnnulusSuctionDensity_Old= Hz_Density_Utube
  94. !endif
  95. !========================ANNULUS====================
  96. MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotAnn_MudDischarged_Volume%Length())= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotAnn_MudDischarged_Volume%Length())+ deltaV !(gal)
  97. else ! Merged with last Mud
  98. Ann_Density%Array(kloc)= (Ann_Density%Array(kloc)*MudSystemDotAnn_MudDischarged_Volume%Array(kloc)+FillingDensity*deltaV)/(MudSystemDotAnn_MudDischarged_Volume%Array(kloc)+deltaV)
  99. MudSystemDotAnn_MudDischarged_Volume%Array(kloc)= MudSystemDotAnn_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. Ann_RemainedVolume_in_LastSection%Array(kloc)= (0.0)
  105. Ann_EmptyVolume_inBackheadLocation%Array(kloc)= (0.0)
  106. endif
  107. endif
  108. end subroutine FillingWell_By_BellNipple