mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4526 Make sure setting wells for flow diagnostics result works and add simplified API
This commit is contained in:
parent
2940713a42
commit
213591f522
@ -170,13 +170,15 @@ if (PYTHON_EXECUTABLE)
|
|||||||
"rips/View.py"
|
"rips/View.py"
|
||||||
"rips/examples/InstanceExample.py"
|
"rips/examples/InstanceExample.py"
|
||||||
"rips/examples/CommandExample.py"
|
"rips/examples/CommandExample.py"
|
||||||
"rips/examples/CaseGridGroup.py"
|
"rips/examples/CaseGridGroup.py"
|
||||||
"rips/examples/CaseInfoStreamingExample.py"
|
"rips/examples/CaseInfoStreamingExample.py"
|
||||||
"rips/examples/SoilPorvAsync.py"
|
"rips/examples/SoilPorvAsync.py"
|
||||||
"rips/examples/SoilPorvSync.py"
|
"rips/examples/SoilPorvSync.py"
|
||||||
"rips/examples/SelectedCases.py"
|
"rips/examples/SelectedCases.py"
|
||||||
"rips/examples/AllCases.py"
|
"rips/examples/AllCases.py"
|
||||||
"rips/examples/SetGridProperties.py"
|
"rips/examples/SetGridProperties.py"
|
||||||
|
"rips/examples/SetCellResult.py"
|
||||||
|
"rips/examples/SetFlowDiagnosticsResult.py"
|
||||||
"rips/examples/GridInformation.py"
|
"rips/examples/GridInformation.py"
|
||||||
"rips/examples/InputPropTestSync.py"
|
"rips/examples/InputPropTestSync.py"
|
||||||
"rips/examples/InputPropTestAsync.py"
|
"rips/examples/InputPropTestAsync.py"
|
||||||
|
@ -59,7 +59,7 @@ class PdmObject:
|
|||||||
elif isinstance(value, list):
|
elif isinstance(value, list):
|
||||||
listofstrings = []
|
listofstrings = []
|
||||||
for val in value:
|
for val in value:
|
||||||
listofstrings.append(self.__fromValue(val))
|
listofstrings.append(self.__fromValue('\"' + val + '\"'))
|
||||||
return "[" + ", ".join(listofstrings) + "]"
|
return "[" + ", ".join(listofstrings) + "]"
|
||||||
else:
|
else:
|
||||||
return str(value)
|
return str(value)
|
||||||
|
@ -30,4 +30,48 @@ class View (PdmObject):
|
|||||||
|
|
||||||
def cellResult(self):
|
def cellResult(self):
|
||||||
"""Retrieve the current cell results"""
|
"""Retrieve the current cell results"""
|
||||||
return self.children("GridCellResult")[0]
|
return self.children("GridCellResult")[0]
|
||||||
|
|
||||||
|
def applyCellResult(self, resultType, resultVariable):
|
||||||
|
"""Apply a regular cell result
|
||||||
|
Arguments:
|
||||||
|
resultType [str]: String representing the result category
|
||||||
|
The valid values are: "DYNAMIC_NATIVE", "STATIC_NATIVE", "SOURSIMRL",
|
||||||
|
"GENERATED", "INPUT_PROPERTY", "FORMATION_NAMES",
|
||||||
|
"FLOW_DIAGNOSTICS" and "INJECTION_FLOODING"
|
||||||
|
resultVariable [str]: String representing the result value.
|
||||||
|
"""
|
||||||
|
cellResult = self.cellResult()
|
||||||
|
cellResult.setValue("ResultType", resultType)
|
||||||
|
cellResult.setValue("ResultVariable", resultVariable)
|
||||||
|
cellResult.update()
|
||||||
|
|
||||||
|
def applyFlowDiagnosticsCellResult(self,
|
||||||
|
resultVariable = 'TOF',
|
||||||
|
selectionMode = 'FLOW_TR_BY_SELECTION',
|
||||||
|
injectors = [],
|
||||||
|
producers = []):
|
||||||
|
"""Apply a flow diagnostics cell result
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
resultVariable [str]: String representing the result value
|
||||||
|
The valid values are 'TOF', 'Fraction', 'MaxFractionTracer' and 'Communication'.
|
||||||
|
selectionMode [str]: String specifying which tracers to select.
|
||||||
|
The valid values are FLOW_TR_INJ_AND_PROD (all injector and producer tracers)
|
||||||
|
FLOW_TR_PRODUCERS (all producers)
|
||||||
|
FLOW_TR_INJECTORS (all injectors)
|
||||||
|
FLOW_TR_BY_SELECTION (specify individual tracers in the
|
||||||
|
injectorTracers and producerTracers variables)
|
||||||
|
injectorTracers [list]: List of injector names (strings) to select.
|
||||||
|
Requires selectionMode to be 'FLOW_TR_BY_SELECTION'.
|
||||||
|
producerTracers [list]: List of producer tracers (strings) to select.
|
||||||
|
Requires selectionMode to be 'FLOW_TR_BY_SELECTION'.
|
||||||
|
"""
|
||||||
|
cellResult = self.cellResult()
|
||||||
|
cellResult.setValue("ResultType", "FLOW_DIAGNOSTICS")
|
||||||
|
cellResult.setValue("ResultVariable", resultVariable)
|
||||||
|
cellResult.setValue("FlowTracerSelectionMode", selectionMode)
|
||||||
|
if selectionMode == 'FLOW_TR_BY_SELECTION':
|
||||||
|
cellResult.setValue("SelectedInjectorTracers", injectors)
|
||||||
|
cellResult.setValue("SelectedProducerTracers", producers)
|
||||||
|
cellResult.update()
|
@ -3,12 +3,4 @@ import rips
|
|||||||
resInsight = rips.Instance.find()
|
resInsight = rips.Instance.find()
|
||||||
|
|
||||||
view = resInsight.project.view(0)
|
view = resInsight.project.view(0)
|
||||||
|
view.applyCellResult(resultType='STATIC_NATIVE', resultVariable='DX')
|
||||||
cellResult = view.cellResult()
|
|
||||||
|
|
||||||
cellResult.printObjectInfo()
|
|
||||||
|
|
||||||
cellResult.setValue("ResultType", "FLOW_DIAGNOSTICS")
|
|
||||||
cellResult.setValue("ResultVariable", "TOF")
|
|
||||||
|
|
||||||
cellResult.update()
|
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
# Load ResInsight Processing Server Client Library
|
||||||
|
import rips
|
||||||
|
# Connect to ResInsight instance
|
||||||
|
resInsight = rips.Instance.find()
|
||||||
|
|
||||||
|
view = resInsight.project.view(0)
|
||||||
|
view.applyFlowDiagnosticsCellResult(resultVariable='Fraction',
|
||||||
|
selectionMode='FLOW_TR_INJ_AND_PROD')
|
||||||
|
|
||||||
|
# Example of setting individual wells. Commented out because well names are case specific.
|
||||||
|
#view.applyFlowDiagnosticsCellResult(resultVariable='Fraction',
|
||||||
|
# selectionMode='FLOW_TR_BY_SELECTION',
|
||||||
|
# injectors = ['C-1H', 'C-2H', 'F-2H'],
|
||||||
|
# producers = ['B-1AH', 'B-3H', 'D-1H'])
|
@ -1210,8 +1210,12 @@ void RimEclipseResultDefinition::setSelectedSouringTracers(const std::vector<QSt
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimEclipseResultDefinition::updateUiFieldsFromActiveResult()
|
void RimEclipseResultDefinition::updateUiFieldsFromActiveResult()
|
||||||
{
|
{
|
||||||
m_resultTypeUiField = m_resultType;
|
m_resultTypeUiField = m_resultType;
|
||||||
m_resultVariableUiField = resultVariable();
|
m_resultVariableUiField = resultVariable();
|
||||||
|
m_selectedInjectorTracersUiField = m_selectedInjectorTracers;
|
||||||
|
m_selectedProducerTracersUiField = m_selectedProducerTracers;
|
||||||
|
m_selectedSouringTracersUiField = m_selectedSouringTracers;
|
||||||
|
m_porosityModelUiField = m_porosityModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user