Simulation Core
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

TD_BOPDiamCalculation.i90 8.4 KiB

1 anno fa
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. # 1 "/mnt/c/Projects/VSIM/SimulationCore2/TorqueDrag/TD_DrillingSubs/TD_BOPDiamCalculation.f90"
  2. subroutine TD_BOPDiamCalculation
  3. Use TD_DrillStemComponents
  4. use SimulationVariables !@
  5. use SimulationVariables !@
  6. use SimulationVariables !@
  7. Use TD_StringConnectionData
  8. Use CBopStackVariables
  9. use SimulationVariables
  10. use DownHoleModule
  11. Integer :: i , j , n , m , TD_Numbs
  12. Real(8) :: TD_LimitUp , TD_LimitDown , TD_OldFillingValue , TD_AnnTjDiff , TD_AnnularFilling
  13. Real(8) :: TD_ElToolJoints(2,2)
  14. !data%State%TD_String%ToolJointRange = 0.4005d0*3.28 ! [ft]
  15. !====================================================
  16. ! Read BOP Data
  17. !====================================================
  18. data%State%TD_BOP%BOPHeight(5) = data%Configuration%BopStack%AboveAnnularHeight
  19. data%State%TD_BOP%BOPHeight(1) = data%Configuration%BopStack%AnnularPreventerHeight
  20. data%State%TD_BOP%BOPHeight(2) = data%Configuration%BopStack%UpperRamHeight
  21. data%State%TD_BOP%BOPHeight(3) = data%Configuration%BopStack%BlindRamHeight
  22. data%State%TD_BOP%BOPHeight(6) = data%Configuration%BopStack%KillHeight
  23. data%State%TD_BOP%BOPHeight(4) = data%Configuration%BopStack%LowerRamHeight
  24. data%State%TD_BOP%BOPRamDiam(1) = data%State%ShearRAM%IDAnnularfinal
  25. data%State%TD_BOP%BOPRamDiam(2) = data%State%ShearRAM%IDPipeRam1final
  26. data%State%TD_BOP%BOPRamDiam(3) = data%State%ShearRAM%IDshearBopfinal
  27. data%State%TD_BOP%BOPRamDiam(4) = data%State%ShearRAM%IDPipeRam2final
  28. !====================================================
  29. ! Element Counts in BOPStack Domain
  30. !====================================================
  31. !if (data%State%TD_String%DrillStemComponentsNumbs>5) then
  32. TD_Numbs = data%State%TD_String%DrillStemComponentsNumbs-7 ! 7 Elements from the Top of DrillStem
  33. !else
  34. ! TD_Numbs = 1
  35. !end if
  36. !====================================================
  37. ! Determination of Elements Diameter in BOPStack Domain
  38. !====================================================
  39. data%State%TD_BOP%BOPDiam = 0.d0
  40. TD_OldFillingValue = 0.d0
  41. Do i = data%State%TD_String%DrillStemComponentsNumbs,TD_Numbs,-1
  42. TD_LimitUp = data%State%TD_DrillStems(i)%TopDepth+data%State%TD_DrillStems(i)%ToolJointRange
  43. TD_LimitDown = data%State%TD_DrillStems(i)%DownDepth-data%State%TD_DrillStems(i)%ToolJointRange
  44. TD_ElToolJoints(1,1) = data%State%TD_DrillStems(i)%TopDepth ! TD_ElToolJoints(i,j) , i=top & down tooljoints of element , j=top & down tooljoints Depth
  45. TD_ElToolJoints(1,2) = TD_LimitUp
  46. TD_ElToolJoints(2,1) = TD_LimitDown
  47. TD_ElToolJoints(2,2) = data%State%TD_DrillStems(i)%DownDepth
  48. !===> che meghdar az fazaye annular ba tooljoint por mishavad (for BOP Module)
  49. Do m = 1,2
  50. TD_AnnTjDiff = min(TD_ElToolJoints(m,2),(data%State%TD_BOP%BOPHeight(1)+data%State%TD_BOP%BOPThickness))-max(TD_ElToolJoints(m,1),(data%State%TD_BOP%BOPHeight(1)-data%State%TD_BOP%BOPThickness))
  51. if (TD_AnnTjDiff<0.) then ! tooljoint is not in the annular range
  52. TD_AnnTjDiff = 0.d0
  53. end if
  54. TD_AnnularFilling = TD_OldFillingValue+(TD_AnnTjDiff/(data%State%TD_BOP%BOPThickness*2.d0)) ! 0=<TD_AnnularFilling<=1
  55. TD_OldFillingValue = TD_AnnularFilling
  56. End Do
  57. do j = 1,6
  58. if ( (data%State%TD_BOP%BOPHeight(j)-data%State%TD_BOP%BOPThickness)>TD_LimitUp .and. (data%State%TD_BOP%BOPHeight(j)+data%State%TD_BOP%BOPThickness)<TD_LimitDown ) then
  59. data%State%TD_BOP%BOPDiam(j) = data%State%TD_DrillStems(i)%Od
  60. data%State%TD_BOP%BOPElementNo(j) = i
  61. if ( data%State%TD_DrillStems(i)%ComponentType==3 .and. j/=1 .and. data%State%TD_String%DrillStemRotVelocity==0. ) then
  62. data%State%TD_BOP%BOPConnectionPossibility(j) = 1
  63. else if ( j==1 ) then
  64. data%State%TD_BOP%BOPConnectionPossibility(j) = 1
  65. else
  66. data%State%TD_BOP%BOPConnectionPossibility(j) = 0
  67. end if
  68. !print* , 'T.DP. , B.DP. 1=' , data%State%TD_DrillStems(i)%TopDepth , data%State%TD_DrillStems(i)%DownDepth
  69. !print* , 'T.R. , B.R. , LimitUp , LimitDown 1=' , (data%State%TD_BOP%BOPHeight(j)-data%State%TD_BOP%BOPThickness) , (data%State%TD_BOP%BOPHeight(j)+data%State%TD_BOP%BOPThickness) , TD_LimitUp , TD_LimitDown
  70. !print* , 'stringNo , ramsNo , Possibility , BOPDiam 1=' , i , j , data%State%TD_BOP%BOPConnectionPossibility(j) , data%State%TD_BOP%BOPDiam(j)
  71. else if ( (data%State%TD_BOP%BOPHeight(j)+data%State%TD_BOP%BOPThickness)>=data%State%TD_DrillStems(i)%TopDepth .and. (data%State%TD_BOP%BOPHeight(j)-data%State%TD_BOP%BOPThickness)<=data%State%TD_DrillStems(i)%DownDepth ) then
  72. data%State%TD_BOP%BOPDiam(j) = data%State%TD_DrillStems(i)%RtoolJoint*2.d0
  73. data%State%TD_BOP%BOPElementNo(j) = i
  74. if ( j==1 ) then
  75. data%State%TD_BOP%BOPConnectionPossibility(j) = 1
  76. else
  77. data%State%TD_BOP%BOPConnectionPossibility(j) = 0
  78. end if
  79. !print* , 'T.DP. , B.DP. 2=' , data%State%TD_DrillStems(i)%TopDepth , data%State%TD_DrillStems(i)%DownDepth
  80. !print* , 'T.R. , B.R. , LimitUp , LimitDown 2=' , (data%State%TD_BOP%BOPHeight(j)-data%State%TD_BOP%BOPThickness) , (data%State%TD_BOP%BOPHeight(j)+data%State%TD_BOP%BOPThickness) , TD_LimitUp , TD_LimitDown
  81. !print* , 'stringNo , ramsNo , Possibility , BOPDiam 2=' , i , j , data%State%TD_BOP%BOPConnectionPossibility(j) , data%State%TD_BOP%BOPDiam(j)
  82. end if
  83. end do
  84. End Do
  85. data%State%TD_BOP%AnnularFillingFinal = TD_AnnularFilling
  86. data%State%TD_BOP%AboveAnnularDiam = data%State%TD_BOP%BOPDiam(5)
  87. data%State%TD_BOP%AnnularPreventerDiam = data%State%TD_BOP%BOPDiam(1)
  88. data%State%TD_BOP%UpperRamDiam = data%State%TD_BOP%BOPDiam(2)
  89. data%State%TD_BOP%BlindRamDiam = data%State%TD_BOP%BOPDiam(3)
  90. data%State%TD_BOP%KillDiam = data%State%TD_BOP%BOPDiam(6)
  91. data%State%TD_BOP%LowerRamDiam = data%State%TD_BOP%BOPDiam(4)
  92. !print* , 'data%State%TD_BOP%BOPElementNo=' , data%State%TD_BOP%BOPElementNo
  93. !print* , 'data%State%TD_BOP%BOPConnectionPossibility=' , data%State%TD_BOP%BOPConnectionPossibility
  94. !print* , 'data%State%TD_BOP%BOPDiam=' , data%State%TD_BOP%BOPDiam
  95. !!===> BOP RAMs Condition *** data%State%TD_BOP%BOPCondition: 0=open , 1=close
  96. !do j = 1,4
  97. ! if ( data%State%TD_BOP%BOPDiam(j)>=data%State%TD_BOP%BOPRamDiam(j) ) then
  98. ! data%State%TD_BOP%BOPCondition(j) = 1
  99. ! else
  100. ! data%State%TD_BOP%BOPCondition(j) = 0
  101. ! end if
  102. !end do
  103. !====================================================
  104. ! String Elements Configuration in BOPStack Domain
  105. !====================================================
  106. !if ( allocated(data%State%TD_BOPElement) ) deallocate (data%State%TD_BOPElement)
  107. !allocate(data%State%TD_BOPElement())
  108. n = 0
  109. data%State%TD_BOPElement%ElementType = 0.d0
  110. data%State%TD_BOPElement%ElementStart = 0.d0
  111. data%State%TD_BOPElement%ElementEnd = 0.d0
  112. do k = data%State%TD_String%DrillStemComponentsNumbs,TD_Numbs,-1
  113. if( ((data%State%TD_DrillStems(k)%TopDepth>=data%State%TD_BOP%BOPHeight(5)).and.(data%State%TD_DrillStems(k)%TopDepth<=data%State%TD_BOP%BOPHeight(4))) .or. ((data%State%TD_DrillStems(k)%DownDepth>=data%State%TD_BOP%BOPHeight(5)).and.(data%State%TD_DrillStems(k)%DownDepth<=data%State%TD_BOP%BOPHeight(4))) ) then
  114. n = n+1
  115. data%State%TD_BOPElement(n)%ElementType = data%State%TD_DrillStems(k)%ComponentType
  116. data%State%TD_BOPElement(n)%ElementStart = data%State%TD_DrillStems(k)%TopDepth
  117. data%State%TD_BOPElement(n)%ElementEnd = data%State%TD_DrillStems(k)%DownDepth
  118. else if ( data%State%TD_DrillStems(k)%TopDepth<=data%State%TD_BOP%BOPHeight(5) .and. data%State%TD_DrillStems(k)%DownDepth>=data%State%TD_BOP%BOPHeight(4) ) then
  119. n = n+1
  120. data%State%TD_BOPElement(n)%ElementType = data%State%TD_DrillStems(k)%ComponentType
  121. data%State%TD_BOPElement(n)%ElementStart = data%State%TD_DrillStems(k)%TopDepth
  122. data%State%TD_BOPElement(n)%ElementEnd = data%State%TD_DrillStems(k)%DownDepth
  123. end if
  124. end do
  125. Call SetBopElements(data%State%TD_BOPElement)
  126. end subroutine