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.
 
 
 
 
 
 

278 rivejä
9.3 KiB

  1. module CDownHole
  2. use CDownHoleVariables
  3. implicit none
  4. public
  5. !abstract interface
  6. ! subroutine ActionFluid(array)
  7. ! use CDownHoleVariables
  8. ! type(CFluid), intent(inout), target :: array
  9. ! end subroutine
  10. !end interface
  11. contains
  12. subroutine AnnalusDrillMud
  13. !DEC$ ATTRIBUTES DLLEXPORT::AnnalusDrillMud
  14. !DEC$ ATTRIBUTES ALIAS: 'AnnalusDrillMud' :: AnnalusDrillMud
  15. implicit none
  16. DownHole%AnnDrillMud = .true.
  17. end subroutine AnnalusDrillMud
  18. subroutine AnnalusCirculateMud
  19. !DEC$ ATTRIBUTES DLLEXPORT::AnnalusCirculateMud
  20. !DEC$ ATTRIBUTES ALIAS: 'AnnalusCirculateMud' :: AnnalusCirculateMud
  21. implicit none
  22. DownHole%AnnCirculateMud = .true.
  23. end subroutine AnnalusCirculateMud
  24. !type(CFluid) function ActionFluid() !(array)
  25. ! !use CDownHoleVariables
  26. ! !integer, intent(in) :: count
  27. ! !type(CFluid), intent(inout), target :: array !(count)
  28. ! end function
  29. integer function GetAnnalusFluidsCount()
  30. !DEC$ ATTRIBUTES DLLEXPORT::GetAnnalusFluidsCount
  31. !DEC$ ATTRIBUTES ALIAS: 'GetAnnalusFluidsCount' :: GetAnnalusFluidsCount
  32. implicit none
  33. GetAnnalusFluidsCount = size(DownHole%AnnalusFluids)
  34. !GetAnnalusFluidsCount = AnnalusFluidsCount
  35. end function GetAnnalusFluidsCount
  36. subroutine GetAnnalusFluids(count, array)
  37. !DEC$ ATTRIBUTES DLLEXPORT::GetAnnalusFluids
  38. !DEC$ ATTRIBUTES ALIAS: 'GetAnnalusFluids' :: GetAnnalusFluids
  39. implicit none
  40. integer :: i
  41. integer, intent(in) :: count
  42. type(CFluid), intent(inout), target :: array(count)
  43. type(CFluid), pointer :: item
  44. if(.not.allocated(DownHole%AnnalusFluids)) return
  45. do i = 1, count
  46. item => array(i)
  47. item%StartMd = DownHole%AnnalusFluids(i)%StartMd
  48. item%EndMd = DownHole%AnnalusFluids(i)%EndMd
  49. item%Density = DownHole%AnnalusFluids(i)%Density
  50. item%MudType = DownHole%AnnalusFluids(i)%MudType
  51. end do
  52. end subroutine GetAnnalusFluids
  53. integer function GetStringFluidsCount()
  54. !DEC$ ATTRIBUTES DLLEXPORT::GetStringFluidsCount
  55. !DEC$ ATTRIBUTES ALIAS: 'GetStringFluidsCount' :: GetStringFluidsCount
  56. implicit none
  57. !GetStringFluidsCount = StringFluidsCount
  58. GetStringFluidsCount = size(DownHole%StringFluids)
  59. end function GetStringFluidsCount
  60. subroutine GetStringFluids(count, array)
  61. !DEC$ ATTRIBUTES DLLEXPORT::GetStringFluids
  62. !DEC$ ATTRIBUTES ALIAS: 'GetStringFluids' :: GetStringFluids
  63. implicit none
  64. integer :: i
  65. integer, intent(in) :: count
  66. type(CFluid), intent(inout), target :: array(count)
  67. type(CFluid), pointer :: item
  68. if(.not.allocated(DownHole%StringFluids)) return
  69. do i = 1, count
  70. item => array(i)
  71. item%StartMd = DownHole%StringFluids(i)%StartMd
  72. item%EndMd = DownHole%StringFluids(i)%EndMd
  73. item%Density = DownHole%StringFluids(i)%Density
  74. item%MudType = DownHole%StringFluids(i)%MudType
  75. end do
  76. end subroutine GetStringFluids
  77. integer function GetStringCount()
  78. !DEC$ ATTRIBUTES DLLEXPORT::GetStringCount
  79. !DEC$ ATTRIBUTES ALIAS: 'GetStringCount' :: GetStringCount
  80. implicit none
  81. GetStringCount = DownHole%StringCount
  82. !GetStringCount = 4
  83. end function GetStringCount
  84. subroutine GetString(count, array)
  85. !DEC$ ATTRIBUTES DLLEXPORT::GetString
  86. !DEC$ ATTRIBUTES ALIAS: 'GetString' :: GetString
  87. implicit none
  88. integer :: i
  89. integer, intent(in) :: count
  90. type(CStringComponent), intent(inout), target :: array(count)
  91. type(CStringComponent), pointer :: item
  92. !do i = 1, count
  93. ! item => array(i)
  94. ! item%Length = String(i)%Length
  95. ! item%TopDepth = String(i)%TopDepth
  96. ! item%DownDepth = String(i)%DownDepth
  97. ! item%Od = String(i)%Od
  98. ! item%Id = String(i)%Id
  99. ! item%ComponentType = String(i)%ComponentType
  100. !end do
  101. end subroutine GetString
  102. subroutine GetDownhole()
  103. !DEC$ ATTRIBUTES DLLEXPORT::GetDownhole
  104. !DEC$ ATTRIBUTES ALIAS: 'GetDownhole' :: GetDownhole
  105. implicit none
  106. !BopElement
  107. if(associated(BopElementsPtr)) call BopElementsPtr(DownHole%BopElements)
  108. !Annalus
  109. if(associated(AnnalusMudCountPtr)) call AnnalusMudCountPtr(DownHole%AnnalusFluidsCount)
  110. if(associated(AnnalusMudArrayPtr)) call AnnalusMudArrayPtr(DownHole%AnnalusFluids)
  111. !string
  112. if(associated(StringMudCountPtr)) call StringMudCountPtr(DownHole%StringFluidsCount)
  113. if(associated(StringMudArrayPtr)) call StringMudArrayPtr(DownHole%StringFluids)
  114. !components
  115. if(associated(StringComponentCountPtr)) call StringComponentCountPtr(DownHole%StringCount)
  116. if(associated(StringComponentArrayPtr)) call StringComponentArrayPtr(DownHole%String)
  117. end subroutine GetDownhole
  118. real(8) function GetDrillPipePressureH()
  119. !DEC$ ATTRIBUTES DLLEXPORT :: GetDrillPipePressureH
  120. !DEC$ ATTRIBUTES ALIAS: 'GetDrillPipePressureH' :: GetDrillPipePressureH
  121. use PressureDisplayVARIABLES
  122. implicit none
  123. GetDrillPipePressureH = DownHole%DrillPipePressure !real(PressureGauges(1), 8) !
  124. end function
  125. real(8) function GetCasingPressureH()
  126. !DEC$ ATTRIBUTES DLLEXPORT :: GetCasingPressureH
  127. !DEC$ ATTRIBUTES ALIAS: 'GetCasingPressureH' :: GetCasingPressureH
  128. use FricPressDropVars
  129. implicit none
  130. !if (allocated(FinalFlowEl)) then
  131. ! if(size(FinalFlowEl) > 0) then
  132. ! CasingPressure = real(int(FinalFlowEl(AnnulusLastEl)%EndPress), 8) !CasingPressure
  133. ! endif
  134. !endif
  135. GetCasingPressureH = DownHole%CasingPressure
  136. end function
  137. real(8) function GetShoePressure()
  138. !DEC$ ATTRIBUTES DLLEXPORT :: GetShoePressure
  139. !DEC$ ATTRIBUTES ALIAS: 'GetShoePressure' :: GetShoePressure
  140. use PressureDisplayVARIABLES
  141. implicit none
  142. GetShoePressure = DownHole%ShoePressure !real(PressureGauges(5), 8) !
  143. end function
  144. real(8) function GetBottomHolePressure()
  145. !DEC$ ATTRIBUTES DLLEXPORT :: GetBottomHolePressure
  146. !DEC$ ATTRIBUTES ALIAS: 'GetBottomHolePressure' :: GetBottomHolePressure
  147. use PressureDisplayVARIABLES
  148. implicit none
  149. GetBottomHolePressure = DownHole%BottomHolePressure !real(PressureGauges(3), 8) !
  150. end function
  151. real(8) function GetFormationPressure()
  152. !DEC$ ATTRIBUTES DLLEXPORT :: GetFormationPressure
  153. !DEC$ ATTRIBUTES ALIAS: 'GetFormationPressure' :: GetFormationPressure
  154. implicit none
  155. GetFormationPressure = DownHole%FormationPressure
  156. end function
  157. real function GetInfluxRate()
  158. !DEC$ ATTRIBUTES DLLEXPORT :: GetInfluxRate
  159. !DEC$ ATTRIBUTES ALIAS: 'GetInfluxRate' :: GetInfluxRate
  160. implicit none
  161. GetInfluxRate = DownHole%InfluxRate
  162. end function
  163. real function GetKickVolume()
  164. !DEC$ ATTRIBUTES DLLEXPORT :: GetKickVolume
  165. !DEC$ ATTRIBUTES ALIAS: 'GetKickVolume' :: GetKickVolume
  166. implicit none
  167. !KickVolume = KickVolume + 1
  168. GetKickVolume = DownHole%KickVolume
  169. end function
  170. real function GetSecondKickVolume()
  171. !DEC$ ATTRIBUTES DLLEXPORT :: GetSecondKickVolume
  172. !DEC$ ATTRIBUTES ALIAS: 'GetSecondKickVolume' :: GetSecondKickVolume
  173. implicit none
  174. !SecondKickVolume = SecondKickVolume + 1
  175. GetSecondKickVolume = DownHole%SecondKickVolume
  176. end function
  177. real function GetPermeabilityExposedHeight()
  178. !DEC$ ATTRIBUTES DLLEXPORT :: GetPermeabilityExposedHeight
  179. !DEC$ ATTRIBUTES ALIAS: 'GetPermeabilityExposedHeight' :: GetPermeabilityExposedHeight
  180. implicit none
  181. GetPermeabilityExposedHeight = DownHole%PermeabilityExposedHeight
  182. end function
  183. real(8) function GetDensityH()
  184. !DEC$ ATTRIBUTES DLLEXPORT :: GetDensityH
  185. !DEC$ ATTRIBUTES ALIAS: 'GetDensityH' :: GetDensityH
  186. implicit none
  187. GetDensityH = DownHole%Density
  188. end function
  189. real(8) function GetPressureH()
  190. !DEC$ ATTRIBUTES DLLEXPORT :: GetPressureH
  191. !DEC$ ATTRIBUTES ALIAS: 'GetPressureH' :: GetPressureH
  192. implicit none
  193. GetPressureH = DownHole%Pressure
  194. end function
  195. real(8) function GetTemperatureH()
  196. !DEC$ ATTRIBUTES DLLEXPORT :: GetTemperatureH
  197. !DEC$ ATTRIBUTES ALIAS: 'GetTemperatureH' :: GetTemperatureH
  198. implicit none
  199. GetTemperatureH = DownHole%Temperature
  200. end function
  201. real(8) function GetHeightH()
  202. !DEC$ ATTRIBUTES DLLEXPORT :: GetHeightH
  203. !DEC$ ATTRIBUTES ALIAS: 'GetHeightH' :: GetHeightH
  204. implicit none
  205. GetHeightH = DownHole%Height
  206. end function
  207. real(8) function GetVolumeH()
  208. !DEC$ ATTRIBUTES DLLEXPORT :: GetVolumeH
  209. !DEC$ ATTRIBUTES ALIAS: 'GetVolumeH' :: GetVolumeH
  210. implicit none
  211. GetVolumeH = DownHole%Volume
  212. end function
  213. end module CDownHole