Commit 4cdea13e authored by Timo Koch's avatar Timo Koch
Browse files

[cleanup] Remove restart

parent b3f68777
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include <dumux/io/vtkoutputmodule.hh> #include <dumux/io/vtkoutputmodule.hh>
#include <dumux/io/grid/gridmanager.hh> #include <dumux/io/grid/gridmanager.hh>
#include <dumux/io/loadsolution.hh>
// The problem file, where setup-specific boundary and initial conditions are defined. // The problem file, where setup-specific boundary and initial conditions are defined.
#include "injection2pproblem.hh" #include "injection2pproblem.hh"
...@@ -90,25 +89,9 @@ int main(int argc, char** argv) try ...@@ -90,25 +89,9 @@ int main(int argc, char** argv) try
using Problem = GetPropType<TypeTag, Properties::Problem>; using Problem = GetPropType<TypeTag, Properties::Problem>;
auto problem = std::make_shared<Problem>(fvGridGeometry); auto problem = std::make_shared<Problem>(fvGridGeometry);
// check if we are about to restart a previously interrupted simulation
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
Scalar restartTime = getParam<Scalar>("Restart.Time", 0);
// the solution vector // the solution vector
using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>;
SolutionVector x(fvGridGeometry->numDofs()); problem->applyInitialSolution(x);
if (restartTime > 0)
{
using IOFields = GetPropType<TypeTag, Properties::IOFields>;
using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>;
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
const auto fileName = getParam<std::string>("Restart.File");
const auto pvName = createPVNameFunction<IOFields, PrimaryVariables, ModelTraits, FluidSystem>();
loadSolution(x, fileName, pvName, *fvGridGeometry);
}
else
problem->applyInitialSolution(x);
auto xOld = x; auto xOld = x;
// the grid variables // the grid variables
...@@ -132,7 +115,7 @@ int main(int argc, char** argv) try ...@@ -132,7 +115,7 @@ int main(int argc, char** argv) try
using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>; using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>;
vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables)); vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables));
IOFields::initOutputModule(vtkWriter); //!< Add model specific output fields IOFields::initOutputModule(vtkWriter); //!< Add model specific output fields
vtkWriter.write(restartTime); vtkWriter.write(0.0);
// instantiate time loop // instantiate time loop
auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd); auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd);
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include <dumux/io/vtkoutputmodule.hh> #include <dumux/io/vtkoutputmodule.hh>
#include <dumux/io/grid/gridmanager.hh> #include <dumux/io/grid/gridmanager.hh>
#include <dumux/io/loadsolution.hh>
// The problem file, where setup-specific boundary and initial conditions are defined. // The problem file, where setup-specific boundary and initial conditions are defined.
#include "injection2p2cproblem.hh" #include "injection2p2cproblem.hh"
...@@ -90,26 +89,10 @@ int main(int argc, char** argv) try ...@@ -90,26 +89,10 @@ int main(int argc, char** argv) try
using Problem = GetPropType<TypeTag, Properties::Problem>; using Problem = GetPropType<TypeTag, Properties::Problem>;
auto problem = std::make_shared<Problem>(fvGridGeometry); auto problem = std::make_shared<Problem>(fvGridGeometry);
// check if we are about to restart a previously interrupted simulation
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
Scalar restartTime = getParam<Scalar>("Restart.Time", 0);
// the solution vector // the solution vector
using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>;
SolutionVector x(fvGridGeometry->numDofs()); SolutionVector x(fvGridGeometry->numDofs());
// problem->applyInitialSolution(x); problem->applyInitialSolution(x);
if (restartTime > 0)
{
using IOFields = GetPropType<TypeTag, Properties::IOFields>;
using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>;
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
const auto fileName = getParam<std::string>("Restart.File");
const auto pvName = createPVNameFunction<IOFields, PrimaryVariables, ModelTraits, FluidSystem>();
loadSolution(x, fileName, pvName, *fvGridGeometry);
}
else
problem->applyInitialSolution(x);
auto xOld = x; auto xOld = x;
// the grid variables // the grid variables
...@@ -129,7 +112,7 @@ int main(int argc, char** argv) try ...@@ -129,7 +112,7 @@ int main(int argc, char** argv) try
using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>; using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>;
vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables)); vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables));
IOFields::initOutputModule(vtkWriter); //!< Add model specific output fields IOFields::initOutputModule(vtkWriter); //!< Add model specific output fields
vtkWriter.write(restartTime); vtkWriter.write(0.0);
// instantiate time loop // instantiate time loop
auto timeLoop = std::make_shared<TimeLoop<Scalar>>(restartTime, dt, tEnd); auto timeLoop = std::make_shared<TimeLoop<Scalar>>(restartTime, dt, tEnd);
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include <dumux/io/vtkoutputmodule.hh> #include <dumux/io/vtkoutputmodule.hh>
#include <dumux/io/grid/gridmanager.hh> #include <dumux/io/grid/gridmanager.hh>
#include <dumux/io/loadsolution.hh>
// The problem file, where setup-specific boundary and initial conditions are defined. // The problem file, where setup-specific boundary and initial conditions are defined.
#include "injection2pproblem.hh" #include "injection2pproblem.hh"
...@@ -90,25 +89,9 @@ int main(int argc, char** argv) try ...@@ -90,25 +89,9 @@ int main(int argc, char** argv) try
using Problem = GetPropType<TypeTag, Properties::Problem>; using Problem = GetPropType<TypeTag, Properties::Problem>;
auto problem = std::make_shared<Problem>(fvGridGeometry); auto problem = std::make_shared<Problem>(fvGridGeometry);
// check if we are about to restart a previously interrupted simulation
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
Scalar restartTime = getParam<Scalar>("Restart.Time", 0);
// the solution vector // the solution vector
using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>;
SolutionVector x(fvGridGeometry->numDofs()); problem->applyInitialSolution(x);
if (restartTime > 0)
{
using IOFields = GetPropType<TypeTag, Properties::IOFields>;
using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>;
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
const auto fileName = getParam<std::string>("Restart.File");
const auto pvName = createPVNameFunction<IOFields, PrimaryVariables, ModelTraits, FluidSystem>();
loadSolution(x, fileName, pvName, *fvGridGeometry);
}
else
problem->applyInitialSolution(x);
auto xOld = x; auto xOld = x;
// the grid variables // the grid variables
...@@ -130,7 +113,7 @@ int main(int argc, char** argv) try ...@@ -130,7 +113,7 @@ int main(int argc, char** argv) try
using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>; using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>;
vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables)); vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables));
IOFields::initOutputModule(vtkWriter); //!< Add model specific output fields IOFields::initOutputModule(vtkWriter); //!< Add model specific output fields
vtkWriter.write(restartTime); vtkWriter.write(0.0);
// instantiate time loop // instantiate time loop
auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd); auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd);
......
...@@ -50,7 +50,6 @@ ...@@ -50,7 +50,6 @@
#include <dumux/io/vtkoutputmodule.hh> #include <dumux/io/vtkoutputmodule.hh>
#include <dumux/io/grid/gridmanager.hh> #include <dumux/io/grid/gridmanager.hh>
#include <dumux/io/loadsolution.hh>
/*! /*!
* \brief Provides an interface for customizing error messages associated with * \brief Provides an interface for customizing error messages associated with
...@@ -121,26 +120,9 @@ int main(int argc, char** argv) try ...@@ -121,26 +120,9 @@ int main(int argc, char** argv) try
using Problem = GetPropType<TypeTag, Properties::Problem>; using Problem = GetPropType<TypeTag, Properties::Problem>;
auto problem = std::make_shared<Problem>(fvGridGeometry); auto problem = std::make_shared<Problem>(fvGridGeometry);
// check if we are about to restart a previously interrupted simulation
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
Scalar restartTime = getParam<Scalar>("Restart.Time", 0);
// the solution vector // the solution vector
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>;
SolutionVector x(fvGridGeometry->numDofs()); problem->applyInitialSolution(x);
if (restartTime > 0)
{
using IOFields = GetPropType<TypeTag, Properties::IOFields>;
using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>;
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
const auto fileName = getParam<std::string>("Restart.File");
const auto pvName = createPVNameFunction<IOFields, PrimaryVariables, ModelTraits, FluidSystem>();
loadSolution(x, fileName, pvName, *fvGridGeometry);
}
else
problem->applyInitialSolution(x);
auto xOld = x; auto xOld = x;
// the grid variables // the grid variables
...@@ -160,7 +142,7 @@ int main(int argc, char** argv) try ...@@ -160,7 +142,7 @@ int main(int argc, char** argv) try
using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>; using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>;
vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables)); vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables));
IOFields::initOutputModule(vtkWriter); //!< Add model specific output fields IOFields::initOutputModule(vtkWriter); //!< Add model specific output fields
vtkWriter.write(restartTime); vtkWriter.write(0.0);
// instantiate time loop // instantiate time loop
auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd); auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd);
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include <dumux/io/vtkoutputmodule.hh> #include <dumux/io/vtkoutputmodule.hh>
#include <dumux/io/grid/gridmanager.hh> #include <dumux/io/grid/gridmanager.hh>
#include <dumux/io/loadsolution.hh>
// The problem file, where setup-specific boundary and initial conditions are defined. // The problem file, where setup-specific boundary and initial conditions are defined.
#include "injection2pproblem.hh" #include "injection2pproblem.hh"
...@@ -90,25 +89,9 @@ int main(int argc, char** argv) try ...@@ -90,25 +89,9 @@ int main(int argc, char** argv) try
using Problem = GetPropType<TypeTag, Properties::Problem>; using Problem = GetPropType<TypeTag, Properties::Problem>;
auto problem = std::make_shared<Problem>(fvGridGeometry); auto problem = std::make_shared<Problem>(fvGridGeometry);
// check if we are about to restart a previously interrupted simulation
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
Scalar restartTime = getParam<Scalar>("Restart.Time", 0);
// the solution vector // the solution vector
using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>;
SolutionVector x(fvGridGeometry->numDofs()); problem->applyInitialSolution(x);
if (restartTime > 0)
{
using IOFields = GetPropType<TypeTag, Properties::IOFields>;
using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>;
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
const auto fileName = getParam<std::string>("Restart.File");
const auto pvName = createPVNameFunction<IOFields, PrimaryVariables, ModelTraits, FluidSystem>();
loadSolution(x, fileName, pvName, *fvGridGeometry);
}
else
problem->applyInitialSolution(x);
auto xOld = x; auto xOld = x;
// the grid variables // the grid variables
...@@ -130,7 +113,7 @@ int main(int argc, char** argv) try ...@@ -130,7 +113,7 @@ int main(int argc, char** argv) try
using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>; using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>;
vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables)); vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables));
IOFields::initOutputModule(vtkWriter); //!< Add model specific output fields IOFields::initOutputModule(vtkWriter); //!< Add model specific output fields
vtkWriter.write(restartTime); vtkWriter.write(0.0);
// instantiate time loop // instantiate time loop
auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd); auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd);
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include <dumux/io/vtkoutputmodule.hh> #include <dumux/io/vtkoutputmodule.hh>
#include <dumux/io/grid/gridmanager.hh> #include <dumux/io/grid/gridmanager.hh>
#include <dumux/io/loadsolution.hh>
// The problem file, where setup-specific boundary and initial conditions are defined. // The problem file, where setup-specific boundary and initial conditions are defined.
#include "injection2pniproblem.hh" #include "injection2pniproblem.hh"
...@@ -90,25 +89,9 @@ int main(int argc, char** argv) try ...@@ -90,25 +89,9 @@ int main(int argc, char** argv) try
using Problem = GetPropType<TypeTag, Properties::Problem>; using Problem = GetPropType<TypeTag, Properties::Problem>;
auto problem = std::make_shared<Problem>(fvGridGeometry); auto problem = std::make_shared<Problem>(fvGridGeometry);
// check if we are about to restart a previously interrupted simulation
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
Scalar restartTime = getParam<Scalar>("Restart.Time", 0);
// the solution vector // the solution vector
using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>;
SolutionVector x(fvGridGeometry->numDofs()); problem->applyInitialSolution(x);
if (restartTime > 0)
{
using IOFields = GetPropType<TypeTag, Properties::IOFields>;
using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>;
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
const auto fileName = getParam<std::string>("Restart.File");
const auto pvName = createPVNameFunction<IOFields, PrimaryVariables, ModelTraits, FluidSystem>();
loadSolution(x, fileName, pvName, *fvGridGeometry);
}
else
problem->applyInitialSolution(x);
auto xOld = x; auto xOld = x;
// the grid variables // the grid variables
...@@ -128,7 +111,7 @@ int main(int argc, char** argv) try ...@@ -128,7 +111,7 @@ int main(int argc, char** argv) try
using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>; using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>;
vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables)); vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables));
IOFields::initOutputModule(vtkWriter); //!< Add model specific output fields IOFields::initOutputModule(vtkWriter); //!< Add model specific output fields
vtkWriter.write(restartTime); vtkWriter.write(0.0);
// instantiate time loop // instantiate time loop
auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd); auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd);
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include <dumux/io/vtkoutputmodule.hh> #include <dumux/io/vtkoutputmodule.hh>
#include <dumux/io/grid/gridmanager.hh> #include <dumux/io/grid/gridmanager.hh>
#include <dumux/io/loadsolution.hh>
// The problem file, where setup-specific boundary and initial conditions are defined. // The problem file, where setup-specific boundary and initial conditions are defined.
#include "injection2pproblem.hh" #include "injection2pproblem.hh"
...@@ -90,25 +89,9 @@ int main(int argc, char** argv) try ...@@ -90,25 +89,9 @@ int main(int argc, char** argv) try
using Problem = GetPropType<TypeTag, Properties::Problem>; using Problem = GetPropType<TypeTag, Properties::Problem>;
auto problem = std::make_shared<Problem>(fvGridGeometry); auto problem = std::make_shared<Problem>(fvGridGeometry);
// check if we are about to restart a previously interrupted simulation
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
Scalar restartTime = getParam<Scalar>("Restart.Time", 0);
// the solution vector // the solution vector
using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>;
SolutionVector x(fvGridGeometry->numDofs()); problem->applyInitialSolution(x);
if (restartTime > 0)
{
using IOFields = GetPropType<TypeTag, Properties::IOFields>;
using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>;
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
const auto fileName = getParam<std::string>("Restart.File");
const auto pvName = createPVNameFunction<IOFields, PrimaryVariables, ModelTraits, FluidSystem>();
loadSolution(x, fileName, pvName, *fvGridGeometry);
}
else
problem->applyInitialSolution(x);
auto xOld = x; auto xOld = x;
// the grid variables // the grid variables
...@@ -130,7 +113,7 @@ int main(int argc, char** argv) try ...@@ -130,7 +113,7 @@ int main(int argc, char** argv) try
using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>; using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>;
vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables)); vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables));
IOFields::initOutputModule(vtkWriter); //!< Add model specific output fields IOFields::initOutputModule(vtkWriter); //!< Add model specific output fields
vtkWriter.write(restartTime); vtkWriter.write(0.0);
// instantiate time loop // instantiate time loop
auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd); auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd);
......
...@@ -121,25 +121,9 @@ int main(int argc, char** argv) try ...@@ -121,25 +121,9 @@ int main(int argc, char** argv) try
using Problem = GetPropType<TypeTag, Properties::Problem>; using Problem = GetPropType<TypeTag, Properties::Problem>;
auto problem = std::make_shared<Problem>(fvGridGeometry); auto problem = std::make_shared<Problem>(fvGridGeometry);
// check if we are about to restart a previously interrupted simulation
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
Scalar restartTime = getParam<Scalar>("Restart.Time", 0);
// the solution vector // the solution vector
using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>;
SolutionVector x(fvGridGeometry->numDofs()); problem->applyInitialSolution(x);
if (restartTime > 0)
{
using IOFields = GetPropType<TypeTag, Properties::IOFields>;
using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>;
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
const auto fileName = getParam<std::string>("Restart.File");
const auto pvName = createPVNameFunction<IOFields, PrimaryVariables, ModelTraits, FluidSystem>();
loadSolution(x, fileName, pvName, *fvGridGeometry);
}
else
problem->applyInitialSolution(x);
auto xOld = x; auto xOld = x;
// the grid variables // the grid variables
...@@ -159,7 +143,7 @@ int main(int argc, char** argv) try ...@@ -159,7 +143,7 @@ int main(int argc, char** argv) try
using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>; using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>;
vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables)); vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables));
IOFields::initOutputModule(vtkWriter); //!< Add model specific output fields IOFields::initOutputModule(vtkWriter); //!< Add model specific output fields
vtkWriter.write(restartTime); vtkWriter.write(0.0);
// instantiate time loop // instantiate time loop
auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd); auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd);
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include <dumux/io/vtkoutputmodule.hh> #include <dumux/io/vtkoutputmodule.hh>
#include <dumux/io/grid/gridmanager.hh> #include <dumux/io/grid/gridmanager.hh>
#include <dumux/io/loadsolution.hh>
// The problem file, where setup-specific boundary and initial conditions are defined. // The problem file, where setup-specific boundary and initial conditions are defined.
#include "injection2pproblem.hh" #include "injection2pproblem.hh"
...@@ -90,25 +89,9 @@ int main(int argc, char** argv) try ...@@ -90,25 +89,9 @@ int main(int argc, char** argv) try
using Problem = GetPropType<TypeTag, Properties::Problem>; using Problem = GetPropType<TypeTag, Properties::Problem>;
auto problem = std::make_shared<Problem>(fvGridGeometry); auto problem = std::make_shared<Problem>(fvGridGeometry);
// check if we are about to restart a previously interrupted simulation
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
Scalar restartTime = getParam<Scalar>("Restart.Time", 0);
// the solution vector // the solution vector
using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>;
SolutionVector x(fvGridGeometry->numDofs()); problem->applyInitialSolution(x);
if (restartTime > 0)
{
using IOFields = GetPropType<TypeTag, Properties::IOFields>;
using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>;
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
const auto fileName = getParam<std::string>("Restart.File");
const auto pvName = createPVNameFunction<IOFields, PrimaryVariables, ModelTraits, FluidSystem>();
loadSolution(x, fileName, pvName, *fvGridGeometry);
}
else
problem->applyInitialSolution(x);
auto xOld = x; auto xOld = x;
// the grid variables // the grid variables
...@@ -130,7 +113,7 @@ int main(int argc, char** argv) try ...@@ -130,7 +113,7 @@ int main(int argc, char** argv) try
using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>; using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>;
vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables)); vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables));
IOFields::initOutputModule(vtkWriter); //!< Add model specific output fields IOFields::initOutputModule(vtkWriter); //!< Add model specific output fields
vtkWriter.write(restartTime); vtkWriter.write(0.0);
// instantiate time loop // instantiate time loop
auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd); auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment