Commit 6fae9dc3 authored by Melanie Lipp's avatar Melanie Lipp Committed by Timo Koch

[test][freeflow] Let angeli problem have time_ and timeStepSize_ instead of timeLoop_.

parent c23a82f9
...@@ -93,7 +93,8 @@ int main(int argc, char** argv) try ...@@ -93,7 +93,8 @@ int main(int argc, char** argv) try
// the problem (initial and boundary conditions) // the problem (initial and boundary conditions)
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);
problem->setTimeLoop(timeLoop); problem->updateTimeStepSize(timeLoop->timeStepSize());
problem->createAnalyticalSolution();
// the solution vector // the solution vector
using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>;
...@@ -148,6 +149,7 @@ int main(int argc, char** argv) try ...@@ -148,6 +149,7 @@ int main(int argc, char** argv) try
// advance to the time loop to the next step // advance to the time loop to the next step
timeLoop->advanceTimeStep(); timeLoop->advanceTimeStep();
problem->updateTime(timeLoop->time());
// write vtk output // write vtk output
vtkWriter.write(timeLoop->time()); vtkWriter.write(timeLoop->time());
...@@ -157,6 +159,7 @@ int main(int argc, char** argv) try ...@@ -157,6 +159,7 @@ int main(int argc, char** argv) try
// set new dt as suggested by newton solver // set new dt as suggested by newton solver
timeLoop->setTimeStepSize(nonLinearSolver.suggestTimeStepSize(timeLoop->timeStepSize())); timeLoop->setTimeStepSize(nonLinearSolver.suggestTimeStepSize(timeLoop->timeStepSize()));
problem->updateTimeStepSize(timeLoop->timeStepSize());
} while (!timeLoop->finished()); } while (!timeLoop->finished());
......
...@@ -104,7 +104,7 @@ class AngeliTestProblem : public NavierStokesProblem<TypeTag> ...@@ -104,7 +104,7 @@ class AngeliTestProblem : public NavierStokesProblem<TypeTag>
public: public:
AngeliTestProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry) AngeliTestProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry)
: ParentType(fvGridGeometry), eps_(1e-6) : ParentType(fvGridGeometry)
{ {
printL2Error_ = getParam<bool>("Problem.PrintL2Error"); printL2Error_ = getParam<bool>("Problem.PrintL2Error");
kinematicViscosity_ = getParam<Scalar>("Component.LiquidKinematicViscosity", 1.0); kinematicViscosity_ = getParam<Scalar>("Component.LiquidKinematicViscosity", 1.0);
...@@ -209,7 +209,7 @@ public: ...@@ -209,7 +209,7 @@ public:
PrimaryVariables dirichletAtPos(const GlobalPosition & globalPos) const PrimaryVariables dirichletAtPos(const GlobalPosition & globalPos) const
{ {
// use the values of the analytical solution // use the values of the analytical solution
return analyticalSolution(globalPos, time()); return analyticalSolution(globalPos, time_);
} }
/*! /*!
...@@ -223,7 +223,7 @@ public: ...@@ -223,7 +223,7 @@ public:
const Scalar x = globalPos[0]; const Scalar x = globalPos[0];
const Scalar y = globalPos[1]; const Scalar y = globalPos[1];
const Scalar t = time + timeLoop_->timeStepSize(); const Scalar t = time + timeStepSize_;
PrimaryVariables values; PrimaryVariables values;
...@@ -248,7 +248,7 @@ public: ...@@ -248,7 +248,7 @@ public:
*/ */
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
{ {
return analyticalSolution(globalPos, -timeLoop_->timeStepSize()); return analyticalSolution(globalPos, -timeStepSize_);
} }
/*! /*!
...@@ -275,15 +275,20 @@ public: ...@@ -275,15 +275,20 @@ public:
return analyticalVelocityOnFace_; return analyticalVelocityOnFace_;
} }
void setTimeLoop(TimeLoopPtr timeLoop) /*!
* \brief Updates the time
*/
void updateTime(const Scalar time)
{ {
timeLoop_ = timeLoop; time_ = time;
createAnalyticalSolution();
} }
Scalar time() const /*!
* \brief Updates the time step size
*/
void updateTimeStepSize(const Scalar timeStepSize)
{ {
return timeLoop_->time(); timeStepSize_ = timeStepSize;
} }
/*! /*!
...@@ -305,7 +310,7 @@ public: ...@@ -305,7 +310,7 @@ public:
{ {
auto ccDofIdx = scv.dofIndex(); auto ccDofIdx = scv.dofIndex();
auto ccDofPosition = scv.dofPosition(); auto ccDofPosition = scv.dofPosition();
auto analyticalSolutionAtCc = analyticalSolution(ccDofPosition, time()); auto analyticalSolutionAtCc = analyticalSolution(ccDofPosition, time_);
// velocities on faces // velocities on faces
for (auto&& scvf : scvfs(fvGeometry)) for (auto&& scvf : scvfs(fvGeometry))
...@@ -313,7 +318,7 @@ public: ...@@ -313,7 +318,7 @@ public:
const auto faceDofIdx = scvf.dofIndex(); const auto faceDofIdx = scvf.dofIndex();
const auto faceDofPosition = scvf.center(); const auto faceDofPosition = scvf.center();
const auto dirIdx = scvf.directionIndex(); const auto dirIdx = scvf.directionIndex();
const auto analyticalSolutionAtFace = analyticalSolution(faceDofPosition, time()); const auto analyticalSolutionAtFace = analyticalSolution(faceDofPosition, time_);
analyticalVelocityOnFace_[faceDofIdx][dirIdx] = analyticalSolutionAtFace[Indices::velocity(dirIdx)]; analyticalVelocityOnFace_[faceDofIdx][dirIdx] = analyticalSolutionAtFace[Indices::velocity(dirIdx)];
} }
...@@ -326,11 +331,11 @@ public: ...@@ -326,11 +331,11 @@ public:
} }
private: private:
static constexpr Scalar eps_ = 1e-6;
Scalar eps_;
Scalar kinematicViscosity_; Scalar kinematicViscosity_;
TimeLoopPtr timeLoop_; Scalar time_ = 0;
Scalar timeStepSize_ = 0;
bool printL2Error_; bool printL2Error_;
std::vector<Scalar> analyticalPressure_; std::vector<Scalar> analyticalPressure_;
std::vector<VelocityVector> analyticalVelocity_; std::vector<VelocityVector> analyticalVelocity_;
......
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