From 78c26114883cdc2af8d100897ed75e9386dab044 Mon Sep 17 00:00:00 2001 From: mahmood19227 Date: Sun, 11 Jun 2023 09:06:52 +0330 Subject: [PATCH] ConfigurationToJson Completed --- .../BasicInputs/CMudPropertiesVariables.f90 | 65 +------------ CSharp/BasicInputs/MudProperties.f90 | 91 +++++++++++++++++++ .../WellProfile/CPathGeneration.f90 | 33 +++++-- .../WellProfile/CPathGenerationVariables.f90 | 2 +- .../WellProfile/CWellSurveyData.f90 | 56 ++++++------ Equipments/MudSystem/Elements_Creation.f90 | 10 +- Equipments/MudSystem/MudSystem.f90 | 73 +++++++-------- Equipments/MudSystem/MudSystemStartup.f90 | 36 ++++---- FluidFlow/Flow_Startup.f90 | 14 +-- FluidFlow/Frictional_Press_Drop_Calc.f90 | 20 ++-- Rop/ROP_MainCalculation.f90 | 2 +- Simulation/SimulationVariables.f90 | 6 +- SimulationCore2.vfproj | 3 +- Text1.txt | 22 ++--- .../TD_WellReadData.f90 | 24 ++--- TorqueDrag/TD_StartUp/TD_StartUp.f90 | 4 +- helper.ipynb | 87 +++++++++++------- test.json | 72 ++++++++++++++- 18 files changed, 376 insertions(+), 244 deletions(-) create mode 100644 CSharp/BasicInputs/MudProperties.f90 diff --git a/CSharp/BasicInputs/CMudPropertiesVariables.f90 b/CSharp/BasicInputs/CMudPropertiesVariables.f90 index 2e13af7..8fd6727 100644 --- a/CSharp/BasicInputs/CMudPropertiesVariables.f90 +++ b/CSharp/BasicInputs/CMudPropertiesVariables.f90 @@ -2,19 +2,7 @@ module CMudPropertiesVariables use CIActionReference !**use CDoubleEventHandlerCollection implicit none - public - - !pointers - ! procedure (ActionDouble), pointer :: ActiveMudVolumePtr - ! procedure (ActionDouble), pointer :: ActiveDensityPtr - ! procedure (ActionDouble), pointer :: ReserveMudVolumePtr - ! procedure (ActionDouble), pointer :: ReserveDensityPtr - - !**type(DoubleEventHandlerCollection) :: OnActiveMudVolumeChange - !**type(DoubleEventHandlerCollection) :: OnActiveDensityChange - !**type(DoubleEventHandlerCollection) :: OnReserveMudVolumeChange - !**type(DoubleEventHandlerCollection) :: OnReserveDensityChange - + public !constants integer, parameter :: WaterBase_MudType = 0 integer, parameter :: OilBase_MudType = 1 @@ -51,60 +39,11 @@ module CMudPropertiesVariables real(8) :: ActiveTotalContents real(8) :: ActiveTotalContentsGal logical :: ActiveAutoDensity - !real(8) :: ReserveTotalTankCapacity - !real(8) :: ReserveTotalTankCapacityGal - !real(8) :: ReserveSettledContents - !real(8) :: ReserveSettledContentsGal - !real(8) :: ReserveTotalContents - !real(8) :: ReserveTotalContentsGal real(8) :: InitialTripTankMudVolume real(8) :: InitialTripTankMudVolumeGal real(8) :: PedalFlowMeter End type MudPropertiesType - Type(MudPropertiesType)::MudProperties - - - contains - - subroutine Set_ActiveMudVolume_StudentStation(v) - implicit none - real*8, intent(in) :: v -#ifdef ExcludeExtraChanges - if(MudProperties%ActiveMudVolume == v) return -#endif - MudProperties%ActiveMudVolume = v - ! if(associated(ActiveMudVolumePtr)) call ActiveMudVolumePtr(MudProperties%ActiveMudVolume) - end subroutine - - subroutine Set_ActiveDensity_StudentStation(v) - implicit none - real*8, intent(in) :: v -#ifdef ExcludeExtraChanges - if(MudProperties%ActiveDensity == v) return -#endif - MudProperties%ActiveDensity = v - ! if(associated(ActiveDensityPtr)) call ActiveDensityPtr(MudProperties%ActiveDensity) - end subroutine - - subroutine Set_ReserveMudVolume_StudentStation(v) - implicit none - real*8, intent(in) :: v -#ifdef ExcludeExtraChanges - if(MudProperties%ReserveMudVolume == v) return -#endif - MudProperties%ReserveMudVolume = v - ! if(associated(ReserveMudVolumePtr)) call ReserveMudVolumePtr(MudProperties%ReserveMudVolume) - end subroutine - - subroutine Set_ReserveDensity_StudentStation(v) - implicit none - real*8, intent(in) :: v -#ifdef ExcludeExtraChanges - if(MudProperties%ReserveDensity == v) return -#endif - MudProperties%ReserveDensity = v - ! if(associated(ReserveDensityPtr)) call ReserveDensityPtr(MudProperties%ReserveDensity) - end subroutine +! Type(MudPropertiesType)::MudProperties diff --git a/CSharp/BasicInputs/MudProperties.f90 b/CSharp/BasicInputs/MudProperties.f90 new file mode 100644 index 0000000..2e3f2b2 --- /dev/null +++ b/CSharp/BasicInputs/MudProperties.f90 @@ -0,0 +1,91 @@ +module MudPropertiesModule + use SimulationVariables + use json_module + implicit none + + contains + + subroutine MudPropertiesToJson(parent) + + type(json_value),pointer :: parent + type(json_core) :: json + type(json_value),pointer :: p + + ! 1. create new node + call json%create_object(p,'Mud') + + ! 2. add member of data type to new node + call json%add(p,"ActiveMudType",data%Configuration%Mud%ActiveMudType) + call json%add(p,"ActiveRheologyModel",data%Configuration%Mud%ActiveRheologyModel) + call json%add(p,"ActiveMudVolume",data%Configuration%Mud%ActiveMudVolume) + call json%add(p,"ActiveMudVolumeGal",data%Configuration%Mud%ActiveMudVolumeGal) + call json%add(p,"ActiveDensity",data%Configuration%Mud%ActiveDensity) + call json%add(p,"ActivePlasticViscosity",data%Configuration%Mud%ActivePlasticViscosity) + call json%add(p,"ActiveYieldPoint",data%Configuration%Mud%ActiveYieldPoint) + call json%add(p,"ActiveThetaThreeHundred",data%Configuration%Mud%ActiveThetaThreeHundred) + call json%add(p,"ActiveThetaSixHundred",data%Configuration%Mud%ActiveThetaSixHundred) + call json%add(p,"ReserveMudType",data%Configuration%Mud%ReserveMudType) + call json%add(p,"ReserveMudVolume",data%Configuration%Mud%ReserveMudVolume) + call json%add(p,"ReserveMudVolumeGal",data%Configuration%Mud%ReserveMudVolumeGal) + call json%add(p,"ReserveDensity",data%Configuration%Mud%ReserveDensity) + call json%add(p,"ReservePlasticViscosity",data%Configuration%Mud%ReservePlasticViscosity) + call json%add(p,"ReserveYieldPoint",data%Configuration%Mud%ReserveYieldPoint) + call json%add(p,"ReserveThetaThreeHundred",data%Configuration%Mud%ReserveThetaThreeHundred) + call json%add(p,"ReserveThetaSixHundred",data%Configuration%Mud%ReserveThetaSixHundred) + call json%add(p,"ActiveTotalTankCapacity",data%Configuration%Mud%ActiveTotalTankCapacity) + call json%add(p,"ActiveTotalTankCapacityGal",data%Configuration%Mud%ActiveTotalTankCapacityGal) + call json%add(p,"ActiveSettledContents",data%Configuration%Mud%ActiveSettledContents) + call json%add(p,"ActiveSettledContentsGal",data%Configuration%Mud%ActiveSettledContentsGal) + call json%add(p,"ActiveTotalContents",data%Configuration%Mud%ActiveTotalContents) + call json%add(p,"ActiveTotalContentsGal",data%Configuration%Mud%ActiveTotalContentsGal) + call json%add(p,"ActiveAutoDensity",data%Configuration%Mud%ActiveAutoDensity) + call json%add(p,"InitialTripTankMudVolume",data%Configuration%Mud%InitialTripTankMudVolume) + call json%add(p,"InitialTripTankMudVolumeGal",data%Configuration%Mud%InitialTripTankMudVolumeGal) + call json%add(p,"PedalFlowMeter",data%Configuration%Mud%PedalFlowMeter) + + ! 3. add new node to parent + call json%add(parent,p) + end subroutine + + + subroutine Set_ActiveMudVolume_StudentStation(v) + implicit none + real*8, intent(in) :: v + #ifdef ExcludeExtraChanges + if(data%Configuration%Mud%ActiveMudVolume == v) return + #endif + data%Configuration%Mud%ActiveMudVolume = v + ! if(associated(ActiveMudVolumePtr)) call ActiveMudVolumePtr(data%Configuration%Mud%ActiveMudVolume) + end subroutine + + subroutine Set_ActiveDensity_StudentStation(v) + implicit none + real*8, intent(in) :: v + #ifdef ExcludeExtraChanges + if(data%Configuration%Mud%ActiveDensity == v) return + #endif + data%Configuration%Mud%ActiveDensity = v + ! if(associated(ActiveDensityPtr)) call ActiveDensityPtr(data%Configuration%Mud%ActiveDensity) + end subroutine + + subroutine Set_ReserveMudVolume_StudentStation(v) + implicit none + real*8, intent(in) :: v + #ifdef ExcludeExtraChanges + if(data%Configuration%Mud%ReserveMudVolume == v) return + #endif + data%Configuration%Mud%ReserveMudVolume = v + ! if(associated(ReserveMudVolumePtr)) call ReserveMudVolumePtr(data%Configuration%Mud%ReserveMudVolume) + end subroutine + + subroutine Set_ReserveDensity_StudentStation(v) + implicit none + real*8, intent(in) :: v + #ifdef ExcludeExtraChanges + if(data%Configuration%Mud%ReserveDensity == v) return + #endif + data%Configuration%Mud%ReserveDensity = v + ! if(associated(ReserveDensityPtr)) call ReserveDensityPtr(data%Configuration%Mud%ReserveDensity) + end subroutine + +end module MudPropertiesModule \ No newline at end of file diff --git a/CSharp/BasicInputs/WellProfile/CPathGeneration.f90 b/CSharp/BasicInputs/WellProfile/CPathGeneration.f90 index 79ef24c..e3b74bf 100644 --- a/CSharp/BasicInputs/WellProfile/CPathGeneration.f90 +++ b/CSharp/BasicInputs/WellProfile/CPathGeneration.f90 @@ -9,18 +9,37 @@ module CPathGeneration type(json_value),pointer :: parent type(json_core) :: json - type(json_value),pointer :: p + type(json_value),pointer :: ppath,pitems,pdp,p + integer::i ! 1. create new node - call json%create_object(p,'Path') + call json%create_object(ppath,'Path') + + call json%create_array(pitems,'Items') + do i=1,data%Configuration%Path%ItemCount + call json%create_object(p,'') + call json%add(p,"HoleType",data%Configuration%Path%items(i)%HoleType) + call json%add(p,"Angle",data%Configuration%Path%items(i)%Angle) + call json%add(p,"Length",data%Configuration%Path%items(i)%Length) + call json%add(p,"FinalAngle",data%Configuration%Path%items(i)%FinalAngle) + call json%add(p,"TotalLength",data%Configuration%Path%items(i)%TotalLength) + call json%add(p,"MeasuredDepth",data%Configuration%Path%items(i)%MeasuredDepth) + call json%add(p,"TotalVerticalDepth",data%Configuration%Path%items(i)%TotalVerticalDepth) + call json%add(pitems,p) + end do - ! 2. add member of data type to new node - ! call StringConfigurationToJson(p) - ! call FormationToJson(p) - ! call json%add(p,"",data%Configuration%Formation%Formations(i)%Abrasiveness) + call json%create_array(pdp,'DataPoints') + do i=1,data%Configuration%Path%DataPointsCount + call json%create_object(p,'') + call json%add(p,"X",data%Configuration%Path%DataPoints(i)%X) + call json%add(p,"Y",data%Configuration%Path%DataPoints(i)%Y) + call json%add(pdp,p) + end do ! 3. add new node to parent - call json%add(parent,p) + call json%add(ppath,pitems) + call json%add(ppath,pdp) + call json%add(parent,ppath) end subroutine end module CPathGeneration \ No newline at end of file diff --git a/CSharp/BasicInputs/WellProfile/CPathGenerationVariables.f90 b/CSharp/BasicInputs/WellProfile/CPathGenerationVariables.f90 index 07ac5a9..4adb520 100644 --- a/CSharp/BasicInputs/WellProfile/CPathGenerationVariables.f90 +++ b/CSharp/BasicInputs/WellProfile/CPathGenerationVariables.f90 @@ -25,6 +25,6 @@ module CPathGenerationVariables type(CDataPointItem), allocatable :: DataPoints(:) End type PathGenerationType - Type(PathGenerationType)::PathGeneration + ! Type(PathGenerationType)::PathGeneration end module CPathGenerationVariables \ No newline at end of file diff --git a/CSharp/BasicInputs/WellProfile/CWellSurveyData.f90 b/CSharp/BasicInputs/WellProfile/CWellSurveyData.f90 index e527b4b..bee7f63 100644 --- a/CSharp/BasicInputs/WellProfile/CWellSurveyData.f90 +++ b/CSharp/BasicInputs/WellProfile/CWellSurveyData.f90 @@ -2,33 +2,33 @@ module CWellSurveyData use CWellSurveyDataVariables implicit none public - contains - integer function SetSurveyData(count, array) - !DEC$ ATTRIBUTES DLLEXPORT::SetSurveyData - !DEC$ ATTRIBUTES ALIAS: 'SetSurveyData' :: SetSurveyData - implicit none - integer, intent(in) :: count - integer :: i - type(CSurveyDataItem), intent(inout), target :: array(count) - type(CSurveyDataItem), pointer :: item - WellSurveyData%Count = count - if(size(WellSurveyData%Items) > 0) then - deallocate(WellSurveyData%Items) - end if - if(count > 0) then - allocate(WellSurveyData%Items(count)) - do i = 1, count - item => array(i) - WellSurveyData%Items(i)%MeasuredDepth = item%MeasuredDepth - WellSurveyData%Items(i)%Inclination = item%Inclination - WellSurveyData%Items(i)%Azimoth = item%Azimoth - WellSurveyData%Items(i)%TotalVerticalDepth = item%TotalVerticalDepth - WellSurveyData%Items(i)%X = item%X - WellSurveyData%Items(i)%Y = item%Y - WellSurveyData%Items(i)%Z = item%Z - end do - end if + contains + ! integer function SetSurveyData(count, array) + ! !DEC$ ATTRIBUTES DLLEXPORT::SetSurveyData + ! !DEC$ ATTRIBUTES ALIAS: 'SetSurveyData' :: SetSurveyData + ! implicit none + ! integer, intent(in) :: count + ! integer :: i + ! type(CSurveyDataItem), intent(inout), target :: array(count) + ! type(CSurveyDataItem), pointer :: item + ! WellSurveyData%Count = count + ! if(size(WellSurveyData%Items) > 0) then + ! deallocate(WellSurveyData%Items) + ! end if + ! if(count > 0) then + ! allocate(WellSurveyData%Items(count)) + ! do i = 1, count + ! item => array(i) + ! WellSurveyData%Items(i)%MeasuredDepth = item%MeasuredDepth + ! WellSurveyData%Items(i)%Inclination = item%Inclination + ! WellSurveyData%Items(i)%Azimoth = item%Azimoth + ! WellSurveyData%Items(i)%TotalVerticalDepth = item%TotalVerticalDepth + ! WellSurveyData%Items(i)%X = item%X + ! WellSurveyData%Items(i)%Y = item%Y + ! WellSurveyData%Items(i)%Z = item%Z + ! end do + ! end if - SetSurveyData = 0 - end function SetSurveyData + ! SetSurveyData = 0 + ! end function SetSurveyData end module CWellSurveyData \ No newline at end of file diff --git a/Equipments/MudSystem/Elements_Creation.f90 b/Equipments/MudSystem/Elements_Creation.f90 index 7301cf9..cad138b 100644 --- a/Equipments/MudSystem/Elements_Creation.f90 +++ b/Equipments/MudSystem/Elements_Creation.f90 @@ -139,7 +139,7 @@ ALLOCATE (data%State%MudSystem%Xstart_OpSection(data%State%F_Counts%BottomHoleIn call data%State%MudSystem%Hz_Mud_Backhead_section%AddToFirst (1) call data%State%MudSystem%Hz_Mud_Forehead_X%AddToFirst (data%State%MudSystem%Xend_PipeSection(1)) call data%State%MudSystem%Hz_Mud_Forehead_section%AddToFirst (1) - call data%State%MudSystem%Hz_Density%AddToFirst (MudProperties%ActiveDensity) ! initial(ppg) + call data%State%MudSystem%Hz_Density%AddToFirst (data%Configuration%Mud%ActiveDensity) ! initial(ppg) call data%State%MudSystem%Hz_RemainedVolume_in_LastSection%AddToFirst (0.0d0) call data%State%MudSystem%Hz_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) call data%State%MudSystem%Hz_MudOrKick%AddToFirst (0) @@ -150,7 +150,7 @@ ALLOCATE (data%State%MudSystem%Xstart_OpSection(data%State%F_Counts%BottomHoleIn call data%State%MudSystem%St_Mud_Backhead_section%AddToFirst (2) call data%State%MudSystem%St_Mud_Forehead_X%AddToFirst (data%State%MudSystem%Xend_PipeSection(data%State%F_Counts%StringIntervalCounts)) call data%State%MudSystem%St_Mud_Forehead_section%AddToFirst (data%State%F_Counts%StringIntervalCounts) - call data%State%MudSystem%St_Density%AddToFirst (MudProperties%ActiveDensity) ! initial(ppg) + call data%State%MudSystem%St_Density%AddToFirst (data%Configuration%Mud%ActiveDensity) ! initial(ppg) call data%State%MudSystem%St_RemainedVolume_in_LastSection%AddToFirst (0.0d0) call data%State%MudSystem%St_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) call data%State%MudSystem%St_MudOrKick%AddToFirst (0) @@ -161,7 +161,7 @@ ALLOCATE (data%State%MudSystem%Xstart_OpSection(data%State%F_Counts%BottomHoleIn call data%State%MudSystem%Ann_Mud_Backhead_section%AddToFirst (data%State%F_Counts%StringIntervalCounts+1) call data%State%MudSystem%Ann_Mud_Forehead_X%AddToFirst (data%State%MudSystem%Xend_PipeSection(data%State%MudSystem%NoPipeSections)) call data%State%MudSystem%Ann_Mud_Forehead_section%AddToFirst (data%State%MudSystem%NoPipeSections) - call data%State%MudSystem%Ann_Density%AddToFirst (MudProperties%ActiveDensity) ! initial(ppg) + call data%State%MudSystem%Ann_Density%AddToFirst (data%Configuration%Mud%ActiveDensity) ! initial(ppg) call data%State%MudSystem%Ann_RemainedVolume_in_LastSection%AddToFirst (0.0d0) call data%State%MudSystem%Ann_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) call data%State%MudSystem%Ann_MudOrKick%AddToFirst (0) @@ -177,7 +177,7 @@ ALLOCATE (data%State%MudSystem%Xstart_OpSection(data%State%F_Counts%BottomHoleIn call data%State%MudSystem%ChokeLine_Mud_Backhead_section%AddToFirst (1) call data%State%MudSystem%ChokeLine_Mud_Forehead_X%AddToFirst (data%Configuration%BopStack%ChokeLineLength) call data%State%MudSystem%ChokeLine_Mud_Forehead_section%AddToFirst (1) - call data%State%MudSystem%ChokeLine_Density%AddToFirst (MudProperties%ActiveDensity) ! initial(ppg) + call data%State%MudSystem%ChokeLine_Density%AddToFirst (data%Configuration%Mud%ActiveDensity) ! initial(ppg) call data%State%MudSystem%ChokeLine_RemainedVolume_in_LastSection%AddToFirst (0.0d0) call data%State%MudSystem%ChokeLine_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) call data%State%MudSystem%ChokeLine_MudOrKick%AddToFirst (0) @@ -188,7 +188,7 @@ ALLOCATE (data%State%MudSystem%Xstart_OpSection(data%State%F_Counts%BottomHoleIn call data%State%MudSystem%Op_Mud_Backhead_section%AddToFirst (1) call data%State%MudSystem%Op_Mud_Forehead_X%AddToFirst (data%State%MudSystem%Xend_OpSection(data%State%F_Counts%BottomHoleIntervalCounts)) call data%State%MudSystem%Op_Mud_Forehead_section%AddToFirst (data%State%F_Counts%BottomHoleIntervalCounts) - call data%State%MudSystem%Op_Density%AddToFirst (MudProperties%ActiveDensity) + call data%State%MudSystem%Op_Density%AddToFirst (data%Configuration%Mud%ActiveDensity) call data%State%MudSystem%Op_RemainedVolume_in_LastSection%AddToFirst (0.0d0) call data%State%MudSystem%Op_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) call data%State%MudSystem%Op_MudOrKick%AddToFirst (0) diff --git a/Equipments/MudSystem/MudSystem.f90 b/Equipments/MudSystem/MudSystem.f90 index 6ee15a0..451ab1a 100644 --- a/Equipments/MudSystem/MudSystem.f90 +++ b/Equipments/MudSystem/MudSystem.f90 @@ -5,7 +5,7 @@ use SimulationVariables !@@@ use PressureDisplayVARIABLESModule USE FricPressDropVarsModule USE Fluid_Flow_Startup_Vars - USE CMudPropertiesVariables + ! USE CMudPropertiesVariables USE CManifolds use CPumpsVariables use CPumps @@ -17,6 +17,7 @@ use SimulationVariables !@@@ use CDataDisplayConsole use SimulationVariables use CStudentStationVariables !, PitGainLossReset=>PitGainLossZero + use MudPropertiesModule implicit none @@ -687,7 +688,7 @@ use SimulationVariables !@ data%State%MudSystem%ActiveTankVolume= data%State%MudSystem%ActiveTankVolume+ Mp1Coef*data%State%Pump(1)%Flow_Rate*data%State%MudSystem%DeltaT_Mudline/60. + Mp2Coef*data%State%Pump(2)%Flow_Rate*data%State%MudSystem%DeltaT_Mudline/60. !write(*,*) 'active by j15' endif - data%State%MudSystem%ActiveTankVolume=min(data%State%MudSystem%ActiveTankVolume , MudProperties%ActiveTotalTankCapacityGal-MudProperties%ActiveSettledContentsGal) + data%State%MudSystem%ActiveTankVolume=min(data%State%MudSystem%ActiveTankVolume , data%Configuration%Mud%ActiveTotalTankCapacityGal-data%Configuration%Mud%ActiveSettledContentsGal) !if ActiveTankVolume is higher, excess amount is dumped endif if (H84 > 0.0) then !CementPumpToCementTank_Through67 @@ -1039,7 +1040,7 @@ use SimulationVariables !@ data%State%MudSystem%ActiveTankVolume= data%State%MudSystem%ActiveTankVolume+ ((0.5*data%State%MUD(6)%Q/60.)*data%State%MudSystem%DeltaT_Mudline) data%State%MudSystem%BellNippleVolume= data%State%MudSystem%BellNippleVolume+ ((0.5*data%State%MUD(6)%Q/60.)*data%State%MudSystem%DeltaT_Mudline) endif - data%State%MudSystem%ActiveTankVolume=min(data%State%MudSystem%ActiveTankVolume , MudProperties%ActiveTotalTankCapacityGal-MudProperties%ActiveSettledContentsGal) + data%State%MudSystem%ActiveTankVolume=min(data%State%MudSystem%ActiveTankVolume , data%Configuration%Mud%ActiveTotalTankCapacityGal-data%Configuration%Mud%ActiveSettledContentsGal) !if ActiveTankVolume is higher, excess amount is dumped endif @@ -1075,17 +1076,17 @@ use SimulationVariables !@ if (j3 == 1 .and. B71==1) then !(volumes in galon) data%State%MUD(3)%Q = min(data%State%MUD(3)%Q , data%State%MudSystem%PedalMeter) !write(*,*) 'data%State%MUD(3)%Q=' , data%State%MUD(3)%Q - IF (MudProperties%ActiveAutoDensity == .FALSE.) THEN + IF (data%Configuration%Mud%ActiveAutoDensity == .FALSE.) THEN data%State%MudSystem%ActiveTankDensity= ((data%State%MudSystem%ActiveTankDensity*data%State%MudSystem%ActiveTankVolume)+(data%State%MudSystem%BellNippleDensity*(data%State%MUD(3)%Q/60.)*data%State%MudSystem%DeltaT_Mudline))/(data%State%MudSystem%ActiveTankVolume+((data%State%MUD(3)%Q/60.)*data%State%MudSystem%DeltaT_Mudline)) data%State%MudSystem%ActiveTankVolume= data%State%MudSystem%ActiveTankVolume+ ((data%State%MUD(3)%Q/60.)*data%State%MudSystem%DeltaT_Mudline) !write(*,*) 'active increase bell 1=' , ((data%State%MUD(3)%Q/60.)*DeltaT_Mudline) - ELSEIF (MudProperties%ActiveAutoDensity .and. data%State%MudSystem%BellNippleDensity > data%State%MudSystem%ActiveTankDensity) THEN + ELSEIF (data%Configuration%Mud%ActiveAutoDensity .and. data%State%MudSystem%BellNippleDensity > data%State%MudSystem%ActiveTankDensity) THEN data%State%MudSystem%ActiveTankVolume= data%State%MudSystem%ActiveTankVolume+ ((20.8d0-data%State%MudSystem%BellNippleDensity)/(20.8d0-data%State%MudSystem%ActiveTankDensity))*((data%State%MUD(3)%Q/60.d0)*data%State%MudSystem%DeltaT_Mudline) ! asumed cutting density = 20.8 ppg !write(*,*) 'active increase bell 2=' , ((20.8d0-BellNippleDensity)/(20.8d0-ActiveTankDensity))*((data%State%MUD(3)%Q/60.d0)*DeltaT_Mudline) - ELSEIF (MudProperties%ActiveAutoDensity .and. data%State%MudSystem%BellNippleDensity < 5.0) THEN + ELSEIF (data%Configuration%Mud%ActiveAutoDensity .and. data%State%MudSystem%BellNippleDensity < 5.0) THEN data%State%MudSystem%ActiveTankVolume= data%State%MudSystem%ActiveTankVolume+ ((2.d0-data%State%MudSystem%BellNippleDensity)/(2.d0-data%State%MudSystem%ActiveTankDensity))*((data%State%MUD(3)%Q/60.d0)*data%State%MudSystem%DeltaT_Mudline) ! asumed GAS density = 2.0 ppg !write(*,*) 'active increase bell 3=' , ((2.d0-BellNippleDensity)/(2.d0-ActiveTankDensity))*((data%State%MUD(3)%Q/60.d0)*DeltaT_Mudline) - ELSEIF (MudProperties%ActiveAutoDensity .and. 5.0 < data%State%MudSystem%BellNippleDensity .and. data%State%MudSystem%BellNippleDensity <= data%State%MudSystem%ActiveTankDensity) THEN + ELSEIF (data%Configuration%Mud%ActiveAutoDensity .and. 5.0 < data%State%MudSystem%BellNippleDensity .and. data%State%MudSystem%BellNippleDensity <= data%State%MudSystem%ActiveTankDensity) THEN !write(*,*) ' Auto true 3' data%State%MudSystem%ActiveTankVolume= data%State%MudSystem%ActiveTankVolume+ ((data%State%MUD(3)%Q/60.d0)*data%State%MudSystem%DeltaT_Mudline) !write(*,*) 'active increase bell 4=' , ((data%State%MUD(3)%Q/60.d0)*DeltaT_Mudline) @@ -1093,18 +1094,18 @@ use SimulationVariables !@ endif if (j3 == 1 .and. B77==1) then data%State%MUD(3)%Q = min(data%State%MUD(3)%Q , data%State%MudSystem%PedalMeter) - IF (MudProperties%ActiveAutoDensity == .FALSE.) THEN + IF (data%Configuration%Mud%ActiveAutoDensity == .FALSE.) THEN data%State%MudSystem%TripTankDensityCalc= ((data%State%MudSystem%TripTankDensityCalc*data%State%MudSystem%TripTankVolumeCalc)+(data%State%MudSystem%BellNippleDensity*(data%State%MUD(3)%Q/60.)*data%State%MudSystem%DeltaT_Mudline))/(data%State%MudSystem%TripTankVolumeCalc+((data%State%MUD(3)%Q/60.)*data%State%MudSystem%DeltaT_Mudline)) data%State%MudSystem%TripTankVolumeCalc= data%State%MudSystem%TripTankVolumeCalc+ (data%State%MUD(3)%Q/60.)*data%State%MudSystem%DeltaT_Mudline - ELSEIF (MudProperties%ActiveAutoDensity .and. data%State%MudSystem%BellNippleDensity > data%State%MudSystem%ActiveTankDensity) THEN + ELSEIF (data%Configuration%Mud%ActiveAutoDensity .and. data%State%MudSystem%BellNippleDensity > data%State%MudSystem%ActiveTankDensity) THEN AddedVolumeToTank= ((20.8d0-data%State%MudSystem%BellNippleDensity)/(20.8d0-data%State%MudSystem%ActiveTankDensity))*((data%State%MUD(3)%Q/60.d0)*data%State%MudSystem%DeltaT_Mudline) data%State%MudSystem%TripTankDensityCalc= ((data%State%MudSystem%TripTankDensityCalc*data%State%MudSystem%TripTankVolumeCalc)+(data%State%MudSystem%ActiveTankDensity*AddedVolumeToTank))/(data%State%MudSystem%TripTankVolumeCalc+AddedVolumeToTank) data%State%MudSystem%TripTankVolumeCalc= data%State%MudSystem%TripTankVolumeCalc+ AddedVolumeToTank - ELSEIF (MudProperties%ActiveAutoDensity .and. data%State%MudSystem%BellNippleDensity < 5.0) THEN + ELSEIF (data%Configuration%Mud%ActiveAutoDensity .and. data%State%MudSystem%BellNippleDensity < 5.0) THEN AddedVolumeToTank= ((2.d0-data%State%MudSystem%BellNippleDensity)/(2.d0-data%State%MudSystem%ActiveTankDensity))*((data%State%MUD(3)%Q/60.d0)*data%State%MudSystem%DeltaT_Mudline) ! asumed GAS density = 2.0 ppg data%State%MudSystem%TripTankDensityCalc= ((data%State%MudSystem%TripTankDensityCalc*data%State%MudSystem%TripTankVolumeCalc)+(data%State%MudSystem%ActiveTankDensity*AddedVolumeToTank))/(data%State%MudSystem%TripTankVolumeCalc+AddedVolumeToTank) data%State%MudSystem%TripTankVolumeCalc= data%State%MudSystem%TripTankVolumeCalc+ AddedVolumeToTank - ELSEIF (MudProperties%ActiveAutoDensity .and. 5.0 < data%State%MudSystem%BellNippleDensity .and. data%State%MudSystem%BellNippleDensity <= data%State%MudSystem%ActiveTankDensity) THEN + ELSEIF (data%Configuration%Mud%ActiveAutoDensity .and. 5.0 < data%State%MudSystem%BellNippleDensity .and. data%State%MudSystem%BellNippleDensity <= data%State%MudSystem%ActiveTankDensity) THEN AddedVolumeToTank= ((data%State%MUD(3)%Q/60.d0)*data%State%MudSystem%DeltaT_Mudline) data%State%MudSystem%TripTankDensityCalc= ((data%State%MudSystem%TripTankDensityCalc*data%State%MudSystem%TripTankVolumeCalc)+(data%State%MudSystem%ActiveTankDensity*AddedVolumeToTank))/(data%State%MudSystem%TripTankVolumeCalc+AddedVolumeToTank) data%State%MudSystem%TripTankVolumeCalc= data%State%MudSystem%TripTankVolumeCalc+ AddedVolumeToTank @@ -1118,7 +1119,7 @@ use SimulationVariables !@ data%State%MUD(3)%Q = min(data%State%MUD(3)%Q , data%State%MudSystem%PedalMeter) - IF (MudProperties%ActiveAutoDensity == .FALSE.) THEN + IF (data%Configuration%Mud%ActiveAutoDensity == .FALSE.) THEN data%State%MudSystem%ActiveTankDensity= ((data%State%MudSystem%ActiveTankDensity*data%State%MudSystem%ActiveTankVolume)+(data%State%MudSystem%BellNippleDensity*(0.5*data%State%MUD(3)%Q/60.)*data%State%MudSystem%DeltaT_Mudline))/(data%State%MudSystem%ActiveTankVolume+((0.5*data%State%MUD(3)%Q/60.)*data%State%MudSystem%DeltaT_Mudline)) data%State%MudSystem%TripTankDensityCalc= ((data%State%MudSystem%TripTankDensityCalc*data%State%MudSystem%TripTankVolumeCalc)+(data%State%MudSystem%BellNippleDensity*(0.5*data%State%MUD(3)%Q/60.)*data%State%MudSystem%DeltaT_Mudline))/(data%State%MudSystem%TripTankVolumeCalc+((0.5*data%State%MUD(3)%Q/60.)*data%State%MudSystem%DeltaT_Mudline)) @@ -1126,7 +1127,7 @@ use SimulationVariables !@ data%State%MudSystem%ActiveTankVolume= data%State%MudSystem%ActiveTankVolume+ ((0.5*data%State%MUD(3)%Q/60.)*data%State%MudSystem%DeltaT_Mudline) data%State%MudSystem%TripTankVolumeCalc= data%State%MudSystem%TripTankVolumeCalc+ ((0.5*data%State%MUD(3)%Q/60.)*data%State%MudSystem%DeltaT_Mudline) - ELSEIF (MudProperties%ActiveAutoDensity .and. data%State%MudSystem%BellNippleDensity > data%State%MudSystem%ActiveTankDensity) THEN + ELSEIF (data%Configuration%Mud%ActiveAutoDensity .and. data%State%MudSystem%BellNippleDensity > data%State%MudSystem%ActiveTankDensity) THEN AddedVolumeToTank= ((20.8d0-data%State%MudSystem%BellNippleDensity)/(20.8d0-data%State%MudSystem%ActiveTankDensity))*((0.5d0*data%State%MUD(3)%Q/60.d0)*data%State%MudSystem%DeltaT_Mudline) @@ -1135,7 +1136,7 @@ use SimulationVariables !@ data%State%MudSystem%ActiveTankVolume= data%State%MudSystem%ActiveTankVolume+ AddedVolumeToTank data%State%MudSystem%TripTankVolumeCalc= data%State%MudSystem%TripTankVolumeCalc+ AddedVolumeToTank - ELSEIF (MudProperties%ActiveAutoDensity .and. 5.0 < data%State%MudSystem%ActiveTankDensity) THEN + ELSEIF (data%Configuration%Mud%ActiveAutoDensity .and. 5.0 < data%State%MudSystem%ActiveTankDensity) THEN AddedVolumeToTank= ((2.d0-data%State%MudSystem%BellNippleDensity)/(2.d0-data%State%MudSystem%ActiveTankDensity))*((0.5d0*data%State%MUD(3)%Q/60.d0)*data%State%MudSystem%DeltaT_Mudline) ! asumed GAS density = 2.0 ppg data%State%MudSystem%TripTankDensityCalc= ((data%State%MudSystem%TripTankDensityCalc*data%State%MudSystem%TripTankVolumeCalc)+(data%State%MudSystem%ActiveTankDensity*AddedVolumeToTank))/(data%State%MudSystem%TripTankVolumeCalc+AddedVolumeToTank) @@ -1143,7 +1144,7 @@ use SimulationVariables !@ data%State%MudSystem%ActiveTankVolume= data%State%MudSystem%ActiveTankVolume+ AddedVolumeToTank data%State%MudSystem%TripTankVolumeCalc= data%State%MudSystem%TripTankVolumeCalc+ AddedVolumeToTank - ELSEIF (MudProperties%ActiveAutoDensity .and. 5.0 < data%State%MudSystem%BellNippleDensity .and. data%State%MudSystem%BellNippleDensity <= data%State%MudSystem%ActiveTankDensity) THEN + ELSEIF (data%Configuration%Mud%ActiveAutoDensity .and. 5.0 < data%State%MudSystem%BellNippleDensity .and. data%State%MudSystem%BellNippleDensity <= data%State%MudSystem%ActiveTankDensity) THEN AddedVolumeToTank= ((data%State%MUD(3)%Q/60.d0)*data%State%MudSystem%DeltaT_Mudline) data%State%MudSystem%TripTankDensityCalc= ((data%State%MudSystem%TripTankDensityCalc*data%State%MudSystem%TripTankVolumeCalc)+(data%State%MudSystem%ActiveTankDensity*AddedVolumeToTank))/(data%State%MudSystem%TripTankVolumeCalc+AddedVolumeToTank) @@ -1180,7 +1181,7 @@ use SimulationVariables !@ data%State%MudSystem%TripTankVolumeCalc = min(data%State%MudSystem%TripTankVolumeCalc,50.*42.) !50. BBL *42. gal/BBL = gal !if TripTankVolumeCalc>50 BBl, excess value(TripTankVolumeCalc-50) is dumped - data%State%MudSystem%ActiveTankVolume = min(data%State%MudSystem%ActiveTankVolume , MudProperties%ActiveTotalTankCapacityGal - MudProperties%ActiveSettledContentsGal) + data%State%MudSystem%ActiveTankVolume = min(data%State%MudSystem%ActiveTankVolume , data%Configuration%Mud%ActiveTotalTankCapacityGal - data%Configuration%Mud%ActiveSettledContentsGal) !if ActiveTankVolume is higher, excess amount is dumped !write(*,*) 'BellNippleDensity=' , BellNippleDensity @@ -1284,27 +1285,27 @@ use SimulationVariables !@ ! IN ALL CONDITIONS EFFECT OF 78 IS COMPUTED BY RealJ4 if (C71==1 .and. C77==0) then !(volumes in galon) RealJ4: 1 OR 2(IF 78 IS OPEN) - IF (MudProperties%ActiveAutoDensity == .FALSE.) THEN + IF (data%Configuration%Mud%ActiveAutoDensity == .FALSE.) THEN data%State%MudSystem%ActiveTankDensity= ((data%State%MudSystem%ActiveTankDensity*data%State%MudSystem%ActiveTankVolume)+(data%State%MudSystem%ChokeOutletDensity*((1./RealJ4)*data%State%MUD(4)%Q/60.)*data%State%MudSystem%DeltaT_Mudline))/(data%State%MudSystem%ActiveTankVolume+(((1./RealJ4)*data%State%MUD(4)%Q/60.)*data%State%MudSystem%DeltaT_Mudline)) data%State%MudSystem%ActiveTankVolume= data%State%MudSystem%ActiveTankVolume+ (((1./RealJ4)*data%State%MUD(4)%Q/60.)*data%State%MudSystem%DeltaT_Mudline) !write(*,*) 'active increase choke1=' , (((1./RealJ4)*data%State%MUD(4)%Q/60.)*DeltaT_Mudline) data%State%MudSystem%ChokeManifoldDumpVolume= data%State%MudSystem%ChokeManifoldDumpVolume+ C78*(((1./RealJ4)*data%State%MUD(4)%Q/60.)*data%State%MudSystem%DeltaT_Mudline) - ELSEIF (MudProperties%ActiveAutoDensity .and. data%State%MudSystem%ChokeOutletDensity > data%State%MudSystem%ActiveTankDensity) THEN + ELSEIF (data%Configuration%Mud%ActiveAutoDensity .and. data%State%MudSystem%ChokeOutletDensity > data%State%MudSystem%ActiveTankDensity) THEN data%State%MudSystem%ActiveTankVolume= data%State%MudSystem%ActiveTankVolume+ ((20.8d0-data%State%MudSystem%ChokeOutletDensity)/(20.8d0-data%State%MudSystem%ActiveTankDensity))*(((1.d0/RealJ4)*data%State%MUD(4)%Q/60.d0)*data%State%MudSystem%DeltaT_Mudline) ! asumed cutting density = 20.8 ppg data%State%MudSystem%ChokeManifoldDumpVolume= data%State%MudSystem%ChokeManifoldDumpVolume+ C78*(((1./RealJ4)*data%State%MUD(4)%Q/60.d0)*data%State%MudSystem%DeltaT_Mudline) !write(*,*) 'active increase choke2=' , ((20.8d0-ChokeOutletDensity)/(20.8d0-ActiveTankDensity))*(((1.d0/RealJ4)*data%State%MUD(4)%Q/60.d0)*DeltaT_Mudline) - ELSEIF (MudProperties%ActiveAutoDensity .and. data%State%MudSystem%ChokeOutletDensity < 5.0) THEN + ELSEIF (data%Configuration%Mud%ActiveAutoDensity .and. data%State%MudSystem%ChokeOutletDensity < 5.0) THEN data%State%MudSystem%ActiveTankVolume= data%State%MudSystem%ActiveTankVolume+ ((2.d0-data%State%MudSystem%ChokeOutletDensity)/(2.d0-data%State%MudSystem%ActiveTankDensity))*(((1.d0/RealJ4)*data%State%MUD(4)%Q/60.d0)*data%State%MudSystem%DeltaT_Mudline) ! asumed GAS density = 2.0 ppg data%State%MudSystem%ChokeManifoldDumpVolume= data%State%MudSystem%ChokeManifoldDumpVolume+ C78*(((1.d0/RealJ4)*data%State%MUD(4)%Q/60.d0)*data%State%MudSystem%DeltaT_Mudline) !write(*,*) 'active increase choke3=' ,((2.d0-ChokeOutletDensity)/(2.d0-ActiveTankDensity))*(((1.d0/RealJ4)*data%State%MUD(4)%Q/60.d0)*DeltaT_Mudline) - ELSEIF (MudProperties%ActiveAutoDensity .and. 5.0 < data%State%MudSystem%ChokeOutletDensity .and. data%State%MudSystem%ChokeOutletDensity <= data%State%MudSystem%ActiveTankDensity) THEN + ELSEIF (data%Configuration%Mud%ActiveAutoDensity .and. 5.0 < data%State%MudSystem%ChokeOutletDensity .and. data%State%MudSystem%ChokeOutletDensity <= data%State%MudSystem%ActiveTankDensity) THEN !write(*,*) ' Auto true 3' @@ -1321,13 +1322,13 @@ use SimulationVariables !@ if (C77==1 .and. C71==0) then !RealJ4: 1 OR 2(IF 78 IS OPEN) - IF (MudProperties%ActiveAutoDensity == .FALSE.) THEN + IF (data%Configuration%Mud%ActiveAutoDensity == .FALSE.) THEN data%State%MudSystem%TripTankDensityCalc= ((data%State%MudSystem%TripTankDensityCalc*data%State%MudSystem%TripTankVolumeCalc)+(data%State%MudSystem%ChokeOutletDensity*((1./RealJ4)*data%State%MUD(4)%Q/60.)*data%State%MudSystem%DeltaT_Mudline))/(data%State%MudSystem%TripTankVolumeCalc+(((1./RealJ4)*data%State%MUD(4)%Q/60.)*data%State%MudSystem%DeltaT_Mudline)) data%State%MudSystem%TripTankVolumeCalc= data%State%MudSystem%TripTankVolumeCalc+ (((1./RealJ4)*data%State%MUD(4)%Q/60.)*data%State%MudSystem%DeltaT_Mudline) data%State%MudSystem%ChokeManifoldDumpVolume= data%State%MudSystem%ChokeManifoldDumpVolume+ C78*(((1./RealJ4)*data%State%MUD(4)%Q/60.)*data%State%MudSystem%DeltaT_Mudline) - ELSEIF (MudProperties%ActiveAutoDensity .and. data%State%MudSystem%ChokeOutletDensity > data%State%MudSystem%ActiveTankDensity) THEN + ELSEIF (data%Configuration%Mud%ActiveAutoDensity .and. data%State%MudSystem%ChokeOutletDensity > data%State%MudSystem%ActiveTankDensity) THEN AddedVolumeToTank= ((20.8d0-data%State%MudSystem%ChokeOutletDensity)/(20.8d0-data%State%MudSystem%ActiveTankDensity))*(((1.d0/RealJ4)*data%State%MUD(4)%Q/60.d0)*data%State%MudSystem%DeltaT_Mudline) data%State%MudSystem%TripTankDensityCalc= ((data%State%MudSystem%TripTankDensityCalc*data%State%MudSystem%TripTankVolumeCalc)+(data%State%MudSystem%ActiveTankDensity*AddedVolumeToTank))/(data%State%MudSystem%TripTankVolumeCalc+AddedVolumeToTank) @@ -1337,7 +1338,7 @@ use SimulationVariables !@ data%State%MudSystem%ChokeManifoldDumpVolume= data%State%MudSystem%ChokeManifoldDumpVolume+ C78*(((1.d0/RealJ4)*data%State%MUD(4)%Q/60.d0)*data%State%MudSystem%DeltaT_Mudline) - ELSEIF (MudProperties%ActiveAutoDensity .and. data%State%MudSystem%ChokeOutletDensity < 5.0) THEN + ELSEIF (data%Configuration%Mud%ActiveAutoDensity .and. data%State%MudSystem%ChokeOutletDensity < 5.0) THEN AddedVolumeToTank= ((2.d0-data%State%MudSystem%ChokeOutletDensity)/(2.d0-data%State%MudSystem%ActiveTankDensity))*(((1.d0/RealJ4)*data%State%MUD(4)%Q/60.d0)*data%State%MudSystem%DeltaT_Mudline) ! asumed GAS density = 2.0 ppg data%State%MudSystem%TripTankDensityCalc= ((data%State%MudSystem%TripTankDensityCalc*data%State%MudSystem%TripTankVolumeCalc)+(data%State%MudSystem%ActiveTankDensity*AddedVolumeToTank))/(data%State%MudSystem%TripTankVolumeCalc+AddedVolumeToTank) @@ -1346,7 +1347,7 @@ use SimulationVariables !@ data%State%MudSystem%ChokeManifoldDumpVolume= data%State%MudSystem%ChokeManifoldDumpVolume+ C78*(((1.d0/RealJ4)*data%State%MUD(4)%Q/60.d0)*data%State%MudSystem%DeltaT_Mudline) - ELSEIF (MudProperties%ActiveAutoDensity .and. 5.0 < data%State%MudSystem%ChokeOutletDensity .and. data%State%MudSystem%ChokeOutletDensity <= data%State%MudSystem%ActiveTankDensity) THEN + ELSEIF (data%Configuration%Mud%ActiveAutoDensity .and. 5.0 < data%State%MudSystem%ChokeOutletDensity .and. data%State%MudSystem%ChokeOutletDensity <= data%State%MudSystem%ActiveTankDensity) THEN AddedVolumeToTank= (((1.d0/RealJ4)*data%State%MUD(4)%Q/60.d0)*data%State%MudSystem%DeltaT_Mudline) data%State%MudSystem%TripTankDensityCalc= ((data%State%MudSystem%TripTankDensityCalc*data%State%MudSystem%TripTankVolumeCalc)+(data%State%MudSystem%ActiveTankDensity*AddedVolumeToTank))/(data%State%MudSystem%TripTankVolumeCalc+AddedVolumeToTank) @@ -1363,7 +1364,7 @@ use SimulationVariables !@ if (C71==1 .and. C77==1) then !RealJ4: 2 OR 3(IF 78 IS OPEN) - IF (MudProperties%ActiveAutoDensity == .FALSE.) THEN + IF (data%Configuration%Mud%ActiveAutoDensity == .FALSE.) THEN data%State%MudSystem%ActiveTankDensity= ((data%State%MudSystem%ActiveTankDensity*data%State%MudSystem%ActiveTankVolume)+(data%State%MudSystem%ChokeOutletDensity*((1./RealJ4)*data%State%MUD(4)%Q/60.)*data%State%MudSystem%DeltaT_Mudline))/(data%State%MudSystem%ActiveTankVolume+(((1./RealJ4)*data%State%MUD(4)%Q/60.)*data%State%MudSystem%DeltaT_Mudline)) data%State%MudSystem%TripTankDensityCalc= ((data%State%MudSystem%TripTankDensityCalc*data%State%MudSystem%TripTankVolumeCalc)+(data%State%MudSystem%ChokeOutletDensity*((1./RealJ4)*data%State%MUD(4)%Q/60.)*data%State%MudSystem%DeltaT_Mudline))/(data%State%MudSystem%TripTankVolumeCalc+(((1./RealJ4)*data%State%MUD(4)%Q/60.)*data%State%MudSystem%DeltaT_Mudline)) @@ -1372,7 +1373,7 @@ use SimulationVariables !@ data%State%MudSystem%ChokeManifoldDumpVolume= data%State%MudSystem%ChokeManifoldDumpVolume+ C78*(((1./RealJ4)*data%State%MUD(4)%Q/60.)*data%State%MudSystem%DeltaT_Mudline) - ELSEIF (MudProperties%ActiveAutoDensity .and. data%State%MudSystem%ChokeOutletDensity > data%State%MudSystem%ActiveTankDensity) THEN + ELSEIF (data%Configuration%Mud%ActiveAutoDensity .and. data%State%MudSystem%ChokeOutletDensity > data%State%MudSystem%ActiveTankDensity) THEN AddedVolumeToTank= ((20.8d0-data%State%MudSystem%ChokeOutletDensity)/(20.8d0-data%State%MudSystem%ActiveTankDensity))*(((1.d0/RealJ4)*data%State%MUD(4)%Q/60.d0)*data%State%MudSystem%DeltaT_Mudline) @@ -1383,7 +1384,7 @@ use SimulationVariables !@ data%State%MudSystem%ChokeManifoldDumpVolume= data%State%MudSystem%ChokeManifoldDumpVolume+ C78*(((1.d0/RealJ4)*data%State%MUD(4)%Q/60.d0)*data%State%MudSystem%DeltaT_Mudline) - ELSEIF (MudProperties%ActiveAutoDensity .and. 5.0 < data%State%MudSystem%ActiveTankDensity) THEN + ELSEIF (data%Configuration%Mud%ActiveAutoDensity .and. 5.0 < data%State%MudSystem%ActiveTankDensity) THEN AddedVolumeToTank= ((2.d0-data%State%MudSystem%ChokeOutletDensity)/(2.d0-data%State%MudSystem%ActiveTankDensity))*(((1.d0/RealJ4)*data%State%MUD(4)%Q/60.d0)*data%State%MudSystem%DeltaT_Mudline) ! asumed GAS density = 2.0 ppg data%State%MudSystem%TripTankDensityCalc= ((data%State%MudSystem%TripTankDensityCalc*data%State%MudSystem%TripTankVolumeCalc)+(data%State%MudSystem%ActiveTankDensity*AddedVolumeToTank))/(data%State%MudSystem%TripTankVolumeCalc+AddedVolumeToTank) @@ -1393,7 +1394,7 @@ use SimulationVariables !@ data%State%MudSystem%ChokeManifoldDumpVolume= data%State%MudSystem%ChokeManifoldDumpVolume+ C78*(((1.d0/RealJ4)*data%State%MUD(4)%Q/60.d0)*data%State%MudSystem%DeltaT_Mudline) - ELSEIF (MudProperties%ActiveAutoDensity .and. 5.0 < data%State%MudSystem%ChokeOutletDensity .and. data%State%MudSystem%ChokeOutletDensity <= data%State%MudSystem%ActiveTankDensity) THEN + ELSEIF (data%Configuration%Mud%ActiveAutoDensity .and. 5.0 < data%State%MudSystem%ChokeOutletDensity .and. data%State%MudSystem%ChokeOutletDensity <= data%State%MudSystem%ActiveTankDensity) THEN AddedVolumeToTank= ((1.d0/RealJ4)*data%State%MUD(4)%Q/60.d0) data%State%MudSystem%TripTankDensityCalc= ((data%State%MudSystem%TripTankDensityCalc*data%State%MudSystem%TripTankVolumeCalc)+(data%State%MudSystem%ActiveTankDensity*AddedVolumeToTank))/(data%State%MudSystem%TripTankVolumeCalc+AddedVolumeToTank) @@ -1424,7 +1425,7 @@ use SimulationVariables !@ data%State%MudSystem%TripTankVolumeCalc=min(data%State%MudSystem%TripTankVolumeCalc,50.*42.) !50. BBL *42. gal/BBL = gal !if TripTankVolumeCalc>50 BBl, excess value(TripTankVolumeCalc-50) is dumped - data%State%MudSystem%ActiveTankVolume=min(data%State%MudSystem%ActiveTankVolume , MudProperties%ActiveTotalTankCapacityGal-MudProperties%ActiveSettledContentsGal) + data%State%MudSystem%ActiveTankVolume=min(data%State%MudSystem%ActiveTankVolume , data%Configuration%Mud%ActiveTotalTankCapacityGal-data%Configuration%Mud%ActiveSettledContentsGal) !if ActiveTankVolume is higher, excess amount is dumped endif @@ -1535,7 +1536,7 @@ use SimulationVariables !@ data%State%MudSystem%TripTankVolumeCalc=min(data%State%MudSystem%TripTankVolumeCalc,50.*42.) !50. BBL *42. gal/BBL = gal !if TripTankVolumeCalc>50 BBl, excess value(TripTankVolumeCalc-50) is dumped - data%State%MudSystem%ActiveTankVolume=min(data%State%MudSystem%ActiveTankVolume , MudProperties%ActiveTotalTankCapacityGal-MudProperties%ActiveSettledContentsGal) + data%State%MudSystem%ActiveTankVolume=min(data%State%MudSystem%ActiveTankVolume , data%Configuration%Mud%ActiveTotalTankCapacityGal-data%Configuration%Mud%ActiveSettledContentsGal) !if ActiveTankVolume is higher, excess amount is dumped endif @@ -2001,8 +2002,8 @@ use SimulationVariables !@ IF (Manifold%Valve(67)%Status == .TRUE.) call Activate_Pump3PopOffValveBlown() !Pump2PopOffValveBlown= .TRUE. - IF (data%State%MudSystem%ActiveTankVolume >= (MudProperties%ActiveTotalTankCapacityGal-MudProperties%ActiveSettledContentsGal)) THEN - data%State%MudSystem%ActiveTankVolume = (MudProperties%ActiveTotalTankCapacityGal-MudProperties%ActiveSettledContentsGal) + IF (data%State%MudSystem%ActiveTankVolume >= (data%Configuration%Mud%ActiveTotalTankCapacityGal-data%Configuration%Mud%ActiveSettledContentsGal)) THEN + data%State%MudSystem%ActiveTankVolume = (data%Configuration%Mud%ActiveTotalTankCapacityGal-data%Configuration%Mud%ActiveSettledContentsGal) call Activate_ActiveTankOverflow() ELSE call Deactivate_ActiveTankOverflow() @@ -2502,7 +2503,7 @@ use SimulationVariables !@ implicit none real(8), intent (in) :: v !call Log_4('ActiveMudVolumeChanged=', v) - data%State%MudSystem%ActiveTankVolume= MudProperties%ActiveMudVolumeGal ! update from student input + data%State%MudSystem%ActiveTankVolume= data%Configuration%Mud%ActiveMudVolumeGal ! update from student input end subroutine subroutine ActiveDensityChanged(v) @@ -2510,7 +2511,7 @@ use SimulationVariables !@ implicit none real(8), intent (in) :: v !call Log_4('ActiveDensityChanged=', v) - data%State%MudSystem%ActiveTankDensity= MudProperties%ActiveDensity ! update from student input + data%State%MudSystem%ActiveTankDensity= data%Configuration%Mud%ActiveDensity ! update from student input end subroutine subroutine ReserveMudVolumeChanged(v) @@ -2518,7 +2519,7 @@ use SimulationVariables !@ implicit none real(8), intent (in) :: v !call Log_4('ReserveMudVolumeChanged=', v) - data%State%MudSystem%ReserveTankVolume= MudProperties%ReserveMudVolumeGal ! update from student input + data%State%MudSystem%ReserveTankVolume= data%Configuration%Mud%ReserveMudVolumeGal ! update from student input end subroutine subroutine ReserveDensityChanged(v) @@ -2526,7 +2527,7 @@ use SimulationVariables !@ implicit none real(8), intent (in) :: v !call Log_4('ReserveDensityChanged=', v) - data%State%MudSystem%ReserveTankDensity= MudProperties%ReserveDensity ! update from student input + data%State%MudSystem%ReserveTankDensity= data%Configuration%Mud%ReserveDensity ! update from student input end subroutine ! subroutine SetupMudSystem() diff --git a/Equipments/MudSystem/MudSystemStartup.f90 b/Equipments/MudSystem/MudSystemStartup.f90 index beae781..21e48e4 100644 --- a/Equipments/MudSystem/MudSystemStartup.f90 +++ b/Equipments/MudSystem/MudSystemStartup.f90 @@ -94,11 +94,11 @@ data%State%MudSystem%FluidFlowCounter = 0 imud=1 data%State%MudSystem%iLoc= 1 ! for Kick - data%State%MudSystem%Suction_Density_MudSystem= MudProperties%ActiveDensity - data%State%MudSystem%SuctionDensity_Old= MudProperties%ActiveDensity ! initial(ppg) - data%State%MudSystem%StringDensity_Old= MudProperties%ActiveDensity ! initial(ppg) - data%State%MudSystem%AnnulusSuctionDensity_Old= MudProperties%ActiveDensity ! initial(ppg) - data%State%MudSystem%ChokeLineDensity_Old= MudProperties%ActiveDensity ! initial(ppg) + data%State%MudSystem%Suction_Density_MudSystem= data%Configuration%Mud%ActiveDensity + data%State%MudSystem%SuctionDensity_Old= data%Configuration%Mud%ActiveDensity ! initial(ppg) + data%State%MudSystem%StringDensity_Old= data%Configuration%Mud%ActiveDensity ! initial(ppg) + data%State%MudSystem%AnnulusSuctionDensity_Old= data%Configuration%Mud%ActiveDensity ! initial(ppg) + data%State%MudSystem%ChokeLineDensity_Old= data%Configuration%Mud%ActiveDensity ! initial(ppg) data%State%MudSystem%TotalAddedVolume= 0. @@ -176,12 +176,12 @@ data%State%MudSystem%PressureGauge76 = 0.0 data%State%MudSystem%TripTank_MaxVol_Allowded= 50. *42. !(bbl to gal, initial value) -data%State%MudSystem%ActiveTankFloorArea= (MudProperties%ActiveTotalTankCapacityGal) / (7.48051948*100./12.) ! (ft^2) - Tank Height= 100 inch , 12=inch to ft 7.48051948=gal to ft^3 +data%State%MudSystem%ActiveTankFloorArea= (data%Configuration%Mud%ActiveTotalTankCapacityGal) / (7.48051948*100./12.) ! (ft^2) - Tank Height= 100 inch , 12=inch to ft 7.48051948=gal to ft^3 data%State%MudSystem%TripTankFloorArea= (50.*42.) / (7.48051948*100./12.) ! (ft^2) - 50.*42.=Trip Tank Capacity in BBl*42= Gal , Tank Height= 100 inch , 12=inch to ft 7.48051948=gal to ft^3 -data%State%MudSystem%TripTank_Vol= MudProperties%InitialTripTankMudVolumeGal !(gal) +data%State%MudSystem%TripTank_Vol= data%Configuration%Mud%InitialTripTankMudVolumeGal !(gal) data%State%MudSystem%TripTank_Dens= 1. data%EquipmentControl%DataDisplayConsole%TripTankGauge=0. @@ -206,8 +206,8 @@ data%State%MudSystem%Mp2Density= 0.0 !(VALVE83) data%State%MudSystem%Mp3Density= 0.0 !(VALVE84) -data%State%MudSystem%ReserveTankVolume= MudProperties%ReserveMudVolumeGal ! initial volume (gal) -data%State%MudSystem%ReserveTankDensity= MudProperties%ReserveDensity ! initial +data%State%MudSystem%ReserveTankVolume= data%Configuration%Mud%ReserveMudVolumeGal ! initial volume (gal) +data%State%MudSystem%ReserveTankDensity= data%Configuration%Mud%ReserveDensity ! initial @@ -219,21 +219,21 @@ data%State%MudSystem%PumpsDumpFlowRate= 0.0 -data%State%MudSystem%ActiveTankVolume= MudProperties%ActiveMudVolumeGal ! initial volume (gal) +data%State%MudSystem%ActiveTankVolume= data%Configuration%Mud%ActiveMudVolumeGal ! initial volume (gal) data%State%MudSystem%RefrencePitVolume= data%State%MudSystem%ActiveTankVolume/42. !(bbl) data%State%MudSystem%RefrencePitVolume_DrillWatch= data%State%MudSystem%ActiveTankVolume/42. !(bbl) data%State%MudSystem%MVT_MinVol_Allowded= 0. data%State%MudSystem%MVT_MaxVol_Allowded= 0. -data%State%MudSystem%MudTank1_vol= MudProperties%ActiveMudVolumeGal/3. ! (gal) -data%State%MudSystem%MudTank2_vol= MudProperties%ActiveMudVolumeGal/3. ! (gal) -data%State%MudSystem%MudTank3_vol= MudProperties%ActiveMudVolumeGal/3. ! (gal) -data%State%MudSystem%ActiveTankSettled= MudProperties%ActiveSettledContentsGal ! (gal) -data%State%MudSystem%MudTank4_vol= MudProperties%InitialTripTankMudVolumeGal ! (gal) +data%State%MudSystem%MudTank1_vol= data%Configuration%Mud%ActiveMudVolumeGal/3. ! (gal) +data%State%MudSystem%MudTank2_vol= data%Configuration%Mud%ActiveMudVolumeGal/3. ! (gal) +data%State%MudSystem%MudTank3_vol= data%Configuration%Mud%ActiveMudVolumeGal/3. ! (gal) +data%State%MudSystem%ActiveTankSettled= data%Configuration%Mud%ActiveSettledContentsGal ! (gal) +data%State%MudSystem%MudTank4_vol= data%Configuration%Mud%InitialTripTankMudVolumeGal ! (gal) -data%State%MudSystem%TripTankVolumeCalc= MudProperties%InitialTripTankMudVolumeGal ! initial volume (gal) -data%State%MudSystem%ActiveTankDensity= MudProperties%ActiveDensity ! initial(ppg) +data%State%MudSystem%TripTankVolumeCalc= data%Configuration%Mud%InitialTripTankMudVolumeGal ! initial volume (gal) +data%State%MudSystem%ActiveTankDensity= data%Configuration%Mud%ActiveDensity ! initial(ppg) data%State%MudSystem%TripTankDensityCalc= data%EquipmentControl%Tank%TripTankDensity ! initial(ppg) data%State%MudSystem%ChokeManifoldDumpVolume= 0.0 @@ -246,7 +246,7 @@ data%State%MudSystem%FirstSet_Time= .true. -data%State%MudSystem%PedalMeter= MudProperties%PedalFlowMeter !1600. !(gpm) +data%State%MudSystem%PedalMeter= data%Configuration%Mud%PedalFlowMeter !1600. !(gpm) data%State%MudSystem%ReturnFlowRate=0. diff --git a/FluidFlow/Flow_Startup.f90 b/FluidFlow/Flow_Startup.f90 index 434951d..04039a3 100644 --- a/FluidFlow/Flow_Startup.f90 +++ b/FluidFlow/Flow_Startup.f90 @@ -32,7 +32,7 @@ use SimulationVariables !@, pi4 => pi KickVARIABLES%MaxChokeDensityChange = 25.0 ! [ppg/min] KickVARIABLES%ChokeMinDensity = 2.0 - KickVARIABLES%ChokeDensity = MudProperties%ActiveDensity + KickVARIABLES%ChokeDensity = data%Configuration%Mud%ActiveDensity KickVARIABLES%MinKickVol = 0.5 ! USGal @@ -71,7 +71,7 @@ use SimulationVariables !@, pi4 => pi SoundSpeed = 1530.0 / Convfttom data%State%PressureDisplay%PressureTimeStepDelay(1) = INT(2.0 * SUM(data%Configuration%StringConfiguration%StringConfigurations(2:)%ComponentLength) / SoundSpeed / dt) - data%State%PressureDisplay%PressureTimeStepDelay(2) = INT(PathGeneration%Items(SIZE(PathGeneration%Items))%MeasuredDepth / SoundSpeed / dt) + data%State%PressureDisplay%PressureTimeStepDelay(2) = INT(data%Configuration%Path%Items(SIZE(data%Configuration%Path%Items))%MeasuredDepth / SoundSpeed / dt) data%State%PressureDisplay%PressureTimeStepDelay(3) = INT(Shoe%ShoeDepth / SoundSpeed / dt) !WRITE (*,*) SUM(StringConfigurations(2:)%ComponentLength), PathGenerations(SIZE(PathGenerations))%TotalVerticalDepth!, WellSurveyData(SIZE(WellSurveyData))%TotalVerticalDepth @@ -83,11 +83,11 @@ use SimulationVariables !@, pi4 => pi END DO DO i = 1 , data%State%PressureDisplay%PressureTimeStepDelay(2) - CALL BottomHolePressureDelay%AddToFirst(REAL(0.052 * MudProperties%ActiveDensity * PathGeneration%Items(SIZE(PathGeneration%Items))%TotalVerticalDepth)) + CALL BottomHolePressureDelay%AddToFirst(REAL(0.052 * data%Configuration%Mud%ActiveDensity * data%Configuration%Path%Items(SIZE(data%Configuration%Path%Items))%TotalVerticalDepth)) END DO DO i = 1 , data%State%PressureDisplay%PressureTimeStepDelay(3) - CALL ShoePressureDelay%AddToFirst(REAL(0.052 * MudProperties%ActiveDensity * Shoe%ShoeDepth)) + CALL ShoePressureDelay%AddToFirst(REAL(0.052 * data%Configuration%Mud%ActiveDensity * Shoe%ShoeDepth)) END DO @@ -113,8 +113,8 @@ use SimulationVariables !@, pi4 => pi data%State%GasType(3)%GasConstant = RUniversal / data%State%GasType(2)%MolarWt !!!!!!!! Mud density and viscosity - Theta600Refrence = MudProperties%ActiveThetaSixHundred - Theta300Refrence = MudProperties%ActiveThetaThreeHundred - DensityRefrence = MudProperties%ActiveDensity + Theta600Refrence = data%Configuration%Mud%ActiveThetaSixHundred + Theta300Refrence = data%Configuration%Mud%ActiveThetaThreeHundred + DensityRefrence = data%Configuration%Mud%ActiveDensity END SUBROUTINE \ No newline at end of file diff --git a/FluidFlow/Frictional_Press_Drop_Calc.f90 b/FluidFlow/Frictional_Press_Drop_Calc.f90 index c1659e8..22163c6 100644 --- a/FluidFlow/Frictional_Press_Drop_Calc.f90 +++ b/FluidFlow/Frictional_Press_Drop_Calc.f90 @@ -11,7 +11,7 @@ SUBROUTINE FricPressDrop(iloc) USE FricPressDropVarsModule - USE CMudPropertiesVariables + USE SimulationVariables USE Fluid_Flow_Startup_Vars USE CError @@ -45,9 +45,9 @@ SUBROUTINE FricPressDrop(iloc) FlowEl(iloc)%YieldP = 2.0 * FlowEl(iloc)%Theta300 - FlowEl(iloc)%Theta600 ! lbf/100ft**2 FlowEl(iloc)%nIndex = 3.32 * log10(FlowEl(iloc)%Theta600 / FlowEl(iloc)%Theta300) FlowEl(iloc)%kIndex = 510.0 * FlowEl(iloc)%Theta300 / (511.0**FlowEl(iloc)%nIndex) ! rabete fv2 - IF (MudProperties%ActiveRheologyModel == Herschel_Bulkley_RheologyModel .AND. FlowEl(iloc)%alpha == 0) THEN + IF (data%Configuration%Mud%ActiveRheologyModel == Herschel_Bulkley_RheologyModel .AND. FlowEl(iloc)%alpha == 0) THEN FlowEl(iloc)%kIndex = 1.066 * FlowEl(iloc)%Theta300 / (511.0**FlowEl(iloc)%nIndex) - ELSE IF (MudProperties%ActiveRheologyModel == Herschel_Bulkley_RheologyModel .AND. FlowEl(iloc)%alpha == 1) THEN + ELSE IF (data%Configuration%Mud%ActiveRheologyModel == Herschel_Bulkley_RheologyModel .AND. FlowEl(iloc)%alpha == 1) THEN FlowEl(iloc)%nIndex = 3.32 * log10((FlowEl(iloc)%Theta600 - TauZero) / (FlowEl(iloc)%Theta300 - TauZero)) FlowEl(iloc)%kIndex = 1.066 * (FlowEl(iloc)%Theta300 - TauZero) / (511.0**FlowEl(iloc)%nIndex) END IF @@ -75,10 +75,10 @@ SUBROUTINE FricPressDrop(iloc) !END IF ! Calculating effective or apparent viscosity - IF (MudProperties%ActiveRheologyModel == Bingham_RheologyModel) THEN ! Bingham Plastic + IF (data%Configuration%Mud%ActiveRheologyModel == Bingham_RheologyModel) THEN ! Bingham Plastic FlowEl(iloc)%mueff = FlowEl(iloc)%muPlastic + 5. * FlowEl(iloc)%YieldP * FlowEl(iloc)%Dhyd / FlowEl(iloc)%vel !write(*,*) 'pointer1' , FlowEl(iloc)%muPlastic , FlowEl(iloc)%YieldP , FlowEl(iloc)%Dhyd , FlowEl(iloc)%vel - ELSE IF (MudProperties%ActiveRheologyModel == PowerLaw_RheologyModel .OR. MudProperties%ActiveRheologyModel == Herschel_Bulkley_RheologyModel) THEN ! Power Law + ELSE IF (data%Configuration%Mud%ActiveRheologyModel == PowerLaw_RheologyModel .OR. data%Configuration%Mud%ActiveRheologyModel == Herschel_Bulkley_RheologyModel) THEN ! Power Law FlowEl(iloc)%Gf = ((3. - FlowEl(iloc)%alpha) * FlowEl(iloc)%nIndex + 1.0) / FlowEl(iloc)%nIndex / (4.0 - FlowEl(iloc)%alpha) * (2.0 + FlowEl(iloc)%alpha) / 2.0 FlowEl(iloc)%mueff = (FlowEl(iloc)%kIndex) / (1. + FlowEl(iloc)%alpha / 2.) * ((96. * FlowEl(iloc)%vel / FlowEl(iloc)%Dhyd)**(FlowEl(iloc)%nIndex - 1)) * FlowEl(iloc)%Gf**FlowEl(iloc)%nIndex !write(*,*) 'pointer2' , FlowEl(iloc)%kIndex ,FlowEl(iloc)%alpha , FlowEl(iloc)%vel ,FlowEl(iloc)%Dhyd,FlowEl(iloc)%nIndex ,FlowEl(iloc)%Gf ,FlowEl(iloc)%nIndex @@ -99,7 +99,7 @@ SUBROUTINE FricPressDrop(iloc) !FlowEl(iloc)%GenRe = 2997 * FlowEl(iloc)%density * FlowEl(iloc)%vel**2 / 19.36 / FlowEl(iloc)%tauW ! Calculating friction factor - IF (MudProperties%ActiveRheologyModel == Bingham_RheologyModel) THEN ! Bingham Plastic + IF (data%Configuration%Mud%ActiveRheologyModel == Bingham_RheologyModel) THEN ! Bingham Plastic IF (FlowEl(iloc)%GenRe <= 2000.0) THEN ! laminar regime FlowEl(iloc)%f = 16.0 / FlowEl(iloc)%GenRe ELSE IF (FlowEl(iloc)%GenRe >= 4000.0) THEN ! turbulent regime @@ -113,7 +113,7 @@ SUBROUTINE FricPressDrop(iloc) + (FlowEl(iloc)%GenRe - 2000.0) / 2000.0 * FlowEl(iloc)%a / FlowEl(iloc)%GenRe**FlowEl(iloc)%b END IF - ELSE IF (MudProperties%ActiveRheologyModel == PowerLaw_RheologyModel) THEN ! Power law + ELSE IF (data%Configuration%Mud%ActiveRheologyModel == PowerLaw_RheologyModel) THEN ! Power law FlowEl(iloc)%ReCritLam = 3470. - 1370. * FlowEl(iloc)%nIndex FlowEl(iloc)%ReCritTurb = 4270. - 1370. * FlowEl(iloc)%nIndex @@ -167,7 +167,7 @@ END SUBROUTINE FricPressDrop SUBROUTINE PartialDerivativeFricToFlowRate(iloc) USE FricPressDropVarsModule - USE CMudPropertiesVariables + USE SimulationVariables USE Fluid_Flow_Startup_Vars use KickVARIABLESModule USE CError @@ -186,7 +186,7 @@ SUBROUTINE PartialDerivativeFricToFlowRate(iloc) .AND. (ABS(FlowEl(iloc)%Length) >= PressLengthTolerance) & .AND. (FlowEl(iloc)%MaterialType /= 4)) THEN ! not air - IF (MudProperties%ActiveRheologyModel == PowerLaw_RheologyModel) THEN ! Power law + IF (data%Configuration%Mud%ActiveRheologyModel == PowerLaw_RheologyModel) THEN ! Power law !IF (FlowEl(iloc)%Flowrate == 0.0) THEN ! FlowEl(iloc)%Flowrate = 10.0 ! CALL FricPressDrop(iloc) @@ -204,7 +204,7 @@ SUBROUTINE PartialDerivativeFricToFlowRate(iloc) * ((FlowEl(iloc)%a * FlowEl(iloc)%GenRe**(1. - FlowEl(iloc)%b) - 16.) / 800. / FlowEl(iloc)%f - 1.)) END IF - ELSE IF (MudProperties%ActiveRheologyModel == Bingham_RheologyModel) THEN ! Bingham Plastic + ELSE IF (data%Configuration%Mud%ActiveRheologyModel == Bingham_RheologyModel) THEN ! Bingham Plastic IF (FlowEl(iloc)%GenRe <= 2000.0 .OR. FlowEl(iloc)%f == 0.0) THEN ! laminar flow if f = 0.0, we have no flow in first time flowing FlowEl(iloc)%FricToQPartialDiff = (16. * FlowEl(iloc)%muPlastic * REAL(FlowEl(iloc)%Length) * 2.224 * (10.)**(-3)) & / (25.81 * 928. * (1 - 0.184 * FlowEl(iloc)%alpha) * FlowEl(iloc)%Dhyd**2 * FlowEl(iloc)%Area) diff --git a/Rop/ROP_MainCalculation.f90 b/Rop/ROP_MainCalculation.f90 index ad44aed..f826d3b 100644 --- a/Rop/ROP_MainCalculation.f90 +++ b/Rop/ROP_MainCalculation.f90 @@ -168,7 +168,7 @@ use SimulationVariables !@@@ data%State%ROP_Bit%RateOfPenetration = (data%State%ROP_Spec%f1*data%State%ROP_Spec%f2*data%State%ROP_Spec%f3*data%State%ROP_Spec%f4*data%State%ROP_Spec%f5*data%State%ROP_Spec%f6*data%State%ROP_Spec%f7*data%State%ROP_Spec%f8) ![ft/h] data%State%ROP_Bit%RateOfPenetration = (DINT(data%State%ROP_Bit%RateOfPenetration*10.d0))/10.d0 - if ( (data%State%TD_WellGeneral%WellTotalLength==PathGeneration%Items(PathGeneration%ItemCount)%MeasuredDepth) ) then + if ( (data%State%TD_WellGeneral%WellTotalLength==data%Configuration%Path%Items(data%Configuration%Path%ItemCount)%MeasuredDepth) ) then data%State%ROP_Bit%SetROPGauge = data%State%ROP_Bit%RateOfPenetration Call Set_ROP(data%State%ROP_Bit%SetROPGauge) ![ft/h] data%State%ROP_Bit%OldROPValue(4) = data%State%ROP_Bit%RateOfPenetration diff --git a/Simulation/SimulationVariables.f90 b/Simulation/SimulationVariables.f90 index 40ba265..ff935c4 100644 --- a/Simulation/SimulationVariables.f90 +++ b/Simulation/SimulationVariables.f90 @@ -81,9 +81,9 @@ module SimulationVariables Type(PumpSpecificationType)::Pumps Type(RigSizeType)::RigSize Type(CasingLinerChokeType)::CasingLinerChoke - Type(PathGenerationType)::PathGeneration - Type(WellSurveyDataType)::WellSurveyData - Type(MudPropertiesType)::MudProperties + Type(PathGenerationType)::Path + ! Type(WellSurveyDataType)::WellSurveyData + Type(MudPropertiesType)::Mud end type ConfigurationType type EquipmentControlType diff --git a/SimulationCore2.vfproj b/SimulationCore2.vfproj index 3aac158..2aa0c5d 100644 --- a/SimulationCore2.vfproj +++ b/SimulationCore2.vfproj @@ -85,7 +85,8 @@ - + + diff --git a/Text1.txt b/Text1.txt index 2f308b2..84da2e1 100644 --- a/Text1.txt +++ b/Text1.txt @@ -1,15 +1,7 @@ - real(8) :: CasingDepth - real(8) :: CasingId - real(8) :: CasingOd - real(8) :: CasingWeight - real(8) :: CasingCollapsePressure - real(8) :: CasingTensileStrength - real(8) :: LinerTopDepth - real(8) :: LinerLength - real(8) :: LinerId - real(8) :: LinerOd - real(8) :: LinerWeight - real(8) :: LinerCollapsePressure - real(8) :: LinerTensileStrength - real(8) :: OpenHoleId - real(8) :: OpenHoleLength \ No newline at end of file + integer :: HoleType + real(8) :: Angle + real(8) :: Length + real(8) :: FinalAngle + real(8) :: TotalLength + real(8) :: MeasuredDepth + real(8) :: TotalVerticalDepth \ No newline at end of file diff --git a/TorqueDrag/TD_ReadDataSubroutines/TD_WellReadData.f90 b/TorqueDrag/TD_ReadDataSubroutines/TD_WellReadData.f90 index 40d457f..79eb7b2 100644 --- a/TorqueDrag/TD_ReadDataSubroutines/TD_WellReadData.f90 +++ b/TorqueDrag/TD_ReadDataSubroutines/TD_WellReadData.f90 @@ -9,7 +9,7 @@ subroutine TD_WellReadData - data%State%TD_WellGeneral%WellIntervalsCount = PathGeneration%ItemCount + 1 ! +1 is belong to ROP hole + data%State%TD_WellGeneral%WellIntervalsCount = data%Configuration%Path%ItemCount + 1 ! +1 is belong to ROP hole if (Allocated(data%State%TD_WellGeo)) deAllocate (data%State%TD_WellGeo) Allocate (data%State%TD_WellGeo(data%State%TD_WellGeneral%WellIntervalsCount)) @@ -21,25 +21,25 @@ subroutine TD_WellReadData ! Set Well Geometry Data !==================================================== - data%State%TD_WellGeo(1)%HoleType = PathGeneration%Items(1)%HoleType + data%State%TD_WellGeo(1)%HoleType = data%Configuration%Path%Items(1)%HoleType data%State%TD_WellGeo(1)%StartAngle = 0.d0 ![rad] - data%State%TD_WellGeo(1)%EndAngle = PathGeneration%Items(1)%FinalAngle*(pi/180.d0) ![rad] - data%State%TD_WellGeo(1)%IntervalLength= PathGeneration%Items(1)%TotalLength ![ft] + data%State%TD_WellGeo(1)%EndAngle = data%Configuration%Path%Items(1)%FinalAngle*(pi/180.d0) ![rad] + data%State%TD_WellGeo(1)%IntervalLength= data%Configuration%Path%Items(1)%TotalLength ![ft] !data%State%TD_WellGeo(1)%VerticalDepth = PathGenerations(1)%TotalVerticalDepth data%State%TD_WellGeo(1)%TopDepth = 0.d0 - data%State%TD_WellGeo(1)%DownDepth = PathGeneration%Items(1)%MeasuredDepth + data%State%TD_WellGeo(1)%DownDepth = data%Configuration%Path%Items(1)%MeasuredDepth Do i=2,data%State%TD_WellGeneral%WellIntervalsCount-1 - data%State%TD_WellGeo(i)%HoleType = PathGeneration%Items(i)%HoleType - data%State%TD_WellGeo(i)%StartAngle = PathGeneration%Items(i-1)%FinalAngle*(pi/180.d0) - data%State%TD_WellGeo(i)%EndAngle = PathGeneration%Items(i)%FinalAngle*(pi/180.d0) - data%State%TD_WellGeo(i)%IntervalLength= PathGeneration%Items(i)%TotalLength - !data%State%TD_WellGeo(i)%VerticalDepth = PathGeneration%Items(i)%TotalVerticalDepth - data%State%TD_WellGeo(i)%TopDepth = PathGeneration%Items(i-1)%MeasuredDepth - data%State%TD_WellGeo(i)%DownDepth = PathGeneration%Items(i)%MeasuredDepth + data%State%TD_WellGeo(i)%HoleType = data%Configuration%Path%Items(i)%HoleType + data%State%TD_WellGeo(i)%StartAngle = data%Configuration%Path%Items(i-1)%FinalAngle*(pi/180.d0) + data%State%TD_WellGeo(i)%EndAngle = data%Configuration%Path%Items(i)%FinalAngle*(pi/180.d0) + data%State%TD_WellGeo(i)%IntervalLength= data%Configuration%Path%Items(i)%TotalLength + !data%State%TD_WellGeo(i)%VerticalDepth = data%Configuration%Path%Items(i)%TotalVerticalDepth + data%State%TD_WellGeo(i)%TopDepth = data%Configuration%Path%Items(i-1)%MeasuredDepth + data%State%TD_WellGeo(i)%DownDepth = data%Configuration%Path%Items(i)%MeasuredDepth !=====> Radius Of Curvature Calculation if (data%State%TD_WellGeo(i)%HoleType/=0) then diff --git a/TorqueDrag/TD_StartUp/TD_StartUp.f90 b/TorqueDrag/TD_StartUp/TD_StartUp.f90 index ea37d85..4896c15 100644 --- a/TorqueDrag/TD_StartUp/TD_StartUp.f90 +++ b/TorqueDrag/TD_StartUp/TD_StartUp.f90 @@ -26,7 +26,7 @@ subroutine TD_StartUp !! Allocate Modules !!==================================================== ! !=====> Set WellGeo Dimension -! data%State%TD_WellGeneral%WellIntervalsCount = PathGeneration%ItemCount + 1 ! +1 is belong to ROP hole +! data%State%TD_WellGeneral%WellIntervalsCount = data%Configuration%Path%ItemCount + 1 ! +1 is belong to ROP hole ! Allocate (data%State%TD_WellGeo(data%State%TD_WellGeneral%WellIntervalsCount)) ! ! !=====> Set WellGeo Dimension @@ -37,7 +37,7 @@ subroutine TD_StartUp data%State%ROP_Bit%RateOfPenetration = 0.d0 data%State%ROP_Bit%BearingWear = 0.d0 data%State%ROP_Spec%FormationNumber = 0 - data%State%ROP_Bit%OldROPDepth = PathGeneration%Items(PathGeneration%ItemCount)%MeasuredDepth + data%State%ROP_Bit%OldROPDepth = data%Configuration%Path%Items(data%Configuration%Path%ItemCount)%MeasuredDepth data%State%ROP_Bit%OldROPValue = 0.d0 data%State%ROP_Bit%SetROPGauge = 0.d0 diff --git a/helper.ipynb b/helper.ipynb index d609967..c806e29 100644 --- a/helper.ipynb +++ b/helper.ipynb @@ -2,58 +2,81 @@ "cells": [ { "cell_type": "code", - "execution_count": 19, + "execution_count": 5, "metadata": {}, "outputs": [ { - "data": { - "text/plain": [ - "[' integer :: RigType\\n',\n", - " ' real(8) :: CrownHeight\\n',\n", - " ' real(8) :: MonkeyBoandHeight\\n',\n", - " ' real(8) :: RigFloorHeight\\n']" - ] - }, - "execution_count": 19, - "metadata": {}, - "output_type": "execute_result" + "name": "stdout", + "output_type": "stream", + "text": [ + "{\"BitType\":0,\n", + "\"BitSize\":0,\n", + "\"BitCodeHundreds\":0,\n", + "\"BitCodeTens\":0,\n", + "\"BitCodeOnes\":0,\n", + "\"BitNozzleSize\":0,\n", + "\"BitLength\":0,\n", + "\"BitWeightPerLength\":0,\n", + "\"BitNozzleNo\":0,\n", + "\"FloatValve\":0,\n", + "\n" + ] } ], "source": [ - "lines" + "input = open(\"Text1.txt\")\n", + "output = \"{\"\n", + "lines = input.readlines()\n", + "for line in lines:\n", + " name = line.split(\"::\")[-1].strip()\n", + " type = line.split(\"::\")[0].strip()\n", + " output += f\"\\\"{name}\\\":0,\\n\" \n", + " # name = line.split(\"%\")[-1][:-1]\n", + " # print(name)\n", + "print(output+\"}\")\n" ] }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "call json%add(p,\"CasingDepth\",data%Configuration%CasingLinerChoke%CasingDepth)\n", - "call json%add(p,\"CasingId\",data%Configuration%CasingLinerChoke%CasingId)\n", - "call json%add(p,\"CasingOd\",data%Configuration%CasingLinerChoke%CasingOd)\n", - "call json%add(p,\"CasingWeight\",data%Configuration%CasingLinerChoke%CasingWeight)\n", - "call json%add(p,\"CasingCollapsePressure\",data%Configuration%CasingLinerChoke%CasingCollapsePressure)\n", - "call json%add(p,\"CasingTensileStrength\",data%Configuration%CasingLinerChoke%CasingTensileStrength)\n", - "call json%add(p,\"\",data%Configuration%CasingLinerChoke%)\n", - "call json%add(p,\"LinerTopDepth\",data%Configuration%CasingLinerChoke%LinerTopDepth)\n", - "call json%add(p,\"LinerLength\",data%Configuration%CasingLinerChoke%LinerLength)\n", - "call json%add(p,\"LinerId\",data%Configuration%CasingLinerChoke%LinerId)\n", - "call json%add(p,\"LinerOd\",data%Configuration%CasingLinerChoke%LinerOd)\n", - "call json%add(p,\"LinerWeight\",data%Configuration%CasingLinerChoke%LinerWeight)\n", - "call json%add(p,\"LinerCollapsePressure\",data%Configuration%CasingLinerChoke%LinerCollapsePressure)\n", - "call json%add(p,\"LinerTensileStrength\",data%Configuration%CasingLinerChoke%LinerTensileStrength)\n", - "call json%add(p,\"\",data%Configuration%CasingLinerChoke%)\n", - "call json%add(p,\"OpenHoleId\",data%Configuration%CasingLinerChoke%OpenHoleId)\n", - "call json%add(p,\"OpenHoleLength\",data%Configuration%CasingLinerChoke%OpenHoleLength)\n" + "call json%add(p,\"ActiveMudType\",data%Configuration%Mud%ActiveMudType)\n", + "call json%add(p,\"ActiveRheologyModel\",data%Configuration%Mud%ActiveRheologyModel)\n", + "call json%add(p,\"ActiveMudVolume\",data%Configuration%Mud%ActiveMudVolume)\n", + "call json%add(p,\"ActiveMudVolumeGal\",data%Configuration%Mud%ActiveMudVolumeGal)\n", + "call json%add(p,\"ActiveDensity\",data%Configuration%Mud%ActiveDensity)\n", + "call json%add(p,\"ActivePlasticViscosity\",data%Configuration%Mud%ActivePlasticViscosity)\n", + "call json%add(p,\"ActiveYieldPoint\",data%Configuration%Mud%ActiveYieldPoint)\n", + "call json%add(p,\"ActiveThetaThreeHundred\",data%Configuration%Mud%ActiveThetaThreeHundred)\n", + "call json%add(p,\"ActiveThetaSixHundred\",data%Configuration%Mud%ActiveThetaSixHundred)\n", + "call json%add(p,\"ReserveMudType\",data%Configuration%Mud%ReserveMudType)\n", + "call json%add(p,\"ReserveMudVolume\",data%Configuration%Mud%ReserveMudVolume)\n", + "call json%add(p,\"ReserveMudVolumeGal\",data%Configuration%Mud%ReserveMudVolumeGal)\n", + "call json%add(p,\"ReserveDensity\",data%Configuration%Mud%ReserveDensity)\n", + "call json%add(p,\"ReservePlasticViscosity\",data%Configuration%Mud%ReservePlasticViscosity)\n", + "call json%add(p,\"ReserveYieldPoint\",data%Configuration%Mud%ReserveYieldPoint)\n", + "call json%add(p,\"ReserveThetaThreeHundred\",data%Configuration%Mud%ReserveThetaThreeHundred)\n", + "call json%add(p,\"ReserveThetaSixHundred\",data%Configuration%Mud%ReserveThetaSixHundred)\n", + "call json%add(p,\"ActiveTotalTankCapacity\",data%Configuration%Mud%ActiveTotalTankCapacity)\n", + "call json%add(p,\"ActiveTotalTankCapacityGal\",data%Configuration%Mud%ActiveTotalTankCapacityGal)\n", + "call json%add(p,\"ActiveSettledContents\",data%Configuration%Mud%ActiveSettledContents)\n", + "call json%add(p,\"ActiveSettledContentsGal\",data%Configuration%Mud%ActiveSettledContentsGal)\n", + "call json%add(p,\"ActiveTotalContents\",data%Configuration%Mud%ActiveTotalContents)\n", + "call json%add(p,\"ActiveTotalContentsGal\",data%Configuration%Mud%ActiveTotalContentsGal)\n", + "call json%add(p,\"ActiveAutoDensity\",data%Configuration%Mud%ActiveAutoDensity)\n", + "call json%add(p,\"InitialTripTankMudVolume\",data%Configuration%Mud%InitialTripTankMudVolume)\n", + "call json%add(p,\"InitialTripTankMudVolumeGal\",data%Configuration%Mud%InitialTripTankMudVolumeGal)\n", + "call json%add(p,\"PedalFlowMeter\",data%Configuration%Mud%PedalFlowMeter)\n" ] } ], "source": [ - "precode = \"\"\"call json%add(p,\"\",data%Configuration%CasingLinerChoke%\"\"\"\n", + "precode = \"\"\"call json%add(p,\"\",data%Configuration%Mud%\"\"\"\n", "input = open(\"Text1.txt\")\n", "lines = input.readlines()\n", "for line in lines:\n", diff --git a/test.json b/test.json index 98b905c..b76e4f4 100644 --- a/test.json +++ b/test.json @@ -1,7 +1,31 @@ { "Configuration": { "StringConfiguration": { - "StringConfigurationItems": [], + "StringConfigurationItems": [ + {"BitType":0, + "BitSize":0, + "BitCodeHundreds":0, + "BitCodeTens":0, + "BitCodeOnes":0, + "BitNozzleSize":0, + "BitLength":0, + "BitWeightPerLength":0, + "BitNozzleNo":0, + "FloatValve":0 + } + , + {"BitType":0, + "BitSize":0, + "BitCodeHundreds":0, + "BitCodeTens":0, + "BitCodeOnes":0, + "BitNozzleSize":0, + "BitLength":0, + "BitWeightPerLength":0, + "BitNozzleNo":0, + "FloatValve":0 + } + ], "BitDefenition": { "BitCodeHundreds": 0, "BitCodeOnes": 0, @@ -15,7 +39,22 @@ "FloatValve": false } }, - "Fromations": [], + "Fromations": [ + {"Top":0, + "Thickness":0, + "Drillablity":0, + "Abrasiveness":0, + "ThresholdWeight":0, + "PorePressureGradient":0 + }, + {"Top":0, + "Thickness":0, + "Drillablity":0, + "Abrasiveness":0, + "ThresholdWeight":0, + "PorePressureGradient":0 + } + ], "Reservoir": { "AutoMigrationRate": 0.0E+0, "FluidGradient": 0.0E+0, @@ -152,6 +191,33 @@ "OpenHoleId": 0.0E+0, "OpenHoleLength": 0.0E+0 }, - "Path": {} + "Path": { + "Items": [ + {"HoleType":0, + "Angle":0, + "Length":0, + "FinalAngle":0, + "TotalLength":0, + "MeasuredDepth":0, + "TotalVerticalDepth":0 + }, + {"HoleType":0, + "Angle":0, + "Length":0, + "FinalAngle":0, + "TotalLength":0, + "MeasuredDepth":0, + "TotalVerticalDepth":0 + } + ], + "DataPoints": [ + {"X":0, + "Y":0 + }, + {"X":0, + "Y":0 + } + ] + } } }