mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4527 Export Flow Characteristics : Add support for Python execution
This commit is contained in:
parent
b8f0fcd7e9
commit
e54d42a0da
@ -238,6 +238,17 @@ message CreateGridCaseGroupRequest
|
|||||||
repeated string casePaths = 1;
|
repeated string casePaths = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message ExportFlowInfoRequest
|
||||||
|
{
|
||||||
|
int32 caseId = 1;
|
||||||
|
repeated int32 timeSteps = 2;
|
||||||
|
repeated string injectors = 3;
|
||||||
|
repeated string producers = 4;
|
||||||
|
string fileName = 5;
|
||||||
|
double minimumCommunication = 6;
|
||||||
|
double aquiferCellThreshold = 7;
|
||||||
|
}
|
||||||
|
|
||||||
/* CommandParams handles both command name and parameters in one.
|
/* CommandParams handles both command name and parameters in one.
|
||||||
* The message type and content is used as parameters and
|
* The message type and content is used as parameters and
|
||||||
* the name of the variable is used to find the command name. */
|
* the name of the variable is used to find the command name. */
|
||||||
@ -276,6 +287,7 @@ message CommandParams
|
|||||||
CreateSatPressPlotRequest createSaturationPressurePlots = 25;
|
CreateSatPressPlotRequest createSaturationPressurePlots = 25;
|
||||||
ReplaceCaseRequests replaceMultipleCases = 26;
|
ReplaceCaseRequests replaceMultipleCases = 26;
|
||||||
CreateGridCaseGroupRequest createGridCaseGroup = 27;
|
CreateGridCaseGroupRequest createGridCaseGroup = 27;
|
||||||
|
ExportFlowInfoRequest exportFlowCharacteristics = 28;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,3 +267,17 @@ class Commands:
|
|||||||
caseIds = [caseIds]
|
caseIds = [caseIds]
|
||||||
return self.__execute(createSaturationPressurePlots=Cmd.CreateSatPressPlotRequest(caseIds=caseIds))
|
return self.__execute(createSaturationPressurePlots=Cmd.CreateSatPressPlotRequest(caseIds=caseIds))
|
||||||
|
|
||||||
|
def exportFlowCharacteristics(self, caseId, timeSteps, injectors, producers, fileName, minimumCommunication=0.0, aquiferCellThreshold=0.1):
|
||||||
|
if isinstance(timeSteps, int):
|
||||||
|
timeSteps = [timeSteps]
|
||||||
|
if isinstance(injectors, str):
|
||||||
|
injectors = [injectors]
|
||||||
|
if isinstance(producers, str):
|
||||||
|
producers = [producers]
|
||||||
|
return self.__execute(exportFlowCharacteristics=Cmd.ExportFlowInfoRequest(caseId=caseId,
|
||||||
|
timeSteps=timeSteps,
|
||||||
|
injectors=injectors,
|
||||||
|
producers=producers,
|
||||||
|
fileName=fileName,
|
||||||
|
minimumCommunication = minimumCommunication,
|
||||||
|
aquiferCellThreshold = aquiferCellThreshold))
|
||||||
|
@ -41,4 +41,12 @@ def test_loadGridCaseGroup(rips_instance, initializeTest):
|
|||||||
casePaths.append(dataroot.PATH + "/Case_with_10_timesteps/Real0/BRUGGE_0000.EGRID")
|
casePaths.append(dataroot.PATH + "/Case_with_10_timesteps/Real0/BRUGGE_0000.EGRID")
|
||||||
casePaths.append(dataroot.PATH + "/Case_with_10_timesteps/Real10/BRUGGE_0010.EGRID")
|
casePaths.append(dataroot.PATH + "/Case_with_10_timesteps/Real10/BRUGGE_0010.EGRID")
|
||||||
groupId, groupName = rips_instance.commands.createGridCaseGroup(casePaths=casePaths)
|
groupId, groupName = rips_instance.commands.createGridCaseGroup(casePaths=casePaths)
|
||||||
print(groupId, groupName)
|
print(groupId, groupName)
|
||||||
|
|
||||||
|
def test_exportFlowCharacteristics(rips_instance, initializeTest):
|
||||||
|
casePath = dataroot.PATH + "/Case_with_10_timesteps/Real0/BRUGGE_0000.EGRID"
|
||||||
|
rips_instance.project.loadCase(casePath)
|
||||||
|
with tempfile.TemporaryDirectory(prefix="rips") as tmpdirname:
|
||||||
|
print("Temporary folder: ", tmpdirname)
|
||||||
|
fileName = tmpdirname + "/exportFlowChar.txt"
|
||||||
|
rips_instance.commands.exportFlowCharacteristics(caseId=0, timeSteps=8, producers=[], injectors = "I01", fileName = fileName)
|
Loading…
Reference in New Issue
Block a user