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.

Circulation_Code_Select.f90 5.3 KiB

1 jaar geleden
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. subroutine CirculationCodeSelect ! is called in subroutine Fluid_Flow_Solver
  2. Use KickVariables
  3. Use MudSystemVARIABLES
  4. USE TD_DrillStemComponents
  5. Use CUnityInputs
  6. Use CUnityOutputs
  7. USE CKellyConnectionEnumVariables
  8. USE UTUBEVARS
  9. use sROP_Variables
  10. USE PressureDisplayVARIABLES
  11. implicit none
  12. Integer i
  13. !NewInfluxNumber = NoGasPocket
  14. Flow_timeCounter= 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. 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 (MUD(8)%Q > 0.0) call FillingWell_By_BellNipple ! Filling Well Through BellNipple ( Path j11 )
  28. !if (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 (TD_RemoveVolume > 0.) call DisconnectingPipe !! .and. Get_JointConnectionPossible() == .false.) call DisconnectingPipe
  31. IF (KickFlux .AND. NOT(KickOffBottom)) THEN
  32. call Kick_Influx
  33. endif
  34. IF ( NewInfluxNumber > 0 ) THEN
  35. !write(*,*) 'KickOffBottom , ROP=' , KickOffBottom , Rate_of_Penetration
  36. call Kick_Migration
  37. endif
  38. ! ============================ must be after migration ==============================
  39. DO KickNumber= NewInfluxNumber-NoGasPocket+1 , NewInfluxNumber
  40. ! FINDING NEW KICK LOCATIONS:
  41. Ann_KickLoc= 0
  42. Op_KickLoc= 0
  43. ChokeLine_KickLoc= 0
  44. do i = 1, Ann_MudOrKick%Length ()
  45. if (Ann_MudOrKick%Array(i) == KickNumber) then
  46. Ann_KickLoc = i
  47. exit
  48. endif
  49. end do
  50. do i = 1, Op_MudOrKick%Length ()
  51. if (Op_MudOrKick%Array(i) == KickNumber) then
  52. Op_KickLoc = i
  53. exit
  54. endif
  55. end do
  56. do i = 1, ChokeLine_MudOrKick%Length ()
  57. if (ChokeLine_MudOrKick%Array(i) == KickNumber) then
  58. ChokeLine_KickLoc = i
  59. exit
  60. endif
  61. end do
  62. ! ============================ must be after migration-end ===========================
  63. IF (ALLOCATED(GasPocketWeight%Array) .and. KickNumber == NewInfluxNumber .AND. NOT(KickOffBottom) .AND. WellHeadIsOpen) THEN
  64. cycle
  65. ELSE IF (ALLOCATED(GasPocketWeight%Array)) THEN
  66. if (((GasPocketDeltaVol%Array(NewInfluxNumber - KickNumber + 1) > 0.0 .AND. WellHeadIsOpen) .or. KickExpansion_DueToMudLost) ) call Kick_Expansion
  67. if ((GasPocketDeltaVol%Array(NewInfluxNumber - KickNumber + 1) < 0.0 ) .OR. WellHeadIsOpen == .FALSE.) CALL Kick_Contraction
  68. ENDIF
  69. ENDDO
  70. LostInTripOutIsDone= .false.
  71. if( DeltaVolumeOp >= 0.0 .and. Get_KellyConnection()==KELLY_CONNECTION_STRING) then
  72. !write(*,*) 'DeltaVolumeOp=' , DeltaVolumeOp
  73. call Pump_and_TripIn
  74. elseif (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. WellOutletDensity= Ann_Density%Last() ! (ppg) used in MudSystem
  80. if (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. MudChecked= .true.
  89. UtubePossibility= .true.
  90. !WRITE(*,*) '***********************************************************************'
  91. end subroutine CirculationCodeSelect