module CReservoir use SimulationVariables use json_module implicit none contains subroutine ReservoirFromJson(parent) use json_module,IK =>json_ik type(json_value),pointer :: parent type(json_core) :: json type(json_value),pointer :: p,pitem,pval logical::is_found integer::i,n_children CHARACTER(KIND=JSON_CK, LEN=:), ALLOCATABLE :: val call json%get(parent,'Reservoir',p) call json%get(p,'FormationNo',pval) call json%get(pval,data%Configuration%Reservoir%FormationNo) call json%get(p,'FormationTop',pval) call json%get(pval,data%Configuration%Reservoir%FormationTop) call json%get(p,'PressureGradient',pval) call json%get(pval,data%Configuration%Reservoir%PressureGradient) call json%get(p,'FormationPermeability',pval) call json%get(pval,data%Configuration%Reservoir%FormationPermeability) call json%get(p,'GeothermalGradient',pval) call json%get(pval,data%Configuration%Reservoir%GeothermalGradient) call json%get(p,'FluidType',pval) call json%get(pval,data%Configuration%Reservoir%FluidType) call json%get(p,'FluidGradient',pval) call json%get(pval,data%Configuration%Reservoir%FluidGradient) call json%get(p,'FluidViscosity',pval) call json%get(pval,data%Configuration%Reservoir%FluidViscosity) call json%get(p,'InactiveInflux',pval) call json%get(pval,data%Configuration%Reservoir%InactiveInflux) call json%get(p,'IsAutoMigrationRateSelected',pval) call json%get(pval,data%Configuration%Reservoir%IsAutoMigrationRateSelected) call json%get(p,'AutoMigrationRate',pval) call json%get(pval,data%Configuration%Reservoir%AutoMigrationRate) call json%get(p,'MakeKickSinglePacket',pval) call json%get(pval,data%Configuration%Reservoir%MakeKickSinglePacket) end subroutine subroutine ReservoirToJson(parent) type(json_value),pointer :: parent type(json_core) :: json type(json_value),pointer :: p ! 1. create new node call json%create_object(p,'Reservoir') ! 2. add member of data type to new node ! call StringConfigurationToJson(p) ! call FormationToJson(p) call json%add(p,"AutoMigrationRate",data%Configuration%Reservoir%AutoMigrationRate) call json%add(p,"FluidGradient",data%Configuration%Reservoir%FluidGradient) call json%add(p,"FluidType",data%Configuration%Reservoir%FluidType) call json%add(p,"FluidViscosity",data%Configuration%Reservoir%FluidViscosity) call json%add(p,"FormationNo",data%Configuration%Reservoir%FormationNo) call json%add(p,"FormationPermeability",data%Configuration%Reservoir%FormationPermeability) call json%add(p,"FormationTop",data%Configuration%Reservoir%FormationTop) call json%add(p,"GeothermalGradient",data%Configuration%Reservoir%GeothermalGradient) call json%add(p,"InactiveInflux",data%Configuration%Reservoir%InactiveInflux) call json%add(p,"IsAutoMigrationRateSelected",data%Configuration%Reservoir%IsAutoMigrationRateSelected) call json%add(p,"MakeKickSinglePacket",data%Configuration%Reservoir%MakeKickSinglePacket) call json%add(p,"PressureGradient",data%Configuration%Reservoir%PressureGradient) ! 3. add new node to parent call json%add(parent,p) end subroutine end module CReservoir