module CPumps use SimulationVariables use json_module implicit none public contains subroutine PumpsToJson(parent) type(json_value),pointer :: parent type(json_core) :: json type(json_value),pointer :: p ! 1. create new node call json%create_object(p,'Pumps') ! 2. add member of data type to new node ! call StringConfigurationToJson(p) ! call FormationToJson(p) call json%add(p,"MudPump1LinerDiameter",data%Configuration%Pumps%MudPump1LinerDiameter) call json%add(p,"MudPump1Stroke",data%Configuration%Pumps%MudPump1Stroke) call json%add(p,"MudPump1MechanicalEfficiency",data%Configuration%Pumps%MudPump1MechanicalEfficiency) call json%add(p,"MudPump1VolumetricEfficiency",data%Configuration%Pumps%MudPump1VolumetricEfficiency) call json%add(p,"MudPump1Output",data%Configuration%Pumps%MudPump1Output) call json%add(p,"MudPump1OutputBblStroke",data%Configuration%Pumps%MudPump1OutputBblStroke) call json%add(p,"MudPump1Maximum",data%Configuration%Pumps%MudPump1Maximum) call json%add(p,"MudPump1ReliefValvePressure",data%Configuration%Pumps%MudPump1ReliefValvePressure) call json%add(p,"MudPump2LinerDiameter",data%Configuration%Pumps%MudPump2LinerDiameter) call json%add(p,"MudPump2Stroke",data%Configuration%Pumps%MudPump2Stroke) call json%add(p,"MudPump2MechanicalEfficiency",data%Configuration%Pumps%MudPump2MechanicalEfficiency) call json%add(p,"MudPump2VolumetricEfficiency",data%Configuration%Pumps%MudPump2VolumetricEfficiency) call json%add(p,"MudPump2Output",data%Configuration%Pumps%MudPump2Output) call json%add(p,"MudPump2OutputBblStroke",data%Configuration%Pumps%MudPump2OutputBblStroke) call json%add(p,"MudPump2Maximum",data%Configuration%Pumps%MudPump2Maximum) call json%add(p,"MudPump2ReliefValvePressure",data%Configuration%Pumps%MudPump2ReliefValvePressure) call json%add(p,"CementPumpLinerDiameter",data%Configuration%Pumps%CementPumpLinerDiameter) call json%add(p,"CementPumpStroke",data%Configuration%Pumps%CementPumpStroke) call json%add(p,"CementPumpMechanicalEfficiency",data%Configuration%Pumps%CementPumpMechanicalEfficiency) call json%add(p,"CementPumpVolumetricEfficiency",data%Configuration%Pumps%CementPumpVolumetricEfficiency) call json%add(p,"CementPumpOutput",data%Configuration%Pumps%CementPumpOutput) call json%add(p,"CementPumpOutputBblStroke",data%Configuration%Pumps%CementPumpOutputBblStroke) call json%add(p,"CementPumpMaximum",data%Configuration%Pumps%CementPumpMaximum) call json%add(p,"CementPumpReliefValvePressure ",data%Configuration%Pumps%CementPumpReliefValvePressure ) call json%add(p,"MudPump1ReliefValveIsSet",data%Configuration%Pumps%MudPump1ReliefValveIsSet) call json%add(p,"MudPump2ReliefValveIsSet",data%Configuration%Pumps%MudPump2ReliefValveIsSet) call json%add(p,"CementPumpReliefValveIsSet",data%Configuration%Pumps%CementPumpReliefValveIsSet) call json%add(p,"ManualPumpPower",data%Configuration%Pumps%ManualPumpPower) call json%add(p,"Valve1",data%Configuration%Pumps%Valve1) call json%add(p,"Valve2",data%Configuration%Pumps%Valve2) call json%add(p,"Valve3",data%Configuration%Pumps%Valve3) call json%add(p,"Valve4",data%Configuration%Pumps%Valve4) call json%add(p,"Valve5",data%Configuration%Pumps%Valve5) ! 3. add new node to parent call json%add(parent,p) end subroutine subroutine PumpsFromJson(parent) use json_module,IK =>json_ik type(json_value),pointer :: parent type(json_core) :: json type(json_value),pointer :: p,pitems,pitem,pval,pbit call json%get(parent,'Pumps',p) call json%get(p,"MudPump1LinerDiameter",pitem) call json%get(pitem,data%Configuration%Pumps%MudPump1LinerDiameter) call json%get(p,"MudPump1Stroke",pitem) call json%get(pitem,data%Configuration%Pumps%MudPump1Stroke) call json%get(p,"MudPump1MechanicalEfficiency",pitem) call json%get(pitem,data%Configuration%Pumps%MudPump1MechanicalEfficiency) call json%get(p,"MudPump1VolumetricEfficiency",pitem) call json%get(pitem,data%Configuration%Pumps%MudPump1VolumetricEfficiency) call json%get(p,"MudPump1Output",pitem) call json%get(pitem,data%Configuration%Pumps%MudPump1Output) call json%get(p,"MudPump1OutputBblStroke",pitem) call json%get(pitem,data%Configuration%Pumps%MudPump1OutputBblStroke) call json%get(p,"MudPump1Maximum",pitem) call json%get(pitem,data%Configuration%Pumps%MudPump1Maximum) call json%get(p,"MudPump1ReliefValvePressure",pitem) call json%get(pitem,data%Configuration%Pumps%MudPump1ReliefValvePressure) call json%get(p,"MudPump2LinerDiameter",pitem) call json%get(pitem,data%Configuration%Pumps%MudPump2LinerDiameter) call json%get(p,"MudPump2Stroke",pitem) call json%get(pitem,data%Configuration%Pumps%MudPump2Stroke) call json%get(p,"MudPump2MechanicalEfficiency",pitem) call json%get(pitem,data%Configuration%Pumps%MudPump2MechanicalEfficiency) call json%get(p,"MudPump2VolumetricEfficiency",pitem) call json%get(pitem,data%Configuration%Pumps%MudPump2VolumetricEfficiency) call json%get(p,"MudPump2Output",pitem) call json%get(pitem,data%Configuration%Pumps%MudPump2Output) call json%get(p,"MudPump2OutputBblStroke",pitem) call json%get(pitem,data%Configuration%Pumps%MudPump2OutputBblStroke) call json%get(p,"MudPump2Maximum",pitem) call json%get(pitem,data%Configuration%Pumps%MudPump2Maximum) call json%get(p,"MudPump2ReliefValvePressure",pitem) call json%get(pitem,data%Configuration%Pumps%MudPump2ReliefValvePressure) call json%get(p,"CementPumpLinerDiameter",pitem) call json%get(pitem,data%Configuration%Pumps%CementPumpLinerDiameter) call json%get(p,"CementPumpStroke",pitem) call json%get(pitem,data%Configuration%Pumps%CementPumpStroke) call json%get(p,"CementPumpMechanicalEfficiency",pitem) call json%get(pitem,data%Configuration%Pumps%CementPumpMechanicalEfficiency) call json%get(p,"CementPumpVolumetricEfficiency",pitem) call json%get(pitem,data%Configuration%Pumps%CementPumpVolumetricEfficiency) call json%get(p,"CementPumpOutput",pitem) call json%get(pitem,data%Configuration%Pumps%CementPumpOutput) call json%get(p,"CementPumpOutputBblStroke",pitem) call json%get(pitem,data%Configuration%Pumps%CementPumpOutputBblStroke) call json%get(p,"CementPumpMaximum",pitem) call json%get(pitem,data%Configuration%Pumps%CementPumpMaximum) call json%get(p,"CementPumpReliefValvePressure",pitem) call json%get(pitem,data%Configuration%Pumps%CementPumpReliefValvePressure) call json%get(p,"MudPump1ReliefValveIsSet",pitem) call json%get(pitem,data%Configuration%Pumps%MudPump1ReliefValveIsSet) call json%get(p,"MudPump2ReliefValveIsSet",pitem) call json%get(pitem,data%Configuration%Pumps%MudPump2ReliefValveIsSet) call json%get(p,"CementPumpReliefValveIsSet",pitem) call json%get(pitem,data%Configuration%Pumps%CementPumpReliefValveIsSet) call json%get(p,"ManualPumpPower",pitem) call json%get(pitem,data%Configuration%Pumps%ManualPumpPower) call json%get(p,"Valve1",pitem) call json%get(pitem,data%Configuration%Pumps%Valve1) call json%get(p,"Valve2",pitem) call json%get(pitem,data%Configuration%Pumps%Valve2) call json%get(p,"Valve3",pitem) call json%get(pitem,data%Configuration%Pumps%Valve3) call json%get(p,"Valve4",pitem) call json%get(pitem,data%Configuration%Pumps%Valve4) call json%get(p,"Valve5",pitem) call json%get(pitem,data%Configuration%Pumps%Valve5) end subroutine subroutine OpenPump1() use CManifolds implicit none call ChangeValve(16, .true.) end subroutine subroutine ClosePump1() use CManifolds implicit none call ChangeValve(16, .false.) end subroutine subroutine OpenPump2() use CManifolds implicit none call ChangeValve(17, .true.) end subroutine subroutine ClosePump2() use CManifolds implicit none call ChangeValve(17, .false.) end subroutine subroutine OpenCementPump() use CManifolds implicit none call ChangeValve(18, .true.) end subroutine subroutine CloseCementPump() use CManifolds implicit none call ChangeValve(18, .false.) end subroutine ! subroutine SetMudPump1LinerDiameterN(a) ! implicit none ! real(8) :: a ! if(associated(MudPump1LinerDiameterPtr)) call MudPump1LinerDiameterPtr(a) ! end subroutine ! subroutine SetMudPump2LinerDiameterN(a) ! implicit none ! real(8) :: a ! if(associated(MudPump2LinerDiameterPtr)) call MudPump2LinerDiameterPtr(a) ! end subroutine ! subroutine SetMudPump3LinerDiameterN(a) ! implicit none ! real(8) :: a ! if(associated(MudPump3LinerDiameterPtr)) call MudPump3LinerDiameterPtr(a) ! end subroutine ! subroutine SetMudPump1OutputBblStrokeN(a) ! implicit none ! real(8) :: a ! if(associated(MudPump1OutputBblStrokePtr)) call MudPump1OutputBblStrokePtr(a) ! end subroutine ! subroutine SetMudPump2OutputBblStrokeN(a) ! implicit none ! real(8) :: a ! if(associated(MudPump2OutputBblStrokePtr)) call MudPump2OutputBblStrokePtr(a) ! end subroutine ! subroutine SetMudPump3OutputBblStrokeN(a) ! implicit none ! real(8) :: a ! if(associated(MudPump3OutputBblStrokePtr)) call MudPump3OutputBblStrokePtr(a) ! end subroutine ! subroutine CalcMudPump1LinerDiameter() ! use, intrinsic :: IEEE_ARITHMETIC ! implicit none ! real(8) :: a ! a = (MathPI / 4.d0) * data%Configuration%Pumps%MudPump1Stroke * 3.0d0 * data%Configuration%Pumps%MudPump1VolumetricEfficiency / 9702.03d0 ! a = dsqrt(data%Configuration%Pumps%MudPump1OutputBblStroke / a) ! if (.not.IEEE_IS_FINITE(a) .or. IEEE_IS_NAN(a)) then ! data%Configuration%Pumps%MudPump1LinerDiameter = 0.0 ! else ! data%Configuration%Pumps%MudPump1LinerDiameter = a ! endif ! call SetMudPump1LinerDiameterN(data%Configuration%Pumps%MudPump1LinerDiameter) ! end subroutine ! subroutine CalcMudPump2LinerDiameter() ! use, intrinsic :: IEEE_ARITHMETIC ! implicit none ! real(8) :: a ! a = (MathPI / 4.d0) * data%Configuration%Pumps%MudPump2Stroke * 3.0d0 * data%Configuration%Pumps%MudPump2VolumetricEfficiency / 9702.03d0 ! a = dsqrt(data%Configuration%Pumps%MudPump2OutputBblStroke / a) ! if (.not.IEEE_IS_FINITE(a) .or. IEEE_IS_NAN(a)) then ! data%Configuration%Pumps%MudPump2LinerDiameter = 0.0 ! else ! data%Configuration%Pumps%MudPump2LinerDiameter = a ! endif ! call SetMudPump2LinerDiameterN(data%Configuration%Pumps%MudPump2LinerDiameter) ! end subroutine ! subroutine CalcMudPump3LinerDiameter() ! use, intrinsic :: IEEE_ARITHMETIC ! implicit none ! real(8) :: a ! a = (MathPI / 4.d0) * data%Configuration%Pumps%CementPumpStroke * 3.0d0 * data%Configuration%Pumps%CementPumpVolumetricEfficiency / 9702.03d0 ! a = dsqrt(data%Configuration%Pumps%CementPumpOutputBblStroke / a) ! if (.not.IEEE_IS_FINITE(a) .or. IEEE_IS_NAN(a)) then ! data%Configuration%Pumps%CementPumpLinerDiameter = 0.0 ! else ! data%Configuration%Pumps%CementPumpLinerDiameter = a ! endif ! call SetMudPump3LinerDiameterN(data%Configuration%Pumps%CementPumpLinerDiameter) ! end subroutine ! subroutine CalcPump1OutputBblStroke() ! implicit none ! data%Configuration%Pumps%MudPump1OutputBblStroke = (MathPI / 4.d0) * (data%Configuration%Pumps%MudPump1LinerDiameter**2) * data%Configuration%Pumps%MudPump1Stroke * 3.0d0 * data%Configuration%Pumps%MudPump1VolumetricEfficiency / 9702.03d0 ! call SetMudPump1OutputBblStrokeN(data%Configuration%Pumps%MudPump1OutputBblStroke) ! end subroutine ! subroutine CalcPump2OutputBblStroke() ! implicit none ! data%Configuration%Pumps%MudPump2OutputBblStroke = (MathPI / 4.d0) * (data%Configuration%Pumps%MudPump2LinerDiameter**2) * data%Configuration%Pumps%MudPump2Stroke * 3.0d0 * data%Configuration%Pumps%MudPump2VolumetricEfficiency / 9702.03d0 ! call SetMudPump2OutputBblStrokeN(data%Configuration%Pumps%MudPump2OutputBblStroke) ! end subroutine ! subroutine CalcPump3OutputBblStroke() ! implicit none ! data%Configuration%Pumps%CementPumpOutputBblStroke = (MathPI / 4.d0) * (data%Configuration%Pumps%CementPumpLinerDiameter**2) * data%Configuration%Pumps%CementPumpStroke * 3.0d0 * data%Configuration%Pumps%CementPumpVolumetricEfficiency / 9702.03d0 ! call SetMudPump3OutputBblStrokeN(data%Configuration%Pumps%CementPumpOutputBblStroke) ! end subroutine end module CPumps