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.
 
 
 
 
 
 

106 lines
6.9 KiB

  1. # 1 "/mnt/c/Projects/VSIM/SimulationCore2/TorqueDrag/TD_ReadDataSubroutines/TD_WellReadData.f90"
  2. subroutine TD_WellReadData
  3. use SimulationVariables !@
  4. implicit none
  5. Integer :: i
  6. data%State%TD_WellGeneral%WellIntervalsCount = data%Configuration%Path%ItemCount + 1 ! +1 is belong to ROP hole
  7. if (Allocated(data%State%TD_WellGeo)) deAllocate (data%State%TD_WellGeo)
  8. Allocate (data%State%TD_WellGeo(data%State%TD_WellGeneral%WellIntervalsCount))
  9. !====================================================
  10. ! Set Well Geometry Data
  11. !====================================================
  12. data%State%TD_WellGeo(1)%HoleType = data%Configuration%Path%Items(1)%HoleType
  13. data%State%TD_WellGeo(1)%StartAngle = 0.d0 ![rad]
  14. data%State%TD_WellGeo(1)%EndAngle = data%Configuration%Path%Items(1)%FinalAngle*(pi/180.d0) ![rad]
  15. data%State%TD_WellGeo(1)%IntervalLength= data%Configuration%Path%Items(1)%TotalLength ![ft]
  16. !data%State%TD_WellGeo(1)%VerticalDepth = PathGenerations(1)%TotalVerticalDepth
  17. data%State%TD_WellGeo(1)%TopDepth = 0.d0
  18. data%State%TD_WellGeo(1)%DownDepth = data%Configuration%Path%Items(1)%MeasuredDepth
  19. Do i=2,data%State%TD_WellGeneral%WellIntervalsCount-1
  20. data%State%TD_WellGeo(i)%HoleType = data%Configuration%Path%Items(i)%HoleType
  21. data%State%TD_WellGeo(i)%StartAngle = data%Configuration%Path%Items(i-1)%FinalAngle*(pi/180.d0)
  22. data%State%TD_WellGeo(i)%EndAngle = data%Configuration%Path%Items(i)%FinalAngle*(pi/180.d0)
  23. data%State%TD_WellGeo(i)%IntervalLength= data%Configuration%Path%Items(i)%TotalLength
  24. !data%State%TD_WellGeo(i)%VerticalDepth = data%Configuration%Path%Items(i)%TotalVerticalDepth
  25. data%State%TD_WellGeo(i)%TopDepth = data%Configuration%Path%Items(i-1)%MeasuredDepth
  26. data%State%TD_WellGeo(i)%DownDepth = data%Configuration%Path%Items(i)%MeasuredDepth
  27. !=====> Radius Of Curvature Calculation
  28. if (data%State%TD_WellGeo(i)%HoleType/=0) then
  29. data%State%TD_WellGeo(i)%RCurvature = ((data%State%TD_WellGeo(i)%IntervalLength)/abs(data%State%TD_WellGeo(i)%EndAngle-data%State%TD_WellGeo(i)%StartAngle))
  30. end if
  31. End Do
  32. !=====> Set ROP Hole Data
  33. data%State%TD_WellGeo(data%State%TD_WellGeneral%WellIntervalsCount)%HoleType = 0 !Straight
  34. data%State%TD_WellGeo(data%State%TD_WellGeneral%WellIntervalsCount)%StartAngle = data%State%TD_WellGeo(data%State%TD_WellGeneral%WellIntervalsCount-1)%EndAngle
  35. data%State%TD_WellGeo(data%State%TD_WellGeneral%WellIntervalsCount)%EndAngle = data%State%TD_WellGeo(data%State%TD_WellGeneral%WellIntervalsCount)%StartAngle
  36. data%State%TD_WellGeo(data%State%TD_WellGeneral%WellIntervalsCount)%IntervalLength= 0.d0
  37. !data%State%TD_WellGeo(data%State%TD_WellGeneral%WellIntervalsCount)%VerticalDepth = data%State%TD_WellGeo(data%State%TD_WellGeneral%WellIntervalsCount-1)%VerticalDepth
  38. data%State%TD_WellGeo(data%State%TD_WellGeneral%WellIntervalsCount)%TopDepth = data%State%TD_WellGeo(data%State%TD_WellGeneral%WellIntervalsCount-1)%DownDepth
  39. data%State%TD_WellGeo(data%State%TD_WellGeneral%WellIntervalsCount)%DownDepth = data%State%TD_WellGeo(data%State%TD_WellGeneral%WellIntervalsCount)%TopDepth+data%State%TD_WellGeo(data%State%TD_WellGeneral%WellIntervalsCount)%IntervalLength
  40. !=====> Vertical Depth Calculation
  41. if ( data%State%TD_WellGeo(1)%HoleType==0 ) then
  42. data%State%TD_WellGeo(1)%VerticalDepth = data%State%TD_WellGeo(1)%IntervalLength*cos(data%State%TD_WellGeo(1)%StartAngle)
  43. else if ( data%State%TD_WellGeo(1)%HoleType==1 ) then
  44. data%State%TD_WellGeo(1)%VerticalDepth = (data%State%TD_WellGeo(1)%RCurvature*sin(abs(data%State%TD_WellGeo(1)%EndAngle)-abs(data%State%TD_WellGeo(1)%StartAngle))*cos(abs(data%State%TD_WellGeo(1)%StartAngle)))-(data%State%TD_WellGeo(1)%RCurvature*(1.-cos(abs(data%State%TD_WellGeo(1)%EndAngle)-abs(data%State%TD_WellGeo(1)%StartAngle)))*sin(abs(data%State%TD_WellGeo(1)%StartAngle)))
  45. else if ( data%State%TD_WellGeo(1)%HoleType==2 ) then
  46. data%State%TD_WellGeo(1)%VerticalDepth = (data%State%TD_WellGeo(1)%RCurvature*sin(abs(abs(data%State%TD_WellGeo(1)%EndAngle)-abs(data%State%TD_WellGeo(1)%StartAngle)))*cos(abs(data%State%TD_WellGeo(1)%StartAngle)))+(data%State%TD_WellGeo(1)%RCurvature*(1.-cos(abs(abs(data%State%TD_WellGeo(1)%EndAngle)-abs(data%State%TD_WellGeo(1)%StartAngle))))*sin(abs(data%State%TD_WellGeo(1)%StartAngle)))
  47. End if
  48. Do i= 2,data%State%TD_WellGeneral%WellIntervalsCount
  49. if ( data%State%TD_WellGeo(i)%HoleType==0 ) then
  50. data%State%TD_WellGeo(i)%VerticalDepth = data%State%TD_WellGeo(i-1)%VerticalDepth+data%State%TD_WellGeo(i)%IntervalLength*cos(data%State%TD_WellGeo(i)%StartAngle)
  51. else if ( data%State%TD_WellGeo(i)%HoleType==1 ) then
  52. data%State%TD_WellGeo(i)%VerticalDepth = data%State%TD_WellGeo(i-1)%VerticalDepth+(data%State%TD_WellGeo(i)%RCurvature*sin(abs(data%State%TD_WellGeo(i)%EndAngle)-abs(data%State%TD_WellGeo(i)%StartAngle))*cos(abs(data%State%TD_WellGeo(i)%StartAngle)))-(data%State%TD_WellGeo(i)%RCurvature*(1.-cos(abs(data%State%TD_WellGeo(i)%EndAngle)-abs(data%State%TD_WellGeo(i)%StartAngle)))*sin(abs(data%State%TD_WellGeo(i)%StartAngle)))
  53. else if ( data%State%TD_WellGeo(i)%HoleType==2 ) then
  54. data%State%TD_WellGeo(i)%VerticalDepth = data%State%TD_WellGeo(i-1)%VerticalDepth+(data%State%TD_WellGeo(i)%RCurvature*sin(abs(abs(data%State%TD_WellGeo(i)%EndAngle)-abs(data%State%TD_WellGeo(i)%StartAngle)))*cos(abs(data%State%TD_WellGeo(i)%StartAngle)))+(data%State%TD_WellGeo(i)%RCurvature*(1.-cos(abs(abs(data%State%TD_WellGeo(i)%EndAngle)-abs(data%State%TD_WellGeo(i)%StartAngle))))*sin(abs(data%State%TD_WellGeo(i)%StartAngle)))
  55. End if
  56. End Do
  57. !Do i=1,data%State%TD_WellGeneral%WellIntervalsCount
  58. ! print*, 'data%State%TD_WellGeo(i)%TopDepth=' , i , data%State%TD_WellGeo(i)%TopDepth
  59. ! print*, 'data%State%TD_WellGeo(i)%DownDepth=' , i , data%State%TD_WellGeo(i)%DownDepth
  60. ! print*, 'data%State%TD_WellGeo(i)%HoleType=' , i , data%State%TD_WellGeo(i)%HoleType
  61. ! print*, 'data%State%TD_WellGeo(i)%RCurvature=' , i , data%State%TD_WellGeo(i)%RCurvature
  62. ! print*, 'data%State%TD_WellGeo(i)%EndAngle=' , i , data%State%TD_WellGeo(i)%EndAngle
  63. ! print*, 'data%State%TD_WellGeo(i)%StartAngle=' , i , data%State%TD_WellGeo(i)%StartAngle
  64. ! print*, 'data%State%TD_WellGeo(i)%VerticalDepth=' , i , data%State%TD_WellGeo(i)%VerticalDepth
  65. !end do
  66. !=====> Well Total Length Calculation
  67. data%State%TD_WellGeneral%WellTotalLength = data%State%TD_WellGeo(data%State%TD_WellGeneral%WellIntervalsCount)%DownDepth
  68. data%State%TD_WellGeneral%WellTotalVerticalLength = data%State%TD_WellGeo(data%State%TD_WellGeneral%WellIntervalsCount)%VerticalDepth
  69. end subroutine