Simulation Core
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

151 righe
4.6 KiB

  1. module Simulator
  2. use Bop
  3. use PumpsMain
  4. use RopMain
  5. use RotaryTableMain
  6. use DrawworksMain
  7. use FluidFlowMain
  8. use TorqueDragMain
  9. use MudSystemMain
  10. use PipeRams1Main
  11. use PipeRams2Main
  12. use KillLineMain
  13. use ChokeLineMain
  14. use BlindRamsMain
  15. use AnnularMain
  16. use TopDriveMain
  17. use GeoMain
  18. use COperationScenariosMain
  19. use :: json_module, rk => json_rk
  20. implicit none
  21. real :: t0, dt, tf, mu
  22. real(kind=rk), allocatable :: x0(:)
  23. type(json_file) :: json
  24. logical :: is_found
  25. contains
  26. subroutine Simulate
  27. integer :: t
  28. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  29. t=0
  30. do while (t<10)
  31. !!read variable from shared file
  32. call read_variables()
  33. !!Location: ./bop
  34. !! Variables:
  35. !! Nothing exist in rop_step or even ropMainBody!
  36. !! Tarmigh, Now merged with FluidFlow
  37. call Rop_Step()
  38. !!Location: ./Equipment/BopStack
  39. !! Rafiee, nothing changed
  40. call BopStack_Step()
  41. !! Location: /Equipment/Pumps
  42. !! Variables:
  43. !! Does not have step function
  44. !! Call Pump_StartUp in the start
  45. !! Why we have a infinite loop (loop2) in step? Must be rewritten
  46. !! Tarmigh, now is rewritten
  47. call Pump1_Step()
  48. call Pump2_Step()
  49. !! Location ./Equipment/Rotarytable
  50. !! Variables:
  51. !! Does not have step function
  52. !! Call RTable_StartUp in the start
  53. !! Again has a loop in each step
  54. !! Tarmigh, now is rewritten
  55. call RotaryTable_Step()
  56. !! Location ./Equipment/Drawworks
  57. !! Variables:
  58. !! Does not have step function
  59. !! Call ..._StartUp in the start
  60. !! Again has a loop in each step
  61. !! Tarmigh, now is rewritten
  62. call Drawworks_Step()
  63. !! Empty nothing called
  64. !! Merged in FluidFlow
  65. call TorqueDrag_Step()
  66. !! Location: ./Equipment/MudSystem
  67. !! Variables: MudSystem_variables.f90 and MudSystem.f90
  68. !! Step function simply calls LineupAndPath in MudSystem.f90
  69. !! had not startUp
  70. !! Rafiee
  71. call MudSystem_Step()
  72. !! Location ./Equipment/BopStack
  73. !! Variables: VARIABLES,CBopStackVariables,CBopControlPanelVariables,CEquipmentsConstants
  74. !! Step function added, only call PIPE_RAMS1 and 2 function
  75. !! BOP_StartUp commented
  76. !! Rafiee
  77. call PipeRams1_Step()
  78. call PipeRams2_Step()
  79. !! Location ./Equipment/BopStack
  80. !! Variables: VARIABLES,CBopStackVariables,CBopControlPanelVariables,CEquipmentsConstants,CAccumulatorVariables,CSimulationVariables
  81. !! Step function added, only call PIPE_RAMS1 and 2 function
  82. !! BOP_StartUp commented
  83. !! Rafiee
  84. call KillLine_Step()
  85. !! Probably like other bopstack equipments
  86. !! Rafiee
  87. call ChokeLine_Step()
  88. call BlindRams_Step()
  89. call Annular_Step()
  90. !!Tarmigh. Step must rewrittem
  91. call TopDrive_Step()
  92. !!Empty
  93. call Geo_Step()
  94. !! Sheikh
  95. call FluidFlow_Step()
  96. !! Ahmadi
  97. call OperationScenarios_Step()
  98. !! Write variables to shared files
  99. call write_variables()
  100. print *,"t=",t
  101. t = t + 1
  102. end do
  103. end subroutine Simulate
  104. subroutine write_variables
  105. !implicit none
  106. end subroutine
  107. subroutine read_variables
  108. call json%initialize()
  109. ! Load the file.
  110. call json%load_file('config.json'); if (json%failed()) stop
  111. call json%get('t0', t0, is_found); if (.not. is_found) return
  112. call json%get('dt', dt, is_found); if (.not. is_found) return
  113. call json%get('tf', tf, is_found); if (.not. is_found) return
  114. call json%get('mu', mu, is_found); if (.not. is_found) return
  115. call json%get('x0', x0, is_found); if (.not. is_found) return
  116. ! Output values.
  117. if (is_found) then
  118. print *, t0, dt, tf, mu
  119. print *, x0
  120. end if
  121. ! Clean up.
  122. call json%destroy()
  123. end subroutine
  124. end module Simulator