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.
 
 
 
 
 
 

74 lines
3.3 KiB

  1. module CReservoir
  2. use SimulationVariables
  3. use json_module
  4. implicit none
  5. contains
  6. subroutine ReservoirFromJson(parent)
  7. use json_module,IK =>json_ik
  8. type(json_value),pointer :: parent
  9. type(json_core) :: json
  10. type(json_value),pointer :: p,pitem,pval
  11. logical::is_found
  12. integer::i,n_children
  13. CHARACTER(KIND=JSON_CK, LEN=:), ALLOCATABLE :: val
  14. call json%get(parent,'Reservoir',p)
  15. call json%get(p,'FormationNo',pval)
  16. call json%get(pval,data%Configuration%Reservoir%FormationNo)
  17. call json%get(p,'FormationTop',pval)
  18. call json%get(pval,data%Configuration%Reservoir%FormationTop)
  19. call json%get(p,'PressureGradient',pval)
  20. call json%get(pval,data%Configuration%Reservoir%PressureGradient)
  21. call json%get(p,'FormationPermeability',pval)
  22. call json%get(pval,data%Configuration%Reservoir%FormationPermeability)
  23. call json%get(p,'GeothermalGradient',pval)
  24. call json%get(pval,data%Configuration%Reservoir%GeothermalGradient)
  25. call json%get(p,'FluidType',pval)
  26. call json%get(pval,data%Configuration%Reservoir%FluidType)
  27. call json%get(p,'FluidGradient',pval)
  28. call json%get(pval,data%Configuration%Reservoir%FluidGradient)
  29. call json%get(p,'FluidViscosity',pval)
  30. call json%get(pval,data%Configuration%Reservoir%FluidViscosity)
  31. call json%get(p,'InactiveInflux',pval)
  32. call json%get(pval,data%Configuration%Reservoir%InactiveInflux)
  33. call json%get(p,'IsAutoMigrationRateSelected',pval)
  34. call json%get(pval,data%Configuration%Reservoir%IsAutoMigrationRateSelected)
  35. call json%get(p,'AutoMigrationRate',pval)
  36. call json%get(pval,data%Configuration%Reservoir%AutoMigrationRate)
  37. call json%get(p,'MakeKickSinglePacket',pval)
  38. call json%get(pval,data%Configuration%Reservoir%MakeKickSinglePacket)
  39. end subroutine
  40. subroutine ReservoirToJson(parent)
  41. type(json_value),pointer :: parent
  42. type(json_core) :: json
  43. type(json_value),pointer :: p
  44. ! 1. create new node
  45. call json%create_object(p,'Reservoir')
  46. ! 2. add member of data type to new node
  47. ! call StringConfigurationToJson(p)
  48. ! call FormationToJson(p)
  49. call json%add(p,"AutoMigrationRate",data%Configuration%Reservoir%AutoMigrationRate)
  50. call json%add(p,"FluidGradient",data%Configuration%Reservoir%FluidGradient)
  51. call json%add(p,"FluidType",data%Configuration%Reservoir%FluidType)
  52. call json%add(p,"FluidViscosity",data%Configuration%Reservoir%FluidViscosity)
  53. call json%add(p,"FormationNo",data%Configuration%Reservoir%FormationNo)
  54. call json%add(p,"FormationPermeability",data%Configuration%Reservoir%FormationPermeability)
  55. call json%add(p,"FormationTop",data%Configuration%Reservoir%FormationTop)
  56. call json%add(p,"GeothermalGradient",data%Configuration%Reservoir%GeothermalGradient)
  57. call json%add(p,"InactiveInflux",data%Configuration%Reservoir%InactiveInflux)
  58. call json%add(p,"IsAutoMigrationRateSelected",data%Configuration%Reservoir%IsAutoMigrationRateSelected)
  59. call json%add(p,"MakeKickSinglePacket",data%Configuration%Reservoir%MakeKickSinglePacket)
  60. call json%add(p,"PressureGradient",data%Configuration%Reservoir%PressureGradient)
  61. ! 3. add new node to parent
  62. call json%add(parent,p)
  63. end subroutine
  64. end module CReservoir