Simulation Core
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 
 

146 líneas
5.9 KiB

  1. subroutine CirculationCodeSelect ! is called in subroutine Fluid_Flow_Solver
  2. use KickVARIABLESModule
  3. USE MudSystemVARIABLES
  4. use SimulationVariables !@@@
  5. USE TD_DrillStemComponents
  6. use OperationScenariosModule
  7. use UTUBEVARSModule
  8. use sROP_Variables
  9. use PressureDisplayVARIABLESModule
  10. use UnityModule
  11. implicit none
  12. Integer i,KickNumber
  13. !NewInfluxNumber = NoGasPocket
  14. data%State%MudSystem%Flow_timeCounter= data%State%MudSystem%Flow_timeCounter+1
  15. !if (ChokePanelStrokeResetSwitch == 1) then
  16. ! Flow_timeCounter= 0
  17. !endif
  18. !write(*,*) 'Flow_timeCounter' , Flow_timeCounter
  19. !===========================Shoe Lost===============================
  20. call ShoeLostSub
  21. !===================================================================
  22. data%State%MudSystem%iLoc= 1 ! will be changed in KickFlux and Migration or Pump and TripIn (save OP Mud data)
  23. !KickMigration_2SideBit= .false.
  24. Call Set_FlowPipeDisconnect(.false.)
  25. Call Set_FlowKellyDisconnect(.false.)
  26. call ElementsCreation
  27. if (data%State%MUD(8)%Q > 0.0) call FillingWell_By_BellNipple ! Filling Well Through BellNipple ( Path j11 )
  28. !if (data%State%MUD(10)%Q > 0.0) call FillingWell_By_Pumps ! Filling Well Through Pumps ( Path j19 )
  29. !write(*,*) 'TD_RemoveVolume,Get_JointConnectionPossible=' , TD_RemoveVolume,Get_JointConnectionPossible()
  30. if (data%State%TD_Vol%RemoveVolume > 0.) call DisconnectingPipe !! .and. Get_JointConnectionPossible() == .false.) call DisconnectingPipe
  31. IF (KickVARIABLES%KickFlux .AND. NOT(KickVARIABLES%KickOffBottom)) THEN
  32. call Kick_Influx
  33. endif
  34. IF ( data%State%MudSystem%NewInfluxNumber > 0 ) THEN
  35. call Kick_Migration
  36. endif
  37. ! ============================ must be after migration ==============================
  38. DO KickNumber= data%State%MudSystem%NewInfluxNumber-KickVARIABLES%NoGasPocket+1 , data%State%MudSystem%NewInfluxNumber
  39. ! FINDING NEW KICK LOCATIONS:
  40. data%State%MudSystem%Ann_KickLoc= 0
  41. data%State%MudSystem%Op_KickLoc= 0
  42. data%State%MudSystem%ChokeLine_KickLoc= 0
  43. do i = 1, data%State%MudSystem%Ann_MudOrKick%Length ()
  44. if (data%State%MudSystem%Ann_MudOrKick%Array(i) == KickNumber) then
  45. data%State%MudSystem%Ann_KickLoc = i
  46. exit
  47. endif
  48. end do
  49. do i = 1, data%State%MudSystem%Op_MudOrKick%Length ()
  50. if (data%State%MudSystem%Op_MudOrKick%Array(i) == KickNumber) then
  51. data%State%MudSystem%Op_KickLoc = i
  52. exit
  53. endif
  54. end do
  55. do i = 1, data%State%MudSystem%ChokeLine_MudOrKick%Length ()
  56. if (data%State%MudSystem%ChokeLine_MudOrKick%Array(i) == KickNumber) then
  57. data%State%MudSystem%ChokeLine_KickLoc = i
  58. exit
  59. endif
  60. end do
  61. ! ============================ must be after migration-end ===========================
  62. IF (ALLOCATED(GasPocketWeight%Array) .and. KickNumber == data%State%MudSystem%NewInfluxNumber .AND. NOT(KickVARIABLES%KickOffBottom) .AND. data%State%MudSystem%WellHeadIsOpen) THEN
  63. cycle
  64. ELSE IF (ALLOCATED(GasPocketWeight%Array)) THEN
  65. if (((GasPocketDeltaVol%Array(data%State%MudSystem%NewInfluxNumber - KickNumber + 1) > 0.0 .AND. data%State%MudSystem%WellHeadIsOpen) .or. data%State%MudSystem%Kickexpansion_DueToMudLost) ) call Kick_Expansion
  66. if ((GasPocketDeltaVol%Array(data%State%MudSystem%NewInfluxNumber - KickNumber + 1) < 0.0 ) .OR. data%State%MudSystem%WellHeadIsOpen == .FALSE.) CALL Kick_Contraction
  67. ENDIF
  68. ENDDO
  69. data%State%MudSystem%KickNumber = KickNumber
  70. data%State%MudSystem%LostInTripOutIsDone= .false.
  71. if( data%State%MudSystem%DeltaVolumeOp >= 0.0 .and. Get_KellyConnection()==KELLY_CONNECTION_STRING) then
  72. !write(*,*) 'DeltaVolumeOp=' , DeltaVolumeOp
  73. call Pump_and_TripIn
  74. elseif (data%State%MudSystem%DeltaVolumeOp < 0.0) then
  75. ! when we have Utube and tripping out simultaneously, it uses "TripOut_and_Pump" subroutine, and then Utube code is done
  76. ! "Utube" and "Pump_and_TripIn" subroutines, not to be used simultaneously because "Utube" code supports trip in
  77. call TripOut_and_Pump
  78. endif
  79. data%State%MudSystem%WellOutletDensity= data%State%MudSystem%Ann_Density%Last() ! (ppg) used in MudSystem
  80. if (data%State%MUD(4)%Q > 0.) then ! ( j4 > 0 ) ! THIS CIRCULATION CODE IS JUST FOR LINE J4, AND NOT NEEDED FOR LINE J18
  81. call ChokeLineMud
  82. endif
  83. call Choke_GasSound
  84. !WRITE(*,*) 'CIRCU-Ann_Saved_MudDischarged_Volume' , Ann_Saved_MudDischarged_Volume
  85. !****Utube is called in Plot Subroutine****
  86. Call Instructor_CirculationMud_Edit
  87. call PlotFinalMudElements
  88. data%State%MudSystem%MudChecked= .true.
  89. data%State%MudSystem%UtubePossibility= .true.
  90. !WRITE(*,*) '***********************************************************************'
  91. end subroutine CirculationCodeSelect