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.

CBitProblems.i90 4.3 KiB

1 年之前
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. # 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/Problems/CBitProblems.f90"
  2. module CBitProblems
  3. use SimulationVariables
  4. use json_module
  5. implicit none
  6. public
  7. contains
  8. subroutine BitProblemsFromJson(parent)
  9. type(json_value),pointer :: parent
  10. type(json_core) :: json
  11. type(json_value),pointer :: p,pval
  12. call json%get(parent,'BitProblems',p)
  13. call ProblemFromJson(p,"JetWashout",data%problems%BitProblems%JetWashout)
  14. call ProblemFromJson(p,"PlugJets",data%problems%BitProblems%PlugJets)
  15. call json%get(p,"JetWashoutCount",pval)
  16. call json%get(pval,data%problems%BitProblems%JetWashoutCount)
  17. call json%get(p,"PlugJetsCount",pval)
  18. call json%get(pval,data%problems%BitProblems%PlugJetsCount)
  19. end subroutine
  20. subroutine BitProblemsToJson(parent)
  21. type(json_value),pointer :: parent
  22. type(json_core) :: json
  23. type(json_value),pointer :: p
  24. ! 1. create new node
  25. call json%create_object(p,'BitProblems')
  26. ! 2. add member of data type to new node
  27. call ProblemToJson(p,"JetWashout",data%problems%BitProblems%JetWashout)
  28. call ProblemToJson(p,"PlugJets",data%problems%BitProblems%PlugJets)
  29. call json%add(p, "JetWashoutCount",data%problems%BitProblems%JetWashoutCount)
  30. call json%add(p, "PlugJetsCount",data%problems%BitProblems%PlugJetsCount)
  31. ! 3. add new node to parent
  32. call json%add(parent,p)
  33. end subroutine
  34. subroutine ProcessBitProblemsDueTime(time)
  35. implicit none
  36. integer :: time
  37. if(data%problems%BitProblems%PlugJets%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%BitProblems%PlugJets, ChangePlugJets, time)
  38. if(data%problems%BitProblems%JetWashout%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%BitProblems%JetWashout, ChangeJetWashout, time)
  39. end subroutine
  40. subroutine ProcessBitProblemsDuePumpStrokes(strokes)
  41. implicit none
  42. integer :: strokes
  43. if(data%problems%BitProblems%PlugJets%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%BitProblems%PlugJets, ChangePlugJets, strokes)
  44. if(data%problems%BitProblems%JetWashout%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%BitProblems%JetWashout, ChangeJetWashout, strokes)
  45. end subroutine
  46. subroutine ProcessBitProblemsDueVolumePumped(volume)
  47. implicit none
  48. real(8) :: volume
  49. if(data%problems%BitProblems%PlugJets%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%BitProblems%PlugJets, ChangePlugJets, volume)
  50. if(data%problems%BitProblems%JetWashout%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%BitProblems%JetWashout, ChangeJetWashout, volume)
  51. end subroutine
  52. subroutine ProcessBitProblemsDueDistanceDrilled(distance)
  53. implicit none
  54. real(8) :: distance
  55. if(data%problems%BitProblems%PlugJets%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%BitProblems%PlugJets, ChangePlugJets, distance)
  56. if(data%problems%BitProblems%JetWashout%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%BitProblems%JetWashout, ChangeJetWashout, distance)
  57. end subroutine
  58. subroutine ChangePlugJets(status)
  59. USE FricPressDropVarsModule
  60. implicit none
  61. integer, intent (in) :: status
  62. ! if(associated(data%problems%BitProblems%PlugJetsPtr)) call data%problems%BitProblems%PlugJetsPtr(status)
  63. if(status == Clear_StatusType) data%State%FricPressDrop%BitJetsPlugged = 0
  64. if(status == Executed_StatusType) data%State%FricPressDrop%BitJetsPlugged = 1
  65. endsubroutine
  66. subroutine ChangeJetWashout(status)
  67. USE FricPressDropVarsModule
  68. implicit none
  69. integer, intent (in) :: status
  70. ! if(associated(data%problems%BitProblems%JetWashoutPtr)) call data%problems%BitProblems%JetWashoutPtr(status)
  71. if(status == Clear_StatusType) data%State%FricPressDrop%BitJetsWashedOut = 0
  72. if(status == Executed_StatusType) data%State%FricPressDrop%BitJetsWashedOut = 1
  73. endsubroutine
  74. end module CBitProblems