#4526 Make sure setting wells for flow diagnostics result works and add simplified API

This commit is contained in:
Gaute Lindkvist 2019-07-31 09:53:15 +02:00
parent 2940713a42
commit 213591f522
6 changed files with 70 additions and 14 deletions

View File

@ -170,13 +170,15 @@ if (PYTHON_EXECUTABLE)
"rips/View.py"
"rips/examples/InstanceExample.py"
"rips/examples/CommandExample.py"
"rips/examples/CaseGridGroup.py"
"rips/examples/CaseGridGroup.py"
"rips/examples/CaseInfoStreamingExample.py"
"rips/examples/SoilPorvAsync.py"
"rips/examples/SoilPorvSync.py"
"rips/examples/SelectedCases.py"
"rips/examples/AllCases.py"
"rips/examples/SetGridProperties.py"
"rips/examples/SetCellResult.py"
"rips/examples/SetFlowDiagnosticsResult.py"
"rips/examples/GridInformation.py"
"rips/examples/InputPropTestSync.py"
"rips/examples/InputPropTestAsync.py"

View File

@ -59,7 +59,7 @@ class PdmObject:
elif isinstance(value, list):
listofstrings = []
for val in value:
listofstrings.append(self.__fromValue(val))
listofstrings.append(self.__fromValue('\"' + val + '\"'))
return "[" + ", ".join(listofstrings) + "]"
else:
return str(value)

View File

@ -30,4 +30,48 @@ class View (PdmObject):
def cellResult(self):
"""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()

View File

@ -3,12 +3,4 @@ import rips
resInsight = rips.Instance.find()
view = resInsight.project.view(0)
cellResult = view.cellResult()
cellResult.printObjectInfo()
cellResult.setValue("ResultType", "FLOW_DIAGNOSTICS")
cellResult.setValue("ResultVariable", "TOF")
cellResult.update()
view.applyCellResult(resultType='STATIC_NATIVE', resultVariable='DX')

View File

@ -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'])

View File

@ -1210,8 +1210,12 @@ void RimEclipseResultDefinition::setSelectedSouringTracers(const std::vector<QSt
//--------------------------------------------------------------------------------------------------
void RimEclipseResultDefinition::updateUiFieldsFromActiveResult()
{
m_resultTypeUiField = m_resultType;
m_resultVariableUiField = resultVariable();
m_resultTypeUiField = m_resultType;
m_resultVariableUiField = resultVariable();
m_selectedInjectorTracersUiField = m_selectedInjectorTracers;
m_selectedProducerTracersUiField = m_selectedProducerTracers;
m_selectedSouringTracersUiField = m_selectedSouringTracers;
m_porosityModelUiField = m_porosityModel;
}
//--------------------------------------------------------------------------------------------------