|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- module Simulator
- use Bop
- use PumpsMain
- use RopMain
- use RotaryTableMain
- use DrawworksMain
- use FluidFlowMain
- use TorqueDragMain
- use MudSystemMain
- use PipeRams1Main
- use PipeRams2Main
- use KillLineMain
- use ChokeLineMain
- use BlindRamsMain
- use AnnularMain
- use TopDriveMain
- use GeoMain
- use COperationScenariosMain
- use :: json_module, rk => json_rk
-
- implicit none
- real :: t0, dt, tf, mu
- real(kind=rk), allocatable :: x0(:)
- type(json_file) :: json
- logical :: is_found,test
-
- contains
- subroutine Simulate
- integer :: t
- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- t=0
- do while (t<10)
- !!read variable from shared file
- call read_variables()
-
- !!Location: ./bop
- !! Variables:
- !! Nothing exist in rop_step or even ropMainBody!
- !! Tarmigh, Now merged with FluidFlow
- call Rop_Step()
-
- !!Location: ./Equipment/BopStack
- !! Rafiee, nothing changed
- call BopStack_Step()
-
- !! Location: /Equipment/Pumps
- !! Variables:
- !! Does not have step function
- !! Call Pump_StartUp in the start
- !! Why we have a infinite loop (loop2) in step? Must be rewritten
- !! Tarmigh, now is rewritten
- call Pump1_Step()
- call Pump2_Step()
-
- !! Location ./Equipment/Rotarytable
- !! Variables:
- !! Does not have step function
- !! Call RTable_StartUp in the start
- !! Again has a loop in each step
- !! Tarmigh, now is rewritten
- call RotaryTable_Step()
-
- !! Location ./Equipment/Drawworks
- !! Variables:
- !! Does not have step function
- !! Call ..._StartUp in the start
- !! Again has a loop in each step
- !! Tarmigh, now is rewritten
- call Drawworks_Step()
-
- !! Empty nothing called
- !! Merged in FluidFlow
- call TorqueDrag_Step()
-
- !! Location: ./Equipment/MudSystem
- !! Variables: MudSystem_variables.f90 and MudSystem.f90
- !! Step function simply calls LineupAndPath in MudSystem.f90
- !! had not startUp
- !! Rafiee
- call MudSystem_Step()
-
- !! Location ./Equipment/BopStack
- !! Variables: VARIABLES,CBopStackVariables,CBopControlPanelVariables,CEquipmentsConstants
- !! Step function added, only call PIPE_RAMS1 and 2 function
- !! BOP_StartUp commented
- !! Rafiee
- call PipeRams1_Step()
- call PipeRams2_Step()
-
-
- !! Location ./Equipment/BopStack
- !! Variables: VARIABLES,CBopStackVariables,CBopControlPanelVariables,CEquipmentsConstants,CAccumulatorVariables,CSimulationVariables
- !! Step function added, only call PIPE_RAMS1 and 2 function
- !! BOP_StartUp commented
- !! Rafiee
- call KillLine_Step()
-
- !! Probably like other bopstack equipments
- !! Rafiee
- call ChokeLine_Step()
- call BlindRams_Step()
- call Annular_Step()
-
- !!Tarmigh. Step must rewrittem
- call TopDrive_Step()
-
- !!Empty
- call Geo_Step()
-
- !! Sheikh
- call FluidFlow_Step()
-
- !! Ahmadi
- call OperationScenarios_Step()
-
- !! Write variables to shared files
- call write_variables()
-
- print *,"t=",t
- t = t + 1
- end do
- end subroutine Simulate
-
- subroutine write_variables
- !implicit none
- end subroutine
-
- subroutine read_variables
- call json%initialize()
-
- ! Load the file.
- call json%load_file('config.json'); if (json%failed()) stop
-
- call json%get('t0', t0, is_found); if (.not. is_found) return
- call json%get('dt', dt, is_found); if (.not. is_found) return
- call json%get('tf', tf, is_found); if (.not. is_found) return
- call json%get('mu', mu, is_found); if (.not. is_found) return
- call json%get('x0', x0, is_found); if (.not. is_found) return
-
- ! Output values.
- if (is_found) then
- print *, t0, dt, tf, mu
- print *, x0
- end if
-
- ! Clean up.
- call json%destroy()
- end subroutine
-
- end module Simulator
|