diff --git a/Equipments/MudSystem/Circulation_Code_Select.f90 b/Equipments/MudSystem/Circulation_Code_Select.f90 index c71a0df..8b0bd6f 100644 --- a/Equipments/MudSystem/Circulation_Code_Select.f90 +++ b/Equipments/MudSystem/Circulation_Code_Select.f90 @@ -19,7 +19,7 @@ subroutine CirculationCodeSelect ! is called in subroutine Fluid_Flow_Solver !NewInfluxNumber = NoGasPocket - Flow_timeCounter= Flow_timeCounter+1 + MudSystemDotFlow_timeCounter= MudSystemDotFlow_timeCounter+1 !if (ChokePanelStrokeResetSwitch == 1) then ! Flow_timeCounter= 0 @@ -35,7 +35,7 @@ subroutine CirculationCodeSelect ! is called in subroutine Fluid_Flow_Solver !=================================================================== - iloc= 1 ! will be changed in KickFlux and Migration or Pump and TripIn (save OP Mud data) + MudSystemDotiLoc= 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.) @@ -60,51 +60,51 @@ subroutine CirculationCodeSelect ! is called in subroutine Fluid_Flow_Solver - IF ( NewInfluxNumber > 0 ) THEN + IF ( MudSystemDotNewInfluxNumber > 0 ) THEN !write(*,*) 'KickOffBottom , ROP=' , KickOffBottom , Rate_of_Penetration call Kick_Migration endif ! ============================ must be after migration ============================== - DO KickNumber= NewInfluxNumber-NoGasPocket+1 , NewInfluxNumber + DO MudSystemDotKickNumber= MudSystemDotNewInfluxNumber-NoGasPocket+1 , MudSystemDotNewInfluxNumber ! FINDING NEW KICK LOCATIONS: - Ann_KickLoc= 0 - Op_KickLoc= 0 - ChokeLine_KickLoc= 0 + MudSystemDotAnn_KickLoc= 0 + MudSystemDotOp_KickLoc= 0 + MudSystemDotChokeLine_KickLoc= 0 do i = 1, Ann_MudOrKick%Length () - if (Ann_MudOrKick%Array(i) == KickNumber) then - Ann_KickLoc = i + if (Ann_MudOrKick%Array(i) == MudSystemDotKickNumber) then + MudSystemDotAnn_KickLoc = i exit endif end do do i = 1, Op_MudOrKick%Length () - if (Op_MudOrKick%Array(i) == KickNumber) then - Op_KickLoc = i + if (Op_MudOrKick%Array(i) == MudSystemDotKickNumber) then + MudSystemDotOp_KickLoc = i exit endif end do do i = 1, ChokeLine_MudOrKick%Length () - if (ChokeLine_MudOrKick%Array(i) == KickNumber) then - ChokeLine_KickLoc = i + if (ChokeLine_MudOrKick%Array(i) == MudSystemDotKickNumber) then + MudSystemDotChokeLine_KickLoc = i exit endif end do ! ============================ must be after migration-end =========================== - IF (ALLOCATED(GasPocketWeight%Array) .and. KickNumber == NewInfluxNumber .AND. NOT(KickOffBottom) .AND. WellHeadIsOpen) THEN + IF (ALLOCATED(GasPocketWeight%Array) .and. MudSystemDotKickNumber == MudSystemDotNewInfluxNumber .AND. NOT(KickOffBottom) .AND. WellHeadIsOpen) THEN cycle ELSE IF (ALLOCATED(GasPocketWeight%Array)) THEN - if (((GasPocketDeltaVol%Array(NewInfluxNumber - KickNumber + 1) > 0.0 .AND. WellHeadIsOpen) .or. KickExpansion_DueToMudLost) ) call Kick_Expansion + if (((GasPocketDeltaVol%Array(MudSystemDotNewInfluxNumber - MudSystemDotKickNumber + 1) > 0.0 .AND. WellHeadIsOpen) .or. MudSystemDotKickexpansion_DueToMudLost) ) call Kick_Expansion - if ((GasPocketDeltaVol%Array(NewInfluxNumber - KickNumber + 1) < 0.0 ) .OR. WellHeadIsOpen == .FALSE.) CALL Kick_Contraction + if ((GasPocketDeltaVol%Array(MudSystemDotNewInfluxNumber - MudSystemDotKickNumber + 1) < 0.0 ) .OR. WellHeadIsOpen == .FALSE.) CALL Kick_Contraction ENDIF @@ -114,12 +114,12 @@ subroutine CirculationCodeSelect ! is called in subroutine Fluid_Flow_Solver - LostInTripOutIsDone= .false. + MudSystemDotLostInTripOutIsDone= .false. - if( DeltaVolumeOp >= 0.0 .and. Get_KellyConnection()==KELLY_CONNECTION_STRING) then + if( MudSystemDotDeltaVolumeOp >= 0.0 .and. Get_KellyConnection()==KELLY_CONNECTION_STRING) then !write(*,*) 'DeltaVolumeOp=' , DeltaVolumeOp call Pump_and_TripIn - elseif (DeltaVolumeOp < 0.0) then + elseif (MudSystemDotDeltaVolumeOp < 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 @@ -147,7 +147,7 @@ subroutine CirculationCodeSelect ! is called in subroutine Fluid_Flow_Solver call PlotFinalMudElements MudChecked= .true. - UtubePossibility= .true. + MudSystemDotUtubePossibility= .true. !WRITE(*,*) '***********************************************************************' diff --git a/Equipments/MudSystem/Deallocate_Normal_Circulation.f90 b/Equipments/MudSystem/Deallocate_Normal_Circulation.f90 index 442e8f4..4e7fd65 100644 --- a/Equipments/MudSystem/Deallocate_Normal_Circulation.f90 +++ b/Equipments/MudSystem/Deallocate_Normal_Circulation.f90 @@ -3,45 +3,45 @@ subroutine DEALLOCATE_ARRAYS_NormalCirculation() ! is called in module Fluid implicit none -if(allocated(Xstart_PipeSection)) deallocate(Xstart_PipeSection) -if(allocated(Xend_PipeSection)) deallocate(Xend_PipeSection) -if(allocated(PipeSection_VolumeCapacity)) deallocate(PipeSection_VolumeCapacity) -if(allocated(Area_PipeSectionFt)) deallocate(Area_PipeSectionFt) -if(allocated(OD_PipeSectionInch)) deallocate(OD_PipeSectionInch) -if(allocated(ID_PipeSectionInch)) deallocate(ID_PipeSectionInch) -if(allocated(Xstart_OpSection)) deallocate(Xstart_OpSection) -if(allocated(Xend_OpSection)) deallocate(Xend_OpSection) -if(allocated(Area_OpSectionFt)) deallocate(Area_OpSectionFt) -if(allocated(OD_OpSectionInch)) deallocate(OD_OpSectionInch) -if(allocated(ID_OpSectionInch)) deallocate(ID_OpSectionInch) -if(allocated(OpSection_VolumeCapacity)) deallocate(OpSection_VolumeCapacity) -if(allocated(GeoTypeOp)) deallocate(GeoTypeOp) -if(allocated(GeoType)) deallocate(GeoType) +if(allocated(MudSystemDotXstart_PipeSection)) deallocate(MudSystemDotXstart_PipeSection) +if(allocated(MudSystemDotXend_PipeSection)) deallocate(MudSystemDotXend_PipeSection) +if(allocated(MudSystemDotPipeSection_VolumeCapacity)) deallocate(MudSystemDotPipeSection_VolumeCapacity) +if(allocated(MudSystemDotArea_PipeSectionFt)) deallocate(MudSystemDotArea_PipeSectionFt) +if(allocated(MudSystemDotOD_PipeSectionInch)) deallocate(MudSystemDotOD_PipeSectionInch) +if(allocated(MudSystemDotID_PipeSectionInch)) deallocate(MudSystemDotID_PipeSectionInch) +if(allocated(MudSystemDotXstart_OpSection)) deallocate(MudSystemDotXstart_OpSection) +if(allocated(MudSystemDotXend_OpSection)) deallocate(MudSystemDotXend_OpSection) +if(allocated(MudSystemDotArea_OpSectionFt)) deallocate(MudSystemDotArea_OpSectionFt) +if(allocated(MudSystemDotOD_OpSectionInch)) deallocate(MudSystemDotOD_OpSectionInch) +if(allocated(MudSystemDotID_OpSectionInch)) deallocate(MudSystemDotID_OpSectionInch) +if(allocated(MudSystemDotOpSection_VolumeCapacity)) deallocate(MudSystemDotOpSection_VolumeCapacity) +if(allocated(MudSystemDotGeoTypeOp)) deallocate(MudSystemDotGeoTypeOp) +if(allocated(MudSystemDotGeoType)) deallocate(MudSystemDotGeoType) - call Hz_MudDischarged_Volume%Empty() - call Hz_Mud_Backhead_X%Empty() + call MudSystemDotHz_MudDischarged_Volume%Empty() + call MudSystemDotHz_Mud_Backhead_X%Empty() call Hz_Mud_Backhead_section%Empty() - call Hz_Mud_Forehead_X%Empty() + call MudSystemDotHz_Mud_Forehead_X%Empty() call Hz_Mud_Forehead_section%Empty() - call Hz_Density%Empty() - call Hz_RemainedVolume_in_LastSection%Empty() - call Hz_EmptyVolume_inBackheadLocation%Empty() + call MudSystemDotHz_Density%Empty() + call MudSystemDotHz_RemainedVolume_in_LastSection%Empty() + call MudSystemDotHz_EmptyVolume_inBackheadLocation%Empty() call Hz_MudOrKick%Empty() - call St_MudDischarged_Volume%Empty() - call St_Mud_Backhead_X%Empty() + call MudSystemDotSt_MudDischarged_Volume%Empty() + call MudSystemDotSt_Mud_Backhead_X%Empty() call St_Mud_Backhead_section%Empty() - call St_Mud_Forehead_X%Empty() + call MudSystemDotSt_Mud_Forehead_X%Empty() call St_Mud_Forehead_section%Empty() call St_Density%Empty() - call St_RemainedVolume_in_LastSection%Empty() - call St_EmptyVolume_inBackheadLocation%Empty() + call MudSystemDotSt_RemainedVolume_in_LastSection%Empty() + call MudSystemDotSt_EmptyVolume_inBackheadLocation%Empty() call St_MudOrKick%Empty() - call Ann_MudDischarged_Volume%Empty() + call MudSystemDotAnn_MudDischarged_Volume%Empty() call Ann_Mud_Backhead_X%Empty() call Ann_Mud_Backhead_section%Empty() call Ann_Mud_Forehead_X%Empty() @@ -53,25 +53,25 @@ if(allocated(GeoType)) deallocate(GeoType) call Ann_CuttingMud%Empty() - call Op_MudDischarged_Volume%Empty() - call Op_Mud_Backhead_X%Empty() + call MudSystemDotOp_MudDischarged_Volume%Empty() + call MudSystemDotOp_Mud_Backhead_X%Empty() call Op_Mud_Backhead_section%Empty() - call Op_Mud_Forehead_X%Empty() + call MudSystemDotOp_Mud_Forehead_X%Empty() call Op_Mud_Forehead_section%Empty() - call Op_Density%Empty() - call Op_RemainedVolume_in_LastSection%Empty() - call Op_EmptyVolume_inBackheadLocation%Empty() + call MudSystemDotOp_Density%Empty() + call MudSystemDotOp_RemainedVolume_in_LastSection%Empty() + call MudSystemDotOp_EmptyVolume_inBackheadLocation%Empty() call Op_MudOrKick%Empty() - call ChokeLine_MudDischarged_Volume%Empty() - call ChokeLine_Mud_Backhead_X%Empty() + call MudSystemDotChokeLine_MudDischarged_Volume%Empty() + call MudSystemDotChokeLine_Mud_Backhead_X%Empty() call ChokeLine_Mud_Backhead_section%Empty() - call ChokeLine_Mud_Forehead_X%Empty() + call MudSystemDotChokeLine_Mud_Forehead_X%Empty() call ChokeLine_Mud_Forehead_section%Empty() - call ChokeLine_Density%Empty() - call ChokeLine_RemainedVolume_in_LastSection%Empty() - call ChokeLine_EmptyVolume_inBackheadLocation%Empty() + call MudSystemDotChokeLine_Density%Empty() + call MudSystemDotChokeLine_RemainedVolume_in_LastSection%Empty() + call MudSystemDotChokeLine_EmptyVolume_inBackheadLocation%Empty() call ChokeLine_MudOrKick%Empty() @@ -107,7 +107,7 @@ subroutine RemoveAnnulusMudArrays(ilocal) INTEGER :: ilocal - call Ann_MudDischarged_Volume%Remove (ilocal) + call MudSystemDotAnn_MudDischarged_Volume%Remove (ilocal) call Ann_Mud_Backhead_X%Remove (ilocal) call Ann_Mud_Backhead_section%Remove (ilocal) call Ann_Mud_Forehead_X%Remove (ilocal) @@ -130,14 +130,14 @@ subroutine RemoveStringMudArrays(ilocal) INTEGER :: ilocal - call St_MudDischarged_Volume%Remove (ilocal) - call St_Mud_Backhead_X%Remove (ilocal) + call MudSystemDotSt_MudDischarged_Volume%Remove (ilocal) + call MudSystemDotSt_Mud_Backhead_X%Remove (ilocal) call St_Mud_Backhead_section%Remove (ilocal) - call St_Mud_Forehead_X%Remove (ilocal) + call MudSystemDotSt_Mud_Forehead_X%Remove (ilocal) call St_Mud_Forehead_section%Remove (ilocal) call St_Density%Remove (ilocal) - call St_RemainedVolume_in_LastSection%Remove (ilocal) - call St_EmptyVolume_inBackheadLocation%Remove (ilocal) + call MudSystemDotSt_RemainedVolume_in_LastSection%Remove (ilocal) + call MudSystemDotSt_EmptyVolume_inBackheadLocation%Remove (ilocal) call St_MudOrKick%Remove (ilocal) @@ -152,14 +152,14 @@ subroutine RemoveOpMudArrays(ilocal) INTEGER :: ilocal - call Op_MudDischarged_Volume%Remove (ilocal) - call Op_Mud_Backhead_X%Remove (ilocal) + call MudSystemDotOp_MudDischarged_Volume%Remove (ilocal) + call MudSystemDotOp_Mud_Backhead_X%Remove (ilocal) call Op_Mud_Backhead_section%Remove (ilocal) - call Op_Mud_Forehead_X%Remove (ilocal) + call MudSystemDotOp_Mud_Forehead_X%Remove (ilocal) call Op_Mud_Forehead_section%Remove (ilocal) - call Op_Density%Remove (ilocal) - call Op_RemainedVolume_in_LastSection%Remove (ilocal) - call Op_EmptyVolume_inBackheadLocation%Remove (ilocal) + call MudSystemDotOp_Density%Remove (ilocal) + call MudSystemDotOp_RemainedVolume_in_LastSection%Remove (ilocal) + call MudSystemDotOp_EmptyVolume_inBackheadLocation%Remove (ilocal) call Op_MudOrKick%Remove (ilocal) @@ -173,14 +173,14 @@ subroutine RemoveHzMudArrays(ilocal) INTEGER :: ilocal - call Hz_MudDischarged_Volume%Remove (ilocal) - call Hz_Mud_Backhead_X%Remove (ilocal) + call MudSystemDotHz_MudDischarged_Volume%Remove (ilocal) + call MudSystemDotHz_Mud_Backhead_X%Remove (ilocal) call Hz_Mud_Backhead_section%Remove (ilocal) - call Hz_Mud_Forehead_X%Remove (ilocal) + call MudSystemDotHz_Mud_Forehead_X%Remove (ilocal) call Hz_Mud_Forehead_section%Remove (ilocal) - call Hz_Density%Remove (ilocal) - call Hz_RemainedVolume_in_LastSection%Remove (ilocal) - call Hz_EmptyVolume_inBackheadLocation%Remove (ilocal) + call MudSystemDotHz_Density%Remove (ilocal) + call MudSystemDotHz_RemainedVolume_in_LastSection%Remove (ilocal) + call MudSystemDotHz_EmptyVolume_inBackheadLocation%Remove (ilocal) call Hz_MudOrKick%Remove (ilocal) diff --git a/Equipments/MudSystem/Disconnecting_Pipe.f90 b/Equipments/MudSystem/Disconnecting_Pipe.f90 index 7ee6371..d4644fc 100644 --- a/Equipments/MudSystem/Disconnecting_Pipe.f90 +++ b/Equipments/MudSystem/Disconnecting_Pipe.f90 @@ -21,7 +21,7 @@ subroutine DisconnectingPipe ! is called in subroutine CirculationCodeSelect !TD_RemoveVolume= TD_RemoveVolume* 7.48051948 ! ft^3 to gal - ExcessMudVolume= sum(St_MudDischarged_Volume%Array(:)) - sum(PipeSection_VolumeCapacity(2:F_StringIntervalCounts)) + ExcessMudVolume= sum(MudSystemDotSt_MudDischarged_Volume%Array(:)) - sum(MudSystemDotPipeSection_VolumeCapacity(2:F_StringIntervalCounts)) ! ======if(ExcessMudVolume <= 0.) No Modification Needed Because Removed Pipe was Empty===== @@ -62,36 +62,36 @@ subroutine DisconnectingPipe ! is called in subroutine CirculationCodeSelect ExcessMudVolume_Remained= ExcessMudVolume ! ft^3 to gal - imud=1 + MudSystemDotimud=1 Do - if(St_MudDischarged_Volume%Array(imud) < ExcessMudVolume_Remained) then - ExcessMudVolume_Remained= ExcessMudVolume_Remained- St_MudDischarged_Volume%Array(imud) - call St_MudDischarged_Volume%Remove (imud) - call St_Mud_Backhead_X%Remove (imud) - call St_Mud_Backhead_section%Remove (imud) - call St_Mud_Forehead_X%Remove (imud) - call St_Mud_Forehead_section%Remove (imud) - call St_Density%Remove (imud) - call St_RemainedVolume_in_LastSection%Remove (imud) - call St_EmptyVolume_inBackheadLocation%Remove (imud) - call St_MudOrKick%Remove (imud) + if(MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud) < ExcessMudVolume_Remained) then + ExcessMudVolume_Remained= ExcessMudVolume_Remained- MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud) + call MudSystemDotSt_MudDischarged_Volume%Remove (MudSystemDotimud) + call MudSystemDotSt_Mud_Backhead_X%Remove (MudSystemDotimud) + call St_Mud_Backhead_section%Remove (MudSystemDotimud) + call MudSystemDotSt_Mud_Forehead_X%Remove (MudSystemDotimud) + call St_Mud_Forehead_section%Remove (MudSystemDotimud) + call St_Density%Remove (MudSystemDotimud) + call MudSystemDotSt_RemainedVolume_in_LastSection%Remove (MudSystemDotimud) + call MudSystemDotSt_EmptyVolume_inBackheadLocation%Remove (MudSystemDotimud) + call St_MudOrKick%Remove (MudSystemDotimud) - elseif(St_MudDischarged_Volume%Array(imud) > ExcessMudVolume_Remained) then - St_MudDischarged_Volume%Array(imud)= St_MudDischarged_Volume%Array(imud)- ExcessMudVolume_Remained + elseif(MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud) > ExcessMudVolume_Remained) then + MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud)= MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud)- ExcessMudVolume_Remained exit else !(St_MudDischarged_Volume%Array(imud) == ExcessMudVolume_Remained) - call St_MudDischarged_Volume%Remove (imud) - call St_Mud_Backhead_X%Remove (imud) - call St_Mud_Backhead_section%Remove (imud) - call St_Mud_Forehead_X%Remove (imud) - call St_Mud_Forehead_section%Remove (imud) - call St_Density%Remove (imud) - call St_RemainedVolume_in_LastSection%Remove (imud) - call St_EmptyVolume_inBackheadLocation%Remove (imud) - call St_MudOrKick%Remove (imud) + call MudSystemDotSt_MudDischarged_Volume%Remove (MudSystemDotimud) + call MudSystemDotSt_Mud_Backhead_X%Remove (MudSystemDotimud) + call St_Mud_Backhead_section%Remove (MudSystemDotimud) + call MudSystemDotSt_Mud_Forehead_X%Remove (MudSystemDotimud) + call St_Mud_Forehead_section%Remove (MudSystemDotimud) + call St_Density%Remove (MudSystemDotimud) + call MudSystemDotSt_RemainedVolume_in_LastSection%Remove (MudSystemDotimud) + call MudSystemDotSt_EmptyVolume_inBackheadLocation%Remove (MudSystemDotimud) + call St_MudOrKick%Remove (MudSystemDotimud) exit endif diff --git a/Equipments/MudSystem/Elements_Creation.f90 b/Equipments/MudSystem/Elements_Creation.f90 index 4047c9d..d2bd1fe 100644 --- a/Equipments/MudSystem/Elements_Creation.f90 +++ b/Equipments/MudSystem/Elements_Creation.f90 @@ -24,48 +24,48 @@ subroutine ElementsCreation ! is called in subroutine Fluid_Flow_Solver !===========================================================WELL============================================================ !===========================================================WELL============================================================ - if(allocated(Xstart_PipeSection)) deallocate(Xstart_PipeSection) - if(allocated(Xend_PipeSection)) deallocate(Xend_PipeSection) - if(allocated(PipeSection_VolumeCapacity)) deallocate(PipeSection_VolumeCapacity) - if(allocated(Area_PipeSectionFt)) deallocate(Area_PipeSectionFt) - if(allocated(GeoType)) deallocate(GeoType) - if(allocated(OD_PipeSectionInch)) deallocate(OD_PipeSectionInch) - if(allocated(ID_PipeSectionInch)) deallocate(ID_PipeSectionInch) - if(allocated(Angle_PipeSection)) deallocate(Angle_PipeSection) - - if(allocated(Xstart_OpSection)) deallocate(Xstart_OpSection) - if(allocated(Xend_OpSection)) deallocate(Xend_OpSection) - if(allocated(OpSection_VolumeCapacity)) deallocate(OpSection_VolumeCapacity) - if(allocated(Area_OpSectionFt)) deallocate(Area_OpSectionFt) - if(allocated(GeoTypeOp)) deallocate(GeoTypeOp) - if(allocated(OD_OpSectionInch)) deallocate(OD_OpSectionInch) - if(allocated(ID_OpSectionInch)) deallocate(ID_OpSectionInch) - if(allocated(Angle_OpSection)) deallocate(Angle_OpSection) + if(allocated(MudSystemDotXstart_PipeSection)) deallocate(MudSystemDotXstart_PipeSection) + if(allocated(MudSystemDotXend_PipeSection)) deallocate(MudSystemDotXend_PipeSection) + if(allocated(MudSystemDotPipeSection_VolumeCapacity)) deallocate(MudSystemDotPipeSection_VolumeCapacity) + if(allocated(MudSystemDotArea_PipeSectionFt)) deallocate(MudSystemDotArea_PipeSectionFt) + if(allocated(MudSystemDotGeoType)) deallocate(MudSystemDotGeoType) + if(allocated(MudSystemDotOD_PipeSectionInch)) deallocate(MudSystemDotOD_PipeSectionInch) + if(allocated(MudSystemDotID_PipeSectionInch)) deallocate(MudSystemDotID_PipeSectionInch) + if(allocated(MudSystemDotAngle_PipeSection)) deallocate(MudSystemDotAngle_PipeSection) + + if(allocated(MudSystemDotXstart_OpSection)) deallocate(MudSystemDotXstart_OpSection) + if(allocated(MudSystemDotXend_OpSection)) deallocate(MudSystemDotXend_OpSection) + if(allocated(MudSystemDotOpSection_VolumeCapacity)) deallocate(MudSystemDotOpSection_VolumeCapacity) + if(allocated(MudSystemDotArea_OpSectionFt)) deallocate(MudSystemDotArea_OpSectionFt) + if(allocated(MudSystemDotGeoTypeOp)) deallocate(MudSystemDotGeoTypeOp) + if(allocated(MudSystemDotOD_OpSectionInch)) deallocate(MudSystemDotOD_OpSectionInch) + if(allocated(MudSystemDotID_OpSectionInch)) deallocate(MudSystemDotID_OpSectionInch) + if(allocated(MudSystemDotAngle_OpSection)) deallocate(MudSystemDotAngle_OpSection) -ALLOCATE (Xstart_PipeSection(F_StringIntervalCounts+F_AnnulusIntervalCounts),Xend_PipeSection(F_StringIntervalCounts+F_AnnulusIntervalCounts) & - ,PipeSection_VolumeCapacity(F_StringIntervalCounts+F_AnnulusIntervalCounts),Area_PipeSectionFt(F_StringIntervalCounts+F_AnnulusIntervalCounts), & - GeoType(F_StringIntervalCounts+F_AnnulusIntervalCounts),OD_PipeSectionInch(F_StringIntervalCounts+F_AnnulusIntervalCounts),ID_PipeSectionInch(F_StringIntervalCounts+F_AnnulusIntervalCounts)) +ALLOCATE (MudSystemDotXstart_PipeSection(F_StringIntervalCounts+F_AnnulusIntervalCounts),MudSystemDotXend_PipeSection(F_StringIntervalCounts+F_AnnulusIntervalCounts) & + ,MudSystemDotPipeSection_VolumeCapacity(F_StringIntervalCounts+F_AnnulusIntervalCounts),MudSystemDotArea_PipeSectionFt(F_StringIntervalCounts+F_AnnulusIntervalCounts), & + MudSystemDotGeoType(F_StringIntervalCounts+F_AnnulusIntervalCounts),MudSystemDotOD_PipeSectionInch(F_StringIntervalCounts+F_AnnulusIntervalCounts),MudSystemDotID_PipeSectionInch(F_StringIntervalCounts+F_AnnulusIntervalCounts)) -ALLOCATE (Xstart_OpSection(F_BottomHoleIntervalCounts),Xend_OpSection(F_BottomHoleIntervalCounts) & - ,OpSection_VolumeCapacity(F_BottomHoleIntervalCounts),Area_OpSectionFt(F_BottomHoleIntervalCounts), & - GeoTypeOp(F_BottomHoleIntervalCounts),OD_OpSectionInch(F_BottomHoleIntervalCounts),ID_OpSectionInch(F_BottomHoleIntervalCounts)) +ALLOCATE (MudSystemDotXstart_OpSection(F_BottomHoleIntervalCounts),MudSystemDotXend_OpSection(F_BottomHoleIntervalCounts) & + ,MudSystemDotOpSection_VolumeCapacity(F_BottomHoleIntervalCounts),MudSystemDotArea_OpSectionFt(F_BottomHoleIntervalCounts), & + MudSystemDotGeoTypeOp(F_BottomHoleIntervalCounts),MudSystemDotOD_OpSectionInch(F_BottomHoleIntervalCounts),MudSystemDotID_OpSectionInch(F_BottomHoleIntervalCounts)) - OpSection=0 - isection=0 + MudSystemDotOpSection=0 + MudSystemDotisection=0 - DO iisection=1, F_IntervalsTotalCounts - IF (F_Interval(iisection)%GeoType == 1) THEN - OpSection= OpSection+1 - Xstart_OpSection(OpSection)= (F_Interval(iisection)%StartDepth) - Xend_OpSection(OpSection)= (F_Interval(iisection)%EndDepth) - Area_OpSectionFt(OpSection)= PII*((F_Interval(iisection)%OD/12.0d0)**2-(F_Interval(iisection)%ID/12.0d0)**2)/4.0d0 !D(in), AREA(ft^2) - OD_OpSectionInch(OpSection)= (F_Interval(iisection)%OD) - ID_OpSectionInch(OpSection)= (F_Interval(iisection)%ID) !REAL(F_Interval(iisection)%Volume) - GeoTypeOp(OpSection)= F_Interval(iisection)%GeoType ! niaz nist ehtemalan + DO MudSystemDotiisection=1, F_IntervalsTotalCounts + IF (F_Interval(MudSystemDotiisection)%GeoType == 1) THEN + MudSystemDotOpSection= MudSystemDotOpSection+1 + MudSystemDotXstart_OpSection(MudSystemDotOpSection)= (F_Interval(MudSystemDotiisection)%StartDepth) + MudSystemDotXend_OpSection(MudSystemDotOpSection)= (F_Interval(MudSystemDotiisection)%EndDepth) + MudSystemDotArea_OpSectionFt(MudSystemDotOpSection)= PII*((F_Interval(MudSystemDotiisection)%OD/12.0d0)**2-(F_Interval(MudSystemDotiisection)%ID/12.0d0)**2)/4.0d0 !D(in), AREA(ft^2) + MudSystemDotOD_OpSectionInch(MudSystemDotOpSection)= (F_Interval(MudSystemDotiisection)%OD) + MudSystemDotID_OpSectionInch(MudSystemDotOpSection)= (F_Interval(MudSystemDotiisection)%ID) !REAL(F_Interval(iisection)%Volume) + MudSystemDotGeoTypeOp(MudSystemDotOpSection)= F_Interval(MudSystemDotiisection)%GeoType ! niaz nist ehtemalan !Angle_OpSection(OpSection)= F_Interval(iisection)%Angle !write(*,*) 'iisection=' , iisection !write(*,*) 'StartDepth=' , F_Interval(iisection)%StartDepth @@ -73,17 +73,17 @@ ALLOCATE (Xstart_OpSection(F_BottomHoleIntervalCounts),Xend_OpSection(F_BottomHo !write(*,*) 'OD=' , F_Interval(iisection)%OD !write(*,*) 'ID=' , F_Interval(iisection)%ID ELSE - isection= isection+1 - Xstart_PipeSection(isection)= (F_Interval(iisection)%StartDepth) + MudSystemDotisection= MudSystemDotisection+1 + MudSystemDotXstart_PipeSection(MudSystemDotisection)= (F_Interval(MudSystemDotiisection)%StartDepth) !write(*,*) 'F_Interval(iisection)%StartDepth=' , F_Interval(iisection)%StartDepth - Xend_PipeSection(isection)= (F_Interval(iisection)%EndDepth) + MudSystemDotXend_PipeSection(MudSystemDotisection)= (F_Interval(MudSystemDotiisection)%EndDepth) !write(*,*) 'F_Interval(iisection)%EndDepth=' , F_Interval(iisection)%EndDepth - OD_PipeSectionInch(isection)= (F_Interval(iisection)%OD) - Area_PipeSectionFt(isection)= PII*((F_Interval(iisection)%OD/12.0d0)**2-(F_Interval(iisection)%ID/12.0d0)**2)/4.0d0 !D(in), AREA(ft^2) - ID_PipeSectionInch(isection)= (F_Interval(iisection)%ID) + MudSystemDotOD_PipeSectionInch(MudSystemDotisection)= (F_Interval(MudSystemDotiisection)%OD) + MudSystemDotArea_PipeSectionFt(MudSystemDotisection)= PII*((F_Interval(MudSystemDotiisection)%OD/12.0d0)**2-(F_Interval(MudSystemDotiisection)%ID/12.0d0)**2)/4.0d0 !D(in), AREA(ft^2) + MudSystemDotID_PipeSectionInch(MudSystemDotisection)= (F_Interval(MudSystemDotiisection)%ID) !PipeSection_VolumeCapacity(isection)= Area_PipeSectionFt(isection)* ABS(Xend_PipeSection(isection)-Xstart_PipeSection(isection))* 7.48051948 !REAL(F_Interval(iisection)%Volume) ! (gal) - GeoType(isection)= F_Interval(iisection)%GeoType + MudSystemDotGeoType(MudSystemDotisection)= F_Interval(MudSystemDotiisection)%GeoType !Angle_PipeSection(isection)= F_Interval(iisection)%Angle ENDIF @@ -92,33 +92,33 @@ ALLOCATE (Xstart_OpSection(F_BottomHoleIntervalCounts),Xend_OpSection(F_BottomHo call Xstart_MudElement%Empty() - call Xstart_MudElement%Add(Xstart_PipeSection(1)) + call Xstart_MudElement%Add(MudSystemDotXstart_PipeSection(1)) call Xstart_OpMudElement%Empty() - call Xstart_OpMudElement%Add(Xstart_OpSection(1)) + call Xstart_OpMudElement%Add(MudSystemDotXstart_OpSection(1)) call TVDstart_MudElement%Empty() - call TVD_Calculator(Xstart_PipeSection(1),MudCircVerticalDepth) - call TVDstart_MudElement%Add(MudCircVerticalDepth) + call TVD_Calculator(MudSystemDotXstart_PipeSection(1),MudSystemDotMudCircVerticalDepth) + call TVDstart_MudElement%Add(MudSystemDotMudCircVerticalDepth) call TVDstart_OPMudElement%Empty() - call TVD_Calculator(Xstart_OpSection(1),MudCircVerticalDepth) - call TVDstart_OPMudElement%Add(MudCircVerticalDepth) + call TVD_Calculator(MudSystemDotXstart_OpSection(1),MudSystemDotMudCircVerticalDepth) + call TVDstart_OPMudElement%Add(MudSystemDotMudCircVerticalDepth) - NoPipeSections= isection ! sections in string and annulus(GeoType 0 & 2) + MudSystemDotNoPipeSections= MudSystemDotisection ! sections in string and annulus(GeoType 0 & 2) - DO OpSection= 1,F_BottomHoleIntervalCounts - OpSection_VolumeCapacity(OpSection)= Area_OpSectionFt(OpSection)* ABS(Xend_OpSection(OpSection)-Xstart_OpSection(OpSection))* 7.48051948d0 !REAL(F_Interval(iisection)%Volume) + DO MudSystemDotOpSection= 1,F_BottomHoleIntervalCounts + MudSystemDotOpSection_VolumeCapacity(MudSystemDotOpSection)= MudSystemDotArea_OpSectionFt(MudSystemDotOpSection)* ABS(MudSystemDotXend_OpSection(MudSystemDotOpSection)-MudSystemDotXstart_OpSection(MudSystemDotOpSection))* 7.48051948d0 !REAL(F_Interval(iisection)%Volume) ENDDO - DO isection= 1,NoPipeSections - PipeSection_VolumeCapacity(isection)= Area_PipeSectionFt(isection)* ABS(Xend_PipeSection(isection)-Xstart_PipeSection(isection))* 7.48051948d0 !REAL(F_Interval(iisection)%Volume) ! (gal) + DO MudSystemDotisection= 1,MudSystemDotNoPipeSections + MudSystemDotPipeSection_VolumeCapacity(MudSystemDotisection)= MudSystemDotArea_PipeSectionFt(MudSystemDotisection)* ABS(MudSystemDotXend_PipeSection(MudSystemDotisection)-MudSystemDotXstart_PipeSection(MudSystemDotisection))* 7.48051948d0 !REAL(F_Interval(iisection)%Volume) ! (gal) ENDDO @@ -127,71 +127,71 @@ ALLOCATE (Xstart_OpSection(F_BottomHoleIntervalCounts),Xend_OpSection(F_BottomHo !types: Mud= 0 Kick=1 !=========================================== - if (FirstMudSet==0) then - call Hz_MudDischarged_Volume%AddToFirst(PipeSection_VolumeCapacity(1)) !startup initial - call Hz_Mud_Backhead_X%AddToFirst (Xstart_PipeSection(1)) + if (MudSystemDotFirstMudSet==0) then + call MudSystemDotHz_MudDischarged_Volume%AddToFirst(MudSystemDotPipeSection_VolumeCapacity(1)) !startup initial + call MudSystemDotHz_Mud_Backhead_X%AddToFirst (MudSystemDotXstart_PipeSection(1)) call Hz_Mud_Backhead_section%AddToFirst (1) - call Hz_Mud_Forehead_X%AddToFirst (Xend_PipeSection(1)) + call MudSystemDotHz_Mud_Forehead_X%AddToFirst (MudSystemDotXend_PipeSection(1)) call Hz_Mud_Forehead_section%AddToFirst (1) - call Hz_Density%AddToFirst (MudProperties%ActiveDensity) ! initial(ppg) - call Hz_RemainedVolume_in_LastSection%AddToFirst (0.0d0) - call Hz_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) + call MudSystemDotHz_Density%AddToFirst (MudProperties%ActiveDensity) ! initial(ppg) + call MudSystemDotHz_RemainedVolume_in_LastSection%AddToFirst (0.0d0) + call MudSystemDotHz_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) call Hz_MudOrKick%AddToFirst (0) - call St_MudDischarged_Volume%AddToFirst(sum(PipeSection_VolumeCapacity(2:F_StringIntervalCounts))) !startup initial - call St_Mud_Backhead_X%AddToFirst (Xstart_PipeSection(2)) + call MudSystemDotSt_MudDischarged_Volume%AddToFirst(sum(MudSystemDotPipeSection_VolumeCapacity(2:F_StringIntervalCounts))) !startup initial + call MudSystemDotSt_Mud_Backhead_X%AddToFirst (MudSystemDotXstart_PipeSection(2)) call St_Mud_Backhead_section%AddToFirst (2) - call St_Mud_Forehead_X%AddToFirst (Xend_PipeSection(F_StringIntervalCounts)) + call MudSystemDotSt_Mud_Forehead_X%AddToFirst (MudSystemDotXend_PipeSection(F_StringIntervalCounts)) call St_Mud_Forehead_section%AddToFirst (F_StringIntervalCounts) call St_Density%AddToFirst (MudProperties%ActiveDensity) ! initial(ppg) - call St_RemainedVolume_in_LastSection%AddToFirst (0.0d0) - call St_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) + call MudSystemDotSt_RemainedVolume_in_LastSection%AddToFirst (0.0d0) + call MudSystemDotSt_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) call St_MudOrKick%AddToFirst (0) - call Ann_MudDischarged_Volume%AddToFirst(sum(PipeSection_VolumeCapacity(F_StringIntervalCounts+1:NoPipeSections))) - call Ann_Mud_Backhead_X%AddToFirst (Xstart_PipeSection(F_StringIntervalCounts+1)) + call MudSystemDotAnn_MudDischarged_Volume%AddToFirst(sum(MudSystemDotPipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystemDotNoPipeSections))) + call Ann_Mud_Backhead_X%AddToFirst (MudSystemDotXstart_PipeSection(F_StringIntervalCounts+1)) call Ann_Mud_Backhead_section%AddToFirst (F_StringIntervalCounts+1) - call Ann_Mud_Forehead_X%AddToFirst (Xend_PipeSection(NoPipeSections)) - call Ann_Mud_Forehead_section%AddToFirst (NoPipeSections) + call Ann_Mud_Forehead_X%AddToFirst (MudSystemDotXend_PipeSection(MudSystemDotNoPipeSections)) + call Ann_Mud_Forehead_section%AddToFirst (MudSystemDotNoPipeSections) call Ann_Density%AddToFirst (MudProperties%ActiveDensity) ! initial(ppg) call Ann_RemainedVolume_in_LastSection%AddToFirst (0.0d0) call Ann_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) call Ann_MudOrKick%AddToFirst (0) call Ann_CuttingMud%AddToFirst (0) - OldPosition= Xend_PipeSection(F_StringIntervalCounts) + MudSystemDotOldPosition= MudSystemDotXend_PipeSection(F_StringIntervalCounts) - OldAnnulusCapacity= sum(PipeSection_VolumeCapacity(F_StringIntervalCounts+1:NoPipeSections)) + MudSystemDotOldAnnulusCapacity= sum(MudSystemDotPipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystemDotNoPipeSections)) - call ChokeLine_MudDischarged_Volume%AddToFirst(ChokeLine_VolumeCapacity) - call ChokeLine_Mud_Backhead_X%AddToFirst (0.0d0) + call MudSystemDotChokeLine_MudDischarged_Volume%AddToFirst(MudSystemDotChokeLine_VolumeCapacity) + call MudSystemDotChokeLine_Mud_Backhead_X%AddToFirst (0.0d0) call ChokeLine_Mud_Backhead_section%AddToFirst (1) - call ChokeLine_Mud_Forehead_X%AddToFirst (BopStackSpecification%ChokeLineLength) + call MudSystemDotChokeLine_Mud_Forehead_X%AddToFirst (BopStackSpecification%ChokeLineLength) call ChokeLine_Mud_Forehead_section%AddToFirst (1) - call ChokeLine_Density%AddToFirst (MudProperties%ActiveDensity) ! initial(ppg) - call ChokeLine_RemainedVolume_in_LastSection%AddToFirst (0.0d0) - call ChokeLine_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) + call MudSystemDotChokeLine_Density%AddToFirst (MudProperties%ActiveDensity) ! initial(ppg) + call MudSystemDotChokeLine_RemainedVolume_in_LastSection%AddToFirst (0.0d0) + call MudSystemDotChokeLine_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) call ChokeLine_MudOrKick%AddToFirst (0) - call Op_MudDischarged_Volume%AddToFirst (sum(OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts))) - call Op_Mud_Backhead_X%AddToFirst (Xstart_OpSection(1)) + call MudSystemDotOp_MudDischarged_Volume%AddToFirst (sum(MudSystemDotOpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts))) + call MudSystemDotOp_Mud_Backhead_X%AddToFirst (MudSystemDotXstart_OpSection(1)) call Op_Mud_Backhead_section%AddToFirst (1) - call Op_Mud_Forehead_X%AddToFirst (Xend_OpSection(F_BottomHoleIntervalCounts)) + call MudSystemDotOp_Mud_Forehead_X%AddToFirst (MudSystemDotXend_OpSection(F_BottomHoleIntervalCounts)) call Op_Mud_Forehead_section%AddToFirst (F_BottomHoleIntervalCounts) - call Op_Density%AddToFirst (MudProperties%ActiveDensity) - call Op_RemainedVolume_in_LastSection%AddToFirst (0.0d0) - call Op_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) + call MudSystemDotOp_Density%AddToFirst (MudProperties%ActiveDensity) + call MudSystemDotOp_RemainedVolume_in_LastSection%AddToFirst (0.0d0) + call MudSystemDotOp_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) call Op_MudOrKick%AddToFirst (0) !F_StringIntervalCountsOld= F_StringIntervalCounts ! is used for adding new pipe to string - F_StringIntervalCounts_Old= F_StringIntervalCounts ! is used for adding new pipe to string + MudSystemDotF_StringIntervalCounts_Old= F_StringIntervalCounts ! is used for adding new pipe to string - FirstMudSet= 1 + MudSystemDotFirstMudSet= 1 endif @@ -201,16 +201,16 @@ ALLOCATE (Xstart_OpSection(F_BottomHoleIntervalCounts),Xend_OpSection(F_BottomHo !DeltaVolumeOp < 0 : Trip out - DeltaVolumeOp= ((Xend_PipeSection(F_StringIntervalCounts)-OldPosition)*PII*((OD_PipeSectionInch(F_StringIntervalCounts+1)/12.0d0)**2)/4.0d0)* 7.48051948d0! ft^3 to gal ! D(in) - DeltaVolumeOp = INT(DeltaVolumeOp * 100000.d0) / 100000.d0 + MudSystemDotDeltaVolumeOp= ((MudSystemDotXend_PipeSection(F_StringIntervalCounts)-MudSystemDotOldPosition)*PII*((MudSystemDotOD_PipeSectionInch(F_StringIntervalCounts+1)/12.0d0)**2)/4.0d0)* 7.48051948d0! ft^3 to gal ! D(in) + MudSystemDotDeltaVolumeOp = INT(MudSystemDotDeltaVolumeOp * 100000.d0) / 100000.d0 - DeltaVolumePipe= ((Xend_PipeSection(F_StringIntervalCounts)-OldPosition)*PII*((ID_PipeSectionInch(F_StringIntervalCounts+F_AnnulusIntervalCounts)/12.0d0)**2)/4.0d0)* 7.48051948d0! ft^3 to gal - DeltaVolumePipe = INT(DeltaVolumePipe * 100000.d0) / 100000.d0 + MudSystemDotDeltaVolumePipe= ((MudSystemDotXend_PipeSection(F_StringIntervalCounts)-MudSystemDotOldPosition)*PII*((MudSystemDotID_PipeSectionInch(F_StringIntervalCounts+F_AnnulusIntervalCounts)/12.0d0)**2)/4.0d0)* 7.48051948d0! ft^3 to gal + MudSystemDotDeltaVolumePipe = INT(MudSystemDotDeltaVolumePipe * 100000.d0) / 100000.d0 !DeltaVolumeAnnulusCapacity= ((Xend_PipeSection(F_StringIntervalCounts)-OldPosition))*Area_PipeSectionFt(NoPipeSections)* 7.48051948d0! ft^3 to gal - DrillStringSpeed = (Xend_PipeSection(F_StringIntervalCounts)-OldPosition) / 0.1 + DrillStringSpeed = (MudSystemDotXend_PipeSection(F_StringIntervalCounts)-MudSystemDotOldPosition) / 0.1 - DeltaVolumeAnnulusCapacity= sum(PipeSection_VolumeCapacity(F_StringIntervalCounts+1:NoPipeSections)) - OldAnnulusCapacity + MudSystemDotDeltaVolumeAnnulusCapacity= sum(MudSystemDotPipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystemDotNoPipeSections)) - MudSystemDotOldAnnulusCapacity !write(*,*) 'DeltaVolumeAnnulusCapacity= ' , DeltaVolumeAnnulusCapacity @@ -224,32 +224,32 @@ ALLOCATE (Xstart_OpSection(F_BottomHoleIntervalCounts),Xend_OpSection(F_BottomHo - OldAnnulusCapacity= sum(PipeSection_VolumeCapacity(F_StringIntervalCounts+1:NoPipeSections)) + MudSystemDotOldAnnulusCapacity= sum(MudSystemDotPipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystemDotNoPipeSections)) - OldPosition= Xend_PipeSection(F_StringIntervalCounts) + MudSystemDotOldPosition= MudSystemDotXend_PipeSection(F_StringIntervalCounts) ! Needed for trip in or out: - if (Hz_Mud_Backhead_X%Length() == 0) then + if (MudSystemDotHz_Mud_Backhead_X%Length() == 0) then CALL ErrorStop('Hz_Mud_Backhead_X Length is 0') endif - Hz_Mud_Backhead_X%Array(1)= Xstart_PipeSection(1) + MudSystemDotHz_Mud_Backhead_X%Array(1)= MudSystemDotXstart_PipeSection(1) Hz_Mud_Backhead_section%Array(1)= 1 - AddedElementsToString = F_StringIntervalCounts - F_StringIntervalCounts_Old - St_Mud_Backhead_X%Array(1)= Xstart_PipeSection(2) + MudSystemDotAddedElementsToString = F_StringIntervalCounts - MudSystemDotF_StringIntervalCounts_Old + MudSystemDotSt_Mud_Backhead_X%Array(1)= MudSystemDotXstart_PipeSection(2) St_Mud_Backhead_section%Array(1)= 2 - Ann_Mud_Backhead_X%Array(1)= Xstart_PipeSection(F_StringIntervalCounts+1) + Ann_Mud_Backhead_X%Array(1)= MudSystemDotXstart_PipeSection(F_StringIntervalCounts+1) Ann_Mud_Backhead_section%Array(1)= F_StringIntervalCounts+1 - Op_Mud_Backhead_X%Array(1)= Xstart_OpSection(1) + MudSystemDotOp_Mud_Backhead_X%Array(1)= MudSystemDotXstart_OpSection(1) Op_Mud_Backhead_section%Array(1)= 1 - ChokeLine_Mud_Backhead_X%Array(1)= 0. + MudSystemDotChokeLine_Mud_Backhead_X%Array(1)= 0. ChokeLine_Mud_Backhead_section%Array(1)= 1 - F_StringIntervalCounts_Old= F_StringIntervalCounts + MudSystemDotF_StringIntervalCounts_Old= F_StringIntervalCounts !write(*,*) 'Xstart_PipeSection(2)' , Xstart_PipeSection(2) !write(*,*) 'Xend_PipeSection(1)' , Xend_PipeSection(1) diff --git a/Equipments/MudSystem/FillingWell_By_BellNipple.f90 b/Equipments/MudSystem/FillingWell_By_BellNipple.f90 index 77f5cee..1b50414 100644 --- a/Equipments/MudSystem/FillingWell_By_BellNipple.f90 +++ b/Equipments/MudSystem/FillingWell_By_BellNipple.f90 @@ -38,26 +38,26 @@ subroutine FillingWell_By_BellNipple ! is called in subroutine CirculationCo FillingDensity= BellNippleDensity !**************************** - if ( Ann_MudDischarged_Volume%Last() > (((MUD(8)%Q+MUD(10)%Q)/60.)*DeltaT_Mudline)) then ! air baghi mimune + if ( MudSystemDotAnn_MudDischarged_Volume%Last() > (((MUD(8)%Q+MUD(10)%Q)/60.)*DeltaT_Mudline)) then ! air baghi mimune - kloc= Ann_MudDischarged_Volume%Length()-1 + kloc= MudSystemDotAnn_MudDischarged_Volume%Length()-1 deltaV= ((MUD(8)%Q+MUD(10)%Q)/60.)*DeltaT_Mudline - Ann_MudDischarged_Volume%Array(Ann_MudDischarged_Volume%Length())= Ann_MudDischarged_Volume%Array(Ann_MudDischarged_Volume%Length()) - deltaV + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotAnn_MudDischarged_Volume%Length())= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotAnn_MudDischarged_Volume%Length()) - deltaV !========================ANNULUS ENTRANCE==================== - if (ABS(Ann_Density%Array(kloc) - FillingDensity) >= DensityMixTol) then ! new mud is pumped + if (ABS(Ann_Density%Array(kloc) - FillingDensity) >= MudSystemDotDensityMixTol) then ! new mud is pumped call Ann_Density%AddTo (kloc, FillingDensity) - call Ann_MudDischarged_Volume%AddTo (kloc, 0.0d0) + call MudSystemDotAnn_MudDischarged_Volume%AddTo (kloc, 0.0d0) call Ann_Mud_Forehead_X%AddTo (kloc, 0.0d0) call Ann_Mud_Forehead_section%AddTo (kloc, 1) call Ann_Mud_Backhead_X%AddTo (kloc, 0.0d0) - call Ann_Mud_Backhead_section%AddTo (kloc, NoPipeSections) + call Ann_Mud_Backhead_section%AddTo (kloc, MudSystemDotNoPipeSections) call Ann_RemainedVolume_in_LastSection%AddTo (kloc, 0.0d0) call Ann_EmptyVolume_inBackheadLocation%AddTo (kloc, 0.0d0) call Ann_MudOrKick%AddTo (kloc, 0) @@ -68,7 +68,7 @@ subroutine FillingWell_By_BellNipple ! is called in subroutine CirculationCo !========================ANNULUS==================== - Ann_MudDischarged_Volume%Array(kloc)= Ann_MudDischarged_Volume%Array(kloc)+ deltaV !(gal) + MudSystemDotAnn_MudDischarged_Volume%Array(kloc)= MudSystemDotAnn_MudDischarged_Volume%Array(kloc)+ deltaV !(gal) @@ -77,23 +77,23 @@ subroutine FillingWell_By_BellNipple ! is called in subroutine CirculationCo - kloc= Ann_MudDischarged_Volume%Length()-1 + kloc= MudSystemDotAnn_MudDischarged_Volume%Length()-1 - deltaV= Ann_MudDischarged_Volume%Last() + deltaV= MudSystemDotAnn_MudDischarged_Volume%Last() - if (ABS(Ann_Density%Array(kloc)-FillingDensity)< DensityMixTol .and. Ann_CuttingMud%Array(kloc)==0) then ! .OR. (Ann_MudDischarged_Volume%Array(kloc)< 42.) ) then ! 1-Pockets are Merged - Ann_Density%Array(kloc)= (Ann_Density%Array(kloc)*Ann_MudDischarged_Volume%Array(kloc)+FillingDensity*deltaV)/(Ann_MudDischarged_Volume%Array(kloc)+deltaV) - Ann_MudDischarged_Volume%Array(kloc)= Ann_MudDischarged_Volume%Array(kloc)+deltaV - Ann_Mud_Forehead_X%Array(kloc)= Xend_PipeSection(NoPipeSections) - Ann_Mud_Forehead_section%Array(kloc)= NoPipeSections + if (ABS(Ann_Density%Array(kloc)-FillingDensity)< MudSystemDotDensityMixTol .and. Ann_CuttingMud%Array(kloc)==0) then ! .OR. (Ann_MudDischarged_Volume%Array(kloc)< 42.) ) then ! 1-Pockets are Merged + Ann_Density%Array(kloc)= (Ann_Density%Array(kloc)*MudSystemDotAnn_MudDischarged_Volume%Array(kloc)+FillingDensity*deltaV)/(MudSystemDotAnn_MudDischarged_Volume%Array(kloc)+deltaV) + MudSystemDotAnn_MudDischarged_Volume%Array(kloc)= MudSystemDotAnn_MudDischarged_Volume%Array(kloc)+deltaV + Ann_Mud_Forehead_X%Array(kloc)= MudSystemDotXend_PipeSection(MudSystemDotNoPipeSections) + Ann_Mud_Forehead_section%Array(kloc)= MudSystemDotNoPipeSections !Ann_Mud_Backhead_X%Array(kloc)= no change !Ann_Mud_Backhead_section%Array(kloc)= no change Ann_RemainedVolume_in_LastSection%Array(kloc)= (0.0) Ann_EmptyVolume_inBackheadLocation%Array(kloc)= (0.0) - call Ann_MudDischarged_Volume%Remove (kloc+1) + call MudSystemDotAnn_MudDischarged_Volume%Remove (kloc+1) call Ann_Mud_Backhead_X%Remove (kloc+1) call Ann_Mud_Backhead_section%Remove (kloc+1) call Ann_Mud_Forehead_X%Remove (kloc+1) @@ -131,7 +131,7 @@ subroutine FillingWell_By_BellNipple ! is called in subroutine CirculationCo deltaV= ((MUD(8)%Q+MUD(10)%Q)/60.)*DeltaT_Mudline - kloc= Ann_MudDischarged_Volume%Length() + kloc= MudSystemDotAnn_MudDischarged_Volume%Length() @@ -139,11 +139,11 @@ subroutine FillingWell_By_BellNipple ! is called in subroutine CirculationCo !========================ANNULUS ENTRANCE==================== - if (ABS(Ann_Density%Last() - FillingDensity) >= DensityMixTol .or. Ann_CuttingMud%Last()==1) then ! .OR. (Ann_MudDischarged_Volume%Array(kloc)>42.) ) then ! new mud is pumped + if (ABS(Ann_Density%Last() - FillingDensity) >= MudSystemDotDensityMixTol .or. Ann_CuttingMud%Last()==1) then ! .OR. (Ann_MudDischarged_Volume%Array(kloc)>42.) ) then ! new mud is pumped Xposition= Ann_Mud_Forehead_X%Last() SectionPosition= Ann_Mud_Forehead_section%Last() call Ann_Density%Add (FillingDensity) - call Ann_MudDischarged_Volume%Add (0.0d0) + call MudSystemDotAnn_MudDischarged_Volume%Add (0.0d0) call Ann_Mud_Forehead_X%Add (Xposition) call Ann_Mud_Forehead_section%Add (SectionPosition) call Ann_Mud_Backhead_X%Add (Xposition) @@ -158,12 +158,12 @@ subroutine FillingWell_By_BellNipple ! is called in subroutine CirculationCo !========================ANNULUS==================== - Ann_MudDischarged_Volume%Array(Ann_MudDischarged_Volume%Length())= Ann_MudDischarged_Volume%Array(Ann_MudDischarged_Volume%Length())+ deltaV !(gal) + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotAnn_MudDischarged_Volume%Length())= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotAnn_MudDischarged_Volume%Length())+ deltaV !(gal) else ! Merged with last Mud - Ann_Density%Array(kloc)= (Ann_Density%Array(kloc)*Ann_MudDischarged_Volume%Array(kloc)+FillingDensity*deltaV)/(Ann_MudDischarged_Volume%Array(kloc)+deltaV) - Ann_MudDischarged_Volume%Array(kloc)= Ann_MudDischarged_Volume%Array(kloc)+deltaV + Ann_Density%Array(kloc)= (Ann_Density%Array(kloc)*MudSystemDotAnn_MudDischarged_Volume%Array(kloc)+FillingDensity*deltaV)/(MudSystemDotAnn_MudDischarged_Volume%Array(kloc)+deltaV) + MudSystemDotAnn_MudDischarged_Volume%Array(kloc)= MudSystemDotAnn_MudDischarged_Volume%Array(kloc)+deltaV !Ann_Mud_Forehead_X%Array(kloc)= Xend_PipeSection(NoPipeSections) !Ann_Mud_Forehead_section%Array(kloc)= NoPipeSections !Ann_Mud_Backhead_X%Array(kloc)= no change diff --git a/Equipments/MudSystem/Kick_Expansion_and_Contraction.f90 b/Equipments/MudSystem/Kick_Expansion_and_Contraction.f90 index 1166d23..9aee879 100644 --- a/Equipments/MudSystem/Kick_Expansion_and_Contraction.f90 +++ b/Equipments/MudSystem/Kick_Expansion_and_Contraction.f90 @@ -18,19 +18,19 @@ subroutine Kick_Expansion ! is called in subroutine CirculationCodeSelect !write(*,*) 'Kick Expansion' -ExpansionVolume= GasPocketDeltaVol%Array(NewInfluxNumber - KickNumber + 1) * 7.48 +ExpansionVolume= GasPocketDeltaVol%Array(MudSystemDotNewInfluxNumber - MudSystemDotKickNumber + 1) * 7.48 -IF ( Kickexpansion_DueToMudLost ) ExpansionVolume = ((Qlost/60.0d0)*DeltaT_Mudline) +IF ( MudSystemDotKickexpansion_DueToMudLost ) ExpansionVolume = ((MudSystemDotQlost/60.0d0)*DeltaT_Mudline) !============================== kick zire mate bashad ============================== - if (Op_KickLoc > 0 .and. Ann_KickLoc==0) then ! .and. Op_KickLoc /= Op_MudOrKick%Length ()) then + if (MudSystemDotOp_KickLoc > 0 .and. MudSystemDotAnn_KickLoc==0) then ! .and. Op_KickLoc /= Op_MudOrKick%Length ()) then !write(*,*) 'expansion (1)' - Op_MudDischarged_Volume%Array(Op_KickLoc)= Op_MudDischarged_Volume%Array(Op_KickLoc)+ ExpansionVolume + MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc)= MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc)+ ExpansionVolume !if (MUD(4)%Q > 0.) then @@ -58,14 +58,14 @@ IF ( Kickexpansion_DueToMudLost ) ExpansionVolume = ((Qlost/60.0d0)*DeltaT_Mud !============================= foreheade dar fazaye annulus bashad =========================== ! agar kick be entehaye annulus reside bashe, expansion ra emaal nemikonim - if (Ann_KickLoc > 0) then ! .and. Ann_KickLoc /= Ann_MudOrKick%Length ()) then + if (MudSystemDotAnn_KickLoc > 0) then ! .and. Ann_KickLoc /= Ann_MudOrKick%Length ()) then !write(*,*) 'expansion (2)' !if ( sum(Ann_MudDischarged_Volume%Array(1:Ann_KickLoc)) + ExpansionVolume > sum(PipeSection_VolumeCapacity(F_StringIntervalCounts+1:NoPipeSections)) ) then ! agar khast az mate rad kone ! ExpansionVolume= sum(PipeSection_VolumeCapacity(F_StringIntervalCounts+1:NoPipeSections)) - sum(Ann_MudDischarged_Volume%Array(1:Ann_KickLoc)) !endif - Ann_MudDischarged_Volume%Array(Ann_KickLoc)= Ann_MudDischarged_Volume%Array(Ann_KickLoc)+ ExpansionVolume + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotAnn_KickLoc)= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotAnn_KickLoc)+ ExpansionVolume !if (MUD(4)%Q > 0.) then ! @@ -95,9 +95,9 @@ IF ( Kickexpansion_DueToMudLost ) ExpansionVolume = ((Qlost/60.0d0)*DeltaT_Mud !=============================== foreheade dar choke line bashad ============================= - if (ChokeLine_KickLoc > 0 .and. Ann_KickLoc==0) then + if (MudSystemDotChokeLine_KickLoc > 0 .and. MudSystemDotAnn_KickLoc==0) then - ChokeLine_MudDischarged_Volume%Array(ChokeLine_KickLoc)= ChokeLine_MudDischarged_Volume%Array(ChokeLine_KickLoc)+ ExpansionVolume + MudSystemDotChokeLine_MudDischarged_Volume%Array(MudSystemDotChokeLine_KickLoc)= MudSystemDotChokeLine_MudDischarged_Volume%Array(MudSystemDotChokeLine_KickLoc)+ ExpansionVolume endif @@ -152,12 +152,12 @@ subroutine Kick_Contraction ! is called in subroutine CirculationCodeSelect !write(*,*) 'Kick Contraction' !MUD(2)%Q= total_pumps%Total_Pump_GPM - StringFlowRate= MUD(2)%Q - AnnulusFlowRate= MUD(2)%Q + MudSystemDotStringFlowRate= MUD(2)%Q + MudSystemDotAnnulusFlowRate= MUD(2)%Q - if (NewPipeFilling == 0) then - StringFlowRate= 0. - AnnulusFlowRate= 0. + if (MudSystemDotNewPipeFilling == 0) then + MudSystemDotStringFlowRate= 0. + MudSystemDotAnnulusFlowRate= 0. endif @@ -165,10 +165,10 @@ subroutine Kick_Contraction ! is called in subroutine CirculationCodeSelect !if (WellHeadIsOpen) then - ContractionVolume= - GasPocketDeltaVol%Array(NewInfluxNumber - KickNumber + 1) * 7.48 + ContractionVolume= - GasPocketDeltaVol%Array(MudSystemDotNewInfluxNumber - MudSystemDotKickNumber + 1) * 7.48 !else !ContractionVolume = (StringFlowRate/60.0d0)*DeltaT_Mudline + DeltaVolumePipe - if (KickNumber == 1 .and. WellHeadIsOpen==.false.) ContractionVolume = ContractionVolume + (StringFlowRate/60.0d0)*DeltaT_Mudline + DeltaVolumePipe + if (MudSystemDotKickNumber == 1 .and. WellHeadIsOpen==.false.) ContractionVolume = ContractionVolume + (MudSystemDotStringFlowRate/60.0d0)*DeltaT_Mudline + MudSystemDotDeltaVolumePipe !endif @@ -176,43 +176,43 @@ subroutine Kick_Contraction ! is called in subroutine CirculationCodeSelect ! pump mud is added in "pump&TripIn" code - IF (Op_KickLoc > 0 .and. Ann_KickLoc == 0) then ! All of kick is under bit (iloc == 1) + IF (MudSystemDotOp_KickLoc > 0 .and. MudSystemDotAnn_KickLoc == 0) then ! All of kick is under bit (iloc == 1) - Op_MudDischarged_Volume%Array(Op_KickLoc)= Op_MudDischarged_Volume%Array(Op_KickLoc) - ( ContractionVolume ) + MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc)= MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc) - ( ContractionVolume ) - ELSE IF (Op_KickLoc == 0 .AND. Ann_KickLoc > 0 .AND. ChokeLine_KickLoc == 0) THEN ! All of kick is an Annulus (iloc == 1) + ELSE IF (MudSystemDotOp_KickLoc == 0 .AND. MudSystemDotAnn_KickLoc > 0 .AND. MudSystemDotChokeLine_KickLoc == 0) THEN ! All of kick is an Annulus (iloc == 1) - Ann_MudDischarged_Volume%Array(Ann_KickLoc)= Ann_MudDischarged_Volume%Array(Ann_KickLoc) - ( ContractionVolume ) + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotAnn_KickLoc)= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotAnn_KickLoc) - ( ContractionVolume ) - ELSE IF (Ann_KickLoc == 0 .AND. ChokeLine_KickLoc > 0) THEN ! kick is in chokeline only + ELSE IF (MudSystemDotAnn_KickLoc == 0 .AND. MudSystemDotChokeLine_KickLoc > 0) THEN ! kick is in chokeline only - ChokeLine_MudDischarged_Volume%Array(ChokeLine_KickLoc)= ChokeLine_MudDischarged_Volume%Array(ChokeLine_KickLoc) - ( ContractionVolume ) + MudSystemDotChokeLine_MudDischarged_Volume%Array(MudSystemDotChokeLine_KickLoc)= MudSystemDotChokeLine_MudDischarged_Volume%Array(MudSystemDotChokeLine_KickLoc) - ( ContractionVolume ) - ELSE IF (Op_KickLoc > 0 .AND. Ann_KickLoc > 0) THEN ! Kick is around bit (iloc==2) + ELSE IF (MudSystemDotOp_KickLoc > 0 .AND. MudSystemDotAnn_KickLoc > 0) THEN ! Kick is around bit (iloc==2) - if (Ann_MudDischarged_Volume%Array(1) > ContractionVolume ) then + if (MudSystemDotAnn_MudDischarged_Volume%Array(1) > ContractionVolume ) then - Ann_MudDischarged_Volume%Array(1)= Ann_MudDischarged_Volume%Array(1) - ( ContractionVolume ) + MudSystemDotAnn_MudDischarged_Volume%Array(1)= MudSystemDotAnn_MudDischarged_Volume%Array(1) - ( ContractionVolume ) - elseif (Op_MudDischarged_Volume%Last() > ContractionVolume ) then + elseif (MudSystemDotOp_MudDischarged_Volume%Last() > ContractionVolume ) then - Op_MudDischarged_Volume%Array(Op_MudDischarged_Volume%Length())= Op_MudDischarged_Volume%Array(Op_MudDischarged_Volume%Length()) - ( ContractionVolume ) + MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_MudDischarged_Volume%Length())= MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_MudDischarged_Volume%Length()) - ( ContractionVolume ) else Call ErrorStop ('kick contraction error 1') endif - ELSE IF (Ann_KickLoc > 0 .AND. ChokeLine_KickLoc > 0) THEN + ELSE IF (MudSystemDotAnn_KickLoc > 0 .AND. MudSystemDotChokeLine_KickLoc > 0) THEN - if (ChokeLine_MudDischarged_Volume%Array(1) > ContractionVolume ) then + if (MudSystemDotChokeLine_MudDischarged_Volume%Array(1) > ContractionVolume ) then - ChokeLine_MudDischarged_Volume%Array(1) = ChokeLine_MudDischarged_Volume%Array(1) - ( ContractionVolume ) + MudSystemDotChokeLine_MudDischarged_Volume%Array(1) = MudSystemDotChokeLine_MudDischarged_Volume%Array(1) - ( ContractionVolume ) - elseif (Ann_MudDischarged_Volume%Last() > ContractionVolume ) then + elseif (MudSystemDotAnn_MudDischarged_Volume%Last() > ContractionVolume ) then - Ann_MudDischarged_Volume%Array(Ann_MudDischarged_Volume%Length())= Ann_MudDischarged_Volume%Array(Ann_MudDischarged_Volume%Length()) - ( ContractionVolume ) + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotAnn_MudDischarged_Volume%Length())= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotAnn_MudDischarged_Volume%Length()) - ( ContractionVolume ) else Call ErrorStop ('kick contraction error 2') diff --git a/Equipments/MudSystem/Kick_Influx.f90 b/Equipments/MudSystem/Kick_Influx.f90 index 48033e8..765057d 100644 --- a/Equipments/MudSystem/Kick_Influx.f90 +++ b/Equipments/MudSystem/Kick_Influx.f90 @@ -22,27 +22,27 @@ subroutine Kick_Influx ! is called in subroutine CirculationCodeSelect !=================== Bottom Hole Kick Influx ENTRANCE(due to Kick) =================== - Kick_Density= 2 - NewInflux_Density= Kick_Density + MudSystemDotKick_Density= 2 + MudSystemDotNewInflux_Density= MudSystemDotKick_Density - if ( NewInfluxElementCreated==0 ) then ! new kick is pumped- (it is set to zero in sheykh subroutine after a new kick influx) - call Op_Density%AddToFirst (NewInflux_Density) - call Op_MudDischarged_Volume%AddToFirst (0.0d0) - call Op_Mud_Forehead_X%AddToFirst (Xstart_OpSection(1)) + if ( MudSystemDotNewInfluxElementCreated==0 ) then ! new kick is pumped- (it is set to zero in sheykh subroutine after a new kick influx) + call MudSystemDotOp_Density%AddToFirst (MudSystemDotNewInflux_Density) + call MudSystemDotOp_MudDischarged_Volume%AddToFirst (0.0d0) + call MudSystemDotOp_Mud_Forehead_X%AddToFirst (MudSystemDotXstart_OpSection(1)) call Op_Mud_Forehead_section%AddToFirst (1) - call Op_Mud_Backhead_X%AddToFirst (Xstart_OpSection(1)) + call MudSystemDotOp_Mud_Backhead_X%AddToFirst (MudSystemDotXstart_OpSection(1)) call Op_Mud_Backhead_section%AddToFirst (1) - call Op_RemainedVolume_in_LastSection%AddToFirst (0.0d0) - call Op_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) - call Op_MudOrKick%AddToFirst (NewInfluxNumber) ! KickNumber= NewInfluxNumber + call MudSystemDotOp_RemainedVolume_in_LastSection%AddToFirst (0.0d0) + call MudSystemDotOp_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) + call Op_MudOrKick%AddToFirst (MudSystemDotNewInfluxNumber) ! KickNumber= NewInfluxNumber - NewInfluxElementCreated= 1 + MudSystemDotNewInfluxElementCreated= 1 endif - Op_MudDischarged_Volume%Array(1)= Op_MudDischarged_Volume%Array(1)+ ((GasKickPumpFlowRate/60.0d0)*DeltaT_Mudline) !(gal) due to KickFlux + MudSystemDotOp_MudDischarged_Volume%Array(1)= MudSystemDotOp_MudDischarged_Volume%Array(1)+ ((GasKickPumpFlowRate/60.0d0)*DeltaT_Mudline) !(gal) due to KickFlux !write(*,*) 'kick volume ok=' , Op_MudDischarged_Volume%Array(1) @@ -79,13 +79,13 @@ subroutine Instructor_CirculationMud_Edit ! is called in subroutine Circulat - if ( DownHole%AnnDrillMud == .true. .and. (Rate_of_Penetration>0. .and. DeltaVolumeOp>0.0) ) then + if ( DownHole%AnnDrillMud == .true. .and. (Rate_of_Penetration>0. .and. MudSystemDotDeltaVolumeOp>0.0) ) then - do imud= 1, Ann_Density%Length() + do MudSystemDotimud= 1, Ann_Density%Length() - if ( Ann_MudOrKick%Array(imud) == 0 ) then - Ann_Density%Array(imud)= (St_Density%Last() * AnnulusFlowRate + 141.4296E-4*Rate_of_Penetration*Diameter_of_Bit**2)/(AnnulusFlowRate+6.7995E-4*Rate_of_Penetration*Diameter_of_Bit**2) - Ann_CuttingMud%Array(imud)= 1 + if ( Ann_MudOrKick%Array(MudSystemDotimud) == 0 ) then + Ann_Density%Array(MudSystemDotimud)= (St_Density%Last() * MudSystemDotAnnulusFlowRate + 141.4296E-4*Rate_of_Penetration*Diameter_of_Bit**2)/(MudSystemDotAnnulusFlowRate+6.7995E-4*Rate_of_Penetration*Diameter_of_Bit**2) + Ann_CuttingMud%Array(MudSystemDotimud)= 1 endif enddo @@ -95,18 +95,18 @@ subroutine Instructor_CirculationMud_Edit ! is called in subroutine Circulat if ( DownHole%AnnCirculateMud == .true. ) then - do imud= 1, Ann_Density%Length() + do MudSystemDotimud= 1, Ann_Density%Length() - if ( Ann_MudOrKick%Array(imud) == 0 ) then - Ann_Density%Array(imud)= ActiveTankDensity - Ann_CuttingMud%Array(imud)= 0 + if ( Ann_MudOrKick%Array(MudSystemDotimud) == 0 ) then + Ann_Density%Array(MudSystemDotimud)= ActiveTankDensity + Ann_CuttingMud%Array(MudSystemDotimud)= 0 endif enddo - do imud= 1, St_Density%Length() + do MudSystemDotimud= 1, St_Density%Length() - St_Density%Array(imud)= ActiveTankDensity + St_Density%Array(MudSystemDotimud)= ActiveTankDensity enddo @@ -138,28 +138,28 @@ subroutine ShoeLostSub ! is called in subroutine CirculationCodeSelect implicit none - ShoeLost= .false. - Kickexpansion_DueToMudLost= .false. + MudSystemDotShoeLost= .false. + MudSystemDotKickexpansion_DueToMudLost= .false. - ShoeMudPressure= PressureGauges(5) + MudSystemDotShoeMudPressure= PressureGauges(5) - UGBOSuccessionCounter = UGBOSuccessionCounter + 1 + MudSystemDotUGBOSuccessionCounter = MudSystemDotUGBOSuccessionCounter + 1 !write(*,*) 'check point 1' - if (Shoe%InactiveFracture == .FALSE. .AND. ((ShoeMudPressure >= FormationLostPressure) .or. ShoeFractured )) then + if (Shoe%InactiveFracture == .FALSE. .AND. ((MudSystemDotShoeMudPressure >= MudSystemDotFormationLostPressure) .or. MudSystemDotShoeFractured )) then !write(*,*) 'check point 2 ,UGBOSuccessionCounter' , UGBOSuccessionCounter ! if ShoeFractured changed to true , then time counter is not needed more - if ( UGBOSuccessionCounter /= UGBOSuccessionCounterOld+1 .and. ShoeFractured==.false. ) then - UGBOSuccessionCounter = 0 ! also in starup - UGBOSuccessionCounterOld = 0 ! also in starup + if ( MudSystemDotUGBOSuccessionCounter /= MudSystemDotUGBOSuccessionCounterOld+1 .and. MudSystemDotShoeFractured==.false. ) then + MudSystemDotUGBOSuccessionCounter = 0 ! also in starup + MudSystemDotUGBOSuccessionCounterOld = 0 ! also in starup return else - UGBOSuccessionCounterOld= UGBOSuccessionCounter + MudSystemDotUGBOSuccessionCounterOld= MudSystemDotUGBOSuccessionCounter endif - if ( UGBOSuccessionCounter < 10 .and. ShoeFractured==.false.) then + if ( MudSystemDotUGBOSuccessionCounter < 10 .and. MudSystemDotShoeFractured==.false.) then return endif @@ -167,30 +167,30 @@ subroutine ShoeLostSub ! is called in subroutine CirculationCodeSelect - ShoeFractured= .true. + MudSystemDotShoeFractured= .true. - ShoeMudViscosity= MAX(ShoeMudViscosity, 12.d0) + MudSystemDotShoeMudViscosity= MAX(MudSystemDotShoeMudViscosity, 12.d0) !write(*,*) 'ShoeMudDensity , ShoeMudViscosity' , ShoeMudDensity , ShoeMudViscosity - ShoeLostCoef = 10.**(-8) * 1.15741d0 * 7.08d0 * 1000000.d0 * 1.d0 * ShoeMudDensity / & - (ShoeMudViscosity * LOG(10000.d0)) + MudSystemDotShoeLostCoef = 10.**(-8) * 1.15741d0 * 7.08d0 * 1000000.d0 * 1.d0 * MudSystemDotShoeMudDensity / & + (MudSystemDotShoeMudViscosity * LOG(10000.d0)) !write(*,*) 'lost parameters 1' , ShoeMudPressure , FormationLostPressure - Qlost = MAX( (ShoeLostCoef * (ShoeMudPressure - (FormationLostPressure/2.0))) , 0.d0 ) - if (Qlost > 0.0) then - ShoeLost= .true. + MudSystemDotQlost = MAX( (MudSystemDotShoeLostCoef * (MudSystemDotShoeMudPressure - (MudSystemDotFormationLostPressure/2.0))) , 0.d0 ) + if (MudSystemDotQlost > 0.0) then + MudSystemDotShoeLost= .true. else - ShoeLost= .false. + MudSystemDotShoeLost= .false. endif !write(*,*) 'Qlost=' , Qlost, ShoeMudPressure, FormationLostPressure call Activate_UndergroundBlowout() - do imud= 1, Ann_Mud_Forehead_X%Length() + do MudSystemDotimud= 1, Ann_Mud_Forehead_X%Length() - IF ( ShoeLost .and. Shoe%ShoeDepth < Ann_Mud_Backhead_X%Array(imud) .and. Shoe%ShoeDepth >= Ann_Mud_Forehead_X%Array(imud) & - .and. Ann_MudOrKick%Array(imud) == 0 .and. WellHeadIsOpen == .FALSE. ) then + IF ( MudSystemDotShoeLost .and. Shoe%ShoeDepth < Ann_Mud_Backhead_X%Array(MudSystemDotimud) .and. Shoe%ShoeDepth >= Ann_Mud_Forehead_X%Array(MudSystemDotimud) & + .and. Ann_MudOrKick%Array(MudSystemDotimud) == 0 .and. WellHeadIsOpen == .FALSE. ) then - Kickexpansion_DueToMudLost= .true. + MudSystemDotKickexpansion_DueToMudLost= .true. write(*,*) 'Kickexpansion_DueToMudLost' EXIT @@ -204,7 +204,7 @@ subroutine ShoeLostSub ! is called in subroutine CirculationCodeSelect endif - if (UndergroundBlowout == .false.) ShoeLost= .false. + if (UndergroundBlowout == .false.) MudSystemDotShoeLost= .false. diff --git a/Equipments/MudSystem/Kick_Migration.f90 b/Equipments/MudSystem/Kick_Migration.f90 index f8d9040..eeef520 100644 --- a/Equipments/MudSystem/Kick_Migration.f90 +++ b/Equipments/MudSystem/Kick_Migration.f90 @@ -39,12 +39,12 @@ subroutine Kick_Migration ! is called in subroutine CirculationCodeSelect !FirstSetKickMigration !write(*,*) 'NewInfluxNumber=' , NewInfluxNumber -DO KickNumber= NewInfluxNumber-NoGasPocket+1 , NewInfluxNumber +DO MudSystemDotKickNumber= MudSystemDotNewInfluxNumber-NoGasPocket+1 , MudSystemDotNewInfluxNumber !write(*,*) 'KickNumber=' , KickNumber - if (KickFlux .AND. NOT(KickOffBottom) .and. KickNumber == NewInfluxNumber) cycle + if (KickFlux .AND. NOT(KickOffBottom) .and. MudSystemDotKickNumber == MudSystemDotNewInfluxNumber) cycle - if ( KickNumber == Ann_MudOrKick%Last() ) cycle ! when the last element in Annulus is kick, Migration is not called + if ( MudSystemDotKickNumber == Ann_MudOrKick%Last() ) cycle ! when the last element in Annulus is kick, Migration is not called !write(*,*) 'Migration will be done for,KickNumber=' ,KickNumber @@ -53,28 +53,28 @@ DO KickNumber= NewInfluxNumber-NoGasPocket+1 , NewInfluxNumber !KickDx= (AutoMigrationRate/60.)*DeltaT_Mudline !3600 (ft/min)= 6 ft set in start up - Op_KickLoc= 0 - Ann_KickLoc= 0 - ChokeLine_KickLoc= 0 + MudSystemDotOp_KickLoc= 0 + MudSystemDotAnn_KickLoc= 0 + MudSystemDotChokeLine_KickLoc= 0 do i = 1, Op_MudOrKick%Length () - if (Op_MudOrKick%Array(i) == KickNumber) then - Op_KickLoc = i + if (Op_MudOrKick%Array(i) == MudSystemDotKickNumber) then + MudSystemDotOp_KickLoc = i exit endif end do do i = 1, Ann_MudOrKick%Length () - if (Ann_MudOrKick%Array(i) == KickNumber) then - Ann_KickLoc = i + if (Ann_MudOrKick%Array(i) == MudSystemDotKickNumber) then + MudSystemDotAnn_KickLoc = i exit endif end do do i = 1, ChokeLine_MudOrKick%Length () - if (ChokeLine_MudOrKick%Array(i) == KickNumber) then - ChokeLine_KickLoc = i + if (ChokeLine_MudOrKick%Array(i) == MudSystemDotKickNumber) then + MudSystemDotChokeLine_KickLoc = i exit endif end do @@ -93,114 +93,114 @@ DO KickNumber= NewInfluxNumber-NoGasPocket+1 , NewInfluxNumber !============================== foreheade kick be mate reside bashad *3 ============================== - if (Op_KickLoc == Op_MudOrKick%Length () .and. Ann_KickLoc==0 ) then + if (MudSystemDotOp_KickLoc == Op_MudOrKick%Length () .and. MudSystemDotAnn_KickLoc==0 ) then !write(*,*) '****3' - iloc= 2 + MudSystemDotiLoc= 2 - KickDv= Area_OpSectionFt(Op_Mud_Forehead_section%Array(Op_KickLoc)) * KickDx * 7.48051948d0 ! ft^3 to gal + MudSystemDotKickDv= MudSystemDotArea_OpSectionFt(Op_Mud_Forehead_section%Array(MudSystemDotOp_KickLoc)) * MudSystemDotKickDx * 7.48051948d0 ! ft^3 to gal - MinKickDv= min( KickDv,Ann_MudDischarged_Volume%Array (1), Op_MudDischarged_Volume%Last () ) + MudSystemDotMinKickDv= min( MudSystemDotKickDv,MudSystemDotAnn_MudDischarged_Volume%Array (1), MudSystemDotOp_MudDischarged_Volume%Last () ) NewDensity= Ann_Density%Array (1) - NewVolume= MinKickDv + MudSystemDotNewVolume= MudSystemDotMinKickDv - if ( MinKickDv == KickDv ) then !eleman bala sari baghi mimund, paeeni(kick) ham baghi mimund + if ( MudSystemDotMinKickDv == MudSystemDotKickDv ) then !eleman bala sari baghi mimund, paeeni(kick) ham baghi mimund - Ann_MudDischarged_Volume%Array (1)= Ann_MudDischarged_Volume%Array (1) - MinKickDv + MudSystemDotAnn_MudDischarged_Volume%Array (1)= MudSystemDotAnn_MudDischarged_Volume%Array (1) - MudSystemDotMinKickDv - call Ann_Density%AddToFirst (Op_Density%Last()) - call Ann_MudDischarged_Volume%AddToFirst (MinKickDv) - call Ann_Mud_Forehead_X%AddToFirst (Xstart_PipeSection(F_StringIntervalCounts+1)) + call Ann_Density%AddToFirst (MudSystemDotOp_Density%Last()) + call MudSystemDotAnn_MudDischarged_Volume%AddToFirst (MudSystemDotMinKickDv) + call Ann_Mud_Forehead_X%AddToFirst (MudSystemDotXstart_PipeSection(F_StringIntervalCounts+1)) call Ann_Mud_Forehead_section%AddToFirst (F_StringIntervalCounts+1) - call Ann_Mud_Backhead_X%AddToFirst (Xstart_PipeSection(F_StringIntervalCounts+1)) + call Ann_Mud_Backhead_X%AddToFirst (MudSystemDotXstart_PipeSection(F_StringIntervalCounts+1)) call Ann_Mud_Backhead_section%AddToFirst (F_StringIntervalCounts+1) call Ann_RemainedVolume_in_LastSection%AddToFirst (0.0d0) call Ann_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) - call Ann_MudOrKick%AddToFirst (KickNumber) + call Ann_MudOrKick%AddToFirst (MudSystemDotKickNumber) call Ann_CuttingMud%AddToFirst (0) - Op_MudDischarged_Volume%Array (Op_KickLoc)= Op_MudDischarged_Volume%Array (Op_KickLoc) - MinKickDv + MudSystemDotOp_MudDischarged_Volume%Array (MudSystemDotOp_KickLoc)= MudSystemDotOp_MudDischarged_Volume%Array (MudSystemDotOp_KickLoc) - MudSystemDotMinKickDv ! backheade kick zire mate bashad - if (Op_KickLoc > 1) then + if (MudSystemDotOp_KickLoc > 1) then !if ( Op_Density%Array (Op_KickLoc-1) /= NewDensity ) then - if ( ABS(Op_Density%Array (Op_KickLoc-1) - NewDensity) >= DensityMixTol ) then + if ( ABS(MudSystemDotOp_Density%Array (MudSystemDotOp_KickLoc-1) - NewDensity) >= MudSystemDotDensityMixTol ) then - Old_KickBackHead_X= Op_Mud_Backhead_X%Array (Op_KickLoc) - Old_KickBackHead_Section= Op_Mud_Backhead_section%Array (Op_KickLoc) + MudSystemDotOld_KickBackHead_X= MudSystemDotOp_Mud_Backhead_X%Array (MudSystemDotOp_KickLoc) + MudSystemDotOld_KickBackHead_Section= Op_Mud_Backhead_section%Array (MudSystemDotOp_KickLoc) - call Op_Density%AddTo (Op_KickLoc,NewDensity) - call Op_MudDischarged_Volume%AddTo (Op_KickLoc,NewVolume) - call Op_Mud_Forehead_X%AddTo (Op_KickLoc,Old_KickBackHead_X) - call Op_Mud_Forehead_section%AddTo (Op_KickLoc,Old_KickBackHead_Section) - call Op_Mud_Backhead_X%AddTo (Op_KickLoc,Old_KickBackHead_X) - call Op_Mud_Backhead_section%AddTo (Op_KickLoc,Old_KickBackHead_Section) - call Op_RemainedVolume_in_LastSection%AddTo (Op_KickLoc,0.0d0) - call Op_EmptyVolume_inBackheadLocation%AddTo (Op_KickLoc,0.0d0) - call Op_MudOrKick%AddTo (Op_KickLoc,0) + call MudSystemDotOp_Density%AddTo (MudSystemDotOp_KickLoc,NewDensity) + call MudSystemDotOp_MudDischarged_Volume%AddTo (MudSystemDotOp_KickLoc,MudSystemDotNewVolume) + call MudSystemDotOp_Mud_Forehead_X%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_X) + call Op_Mud_Forehead_section%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_Mud_Backhead_X%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_X) + call Op_Mud_Backhead_section%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_RemainedVolume_in_LastSection%AddTo (MudSystemDotOp_KickLoc,0.0d0) + call MudSystemDotOp_EmptyVolume_inBackheadLocation%AddTo (MudSystemDotOp_KickLoc,0.0d0) + call Op_MudOrKick%AddTo (MudSystemDotOp_KickLoc,0) else !Op_Density%Array (imudKick-1) == NewDensity - Op_Density%Array(Op_KickLoc-1)= (Op_Density%Array(Op_KickLoc-1)*Op_MudDischarged_Volume%Array(Op_KickLoc-1)+NewDensity*NewVolume)/(Op_MudDischarged_Volume%Array(Op_KickLoc-1)+NewVolume) - Op_MudDischarged_Volume%Array(Op_KickLoc-1)= Op_MudDischarged_Volume%Array(Op_KickLoc-1) + NewVolume + MudSystemDotOp_Density%Array(MudSystemDotOp_KickLoc-1)= (MudSystemDotOp_Density%Array(MudSystemDotOp_KickLoc-1)*MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1)+NewDensity*MudSystemDotNewVolume)/(MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1)+MudSystemDotNewVolume) + MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1)= MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1) + MudSystemDotNewVolume endif else !if Op_KickLoc == 1 (*****Migration Start*****) *3-1=============================== !write(*,*) '****3-1' - call Op_Density%AddToFirst (NewDensity) - call Op_MudDischarged_Volume%AddToFirst (NewVolume) - call Op_Mud_Forehead_X%AddToFirst (Old_KickBackHead_X) - call Op_Mud_Forehead_section%AddToFirst (Old_KickBackHead_Section) - call Op_Mud_Backhead_X%AddToFirst (Old_KickBackHead_X) - call Op_Mud_Backhead_section%AddToFirst (Old_KickBackHead_Section) - call Op_RemainedVolume_in_LastSection%AddToFirst (0.0d0) - call Op_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) + call MudSystemDotOp_Density%AddToFirst (NewDensity) + call MudSystemDotOp_MudDischarged_Volume%AddToFirst (MudSystemDotNewVolume) + call MudSystemDotOp_Mud_Forehead_X%AddToFirst (MudSystemDotOld_KickBackHead_X) + call Op_Mud_Forehead_section%AddToFirst (MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_Mud_Backhead_X%AddToFirst (MudSystemDotOld_KickBackHead_X) + call Op_Mud_Backhead_section%AddToFirst (MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_RemainedVolume_in_LastSection%AddToFirst (0.0d0) + call MudSystemDotOp_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) call Op_MudOrKick%AddToFirst (0) endif - elseif ( MinKickDv == Ann_MudDischarged_Volume%Array (1) ) then ! eleman bala sari baghi nemimund + elseif ( MudSystemDotMinKickDv == MudSystemDotAnn_MudDischarged_Volume%Array (1) ) then ! eleman bala sari baghi nemimund - Ann_Density%Array(1)= Op_Density%Last() - Ann_MudOrKick%Array(1)= KickNumber + Ann_Density%Array(1)= MudSystemDotOp_Density%Last() + Ann_MudOrKick%Array(1)= MudSystemDotKickNumber - Op_MudDischarged_Volume%Array (Op_KickLoc)= Op_MudDischarged_Volume%Array (Op_KickLoc) - MinKickDv + MudSystemDotOp_MudDischarged_Volume%Array (MudSystemDotOp_KickLoc)= MudSystemDotOp_MudDischarged_Volume%Array (MudSystemDotOp_KickLoc) - MudSystemDotMinKickDv ! backheade kick zire mate bashad - if (Op_KickLoc > 1) then + if (MudSystemDotOp_KickLoc > 1) then !if ( Op_Density%Array (Op_KickLoc-1) /= NewDensity ) then - if ( ABS(Op_Density%Array (Op_KickLoc-1) - NewDensity) >= DensityMixTol ) then + if ( ABS(MudSystemDotOp_Density%Array (MudSystemDotOp_KickLoc-1) - NewDensity) >= MudSystemDotDensityMixTol ) then - Old_KickBackHead_X= Op_Mud_Backhead_X%Array (Op_KickLoc) - Old_KickBackHead_Section= Op_Mud_Backhead_section%Array (Op_KickLoc) + MudSystemDotOld_KickBackHead_X= MudSystemDotOp_Mud_Backhead_X%Array (MudSystemDotOp_KickLoc) + MudSystemDotOld_KickBackHead_Section= Op_Mud_Backhead_section%Array (MudSystemDotOp_KickLoc) - call Op_Density%AddTo (Op_KickLoc,NewDensity) - call Op_MudDischarged_Volume%AddTo (Op_KickLoc,NewVolume) - call Op_Mud_Forehead_X%AddTo (Op_KickLoc,Old_KickBackHead_X) - call Op_Mud_Forehead_section%AddTo (Op_KickLoc,Old_KickBackHead_Section) - call Op_Mud_Backhead_X%AddTo (Op_KickLoc,Old_KickBackHead_X) - call Op_Mud_Backhead_section%AddTo (Op_KickLoc,Old_KickBackHead_Section) - call Op_RemainedVolume_in_LastSection%AddTo (Op_KickLoc,0.0d0) - call Op_EmptyVolume_inBackheadLocation%AddTo (Op_KickLoc,0.0d0) - call Op_MudOrKick%AddTo (Op_KickLoc,0) + call MudSystemDotOp_Density%AddTo (MudSystemDotOp_KickLoc,NewDensity) + call MudSystemDotOp_MudDischarged_Volume%AddTo (MudSystemDotOp_KickLoc,MudSystemDotNewVolume) + call MudSystemDotOp_Mud_Forehead_X%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_X) + call Op_Mud_Forehead_section%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_Mud_Backhead_X%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_X) + call Op_Mud_Backhead_section%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_RemainedVolume_in_LastSection%AddTo (MudSystemDotOp_KickLoc,0.0d0) + call MudSystemDotOp_EmptyVolume_inBackheadLocation%AddTo (MudSystemDotOp_KickLoc,0.0d0) + call Op_MudOrKick%AddTo (MudSystemDotOp_KickLoc,0) else !Op_Density%Array (imudKick-1) == NewDensity - Op_Density%Array(Op_KickLoc-1)= (Op_Density%Array(Op_KickLoc-1)*Op_MudDischarged_Volume%Array(Op_KickLoc-1)+NewDensity*NewVolume)/(Op_MudDischarged_Volume%Array(Op_KickLoc-1)+NewVolume) - Op_MudDischarged_Volume%Array(Op_KickLoc-1)= Op_MudDischarged_Volume%Array(Op_KickLoc-1) + NewVolume + MudSystemDotOp_Density%Array(MudSystemDotOp_KickLoc-1)= (MudSystemDotOp_Density%Array(MudSystemDotOp_KickLoc-1)*MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1)+NewDensity*MudSystemDotNewVolume)/(MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1)+MudSystemDotNewVolume) + MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1)= MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1) + MudSystemDotNewVolume endif @@ -208,87 +208,87 @@ DO KickNumber= NewInfluxNumber-NoGasPocket+1 , NewInfluxNumber !write(*,*) '****3-2' - call Op_Density%AddToFirst (NewDensity) - call Op_MudDischarged_Volume%AddToFirst (NewVolume) - call Op_Mud_Forehead_X%AddToFirst (Old_KickBackHead_X) - call Op_Mud_Forehead_section%AddToFirst (Old_KickBackHead_Section) - call Op_Mud_Backhead_X%AddToFirst (Old_KickBackHead_X) - call Op_Mud_Backhead_section%AddToFirst (Old_KickBackHead_Section) - call Op_RemainedVolume_in_LastSection%AddToFirst (0.0d0) - call Op_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) + call MudSystemDotOp_Density%AddToFirst (NewDensity) + call MudSystemDotOp_MudDischarged_Volume%AddToFirst (MudSystemDotNewVolume) + call MudSystemDotOp_Mud_Forehead_X%AddToFirst (MudSystemDotOld_KickBackHead_X) + call Op_Mud_Forehead_section%AddToFirst (MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_Mud_Backhead_X%AddToFirst (MudSystemDotOld_KickBackHead_X) + call Op_Mud_Backhead_section%AddToFirst (MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_RemainedVolume_in_LastSection%AddToFirst (0.0d0) + call MudSystemDotOp_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) call Op_MudOrKick%AddToFirst (0) endif ! - elseif ( MinKickDv == Op_MudDischarged_Volume%Last () ) then ! eleman balaee baghi mimund, kick hazf mishod + elseif ( MudSystemDotMinKickDv == MudSystemDotOp_MudDischarged_Volume%Last () ) then ! eleman balaee baghi mimund, kick hazf mishod - Ann_MudDischarged_Volume%Array (1)= Ann_MudDischarged_Volume%Array (1) - MinKickDv + MudSystemDotAnn_MudDischarged_Volume%Array (1)= MudSystemDotAnn_MudDischarged_Volume%Array (1) - MudSystemDotMinKickDv - call Ann_Density%AddToFirst (Op_Density%Last()) - call Ann_MudDischarged_Volume%AddToFirst (MinKickDv) - call Ann_Mud_Forehead_X%AddToFirst (Xstart_PipeSection(F_StringIntervalCounts+1)) + call Ann_Density%AddToFirst (MudSystemDotOp_Density%Last()) + call MudSystemDotAnn_MudDischarged_Volume%AddToFirst (MudSystemDotMinKickDv) + call Ann_Mud_Forehead_X%AddToFirst (MudSystemDotXstart_PipeSection(F_StringIntervalCounts+1)) call Ann_Mud_Forehead_section%AddToFirst (F_StringIntervalCounts+1) - call Ann_Mud_Backhead_X%AddToFirst (Xstart_PipeSection(F_StringIntervalCounts+1)) + call Ann_Mud_Backhead_X%AddToFirst (MudSystemDotXstart_PipeSection(F_StringIntervalCounts+1)) call Ann_Mud_Backhead_section%AddToFirst (F_StringIntervalCounts+1) call Ann_RemainedVolume_in_LastSection%AddToFirst (0.0d0) call Ann_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) - call Ann_MudOrKick%AddToFirst (KickNumber) + call Ann_MudOrKick%AddToFirst (MudSystemDotKickNumber) call Ann_CuttingMud%AddToFirst (0) - Old_KickBackHead_X= Op_Mud_Backhead_X%Array (Op_KickLoc) - Old_KickBackHead_Section= Op_Mud_Backhead_section%Array (Op_KickLoc) + MudSystemDotOld_KickBackHead_X= MudSystemDotOp_Mud_Backhead_X%Array (MudSystemDotOp_KickLoc) + MudSystemDotOld_KickBackHead_Section= Op_Mud_Backhead_section%Array (MudSystemDotOp_KickLoc) - call Op_MudDischarged_Volume%Remove (Op_KickLoc) - call Op_Mud_Backhead_X%Remove (Op_KickLoc) - call Op_Mud_Backhead_section%Remove (Op_KickLoc) - call Op_Mud_Forehead_X%Remove (Op_KickLoc) - call Op_Mud_Forehead_section%Remove (Op_KickLoc) - call Op_Density%Remove (Op_KickLoc) - call Op_RemainedVolume_in_LastSection%Remove (Op_KickLoc) - call Op_EmptyVolume_inBackheadLocation%Remove (Op_KickLoc) - call Op_MudOrKick%Remove (Op_KickLoc) + call MudSystemDotOp_MudDischarged_Volume%Remove (MudSystemDotOp_KickLoc) + call MudSystemDotOp_Mud_Backhead_X%Remove (MudSystemDotOp_KickLoc) + call Op_Mud_Backhead_section%Remove (MudSystemDotOp_KickLoc) + call MudSystemDotOp_Mud_Forehead_X%Remove (MudSystemDotOp_KickLoc) + call Op_Mud_Forehead_section%Remove (MudSystemDotOp_KickLoc) + call MudSystemDotOp_Density%Remove (MudSystemDotOp_KickLoc) + call MudSystemDotOp_RemainedVolume_in_LastSection%Remove (MudSystemDotOp_KickLoc) + call MudSystemDotOp_EmptyVolume_inBackheadLocation%Remove (MudSystemDotOp_KickLoc) + call Op_MudOrKick%Remove (MudSystemDotOp_KickLoc) ! backheade kick zire mate bashad - if (Op_KickLoc > 1) then + if (MudSystemDotOp_KickLoc > 1) then !if ( Op_Density%Array (Op_KickLoc-1) /= NewDensity ) then - if ( ABS(Op_Density%Array (Op_KickLoc-1) - NewDensity) >= DensityMixTol ) then + if ( ABS(MudSystemDotOp_Density%Array (MudSystemDotOp_KickLoc-1) - NewDensity) >= MudSystemDotDensityMixTol ) then - call Op_Density%AddTo (Op_KickLoc,NewDensity) - call Op_MudDischarged_Volume%AddTo (Op_KickLoc,NewVolume) - call Op_Mud_Forehead_X%AddTo (Op_KickLoc,Old_KickBackHead_X) - call Op_Mud_Forehead_section%AddTo (Op_KickLoc,Old_KickBackHead_Section) - call Op_Mud_Backhead_X%AddTo (Op_KickLoc,Old_KickBackHead_X) - call Op_Mud_Backhead_section%AddTo (Op_KickLoc,Old_KickBackHead_Section) - call Op_RemainedVolume_in_LastSection%AddTo (Op_KickLoc,0.0d0) - call Op_EmptyVolume_inBackheadLocation%AddTo (Op_KickLoc,0.0d0) - call Op_MudOrKick%AddTo (Op_KickLoc,0) + call MudSystemDotOp_Density%AddTo (MudSystemDotOp_KickLoc,NewDensity) + call MudSystemDotOp_MudDischarged_Volume%AddTo (MudSystemDotOp_KickLoc,MudSystemDotNewVolume) + call MudSystemDotOp_Mud_Forehead_X%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_X) + call Op_Mud_Forehead_section%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_Mud_Backhead_X%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_X) + call Op_Mud_Backhead_section%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_RemainedVolume_in_LastSection%AddTo (MudSystemDotOp_KickLoc,0.0d0) + call MudSystemDotOp_EmptyVolume_inBackheadLocation%AddTo (MudSystemDotOp_KickLoc,0.0d0) + call Op_MudOrKick%AddTo (MudSystemDotOp_KickLoc,0) else !Op_Density%Array (imudKick-1) == NewDensity - Op_Density%Array(Op_KickLoc-1)= (Op_Density%Array(Op_KickLoc-1)*Op_MudDischarged_Volume%Array(Op_KickLoc-1)+NewDensity*NewVolume)/(Op_MudDischarged_Volume%Array(Op_KickLoc-1)+NewVolume) - Op_MudDischarged_Volume%Array(Op_KickLoc-1)= Op_MudDischarged_Volume%Array(Op_KickLoc-1) + NewVolume + MudSystemDotOp_Density%Array(MudSystemDotOp_KickLoc-1)= (MudSystemDotOp_Density%Array(MudSystemDotOp_KickLoc-1)*MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1)+NewDensity*MudSystemDotNewVolume)/(MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1)+MudSystemDotNewVolume) + MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1)= MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1) + MudSystemDotNewVolume endif else !if Op_KickLoc == 1 (*****Migration Start*****) *3-3=============================== !write(*,*) '****3-3' - call Op_Density%AddToFirst (NewDensity) - call Op_MudDischarged_Volume%AddToFirst (NewVolume) - call Op_Mud_Forehead_X%AddToFirst (Old_KickBackHead_X) - call Op_Mud_Forehead_section%AddToFirst (Old_KickBackHead_Section) - call Op_Mud_Backhead_X%AddToFirst (Old_KickBackHead_X) - call Op_Mud_Backhead_section%AddToFirst (Old_KickBackHead_Section) - call Op_RemainedVolume_in_LastSection%AddToFirst (0.0d0) - call Op_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) + call MudSystemDotOp_Density%AddToFirst (NewDensity) + call MudSystemDotOp_MudDischarged_Volume%AddToFirst (MudSystemDotNewVolume) + call MudSystemDotOp_Mud_Forehead_X%AddToFirst (MudSystemDotOld_KickBackHead_X) + call Op_Mud_Forehead_section%AddToFirst (MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_Mud_Backhead_X%AddToFirst (MudSystemDotOld_KickBackHead_X) + call Op_Mud_Backhead_section%AddToFirst (MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_RemainedVolume_in_LastSection%AddToFirst (0.0d0) + call MudSystemDotOp_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) call Op_MudOrKick%AddToFirst (0) endif @@ -371,86 +371,86 @@ DO KickNumber= NewInfluxNumber-NoGasPocket+1 , NewInfluxNumber !============================= tamame kick zire mate bashad *1 ================================ - if ( Op_KickLoc>0 .and. Op_KickLoc < Op_MudOrKick%Length () ) then + if ( MudSystemDotOp_KickLoc>0 .and. MudSystemDotOp_KickLoc < Op_MudOrKick%Length () ) then !write(*,*) '****1' !iloc= 1 - KickDv= Area_OpSectionFt(Op_Mud_Forehead_section%Array(Op_KickLoc)) * KickDx * 7.48051948d0 ! ft^3 to gal + MudSystemDotKickDv= MudSystemDotArea_OpSectionFt(Op_Mud_Forehead_section%Array(MudSystemDotOp_KickLoc)) * MudSystemDotKickDx * 7.48051948d0 ! ft^3 to gal - Old_KickBackHead_X= Op_Mud_Backhead_X%Array (Op_KickLoc) - Old_KickBackHead_Section= Op_Mud_Backhead_section%Array (Op_KickLoc) + MudSystemDotOld_KickBackHead_X= MudSystemDotOp_Mud_Backhead_X%Array (MudSystemDotOp_KickLoc) + MudSystemDotOld_KickBackHead_Section= Op_Mud_Backhead_section%Array (MudSystemDotOp_KickLoc) - if ( KickDv < Op_MudDischarged_Volume%Array (Op_KickLoc+1) ) then !eleman bala sari baghi mimund + if ( MudSystemDotKickDv < MudSystemDotOp_MudDischarged_Volume%Array (MudSystemDotOp_KickLoc+1) ) then !eleman bala sari baghi mimund !write(*,*) 'cond 11111111111111' - Op_MudDischarged_Volume%Array (Op_KickLoc+1)= Op_MudDischarged_Volume%Array (Op_KickLoc+1) - KickDv + MudSystemDotOp_MudDischarged_Volume%Array (MudSystemDotOp_KickLoc+1)= MudSystemDotOp_MudDischarged_Volume%Array (MudSystemDotOp_KickLoc+1) - MudSystemDotKickDv - NewDensity= Op_Density%Array (Op_KickLoc+1) - NewVolume= KickDv + NewDensity= MudSystemDotOp_Density%Array (MudSystemDotOp_KickLoc+1) + MudSystemDotNewVolume= MudSystemDotKickDv else !KickDv > Op_MudDischarged_Volume%Array (imudKick+1) eleman baghi nemimund ! write(*,*) 'cond 22222222222222222' - KickDv= Op_MudDischarged_Volume%Array (Op_KickLoc+1) + MudSystemDotKickDv= MudSystemDotOp_MudDischarged_Volume%Array (MudSystemDotOp_KickLoc+1) - NewVolume= KickDv - NewDensity= Op_Density%Array (Op_KickLoc+1) + MudSystemDotNewVolume= MudSystemDotKickDv + NewDensity= MudSystemDotOp_Density%Array (MudSystemDotOp_KickLoc+1) - call Op_MudDischarged_Volume%Remove (Op_KickLoc+1) - call Op_Mud_Backhead_X%Remove (Op_KickLoc+1) - call Op_Mud_Backhead_section%Remove (Op_KickLoc+1) - call Op_Mud_Forehead_X%Remove (Op_KickLoc+1) - call Op_Mud_Forehead_section%Remove (Op_KickLoc+1) - call Op_Density%Remove (Op_KickLoc+1) - call Op_RemainedVolume_in_LastSection%Remove (Op_KickLoc+1) - call Op_EmptyVolume_inBackheadLocation%Remove (Op_KickLoc+1) - call Op_MudOrKick%Remove (Op_KickLoc+1) + call MudSystemDotOp_MudDischarged_Volume%Remove (MudSystemDotOp_KickLoc+1) + call MudSystemDotOp_Mud_Backhead_X%Remove (MudSystemDotOp_KickLoc+1) + call Op_Mud_Backhead_section%Remove (MudSystemDotOp_KickLoc+1) + call MudSystemDotOp_Mud_Forehead_X%Remove (MudSystemDotOp_KickLoc+1) + call Op_Mud_Forehead_section%Remove (MudSystemDotOp_KickLoc+1) + call MudSystemDotOp_Density%Remove (MudSystemDotOp_KickLoc+1) + call MudSystemDotOp_RemainedVolume_in_LastSection%Remove (MudSystemDotOp_KickLoc+1) + call MudSystemDotOp_EmptyVolume_inBackheadLocation%Remove (MudSystemDotOp_KickLoc+1) + call Op_MudOrKick%Remove (MudSystemDotOp_KickLoc+1) endif ! backheade kick zire mate bashad - if (Op_KickLoc > 1) then + if (MudSystemDotOp_KickLoc > 1) then !if ( Op_Density%Array (Op_KickLoc-1) /= NewDensity ) then - if ( ABS(Op_Density%Array (Op_KickLoc-1) - NewDensity) >= DensityMixTol ) then + if ( ABS(MudSystemDotOp_Density%Array (MudSystemDotOp_KickLoc-1) - NewDensity) >= MudSystemDotDensityMixTol ) then - call Op_Density%AddTo (Op_KickLoc,NewDensity) - call Op_MudDischarged_Volume%AddTo (Op_KickLoc,NewVolume) - call Op_Mud_Forehead_X%AddTo (Op_KickLoc,Old_KickBackHead_X) - call Op_Mud_Forehead_section%AddTo (Op_KickLoc,Old_KickBackHead_Section) - call Op_Mud_Backhead_X%AddTo (Op_KickLoc,Old_KickBackHead_X) - call Op_Mud_Backhead_section%AddTo (Op_KickLoc,Old_KickBackHead_Section) - call Op_RemainedVolume_in_LastSection%AddTo (Op_KickLoc,0.0d0) - call Op_EmptyVolume_inBackheadLocation%AddTo (Op_KickLoc,0.0d0) - call Op_MudOrKick%AddTo (Op_KickLoc,0) + call MudSystemDotOp_Density%AddTo (MudSystemDotOp_KickLoc,NewDensity) + call MudSystemDotOp_MudDischarged_Volume%AddTo (MudSystemDotOp_KickLoc,MudSystemDotNewVolume) + call MudSystemDotOp_Mud_Forehead_X%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_X) + call Op_Mud_Forehead_section%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_Mud_Backhead_X%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_X) + call Op_Mud_Backhead_section%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_RemainedVolume_in_LastSection%AddTo (MudSystemDotOp_KickLoc,0.0d0) + call MudSystemDotOp_EmptyVolume_inBackheadLocation%AddTo (MudSystemDotOp_KickLoc,0.0d0) + call Op_MudOrKick%AddTo (MudSystemDotOp_KickLoc,0) else !Op_Density%Array (Op_KickLoc-1) == NewDensity - Op_Density%Array(Op_KickLoc-1)= (Op_Density%Array(Op_KickLoc-1)*Op_MudDischarged_Volume%Array(Op_KickLoc-1)+NewDensity*NewVolume)/(Op_MudDischarged_Volume%Array(Op_KickLoc-1)+NewVolume) - Op_MudDischarged_Volume%Array(Op_KickLoc-1)= Op_MudDischarged_Volume%Array(Op_KickLoc-1) + NewVolume + MudSystemDotOp_Density%Array(MudSystemDotOp_KickLoc-1)= (MudSystemDotOp_Density%Array(MudSystemDotOp_KickLoc-1)*MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1)+NewDensity*MudSystemDotNewVolume)/(MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1)+MudSystemDotNewVolume) + MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1)= MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1) + MudSystemDotNewVolume endif else !if Op_KickLoc == 1 (*****Migration Start*****) *5-1=============================== !write(*,*) '****5-1' - call Op_Density%AddToFirst (NewDensity) - call Op_MudDischarged_Volume%AddToFirst (NewVolume) - call Op_Mud_Forehead_X%AddToFirst (Old_KickBackHead_X) - call Op_Mud_Forehead_section%AddToFirst (Old_KickBackHead_Section) - call Op_Mud_Backhead_X%AddToFirst (Old_KickBackHead_X) - call Op_Mud_Backhead_section%AddToFirst (Old_KickBackHead_Section) - call Op_RemainedVolume_in_LastSection%AddToFirst (0.0d0) - call Op_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) + call MudSystemDotOp_Density%AddToFirst (NewDensity) + call MudSystemDotOp_MudDischarged_Volume%AddToFirst (MudSystemDotNewVolume) + call MudSystemDotOp_Mud_Forehead_X%AddToFirst (MudSystemDotOld_KickBackHead_X) + call Op_Mud_Forehead_section%AddToFirst (MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_Mud_Backhead_X%AddToFirst (MudSystemDotOld_KickBackHead_X) + call Op_Mud_Backhead_section%AddToFirst (MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_RemainedVolume_in_LastSection%AddToFirst (0.0d0) + call MudSystemDotOp_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) call Op_MudOrKick%AddToFirst (0) endif @@ -465,65 +465,65 @@ DO KickNumber= NewInfluxNumber-NoGasPocket+1 , NewInfluxNumber !=========================== tamame kick balaye mate bashad *2 ================================== - if ( Ann_KickLoc > 0 .and. Op_KickLoc==0 ) then + if ( MudSystemDotAnn_KickLoc > 0 .and. MudSystemDotOp_KickLoc==0 ) then !write(*,*) '****2' !iloc= 1 - KickDv= Area_PipeSectionFt(Ann_Mud_Forehead_section%Array(Ann_KickLoc)) * KickDx * 7.48051948d0 ! ft^3 to gal + MudSystemDotKickDv= MudSystemDotArea_PipeSectionFt(Ann_Mud_Forehead_section%Array(MudSystemDotAnn_KickLoc)) * MudSystemDotKickDx * 7.48051948d0 ! ft^3 to gal - NewDensity= Ann_Density%Array (Ann_KickLoc+1) - NewVolume= KickDv - CuttingValue= Ann_CuttingMud%Array (Ann_KickLoc+1) + NewDensity= Ann_Density%Array (MudSystemDotAnn_KickLoc+1) + MudSystemDotNewVolume= MudSystemDotKickDv + CuttingValue= Ann_CuttingMud%Array (MudSystemDotAnn_KickLoc+1) - if ( KickDv < Ann_MudDischarged_Volume%Array (Ann_KickLoc+1) ) then !eleman bala sari baghi mimund + if ( MudSystemDotKickDv < MudSystemDotAnn_MudDischarged_Volume%Array (MudSystemDotAnn_KickLoc+1) ) then !eleman bala sari baghi mimund - Ann_MudDischarged_Volume%Array (Ann_KickLoc+1)= Ann_MudDischarged_Volume%Array (Ann_KickLoc+1) - KickDv + MudSystemDotAnn_MudDischarged_Volume%Array (MudSystemDotAnn_KickLoc+1)= MudSystemDotAnn_MudDischarged_Volume%Array (MudSystemDotAnn_KickLoc+1) - MudSystemDotKickDv else !KickDv > Ann_MudDischarged_Volume%Array (imudKick+1) eleman baghi nemimund - KickDv= Ann_MudDischarged_Volume%Array (Ann_KickLoc+1) - NewVolume= KickDv + MudSystemDotKickDv= MudSystemDotAnn_MudDischarged_Volume%Array (MudSystemDotAnn_KickLoc+1) + MudSystemDotNewVolume= MudSystemDotKickDv - call Ann_MudDischarged_Volume%Remove (Ann_KickLoc+1) - call Ann_Mud_Backhead_X%Remove (Ann_KickLoc+1) - call Ann_Mud_Backhead_section%Remove (Ann_KickLoc+1) - call Ann_Mud_Forehead_X%Remove (Ann_KickLoc+1) - call Ann_Mud_Forehead_section%Remove (Ann_KickLoc+1) - call Ann_Density%Remove (Ann_KickLoc+1) - call Ann_RemainedVolume_in_LastSection%Remove (Ann_KickLoc+1) - call Ann_EmptyVolume_inBackheadLocation%Remove (Ann_KickLoc+1) - call Ann_MudOrKick%Remove (Ann_KickLoc+1) - call Ann_CuttingMud%Remove (Ann_KickLoc+1) + call MudSystemDotAnn_MudDischarged_Volume%Remove (MudSystemDotAnn_KickLoc+1) + call Ann_Mud_Backhead_X%Remove (MudSystemDotAnn_KickLoc+1) + call Ann_Mud_Backhead_section%Remove (MudSystemDotAnn_KickLoc+1) + call Ann_Mud_Forehead_X%Remove (MudSystemDotAnn_KickLoc+1) + call Ann_Mud_Forehead_section%Remove (MudSystemDotAnn_KickLoc+1) + call Ann_Density%Remove (MudSystemDotAnn_KickLoc+1) + call Ann_RemainedVolume_in_LastSection%Remove (MudSystemDotAnn_KickLoc+1) + call Ann_EmptyVolume_inBackheadLocation%Remove (MudSystemDotAnn_KickLoc+1) + call Ann_MudOrKick%Remove (MudSystemDotAnn_KickLoc+1) + call Ann_CuttingMud%Remove (MudSystemDotAnn_KickLoc+1) endif ! backheade kick balaye mate bashad - if (Ann_KIckLoc > 1) then + if (MudSystemDotAnn_KickLoc > 1) then !if ( Ann_Density%Array (Ann_KickLoc-1) /= NewDensity ) then - if ( ABS(Ann_Density%Array (Ann_KickLoc-1) - NewDensity) >= DensityMixTol ) then + if ( ABS(Ann_Density%Array (MudSystemDotAnn_KickLoc-1) - NewDensity) >= MudSystemDotDensityMixTol ) then - Old_KickBackHead_X= Ann_Mud_Backhead_X%Array (Ann_KickLoc) - Old_KickBackHead_Section= Ann_Mud_Backhead_section%Array (Ann_KickLoc) + MudSystemDotOld_KickBackHead_X= Ann_Mud_Backhead_X%Array (MudSystemDotAnn_KickLoc) + MudSystemDotOld_KickBackHead_Section= Ann_Mud_Backhead_section%Array (MudSystemDotAnn_KickLoc) - call Ann_Density%AddTo (Ann_KickLoc,NewDensity) - call Ann_MudDischarged_Volume%AddTo (Ann_KickLoc,NewVolume) - call Ann_Mud_Forehead_X%AddTo (Ann_KickLoc,Old_KickBackHead_X) - call Ann_Mud_Forehead_section%AddTo (Ann_KickLoc,Old_KickBackHead_Section) - call Ann_Mud_Backhead_X%AddTo (Ann_KickLoc,Old_KickBackHead_X) - call Ann_Mud_Backhead_section%AddTo (Ann_KickLoc,Old_KickBackHead_Section) - call Ann_RemainedVolume_in_LastSection%AddTo (Ann_KickLoc,0.0d0) - call Ann_EmptyVolume_inBackheadLocation%AddTo (Ann_KickLoc,0.0d0) - call Ann_MudOrKick%AddTo (Ann_KickLoc,0) - call Ann_CuttingMud%AddTo (Ann_KickLoc,0) + call Ann_Density%AddTo (MudSystemDotAnn_KickLoc,NewDensity) + call MudSystemDotAnn_MudDischarged_Volume%AddTo (MudSystemDotAnn_KickLoc,MudSystemDotNewVolume) + call Ann_Mud_Forehead_X%AddTo (MudSystemDotAnn_KickLoc,MudSystemDotOld_KickBackHead_X) + call Ann_Mud_Forehead_section%AddTo (MudSystemDotAnn_KickLoc,MudSystemDotOld_KickBackHead_Section) + call Ann_Mud_Backhead_X%AddTo (MudSystemDotAnn_KickLoc,MudSystemDotOld_KickBackHead_X) + call Ann_Mud_Backhead_section%AddTo (MudSystemDotAnn_KickLoc,MudSystemDotOld_KickBackHead_Section) + call Ann_RemainedVolume_in_LastSection%AddTo (MudSystemDotAnn_KickLoc,0.0d0) + call Ann_EmptyVolume_inBackheadLocation%AddTo (MudSystemDotAnn_KickLoc,0.0d0) + call Ann_MudOrKick%AddTo (MudSystemDotAnn_KickLoc,0) + call Ann_CuttingMud%AddTo (MudSystemDotAnn_KickLoc,0) else !Op_Density%Array (imudKick-1) == NewDensity - Ann_Density%Array(Ann_KickLoc-1)= (Ann_Density%Array(Ann_KickLoc-1)*Ann_MudDischarged_Volume%Array(Ann_KickLoc-1)+NewDensity*NewVolume)/(Ann_MudDischarged_Volume%Array(Ann_KickLoc-1)+NewVolume) - Ann_MudDischarged_Volume%Array(Ann_KickLoc-1)= Ann_MudDischarged_Volume%Array(Ann_KickLoc-1) + NewVolume + Ann_Density%Array(MudSystemDotAnn_KickLoc-1)= (Ann_Density%Array(MudSystemDotAnn_KickLoc-1)*MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotAnn_KickLoc-1)+NewDensity*MudSystemDotNewVolume)/(MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotAnn_KickLoc-1)+MudSystemDotNewVolume) + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotAnn_KickLoc-1)= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotAnn_KickLoc-1) + MudSystemDotNewVolume endif @@ -531,16 +531,16 @@ DO KickNumber= NewInfluxNumber-NoGasPocket+1 , NewInfluxNumber else !if Ann_KickLoc == 1 *6 =============================== !write(*,*) '****6' - Old_KickBackHead_X= Ann_Mud_Backhead_X%Array (Ann_KickLoc) - Old_KickBackHead_Section= Ann_Mud_Backhead_section%Array (Ann_KickLoc) + MudSystemDotOld_KickBackHead_X= Ann_Mud_Backhead_X%Array (MudSystemDotAnn_KickLoc) + MudSystemDotOld_KickBackHead_Section= Ann_Mud_Backhead_section%Array (MudSystemDotAnn_KickLoc) call Ann_Density%AddToFirst (NewDensity) - call Ann_MudDischarged_Volume%AddToFirst (NewVolume) - call Ann_Mud_Forehead_X%AddToFirst (Old_KickBackHead_X) - call Ann_Mud_Forehead_section%AddToFirst (Old_KickBackHead_Section) - call Ann_Mud_Backhead_X%AddToFirst (Old_KickBackHead_X) - call Ann_Mud_Backhead_section%AddToFirst (Old_KickBackHead_Section) + call MudSystemDotAnn_MudDischarged_Volume%AddToFirst (MudSystemDotNewVolume) + call Ann_Mud_Forehead_X%AddToFirst (MudSystemDotOld_KickBackHead_X) + call Ann_Mud_Forehead_section%AddToFirst (MudSystemDotOld_KickBackHead_Section) + call Ann_Mud_Backhead_X%AddToFirst (MudSystemDotOld_KickBackHead_X) + call Ann_Mud_Backhead_section%AddToFirst (MudSystemDotOld_KickBackHead_Section) call Ann_RemainedVolume_in_LastSection%AddToFirst (0.0d0) call Ann_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) call Ann_MudOrKick%AddToFirst (0) @@ -560,208 +560,208 @@ DO KickNumber= NewInfluxNumber-NoGasPocket+1 , NewInfluxNumber !============================== kick 2 tarafe mate bashad *4 ============================== - if ( Ann_KickLoc > 0 .and. Op_KickLoc > 0 ) then + if ( MudSystemDotAnn_KickLoc > 0 .and. MudSystemDotOp_KickLoc > 0 ) then !write(*,*) '****4' - iloc= 2 + MudSystemDotiLoc= 2 - KickDv= Area_PipeSectionFt(Ann_Mud_Forehead_section%Array(Ann_KickLoc)) * KickDx * 7.48051948d0 ! ft^3 to gal + MudSystemDotKickDv= MudSystemDotArea_PipeSectionFt(Ann_Mud_Forehead_section%Array(MudSystemDotAnn_KickLoc)) * MudSystemDotKickDx * 7.48051948d0 ! ft^3 to gal - MinKickDv= min( KickDv,Ann_MudDischarged_Volume%Array (Ann_KickLoc+1), Op_MudDischarged_Volume%Last () ) ! Ann_KickLoc+1=2 Op_MudDischarged_Volume%Last ()=kick + MudSystemDotMinKickDv= min( MudSystemDotKickDv,MudSystemDotAnn_MudDischarged_Volume%Array (MudSystemDotAnn_KickLoc+1), MudSystemDotOp_MudDischarged_Volume%Last () ) ! Ann_KickLoc+1=2 Op_MudDischarged_Volume%Last ()=kick - NewDensity= Ann_Density%Array (Ann_KickLoc+1) - NewVolume= MinKickDv + NewDensity= Ann_Density%Array (MudSystemDotAnn_KickLoc+1) + MudSystemDotNewVolume= MudSystemDotMinKickDv - if ( MinKickDv == KickDv ) then !eleman bala sari baghi mimund, paeeni(kick) dar OP ham baghi mimund + if ( MudSystemDotMinKickDv == MudSystemDotKickDv ) then !eleman bala sari baghi mimund, paeeni(kick) dar OP ham baghi mimund !write(*,*) '****4----1' - Ann_MudDischarged_Volume%Array (Ann_KickLoc+1)= Ann_MudDischarged_Volume%Array (Ann_KickLoc+1) - MinKickDv + MudSystemDotAnn_MudDischarged_Volume%Array (MudSystemDotAnn_KickLoc+1)= MudSystemDotAnn_MudDischarged_Volume%Array (MudSystemDotAnn_KickLoc+1) - MudSystemDotMinKickDv - Ann_MudDischarged_Volume%Array (Ann_KickLoc)= Ann_MudDischarged_Volume%Array (Ann_KickLoc) + MinKickDv ! Ann_KickLoc= 1 + MudSystemDotAnn_MudDischarged_Volume%Array (MudSystemDotAnn_KickLoc)= MudSystemDotAnn_MudDischarged_Volume%Array (MudSystemDotAnn_KickLoc) + MudSystemDotMinKickDv ! Ann_KickLoc= 1 - Op_MudDischarged_Volume%Array (Op_KickLoc)= Op_MudDischarged_Volume%Array (Op_KickLoc) - MinKickDv ! Op_KickLoc= last + MudSystemDotOp_MudDischarged_Volume%Array (MudSystemDotOp_KickLoc)= MudSystemDotOp_MudDischarged_Volume%Array (MudSystemDotOp_KickLoc) - MudSystemDotMinKickDv ! Op_KickLoc= last ! backheade kick zire mate bashad - if ( Op_KickLoc>1) then + if ( MudSystemDotOp_KickLoc>1) then !if ( Op_Density%Array (Op_KickLoc-1) /= NewDensity ) then - if ( ABS(Op_Density%Array (Op_KickLoc-1) - NewDensity) >= DensityMixTol ) then + if ( ABS(MudSystemDotOp_Density%Array (MudSystemDotOp_KickLoc-1) - NewDensity) >= MudSystemDotDensityMixTol ) then - Old_KickBackHead_X= Op_Mud_Backhead_X%Array (Op_KickLoc) - Old_KickBackHead_Section= Op_Mud_Backhead_section%Array (Op_KickLoc) + MudSystemDotOld_KickBackHead_X= MudSystemDotOp_Mud_Backhead_X%Array (MudSystemDotOp_KickLoc) + MudSystemDotOld_KickBackHead_Section= Op_Mud_Backhead_section%Array (MudSystemDotOp_KickLoc) - call Op_Density%AddTo (Op_KickLoc,NewDensity) - call Op_MudDischarged_Volume%AddTo (Op_KickLoc,NewVolume) - call Op_Mud_Forehead_X%AddTo (Op_KickLoc,Old_KickBackHead_X) - call Op_Mud_Forehead_section%AddTo (Op_KickLoc,Old_KickBackHead_Section) - call Op_Mud_Backhead_X%AddTo (Op_KickLoc,Old_KickBackHead_X) - call Op_Mud_Backhead_section%AddTo (Op_KickLoc,Old_KickBackHead_Section) - call Op_RemainedVolume_in_LastSection%AddTo (Op_KickLoc,0.0d0) - call Op_EmptyVolume_inBackheadLocation%AddTo (Op_KickLoc,0.0d0) - call Op_MudOrKick%AddTo (Op_KickLoc,0) + call MudSystemDotOp_Density%AddTo (MudSystemDotOp_KickLoc,NewDensity) + call MudSystemDotOp_MudDischarged_Volume%AddTo (MudSystemDotOp_KickLoc,MudSystemDotNewVolume) + call MudSystemDotOp_Mud_Forehead_X%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_X) + call Op_Mud_Forehead_section%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_Mud_Backhead_X%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_X) + call Op_Mud_Backhead_section%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_RemainedVolume_in_LastSection%AddTo (MudSystemDotOp_KickLoc,0.0d0) + call MudSystemDotOp_EmptyVolume_inBackheadLocation%AddTo (MudSystemDotOp_KickLoc,0.0d0) + call Op_MudOrKick%AddTo (MudSystemDotOp_KickLoc,0) else ! merge - Op_Density%Array(Op_KickLoc-1)= (Op_Density%Array(Op_KickLoc-1)*Op_MudDischarged_Volume%Array(Op_KickLoc-1)+NewDensity*NewVolume)/(Op_MudDischarged_Volume%Array(Op_KickLoc-1)+NewVolume) - Op_MudDischarged_Volume%Array(Op_KickLoc-1)= Op_MudDischarged_Volume%Array(Op_KickLoc-1) + NewVolume + MudSystemDotOp_Density%Array(MudSystemDotOp_KickLoc-1)= (MudSystemDotOp_Density%Array(MudSystemDotOp_KickLoc-1)*MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1)+NewDensity*MudSystemDotNewVolume)/(MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1)+MudSystemDotNewVolume) + MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1)= MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1) + MudSystemDotNewVolume endif else !if Op_KickLoc == 1 (*****Migration Start*****) *5-2=============================== !write(*,*) '****5-2' - Old_KickBackHead_X= Op_Mud_Backhead_X%Array (Op_KickLoc) - Old_KickBackHead_Section= Op_Mud_Backhead_section%Array (Op_KickLoc) + MudSystemDotOld_KickBackHead_X= MudSystemDotOp_Mud_Backhead_X%Array (MudSystemDotOp_KickLoc) + MudSystemDotOld_KickBackHead_Section= Op_Mud_Backhead_section%Array (MudSystemDotOp_KickLoc) - call Op_Density%AddToFirst (NewDensity) - call Op_MudDischarged_Volume%AddToFirst (NewVolume) - call Op_Mud_Forehead_X%AddToFirst (Old_KickBackHead_X) - call Op_Mud_Forehead_section%AddToFirst (Old_KickBackHead_Section) - call Op_Mud_Backhead_X%AddToFirst (Old_KickBackHead_X) - call Op_Mud_Backhead_section%AddToFirst (Old_KickBackHead_Section) - call Op_RemainedVolume_in_LastSection%AddToFirst (0.0d0) - call Op_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) + call MudSystemDotOp_Density%AddToFirst (NewDensity) + call MudSystemDotOp_MudDischarged_Volume%AddToFirst (MudSystemDotNewVolume) + call MudSystemDotOp_Mud_Forehead_X%AddToFirst (MudSystemDotOld_KickBackHead_X) + call Op_Mud_Forehead_section%AddToFirst (MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_Mud_Backhead_X%AddToFirst (MudSystemDotOld_KickBackHead_X) + call Op_Mud_Backhead_section%AddToFirst (MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_RemainedVolume_in_LastSection%AddToFirst (0.0d0) + call MudSystemDotOp_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) call Op_MudOrKick%AddToFirst (0) endif - elseif ( MinKickDv == Ann_MudDischarged_Volume%Array (Ann_KickLoc+1) ) then ! eleman bala sari baghi nemimund + elseif ( MudSystemDotMinKickDv == MudSystemDotAnn_MudDischarged_Volume%Array (MudSystemDotAnn_KickLoc+1) ) then ! eleman bala sari baghi nemimund !write(*,*) '****4----2' - call Ann_MudDischarged_Volume%Remove (Ann_KickLoc+1) - call Ann_Mud_Backhead_X%Remove (Ann_KickLoc+1) - call Ann_Mud_Backhead_section%Remove (Ann_KickLoc+1) - call Ann_Mud_Forehead_X%Remove (Ann_KickLoc+1) - call Ann_Mud_Forehead_section%Remove (Ann_KickLoc+1) - call Ann_Density%Remove (Ann_KickLoc+1) - call Ann_RemainedVolume_in_LastSection%Remove (Ann_KickLoc+1) - call Ann_EmptyVolume_inBackheadLocation%Remove (Ann_KickLoc+1) - call Ann_MudOrKick%Remove (Ann_KickLoc+1) - call Ann_CuttingMud%Remove (Ann_KickLoc+1) + call MudSystemDotAnn_MudDischarged_Volume%Remove (MudSystemDotAnn_KickLoc+1) + call Ann_Mud_Backhead_X%Remove (MudSystemDotAnn_KickLoc+1) + call Ann_Mud_Backhead_section%Remove (MudSystemDotAnn_KickLoc+1) + call Ann_Mud_Forehead_X%Remove (MudSystemDotAnn_KickLoc+1) + call Ann_Mud_Forehead_section%Remove (MudSystemDotAnn_KickLoc+1) + call Ann_Density%Remove (MudSystemDotAnn_KickLoc+1) + call Ann_RemainedVolume_in_LastSection%Remove (MudSystemDotAnn_KickLoc+1) + call Ann_EmptyVolume_inBackheadLocation%Remove (MudSystemDotAnn_KickLoc+1) + call Ann_MudOrKick%Remove (MudSystemDotAnn_KickLoc+1) + call Ann_CuttingMud%Remove (MudSystemDotAnn_KickLoc+1) - Ann_MudDischarged_Volume%Array (Ann_KickLoc)= Ann_MudDischarged_Volume%Array (Ann_KickLoc) + MinKickDv ! Ann_KickLoc= 1 + MudSystemDotAnn_MudDischarged_Volume%Array (MudSystemDotAnn_KickLoc)= MudSystemDotAnn_MudDischarged_Volume%Array (MudSystemDotAnn_KickLoc) + MudSystemDotMinKickDv ! Ann_KickLoc= 1 - Op_MudDischarged_Volume%Array (Op_KickLoc)= Op_MudDischarged_Volume%Array (Op_KickLoc) - MinKickDv ! Op_KickLoc= last + MudSystemDotOp_MudDischarged_Volume%Array (MudSystemDotOp_KickLoc)= MudSystemDotOp_MudDischarged_Volume%Array (MudSystemDotOp_KickLoc) - MudSystemDotMinKickDv ! Op_KickLoc= last ! backheade kick zire mate bashad - if (Op_KickLoc > 1) then + if (MudSystemDotOp_KickLoc > 1) then !if ( Op_Density%Array (Op_KickLoc-1) /= NewDensity ) then - if ( ABS(Op_Density%Array (Op_KickLoc-1) - NewDensity) >= DensityMixTol ) then + if ( ABS(MudSystemDotOp_Density%Array (MudSystemDotOp_KickLoc-1) - NewDensity) >= MudSystemDotDensityMixTol ) then - Old_KickBackHead_X= Op_Mud_Backhead_X%Array (Op_KickLoc) - Old_KickBackHead_Section= Op_Mud_Backhead_section%Array (Op_KickLoc) + MudSystemDotOld_KickBackHead_X= MudSystemDotOp_Mud_Backhead_X%Array (MudSystemDotOp_KickLoc) + MudSystemDotOld_KickBackHead_Section= Op_Mud_Backhead_section%Array (MudSystemDotOp_KickLoc) - call Op_Density%AddTo (Op_KickLoc,NewDensity) - call Op_MudDischarged_Volume%AddTo (Op_KickLoc,NewVolume) - call Op_Mud_Forehead_X%AddTo (Op_KickLoc,Old_KickBackHead_X) - call Op_Mud_Forehead_section%AddTo (Op_KickLoc,Old_KickBackHead_Section) - call Op_Mud_Backhead_X%AddTo (Op_KickLoc,Old_KickBackHead_X) - call Op_Mud_Backhead_section%AddTo (Op_KickLoc,Old_KickBackHead_Section) - call Op_RemainedVolume_in_LastSection%AddTo (Op_KickLoc,0.0d0) - call Op_EmptyVolume_inBackheadLocation%AddTo (Op_KickLoc,0.0d0) - call Op_MudOrKick%AddTo (Op_KickLoc,0) + call MudSystemDotOp_Density%AddTo (MudSystemDotOp_KickLoc,NewDensity) + call MudSystemDotOp_MudDischarged_Volume%AddTo (MudSystemDotOp_KickLoc,MudSystemDotNewVolume) + call MudSystemDotOp_Mud_Forehead_X%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_X) + call Op_Mud_Forehead_section%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_Mud_Backhead_X%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_X) + call Op_Mud_Backhead_section%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_RemainedVolume_in_LastSection%AddTo (MudSystemDotOp_KickLoc,0.0d0) + call MudSystemDotOp_EmptyVolume_inBackheadLocation%AddTo (MudSystemDotOp_KickLoc,0.0d0) + call Op_MudOrKick%AddTo (MudSystemDotOp_KickLoc,0) else !Op_Density%Array (imudKick-1) == NewDensity - Op_Density%Array(Op_KickLoc-1)= (Op_Density%Array(Op_KickLoc-1)*Op_MudDischarged_Volume%Array(Op_KickLoc-1)+NewDensity*NewVolume)/(Op_MudDischarged_Volume%Array(Op_KickLoc-1)+NewVolume) - Op_MudDischarged_Volume%Array(Op_KickLoc-1)= Op_MudDischarged_Volume%Array(Op_KickLoc-1) + NewVolume + MudSystemDotOp_Density%Array(MudSystemDotOp_KickLoc-1)= (MudSystemDotOp_Density%Array(MudSystemDotOp_KickLoc-1)*MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1)+NewDensity*MudSystemDotNewVolume)/(MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1)+MudSystemDotNewVolume) + MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1)= MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1) + MudSystemDotNewVolume endif else !if Op_KickLoc == 1 (*****Migration Start*****) *5-2=============================== - Old_KickBackHead_X= Op_Mud_Backhead_X%Array (Op_KickLoc) - Old_KickBackHead_Section= Op_Mud_Backhead_section%Array (Op_KickLoc) + MudSystemDotOld_KickBackHead_X= MudSystemDotOp_Mud_Backhead_X%Array (MudSystemDotOp_KickLoc) + MudSystemDotOld_KickBackHead_Section= Op_Mud_Backhead_section%Array (MudSystemDotOp_KickLoc) - call Op_Density%AddToFirst (NewDensity) - call Op_MudDischarged_Volume%AddToFirst (NewVolume) - call Op_Mud_Forehead_X%AddToFirst (Old_KickBackHead_X) - call Op_Mud_Forehead_section%AddToFirst (Old_KickBackHead_Section) - call Op_Mud_Backhead_X%AddToFirst (Old_KickBackHead_X) - call Op_Mud_Backhead_section%AddToFirst (Old_KickBackHead_Section) - call Op_RemainedVolume_in_LastSection%AddToFirst (0.0d0) - call Op_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) + call MudSystemDotOp_Density%AddToFirst (NewDensity) + call MudSystemDotOp_MudDischarged_Volume%AddToFirst (MudSystemDotNewVolume) + call MudSystemDotOp_Mud_Forehead_X%AddToFirst (MudSystemDotOld_KickBackHead_X) + call Op_Mud_Forehead_section%AddToFirst (MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_Mud_Backhead_X%AddToFirst (MudSystemDotOld_KickBackHead_X) + call Op_Mud_Backhead_section%AddToFirst (MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_RemainedVolume_in_LastSection%AddToFirst (0.0d0) + call MudSystemDotOp_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) call Op_MudOrKick%AddToFirst (0) endif - elseif ( MinKickDv == Op_MudDischarged_Volume%Last () ) then ! eleman balaee baghi mimund, kick az OP kamel kharej mishod + elseif ( MudSystemDotMinKickDv == MudSystemDotOp_MudDischarged_Volume%Last () ) then ! eleman balaee baghi mimund, kick az OP kamel kharej mishod !write(*,*) '****4----3' - Ann_MudDischarged_Volume%Array (Ann_KickLoc+1)= Ann_MudDischarged_Volume%Array (Ann_KickLoc+1) - MinKickDv + MudSystemDotAnn_MudDischarged_Volume%Array (MudSystemDotAnn_KickLoc+1)= MudSystemDotAnn_MudDischarged_Volume%Array (MudSystemDotAnn_KickLoc+1) - MudSystemDotMinKickDv - Ann_MudDischarged_Volume%Array (Ann_KickLoc)= Ann_MudDischarged_Volume%Array (Ann_KickLoc) + MinKickDv ! Ann_KickLoc= 1 + MudSystemDotAnn_MudDischarged_Volume%Array (MudSystemDotAnn_KickLoc)= MudSystemDotAnn_MudDischarged_Volume%Array (MudSystemDotAnn_KickLoc) + MudSystemDotMinKickDv ! Ann_KickLoc= 1 - Old_KickBackHead_X= Op_Mud_Backhead_X%Array (Op_KickLoc) - Old_KickBackHead_Section= Op_Mud_Backhead_section%Array (Op_KickLoc) + MudSystemDotOld_KickBackHead_X= MudSystemDotOp_Mud_Backhead_X%Array (MudSystemDotOp_KickLoc) + MudSystemDotOld_KickBackHead_Section= Op_Mud_Backhead_section%Array (MudSystemDotOp_KickLoc) - call Op_MudDischarged_Volume%Remove (Op_KickLoc) ! Op_KickLoc= last - call Op_Mud_Backhead_X%Remove (Op_KickLoc) - call Op_Mud_Backhead_section%Remove (Op_KickLoc) - call Op_Mud_Forehead_X%Remove (Op_KickLoc) - call Op_Mud_Forehead_section%Remove (Op_KickLoc) - call Op_Density%Remove (Op_KickLoc) - call Op_RemainedVolume_in_LastSection%Remove (Op_KickLoc) - call Op_EmptyVolume_inBackheadLocation%Remove (Op_KickLoc) - call Op_MudOrKick%Remove (Op_KickLoc) + call MudSystemDotOp_MudDischarged_Volume%Remove (MudSystemDotOp_KickLoc) ! Op_KickLoc= last + call MudSystemDotOp_Mud_Backhead_X%Remove (MudSystemDotOp_KickLoc) + call Op_Mud_Backhead_section%Remove (MudSystemDotOp_KickLoc) + call MudSystemDotOp_Mud_Forehead_X%Remove (MudSystemDotOp_KickLoc) + call Op_Mud_Forehead_section%Remove (MudSystemDotOp_KickLoc) + call MudSystemDotOp_Density%Remove (MudSystemDotOp_KickLoc) + call MudSystemDotOp_RemainedVolume_in_LastSection%Remove (MudSystemDotOp_KickLoc) + call MudSystemDotOp_EmptyVolume_inBackheadLocation%Remove (MudSystemDotOp_KickLoc) + call Op_MudOrKick%Remove (MudSystemDotOp_KickLoc) ! backheade kick zire mate bashad - if (Op_KickLoc > 1) then + if (MudSystemDotOp_KickLoc > 1) then !if ( Op_Density%Array (Op_KickLoc-1) /= NewDensity ) then - if ( ABS(Op_Density%Array (Op_KickLoc-1) - NewDensity) >= DensityMixTol ) then + if ( ABS(MudSystemDotOp_Density%Array (MudSystemDotOp_KickLoc-1) - NewDensity) >= MudSystemDotDensityMixTol ) then - call Op_Density%AddTo (Op_KickLoc,NewDensity) - call Op_MudDischarged_Volume%AddTo (Op_KickLoc,NewVolume) - call Op_Mud_Forehead_X%AddTo (Op_KickLoc,Old_KickBackHead_X) - call Op_Mud_Forehead_section%AddTo (Op_KickLoc,Old_KickBackHead_Section) - call Op_Mud_Backhead_X%AddTo (Op_KickLoc,Old_KickBackHead_X) - call Op_Mud_Backhead_section%AddTo (Op_KickLoc,Old_KickBackHead_Section) - call Op_RemainedVolume_in_LastSection%AddTo (Op_KickLoc,0.0d0) - call Op_EmptyVolume_inBackheadLocation%AddTo (Op_KickLoc,0.0d0) - call Op_MudOrKick%AddTo (Op_KickLoc,0) + call MudSystemDotOp_Density%AddTo (MudSystemDotOp_KickLoc,NewDensity) + call MudSystemDotOp_MudDischarged_Volume%AddTo (MudSystemDotOp_KickLoc,MudSystemDotNewVolume) + call MudSystemDotOp_Mud_Forehead_X%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_X) + call Op_Mud_Forehead_section%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_Mud_Backhead_X%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_X) + call Op_Mud_Backhead_section%AddTo (MudSystemDotOp_KickLoc,MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_RemainedVolume_in_LastSection%AddTo (MudSystemDotOp_KickLoc,0.0d0) + call MudSystemDotOp_EmptyVolume_inBackheadLocation%AddTo (MudSystemDotOp_KickLoc,0.0d0) + call Op_MudOrKick%AddTo (MudSystemDotOp_KickLoc,0) else !Op_Density%Array (imudKick-1) == NewDensity - Op_Density%Array(Op_KickLoc-1)= (Op_Density%Array(Op_KickLoc-1)*Op_MudDischarged_Volume%Array(Op_KickLoc-1)+NewDensity*NewVolume)/(Op_MudDischarged_Volume%Array(Op_KickLoc-1)+NewVolume) - Op_MudDischarged_Volume%Array(Op_KickLoc-1)= Op_MudDischarged_Volume%Array(Op_KickLoc-1) + NewVolume + MudSystemDotOp_Density%Array(MudSystemDotOp_KickLoc-1)= (MudSystemDotOp_Density%Array(MudSystemDotOp_KickLoc-1)*MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1)+NewDensity*MudSystemDotNewVolume)/(MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1)+MudSystemDotNewVolume) + MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1)= MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_KickLoc-1) + MudSystemDotNewVolume endif else !if Op_KickLoc == 1 (*****Migration Start*****) *5-2=============================== - call Op_Density%AddToFirst (NewDensity) - call Op_MudDischarged_Volume%AddToFirst (NewVolume) - call Op_Mud_Forehead_X%AddToFirst (Old_KickBackHead_X) - call Op_Mud_Forehead_section%AddToFirst (Old_KickBackHead_Section) - call Op_Mud_Backhead_X%AddToFirst (Old_KickBackHead_X) - call Op_Mud_Backhead_section%AddToFirst (Old_KickBackHead_Section) - call Op_RemainedVolume_in_LastSection%AddToFirst (0.0d0) - call Op_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) + call MudSystemDotOp_Density%AddToFirst (NewDensity) + call MudSystemDotOp_MudDischarged_Volume%AddToFirst (MudSystemDotNewVolume) + call MudSystemDotOp_Mud_Forehead_X%AddToFirst (MudSystemDotOld_KickBackHead_X) + call Op_Mud_Forehead_section%AddToFirst (MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_Mud_Backhead_X%AddToFirst (MudSystemDotOld_KickBackHead_X) + call Op_Mud_Backhead_section%AddToFirst (MudSystemDotOld_KickBackHead_Section) + call MudSystemDotOp_RemainedVolume_in_LastSection%AddToFirst (0.0d0) + call MudSystemDotOp_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) call Op_MudOrKick%AddToFirst (0) endif - iloc= 1 ! ok + MudSystemDotiLoc= 1 ! ok endif diff --git a/Equipments/MudSystem/MudSystem.f90 b/Equipments/MudSystem/MudSystem.f90 index 37bf145..8daab5e 100644 --- a/Equipments/MudSystem/MudSystem.f90 +++ b/Equipments/MudSystem/MudSystem.f90 @@ -217,7 +217,7 @@ module MudSystem !================================================ !============BellNippleToPits-FullWell============== - if(FirstMudSet== 1 ) then !.and. WellisNOTFull== .false.) then ! Well Must Be Full !Ann_Mud_Forehead_X%Last()==AboveAnnularHeight .and. Ann_Density%Last()/=0.0) + if(MudSystemDotFirstMudSet== 1 ) then !.and. WellisNOTFull== .false.) then ! Well Must Be Full !Ann_Mud_Forehead_X%Last()==AboveAnnularHeight .and. Ann_Density%Last()/=0.0) if(condition4) then j3=j3+1 B71=1 @@ -309,7 +309,7 @@ module MudSystem !============BellNippleToWell-NonFullWell============== - if(condition16 .and. FirstMudSet== 1 .and. BellNippleVolume > 0.0001 .and. WellisNOTFull) then + if(condition16 .and. MudSystemDotFirstMudSet== 1 .and. BellNippleVolume > 0.0001 .and. MudSystemDotWellisNOTFull) then write(*,*) 'MUD(7)%Q=' , MUD(7)%Q write(*,*) 'BellNippleVolume=' , BellNippleVolume @@ -638,9 +638,9 @@ module MudSystem implicit none Integer I - MudSys_timeCounter = MudSys_timeCounter + 1 + MudSystemDotMudSys_timeCounter = MudSystemDotMudSys_timeCounter + 1 if (ChokeControlPanel%ChokePanelStrokeResetSwitch == 1) then - MudSys_timeCounter= 0 + MudSystemDotMudSys_timeCounter= 0 endif !WRITE (*,*) 'MudSys_timeCounter', MudSys_timeCounter @@ -884,18 +884,18 @@ module MudSystem if (PumpPressure1 >= MaxWorkingPressure1 .and. MP1_Q > 0.0) then write(*,*) 'mp1,if=' , PumpPressure1 , MaxWorkingPressure1 , MP1_Q - Pump1BlownCount = Pump1BlownCount + 1 + MudSystemDotPump1BlownCount = MudSystemDotPump1BlownCount + 1 !if (Pump1BlownStarted == .FALSE.) then ! write(*,*) 'if (Pump1BlownStarted == .FALSE. ) then' ! Pump1BlownInTimeStep = SimulationTime + BlownThresholdInSecond ! Pump1BlownStarted = .TRUE. !endif !write(*,*) 'SimulationTime===', SimulationTime, Pump1BlownInTimeStep - if(PumpsSpecification%MudPump1ReliefValveIsSet .and. Pump1BlownCount >= BlownThreshold) then + if(PumpsSpecification%MudPump1ReliefValveIsSet .and. MudSystemDotPump1BlownCount >= BlownThreshold) then write(*,*) 'valve 65 open, BLOWN' call ChangeValve(65, .TRUE.) PumpToManifoldCompressedMudVol= 0.0 - Pump1BlownCount = 0 + MudSystemDotPump1BlownCount = 0 !Pump1BlownStarted = .FALSE. !else ! write(*,*) 'PumpPressure1= 6000 psi' @@ -917,17 +917,17 @@ module MudSystem if(PumpPressure2 >= MaxWorkingPressure2 .and. MP2_Q > 0.0 ) then write(*,*) 'mp2,if=' , PumpPressure2 , MaxWorkingPressure2 , MP2_Q - Pump2BlownCount = Pump2BlownCount + 1 + MudSystemDotPump2BlownCount = MudSystemDotPump2BlownCount + 1 !if (Pump2BlownStarted == .FALSE. ) then ! Pump2BlownInTimeStep = SimulationTime + BlownThresholdInSecond ! Pump2BlownStarted = .TRUE. !endif !if (MudPump2ReliefValveIsSet .and. SimulationTime >= Pump2BlownInTimeStep .and. Pump2BlownStarted) then - if (PumpsSpecification%MudPump2ReliefValveIsSet .and. Pump2BlownCount >= BlownThreshold) then + if (PumpsSpecification%MudPump2ReliefValveIsSet .and. MudSystemDotPump2BlownCount >= BlownThreshold) then write(*,*) 'valve 66 open, BLOWN' call ChangeValve(66, .TRUE.) PumpToManifoldCompressedMudVol= 0.0 - Pump2BlownCount = 0 + MudSystemDotPump2BlownCount = 0 !Pump2BlownInTimeStep = 0 !Pump2BlownStarted = .FALSE. !else @@ -942,12 +942,12 @@ module MudSystem !.or.(J14> 0 .and. j4==0 .and. j9==0 .and. NOT(ALLOCATED(GasPocketWeight%Array)))) .and. MP3_Q > 0.0 ) then if(PumpPressure3 >= MaxWorkingPressure3 .and. MP3_Q > 0.0 ) then - Pump3BlownCount = Pump3BlownCount + 1 - if (PumpsSpecification%CementPumpReliefValveIsSet .and. Pump3BlownCount >= BlownThreshold) then + MudSystemDotPump3BlownCount = MudSystemDotPump3BlownCount + 1 + if (PumpsSpecification%CementPumpReliefValveIsSet .and. MudSystemDotPump3BlownCount >= BlownThreshold) then !write(*,*) 'valve 67 open, BLOWN' call ChangeValve(67, .TRUE.) PumpToManifoldCompressedMudVol= 0.0 - Pump3BlownCount = 0 + MudSystemDotPump3BlownCount = 0 !else ! PumpPressure3= 6000. !psi endif @@ -959,13 +959,13 @@ module MudSystem !write(*,*) '3)PumpPressure1=' , PumpPressure1 if (PumpPressure1>= 6000.) then - Pump1BlownCount = Pump1BlownCount + 1 - if(Pump1BlownCount >= BlownThreshold) then + MudSystemDotPump1BlownCount = MudSystemDotPump1BlownCount + 1 + if(MudSystemDotPump1BlownCount >= BlownThreshold) then call ChangeValve(65, .TRUE.) PumpToManifoldCompressedMudVol= 0.0 call Activate_Pump1Failure() Pump1OffFailure= .true. - Pump1BlownCount = 0 + MudSystemDotPump1BlownCount = 0 endif !else !Pump1BlownInTimeStep = 0 @@ -973,13 +973,13 @@ module MudSystem endif if (PumpPressure2>= 6000.) then - Pump2BlownCount = Pump2BlownCount + 1 - if(Pump2BlownCount >= BlownThreshold) then + MudSystemDotPump2BlownCount = MudSystemDotPump2BlownCount + 1 + if(MudSystemDotPump2BlownCount >= BlownThreshold) then call ChangeValve(66, .TRUE.) PumpToManifoldCompressedMudVol= 0.0 call Activate_Pump2Failure() Pump2OffFailure= .true. - Pump2BlownCount = 0 + MudSystemDotPump2BlownCount = 0 endif !else !Pump2BlownInTimeStep = 0 @@ -987,13 +987,13 @@ module MudSystem endif if (PumpPressure3>= 6000.) then - Pump3BlownCount = Pump3BlownCount + 1 - if(Pump3BlownCount >= BlownThreshold) then + MudSystemDotPump3BlownCount = MudSystemDotPump3BlownCount + 1 + if(MudSystemDotPump3BlownCount >= BlownThreshold) then call ChangeValve(67, .TRUE.) PumpToManifoldCompressedMudVol= 0.0 call Activate_Pump3Failure() Pump3OffFailure= .true. - Pump3BlownCount = 0 + MudSystemDotPump3BlownCount = 0 endif !else !Pump3BlownInTimeStep = 0 @@ -1007,7 +1007,7 @@ module MudSystem !MUD(7)%Q= ( Ann_Saved_MudDischarged_Volume_Final+Ann_Kick_Saved_Volume_Final - ((Qlost/60.0d0)*DeltaT_Mudline) )*60.d0/DeltaT_Mudline - MUD(7)%Q= ( MudVolume_InjectedFromAnn + Ann_Kick_Saved_Volume )*60.d0/DeltaT_Mudline !Injected is referred only to Mud + MUD(7)%Q= ( MudVolume_InjectedFromAnn + MudSystemDotAnn_Kick_Saved_Volume )*60.d0/DeltaT_Mudline !Injected is referred only to Mud if (j4 > 0) then @@ -1394,14 +1394,14 @@ module MudSystem !WRITE (*,*) 'choke condition', j4, ChokeLineNOTFull - if (j4 > 0 .and. ChokeLineNOTFull== .false.) then !WellToChokeManifold(Through 26) + if (j4 > 0 .and. MudSystemDotChokeLineNOTFull== .false.) then !WellToChokeManifold(Through 26) !write(*,*) 'j4 is open' !write(*,*) 'active by j4' !MUD(4)%Q= ( Ann_Saved_MudDischarged_Volume_Final+Ann_Kick_Saved_Volume_Final - ((Qlost/60.0d0)*DeltaT_Mudline) )*60.d0/DeltaT_Mudline - MUD(4)%Q= ( MudVolume_InjectedFromAnn + Ann_Kick_Saved_Volume )*60.d0/DeltaT_Mudline !Injected is referred only to Mud + MUD(4)%Q= ( MudVolume_InjectedFromAnn + MudSystemDotAnn_Kick_Saved_Volume )*60.d0/DeltaT_Mudline !Injected is referred only to Mud !if ( WellisNOTFull== .true. ) MUD(4)%Q= 0.0 @@ -1415,7 +1415,7 @@ module MudSystem !call Log_1('MUD(4)%Q=', MUD(4)%Q) - ChokeOutletDensity= ChokeLine_Density%Last() ! <<< in CirculationCodeSelect Code + ChokeOutletDensity= MudSystemDotChokeLine_Density%Last() ! <<< in CirculationCodeSelect Code !MudWeightOut2= ChokeOutletDensity !for drillwatch display @@ -1583,7 +1583,7 @@ module MudSystem - if (j4 == 0 .or. ChokeLineNOTFull== .true.) then + if (j4 == 0 .or. MudSystemDotChokeLineNOTFull== .true.) then !Pressure_BeforeChokes=0.0 ! for normal circulation input MUD(4)%Q=0.0 ! for CirculationCodeSelect input. endif diff --git a/Equipments/MudSystem/MudSystemStartup.f90 b/Equipments/MudSystem/MudSystemStartup.f90 index 153bc25..e3e42e1 100644 --- a/Equipments/MudSystem/MudSystemStartup.f90 +++ b/Equipments/MudSystem/MudSystemStartup.f90 @@ -20,15 +20,15 @@ !Pump2BlownStarted = .FALSE. !Pump3BlownStarted = .FALSE. - Pump1BlownCount = 0 - Pump2BlownCount = 0 - Pump3BlownCount = 0 + MudSystemDotPump1BlownCount = 0 + MudSystemDotPump2BlownCount = 0 + MudSystemDotPump3BlownCount = 0 -DeltaWellCap=0. -WellCapOld = 0. -AnnCapOld=0. -DeltaAnnCap=0. +MudSystemDotDeltaWellCap=0. +MudSystemDotWellCapOld = 0. +MudSystemDotAnnCapOld=0. +MudSystemDotDeltaAnnCap=0. total_pumps%Total_Stroke_Counter_For_Plot = 0.0 @@ -39,58 +39,58 @@ total_pumps%Total_Stroke_Counter_For_Plot = 0.0 Call Set_FlowPipeDisconnect(.false.) !HZ_ADD= 0.d0 -Flow_timeCounter= 0 -MudSys_timeCounter= 0 -FluidFlowCounter = 0 +MudSystemDotFlow_timeCounter= 0 +MudSystemDotMudSys_timeCounter= 0 +MudSystemDotFluidFlowCounter = 0 !======================================================================== ! MUD CIRCULATION STARTUP !======================================================================== - FormationLostPressure= Shoe%LeakOff * Shoe%ShoeDepth - ShoeFractured= .false. + MudSystemDotFormationLostPressure= Shoe%LeakOff * Shoe%ShoeDepth + MudSystemDotShoeFractured= .false. - UGBOSuccessionCounter = 0 ! also in starup - UGBOSuccessionCounterOld = 0 ! also in starup + MudSystemDotUGBOSuccessionCounter = 0 ! also in starup + MudSystemDotUGBOSuccessionCounterOld = 0 ! also in starup - ChokeLineFlowRate= 0.0 - StringFlowRate= 0.0 - AnnulusFlowRate= 0.0 + MudSystemDotChokeLineFlowRate= 0.0 + MudSystemDotStringFlowRate= 0.0 + MudSystemDotAnnulusFlowRate= 0.0 MudVolume_InjectedFromAnn= 0.D0 - MudVolume_InjectedToBH= 0.D0 + MudSystemDotMudVolume_InjectedToBH= 0.D0 - DensityMixTol= 0.1 !(ppg) - CuttingDensityMixTol= 0.5 - NewPipeFilling= 1 - UtubeFilling= 1 - UtubeEmptyVolume= 0.0 + MudSystemDotDensityMixTol= 0.1 !(ppg) + MudSystemDotCuttingDensityMixTol= 0.5 + MudSystemDotNewPipeFilling= 1 + MudSystemDotUtubeFilling= 1 + MudSystemDotUtubeEmptyVolume= 0.0 - UtubeMode1Activated= .false. - UtubeMode2Activated= .false. - UtubePossibility= .false. + MudSystemDotUtubeMode1Activated= .false. + MudSystemDotUtubeMode2Activated= .false. + MudSystemDotUtubePossibility= .false. !KickMigration_2SideBit = .FALSE. - KickDx= (Reservoir%AutoMigrationRate/3600.)*DeltaT_Mudline !AutoMigrationRate (ft/h)= ft per DeltaT_Mudline + MudSystemDotKickDx= (Reservoir%AutoMigrationRate/3600.)*DeltaT_Mudline !AutoMigrationRate (ft/h)= ft per DeltaT_Mudline - NewInfluxElementCreated= 0 - NewInfluxNumber= 0 + MudSystemDotNewInfluxElementCreated= 0 + MudSystemDotNewInfluxNumber= 0 !KickVolumeinAnnulus= 0.0 - KickDeltaVinAnnulus= 0.0 + MudSystemDotKickDeltaVinAnnulus= 0.0 GasKickPumpFlowRate= 0.0 - FirstMudSet= 0 - FirstSetUtube1=0 - FirstSetUtube2=0 - SuctionMud=1 - ImudCount= 1 - imud=1 - iLoc= 1 ! for Kick + MudSystemDotFirstMudSet= 0 + MudSystemDotFirstSetUtube1=0 + MudSystemDotFirstSetUtube2=0 + MudSystemDotSuctionMud=1 + MudSystemDotImudCount= 1 + MudSystemDotimud=1 + MudSystemDotiLoc= 1 ! for Kick Suction_Density_MudSystem= MudProperties%ActiveDensity SuctionDensity_Old= MudProperties%ActiveDensity ! initial(ppg) @@ -98,10 +98,10 @@ FluidFlowCounter = 0 AnnulusSuctionDensity_Old= MudProperties%ActiveDensity ! initial(ppg) ChokeLineDensity_Old= MudProperties%ActiveDensity ! initial(ppg) - TotalAddedVolume= 0. + MudSystemDotTotalAddedVolume= 0. - xx=0. + MudSystemDotxx=0. @@ -331,8 +331,8 @@ PIPINGS_MUDLINE(4,1)= BopStackSpecification%ChokeLineId PIPINGS_MUDLINE(4,2)= BopStackSpecification%ChokeLineLength PIPINGS_MUDLINE(4,3)= 0.03 !(MLnumber=4,,WellToChokeManifold) -Area_ChokeLineFt= PII*((BopStackSpecification%ChokeLineId/12.)**2)/4. !D(in), AREA(ft^2) -ChokeLine_VolumeCapacity= Area_ChokeLineFt* BopStackSpecification%ChokeLineLength* 7.48051948 ! (gal) +MudSystemDotArea_ChokeLineFt= PII*((BopStackSpecification%ChokeLineId/12.)**2)/4. !D(in), AREA(ft^2) +MudSystemDotChokeLine_VolumeCapacity= MudSystemDotArea_ChokeLineFt* BopStackSpecification%ChokeLineLength* 7.48051948 ! (gal) ALLOCATE (DIAM_MUDLINE_INCH(NO_PIPINGSMUDLINE), & AREA_MUDLINE(NO_PIPINGSMUDLINE),LENGT_MUDLINE(NO_PIPINGSMUDLINE),ROUGHNESS_MUDLINE(NO_PIPINGSMUDLINE),RELROUGH_MUDLINE(NO_PIPINGSMUDLINE)) diff --git a/Equipments/MudSystem/MudSystem_Variables.f90 b/Equipments/MudSystem/MudSystem_Variables.f90 index c8f3368..dd09e2e 100644 --- a/Equipments/MudSystem/MudSystem_Variables.f90 +++ b/Equipments/MudSystem/MudSystem_Variables.f90 @@ -16,71 +16,69 @@ USE CReservoirVariables IMPLICIT NONE + integer, parameter :: BlownThreshold = 10 ! temporary varibales for solving pressure jerks -- 1399-11-09 - integer Pump1BlownCount, Pump2BlownCount, Pump3BlownCount - integer, parameter :: BlownThreshold = 10 + integer MudSystemDotPump1BlownCount, MudSystemDotPump2BlownCount, MudSystemDotPump3BlownCount !integer Pump1BlownInTimeStep, Pump2BlownInTimeStep, Pump3BlownInTimeStep !logical Pump1BlownStarted, Pump2BlownStarted, Pump3BlownStarted !integer, parameter :: BlownThresholdInSecond = 5 - - -real(8) total_add,total_injected - real(8) DeltaWellCap,WellCapOld,AnnCapOld,DeltaAnnCap - + real(8) MudSystemDottotal_add,MudSystemDottotal_injected + real(8) MudSystemDotDeltaWellCap,MudSystemDotWellCapOld,MudSystemDotAnnCapOld,MudSystemDotDeltaAnnCap !======================================================================== ! KICK VARIABLES !======================================================================== -REAL(8) KickDeltaVinAnnulus, KickVolumeinAnnulus -REAL(8) Kick_Forehead_X,Kick_RemainedVolume_in_LastSection,BackheadX,KickDv,KickDx,MinKickDv,Old_KickBackHead_X,Kick_Density -INTEGER NewInfluxElementCreated,Kick_Forehead_section,MudSection,Op_KickLoc,Ann_KickLoc,FirstSetKickMigration,Old_KickBackHead_Section -Integer iLoc,ChokeLine_KickLoc,KickNumber,NewInfluxNumber,SoundGasThroughChoke +REAL(8) MudSystemDotKickDeltaVinAnnulus, MudSystemDotKickVolumeinAnnulus +REAL(8) MudSystemDotKick_Forehead_X,MudSystemDotKick_RemainedVolume_in_LastSection,MudSystemDotBackheadX,MudSystemDotKickDv,MudSystemDotKickDx,MudSystemDotMinKickDv,MudSystemDotOld_KickBackHead_X,MudSystemDotKick_Density +INTEGER MudSystemDotNewInfluxElementCreated,MudSystemDotKick_Forehead_section,MudSystemDotMudSection,MudSystemDotOp_KickLoc,MudSystemDotAnn_KickLoc,MudSystemDotFirstSetKickMigration,MudSystemDotOld_KickBackHead_Section +Integer MudSystemDotiLoc,MudSystemDotChokeLine_KickLoc,MudSystemDotKickNumber,MudSystemDotNewInfluxNumber,MudSystemDotSoundGasThroughChoke -LOGICAL DrillingMode +LOGICAL MudSystemDotDrillingMode !real(8) HZ_ADD -integer Flow_timeCounter,MudSys_timeCounter,FluidFlowCounter +integer MudSystemDotFlow_timeCounter,MudSystemDotMudSys_timeCounter,MudSystemDotFluidFlowCounter !======================================================================== ! MUD CIRCULATION !======================================================================== -REAL(8), ALLOCATABLE:: Xstart_PipeSection(:),Xend_PipeSection(:),PipeSection_VolumeCapacity(:),Area_PipeSectionFt(:),OD_PipeSectionInch(:),ID_PipeSectionInch(:),Angle_PipeSection(:) -REAL(8), ALLOCATABLE:: Xstart_OpSection(:),Xend_OpSection(:),Area_OpSectionFt(:),OD_OpSectionInch(:),ID_OpSectionInch(:),OpSection_VolumeCapacity(:),GeoTypeOp(:),Angle_OpSection(:) -REAL(8), ALLOCATABLE:: TDXstart_MudElementArray(:) , TDXend_MudElementArray(:) , TDDensity_MudElementArray(:) - -INTEGER, ALLOCATABLE:: GeoType(:) -real(8) StMudVolumeSum,St_MudSaved_Density,St_Saved_MudDischarged_Volume,St_Saved_MudDischarged_Volume_Final,MudVolume_InjectedToBH,MudVolume_InjectedFromAnn -real BitMudDensity -REAL(8) xx,TrueMinValue,NewVolume,UtubeEmptyVolume,NewDensity, MudCircVerticalDepth -REAL DirectionCoef -INTEGER isection,OpSection,imud,SuctionMud,NoStringMudElements,ImudCount,NoCasingMudElements,NoHorizontalMudElements,AddedElementsToString -Integer TDNoHorizontalMudElements, TDNoStringMudElements, TDNoCasingMudElements -Integer istring,icasing,iisection,NoPipeSections,FirstMudSet -INTEGER NoBottomHoleMudElements,NoStringMudElementsForPlot,F_StringIntervalCounts_Old -INTEGER FirstSetUtube1,FirstSetUtube2,FirstAdded,NewPipeFilling,Hz_MudOrKick_Utube,UtubeFilling,totalLength -REAL(8) DeltaVolumeOp,DeltaVTemp,OldPosition,StringFlowRate,StringFlowRateFinal,AnnulusFlowRateFinal,TD_RemoveVolume_Remained,DeltaVolumePipe,DeltaVolumeAnnulusCapacity -REAL AnnulusFlowRate,ChokeLineFlowRate -Logical:: UtubePossibility,MudIsChanged,AddedPipe,UtubeMode1Activated,UtubeMode2Activated,WellisNOTFull,ChokeLineNOTFull -Logical:: ShoeLost,ShoeFractured,Kickexpansion_DueToMudLost,LostInTripOutIsDone -Integer UGBOSuccessionCounter, UGBOSuccessionCounterOld -REAL(8) Area_ChokeLineFt, ChokeLine_VolumeCapacity,TotalAddedVolume,LackageMudVolumeAfterFilling, LackageMudVolume, NewInflux_Density -real(8) DensityMixTol,Hz_Density_Utube,CuttingDensityMixTol,Op_Kick_Saved_Volume,Op_MudSaved_Density,Op_KickSaved_Density,Op_Saved_MudDischarged_Volume,OpMudVolumeSum,Op_NeededVolume_ToFill -real(8) Choke_Kick_Saved_Volume,Choke_Saved_MudDischarged_Volume,Choke_KickSaved_Density,Choke_MudSaved_Density,ChokeMudVolumeSum -integer Saved_Op_MudOrKick,Saved_Ann_MudOrKick,Saved_Choke_MudOrKick -real(8) Choke_Saved_MudDischarged_Volume_Final,Choke_Kick_Saved_Volume_Final -real(8) Qlost,FormationLostPressure,ShoeMudPressure,ShoeLostCoef, ShoeMudViscosity, ShoeMudDensity ,OldAnnulusCapacity -logical:: Ann_to_Choke_2mud -real(8) AnnMudVolumeSum,Ann_MudSaved_Density,Ann_KickSaved_Density,Ann_Saved_MudDischarged_Volume,Ann_Kick_Saved_Volume,Ann_Saved_MudDischarged_Volume_Final, Ann_Kick_Saved_Volume_Final -type(DynamicDoubleArrayType) :: Hz_MudDischarged_Volume,Hz_Mud_Backhead_X,Hz_Mud_Forehead_X,Hz_Density,Hz_RemainedVolume_in_LastSection,Hz_EmptyVolume_inBackheadLocation, & - Op_MudDischarged_Volume,Op_Mud_Backhead_X,Op_Mud_Forehead_X,Op_Density,Op_RemainedVolume_in_LastSection,Op_EmptyVolume_inBackheadLocation - -type(DynamicDoubleArrayType) :: ChokeLine_MudDischarged_Volume,ChokeLine_Mud_Backhead_X,ChokeLine_Mud_Forehead_X,ChokeLine_Density,ChokeLine_RemainedVolume_in_LastSection, & - ChokeLine_EmptyVolume_inBackheadLocation - - -type(DynamicDoubleArrayType) :: St_MudDischarged_Volume,St_Mud_Backhead_X,St_Mud_Forehead_X,St_Density,St_RemainedVolume_in_LastSection, & - St_EmptyVolume_inBackheadLocation,Ann_MudDischarged_Volume,Ann_Mud_Backhead_X,Ann_Mud_Forehead_X, & +REAL(8), ALLOCATABLE:: MudSystemDotXstart_PipeSection(:),MudSystemDotXend_PipeSection(:),MudSystemDotPipeSection_VolumeCapacity(:),MudSystemDotArea_PipeSectionFt(:),MudSystemDotOD_PipeSectionInch(:),MudSystemDotID_PipeSectionInch(:),MudSystemDotAngle_PipeSection(:) +REAL(8), ALLOCATABLE:: MudSystemDotXstart_OpSection(:),MudSystemDotXend_OpSection(:),MudSystemDotArea_OpSectionFt(:),MudSystemDotOD_OpSectionInch(:),MudSystemDotID_OpSectionInch(:),MudSystemDotOpSection_VolumeCapacity(:),MudSystemDotGeoTypeOp(:),MudSystemDotAngle_OpSection(:) +REAL(8), ALLOCATABLE:: MudSystemDotTDXstart_MudElementArray(:) , MudSystemDotTDXend_MudElementArray(:) , MudSystemDotTDDensity_MudElementArray(:) + +INTEGER, ALLOCATABLE:: MudSystemDotGeoType(:) +real(8) MudSystemDotStMudVolumeSum,MudSystemDotSt_MudSaved_Density,MudSystemDotSt_Saved_MudDischarged_Volume,MudSystemDotSt_Saved_MudDischarged_Volume_Final,MudSystemDotMudVolume_InjectedToBH,MudSystemDotMudVolume_Injec2tedFromAnn +real MudSystemDotBitMudDensity +REAL(8) MudSystemDotxx,MudSystemDotNewVolume,MudSystemDotUtubeEmptyVolume,MudSystemDotNe2wDensity, MudSystemDotMudCircVerticalDepth +! ,TrueMinValue +REAL MudSystemDotDirectionCoef +INTEGER MudSystemDotisection,MudSystemDotOpSection,MudSystemDotimud,MudSystemDotSuctionMud,MudSystemDotNoStringMudElements,MudSystemDotImudCount,MudSystemDotNoCasingMudElements,MudSystemDotNoHorizontalMudElements,MudSystemDotAddedElementsToString +Integer MudSystemDotTDNoHorizontalMudElements, MudSystemDotTDNoStringMudElements, MudSystemDotTDNoCasingMudElements +Integer MudSystemDotistring,MudSystemDoticasing,MudSystemDotiisection,MudSystemDotNoPipeSections,MudSystemDotFirstMudSet +INTEGER MudSystemDotNoBottomHoleMudElements,MudSystemDotNoStringMudElementsForPlot,MudSystemDotF_StringIntervalCounts_Old +INTEGER MudSystemDotFirstSetUtube1,MudSystemDotFirstSetUtube2,MudSystemDotFirstAdded,MudSystemDotNewPipeFilling,MudSystemDotHz_MudOrKick_Utube,MudSystemDotUtubeFilling,MudSystemDottotalLength +REAL(8) MudSystemDotDeltaVolumeOp,MudSystemDotDeltaVTemp,MudSystemDotOldPosition,MudSystemDotStringFlowRate,MudSystemDotStringFlowRateFinal,MudSystemDotAnnulusFlowRateFinal,MudSystemDotTD_RemoveVolume_Remained,MudSystemDotDeltaVolumePipe,MudSystemDotDeltaVolumeAnnulusCapacity +REAL MudSystemDotAnnulusFlowRate,MudSystemDotChokeLineFlowRate +Logical:: MudSystemDotUtubePossibility,MudSystemDotMudIsChanged,MudSystemDotAddedPipe,MudSystemDotUtubeMode1Activated,MudSystemDotUtubeMode2Activated,MudSystemDotWellisNOTFull,MudSystemDotChokeLineNOTFull +Logical:: MudSystemDotShoeLost,MudSystemDotShoeFractured,MudSystemDotKickexpansion_DueToMudLost,MudSystemDotLostInTripOutIsDone +Integer MudSystemDotUGBOSuccessionCounter, MudSystemDotUGBOSuccessionCounterOld +REAL(8) MudSystemDotArea_ChokeLineFt, MudSystemDotChokeLine_VolumeCapacity,MudSystemDotTotalAddedVolume,MudSystemDotLackageMudVolumeAfterFilling, MudSystemDotLackageMudVolume, MudSystemDotNewInflux_Density +real(8) MudSystemDotDensityMixTol,MudSystemDotHz_Density_Utube,MudSystemDotCuttingDensityMixTol,MudSystemDotOp_Kick_Saved_Volume,MudSystemDotOp_MudSaved_Density,MudSystemDotOp_KickSaved_Density,MudSystemDotOp_Saved_MudDischarged_Volume,MudSystemDotOpMudVolumeSum,MudSystemDotOp_NeededVolume_ToFill +real(8) MudSystemDotChoke_Kick_Saved_Volume,MudSystemDotChoke_Saved_MudDischarged_Volume,MudSystemDotChoke_KickSaved_Density,MudSystemDotChoke_MudSaved_Density,MudSystemDotChokeMudVolumeSum +integer MudSystemDotSaved_Op_MudOrKick,MudSystemDotSaved_Ann_MudOrKick,MudSystemDotSaved_Choke_MudOrKick +real(8) MudSystemDotChoke_Saved_MudDischarged_Volume_Final,MudSystemDotChoke_Kick_Saved_Volume_Final +real(8) MudSystemDotQlost,MudSystemDotFormationLostPressure,MudSystemDotShoeMudPressure,MudSystemDotShoeLostCoef, MudSystemDotShoeMudViscosity, MudSystemDotShoeMudDensity ,MudSystemDotOldAnnulusCapacity +logical:: MudSystemDotAnn_to_Choke_2mud +real(8) MudSystemDotAnnMudVolumeSum,MudSystemDotAnn_MudSaved_Density,MudSystemDotAnn_KickSaved_Density,MudSystemDotAnn_Saved_MudDischarged_Volume,MudSystemDotAnn_Kick_Saved_Volume,MudSystemDotAnn_Saved_MudDischarged_Volume_Final, MudSystemDotAnn_Kick_Saved_Volume_Final +type(DynamicDoubleArrayType) :: MudSystemDotHz_MudDischarged_Volume,MudSystemDotHz_Mud_Backhead_X,MudSystemDotHz_Mud_Forehead_X,MudSystemDotHz_Density,MudSystemDotHz_RemainedVolume_in_LastSection,MudSystemDotHz_EmptyVolume_inBackheadLocation, & + MudSystemDotOp_MudDischarged_Volume,MudSystemDotOp_Mud_Backhead_X,MudSystemDotOp_Mud_Forehead_X,MudSystemDotOp_Density,MudSystemDotOp_RemainedVolume_in_LastSection,MudSystemDotOp_EmptyVolume_inBackheadLocation + +type(DynamicDoubleArrayType) :: MudSystemDotChokeLine_MudDischarged_Volume,MudSystemDotChokeLine_Mud_Backhead_X,MudSystemDotChokeLine_Mud_Forehead_X,MudSystemDotChokeLine_Density,MudSystemDotChokeLine_RemainedVolume_in_LastSection, & + MudSystemDotChokeLine_EmptyVolume_inBackheadLocation + + +type(DynamicDoubleArrayType) :: MudSystemDotSt_MudDischarged_Volume,MudSystemDotSt_Mud_Backhead_X,MudSystemDotSt_Mud_Forehead_X,St_Density,MudSystemDotSt_RemainedVolume_in_LastSection, & + MudSystemDotSt_EmptyVolume_inBackheadLocation,MudSystemDotAnn_MudDischarged_Volume,Ann_Mud_Backhead_X,Ann_Mud_Forehead_X, & Ann_Density,Ann_RemainedVolume_in_LastSection,Ann_EmptyVolume_inBackheadLocation type(DynamicIntegerArrayType) :: St_Mud_Backhead_section,St_Mud_Forehead_section,Ann_Mud_Backhead_section,Ann_Mud_Forehead_section,MudGeoType,Hz_Mud_Backhead_section,Hz_Mud_Forehead_section, & @@ -206,23 +204,6 @@ logical Pump1OffFailure,Pump2OffFailure,Pump3OffFailure,ChokeLineGaugeToTanks,We END TYPE MUD_TypeVars2D TYPE(MUD_TypeVars2D) :: MUDS - - - - - - ! 1 : MLnumber=1,,PumpsToString - ! 2 : MLnumber=2,,STGaugeToString - ! 3 : MLnumber=3,,WellToPits - - - - - - - - - END MODULE diff --git a/Equipments/MudSystem/Plot_Final_Mud_Elements.f90 b/Equipments/MudSystem/Plot_Final_Mud_Elements.f90 index 8ef9d4d..4971056 100644 --- a/Equipments/MudSystem/Plot_Final_Mud_Elements.f90 +++ b/Equipments/MudSystem/Plot_Final_Mud_Elements.f90 @@ -31,10 +31,10 @@ subroutine PlotFinalMudElements ! is called in subroutine CirculationCodeSel if (ChokeControlPanel%ChokePanelStrokeResetSwitch == 1) then - write(*,*) 'well cap=' , sum(PipeSection_VolumeCapacity(F_StringIntervalCounts+1:NoPipeSections)) + sum(OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) - DeltaWellCap= sum(PipeSection_VolumeCapacity(F_StringIntervalCounts+1:NoPipeSections)) + sum(OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) - WellCapOld - WellCapOld= sum(PipeSection_VolumeCapacity(F_StringIntervalCounts+1:NoPipeSections)) + sum(OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) - write(*,*) 'cap_reset,DeltaWellCap=' , DeltaWellCap + write(*,*) 'well cap=' , sum(MudSystemDotPipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystemDotNoPipeSections)) + sum(MudSystemDotOpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) + MudSystemDotDeltaWellCap= sum(MudSystemDotPipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystemDotNoPipeSections)) + sum(MudSystemDotOpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) - MudSystemDotWellCapOld + MudSystemDotWellCapOld= sum(MudSystemDotPipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystemDotNoPipeSections)) + sum(MudSystemDotOpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) + write(*,*) 'cap_reset,DeltaWellCap=' , MudSystemDotDeltaWellCap endif @@ -42,16 +42,16 @@ subroutine PlotFinalMudElements ! is called in subroutine CirculationCodeSel !========================ANNULUS END================= if ((Ann_Mud_Forehead_X%Last() - BopStackSpecification%AboveAnnularHeight) > 0.8 .or. Ann_Density%Last()==0.0) then ! for Line (BellNippleToWell-NonFullWell) - WellisNOTFull= .true. + MudSystemDotWellisNOTFull= .true. else - WellisNOTFull= .false. + MudSystemDotWellisNOTFull= .false. endif !WRITE(*,*) 'Ann_Mud_Forehead_X%Last() , KillHeight', Ann_Mud_Forehead_X%Last() , KillHeight if ((Ann_Mud_Forehead_X%Last() - BopStackSpecification%KillHeight)>0.8 .or. Ann_Density%Last()==0.0) then ! for Line j4 , WellToChokeManifold(Through 26) - ChokeLineNOTFull= .true. + MudSystemDotChokeLineNOTFull= .true. else - ChokeLineNOTFull= .false. + MudSystemDotChokeLineNOTFull= .false. endif @@ -75,22 +75,22 @@ endif - DO WHILE(jmud <= Hz_Mud_Forehead_X%Length() .and. jsection<=1) + DO WHILE(jmud <= MudSystemDotHz_Mud_Forehead_X%Length() .and. jsection<=1) jelement= jelement+1 - TrueMinValue= min(Hz_Mud_Forehead_X%Array(jmud), Xend_PipeSection(jsection)) + TrueMinValue= min(MudSystemDotHz_Mud_Forehead_X%Array(jmud), MudSystemDotXend_PipeSection(jsection)) call Xend_MudElement%Add(TrueMinValue) - call TVD_Calculator(TrueMinValue,MudCircVerticalDepth) - call TVDend_MudElement%Add(MudCircVerticalDepth) - call Density_MudElement%Add(Hz_Density%Array(jmud)) - call PipeID_MudElement%Add(ID_PipeSectionInch(jsection)) - call PipeOD_MudElement%Add(OD_PipeSectionInch(jsection)) + call TVD_Calculator(TrueMinValue,MudSystemDotMudCircVerticalDepth) + call TVDend_MudElement%Add(MudSystemDotMudCircVerticalDepth) + call Density_MudElement%Add(MudSystemDotHz_Density%Array(jmud)) + call PipeID_MudElement%Add(MudSystemDotID_PipeSectionInch(jsection)) + call PipeOD_MudElement%Add(MudSystemDotOD_PipeSectionInch(jsection)) !call Angle_MudElement%Add(Angle_PipeSection(jsection)) call MudType_MudElement%Add(Hz_MudOrKick%Array(jmud)) - if (Xend_MudElement%Array(jelement)== Hz_Mud_Forehead_X%Array(jmud)) then + if (Xend_MudElement%Array(jelement)== MudSystemDotHz_Mud_Forehead_X%Array(jmud)) then jmud= jmud+1 else jsection= jsection+1 @@ -98,7 +98,7 @@ endif ENDDO - NoHorizontalMudElements= jelement + MudSystemDotNoHorizontalMudElements= jelement @@ -106,22 +106,22 @@ endif jmud= 1 jsection= 2 - DO WHILE(jmud <= St_Mud_Forehead_X%Length() .and. jsection<=F_StringIntervalCounts) + DO WHILE(jmud <= MudSystemDotSt_Mud_Forehead_X%Length() .and. jsection<=F_StringIntervalCounts) jelement= jelement+1 - TrueMinValue= min(St_Mud_Forehead_X%Array(jmud), Xend_PipeSection(jsection)) + TrueMinValue= min(MudSystemDotSt_Mud_Forehead_X%Array(jmud), MudSystemDotXend_PipeSection(jsection)) call Xend_MudElement%Add(TrueMinValue) - call TVD_Calculator(TrueMinValue,MudCircVerticalDepth) - call TVDend_MudElement%Add(MudCircVerticalDepth) + call TVD_Calculator(TrueMinValue,MudSystemDotMudCircVerticalDepth) + call TVDend_MudElement%Add(MudSystemDotMudCircVerticalDepth) call Density_MudElement%Add(St_Density%Array(jmud)) - call PipeID_MudElement%Add(ID_PipeSectionInch(jsection)) - call PipeOD_MudElement%Add(OD_PipeSectionInch(jsection)) + call PipeID_MudElement%Add(MudSystemDotID_PipeSectionInch(jsection)) + call PipeOD_MudElement%Add(MudSystemDotOD_PipeSectionInch(jsection)) !call Angle_MudElement%Add(Angle_PipeSection(jsection)) call MudType_MudElement%Add(St_MudOrKick%Array(jmud)) - if (Xend_MudElement%Array(jelement)== St_Mud_Forehead_X%Array(jmud)) then + if (Xend_MudElement%Array(jelement)== MudSystemDotSt_Mud_Forehead_X%Array(jmud)) then jmud= jmud+1 else jsection= jsection+1 @@ -129,7 +129,7 @@ endif ENDDO - NoStringMudElements= jelement- NoHorizontalMudElements + MudSystemDotNoStringMudElements= jelement- MudSystemDotNoHorizontalMudElements @@ -137,17 +137,17 @@ endif jmud= 1 jsection= F_StringIntervalCounts+1 - DO WHILE(jmud<= Ann_Mud_Forehead_X%Length() .and. jsection<=NoPipeSections) + DO WHILE(jmud<= Ann_Mud_Forehead_X%Length() .and. jsection<=MudSystemDotNoPipeSections) jelement= jelement+1 - TrueMinValue= max(Ann_Mud_Forehead_X%Array(jmud), Xend_PipeSection(jsection)) + TrueMinValue= max(Ann_Mud_Forehead_X%Array(jmud), MudSystemDotXend_PipeSection(jsection)) call Xend_MudElement%Add(TrueMinValue) - call TVD_Calculator(TrueMinValue,MudCircVerticalDepth) - call TVDend_MudElement%Add(MudCircVerticalDepth) + call TVD_Calculator(TrueMinValue,MudSystemDotMudCircVerticalDepth) + call TVDend_MudElement%Add(MudSystemDotMudCircVerticalDepth) call Density_MudElement%Add(Ann_Density%Array(jmud)) - call PipeID_MudElement%Add(ID_PipeSectionInch(jsection)) - call PipeOD_MudElement%Add(OD_PipeSectionInch(jsection)) + call PipeID_MudElement%Add(MudSystemDotID_PipeSectionInch(jsection)) + call PipeOD_MudElement%Add(MudSystemDotOD_PipeSectionInch(jsection)) !call Angle_MudElement%Add(Angle_PipeSection(jsection)) call MudType_MudElement%Add(Ann_MudOrKick%Array(jmud)) @@ -161,14 +161,14 @@ endif ENDDO do i= 2, Xend_MudElement%Length() - if ( i== NoHorizontalMudElements+NoStringMudElements+1) then + if ( i== MudSystemDotNoHorizontalMudElements+MudSystemDotNoStringMudElements+1) then call Xstart_MudElement%Add (Ann_Mud_Backhead_X%Array(1)) ! start of annulus - call TVD_Calculator(Ann_Mud_Backhead_X%Array(1),MudCircVerticalDepth) - call TVDstart_MudElement%Add(MudCircVerticalDepth) - elseif ( i== NoHorizontalMudElements+1 ) then - call Xstart_MudElement%Add (St_Mud_Backhead_X%Array(1)) ! start of stirng - call TVD_Calculator(St_Mud_Backhead_X%Array(1),MudCircVerticalDepth) - call TVDstart_MudElement%Add(MudCircVerticalDepth) + call TVD_Calculator(Ann_Mud_Backhead_X%Array(1),MudSystemDotMudCircVerticalDepth) + call TVDstart_MudElement%Add(MudSystemDotMudCircVerticalDepth) + elseif ( i== MudSystemDotNoHorizontalMudElements+1 ) then + call Xstart_MudElement%Add (MudSystemDotSt_Mud_Backhead_X%Array(1)) ! start of stirng + call TVD_Calculator(MudSystemDotSt_Mud_Backhead_X%Array(1),MudSystemDotMudCircVerticalDepth) + call TVDstart_MudElement%Add(MudSystemDotMudCircVerticalDepth) else call Xstart_MudElement%Add(Xend_MudElement%Array(i-1)) ! normal calculation call TVDstart_MudElement%Add(TVDend_MudElement%Array(i-1)) ! normal calculation @@ -176,25 +176,25 @@ endif enddo - NoCasingMudElements = jelement- NoStringMudElements- NoHorizontalMudElements + MudSystemDotNoCasingMudElements = jelement- MudSystemDotNoStringMudElements- MudSystemDotNoHorizontalMudElements !=========================For Torque and Drag======================== - if (allocated(TDXstart_MudElementArray)) deallocate(TDXstart_MudElementArray) - allocate(TDXstart_MudElementArray(NoHorizontalMudElements+NoStringMudElements+NoCasingMudElements)) - if (allocated(TDXend_MudElementArray)) deallocate(TDXend_MudElementArray) - allocate(TDXend_MudElementArray(NoHorizontalMudElements+NoStringMudElements+NoCasingMudElements)) - if (allocated(TDDensity_MudElementArray)) deallocate(TDDensity_MudElementArray) - allocate(TDDensity_MudElementArray(NoHorizontalMudElements+NoStringMudElements+NoCasingMudElements)) + if (allocated(MudSystemDotTDXstart_MudElementArray)) deallocate(MudSystemDotTDXstart_MudElementArray) + allocate(MudSystemDotTDXstart_MudElementArray(MudSystemDotNoHorizontalMudElements+MudSystemDotNoStringMudElements+MudSystemDotNoCasingMudElements)) + if (allocated(MudSystemDotTDXend_MudElementArray)) deallocate(MudSystemDotTDXend_MudElementArray) + allocate(MudSystemDotTDXend_MudElementArray(MudSystemDotNoHorizontalMudElements+MudSystemDotNoStringMudElements+MudSystemDotNoCasingMudElements)) + if (allocated(MudSystemDotTDDensity_MudElementArray)) deallocate(MudSystemDotTDDensity_MudElementArray) + allocate(MudSystemDotTDDensity_MudElementArray(MudSystemDotNoHorizontalMudElements+MudSystemDotNoStringMudElements+MudSystemDotNoCasingMudElements)) - TDNoHorizontalMudElements= NoHorizontalMudElements - TDNoStringMudElements= NoStringMudElements - TDNoCasingMudElements= NoCasingMudElements + MudSystemDotTDNoHorizontalMudElements= MudSystemDotNoHorizontalMudElements + MudSystemDotTDNoStringMudElements= MudSystemDotNoStringMudElements + MudSystemDotTDNoCasingMudElements= MudSystemDotNoCasingMudElements - TDXstart_MudElementArray(:) = Xstart_MudElement%Array(:) - TDXend_MudElementArray(:) = Xend_MudElement%Array(:) - TDDensity_MudElementArray(:) = Density_MudElement%Array(:) + MudSystemDotTDXstart_MudElementArray(:) = Xstart_MudElement%Array(:) + MudSystemDotTDXend_MudElementArray(:) = Xend_MudElement%Array(:) + MudSystemDotTDDensity_MudElementArray(:) = Density_MudElement%Array(:) !===================================================================== @@ -222,21 +222,21 @@ endif - DO WHILE(jopmud<= Op_Mud_Forehead_X%Length() .and. jopsection<=F_BottomHoleIntervalCounts) + DO WHILE(jopmud<= MudSystemDotOp_Mud_Forehead_X%Length() .and. jopsection<=F_BottomHoleIntervalCounts) jopelement= jopelement+1 - TrueMinValue= max(Op_Mud_Forehead_X%Array(jopmud), Xend_OpSection(jopsection)) + TrueMinValue= max(MudSystemDotOp_Mud_Forehead_X%Array(jopmud), MudSystemDotXend_OpSection(jopsection)) call Xend_OpMudElement%Add(TrueMinValue) - call TVD_Calculator(TrueMinValue,MudCircVerticalDepth) - call TVDend_OpMudElement%Add(MudCircVerticalDepth) - call Density_OpMudElement%Add(Op_Density%Array(jopmud)) - call PipeID_OpMudElement%Add(ID_OpSectionInch(jopsection)) - call PipeOD_OpMudElement%Add(OD_OpSectionInch(jopsection)) + call TVD_Calculator(TrueMinValue,MudSystemDotMudCircVerticalDepth) + call TVDend_OpMudElement%Add(MudSystemDotMudCircVerticalDepth) + call Density_OpMudElement%Add(MudSystemDotOp_Density%Array(jopmud)) + call PipeID_OpMudElement%Add(MudSystemDotID_OpSectionInch(jopsection)) + call PipeOD_OpMudElement%Add(MudSystemDotOD_OpSectionInch(jopsection)) !call Angle_MudElement%Add(Angle_PipeSection(jopsection)) call MudTypeOp_MudElement%Add(Op_MudOrKick%Array(jopmud)) - if (Xend_OpMudElement%Array(jopelement)== Op_Mud_Forehead_X%Array(jopmud)) then + if (Xend_OpMudElement%Array(jopelement)== MudSystemDotOp_Mud_Forehead_X%Array(jopmud)) then jopmud= jopmud+1 else jopsection= jopsection+1 @@ -249,7 +249,7 @@ endif call TVDstart_OpMudElement%Add(TVDend_OpMudElement%Array(i-1)) enddo - NoBottomHoleMudElements = jopelement + MudSystemDotNoBottomHoleMudElements = jopelement !================================================================ @@ -257,21 +257,21 @@ endif if(allocated(StringMudElement)) deallocate(StringMudElement) - allocate(StringMudElement(NoStringMudElements)) + allocate(StringMudElement(MudSystemDotNoStringMudElements)) if(allocated(CasingMudElement)) deallocate(CasingMudElement) - allocate(CasingMudElement(NoCasingMudElements+NoBottomHoleMudElements)) + allocate(CasingMudElement(MudSystemDotNoCasingMudElements+MudSystemDotNoBottomHoleMudElements)) - istring=0 - icasing=0 + MudSystemDotistring=0 + MudSystemDoticasing=0 - BitMudDensity= Density_MudElement%Array(NoHorizontalMudElements+NoStringMudElements) ! (for ROP module) + MudSystemDotBitMudDensity= Density_MudElement%Array(MudSystemDotNoHorizontalMudElements+MudSystemDotNoStringMudElements) ! (for ROP module) !================================================================ !============================ UTUBE ============================= !IF (UtubePossibility== .true. .and. Get_KellyConnection() /= KELLY_CONNECTION_STRING .and. WellHeadIsOpen) THEN - IF (UtubePossibility== .true. .and. TD_FluidStringConnectionMode==0 .and. WellHeadIsOpen .AND. NoGasPocket == 0) THEN + IF (MudSystemDotUtubePossibility== .true. .and. TD_FluidStringConnectionMode==0 .and. WellHeadIsOpen .AND. NoGasPocket == 0) THEN CALL WellPressureDataTransfer !WRITE (*,*) ' U-Tube Done 1' CALL Utube @@ -294,17 +294,17 @@ endif !enddo - IF (ANY(IEEE_Is_NaN(Op_MudDischarged_Volume%Array(:))) .OR. ANY(Op_MudDischarged_Volume%Array(:) <= 0.0)) THEN + IF (ANY(IEEE_Is_NaN(MudSystemDotOp_MudDischarged_Volume%Array(:))) .OR. ANY(MudSystemDotOp_MudDischarged_Volume%Array(:) <= 0.0)) THEN do i = 1 , Op_MudOrKick%Length() - write(*,555) i,'Op_Volume(i), type=' ,Op_MudDischarged_Volume%Array(i) , Op_MudOrKick%Array(i) , Op_Density%Array(i) + write(*,555) i,'Op_Volume(i), type=' ,MudSystemDotOp_MudDischarged_Volume%Array(i) , Op_MudOrKick%Array(i) , MudSystemDotOp_Density%Array(i) end do call ErrorStop('NaN in Op Volume-Plot or Op Volume <=0') END IF - IF (ANY(IEEE_Is_NaN(Ann_MudDischarged_Volume%Array(:))) .OR. ANY(Ann_MudDischarged_Volume%Array(:) <= 0.0)) THEN + IF (ANY(IEEE_Is_NaN(MudSystemDotAnn_MudDischarged_Volume%Array(:))) .OR. ANY(MudSystemDotAnn_MudDischarged_Volume%Array(:) <= 0.0)) THEN do i = 1 , Ann_MudOrKick%Length() - write(*,555) i,'Ann_Volume(i), type=' ,Ann_MudDischarged_Volume%Array(i) , Ann_MudOrKick%Array(i) , Ann_Density%Array(i) + write(*,555) i,'Ann_Volume(i), type=' ,MudSystemDotAnn_MudDischarged_Volume%Array(i) , Ann_MudOrKick%Array(i) , Ann_Density%Array(i) end do call ErrorStop('NaN in Ann Volume-Plot or Ann Volume <=0') END IF @@ -318,22 +318,22 @@ endif 555 FORMAT(I3,5X,A42,(f12.5),5X,I3,5X,(f12.5)) - NoStringMudElementsForPlot= NoStringMudElements + MudSystemDotNoStringMudElementsForPlot= MudSystemDotNoStringMudElements ! 1-Horizontal Mud Elements are not shown !write(*,333) 'Horiz:', 1,'Xstart\=', Xstart_MudElement%Array(1), 'Xend=' , Xend_MudElement%Array(1), 'Density=' , Density_MudElement%Array(1), 'MudType=' , MudType_MudElement%Array(1) - do i=NoHorizontalMudElements+1, NoHorizontalMudElements+NoStringMudElements ! 2-string elements + do i=MudSystemDotNoHorizontalMudElements+1, MudSystemDotNoHorizontalMudElements+MudSystemDotNoStringMudElements ! 2-string elements if (Xend_MudElement%Array(i) <= 0.0) then - NoStringMudElementsForPlot= NoStringMudElementsForPlot-1 + MudSystemDotNoStringMudElementsForPlot= MudSystemDotNoStringMudElementsForPlot-1 cycle endif - istring= istring+1 - StringMudElement(istring)%StartMd = Xstart_MudElement%Array(i) - StringMudElement(istring)%EndMd = Xend_MudElement%Array(i) + MudSystemDotistring= MudSystemDotistring+1 + StringMudElement(MudSystemDotistring)%StartMd = Xstart_MudElement%Array(i) + StringMudElement(MudSystemDotistring)%EndMd = Xend_MudElement%Array(i) !StringMudElement(istring)%Id = PipeID_MudElement%Array(i) !StringMudElement(istring)%Od = PipeOD_MudElement%Array(i) - StringMudElement(istring)%Density = Density_MudElement%Array(i) + StringMudElement(MudSystemDotistring)%Density = Density_MudElement%Array(i) if (MudType_MudElement%Array(i) == 104) then MudType_MudElement%Array(i)= 4 ! air @@ -341,22 +341,22 @@ endif MudType_MudElement%Array(i)= 1 ! gas kick endif - StringMudElement(istring)%MudType = MudType_MudElement%Array(i) + StringMudElement(MudSystemDotistring)%MudType = MudType_MudElement%Array(i) !write(*,333) 'STRING:', i,'Xstart\=', Xstart_MudElement%Array(i), 'Xend=' , Xend_MudElement%Array(i), 'Density=' , Density_MudElement%Array(i), 'MudType=' , MudType_MudElement%Array(i) enddo - do i=Xend_MudElement%Length(), NoHorizontalMudElements+NoStringMudElements+1 , -1 ! 3-casing elements - icasing= icasing+1 - CasingMudElement(icasing)%StartMd = Xend_MudElement%Array(i) - CasingMudElement(icasing)%EndMd = Xstart_MudElement%Array(i) + do i=Xend_MudElement%Length(), MudSystemDotNoHorizontalMudElements+MudSystemDotNoStringMudElements+1 , -1 ! 3-casing elements + MudSystemDoticasing= MudSystemDoticasing+1 + CasingMudElement(MudSystemDoticasing)%StartMd = Xend_MudElement%Array(i) + CasingMudElement(MudSystemDoticasing)%EndMd = Xstart_MudElement%Array(i) !CasingMudElement(icasing)%Id = PipeID_MudElement%Array(i) !CasingMudElement(icasing)%Od = PipeOD_MudElement%Array(i) !write(*,333) 'CASING:', i,'Xstart\=', Xstart_MudElement%Array(i), 'Xend=' , Xend_MudElement%Array(i), 'Density=' , Density_MudElement%Array(i), 'MudType=' , MudType_MudElement%Array(i) !call Log_1(temp1) !write(*,444) 'CASING:', i,'Xstart\=', Xstart_MudElement%Array(i), 'Xend=' , Xend_MudElement%Array(i), 'PipeID_MudElement%Array(i)=' , PipeID_MudElement%Array(i), 'PipeOD_MudElement%Array(i)=' , PipeOD_MudElement%Array(i) - CasingMudElement(icasing)%Density = Density_MudElement%Array(i) + CasingMudElement(MudSystemDoticasing)%Density = Density_MudElement%Array(i) if (MudType_MudElement%Array(i) == 104) then MudType_MudElement%Array(i)= 4 ! air @@ -364,20 +364,20 @@ endif MudType_MudElement%Array(i)= 1 ! gas kick endif - CasingMudElement(icasing)%MudType = MudType_MudElement%Array(i) + CasingMudElement(MudSystemDoticasing)%MudType = MudType_MudElement%Array(i) enddo - do i= NoBottomHoleMudElements, 1 , -1 ! 4-open hole elements - icasing= icasing+1 - CasingMudElement(icasing)%StartMd = Xend_OpMudElement%Array(i) - CasingMudElement(icasing)%EndMd = Xstart_OpMudElement%Array(i) + do i= MudSystemDotNoBottomHoleMudElements, 1 , -1 ! 4-open hole elements + MudSystemDoticasing= MudSystemDoticasing+1 + CasingMudElement(MudSystemDoticasing)%StartMd = Xend_OpMudElement%Array(i) + CasingMudElement(MudSystemDoticasing)%EndMd = Xstart_OpMudElement%Array(i) !CasingMudElement(icasing)%Id = PipeID_OpMudElement%Array(i) !CasingMudElement(icasing)%Od = PipeOD_OpMudElement%Array(i) !write(*,333) 'OpenHole:',i,'Xstart\=', Xstart_OpMudElement%Array(i), 'Xend=' , Xend_OpMudElement%Array(i), 'Density=' , Density_OpMudElement%Array(i), 'MudType=' , MudTypeOp_MudElement%Array(i) !call Log_1(temp2) !write(*,444) 'OpenHole:',i,'Xstart\=', Xstart_OpMudElement%Array(i), 'Xend=' , Xend_OpMudElement%Array(i), 'PipeID_MudElement%Array(i)=' , PipeID_MudElement%Array(i), 'PipeOD_MudElement%Array(i)=' , PipeOD_MudElement%Array(i) - CasingMudElement(icasing)%Density = Density_OpMudElement%Array(i) + CasingMudElement(MudSystemDoticasing)%Density = Density_OpMudElement%Array(i) if (MudTypeOp_MudElement%Array(i) == 104) then MudTypeOp_MudElement%Array(i)= 4 ! air @@ -385,7 +385,7 @@ endif MudTypeOp_MudElement%Array(i)= 1 ! gas kick endif - CasingMudElement(icasing)%MudType = MudTypeOp_MudElement%Array(i) + CasingMudElement(MudSystemDoticasing)%MudType = MudTypeOp_MudElement%Array(i) enddo @@ -398,8 +398,8 @@ endif ! shomare gozari be tartib HZ mud, ST mud, Casing ! shomare gzari OpenHole jodagane ast az 1 - call SetStringFluids(NoStringMudElementsForPlot, StringMudElement) !for data display in string - call SetAnnalusFluids(NoCasingMudElements+NoBottomHoleMudElements, CasingMudElement) !for data display in casing + call SetStringFluids(MudSystemDotNoStringMudElementsForPlot, StringMudElement) !for data display in string + call SetAnnalusFluids(MudSystemDotNoCasingMudElements+MudSystemDotNoBottomHoleMudElements, CasingMudElement) !for data display in casing !=========================================================================================================================== diff --git a/Equipments/MudSystem/Pump_and_Trip_In.f90 b/Equipments/MudSystem/Pump_and_Trip_In.f90 index 44c8159..2bb3397 100644 --- a/Equipments/MudSystem/Pump_and_Trip_In.f90 +++ b/Equipments/MudSystem/Pump_and_Trip_In.f90 @@ -24,8 +24,8 @@ integer i,ii,AddLocation !===========================================================WELL============================================================ !===========================================================WELL============================================================ - StringFlowRate= MUD(2)%Q - AnnulusFlowRate= MUD(2)%Q + MudSystemDotStringFlowRate= MUD(2)%Q + MudSystemDotAnnulusFlowRate= MUD(2)%Q !write(*,*) 'Trip In' @@ -33,16 +33,16 @@ integer i,ii,AddLocation !========================Horizontal PIPE ENTRANCE================= - if (ABS(SuctionDensity_Old - Suction_Density_MudSystem) >= DensityMixTol) then ! new mud is pumped + if (ABS(SuctionDensity_Old - Suction_Density_MudSystem) >= MudSystemDotDensityMixTol) then ! new mud is pumped - call Hz_Density%AddToFirst (Suction_Density_MudSystem) - call Hz_MudDischarged_Volume%AddToFirst (0.0d0) - call Hz_Mud_Forehead_X%AddToFirst (Xstart_PipeSection(1)) + call MudSystemDotHz_Density%AddToFirst (Suction_Density_MudSystem) + call MudSystemDotHz_MudDischarged_Volume%AddToFirst (0.0d0) + call MudSystemDotHz_Mud_Forehead_X%AddToFirst (MudSystemDotXstart_PipeSection(1)) call Hz_Mud_Forehead_section%AddToFirst (1) - call Hz_Mud_Backhead_X%AddToFirst (Xstart_PipeSection(1)) + call MudSystemDotHz_Mud_Backhead_X%AddToFirst (MudSystemDotXstart_PipeSection(1)) call Hz_Mud_Backhead_section%AddToFirst (1) - call Hz_RemainedVolume_in_LastSection%AddToFirst (0.0d0) - call Hz_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) + call MudSystemDotHz_RemainedVolume_in_LastSection%AddToFirst (0.0d0) + call MudSystemDotHz_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) call Hz_MudOrKick%AddToFirst (0) SuctionDensity_Old= Suction_Density_MudSystem @@ -50,70 +50,70 @@ integer i,ii,AddLocation !========================Horizontal PIPE STRING================= - Hz_MudDischarged_Volume%Array(1)= Hz_MudDischarged_Volume%Array(1)+ ((StringFlowRate/60.0d0)*DeltaT_Mudline) !(gal) + MudSystemDotHz_MudDischarged_Volume%Array(1)= MudSystemDotHz_MudDischarged_Volume%Array(1)+ ((MudSystemDotStringFlowRate/60.0d0)*DeltaT_Mudline) !(gal) - total_add = total_add + ((StringFlowRate/60.0d0)*DeltaT_Mudline) + MudSystemDottotal_add = MudSystemDottotal_add + ((MudSystemDotStringFlowRate/60.0d0)*DeltaT_Mudline) if (ChokeControlPanel%ChokePanelStrokeResetSwitch == 1) then - total_add= 0. + MudSystemDottotal_add= 0. endif !write(*,*) ' total decrease(add to HZ)=' , total_add !write(*,*) ' add to HZ=' , ((StringFlowRate/60.0d0)*DeltaT_Mudline) -imud=0 - do while (imud < Hz_Mud_Forehead_X%Length()) - imud = imud + 1 +MudSystemDotimud=0 + do while (MudSystemDotimud < MudSystemDotHz_Mud_Forehead_X%Length()) + MudSystemDotimud = MudSystemDotimud + 1 - if (imud> 1) then - Hz_Mud_Backhead_X%Array(imud)= Hz_Mud_Forehead_X%Array(imud-1) - Hz_Mud_Backhead_section%Array(imud)= Hz_Mud_Forehead_section%Array(imud-1) + if (MudSystemDotimud> 1) then + MudSystemDotHz_Mud_Backhead_X%Array(MudSystemDotimud)= MudSystemDotHz_Mud_Forehead_X%Array(MudSystemDotimud-1) + Hz_Mud_Backhead_section%Array(MudSystemDotimud)= Hz_Mud_Forehead_section%Array(MudSystemDotimud-1) endif - DirectionCoef= (Xend_PipeSection(Hz_Mud_Backhead_section%Array(imud))-Xstart_PipeSection(Hz_Mud_Backhead_section%Array(imud))) & - / ABS(Xend_PipeSection(Hz_Mud_Backhead_section%Array(imud))-Xstart_PipeSection(Hz_Mud_Backhead_section%Array(imud))) + MudSystemDotDirectionCoef= (MudSystemDotXend_PipeSection(Hz_Mud_Backhead_section%Array(MudSystemDotimud))-MudSystemDotXstart_PipeSection(Hz_Mud_Backhead_section%Array(MudSystemDotimud))) & + / ABS(MudSystemDotXend_PipeSection(Hz_Mud_Backhead_section%Array(MudSystemDotimud))-MudSystemDotXstart_PipeSection(Hz_Mud_Backhead_section%Array(MudSystemDotimud))) ! +1 for string , -1 for annulus - Hz_EmptyVolume_inBackheadLocation%Array(imud)= DirectionCoef* (Xend_PipeSection(Hz_Mud_Backhead_section%Array(imud))- Hz_Mud_Backhead_X%Array(imud))* & - Area_PipeSectionFt(Hz_Mud_Backhead_section%Array(imud)) !(ft^3) - Hz_EmptyVolume_inBackheadLocation%Array(imud)= Hz_EmptyVolume_inBackheadLocation%Array(imud)* 7.48051948d0 ! ft^3 to gal + MudSystemDotHz_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotDirectionCoef* (MudSystemDotXend_PipeSection(Hz_Mud_Backhead_section%Array(MudSystemDotimud))- MudSystemDotHz_Mud_Backhead_X%Array(MudSystemDotimud))* & + MudSystemDotArea_PipeSectionFt(Hz_Mud_Backhead_section%Array(MudSystemDotimud)) !(ft^3) + MudSystemDotHz_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotHz_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)* 7.48051948d0 ! ft^3 to gal - if ( Hz_MudDischarged_Volume%Array(imud) <= Hz_EmptyVolume_inBackheadLocation%Array(imud)) then - Hz_Mud_Forehead_section%Array(imud)= Hz_Mud_Backhead_section%Array(imud) - Hz_Mud_Forehead_X%Array(imud)= Hz_Mud_Backhead_X%Array(imud)+ DirectionCoef*(Hz_MudDischarged_Volume%Array(imud)/7.48051948d0)/Area_PipeSectionFt(Hz_Mud_Backhead_section%Array(imud)) + if ( MudSystemDotHz_MudDischarged_Volume%Array(MudSystemDotimud) <= MudSystemDotHz_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)) then + Hz_Mud_Forehead_section%Array(MudSystemDotimud)= Hz_Mud_Backhead_section%Array(MudSystemDotimud) + MudSystemDotHz_Mud_Forehead_X%Array(MudSystemDotimud)= MudSystemDotHz_Mud_Backhead_X%Array(MudSystemDotimud)+ MudSystemDotDirectionCoef*(MudSystemDotHz_MudDischarged_Volume%Array(MudSystemDotimud)/7.48051948d0)/MudSystemDotArea_PipeSectionFt(Hz_Mud_Backhead_section%Array(MudSystemDotimud)) else - isection= Hz_Mud_Backhead_section%Array(imud)+1 - Hz_RemainedVolume_in_LastSection%Array(imud)= Hz_MudDischarged_Volume%Array(imud)- Hz_EmptyVolume_inBackheadLocation%Array(imud) + MudSystemDotisection= Hz_Mud_Backhead_section%Array(MudSystemDotimud)+1 + MudSystemDotHz_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotHz_MudDischarged_Volume%Array(MudSystemDotimud)- MudSystemDotHz_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud) do - if (isection > 1) then ! (horizontal pipe exit) - Hz_MudDischarged_Volume%Array(imud)= Hz_MudDischarged_Volume%Array(imud)- Hz_RemainedVolume_in_LastSection%Array(imud) - Hz_Mud_Forehead_X%Array(imud)= Xend_PipeSection(1) - Hz_Mud_Forehead_section%Array(imud)= 1 + if (MudSystemDotisection > 1) then ! (horizontal pipe exit) + MudSystemDotHz_MudDischarged_Volume%Array(MudSystemDotimud)= MudSystemDotHz_MudDischarged_Volume%Array(MudSystemDotimud)- MudSystemDotHz_RemainedVolume_in_LastSection%Array(MudSystemDotimud) + MudSystemDotHz_Mud_Forehead_X%Array(MudSystemDotimud)= MudSystemDotXend_PipeSection(1) + Hz_Mud_Forehead_section%Array(MudSystemDotimud)= 1 - if (Hz_MudDischarged_Volume%Array(imud)<= 0.0d0) then ! imud is completely exited form the string - call RemoveHzMudArrays(imud) + if (MudSystemDotHz_MudDischarged_Volume%Array(MudSystemDotimud)<= 0.0d0) then ! imud is completely exited form the string + call RemoveHzMudArrays(MudSystemDotimud) endif exit endif - xx= Hz_RemainedVolume_in_LastSection%Array(imud)/ PipeSection_VolumeCapacity(isection) !(gal) + MudSystemDotxx= MudSystemDotHz_RemainedVolume_in_LastSection%Array(MudSystemDotimud)/ MudSystemDotPipeSection_VolumeCapacity(MudSystemDotisection) !(gal) - if (xx<= 1.0) then - Hz_Mud_Forehead_section%Array(imud)= isection - Hz_Mud_Forehead_X%Array(imud)= (xx * (Xend_PipeSection(isection)- Xstart_PipeSection(isection)))+ Xstart_PipeSection(isection) + if (MudSystemDotxx<= 1.0) then + Hz_Mud_Forehead_section%Array(MudSystemDotimud)= MudSystemDotisection + MudSystemDotHz_Mud_Forehead_X%Array(MudSystemDotimud)= (MudSystemDotxx * (MudSystemDotXend_PipeSection(MudSystemDotisection)- MudSystemDotXstart_PipeSection(MudSystemDotisection)))+ MudSystemDotXstart_PipeSection(MudSystemDotisection) exit else - Hz_RemainedVolume_in_LastSection%Array(imud)= Hz_RemainedVolume_in_LastSection%Array(imud)- PipeSection_VolumeCapacity(isection) - isection= isection+ 1 + MudSystemDotHz_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotHz_RemainedVolume_in_LastSection%Array(MudSystemDotimud)- MudSystemDotPipeSection_VolumeCapacity(MudSystemDotisection) + MudSystemDotisection= MudSystemDotisection+ 1 endif @@ -156,24 +156,24 @@ imud=0 !========================New Pipe Filling================= !if (F_StringIntervalCounts > F_StringIntervalCountsOld) then ! StringUpdate == .true. - if (AddedElementsToString > 0) then ! StringUpdate == .true. + if (MudSystemDotAddedElementsToString > 0) then ! StringUpdate == .true. !NoPipeAdded= F_StringIntervalCounts - F_StringIntervalCountsOld - NewPipeFilling=0 + MudSystemDotNewPipeFilling=0 IF (St_MudOrKick%First() == 104) then - St_MudDischarged_Volume%Array(1) = St_MudDischarged_Volume%Array(1) + sum(PipeSection_VolumeCapacity(2:1+AddedElementsToString)) ! new pipe is filled by air + MudSystemDotSt_MudDischarged_Volume%Array(1) = MudSystemDotSt_MudDischarged_Volume%Array(1) + sum(MudSystemDotPipeSection_VolumeCapacity(2:1+MudSystemDotAddedElementsToString)) ! new pipe is filled by air else call St_Density%AddToFirst (0.d0) - call St_MudDischarged_Volume%AddToFirst (sum(PipeSection_VolumeCapacity(2:1+AddedElementsToString))) - call St_Mud_Forehead_X%AddToFirst (Xstart_PipeSection(2)) + call MudSystemDotSt_MudDischarged_Volume%AddToFirst (sum(MudSystemDotPipeSection_VolumeCapacity(2:1+MudSystemDotAddedElementsToString))) + call MudSystemDotSt_Mud_Forehead_X%AddToFirst (MudSystemDotXstart_PipeSection(2)) call St_Mud_Forehead_section%AddToFirst (2) - call St_Mud_Backhead_X%AddToFirst (Xstart_PipeSection(2)) + call MudSystemDotSt_Mud_Backhead_X%AddToFirst (MudSystemDotXstart_PipeSection(2)) call St_Mud_Backhead_section%AddToFirst (2) - call St_RemainedVolume_in_LastSection%AddToFirst (0.d0) - call St_EmptyVolume_inBackheadLocation%AddToFirst (0.d0) + call MudSystemDotSt_RemainedVolume_in_LastSection%AddToFirst (0.d0) + call MudSystemDotSt_EmptyVolume_inBackheadLocation%AddToFirst (0.d0) call St_MudOrKick%AddToFirst (104) endif @@ -183,45 +183,45 @@ imud=0 - if (NewPipeFilling == 0) then ! 2= is the first element of string (1= is for Hz pipe) + if (MudSystemDotNewPipeFilling == 0) then ! 2= is the first element of string (1= is for Hz pipe) - LackageMudVolume= St_MudDischarged_Volume%Array(1) ! = Air element + MudSystemDotLackageMudVolume= MudSystemDotSt_MudDischarged_Volume%Array(1) ! = Air element - write(*,*) 'LackageMudVolume=' , LackageMudVolume + write(*,*) 'LackageMudVolume=' , MudSystemDotLackageMudVolume - if (ABS(St_Density%Array(2) - Hz_Density%Last()) >= DensityMixTol) then ! new mud is pumped - call St_Density%AddTo (2,Hz_Density%Last()) - call St_MudDischarged_Volume%AddTo (2, 0.d0) - call St_Mud_Forehead_X%AddTo (2,Xstart_PipeSection(2)) + if (ABS(St_Density%Array(2) - MudSystemDotHz_Density%Last()) >= MudSystemDotDensityMixTol) then ! new mud is pumped + call St_Density%AddTo (2,MudSystemDotHz_Density%Last()) + call MudSystemDotSt_MudDischarged_Volume%AddTo (2, 0.d0) + call MudSystemDotSt_Mud_Forehead_X%AddTo (2,MudSystemDotXstart_PipeSection(2)) call St_Mud_Forehead_section%AddTo (2 , 2) - call St_Mud_Backhead_X%AddTo (2,Xstart_PipeSection(2)) + call MudSystemDotSt_Mud_Backhead_X%AddTo (2,MudSystemDotXstart_PipeSection(2)) call St_Mud_Backhead_section%AddTo (2 ,2) - call St_RemainedVolume_in_LastSection%AddTo (2,0.d0) - call St_EmptyVolume_inBackheadLocation%AddTo (2,0.d0) + call MudSystemDotSt_RemainedVolume_in_LastSection%AddTo (2,0.d0) + call MudSystemDotSt_EmptyVolume_inBackheadLocation%AddTo (2,0.d0) call St_MudOrKick%AddTo (2,0) !StringDensity_Old= Hz_Density%Last() endif - St_MudDischarged_Volume%Array(2)= St_MudDischarged_Volume%Array(2)+ min( ((StringFlowRate/60.0d0)*DeltaT_Mudline), LackageMudVolume) !(gal) + MudSystemDotSt_MudDischarged_Volume%Array(2)= MudSystemDotSt_MudDischarged_Volume%Array(2)+ min( ((MudSystemDotStringFlowRate/60.0d0)*DeltaT_Mudline), MudSystemDotLackageMudVolume) !(gal) - St_MudDischarged_Volume%Array(1)= St_MudDischarged_Volume%Array(1)- min( ((StringFlowRate/60.0d0)*DeltaT_Mudline), LackageMudVolume) ! air(gal) + MudSystemDotSt_MudDischarged_Volume%Array(1)= MudSystemDotSt_MudDischarged_Volume%Array(1)- min( ((MudSystemDotStringFlowRate/60.0d0)*DeltaT_Mudline), MudSystemDotLackageMudVolume) ! air(gal) !LackageMudVolumeAfterFilling= sum(PipeSection_VolumeCapacity(2:F_StringIntervalCounts)) - sum(St_MudDischarged_Volume%Array(:)) - LackageMudVolumeAfterFilling= St_MudDischarged_Volume%Array(1) ! last time it should be zero + MudSystemDotLackageMudVolumeAfterFilling= MudSystemDotSt_MudDischarged_Volume%Array(1) ! last time it should be zero - if (LackageMudVolumeAfterFilling == 0.) then - NewPipeFilling= 1 + if (MudSystemDotLackageMudVolumeAfterFilling == 0.) then + MudSystemDotNewPipeFilling= 1 call RemoveStringMudArrays(1) - St_Mud_Backhead_X%Array(1) = Xstart_PipeSection(2) + MudSystemDotSt_Mud_Backhead_X%Array(1) = MudSystemDotXstart_PipeSection(2) St_Mud_Backhead_section%Array(1) = 2 endif @@ -232,66 +232,66 @@ imud=0 - if (NewPipeFilling == 0) then - StringFlowRate= 0. - AnnulusFlowRate= 0. + if (MudSystemDotNewPipeFilling == 0) then + MudSystemDotStringFlowRate= 0. + MudSystemDotAnnulusFlowRate= 0. endif - StringFlowRateFinal= StringFlowRate - AnnulusFlowRateFinal= AnnulusFlowRate + MudSystemDotStringFlowRateFinal= MudSystemDotStringFlowRate + MudSystemDotAnnulusFlowRateFinal= MudSystemDotAnnulusFlowRate !========================STRING ENTRANCE================= - if (StringFlowRateFinal > 0.0 .and. ABS(St_Density%First() - Hz_Density%Last()) >= DensityMixTol) then ! new mud is pumped - call St_Density%AddToFirst (Hz_Density%Last()) - call St_MudDischarged_Volume%AddToFirst (0.0d0) - call St_Mud_Forehead_X%AddToFirst (Xstart_PipeSection(2)) + if (MudSystemDotStringFlowRateFinal > 0.0 .and. ABS(St_Density%First() - MudSystemDotHz_Density%Last()) >= MudSystemDotDensityMixTol) then ! new mud is pumped + call St_Density%AddToFirst (MudSystemDotHz_Density%Last()) + call MudSystemDotSt_MudDischarged_Volume%AddToFirst (0.0d0) + call MudSystemDotSt_Mud_Forehead_X%AddToFirst (MudSystemDotXstart_PipeSection(2)) call St_Mud_Forehead_section%AddToFirst (2) - call St_Mud_Backhead_X%AddToFirst (Xstart_PipeSection(2)) + call MudSystemDotSt_Mud_Backhead_X%AddToFirst (MudSystemDotXstart_PipeSection(2)) call St_Mud_Backhead_section%AddToFirst (2) - call St_RemainedVolume_in_LastSection%AddToFirst (0.0d0) - call St_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) + call MudSystemDotSt_RemainedVolume_in_LastSection%AddToFirst (0.0d0) + call MudSystemDotSt_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) call St_MudOrKick%AddToFirst (0) !StringDensity_Old= Hz_Density%Last() endif - St_MudDischarged_Volume%Array(1)= St_MudDischarged_Volume%Array(1)+ ((StringFlowRate/60.0d0)*DeltaT_Mudline) !(gal) + MudSystemDotSt_MudDischarged_Volume%Array(1)= MudSystemDotSt_MudDischarged_Volume%Array(1)+ ((MudSystemDotStringFlowRate/60.0d0)*DeltaT_Mudline) !(gal) !=============== save String Mud data=========== - StMudVolumeSum= 0.d0 + MudSystemDotStMudVolumeSum= 0.d0 !St_MudSaved_Density= 0.d0 - St_Saved_MudDischarged_Volume= 0.d0 + MudSystemDotSt_Saved_MudDischarged_Volume= 0.d0 !Saved_St_MudOrKick= 0 !Ann_to_Choke_2mud= .false. - do imud=1, St_MudDischarged_Volume%Length() + do MudSystemDotimud=1, MudSystemDotSt_MudDischarged_Volume%Length() - StMudVolumeSum = StMudVolumeSum + St_MudDischarged_Volume%Array(imud) + MudSystemDotStMudVolumeSum = MudSystemDotStMudVolumeSum + MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud) - if ( StMudVolumeSum > sum(PipeSection_VolumeCapacity(2:F_StringIntervalCounts)) ) then + if ( MudSystemDotStMudVolumeSum > sum(MudSystemDotPipeSection_VolumeCapacity(2:F_StringIntervalCounts)) ) then !IF (St_MudOrKick%Array(imud) == 0) THEN - St_MudSaved_Density = St_Density%Array(imud) - St_Saved_MudDischarged_Volume = StMudVolumeSum - sum(PipeSection_VolumeCapacity(2:F_StringIntervalCounts)) + MudSystemDotSt_MudSaved_Density = St_Density%Array(MudSystemDotimud) + MudSystemDotSt_Saved_MudDischarged_Volume = MudSystemDotStMudVolumeSum - sum(MudSystemDotPipeSection_VolumeCapacity(2:F_StringIntervalCounts)) !ELSEIF (St_MudOrKick%Array(imud) > 0 .AND. St_MudOrKick%Array(imud) <100) THEN ! 104= AIR ! St_Kick_Saved_Volume = StMudVolumeSum - sum(PipeSection_VolumeCapacity(F_StringIntervalCounts+1:NoPipeSections)) ! Saved_St_MudOrKick= St_MudOrKick%Array (imud) ! St_KickSaved_Density= St_Density%Array(imud) !END IF - do ii= imud + 1, St_MudDischarged_Volume%Length() + do ii= MudSystemDotimud + 1, MudSystemDotSt_MudDischarged_Volume%Length() !IF (St_MudOrKick%Array(ii) == 0) THEN - St_MudSaved_Density = ((St_MudSaved_Density * St_Saved_MudDischarged_Volume) + (St_Density%Array(ii) * St_MudDischarged_Volume%Array(ii))) / (St_Saved_MudDischarged_Volume + St_MudDischarged_Volume%Array(ii)) - St_Saved_MudDischarged_Volume = St_Saved_MudDischarged_Volume + St_MudDischarged_Volume%Array(ii) + MudSystemDotSt_MudSaved_Density = ((MudSystemDotSt_MudSaved_Density * MudSystemDotSt_Saved_MudDischarged_Volume) + (St_Density%Array(ii) * MudSystemDotSt_MudDischarged_Volume%Array(ii))) / (MudSystemDotSt_Saved_MudDischarged_Volume + MudSystemDotSt_MudDischarged_Volume%Array(ii)) + MudSystemDotSt_Saved_MudDischarged_Volume = MudSystemDotSt_Saved_MudDischarged_Volume + MudSystemDotSt_MudDischarged_Volume%Array(ii) !ELSEIF (St_MudOrKick%Array(imud) > 0 .AND. St_MudOrKick%Array(imud) <100) THEN ! 104= AIR ! St_Kick_Saved_Volume = St_Kick_Saved_Volume + St_MudDischarged_Volume%Array(ii) @@ -307,30 +307,30 @@ imud=0 endif enddo -St_Saved_MudDischarged_Volume_Final = St_Saved_MudDischarged_Volume +MudSystemDotSt_Saved_MudDischarged_Volume_Final = MudSystemDotSt_Saved_MudDischarged_Volume -IF (WellHeadIsOpen) MudVolume_InjectedToBH = St_Saved_MudDischarged_Volume_Final +IF (WellHeadIsOpen) MudSystemDotMudVolume_InjectedToBH = MudSystemDotSt_Saved_MudDischarged_Volume_Final !====================================================================== !========================STRING================= -imud=0 - do while (imud < St_Mud_Forehead_X%Length()) - imud = imud + 1 +MudSystemDotimud=0 + do while (MudSystemDotimud < MudSystemDotSt_Mud_Forehead_X%Length()) + MudSystemDotimud = MudSystemDotimud + 1 - if (imud> 1) then - St_Mud_Backhead_X%Array(imud)= St_Mud_Forehead_X%Array(imud-1) - St_Mud_Backhead_section%Array(imud)= St_Mud_Forehead_section%Array(imud-1) + if (MudSystemDotimud> 1) then + MudSystemDotSt_Mud_Backhead_X%Array(MudSystemDotimud)= MudSystemDotSt_Mud_Forehead_X%Array(MudSystemDotimud-1) + St_Mud_Backhead_section%Array(MudSystemDotimud)= St_Mud_Forehead_section%Array(MudSystemDotimud-1) endif - DirectionCoef= (Xend_PipeSection(St_Mud_Backhead_section%Array(imud))-Xstart_PipeSection(St_Mud_Backhead_section%Array(imud))) & - / ABS(Xend_PipeSection(St_Mud_Backhead_section%Array(imud))-Xstart_PipeSection(St_Mud_Backhead_section%Array(imud))) + MudSystemDotDirectionCoef= (MudSystemDotXend_PipeSection(St_Mud_Backhead_section%Array(MudSystemDotimud))-MudSystemDotXstart_PipeSection(St_Mud_Backhead_section%Array(MudSystemDotimud))) & + / ABS(MudSystemDotXend_PipeSection(St_Mud_Backhead_section%Array(MudSystemDotimud))-MudSystemDotXstart_PipeSection(St_Mud_Backhead_section%Array(MudSystemDotimud))) ! +1 for string , -1 for annulus - St_EmptyVolume_inBackheadLocation%Array(imud)= DirectionCoef* (Xend_PipeSection(St_Mud_Backhead_section%Array(imud))- St_Mud_Backhead_X%Array(imud))* & - Area_PipeSectionFt(St_Mud_Backhead_section%Array(imud)) !(ft^3) - St_EmptyVolume_inBackheadLocation%Array(imud)= St_EmptyVolume_inBackheadLocation%Array(imud)* 7.48051948d0 ! ft^3 to gal + MudSystemDotSt_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotDirectionCoef* (MudSystemDotXend_PipeSection(St_Mud_Backhead_section%Array(MudSystemDotimud))- MudSystemDotSt_Mud_Backhead_X%Array(MudSystemDotimud))* & + MudSystemDotArea_PipeSectionFt(St_Mud_Backhead_section%Array(MudSystemDotimud)) !(ft^3) + MudSystemDotSt_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotSt_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)* 7.48051948d0 ! ft^3 to gal !write(*,*) 'St_Mud_Backhead_section%Array(1)=' , St_Mud_Backhead_section%Array(1) @@ -340,38 +340,38 @@ imud=0 !write(*,*) 'St_Mud_Backhead_X%Array(1)=' , St_Mud_Backhead_X%Array(1) - if ( St_MudDischarged_Volume%Array(imud) <= St_EmptyVolume_inBackheadLocation%Array(imud)) then - St_Mud_Forehead_section%Array(imud)= St_Mud_Backhead_section%Array(imud) - St_Mud_Forehead_X%Array(imud)= St_Mud_Backhead_X%Array(imud)+ DirectionCoef*(St_MudDischarged_Volume%Array(imud)/7.48051948d0)/Area_PipeSectionFt(St_Mud_Backhead_section%Array(imud)) + if ( MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud) <= MudSystemDotSt_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)) then + St_Mud_Forehead_section%Array(MudSystemDotimud)= St_Mud_Backhead_section%Array(MudSystemDotimud) + MudSystemDotSt_Mud_Forehead_X%Array(MudSystemDotimud)= MudSystemDotSt_Mud_Backhead_X%Array(MudSystemDotimud)+ MudSystemDotDirectionCoef*(MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud)/7.48051948d0)/MudSystemDotArea_PipeSectionFt(St_Mud_Backhead_section%Array(MudSystemDotimud)) ! 7.48 is for gal to ft^3 else - isection= St_Mud_Backhead_section%Array(imud)+1 - St_RemainedVolume_in_LastSection%Array(imud)= St_MudDischarged_Volume%Array(imud)- St_EmptyVolume_inBackheadLocation%Array(imud) + MudSystemDotisection= St_Mud_Backhead_section%Array(MudSystemDotimud)+1 + MudSystemDotSt_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud)- MudSystemDotSt_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud) do - if (isection > F_StringIntervalCounts) then ! last pipe section(string exit) F_StringIntervalCounts includes Horizontal line - St_MudDischarged_Volume%Array(imud)= St_MudDischarged_Volume%Array(imud)- St_RemainedVolume_in_LastSection%Array(imud) - St_Mud_Forehead_X%Array(imud)= Xend_PipeSection(F_StringIntervalCounts) - St_Mud_Forehead_section%Array(imud)= F_StringIntervalCounts + if (MudSystemDotisection > F_StringIntervalCounts) then ! last pipe section(string exit) F_StringIntervalCounts includes Horizontal line + MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud)= MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud)- MudSystemDotSt_RemainedVolume_in_LastSection%Array(MudSystemDotimud) + MudSystemDotSt_Mud_Forehead_X%Array(MudSystemDotimud)= MudSystemDotXend_PipeSection(F_StringIntervalCounts) + St_Mud_Forehead_section%Array(MudSystemDotimud)= F_StringIntervalCounts - if (St_MudDischarged_Volume%Array(imud)<= 0.0d0) then ! imud is completely exited form the string - call RemoveStringMudArrays(imud) + if (MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud)<= 0.0d0) then ! imud is completely exited form the string + call RemoveStringMudArrays(MudSystemDotimud) endif exit endif - xx= St_RemainedVolume_in_LastSection%Array(imud)/ PipeSection_VolumeCapacity(isection) !(gal) + MudSystemDotxx= MudSystemDotSt_RemainedVolume_in_LastSection%Array(MudSystemDotimud)/ MudSystemDotPipeSection_VolumeCapacity(MudSystemDotisection) !(gal) - if (xx<= 1.0) then - St_Mud_Forehead_section%Array(imud)= isection - St_Mud_Forehead_X%Array(imud)= (xx * (Xend_PipeSection(isection)- Xstart_PipeSection(isection)))+ Xstart_PipeSection(isection) + if (MudSystemDotxx<= 1.0) then + St_Mud_Forehead_section%Array(MudSystemDotimud)= MudSystemDotisection + MudSystemDotSt_Mud_Forehead_X%Array(MudSystemDotimud)= (MudSystemDotxx * (MudSystemDotXend_PipeSection(MudSystemDotisection)- MudSystemDotXstart_PipeSection(MudSystemDotisection)))+ MudSystemDotXstart_PipeSection(MudSystemDotisection) exit else - St_RemainedVolume_in_LastSection%Array(imud)= St_RemainedVolume_in_LastSection%Array(imud)- PipeSection_VolumeCapacity(isection) - isection= isection+ 1 + MudSystemDotSt_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotSt_RemainedVolume_in_LastSection%Array(MudSystemDotimud)- MudSystemDotPipeSection_VolumeCapacity(MudSystemDotisection) + MudSystemDotisection= MudSystemDotisection+ 1 endif @@ -402,38 +402,38 @@ imud=0 !========================STRING END================= - IF (Op_MudOrKick%Last() /= 0 .and. Op_MudOrKick%Last()==Ann_MudOrKick%First()) iLoc=2 ! it may be 1,2,3 or more, all of them are kick + IF (Op_MudOrKick%Last() /= 0 .and. Op_MudOrKick%Last()==Ann_MudOrKick%First()) MudSystemDotiLoc=2 ! it may be 1,2,3 or more, all of them are kick !write(*,*) ' iloc (b): ' , iloc !=============================Add PumpFlowRate to Bottom Hole ============================== !if ( AnnulusFlowRate>0.0 ) then - if ( MudVolume_InjectedToBH > 0.0 ) then + if ( MudSystemDotMudVolume_InjectedToBH > 0.0 ) then if (KickOffBottom) then ! (kickOffBottom = F) means kick is next to the bottom hole and usually kick is entering the - AddLocation= Op_Density%Length()-iloc+1+1 ! well, thus pumped mud should be placed above the kick + AddLocation= MudSystemDotOp_Density%Length()-MudSystemDotiLoc+1+1 ! well, thus pumped mud should be placed above the kick else - AddLocation= Op_Density%Length()+1 + AddLocation= MudSystemDotOp_Density%Length()+1 endif !write(*,*) 'AddLocation====' , AddLocation if ( AddLocation== 0) CALL ErrorStop ('AddLocation=0') - if ( ABS(St_Density%Last() - Op_Density%Array(AddLocation-1)) >= DensityMixTol ) then + if ( ABS(St_Density%Last() - MudSystemDotOp_Density%Array(AddLocation-1)) >= MudSystemDotDensityMixTol ) then !write(*,*) 'new pocket**' !write(*,*) 'St_Density%Last()=' , St_Density%Last() !write(*,*) 'Op_Density%Array(AddLocation-1)=' , Op_Density%Array(AddLocation-1) - call Op_Density% AddTo (AddLocation,St_Density%Last()) + call MudSystemDotOp_Density% AddTo (AddLocation,St_Density%Last()) !call Op_MudDischarged_Volume%AddTo (AddLocation,((AnnulusFlowRate/60.d0)*DeltaT_Mudline)) - call Op_MudDischarged_Volume%AddTo (AddLocation,MudVolume_InjectedToBH) - call Op_Mud_Forehead_X%AddTo (AddLocation,Xstart_OpSection(1)) + call MudSystemDotOp_MudDischarged_Volume%AddTo (AddLocation,MudSystemDotMudVolume_InjectedToBH) + call MudSystemDotOp_Mud_Forehead_X%AddTo (AddLocation,MudSystemDotXstart_OpSection(1)) call Op_Mud_Forehead_section%AddTo (AddLocation,1) - call Op_Mud_Backhead_X%AddTo (AddLocation,Xstart_OpSection(1)) + call MudSystemDotOp_Mud_Backhead_X%AddTo (AddLocation,MudSystemDotXstart_OpSection(1)) call Op_Mud_Backhead_section%AddTo (AddLocation,1) - call Op_RemainedVolume_in_LastSection%AddTo (AddLocation,0.0d0) - call Op_EmptyVolume_inBackheadLocation%AddTo (AddLocation,0.0d0) + call MudSystemDotOp_RemainedVolume_in_LastSection%AddTo (AddLocation,0.0d0) + call MudSystemDotOp_EmptyVolume_inBackheadLocation%AddTo (AddLocation,0.0d0) call Op_MudOrKick%AddTo (AddLocation,0) else !write(*,*) 'merge**' @@ -443,8 +443,8 @@ imud=0 !Op_Density%Array(AddLocation-1)= (Op_Density%Array(AddLocation-1)*Op_MudDischarged_Volume%Array(AddLocation-1)+St_Density%Last()*((AnnulusFlowRate/60.d0)*DeltaT_Mudline))/(Op_MudDischarged_Volume%Array(AddLocation-1)+((AnnulusFlowRate/60.d0)*DeltaT_Mudline)) !Op_MudDischarged_Volume%Array(AddLocation-1)= Op_MudDischarged_Volume%Array(AddLocation-1) + ((AnnulusFlowRate/60.d0)*DeltaT_Mudline) - Op_Density%Array(AddLocation-1)= (Op_Density%Array(AddLocation-1)*Op_MudDischarged_Volume%Array(AddLocation-1)+St_Density%Last()*MudVolume_InjectedToBH)/(Op_MudDischarged_Volume%Array(AddLocation-1)+MudVolume_InjectedToBH) - Op_MudDischarged_Volume%Array(AddLocation-1)= Op_MudDischarged_Volume%Array(AddLocation-1) + MudVolume_InjectedToBH + MudSystemDotOp_Density%Array(AddLocation-1)= (MudSystemDotOp_Density%Array(AddLocation-1)*MudSystemDotOp_MudDischarged_Volume%Array(AddLocation-1)+St_Density%Last()*MudSystemDotMudVolume_InjectedToBH)/(MudSystemDotOp_MudDischarged_Volume%Array(AddLocation-1)+MudSystemDotMudVolume_InjectedToBH) + MudSystemDotOp_MudDischarged_Volume%Array(AddLocation-1)= MudSystemDotOp_MudDischarged_Volume%Array(AddLocation-1) + MudSystemDotMudVolume_InjectedToBH !write(*,*) 'density after=' , Op_Density%Array(AddLocation-1) endif @@ -456,12 +456,12 @@ imud=0 !=============== save OP Mud data to transfer to the annulus enterance due to tripin or kick - OpMudVolumeSum= 0.d0 + MudSystemDotOpMudVolumeSum= 0.d0 !Op_MudSaved_Density= 0.d0 !Op_KickSaved_Density= 0.d0 - Op_Saved_MudDischarged_Volume= 0.d0 - Op_Kick_Saved_Volume= 0.d0 - Saved_Op_MudOrKick= 0 + MudSystemDotOp_Saved_MudDischarged_Volume= 0.d0 + MudSystemDotOp_Kick_Saved_Volume= 0.d0 + MudSystemDotSaved_Op_MudOrKick= 0 @@ -469,34 +469,34 @@ imud=0 !write(*,*) 'Op_MudDischarged_Volume%Length()===' , Op_MudDischarged_Volume%Length() ! - do imud=1, Op_MudDischarged_Volume%Length() + do MudSystemDotimud=1, MudSystemDotOp_MudDischarged_Volume%Length() !write(*,*) 'imud, Op_MudDischarged_Volume%Array(imud)=' , imud,Op_MudDischarged_Volume%Array(imud) - OpMudVolumeSum= OpMudVolumeSum + Op_MudDischarged_Volume%Array(imud) + MudSystemDotOpMudVolumeSum= MudSystemDotOpMudVolumeSum + MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud) - if ( OpMudVolumeSum > sum(OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) ) then + if ( MudSystemDotOpMudVolumeSum > sum(MudSystemDotOpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) ) then - IF (Op_MudOrKick%Array(imud) == 0) THEN - Op_MudSaved_Density = Op_Density%Array(imud) - Op_Saved_MudDischarged_Volume = OpMudVolumeSum - sum(OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) + IF (Op_MudOrKick%Array(MudSystemDotimud) == 0) THEN + MudSystemDotOp_MudSaved_Density = MudSystemDotOp_Density%Array(MudSystemDotimud) + MudSystemDotOp_Saved_MudDischarged_Volume = MudSystemDotOpMudVolumeSum - sum(MudSystemDotOpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) ELSE - Op_Kick_Saved_Volume = OpMudVolumeSum - sum(OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) + MudSystemDotOp_Kick_Saved_Volume = MudSystemDotOpMudVolumeSum - sum(MudSystemDotOpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) !write(*,*) 'cond 1- Op_MudOrKick%Array (imud),Op_Density%Array(imud):' ,Op_MudOrKick%Array (imud),Op_Density%Array(imud) - Saved_Op_MudOrKick= Op_MudOrKick%Array (imud) - Op_KickSaved_Density= Op_Density%Array(imud) - iloc= 2 + MudSystemDotSaved_Op_MudOrKick= Op_MudOrKick%Array (MudSystemDotimud) + MudSystemDotOp_KickSaved_Density= MudSystemDotOp_Density%Array(MudSystemDotimud) + MudSystemDotiLoc= 2 END IF - do ii= imud + 1, Op_MudDischarged_Volume%Length() + do ii= MudSystemDotimud + 1, MudSystemDotOp_MudDischarged_Volume%Length() IF (Op_MudOrKick%Array(ii) == 0) THEN - Op_MudSaved_Density = ((Op_MudSaved_Density * Op_Saved_MudDischarged_Volume) + (Op_Density%Array(ii) * Op_MudDischarged_Volume%Array(ii))) / (Op_Saved_MudDischarged_Volume + Op_MudDischarged_Volume%Array(ii)) - Op_Saved_MudDischarged_Volume = Op_Saved_MudDischarged_Volume + Op_MudDischarged_Volume%Array(ii) + MudSystemDotOp_MudSaved_Density = ((MudSystemDotOp_MudSaved_Density * MudSystemDotOp_Saved_MudDischarged_Volume) + (MudSystemDotOp_Density%Array(ii) * MudSystemDotOp_MudDischarged_Volume%Array(ii))) / (MudSystemDotOp_Saved_MudDischarged_Volume + MudSystemDotOp_MudDischarged_Volume%Array(ii)) + MudSystemDotOp_Saved_MudDischarged_Volume = MudSystemDotOp_Saved_MudDischarged_Volume + MudSystemDotOp_MudDischarged_Volume%Array(ii) ELSE - Op_Kick_Saved_Volume = Op_Kick_Saved_Volume + Op_MudDischarged_Volume%Array(ii) + MudSystemDotOp_Kick_Saved_Volume = MudSystemDotOp_Kick_Saved_Volume + MudSystemDotOp_MudDischarged_Volume%Array(ii) !write(*,*) 'cond 2- Op_MudOrKick%Array (ii),Op_Density%Array(ii):' ,Op_MudOrKick%Array (ii),Op_Density%Array(ii) - Saved_Op_MudOrKick= Op_MudOrKick%Array (ii) - Op_KickSaved_Density= Op_Density%Array(ii) - iloc= 2 + MudSystemDotSaved_Op_MudOrKick= Op_MudOrKick%Array (ii) + MudSystemDotOp_KickSaved_Density= MudSystemDotOp_Density%Array(ii) + MudSystemDotiLoc= 2 END IF enddo @@ -517,8 +517,8 @@ imud=0 !if (iLoc == 1) then - MudSection= F_StringIntervalCounts+1 - BackheadX= Xstart_PipeSection(F_StringIntervalCounts+1) + MudSystemDotMudSection= F_StringIntervalCounts+1 + MudSystemDotBackheadX= MudSystemDotXstart_PipeSection(F_StringIntervalCounts+1) !elseif (iLoc == 2) then ! MudSection= Kick_Forehead_section ! BackheadX= Kick_Forehead_X @@ -554,8 +554,8 @@ imud=0 - Ann_Mud_Backhead_section%Array(1)= MudSection !it is needed to be updated for a condition that one pipe is removed from Annulus due to trip out - Ann_Mud_Backhead_X%Array(1)= BackheadX + Ann_Mud_Backhead_section%Array(1)= MudSystemDotMudSection !it is needed to be updated for a condition that one pipe is removed from Annulus due to trip out + Ann_Mud_Backhead_X%Array(1)= MudSystemDotBackheadX @@ -589,56 +589,56 @@ imud=0 !endif - if (Op_Kick_Saved_Volume > 0.0 .and. Ann_MudOrKick%First() == 0) then + if (MudSystemDotOp_Kick_Saved_Volume > 0.0 .and. Ann_MudOrKick%First() == 0) then write(*,*) 'Kick influx enters Annulus' - call Ann_Density%AddToFirst (Op_KickSaved_Density) - call Ann_MudDischarged_Volume%AddToFirst (Op_Kick_Saved_Volume) - call Ann_Mud_Forehead_X%AddToFirst (Xstart_PipeSection(F_StringIntervalCounts+1)) + call Ann_Density%AddToFirst (MudSystemDotOp_KickSaved_Density) + call MudSystemDotAnn_MudDischarged_Volume%AddToFirst (MudSystemDotOp_Kick_Saved_Volume) + call Ann_Mud_Forehead_X%AddToFirst (MudSystemDotXstart_PipeSection(F_StringIntervalCounts+1)) call Ann_Mud_Forehead_section%AddToFirst (F_StringIntervalCounts+1) - call Ann_Mud_Backhead_X%AddToFirst (Xstart_PipeSection(F_StringIntervalCounts+1)) + call Ann_Mud_Backhead_X%AddToFirst (MudSystemDotXstart_PipeSection(F_StringIntervalCounts+1)) call Ann_Mud_Backhead_section%AddToFirst (F_StringIntervalCounts+1) call Ann_RemainedVolume_in_LastSection%AddToFirst (0.0d0) call Ann_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) - call Ann_MudOrKick%AddToFirst (Saved_Op_MudOrKick) !<<<<<<<< + call Ann_MudOrKick%AddToFirst (MudSystemDotSaved_Op_MudOrKick) !<<<<<<<< call Ann_CuttingMud%AddToFirst (0) - elseif (Op_Kick_Saved_Volume > 0.0 .and. Ann_MudOrKick%First() /= 0) then - Ann_MudDischarged_Volume%Array(1)= Ann_MudDischarged_Volume%Array(1) + Op_Kick_Saved_Volume + elseif (MudSystemDotOp_Kick_Saved_Volume > 0.0 .and. Ann_MudOrKick%First() /= 0) then + MudSystemDotAnn_MudDischarged_Volume%Array(1)= MudSystemDotAnn_MudDischarged_Volume%Array(1) + MudSystemDotOp_Kick_Saved_Volume endif - if (Op_Saved_MudDischarged_Volume> 0.0) then - NewDensity= Op_MudSaved_Density - NewVolume= Op_Saved_MudDischarged_Volume + if (MudSystemDotOp_Saved_MudDischarged_Volume> 0.0) then + NewDensity= MudSystemDotOp_MudSaved_Density + MudSystemDotNewVolume= MudSystemDotOp_Saved_MudDischarged_Volume !write(*,*) 'NewVolume=' , NewVolume !write(*,*) 'iloc=' , iloc,'Ann_MudDischarged_Volume%Array(1)=' , Ann_MudDischarged_Volume%Array(1) - if ((Rate_of_Penetration==0 .and. abs(Ann_Density%Array(iLoc)-NewDensity)< DensityMixTol) & - .or. (Rate_of_Penetration>0. .and. Ann_CuttingMud%Array(iLoc)==1 .and. abs(Ann_Density%Array(iLoc)-NewDensity)< CuttingDensityMixTol) & - .or. (Rate_of_Penetration>0. .and. Ann_CuttingMud%Array(iLoc)==0 .and. Ann_MudDischarged_Volume%Array(iLoc) < 42.) ) then ! 1-Pockets are Merged + if ((Rate_of_Penetration==0 .and. abs(Ann_Density%Array(MudSystemDotiLoc)-NewDensity)< MudSystemDotDensityMixTol) & + .or. (Rate_of_Penetration>0. .and. Ann_CuttingMud%Array(MudSystemDotiLoc)==1 .and. abs(Ann_Density%Array(MudSystemDotiLoc)-NewDensity)< MudSystemDotCuttingDensityMixTol) & + .or. (Rate_of_Penetration>0. .and. Ann_CuttingMud%Array(MudSystemDotiLoc)==0 .and. MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc) < 42.) ) then ! 1-Pockets are Merged - Ann_Density%Array(iLoc)= (Ann_Density%Array(iLoc)*Ann_MudDischarged_Volume%Array(iLoc)+NewDensity*NewVolume)/(Ann_MudDischarged_Volume%Array(iLoc)+NewVolume) - Ann_MudDischarged_Volume%Array(iLoc)= Ann_MudDischarged_Volume%Array(iLoc)+NewVolume - Ann_Mud_Forehead_X%Array(iLoc)= BackheadX - Ann_Mud_Forehead_section%Array(iLoc)= MudSection - Ann_Mud_Backhead_X%Array(iLoc)= BackheadX - Ann_Mud_Backhead_section%Array(iLoc)= MudSection - Ann_RemainedVolume_in_LastSection%Array(iLoc)= (0.0d0) - Ann_EmptyVolume_inBackheadLocation%Array(iLoc)= (0.0d0) + Ann_Density%Array(MudSystemDotiLoc)= (Ann_Density%Array(MudSystemDotiLoc)*MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)+NewDensity*MudSystemDotNewVolume)/(MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)+MudSystemDotNewVolume) + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)+MudSystemDotNewVolume + Ann_Mud_Forehead_X%Array(MudSystemDotiLoc)= MudSystemDotBackheadX + Ann_Mud_Forehead_section%Array(MudSystemDotiLoc)= MudSystemDotMudSection + Ann_Mud_Backhead_X%Array(MudSystemDotiLoc)= MudSystemDotBackheadX + Ann_Mud_Backhead_section%Array(MudSystemDotiLoc)= MudSystemDotMudSection + Ann_RemainedVolume_in_LastSection%Array(MudSystemDotiLoc)= (0.0d0) + Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotiLoc)= (0.0d0) !write(*,*) 'merge' ,'Ann_Volume%Array(1)=' , Ann_MudDischarged_Volume%Array(1) else ! 2-Merging conditions are not meeted, so new pocket - call Ann_Density%AddTo (iLoc,NewDensity) - call Ann_MudDischarged_Volume%AddTo (iLoc,NewVolume) - call Ann_Mud_Forehead_X%AddTo (iLoc,BackheadX) - call Ann_Mud_Forehead_section%AddTo (iLoc,MudSection) - call Ann_Mud_Backhead_X%AddTo (iLoc,BackheadX) - call Ann_Mud_Backhead_section%AddTo (iLoc,MudSection) - call Ann_RemainedVolume_in_LastSection%AddTo (iLoc,0.0d0) - call Ann_EmptyVolume_inBackheadLocation%AddTo (iLoc,0.0d0) - call Ann_MudOrKick%AddTo (iLoc,0) - call Ann_CuttingMud%AddTo (iLoc,0) + call Ann_Density%AddTo (MudSystemDotiLoc,NewDensity) + call MudSystemDotAnn_MudDischarged_Volume%AddTo (MudSystemDotiLoc,MudSystemDotNewVolume) + call Ann_Mud_Forehead_X%AddTo (MudSystemDotiLoc,MudSystemDotBackheadX) + call Ann_Mud_Forehead_section%AddTo (MudSystemDotiLoc,MudSystemDotMudSection) + call Ann_Mud_Backhead_X%AddTo (MudSystemDotiLoc,MudSystemDotBackheadX) + call Ann_Mud_Backhead_section%AddTo (MudSystemDotiLoc,MudSystemDotMudSection) + call Ann_RemainedVolume_in_LastSection%AddTo (MudSystemDotiLoc,0.0d0) + call Ann_EmptyVolume_inBackheadLocation%AddTo (MudSystemDotiLoc,0.0d0) + call Ann_MudOrKick%AddTo (MudSystemDotiLoc,0) + call Ann_CuttingMud%AddTo (MudSystemDotiLoc,0) !write(*,*) 'd) annLength=' , Ann_Density%Length() !write(*,*) 'new' ,'Ann_Volume%Array(1)=' , Ann_MudDischarged_Volume%Array(1) @@ -651,7 +651,7 @@ imud=0 !========================Drilling Mode======================== - if (Rate_of_Penetration>0. .and. DeltaVolumeOp>0.0) then ! trip in mode(loole paeen) DrillingMode== .true. + if (Rate_of_Penetration>0. .and. MudSystemDotDeltaVolumeOp>0.0) then ! trip in mode(loole paeen) DrillingMode== .true. !write(*,*) 'Drilling Mode' !if ( MudIsChanged== .true. ) then @@ -669,52 +669,52 @@ imud=0 !!! Density in ppg, flow rate in gpm, ROP in ft/s, bit diameter in inch - do imud=1, Op_MudDischarged_Volume%Length() - if ( Op_MudOrKick%Array(imud) == 0 ) then - Op_Density%Array(imud)= NewDensity + do MudSystemDotimud=1, MudSystemDotOp_MudDischarged_Volume%Length() + if ( Op_MudOrKick%Array(MudSystemDotimud) == 0 ) then + MudSystemDotOp_Density%Array(MudSystemDotimud)= NewDensity endif enddo - if (Op_Kick_Saved_Volume > 0.0 .and. Ann_MudOrKick%First() == 0) then + if (MudSystemDotOp_Kick_Saved_Volume > 0.0 .and. Ann_MudOrKick%First() == 0) then write(*,*) 'Kick influx enters Annulus first time' !write(*,*) 'Saved_Op_MudOrKick=',Saved_Op_MudOrKick - call Ann_Density%AddToFirst (Op_KickSaved_Density) - call Ann_MudDischarged_Volume%AddToFirst (Op_Kick_Saved_Volume) - call Ann_Mud_Forehead_X%AddToFirst (Xstart_PipeSection(F_StringIntervalCounts+1)) + call Ann_Density%AddToFirst (MudSystemDotOp_KickSaved_Density) + call MudSystemDotAnn_MudDischarged_Volume%AddToFirst (MudSystemDotOp_Kick_Saved_Volume) + call Ann_Mud_Forehead_X%AddToFirst (MudSystemDotXstart_PipeSection(F_StringIntervalCounts+1)) call Ann_Mud_Forehead_section%AddToFirst (F_StringIntervalCounts+1) - call Ann_Mud_Backhead_X%AddToFirst (Xstart_PipeSection(F_StringIntervalCounts+1)) + call Ann_Mud_Backhead_X%AddToFirst (MudSystemDotXstart_PipeSection(F_StringIntervalCounts+1)) call Ann_Mud_Backhead_section%AddToFirst (F_StringIntervalCounts+1) call Ann_RemainedVolume_in_LastSection%AddToFirst (0.0d0) call Ann_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) - call Ann_MudOrKick%AddToFirst (Saved_Op_MudOrKick) !<<<<<<<< + call Ann_MudOrKick%AddToFirst (MudSystemDotSaved_Op_MudOrKick) !<<<<<<<< call Ann_CuttingMud%AddToFirst (0) - elseif (Op_Kick_Saved_Volume > 0.0 .and. Ann_MudOrKick%First() /= 0) then - Ann_MudDischarged_Volume%Array(1)= Ann_MudDischarged_Volume%Array(1) + Op_Kick_Saved_Volume + elseif (MudSystemDotOp_Kick_Saved_Volume > 0.0 .and. Ann_MudOrKick%First() /= 0) then + MudSystemDotAnn_MudDischarged_Volume%Array(1)= MudSystemDotAnn_MudDischarged_Volume%Array(1) + MudSystemDotOp_Kick_Saved_Volume endif - if (Op_Saved_MudDischarged_Volume> 0.0) then + if (MudSystemDotOp_Saved_MudDischarged_Volume> 0.0) then !write(*,*) 'Op_Saved_Mud added' NewDensity= NewDensity !(drilling density) - NewVolume= Op_Saved_MudDischarged_Volume + DeltaVolumeOp ! (DeltaVolumeOp: for Cuttings Volume) + MudSystemDotNewVolume= MudSystemDotOp_Saved_MudDischarged_Volume + MudSystemDotDeltaVolumeOp ! (DeltaVolumeOp: for Cuttings Volume) !write(*,*) 'NewVolume=' , NewVolume !write(*,*) 'iloc=' , iloc,'Ann_MudDischarged_Volume%Array(1)=' , Ann_MudDischarged_Volume%Array(1) - if ( (Ann_CuttingMud%Array(iloc)==1 .and. abs(Ann_Density%Array(iLoc)-NewDensity)< CuttingDensityMixTol ) & - .or. (Ann_CuttingMud%Array(iLoc)==0 .and. Ann_MudDischarged_Volume%Array(iLoc) < 42.) ) then ! 1-Pockets are Merged + if ( (Ann_CuttingMud%Array(MudSystemDotiLoc)==1 .and. abs(Ann_Density%Array(MudSystemDotiLoc)-NewDensity)< MudSystemDotCuttingDensityMixTol ) & + .or. (Ann_CuttingMud%Array(MudSystemDotiLoc)==0 .and. MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc) < 42.) ) then ! 1-Pockets are Merged - Ann_Density%Array(iLoc)= (Ann_Density%Array(iLoc)*Ann_MudDischarged_Volume%Array(iLoc)+NewDensity*NewVolume)/(Ann_MudDischarged_Volume%Array(iLoc)+NewVolume) - Ann_MudDischarged_Volume%Array(iLoc)= Ann_MudDischarged_Volume%Array(iLoc)+NewVolume - Ann_Mud_Forehead_X%Array(iLoc)= BackheadX - Ann_Mud_Forehead_section%Array(iLoc)= MudSection - Ann_Mud_Backhead_X%Array(iLoc)= BackheadX - Ann_Mud_Backhead_section%Array(iLoc)= MudSection - Ann_RemainedVolume_in_LastSection%Array(iLoc)= (0.0d0) - Ann_EmptyVolume_inBackheadLocation%Array(iLoc)= (0.0d0) - Ann_CuttingMud%Array(iLoc)= 1 + Ann_Density%Array(MudSystemDotiLoc)= (Ann_Density%Array(MudSystemDotiLoc)*MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)+NewDensity*MudSystemDotNewVolume)/(MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)+MudSystemDotNewVolume) + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)+MudSystemDotNewVolume + Ann_Mud_Forehead_X%Array(MudSystemDotiLoc)= MudSystemDotBackheadX + Ann_Mud_Forehead_section%Array(MudSystemDotiLoc)= MudSystemDotMudSection + Ann_Mud_Backhead_X%Array(MudSystemDotiLoc)= MudSystemDotBackheadX + Ann_Mud_Backhead_section%Array(MudSystemDotiLoc)= MudSystemDotMudSection + Ann_RemainedVolume_in_LastSection%Array(MudSystemDotiLoc)= (0.0d0) + Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotiLoc)= (0.0d0) + Ann_CuttingMud%Array(MudSystemDotiLoc)= 1 !write(*,*) 'merge' ,'Ann_Volume%Array(1)=' , Ann_MudDischarged_Volume%Array(1) else ! 2-Merging conditions are not meeted, so new pocket @@ -722,16 +722,16 @@ imud=0 !write(*,*) 'before e) Ann_MudDischarged_Volume%Array(iLoc)=' , Ann_MudDischarged_Volume%Array(iLoc) - call Ann_Density%AddTo (iLoc,NewDensity) - call Ann_MudDischarged_Volume%AddTo (iLoc,NewVolume) - call Ann_Mud_Forehead_X%AddTo (iLoc,BackheadX) - call Ann_Mud_Forehead_section%AddTo (iLoc,MudSection) - call Ann_Mud_Backhead_X%AddTo (iLoc,BackheadX) - call Ann_Mud_Backhead_section%AddTo (iLoc,MudSection) - call Ann_RemainedVolume_in_LastSection%AddTo (iLoc,0.0d0) - call Ann_EmptyVolume_inBackheadLocation%AddTo (iLoc,0.0d0) - call Ann_MudOrKick%AddTo (iLoc,0) - call Ann_CuttingMud%AddTo (iLoc,1) ! 1= cutting 0= mud + call Ann_Density%AddTo (MudSystemDotiLoc,NewDensity) + call MudSystemDotAnn_MudDischarged_Volume%AddTo (MudSystemDotiLoc,MudSystemDotNewVolume) + call Ann_Mud_Forehead_X%AddTo (MudSystemDotiLoc,MudSystemDotBackheadX) + call Ann_Mud_Forehead_section%AddTo (MudSystemDotiLoc,MudSystemDotMudSection) + call Ann_Mud_Backhead_X%AddTo (MudSystemDotiLoc,MudSystemDotBackheadX) + call Ann_Mud_Backhead_section%AddTo (MudSystemDotiLoc,MudSystemDotMudSection) + call Ann_RemainedVolume_in_LastSection%AddTo (MudSystemDotiLoc,0.0d0) + call Ann_EmptyVolume_inBackheadLocation%AddTo (MudSystemDotiLoc,0.0d0) + call Ann_MudOrKick%AddTo (MudSystemDotiLoc,0) + call Ann_CuttingMud%AddTo (MudSystemDotiLoc,1) ! 1= cutting 0= mud !write(*,*) 'new' ,'Ann_Volume%Array(1)=' , Ann_MudDischarged_Volume%Array(1) !write(*,*) 'e) annLength=' , Ann_Density%Length() @@ -757,52 +757,52 @@ imud=0 ! !write(*,*) '==after add to ann' - NewVolume= ((AnnulusFlowRate/60.d0)*DeltaT_Mudline) - Op_Saved_MudDischarged_Volume + MudSystemDotNewVolume= ((MudSystemDotAnnulusFlowRate/60.d0)*DeltaT_Mudline) - MudSystemDotOp_Saved_MudDischarged_Volume - if (iloc==2 .and. Op_MudOrKick%Last()==0 .and. NewVolume > 0.d0 ) then ! for avoid kick separation + if (MudSystemDotiLoc==2 .and. Op_MudOrKick%Last()==0 .and. MudSystemDotNewVolume > 0.d0 ) then ! for avoid kick separation !write(*,*) 'avoid kick separation' - NewDensity= Op_MudSaved_Density + NewDensity= MudSystemDotOp_MudSaved_Density - call RemoveOpMudArrays(Op_Density%Length()) ! mud here is removed and then will be added to iloc=2 in Ann - if ( Ann_MudDischarged_Volume%Array(1) > ((AnnulusFlowRate/60.d0)*DeltaT_Mudline)- Op_Saved_MudDischarged_Volume) then! 1st in Ann = kick + call RemoveOpMudArrays(MudSystemDotOp_Density%Length()) ! mud here is removed and then will be added to iloc=2 in Ann + if ( MudSystemDotAnn_MudDischarged_Volume%Array(1) > ((MudSystemDotAnnulusFlowRate/60.d0)*DeltaT_Mudline)- MudSystemDotOp_Saved_MudDischarged_Volume) then! 1st in Ann = kick !write(*,*) 'mode1' - Ann_MudDischarged_Volume%Array(1)= Ann_MudDischarged_Volume%Array(1) - (((AnnulusFlowRate/60.d0)*DeltaT_Mudline) -Op_Saved_MudDischarged_Volume) - Op_MudDischarged_Volume%Array(Op_Density%Length())= Op_MudDischarged_Volume%Array(Op_Density%Length())+ (((AnnulusFlowRate/60.d0)*DeltaT_Mudline) - Op_Saved_MudDischarged_Volume) !kick + MudSystemDotAnn_MudDischarged_Volume%Array(1)= MudSystemDotAnn_MudDischarged_Volume%Array(1) - (((MudSystemDotAnnulusFlowRate/60.d0)*DeltaT_Mudline) -MudSystemDotOp_Saved_MudDischarged_Volume) + MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_Density%Length())= MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_Density%Length())+ (((MudSystemDotAnnulusFlowRate/60.d0)*DeltaT_Mudline) - MudSystemDotOp_Saved_MudDischarged_Volume) !kick else call RemoveAnnulusMudArrays(1) !kick is removed - iloc= 1 - Op_MudDischarged_Volume%Array(Op_Density%Length())= Op_MudDischarged_Volume%Array(Op_Density%Length())+ (((AnnulusFlowRate/60.d0)*DeltaT_Mudline) - Op_Saved_MudDischarged_Volume) + MudSystemDotiLoc= 1 + MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_Density%Length())= MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_Density%Length())+ (((MudSystemDotAnnulusFlowRate/60.d0)*DeltaT_Mudline) - MudSystemDotOp_Saved_MudDischarged_Volume) !write(*,*) 'mode2' ! including a little expand endif - if ((Rate_of_Penetration==0 .and. abs(Ann_Density%Array(iLoc)-NewDensity)< DensityMixTol) & - .or. (Rate_of_Penetration>0. .and. Ann_CuttingMud%Array(iLoc)==1 .and. abs(Ann_Density%Array(iLoc)-NewDensity)< CuttingDensityMixTol) & - .or. (Rate_of_Penetration>0. .and. Ann_CuttingMud%Array(iLoc)==0 .and. Ann_MudDischarged_Volume%Array(iLoc) < 42.) ) then ! 1-Pockets are Merged + if ((Rate_of_Penetration==0 .and. abs(Ann_Density%Array(MudSystemDotiLoc)-NewDensity)< MudSystemDotDensityMixTol) & + .or. (Rate_of_Penetration>0. .and. Ann_CuttingMud%Array(MudSystemDotiLoc)==1 .and. abs(Ann_Density%Array(MudSystemDotiLoc)-NewDensity)< MudSystemDotCuttingDensityMixTol) & + .or. (Rate_of_Penetration>0. .and. Ann_CuttingMud%Array(MudSystemDotiLoc)==0 .and. MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc) < 42.) ) then ! 1-Pockets are Merged - Ann_Density%Array(iLoc)= (Ann_Density%Array(iLoc)*Ann_MudDischarged_Volume%Array(iLoc)+NewDensity*NewVolume)/(Ann_MudDischarged_Volume%Array(iLoc)+NewVolume) - Ann_MudDischarged_Volume%Array(iLoc)= Ann_MudDischarged_Volume%Array(iLoc)+NewVolume - Ann_Mud_Forehead_X%Array(iLoc)= BackheadX - Ann_Mud_Forehead_section%Array(iLoc)= MudSection - Ann_Mud_Backhead_X%Array(iLoc)= BackheadX - Ann_Mud_Backhead_section%Array(iLoc)= MudSection - Ann_RemainedVolume_in_LastSection%Array(iLoc)= (0.0d0) - Ann_EmptyVolume_inBackheadLocation%Array(iLoc)= (0.0d0) + Ann_Density%Array(MudSystemDotiLoc)= (Ann_Density%Array(MudSystemDotiLoc)*MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)+NewDensity*MudSystemDotNewVolume)/(MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)+MudSystemDotNewVolume) + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)+MudSystemDotNewVolume + Ann_Mud_Forehead_X%Array(MudSystemDotiLoc)= MudSystemDotBackheadX + Ann_Mud_Forehead_section%Array(MudSystemDotiLoc)= MudSystemDotMudSection + Ann_Mud_Backhead_X%Array(MudSystemDotiLoc)= MudSystemDotBackheadX + Ann_Mud_Backhead_section%Array(MudSystemDotiLoc)= MudSystemDotMudSection + Ann_RemainedVolume_in_LastSection%Array(MudSystemDotiLoc)= (0.0d0) + Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotiLoc)= (0.0d0) else ! 2-Merging conditions are not meeted, so new pocket - call Ann_Density%AddTo (iLoc,NewDensity) - call Ann_MudDischarged_Volume%AddTo (iLoc,NewVolume) - call Ann_Mud_Forehead_X%AddTo (iLoc,BackheadX) - call Ann_Mud_Forehead_section%AddTo (iLoc,MudSection) - call Ann_Mud_Backhead_X%AddTo (iLoc,BackheadX) - call Ann_Mud_Backhead_section%AddTo (iLoc,MudSection) - call Ann_RemainedVolume_in_LastSection%AddTo (iLoc,0.0d0) - call Ann_EmptyVolume_inBackheadLocation%AddTo (iLoc,0.0d0) - call Ann_MudOrKick%AddTo (iLoc,0) - call Ann_CuttingMud%AddTo (iLoc,0) + call Ann_Density%AddTo (MudSystemDotiLoc,NewDensity) + call MudSystemDotAnn_MudDischarged_Volume%AddTo (MudSystemDotiLoc,MudSystemDotNewVolume) + call Ann_Mud_Forehead_X%AddTo (MudSystemDotiLoc,MudSystemDotBackheadX) + call Ann_Mud_Forehead_section%AddTo (MudSystemDotiLoc,MudSystemDotMudSection) + call Ann_Mud_Backhead_X%AddTo (MudSystemDotiLoc,MudSystemDotBackheadX) + call Ann_Mud_Backhead_section%AddTo (MudSystemDotiLoc,MudSystemDotMudSection) + call Ann_RemainedVolume_in_LastSection%AddTo (MudSystemDotiLoc,0.0d0) + call Ann_EmptyVolume_inBackheadLocation%AddTo (MudSystemDotiLoc,0.0d0) + call Ann_MudOrKick%AddTo (MudSystemDotiLoc,0) + call Ann_CuttingMud%AddTo (MudSystemDotiLoc,0) !write(*,*) 'd) annLength=' , Ann_Density%Length() endif @@ -814,22 +814,22 @@ imud=0 write(*,*) '***error2****==' - write(*,*) 'Op_Kick_Saved_Volume,Op_Saved_MudDischarged_Volume=' , Op_Kick_Saved_Volume,Op_Saved_MudDischarged_Volume + write(*,*) 'Op_Kick_Saved_Volume,Op_Saved_MudDischarged_Volume=' , MudSystemDotOp_Kick_Saved_Volume,MudSystemDotOp_Saved_MudDischarged_Volume write(*,*) 'after add to ann==' - do imud=1, Op_MudDischarged_Volume%Length() - write(*,*) 'Op:', imud, Op_MudDischarged_Volume%Array(imud), Op_Density%Array(imud) ,Op_MudOrKick%Array(imud) + do MudSystemDotimud=1, MudSystemDotOp_MudDischarged_Volume%Length() + write(*,*) 'Op:', MudSystemDotimud, MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud), MudSystemDotOp_Density%Array(MudSystemDotimud) ,Op_MudOrKick%Array(MudSystemDotimud) enddo - do imud=1, Ann_MudDischarged_Volume%Length() - write(*,*) 'Ann:', imud, Ann_MudDischarged_Volume%Array(imud), Ann_Density%Array(imud) ,Ann_MudOrKick%Array(imud) + do MudSystemDotimud=1, MudSystemDotAnn_MudDischarged_Volume%Length() + write(*,*) 'Ann:', MudSystemDotimud, MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud), Ann_Density%Array(MudSystemDotimud) ,Ann_MudOrKick%Array(MudSystemDotimud) enddo write(*,*) '==after add to ann' - write(*,*) 'NewVolume,Op_MudOrKick%Last=' , NewVolume,Op_MudOrKick%Last() + write(*,*) 'NewVolume,Op_MudOrKick%Last=' , MudSystemDotNewVolume,Op_MudOrKick%Last() write(*,*) '==***error2****' endif @@ -839,41 +839,41 @@ imud=0 !=============== save Ann Mud data to transfer to the ChokeLine enterance - AnnMudVolumeSum= 0.d0 + MudSystemDotAnnMudVolumeSum= 0.d0 !Ann_MudSaved_Density= 0.d0 !Ann_KickSaved_Density= 0.d0 - Ann_Saved_MudDischarged_Volume= 0.d0 - Ann_Kick_Saved_Volume= 0.d0 - Saved_Ann_MudOrKick= 0 - Ann_to_Choke_2mud= .false. + MudSystemDotAnn_Saved_MudDischarged_Volume= 0.d0 + MudSystemDotAnn_Kick_Saved_Volume= 0.d0 + MudSystemDotSaved_Ann_MudOrKick= 0 + MudSystemDotAnn_to_Choke_2mud= .false. - do imud=1, Ann_MudDischarged_Volume%Length() + do MudSystemDotimud=1, MudSystemDotAnn_MudDischarged_Volume%Length() - AnnMudVolumeSum= AnnMudVolumeSum + Ann_MudDischarged_Volume%Array(imud) + MudSystemDotAnnMudVolumeSum= MudSystemDotAnnMudVolumeSum + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud) - if ( AnnMudVolumeSum > sum(PipeSection_VolumeCapacity(F_StringIntervalCounts+1:NoPipeSections)) ) then + if ( MudSystemDotAnnMudVolumeSum > sum(MudSystemDotPipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystemDotNoPipeSections)) ) then - IF (Ann_MudOrKick%Array(imud) == 0) THEN - Ann_MudSaved_Density = Ann_Density%Array(imud) - Ann_Saved_MudDischarged_Volume = AnnMudVolumeSum - sum(PipeSection_VolumeCapacity(F_StringIntervalCounts+1:NoPipeSections)) - ELSEIF (Ann_MudOrKick%Array(imud) > 0 .AND. Ann_MudOrKick%Array(imud) <100) THEN ! 104= AIR - Ann_Kick_Saved_Volume = AnnMudVolumeSum - sum(PipeSection_VolumeCapacity(F_StringIntervalCounts+1:NoPipeSections)) - Saved_Ann_MudOrKick= Ann_MudOrKick%Array (imud) - Ann_KickSaved_Density= Ann_Density%Array(imud) + IF (Ann_MudOrKick%Array(MudSystemDotimud) == 0) THEN + MudSystemDotAnn_MudSaved_Density = Ann_Density%Array(MudSystemDotimud) + MudSystemDotAnn_Saved_MudDischarged_Volume = MudSystemDotAnnMudVolumeSum - sum(MudSystemDotPipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystemDotNoPipeSections)) + ELSEIF (Ann_MudOrKick%Array(MudSystemDotimud) > 0 .AND. Ann_MudOrKick%Array(MudSystemDotimud) <100) THEN ! 104= AIR + MudSystemDotAnn_Kick_Saved_Volume = MudSystemDotAnnMudVolumeSum - sum(MudSystemDotPipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystemDotNoPipeSections)) + MudSystemDotSaved_Ann_MudOrKick= Ann_MudOrKick%Array (MudSystemDotimud) + MudSystemDotAnn_KickSaved_Density= Ann_Density%Array(MudSystemDotimud) END IF - do ii= imud + 1, Ann_MudDischarged_Volume%Length() + do ii= MudSystemDotimud + 1, MudSystemDotAnn_MudDischarged_Volume%Length() IF (Ann_MudOrKick%Array(ii) == 0) THEN - Ann_MudSaved_Density = ((Ann_MudSaved_Density * Ann_Saved_MudDischarged_Volume) + (Ann_Density%Array(ii) * Ann_MudDischarged_Volume%Array(ii))) / (Ann_Saved_MudDischarged_Volume + Ann_MudDischarged_Volume%Array(ii)) - Ann_Saved_MudDischarged_Volume = Ann_Saved_MudDischarged_Volume + Ann_MudDischarged_Volume%Array(ii) - Ann_to_Choke_2mud= .true. + MudSystemDotAnn_MudSaved_Density = ((MudSystemDotAnn_MudSaved_Density * MudSystemDotAnn_Saved_MudDischarged_Volume) + (Ann_Density%Array(ii) * MudSystemDotAnn_MudDischarged_Volume%Array(ii))) / (MudSystemDotAnn_Saved_MudDischarged_Volume + MudSystemDotAnn_MudDischarged_Volume%Array(ii)) + MudSystemDotAnn_Saved_MudDischarged_Volume = MudSystemDotAnn_Saved_MudDischarged_Volume + MudSystemDotAnn_MudDischarged_Volume%Array(ii) + MudSystemDotAnn_to_Choke_2mud= .true. ELSEIF (Ann_MudOrKick%Array(ii) > 0 .AND. Ann_MudOrKick%Array(ii) <100) THEN ! 104= AIR - Ann_Kick_Saved_Volume = Ann_Kick_Saved_Volume + Ann_MudDischarged_Volume%Array(ii) - Saved_Ann_MudOrKick= Ann_MudOrKick%Array (ii) - Ann_KickSaved_Density= Ann_Density%Array(ii) + MudSystemDotAnn_Kick_Saved_Volume = MudSystemDotAnn_Kick_Saved_Volume + MudSystemDotAnn_MudDischarged_Volume%Array(ii) + MudSystemDotSaved_Ann_MudOrKick= Ann_MudOrKick%Array (ii) + MudSystemDotAnn_KickSaved_Density= Ann_Density%Array(ii) END IF enddo @@ -884,9 +884,9 @@ imud=0 endif enddo -Ann_Saved_MudDischarged_Volume_Final= Ann_Saved_MudDischarged_Volume !+ Ann_Kick_Saved_Volume -Ann_Kick_Saved_Volume_Final= Ann_Kick_Saved_Volume -IF (WellHeadIsOpen) MudVolume_InjectedFromAnn = Ann_Saved_MudDischarged_Volume_Final -((Qlost/60.0d0)*DeltaT_Mudline) +MudSystemDotAnn_Saved_MudDischarged_Volume_Final= MudSystemDotAnn_Saved_MudDischarged_Volume !+ Ann_Kick_Saved_Volume +MudSystemDotAnn_Kick_Saved_Volume_Final= MudSystemDotAnn_Kick_Saved_Volume +IF (WellHeadIsOpen) MudVolume_InjectedFromAnn = MudSystemDotAnn_Saved_MudDischarged_Volume_Final -((MudSystemDotQlost/60.0d0)*DeltaT_Mudline) !WRITE (*,*) 'MudVolume_InjectedFromAnn=', MudVolume_InjectedFromAnn !====================================================================== @@ -894,10 +894,10 @@ IF (WellHeadIsOpen) MudVolume_InjectedFromAnn = Ann_Saved_MudDischarged_Vo !write(*,*) 'Ann cap=' , sum(PipeSection_VolumeCapacity(F_StringIntervalCounts+1:NoPipeSections)) !write(*,*) 'Ann_Saved_Mud=' , Ann_Saved_MudDischarged_Volume - total_injected = total_injected + MudVolume_InjectedFromAnn + MudSystemDottotal_injected = MudSystemDottotal_injected + MudVolume_InjectedFromAnn if (ChokeControlPanel%ChokePanelStrokeResetSwitch == 1) then - total_injected= 0. + MudSystemDottotal_injected= 0. endif !write(*,*) ' total injected-tripin =' , total_injected @@ -911,26 +911,26 @@ IF (WellHeadIsOpen) MudVolume_InjectedFromAnn = Ann_Saved_MudDischarged_Vo !MudIsChanged= .false. -imud= 0 +MudSystemDotimud= 0 - do while (imud < Ann_Mud_Forehead_X%Length()) - imud = imud + 1 + do while (MudSystemDotimud < Ann_Mud_Forehead_X%Length()) + MudSystemDotimud = MudSystemDotimud + 1 - if (imud> 1) then - Ann_Mud_Backhead_X%Array(imud)= Ann_Mud_Forehead_X%Array(imud-1) - Ann_Mud_Backhead_section%Array(imud)= Ann_Mud_Forehead_section%Array(imud-1) + if (MudSystemDotimud> 1) then + Ann_Mud_Backhead_X%Array(MudSystemDotimud)= Ann_Mud_Forehead_X%Array(MudSystemDotimud-1) + Ann_Mud_Backhead_section%Array(MudSystemDotimud)= Ann_Mud_Forehead_section%Array(MudSystemDotimud-1) endif ! <<< Fracture Shoe Lost - IF ( ShoeLost .and. Shoe%ShoeDepth < Ann_Mud_Backhead_X%Array(imud) .and. Shoe%ShoeDepth >= Ann_Mud_Forehead_X%Array(imud) ) then + IF ( MudSystemDotShoeLost .and. Shoe%ShoeDepth < Ann_Mud_Backhead_X%Array(MudSystemDotimud) .and. Shoe%ShoeDepth >= Ann_Mud_Forehead_X%Array(MudSystemDotimud) ) then !write(*,*) 'ShoeLost imud,AnnVolume(imud), VolumeLost:' , imud,Ann_MudDischarged_Volume%Array(imud), (( Qlost/60.0d0)*DeltaT_Mudline) - Ann_MudDischarged_Volume%Array(imud)= Ann_MudDischarged_Volume%Array(imud)-((Qlost/60.0d0)*DeltaT_Mudline) !(gal) - if (Ann_MudDischarged_Volume%Array(imud) < 0.0) then + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)-((MudSystemDotQlost/60.0d0)*DeltaT_Mudline) !(gal) + if (MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud) < 0.0) then !write(*,*) 'mud is removed by shoe lost, imud=' , imud - call RemoveAnnulusMudArrays(imud) - imud= imud-1 + call RemoveAnnulusMudArrays(MudSystemDotimud) + MudSystemDotimud= MudSystemDotimud-1 cycle endif @@ -938,48 +938,48 @@ imud= 0 ! Fracture Shoe Lost >>> - DirectionCoef= (Xend_PipeSection(Ann_Mud_Backhead_section%Array(imud))-Xstart_PipeSection(Ann_Mud_Backhead_section%Array(imud))) & - / ABS(Xend_PipeSection(Ann_Mud_Backhead_section%Array(imud))-Xstart_PipeSection(Ann_Mud_Backhead_section%Array(imud))) + MudSystemDotDirectionCoef= (MudSystemDotXend_PipeSection(Ann_Mud_Backhead_section%Array(MudSystemDotimud))-MudSystemDotXstart_PipeSection(Ann_Mud_Backhead_section%Array(MudSystemDotimud))) & + / ABS(MudSystemDotXend_PipeSection(Ann_Mud_Backhead_section%Array(MudSystemDotimud))-MudSystemDotXstart_PipeSection(Ann_Mud_Backhead_section%Array(MudSystemDotimud))) ! +1 for string , -1 for annulus - Ann_EmptyVolume_inBackheadLocation%Array(imud)= DirectionCoef* (Xend_PipeSection(Ann_Mud_Backhead_section%Array(imud))- Ann_Mud_Backhead_X%Array(imud))* & - Area_PipeSectionFt(Ann_Mud_Backhead_section%Array(imud)) !(ft^3) - Ann_EmptyVolume_inBackheadLocation%Array(imud)= Ann_EmptyVolume_inBackheadLocation%Array(imud)* 7.48051948d0 ! ft^3 to gal + Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotDirectionCoef* (MudSystemDotXend_PipeSection(Ann_Mud_Backhead_section%Array(MudSystemDotimud))- Ann_Mud_Backhead_X%Array(MudSystemDotimud))* & + MudSystemDotArea_PipeSectionFt(Ann_Mud_Backhead_section%Array(MudSystemDotimud)) !(ft^3) + Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)* 7.48051948d0 ! ft^3 to gal - if ( Ann_MudDischarged_Volume%Array(imud) <= Ann_EmptyVolume_inBackheadLocation%Array(imud)) then - Ann_Mud_Forehead_section%Array(imud)= Ann_Mud_Backhead_section%Array(imud) - Ann_Mud_Forehead_X%Array(imud)= Ann_Mud_Backhead_X%Array(imud)+ DirectionCoef*(Ann_MudDischarged_Volume%Array(imud)/7.48051948d0)/Area_PipeSectionFt(Ann_Mud_Backhead_section%Array(imud)) + if ( MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud) <= Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)) then + Ann_Mud_Forehead_section%Array(MudSystemDotimud)= Ann_Mud_Backhead_section%Array(MudSystemDotimud) + Ann_Mud_Forehead_X%Array(MudSystemDotimud)= Ann_Mud_Backhead_X%Array(MudSystemDotimud)+ MudSystemDotDirectionCoef*(MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)/7.48051948d0)/MudSystemDotArea_PipeSectionFt(Ann_Mud_Backhead_section%Array(MudSystemDotimud)) ! 7.48 is for gal to ft^3 else - isection= Ann_Mud_Backhead_section%Array(imud)+1 - Ann_RemainedVolume_in_LastSection%Array(imud)= Ann_MudDischarged_Volume%Array(imud)- Ann_EmptyVolume_inBackheadLocation%Array(imud) + MudSystemDotisection= Ann_Mud_Backhead_section%Array(MudSystemDotimud)+1 + Ann_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)- Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud) do - if (isection > NoPipeSections) then ! last pipe section(well exit) - Ann_MudDischarged_Volume%Array(imud)= Ann_MudDischarged_Volume%Array(imud)- Ann_RemainedVolume_in_LastSection%Array(imud) - Ann_Mud_Forehead_X%Array(imud)= Xend_PipeSection(NoPipeSections) - Ann_Mud_Forehead_section%Array(imud)= NoPipeSections + if (MudSystemDotisection > MudSystemDotNoPipeSections) then ! last pipe section(well exit) + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)- Ann_RemainedVolume_in_LastSection%Array(MudSystemDotimud) + Ann_Mud_Forehead_X%Array(MudSystemDotimud)= MudSystemDotXend_PipeSection(MudSystemDotNoPipeSections) + Ann_Mud_Forehead_section%Array(MudSystemDotimud)= MudSystemDotNoPipeSections - if (Ann_MudDischarged_Volume%Array(imud)<= 0.0d0) then ! imud is completely exited form the well + if (MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)<= 0.0d0) then ! imud is completely exited form the well !write(*,*) 'remove******' - call RemoveAnnulusMudArrays(imud) + call RemoveAnnulusMudArrays(MudSystemDotimud) endif exit endif - xx= Ann_RemainedVolume_in_LastSection%Array(imud)/ PipeSection_VolumeCapacity(isection) !(gal) + MudSystemDotxx= Ann_RemainedVolume_in_LastSection%Array(MudSystemDotimud)/ MudSystemDotPipeSection_VolumeCapacity(MudSystemDotisection) !(gal) - if (xx<= 1.0) then - Ann_Mud_Forehead_section%Array(imud)= isection - Ann_Mud_Forehead_X%Array(imud)= (xx * (Xend_PipeSection(isection)- Xstart_PipeSection(isection)))+ Xstart_PipeSection(isection) + if (MudSystemDotxx<= 1.0) then + Ann_Mud_Forehead_section%Array(MudSystemDotimud)= MudSystemDotisection + Ann_Mud_Forehead_X%Array(MudSystemDotimud)= (MudSystemDotxx * (MudSystemDotXend_PipeSection(MudSystemDotisection)- MudSystemDotXstart_PipeSection(MudSystemDotisection)))+ MudSystemDotXstart_PipeSection(MudSystemDotisection) exit else - Ann_RemainedVolume_in_LastSection%Array(imud)= Ann_RemainedVolume_in_LastSection%Array(imud)- PipeSection_VolumeCapacity(isection) - isection= isection+ 1 + Ann_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= Ann_RemainedVolume_in_LastSection%Array(MudSystemDotimud)- MudSystemDotPipeSection_VolumeCapacity(MudSystemDotisection) + MudSystemDotisection= MudSystemDotisection+ 1 endif @@ -1002,8 +1002,8 @@ imud= 0 enddo - if (Ann_Mud_Forehead_X%Last() < Xend_PipeSection(NoPipeSections)) then - Ann_Mud_Forehead_X%Array(Ann_Mud_Forehead_X%Length()) = Xend_PipeSection(NoPipeSections) ! for error preventing + if (Ann_Mud_Forehead_X%Last() < MudSystemDotXend_PipeSection(MudSystemDotNoPipeSections)) then + Ann_Mud_Forehead_X%Array(Ann_Mud_Forehead_X%Length()) = MudSystemDotXend_PipeSection(MudSystemDotNoPipeSections) ! for error preventing endif !========================ANNULUS END================= @@ -1021,60 +1021,60 @@ imud= 0 !========================Bottom Hole================= -imud=0 - do while (imud < Op_Mud_Forehead_X%Length()) - imud = imud + 1 +MudSystemDotimud=0 + do while (MudSystemDotimud < MudSystemDotOp_Mud_Forehead_X%Length()) + MudSystemDotimud = MudSystemDotimud + 1 - if (imud> 1) then - Op_Mud_Backhead_X%Array(imud)= Op_Mud_Forehead_X%Array(imud-1) - Op_Mud_Backhead_section%Array(imud)= Op_Mud_Forehead_section%Array(imud-1) + if (MudSystemDotimud> 1) then + MudSystemDotOp_Mud_Backhead_X%Array(MudSystemDotimud)= MudSystemDotOp_Mud_Forehead_X%Array(MudSystemDotimud-1) + Op_Mud_Backhead_section%Array(MudSystemDotimud)= Op_Mud_Forehead_section%Array(MudSystemDotimud-1) endif !write(*,*) 'imud**=' , imud - DirectionCoef= (Xend_OpSection(Op_Mud_Backhead_section%Array(imud))-Xstart_OpSection(Op_Mud_Backhead_section%Array(imud))) & - / ABS(Xend_OpSection(Op_Mud_Backhead_section%Array(imud))-Xstart_OpSection(Op_Mud_Backhead_section%Array(imud))) + MudSystemDotDirectionCoef= (MudSystemDotXend_OpSection(Op_Mud_Backhead_section%Array(MudSystemDotimud))-MudSystemDotXstart_OpSection(Op_Mud_Backhead_section%Array(MudSystemDotimud))) & + / ABS(MudSystemDotXend_OpSection(Op_Mud_Backhead_section%Array(MudSystemDotimud))-MudSystemDotXstart_OpSection(Op_Mud_Backhead_section%Array(MudSystemDotimud))) ! +1 for string , -1 for annulus - Op_EmptyVolume_inBackheadLocation%Array(imud)= DirectionCoef* (Xend_OpSection(Op_Mud_Backhead_section%Array(imud))- Op_Mud_Backhead_X%Array(imud))* & - Area_OpSectionFt(Op_Mud_Backhead_section%Array(imud)) !(ft^3) - Op_EmptyVolume_inBackheadLocation%Array(imud)= Op_EmptyVolume_inBackheadLocation%Array(imud)* 7.48051948d0 ! ft^3 to gal + MudSystemDotOp_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotDirectionCoef* (MudSystemDotXend_OpSection(Op_Mud_Backhead_section%Array(MudSystemDotimud))- MudSystemDotOp_Mud_Backhead_X%Array(MudSystemDotimud))* & + MudSystemDotArea_OpSectionFt(Op_Mud_Backhead_section%Array(MudSystemDotimud)) !(ft^3) + MudSystemDotOp_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotOp_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)* 7.48051948d0 ! ft^3 to gal !write(*,*) ' Op_EmptyVolume_inBackheadLocation%Array(1) =' , Op_EmptyVolume_inBackheadLocation%Array(1) - if ( Op_EmptyVolume_inBackheadLocation%Array(1) < 0.0) CALL ErrorStop1 ('Negative Empty volume') + if ( MudSystemDotOp_EmptyVolume_inBackheadLocation%Array(1) < 0.0) CALL ErrorStop1 ('Negative Empty volume') - if ( Op_MudDischarged_Volume%Array(imud) <= Op_EmptyVolume_inBackheadLocation%Array(imud)) then - Op_Mud_Forehead_section%Array(imud)= Op_Mud_Backhead_section%Array(imud) - Op_Mud_Forehead_X%Array(imud)= Op_Mud_Backhead_X%Array(imud)+ DirectionCoef*(Op_MudDischarged_Volume%Array(imud)/7.48051948d0)/Area_OpSectionFt(Op_Mud_Backhead_section%Array(imud)) + if ( MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud) <= MudSystemDotOp_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)) then + Op_Mud_Forehead_section%Array(MudSystemDotimud)= Op_Mud_Backhead_section%Array(MudSystemDotimud) + MudSystemDotOp_Mud_Forehead_X%Array(MudSystemDotimud)= MudSystemDotOp_Mud_Backhead_X%Array(MudSystemDotimud)+ MudSystemDotDirectionCoef*(MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud)/7.48051948d0)/MudSystemDotArea_OpSectionFt(Op_Mud_Backhead_section%Array(MudSystemDotimud)) ! 7.48 is for gal to ft^3 else - isection= Op_Mud_Backhead_section%Array(imud)+1 - Op_RemainedVolume_in_LastSection%Array(imud)= Op_MudDischarged_Volume%Array(imud)- Op_EmptyVolume_inBackheadLocation%Array(imud) + MudSystemDotisection= Op_Mud_Backhead_section%Array(MudSystemDotimud)+1 + MudSystemDotOp_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud)- MudSystemDotOp_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud) do - if (isection > F_BottomHoleIntervalCounts) then ! last pipe section(well exit) + if (MudSystemDotisection > F_BottomHoleIntervalCounts) then ! last pipe section(well exit) !if( imud==1) KickDeltaVinAnnulus= Op_RemainedVolume_in_LastSection%Array(imud) ! Kick enters Annulus space - Op_MudDischarged_Volume%Array(imud)= Op_MudDischarged_Volume%Array(imud)- Op_RemainedVolume_in_LastSection%Array(imud) - Op_Mud_Forehead_X%Array(imud)= Xend_OpSection(F_BottomHoleIntervalCounts) - Op_Mud_Forehead_section%Array(imud)= F_BottomHoleIntervalCounts + MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud)= MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud)- MudSystemDotOp_RemainedVolume_in_LastSection%Array(MudSystemDotimud) + MudSystemDotOp_Mud_Forehead_X%Array(MudSystemDotimud)= MudSystemDotXend_OpSection(F_BottomHoleIntervalCounts) + Op_Mud_Forehead_section%Array(MudSystemDotimud)= F_BottomHoleIntervalCounts - if (Op_MudDischarged_Volume%Array(imud)<= 0.0d0) then ! imud is completely exited form the well - call RemoveOpMudArrays(imud) + if (MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud)<= 0.0d0) then ! imud is completely exited form the well + call RemoveOpMudArrays(MudSystemDotimud) endif exit endif - xx= Op_RemainedVolume_in_LastSection%Array(imud)/ OpSection_VolumeCapacity(isection) !(gal) + MudSystemDotxx= MudSystemDotOp_RemainedVolume_in_LastSection%Array(MudSystemDotimud)/ MudSystemDotOpSection_VolumeCapacity(MudSystemDotisection) !(gal) - if (xx<= 1.0) then - Op_Mud_Forehead_section%Array(imud)= isection - Op_Mud_Forehead_X%Array(imud)= (xx * (Xend_OpSection(isection)- Xstart_OpSection(isection)))+ Xstart_OpSection(isection) + if (MudSystemDotxx<= 1.0) then + Op_Mud_Forehead_section%Array(MudSystemDotimud)= MudSystemDotisection + MudSystemDotOp_Mud_Forehead_X%Array(MudSystemDotimud)= (MudSystemDotxx * (MudSystemDotXend_OpSection(MudSystemDotisection)- MudSystemDotXstart_OpSection(MudSystemDotisection)))+ MudSystemDotXstart_OpSection(MudSystemDotisection) exit else - Op_RemainedVolume_in_LastSection%Array(imud)= Op_RemainedVolume_in_LastSection%Array(imud)- OpSection_VolumeCapacity(isection) - isection= isection+ 1 + MudSystemDotOp_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotOp_RemainedVolume_in_LastSection%Array(MudSystemDotimud)- MudSystemDotOpSection_VolumeCapacity(MudSystemDotisection) + MudSystemDotisection= MudSystemDotisection+ 1 endif @@ -1083,13 +1083,13 @@ imud=0 endif ! for OP remove: - if (Op_Mud_Forehead_X%Array(imud)== Xend_OpSection(F_BottomHoleIntervalCounts)) then - totalLength = Op_MudDischarged_Volume%Length() - do while(imud < totalLength) + if (MudSystemDotOp_Mud_Forehead_X%Array(MudSystemDotimud)== MudSystemDotXend_OpSection(F_BottomHoleIntervalCounts)) then + MudSystemDottotalLength = MudSystemDotOp_MudDischarged_Volume%Length() + do while(MudSystemDotimud < MudSystemDottotalLength) !imud = imud + 1 - call RemoveOpMudArrays(totalLength) - totalLength = totalLength - 1 + call RemoveOpMudArrays(MudSystemDottotalLength) + MudSystemDottotalLength = MudSystemDottotalLength - 1 enddo @@ -1217,17 +1217,17 @@ imud=0 - ChokeLineFlowRate = MUD(4)%Q + MudSystemDotChokeLineFlowRate = MUD(4)%Q !WRITE (*,*) 'MUD(4)%Q', MUD(4)%Q - if (NewPipeFilling == 0) then ! .or. UtubeFilling==0) then - ChokeLineFlowRate= 0. + if (MudSystemDotNewPipeFilling == 0) then ! .or. UtubeFilling==0) then + MudSystemDotChokeLineFlowRate= 0. endif - do imud=1, ChokeLine_MudDischarged_Volume%Length()-2 - if ( ChokeLine_MudOrKick%Array(imud) ==1 .and. ChokeLine_MudOrKick%Array(imud+1) ==0 .and. ChokeLine_MudOrKick%Array(imud+2) ==1 ) then + do MudSystemDotimud=1, MudSystemDotChokeLine_MudDischarged_Volume%Length()-2 + if ( ChokeLine_MudOrKick%Array(MudSystemDotimud) ==1 .and. ChokeLine_MudOrKick%Array(MudSystemDotimud+1) ==0 .and. ChokeLine_MudOrKick%Array(MudSystemDotimud+2) ==1 ) then write(*,*) 'error_location is 1' error_occured = 1 endif @@ -1244,32 +1244,32 @@ imud=0 !========================CHOKE LINE ENTRANCE================= !if ( Ann_Kick_Saved_Volume > 0.0 .and. ( Ann_Saved_MudDischarged_Volume-((Qlost/60.0d0)*DeltaT_Mudline) ) == 0.0 ) then - if ( Ann_Kick_Saved_Volume > 1.0e-5 .and. ( MudVolume_InjectedFromAnn ) <= 1.0e-5 ) then + if ( MudSystemDotAnn_Kick_Saved_Volume > 1.0e-5 .and. ( MudVolume_InjectedFromAnn ) <= 1.0e-5 ) then !WRITE (*,*) 'only kick enters to chokeline, Casing pressure = ', PressureGauges(2) if (ChokeLine_MudOrKick%First() == 0) then - call ChokeLine_Density%AddToFirst (Ann_KickSaved_Density) - call ChokeLine_MudDischarged_Volume%AddToFirst (0.d0) - call ChokeLine_Mud_Forehead_X%AddToFirst (0.0d0) + call MudSystemDotChokeLine_Density%AddToFirst (MudSystemDotAnn_KickSaved_Density) + call MudSystemDotChokeLine_MudDischarged_Volume%AddToFirst (0.d0) + call MudSystemDotChokeLine_Mud_Forehead_X%AddToFirst (0.0d0) call ChokeLine_Mud_Forehead_section%AddToFirst (1) - call ChokeLine_Mud_Backhead_X%AddToFirst (0.0d0) + call MudSystemDotChokeLine_Mud_Backhead_X%AddToFirst (0.0d0) call ChokeLine_Mud_Backhead_section%AddToFirst (1) - call ChokeLine_RemainedVolume_in_LastSection%AddToFirst (0.0d0) - call ChokeLine_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) - call ChokeLine_MudOrKick%AddToFirst (Saved_Ann_MudOrKick) + call MudSystemDotChokeLine_RemainedVolume_in_LastSection%AddToFirst (0.0d0) + call MudSystemDotChokeLine_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) + call ChokeLine_MudOrKick%AddToFirst (MudSystemDotSaved_Ann_MudOrKick) - ChokeLineDensity_Old= Ann_KickSaved_Density + ChokeLineDensity_Old= MudSystemDotAnn_KickSaved_Density endif - ChokeLine_MudDischarged_Volume%Array(1)= ChokeLine_MudDischarged_Volume%Array(1)+ Ann_Kick_Saved_Volume !(gal) + MudSystemDotChokeLine_MudDischarged_Volume%Array(1)= MudSystemDotChokeLine_MudDischarged_Volume%Array(1)+ MudSystemDotAnn_Kick_Saved_Volume !(gal) endif - do imud=1, ChokeLine_MudDischarged_Volume%Length()-2 - if ( ChokeLine_MudOrKick%Array(imud) ==1 .and. ChokeLine_MudOrKick%Array(imud+1) ==0 .and. ChokeLine_MudOrKick%Array(imud+2) ==1 ) then + do MudSystemDotimud=1, MudSystemDotChokeLine_MudDischarged_Volume%Length()-2 + if ( ChokeLine_MudOrKick%Array(MudSystemDotimud) ==1 .and. ChokeLine_MudOrKick%Array(MudSystemDotimud+1) ==0 .and. ChokeLine_MudOrKick%Array(MudSystemDotimud+2) ==1 ) then write(*,*) 'error_location is 2' error_occured = 1 @@ -1280,27 +1280,27 @@ imud=0 !if ( Ann_Kick_Saved_Volume == 0.0 .and. ( Ann_Saved_MudDischarged_Volume - ((Qlost/60.0d0)*DeltaT_Mudline) ) > 0.0 ) then - if ( Ann_Kick_Saved_Volume <= 1.0e-5 .and. MudVolume_InjectedFromAnn > 1.0e-5 ) then + if ( MudSystemDotAnn_Kick_Saved_Volume <= 1.0e-5 .and. MudVolume_InjectedFromAnn > 1.0e-5 ) then !WRITE (*,*) 'only mud enters to chokeline' - if ((Ann_to_Choke_2mud == .false. .and. ABS(ChokeLineDensity_Old - Ann_MudSaved_Density) >= DensityMixTol) .or. ChokeLine_MudOrKick%First() /= 0) then ! new mud is pumped - call ChokeLine_Density%AddToFirst (Ann_MudSaved_Density) - call ChokeLine_MudDischarged_Volume%AddToFirst (0.0d0) - call ChokeLine_Mud_Forehead_X%AddToFirst (0.0d0) + if ((MudSystemDotAnn_to_Choke_2mud == .false. .and. ABS(ChokeLineDensity_Old - MudSystemDotAnn_MudSaved_Density) >= MudSystemDotDensityMixTol) .or. ChokeLine_MudOrKick%First() /= 0) then ! new mud is pumped + call MudSystemDotChokeLine_Density%AddToFirst (MudSystemDotAnn_MudSaved_Density) + call MudSystemDotChokeLine_MudDischarged_Volume%AddToFirst (0.0d0) + call MudSystemDotChokeLine_Mud_Forehead_X%AddToFirst (0.0d0) call ChokeLine_Mud_Forehead_section%AddToFirst (1) - call ChokeLine_Mud_Backhead_X%AddToFirst (0.0d0) + call MudSystemDotChokeLine_Mud_Backhead_X%AddToFirst (0.0d0) call ChokeLine_Mud_Backhead_section%AddToFirst (1) - call ChokeLine_RemainedVolume_in_LastSection%AddToFirst (0.0d0) - call ChokeLine_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) + call MudSystemDotChokeLine_RemainedVolume_in_LastSection%AddToFirst (0.0d0) + call MudSystemDotChokeLine_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) call ChokeLine_MudOrKick%AddToFirst (0) - ChokeLineDensity_Old= Ann_MudSaved_Density + ChokeLineDensity_Old= MudSystemDotAnn_MudSaved_Density endif !ChokeLine_MudDischarged_Volume%Array(1)= ChokeLine_MudDischarged_Volume%Array(1)+ (Ann_Saved_MudDischarged_Volume - ((Qlost/60.0d0)*DeltaT_Mudline) ) !(gal) - ChokeLine_MudDischarged_Volume%Array(1)= ChokeLine_MudDischarged_Volume%Array(1)+ (MudVolume_InjectedFromAnn) !(gal) + MudSystemDotChokeLine_MudDischarged_Volume%Array(1)= MudSystemDotChokeLine_MudDischarged_Volume%Array(1)+ (MudVolume_InjectedFromAnn) !(gal) @@ -1308,8 +1308,8 @@ imud=0 - do imud=1, ChokeLine_MudDischarged_Volume%Length()-2 - if ( ChokeLine_MudOrKick%Array(imud) ==1 .and. ChokeLine_MudOrKick%Array(imud+1) ==0 .and. ChokeLine_MudOrKick%Array(imud+2) ==1 ) then + do MudSystemDotimud=1, MudSystemDotChokeLine_MudDischarged_Volume%Length()-2 + if ( ChokeLine_MudOrKick%Array(MudSystemDotimud) ==1 .and. ChokeLine_MudOrKick%Array(MudSystemDotimud+1) ==0 .and. ChokeLine_MudOrKick%Array(MudSystemDotimud+2) ==1 ) then write(*,*) 'error_location is 3' error_occured = 1 @@ -1318,60 +1318,60 @@ imud=0 !if ( Ann_Kick_Saved_Volume > 0.0 .and. (Ann_Saved_MudDischarged_Volume - ((Qlost/60.0d0)*DeltaT_Mudline) ) > 0.0 .and. ChokeLine_MudOrKick%First() /= 0 ) then - if ( Ann_Kick_Saved_Volume > 1.0e-5 .and. (MudVolume_InjectedFromAnn) > 1.0e-5 .and. ChokeLine_MudOrKick%First() /= 0 ) then + if ( MudSystemDotAnn_Kick_Saved_Volume > 1.0e-5 .and. (MudVolume_InjectedFromAnn) > 1.0e-5 .and. ChokeLine_MudOrKick%First() /= 0 ) then WRITE (*,*) 'Kick Enters Choke line Last Time' - ChokeLine_MudDischarged_Volume%Array(1)= ChokeLine_MudDischarged_Volume%Array(1)+ Ann_Kick_Saved_Volume !(gal) + MudSystemDotChokeLine_MudDischarged_Volume%Array(1)= MudSystemDotChokeLine_MudDischarged_Volume%Array(1)+ MudSystemDotAnn_Kick_Saved_Volume !(gal) - call ChokeLine_Density%AddToFirst (Ann_MudSaved_Density) + call MudSystemDotChokeLine_Density%AddToFirst (MudSystemDotAnn_MudSaved_Density) !call ChokeLine_MudDischarged_Volume%AddToFirst (Ann_Saved_MudDischarged_Volume - ((Qlost/60.0d0)*DeltaT_Mudline) ) - call ChokeLine_MudDischarged_Volume%AddToFirst (MudVolume_InjectedFromAnn) - call ChokeLine_Mud_Forehead_X%AddToFirst (0.0d0) + call MudSystemDotChokeLine_MudDischarged_Volume%AddToFirst (MudVolume_InjectedFromAnn) + call MudSystemDotChokeLine_Mud_Forehead_X%AddToFirst (0.0d0) call ChokeLine_Mud_Forehead_section%AddToFirst (1) - call ChokeLine_Mud_Backhead_X%AddToFirst (0.0d0) + call MudSystemDotChokeLine_Mud_Backhead_X%AddToFirst (0.0d0) call ChokeLine_Mud_Backhead_section%AddToFirst (1) - call ChokeLine_RemainedVolume_in_LastSection%AddToFirst (0.0d0) - call ChokeLine_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) + call MudSystemDotChokeLine_RemainedVolume_in_LastSection%AddToFirst (0.0d0) + call MudSystemDotChokeLine_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) call ChokeLine_MudOrKick%AddToFirst (0) - ChokeLineDensity_Old= Ann_MudSaved_Density + ChokeLineDensity_Old= MudSystemDotAnn_MudSaved_Density !ELSE if ( Ann_Kick_Saved_Volume > 0.0 .and. ( Ann_Saved_MudDischarged_Volume - ((Qlost/60.0d0)*DeltaT_Mudline) ) > 0.0 .and. ChokeLine_MudOrKick%First() == 0 ) then - ELSE if ( Ann_Kick_Saved_Volume > 1.0e-5 .and. ( MudVolume_InjectedFromAnn ) > 1.0e-5 .and. ChokeLine_MudOrKick%First() == 0 ) then + ELSE if ( MudSystemDotAnn_Kick_Saved_Volume > 1.0e-5 .and. ( MudVolume_InjectedFromAnn ) > 1.0e-5 .and. ChokeLine_MudOrKick%First() == 0 ) then WRITE (*,*) 'Kick Enters Choke line First Time' !ChokeLine_MudDischarged_Volume%Array(1)= ChokeLine_MudDischarged_Volume%Array(1)+ ( Ann_Saved_MudDischarged_Volume - ((Qlost/60.0d0)*DeltaT_Mudline) ) !(gal) - ChokeLine_MudDischarged_Volume%Array(1)= ChokeLine_MudDischarged_Volume%Array(1)+ ( MudVolume_InjectedFromAnn ) !(gal) + MudSystemDotChokeLine_MudDischarged_Volume%Array(1)= MudSystemDotChokeLine_MudDischarged_Volume%Array(1)+ ( MudVolume_InjectedFromAnn ) !(gal) - call ChokeLine_Density%AddToFirst (Ann_KickSaved_Density) - call ChokeLine_MudDischarged_Volume%AddToFirst (Ann_Kick_Saved_Volume) - call ChokeLine_Mud_Forehead_X%AddToFirst (0.0d0) + call MudSystemDotChokeLine_Density%AddToFirst (MudSystemDotAnn_KickSaved_Density) + call MudSystemDotChokeLine_MudDischarged_Volume%AddToFirst (MudSystemDotAnn_Kick_Saved_Volume) + call MudSystemDotChokeLine_Mud_Forehead_X%AddToFirst (0.0d0) call ChokeLine_Mud_Forehead_section%AddToFirst (1) - call ChokeLine_Mud_Backhead_X%AddToFirst (0.0d0) + call MudSystemDotChokeLine_Mud_Backhead_X%AddToFirst (0.0d0) call ChokeLine_Mud_Backhead_section%AddToFirst (1) - call ChokeLine_RemainedVolume_in_LastSection%AddToFirst (0.0d0) - call ChokeLine_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) - call ChokeLine_MudOrKick%AddToFirst (Saved_Ann_MudOrKick) + call MudSystemDotChokeLine_RemainedVolume_in_LastSection%AddToFirst (0.0d0) + call MudSystemDotChokeLine_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) + call ChokeLine_MudOrKick%AddToFirst (MudSystemDotSaved_Ann_MudOrKick) - ChokeLineDensity_Old= Ann_KickSaved_Density + ChokeLineDensity_Old= MudSystemDotAnn_KickSaved_Density endif - do imud=1, ChokeLine_MudDischarged_Volume%Length()-2 - if ( ChokeLine_MudOrKick%Array(imud) ==1 .and. ChokeLine_MudOrKick%Array(imud+1) ==0 .and. ChokeLine_MudOrKick%Array(imud+2) ==1 ) then + do MudSystemDotimud=1, MudSystemDotChokeLine_MudDischarged_Volume%Length()-2 + if ( ChokeLine_MudOrKick%Array(MudSystemDotimud) ==1 .and. ChokeLine_MudOrKick%Array(MudSystemDotimud+1) ==0 .and. ChokeLine_MudOrKick%Array(MudSystemDotimud+2) ==1 ) then write(*,*) 'error_location is 4' error_occured = 1 @@ -1380,8 +1380,8 @@ imud=0 if (error_occured == 1) then - do imud=1, ChokeLine_MudDischarged_Volume%Length() - write(*,*) 'ChokeLine:', imud, ChokeLine_Density%Array(imud) ,ChokeLine_MudOrKick%Array(imud) + do MudSystemDotimud=1, MudSystemDotChokeLine_MudDischarged_Volume%Length() + write(*,*) 'ChokeLine:', MudSystemDotimud, MudSystemDotChokeLine_Density%Array(MudSystemDotimud) ,ChokeLine_MudOrKick%Array(MudSystemDotimud) enddo endif @@ -1402,40 +1402,40 @@ imud=0 !=============== save Choke Mud data========================== - ChokeMudVolumeSum= 0.d0 + MudSystemDotChokeMudVolumeSum= 0.d0 !Ann_MudSaved_Density= 0.d0 !Ann_KickSaved_Density= 0.d0 - Choke_Saved_MudDischarged_Volume= 0.d0 - Choke_Kick_Saved_Volume= 0.d0 - Saved_Choke_MudOrKick= 0 + MudSystemDotChoke_Saved_MudDischarged_Volume= 0.d0 + MudSystemDotChoke_Kick_Saved_Volume= 0.d0 + MudSystemDotSaved_Choke_MudOrKick= 0 - do imud=1, ChokeLine_MudDischarged_Volume%Length() + do MudSystemDotimud=1, MudSystemDotChokeLine_MudDischarged_Volume%Length() - ChokeMudVolumeSum= ChokeMudVolumeSum + ChokeLine_MudDischarged_Volume%Array(imud) + MudSystemDotChokeMudVolumeSum= MudSystemDotChokeMudVolumeSum + MudSystemDotChokeLine_MudDischarged_Volume%Array(MudSystemDotimud) - if ( ChokeMudVolumeSum > ChokeLine_VolumeCapacity ) then + if ( MudSystemDotChokeMudVolumeSum > MudSystemDotChokeLine_VolumeCapacity ) then - IF (ChokeLine_MudOrKick%Array(imud) == 0) THEN - Choke_MudSaved_Density = ChokeLine_Density%Array(imud) - Choke_Saved_MudDischarged_Volume = ChokeMudVolumeSum - ChokeLine_VolumeCapacity - ELSEIF (ChokeLine_MudOrKick%Array(imud) > 0 .AND. ChokeLine_MudOrKick%Array(imud) <100) THEN ! 104= AIR - Choke_Kick_Saved_Volume = ChokeMudVolumeSum - ChokeLine_VolumeCapacity - Saved_Choke_MudOrKick= ChokeLine_MudOrKick%Array (imud) - Choke_KickSaved_Density= ChokeLine_Density%Array(imud) + IF (ChokeLine_MudOrKick%Array(MudSystemDotimud) == 0) THEN + MudSystemDotChoke_MudSaved_Density = MudSystemDotChokeLine_Density%Array(MudSystemDotimud) + MudSystemDotChoke_Saved_MudDischarged_Volume = MudSystemDotChokeMudVolumeSum - MudSystemDotChokeLine_VolumeCapacity + ELSEIF (ChokeLine_MudOrKick%Array(MudSystemDotimud) > 0 .AND. ChokeLine_MudOrKick%Array(MudSystemDotimud) <100) THEN ! 104= AIR + MudSystemDotChoke_Kick_Saved_Volume = MudSystemDotChokeMudVolumeSum - MudSystemDotChokeLine_VolumeCapacity + MudSystemDotSaved_Choke_MudOrKick= ChokeLine_MudOrKick%Array (MudSystemDotimud) + MudSystemDotChoke_KickSaved_Density= MudSystemDotChokeLine_Density%Array(MudSystemDotimud) END IF - do ii= imud + 1, ChokeLine_MudDischarged_Volume%Length() + do ii= MudSystemDotimud + 1, MudSystemDotChokeLine_MudDischarged_Volume%Length() IF (ChokeLine_MudOrKick%Array(ii) == 0) THEN - Choke_MudSaved_Density = ((Choke_MudSaved_Density * Choke_Saved_MudDischarged_Volume) + (ChokeLine_Density%Array(ii) * ChokeLine_MudDischarged_Volume%Array(ii))) / (Choke_Saved_MudDischarged_Volume + ChokeLine_MudDischarged_Volume%Array(ii)) - Choke_Saved_MudDischarged_Volume = Choke_Saved_MudDischarged_Volume + ChokeLine_MudDischarged_Volume%Array(ii) + MudSystemDotChoke_MudSaved_Density = ((MudSystemDotChoke_MudSaved_Density * MudSystemDotChoke_Saved_MudDischarged_Volume) + (MudSystemDotChokeLine_Density%Array(ii) * MudSystemDotChokeLine_MudDischarged_Volume%Array(ii))) / (MudSystemDotChoke_Saved_MudDischarged_Volume + MudSystemDotChokeLine_MudDischarged_Volume%Array(ii)) + MudSystemDotChoke_Saved_MudDischarged_Volume = MudSystemDotChoke_Saved_MudDischarged_Volume + MudSystemDotChokeLine_MudDischarged_Volume%Array(ii) ELSEIF (ChokeLine_MudOrKick%Array(ii) > 0 .AND. ChokeLine_MudOrKick%Array(ii) <100) THEN ! 104= AIR - Choke_Kick_Saved_Volume = Choke_Kick_Saved_Volume + ChokeLine_MudDischarged_Volume%Array(ii) - Saved_Choke_MudOrKick= ChokeLine_MudOrKick%Array (ii) - Choke_KickSaved_Density= ChokeLine_Density%Array(ii) + MudSystemDotChoke_Kick_Saved_Volume = MudSystemDotChoke_Kick_Saved_Volume + MudSystemDotChokeLine_MudDischarged_Volume%Array(ii) + MudSystemDotSaved_Choke_MudOrKick= ChokeLine_MudOrKick%Array (ii) + MudSystemDotChoke_KickSaved_Density= MudSystemDotChokeLine_Density%Array(ii) END IF enddo @@ -1446,8 +1446,8 @@ imud=0 endif enddo -Choke_Saved_MudDischarged_Volume_Final= Choke_Saved_MudDischarged_Volume !+ Choke_Kick_Saved_Volume -Choke_Kick_Saved_Volume_Final= Choke_Kick_Saved_Volume +MudSystemDotChoke_Saved_MudDischarged_Volume_Final= MudSystemDotChoke_Saved_MudDischarged_Volume !+ Choke_Kick_Saved_Volume +MudSystemDotChoke_Kick_Saved_Volume_Final= MudSystemDotChoke_Kick_Saved_Volume !====================================================================== @@ -1466,13 +1466,13 @@ Choke_Kick_Saved_Volume_Final= Choke_Kick_Saved_Volume !========================Choke Line================= -imud=0 - do while (imud < ChokeLine_Mud_Forehead_X%Length()) - imud = imud + 1 +MudSystemDotimud=0 + do while (MudSystemDotimud < MudSystemDotChokeLine_Mud_Forehead_X%Length()) + MudSystemDotimud = MudSystemDotimud + 1 - if (imud> 1) then - ChokeLine_Mud_Backhead_X%Array(imud)= ChokeLine_Mud_Forehead_X%Array(imud-1) - ChokeLine_Mud_Backhead_section%Array(imud)= ChokeLine_Mud_Forehead_section%Array(imud-1) + if (MudSystemDotimud> 1) then + MudSystemDotChokeLine_Mud_Backhead_X%Array(MudSystemDotimud)= MudSystemDotChokeLine_Mud_Forehead_X%Array(MudSystemDotimud-1) + ChokeLine_Mud_Backhead_section%Array(MudSystemDotimud)= ChokeLine_Mud_Forehead_section%Array(MudSystemDotimud-1) endif @@ -1481,49 +1481,49 @@ imud=0 ! +1 for string , -1 for annulus - ChokeLine_EmptyVolume_inBackheadLocation%Array(imud)= (BopStackSpecification%ChokeLineLength- ChokeLine_Mud_Backhead_X%Array(imud))* Area_ChokeLineFt !(ft^3) + MudSystemDotChokeLine_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= (BopStackSpecification%ChokeLineLength- MudSystemDotChokeLine_Mud_Backhead_X%Array(MudSystemDotimud))* MudSystemDotArea_ChokeLineFt !(ft^3) - ChokeLine_EmptyVolume_inBackheadLocation%Array(imud)= ChokeLine_EmptyVolume_inBackheadLocation%Array(imud)* 7.48051948d0 ! ft^3 to gal + MudSystemDotChokeLine_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotChokeLine_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)* 7.48051948d0 ! ft^3 to gal - if ( ChokeLine_MudDischarged_Volume%Array(imud) <= ChokeLine_EmptyVolume_inBackheadLocation%Array(imud)) then - ChokeLine_Mud_Forehead_section%Array(imud)= ChokeLine_Mud_Backhead_section%Array(imud) - ChokeLine_Mud_Forehead_X%Array(imud)= ChokeLine_Mud_Backhead_X%Array(imud)+ (ChokeLine_MudDischarged_Volume%Array(imud)/7.48051948d0)/Area_ChokeLineFt + if ( MudSystemDotChokeLine_MudDischarged_Volume%Array(MudSystemDotimud) <= MudSystemDotChokeLine_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)) then + ChokeLine_Mud_Forehead_section%Array(MudSystemDotimud)= ChokeLine_Mud_Backhead_section%Array(MudSystemDotimud) + MudSystemDotChokeLine_Mud_Forehead_X%Array(MudSystemDotimud)= MudSystemDotChokeLine_Mud_Backhead_X%Array(MudSystemDotimud)+ (MudSystemDotChokeLine_MudDischarged_Volume%Array(MudSystemDotimud)/7.48051948d0)/MudSystemDotArea_ChokeLineFt ! 7.48 is for gal to ft^3 else - isection= ChokeLine_Mud_Backhead_section%Array(imud)+1 - ChokeLine_RemainedVolume_in_LastSection%Array(imud)= ChokeLine_MudDischarged_Volume%Array(imud)- ChokeLine_EmptyVolume_inBackheadLocation%Array(imud) + MudSystemDotisection= ChokeLine_Mud_Backhead_section%Array(MudSystemDotimud)+1 + MudSystemDotChokeLine_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotChokeLine_MudDischarged_Volume%Array(MudSystemDotimud)- MudSystemDotChokeLine_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud) do - if (isection > 1) then ! last pipe section(Chokeline exit) - ChokeLine_MudDischarged_Volume%Array(imud)= ChokeLine_MudDischarged_Volume%Array(imud)- ChokeLine_RemainedVolume_in_LastSection%Array(imud) - ChokeLine_Mud_Forehead_X%Array(imud)= BopStackSpecification%ChokeLineLength - ChokeLine_Mud_Forehead_section%Array(imud)= 1 - if (ChokeLine_MudDischarged_Volume%Array(imud)<= 0.0d0) then ! imud is completely exited form the string - call ChokeLine_MudDischarged_Volume%Remove (imud) - call ChokeLine_Mud_Backhead_X%Remove (imud) - call ChokeLine_Mud_Backhead_section%Remove (imud) - call ChokeLine_Mud_Forehead_X%Remove (imud) - call ChokeLine_Mud_Forehead_section%Remove (imud) - call ChokeLine_Density%Remove (imud) - call ChokeLine_RemainedVolume_in_LastSection%Remove (imud) - call ChokeLine_EmptyVolume_inBackheadLocation%Remove (imud) - call ChokeLine_MudOrKick%Remove (imud) + if (MudSystemDotisection > 1) then ! last pipe section(Chokeline exit) + MudSystemDotChokeLine_MudDischarged_Volume%Array(MudSystemDotimud)= MudSystemDotChokeLine_MudDischarged_Volume%Array(MudSystemDotimud)- MudSystemDotChokeLine_RemainedVolume_in_LastSection%Array(MudSystemDotimud) + MudSystemDotChokeLine_Mud_Forehead_X%Array(MudSystemDotimud)= BopStackSpecification%ChokeLineLength + ChokeLine_Mud_Forehead_section%Array(MudSystemDotimud)= 1 + if (MudSystemDotChokeLine_MudDischarged_Volume%Array(MudSystemDotimud)<= 0.0d0) then ! imud is completely exited form the string + call MudSystemDotChokeLine_MudDischarged_Volume%Remove (MudSystemDotimud) + call MudSystemDotChokeLine_Mud_Backhead_X%Remove (MudSystemDotimud) + call ChokeLine_Mud_Backhead_section%Remove (MudSystemDotimud) + call MudSystemDotChokeLine_Mud_Forehead_X%Remove (MudSystemDotimud) + call ChokeLine_Mud_Forehead_section%Remove (MudSystemDotimud) + call MudSystemDotChokeLine_Density%Remove (MudSystemDotimud) + call MudSystemDotChokeLine_RemainedVolume_in_LastSection%Remove (MudSystemDotimud) + call MudSystemDotChokeLine_EmptyVolume_inBackheadLocation%Remove (MudSystemDotimud) + call ChokeLine_MudOrKick%Remove (MudSystemDotimud) endif exit endif - xx= ChokeLine_RemainedVolume_in_LastSection%Array(imud)/ ChokeLine_VolumeCapacity !(gal) + MudSystemDotxx= MudSystemDotChokeLine_RemainedVolume_in_LastSection%Array(MudSystemDotimud)/ MudSystemDotChokeLine_VolumeCapacity !(gal) - if (xx<= 1.0) then - ChokeLine_Mud_Forehead_section%Array(imud)= isection - ChokeLine_Mud_Forehead_X%Array(imud)= xx * BopStackSpecification%ChokeLineLength + if (MudSystemDotxx<= 1.0) then + ChokeLine_Mud_Forehead_section%Array(MudSystemDotimud)= MudSystemDotisection + MudSystemDotChokeLine_Mud_Forehead_X%Array(MudSystemDotimud)= MudSystemDotxx * BopStackSpecification%ChokeLineLength exit else - ChokeLine_RemainedVolume_in_LastSection%Array(imud)= ChokeLine_RemainedVolume_in_LastSection%Array(imud)- ChokeLine_VolumeCapacity - isection= isection+ 1 + MudSystemDotChokeLine_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotChokeLine_RemainedVolume_in_LastSection%Array(MudSystemDotimud)- MudSystemDotChokeLine_VolumeCapacity + MudSystemDotisection= MudSystemDotisection+ 1 endif @@ -1539,7 +1539,7 @@ imud=0 ! write(*,*) 'b)ChokeLine:', imud, ChokeLine_MudDischarged_Volume%Array(imud) ,ChokeLine_MudOrKick%Array(imud) !enddo - ChokeOutletDensity= ChokeLine_Density%Last() ! used in MudSystem + ChokeOutletDensity= MudSystemDotChokeLine_Density%Last() ! used in MudSystem @@ -1548,8 +1548,8 @@ imud=0 do i=1, ChokeLine_MudOrKick%Length() !write(*,555) i,'Choke_Volume(i), type=' ,ChokeLine_MudDischarged_Volume%Array(i),ChokeLine_MudOrKick%Array(i) - IF (IEEE_Is_NaN(ChokeLine_MudDischarged_Volume%Array(i))) call ErrorStop('NaN in Choke Volume-Plot') - IF (ChokeLine_MudDischarged_Volume%Array(i)<=0.) call ErrorStop('Choke Volume= <=0' , ChokeLine_MudDischarged_Volume%Array(i)) + IF (IEEE_Is_NaN(MudSystemDotChokeLine_MudDischarged_Volume%Array(i))) call ErrorStop('NaN in Choke Volume-Plot') + IF (MudSystemDotChokeLine_MudDischarged_Volume%Array(i)<=0.) call ErrorStop('Choke Volume= <=0' , MudSystemDotChokeLine_MudDischarged_Volume%Array(i)) enddo 555 FORMAT(I3,5X,A42,(f12.5),5X,I3) @@ -1609,19 +1609,19 @@ use CSounds if ( ChokeLine_MudOrKick%Last() > 0 .AND. WellToChokeManifoldOpen == .true.) then !WellToChokeManifoldWasOpen - SoundGasThroughChoke = 100 !100:chon dar adadhaye kamtar az 100 seda ghaat mishavad. eslah shavad.5.8.98 !int (min(ChokeLineFlowRate/2. , 100.)) - print* , 'SoundGasThroughChoke1=', SoundGasThroughChoke + MudSystemDotSoundGasThroughChoke = 100 !100:chon dar adadhaye kamtar az 100 seda ghaat mishavad. eslah shavad.5.8.98 !int (min(ChokeLineFlowRate/2. , 100.)) + print* , 'SoundGasThroughChoke1=', MudSystemDotSoundGasThroughChoke !WRITE (*,*) 'WellToChokeManifoldWasOpen-Sound', WellToChokeManifoldWasOpen WRITE (*,*) 'WellToChokeManifoldOpen', WellToChokeManifoldOpen else - SoundGasThroughChoke = 0 - print* , 'SoundGasThroughChoke2=', SoundGasThroughChoke + MudSystemDotSoundGasThroughChoke = 0 + print* , 'SoundGasThroughChoke2=', MudSystemDotSoundGasThroughChoke endif !print* , 'SoundGasThroughChoke3=', SoundGasThroughChoke - call SetSoundGasThroughChoke(SoundGasThroughChoke) + call SetSoundGasThroughChoke(MudSystemDotSoundGasThroughChoke) end subroutine Choke_GasSound \ No newline at end of file diff --git a/Equipments/MudSystem/Trip_Out_andPump.f90 b/Equipments/MudSystem/Trip_Out_andPump.f90 index 3ef034c..d6dd7e5 100644 --- a/Equipments/MudSystem/Trip_Out_andPump.f90 +++ b/Equipments/MudSystem/Trip_Out_andPump.f90 @@ -25,8 +25,8 @@ Real(8) ExcessMudVolume_Remained,SavedDensityForOp !===========================================================WELL============================================================ !===========================================================WELL============================================================ - StringFlowRate= MUD(2)%Q - AnnulusFlowRate= MUD(2)%Q + MudSystemDotStringFlowRate= MUD(2)%Q + MudSystemDotAnnulusFlowRate= MUD(2)%Q !write(*,*) 'MUD(2)%Q=====' , MUD(2)%Q @@ -48,16 +48,16 @@ Real(8) ExcessMudVolume_Remained,SavedDensityForOp !========================Horizontal PIPE ENTRANCE================= - if (ABS(SuctionDensity_Old - Suction_Density_MudSystem) >= DensityMixTol) then ! new mud is pumped + if (ABS(SuctionDensity_Old - Suction_Density_MudSystem) >= MudSystemDotDensityMixTol) then ! new mud is pumped - call Hz_Density%AddToFirst (Suction_Density_MudSystem) - call Hz_MudDischarged_Volume%AddToFirst (0.0d0) - call Hz_Mud_Forehead_X%AddToFirst (Xstart_PipeSection(1)) + call MudSystemDotHz_Density%AddToFirst (Suction_Density_MudSystem) + call MudSystemDotHz_MudDischarged_Volume%AddToFirst (0.0d0) + call MudSystemDotHz_Mud_Forehead_X%AddToFirst (MudSystemDotXstart_PipeSection(1)) call Hz_Mud_Forehead_section%AddToFirst (1) - call Hz_Mud_Backhead_X%AddToFirst (Xstart_PipeSection(1)) + call MudSystemDotHz_Mud_Backhead_X%AddToFirst (MudSystemDotXstart_PipeSection(1)) call Hz_Mud_Backhead_section%AddToFirst (1) - call Hz_RemainedVolume_in_LastSection%AddToFirst (0.0d0) - call Hz_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) + call MudSystemDotHz_RemainedVolume_in_LastSection%AddToFirst (0.0d0) + call MudSystemDotHz_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) call Hz_MudOrKick%AddToFirst (0) SuctionDensity_Old= Suction_Density_MudSystem @@ -65,14 +65,14 @@ Real(8) ExcessMudVolume_Remained,SavedDensityForOp !========================Horizontal PIPE STRING================= - Hz_MudDischarged_Volume%Array(1)= Hz_MudDischarged_Volume%Array(1)+ ((StringFlowRate/60.0d0)*DeltaT_Mudline) !(gal) + MudSystemDotHz_MudDischarged_Volume%Array(1)= MudSystemDotHz_MudDischarged_Volume%Array(1)+ ((MudSystemDotStringFlowRate/60.0d0)*DeltaT_Mudline) !(gal) - total_add = total_add + ((StringFlowRate/60.0d0)*DeltaT_Mudline) + MudSystemDottotal_add = MudSystemDottotal_add + ((MudSystemDotStringFlowRate/60.0d0)*DeltaT_Mudline) if (ChokeControlPanel%ChokePanelStrokeResetSwitch == 1) then - total_add= 0. + MudSystemDottotal_add= 0. endif !write(*,*) ' total decrease(add to HZ)=' , total_add @@ -80,58 +80,58 @@ Real(8) ExcessMudVolume_Remained,SavedDensityForOp -imud=0 - do while (imud < Hz_Mud_Forehead_X%Length()) - imud = imud + 1 +MudSystemDotimud=0 + do while (MudSystemDotimud < MudSystemDotHz_Mud_Forehead_X%Length()) + MudSystemDotimud = MudSystemDotimud + 1 - if (imud> 1) then - Hz_Mud_Backhead_X%Array(imud)= Hz_Mud_Forehead_X%Array(imud-1) - Hz_Mud_Backhead_section%Array(imud)= Hz_Mud_Forehead_section%Array(imud-1) + if (MudSystemDotimud> 1) then + MudSystemDotHz_Mud_Backhead_X%Array(MudSystemDotimud)= MudSystemDotHz_Mud_Forehead_X%Array(MudSystemDotimud-1) + Hz_Mud_Backhead_section%Array(MudSystemDotimud)= Hz_Mud_Forehead_section%Array(MudSystemDotimud-1) endif - DirectionCoef= (Xend_PipeSection(Hz_Mud_Backhead_section%Array(imud))-Xstart_PipeSection(Hz_Mud_Backhead_section%Array(imud))) & - / ABS(Xend_PipeSection(Hz_Mud_Backhead_section%Array(imud))-Xstart_PipeSection(Hz_Mud_Backhead_section%Array(imud))) + MudSystemDotDirectionCoef= (MudSystemDotXend_PipeSection(Hz_Mud_Backhead_section%Array(MudSystemDotimud))-MudSystemDotXstart_PipeSection(Hz_Mud_Backhead_section%Array(MudSystemDotimud))) & + / ABS(MudSystemDotXend_PipeSection(Hz_Mud_Backhead_section%Array(MudSystemDotimud))-MudSystemDotXstart_PipeSection(Hz_Mud_Backhead_section%Array(MudSystemDotimud))) ! +1 for string , -1 for annulus - Hz_EmptyVolume_inBackheadLocation%Array(imud)= DirectionCoef* (Xend_PipeSection(Hz_Mud_Backhead_section%Array(imud))- Hz_Mud_Backhead_X%Array(imud))* & - Area_PipeSectionFt(Hz_Mud_Backhead_section%Array(imud)) !(ft^3) - Hz_EmptyVolume_inBackheadLocation%Array(imud)= Hz_EmptyVolume_inBackheadLocation%Array(imud)* 7.48051948d0 ! ft^3 to gal + MudSystemDotHz_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotDirectionCoef* (MudSystemDotXend_PipeSection(Hz_Mud_Backhead_section%Array(MudSystemDotimud))- MudSystemDotHz_Mud_Backhead_X%Array(MudSystemDotimud))* & + MudSystemDotArea_PipeSectionFt(Hz_Mud_Backhead_section%Array(MudSystemDotimud)) !(ft^3) + MudSystemDotHz_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotHz_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)* 7.48051948d0 ! ft^3 to gal - if ( Hz_MudDischarged_Volume%Array(imud) <= Hz_EmptyVolume_inBackheadLocation%Array(imud)) then - Hz_Mud_Forehead_section%Array(imud)= Hz_Mud_Backhead_section%Array(imud) - Hz_Mud_Forehead_X%Array(imud)= Hz_Mud_Backhead_X%Array(imud)+ DirectionCoef*(Hz_MudDischarged_Volume%Array(imud)/7.48051948d0)/Area_PipeSectionFt(Hz_Mud_Backhead_section%Array(imud)) + if ( MudSystemDotHz_MudDischarged_Volume%Array(MudSystemDotimud) <= MudSystemDotHz_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)) then + Hz_Mud_Forehead_section%Array(MudSystemDotimud)= Hz_Mud_Backhead_section%Array(MudSystemDotimud) + MudSystemDotHz_Mud_Forehead_X%Array(MudSystemDotimud)= MudSystemDotHz_Mud_Backhead_X%Array(MudSystemDotimud)+ MudSystemDotDirectionCoef*(MudSystemDotHz_MudDischarged_Volume%Array(MudSystemDotimud)/7.48051948d0)/MudSystemDotArea_PipeSectionFt(Hz_Mud_Backhead_section%Array(MudSystemDotimud)) else - isection= Hz_Mud_Backhead_section%Array(imud)+1 - Hz_RemainedVolume_in_LastSection%Array(imud)= Hz_MudDischarged_Volume%Array(imud)- Hz_EmptyVolume_inBackheadLocation%Array(imud) + MudSystemDotisection= Hz_Mud_Backhead_section%Array(MudSystemDotimud)+1 + MudSystemDotHz_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotHz_MudDischarged_Volume%Array(MudSystemDotimud)- MudSystemDotHz_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud) do - if (isection > 1) then ! (horizontal pipe exit) - Hz_MudDischarged_Volume%Array(imud)= Hz_MudDischarged_Volume%Array(imud)- Hz_RemainedVolume_in_LastSection%Array(imud) - Hz_Mud_Forehead_X%Array(imud)= Xend_PipeSection(1) - Hz_Mud_Forehead_section%Array(imud)= 1 + if (MudSystemDotisection > 1) then ! (horizontal pipe exit) + MudSystemDotHz_MudDischarged_Volume%Array(MudSystemDotimud)= MudSystemDotHz_MudDischarged_Volume%Array(MudSystemDotimud)- MudSystemDotHz_RemainedVolume_in_LastSection%Array(MudSystemDotimud) + MudSystemDotHz_Mud_Forehead_X%Array(MudSystemDotimud)= MudSystemDotXend_PipeSection(1) + Hz_Mud_Forehead_section%Array(MudSystemDotimud)= 1 - if (Hz_MudDischarged_Volume%Array(imud)<= 0.0d0) then ! imud is completely exited form the string - call RemoveHzMudArrays(imud) + if (MudSystemDotHz_MudDischarged_Volume%Array(MudSystemDotimud)<= 0.0d0) then ! imud is completely exited form the string + call RemoveHzMudArrays(MudSystemDotimud) endif exit endif - xx= Hz_RemainedVolume_in_LastSection%Array(imud)/ PipeSection_VolumeCapacity(isection) !(gal) + MudSystemDotxx= MudSystemDotHz_RemainedVolume_in_LastSection%Array(MudSystemDotimud)/ MudSystemDotPipeSection_VolumeCapacity(MudSystemDotisection) !(gal) - if (xx<= 1.0) then - Hz_Mud_Forehead_section%Array(imud)= isection - Hz_Mud_Forehead_X%Array(imud)= (xx * (Xend_PipeSection(isection)- Xstart_PipeSection(isection)))+ Xstart_PipeSection(isection) + if (MudSystemDotxx<= 1.0) then + Hz_Mud_Forehead_section%Array(MudSystemDotimud)= MudSystemDotisection + MudSystemDotHz_Mud_Forehead_X%Array(MudSystemDotimud)= (MudSystemDotxx * (MudSystemDotXend_PipeSection(MudSystemDotisection)- MudSystemDotXstart_PipeSection(MudSystemDotisection)))+ MudSystemDotXstart_PipeSection(MudSystemDotisection) exit else - Hz_RemainedVolume_in_LastSection%Array(imud)= Hz_RemainedVolume_in_LastSection%Array(imud)- PipeSection_VolumeCapacity(isection) - isection= isection+ 1 + MudSystemDotHz_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotHz_RemainedVolume_in_LastSection%Array(MudSystemDotimud)- MudSystemDotPipeSection_VolumeCapacity(MudSystemDotisection) + MudSystemDotisection= MudSystemDotisection+ 1 endif @@ -158,14 +158,14 @@ imud=0 !========================Utube2 Removing from Annulus================= - if (UtubeMode2Activated== .true.) then ! StringUpdate == .true. - TotalAddedVolume=0. + if (MudSystemDotUtubeMode2Activated== .true.) then ! StringUpdate == .true. + MudSystemDotTotalAddedVolume=0. if (Ann_MudOrKick%Last() == 104) then !movaghati. albate age merge anjam shode bashe moshkeli nist call RemoveAnnulusMudArrays(Ann_MudOrKick%Length()) endif - UtubeMode2Activated= .false. + MudSystemDotUtubeMode2Activated= .false. endif @@ -173,24 +173,24 @@ imud=0 !========================New Pipe Filling================= - if (AddedElementsToString > 0) then ! StringUpdate == .true. + if (MudSystemDotAddedElementsToString > 0) then ! StringUpdate == .true. !NoPipeAdded= F_StringIntervalCounts - F_StringIntervalCountsOld - NewPipeFilling=0 + MudSystemDotNewPipeFilling=0 IF (St_MudOrKick%First() == 104) then - St_MudDischarged_Volume%Array(1) = St_MudDischarged_Volume%Array(1) + sum(PipeSection_VolumeCapacity(2:1+AddedElementsToString)) ! new pipe is filled by air + MudSystemDotSt_MudDischarged_Volume%Array(1) = MudSystemDotSt_MudDischarged_Volume%Array(1) + sum(MudSystemDotPipeSection_VolumeCapacity(2:1+MudSystemDotAddedElementsToString)) ! new pipe is filled by air else call St_Density%AddToFirst (0.d0) - call St_MudDischarged_Volume%AddToFirst (sum(PipeSection_VolumeCapacity(2:1+AddedElementsToString))) - call St_Mud_Forehead_X%AddToFirst (Xstart_PipeSection(2)) + call MudSystemDotSt_MudDischarged_Volume%AddToFirst (sum(MudSystemDotPipeSection_VolumeCapacity(2:1+MudSystemDotAddedElementsToString))) + call MudSystemDotSt_Mud_Forehead_X%AddToFirst (MudSystemDotXstart_PipeSection(2)) call St_Mud_Forehead_section%AddToFirst (2) - call St_Mud_Backhead_X%AddToFirst (Xstart_PipeSection(2)) + call MudSystemDotSt_Mud_Backhead_X%AddToFirst (MudSystemDotXstart_PipeSection(2)) call St_Mud_Backhead_section%AddToFirst (2) - call St_RemainedVolume_in_LastSection%AddToFirst (0.d0) - call St_EmptyVolume_inBackheadLocation%AddToFirst (0.d0) + call MudSystemDotSt_RemainedVolume_in_LastSection%AddToFirst (0.d0) + call MudSystemDotSt_EmptyVolume_inBackheadLocation%AddToFirst (0.d0) call St_MudOrKick%AddToFirst (104) endif @@ -200,45 +200,45 @@ imud=0 - if (NewPipeFilling == 0) then ! 2= is the first element of string (1= is for Hz pipe) + if (MudSystemDotNewPipeFilling == 0) then ! 2= is the first element of string (1= is for Hz pipe) - LackageMudVolume= St_MudDischarged_Volume%Array(1) ! = Air element + MudSystemDotLackageMudVolume= MudSystemDotSt_MudDischarged_Volume%Array(1) ! = Air element !write(*,*) 'LackageMudVolume=' , LackageMudVolume - if (ABS(St_Density%Array(2) - Hz_Density%Last()) >= DensityMixTol) then ! new mud is pumped - call St_Density%AddTo (2,Hz_Density%Last()) - call St_MudDischarged_Volume%AddTo (2,0.d0) - call St_Mud_Forehead_X%AddTo (2,Xstart_PipeSection(2)) + if (ABS(St_Density%Array(2) - MudSystemDotHz_Density%Last()) >= MudSystemDotDensityMixTol) then ! new mud is pumped + call St_Density%AddTo (2,MudSystemDotHz_Density%Last()) + call MudSystemDotSt_MudDischarged_Volume%AddTo (2,0.d0) + call MudSystemDotSt_Mud_Forehead_X%AddTo (2,MudSystemDotXstart_PipeSection(2)) call St_Mud_Forehead_section%AddTo (2 , 2) - call St_Mud_Backhead_X%AddTo (2,Xstart_PipeSection(2)) + call MudSystemDotSt_Mud_Backhead_X%AddTo (2,MudSystemDotXstart_PipeSection(2)) call St_Mud_Backhead_section%AddTo (2 ,2) - call St_RemainedVolume_in_LastSection%AddTo (2,0.d0) - call St_EmptyVolume_inBackheadLocation%AddTo (2,0.d0) + call MudSystemDotSt_RemainedVolume_in_LastSection%AddTo (2,0.d0) + call MudSystemDotSt_EmptyVolume_inBackheadLocation%AddTo (2,0.d0) call St_MudOrKick%AddTo (2,0) !StringDensity_Old= Hz_Density%Last() endif - St_MudDischarged_Volume%Array(2)= St_MudDischarged_Volume%Array(2)+ min( ((StringFlowRate/60.0d0)*DeltaT_Mudline), LackageMudVolume) !(gal) + MudSystemDotSt_MudDischarged_Volume%Array(2)= MudSystemDotSt_MudDischarged_Volume%Array(2)+ min( ((MudSystemDotStringFlowRate/60.0d0)*DeltaT_Mudline), MudSystemDotLackageMudVolume) !(gal) - St_MudDischarged_Volume%Array(1)= St_MudDischarged_Volume%Array(1)- min( ((StringFlowRate/60.0d0)*DeltaT_Mudline), LackageMudVolume) ! air(gal) + MudSystemDotSt_MudDischarged_Volume%Array(1)= MudSystemDotSt_MudDischarged_Volume%Array(1)- min( ((MudSystemDotStringFlowRate/60.0d0)*DeltaT_Mudline), MudSystemDotLackageMudVolume) ! air(gal) !LackageMudVolumeAfterFilling= sum(PipeSection_VolumeCapacity(2:F_StringIntervalCounts)) - sum(St_MudDischarged_Volume%Array(:)) - LackageMudVolumeAfterFilling= St_MudDischarged_Volume%Array(1) ! last time it should be zero + MudSystemDotLackageMudVolumeAfterFilling= MudSystemDotSt_MudDischarged_Volume%Array(1) ! last time it should be zero - if (LackageMudVolumeAfterFilling == 0.) then - NewPipeFilling= 1 + if (MudSystemDotLackageMudVolumeAfterFilling == 0.) then + MudSystemDotNewPipeFilling= 1 call RemoveStringMudArrays(1) - St_Mud_Backhead_X%Array(1) = Xstart_PipeSection(2) + MudSystemDotSt_Mud_Backhead_X%Array(1) = MudSystemDotXstart_PipeSection(2) St_Mud_Backhead_section%Array(1) = 2 endif @@ -247,58 +247,58 @@ imud=0 !========================New Pipe Filling End================= - if (NewPipeFilling == 0) then - StringFlowRate= 0. - AnnulusFlowRate= 0. + if (MudSystemDotNewPipeFilling == 0) then + MudSystemDotStringFlowRate= 0. + MudSystemDotAnnulusFlowRate= 0. endif - StringFlowRateFinal= StringFlowRate - AnnulusFlowRateFinal= AnnulusFlowRate + MudSystemDotStringFlowRateFinal= MudSystemDotStringFlowRate + MudSystemDotAnnulusFlowRateFinal= MudSystemDotAnnulusFlowRate !========================STRING ENTRANCE================= - if (StringFlowRateFinal > 0.0 .and. ABS(St_Density%First() - Hz_Density%Last()) >= DensityMixTol) then ! new mud is pumped + if (MudSystemDotStringFlowRateFinal > 0.0 .and. ABS(St_Density%First() - MudSystemDotHz_Density%Last()) >= MudSystemDotDensityMixTol) then ! new mud is pumped !if (ABS(StringDensity_Old - Hz_Density%Last()) >= DensityMixTol) then ! new mud is pumped - call St_Density%AddToFirst (Hz_Density%Last()) - call St_MudDischarged_Volume%AddToFirst (0.0d0) - call St_Mud_Forehead_X%AddToFirst (Xstart_PipeSection(2)) + call St_Density%AddToFirst (MudSystemDotHz_Density%Last()) + call MudSystemDotSt_MudDischarged_Volume%AddToFirst (0.0d0) + call MudSystemDotSt_Mud_Forehead_X%AddToFirst (MudSystemDotXstart_PipeSection(2)) call St_Mud_Forehead_section%AddToFirst (2) - call St_Mud_Backhead_X%AddToFirst (Xstart_PipeSection(2)) + call MudSystemDotSt_Mud_Backhead_X%AddToFirst (MudSystemDotXstart_PipeSection(2)) call St_Mud_Backhead_section%AddToFirst (2) - call St_RemainedVolume_in_LastSection%AddToFirst (0.0d0) - call St_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) + call MudSystemDotSt_RemainedVolume_in_LastSection%AddToFirst (0.0d0) + call MudSystemDotSt_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) call St_MudOrKick%AddToFirst (0) !StringDensity_Old= Hz_Density%Last() endif - St_MudDischarged_Volume%Array(1)= St_MudDischarged_Volume%Array(1)+ ((StringFlowRate/60.0d0)*DeltaT_Mudline) !(gal) + MudSystemDotSt_MudDischarged_Volume%Array(1)= MudSystemDotSt_MudDischarged_Volume%Array(1)+ ((MudSystemDotStringFlowRate/60.0d0)*DeltaT_Mudline) !(gal) !=============== save String Mud data=========== - StMudVolumeSum= 0.d0 + MudSystemDotStMudVolumeSum= 0.d0 !St_MudSaved_Density= 0.d0 - St_Saved_MudDischarged_Volume= 0.d0 + MudSystemDotSt_Saved_MudDischarged_Volume= 0.d0 !Saved_St_MudOrKick= 0 !Ann_to_Choke_2mud= .false. - do imud=1, St_MudDischarged_Volume%Length() + do MudSystemDotimud=1, MudSystemDotSt_MudDischarged_Volume%Length() - StMudVolumeSum= StMudVolumeSum + St_MudDischarged_Volume%Array(imud) + MudSystemDotStMudVolumeSum= MudSystemDotStMudVolumeSum + MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud) - if ( StMudVolumeSum > sum(PipeSection_VolumeCapacity(2:F_StringIntervalCounts)) ) then + if ( MudSystemDotStMudVolumeSum > sum(MudSystemDotPipeSection_VolumeCapacity(2:F_StringIntervalCounts)) ) then !IF (St_MudOrKick%Array(imud) == 0) THEN - St_MudSaved_Density = St_Density%Array(imud) - St_Saved_MudDischarged_Volume = StMudVolumeSum - sum(PipeSection_VolumeCapacity(2:F_StringIntervalCounts)) + MudSystemDotSt_MudSaved_Density = St_Density%Array(MudSystemDotimud) + MudSystemDotSt_Saved_MudDischarged_Volume = MudSystemDotStMudVolumeSum - sum(MudSystemDotPipeSection_VolumeCapacity(2:F_StringIntervalCounts)) !ELSEIF (St_MudOrKick%Array(imud) > 0 .AND. St_MudOrKick%Array(imud) <100) THEN ! 104= AIR ! St_Kick_Saved_Volume = StMudVolumeSum - sum(PipeSection_VolumeCapacity(F_StringIntervalCounts+1:NoPipeSections)) ! Saved_St_MudOrKick= St_MudOrKick%Array (imud) ! St_KickSaved_Density= St_Density%Array(imud) !END IF - do ii= imud + 1, St_MudDischarged_Volume%Length() + do ii= MudSystemDotimud + 1, MudSystemDotSt_MudDischarged_Volume%Length() !IF (St_MudOrKick%Array(ii) == 0) THEN - St_MudSaved_Density = ((St_MudSaved_Density * St_Saved_MudDischarged_Volume) + (St_Density%Array(ii) * St_MudDischarged_Volume%Array(ii))) / (St_Saved_MudDischarged_Volume + St_MudDischarged_Volume%Array(ii)) - St_Saved_MudDischarged_Volume = St_Saved_MudDischarged_Volume + St_MudDischarged_Volume%Array(ii) + MudSystemDotSt_MudSaved_Density = ((MudSystemDotSt_MudSaved_Density * MudSystemDotSt_Saved_MudDischarged_Volume) + (St_Density%Array(ii) * MudSystemDotSt_MudDischarged_Volume%Array(ii))) / (MudSystemDotSt_Saved_MudDischarged_Volume + MudSystemDotSt_MudDischarged_Volume%Array(ii)) + MudSystemDotSt_Saved_MudDischarged_Volume = MudSystemDotSt_Saved_MudDischarged_Volume + MudSystemDotSt_MudDischarged_Volume%Array(ii) !ELSEIF (St_MudOrKick%Array(imud) > 0 .AND. St_MudOrKick%Array(imud) <100) THEN ! 104= AIR ! St_Kick_Saved_Volume = St_Kick_Saved_Volume + St_MudDischarged_Volume%Array(ii) @@ -314,65 +314,65 @@ imud=0 endif enddo -St_Saved_MudDischarged_Volume_Final= St_Saved_MudDischarged_Volume +MudSystemDotSt_Saved_MudDischarged_Volume_Final= MudSystemDotSt_Saved_MudDischarged_Volume -IF (WellHeadIsOpen) MudVolume_InjectedToBH = St_Saved_MudDischarged_Volume_Final +IF (WellHeadIsOpen) MudSystemDotMudVolume_InjectedToBH = MudSystemDotSt_Saved_MudDischarged_Volume_Final !====================================================================== !========================STRING================= -imud=0 - do while (imud < St_Mud_Forehead_X%Length()) - imud = imud + 1 +MudSystemDotimud=0 + do while (MudSystemDotimud < MudSystemDotSt_Mud_Forehead_X%Length()) + MudSystemDotimud = MudSystemDotimud + 1 - if (imud> 1) then - St_Mud_Backhead_X%Array(imud)= St_Mud_Forehead_X%Array(imud-1) - St_Mud_Backhead_section%Array(imud)= St_Mud_Forehead_section%Array(imud-1) + if (MudSystemDotimud> 1) then + MudSystemDotSt_Mud_Backhead_X%Array(MudSystemDotimud)= MudSystemDotSt_Mud_Forehead_X%Array(MudSystemDotimud-1) + St_Mud_Backhead_section%Array(MudSystemDotimud)= St_Mud_Forehead_section%Array(MudSystemDotimud-1) endif - DirectionCoef= (Xend_PipeSection(St_Mud_Backhead_section%Array(imud))-Xstart_PipeSection(St_Mud_Backhead_section%Array(imud))) & - / ABS(Xend_PipeSection(St_Mud_Backhead_section%Array(imud))-Xstart_PipeSection(St_Mud_Backhead_section%Array(imud))) + MudSystemDotDirectionCoef= (MudSystemDotXend_PipeSection(St_Mud_Backhead_section%Array(MudSystemDotimud))-MudSystemDotXstart_PipeSection(St_Mud_Backhead_section%Array(MudSystemDotimud))) & + / ABS(MudSystemDotXend_PipeSection(St_Mud_Backhead_section%Array(MudSystemDotimud))-MudSystemDotXstart_PipeSection(St_Mud_Backhead_section%Array(MudSystemDotimud))) ! +1 for string , -1 for annulus - St_EmptyVolume_inBackheadLocation%Array(imud)= DirectionCoef* (Xend_PipeSection(St_Mud_Backhead_section%Array(imud))- St_Mud_Backhead_X%Array(imud))* & - Area_PipeSectionFt(St_Mud_Backhead_section%Array(imud)) !(ft^3) - St_EmptyVolume_inBackheadLocation%Array(imud)= St_EmptyVolume_inBackheadLocation%Array(imud)* 7.48051948d0 ! ft^3 to gal + MudSystemDotSt_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotDirectionCoef* (MudSystemDotXend_PipeSection(St_Mud_Backhead_section%Array(MudSystemDotimud))- MudSystemDotSt_Mud_Backhead_X%Array(MudSystemDotimud))* & + MudSystemDotArea_PipeSectionFt(St_Mud_Backhead_section%Array(MudSystemDotimud)) !(ft^3) + MudSystemDotSt_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotSt_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)* 7.48051948d0 ! ft^3 to gal - if ( St_MudDischarged_Volume%Array(imud) <= St_EmptyVolume_inBackheadLocation%Array(imud)) then - St_Mud_Forehead_section%Array(imud)= St_Mud_Backhead_section%Array(imud) - St_Mud_Forehead_X%Array(imud)= St_Mud_Backhead_X%Array(imud)+ DirectionCoef*(St_MudDischarged_Volume%Array(imud)/7.48051948d0)/Area_PipeSectionFt(St_Mud_Backhead_section%Array(imud)) + if ( MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud) <= MudSystemDotSt_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)) then + St_Mud_Forehead_section%Array(MudSystemDotimud)= St_Mud_Backhead_section%Array(MudSystemDotimud) + MudSystemDotSt_Mud_Forehead_X%Array(MudSystemDotimud)= MudSystemDotSt_Mud_Backhead_X%Array(MudSystemDotimud)+ MudSystemDotDirectionCoef*(MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud)/7.48051948d0)/MudSystemDotArea_PipeSectionFt(St_Mud_Backhead_section%Array(MudSystemDotimud)) ! 7.48 is for gal to ft^3 else - isection= St_Mud_Backhead_section%Array(imud)+1 - St_RemainedVolume_in_LastSection%Array(imud)= St_MudDischarged_Volume%Array(imud)- St_EmptyVolume_inBackheadLocation%Array(imud) + MudSystemDotisection= St_Mud_Backhead_section%Array(MudSystemDotimud)+1 + MudSystemDotSt_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud)- MudSystemDotSt_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud) do - if (isection > F_StringIntervalCounts) then ! last pipe section(string exit) - St_MudDischarged_Volume%Array(imud)= St_MudDischarged_Volume%Array(imud)- St_RemainedVolume_in_LastSection%Array(imud) - St_Mud_Forehead_X%Array(imud)= Xend_PipeSection(F_StringIntervalCounts) - St_Mud_Forehead_section%Array(imud)= F_StringIntervalCounts + if (MudSystemDotisection > F_StringIntervalCounts) then ! last pipe section(string exit) + MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud)= MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud)- MudSystemDotSt_RemainedVolume_in_LastSection%Array(MudSystemDotimud) + MudSystemDotSt_Mud_Forehead_X%Array(MudSystemDotimud)= MudSystemDotXend_PipeSection(F_StringIntervalCounts) + St_Mud_Forehead_section%Array(MudSystemDotimud)= F_StringIntervalCounts - if (St_MudDischarged_Volume%Array(imud)<= 0.0d0) then ! imud is completely exited form the string - call RemoveStringMudArrays(imud) + if (MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud)<= 0.0d0) then ! imud is completely exited form the string + call RemoveStringMudArrays(MudSystemDotimud) endif exit endif - xx= St_RemainedVolume_in_LastSection%Array(imud)/ PipeSection_VolumeCapacity(isection) !(gal) + MudSystemDotxx= MudSystemDotSt_RemainedVolume_in_LastSection%Array(MudSystemDotimud)/ MudSystemDotPipeSection_VolumeCapacity(MudSystemDotisection) !(gal) - if (xx<= 1.0) then - St_Mud_Forehead_section%Array(imud)= isection - St_Mud_Forehead_X%Array(imud)= (xx * (Xend_PipeSection(isection)- Xstart_PipeSection(isection)))+ Xstart_PipeSection(isection) + if (MudSystemDotxx<= 1.0) then + St_Mud_Forehead_section%Array(MudSystemDotimud)= MudSystemDotisection + MudSystemDotSt_Mud_Forehead_X%Array(MudSystemDotimud)= (MudSystemDotxx * (MudSystemDotXend_PipeSection(MudSystemDotisection)- MudSystemDotXstart_PipeSection(MudSystemDotisection)))+ MudSystemDotXstart_PipeSection(MudSystemDotisection) exit else - St_RemainedVolume_in_LastSection%Array(imud)= St_RemainedVolume_in_LastSection%Array(imud)- PipeSection_VolumeCapacity(isection) - isection= isection+ 1 + MudSystemDotSt_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotSt_RemainedVolume_in_LastSection%Array(MudSystemDotimud)- MudSystemDotPipeSection_VolumeCapacity(MudSystemDotisection) + MudSystemDotisection= MudSystemDotisection+ 1 endif @@ -403,7 +403,7 @@ imud=0 iloc_changedTo2 = 0 IF (Op_MudOrKick%Last() /= 0 .and. Op_MudOrKick%Last()==Ann_MudOrKick%First()) then - iLoc=2 ! it may be 1,2,3 or more, all of them are kick + MudSystemDotiLoc=2 ! it may be 1,2,3 or more, all of them are kick iloc_changedTo2= 1 endif @@ -411,8 +411,8 @@ imud=0 iloc_edited= 0 !write(*,*) sum(Op_MudDischarged_Volume%Array(:)) , ((AnnulusFlowRate/60.d0)*DeltaT_Mudline) , Ann_MudDischarged_Volume%First() , sum(OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) - if (iloc==2 .and. sum(Op_MudDischarged_Volume%Array(:))+((AnnulusFlowRate/60.d0)*DeltaT_Mudline)+Ann_MudDischarged_Volume%First() < sum(OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) ) then - iloc = 1 + if (MudSystemDotiLoc==2 .and. sum(MudSystemDotOp_MudDischarged_Volume%Array(:))+((MudSystemDotAnnulusFlowRate/60.d0)*DeltaT_Mudline)+MudSystemDotAnn_MudDischarged_Volume%First() < sum(MudSystemDotOpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) ) then + MudSystemDotiLoc = 1 iloc_edited = 1 !write(*,*) 'hellooooooo' endif @@ -427,33 +427,33 @@ imud=0 !=============================Add PumpFlowRate to Bottom Hole ============================== !if ( AnnulusFlowRate>0.0 ) then - if ( MudVolume_InjectedToBH > 0.0 ) then + if ( MudSystemDotMudVolume_InjectedToBH > 0.0 ) then if (KickOffBottom) then ! (kickOffBottom = F) means kick is next to the bottom hole and usually kick is entering the - AddLocation= Op_Density%Length()-iloc+1+1 ! well, thus pumped mud should be placed above the kick + AddLocation= MudSystemDotOp_Density%Length()-MudSystemDotiLoc+1+1 ! well, thus pumped mud should be placed above the kick else - AddLocation= Op_Density%Length()+1 + AddLocation= MudSystemDotOp_Density%Length()+1 endif !write(*,*) 'AddLocation====' , AddLocation if ( AddLocation== 0) CALL ErrorStop ('AddLocation=0') - if ( ABS(St_Density%Last() - Op_Density%Array(AddLocation-1)) >= DensityMixTol ) then + if ( ABS(St_Density%Last() - MudSystemDotOp_Density%Array(AddLocation-1)) >= MudSystemDotDensityMixTol ) then !write(*,*) 'new pocket**' !write(*,*) 'St_Density%Last()=' , St_Density%Last() !write(*,*) 'Op_Density%Array(AddLocation-1)=' , Op_Density%Array(AddLocation-1) - call Op_Density% AddTo (AddLocation,St_Density%Last()) + call MudSystemDotOp_Density% AddTo (AddLocation,St_Density%Last()) !call Op_MudDischarged_Volume%AddTo (AddLocation,((AnnulusFlowRate/60.d0)*DeltaT_Mudline)) - call Op_MudDischarged_Volume%AddTo (AddLocation,MudVolume_InjectedToBH) - call Op_Mud_Forehead_X%AddTo (AddLocation,Xstart_OpSection(1)) + call MudSystemDotOp_MudDischarged_Volume%AddTo (AddLocation,MudSystemDotMudVolume_InjectedToBH) + call MudSystemDotOp_Mud_Forehead_X%AddTo (AddLocation,MudSystemDotXstart_OpSection(1)) call Op_Mud_Forehead_section%AddTo (AddLocation,1) - call Op_Mud_Backhead_X%AddTo (AddLocation,Xstart_OpSection(1)) + call MudSystemDotOp_Mud_Backhead_X%AddTo (AddLocation,MudSystemDotXstart_OpSection(1)) call Op_Mud_Backhead_section%AddTo (AddLocation,1) - call Op_RemainedVolume_in_LastSection%AddTo (AddLocation,0.0d0) - call Op_EmptyVolume_inBackheadLocation%AddTo (AddLocation,0.0d0) + call MudSystemDotOp_RemainedVolume_in_LastSection%AddTo (AddLocation,0.0d0) + call MudSystemDotOp_EmptyVolume_inBackheadLocation%AddTo (AddLocation,0.0d0) call Op_MudOrKick%AddTo (AddLocation,0) else !write(*,*) 'merge**' @@ -463,8 +463,8 @@ imud=0 !Op_Density%Array(AddLocation-1)= (Op_Density%Array(AddLocation-1)*Op_MudDischarged_Volume%Array(AddLocation-1)+St_Density%Last()*((AnnulusFlowRate/60.d0)*DeltaT_Mudline))/(Op_MudDischarged_Volume%Array(AddLocation-1)+((AnnulusFlowRate/60.d0)*DeltaT_Mudline)) !Op_MudDischarged_Volume%Array(AddLocation-1)= Op_MudDischarged_Volume%Array(AddLocation-1) + ((AnnulusFlowRate/60.d0)*DeltaT_Mudline) - Op_Density%Array(AddLocation-1)= (Op_Density%Array(AddLocation-1)*Op_MudDischarged_Volume%Array(AddLocation-1)+St_Density%Last()*MudVolume_InjectedToBH)/(Op_MudDischarged_Volume%Array(AddLocation-1)+MudVolume_InjectedToBH) - Op_MudDischarged_Volume%Array(AddLocation-1)= Op_MudDischarged_Volume%Array(AddLocation-1) + MudVolume_InjectedToBH + MudSystemDotOp_Density%Array(AddLocation-1)= (MudSystemDotOp_Density%Array(AddLocation-1)*MudSystemDotOp_MudDischarged_Volume%Array(AddLocation-1)+St_Density%Last()*MudSystemDotMudVolume_InjectedToBH)/(MudSystemDotOp_MudDischarged_Volume%Array(AddLocation-1)+MudSystemDotMudVolume_InjectedToBH) + MudSystemDotOp_MudDischarged_Volume%Array(AddLocation-1)= MudSystemDotOp_MudDischarged_Volume%Array(AddLocation-1) + MudSystemDotMudVolume_InjectedToBH !write(*,*) 'density after=' , Op_Density%Array(AddLocation-1) endif @@ -491,44 +491,44 @@ imud=0 !=============== save OP Mud data to transfer to the annulus enterance due to tripin or kick - OpMudVolumeSum= 0.d0 + MudSystemDotOpMudVolumeSum= 0.d0 !Op_MudSaved_Density= 0.d0 !Op_KickSaved_Density= 0.d0 - Op_Saved_MudDischarged_Volume= 0.d0 - Op_Kick_Saved_Volume= 0.d0 - Saved_Op_MudOrKick= 0 - Op_NeededVolume_ToFill= 0.d0 + MudSystemDotOp_Saved_MudDischarged_Volume= 0.d0 + MudSystemDotOp_Kick_Saved_Volume= 0.d0 + MudSystemDotSaved_Op_MudOrKick= 0 + MudSystemDotOp_NeededVolume_ToFill= 0.d0 - do imud=1, Op_MudDischarged_Volume%Length() + do MudSystemDotimud=1, MudSystemDotOp_MudDischarged_Volume%Length() - OpMudVolumeSum= OpMudVolumeSum + Op_MudDischarged_Volume%Array(imud) + MudSystemDotOpMudVolumeSum= MudSystemDotOpMudVolumeSum + MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud) - if ( OpMudVolumeSum > sum(OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) ) then !1st mode + if ( MudSystemDotOpMudVolumeSum > sum(MudSystemDotOpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) ) then !1st mode - IF (Op_MudOrKick%Array(imud) == 0) THEN - Op_MudSaved_Density = Op_Density%Array(imud) - Op_Saved_MudDischarged_Volume = OpMudVolumeSum - sum(OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) + IF (Op_MudOrKick%Array(MudSystemDotimud) == 0) THEN + MudSystemDotOp_MudSaved_Density = MudSystemDotOp_Density%Array(MudSystemDotimud) + MudSystemDotOp_Saved_MudDischarged_Volume = MudSystemDotOpMudVolumeSum - sum(MudSystemDotOpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) ELSE - Op_Kick_Saved_Volume = OpMudVolumeSum - sum(OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) - Saved_Op_MudOrKick= Op_MudOrKick%Array (imud) - Op_KickSaved_Density= Op_Density%Array(imud) - iloc= 2 + MudSystemDotOp_Kick_Saved_Volume = MudSystemDotOpMudVolumeSum - sum(MudSystemDotOpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) + MudSystemDotSaved_Op_MudOrKick= Op_MudOrKick%Array (MudSystemDotimud) + MudSystemDotOp_KickSaved_Density= MudSystemDotOp_Density%Array(MudSystemDotimud) + MudSystemDotiLoc= 2 iloc_changedTo2= 2 END IF - do ii= imud + 1, Op_MudDischarged_Volume%Length() + do ii= MudSystemDotimud + 1, MudSystemDotOp_MudDischarged_Volume%Length() IF (Op_MudOrKick%Array(ii) == 0) THEN - Op_MudSaved_Density = ((Op_MudSaved_Density * Op_Saved_MudDischarged_Volume) + (Op_Density%Array(ii) * Op_MudDischarged_Volume%Array(ii))) / (Op_Saved_MudDischarged_Volume + Op_MudDischarged_Volume%Array(ii)) - Op_Saved_MudDischarged_Volume = Op_Saved_MudDischarged_Volume + Op_MudDischarged_Volume%Array(ii) + MudSystemDotOp_MudSaved_Density = ((MudSystemDotOp_MudSaved_Density * MudSystemDotOp_Saved_MudDischarged_Volume) + (MudSystemDotOp_Density%Array(ii) * MudSystemDotOp_MudDischarged_Volume%Array(ii))) / (MudSystemDotOp_Saved_MudDischarged_Volume + MudSystemDotOp_MudDischarged_Volume%Array(ii)) + MudSystemDotOp_Saved_MudDischarged_Volume = MudSystemDotOp_Saved_MudDischarged_Volume + MudSystemDotOp_MudDischarged_Volume%Array(ii) ELSE - Op_Kick_Saved_Volume = Op_Kick_Saved_Volume + Op_MudDischarged_Volume%Array(ii) - Saved_Op_MudOrKick= Op_MudOrKick%Array (ii) - Op_KickSaved_Density= Op_Density%Array(ii) - iloc= 2 + MudSystemDotOp_Kick_Saved_Volume = MudSystemDotOp_Kick_Saved_Volume + MudSystemDotOp_MudDischarged_Volume%Array(ii) + MudSystemDotSaved_Op_MudOrKick= Op_MudOrKick%Array (ii) + MudSystemDotOp_KickSaved_Density= MudSystemDotOp_Density%Array(ii) + MudSystemDotiLoc= 2 iloc_changedTo2= 3 END IF enddo @@ -539,9 +539,9 @@ imud=0 enddo - if ( sum(Op_MudDischarged_Volume%Array(:)) < sum(OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) ) then !2nd & 3rd mode + if ( sum(MudSystemDotOp_MudDischarged_Volume%Array(:)) < sum(MudSystemDotOpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) ) then !2nd & 3rd mode - Op_NeededVolume_ToFill= sum(OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) - sum(Op_MudDischarged_Volume%Array(:)) + MudSystemDotOp_NeededVolume_ToFill= sum(MudSystemDotOpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) - sum(MudSystemDotOp_MudDischarged_Volume%Array(:)) endif @@ -566,52 +566,52 @@ imud=0 - if ( (Op_Kick_Saved_Volume > 0.0 .or. Op_Saved_MudDischarged_Volume> 0.0) .or. & ! 1st Mode-Pump flow is more than trip out so fluid Level in Annulus Increases - (Op_NeededVolume_ToFill < ABS(DeltaVolumeAnnulusCapacity)) ) then !3rd Mode-fluid Level in Annulus Increases + if ( (MudSystemDotOp_Kick_Saved_Volume > 0.0 .or. MudSystemDotOp_Saved_MudDischarged_Volume> 0.0) .or. & ! 1st Mode-Pump flow is more than trip out so fluid Level in Annulus Increases + (MudSystemDotOp_NeededVolume_ToFill < ABS(MudSystemDotDeltaVolumeAnnulusCapacity)) ) then !3rd Mode-fluid Level in Annulus Increases !if ( Op_Kick_Saved_Volume > 0.0 .or. Op_Saved_MudDischarged_Volume> 0.0 ) write(*,*) 'trip out 1st mode' - if ( Op_NeededVolume_ToFill > 0.0 .and. Op_NeededVolume_ToFill < ABS(DeltaVolumeAnnulusCapacity) ) then + if ( MudSystemDotOp_NeededVolume_ToFill > 0.0 .and. MudSystemDotOp_NeededVolume_ToFill < ABS(MudSystemDotDeltaVolumeAnnulusCapacity) ) then ! write(*,*) 'trip out 3rd mode' - NewVolume= 0.d0 ! for condition iloc=1 + MudSystemDotNewVolume= 0.d0 ! for condition iloc=1 SavedDensityForOp= Ann_Density%Array(1) - ExcessMudVolume_Remained= Op_NeededVolume_ToFill + ExcessMudVolume_Remained= MudSystemDotOp_NeededVolume_ToFill - imud=1 + MudSystemDotimud=1 Do - if(Ann_MudDischarged_Volume%Array(imud) < ExcessMudVolume_Remained) then - ExcessMudVolume_Remained= ExcessMudVolume_Remained- Ann_MudDischarged_Volume%Array(imud) - call Ann_MudDischarged_Volume%Remove (imud) - call Ann_Mud_Backhead_X%Remove (imud) - call Ann_Mud_Backhead_section%Remove (imud) - call Ann_Mud_Forehead_X%Remove (imud) - call Ann_Mud_Forehead_section%Remove (imud) - call Ann_Density%Remove (imud) - call Ann_RemainedVolume_in_LastSection%Remove (imud) - call Ann_EmptyVolume_inBackheadLocation%Remove (imud) - call Ann_MudOrKick%Remove (imud) + if(MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud) < ExcessMudVolume_Remained) then + ExcessMudVolume_Remained= ExcessMudVolume_Remained- MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud) + call MudSystemDotAnn_MudDischarged_Volume%Remove (MudSystemDotimud) + call Ann_Mud_Backhead_X%Remove (MudSystemDotimud) + call Ann_Mud_Backhead_section%Remove (MudSystemDotimud) + call Ann_Mud_Forehead_X%Remove (MudSystemDotimud) + call Ann_Mud_Forehead_section%Remove (MudSystemDotimud) + call Ann_Density%Remove (MudSystemDotimud) + call Ann_RemainedVolume_in_LastSection%Remove (MudSystemDotimud) + call Ann_EmptyVolume_inBackheadLocation%Remove (MudSystemDotimud) + call Ann_MudOrKick%Remove (MudSystemDotimud) - elseif(Ann_MudDischarged_Volume%Array(imud) > ExcessMudVolume_Remained) then - Ann_MudDischarged_Volume%Array(imud)= Ann_MudDischarged_Volume%Array(imud)- ExcessMudVolume_Remained + elseif(MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud) > ExcessMudVolume_Remained) then + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)- ExcessMudVolume_Remained exit else !(Ann_MudDischarged_Volume%Array(imud) == ExcessMudVolume_Remained) - call Ann_MudDischarged_Volume%Remove (imud) - call Ann_Mud_Backhead_X%Remove (imud) - call Ann_Mud_Backhead_section%Remove (imud) - call Ann_Mud_Forehead_X%Remove (imud) - call Ann_Mud_Forehead_section%Remove (imud) - call Ann_Density%Remove (imud) - call Ann_RemainedVolume_in_LastSection%Remove (imud) - call Ann_EmptyVolume_inBackheadLocation%Remove (imud) - call Ann_MudOrKick%Remove (imud) + call MudSystemDotAnn_MudDischarged_Volume%Remove (MudSystemDotimud) + call Ann_Mud_Backhead_X%Remove (MudSystemDotimud) + call Ann_Mud_Backhead_section%Remove (MudSystemDotimud) + call Ann_Mud_Forehead_X%Remove (MudSystemDotimud) + call Ann_Mud_Forehead_section%Remove (MudSystemDotimud) + call Ann_Density%Remove (MudSystemDotimud) + call Ann_RemainedVolume_in_LastSection%Remove (MudSystemDotimud) + call Ann_EmptyVolume_inBackheadLocation%Remove (MudSystemDotimud) + call Ann_MudOrKick%Remove (MudSystemDotimud) exit endif @@ -632,8 +632,8 @@ imud=0 ! (AnnulusFlowRate/60.)*DeltaT_Mudline) - DeltaVolumeOp will be added to annulus !if (iLoc == 1) then - MudSection= F_StringIntervalCounts+1 - BackheadX= Xstart_PipeSection(F_StringIntervalCounts+1) + MudSystemDotMudSection= F_StringIntervalCounts+1 + MudSystemDotBackheadX= MudSystemDotXstart_PipeSection(F_StringIntervalCounts+1) !elseif (iLoc == 2) then ! MudSection= Kick_Forehead_section ! BackheadX= Kick_Forehead_X @@ -665,8 +665,8 @@ imud=0 - Ann_Mud_Backhead_section%Array(1)= MudSection !it is needed to be updated for (a condition that one pipe is removed from Annulus due to trip out)- (and add pipe) - Ann_Mud_Backhead_X%Array(1)= BackheadX + Ann_Mud_Backhead_section%Array(1)= MudSystemDotMudSection !it is needed to be updated for (a condition that one pipe is removed from Annulus due to trip out)- (and add pipe) + Ann_Mud_Backhead_X%Array(1)= MudSystemDotBackheadX @@ -678,58 +678,58 @@ imud=0 !write(*,*) 'Op_Kick_Saved_Volume,Op_Saved_MudDischarged_Volume=' , Op_Kick_Saved_Volume,Op_Saved_MudDischarged_Volume - if (Op_Kick_Saved_Volume > 0.0 .and. Ann_MudOrKick%First() == 0) then !1st Mode + if (MudSystemDotOp_Kick_Saved_Volume > 0.0 .and. Ann_MudOrKick%First() == 0) then !1st Mode write(*,*) 'Kick influx enters Annulus' - call Ann_Density%AddToFirst (Op_KickSaved_Density) - call Ann_MudDischarged_Volume%AddToFirst (Op_Kick_Saved_Volume) - call Ann_Mud_Forehead_X%AddToFirst (Xstart_PipeSection(F_StringIntervalCounts+1)) + call Ann_Density%AddToFirst (MudSystemDotOp_KickSaved_Density) + call MudSystemDotAnn_MudDischarged_Volume%AddToFirst (MudSystemDotOp_Kick_Saved_Volume) + call Ann_Mud_Forehead_X%AddToFirst (MudSystemDotXstart_PipeSection(F_StringIntervalCounts+1)) call Ann_Mud_Forehead_section%AddToFirst (F_StringIntervalCounts+1) - call Ann_Mud_Backhead_X%AddToFirst (Xstart_PipeSection(F_StringIntervalCounts+1)) + call Ann_Mud_Backhead_X%AddToFirst (MudSystemDotXstart_PipeSection(F_StringIntervalCounts+1)) call Ann_Mud_Backhead_section%AddToFirst (F_StringIntervalCounts+1) call Ann_RemainedVolume_in_LastSection%AddToFirst (0.0d0) call Ann_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) - call Ann_MudOrKick%AddToFirst (Saved_Op_MudOrKick) !<<<<<<<< + call Ann_MudOrKick%AddToFirst (MudSystemDotSaved_Op_MudOrKick) !<<<<<<<< call Ann_CuttingMud%AddToFirst (0) - elseif (Op_Kick_Saved_Volume > 0.0 .and. Ann_MudOrKick%First() /= 0) then - Ann_MudDischarged_Volume%Array(1)= Ann_MudDischarged_Volume%Array(1) + Op_Kick_Saved_Volume + elseif (MudSystemDotOp_Kick_Saved_Volume > 0.0 .and. Ann_MudOrKick%First() /= 0) then + MudSystemDotAnn_MudDischarged_Volume%Array(1)= MudSystemDotAnn_MudDischarged_Volume%Array(1) + MudSystemDotOp_Kick_Saved_Volume endif - if ( Op_NeededVolume_ToFill > 0.0 .and. (Op_NeededVolume_ToFill < ABS(DeltaVolumeAnnulusCapacity)) .and. Op_MudOrKick%Last() == 0 .and. (iloc==2 .or. iloc_edited==1)) then !3rd Mode + if ( MudSystemDotOp_NeededVolume_ToFill > 0.0 .and. (MudSystemDotOp_NeededVolume_ToFill < ABS(MudSystemDotDeltaVolumeAnnulusCapacity)) .and. Op_MudOrKick%Last() == 0 .and. (MudSystemDotiLoc==2 .or. iloc_edited==1)) then !3rd Mode !write(*,*) 'checkpoint 0' !! for avoid kick separation -Op_MudOrKick%Last() == 0: because of pump - NewVolume= ((AnnulusFlowRate/60.d0)*DeltaT_Mudline) ! =volume that should be added to iloc=2 in Ann - call RemoveOpMudArrays(Op_Density%Length()) ! mud here is removed and then will be added to iloc=2 in Ann in %%1 section - if ( Ann_MudDischarged_Volume%Array(1) > ((AnnulusFlowRate/60.d0)*DeltaT_Mudline) ) then! 1st in Ann = kick ,, we expect: ((AnnulusFlowRate/60.d0)*DeltaT_Mudline)= OpMudVolLast - Ann_MudDischarged_Volume%Array(1)= Ann_MudDischarged_Volume%Array(1) - ((AnnulusFlowRate/60.d0)*DeltaT_Mudline) - Op_MudDischarged_Volume%Array(Op_Density%Length())= Op_MudDischarged_Volume%Array(Op_Density%Length())+ ((AnnulusFlowRate/60.d0)*DeltaT_Mudline) ! kick + MudSystemDotNewVolume= ((MudSystemDotAnnulusFlowRate/60.d0)*DeltaT_Mudline) ! =volume that should be added to iloc=2 in Ann + call RemoveOpMudArrays(MudSystemDotOp_Density%Length()) ! mud here is removed and then will be added to iloc=2 in Ann in %%1 section + if ( MudSystemDotAnn_MudDischarged_Volume%Array(1) > ((MudSystemDotAnnulusFlowRate/60.d0)*DeltaT_Mudline) ) then! 1st in Ann = kick ,, we expect: ((AnnulusFlowRate/60.d0)*DeltaT_Mudline)= OpMudVolLast + MudSystemDotAnn_MudDischarged_Volume%Array(1)= MudSystemDotAnn_MudDischarged_Volume%Array(1) - ((MudSystemDotAnnulusFlowRate/60.d0)*DeltaT_Mudline) + MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_Density%Length())= MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_Density%Length())+ ((MudSystemDotAnnulusFlowRate/60.d0)*DeltaT_Mudline) ! kick else call RemoveAnnulusMudArrays(1) !kick is removed - iloc= 1 - Op_MudDischarged_Volume%Array(Op_Density%Length())= Op_MudDischarged_Volume%Array(Op_Density%Length())+ ((AnnulusFlowRate/60.d0)*DeltaT_Mudline) + MudSystemDotiLoc= 1 + MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_Density%Length())= MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_Density%Length())+ ((MudSystemDotAnnulusFlowRate/60.d0)*DeltaT_Mudline) write(*,*) 'little expand' ! including a little expand endif endif - if (Op_Saved_MudDischarged_Volume> 0.0) then !1st Mode - NewDensity= Op_MudSaved_Density + if (MudSystemDotOp_Saved_MudDischarged_Volume> 0.0) then !1st Mode + NewDensity= MudSystemDotOp_MudSaved_Density !write(*,*) 'iloc,...' , iloc,((AnnulusFlowRate/60.d0)*DeltaT_Mudline),Op_Saved_MudDischarged_Volume - if (iloc==1) then + if (MudSystemDotiLoc==1) then !write(*,*) 'checkpoint 1' - NewVolume= Op_Saved_MudDischarged_Volume - elseif (real(((AnnulusFlowRate/60.d0)*DeltaT_Mudline)) - real(Op_Saved_MudDischarged_Volume) > 0.d0 ) then ! for avoid kick separation + MudSystemDotNewVolume= MudSystemDotOp_Saved_MudDischarged_Volume + elseif (real(((MudSystemDotAnnulusFlowRate/60.d0)*DeltaT_Mudline)) - real(MudSystemDotOp_Saved_MudDischarged_Volume) > 0.d0 ) then ! for avoid kick separation !write(*,*) 'checkpoint 2' - NewVolume= ((AnnulusFlowRate/60.d0)*DeltaT_Mudline) !- Op_Saved_MudDischarged_Volume - call RemoveOpMudArrays(Op_Density%Length()) ! mud here is removed and then will be added to iloc=2 in Ann - if ( Ann_MudDischarged_Volume%Array(1) > (((AnnulusFlowRate/60.d0)*DeltaT_Mudline) - Op_Saved_MudDischarged_Volume) ) then! 1st in Ann = kick - Ann_MudDischarged_Volume%Array(1)= Ann_MudDischarged_Volume%Array(1) - (((AnnulusFlowRate/60.d0)*DeltaT_Mudline) - Op_Saved_MudDischarged_Volume) - Op_MudDischarged_Volume%Array(Op_Density%Length())= Op_MudDischarged_Volume%Array(Op_Density%Length())+ (((AnnulusFlowRate/60.d0)*DeltaT_Mudline) - Op_Saved_MudDischarged_Volume) !kick + MudSystemDotNewVolume= ((MudSystemDotAnnulusFlowRate/60.d0)*DeltaT_Mudline) !- Op_Saved_MudDischarged_Volume + call RemoveOpMudArrays(MudSystemDotOp_Density%Length()) ! mud here is removed and then will be added to iloc=2 in Ann + if ( MudSystemDotAnn_MudDischarged_Volume%Array(1) > (((MudSystemDotAnnulusFlowRate/60.d0)*DeltaT_Mudline) - MudSystemDotOp_Saved_MudDischarged_Volume) ) then! 1st in Ann = kick + MudSystemDotAnn_MudDischarged_Volume%Array(1)= MudSystemDotAnn_MudDischarged_Volume%Array(1) - (((MudSystemDotAnnulusFlowRate/60.d0)*DeltaT_Mudline) - MudSystemDotOp_Saved_MudDischarged_Volume) + MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_Density%Length())= MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_Density%Length())+ (((MudSystemDotAnnulusFlowRate/60.d0)*DeltaT_Mudline) - MudSystemDotOp_Saved_MudDischarged_Volume) !kick else call RemoveAnnulusMudArrays(1) !kick is removed - iloc =1 - Op_MudDischarged_Volume%Array(Op_Density%Length())= Op_MudDischarged_Volume%Array(Op_Density%Length())+ (((AnnulusFlowRate/60.d0)*DeltaT_Mudline) - Op_Saved_MudDischarged_Volume) + MudSystemDotiLoc =1 + MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_Density%Length())= MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotOp_Density%Length())+ (((MudSystemDotAnnulusFlowRate/60.d0)*DeltaT_Mudline) - MudSystemDotOp_Saved_MudDischarged_Volume) write(*,*) 'little expand' ! including a little expand @@ -738,7 +738,7 @@ imud=0 else ! iloc==2 , ((AnnulusFlowRate/60.d0)*DeltaT_Mudline) == Op_Saved_MudDischarged_Volume !write(*,*) 'checkpoint 3' - NewVolume= Op_Saved_MudDischarged_Volume ! it is normal mode + MudSystemDotNewVolume= MudSystemDotOp_Saved_MudDischarged_Volume ! it is normal mode endif @@ -747,23 +747,23 @@ imud=0 !write(*,*) 'NewVolume=' ,NewVolume - if( Ann_Density%Length() == 1 .and. iloc ==2 ) then + if( Ann_Density%Length() == 1 .and. MudSystemDotiLoc ==2 ) then write(*,*) '***errorb****==' write(*,*) 'iloc_edited=' , iloc_edited write(*,*) 'iloc_changedTo2=' , iloc_changedTo2 - write(*,*) 'Op_Capacity===' , sum(OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) + write(*,*) 'Op_Capacity===' , sum(MudSystemDotOpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) - WRITE (*,*) 'Op_Saved_MudDischarged_Volume, Op_Kick_Saved_Volume',Op_Saved_MudDischarged_Volume, Op_Kick_Saved_Volume + WRITE (*,*) 'Op_Saved_MudDischarged_Volume, Op_Kick_Saved_Volume',MudSystemDotOp_Saved_MudDischarged_Volume, MudSystemDotOp_Kick_Saved_Volume - do imud=1, Op_MudDischarged_Volume%Length() - write(*,*) 'Op:', imud, Op_MudDischarged_Volume%Array(imud), Op_Density%Array(imud) ,Op_MudOrKick%Array(imud) + do MudSystemDotimud=1, MudSystemDotOp_MudDischarged_Volume%Length() + write(*,*) 'Op:', MudSystemDotimud, MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud), MudSystemDotOp_Density%Array(MudSystemDotimud) ,Op_MudOrKick%Array(MudSystemDotimud) enddo - do imud=1, Ann_MudDischarged_Volume%Length() - write(*,*) 'Ann:', imud, Ann_MudDischarged_Volume%Array(imud), Ann_Density%Array(imud) ,Ann_MudOrKick%Array(imud) + do MudSystemDotimud=1, MudSystemDotAnn_MudDischarged_Volume%Length() + write(*,*) 'Ann:', MudSystemDotimud, MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud), Ann_Density%Array(MudSystemDotimud) ,Ann_MudOrKick%Array(MudSystemDotimud) enddo @@ -775,31 +775,31 @@ imud=0 - if ((Rate_of_Penetration==0 .and. abs(Ann_Density%Array(iLoc)-NewDensity)< DensityMixTol) & !%%1 section - .or. (Rate_of_Penetration>0. .and. Ann_CuttingMud%Array(iLoc)==1 .and. abs(Ann_Density%Array(iLoc)-NewDensity)< CuttingDensityMixTol) & - .or. (Rate_of_Penetration>0. .and. Ann_CuttingMud%Array(iLoc)==0 .and. Ann_MudDischarged_Volume%Array(iLoc) < 42.) ) then ! 1-Pockets are Merged + if ((Rate_of_Penetration==0 .and. abs(Ann_Density%Array(MudSystemDotiLoc)-NewDensity)< MudSystemDotDensityMixTol) & !%%1 section + .or. (Rate_of_Penetration>0. .and. Ann_CuttingMud%Array(MudSystemDotiLoc)==1 .and. abs(Ann_Density%Array(MudSystemDotiLoc)-NewDensity)< MudSystemDotCuttingDensityMixTol) & + .or. (Rate_of_Penetration>0. .and. Ann_CuttingMud%Array(MudSystemDotiLoc)==0 .and. MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc) < 42.) ) then ! 1-Pockets are Merged !write(*,*) '%%1 section a)' - Ann_Density%Array(iLoc)= (Ann_Density%Array(iLoc)*Ann_MudDischarged_Volume%Array(iLoc)+NewDensity*NewVolume)/(Ann_MudDischarged_Volume%Array(iLoc)+NewVolume) - Ann_MudDischarged_Volume%Array(iLoc)= Ann_MudDischarged_Volume%Array(iLoc)+NewVolume - Ann_Mud_Forehead_X%Array(iLoc)= BackheadX - Ann_Mud_Forehead_section%Array(iLoc)= MudSection - Ann_Mud_Backhead_X%Array(iLoc)= BackheadX - Ann_Mud_Backhead_section%Array(iLoc)= MudSection - Ann_RemainedVolume_in_LastSection%Array(iLoc)= (0.0d0) - Ann_EmptyVolume_inBackheadLocation%Array(iLoc)= (0.0d0) + Ann_Density%Array(MudSystemDotiLoc)= (Ann_Density%Array(MudSystemDotiLoc)*MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)+NewDensity*MudSystemDotNewVolume)/(MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)+MudSystemDotNewVolume) + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)+MudSystemDotNewVolume + Ann_Mud_Forehead_X%Array(MudSystemDotiLoc)= MudSystemDotBackheadX + Ann_Mud_Forehead_section%Array(MudSystemDotiLoc)= MudSystemDotMudSection + Ann_Mud_Backhead_X%Array(MudSystemDotiLoc)= MudSystemDotBackheadX + Ann_Mud_Backhead_section%Array(MudSystemDotiLoc)= MudSystemDotMudSection + Ann_RemainedVolume_in_LastSection%Array(MudSystemDotiLoc)= (0.0d0) + Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotiLoc)= (0.0d0) else ! 2-Merging conditions are not meeted, so new pocket !write(*,*) '%%1 section b)' - call Ann_Density%AddTo (iLoc,NewDensity) - call Ann_MudDischarged_Volume%AddTo (iLoc,NewVolume) - call Ann_Mud_Forehead_X%AddTo (iLoc,BackheadX) - call Ann_Mud_Forehead_section%AddTo (iLoc,MudSection) - call Ann_Mud_Backhead_X%AddTo (iLoc,BackheadX) - call Ann_Mud_Backhead_section%AddTo (iLoc,MudSection) - call Ann_RemainedVolume_in_LastSection%AddTo (iLoc,0.0d0) - call Ann_EmptyVolume_inBackheadLocation%AddTo (iLoc,0.0d0) - call Ann_MudOrKick%AddTo (iLoc,0) - call Ann_CuttingMud%AddTo (iLoc,0) + call Ann_Density%AddTo (MudSystemDotiLoc,NewDensity) + call MudSystemDotAnn_MudDischarged_Volume%AddTo (MudSystemDotiLoc,MudSystemDotNewVolume) + call Ann_Mud_Forehead_X%AddTo (MudSystemDotiLoc,MudSystemDotBackheadX) + call Ann_Mud_Forehead_section%AddTo (MudSystemDotiLoc,MudSystemDotMudSection) + call Ann_Mud_Backhead_X%AddTo (MudSystemDotiLoc,MudSystemDotBackheadX) + call Ann_Mud_Backhead_section%AddTo (MudSystemDotiLoc,MudSystemDotMudSection) + call Ann_RemainedVolume_in_LastSection%AddTo (MudSystemDotiLoc,0.0d0) + call Ann_EmptyVolume_inBackheadLocation%AddTo (MudSystemDotiLoc,0.0d0) + call Ann_MudOrKick%AddTo (MudSystemDotiLoc,0) + call Ann_CuttingMud%AddTo (MudSystemDotiLoc,0) !write(*,*) 'd) annLength=' , Ann_Density%Length() endif @@ -829,41 +829,41 @@ imud=0 !write(*,*) '2======no' !=============== save Ann Mud data to transfer to the ChokeLine enterance - AnnMudVolumeSum= 0.d0 + MudSystemDotAnnMudVolumeSum= 0.d0 !Ann_MudSaved_Density= 0.d0 !Ann_KickSaved_Density= 0.d0 - Ann_Saved_MudDischarged_Volume= 0.d0 - Ann_Kick_Saved_Volume= 0.d0 - Saved_Ann_MudOrKick= 0 - Ann_to_Choke_2mud= .false. + MudSystemDotAnn_Saved_MudDischarged_Volume= 0.d0 + MudSystemDotAnn_Kick_Saved_Volume= 0.d0 + MudSystemDotSaved_Ann_MudOrKick= 0 + MudSystemDotAnn_to_Choke_2mud= .false. - do imud=1, Ann_MudDischarged_Volume%Length() + do MudSystemDotimud=1, MudSystemDotAnn_MudDischarged_Volume%Length() - AnnMudVolumeSum= AnnMudVolumeSum + Ann_MudDischarged_Volume%Array(imud) + MudSystemDotAnnMudVolumeSum= MudSystemDotAnnMudVolumeSum + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud) - if ( AnnMudVolumeSum > sum(PipeSection_VolumeCapacity(F_StringIntervalCounts+1:NoPipeSections)) ) then + if ( MudSystemDotAnnMudVolumeSum > sum(MudSystemDotPipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystemDotNoPipeSections)) ) then - IF (Ann_MudOrKick%Array(imud) == 0) THEN - Ann_MudSaved_Density = Ann_Density%Array(imud) - Ann_Saved_MudDischarged_Volume = AnnMudVolumeSum - sum(PipeSection_VolumeCapacity(F_StringIntervalCounts+1:NoPipeSections)) - ELSEIF (Ann_MudOrKick%Array(imud) > 0 .AND. Ann_MudOrKick%Array(imud) <100) THEN ! 104= AIR - Ann_Kick_Saved_Volume = AnnMudVolumeSum - sum(PipeSection_VolumeCapacity(F_StringIntervalCounts+1:NoPipeSections)) - Saved_Ann_MudOrKick= Ann_MudOrKick%Array (imud) - Ann_KickSaved_Density= Ann_Density%Array(imud) + IF (Ann_MudOrKick%Array(MudSystemDotimud) == 0) THEN + MudSystemDotAnn_MudSaved_Density = Ann_Density%Array(MudSystemDotimud) + MudSystemDotAnn_Saved_MudDischarged_Volume = MudSystemDotAnnMudVolumeSum - sum(MudSystemDotPipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystemDotNoPipeSections)) + ELSEIF (Ann_MudOrKick%Array(MudSystemDotimud) > 0 .AND. Ann_MudOrKick%Array(MudSystemDotimud) <100) THEN ! 104= AIR + MudSystemDotAnn_Kick_Saved_Volume = MudSystemDotAnnMudVolumeSum - sum(MudSystemDotPipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystemDotNoPipeSections)) + MudSystemDotSaved_Ann_MudOrKick= Ann_MudOrKick%Array (MudSystemDotimud) + MudSystemDotAnn_KickSaved_Density= Ann_Density%Array(MudSystemDotimud) END IF - do ii= imud + 1, Ann_MudDischarged_Volume%Length() + do ii= MudSystemDotimud + 1, MudSystemDotAnn_MudDischarged_Volume%Length() IF (Ann_MudOrKick%Array(ii) == 0) THEN - Ann_MudSaved_Density = ((Ann_MudSaved_Density * Ann_Saved_MudDischarged_Volume) + (Ann_Density%Array(ii) * Ann_MudDischarged_Volume%Array(ii))) / (Ann_Saved_MudDischarged_Volume + Ann_MudDischarged_Volume%Array(ii)) - Ann_Saved_MudDischarged_Volume = Ann_Saved_MudDischarged_Volume + Ann_MudDischarged_Volume%Array(ii) - Ann_to_Choke_2mud= .true. + MudSystemDotAnn_MudSaved_Density = ((MudSystemDotAnn_MudSaved_Density * MudSystemDotAnn_Saved_MudDischarged_Volume) + (Ann_Density%Array(ii) * MudSystemDotAnn_MudDischarged_Volume%Array(ii))) / (MudSystemDotAnn_Saved_MudDischarged_Volume + MudSystemDotAnn_MudDischarged_Volume%Array(ii)) + MudSystemDotAnn_Saved_MudDischarged_Volume = MudSystemDotAnn_Saved_MudDischarged_Volume + MudSystemDotAnn_MudDischarged_Volume%Array(ii) + MudSystemDotAnn_to_Choke_2mud= .true. ELSEIF (Ann_MudOrKick%Array(ii) > 0 .AND. Ann_MudOrKick%Array(ii) <100) THEN ! 104= AIR - Ann_Kick_Saved_Volume = Ann_Kick_Saved_Volume + Ann_MudDischarged_Volume%Array(ii) - Saved_Ann_MudOrKick= Ann_MudOrKick%Array (ii) - Ann_KickSaved_Density= Ann_Density%Array(ii) + MudSystemDotAnn_Kick_Saved_Volume = MudSystemDotAnn_Kick_Saved_Volume + MudSystemDotAnn_MudDischarged_Volume%Array(ii) + MudSystemDotSaved_Ann_MudOrKick= Ann_MudOrKick%Array (ii) + MudSystemDotAnn_KickSaved_Density= Ann_Density%Array(ii) END IF enddo @@ -873,12 +873,12 @@ imud=0 enddo -Ann_Saved_MudDischarged_Volume_Final= Ann_Saved_MudDischarged_Volume -Ann_Kick_Saved_Volume_Final= Ann_Kick_Saved_Volume +MudSystemDotAnn_Saved_MudDischarged_Volume_Final= MudSystemDotAnn_Saved_MudDischarged_Volume +MudSystemDotAnn_Kick_Saved_Volume_Final= MudSystemDotAnn_Kick_Saved_Volume !write(*,*) 'Ann cap=' , sum(PipeSection_VolumeCapacity(F_StringIntervalCounts+1:NoPipeSections)) !write(*,*) 'Ann mud sum vol=' , sum(Ann_MudDischarged_Volume%Array(:)) -IF (WellHeadIsOpen) MudVolume_InjectedFromAnn = Ann_Saved_MudDischarged_Volume_Final-((Qlost/60.0d0)*DeltaT_Mudline) +IF (WellHeadIsOpen) MudVolume_InjectedFromAnn = MudSystemDotAnn_Saved_MudDischarged_Volume_Final-((MudSystemDotQlost/60.0d0)*DeltaT_Mudline) !NoGasPocket !write(*,*) 'Ann_Saved_Mud_Vol,Ann_Kick_Saved_Vol=' , Ann_Saved_MudDischarged_Volume,Ann_Kick_Saved_Volume @@ -890,62 +890,62 @@ IF (WellHeadIsOpen) MudVolume_InjectedFromAnn = Ann_Saved_MudDischarged_Vo !MudIsChanged= .false. -imud= 0 +MudSystemDotimud= 0 - do while (imud < Ann_Mud_Forehead_X%Length()) - imud = imud + 1 + do while (MudSystemDotimud < Ann_Mud_Forehead_X%Length()) + MudSystemDotimud = MudSystemDotimud + 1 - if (imud> 1) then - Ann_Mud_Backhead_X%Array(imud)= Ann_Mud_Forehead_X%Array(imud-1) - Ann_Mud_Backhead_section%Array(imud)= Ann_Mud_Forehead_section%Array(imud-1) + if (MudSystemDotimud> 1) then + Ann_Mud_Backhead_X%Array(MudSystemDotimud)= Ann_Mud_Forehead_X%Array(MudSystemDotimud-1) + Ann_Mud_Backhead_section%Array(MudSystemDotimud)= Ann_Mud_Forehead_section%Array(MudSystemDotimud-1) endif ! write(*,*) 'imud==' , imud !write(*,*) '***)Ann_Mud_Backhead_section(imud)= ' , Ann_Mud_Backhead_section%Array(imud), Ann_density%Array(imud) - DirectionCoef= (Xend_PipeSection(Ann_Mud_Backhead_section%Array(imud))-Xstart_PipeSection(Ann_Mud_Backhead_section%Array(imud))) & - / ABS(Xend_PipeSection(Ann_Mud_Backhead_section%Array(imud))-Xstart_PipeSection(Ann_Mud_Backhead_section%Array(imud))) + MudSystemDotDirectionCoef= (MudSystemDotXend_PipeSection(Ann_Mud_Backhead_section%Array(MudSystemDotimud))-MudSystemDotXstart_PipeSection(Ann_Mud_Backhead_section%Array(MudSystemDotimud))) & + / ABS(MudSystemDotXend_PipeSection(Ann_Mud_Backhead_section%Array(MudSystemDotimud))-MudSystemDotXstart_PipeSection(Ann_Mud_Backhead_section%Array(MudSystemDotimud))) ! +1 for string , -1 for annulus - Ann_EmptyVolume_inBackheadLocation%Array(imud)= DirectionCoef* (Xend_PipeSection(Ann_Mud_Backhead_section%Array(imud))- Ann_Mud_Backhead_X%Array(imud))* & - Area_PipeSectionFt(Ann_Mud_Backhead_section%Array(imud)) !(ft^3) - Ann_EmptyVolume_inBackheadLocation%Array(imud)= Ann_EmptyVolume_inBackheadLocation%Array(imud)* 7.48051948d0 ! ft^3 to gal + Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotDirectionCoef* (MudSystemDotXend_PipeSection(Ann_Mud_Backhead_section%Array(MudSystemDotimud))- Ann_Mud_Backhead_X%Array(MudSystemDotimud))* & + MudSystemDotArea_PipeSectionFt(Ann_Mud_Backhead_section%Array(MudSystemDotimud)) !(ft^3) + Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)* 7.48051948d0 ! ft^3 to gal - if ( Ann_MudDischarged_Volume%Array(imud) <= Ann_EmptyVolume_inBackheadLocation%Array(imud)) then - Ann_Mud_Forehead_section%Array(imud)= Ann_Mud_Backhead_section%Array(imud) - Ann_Mud_Forehead_X%Array(imud)= Ann_Mud_Backhead_X%Array(imud)+ DirectionCoef*(Ann_MudDischarged_Volume%Array(imud)/7.48051948d0)/Area_PipeSectionFt(Ann_Mud_Backhead_section%Array(imud)) + if ( MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud) <= Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)) then + Ann_Mud_Forehead_section%Array(MudSystemDotimud)= Ann_Mud_Backhead_section%Array(MudSystemDotimud) + Ann_Mud_Forehead_X%Array(MudSystemDotimud)= Ann_Mud_Backhead_X%Array(MudSystemDotimud)+ MudSystemDotDirectionCoef*(MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)/7.48051948d0)/MudSystemDotArea_PipeSectionFt(Ann_Mud_Backhead_section%Array(MudSystemDotimud)) ! 7.48 is for gal to ft^3 else - isection= Ann_Mud_Backhead_section%Array(imud)+1 - Ann_RemainedVolume_in_LastSection%Array(imud)= Ann_MudDischarged_Volume%Array(imud)- Ann_EmptyVolume_inBackheadLocation%Array(imud) + MudSystemDotisection= Ann_Mud_Backhead_section%Array(MudSystemDotimud)+1 + Ann_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)- Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud) do - if (isection > NoPipeSections) then ! last pipe section(well exit) - Ann_MudDischarged_Volume%Array(imud)= Ann_MudDischarged_Volume%Array(imud)- Ann_RemainedVolume_in_LastSection%Array(imud) - Ann_Mud_Forehead_X%Array(imud)= Xend_PipeSection(NoPipeSections) - Ann_Mud_Forehead_section%Array(imud)= NoPipeSections + if (MudSystemDotisection > MudSystemDotNoPipeSections) then ! last pipe section(well exit) + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)- Ann_RemainedVolume_in_LastSection%Array(MudSystemDotimud) + Ann_Mud_Forehead_X%Array(MudSystemDotimud)= MudSystemDotXend_PipeSection(MudSystemDotNoPipeSections) + Ann_Mud_Forehead_section%Array(MudSystemDotimud)= MudSystemDotNoPipeSections - if (Ann_MudDischarged_Volume%Array(imud)<= 0.0d0) then ! imud is completely exited form the well - call RemoveAnnulusMudArrays(imud) + if (MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)<= 0.0d0) then ! imud is completely exited form the well + call RemoveAnnulusMudArrays(MudSystemDotimud) endif exit endif - xx= Ann_RemainedVolume_in_LastSection%Array(imud)/ PipeSection_VolumeCapacity(isection) !(gal) + MudSystemDotxx= Ann_RemainedVolume_in_LastSection%Array(MudSystemDotimud)/ MudSystemDotPipeSection_VolumeCapacity(MudSystemDotisection) !(gal) - if (xx<= 1.0) then - Ann_Mud_Forehead_section%Array(imud)= isection - Ann_Mud_Forehead_X%Array(imud)= (xx * (Xend_PipeSection(isection)- Xstart_PipeSection(isection)))+ Xstart_PipeSection(isection) + if (MudSystemDotxx<= 1.0) then + Ann_Mud_Forehead_section%Array(MudSystemDotimud)= MudSystemDotisection + Ann_Mud_Forehead_X%Array(MudSystemDotimud)= (MudSystemDotxx * (MudSystemDotXend_PipeSection(MudSystemDotisection)- MudSystemDotXstart_PipeSection(MudSystemDotisection)))+ MudSystemDotXstart_PipeSection(MudSystemDotisection) exit else - Ann_RemainedVolume_in_LastSection%Array(imud)= Ann_RemainedVolume_in_LastSection%Array(imud)- PipeSection_VolumeCapacity(isection) - isection= isection+ 1 + Ann_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= Ann_RemainedVolume_in_LastSection%Array(MudSystemDotimud)- MudSystemDotPipeSection_VolumeCapacity(MudSystemDotisection) + MudSystemDotisection= MudSystemDotisection+ 1 endif @@ -955,8 +955,8 @@ imud= 0 enddo - if (Ann_Mud_Forehead_X%Last() < Xend_PipeSection(NoPipeSections)) then - Ann_Mud_Forehead_X%Array(Ann_Mud_Forehead_X%Length()) = Xend_PipeSection(NoPipeSections) ! for error preventing + if (Ann_Mud_Forehead_X%Last() < MudSystemDotXend_PipeSection(MudSystemDotNoPipeSections)) then + Ann_Mud_Forehead_X%Array(Ann_Mud_Forehead_X%Length()) = MudSystemDotXend_PipeSection(MudSystemDotNoPipeSections) ! for error preventing endif !========================ANNULUS END================= @@ -968,7 +968,7 @@ imud= 0 !========================Tripping Out- 2nd Mode==================== - elseif ( Op_NeededVolume_ToFill > ABS(DeltaVolumeAnnulusCapacity) ) then !pump is off or Pump flow is less than trip out so fluid Level in Annulus decreases + elseif ( MudSystemDotOp_NeededVolume_ToFill > ABS(MudSystemDotDeltaVolumeAnnulusCapacity) ) then !pump is off or Pump flow is less than trip out so fluid Level in Annulus decreases !write(*,*) 'trip out 2nd mode' @@ -978,11 +978,11 @@ imud= 0 ! <<< SIMILAR TO UTUBE 2 >>> if ( Ann_Density%Last() /= 0.0 ) then ! new mud is pumped call Ann_Density%Add (0.0d0) - call Ann_MudDischarged_Volume%Add (0.0d0) - call Ann_Mud_Forehead_X%Add (Xend_PipeSection(NoPipeSections)) - call Ann_Mud_Forehead_section%Add (NoPipeSections) - call Ann_Mud_Backhead_X%Add (Xstart_PipeSection(NoPipeSections)) - call Ann_Mud_Backhead_section%Add (NoPipeSections) + call MudSystemDotAnn_MudDischarged_Volume%Add (0.0d0) + call Ann_Mud_Forehead_X%Add (MudSystemDotXend_PipeSection(MudSystemDotNoPipeSections)) + call Ann_Mud_Forehead_section%Add (MudSystemDotNoPipeSections) + call Ann_Mud_Backhead_X%Add (MudSystemDotXstart_PipeSection(MudSystemDotNoPipeSections)) + call Ann_Mud_Backhead_section%Add (MudSystemDotNoPipeSections) call Ann_RemainedVolume_in_LastSection%Add (0.0d0) call Ann_EmptyVolume_inBackheadLocation%Add (0.0d0) call Ann_MudOrKick%Add (104) @@ -991,45 +991,45 @@ imud= 0 !AnnulusSuctionDensity_Old= Hz_Density%Last() endif - Ann_Mud_Forehead_section%Array(Ann_Mud_Forehead_section%Length())= NoPipeSections !it is needed to be updated for (a condition that one pipe is removed from Annulus due to trip out)- (and add pipe) - Ann_Mud_Forehead_X%Array(Ann_Mud_Forehead_X%Length())= Xend_PipeSection(NoPipeSections) + Ann_Mud_Forehead_section%Array(Ann_Mud_Forehead_section%Length())= MudSystemDotNoPipeSections !it is needed to be updated for (a condition that one pipe is removed from Annulus due to trip out)- (and add pipe) + Ann_Mud_Forehead_X%Array(Ann_Mud_Forehead_X%Length())= MudSystemDotXend_PipeSection(MudSystemDotNoPipeSections) - Ann_MudDischarged_Volume%Array(Ann_MudDischarged_Volume%Length())= Ann_MudDischarged_Volume%Last()+ (Op_NeededVolume_ToFill - ABS(DeltaVolumeAnnulusCapacity)) ! Op_NeededVolume_ToFill !ABS(DeltaVolumePipe) - ((AnnulusFlowRate/60.)*DeltaT_Mudline) !(gal) + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotAnn_MudDischarged_Volume%Length())= MudSystemDotAnn_MudDischarged_Volume%Last()+ (MudSystemDotOp_NeededVolume_ToFill - ABS(MudSystemDotDeltaVolumeAnnulusCapacity)) ! Op_NeededVolume_ToFill !ABS(DeltaVolumePipe) - ((AnnulusFlowRate/60.)*DeltaT_Mudline) !(gal) !=================================================================== - if ( (iloc==2 .or. iloc_edited==1) .and. Op_MudOrKick%Last()==0 ) then ! for avoid kick separation + if ( (MudSystemDotiLoc==2 .or. iloc_edited==1) .and. Op_MudOrKick%Last()==0 ) then ! for avoid kick separation !write(*,*) 'here mud should be removed from Op last' - if (abs(Ann_Density%Array(iloc)-Op_Density%Last())< DensityMixTol) then + if (abs(Ann_Density%Array(MudSystemDotiLoc)-MudSystemDotOp_Density%Last())< MudSystemDotDensityMixTol) then - Ann_Density%Array(iLoc)= (Ann_Density%Array(iLoc)*Ann_MudDischarged_Volume%Array(iLoc)+Op_Density%Last()*Op_MudDischarged_Volume%Last())/(Ann_MudDischarged_Volume%Array(iLoc)+Op_MudDischarged_Volume%Last()) - Ann_MudDischarged_Volume%Array(iLoc)= Ann_MudDischarged_Volume%Array(iLoc)+Op_MudDischarged_Volume%Last() ! OP_Last is mud(effect of pump added mud) - Ann_Mud_Forehead_X%Array(iLoc)= BackheadX - Ann_Mud_Forehead_section%Array(iLoc)= MudSection - Ann_Mud_Backhead_X%Array(iLoc)= BackheadX - Ann_Mud_Backhead_section%Array(iLoc)= MudSection - Ann_RemainedVolume_in_LastSection%Array(iLoc)= (0.0d0) - Ann_EmptyVolume_inBackheadLocation%Array(iLoc)= (0.0d0) + Ann_Density%Array(MudSystemDotiLoc)= (Ann_Density%Array(MudSystemDotiLoc)*MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)+MudSystemDotOp_Density%Last()*MudSystemDotOp_MudDischarged_Volume%Last())/(MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)+MudSystemDotOp_MudDischarged_Volume%Last()) + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)+MudSystemDotOp_MudDischarged_Volume%Last() ! OP_Last is mud(effect of pump added mud) + Ann_Mud_Forehead_X%Array(MudSystemDotiLoc)= MudSystemDotBackheadX + Ann_Mud_Forehead_section%Array(MudSystemDotiLoc)= MudSystemDotMudSection + Ann_Mud_Backhead_X%Array(MudSystemDotiLoc)= MudSystemDotBackheadX + Ann_Mud_Backhead_section%Array(MudSystemDotiLoc)= MudSystemDotMudSection + Ann_RemainedVolume_in_LastSection%Array(MudSystemDotiLoc)= (0.0d0) + Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotiLoc)= (0.0d0) !write(*,*) 'merge' ,'Ann_Volume%Array(1)=' , Ann_MudDischarged_Volume%Array(1) else ! 2-Merging conditions are not meeted, so new pocket - call Ann_Density%AddTo (iLoc,Op_Density%Last()) - call Ann_MudDischarged_Volume%AddTo (iLoc,Op_MudDischarged_Volume%Last()) - call Ann_Mud_Forehead_X%AddTo (iLoc,BackheadX) - call Ann_Mud_Forehead_section%AddTo (iLoc,MudSection) - call Ann_Mud_Backhead_X%AddTo (iLoc,BackheadX) - call Ann_Mud_Backhead_section%AddTo (iLoc,MudSection) - call Ann_RemainedVolume_in_LastSection%AddTo (iLoc,0.0d0) - call Ann_EmptyVolume_inBackheadLocation%AddTo (iLoc,0.0d0) - call Ann_MudOrKick%AddTo (iLoc,0) - call Ann_CuttingMud%AddTo (iLoc,0) + call Ann_Density%AddTo (MudSystemDotiLoc,MudSystemDotOp_Density%Last()) + call MudSystemDotAnn_MudDischarged_Volume%AddTo (MudSystemDotiLoc,MudSystemDotOp_MudDischarged_Volume%Last()) + call Ann_Mud_Forehead_X%AddTo (MudSystemDotiLoc,MudSystemDotBackheadX) + call Ann_Mud_Forehead_section%AddTo (MudSystemDotiLoc,MudSystemDotMudSection) + call Ann_Mud_Backhead_X%AddTo (MudSystemDotiLoc,MudSystemDotBackheadX) + call Ann_Mud_Backhead_section%AddTo (MudSystemDotiLoc,MudSystemDotMudSection) + call Ann_RemainedVolume_in_LastSection%AddTo (MudSystemDotiLoc,0.0d0) + call Ann_EmptyVolume_inBackheadLocation%AddTo (MudSystemDotiLoc,0.0d0) + call Ann_MudOrKick%AddTo (MudSystemDotiLoc,0) + call Ann_CuttingMud%AddTo (MudSystemDotiLoc,0) endif - Op_NeededVolume_ToFill= Op_NeededVolume_ToFill + Op_MudDischarged_Volume%Last() ! OP_Last is mud(effect of pump added mud) + MudSystemDotOp_NeededVolume_ToFill= MudSystemDotOp_NeededVolume_ToFill + MudSystemDotOp_MudDischarged_Volume%Last() ! OP_Last is mud(effect of pump added mud) call RemoveOpMudArrays(Op_MudOrKick%Length()) @@ -1042,8 +1042,8 @@ imud= 0 !AnnMudVolumeSum= 0.d0 !!Ann_MudSaved_Density= 0.d0 !!Ann_KickSaved_Density= 0.d0 - Ann_Saved_MudDischarged_Volume= 0.d0 - Ann_Kick_Saved_Volume= 0.d0 + MudSystemDotAnn_Saved_MudDischarged_Volume= 0.d0 + MudSystemDotAnn_Kick_Saved_Volume= 0.d0 !Saved_Ann_MudOrKick= 0 !Ann_to_Choke_2mud= .false. @@ -1102,8 +1102,8 @@ imud= 0 -Ann_Saved_MudDischarged_Volume_Final= Ann_Saved_MudDischarged_Volume -Ann_Kick_Saved_Volume_Final= Ann_Kick_Saved_Volume +MudSystemDotAnn_Saved_MudDischarged_Volume_Final= MudSystemDotAnn_Saved_MudDischarged_Volume +MudSystemDotAnn_Kick_Saved_Volume_Final= MudSystemDotAnn_Kick_Saved_Volume !write(*,*) 'Ann cap=' , sum(PipeSection_VolumeCapacity(F_StringIntervalCounts+1:NoPipeSections)) !write(*,*) 'Ann mud sum vol=' , sum(Ann_MudDischarged_Volume%Array(:)) @@ -1111,7 +1111,7 @@ Ann_Kick_Saved_Volume_Final= Ann_Kick_Saved_Volume -IF (WellHeadIsOpen) MudVolume_InjectedFromAnn = Ann_Saved_MudDischarged_Volume_Final-((Qlost/60.0d0)*DeltaT_Mudline) +IF (WellHeadIsOpen) MudVolume_InjectedFromAnn = MudSystemDotAnn_Saved_MudDischarged_Volume_Final-((MudSystemDotQlost/60.0d0)*DeltaT_Mudline) !! NoGasPocket > 0 .AND. !write(*,*) 'Ann_Saved_Mud_Vol,Ann_Kick_Saved_Vol=' , Ann_Saved_MudDischarged_Volume,Ann_Kick_Saved_Volume @@ -1123,28 +1123,28 @@ IF (WellHeadIsOpen) MudVolume_InjectedFromAnn = Ann_Saved_MudDischarged_Vo ! <<< SIMILAR TO UTUBE 2 >>> !write(*,*) Ann_MudOrKick%Last(), 'DeltaVolumePipe , after volume=' ,ABS(DeltaVolumePipe), Ann_MudDischarged_Volume%Last() -imud= Ann_Mud_Forehead_X%Length() + 1 +MudSystemDotimud= Ann_Mud_Forehead_X%Length() + 1 - do while (imud > 1) - imud = imud - 1 + do while (MudSystemDotimud > 1) + MudSystemDotimud = MudSystemDotimud - 1 - if (imud< Ann_Mud_Forehead_X%Length()) then - Ann_Mud_Forehead_X%Array(imud)= Ann_Mud_Backhead_X%Array(imud+1) - Ann_Mud_Forehead_section%Array(imud)= Ann_Mud_Backhead_section%Array(imud+1) + if (MudSystemDotimud< Ann_Mud_Forehead_X%Length()) then + Ann_Mud_Forehead_X%Array(MudSystemDotimud)= Ann_Mud_Backhead_X%Array(MudSystemDotimud+1) + Ann_Mud_Forehead_section%Array(MudSystemDotimud)= Ann_Mud_Backhead_section%Array(MudSystemDotimud+1) endif ! <<< Fracture Shoe Lost - IF ( ShoeLost .and. Shoe%ShoeDepth < Ann_Mud_Backhead_X%Array(imud) .and. Shoe%ShoeDepth >= Ann_Mud_Forehead_X%Array(imud) ) then + IF ( MudSystemDotShoeLost .and. Shoe%ShoeDepth < Ann_Mud_Backhead_X%Array(MudSystemDotimud) .and. Shoe%ShoeDepth >= Ann_Mud_Forehead_X%Array(MudSystemDotimud) ) then !write(*,*) 'ShoeLost imud,AnnVolume(imud), VolumeLost:' , imud,Ann_MudDischarged_Volume%Array(imud), (( Qlost/60.0d0)*DeltaT_Mudline) - Ann_MudDischarged_Volume%Array(imud)= Ann_MudDischarged_Volume%Array(imud)-((Qlost/60.0d0)*DeltaT_Mudline) !(gal) - if (Ann_MudDischarged_Volume%Array(imud) < 0.0) then + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)-((MudSystemDotQlost/60.0d0)*DeltaT_Mudline) !(gal) + if (MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud) < 0.0) then !write(*,*) 'mud is removed by shoe lost, imud=' , imud - call RemoveAnnulusMudArrays(imud) - imud= imud-1 + call RemoveAnnulusMudArrays(MudSystemDotimud) + MudSystemDotimud= MudSystemDotimud-1 cycle endif - LostInTripOutIsDone= .true. + MudSystemDotLostInTripOutIsDone= .true. ENDIF ! Fracture Shoe Lost >>> @@ -1157,46 +1157,46 @@ imud= Ann_Mud_Forehead_X%Length() + 1 !write(*,*) 'a)imud,Ann_Mud_Forehead_section=',imud,Ann_Mud_Forehead_section%Array(imud) - DirectionCoef= (Xend_PipeSection(Ann_Mud_Forehead_section%Array(imud))-Xstart_PipeSection(Ann_Mud_Forehead_section%Array(imud))) & - / ABS(Xend_PipeSection(Ann_Mud_Forehead_section%Array(imud))-Xstart_PipeSection(Ann_Mud_Forehead_section%Array(imud))) + MudSystemDotDirectionCoef= (MudSystemDotXend_PipeSection(Ann_Mud_Forehead_section%Array(MudSystemDotimud))-MudSystemDotXstart_PipeSection(Ann_Mud_Forehead_section%Array(MudSystemDotimud))) & + / ABS(MudSystemDotXend_PipeSection(Ann_Mud_Forehead_section%Array(MudSystemDotimud))-MudSystemDotXstart_PipeSection(Ann_Mud_Forehead_section%Array(MudSystemDotimud))) ! +1 for string , -1 for annulus !write(*,*) 'b)imud,Forehead_X,Xstart_PipeSection=',imud,Ann_Mud_Forehead_X%Array(imud),Xstart_PipeSection(Ann_Mud_Forehead_section%Array(imud)) - Ann_EmptyVolume_inBackheadLocation%Array(imud)= DirectionCoef* (Ann_Mud_Forehead_X%Array(imud)- Xstart_PipeSection(Ann_Mud_Forehead_section%Array(imud)))* & - Area_PipeSectionFt(Ann_Mud_Forehead_section%Array(imud)) !(ft^3) - Ann_EmptyVolume_inBackheadLocation%Array(imud)= Ann_EmptyVolume_inBackheadLocation%Array(imud)* 7.48051948d0 ! ft^3 to gal + Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotDirectionCoef* (Ann_Mud_Forehead_X%Array(MudSystemDotimud)- MudSystemDotXstart_PipeSection(Ann_Mud_Forehead_section%Array(MudSystemDotimud)))* & + MudSystemDotArea_PipeSectionFt(Ann_Mud_Forehead_section%Array(MudSystemDotimud)) !(ft^3) + Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)* 7.48051948d0 ! ft^3 to gal - if ( Ann_MudDischarged_Volume%Array(imud) <= Ann_EmptyVolume_inBackheadLocation%Array(imud)) then - Ann_Mud_Backhead_section%Array(imud)= Ann_Mud_Forehead_section%Array(imud) - Ann_Mud_Backhead_X%Array(imud)= Ann_Mud_Forehead_X%Array(imud)- DirectionCoef*(Ann_MudDischarged_Volume%Array(imud)/7.48051948d0)/Area_PipeSectionFt(Ann_Mud_Forehead_section%Array(imud)) + if ( MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud) <= Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)) then + Ann_Mud_Backhead_section%Array(MudSystemDotimud)= Ann_Mud_Forehead_section%Array(MudSystemDotimud) + Ann_Mud_Backhead_X%Array(MudSystemDotimud)= Ann_Mud_Forehead_X%Array(MudSystemDotimud)- MudSystemDotDirectionCoef*(MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)/7.48051948d0)/MudSystemDotArea_PipeSectionFt(Ann_Mud_Forehead_section%Array(MudSystemDotimud)) ! 7.48051948 is for gal to ft^3 else - isection= Ann_Mud_Forehead_section%Array(imud)-1 - Ann_RemainedVolume_in_LastSection%Array(imud)= Ann_MudDischarged_Volume%Array(imud)- Ann_EmptyVolume_inBackheadLocation%Array(imud) + MudSystemDotisection= Ann_Mud_Forehead_section%Array(MudSystemDotimud)-1 + Ann_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)- Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud) do - if (isection < F_StringIntervalCounts+1) then ! last pipe section(well exit) F_StringIntervalCounts+1 is the first section in Annulus - Ann_MudDischarged_Volume%Array(imud)= Ann_MudDischarged_Volume%Array(imud)- Ann_RemainedVolume_in_LastSection%Array(imud) - Ann_Mud_Backhead_X%Array(imud)= Xstart_PipeSection(F_StringIntervalCounts+1) - Ann_Mud_Backhead_section%Array(imud)= F_StringIntervalCounts+1 + if (MudSystemDotisection < F_StringIntervalCounts+1) then ! last pipe section(well exit) F_StringIntervalCounts+1 is the first section in Annulus + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)- Ann_RemainedVolume_in_LastSection%Array(MudSystemDotimud) + Ann_Mud_Backhead_X%Array(MudSystemDotimud)= MudSystemDotXstart_PipeSection(F_StringIntervalCounts+1) + Ann_Mud_Backhead_section%Array(MudSystemDotimud)= F_StringIntervalCounts+1 - if (Ann_MudDischarged_Volume%Array(imud)<= 0.0d0) then ! imud is completely exited form the well - call RemoveAnnulusMudArrays(imud) + if (MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)<= 0.0d0) then ! imud is completely exited form the well + call RemoveAnnulusMudArrays(MudSystemDotimud) endif exit endif - xx= Ann_RemainedVolume_in_LastSection%Array(imud)/ PipeSection_VolumeCapacity(isection) !(gal) + MudSystemDotxx= Ann_RemainedVolume_in_LastSection%Array(MudSystemDotimud)/ MudSystemDotPipeSection_VolumeCapacity(MudSystemDotisection) !(gal) - if (xx<= 1.0) then - Ann_Mud_Backhead_section%Array(imud)= isection - Ann_Mud_Backhead_X%Array(imud)= (xx * (Xstart_PipeSection(isection)- Xend_PipeSection(isection)))+ Xend_PipeSection(isection) + if (MudSystemDotxx<= 1.0) then + Ann_Mud_Backhead_section%Array(MudSystemDotimud)= MudSystemDotisection + Ann_Mud_Backhead_X%Array(MudSystemDotimud)= (MudSystemDotxx * (MudSystemDotXstart_PipeSection(MudSystemDotisection)- MudSystemDotXend_PipeSection(MudSystemDotisection)))+ MudSystemDotXend_PipeSection(MudSystemDotisection) exit else - Ann_RemainedVolume_in_LastSection%Array(imud)= Ann_RemainedVolume_in_LastSection%Array(imud)- PipeSection_VolumeCapacity(isection) - isection= isection- 1 + Ann_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= Ann_RemainedVolume_in_LastSection%Array(MudSystemDotimud)- MudSystemDotPipeSection_VolumeCapacity(MudSystemDotisection) + MudSystemDotisection= MudSystemDotisection- 1 endif @@ -1220,28 +1220,28 @@ imud= Ann_Mud_Forehead_X%Length() + 1 !======================== Bottom Hole Entrance ========================== !if (iloc == 1) then - if ( Op_NeededVolume_ToFill > 0.0 ) then ! it is needed for 2nd & 3rd mode + if ( MudSystemDotOp_NeededVolume_ToFill > 0.0 ) then ! it is needed for 2nd & 3rd mode !write(*,*) 'op add for 2nd & 3rd mode done' - if ( ABS(Op_Density%Last() - SavedDensityForOp ) >= DensityMixTol) then ! .OR. (Op_MudDischarged_Volume%Last()>42.) ) then ! 1-Merging conditions are not meeted, so new pocket + if ( ABS(MudSystemDotOp_Density%Last() - SavedDensityForOp ) >= MudSystemDotDensityMixTol) then ! .OR. (Op_MudDischarged_Volume%Last()>42.) ) then ! 1-Merging conditions are not meeted, so new pocket - call Op_Density%Add (SavedDensityForOp) - call Op_MudDischarged_Volume%Add (Op_NeededVolume_ToFill) - call Op_Mud_Forehead_X%Add (0.0d0) + call MudSystemDotOp_Density%Add (SavedDensityForOp) + call MudSystemDotOp_MudDischarged_Volume%Add (MudSystemDotOp_NeededVolume_ToFill) + call MudSystemDotOp_Mud_Forehead_X%Add (0.0d0) call Op_Mud_Forehead_section%Add (1) - call Op_Mud_Backhead_X%Add (0.0d0) + call MudSystemDotOp_Mud_Backhead_X%Add (0.0d0) call Op_Mud_Backhead_section%Add (1) - call Op_RemainedVolume_in_LastSection%Add (0.0d0) - call Op_EmptyVolume_inBackheadLocation%Add (0.0d0) + call MudSystemDotOp_RemainedVolume_in_LastSection%Add (0.0d0) + call MudSystemDotOp_EmptyVolume_inBackheadLocation%Add (0.0d0) call Op_MudOrKick%Add (Ann_MudOrKick%Array(1)) else ! 2-Pockets are Merged - Op_Density%Array (Op_Density%Length())= (SavedDensityForOp*Op_NeededVolume_ToFill+Op_Density%Last()*Op_MudDischarged_Volume%Last())/(Op_MudDischarged_Volume%Last()+Op_NeededVolume_ToFill) - Op_MudDischarged_Volume%Array (Op_Density%Length())= Op_MudDischarged_Volume%Array (Op_Density%Length()) + Op_NeededVolume_ToFill - Op_RemainedVolume_in_LastSection%Array (Op_Density%Length())= 0.0 - Op_EmptyVolume_inBackheadLocation%Array (Op_Density%Length())= 0.0 + MudSystemDotOp_Density%Array (MudSystemDotOp_Density%Length())= (SavedDensityForOp*MudSystemDotOp_NeededVolume_ToFill+MudSystemDotOp_Density%Last()*MudSystemDotOp_MudDischarged_Volume%Last())/(MudSystemDotOp_MudDischarged_Volume%Last()+MudSystemDotOp_NeededVolume_ToFill) + MudSystemDotOp_MudDischarged_Volume%Array (MudSystemDotOp_Density%Length())= MudSystemDotOp_MudDischarged_Volume%Array (MudSystemDotOp_Density%Length()) + MudSystemDotOp_NeededVolume_ToFill + MudSystemDotOp_RemainedVolume_in_LastSection%Array (MudSystemDotOp_Density%Length())= 0.0 + MudSystemDotOp_EmptyVolume_inBackheadLocation%Array (MudSystemDotOp_Density%Length())= 0.0 endif @@ -1252,68 +1252,68 @@ imud= Ann_Mud_Forehead_X%Length() + 1 !============================= Bottom Hole ============================== -imud=0 - do while (imud < Op_Mud_Forehead_X%Length()) - imud = imud + 1 +MudSystemDotimud=0 + do while (MudSystemDotimud < MudSystemDotOp_Mud_Forehead_X%Length()) + MudSystemDotimud = MudSystemDotimud + 1 - if (imud> 1) then - Op_Mud_Backhead_X%Array(imud)= Op_Mud_Forehead_X%Array(imud-1) - Op_Mud_Backhead_section%Array(imud)= Op_Mud_Forehead_section%Array(imud-1) + if (MudSystemDotimud> 1) then + MudSystemDotOp_Mud_Backhead_X%Array(MudSystemDotimud)= MudSystemDotOp_Mud_Forehead_X%Array(MudSystemDotimud-1) + Op_Mud_Backhead_section%Array(MudSystemDotimud)= Op_Mud_Forehead_section%Array(MudSystemDotimud-1) endif - DirectionCoef= (Xend_OpSection(Op_Mud_Backhead_section%Array(imud))-Xstart_OpSection(Op_Mud_Backhead_section%Array(imud))) & - / ABS(Xend_OpSection(Op_Mud_Backhead_section%Array(imud))-Xstart_OpSection(Op_Mud_Backhead_section%Array(imud))) + MudSystemDotDirectionCoef= (MudSystemDotXend_OpSection(Op_Mud_Backhead_section%Array(MudSystemDotimud))-MudSystemDotXstart_OpSection(Op_Mud_Backhead_section%Array(MudSystemDotimud))) & + / ABS(MudSystemDotXend_OpSection(Op_Mud_Backhead_section%Array(MudSystemDotimud))-MudSystemDotXstart_OpSection(Op_Mud_Backhead_section%Array(MudSystemDotimud))) ! +1 for string , -1 for annulus - Op_EmptyVolume_inBackheadLocation%Array(imud)= DirectionCoef* (Xend_OpSection(Op_Mud_Backhead_section%Array(imud))- Op_Mud_Backhead_X%Array(imud))* & - Area_OpSectionFt(Op_Mud_Backhead_section%Array(imud)) !(ft^3) - Op_EmptyVolume_inBackheadLocation%Array(imud)= Op_EmptyVolume_inBackheadLocation%Array(imud)* 7.48051948d0 ! ft^3 to gal + MudSystemDotOp_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotDirectionCoef* (MudSystemDotXend_OpSection(Op_Mud_Backhead_section%Array(MudSystemDotimud))- MudSystemDotOp_Mud_Backhead_X%Array(MudSystemDotimud))* & + MudSystemDotArea_OpSectionFt(Op_Mud_Backhead_section%Array(MudSystemDotimud)) !(ft^3) + MudSystemDotOp_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotOp_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)* 7.48051948d0 ! ft^3 to gal - if ( Op_MudDischarged_Volume%Array(imud) <= Op_EmptyVolume_inBackheadLocation%Array(imud)) then - Op_Mud_Forehead_section%Array(imud)= Op_Mud_Backhead_section%Array(imud) - Op_Mud_Forehead_X%Array(imud)= Op_Mud_Backhead_X%Array(imud)+ DirectionCoef*(Op_MudDischarged_Volume%Array(imud)/7.48051948d0)/Area_OpSectionFt(Op_Mud_Backhead_section%Array(imud)) + if ( MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud) <= MudSystemDotOp_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)) then + Op_Mud_Forehead_section%Array(MudSystemDotimud)= Op_Mud_Backhead_section%Array(MudSystemDotimud) + MudSystemDotOp_Mud_Forehead_X%Array(MudSystemDotimud)= MudSystemDotOp_Mud_Backhead_X%Array(MudSystemDotimud)+ MudSystemDotDirectionCoef*(MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud)/7.48051948d0)/MudSystemDotArea_OpSectionFt(Op_Mud_Backhead_section%Array(MudSystemDotimud)) ! 7.48051948 is for gal to ft^3 else - isection= Op_Mud_Backhead_section%Array(imud)+1 - Op_RemainedVolume_in_LastSection%Array(imud)= Op_MudDischarged_Volume%Array(imud)- Op_EmptyVolume_inBackheadLocation%Array(imud) + MudSystemDotisection= Op_Mud_Backhead_section%Array(MudSystemDotimud)+1 + MudSystemDotOp_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud)- MudSystemDotOp_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud) do - if (isection > F_BottomHoleIntervalCounts) then ! last pipe section(well exit) + if (MudSystemDotisection > F_BottomHoleIntervalCounts) then ! last pipe section(well exit) !if( imud==1) KickDeltaVinAnnulus= Op_RemainedVolume_in_LastSection%Array(imud) ! Kick enters Annulus space - Op_MudDischarged_Volume%Array(imud)= Op_MudDischarged_Volume%Array(imud)- Op_RemainedVolume_in_LastSection%Array(imud) - Op_Mud_Forehead_X%Array(imud)= Xend_OpSection(F_BottomHoleIntervalCounts) - Op_Mud_Forehead_section%Array(imud)= F_BottomHoleIntervalCounts + MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud)= MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud)- MudSystemDotOp_RemainedVolume_in_LastSection%Array(MudSystemDotimud) + MudSystemDotOp_Mud_Forehead_X%Array(MudSystemDotimud)= MudSystemDotXend_OpSection(F_BottomHoleIntervalCounts) + Op_Mud_Forehead_section%Array(MudSystemDotimud)= F_BottomHoleIntervalCounts - if (Op_MudDischarged_Volume%Array(imud)<= 0.0d0) then ! imud is completely exited form the well - call Op_MudDischarged_Volume%Remove (imud) - call Op_Mud_Backhead_X%Remove (imud) - call Op_Mud_Backhead_section%Remove (imud) - call Op_Mud_Forehead_X%Remove (imud) - call Op_Mud_Forehead_section%Remove (imud) - call Op_Density%Remove (imud) - call Op_RemainedVolume_in_LastSection%Remove (imud) - call Op_EmptyVolume_inBackheadLocation%Remove (imud) - call Op_MudOrKick%Remove (imud) + if (MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud)<= 0.0d0) then ! imud is completely exited form the well + call MudSystemDotOp_MudDischarged_Volume%Remove (MudSystemDotimud) + call MudSystemDotOp_Mud_Backhead_X%Remove (MudSystemDotimud) + call Op_Mud_Backhead_section%Remove (MudSystemDotimud) + call MudSystemDotOp_Mud_Forehead_X%Remove (MudSystemDotimud) + call Op_Mud_Forehead_section%Remove (MudSystemDotimud) + call MudSystemDotOp_Density%Remove (MudSystemDotimud) + call MudSystemDotOp_RemainedVolume_in_LastSection%Remove (MudSystemDotimud) + call MudSystemDotOp_EmptyVolume_inBackheadLocation%Remove (MudSystemDotimud) + call Op_MudOrKick%Remove (MudSystemDotimud) endif exit endif - xx= Op_RemainedVolume_in_LastSection%Array(imud)/ OpSection_VolumeCapacity(isection) !(gal) + MudSystemDotxx= MudSystemDotOp_RemainedVolume_in_LastSection%Array(MudSystemDotimud)/ MudSystemDotOpSection_VolumeCapacity(MudSystemDotisection) !(gal) - if (xx<= 1.0) then - Op_Mud_Forehead_section%Array(imud)= isection - Op_Mud_Forehead_X%Array(imud)= (xx * (Xend_OpSection(isection)- Xstart_OpSection(isection)))+ Xstart_OpSection(isection) + if (MudSystemDotxx<= 1.0) then + Op_Mud_Forehead_section%Array(MudSystemDotimud)= MudSystemDotisection + MudSystemDotOp_Mud_Forehead_X%Array(MudSystemDotimud)= (MudSystemDotxx * (MudSystemDotXend_OpSection(MudSystemDotisection)- MudSystemDotXstart_OpSection(MudSystemDotisection)))+ MudSystemDotXstart_OpSection(MudSystemDotisection) exit else - Op_RemainedVolume_in_LastSection%Array(imud)= Op_RemainedVolume_in_LastSection%Array(imud)- OpSection_VolumeCapacity(isection) - isection= isection+ 1 + MudSystemDotOp_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotOp_RemainedVolume_in_LastSection%Array(MudSystemDotimud)- MudSystemDotOpSection_VolumeCapacity(MudSystemDotisection) + MudSystemDotisection= MudSystemDotisection+ 1 endif @@ -1345,10 +1345,10 @@ imud=0 !========================================================= - total_injected = total_injected + MudVolume_InjectedFromAnn + MudSystemDottotal_injected = MudSystemDottotal_injected + MudVolume_InjectedFromAnn if (ChokeControlPanel%ChokePanelStrokeResetSwitch == 1) then - total_injected= 0. + MudSystemDottotal_injected= 0. endif !write(*,*) ' MudVolume_InjectedFromAnn =' , MudVolume_InjectedFromAnn diff --git a/Equipments/MudSystem/Utube1_and_Trip_In.f90 b/Equipments/MudSystem/Utube1_and_Trip_In.f90 index c2e91cd..76c183e 100644 --- a/Equipments/MudSystem/Utube1_and_Trip_In.f90 +++ b/Equipments/MudSystem/Utube1_and_Trip_In.f90 @@ -16,16 +16,16 @@ SUBROUTINE Utube1_and_TripIn ! is called in subroutine CirculationCodeSelect write(*,*) 'Utube1 code' !===========================================================WELL============================================================ !===========================================================WELL============================================================ - UtubeMode1Activated= .true. + MudSystemDotUtubeMode1Activated= .true. !write(*,*) 'QUTubeInput=' , QUTubeInput !Qinput=5000. - StringFlowRate= QUTubeInput ! (gpm) - AnnulusFlowRate= QUTubeInput - StringFlowRateFinal= StringFlowRate - AnnulusFlowRateFinal= AnnulusFlowRate + MudSystemDotStringFlowRate= QUTubeInput ! (gpm) + MudSystemDotAnnulusFlowRate= QUTubeInput + MudSystemDotStringFlowRateFinal= MudSystemDotStringFlowRate + MudSystemDotAnnulusFlowRateFinal= MudSystemDotAnnulusFlowRate !=========================================== - if (FirstSetUtube1==0) then + if (MudSystemDotFirstSetUtube1==0) then ! call St_MudDischarged_Volume%AddToFirst (REAL(sum(F_Interval(1:F_StringIntervalCounts)%Volume))) !startup initial ! call St_Mud_Backhead_X%AddToFirst (Xstart_PipeSection(1)) ! call St_Mud_Backhead_section%AddToFirst (1) @@ -46,10 +46,10 @@ SUBROUTINE Utube1_and_TripIn ! is called in subroutine CirculationCodeSelect !Hz_Density%Array(:)= 0.0 !commented !Hz_MudOrKick%Array(:)= 104 !commented - Hz_Density_Utube= 0.0 - Hz_MudOrKick_Utube= 104 + MudSystemDotHz_Density_Utube= 0.0 + MudSystemDotHz_MudOrKick_Utube= 104 - FirstSetUtube1= 1 + MudSystemDotFirstSetUtube1= 1 endif @@ -154,16 +154,16 @@ SUBROUTINE Utube1_and_TripIn ! is called in subroutine CirculationCodeSelect !========================STRING ENTRANCE================= !write(*,*) 'a) St_Density%Length()=' , St_Density%Length() - if (ABS(St_Density%First() - Hz_Density_Utube) >= DensityMixTol) then ! new mud is pumped - call St_Density%AddToFirst (Hz_Density_Utube) - call St_MudDischarged_Volume%AddToFirst (0.0d0) - call St_Mud_Forehead_X%AddToFirst (Xstart_PipeSection(2)) + if (ABS(St_Density%First() - MudSystemDotHz_Density_Utube) >= MudSystemDotDensityMixTol) then ! new mud is pumped + call St_Density%AddToFirst (MudSystemDotHz_Density_Utube) + call MudSystemDotSt_MudDischarged_Volume%AddToFirst (0.0d0) + call MudSystemDotSt_Mud_Forehead_X%AddToFirst (MudSystemDotXstart_PipeSection(2)) call St_Mud_Forehead_section%AddToFirst (2) - call St_Mud_Backhead_X%AddToFirst (Xstart_PipeSection(2)) + call MudSystemDotSt_Mud_Backhead_X%AddToFirst (MudSystemDotXstart_PipeSection(2)) call St_Mud_Backhead_section%AddToFirst (2) - call St_RemainedVolume_in_LastSection%AddToFirst (0.0d0) - call St_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) - call St_MudOrKick%AddToFirst (Hz_MudOrKick_Utube) ! Hz_MudOrKick%Last() = 104 + call MudSystemDotSt_RemainedVolume_in_LastSection%AddToFirst (0.0d0) + call MudSystemDotSt_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) + call St_MudOrKick%AddToFirst (MudSystemDotHz_MudOrKick_Utube) ! Hz_MudOrKick%Last() = 104 !StringDensity_Old= Hz_Density_Utube endif @@ -174,58 +174,58 @@ SUBROUTINE Utube1_and_TripIn ! is called in subroutine CirculationCodeSelect !========================STRING================= !WRITE (*,*) 'Utube1 StringFlowRate', StringFlowRate - St_MudDischarged_Volume%Array(1)= St_MudDischarged_Volume%Array(1)+ ((StringFlowRate/60.d0)*DeltaT_Mudline) !(gal) + MudSystemDotSt_MudDischarged_Volume%Array(1)= MudSystemDotSt_MudDischarged_Volume%Array(1)+ ((MudSystemDotStringFlowRate/60.d0)*DeltaT_Mudline) !(gal) -imud=0 - do while (imud < St_Mud_Forehead_X%Length()) - imud = imud + 1 +MudSystemDotimud=0 + do while (MudSystemDotimud < MudSystemDotSt_Mud_Forehead_X%Length()) + MudSystemDotimud = MudSystemDotimud + 1 - if (imud> 1) then - St_Mud_Backhead_X%Array(imud)= St_Mud_Forehead_X%Array(imud-1) - St_Mud_Backhead_section%Array(imud)= St_Mud_Forehead_section%Array(imud-1) + if (MudSystemDotimud> 1) then + MudSystemDotSt_Mud_Backhead_X%Array(MudSystemDotimud)= MudSystemDotSt_Mud_Forehead_X%Array(MudSystemDotimud-1) + St_Mud_Backhead_section%Array(MudSystemDotimud)= St_Mud_Forehead_section%Array(MudSystemDotimud-1) endif - DirectionCoef= (Xend_PipeSection(St_Mud_Backhead_section%Array(imud))-Xstart_PipeSection(St_Mud_Backhead_section%Array(imud))) & - / ABS(Xend_PipeSection(St_Mud_Backhead_section%Array(imud))-Xstart_PipeSection(St_Mud_Backhead_section%Array(imud))) + MudSystemDotDirectionCoef= (MudSystemDotXend_PipeSection(St_Mud_Backhead_section%Array(MudSystemDotimud))-MudSystemDotXstart_PipeSection(St_Mud_Backhead_section%Array(MudSystemDotimud))) & + / ABS(MudSystemDotXend_PipeSection(St_Mud_Backhead_section%Array(MudSystemDotimud))-MudSystemDotXstart_PipeSection(St_Mud_Backhead_section%Array(MudSystemDotimud))) ! +1 for string , -1 for annulus - St_EmptyVolume_inBackheadLocation%Array(imud)= DirectionCoef* (Xend_PipeSection(St_Mud_Backhead_section%Array(imud))- St_Mud_Backhead_X%Array(imud))* & - Area_PipeSectionFt(St_Mud_Backhead_section%Array(imud)) !(ft^3) - St_EmptyVolume_inBackheadLocation%Array(imud)= St_EmptyVolume_inBackheadLocation%Array(imud)* 7.48051948d0 ! ft^3 to gal + MudSystemDotSt_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotDirectionCoef* (MudSystemDotXend_PipeSection(St_Mud_Backhead_section%Array(MudSystemDotimud))- MudSystemDotSt_Mud_Backhead_X%Array(MudSystemDotimud))* & + MudSystemDotArea_PipeSectionFt(St_Mud_Backhead_section%Array(MudSystemDotimud)) !(ft^3) + MudSystemDotSt_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotSt_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)* 7.48051948d0 ! ft^3 to gal - if ( St_MudDischarged_Volume%Array(imud) <= St_EmptyVolume_inBackheadLocation%Array(imud)) then - St_Mud_Forehead_section%Array(imud)= St_Mud_Backhead_section%Array(imud) - St_Mud_Forehead_X%Array(imud)= St_Mud_Backhead_X%Array(imud)+ DirectionCoef*(St_MudDischarged_Volume%Array(imud)/7.48051948d0)/Area_PipeSectionFt(St_Mud_Backhead_section%Array(imud)) + if ( MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud) <= MudSystemDotSt_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)) then + St_Mud_Forehead_section%Array(MudSystemDotimud)= St_Mud_Backhead_section%Array(MudSystemDotimud) + MudSystemDotSt_Mud_Forehead_X%Array(MudSystemDotimud)= MudSystemDotSt_Mud_Backhead_X%Array(MudSystemDotimud)+ MudSystemDotDirectionCoef*(MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud)/7.48051948d0)/MudSystemDotArea_PipeSectionFt(St_Mud_Backhead_section%Array(MudSystemDotimud)) ! 7.48 is for gal to ft^3 else - isection= St_Mud_Backhead_section%Array(imud)+1 - St_RemainedVolume_in_LastSection%Array(imud)= St_MudDischarged_Volume%Array(imud)- St_EmptyVolume_inBackheadLocation%Array(imud) + MudSystemDotisection= St_Mud_Backhead_section%Array(MudSystemDotimud)+1 + MudSystemDotSt_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud)- MudSystemDotSt_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud) do - if (isection > F_StringIntervalCounts) then ! last pipe section(string exit) F_StringIntervalCounts includes Horizontal line - St_MudDischarged_Volume%Array(imud)= St_MudDischarged_Volume%Array(imud)- St_RemainedVolume_in_LastSection%Array(imud) - St_Mud_Forehead_X%Array(imud)= Xend_PipeSection(F_StringIntervalCounts) - St_Mud_Forehead_section%Array(imud)= F_StringIntervalCounts + if (MudSystemDotisection > F_StringIntervalCounts) then ! last pipe section(string exit) F_StringIntervalCounts includes Horizontal line + MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud)= MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud)- MudSystemDotSt_RemainedVolume_in_LastSection%Array(MudSystemDotimud) + MudSystemDotSt_Mud_Forehead_X%Array(MudSystemDotimud)= MudSystemDotXend_PipeSection(F_StringIntervalCounts) + St_Mud_Forehead_section%Array(MudSystemDotimud)= F_StringIntervalCounts - if (St_MudDischarged_Volume%Array(imud)<= 0.0d0) then ! imud is completely exited form the string - call RemoveStringMudArrays(imud) + if (MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud)<= 0.0d0) then ! imud is completely exited form the string + call RemoveStringMudArrays(MudSystemDotimud) endif exit endif - xx= St_RemainedVolume_in_LastSection%Array(imud)/ PipeSection_VolumeCapacity(isection) !(gal) + MudSystemDotxx= MudSystemDotSt_RemainedVolume_in_LastSection%Array(MudSystemDotimud)/ MudSystemDotPipeSection_VolumeCapacity(MudSystemDotisection) !(gal) - if (xx<= 1.0) then - St_Mud_Forehead_section%Array(imud)= isection - St_Mud_Forehead_X%Array(imud)= (xx * (Xend_PipeSection(isection)- Xstart_PipeSection(isection)))+ Xstart_PipeSection(isection) + if (MudSystemDotxx<= 1.0) then + St_Mud_Forehead_section%Array(MudSystemDotimud)= MudSystemDotisection + MudSystemDotSt_Mud_Forehead_X%Array(MudSystemDotimud)= (MudSystemDotxx * (MudSystemDotXend_PipeSection(MudSystemDotisection)- MudSystemDotXstart_PipeSection(MudSystemDotisection)))+ MudSystemDotXstart_PipeSection(MudSystemDotisection) exit else - St_RemainedVolume_in_LastSection%Array(imud)= St_RemainedVolume_in_LastSection%Array(imud)- PipeSection_VolumeCapacity(isection) - isection= isection+ 1 + MudSystemDotSt_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotSt_RemainedVolume_in_LastSection%Array(MudSystemDotimud)- MudSystemDotPipeSection_VolumeCapacity(MudSystemDotisection) + MudSystemDotisection= MudSystemDotisection+ 1 endif @@ -259,60 +259,60 @@ imud=0 !============================= Bottom Hole ============================== !Op_MudDischarged_Volume%Array(1)= Op_MudDischarged_Volume%Array(1)+ ((GasKickPumpFlowRate/60.)*DeltaT_Mudline) !(gal) due to KickFlux -imud=0 - do while (imud < Op_Mud_Forehead_X%Length()) - imud = imud + 1 +MudSystemDotimud=0 + do while (MudSystemDotimud < MudSystemDotOp_Mud_Forehead_X%Length()) + MudSystemDotimud = MudSystemDotimud + 1 - if (imud> 1) then - Op_Mud_Backhead_X%Array(imud)= Op_Mud_Forehead_X%Array(imud-1) - Op_Mud_Backhead_section%Array(imud)= Op_Mud_Forehead_section%Array(imud-1) + if (MudSystemDotimud> 1) then + MudSystemDotOp_Mud_Backhead_X%Array(MudSystemDotimud)= MudSystemDotOp_Mud_Forehead_X%Array(MudSystemDotimud-1) + Op_Mud_Backhead_section%Array(MudSystemDotimud)= Op_Mud_Forehead_section%Array(MudSystemDotimud-1) endif - DirectionCoef= (Xend_OpSection(Op_Mud_Backhead_section%Array(imud))-Xstart_OpSection(Op_Mud_Backhead_section%Array(imud))) & - / ABS(Xend_OpSection(Op_Mud_Backhead_section%Array(imud))-Xstart_OpSection(Op_Mud_Backhead_section%Array(imud))) + MudSystemDotDirectionCoef= (MudSystemDotXend_OpSection(Op_Mud_Backhead_section%Array(MudSystemDotimud))-MudSystemDotXstart_OpSection(Op_Mud_Backhead_section%Array(MudSystemDotimud))) & + / ABS(MudSystemDotXend_OpSection(Op_Mud_Backhead_section%Array(MudSystemDotimud))-MudSystemDotXstart_OpSection(Op_Mud_Backhead_section%Array(MudSystemDotimud))) ! +1 for string , -1 for annulus - Op_EmptyVolume_inBackheadLocation%Array(imud)= DirectionCoef* (Xend_OpSection(Op_Mud_Backhead_section%Array(imud))- Op_Mud_Backhead_X%Array(imud))* & - Area_OpSectionFt(Op_Mud_Backhead_section%Array(imud)) !(ft^3) - Op_EmptyVolume_inBackheadLocation%Array(imud)= Op_EmptyVolume_inBackheadLocation%Array(imud)* 7.48051948d0 ! ft^3 to gal + MudSystemDotOp_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotDirectionCoef* (MudSystemDotXend_OpSection(Op_Mud_Backhead_section%Array(MudSystemDotimud))- MudSystemDotOp_Mud_Backhead_X%Array(MudSystemDotimud))* & + MudSystemDotArea_OpSectionFt(Op_Mud_Backhead_section%Array(MudSystemDotimud)) !(ft^3) + MudSystemDotOp_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotOp_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)* 7.48051948d0 ! ft^3 to gal - if ( Op_MudDischarged_Volume%Array(imud) <= Op_EmptyVolume_inBackheadLocation%Array(imud)) then - Op_Mud_Forehead_section%Array(imud)= Op_Mud_Backhead_section%Array(imud) - Op_Mud_Forehead_X%Array(imud)= Op_Mud_Backhead_X%Array(imud)+ DirectionCoef*(Op_MudDischarged_Volume%Array(imud)/7.48051948d0)/Area_OpSectionFt(Op_Mud_Backhead_section%Array(imud)) + if ( MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud) <= MudSystemDotOp_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)) then + Op_Mud_Forehead_section%Array(MudSystemDotimud)= Op_Mud_Backhead_section%Array(MudSystemDotimud) + MudSystemDotOp_Mud_Forehead_X%Array(MudSystemDotimud)= MudSystemDotOp_Mud_Backhead_X%Array(MudSystemDotimud)+ MudSystemDotDirectionCoef*(MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud)/7.48051948d0)/MudSystemDotArea_OpSectionFt(Op_Mud_Backhead_section%Array(MudSystemDotimud)) ! 7.48 is for gal to ft^3 else - isection= Op_Mud_Backhead_section%Array(imud)+1 - Op_RemainedVolume_in_LastSection%Array(imud)= Op_MudDischarged_Volume%Array(imud)- Op_EmptyVolume_inBackheadLocation%Array(imud) + MudSystemDotisection= Op_Mud_Backhead_section%Array(MudSystemDotimud)+1 + MudSystemDotOp_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud)- MudSystemDotOp_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud) do - if (isection > F_BottomHoleIntervalCounts) then ! last pipe section(well exit) - if( imud==1) KickDeltaVinAnnulus= Op_RemainedVolume_in_LastSection%Array(imud) ! Kick enters Annulus space - Op_MudDischarged_Volume%Array(imud)= Op_MudDischarged_Volume%Array(imud)- Op_RemainedVolume_in_LastSection%Array(imud) - Op_Mud_Forehead_X%Array(imud)= Xend_OpSection(F_BottomHoleIntervalCounts) - Op_Mud_Forehead_section%Array(imud)= F_BottomHoleIntervalCounts + if (MudSystemDotisection > F_BottomHoleIntervalCounts) then ! last pipe section(well exit) + if( MudSystemDotimud==1) MudSystemDotKickDeltaVinAnnulus= MudSystemDotOp_RemainedVolume_in_LastSection%Array(MudSystemDotimud) ! Kick enters Annulus space + MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud)= MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud)- MudSystemDotOp_RemainedVolume_in_LastSection%Array(MudSystemDotimud) + MudSystemDotOp_Mud_Forehead_X%Array(MudSystemDotimud)= MudSystemDotXend_OpSection(F_BottomHoleIntervalCounts) + Op_Mud_Forehead_section%Array(MudSystemDotimud)= F_BottomHoleIntervalCounts - if (Op_MudDischarged_Volume%Array(imud)<= 0.0d0) then ! imud is completely exited form the well - call RemoveOpMudArrays(imud) + if (MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud)<= 0.0d0) then ! imud is completely exited form the well + call RemoveOpMudArrays(MudSystemDotimud) endif exit endif - xx= Op_RemainedVolume_in_LastSection%Array(imud)/ OpSection_VolumeCapacity(isection) !(gal) + MudSystemDotxx= MudSystemDotOp_RemainedVolume_in_LastSection%Array(MudSystemDotimud)/ MudSystemDotOpSection_VolumeCapacity(MudSystemDotisection) !(gal) - if (xx<= 1.0) then - Op_Mud_Forehead_section%Array(imud)= isection - Op_Mud_Forehead_X%Array(imud)= (xx * (Xend_OpSection(isection)- Xstart_OpSection(isection)))+ Xstart_OpSection(isection) + if (MudSystemDotxx<= 1.0) then + Op_Mud_Forehead_section%Array(MudSystemDotimud)= MudSystemDotisection + MudSystemDotOp_Mud_Forehead_X%Array(MudSystemDotimud)= (MudSystemDotxx * (MudSystemDotXend_OpSection(MudSystemDotisection)- MudSystemDotXstart_OpSection(MudSystemDotisection)))+ MudSystemDotXstart_OpSection(MudSystemDotisection) exit else - Op_RemainedVolume_in_LastSection%Array(imud)= Op_RemainedVolume_in_LastSection%Array(imud)- OpSection_VolumeCapacity(isection) - isection= isection+ 1 + MudSystemDotOp_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotOp_RemainedVolume_in_LastSection%Array(MudSystemDotimud)- MudSystemDotOpSection_VolumeCapacity(MudSystemDotisection) + MudSystemDotisection= MudSystemDotisection+ 1 endif @@ -321,13 +321,13 @@ imud=0 endif - if (Op_Mud_Forehead_X%Array(imud)== Xend_OpSection(F_BottomHoleIntervalCounts)) then - totalLength = Op_MudDischarged_Volume%Length() - do while(imud < totalLength) + if (MudSystemDotOp_Mud_Forehead_X%Array(MudSystemDotimud)== MudSystemDotXend_OpSection(F_BottomHoleIntervalCounts)) then + MudSystemDottotalLength = MudSystemDotOp_MudDischarged_Volume%Length() + do while(MudSystemDotimud < MudSystemDottotalLength) !imud = imud + 1 - call RemoveOpMudArrays(totalLength) - totalLength = totalLength - 1 + call RemoveOpMudArrays(MudSystemDottotalLength) + MudSystemDottotalLength = MudSystemDottotalLength - 1 enddo @@ -352,81 +352,81 @@ imud=0 ! WRITE(*,*) 'Op_Mud_Forehead_X%Array(2)' , Op_Mud_Forehead_X%Array(2) !========================Bottom Hole END================= - if (iLoc == 1) then - MudSection= F_StringIntervalCounts+1 - BackheadX= Xstart_PipeSection(F_StringIntervalCounts+1) - elseif (iLoc == 2) then - MudSection= Kick_Forehead_section - BackheadX= Kick_Forehead_X + if (MudSystemDotiLoc == 1) then + MudSystemDotMudSection= F_StringIntervalCounts+1 + MudSystemDotBackheadX= MudSystemDotXstart_PipeSection(F_StringIntervalCounts+1) + elseif (MudSystemDotiLoc == 2) then + MudSystemDotMudSection= MudSystemDotKick_Forehead_section + MudSystemDotBackheadX= MudSystemDotKick_Forehead_X endif !========================ANNULUS ENTRANCE==================== !write(*,*) 'iloc=====' , iLoc - if ((ABS(AnnulusSuctionDensity_Old - St_Density%Last()) >= DensityMixTol) .OR. (DeltaVolumeOp == 0.0 .and. ABS(Ann_Density%Array(iLoc)-St_Density%Last())>=DensityMixTol .and. AnnulusFlowRate/=0.0d0) ) then ! new mud is pumped - call Ann_Density%AddTo (iLoc,St_Density%Last()) - call Ann_MudDischarged_Volume%AddTo (iLoc,0.0d0) - call Ann_Mud_Forehead_X%AddTo (iLoc,BackheadX) - call Ann_Mud_Forehead_section%AddTo (iLoc,MudSection) - call Ann_Mud_Backhead_X%AddTo (iLoc,BackheadX) - call Ann_Mud_Backhead_section%AddTo (iLoc,MudSection) - call Ann_RemainedVolume_in_LastSection%AddTo (iLoc,0.0d0) - call Ann_EmptyVolume_inBackheadLocation%AddTo (iLoc,0.0d0) - call Ann_MudOrKick%AddTo (iLoc,0) - call Ann_CuttingMud%AddTo (iloc,0) + if ((ABS(AnnulusSuctionDensity_Old - St_Density%Last()) >= MudSystemDotDensityMixTol) .OR. (MudSystemDotDeltaVolumeOp == 0.0 .and. ABS(Ann_Density%Array(MudSystemDotiLoc)-St_Density%Last())>=MudSystemDotDensityMixTol .and. MudSystemDotAnnulusFlowRate/=0.0d0) ) then ! new mud is pumped + call Ann_Density%AddTo (MudSystemDotiLoc,St_Density%Last()) + call MudSystemDotAnn_MudDischarged_Volume%AddTo (MudSystemDotiLoc,0.0d0) + call Ann_Mud_Forehead_X%AddTo (MudSystemDotiLoc,MudSystemDotBackheadX) + call Ann_Mud_Forehead_section%AddTo (MudSystemDotiLoc,MudSystemDotMudSection) + call Ann_Mud_Backhead_X%AddTo (MudSystemDotiLoc,MudSystemDotBackheadX) + call Ann_Mud_Backhead_section%AddTo (MudSystemDotiLoc,MudSystemDotMudSection) + call Ann_RemainedVolume_in_LastSection%AddTo (MudSystemDotiLoc,0.0d0) + call Ann_EmptyVolume_inBackheadLocation%AddTo (MudSystemDotiLoc,0.0d0) + call Ann_MudOrKick%AddTo (MudSystemDotiLoc,0) + call Ann_CuttingMud%AddTo (MudSystemDotiLoc,0) AnnulusSuctionDensity_Old= St_Density%Last() - MudIsChanged= .true. + MudSystemDotMudIsChanged= .true. endif - Ann_MudDischarged_Volume%Array(iLoc)= Ann_MudDischarged_Volume%Array(iLoc)+ ((AnnulusFlowRate/60.0d0)*DeltaT_Mudline) !(gal) + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)+ ((MudSystemDotAnnulusFlowRate/60.0d0)*DeltaT_Mudline) !(gal) !========================Tripping In==================== !write(*,*) 'DeltaVolumeOp=' , DeltaVolumeOp - if (DeltaVolumeOp > 0.0 .and. MudIsChanged== .false.) then !.and. DrillingMode== .false.) then ! trip in mode(loole paeen) + if (MudSystemDotDeltaVolumeOp > 0.0 .and. MudSystemDotMudIsChanged== .false.) then !.and. DrillingMode== .false.) then ! trip in mode(loole paeen) !write(*,*) 'Tripping In' - NewDensity= (St_Density%Last()*((AnnulusFlowRate/60.)*DeltaT_Mudline)+Op_Density%Last()*DeltaVolumeOp)/(((AnnulusFlowRate/60.0d0)*DeltaT_Mudline)+DeltaVolumeOp) - NewVolume= ((AnnulusFlowRate/60.)*DeltaT_Mudline)+DeltaVolumeOp + NewDensity= (St_Density%Last()*((MudSystemDotAnnulusFlowRate/60.)*DeltaT_Mudline)+MudSystemDotOp_Density%Last()*MudSystemDotDeltaVolumeOp)/(((MudSystemDotAnnulusFlowRate/60.0d0)*DeltaT_Mudline)+MudSystemDotDeltaVolumeOp) + MudSystemDotNewVolume= ((MudSystemDotAnnulusFlowRate/60.)*DeltaT_Mudline)+MudSystemDotDeltaVolumeOp !write(*,*) 'Ann_MudDischarged_Volume%Array(1)=', Ann_MudDischarged_Volume%Array(1), 'NewVolume=', NewVolume - if (abs(Ann_Density%Array(iLoc)-NewDensity)< DensityMixTol) then ! 1-Pockets are Merged - (ROP is 0) - Ann_Density%Array(iLoc)= (Ann_Density%Array(iLoc)*Ann_MudDischarged_Volume%Array(iLoc)+NewDensity*NewVolume)/(Ann_MudDischarged_Volume%Array(iLoc)+NewVolume) - Ann_MudDischarged_Volume%Array(iLoc)= Ann_MudDischarged_Volume%Array(iLoc)+DeltaVolumeOp - Ann_Mud_Forehead_X%Array(iLoc)= BackheadX - Ann_Mud_Forehead_section%Array(iLoc)= MudSection - Ann_Mud_Backhead_X%Array(iLoc)= BackheadX - Ann_Mud_Backhead_section%Array(iLoc)= MudSection - Ann_RemainedVolume_in_LastSection%Array(iLoc)= (0.0d0) - Ann_EmptyVolume_inBackheadLocation%Array(iLoc)= (0.0d0) + if (abs(Ann_Density%Array(MudSystemDotiLoc)-NewDensity)< MudSystemDotDensityMixTol) then ! 1-Pockets are Merged - (ROP is 0) + Ann_Density%Array(MudSystemDotiLoc)= (Ann_Density%Array(MudSystemDotiLoc)*MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)+NewDensity*MudSystemDotNewVolume)/(MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)+MudSystemDotNewVolume) + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)+MudSystemDotDeltaVolumeOp + Ann_Mud_Forehead_X%Array(MudSystemDotiLoc)= MudSystemDotBackheadX + Ann_Mud_Forehead_section%Array(MudSystemDotiLoc)= MudSystemDotMudSection + Ann_Mud_Backhead_X%Array(MudSystemDotiLoc)= MudSystemDotBackheadX + Ann_Mud_Backhead_section%Array(MudSystemDotiLoc)= MudSystemDotMudSection + Ann_RemainedVolume_in_LastSection%Array(MudSystemDotiLoc)= (0.0d0) + Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotiLoc)= (0.0d0) else ! 2-Merging conditions are not meeted, so new pocket - call Ann_Density%AddTo (iLoc,NewDensity) - call Ann_MudDischarged_Volume%AddTo (iLoc,NewVolume) - call Ann_Mud_Forehead_X%AddTo (iLoc,BackheadX) - call Ann_Mud_Forehead_section%AddTo (iLoc,MudSection) - call Ann_Mud_Backhead_X%AddTo (iLoc,BackheadX) - call Ann_Mud_Backhead_section%AddTo (iLoc,MudSection) - call Ann_RemainedVolume_in_LastSection%AddTo (iLoc,0.0d0) - call Ann_EmptyVolume_inBackheadLocation%AddTo (iLoc,0.0d0) - call Ann_MudOrKick%AddTo (iLoc,0) - call Ann_CuttingMud%AddTo (iLoc,0) + call Ann_Density%AddTo (MudSystemDotiLoc,NewDensity) + call MudSystemDotAnn_MudDischarged_Volume%AddTo (MudSystemDotiLoc,MudSystemDotNewVolume) + call Ann_Mud_Forehead_X%AddTo (MudSystemDotiLoc,MudSystemDotBackheadX) + call Ann_Mud_Forehead_section%AddTo (MudSystemDotiLoc,MudSystemDotMudSection) + call Ann_Mud_Backhead_X%AddTo (MudSystemDotiLoc,MudSystemDotBackheadX) + call Ann_Mud_Backhead_section%AddTo (MudSystemDotiLoc,MudSystemDotMudSection) + call Ann_RemainedVolume_in_LastSection%AddTo (MudSystemDotiLoc,0.0d0) + call Ann_EmptyVolume_inBackheadLocation%AddTo (MudSystemDotiLoc,0.0d0) + call Ann_MudOrKick%AddTo (MudSystemDotiLoc,0) + call Ann_CuttingMud%AddTo (MudSystemDotiLoc,0) endif - elseif (DeltaVolumeOp > 0.0 .and. MudIsChanged== .true. .and. Rate_of_Penetration==0.) then - Ann_Density%Array(iLoc)= NewDensity - Ann_MudDischarged_Volume%Array(iLoc)= NewVolume - Ann_Mud_Forehead_X%Array(iLoc)= BackheadX - Ann_Mud_Forehead_section%Array(iLoc)= MudSection - Ann_Mud_Backhead_X%Array(iLoc)= BackheadX - Ann_Mud_Backhead_section%Array(iLoc)= MudSection - Ann_RemainedVolume_in_LastSection%Array(iLoc)= (0.0d0) - Ann_EmptyVolume_inBackheadLocation%Array(iLoc)= (0.0d0) + elseif (MudSystemDotDeltaVolumeOp > 0.0 .and. MudSystemDotMudIsChanged== .true. .and. Rate_of_Penetration==0.) then + Ann_Density%Array(MudSystemDotiLoc)= NewDensity + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotiLoc)= MudSystemDotNewVolume + Ann_Mud_Forehead_X%Array(MudSystemDotiLoc)= MudSystemDotBackheadX + Ann_Mud_Forehead_section%Array(MudSystemDotiLoc)= MudSystemDotMudSection + Ann_Mud_Backhead_X%Array(MudSystemDotiLoc)= MudSystemDotBackheadX + Ann_Mud_Backhead_section%Array(MudSystemDotiLoc)= MudSystemDotMudSection + Ann_RemainedVolume_in_LastSection%Array(MudSystemDotiLoc)= (0.0d0) + Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotiLoc)= (0.0d0) endif @@ -435,27 +435,27 @@ imud=0 !======================== ANNULUS ==================== - MudIsChanged= .false. + MudSystemDotMudIsChanged= .false. -imud= 0 +MudSystemDotimud= 0 - do while (imud < Ann_Mud_Forehead_X%Length()) - imud = imud + 1 + do while (MudSystemDotimud < Ann_Mud_Forehead_X%Length()) + MudSystemDotimud = MudSystemDotimud + 1 - if (imud> 1) then - Ann_Mud_Backhead_X%Array(imud)= Ann_Mud_Forehead_X%Array(imud-1) - Ann_Mud_Backhead_section%Array(imud)= Ann_Mud_Forehead_section%Array(imud-1) + if (MudSystemDotimud> 1) then + Ann_Mud_Backhead_X%Array(MudSystemDotimud)= Ann_Mud_Forehead_X%Array(MudSystemDotimud-1) + Ann_Mud_Backhead_section%Array(MudSystemDotimud)= Ann_Mud_Forehead_section%Array(MudSystemDotimud-1) endif ! <<< Fracture Shoe Lost - IF ( ShoeLost .and. LostInTripOutIsDone== .false. .and. Shoe%ShoeDepth < Ann_Mud_Backhead_X%Array(imud) .and. Shoe%ShoeDepth >= Ann_Mud_Forehead_X%Array(imud) ) then + IF ( MudSystemDotShoeLost .and. MudSystemDotLostInTripOutIsDone== .false. .and. Shoe%ShoeDepth < Ann_Mud_Backhead_X%Array(MudSystemDotimud) .and. Shoe%ShoeDepth >= Ann_Mud_Forehead_X%Array(MudSystemDotimud) ) then !write(*,*) 'ShoeLost imud,AnnVolume(imud), VolumeLost:' , imud,Ann_MudDischarged_Volume%Array(imud), (( Qlost/60.0d0)*DeltaT_Mudline) - Ann_MudDischarged_Volume%Array(imud)= Ann_MudDischarged_Volume%Array(imud)-((Qlost/60.0d0)*DeltaT_Mudline) !(gal) - if (Ann_MudDischarged_Volume%Array(imud) < 0.0) then + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)-((MudSystemDotQlost/60.0d0)*DeltaT_Mudline) !(gal) + if (MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud) < 0.0) then !write(*,*) 'mud is removed by shoe lost, imud=' , imud - call RemoveAnnulusMudArrays(imud) - imud= imud-1 + call RemoveAnnulusMudArrays(MudSystemDotimud) + MudSystemDotimud= MudSystemDotimud-1 cycle endif ENDIF @@ -468,48 +468,48 @@ imud= 0 - DirectionCoef= (Xend_PipeSection(Ann_Mud_Backhead_section%Array(imud))-Xstart_PipeSection(Ann_Mud_Backhead_section%Array(imud))) & - / ABS(Xend_PipeSection(Ann_Mud_Backhead_section%Array(imud))-Xstart_PipeSection(Ann_Mud_Backhead_section%Array(imud))) + MudSystemDotDirectionCoef= (MudSystemDotXend_PipeSection(Ann_Mud_Backhead_section%Array(MudSystemDotimud))-MudSystemDotXstart_PipeSection(Ann_Mud_Backhead_section%Array(MudSystemDotimud))) & + / ABS(MudSystemDotXend_PipeSection(Ann_Mud_Backhead_section%Array(MudSystemDotimud))-MudSystemDotXstart_PipeSection(Ann_Mud_Backhead_section%Array(MudSystemDotimud))) ! +1 for string , -1 for annulus - Ann_EmptyVolume_inBackheadLocation%Array(imud)= DirectionCoef* (Xend_PipeSection(Ann_Mud_Backhead_section%Array(imud))- Ann_Mud_Backhead_X%Array(imud))* & - Area_PipeSectionFt(Ann_Mud_Backhead_section%Array(imud)) !(ft^3) - Ann_EmptyVolume_inBackheadLocation%Array(imud)= Ann_EmptyVolume_inBackheadLocation%Array(imud)* 7.48051948d0 ! ft^3 to gal + Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotDirectionCoef* (MudSystemDotXend_PipeSection(Ann_Mud_Backhead_section%Array(MudSystemDotimud))- Ann_Mud_Backhead_X%Array(MudSystemDotimud))* & + MudSystemDotArea_PipeSectionFt(Ann_Mud_Backhead_section%Array(MudSystemDotimud)) !(ft^3) + Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)* 7.48051948d0 ! ft^3 to gal - if ( Ann_MudDischarged_Volume%Array(imud) <= Ann_EmptyVolume_inBackheadLocation%Array(imud)) then - Ann_Mud_Forehead_section%Array(imud)= Ann_Mud_Backhead_section%Array(imud) - Ann_Mud_Forehead_X%Array(imud)= Ann_Mud_Backhead_X%Array(imud)+ DirectionCoef*(Ann_MudDischarged_Volume%Array(imud)/7.48051948d0)/Area_PipeSectionFt(Ann_Mud_Backhead_section%Array(imud)) + if ( MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud) <= Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)) then + Ann_Mud_Forehead_section%Array(MudSystemDotimud)= Ann_Mud_Backhead_section%Array(MudSystemDotimud) + Ann_Mud_Forehead_X%Array(MudSystemDotimud)= Ann_Mud_Backhead_X%Array(MudSystemDotimud)+ MudSystemDotDirectionCoef*(MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)/7.48051948d0)/MudSystemDotArea_PipeSectionFt(Ann_Mud_Backhead_section%Array(MudSystemDotimud)) ! 7.48 is for gal to ft^3 else - isection= Ann_Mud_Backhead_section%Array(imud)+1 - Ann_RemainedVolume_in_LastSection%Array(imud)= Ann_MudDischarged_Volume%Array(imud)- Ann_EmptyVolume_inBackheadLocation%Array(imud) + MudSystemDotisection= Ann_Mud_Backhead_section%Array(MudSystemDotimud)+1 + Ann_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)- Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud) do - if (isection > NoPipeSections) then ! last pipe section(well exit) - Ann_MudDischarged_Volume%Array(imud)= Ann_MudDischarged_Volume%Array(imud)- Ann_RemainedVolume_in_LastSection%Array(imud) - Ann_Mud_Forehead_X%Array(imud)= Xend_PipeSection(NoPipeSections) - Ann_Mud_Forehead_section%Array(imud)= NoPipeSections + if (MudSystemDotisection > MudSystemDotNoPipeSections) then ! last pipe section(well exit) + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)- Ann_RemainedVolume_in_LastSection%Array(MudSystemDotimud) + Ann_Mud_Forehead_X%Array(MudSystemDotimud)= MudSystemDotXend_PipeSection(MudSystemDotNoPipeSections) + Ann_Mud_Forehead_section%Array(MudSystemDotimud)= MudSystemDotNoPipeSections - if (Ann_MudDischarged_Volume%Array(imud)<= 0.0d0) then ! imud is completely exited form the well - call RemoveAnnulusMudArrays(imud) + if (MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)<= 0.0d0) then ! imud is completely exited form the well + call RemoveAnnulusMudArrays(MudSystemDotimud) endif exit endif - xx= Ann_RemainedVolume_in_LastSection%Array(imud)/ PipeSection_VolumeCapacity(isection) !(gal) + MudSystemDotxx= Ann_RemainedVolume_in_LastSection%Array(MudSystemDotimud)/ MudSystemDotPipeSection_VolumeCapacity(MudSystemDotisection) !(gal) - if (xx<= 1.0) then - Ann_Mud_Forehead_section%Array(imud)= isection - Ann_Mud_Forehead_X%Array(imud)= (xx * (Xend_PipeSection(isection)- Xstart_PipeSection(isection)))+ Xstart_PipeSection(isection) + if (MudSystemDotxx<= 1.0) then + Ann_Mud_Forehead_section%Array(MudSystemDotimud)= MudSystemDotisection + Ann_Mud_Forehead_X%Array(MudSystemDotimud)= (MudSystemDotxx * (MudSystemDotXend_PipeSection(MudSystemDotisection)- MudSystemDotXstart_PipeSection(MudSystemDotisection)))+ MudSystemDotXstart_PipeSection(MudSystemDotisection) exit else - Ann_RemainedVolume_in_LastSection%Array(imud)= Ann_RemainedVolume_in_LastSection%Array(imud)- PipeSection_VolumeCapacity(isection) - isection= isection+ 1 + Ann_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= Ann_RemainedVolume_in_LastSection%Array(MudSystemDotimud)- MudSystemDotPipeSection_VolumeCapacity(MudSystemDotisection) + MudSystemDotisection= MudSystemDotisection+ 1 endif diff --git a/Equipments/MudSystem/Utube2_and_Trip_In.f90 b/Equipments/MudSystem/Utube2_and_Trip_In.f90 index 2360003..2d1923f 100644 --- a/Equipments/MudSystem/Utube2_and_Trip_In.f90 +++ b/Equipments/MudSystem/Utube2_and_Trip_In.f90 @@ -16,16 +16,16 @@ SUBROUTINE Utube2_and_TripIn ! is called in subroutine CirculationCodeSelect !===========================================================WELL============================================================ !===========================================================WELL============================================================ - UtubeMode2Activated= .true. + MudSystemDotUtubeMode2Activated= .true. write(*,*) 'QUtubeOutput=' , QUtubeOutput !QUTubeInput=5000. - StringFlowRate= QUtubeOutput ! (gpm) - AnnulusFlowRate= QUtubeOutput - StringFlowRateFinal= StringFlowRate - AnnulusFlowRateFinal= AnnulusFlowRate + MudSystemDotStringFlowRate= QUtubeOutput ! (gpm) + MudSystemDotAnnulusFlowRate= QUtubeOutput + MudSystemDotStringFlowRateFinal= MudSystemDotStringFlowRate + MudSystemDotAnnulusFlowRateFinal= MudSystemDotAnnulusFlowRate !=========================================== - if (FirstSetUtube2==0) then + if (MudSystemDotFirstSetUtube2==0) then ! call St_MudDischarged_Volume%AddToFirst (REAL(sum(F_Interval(1:F_StringIntervalCounts)%Volume))) !startup initial ! call St_Mud_Backhead_X%AddToFirst (Xstart_PipeSection(1)) ! call St_Mud_Backhead_section%AddToFirst (1) @@ -46,10 +46,10 @@ SUBROUTINE Utube2_and_TripIn ! is called in subroutine CirculationCodeSelect !Hz_Density%Array(:)= 0.0 !Hz_MudOrKick%Array(:)= 104 - Hz_Density_Utube= 0.0 - Hz_MudOrKick_Utube= 104 + MudSystemDotHz_Density_Utube= 0.0 + MudSystemDotHz_MudOrKick_Utube= 104 - FirstSetUtube2= 1 + MudSystemDotFirstSetUtube2= 1 endif @@ -154,90 +154,90 @@ SUBROUTINE Utube2_and_TripIn ! is called in subroutine CirculationCodeSelect !========================ANNULUS ENTRANCE==================== - if (ABS(AnnulusSuctionDensity_Old - Hz_Density_Utube) >= DensityMixTol ) then ! new mud is pumped - call Ann_Density%Add (Hz_Density_Utube) - call Ann_MudDischarged_Volume%Add (0.0d0) - call Ann_Mud_Forehead_X%Add (Xend_PipeSection(NoPipeSections)) - call Ann_Mud_Forehead_section%Add (NoPipeSections) - call Ann_Mud_Backhead_X%Add (Xstart_PipeSection(NoPipeSections)) - call Ann_Mud_Backhead_section%Add (NoPipeSections) + if (ABS(AnnulusSuctionDensity_Old - MudSystemDotHz_Density_Utube) >= MudSystemDotDensityMixTol ) then ! new mud is pumped + call Ann_Density%Add (MudSystemDotHz_Density_Utube) + call MudSystemDotAnn_MudDischarged_Volume%Add (0.0d0) + call Ann_Mud_Forehead_X%Add (MudSystemDotXend_PipeSection(MudSystemDotNoPipeSections)) + call Ann_Mud_Forehead_section%Add (MudSystemDotNoPipeSections) + call Ann_Mud_Backhead_X%Add (MudSystemDotXstart_PipeSection(MudSystemDotNoPipeSections)) + call Ann_Mud_Backhead_section%Add (MudSystemDotNoPipeSections) call Ann_RemainedVolume_in_LastSection%Add (0.0d0) call Ann_EmptyVolume_inBackheadLocation%Add (0.0d0) - call Ann_MudOrKick%Add (Hz_MudOrKick_Utube) ! Hz_MudOrKick%Last() = 104 + call Ann_MudOrKick%Add (MudSystemDotHz_MudOrKick_Utube) ! Hz_MudOrKick%Last() = 104 call Ann_CuttingMud%Add (0) - AnnulusSuctionDensity_Old= Hz_Density_Utube + AnnulusSuctionDensity_Old= MudSystemDotHz_Density_Utube endif !========================ANNULUS==================== - Ann_MudDischarged_Volume%Array(Ann_MudDischarged_Volume%Length())= Ann_MudDischarged_Volume%Last()+ ((AnnulusFlowRate/60.)*DeltaT_Mudline) !(gal) + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotAnn_MudDischarged_Volume%Length())= MudSystemDotAnn_MudDischarged_Volume%Last()+ ((MudSystemDotAnnulusFlowRate/60.)*DeltaT_Mudline) !(gal) -imud= Ann_Mud_Forehead_X%Length() + 1 +MudSystemDotimud= Ann_Mud_Forehead_X%Length() + 1 - do while (imud > 1) - imud = imud - 1 + do while (MudSystemDotimud > 1) + MudSystemDotimud = MudSystemDotimud - 1 - if (imud< Ann_Mud_Forehead_X%Length()) then - Ann_Mud_Forehead_X%Array(imud)= Ann_Mud_Backhead_X%Array(imud+1) - Ann_Mud_Forehead_section%Array(imud)= Ann_Mud_Backhead_section%Array(imud+1) + if (MudSystemDotimud< Ann_Mud_Forehead_X%Length()) then + Ann_Mud_Forehead_X%Array(MudSystemDotimud)= Ann_Mud_Backhead_X%Array(MudSystemDotimud+1) + Ann_Mud_Forehead_section%Array(MudSystemDotimud)= Ann_Mud_Backhead_section%Array(MudSystemDotimud+1) endif ! <<< Fracture Shoe Lost - IF ( ShoeLost .and. LostInTripOutIsDone== .false. .and. Shoe%ShoeDepth < Ann_Mud_Backhead_X%Array(imud) .and. Shoe%ShoeDepth >= Ann_Mud_Forehead_X%Array(imud) ) then + IF ( MudSystemDotShoeLost .and. MudSystemDotLostInTripOutIsDone== .false. .and. Shoe%ShoeDepth < Ann_Mud_Backhead_X%Array(MudSystemDotimud) .and. Shoe%ShoeDepth >= Ann_Mud_Forehead_X%Array(MudSystemDotimud) ) then !write(*,*) 'ShoeLost imud,AnnVolume(imud), VolumeLost:' , imud,Ann_MudDischarged_Volume%Array(imud), (( Qlost/60.0d0)*DeltaT_Mudline) - Ann_MudDischarged_Volume%Array(imud)= Ann_MudDischarged_Volume%Array(imud)-((Qlost/60.0d0)*DeltaT_Mudline) !(gal) - if (Ann_MudDischarged_Volume%Array(imud) < 0.0) then + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)-((MudSystemDotQlost/60.0d0)*DeltaT_Mudline) !(gal) + if (MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud) < 0.0) then !write(*,*) 'mud is removed by shoe lost, imud=' , imud - call RemoveAnnulusMudArrays(imud) - imud= imud-1 + call RemoveAnnulusMudArrays(MudSystemDotimud) + MudSystemDotimud= MudSystemDotimud-1 cycle endif ENDIF ! Fracture Shoe Lost >>> - DirectionCoef= (Xend_PipeSection(Ann_Mud_Forehead_section%Array(imud))-Xstart_PipeSection(Ann_Mud_Forehead_section%Array(imud))) & - / ABS(Xend_PipeSection(Ann_Mud_Forehead_section%Array(imud))-Xstart_PipeSection(Ann_Mud_Forehead_section%Array(imud))) + MudSystemDotDirectionCoef= (MudSystemDotXend_PipeSection(Ann_Mud_Forehead_section%Array(MudSystemDotimud))-MudSystemDotXstart_PipeSection(Ann_Mud_Forehead_section%Array(MudSystemDotimud))) & + / ABS(MudSystemDotXend_PipeSection(Ann_Mud_Forehead_section%Array(MudSystemDotimud))-MudSystemDotXstart_PipeSection(Ann_Mud_Forehead_section%Array(MudSystemDotimud))) ! +1 for string , -1 for annulus - Ann_EmptyVolume_inBackheadLocation%Array(imud)= DirectionCoef* (Ann_Mud_Forehead_X%Array(imud)- Xstart_PipeSection(Ann_Mud_Forehead_section%Array(imud)))* & - Area_PipeSectionFt(Ann_Mud_Forehead_section%Array(imud)) !(ft^3) - Ann_EmptyVolume_inBackheadLocation%Array(imud)= Ann_EmptyVolume_inBackheadLocation%Array(imud)* 7.48051948d0 ! ft^3 to gal + Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotDirectionCoef* (Ann_Mud_Forehead_X%Array(MudSystemDotimud)- MudSystemDotXstart_PipeSection(Ann_Mud_Forehead_section%Array(MudSystemDotimud)))* & + MudSystemDotArea_PipeSectionFt(Ann_Mud_Forehead_section%Array(MudSystemDotimud)) !(ft^3) + Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)* 7.48051948d0 ! ft^3 to gal - if ( Ann_MudDischarged_Volume%Array(imud) <= Ann_EmptyVolume_inBackheadLocation%Array(imud)) then - Ann_Mud_Backhead_section%Array(imud)= Ann_Mud_Forehead_section%Array(imud) - Ann_Mud_Backhead_X%Array(imud)= Ann_Mud_Forehead_X%Array(imud)- DirectionCoef*(Ann_MudDischarged_Volume%Array(imud)/7.48051948d0)/Area_PipeSectionFt(Ann_Mud_Forehead_section%Array(imud)) + if ( MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud) <= Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)) then + Ann_Mud_Backhead_section%Array(MudSystemDotimud)= Ann_Mud_Forehead_section%Array(MudSystemDotimud) + Ann_Mud_Backhead_X%Array(MudSystemDotimud)= Ann_Mud_Forehead_X%Array(MudSystemDotimud)- MudSystemDotDirectionCoef*(MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)/7.48051948d0)/MudSystemDotArea_PipeSectionFt(Ann_Mud_Forehead_section%Array(MudSystemDotimud)) ! 7.48051948 is for gal to ft^3 else - isection= Ann_Mud_Forehead_section%Array(imud)-1 - Ann_RemainedVolume_in_LastSection%Array(imud)= Ann_MudDischarged_Volume%Array(imud)- Ann_EmptyVolume_inBackheadLocation%Array(imud) + MudSystemDotisection= Ann_Mud_Forehead_section%Array(MudSystemDotimud)-1 + Ann_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)- Ann_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud) do - if (isection < F_StringIntervalCounts+1) then ! last pipe section(well exit) F_StringIntervalCounts+1 is the first section in Annulus - Ann_MudDischarged_Volume%Array(imud)= Ann_MudDischarged_Volume%Array(imud)- Ann_RemainedVolume_in_LastSection%Array(imud) - Ann_Mud_Backhead_X%Array(imud)= Xstart_PipeSection(F_StringIntervalCounts+1) - Ann_Mud_Backhead_section%Array(imud)= F_StringIntervalCounts+1 + if (MudSystemDotisection < F_StringIntervalCounts+1) then ! last pipe section(well exit) F_StringIntervalCounts+1 is the first section in Annulus + MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)= MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)- Ann_RemainedVolume_in_LastSection%Array(MudSystemDotimud) + Ann_Mud_Backhead_X%Array(MudSystemDotimud)= MudSystemDotXstart_PipeSection(F_StringIntervalCounts+1) + Ann_Mud_Backhead_section%Array(MudSystemDotimud)= F_StringIntervalCounts+1 - if (Ann_MudDischarged_Volume%Array(imud)<= 0.0d0) then ! imud is completely exited form the well - call RemoveAnnulusMudArrays(imud) + if (MudSystemDotAnn_MudDischarged_Volume%Array(MudSystemDotimud)<= 0.0d0) then ! imud is completely exited form the well + call RemoveAnnulusMudArrays(MudSystemDotimud) endif exit endif - xx= Ann_RemainedVolume_in_LastSection%Array(imud)/ PipeSection_VolumeCapacity(isection) !(gal) + MudSystemDotxx= Ann_RemainedVolume_in_LastSection%Array(MudSystemDotimud)/ MudSystemDotPipeSection_VolumeCapacity(MudSystemDotisection) !(gal) - if (xx<= 1.0) then - Ann_Mud_Backhead_section%Array(imud)= isection - Ann_Mud_Backhead_X%Array(imud)= (xx * (Xstart_PipeSection(isection)- Xend_PipeSection(isection)))+ Xend_PipeSection(isection) + if (MudSystemDotxx<= 1.0) then + Ann_Mud_Backhead_section%Array(MudSystemDotimud)= MudSystemDotisection + Ann_Mud_Backhead_X%Array(MudSystemDotimud)= (MudSystemDotxx * (MudSystemDotXstart_PipeSection(MudSystemDotisection)- MudSystemDotXend_PipeSection(MudSystemDotisection)))+ MudSystemDotXend_PipeSection(MudSystemDotisection) exit else - Ann_RemainedVolume_in_LastSection%Array(imud)= Ann_RemainedVolume_in_LastSection%Array(imud)- PipeSection_VolumeCapacity(isection) - isection= isection- 1 + Ann_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= Ann_RemainedVolume_in_LastSection%Array(MudSystemDotimud)- MudSystemDotPipeSection_VolumeCapacity(MudSystemDotisection) + MudSystemDotisection= MudSystemDotisection- 1 endif @@ -271,60 +271,60 @@ imud= Ann_Mud_Forehead_X%Length() + 1 !============================= Bottom Hole ============================== !Op_MudDischarged_Volume%Array(1)= Op_MudDischarged_Volume%Array(1)+ ((GasKickPumpFlowRate/60.)*DeltaT_Mudline) !(gal) due to KickFlux -imud=0 - do while (imud < Op_Mud_Forehead_X%Length()) - imud = imud + 1 +MudSystemDotimud=0 + do while (MudSystemDotimud < MudSystemDotOp_Mud_Forehead_X%Length()) + MudSystemDotimud = MudSystemDotimud + 1 - if (imud> 1) then - Op_Mud_Backhead_X%Array(imud)= Op_Mud_Forehead_X%Array(imud-1) - Op_Mud_Backhead_section%Array(imud)= Op_Mud_Forehead_section%Array(imud-1) + if (MudSystemDotimud> 1) then + MudSystemDotOp_Mud_Backhead_X%Array(MudSystemDotimud)= MudSystemDotOp_Mud_Forehead_X%Array(MudSystemDotimud-1) + Op_Mud_Backhead_section%Array(MudSystemDotimud)= Op_Mud_Forehead_section%Array(MudSystemDotimud-1) endif - DirectionCoef= (Xend_OpSection(Op_Mud_Backhead_section%Array(imud))-Xstart_OpSection(Op_Mud_Backhead_section%Array(imud))) & - / ABS(Xend_OpSection(Op_Mud_Backhead_section%Array(imud))-Xstart_OpSection(Op_Mud_Backhead_section%Array(imud))) + MudSystemDotDirectionCoef= (MudSystemDotXend_OpSection(Op_Mud_Backhead_section%Array(MudSystemDotimud))-MudSystemDotXstart_OpSection(Op_Mud_Backhead_section%Array(MudSystemDotimud))) & + / ABS(MudSystemDotXend_OpSection(Op_Mud_Backhead_section%Array(MudSystemDotimud))-MudSystemDotXstart_OpSection(Op_Mud_Backhead_section%Array(MudSystemDotimud))) ! +1 for string , -1 for annulus - Op_EmptyVolume_inBackheadLocation%Array(imud)= DirectionCoef* (Xend_OpSection(Op_Mud_Backhead_section%Array(imud))- Op_Mud_Backhead_X%Array(imud))* & - Area_OpSectionFt(Op_Mud_Backhead_section%Array(imud)) !(ft^3) - Op_EmptyVolume_inBackheadLocation%Array(imud)= Op_EmptyVolume_inBackheadLocation%Array(imud)* 7.48051948d0 ! ft^3 to gal + MudSystemDotOp_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotDirectionCoef* (MudSystemDotXend_OpSection(Op_Mud_Backhead_section%Array(MudSystemDotimud))- MudSystemDotOp_Mud_Backhead_X%Array(MudSystemDotimud))* & + MudSystemDotArea_OpSectionFt(Op_Mud_Backhead_section%Array(MudSystemDotimud)) !(ft^3) + MudSystemDotOp_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotOp_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)* 7.48051948d0 ! ft^3 to gal - if ( Op_MudDischarged_Volume%Array(imud) <= Op_EmptyVolume_inBackheadLocation%Array(imud)) then - Op_Mud_Forehead_section%Array(imud)= Op_Mud_Backhead_section%Array(imud) - Op_Mud_Forehead_X%Array(imud)= Op_Mud_Backhead_X%Array(imud)+ DirectionCoef*(Op_MudDischarged_Volume%Array(imud)/7.48051948d0)/Area_OpSectionFt(Op_Mud_Backhead_section%Array(imud)) + if ( MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud) <= MudSystemDotOp_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)) then + Op_Mud_Forehead_section%Array(MudSystemDotimud)= Op_Mud_Backhead_section%Array(MudSystemDotimud) + MudSystemDotOp_Mud_Forehead_X%Array(MudSystemDotimud)= MudSystemDotOp_Mud_Backhead_X%Array(MudSystemDotimud)+ MudSystemDotDirectionCoef*(MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud)/7.48051948d0)/MudSystemDotArea_OpSectionFt(Op_Mud_Backhead_section%Array(MudSystemDotimud)) ! 7.48051948 is for gal to ft^3 else - isection= Op_Mud_Backhead_section%Array(imud)+1 - Op_RemainedVolume_in_LastSection%Array(imud)= Op_MudDischarged_Volume%Array(imud)- Op_EmptyVolume_inBackheadLocation%Array(imud) + MudSystemDotisection= Op_Mud_Backhead_section%Array(MudSystemDotimud)+1 + MudSystemDotOp_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud)- MudSystemDotOp_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud) do - if (isection > F_BottomHoleIntervalCounts) then ! last pipe section(well exit) - if( imud==1) KickDeltaVinAnnulus= Op_RemainedVolume_in_LastSection%Array(imud) ! Kick enters Annulus space - Op_MudDischarged_Volume%Array(imud)= Op_MudDischarged_Volume%Array(imud)- Op_RemainedVolume_in_LastSection%Array(imud) - Op_Mud_Forehead_X%Array(imud)= Xend_OpSection(F_BottomHoleIntervalCounts) - Op_Mud_Forehead_section%Array(imud)= F_BottomHoleIntervalCounts + if (MudSystemDotisection > F_BottomHoleIntervalCounts) then ! last pipe section(well exit) + if( MudSystemDotimud==1) MudSystemDotKickDeltaVinAnnulus= MudSystemDotOp_RemainedVolume_in_LastSection%Array(MudSystemDotimud) ! Kick enters Annulus space + MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud)= MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud)- MudSystemDotOp_RemainedVolume_in_LastSection%Array(MudSystemDotimud) + MudSystemDotOp_Mud_Forehead_X%Array(MudSystemDotimud)= MudSystemDotXend_OpSection(F_BottomHoleIntervalCounts) + Op_Mud_Forehead_section%Array(MudSystemDotimud)= F_BottomHoleIntervalCounts - if (Op_MudDischarged_Volume%Array(imud)<= 0.0d0) then ! imud is completely exited form the well - call RemoveOpMudArrays(imud) + if (MudSystemDotOp_MudDischarged_Volume%Array(MudSystemDotimud)<= 0.0d0) then ! imud is completely exited form the well + call RemoveOpMudArrays(MudSystemDotimud) endif exit endif - xx= Op_RemainedVolume_in_LastSection%Array(imud)/ OpSection_VolumeCapacity(isection) !(gal) + MudSystemDotxx= MudSystemDotOp_RemainedVolume_in_LastSection%Array(MudSystemDotimud)/ MudSystemDotOpSection_VolumeCapacity(MudSystemDotisection) !(gal) - if (xx<= 1.0) then - Op_Mud_Forehead_section%Array(imud)= isection - Op_Mud_Forehead_X%Array(imud)= (xx * (Xend_OpSection(isection)- Xstart_OpSection(isection)))+ Xstart_OpSection(isection) + if (MudSystemDotxx<= 1.0) then + Op_Mud_Forehead_section%Array(MudSystemDotimud)= MudSystemDotisection + MudSystemDotOp_Mud_Forehead_X%Array(MudSystemDotimud)= (MudSystemDotxx * (MudSystemDotXend_OpSection(MudSystemDotisection)- MudSystemDotXstart_OpSection(MudSystemDotisection)))+ MudSystemDotXstart_OpSection(MudSystemDotisection) exit else - Op_RemainedVolume_in_LastSection%Array(imud)= Op_RemainedVolume_in_LastSection%Array(imud)- OpSection_VolumeCapacity(isection) - isection= isection+ 1 + MudSystemDotOp_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotOp_RemainedVolume_in_LastSection%Array(MudSystemDotimud)- MudSystemDotOpSection_VolumeCapacity(MudSystemDotisection) + MudSystemDotisection= MudSystemDotisection+ 1 endif @@ -332,13 +332,13 @@ imud=0 endif - if (Op_Mud_Forehead_X%Array(imud)== Xend_OpSection(F_BottomHoleIntervalCounts)) then - totalLength = Op_MudDischarged_Volume%Length() - do while(imud < totalLength) + if (MudSystemDotOp_Mud_Forehead_X%Array(MudSystemDotimud)== MudSystemDotXend_OpSection(F_BottomHoleIntervalCounts)) then + MudSystemDottotalLength = MudSystemDotOp_MudDischarged_Volume%Length() + do while(MudSystemDotimud < MudSystemDottotalLength) !imud = imud + 1 - call RemoveOpMudArrays(totalLength) - totalLength = totalLength - 1 + call RemoveOpMudArrays(MudSystemDottotalLength) + MudSystemDottotalLength = MudSystemDottotalLength - 1 enddo @@ -375,70 +375,70 @@ imud=0 !========================STRING ENTRANCE================= - if ((ABS(St_Density%Last() - Ann_Density%First()) >= DensityMixTol) .OR. (DeltaVolumeOp == 0.0 .and. St_Density%Last() /= Ann_Density%Array(1) .and. StringFlowRate/=0.0d0)) then ! new mud is pumped + if ((ABS(St_Density%Last() - Ann_Density%First()) >= MudSystemDotDensityMixTol) .OR. (MudSystemDotDeltaVolumeOp == 0.0 .and. St_Density%Last() /= Ann_Density%Array(1) .and. MudSystemDotStringFlowRate/=0.0d0)) then ! new mud is pumped !if ((ABS(StringDensity_Old - Ann_Density%First()) >= DensityMixTol) .OR. (DeltaVolumeOp == 0.0 .and. St_Density%Last() /= Ann_Density%Array(1) .and. StringFlowRate/=0.0d0)) then ! new mud is pumped call St_Density%Add (Ann_Density%First()) - call St_MudDischarged_Volume%Add (0.0d0) - call St_Mud_Forehead_X%Add (Xend_PipeSection(F_StringIntervalCounts)) + call MudSystemDotSt_MudDischarged_Volume%Add (0.0d0) + call MudSystemDotSt_Mud_Forehead_X%Add (MudSystemDotXend_PipeSection(F_StringIntervalCounts)) call St_Mud_Forehead_section%Add (F_StringIntervalCounts) - call St_Mud_Backhead_X%Add (Xstart_PipeSection(F_StringIntervalCounts)) + call MudSystemDotSt_Mud_Backhead_X%Add (MudSystemDotXstart_PipeSection(F_StringIntervalCounts)) call St_Mud_Backhead_section%Add (F_StringIntervalCounts) - call St_RemainedVolume_in_LastSection%Add (0.0d0) - call St_EmptyVolume_inBackheadLocation%Add (0.0d0) + call MudSystemDotSt_RemainedVolume_in_LastSection%Add (0.0d0) + call MudSystemDotSt_EmptyVolume_inBackheadLocation%Add (0.0d0) call St_MudOrKick%Add (0) !StringDensity_Old= Ann_Density%First() - MudIsChanged= .true. + MudSystemDotMudIsChanged= .true. endif - St_MudDischarged_Volume%Array(St_MudDischarged_Volume%Length())= St_MudDischarged_Volume%Last()+ ((StringFlowRate/60.0d0)*DeltaT_Mudline) !(gal) + MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotSt_MudDischarged_Volume%Length())= MudSystemDotSt_MudDischarged_Volume%Last()+ ((MudSystemDotStringFlowRate/60.0d0)*DeltaT_Mudline) !(gal) !========================Tripping In==================== !write(*,*) 'DeltaVolumeOp=' , DeltaVolumeOp -write(*,*) 'DeltaVolumeOp=' , DeltaVolumeOp - if (DeltaVolumeOp > 0.0 .and. MudIsChanged== .false.) then !.and. DrillingMode== .false.) then ! trip in mode(loole paeen) +write(*,*) 'DeltaVolumeOp=' , MudSystemDotDeltaVolumeOp + if (MudSystemDotDeltaVolumeOp > 0.0 .and. MudSystemDotMudIsChanged== .false.) then !.and. DrillingMode== .false.) then ! trip in mode(loole paeen) !write(*,*) 'Tripping In' - NewDensity= (Ann_Density%First()*((StringFlowRate/60.0d0)*DeltaT_Mudline)+Op_Density%Last()*DeltaVolumeOp)/(((StringFlowRate/60.0d0)*DeltaT_Mudline)+DeltaVolumeOp) - NewVolume= ((StringFlowRate/60.0d0)*DeltaT_Mudline)+DeltaVolumeOp + NewDensity= (Ann_Density%First()*((MudSystemDotStringFlowRate/60.0d0)*DeltaT_Mudline)+MudSystemDotOp_Density%Last()*MudSystemDotDeltaVolumeOp)/(((MudSystemDotStringFlowRate/60.0d0)*DeltaT_Mudline)+MudSystemDotDeltaVolumeOp) + MudSystemDotNewVolume= ((MudSystemDotStringFlowRate/60.0d0)*DeltaT_Mudline)+MudSystemDotDeltaVolumeOp !write(*,*) 'St_MudDischarged_Volume%Last()=', St_MudDischarged_Volume%Last(), 'NewVolume=', NewVolume - if (abs(St_Density%Last()-NewDensity)< DensityMixTol) then ! .OR. (St_MudDischarged_Volume%Last()< 42.) ) then !+ NewVolume)< 42.) then ! 1-Pockets are Merged - St_Density%Array(St_Density%Length())= (St_Density%Last()*St_MudDischarged_Volume%Last()+NewDensity*NewVolume)/(St_MudDischarged_Volume%Last()+NewVolume) - St_MudDischarged_Volume%Array(St_Density%Length())= St_MudDischarged_Volume%Last()+DeltaVolumeOp - St_Mud_Forehead_X%Array(St_Density%Length())= (Xend_PipeSection(F_StringIntervalCounts)) + if (abs(St_Density%Last()-NewDensity)< MudSystemDotDensityMixTol) then ! .OR. (St_MudDischarged_Volume%Last()< 42.) ) then !+ NewVolume)< 42.) then ! 1-Pockets are Merged + St_Density%Array(St_Density%Length())= (St_Density%Last()*MudSystemDotSt_MudDischarged_Volume%Last()+NewDensity*MudSystemDotNewVolume)/(MudSystemDotSt_MudDischarged_Volume%Last()+MudSystemDotNewVolume) + MudSystemDotSt_MudDischarged_Volume%Array(St_Density%Length())= MudSystemDotSt_MudDischarged_Volume%Last()+MudSystemDotDeltaVolumeOp + MudSystemDotSt_Mud_Forehead_X%Array(St_Density%Length())= (MudSystemDotXend_PipeSection(F_StringIntervalCounts)) St_Mud_Forehead_section%Array(St_Density%Length())= (F_StringIntervalCounts) - St_Mud_Backhead_X%Array(St_Density%Length())= (Xstart_PipeSection(F_StringIntervalCounts)) + MudSystemDotSt_Mud_Backhead_X%Array(St_Density%Length())= (MudSystemDotXstart_PipeSection(F_StringIntervalCounts)) St_Mud_Backhead_section%Array(St_Density%Length())= (F_StringIntervalCounts) - St_RemainedVolume_in_LastSection%Array(St_Density%Length())= (0.0d0) - St_EmptyVolume_inBackheadLocation%Array(St_Density%Length())= (0.0d0) + MudSystemDotSt_RemainedVolume_in_LastSection%Array(St_Density%Length())= (0.0d0) + MudSystemDotSt_EmptyVolume_inBackheadLocation%Array(St_Density%Length())= (0.0d0) else ! 2-Merging conditions are not meeted, so new pocket call St_Density%Add (NewDensity) - call St_MudDischarged_Volume%Add (NewVolume) - call St_Mud_Forehead_X%Add (Xend_PipeSection(F_StringIntervalCounts)) + call MudSystemDotSt_MudDischarged_Volume%Add (MudSystemDotNewVolume) + call MudSystemDotSt_Mud_Forehead_X%Add (MudSystemDotXend_PipeSection(F_StringIntervalCounts)) call St_Mud_Forehead_section%Add (F_StringIntervalCounts) - call St_Mud_Backhead_X%Add (Xstart_PipeSection(F_StringIntervalCounts)) + call MudSystemDotSt_Mud_Backhead_X%Add (MudSystemDotXstart_PipeSection(F_StringIntervalCounts)) call St_Mud_Backhead_section%Add (F_StringIntervalCounts) - call St_RemainedVolume_in_LastSection%Add (0.0d0) - call St_EmptyVolume_inBackheadLocation%Add (0.0d0) + call MudSystemDotSt_RemainedVolume_in_LastSection%Add (0.0d0) + call MudSystemDotSt_EmptyVolume_inBackheadLocation%Add (0.0d0) call St_MudOrKick%Add (0) endif - elseif (DeltaVolumeOp > 0.0 .and. MudIsChanged== .true.) then + elseif (MudSystemDotDeltaVolumeOp > 0.0 .and. MudSystemDotMudIsChanged== .true.) then St_Density%Array(St_Density%Length())= NewDensity - St_MudDischarged_Volume%Array(St_Density%Length())= NewVolume - St_Mud_Forehead_X%Array(St_Density%Length())= (Xend_PipeSection(F_StringIntervalCounts)) + MudSystemDotSt_MudDischarged_Volume%Array(St_Density%Length())= MudSystemDotNewVolume + MudSystemDotSt_Mud_Forehead_X%Array(St_Density%Length())= (MudSystemDotXend_PipeSection(F_StringIntervalCounts)) St_Mud_Forehead_section%Array(St_Density%Length())= (F_StringIntervalCounts) - St_Mud_Backhead_X%Array(St_Density%Length())= (Xstart_PipeSection(F_StringIntervalCounts)) + MudSystemDotSt_Mud_Backhead_X%Array(St_Density%Length())= (MudSystemDotXstart_PipeSection(F_StringIntervalCounts)) St_Mud_Backhead_section%Array(St_Density%Length())= (F_StringIntervalCounts) - St_RemainedVolume_in_LastSection%Array(St_Density%Length())= (0.0d0) - St_EmptyVolume_inBackheadLocation%Array(St_Density%Length())= (0.0d0) + MudSystemDotSt_RemainedVolume_in_LastSection%Array(St_Density%Length())= (0.0d0) + MudSystemDotSt_EmptyVolume_inBackheadLocation%Array(St_Density%Length())= (0.0d0) endif @@ -447,60 +447,60 @@ write(*,*) 'DeltaVolumeOp=' , DeltaVolumeOp !======================== STRING ==================== - MudIsChanged= .false. + MudSystemDotMudIsChanged= .false. - imud= St_Mud_Forehead_X%Length() + 1 + MudSystemDotimud= MudSystemDotSt_Mud_Forehead_X%Length() + 1 - do while (imud > 1) - imud = imud - 1 + do while (MudSystemDotimud > 1) + MudSystemDotimud = MudSystemDotimud - 1 - if (imud< St_Mud_Forehead_X%Length()) then - St_Mud_Forehead_X%Array(imud)= St_Mud_Backhead_X%Array(imud+1) - St_Mud_Forehead_section%Array(imud)= St_Mud_Backhead_section%Array(imud+1) + if (MudSystemDotimud< MudSystemDotSt_Mud_Forehead_X%Length()) then + MudSystemDotSt_Mud_Forehead_X%Array(MudSystemDotimud)= MudSystemDotSt_Mud_Backhead_X%Array(MudSystemDotimud+1) + St_Mud_Forehead_section%Array(MudSystemDotimud)= St_Mud_Backhead_section%Array(MudSystemDotimud+1) endif - DirectionCoef= (Xend_PipeSection(St_Mud_Forehead_section%Array(imud))-Xstart_PipeSection(St_Mud_Forehead_section%Array(imud))) & - / ABS(Xend_PipeSection(St_Mud_Forehead_section%Array(imud))-Xstart_PipeSection(St_Mud_Forehead_section%Array(imud))) + MudSystemDotDirectionCoef= (MudSystemDotXend_PipeSection(St_Mud_Forehead_section%Array(MudSystemDotimud))-MudSystemDotXstart_PipeSection(St_Mud_Forehead_section%Array(MudSystemDotimud))) & + / ABS(MudSystemDotXend_PipeSection(St_Mud_Forehead_section%Array(MudSystemDotimud))-MudSystemDotXstart_PipeSection(St_Mud_Forehead_section%Array(MudSystemDotimud))) ! +1 for string , -1 for annulus - St_EmptyVolume_inBackheadLocation%Array(imud)= DirectionCoef* (St_Mud_Forehead_X%Array(imud)- Xstart_PipeSection(St_Mud_Forehead_section%Array(imud)))* & - Area_PipeSectionFt(St_Mud_Backhead_section%Array(imud)) !(ft^3) - St_EmptyVolume_inBackheadLocation%Array(imud)= St_EmptyVolume_inBackheadLocation%Array(imud)* 7.48051948d0 ! ft^3 to gal + MudSystemDotSt_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotDirectionCoef* (MudSystemDotSt_Mud_Forehead_X%Array(MudSystemDotimud)- MudSystemDotXstart_PipeSection(St_Mud_Forehead_section%Array(MudSystemDotimud)))* & + MudSystemDotArea_PipeSectionFt(St_Mud_Backhead_section%Array(MudSystemDotimud)) !(ft^3) + MudSystemDotSt_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)= MudSystemDotSt_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)* 7.48051948d0 ! ft^3 to gal - if ( St_MudDischarged_Volume%Array(imud) <= St_EmptyVolume_inBackheadLocation%Array(imud)) then - St_Mud_Backhead_section%Array(imud)= St_Mud_Forehead_section%Array(imud) - St_Mud_Backhead_X%Array(imud)= St_Mud_Forehead_X%Array(imud)- DirectionCoef*(St_MudDischarged_Volume%Array(imud)/7.48051948d0)/Area_PipeSectionFt(St_Mud_Forehead_section%Array(imud)) + if ( MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud) <= MudSystemDotSt_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud)) then + St_Mud_Backhead_section%Array(MudSystemDotimud)= St_Mud_Forehead_section%Array(MudSystemDotimud) + MudSystemDotSt_Mud_Backhead_X%Array(MudSystemDotimud)= MudSystemDotSt_Mud_Forehead_X%Array(MudSystemDotimud)- MudSystemDotDirectionCoef*(MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud)/7.48051948d0)/MudSystemDotArea_PipeSectionFt(St_Mud_Forehead_section%Array(MudSystemDotimud)) ! 7.48051948 is for gal to ft^3 else - isection= St_Mud_Backhead_section%Array(imud)-1 - St_RemainedVolume_in_LastSection%Array(imud)= St_MudDischarged_Volume%Array(imud)- St_EmptyVolume_inBackheadLocation%Array(imud) + MudSystemDotisection= St_Mud_Backhead_section%Array(MudSystemDotimud)-1 + MudSystemDotSt_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud)- MudSystemDotSt_EmptyVolume_inBackheadLocation%Array(MudSystemDotimud) do - if (isection < 1) then ! last pipe section(string exit) - St_MudDischarged_Volume%Array(imud)= St_MudDischarged_Volume%Array(imud)- St_RemainedVolume_in_LastSection%Array(imud) - St_Mud_Backhead_X%Array(imud)= Xstart_PipeSection(2) - St_Mud_Backhead_section%Array(imud)= 2 + if (MudSystemDotisection < 1) then ! last pipe section(string exit) + MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud)= MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud)- MudSystemDotSt_RemainedVolume_in_LastSection%Array(MudSystemDotimud) + MudSystemDotSt_Mud_Backhead_X%Array(MudSystemDotimud)= MudSystemDotXstart_PipeSection(2) + St_Mud_Backhead_section%Array(MudSystemDotimud)= 2 - if (St_MudDischarged_Volume%Array(imud)<= 0.0d0) then ! imud is completely exited form the string - call RemoveStringMudArrays(imud) + if (MudSystemDotSt_MudDischarged_Volume%Array(MudSystemDotimud)<= 0.0d0) then ! imud is completely exited form the string + call RemoveStringMudArrays(MudSystemDotimud) endif exit endif - xx= St_RemainedVolume_in_LastSection%Array(imud)/ PipeSection_VolumeCapacity(isection) !(gal) + MudSystemDotxx= MudSystemDotSt_RemainedVolume_in_LastSection%Array(MudSystemDotimud)/ MudSystemDotPipeSection_VolumeCapacity(MudSystemDotisection) !(gal) - if (xx<= 1.0) then - St_Mud_Backhead_section%Array(imud)= isection - St_Mud_Backhead_X%Array(imud)= (xx * (Xstart_PipeSection(isection)- Xend_PipeSection(isection)))+ Xend_PipeSection(isection) + if (MudSystemDotxx<= 1.0) then + St_Mud_Backhead_section%Array(MudSystemDotimud)= MudSystemDotisection + MudSystemDotSt_Mud_Backhead_X%Array(MudSystemDotimud)= (MudSystemDotxx * (MudSystemDotXstart_PipeSection(MudSystemDotisection)- MudSystemDotXend_PipeSection(MudSystemDotisection)))+ MudSystemDotXend_PipeSection(MudSystemDotisection) exit else - St_RemainedVolume_in_LastSection%Array(imud)= St_RemainedVolume_in_LastSection%Array(imud)- PipeSection_VolumeCapacity(isection) - isection= isection- 1 + MudSystemDotSt_RemainedVolume_in_LastSection%Array(MudSystemDotimud)= MudSystemDotSt_RemainedVolume_in_LastSection%Array(MudSystemDotimud)- MudSystemDotPipeSection_VolumeCapacity(MudSystemDotisection) + MudSystemDotisection= MudSystemDotisection- 1 endif diff --git a/FluidFlow/Annulus_and_Openhole_Pressure_Distribution.f90 b/FluidFlow/Annulus_and_Openhole_Pressure_Distribution.f90 index cfcccb7..573f203 100644 --- a/FluidFlow/Annulus_and_Openhole_Pressure_Distribution.f90 +++ b/FluidFlow/Annulus_and_Openhole_Pressure_Distribution.f90 @@ -45,21 +45,21 @@ IF (WellHeadOpen .OR. NoGasPocket == 0) THEN !! (mud circulation is normal we !WRITE (*,*) 'StringFlowRate', StringFlowRate FlowEl(AnnulusFirstEl : OpenholeFirstEl - 1)%FlowRate = (ClingingFactor * FlowEl(AnnulusFirstEl : OpenholeFirstEl - 1)%Area + FlowEl(StringFirstEl)%Area) * DrillStringSpeed * ConvMintoSec * Convft3toUSgal ! flowrate in annulus due to tripping - FlowEl(AnnulusFirstEl : OpenholeFirstEl - 1)%FlowRate = FlowEl(AnnulusFirstEl : OpenholeFirstEl - 1)%FlowRate + REAL(MudVolume_InjectedToBH) * ConvMintoSec / dt ! flowrate in annulus due to pump + FlowEl(AnnulusFirstEl : OpenholeFirstEl - 1)%FlowRate = FlowEl(AnnulusFirstEl : OpenholeFirstEl - 1)%FlowRate + REAL(MudSystemDotMudVolume_InjectedToBH) * ConvMintoSec / dt ! flowrate in annulus due to pump !WRITE (*,*) 'Drillstring speed (ft/s)' , FlowEl(j)%FlowRate !IF (NoWellToChokeEl > 0) THEN ! flowrate in choke line ! FlowEl(NoHorizontalEl + NoStringEl + NoAnnulusEl + 1 : NoHorizontalEl + NoStringEl + NoAnnulusEl + NoWellToChokeEl)%FlowRate = AnnulusFlowRate + (DeltaVolumePipe * ConvMinToSec / dt) !END IF - IF (ShoeFractured) THEN ! reduction of flowrate due to formation fracture and lost circulation + IF (MudSystemDotShoeFractured) THEN ! reduction of flowrate due to formation fracture and lost circulation !WRITE (*,*) ' SHoe fractured', PressureGauges(5), FlowEl(ShoeFlowElNo)%FlowRate IF (ShoeFlowElNo > AnnulusLastEl) THEN ! shoe is in openhole - FlowEl(ShoeFlowElNo : NumbEl)%FlowRate = - QLost - FlowEl(AnnulusFirstEl : OpenholeFirstEl - 1)%FlowRate = FlowEl(AnnulusFirstEl : OpenholeFirstEl - 1)%FlowRate - QLost + FlowEl(ShoeFlowElNo : NumbEl)%FlowRate = - MudSystemDotQlost + FlowEl(AnnulusFirstEl : OpenholeFirstEl - 1)%FlowRate = FlowEl(AnnulusFirstEl : OpenholeFirstEl - 1)%FlowRate - MudSystemDotQlost ELSE ! shoe is in annulus - FlowEl(ShoeFlowElNo : OpenholeFirstEl - 1)%FlowRate = FlowEl(ShoeFlowElNo : OpenholeFirstEl - 1)%FlowRate - QLost + FlowEl(ShoeFlowElNo : OpenholeFirstEl - 1)%FlowRate = FlowEl(ShoeFlowElNo : OpenholeFirstEl - 1)%FlowRate - MudSystemDotQlost END IF END IF @@ -141,7 +141,7 @@ IF (WellHeadOpen .OR. NoGasPocket == 0) THEN !! (mud circulation is normal we IF (FlowEl(OpenholeFirstEl - 1)%FlowRate < 0.0) THEN WRITE (*,*) ' Negative choke flowrate' - FlowEl(OpenholeFirstEl - 1)%FlowRate = MAX((REAL(MudVolume_InjectedToBH) * ConvMintoSec / dt) , 10.0) + FlowEl(OpenholeFirstEl - 1)%FlowRate = MAX((REAL(MudSystemDotMudVolume_InjectedToBH) * ConvMintoSec / dt) , 10.0) END IF !Kchoke = ChokeDensity / ((2. * 89158.0) * (0.26 * 0.61 * TotalOpenChokeArea)**2) deltaPchoke = (Kchoke * FlowEl(OpenholeFirstEl - 1)%FlowRate * ABS(FlowEl(OpenholeFirstEl - 1)%FlowRate)) * 1.d0 diff --git a/FluidFlow/Fluid_Flow_Solver.f90 b/FluidFlow/Fluid_Flow_Solver.f90 index 55b0c3e..c340812 100644 --- a/FluidFlow/Fluid_Flow_Solver.f90 +++ b/FluidFlow/Fluid_Flow_Solver.f90 @@ -21,7 +21,7 @@ subroutine Fluid_Flow_Solver !WRITE (*,*) ' fluid flow pointer 2' - FluidFlowCounter = FluidFlowCounter + 1 + MudSystemDotFluidFlowCounter = MudSystemDotFluidFlowCounter + 1 call CirculationCodeSelect diff --git a/FluidFlow/Horizontal_and_String_Pressure_Distribution.f90 b/FluidFlow/Horizontal_and_String_Pressure_Distribution.f90 index a8dd1e4..200dea1 100644 --- a/FluidFlow/Horizontal_and_String_Pressure_Distribution.f90 +++ b/FluidFlow/Horizontal_and_String_Pressure_Distribution.f90 @@ -52,10 +52,10 @@ SUBROUTINE PressureHorizAndStringDistribution KickWasExitingThroughChoke = .FALSE. - IF (UtubeMode1Activated .OR. FloatValveWasOpen == .FALSE.) THEN ! Horizontal line flow rate + IF (MudSystemDotUtubeMode1Activated .OR. FloatValveWasOpen == .FALSE.) THEN ! Horizontal line flow rate FlowEl(1 : NoHorizontalEl)%FlowRate = 0.0 ELSE ! connection and line is open - FlowEl(1 : NoHorizontalEl)%FlowRate = StringFlowRate ! pump flow rate [gpm] + FlowEl(1 : NoHorizontalEl)%FlowRate = MudSystemDotStringFlowRate ! pump flow rate [gpm] END IF !WRITE (*,*) 'a)A/B P Bit', StaticHeadOnBit , FlowEl(AnnulusFirstEl)%StartPress , SUM(FlowEl(StringFirstEl : StringLastEl)%StaticPressDiff) @@ -87,15 +87,15 @@ SUBROUTINE PressureHorizAndStringDistribution ELSE ! No gas pocket, wellhead is closed and mud is compressed based on volume pumped into annulus AnnDeltaPtoDeltaVCompressibility = 1.0 / (MudCompressibility * AnnMudVol) - AnnCompressedMudVol = AnnCompressedMudVol + REAL(Ann_Saved_MudDischarged_Volume_Final) !!!!!!!!! - AnnCompressedMudVol = MAX((AnnCompressedMudVol - REAL(Qlost / ConvMinToSec / dt)) , 0.0) + AnnCompressedMudVol = AnnCompressedMudVol + REAL(MudSystemDotAnn_Saved_MudDischarged_Volume_Final) !!!!!!!!! + AnnCompressedMudVol = MAX((AnnCompressedMudVol - REAL(MudSystemDotQlost / ConvMinToSec / dt)) , 0.0) AnnDeltaPDueToCompressibility = AnnCompressedMudVol / (MudCompressibility * AnnMudVol) END IF - IF (FloatValveIn == .FALSE. .OR. NoGasPocket == 0 .OR. (FloatValveWasOpen .AND. REAL(St_Saved_MudDischarged_Volume_Final) >= PumpMinDischargedVol)) THEN ! float valve remains open + IF (FloatValveIn == .FALSE. .OR. NoGasPocket == 0 .OR. (FloatValveWasOpen .AND. REAL(MudSystemDotSt_Saved_MudDischarged_Volume_Final) >= PumpMinDischargedVol)) THEN ! float valve remains open FloatValveOpen = .TRUE. - FlowEl(StringFirstEl : StringLastEl)%FlowRate = REAL(St_Saved_MudDischarged_Volume_Final) / dt * ConvMinToSec !StringFlowRate ! String flow rate pump flow rate [gpm] + FlowEl(StringFirstEl : StringLastEl)%FlowRate = REAL(MudSystemDotSt_Saved_MudDischarged_Volume_Final) / dt * ConvMinToSec !StringFlowRate ! String flow rate pump flow rate [gpm] !!!!!!!!!!!!!!! Calculating frictional pressure loss IF (WellHeadOpen) THEN @@ -114,41 +114,41 @@ SUBROUTINE PressureHorizAndStringDistribution !IF (ABS(MudVolume_InjectedToBH - St_Saved_MudDischarged_Volume_Final)> PumpMinDischargedVol) WRITE (*,*) 'Injected to BH & St Saved Mud', MudVolume_InjectedToBH , St_Saved_MudDischarged_Volume_Final IF (BitTotallyPluged) THEN - MudVolume_InjectedToBH = 0.d0 - StCompressedMudVol = StCompressedMudVol + REAL(St_Saved_MudDischarged_Volume_Final) + MudSystemDotMudVolume_InjectedToBH = 0.d0 + StCompressedMudVol = StCompressedMudVol + REAL(MudSystemDotSt_Saved_MudDischarged_Volume_Final) StDeltaPDueToCompressibility = StCompressedMudVol * StDeltaPtoDeltaVCompressibility ELSE IF (WellHeadOpen .OR. NoGasPocket > 0) THEN - IF (REAL(St_Saved_MudDischarged_Volume_Final) >= PumpMinDischargedVol) THEN + IF (REAL(MudSystemDotSt_Saved_MudDischarged_Volume_Final) >= PumpMinDischargedVol) THEN - MudVolume_InjectedToBH = St_Saved_MudDischarged_Volume_Final + MudSystemDotMudVolume_InjectedToBH = MudSystemDotSt_Saved_MudDischarged_Volume_Final !WRITE (*,*) 'MudVolume_InjectedToBH,BitTrue', MudVolume_InjectedToBH !IF (BitTrue .AND. UtubeMode1Activated == .FALSE.) THEN IF (BitTrue) THEN - BitPressLoss = KBit * (MudVolume_InjectedToBH * ConvMinToSec / dt)**2 + BitPressLoss = KBit * (MudSystemDotMudVolume_InjectedToBH * ConvMinToSec / dt)**2 !WRITE (*,*) 'BitPressLoss', BitPressLoss END IF StCompressedMudVol = BitPressLoss / StDeltaPtoDeltaVCompressibility ELSE - MudVolume_InjectedToBH = MAX( 0.d0 , REAL((StDeltaPDueToCompressibility + SUM(FlowEl(StringFirstEl : StringLastEl)%StaticPressDiff - PressBelowFloatValve - AnnDeltaPDueToCompressibility - FloatValveMinOpenPressure) & + MudSystemDotMudVolume_InjectedToBH = MAX( 0.d0 , REAL((StDeltaPDueToCompressibility + SUM(FlowEl(StringFirstEl : StringLastEl)%StaticPressDiff - PressBelowFloatValve - AnnDeltaPDueToCompressibility - FloatValveMinOpenPressure) & / StDeltaPtoDeltaVCompressibility ) * 1.d0)) - MudVolume_InjectedToBH = MIN(MudVolume_InjectedToBH , StCompressedMudVol) - StCompressedMudVol = StCompressedMudVol - MudVolume_InjectedToBH + MudSystemDotMudVolume_InjectedToBH = MIN(MudSystemDotMudVolume_InjectedToBH , StCompressedMudVol) + StCompressedMudVol = StCompressedMudVol - MudSystemDotMudVolume_InjectedToBH END IF StDeltaPDueToCompressibility = StCompressedMudVol / (MudCompressibility * StMudVol) ELSE ! IF (NoGasPocket == 0 .AND. WellHeadOpen == .FALSE.) THEN - StCompressedMudVol = StCompressedMudVol + REAL(St_Saved_MudDischarged_Volume_Final) + StCompressedMudVol = StCompressedMudVol + REAL(MudSystemDotSt_Saved_MudDischarged_Volume_Final) StDeltaPDueToCompressibility = StCompressedMudVol * StDeltaPtoDeltaVCompressibility - MudVolume_InjectedToBH = MAX( 0.d0 , REAL((StDeltaPDueToCompressibility - AnnDeltaPDueToCompressibility - FloatValveMinOpenPressure) & + MudSystemDotMudVolume_InjectedToBH = MAX( 0.d0 , REAL((StDeltaPDueToCompressibility - AnnDeltaPDueToCompressibility - FloatValveMinOpenPressure) & / (StDeltaPtoDeltaVCompressibility + AnnDeltaPtoDeltaVCompressibility)) * 1.d0) - MudVolume_InjectedToBH = MIN(MudVolume_InjectedToBH , StCompressedMudVol) - StCompressedMudVol = StCompressedMudVol - REAL(MudVolume_InjectedToBH) + MudSystemDotMudVolume_InjectedToBH = MIN(MudSystemDotMudVolume_InjectedToBH , StCompressedMudVol) + StCompressedMudVol = StCompressedMudVol - REAL(MudSystemDotMudVolume_InjectedToBH) StDeltaPDueToCompressibility = StCompressedMudVol / (MudCompressibility * StMudVol) FlowEl(AnnulusFirstEl : NumbEl)%StartPress = FlowEl(AnnulusFirstEl : NumbEl)%StartPress + StDeltaPDueToCompressibility FlowEl(AnnulusFirstEl : NumbEl)%EndPress = FlowEl(AnnulusFirstEl : NumbEl)%EndPress + StDeltaPDueToCompressibility @@ -182,14 +182,14 @@ SUBROUTINE PressureHorizAndStringDistribution !!!!!!!!!!!!!!!!!!!!!!!!!!!! Float valve was open and remains open - ELSE IF (REAL(St_Saved_MudDischarged_Volume_Final) < PumpMinDischargedVol) THEN ! NoGasPocket > 0 + ELSE IF (REAL(MudSystemDotSt_Saved_MudDischarged_Volume_Final) < PumpMinDischargedVol) THEN ! NoGasPocket > 0 FloatValveOpen = FloatValveWasOpen ! remains in its former status IF (FloatValveOpen) THEN PressAboveFloatValve = MAX(FlowEl(AnnulusFirstEl)%StartPress , SUM(FlowEl(StringFirstEl : StringLastEl)%StaticPressDiff) + 0.052 * FlowEl(StringFirstEl)%Density * FlowEl(StringFirstEl)%StartTVD) ELSE PressAboveFloatValve = SUM(FlowEl(StringFirstEl : StringLastEl)%StaticPressDiff) + StDeltaPDueToCompressibility - MudVolume_InjectedToBH = 0.d0 + MudSystemDotMudVolume_InjectedToBH = 0.d0 END IF @@ -204,12 +204,12 @@ SUBROUTINE PressureHorizAndStringDistribution END IF IF (FloatValveOpen) THEN - MudVolume_InjectedToBH = MAX( 0.d0 , 0.1 * REAL((PressAboveFloatValve - PressBelowFloatValve - AnnDeltaPDueToCompressibility - FloatValveMinOpenPressure) & + MudSystemDotMudVolume_InjectedToBH = MAX( 0.d0 , 0.1 * REAL((PressAboveFloatValve - PressBelowFloatValve - AnnDeltaPDueToCompressibility - FloatValveMinOpenPressure) & / StDeltaPtoDeltaVCompressibility ) * 1.d0) - MudVolume_InjectedToBH = MIN(MudVolume_InjectedToBH , StCompressedMudVol) + MudSystemDotMudVolume_InjectedToBH = MIN(MudSystemDotMudVolume_InjectedToBH , StCompressedMudVol) !WRITE (*,*) 'MudVolume_InjectedToBH (No Pump)', MudVolume_InjectedToBH - StCompressedMudVol = StCompressedMudVol - MudVolume_InjectedToBH + StCompressedMudVol = StCompressedMudVol - MudSystemDotMudVolume_InjectedToBH StDeltaPDueToCompressibility = StCompressedMudVol / (MudCompressibility * StMudVol) !WRITE (*,*) 'StDeltaPDueToCompressibility(No Pump)', StDeltaPDueToCompressibility @@ -251,11 +251,11 @@ SUBROUTINE PressureHorizAndStringDistribution !WRITE (*,*) ' AnnCompressedMudVol, AnnDeltaPDueToCompressibility',AnnCompressedMudVol, AnnDeltaPDueToCompressibility !!!!!!!!!!!!!!!!!!!!!!!!!!!! Float valve was open (close) and maybe remains open (close) or maybe closed - ELSE IF(FloatValveWasOpen == .FALSE. .AND. REAL(St_Saved_MudDischarged_Volume_Final) >= PumpMinDischargedVol) THEN + ELSE IF(FloatValveWasOpen == .FALSE. .AND. REAL(MudSystemDotSt_Saved_MudDischarged_Volume_Final) >= PumpMinDischargedVol) THEN FloatValveOpen = .FALSE. - MudVolume_InjectedToBH = 0.d0 + MudSystemDotMudVolume_InjectedToBH = 0.d0 - StCompressedMudVol = StCompressedMudVol + REAL(St_Saved_MudDischarged_Volume_Final) + StCompressedMudVol = StCompressedMudVol + REAL(MudSystemDotSt_Saved_MudDischarged_Volume_Final) StDeltaPDueToCompressibility = StCompressedMudVol * StDeltaPtoDeltaVCompressibility PressAboveFloatValve = SUM(FlowEl(StringFirstEl : StringLastEl)%StaticPressDiff) + StDeltaPDueToCompressibility @@ -284,7 +284,7 @@ SUBROUTINE PressureHorizAndStringDistribution END IF - IF ((UtubePossibility == .TRUE. .AND. Get_KellyConnection() /= KELLY_CONNECTION_STRING) .OR. NewPipeFilling == 0) THEN + IF ((MudSystemDotUtubePossibility == .TRUE. .AND. Get_KellyConnection() /= KELLY_CONNECTION_STRING) .OR. MudSystemDotNewPipeFilling == 0) THEN FlowEl(NoHorizontalEl)%EndPress = 0.0 ELSE IF (WellHeadOpen == .FALSE.) THEN FlowEl(NoHorizontalEl)%EndPress = FlowEl(StringFirstEl)%StartPress - 0.052 * FlowEl(NoHorizontalEl)%Density * FlowEl(StringFirstEl)%StartTVD @@ -335,8 +335,8 @@ SUBROUTINE PressureHorizAndStringDistribution !END IF - IF (UtubePossibility== .true. .and. Get_KellyConnection() /= KELLY_CONNECTION_STRING .and. WellHeadOpen) THEN - MudVolume_InjectedToBH = 0.d0 + IF (MudSystemDotUtubePossibility== .true. .and. Get_KellyConnection() /= KELLY_CONNECTION_STRING .and. WellHeadOpen) THEN + MudSystemDotMudVolume_InjectedToBH = 0.d0 MudVolume_InjectedFromAnn = 0.d0 !ELSE @@ -538,8 +538,8 @@ SUBROUTINE PressureHorizAndStringDistribution !IF (PressureGauges(5) >= FormationLostPressure) WRITE (*,*) 'Near Shoe Flowrate', FlowEl(ShoeFlowElNo)%FlowRate - ShoeMudViscosity = FlowEl(ShoeFlowElNo)%MuEff - ShoeMudDensity = FlowEl(ShoeFlowElNo)%Density + MudSystemDotShoeMudViscosity = FlowEl(ShoeFlowElNo)%MuEff + MudSystemDotShoeMudDensity = FlowEl(ShoeFlowElNo)%Density !WRITE (*,*) 'Drillstring speed (ft/s)' , DrillStringSpeed !WRITE (*,*) 'shoe mud speed ', FlowEl(ShoeFlowElNo - 1)%vel diff --git a/FluidFlow/Well_Pressure_Data_Transfer.f90 b/FluidFlow/Well_Pressure_Data_Transfer.f90 index 4a492ad..9cd0487 100644 --- a/FluidFlow/Well_Pressure_Data_Transfer.f90 +++ b/FluidFlow/Well_Pressure_Data_Transfer.f90 @@ -88,12 +88,12 @@ SUBROUTINE WellPressureDataTransfer !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - NoHorizontalEl = NoHorizontalMudElements - NoStringEl = NoStringMudElements - NoAnnulusEl = NoCasingMudElements + NoHorizontalEl = MudSystemDotNoHorizontalMudElements + NoStringEl = MudSystemDotNoStringMudElements + NoAnnulusEl = MudSystemDotNoCasingMudElements NoWellToChokeEl = 0 - IF (ChokeKroneckerDelta == 1) NoWellToChokeEl = ChokeLine_Density%Length() - NoOpenHoleEl = NoBottomHoleMudElements + IF (ChokeKroneckerDelta == 1) NoWellToChokeEl = MudSystemDotChokeLine_Density%Length() + NoOpenHoleEl = MudSystemDotNoBottomHoleMudElements NumbEl = NoHorizontalEl + NoStringEl + NoAnnulusEl + NoWellToChokeEl + NoOpenHoleEl !WRITE (*,*) 'H, S, A, Ch, O', NoHorizontalEl , NoStringEl , NoAnnulusEl , NoWellToChokeEl , NoOpenHoleEl IF(ALLOCATED(FlowEl)) DEALLOCATE(FlowEl) @@ -230,13 +230,13 @@ SUBROUTINE WellPressureDataTransfer !ChokeLastEl = OpenholeFirstEl - 1 j = 1 DO i = NoHorizontalEl + NoStringEl + NoAnnulusEl + 1 , NoHorizontalEl + NoStringEl + NoAnnulusEl + NoWelltoChokeEl - FlowEl(i)%StartX = ChokeLine_Mud_Backhead_X%Array(j) - FlowEl(i)%EndX = ChokeLine_Mud_Forehead_X%Array(j) + FlowEl(i)%StartX = MudSystemDotChokeLine_Mud_Backhead_X%Array(j) + FlowEl(i)%EndX = MudSystemDotChokeLine_Mud_Forehead_X%Array(j) FlowEl(i)%StartTVD = 0.d0 FlowEl(i)%EndTVD = 0.d0 FlowEl(i)%Id = 0.0 FlowEl(i)%Od = BopStackSpecification%ChokeLineId - FlowEl(i)%density = ChokeLine_Density%Array(j) + FlowEl(i)%density = MudSystemDotChokeLine_Density%Array(j) FlowEl(i)%Dhyd = FlowEl(i)%Od FlowEl(i)%Length = ABS(FlowEl(i)%EndX - FlowEl(i)%StartX) @@ -403,14 +403,14 @@ SUBROUTINE WellPressureDataTransfer IF (NoGasPocket > 0) THEN !IF (NoWelltoChokeEl > 0 .AND. (FlowEl(OpenholeFirstEl - 1)%MaterialType == 1 .OR. KickWasExitingThroughChoke) .AND. WellHeadOpen) THEN - IF (Choke_Kick_Saved_Volume_Final > 0.d0) THEN + IF (MudSystemDotChoke_Kick_Saved_Volume_Final > 0.d0) THEN !WRITE (*,*) 'Choke_Kick_Saved_Volume_Final=', Choke_Kick_Saved_Volume_Final, (GasPocketModifiedVol%Array(NoGasPocket) * Convft3ToUSgal) - ExitMass = REAL(Choke_Kick_Saved_Volume_Final / (GasPocketModifiedVol%Array(NoGasPocket) * Convft3ToUSgal)) * GasPocketWeight%Array(NoGasPocket) + ExitMass = REAL(MudSystemDotChoke_Kick_Saved_Volume_Final / (GasPocketModifiedVol%Array(NoGasPocket) * Convft3ToUSgal)) * GasPocketWeight%Array(NoGasPocket) !IF (NoGasPocket > 1) ExitMass = ExitMass + (SUM(GasPocketDeltaVol%Array(1 : NoGasPocket - 1)) / GasPocketNewVol%Array(NoGasPocket)) * GasPocketWeight%Array(NoGasPocket) !WRITE (*,*) 'Total Exit mass=' , ExitMass !, DeltaVolumePipe, StringFlowRate * dt / ConvMinToSec IF (FlowEl(OpenholeFirstEl - 1)%MaterialType /= 1) THEN CALL RemoveGasPocket(NoGasPocket) - WRITE (*,*) 'Choke_Kick_Saved_Volume_Final=', Choke_Kick_Saved_Volume_Final + WRITE (*,*) 'Choke_Kick_Saved_Volume_Final=', MudSystemDotChoke_Kick_Saved_Volume_Final END IF END IF @@ -604,7 +604,7 @@ SUBROUTINE GasPocketFlowElementTransformer i = OpenholeFirstEl - 1 !WRITE (*,*) 'MaterialType, NoWelltoChokeEl', FlowEl(i)%MaterialType , NoWelltoChokeEl !IF (NoWelltoChokeEl > 0 .AND. FlowEl(OpenholeFirstEl - 1)%MaterialType == 1 .AND. WellHeadOpen) THEN ! kick is last element in choke line and does not exit. - IF (Choke_Kick_Saved_Volume_Final > 0.d0 .AND. WellHeadOpen) THEN + IF (MudSystemDotChoke_Kick_Saved_Volume_Final > 0.d0 .AND. WellHeadOpen) THEN WRITE (*,*) 'Kick is exiting through the choke' !ExitMass = GasPocketDensity%Array(NoGasPocket) * (SUM(GasPocketFlowInduced%Array(:)) + (DeltaVolumePipe * ConvMinToSec / dt) + StringFlowRate) / ConvMinToSec * dt GasPocketWeight%Array(NoGasPocket) = GasPocketweight%Array(NoGasPocket) - ExitMass diff --git a/FluidFlow/kick/Formation_Information.f90 b/FluidFlow/kick/Formation_Information.f90 index 4f86f72..6e02075 100644 --- a/FluidFlow/kick/Formation_Information.f90 +++ b/FluidFlow/kick/Formation_Information.f90 @@ -76,7 +76,7 @@ SUBROUTINE FormationInformationCalculator end if !PermeabilityExposedHeight = KickFormLength * FormationPermeability - DownHole%PermeabilityExposedHeight = FluidFlowCounter - MudSys_timeCounter + DownHole%PermeabilityExposedHeight = MudSystemDotFluidFlowCounter - MudSystemDotMudSys_timeCounter !==================================================== ! Reservoir Data !==================================================== diff --git a/FluidFlow/kick/Gas_Kick_Calculator.f90 b/FluidFlow/kick/Gas_Kick_Calculator.f90 index 29586a1..99420e8 100644 --- a/FluidFlow/kick/Gas_Kick_Calculator.f90 +++ b/FluidFlow/kick/Gas_Kick_Calculator.f90 @@ -399,9 +399,9 @@ SUBROUTINE NewGasKick WRITE (*,*) ' New Influx 1' NoGasPocket = 1 - NewInfluxNumber = NewInfluxNumber + 1 + MudSystemDotNewInfluxNumber = MudSystemDotNewInfluxNumber + 1 - NewInfluxElementCreated = 0 + MudSystemDotNewInfluxElementCreated = 0 KickOffBottom = .FALSE. @@ -477,9 +477,9 @@ SUBROUTINE NewGasKick NoGasPocket = NoGasPocket + 1 - NewInfluxNumber = NewInfluxNumber + 1 + MudSystemDotNewInfluxNumber = MudSystemDotNewInfluxNumber + 1 - NewInfluxElementCreated = 0 + MudSystemDotNewInfluxElementCreated = 0 KickOffBottom = .FALSE. CALL GasPocketOldPress%AddToFirst((BottomHolePress + StandardPress) * 1.d0) diff --git a/Rop/JetImpactForce.f90 b/Rop/JetImpactForce.f90 index f61a161..c0b68a1 100644 --- a/Rop/JetImpactForce.f90 +++ b/Rop/JetImpactForce.f90 @@ -15,7 +15,7 @@ subroutine JetImpactForce - Bit_Flowrate = StringFlowRateFinal ![gpm] + Bit_Flowrate = MudSystemDotStringFlowRateFinal ![gpm] !print*, 'Bit_Flowrate=' , Bit_Flowrate !check :: Mud_Density [ppg] ?????????? diff --git a/Rop/ROP_MainCalculation.f90 b/Rop/ROP_MainCalculation.f90 index ecea339..478a92e 100644 --- a/Rop/ROP_MainCalculation.f90 +++ b/Rop/ROP_MainCalculation.f90 @@ -84,12 +84,12 @@ subroutine ROP_MainCalculation Critical_Weight_on_Bit = (Formation%Formations(FormationNumber)%ThresholdWeight/5.d0)-(.06d0*(Formation%Formations(FormationNumber)%ThresholdWeight-10.d0)) ! unit : [klb/in] (Typical Range: 0 to 10 ----> 0.6 to 2) !IF (ALLOCATED(FlowEl)) THEN ! Mud_Viscosity = FlowEl(NoHorizontalEl + NoStringEl)%mueff !13.5 [cP] - Mud_Density = BitMudDensity ! [ppg] + Mud_Density = MudSystemDotBitMudDensity ! [ppg] !ELSE Mud_Viscosity = 13.5 ! [cP] !Mud_Density = 9.2 ! [ppg] !END IF - Mud_Flowrate = StringFlowRateFinal ! [gpm] + Mud_Flowrate = MudSystemDotStringFlowRateFinal ! [gpm] Reynolds_Number = Mud_Flowrate*Mud_Density/(Mud_Viscosity*Number_of_Bit_Nozzles*Diameter_of_Bit_Nozzle) ! unit : [dimensionless] (Typical Range: 0.1 to 1000.0) ! $$$$$**$$$$$**$$$$$**$$$$$**$$$$ End of Variable Initialization $$$$$**$$$$$**$$$$$**$$$$$**$$$$$