Skip to content
Snippets Groups Projects
Commit a3ff28e2 authored by Bernd Flemisch's avatar Bernd Flemisch Committed by Timo Koch
Browse files

[io][vtk] read switched primary variable names from input file

parent 9fa5b610
No related branches found
No related tags found
1 merge request!1039Feature/restart from vtk
...@@ -126,8 +126,20 @@ auto loadSolutionFromVtuFile(const std::string fileName, ...@@ -126,8 +126,20 @@ auto loadSolutionFromVtuFile(const std::string fileName,
template<class ModelTraits, class FluidSystem> template<class ModelTraits, class FluidSystem>
std::string primaryVariableName(int pvIdx, int state) std::string primaryVariableName(int pvIdx, int state)
{ {
if (haveParam("LoadSolution.PrimaryVariableNames")) using std::pow;
DUNE_THROW(Dune::NotImplemented, "reading PrimaryVariableNames from input file"); static auto numStates = pow(2, ModelTraits::numPhases()) - 1;
const auto paramNameWithState = "LoadSolution.PriVarNamesState" + std::to_string(state);
if (haveParam("LoadSolution.PriVarNames"))
{
DUNE_THROW(Dune::NotImplemented, "please provide LoadSolution.PriVarNamesState1..." << numStates
<< " or remove LoadSolution.PriVarNames to use default names");
}
else if (haveParam(paramNameWithState))
{
const auto pvNames = getParam<std::vector<std::string>>(paramNameWithState);
return pvNames[pvIdx];
}
else else
return ModelTraits::template primaryVariableName<FluidSystem>(pvIdx, state); return ModelTraits::template primaryVariableName<FluidSystem>(pvIdx, state);
} }
...@@ -139,9 +151,9 @@ std::string primaryVariableName(int pvIdx, int state) ...@@ -139,9 +151,9 @@ std::string primaryVariableName(int pvIdx, int state)
template<class ModelTraits> template<class ModelTraits>
std::string primaryVariableName(int pvIdx) std::string primaryVariableName(int pvIdx)
{ {
if (haveParam("LoadSolution.PrimaryVariableNames")) if (haveParam("LoadSolution.PriVarNames"))
{ {
static auto pvNames = getParam<std::vector<std::string>>("LoadSolution.PrimaryVariableNames"); static auto pvNames = getParam<std::vector<std::string>>("LoadSolution.PriVarNames");
return pvNames[pvIdx]; return pvNames[pvIdx];
} }
else else
......
...@@ -19,3 +19,8 @@ PressureLow = 1e5 # [Pa] lower pressure limit for tabularization ...@@ -19,3 +19,8 @@ PressureLow = 1e5 # [Pa] lower pressure limit for tabularization
PressureHigh = 3e7 # [Pa] upper pressure limit for tabularization PressureHigh = 3e7 # [Pa] upper pressure limit for tabularization
TemperatureLow = 312.15 # [Pa] lower temperature limit for tabularization TemperatureLow = 312.15 # [Pa] lower temperature limit for tabularization
TemperatureHigh = 314.15 # [Pa] upper temperature limit for tabularization TemperatureHigh = 314.15 # [Pa] upper temperature limit for tabularization
[LoadSolution]
PriVarNamesState1 = pw x_w^N2
PriVarNamesState2 = pw x_n^H2O
PriVarNamesState3 = pw Sn
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment