Problem Definition
I am extensively using the feature replaceTxt
of ogs6py in order to adapt existing .prj
files.
Usually, the command replaceMediumProperty
is sufficient to replace constant medium parameters.
Well, for changing a linear dependent parameter definition one needs the command replaceText
. Unfortunately, replaceTxt
does not work for me being assigned to a certain medium with a specific medium id. At least I couldn’t make it until now…
Example
model_example=OGS(INPUT_FILE="example.prj", PROJECT_FILE="example.prj")
slope = 6.0463e-10
I want to change the value of slope
in example.prj
<media>
<medium id="0">
<phases>
<phase>
<type>Gas</type>
<properties>
<property>
<name>viscosity</name>
<type>Linear</type>
<independent_variable>
<variable_name>phase_pressure</variable_name>
<reference_condition>0</reference_condition>
<slope>6.046e-10</slope>
</independent_variable>
by using:
model_example.replaceTxt(slope,xpath="./media/medium[id='0']/phases/phase[type='Gas']/properties/property[name='viscosity']/independent_variable/slope")
model_example.writeInput()
Python executes but doesn’t change the Parameter in .prj file.
At the same time, the following command works but can not be assigned to a certain medium id:
model_example.replaceTxt(slope,xpath="./media/medium/phases/phase[type='Gas']/properties/property[name='viscosity']/independent_variable/slope")
@joergbuchwald , you might have any idea what I might have done wrong?
Thank you very for your help in advance and thanks for this all in all really great tool ogs6py.
Best regards
Linus