Simulation Core
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

219 linhas
10 KiB

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