Simulation Core
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 
 
 

95 рядки
8.0 KiB

  1. MODULE KickVARIABLES
  2. USE DynamicDoubleArray
  3. USE DynamicIntegerArray
  4. USE DynamicRealArray
  5. IMPLICIT NONE
  6. REAL :: DrillStringSpeed ! drill string speed during surge and swab [ft/s]
  7. REAL :: ChokeDensity , OldChokeDensity ! density of fluid that exits through choke [ppg]
  8. REAL :: ChokeMinDensity ! [ppg]
  9. REAL :: MaxChokeDensityChange ! [ppg/min]
  10. INTEGER :: TotalGasKicks ! Number of gas kicks enetered well
  11. REAL :: GasKickMolarMass ! molar mass of gas kick [lbm/lbmole]
  12. REAL :: GasKickBg ! Gas formation volume factor [bbl/SCF]
  13. REAL :: GasResPressure , GasResTemperature , GasResCompressibility ! pressure [psi] , temperature [R] and compressibility [-] at reservoir condition
  14. REAL :: GasReservoirDensity ! density of gas kick in reservoir condition [ppg]
  15. REAL :: BottomHolePress , BottomHoleTemperature , BottomHoleCompressibility ! pressure [psi] , temperature [R] and compressibility [-] at bottom hole condition
  16. REAL :: KickFluxAvgTemperature , KickFluxAvgPressure , KickFluxAvgCompressibility ! Average pressure [psia] and temperature [R] for calculating gas kick flux
  17. REAL :: GasKickViscosity ! Gas kick viscosity at average condition [cp]
  18. REAL :: GasKickSIDensity ! density of gas kick in average condition and in SI units [gr/cm^3]
  19. REAL :: GasKickDensity ! [ppg]
  20. REAL :: GasKickPumpFlowRate ! change of volume of gas kick in sense of flow rate [gpm]
  21. REAL :: FormPressure , FormTemperature
  22. REAL(8) :: KickFormLength , KickFormTopMD , KickFormDownMD ! [ft]
  23. REAL :: FormPermeability ! formation permeability [mD]
  24. REAL :: GasSpecGravity ! specific gravity of gas kick relative to air [-]
  25. REAL :: KickTc , KickPc ! critical temperature [R] and pressure [psi] of gas kick
  26. REAL :: KickTr , KickPr ! Reduced temperature and pressure of gas kick at reservoir condition
  27. REAL :: K_BHTpr , K_BHPpr ! Reduced temperature and pressure of gas kick at bottom hole condition
  28. REAL :: K_A_Res , K_B_Res , K_C_Res , K_D_Res ! Coefficients in calculating compressibility at reservoir condition
  29. REAL :: K_A_Bottomhole , K_B_Bottomhole , K_C_Bottomhole , K_D_Bottomhole
  30. ! Coefficients in calculating compressibility at bottomhole condition
  31. REAL :: K_Aa , K_Bb , K_Cc ! Coefficient in calculating gas viscosity at reservoir condition
  32. REAL :: MinKickVol ! minimum of kick volume at the beginning of entrance to wellbore [gal]
  33. REAL :: MinAllowableKickVol ! minimum allowable kick volume [ft^3]
  34. REAL :: SecondaryKickVol ! Volume of kicks other than first kick in reservoir condition [bbl]
  35. REAL :: SecondaryKickWeight ! Weight of kicks other than first kick in reservoir condition [lbm]
  36. REAL :: Kickmdot ! mass flow rate of kick [lbm/sec]
  37. REAL :: ExitMass ! escaped mass from choke [lbm]
  38. REAL :: KickmdotACoef ! coefficient in calculating mdot of kick, Eqn. 5 handnote [lbm/(sec.psi)]
  39. REAL :: KickmdotBCoef ! coefficient in calculating mdot of kick, Eqn. 5 handnote [psi]
  40. LOGICAL :: KickFlux ! .TRUE. = Bottomhole pressure is lower than reservoir pressure and thus gas
  41. ! enters the bottomhole.
  42. LOGICAL :: KickInFluxConditions ! a set of conditions, when all are true, this variable will become true
  43. LOGICAL :: WellHeadOpen ! .TRUE. = wellhead is open or flow on choke line
  44. ! .FALSE. = wellhead is close and no fluid flow out
  45. LOGICAL :: WellHeadWasOpen ! well Head Condition in last time step
  46. LOGICAL :: WellToChokeManifoldWasOpen
  47. LOGICAL :: KickOffBottom ! .TRUE. = kick starts to rise up
  48. LOGICAL :: KickSinglePocket ! when 'MakeKickSinglePacket' is active, only one pocket of kick exists in the well.
  49. LOGICAL :: SolvingEquationError
  50. LOGICAL :: KickWasExitingThroughChoke
  51. LOGICAL :: ChokeIsClosing
  52. INTEGER :: NoGasPocket ! number of gas pockets (not gas kick) in wellbore which may migrate or expand
  53. INTEGER :: KickIteration ! the number of itertion for calculating pressure and flowrate, when kick is in the well
  54. INTEGER :: KickType ! = 0 for gas kicks , = 1 for oil kicks and = 2 for water kicks
  55. INTEGER :: KickGasType ! = 1 for methane , = 2 for Hydrogen sulfide
  56. INTEGER :: ChokeKroneckerDelta ! if well to choke manifold is open and well to pit is closed ChokeKroneckerDelta = 1
  57. INTEGER :: MaxGasPocket ! = 1 if 'single pocket model' is on and = 15 if 'single pocket model' is off
  58. !!!!!!!!!!!!!!!!!!!!!!! Gas Pockets Data
  59. TYPE(DynamicDoubleArrayType) :: GasPocketOldPress , GasPocketOldVol ! pressure and volume of gas pocket at the beginning of time step [psia , ft^3]
  60. TYPE(DynamicDoubleArrayType) :: GasPocketNewPress , GasPocketNewVol ! pressure and volume of gas pocket at the end of time step [psia , ft^3]
  61. TYPE(DynamicRealArrayType) :: GasPocketOldTemp , GasPocketNewTemp ! temperature at the beginning (old) and at the end of time step [R]
  62. TYPE(DynamicRealArrayType) :: GasPocketFlowInduced , GasPocketDeltaVol ! flowrate in elements above gas pocket due to mass influx and expansion [gpm]
  63. TYPE(DynamicRealArrayType) :: GasPocketModifiedVol ! in some situation in migration process, or entering kick in a new space type
  64. ! such as entering annulus from openhole, or entering ckokeline from annulus,
  65. ! volume of gas pocket changes due to calculation process, and thus volume of
  66. ! gas pocket should be modified [10^-3 ft^3]
  67. TYPE(DynamicRealArrayType) :: GasPocketWeight ! weight of pocket [lbm]
  68. TYPE(DynamicRealArrayType) :: GasPocketDensity ! density of gas pocket [ppg]
  69. TYPE(DynamicRealArrayType) :: GasPocketCompressibility ! compressibility as a measure of deviation from ideal gas behavior [-]
  70. INTEGER , DIMENSION(:,:) , ALLOCATABLE :: GasPocketFlowEl ! This matrix makes relationship between gas pockets and flow elements,
  71. ! Further information in SUBROUTINE GasPocketFlowElementTransformer
  72. INTEGER , DIMENSION(:,:) , ALLOCATABLE :: tempGasPocketFlowEl ! a temperorary matrix using for data saving during GasPocketFlowEl manipulation
  73. !INTEGER , DIMENSION(:) , ALLOCATABLE :: GasPocketGasType ! = 1 for methane , = 2 for Hydrogen Sulfide
  74. REAL(8) , DIMENSION(:,:) , ALLOCATABLE :: KickJacobian , OldKickJacobian ! a matrix in which jacibian elements stored
  75. REAL(8) , DIMENSION(:) , ALLOCATABLE :: KickVandPFunction
  76. REAL(8) , DIMENSION(:) , ALLOCATABLE :: KickUnknownVector ! (2*n - 1) elements are flowrate and (2*n) elements are pressure of pockets (n >= 1)
  77. REAL , DIMENSION(:) , ALLOCATABLE :: KickCorrectionVector
  78. REAL :: KickCorrectionUnderRelaxation ! under relaxation parameter for correcting gas Kick Unknown Vector (0,1)
  79. ! = 0 means no correction between two step
  80. ! = 1 for direct correcting and no under relaxation
  81. END MODULE