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.i90 7.0 KiB

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