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.
 
 
 
 
 
 

180 lines
6.7 KiB

  1. subroutine TD_BOPDiamCalculation
  2. Use TD_DrillStemComponents
  3. Use TD_WellElements
  4. Use TD_WellGeometry
  5. Use TD_GeneralData
  6. Use TD_StringConnectionData
  7. Use CBopStackVariables
  8. Use VARIABLES
  9. Integer :: i , j , n , m , TD_Numbs
  10. Real(8) :: TD_LimitUp , TD_LimitDown , TD_OldFillingValue , TD_AnnTjDiff , TD_AnnularFilling
  11. Real(8) :: TD_ElToolJoints(2,2)
  12. !TD_ToolJointRange = 0.4005d0*3.28 ! [ft]
  13. !====================================================
  14. ! Read BOP Data
  15. !====================================================
  16. TD_BOPHeight(5) = BopStackSpecification%AboveAnnularHeight
  17. TD_BOPHeight(1) = BopStackSpecification%AnnularPreventerHeight
  18. TD_BOPHeight(2) = BopStackSpecification%UpperRamHeight
  19. TD_BOPHeight(3) = BopStackSpecification%BlindRamHeight
  20. TD_BOPHeight(6) = BopStackSpecification%KillHeight
  21. TD_BOPHeight(4) = BopStackSpecification%LowerRamHeight
  22. TD_BOPRamDiam(1) = ShearRam%IDAnnularFinal
  23. TD_BOPRamDiam(2) = ShearRam%IDPipeRam1Final
  24. TD_BOPRamDiam(3) = ShearRam%IDshearBopFinal
  25. TD_BOPRamDiam(4) = ShearRam%IDPipeRam2Final
  26. !====================================================
  27. ! Element Counts in BOPStack Domain
  28. !====================================================
  29. !if (TD_DrillStemComponentsNumbs>5) then
  30. TD_Numbs = TD_DrillStemComponentsNumbs-7 ! 7 Elements from the Top of DrillStem
  31. !else
  32. ! TD_Numbs = 1
  33. !end if
  34. !====================================================
  35. ! Determination of Elements Diameter in BOPStack Domain
  36. !====================================================
  37. TD_BOPDiam = 0.d0
  38. TD_OldFillingValue = 0.d0
  39. Do i = TD_DrillStemComponentsNumbs,TD_Numbs,-1
  40. TD_LimitUp = TD_DrillStems(i)%TopDepth+TD_DrillStems(i)%ToolJointRange
  41. TD_LimitDown = TD_DrillStems(i)%DownDepth-TD_DrillStems(i)%ToolJointRange
  42. TD_ElToolJoints(1,1) = TD_DrillStems(i)%TopDepth ! TD_ElToolJoints(i,j) , i=top & down tooljoints of element , j=top & down tooljoints Depth
  43. TD_ElToolJoints(1,2) = TD_LimitUp
  44. TD_ElToolJoints(2,1) = TD_LimitDown
  45. TD_ElToolJoints(2,2) = TD_DrillStems(i)%DownDepth
  46. !===> che meghdar az fazaye annular ba tooljoint por mishavad (for BOP Module)
  47. Do m = 1,2
  48. TD_AnnTjDiff = min(TD_ElToolJoints(m,2),(TD_BOPHeight(1)+TD_BOPThickness))-max(TD_ElToolJoints(m,1),(TD_BOPHeight(1)-TD_BOPThickness))
  49. if (TD_AnnTjDiff<0.) then ! tooljoint is not in the annular range
  50. TD_AnnTjDiff = 0.d0
  51. end if
  52. TD_AnnularFilling = TD_OldFillingValue+(TD_AnnTjDiff/(TD_BOPThickness*2.d0)) ! 0=<TD_AnnularFilling<=1
  53. TD_OldFillingValue = TD_AnnularFilling
  54. End Do
  55. do j = 1,6
  56. if ( (TD_BOPHeight(j)-TD_BOPThickness)>TD_LimitUp .and. (TD_BOPHeight(j)+TD_BOPThickness)<TD_LimitDown ) then
  57. TD_BOPDiam(j) = TD_DrillStems(i)%Od
  58. TD_BOPElementNo(j) = i
  59. if ( TD_DrillStems(i)%ComponentType==3 .and. j/=1 .and. TD_DrillStemRotVelocity==0. ) then
  60. TD_BOPConnectionPossibility(j) = 1
  61. else if ( j==1 ) then
  62. TD_BOPConnectionPossibility(j) = 1
  63. else
  64. TD_BOPConnectionPossibility(j) = 0
  65. end if
  66. !print* , 'T.DP. , B.DP. 1=' , TD_DrillStems(i)%TopDepth , TD_DrillStems(i)%DownDepth
  67. !print* , 'T.R. , B.R. , LimitUp , LimitDown 1=' , (TD_BOPHeight(j)-TD_BOPThickness) , (TD_BOPHeight(j)+TD_BOPThickness) , TD_LimitUp , TD_LimitDown
  68. !print* , 'stringNo , ramsNo , Possibility , BOPDiam 1=' , i , j , TD_BOPConnectionPossibility(j) , TD_BOPDiam(j)
  69. else if ( (TD_BOPHeight(j)+TD_BOPThickness)>=TD_DrillStems(i)%TopDepth .and. (TD_BOPHeight(j)-TD_BOPThickness)<=TD_DrillStems(i)%DownDepth ) then
  70. TD_BOPDiam(j) = TD_DrillStems(i)%RtoolJoint*2.d0
  71. TD_BOPElementNo(j) = i
  72. if ( j==1 ) then
  73. TD_BOPConnectionPossibility(j) = 1
  74. else
  75. TD_BOPConnectionPossibility(j) = 0
  76. end if
  77. !print* , 'T.DP. , B.DP. 2=' , TD_DrillStems(i)%TopDepth , TD_DrillStems(i)%DownDepth
  78. !print* , 'T.R. , B.R. , LimitUp , LimitDown 2=' , (TD_BOPHeight(j)-TD_BOPThickness) , (TD_BOPHeight(j)+TD_BOPThickness) , TD_LimitUp , TD_LimitDown
  79. !print* , 'stringNo , ramsNo , Possibility , BOPDiam 2=' , i , j , TD_BOPConnectionPossibility(j) , TD_BOPDiam(j)
  80. end if
  81. end do
  82. End Do
  83. TD_AnnularFillingFinal = TD_AnnularFilling
  84. TD_AboveAnnularDiam = TD_BOPDiam(5)
  85. TD_AnnularPreventerDiam = TD_BOPDiam(1)
  86. TD_UpperRamDiam = TD_BOPDiam(2)
  87. TD_BlindRamDiam = TD_BOPDiam(3)
  88. TD_KillDiam = TD_BOPDiam(6)
  89. TD_LowerRamDiam = TD_BOPDiam(4)
  90. !print* , 'TD_BOPElementNo=' , TD_BOPElementNo
  91. !print* , 'TD_BOPConnectionPossibility=' , TD_BOPConnectionPossibility
  92. !print* , 'TD_BOPDiam=' , TD_BOPDiam
  93. !!===> BOP RAMs Condition *** TD_BOPCondition: 0=open , 1=close
  94. !do j = 1,4
  95. ! if ( TD_BOPDiam(j)>=TD_BOPRamDiam(j) ) then
  96. ! TD_BOPCondition(j) = 1
  97. ! else
  98. ! TD_BOPCondition(j) = 0
  99. ! end if
  100. !end do
  101. !====================================================
  102. ! String Elements Configuration in BOPStack Domain
  103. !====================================================
  104. !if ( allocated(TD_BOPElement) ) deallocate (TD_BOPElement)
  105. !allocate(TD_BOPElement())
  106. n = 0
  107. TD_BOPElement%ElementType = 0.d0
  108. TD_BOPElement%ElementStart = 0.d0
  109. TD_BOPElement%ElementEnd = 0.d0
  110. do k = TD_DrillStemComponentsNumbs,TD_Numbs,-1
  111. if( ((TD_DrillStems(k)%TopDepth>=TD_BOPHeight(5)).and.(TD_DrillStems(k)%TopDepth<=TD_BOPHeight(4))) .or. ((TD_DrillStems(k)%DownDepth>=TD_BOPHeight(5)).and.(TD_DrillStems(k)%DownDepth<=TD_BOPHeight(4))) ) then
  112. n = n+1
  113. TD_BOPElement(n)%ElementType = TD_DrillStems(k)%ComponentType
  114. TD_BOPElement(n)%ElementStart = TD_DrillStems(k)%TopDepth
  115. TD_BOPElement(n)%ElementEnd = TD_DrillStems(k)%DownDepth
  116. else if ( TD_DrillStems(k)%TopDepth<=TD_BOPHeight(5) .and. TD_DrillStems(k)%DownDepth>=TD_BOPHeight(4) ) then
  117. n = n+1
  118. TD_BOPElement(n)%ElementType = TD_DrillStems(k)%ComponentType
  119. TD_BOPElement(n)%ElementStart = TD_DrillStems(k)%TopDepth
  120. TD_BOPElement(n)%ElementEnd = TD_DrillStems(k)%DownDepth
  121. end if
  122. end do
  123. Call SetBopElements(TD_BOPElement)
  124. end subroutine