subroutine Kick_Influx ! is called in subroutine CirculationCodeSelect Use GeoElements_FluidModule USE CMudPropertiesVariables USE MudSystemVARIABLES USE Pump_VARIABLES use CDrillWatchVariables use CTanksVariables, TripTankVolume2 => TripTankVolume, TripTankDensity2 => TripTankDensity USE sROP_Other_Variables USE sROP_Variables Use KickVariables implicit none !===========================================================WELL============================================================ !===========================================================WELL============================================================ !write(*,*) 'Kick Influx' !=================== Bottom Hole Kick Influx ENTRANCE(due to Kick) =================== Kick_Density= 2 NewInflux_Density= Kick_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)) call Op_Mud_Forehead_section%AddToFirst (1) call Op_Mud_Backhead_X%AddToFirst (Xstart_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 NewInfluxElementCreated= 1 endif Op_MudDischarged_Volume%Array(1)= Op_MudDischarged_Volume%Array(1)+ ((GasKickPumpFlowRate/60.0d0)*DeltaT_Mudline) !(gal) due to KickFlux !write(*,*) 'kick volume ok=' , Op_MudDischarged_Volume%Array(1) end subroutine Kick_Influx subroutine Instructor_CirculationMud_Edit ! is called in subroutine CirculationCodeSelect Use KickVariables Use MudSystemVARIABLES USE TD_DrillStemComponents Use CUnityInputs Use CUnityOutputs USE CKellyConnectionEnumVariables USE UTUBEVARS use sROP_Variables use sROP_Other_Variables use CDownHoleVariables implicit none if ( AnnDrillMud == .true. .and. (Rate_of_Penetration>0. .and. DeltaVolumeOp>0.0) ) then do imud= 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 endif enddo endif if ( AnnCirculateMud == .true. ) then do imud= 1, Ann_Density%Length() if ( Ann_MudOrKick%Array(imud) == 0 ) then Ann_Density%Array(imud)= ActiveTankDensity Ann_CuttingMud%Array(imud)= 0 endif enddo do imud= 1, St_Density%Length() St_Density%Array(imud)= ActiveTankDensity enddo endif end subroutine Instructor_CirculationMud_Edit subroutine ShoeLostSub ! is called in subroutine CirculationCodeSelect Use KickVariables Use MudSystemVARIABLES USE TD_DrillStemComponents Use CUnityInputs Use CUnityOutputs USE CKellyConnectionEnumVariables USE UTUBEVARS use sROP_Variables use sROP_Other_Variables use CDownHoleVariables use CShoeVariables USE PressureDisplayVARIABLES Use CWarningsVariables implicit none ShoeLost= .false. Kickexpansion_DueToMudLost= .false. ShoeMudPressure= PressureGauges(5) UGBOSuccessionCounter = UGBOSuccessionCounter + 1 !write(*,*) 'check point 1' if (InactiveFracture == .FALSE. .AND. ((ShoeMudPressure >= FormationLostPressure) .or. ShoeFractured )) 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 return else UGBOSuccessionCounterOld= UGBOSuccessionCounter endif if ( UGBOSuccessionCounter < 10 .and. ShoeFractured==.false.) then return endif !write(*,*) 'check point 3 ,UGBOSuccessionCounter' , UGBOSuccessionCounter ShoeFractured= .true. ShoeMudViscosity= MAX(ShoeMudViscosity, 12.d0) !write(*,*) 'ShoeMudDensity , ShoeMudViscosity' , ShoeMudDensity , ShoeMudViscosity ShoeLostCoef = 10.**(-8) * 1.15741d0 * 7.08d0 * 1000000.d0 * 1.d0 * ShoeMudDensity / & (ShoeMudViscosity * 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. else ShoeLost= .false. endif !write(*,*) 'Qlost=' , Qlost, ShoeMudPressure, FormationLostPressure call Activate_UndergroundBlowout() do imud= 1, Ann_Mud_Forehead_X%Length() IF ( ShoeLost .and. ShoeDepth < Ann_Mud_Backhead_X%Array(imud) .and. ShoeDepth >= Ann_Mud_Forehead_X%Array(imud) & .and. Ann_MudOrKick%Array(imud) == 0 .and. WellHeadIsOpen == .FALSE. ) then Kickexpansion_DueToMudLost= .true. write(*,*) 'Kickexpansion_DueToMudLost' EXIT ENDIF enddo endif if (UndergroundBlowout == .false.) ShoeLost= .false. end subroutine ShoeLostSub