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.
 
 
 
 
 
 

181 lines
8.5 KiB

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