|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235 |
- subroutine Kick_Expansion ! is called in subroutine CirculationCodeSelect
-
- Use GeoElements_FluidModule
- USE CMudPropertiesVariables
- USE MudSystemVARIABLES
- USE Pumps_VARIABLES
- use CDrillWatchVariables
- !use CTanksVariables, TripTankVolume2 => DrillingWatch%TripTankVolume, TripTankDensity2 => TripTankDensity
- USE sROP_Other_Variables
- USE sROP_Variables
- USE CReservoirVariables
- USE KickVARIABLES
-
-
- implicit none
- real(8) ExpansionVolume
-
-
- !write(*,*) 'Kick Expansion'
-
- ExpansionVolume= GasPocketDeltaVol%Array(NewInfluxNumber - KickNumber + 1) * 7.48
-
- IF ( Kickexpansion_DueToMudLost ) ExpansionVolume = ((Qlost/60.0d0)*DeltaT_Mudline)
-
-
- !============================== kick zire mate bashad ==============================
-
- if (Op_KickLoc > 0 .and. Ann_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
-
-
- !if (MUD(4)%Q > 0.) then
- !
- ! if (abs(ChokeLine_Density%Array(1)-Ann_Density%Last())< DensityMixTol) then
- ! ChokeLine_MudDischarged_Volume%Array(1)= ChokeLine_MudDischarged_Volume%Array(1) + ExpansionVolume
- ! else
- ! call ChokeLine_Density%AddToFirst (Ann_Density%Last())
- ! call ChokeLine_MudDischarged_Volume%AddToFirst (ExpansionVolume) ! farz kardam ke hameye hajm ro ba yek density ezafe konim
- ! call ChokeLine_Mud_Forehead_X%AddToFirst (0.0d0)
- ! call ChokeLine_Mud_Forehead_section%AddToFirst (1)
- ! call ChokeLine_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 (Ann_MudOrKick%Last())
- ! endif
- !
- !endif
-
- endif
- !========================================================================================
-
-
-
- !============================= 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
- !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
-
- !if (MUD(4)%Q > 0.) then
- !
- !
- ! if (abs(ChokeLine_Density%Array(1)-Ann_Density%Last())< DensityMixTol) then
- ! ChokeLine_MudDischarged_Volume%Array(1)= ChokeLine_MudDischarged_Volume%Array(1) + ExpansionVolume
- ! else
- ! call ChokeLine_Density%AddToFirst (Ann_Density%Last())
- ! call ChokeLine_MudDischarged_Volume%AddToFirst (ExpansionVolume) ! farz kardam ke hameye hajm ro ba yek density ezafe konim
- ! call ChokeLine_Mud_Forehead_X%AddToFirst (0.0d0)
- ! call ChokeLine_Mud_Forehead_section%AddToFirst (1)
- ! call ChokeLine_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 (Ann_MudOrKick%Last())
- ! endif
- !
- !endif
-
- endif
- !========================================================================================
-
-
-
-
-
- !=============================== foreheade dar choke line bashad =============================
-
- if (ChokeLine_KickLoc > 0 .and. Ann_KickLoc==0) then
-
- ChokeLine_MudDischarged_Volume%Array(ChokeLine_KickLoc)= ChokeLine_MudDischarged_Volume%Array(ChokeLine_KickLoc)+ ExpansionVolume
-
- endif
-
-
- !========================================================================================
-
- !write(*,*) 'Expansion======0'
- ! !do imud=1, Ann_MudDischarged_Volume%Length()
- ! ! write(*,*) 'Ann:', imud, Ann_MudDischarged_Volume%Array(imud), Ann_Density%Array(imud) ,Ann_MudOrKick%Array(imud)
- ! !enddo
- !
- ! do imud=1, Op_MudDischarged_Volume%Length()
- ! write(*,*) 'Op:', imud, Op_MudDischarged_Volume%Array(imud), Op_Density%Array(imud) ,Op_MudOrKick%Array(imud)
- ! enddo
- !write(*,*) '0======expansion'
-
-
-
- end subroutine Kick_Expansion
-
-
-
-
-
- subroutine Kick_Contraction ! is called in subroutine CirculationCodeSelect
-
- Use GeoElements_FluidModule
- USE CMudPropertiesVariables
- USE MudSystemVARIABLES
- USE Pumps_VARIABLES
- use CDrillWatchVariables
- !use CTanksVariables, TripTankVolume2 => DrillingWatch%TripTankVolume, TripTankDensity2 => TripTankDensity
- USE sROP_Other_Variables
- USE sROP_Variables
- USE CReservoirVariables
- USE KickVARIABLES
- USE CError
-
-
- implicit none
-
- integer jelement, jmud, jsection,ielement,i
- integer jopelement,jopmud,jopsection
- real(8) ContractionVolume
-
-
- !*********************************************************
-
- ! contraction is always with pump flow
-
- !*********************************************************
- !write(*,*) 'Kick Contraction'
-
- !MUD(2)%Q= total_pumps%Total_Pump_GPM
- StringFlowRate= MUD(2)%Q
- AnnulusFlowRate= MUD(2)%Q
-
- if (NewPipeFilling == 0) then
- StringFlowRate= 0.
- AnnulusFlowRate= 0.
- endif
-
-
-
-
-
- !if (WellHeadIsOpen) then
- ContractionVolume= - GasPocketDeltaVol%Array(NewInfluxNumber - KickNumber + 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
- !endif
-
-
- !**************************************************************************************************************************************************************************
-
- ! 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)
-
- Op_MudDischarged_Volume%Array(Op_KickLoc)= Op_MudDischarged_Volume%Array(Op_KickLoc) - ( ContractionVolume )
-
- ELSE IF (Op_KickLoc == 0 .AND. Ann_KickLoc > 0 .AND. ChokeLine_KickLoc == 0) THEN ! All of kick is an Annulus (iloc == 1)
-
- Ann_MudDischarged_Volume%Array(Ann_KickLoc)= Ann_MudDischarged_Volume%Array(Ann_KickLoc) - ( ContractionVolume )
-
- ELSE IF (Ann_KickLoc == 0 .AND. ChokeLine_KickLoc > 0) THEN ! kick is in chokeline only
-
- ChokeLine_MudDischarged_Volume%Array(ChokeLine_KickLoc)= ChokeLine_MudDischarged_Volume%Array(ChokeLine_KickLoc) - ( ContractionVolume )
-
- ELSE IF (Op_KickLoc > 0 .AND. Ann_KickLoc > 0) THEN ! Kick is around bit (iloc==2)
-
- if (Ann_MudDischarged_Volume%Array(1) > ContractionVolume ) then
-
- Ann_MudDischarged_Volume%Array(1)= Ann_MudDischarged_Volume%Array(1) - ( ContractionVolume )
-
-
- elseif (Op_MudDischarged_Volume%Last() > ContractionVolume ) then
-
- Op_MudDischarged_Volume%Array(Op_MudDischarged_Volume%Length())= Op_MudDischarged_Volume%Array(Op_MudDischarged_Volume%Length()) - ( ContractionVolume )
-
- else
- Call ErrorStop ('kick contraction error 1')
- endif
-
- ELSE IF (Ann_KickLoc > 0 .AND. ChokeLine_KickLoc > 0) THEN
-
- if (ChokeLine_MudDischarged_Volume%Array(1) > ContractionVolume ) then
-
- ChokeLine_MudDischarged_Volume%Array(1) = ChokeLine_MudDischarged_Volume%Array(1) - ( ContractionVolume )
-
-
- elseif (Ann_MudDischarged_Volume%Last() > ContractionVolume ) then
-
- Ann_MudDischarged_Volume%Array(Ann_MudDischarged_Volume%Length())= Ann_MudDischarged_Volume%Array(Ann_MudDischarged_Volume%Length()) - ( ContractionVolume )
-
- else
- Call ErrorStop ('kick contraction error 2')
- endif
-
-
-
- endif
-
- ! write(*,*) 'contract======0'
- !! !do imud=1, Ann_MudDischarged_Volume%Length()
- !! ! write(*,*) 'Ann:', imud, Ann_MudDischarged_Volume%Array(imud), Ann_Density%Array(imud) ,Ann_MudOrKick%Array(imud)
- !! !enddo
- !!
- ! do imud=1, Op_MudDischarged_Volume%Length()
- ! write(*,*) 'Op:', imud, Op_MudDischarged_Volume%Array(imud), Op_Density%Array(imud) ,Op_MudOrKick%Array(imud)
- ! enddo
- !write(*,*) '0======contract'
-
- end subroutine Kick_Contraction
|