|
- SUBROUTINE NormalCirculation_StartUp() ! is called in module FluidFlowMain
-
- USE MudSystemVARIABLES
- use CTanksVariables
- USE CMudPropertiesVariables
- Use GeoElements_FluidModule
- use KickVARIABLESModule
- Use CUnityOutputs
- Use CShoeVariables
- USE Pumps_VARIABLES
-
- implicit none
-
- ! temporary varibales for solving pressure jerks -- 1399-11-09
- !Pump1BlownInTimeStep = 0
- !Pump2BlownInTimeStep = 0
- !Pump3BlownInTimeStep = 0
-
- !Pump1BlownStarted = .FALSE.
- !Pump2BlownStarted = .FALSE.
- !Pump3BlownStarted = .FALSE.
-
- MudSystem%Pump1BlownCount = 0
- MudSystem%Pump2BlownCount = 0
- MudSystem%Pump3BlownCount = 0
-
-
- MudSystem%DeltaWellCap=0.
- MudSystem%WellCapOld = 0.
- MudSystem%AnnCapOld=0.
- MudSystem%DeltaAnnCap=0.
-
-
- MPumps%Total_Stroke_Counter_For_Plot = 0.0
-
- MudSystem%DeltaT_Mudline=0.1 !second
-
- Call Set_FlowKellyDisconnect(.false.)
- Call Set_FlowPipeDisconnect(.false.)
-
- !HZ_ADD= 0.d0
- MudSystem%Flow_timeCounter= 0
- MudSystem%MudSys_timeCounter= 0
- MudSystem%FluidFlowCounter = 0
- !========================================================================
- ! MUD CIRCULATION STARTUP
- !========================================================================
-
- MudSystem%FormationLostPressure= Shoe%LeakOff * Shoe%ShoeDepth
- MudSystem%ShoeFractured= .false.
-
- MudSystem%UGBOSuccessionCounter = 0 ! also in starup
- MudSystem%UGBOSuccessionCounterOld = 0 ! also in starup
-
-
-
- MudSystem%ChokeLineFlowRate= 0.0
- MudSystem%StringFlowRate= 0.0
- MudSystem%AnnulusFlowRate= 0.0
-
- MudSystem%MudVolume_InjectedFromAnn= 0.D0
- MudSystem%MudVolume_InjectedToBH= 0.D0
-
- MudSystem%DensityMixTol= 0.1 !(ppg)
- MudSystem%CuttingDensityMixTol= 0.5
- MudSystem%NewPipeFilling= 1
- MudSystem%UtubeFilling= 1
- MudSystem%UtubeEmptyVolume= 0.0
-
- MudSystem%UtubeMode1Activated= .false.
- MudSystem%UtubeMode2Activated= .false.
- MudSystem%UtubePossibility= .false.
-
-
- !KickMigration_2SideBit = .FALSE.
-
- MudSystem%KickDx= (Reservoir%AutoMigrationRate/3600.)*MudSystem%DeltaT_Mudline !AutoMigrationRate (ft/h)= ft per DeltaT_Mudline
-
-
- MudSystem%NewInfluxElementCreated= 0
- MudSystem%NewInfluxNumber= 0
-
- !KickVolumeinAnnulus= 0.0
- MudSystem%KickDeltaVinAnnulus= 0.0
- KickVARIABLES%GasKickPumpFlowRate= 0.0
-
- MudSystem%FirstMudSet= 0
- MudSystem%FirstSetUtube1=0
- MudSystem%FirstSetUtube2=0
- MudSystem%SuctionMud=1
- MudSystem%ImudCount= 1
- imud=1
- MudSystem%iLoc= 1 ! for Kick
-
- MudSystem%Suction_Density_MudSystem= MudProperties%ActiveDensity
- MudSystem%SuctionDensity_Old= MudProperties%ActiveDensity ! initial(ppg)
- MudSystem%StringDensity_Old= MudProperties%ActiveDensity ! initial(ppg)
- MudSystem%AnnulusSuctionDensity_Old= MudProperties%ActiveDensity ! initial(ppg)
- MudSystem%ChokeLineDensity_Old= MudProperties%ActiveDensity ! initial(ppg)
-
- MudSystem%TotalAddedVolume= 0.
-
-
- MudSystem%xx=0.
-
-
-
- END SUBROUTINE NormalCirculation_StartUp
-
-
-
-
-
-
-
- SUBROUTINE MudSystem_StartUp()
- USE CMudPropertiesVariables
- USE MudSystemVARIABLES
- USE CDataDisplayConsoleVariables
- USE CHOKEVARIABLES
- USE Pumps_VARIABLES
- USE CBopStackVariables
- USE CPumpsVariables
- use CTanksVariables
- use KickVARIABLESModule
- implicit none
-
-
-
-
-
- CALL MUDLINE_LOSS_INPUTS()
-
- !MPumps%Total_Pump_GPM=10. ! Initial Value
- MUD%Q=0. ! Initial Value
-
- MudSystem%Q_flow32=0.
- MudSystem%Q_flow33=0.
- MudSystem%Q_flow34=0.
- MudSystem%Q_flow35=0.
-
- MudSystem%DeltaT_Mudline=0.1 !second
-
- KickVARIABLES%GasKickPumpFlowRate= 0.
- MudSystem%BellNippleVolume= 0.
- MudSystem%BellNippleDensity= 0.
- MudSystem%MudBucketVolume= 0.
- MudSystem%MudBucketDensity= 0.
- MudSystem%BellNippleDumpVolume= 0.
- !BellNippleDumpRate= 0.
- !BellNippleToPitsRate= 0.0
- MudSystem%MudChecked= .true.
-
- MudSystem%condition32Final= .TRUE.
- MudSystem%condition33Final= .TRUE.
- MudSystem%condition34Final= .TRUE.
-
-
- MudSystem%PressureGauge75= 0.0
- MudSystem%PressureGauge76 = 0.0
-
-
- !!======================================================================
- !! TRIP TANK
- !!======================================================================
-
- MudSystem%TripTank_MinVol_Allowded= 50.*42. !(bbl to gal, initial value)
- MudSystem%TripTank_MaxVol_Allowded= 50. *42. !(bbl to gal, initial value)
-
-
- MudSystem%ActiveTankFloorArea= (MudProperties%ActiveTotalTankCapacityGal) / (7.48051948*100./12.) ! (ft^2) - Tank Height= 100 inch , 12=inch to ft 7.48051948=gal to ft^3
- MudSystem%TripTankFloorArea= (50.*42.) / (7.48051948*100./12.) ! (ft^2) - 50.*42.=Trip Tank Capacity in BBl*42= Gal , Tank Height= 100 inch , 12=inch to ft 7.48051948=gal to ft^3
-
-
-
- MudSystem%TripTank_Vol= MudProperties%InitialTripTankMudVolumeGal !(gal)
- MudSystem%TripTank_Dens= 1.
- DataDisplayConsole%TripTankGauge=0.
-
-
-
- MudSystem%ReturnToTrip_Q= 1.
- MudSystem%ActiveToTrip_Q= 1.
-
-
- MudSystem%TripTankPump_Q= .8
-
-
- MudSystem%ReturnToTrip_Dens=1.0 ! ppg(lbm/gal)
- MudSystem%ActiveToTrip_Dens=1.0
-
- !!======================================================================
- !! MUD VOLUME TOTALIZER
- !!======================================================================
-
- MudSystem%Mp1Density= 0.0 !(VALVE82)
- MudSystem%Mp2Density= 0.0 !(VALVE83)
- MudSystem%Mp3Density= 0.0 !(VALVE84)
-
-
- MudSystem%ReserveTankVolume= MudProperties%ReserveMudVolumeGal ! initial volume (gal)
- MudSystem%ReserveTankDensity= MudProperties%ReserveDensity ! initial
-
-
-
- MudSystem%CementTankVolumeCalc= Tank%CementTankVolume !movaghat--- initial volume (gal)
- MudSystem%CementTankDensityCalc= Tank%CementTankDensity !movaghat--- initial
-
- MudSystem%PumpsDumpVolume=0.0
- MudSystem%PumpsDumpFlowRate= 0.0
-
-
-
- MudSystem%ActiveTankVolume= MudProperties%ActiveMudVolumeGal ! initial volume (gal)
- MudSystem%RefrencePitVolume= MudSystem%ActiveTankVolume/42. !(bbl)
- MudSystem%RefrencePitVolume_DrillWatch= MudSystem%ActiveTankVolume/42. !(bbl)
-
- MudSystem%MVT_MinVol_Allowded= 0.
- MudSystem%MVT_MaxVol_Allowded= 0.
-
- MudSystem%MudTank1_vol= MudProperties%ActiveMudVolumeGal/3. ! (gal)
- MudSystem%MudTank2_vol= MudProperties%ActiveMudVolumeGal/3. ! (gal)
- MudSystem%MudTank3_vol= MudProperties%ActiveMudVolumeGal/3. ! (gal)
- MudSystem%ActiveTankSettled= MudProperties%ActiveSettledContentsGal ! (gal)
- MudSystem%MudTank4_vol= MudProperties%InitialTripTankMudVolumeGal ! (gal)
-
- MudSystem%TripTankVolumeCalc= MudProperties%InitialTripTankMudVolumeGal ! initial volume (gal)
- MudSystem%ActiveTankDensity= MudProperties%ActiveDensity ! initial(ppg)
- MudSystem%TripTankDensityCalc= Tank%TripTankDensity ! initial(ppg)
-
- MudSystem%ChokeManifoldDumpVolume= 0.0
-
- MudSystem%PitGainLossZero= 0.
- MudSystem%PitGainLossZero_Old= MudSystem%PitGainLossZero
- MudSystem%MVTCoarseKnob_Old= DataDisplayConsole%MVTCoarseKnob
- MudSystem%MVTFineKnob_Old= DataDisplayConsole%MVTFineKnob
- MudSystem%FirstSet_Time= .true.
-
-
-
- MudSystem%PedalMeter= MudProperties%PedalFlowMeter !1600. !(gpm)
- MudSystem%ReturnFlowRate=0.
-
-
-
- MudSystem%TotalStrokes1MFFI =0.
- MudSystem%TotalStrokes2MFFI =0.
-
- MudSystem%TotalStrokesPump1=0.
- MudSystem%TotalStrokesPump2=0.
- MudSystem%GraphTotalStrokes=0.
-
-
- Choke%TotalStrokes1 =0.
- Choke%TotalStrokes2 =0.
-
-
-
-
-
-
- end
-
-
-
-
-
-
-
-
-
-
-
- SUBROUTINE MUDLINE_LOSS_INPUTS()
- USE MudSystemVARIABLES
- USE CBopStackVariables
- USE CPumpsVariables
- implicit none
- INTEGER I
-
-
-
- !===========================================================================
- ! MUDLINE MINOR LOSSES INPUT
- !===========================================================================
-
- MudSystem%NO_MudMinors=4
-
- ALLOCATE (MudSystem%MudMinors(MudSystem%NO_MudMinors,4))
-
- ! ID(INCH) LF CV NOTE(BAR) DESCRIPTION
- MudSystem%MudMinors(1,1)= PumpsSpecification%MudPump1Output
- MudSystem%MudMinors(1,2:4)= (/1.5*8., 0., 0./) !elbow (MLnumber=1,,PumpsToString)
- MudSystem%MudMinors(2,1)= PumpsSpecification%MudPump1Output
- MudSystem%MudMinors(2,2:4)= (/1.5*6., 0., 0./) !elbow (MLnumber=2,,STGaugeToString)
- MudSystem%MudMinors(3,1:4)= (/0., 0., 0., 0./) !elbow (MLnumber=3,,WellToPits)
- MudSystem%MudMinors(4,1)= BopStackSpecification%ChokeLineId
- MudSystem%MudMinors(4,2:4)= (/1.5*7., 0., 0./) !elbow (MLnumber=4,,WellToChokeManifold)
-
-
-
- ALLOCATE (MudSystem%MINORDIAMETER_MUDLINE(MudSystem%NO_MudMinors),MudSystem%AREAMINOR_MUDLINE(MudSystem%NO_MudMinors),MudSystem%LF_MUDLINE(MudSystem%NO_MudMinors),MudSystem%CV_MUDLINE(MudSystem%NO_MudMinors) &
- ,MudSystem%NOTE_MUDLINE(MudSystem%NO_MudMinors))
-
-
-
- DO I=1,MudSystem%NO_MudMinors
- MudSystem%MINORDIAMETER_MUDLINE(I)=MudSystem%MudMinors(I,1)
- MudSystem%LF_MUDLINE(I)=MudSystem%MudMinors(I,2)
- MudSystem%CV_MUDLINE(I)=MudSystem%MudMinors(I,3)
- MudSystem%NOTE_MUDLINE(I)=MudSystem%MudMinors(I,4)
-
-
- MudSystem%AREAMINOR_MUDLINE(I)=PII*(MudSystem%MINORDIAMETER_MUDLINE(I)*0.0254)**2/4. !D(in), AREA(m^2)
- ENDDO
-
- !===========================================================================
- ! MUDLINE PIPNING LOSSES INPUT
- !===========================================================================
- MudSystem%NO_PIPINGSMUDLINE=4
-
- ALLOCATE (MudSystem%PIPINGS_MUDLINE(MudSystem%NO_PIPINGSMUDLINE,3))
-
- ! ID(INCH) L(FEET) ROUGHNESS(MM)=e DESCRIPTION
- MudSystem%PIPINGS_MUDLINE(1,1)= PumpsSpecification%MudPump1Output
- MudSystem%PIPINGS_MUDLINE(1,2:3)= (/265., 0.03/) !(MLnumber=1,,PumpsToString)
- MudSystem%PIPINGS_MUDLINE(2,1)= PumpsSpecification%MudPump1Output
- MudSystem%PIPINGS_MUDLINE(2,2:3)= (/100., 0.03/) !(MLnumber=2,,STGaugeToString)
- MudSystem%PIPINGS_MUDLINE(3,1:3)= (/0., 0., 0./) !(MLnumber=3,,WellToPits)
- MudSystem%PIPINGS_MUDLINE(4,1)= BopStackSpecification%ChokeLineId
- MudSystem%PIPINGS_MUDLINE(4,2)= BopStackSpecification%ChokeLineLength
- MudSystem%PIPINGS_MUDLINE(4,3)= 0.03 !(MLnumber=4,,WellToChokeManifold)
-
- MudSystem%Area_ChokeLineFt= PII*((BopStackSpecification%ChokeLineId/12.)**2)/4. !D(in), AREA(ft^2)
- MudSystem%ChokeLine_VolumeCapacity= MudSystem%Area_ChokeLineFt* BopStackSpecification%ChokeLineLength* 7.48051948 ! (gal)
-
- ALLOCATE (MudSystem%DIAM_MUDLINE_INCH(MudSystem%NO_PIPINGSMUDLINE), &
- MudSystem%AREA_MUDLINE(MudSystem%NO_PIPINGSMUDLINE),MudSystem%LENGT_MUDLINE(MudSystem%NO_PIPINGSMUDLINE),MudSystem%ROUGHNESS_MUDLINE(MudSystem%NO_PIPINGSMUDLINE),MudSystem%RELROUGH_MUDLINE(MudSystem%NO_PIPINGSMUDLINE))
-
-
- DO I=1,MudSystem%NO_PIPINGSMUDLINE
- MudSystem%DIAM_MUDLINE_INCH(I)=MudSystem%PIPINGS_MUDLINE(I,1)
- MudSystem%LENGT_MUDLINE(I)=MudSystem%PIPINGS_MUDLINE(I,2)
- MudSystem%ROUGHNESS_MUDLINE(I)=MudSystem%PIPINGS_MUDLINE(I,3)
-
-
-
- MudSystem%AREA_MUDLINE(I)=PII*(MudSystem%DIAM_MUDLINE_INCH(I)*0.0254)**2/4 !D(in), AREA(m^2)
- MudSystem%RELROUGH_MUDLINE(I)=MudSystem%ROUGHNESS_MUDLINE(I)/(MudSystem%DIAM_MUDLINE_INCH(I)*25.4) !e/D
- !DIAM_MUDLINE_MM(I)=DIAM_MUDLINE_MM(I)*.001 ! (m)
- MudSystem%LENGT_MUDLINE(I)=MudSystem%LENGT_MUDLINE(I)*.3048 ! (m)
- ENDDO
-
-
- !===========================================================================
- ! MUDLINE STATIC LOSSES INPUT
- !===========================================================================
-
- ! Height are in (meter)
- MudSystem%Pumps_Height= 0.
- MudSystem%STpipeGauge_Height= 2. !(m)
- MudSystem%Pits_Height= 1. !(m)
- MudSystem%ChokeManifold_Height= 1.*0.3048 !(ft to meter)
- MudSystem%WellChokeExit_Height= BopStackSpecification%GroundLevel-BopStackSpecification%KillHeight
-
-
-
-
-
-
-
-
-
-
-
-
-
- END
-
-
-
-
- SUBROUTINE MUDLINE_LOSSES(MLnumber)
-
- USE MudSystemVARIABLES
- implicit none
- integer I
- INTEGER MLnumber
-
-
- !===============================PIPE LOSS===================================
- MUD(MLnumber)%Re_MUDline=MUD(MLnumber)%Q*6.30902e-5*MudSystem%DIAM_MUDLINE_INCH(MLnumber)*0.0254/(MudSystem%AREA_MUDLINE(MLnumber)*MUD(MLnumber)%nu) !<<<<<< nu: DOROST SHAVAD.ALAN DAR STARTUP SET SHODE
- !write(*,*) 'MUD(MLnumber)%Re_MUDline=' , MUD(MLnumber)%Re_MUDline
- ! Q*6.30902e-5 for (gpm) to (m^3/sec)
- if ( MUD(MLnumber)%Re_MUDline<Re_cr) then
- MUD(MLnumber)%fric=64/ MUD(MLnumber)%Re_MUDline
- else
-
- MUD(MLnumber)%fric=1/(-1.8*log10((MudSystem%RELROUGH_MUDLINE(MLnumber)/3.7)**1.11+6.9/ MUD(MLnumber)%Re_MUDline))**2
- endif
-
- MUD(MLnumber)%fricloss=((MUD(MLnumber)%fric*(wdens*MUD(MLnumber)%Mud_SG*MudSystem%LENGT_MUDLINE(MLnumber)*(MUD(MLnumber)%Q*6.30902e-5/MudSystem%AREA_MUDLINE(MLnumber))**2))/(2*MudSystem%DIAM_MUDLINE_INCH(MLnumber)*0.0254))/6895
-
-
- !==============================MINOR LOSS===================================
-
- if (MudSystem%LF_MUDLINE(MLnumber)/=0) then
- MUD(MLnumber)%minlosspa_MUDLINE=MudSystem%LF_MUDLINE(MLnumber)*wdens*MUD(MLnumber)%Mud_SG*(MUD(MLnumber)%Q*6.30902e-5/MudSystem%AREAMINOR_MUDLINE(MLnumber))**2/2 !(Pa)
- MUD(MLnumber)%minloss_MUDLINE= MUD(MLnumber)%minlosspa_MUDLINE/6895 !(psi)
- elseif (MudSystem%CV_MUDLINE(MLnumber)/=0) then
- MUD(MLnumber)%minlosspa_MUDLINE=1000*MUD(MLnumber)%Mud_SG*((11.7*MUD(MLnumber)%Q*6.30902e-5*3600)/(MudSystem%CV_MUDLINE(MLnumber)))**2 !(pa)
- MUD(MLnumber)%minloss_MUDLINE= MUD(MLnumber)%minlosspa_MUDLINE/6895 !(psi)
- else
- MUD(MLnumber)%minlosspa_MUDLINE=MudSystem%NOTE_MUDLINE(MLnumber)*1e5 !(pa)
- MUD(MLnumber)%minloss_MUDLINE= MUD(MLnumber)%minlosspa_MUDLINE/6895 !(psi)
- endif
-
-
- !==========================STATIC & KINETIC LOSS=============================
-
- MudSystem%String_Height= 50.*0.3048 !<<<<<<<<<<<<<<< (foot) to (meter). az khanom tarmigh
- MUD(1)%static_loss=(MudSystem%String_Height- MudSystem%Pumps_Height)*0.0 !(MLnumber=1,,PumpsToString)
- MUD(2)%static_loss=(MudSystem%String_Height- MudSystem%STpipeGauge_Height)*MUD(2)%Mud_SG*wdens*gravity/6895 ! (psi) (MLnumber=2,,STGaugeToString)
- MUD(3)%static_loss=0. !(MLnumber=1,,WellToPits)
- MUD(4)%static_loss=(MudSystem%ChokeManifold_Height- MudSystem%WellChokeExit_Height)*MUD(4)%Mud_SG*wdens*gravity/6895 !(MLnumber=4,,WellToChokeManifold)
-
-
-
- ! RAM(RNUMBER)%kinetic_loss1=MUD(MLnumber)%Mud_SG*MUD(MLnumber)%Mud_Density*(RAM(RNUMBER)%Q*6.30902e-5/((1/4.)*pi*(.72*0.254e-1)**2))**2/(2*6895) !(psi)
-
-
-
- !============================TOTAL LOSS=======================================
- MUD(MLnumber)%total_loss= MUD(MLnumber)%fricloss+ MUD(MLnumber)%minloss_MUDLINE+ MUD(MLnumber)%static_loss!+ RAM(RNUMBER)%kinetic_loss1 !(psi)
-
-
- END
-
-
-
-
-
-
- SUBROUTINE DEALLOCATE_ARRAYS_MudSystem()
- USE MudSystemVARIABLES
- implicit none
- !===========================================================================
- ! RAMLINE MINOR LOSSES INPUT
- !===========================================================================
- if (allocated(MudSystem%MudMinors)) DEALLOCATE (MudSystem%MudMinors)
- !===========================================================================
- ! RAMLINE PIPNING LOSSES INPUT
- !===========================================================================
- if (allocated(MudSystem%MINORDIAMETER_MUDLINE)) DEALLOCATE (MudSystem%MINORDIAMETER_MUDLINE)
- if (allocated(MudSystem%AREAMINOR_MUDLINE)) DEALLOCATE (MudSystem%AREAMINOR_MUDLINE)
- if (allocated(MudSystem%LF_MUDLINE)) DEALLOCATE (MudSystem%LF_MUDLINE)
- if (allocated(MudSystem%CV_MUDLINE)) DEALLOCATE (MudSystem%CV_MUDLINE)
- if (allocated(MudSystem%NOTE_MUDLINE)) DEALLOCATE (MudSystem%NOTE_MUDLINE)
-
- !===========================================================================
- ! ANNULAR MINOR LOSSES INPUT
- !===========================================================================
- if (allocated(MudSystem%PIPINGS_MUDLINE)) DEALLOCATE (MudSystem%PIPINGS_MUDLINE)
- !===========================================================================
- ! ANNULAR PIPNING LOSSES INPUT
- !===========================================================================
- if (allocated(MudSystem%DIAM_MUDLINE_INCH)) DEALLOCATE (MudSystem%DIAM_MUDLINE_INCH)
- if (allocated(MudSystem%AREA_MUDLINE)) DEALLOCATE (MudSystem%AREA_MUDLINE)
- if (allocated(MudSystem%LENGT_MUDLINE)) DEALLOCATE (MudSystem%LENGT_MUDLINE)
- if (allocated(MudSystem%ROUGHNESS_MUDLINE)) DEALLOCATE (MudSystem%ROUGHNESS_MUDLINE)
- if (allocated(MudSystem%RELROUGH_MUDLINE)) DEALLOCATE (MudSystem%RELROUGH_MUDLINE)
-
- END
-
-
-
-
-
-
- subroutine AddDynamicArray(array, value)
- implicit none
- REAL, allocatable, intent(inout) :: array(:)
- REAL, intent(in) :: value
- REAL, allocatable :: tempArr(:)
- integer :: i, isize
-
- !if(allocated(array)) then
- ! isize = size(array)
- ! allocate(tempArr(isize+1))
- ! do i=1,isize
- ! tempArr(i) = array(i)
- ! end do
- ! tempArr(isize+1) = value
- ! deallocate(array)
- ! call move_alloc(tempArr, array)
- !else
- ! allocate(array(1))
- ! array(1) = value
- !end if
-
- end subroutine
|