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.

CPumpsVariables.f90 8.3 KiB

1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. module CPumpsVariables
  2. use CIActionReference
  3. implicit none
  4. public
  5. ! Pumps Specifications
  6. real(8) :: MudPump1LinerDiameter
  7. real(8) :: MudPump1Stroke
  8. real(8) :: MudPump1MechanicalEfficiency
  9. real(8) :: MudPump1VolumetricEfficiency
  10. real(8) :: MudPump1Output
  11. real(8) :: MudPump1OutputBblStroke
  12. real(8) :: MudPump1Maximum
  13. real(8) :: MudPump1ReliefValvePressure
  14. real(8) :: MudPump2LinerDiameter
  15. real(8) :: MudPump2Stroke
  16. real(8) :: MudPump2MechanicalEfficiency
  17. real(8) :: MudPump2VolumetricEfficiency
  18. real(8) :: MudPump2Output
  19. real(8) :: MudPump2OutputBblStroke
  20. real(8) :: MudPump2Maximum
  21. real(8) :: MudPump2ReliefValvePressure
  22. real(8) :: CementPumpLinerDiameter
  23. real(8) :: CementPumpStroke
  24. real(8) :: CementPumpMechanicalEfficiency
  25. real(8) :: CementPumpVolumetricEfficiency
  26. real(8) :: CementPumpOutput
  27. real(8) :: CementPumpOutputBblStroke
  28. real(8) :: CementPumpMaximum
  29. real(8) :: CementPumpReliefValvePressure
  30. logical :: MudPump1ReliefValveIsSet
  31. logical :: MudPump2ReliefValveIsSet
  32. logical :: CementPumpReliefValveIsSet
  33. logical :: ManualPumpPower
  34. logical :: Valve1
  35. logical :: Valve2
  36. logical :: Valve3
  37. logical :: Valve4
  38. logical :: Valve5
  39. procedure (ActionDouble), pointer :: MudPump1LinerDiameterPtr
  40. procedure (ActionDouble), pointer :: MudPump2LinerDiameterPtr
  41. procedure (ActionDouble), pointer :: MudPump3LinerDiameterPtr
  42. procedure (ActionDouble), pointer :: MudPump1OutputBblStrokePtr
  43. procedure (ActionDouble), pointer :: MudPump2OutputBblStrokePtr
  44. procedure (ActionDouble), pointer :: MudPump3OutputBblStrokePtr
  45. real(8) :: MathPI = 3.14159265358979d0
  46. contains
  47. subroutine OpenPump1()
  48. use CManifolds
  49. implicit none
  50. call ChangeValve(16, .true.)
  51. end subroutine
  52. subroutine ClosePump1()
  53. use CManifolds
  54. implicit none
  55. call ChangeValve(16, .false.)
  56. end subroutine
  57. subroutine OpenPump2()
  58. use CManifolds
  59. implicit none
  60. call ChangeValve(17, .true.)
  61. end subroutine
  62. subroutine ClosePump2()
  63. use CManifolds
  64. implicit none
  65. call ChangeValve(17, .false.)
  66. end subroutine
  67. subroutine OpenCementPump()
  68. use CManifolds
  69. implicit none
  70. call ChangeValve(18, .true.)
  71. end subroutine
  72. subroutine CloseCementPump()
  73. use CManifolds
  74. implicit none
  75. call ChangeValve(18, .false.)
  76. end subroutine
  77. subroutine SubscribeMudPump1LinerDiameter(a)
  78. !DEC$ ATTRIBUTES DLLEXPORT :: SubscribeMudPump1LinerDiameter
  79. !DEC$ ATTRIBUTES ALIAS: 'SubscribeMudPump1LinerDiameter' :: SubscribeMudPump1LinerDiameter
  80. implicit none
  81. procedure (ActionDouble) :: a
  82. MudPump1LinerDiameterPtr => a
  83. end subroutine
  84. subroutine SubscribeMudPump2LinerDiameter(a)
  85. !DEC$ ATTRIBUTES DLLEXPORT :: SubscribeMudPump2LinerDiameter
  86. !DEC$ ATTRIBUTES ALIAS: 'SubscribeMudPump2LinerDiameter' :: SubscribeMudPump2LinerDiameter
  87. implicit none
  88. procedure (ActionDouble) :: a
  89. MudPump2LinerDiameterPtr => a
  90. end subroutine
  91. subroutine SubscribeMudPump3LinerDiameter(a)
  92. !DEC$ ATTRIBUTES DLLEXPORT :: SubscribeMudPump3LinerDiameter
  93. !DEC$ ATTRIBUTES ALIAS: 'SubscribeMudPump3LinerDiameter' :: SubscribeMudPump3LinerDiameter
  94. implicit none
  95. procedure (ActionDouble) :: a
  96. MudPump3LinerDiameterPtr => a
  97. end subroutine
  98. subroutine SubscribeMudPump1OutputBblStroke(a)
  99. !DEC$ ATTRIBUTES DLLEXPORT :: SubscribeMudPump1OutputBblStroke
  100. !DEC$ ATTRIBUTES ALIAS: 'SubscribeMudPump1OutputBblStroke' :: SubscribeMudPump1OutputBblStroke
  101. implicit none
  102. procedure (ActionDouble) :: a
  103. MudPump1OutputBblStrokePtr => a
  104. end subroutine
  105. subroutine SubscribeMudPump2OutputBblStroke(a)
  106. !DEC$ ATTRIBUTES DLLEXPORT :: SubscribeMudPump2OutputBblStroke
  107. !DEC$ ATTRIBUTES ALIAS: 'SubscribeMudPump2OutputBblStroke' :: SubscribeMudPump2OutputBblStroke
  108. implicit none
  109. procedure (ActionDouble) :: a
  110. MudPump2OutputBblStrokePtr => a
  111. end subroutine
  112. subroutine SubscribeMudPump3OutputBblStroke(a)
  113. !DEC$ ATTRIBUTES DLLEXPORT :: SubscribeMudPump3OutputBblStroke
  114. !DEC$ ATTRIBUTES ALIAS: 'SubscribeMudPump3OutputBblStroke' :: SubscribeMudPump3OutputBblStroke
  115. implicit none
  116. procedure (ActionDouble) :: a
  117. MudPump3OutputBblStrokePtr => a
  118. end subroutine
  119. subroutine SetMudPump1LinerDiameterN(a)
  120. implicit none
  121. real(8) :: a
  122. if(associated(MudPump1LinerDiameterPtr)) call MudPump1LinerDiameterPtr(a)
  123. end subroutine
  124. subroutine SetMudPump2LinerDiameterN(a)
  125. implicit none
  126. real(8) :: a
  127. if(associated(MudPump2LinerDiameterPtr)) call MudPump2LinerDiameterPtr(a)
  128. end subroutine
  129. subroutine SetMudPump3LinerDiameterN(a)
  130. implicit none
  131. real(8) :: a
  132. if(associated(MudPump3LinerDiameterPtr)) call MudPump3LinerDiameterPtr(a)
  133. end subroutine
  134. subroutine SetMudPump1OutputBblStrokeN(a)
  135. implicit none
  136. real(8) :: a
  137. if(associated(MudPump1OutputBblStrokePtr)) call MudPump1OutputBblStrokePtr(a)
  138. end subroutine
  139. subroutine SetMudPump2OutputBblStrokeN(a)
  140. implicit none
  141. real(8) :: a
  142. if(associated(MudPump2OutputBblStrokePtr)) call MudPump2OutputBblStrokePtr(a)
  143. end subroutine
  144. subroutine SetMudPump3OutputBblStrokeN(a)
  145. implicit none
  146. real(8) :: a
  147. if(associated(MudPump3OutputBblStrokePtr)) call MudPump3OutputBblStrokePtr(a)
  148. end subroutine
  149. subroutine CalcMudPump1LinerDiameter()
  150. use, intrinsic :: IEEE_ARITHMETIC
  151. implicit none
  152. real(8) :: a
  153. a = (MathPI / 4.d0) * MudPump1Stroke * 3.0d0 * MudPump1VolumetricEfficiency / 9702.03d0
  154. a = dsqrt(MudPump1OutputBblStroke / a)
  155. if (.not.IEEE_IS_FINITE(a) .or. IEEE_IS_NAN(a)) then
  156. MudPump1LinerDiameter = 0.0
  157. else
  158. MudPump1LinerDiameter = a
  159. endif
  160. call SetMudPump1LinerDiameterN(MudPump1LinerDiameter)
  161. end subroutine
  162. subroutine CalcMudPump2LinerDiameter()
  163. use, intrinsic :: IEEE_ARITHMETIC
  164. implicit none
  165. real(8) :: a
  166. a = (MathPI / 4.d0) * MudPump2Stroke * 3.0d0 * MudPump2VolumetricEfficiency / 9702.03d0
  167. a = dsqrt(MudPump2OutputBblStroke / a)
  168. if (.not.IEEE_IS_FINITE(a) .or. IEEE_IS_NAN(a)) then
  169. MudPump2LinerDiameter = 0.0
  170. else
  171. MudPump2LinerDiameter = a
  172. endif
  173. call SetMudPump2LinerDiameterN(MudPump2LinerDiameter)
  174. end subroutine
  175. subroutine CalcMudPump3LinerDiameter()
  176. use, intrinsic :: IEEE_ARITHMETIC
  177. implicit none
  178. real(8) :: a
  179. a = (MathPI / 4.d0) * CementPumpStroke * 3.0d0 * CementPumpVolumetricEfficiency / 9702.03d0
  180. a = dsqrt(CementPumpOutputBblStroke / a)
  181. if (.not.IEEE_IS_FINITE(a) .or. IEEE_IS_NAN(a)) then
  182. CementPumpLinerDiameter = 0.0
  183. else
  184. CementPumpLinerDiameter = a
  185. endif
  186. call SetMudPump3LinerDiameterN(CementPumpLinerDiameter)
  187. end subroutine
  188. subroutine CalcPump1OutputBblStroke()
  189. implicit none
  190. MudPump1OutputBblStroke = (MathPI / 4.d0) * (MudPump1LinerDiameter**2) * MudPump1Stroke * 3.0d0 * MudPump1VolumetricEfficiency / 9702.03d0
  191. call SetMudPump1OutputBblStrokeN(MudPump1OutputBblStroke)
  192. end subroutine
  193. subroutine CalcPump2OutputBblStroke()
  194. implicit none
  195. MudPump2OutputBblStroke = (MathPI / 4.d0) * (MudPump2LinerDiameter**2) * MudPump2Stroke * 3.0d0 * MudPump2VolumetricEfficiency / 9702.03d0
  196. call SetMudPump2OutputBblStrokeN(MudPump2OutputBblStroke)
  197. end subroutine
  198. subroutine CalcPump3OutputBblStroke()
  199. implicit none
  200. CementPumpOutputBblStroke = (MathPI / 4.d0) * (CementPumpLinerDiameter**2) * CementPumpStroke * 3.0d0 * CementPumpVolumetricEfficiency / 9702.03d0
  201. call SetMudPump3OutputBblStrokeN(CementPumpOutputBblStroke)
  202. end subroutine
  203. end module CPumpsVariables