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.
 
 
 
 
 
 

125 lines
5.7 KiB

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