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.

пре 1 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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. AnnDrillMud = .true.
  17. end subroutine AnnalusDrillMud
  18. subroutine AnnalusCirculateMud
  19. !DEC$ ATTRIBUTES DLLEXPORT::AnnalusCirculateMud
  20. !DEC$ ATTRIBUTES ALIAS: 'AnnalusCirculateMud' :: AnnalusCirculateMud
  21. implicit none
  22. 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(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(AnnalusFluids)) return
  45. do i = 1, count
  46. item => array(i)
  47. item%StartMd = AnnalusFluids(i)%StartMd
  48. item%EndMd = AnnalusFluids(i)%EndMd
  49. item%Density = AnnalusFluids(i)%Density
  50. item%MudType = 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(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(StringFluids)) return
  69. do i = 1, count
  70. item => array(i)
  71. item%StartMd = StringFluids(i)%StartMd
  72. item%EndMd = StringFluids(i)%EndMd
  73. item%Density = StringFluids(i)%Density
  74. item%MudType = 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 = 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(BopElements)
  108. !Annalus
  109. if(associated(AnnalusMudCountPtr)) call AnnalusMudCountPtr(AnnalusFluidsCount)
  110. if(associated(AnnalusMudArrayPtr)) call AnnalusMudArrayPtr(AnnalusFluids)
  111. !string
  112. if(associated(StringMudCountPtr)) call StringMudCountPtr(StringFluidsCount)
  113. if(associated(StringMudArrayPtr)) call StringMudArrayPtr(StringFluids)
  114. !components
  115. if(associated(StringComponentCountPtr)) call StringComponentCountPtr(StringCount)
  116. if(associated(StringComponentArrayPtr)) call StringComponentArrayPtr(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 = 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 = 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 = 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 = 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 = FormationPressure
  156. end function
  157. real function GetInfluxRate()
  158. !DEC$ ATTRIBUTES DLLEXPORT :: GetInfluxRate
  159. !DEC$ ATTRIBUTES ALIAS: 'GetInfluxRate' :: GetInfluxRate
  160. implicit none
  161. GetInfluxRate = 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 = 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 = SecondKickVolume
  176. end function
  177. real function GetPermeabilityExposedHeight()
  178. !DEC$ ATTRIBUTES DLLEXPORT :: GetPermeabilityExposedHeight
  179. !DEC$ ATTRIBUTES ALIAS: 'GetPermeabilityExposedHeight' :: GetPermeabilityExposedHeight
  180. implicit none
  181. GetPermeabilityExposedHeight = 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 = 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 = 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 = 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 = 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 = Volume
  212. end function
  213. end module CDownHole