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.
 
 
 
 
 
 

92 lines
3.6 KiB

  1. module CKickProblems
  2. use SimulationVariables
  3. implicit none
  4. public
  5. !constants
  6. ! integer :: Gas_FluidType = 0
  7. ! integer :: Oil_FluidType = 1
  8. ! integer :: Water_FluidType = 2
  9. contains
  10. subroutine KickProblemsFromJson(parent)
  11. type(json_value),pointer :: parent
  12. type(json_core) :: json
  13. type(json_value),pointer :: p,pval
  14. call json%get(parent,'KickProblems',p)
  15. call ProblemFromJson(p,"Kick",data%problems%KickProblems%Kick)
  16. call json%get(p,'FluidType',pval)
  17. call json%get(pval,data%problems%KickProblems%FluidType)
  18. call json%get(p,'FlowRate',pval)
  19. call json%get(pval,data%problems%KickProblems%FlowRate)
  20. call json%get(p,'OverBalancePressure',pval)
  21. call json%get(pval,data%problems%KickProblems%OverBalancePressure)
  22. call json%get(p,'IsAutoMigrationRateSelected',pval)
  23. call json%get(pval,data%problems%KickProblems%IsAutoMigrationRateSelected)
  24. call json%get(p,'AutoMigrationRate',pval)
  25. call json%get(pval,data%problems%KickProblems%AutoMigrationRate)
  26. end subroutine
  27. subroutine KickProblemsToJson(parent)
  28. type(json_value),pointer :: parent
  29. type(json_core) :: json
  30. type(json_value),pointer :: p
  31. ! 1. create new node
  32. call json%create_object(p,'KickProblems')
  33. call ProblemToJson(p,"Kick",data%problems%KickProblems%Kick)
  34. call json%add(p,"FluidType",data%problems%KickProblems%FluidType)
  35. call json%add(p,"FlowRate",data%problems%KickProblems%FlowRate)
  36. call json%add(p,"OverBalancePressure",data%problems%KickProblems%OverBalancePressure)
  37. call json%add(p,"IsAutoMigrationRateSelected",data%problems%KickProblems%IsAutoMigrationRateSelected)
  38. call json%add(p,"AutoMigrationRate",data%problems%KickProblems%AutoMigrationRate) ! 2. add member of data type to new node
  39. ! 3. add new node to parent
  40. call json%add(parent,p)
  41. end subroutine
  42. subroutine ProcessKickProblemsDueTime(time)
  43. implicit none
  44. integer :: time
  45. if(data%problems%KickProblems%Kick%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%KickProblems%Kick, ChangeKick, time)
  46. end subroutine
  47. subroutine ProcessKickProblemsDuePumpStrokes(strokes)
  48. implicit none
  49. integer :: strokes
  50. if(data%problems%KickProblems%Kick%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%KickProblems%Kick, ChangeKick, strokes)
  51. end subroutine
  52. subroutine ProcessKickProblemsDueVolumePumped(volume)
  53. implicit none
  54. real(8) :: volume
  55. if(data%problems%KickProblems%Kick%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%KickProblems%Kick, ChangeKick, volume)
  56. end subroutine
  57. subroutine ProcessKickProblemsDueDistanceDrilled(distance)
  58. implicit none
  59. real(8) :: distance
  60. if(data%problems%KickProblems%Kick%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%KickProblems%Kick, ChangeKick, distance)
  61. end subroutine
  62. subroutine ChangeKick(status)
  63. implicit none
  64. integer, intent (in) :: status
  65. ! if(associated(data%problems%KickProblems%KickPtr)) call data%problems%KickProblems%KickPtr(status)
  66. !if(status == Clear_StatusType) if(print_log) print*,'On_Kick_Clear'
  67. !if(status == Executed_StatusType) if(print_log) print*,'On_Kick_Execute'
  68. endsubroutine
  69. end module CKickProblems