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 6.2 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. # 1 "/home/admin/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. KickGasType = 1 ! methane
  17. !====================================================
  18. ! Formation Length Calculation
  19. !====================================================
  20. WellGeoTopTVD = 0.
  21. KickFormTopMD = 0.
  22. 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. KickFormTopMD = 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. KickFormTopMD = 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. KickFormTopMD = 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. KickFormDownMD = 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. KickFormDownMD = KickFormDownMD + (((Reservoir%FormationTop+data%Configuration%Formation%Formations(Reservoir%FormationNo)%Thickness)-WellGeoTopTVD)&
  52. / cos(data%State%TD_WellGeo(i)%StartAngle))
  53. else
  54. KickFormDownMD = 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. KickFormLength = data%State%TD_WellGeneral%WellTotalLength - KickFormTopMD ![ft]
  63. else if ( data%State%TD_WellGeneral%WellTotalVerticalLength >= (Reservoir%FormationTop + data%Configuration%Formation%Formations(Reservoir%FormationNo)%Thickness) ) then
  64. KickFormLength = KickFormDownMD - KickFormTopMD ![ft]
  65. else
  66. KickFormLength = 0.
  67. end if
  68. !PermeabilityExposedHeight = KickFormLength * FormationPermeability
  69. data%Equipments%DownHole%PermeabilityExposedHeight = data%State%MudSystem%FluidFlowCounter - data%State%MudSystem%MudSys_timeCounter
  70. !====================================================
  71. ! Reservoir Data
  72. !====================================================
  73. FormPermeability = Reservoir%FormationPermeability ! [mD]
  74. FormPressure = data%State%TD_WellGeneral%WellTotalVerticalLength * data%Configuration%Formation%Formations(Reservoir%FormationNo)%PorePressureGradient ![psia]
  75. data%Equipments%DownHole%FormationPressure = INT(FormPressure)
  76. !CALL Log_2('FormPressure =' , FormPressure)
  77. !if(print_log) print*, 'Formations(FormationNo)%PorePressureGradient=', Formations(FormationNo)%PorePressureGradient
  78. !print * , 'FormationNo=' , FormationNo
  79. !print * , 'data%State%TD_WellGeneral%WellTotalVerticalLength=' , data%State%TD_WellGeneral%WellTotalVerticalLength
  80. FormTemperature = 600 ! [Ra]
  81. !WRITE (*,*) ' Formation pressure ' , FormPressure
  82. !====================================================
  83. ! Gas Properties (Methane Gas)
  84. !====================================================
  85. GasResTemperature = FormTemperature
  86. GasResPressure = FormPressure
  87. !!!! Methane , Gas type =1
  88. GasKickMolarMass = data%State%GasType(KickGasType)%MolarWt ! Methane Gas [gr/mol]
  89. GasSpecGravity = GasKickMolarMass / GasDensityRefrence
  90. KickTc = data%State%GasType(KickGasType)%CritTemp
  91. KickPc = data%State%GasType(KickGasType)%CritPress
  92. !!!!!!!! Calculating Compressibility, viscosity for influx condition (Average of reservoir and bottomhole)
  93. KickTr = GasResTemperature / KickTc
  94. KickPr = GasResPressure / KickPc
  95. K_A_Res = 3.53 * KickPr
  96. K_B_Res = 10.0**(0.9813 * KickTr)
  97. K_C_Res = 0.274 * (KickPr**2)
  98. K_D_Res = 10.0**(0.8157 * KickTr)
  99. GasResCompressibility = 0.98 !1. - (K_A_Res / K_B_Res) + (K_C_Res / K_D_Res)
  100. GasReservoirDensity = GasResPressure / (GasResCompressibility * &
  101. GasResTemperature * data%State%GasType(KickGasType)%GasConstant) / Convft3toUSgal ! [ppg]
  102. END SUBROUTINE