|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314 |
- subroutine TD_DrillStemConfiguration
-
- Use CStringConfigurationVariables
- use SoftwareInputsVariables
- ! Use CNearFloorConnection
- use CDataDisplayConsole
- use SimulationVariables
- use SimulationVariables !@
- use UnitySignalVariables
- use UnitySignalsModule
- ! use UnitySignalsModuleVariables
- use OperationScenariosModule
- Use TD_DrillStemComponents
- use SimulationVariables !@
- use SimulationVariables !@
- Use TD_StringConnectionData
- Use sROP_Variables
- use DownHoleModule
-
-
- implicit none
-
- Integer :: i , j , k , kk , TD_Status
-
-
-
-
-
-
- !====================================================
- ! Drill Stem Components Data Modification
- !====================================================
-
-
- !=====> Drill Stem Total Length&Weight Calculation
- data%State%TD_String%DrillStemTotalLength = 0.0d0
- data%State%TD_String%DrillStemTotalLengthIni = 0.0d0
- data%State%TD_String%DrillStemTotalWeight = 0.0d0
- Do i= 1,data%State%TD_String%DrillStemComponentsNumbs
- data%State%TD_String%DrillStemTotalLength = data%State%TD_String%DrillStemTotalLength+data%State%TD_DrillStems(i)%Length
- data%State%TD_String%DrillStemTotalLengthIni = data%State%TD_String%DrillStemTotalLengthIni+data%State%TD_DrillStems(i)%LengthIni
- data%State%TD_String%DrillStemTotalWeight = data%State%TD_String%DrillStemTotalWeight+data%State%TD_DrillStems(i)%Weight
- End Do
-
-
-
-
-
-
-
- !=====> Top&Down Depth Calculation Of Initial Drill Stem Components (Graphic)
- data%State%TD_DrillStems(1)%DownDepth = data%State%TD_String%DrillStemTotalLength-data%State%TD_StConn%ConnectionHeight
- data%State%TD_String%DrillStemBottom = data%State%TD_DrillStems(1)%DownDepth
- if ( data%State%TD_DrillStems(1)%DownDepth>=data%State%TD_WellGeneral%WellTotalLength ) then
- !if ( data%State%TD_StConn%HookHeight>=data%State%TD_StConn%HookHeightOld .and. data%State%ROP_Bit%RateOfPenetration==0. ) then
- ! data%State%TD_StConn%GRigidConnectionHeight = data%State%TD_StConn%GRigidConnectionHeight
- !else
- data%State%TD_StConn%GRigidConnectionHeight = data%State%TD_StConn%GRigidConnectionHeight-(data%State%TD_WellGeneral%WellTotalLength-data%State%TD_DrillStems(1)%DownDepthIniG)
- data%State%TD_DrillStems(1)%DownDepthIniG = data%State%TD_WellGeneral%WellTotalLength !???????????
- ! !data%State%TD_StConn%GRigidConnectionHeight = data%State%TD_StConn%GRigidConnectionHeight
- !end if
- else
- data%State%TD_StConn%GRigidConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_DrillStems(1)%DownDepthIniG = data%State%TD_String%DrillStemTotalLengthIni-data%State%TD_StConn%GRigidConnectionHeight
- end if
-
- !data%State%TD_DrillStems(1)%DownDepthIniG = data%State%TD_String%DrillStemTotalLengthIni-data%State%TD_StConn%GRigidConnectionHeight
- !if ( data%State%TD_DrillStems(1)%DownDepthIniG>data%State%TD_WellGeneral%WellTotalLength ) then
- ! data%State%TD_StConn%GRigidConnectionHeight = data%State%TD_StConn%GRigidConnectionHeight+(data%State%TD_DrillStems(1)%DownDepthIniG-data%State%TD_WellGeneral%WellTotalLength)
- ! data%State%TD_DrillStems(1)%DownDepthIniG = data%State%TD_WellGeneral%WellTotalLength !???????????
- !end if
- data%State%TD_DrillStems(1)%TopDepthIniG = data%State%TD_DrillStems(1)%DownDepthIniG-data%State%TD_DrillStems(1)%LengthIni
- Do i = 2,data%State%TD_String%DrillStemComponentsNumbs
- data%State%TD_DrillStems(i)%TopDepthIniG = data%State%TD_DrillStems(i-1)%TopDepthIniG-data%State%TD_DrillStems(i)%LengthIni
- data%State%TD_DrillStems(i)%DownDepthIniG = data%State%TD_DrillStems(i-1)%DownDepthIniG-data%State%TD_DrillStems(i-1)%LengthIni
- End Do
-
-
-
-
-
-
-
-
- !=====> Top&Down Depth Calculation Of Initial Drill Stem Components (for fluid module)
- if ( data%State%TD_DrillStems(1)%DownDepthIniG>=(data%State%TD_WellGeneral%WellTotalLength-.1d0) ) then
- data%State%TD_StConn%RigidConnectionHeight = data%State%TD_StConn%GRigidConnectionHeight+(.1d0-(data%State%TD_WellGeneral%WellTotalLength-data%State%TD_DrillStems(1)%DownDepthIniG))
- else
- data%State%TD_StConn%RigidConnectionHeight = data%State%TD_StConn%GRigidConnectionHeight
- end if
-
- data%State%TD_DrillStems(1)%DownDepthIni = data%State%TD_String%DrillStemTotalLengthIni-data%State%TD_StConn%RigidConnectionHeight
- data%State%TD_DrillStems(1)%TopDepthIni = data%State%TD_DrillStems(1)%DownDepthIni-data%State%TD_DrillStems(1)%LengthIni
-
- Do i = 2,data%State%TD_String%DrillStemComponentsNumbs
- data%State%TD_DrillStems(i)%TopDepthIni = data%State%TD_DrillStems(i-1)%TopDepthIni-data%State%TD_DrillStems(i)%LengthIni
- data%State%TD_DrillStems(i)%DownDepthIni = data%State%TD_DrillStems(i-1)%DownDepthIni-data%State%TD_DrillStems(i-1)%LengthIni
- End Do
-
-
-
-
-
-
-
-
-
- !=====> Top&Down Depth Calculation Of Drill Stem Components
- data%State%TD_DrillStems(1)%TopDepth = data%State%TD_String%DrillStemTotalLength-data%State%TD_DrillStems(1)%Length-data%State%TD_StConn%GRigidConnectionHeight
- data%State%TD_DrillStems(1)%DownDepth = data%State%TD_String%DrillStemTotalLength-data%State%TD_StConn%GRigidConnectionHeight
-
- Do i = 2,data%State%TD_String%DrillStemComponentsNumbs
- data%State%TD_DrillStems(i)%TopDepth = data%State%TD_DrillStems(i-1)%TopDepth-data%State%TD_DrillStems(i)%Length
- data%State%TD_DrillStems(i)%DownDepth = data%State%TD_DrillStems(i-1)%DownDepth-data%State%TD_DrillStems(i-1)%Length
- End Do
-
- !data%State%TD_String%DrillStemBottom = data%State%TD_DrillStems(1)%DownDepth
-
-
-
-
-
-
-
-
-
- !=====> Hole Type & Inclination Determination Of Drill Stem Components
- Do i = 1,data%State%TD_String%DrillStemComponentsNumbs
-
-
- if (data%State%TD_DrillStems(i)%TopDepth .ge. 0.d0) then
-
-
- Do j = 1,data%State%TD_WellGeneral%WellIntervalsCount
- if (data%State%TD_DrillStems(i)%TopDepth>data%State%TD_WellGeo(j)%TopDepth .and. data%State%TD_DrillStems(i)%TopDepth<data%State%TD_WellGeo(j)%DownDepth) then
- data%State%TD_DrillStems(i)%HoleType = data%State%TD_WellGeo(j)%HoleType
-
-
-
- if (data%State%TD_DrillStems(i)%HoleType == 1) then
- data%State%TD_DrillStems(i)%StartAngle = data%State%TD_WellGeo(j)%StartAngle+(((data%State%TD_DrillStems(i)%TopDepth-data%State%TD_WellGeo(j)%TopDepth)/data%State%TD_WellGeo(j)%RCurvature)) ![rad]
- data%State%TD_DrillStems(i)%EndAngle = data%State%TD_WellGeo(j)%StartAngle+(((data%State%TD_DrillStems(i)%DownDepth-data%State%TD_WellGeo(j)%TopDepth)/data%State%TD_WellGeo(j)%RCurvature))
- data%State%TD_DrillStems(i)%RCurvature = data%State%TD_WellGeo(j)%RCurvature
- else if (data%State%TD_DrillStems(i)%HoleType == 2) then
- data%State%TD_DrillStems(i)%StartAngle = data%State%TD_WellGeo(j)%StartAngle-(((data%State%TD_DrillStems(i)%TopDepth-data%State%TD_WellGeo(j)%TopDepth)/data%State%TD_WellGeo(j)%RCurvature))
- data%State%TD_DrillStems(i)%EndAngle = data%State%TD_WellGeo(j)%StartAngle-(((data%State%TD_DrillStems(i)%DownDepth-data%State%TD_WellGeo(j)%TopDepth)/data%State%TD_WellGeo(j)%RCurvature))
- data%State%TD_DrillStems(i)%RCurvature = data%State%TD_WellGeo(j)%RCurvature
- else
- data%State%TD_DrillStems(i)%StartAngle = data%State%TD_WellGeo(j)%EndAngle !Straight
- data%State%TD_DrillStems(i)%EndAngle = data%State%TD_DrillStems(i)%StartAngle
- end if
-
-
- end if
- End Do
-
-
- else
- data%State%TD_DrillStems(i)%HoleType = 0 !Straight
- data%State%TD_DrillStems(i)%StartAngle = 0.0d0
- data%State%TD_DrillStems(i)%EndAngle = 0.0d0
- end if
-
-
- End Do
-
-
-
-
-
-
-
-
-
-
- !=====> Hole(Well) Diameter Determination Of Drill Stem Components
- Do i = 1,data%State%TD_String%DrillStemComponentsNumbs
- If (data%State%TD_DrillStems(i)%TopDepth>data%State%TD_Casing(1)%TopDepth .and. data%State%TD_DrillStems(i)%TopDepth<data%State%TD_Casing(1)%DownDepth) then
- data%State%TD_DrillStems(i)%HoleDiameter = data%State%TD_Casing(1)%Id
- Else if (data%State%TD_Liner(1)%Length/=0.d0 .and. data%State%TD_DrillStems(i)%TopDepth>data%State%TD_Liner(1)%TopDepth .and. data%State%TD_DrillStems(i)%TopDepth<data%State%TD_Liner(1)%DownDepth) then
- data%State%TD_DrillStems(i)%HoleDiameter = data%State%TD_Liner(1)%Id
- Else if (data%State%TD_OpenHole(1)%Length/=0.d0 .and. data%State%TD_DrillStems(i)%TopDepth>data%State%TD_OpenHole(1)%TopDepth .and. data%State%TD_DrillStems(i)%TopDepth<data%State%TD_OpenHole(1)%DownDepth) then
- data%State%TD_DrillStems(i)%HoleDiameter = data%State%TD_OpenHole(1)%Id
- Else if (data%State%TD_ROPHole(1)%Length/=0.d0 .and. data%State%TD_DrillStems(i)%TopDepth>data%State%TD_ROPHole(1)%TopDepth .and. data%State%TD_DrillStems(i)%TopDepth<data%State%TD_ROPHole(1)%DownDepth) then
- data%State%TD_DrillStems(i)%HoleDiameter = data%State%TD_ROPHole(1)%Id !????????? check
- End If
-
- !=====> Viscosity Correction Coefficient Calculation
- if (data%State%TD_DrillStems(i)%HoleType == 1 .or. data%State%TD_DrillStems(i)%HoleType == 2) then
- data%State%TD_DrillStems(i)%MudVisCorrectCoef = (2.0d0/pi)*atan(sqrt(data%State%TD_DrillStems(i)%HoleDiameter**2-(data%State%TD_DrillStems(i)%Od**2)) &
- / (data%State%TD_DrillStems(i)%Od))*(4.0d0/pi-1.0d0) + 1.0d0
- else if (data%State%TD_DrillStems(i)%HoleType == 0) then
- data%State%TD_DrillStems(i)%MudVisCorrectCoef = 1.d0
- end if
- End Do
-
-
-
-
-
-
-
-
-
- !=====> Out_of_Well Length Of DrillStem
- if (data%State%TD_DrillStems(data%State%TD_String%DrillStemComponentsNumbs)%TopDepth<0.) then
- data%State%TD_String%OutOfWellLength = abs(data%State%TD_DrillStems(data%State%TD_String%DrillStemComponentsNumbs)%TopDepth)
- else
- data%State%TD_String%OutOfWellLength = 0.d0
- end if
-
-
-
-
-
-
-
- !=====> Near Floor Connection
- Do i = data%State%TD_String%DrillStemComponentsNumbs, 1, -1
- if ( data%State%TD_DrillStems(i)%TopDepth<=0.d0 ) then
- data%State%TD_String%NearFloorConnectionNo = i
- data%State%TD_String%NearFloorConnectionHeight = abs(data%State%TD_DrillStems(i)%TopDepth)
- end if
- if (data%State%TD_DrillStems(i)%TopDepth>0.d0) then
- exit
- end if
- End Do
- Call Set_NearFloorConnection(real(data%State%TD_String%NearFloorConnectionHeight))
-
- !=====> Graphic Output
- kk = 0
- k = 0
- Do i= 1,data%State%TD_String%StringConfigurationCount
- k = k+1
- if ( data%State%TD_DrillStems(k)%DownDepthIniG>0.d0 ) then
- kk = kk+1
- if (data%State%TD_DrillStems(k+data%State%TD_DrillStem(i)%Numbs-1)%TopDepthIniG<=0.d0) then
- exit
- end if
- k = k+data%State%TD_DrillStem(i)%Numbs-1
- end if
- End Do
-
- if (allocated(data%State%G_StringElement)) deallocate(data%State%G_StringElement)
- allocate(data%State%G_StringElement(kk))
- k = 0
- Do i= 1,kk
- data%State%G_StringElement(kk-i+1)%Id = data%State%TD_DrillStem(i)%Id
- data%State%G_StringElement(kk-i+1)%Od = data%State%TD_DrillStem(i)%Od
- if ( data%State%TD_DrillStem(i)%ComponentType>4 ) then
- data%State%G_StringElement(kk-i+1)%ComponentType = 3
- else
- data%State%G_StringElement(kk-i+1)%ComponentType = data%State%TD_DrillStem(i)%ComponentType
- end if
- data%State%G_StringElement(kk-i+1)%TopDepth = data%State%TD_DrillStems(k+data%State%TD_DrillStem(i)%Numbs)%TopDepthIniG
- data%State%G_StringElement(kk-i+1)%DownDepth = data%State%TD_DrillStems(k+1)%DownDepthIniG
- k = k+data%State%TD_DrillStem(i)%Numbs
- End Do
- if (data%State%G_StringElement(1)%TopDepth<=0.d0) then
- data%State%G_StringElement(1)%TopDepth = 0.d0
- end if
-
- Call SetString(kk, data%State%G_StringElement)
-
-
- if(data%State%TD_DrillStems(1)%DownDepth<0.d0) then
- data%Equipments%DrillingWatch%BitPosition = data%State%TD_DrillStems(1)%DownDepth
- else
- data%Equipments%DrillingWatch%BitPosition = data%State%G_StringElement(kk)%DownDepth !???????????
- !if ( data%State%G_StringElement(kk)%DownDepth>data%State%TD_WellGeneral%WellTotalLength ) then
- ! data%Equipments%DrillingWatch%BitPosition = data%State%TD_WellGeneral%WellTotalLength !???????????
- !end if
- end if
-
- !if(print_log) print*, 'kk=' , kk
- !Do i=1,kk
- ! if(print_log) print*, 'Number/' , 'downDepth/' , 'topDepth/'
- ! if(print_log) print*, 'ID/' , 'OD/' , 'Type/'
- ! if(print_log) print*, i , data%State%G_StringElement(i)%DownDepth , data%State%G_StringElement(i)%TopDepth
- ! if(print_log) print*, data%State%G_StringElement(i)%Id , data%State%G_StringElement(i)%Od , data%State%G_StringElement(i)%ComponentType
- !End Do
-
-
-
-
-
-
- !if(print_log) print*, 'Top Joint Height before=' , data%State%TD_String%TopJointHeight
- !=====> Top Joint Height
- if ( Get_OperationCondition()==OPERATION_DRILL .and. Get_KellyConnection() == KELLY_CONNECTION_STRING ) then
- data%State%TD_String%TopJointHeight = abs(data%State%TD_DrillStems(data%State%TD_String%DrillStemComponentsNumbs-1)%TopDepth)
- !if(print_log) print*, 'TopDepth1=' , data%State%TD_DrillStems(data%State%TD_String%DrillStemComponentsNumbs-1)%TopDepth
- !if(print_log) print*, 'numb1=' , data%State%TD_String%DrillStemComponentsNumbs-1
- !if(print_log) print*, 'data%State%TD_String%TopJointHeight=' , data%State%TD_String%TopJointHeight
- else
- data%State%TD_String%TopJointHeight = abs(data%State%TD_DrillStems(data%State%TD_String%DrillStemComponentsNumbs)%TopDepth)
- !if(print_log) print*, 'TopDepth2=' , data%State%TD_DrillStems(data%State%TD_String%DrillStemComponentsNumbs)%TopDepth
- !if(print_log) print*, 'numb2=' , data%State%TD_String%DrillStemComponentsNumbs
- !if(print_log) print*, 'data%State%TD_String%TopJointHeight2=' , data%State%TD_String%TopJointHeight
- end if
-
- !if(print_log) print*, 'data%State%TD_String%DrillStemComponentsNumbs=' , data%State%TD_String%DrillStemComponentsNumbs
- !if(print_log) print*, 'data%State%TD_String%TopJointHeight_=' , data%State%TD_String%TopJointHeight
- !if(print_log) print*, 'data%State%TD_StConn%ConnectionHeight_=' , data%State%TD_StConn%ConnectionHeight
- !if(print_log) print*, 'data%State%TD_StConn%StringConnectionMode_=' , data%State%TD_StConn%StringConnectionMode
- !
- !if(print_log) print*, 'Top Joint Height after=' , data%State%TD_String%TopJointHeight
-
-
-
-
-
-
- end subroutine
|