|
- subroutine CirculationCodeSelect ! is called in subroutine Fluid_Flow_Solver
-
- use KickVARIABLESModule
- Use MudSystemVARIABLES
- USE TD_DrillStemComponents
- Use CUnityInputs
- Use CUnityOutputs
- USE CKellyConnectionEnumVariables
- use UTUBEVARSModule
- use sROP_Variables
- use PressureDisplayVARIABLESModule
-
-
-
- implicit none
-
-
- Integer i,KickNumber
-
- !NewInfluxNumber = NoGasPocket
-
- MudSystem%Flow_timeCounter= MudSystem%Flow_timeCounter+1
-
- !if (ChokePanelStrokeResetSwitch == 1) then
- ! Flow_timeCounter= 0
- !endif
-
-
- !write(*,*) 'Flow_timeCounter' , Flow_timeCounter
-
- !===========================Shoe Lost===============================
-
- call ShoeLostSub
-
- !===================================================================
-
-
- MudSystem%iLoc= 1 ! will be changed in KickFlux and Migration or Pump and TripIn (save OP Mud data)
- !KickMigration_2SideBit= .false.
- Call Set_FlowPipeDisconnect(.false.)
- Call Set_FlowKellyDisconnect(.false.)
-
- call ElementsCreation
-
-
-
-
- if (MUD(8)%Q > 0.0) call FillingWell_By_BellNipple ! Filling Well Through BellNipple ( Path j11 )
- !if (MUD(10)%Q > 0.0) call FillingWell_By_Pumps ! Filling Well Through Pumps ( Path j19 )
-
- !write(*,*) 'TD_RemoveVolume,Get_JointConnectionPossible=' , TD_RemoveVolume,Get_JointConnectionPossible()
-
- if (TD_Vol%RemoveVolume > 0.) call DisconnectingPipe !! .and. Get_JointConnectionPossible() == .false.) call DisconnectingPipe
-
-
- IF (KickFlux .AND. NOT(KickOffBottom)) THEN
- call Kick_Influx
- endif
-
-
-
-
- IF ( MudSystem%NewInfluxNumber > 0 ) THEN
- !write(*,*) 'KickOffBottom , ROP=' , KickOffBottom , ROP_Bit%RateOfPenetration
- call Kick_Migration
- endif
-
- ! ============================ must be after migration ==============================
-
- DO KickNumber= MudSystem%NewInfluxNumber-NoGasPocket+1 , MudSystem%NewInfluxNumber
- ! FINDING NEW KICK LOCATIONS:
- MudSystem%Ann_KickLoc= 0
- MudSystem%Op_KickLoc= 0
- MudSystem%ChokeLine_KickLoc= 0
-
- do i = 1, MudSystem%Ann_MudOrKick%Length ()
- if (MudSystem%Ann_MudOrKick%Array(i) == KickNumber) then
- MudSystem%Ann_KickLoc = i
- exit
- endif
- end do
-
- do i = 1, MudSystem%Op_MudOrKick%Length ()
- if (MudSystem%Op_MudOrKick%Array(i) == KickNumber) then
- MudSystem%Op_KickLoc = i
- exit
- endif
- end do
-
- do i = 1, MudSystem%ChokeLine_MudOrKick%Length ()
- if (MudSystem%ChokeLine_MudOrKick%Array(i) == KickNumber) then
- MudSystem%ChokeLine_KickLoc = i
- exit
- endif
- end do
-
- ! ============================ must be after migration-end ===========================
-
- IF (ALLOCATED(GasPocketWeight%Array) .and. KickNumber == MudSystem%NewInfluxNumber .AND. NOT(KickOffBottom) .AND. MudSystem%WellHeadIsOpen) THEN
-
- cycle
-
- ELSE IF (ALLOCATED(GasPocketWeight%Array)) THEN
-
- if (((GasPocketDeltaVol%Array(MudSystem%NewInfluxNumber - KickNumber + 1) > 0.0 .AND. MudSystem%WellHeadIsOpen) .or. MudSystem%Kickexpansion_DueToMudLost) ) call Kick_Expansion
-
- if ((GasPocketDeltaVol%Array(MudSystem%NewInfluxNumber - KickNumber + 1) < 0.0 ) .OR. MudSystem%WellHeadIsOpen == .FALSE.) CALL Kick_Contraction
-
- ENDIF
- ENDDO
- MudSystem%KickNumber = KickNumber
- MudSystem%LostInTripOutIsDone= .false.
-
- if( MudSystem%DeltaVolumeOp >= 0.0 .and. Get_KellyConnection()==KELLY_CONNECTION_STRING) then
- !write(*,*) 'DeltaVolumeOp=' , DeltaVolumeOp
- call Pump_and_TripIn
- elseif (MudSystem%DeltaVolumeOp < 0.0) then
- ! when we have Utube and tripping out simultaneously, it uses "TripOut_and_Pump" subroutine, and then Utube code is done
- ! "Utube" and "Pump_and_TripIn" subroutines, not to be used simultaneously because "Utube" code supports trip in
- call TripOut_and_Pump
- endif
-
- MudSystem%WellOutletDensity= MudSystem%Ann_Density%Last() ! (ppg) used in MudSystem
-
-
-
- if (MUD(4)%Q > 0.) then ! ( j4 > 0 ) ! THIS CIRCULATION CODE IS JUST FOR LINE J4, AND NOT NEEDED FOR LINE J18
- call ChokeLineMud
- endif
-
-
- call Choke_GasSound
-
- !WRITE(*,*) 'CIRCU-Ann_Saved_MudDischarged_Volume' , Ann_Saved_MudDischarged_Volume
-
- !****Utube is called in Plot Subroutine****
-
- Call Instructor_CirculationMud_Edit
-
-
-
- call PlotFinalMudElements
-
- MudSystem%MudChecked= .true.
- MudSystem%UtubePossibility= .true.
- !WRITE(*,*) '***********************************************************************'
-
- end subroutine CirculationCodeSelect
|