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.

CPumps.f90 11 KiB

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