Simulation Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Formation_Information.f90 5.2 KiB

1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. SUBROUTINE FormationInformationCalculator
  2. USE KickVariables
  3. Use TD_WellGeometry
  4. Use CReservoirVariables
  5. Use CFormationVariables
  6. USE Fluid_Flow_Startup_Vars
  7. USE CLog2
  8. USE CDownHoleVariables
  9. USE MudSystemVARIABLES
  10. IMPLICIT NONE
  11. INTEGER :: i
  12. REAL(8) :: WellGeoTopTVD
  13. KickGasType = 1 ! methane
  14. !====================================================
  15. ! Formation Length Calculation
  16. !====================================================
  17. WellGeoTopTVD = 0.
  18. KickFormTopMD = 0.
  19. KickFormDownMD = 0.
  20. !===> Top Measured Depth of Formation
  21. Do i = 1 , TD_WellIntervalsCount
  22. if ( FormationTop >= TD_WellGeo(i)%VerticalDepth ) then
  23. KickFormTopMD = KickFormTopMD + TD_WellGeo(i)%IntervalLength
  24. !WRITE (*,*) ' here 11' , TD_WellGeo(i)%IntervalLength
  25. !WRITE (*,*) ' here v11' , TD_WellGeo(i)%VerticalDepth
  26. WellGeoTopTVD = TD_WellGeo(i)%VerticalDepth
  27. else if ( FormationTop < TD_WellGeo(i)%VerticalDepth ) then
  28. if ( TD_WellGeo(i)%HoleType == 0 ) then
  29. KickFormTopMD = KickFormTopMD + ((FormationTop - WellGeoTopTVD)&
  30. / cos(TD_WellGeo(i)%StartAngle))
  31. !WRITE (*,*) ' here 12' , (FormationTop - WellGeoTopTVD) / cos(TD_WellGeo(i)%StartAngle)
  32. else
  33. KickFormTopMD = KickFormTopMD + (TD_WellGeo(i)%RCurvature &
  34. * Asin((FormationTop - WellGeoTopTVD) / TD_WellGeo(i)%RCurvature))
  35. !WRITE (*,*) ' here 13' , TD_WellGeo(i)%RCurvature * Asin((FormationTop - WellGeoTopTVD) / TD_WellGeo(i)%RCurvature)
  36. end if
  37. exit
  38. end if
  39. End Do
  40. !!===> Down Measured Depth of Formation
  41. WellGeoTopTVD = 0.
  42. Do i = 1 , TD_WellIntervalsCount
  43. if ( (FormationTop + Formations(FormationNo)%Thickness)>=TD_WellGeo(i)%VerticalDepth ) then
  44. KickFormDownMD = KickFormDownMD + TD_WellGeo(i)%IntervalLength
  45. WellGeoTopTVD = TD_WellGeo(i)%VerticalDepth
  46. else if ( (FormationTop+Formations(FormationNo)%Thickness)<TD_WellGeo(i)%VerticalDepth ) then
  47. if ( TD_WellGeo(i)%HoleType==0 ) then
  48. KickFormDownMD = KickFormDownMD + (((FormationTop+Formations(FormationNo)%Thickness)-WellGeoTopTVD)&
  49. / cos(TD_WellGeo(i)%StartAngle))
  50. else
  51. KickFormDownMD = KickFormDownMD + (TD_WellGeo(i)%RCurvature &
  52. * Asin((FormationTop - WellGeoTopTVD) / TD_WellGeo(i)%RCurvature))
  53. end if
  54. exit
  55. end if
  56. End Do
  57. !!===> Determination of Formation Length for Kick Modeling
  58. if (TD_WellTotalVerticalLength >= FormationTop .AND. TD_WellTotalVerticalLength < (FormationTop+Formations(FormationNo)%Thickness)) then
  59. KickFormLength = TD_WellTotalLength - KickFormTopMD ![ft]
  60. else if ( TD_WellTotalVerticalLength >= (FormationTop + Formations(FormationNo)%Thickness) ) then
  61. KickFormLength = KickFormDownMD - KickFormTopMD ![ft]
  62. else
  63. KickFormLength = 0.
  64. end if
  65. !PermeabilityExposedHeight = KickFormLength * FormationPermeability
  66. PermeabilityExposedHeight = FluidFlowCounter - MudSys_timeCounter
  67. !====================================================
  68. ! Reservoir Data
  69. !====================================================
  70. FormPermeability = FormationPermeability ! [mD]
  71. FormPressure = TD_WellTotalVerticalLength * Formations(FormationNo)%PorePressureGradient ![psia]
  72. FormationPressure = INT(FormPressure)
  73. !CALL Log_2('FormPressure =' , FormPressure)
  74. !print*, 'Formations(FormationNo)%PorePressureGradient=', Formations(FormationNo)%PorePressureGradient
  75. !print * , 'FormationNo=' , FormationNo
  76. !print * , 'TD_WellTotalVerticalLength=' , TD_WellTotalVerticalLength
  77. FormTemperature = 600 ! [Ra]
  78. !WRITE (*,*) ' Formation pressure ' , FormPressure
  79. !====================================================
  80. ! Gas Properties (Methane Gas)
  81. !====================================================
  82. GasResTemperature = FormTemperature
  83. GasResPressure = FormPressure
  84. !!!! Methane , Gas type =1
  85. GasKickMolarMass = GasType(KickGasType)%MolarWt ! Methane Gas [gr/mol]
  86. GasSpecGravity = GasKickMolarMass / GasDensityRefrence
  87. KickTc = GasType(KickGasType)%CritTemp
  88. KickPc = GasType(KickGasType)%CritPress
  89. !!!!!!!! Calculating Compressibility, viscosity for influx condition (Average of reservoir and bottomhole)
  90. KickTr = GasResTemperature / KickTc
  91. KickPr = GasResPressure / KickPc
  92. K_A_Res = 3.53 * KickPr
  93. K_B_Res = 10.0**(0.9813 * KickTr)
  94. K_C_Res = 0.274 * (KickPr**2)
  95. K_D_Res = 10.0**(0.8157 * KickTr)
  96. GasResCompressibility = 0.98 !1. - (K_A_Res / K_B_Res) + (K_C_Res / K_D_Res)
  97. GasReservoirDensity = GasResPressure / (GasResCompressibility * &
  98. GasResTemperature * GasType(KickGasType)%GasConstant) / Convft3toUSgal ! [ppg]
  99. END SUBROUTINE