Skip to content
Snippets Groups Projects
Commit d3b0a1b9 authored by Kilian Weishaupt's avatar Kilian Weishaupt
Browse files

[test][freeflowMaxwellStefan] Fix test

* this is the only test that failed after the changes in momentum upwind, thus the use of inertia terms is disabled
* use fixed times to write output
* do some clean-up
parent eda7e678
No related branches found
No related tags found
1 merge request!790[test][freeflowMaxwellStephan] Fix test
...@@ -61,5 +61,5 @@ dune_add_test(NAME test_msfreeflow ...@@ -61,5 +61,5 @@ dune_add_test(NAME test_msfreeflow
COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
CMD_ARGS --script fuzzy CMD_ARGS --script fuzzy
--files ${CMAKE_SOURCE_DIR}/test/references/maxwellstefanfreeflow-reference.vtu --files ${CMAKE_SOURCE_DIR}/test/references/maxwellstefanfreeflow-reference.vtu
${CMAKE_CURRENT_BINARY_DIR}/test_msfreeflow-00025.vtu ${CMAKE_CURRENT_BINARY_DIR}/test_msfreeflow-00005.vtu
--command "${CMAKE_CURRENT_BINARY_DIR}/test_msfreeflow test_msfreeflow.input") --command "${CMAKE_CURRENT_BINARY_DIR}/test_msfreeflow test_msfreeflow.input")
...@@ -42,11 +42,7 @@ class MaxwellStefanNCTestProblem; ...@@ -42,11 +42,7 @@ class MaxwellStefanNCTestProblem;
namespace Properties { namespace Properties {
#if !NONISOTHERMAL
NEW_TYPE_TAG(MaxwellStefanNCTestTypeTag, INHERITS_FROM(StaggeredFreeFlowModel, NavierStokesNC)); NEW_TYPE_TAG(MaxwellStefanNCTestTypeTag, INHERITS_FROM(StaggeredFreeFlowModel, NavierStokesNC));
#else
NEW_TYPE_TAG(MaxwellStefanNCTestTypeTag, INHERITS_FROM(StaggeredFreeFlowModel, NavierStokesNCNI));
#endif
NEW_PROP_TAG(FluidSystem); NEW_PROP_TAG(FluidSystem);
...@@ -66,7 +62,7 @@ SET_BOOL_PROP(MaxwellStefanNCTestTypeTag, EnableGridVolumeVariablesCache, true); ...@@ -66,7 +62,7 @@ SET_BOOL_PROP(MaxwellStefanNCTestTypeTag, EnableGridVolumeVariablesCache, true);
SET_BOOL_PROP(MaxwellStefanNCTestTypeTag, UseMoles, true); SET_BOOL_PROP(MaxwellStefanNCTestTypeTag, UseMoles, true);
// #if ENABLE_NAVIERSTOKES // #if ENABLE_NAVIERSTOKES
SET_BOOL_PROP(MaxwellStefanNCTestTypeTag, EnableInertiaTerms, true); SET_BOOL_PROP(MaxwellStefanNCTestTypeTag, EnableInertiaTerms, false);
//! Here we set FicksLaw or MaxwellStefansLaw //! Here we set FicksLaw or MaxwellStefansLaw
SET_TYPE_PROP(MaxwellStefanNCTestTypeTag, MolecularDiffusionType, MaxwellStefansLaw<TypeTag>); SET_TYPE_PROP(MaxwellStefanNCTestTypeTag, MolecularDiffusionType, MaxwellStefansLaw<TypeTag>);
...@@ -186,8 +182,7 @@ class MaxwellStefanNCTestProblem : public NavierStokesProblem<TypeTag> ...@@ -186,8 +182,7 @@ class MaxwellStefanNCTestProblem : public NavierStokesProblem<TypeTag>
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
// copy some indices for convenience // copy some indices for convenience
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices; using Indices = typename GET_PROP_TYPE(TypeTag, Indices);
enum { dimWorld = GridView::dimensionworld };
enum { enum {
massBalanceIdx = Indices::massBalanceIdx, massBalanceIdx = Indices::massBalanceIdx,
compTwoIdx = FluidSystem::N2Idx, compTwoIdx = FluidSystem::N2Idx,
...@@ -199,12 +194,9 @@ class MaxwellStefanNCTestProblem : public NavierStokesProblem<TypeTag> ...@@ -199,12 +194,9 @@ class MaxwellStefanNCTestProblem : public NavierStokesProblem<TypeTag>
}; };
using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes);
using Element = typename GridView::template Codim<0>::Entity;
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>; using GlobalPosition = Dune::FieldVector<Scalar, GridView::dimensionworld>;
using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables);
using NumEqVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); using NumEqVector = typename GET_PROP_TYPE(TypeTag, NumEqVector);
...@@ -214,10 +206,9 @@ class MaxwellStefanNCTestProblem : public NavierStokesProblem<TypeTag> ...@@ -214,10 +206,9 @@ class MaxwellStefanNCTestProblem : public NavierStokesProblem<TypeTag>
public: public:
MaxwellStefanNCTestProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry) MaxwellStefanNCTestProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry)
: ParentType(fvGridGeometry), eps_(1e-6) : ParentType(fvGridGeometry)
{ {
name_ = getParam<std::string>("Problem.Name"); plotOutput_ = getParam<bool>("Problem.PlotOutput", false);
plotOutput_ = false;
} }
/*! /*!
...@@ -225,21 +216,6 @@ public: ...@@ -225,21 +216,6 @@ public:
*/ */
// \{ // \{
/*!
* \brief The problem name.
*
* This is used as a prefix for files generated by the simulation.
*/
std::string name() const
{
return name_;
}
bool shouldWriteRestartFile() const
{
return false;
}
/*! /*!
* \brief Output the diffusion rates from left to right * \brief Output the diffusion rates from left to right
* *
...@@ -251,7 +227,7 @@ public: ...@@ -251,7 +227,7 @@ public:
*/ */
void postTimeStep(const SolutionVector& curSol, void postTimeStep(const SolutionVector& curSol,
const GridVariables& gridVariables, const GridVariables& gridVariables,
Scalar time) const Scalar time)
{ {
if (plotOutput_) if (plotOutput_)
...@@ -372,10 +348,11 @@ public: ...@@ -372,10 +348,11 @@ public:
BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
{ {
BoundaryTypes values; BoundaryTypes values;
values.setAllNeumann();
// set Dirichlet values for the velocity everywhere // set Dirichlet values for the velocity everywhere
values.setDirichlet(momentumBalanceIdx); values.setDirichlet(momentumBalanceIdx);
values.setDirichlet(massBalanceIdx); values.setOutflow(compTwoIdx);
values.setOutflow(compThreeIdx);
values.setOutflow(massBalanceIdx);
return values; return values;
} }
...@@ -387,9 +364,7 @@ public: ...@@ -387,9 +364,7 @@ public:
*/ */
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
{ {
PrimaryVariables values = initialAtPos(globalPos); return initialAtPos(globalPos);
return values;
} }
/*! /*!
...@@ -417,6 +392,7 @@ public: ...@@ -417,6 +392,7 @@ public:
} }
initialValues[pressureIdx] = 1.1e+5; initialValues[pressureIdx] = 1.1e+5;
initialValues[velocityXIdx] = 0.0;
initialValues[velocityYIdx] = 0.0; initialValues[velocityYIdx] = 0.0;
return initialValues; return initialValues;
...@@ -424,37 +400,21 @@ public: ...@@ -424,37 +400,21 @@ public:
private: private:
bool isInlet(const GlobalPosition& globalPos) const
{
return globalPos[0] < eps_;
}
bool isOutlet(const GlobalPosition& globalPos) const
{
return globalPos[0] > this->bBoxMax()[0] - eps_;
}
bool isWall(const GlobalPosition& globalPos) const
{
return globalPos[0] > eps_ || globalPos[0] < this->bBoxMax()[0] - eps_;
}
bool plotOutput_; bool plotOutput_;
const Scalar eps_{1e-6}; const Scalar eps_{1e-6};
std::string name_;
Dumux::GnuplotInterface<Scalar> gnuplot_;
Dumux::GnuplotInterface<double> gnuplot_; Dumux::GnuplotInterface<Scalar> gnuplot2_;
Dumux::GnuplotInterface<double> gnuplot2_; Dumux::GnuplotInterface<Scalar> gnuplot3_;
Dumux::GnuplotInterface<double> gnuplot3_;
std::vector<Scalar> x_;
std::vector<double> x_; std::vector<Scalar> y_;
std::vector<double> y_; std::vector<Scalar> y2_;
std::vector<double> y2_; std::vector<Scalar> y3_;
std::vector<double> y3_; std::vector<Scalar> y4_;
std::vector<double> y4_; std::vector<Scalar> y5_;
std::vector<double> y5_; std::vector<Scalar> y6_;
std::vector<double> y6_;
}; };
} //end namespace } //end namespace
......
...@@ -176,6 +176,9 @@ int main(int argc, char** argv) try ...@@ -176,6 +176,9 @@ int main(int argc, char** argv) try
auto newtonController = std::make_shared<NewtonController>(timeLoop); auto newtonController = std::make_shared<NewtonController>(timeLoop);
NewtonMethod nonLinearSolver(newtonController, assembler, linearSolver); NewtonMethod nonLinearSolver(newtonController, assembler, linearSolver);
//! set some check points for the time loop
timeLoop->setPeriodicCheckPoint(tEnd/5.0);
// time loop // time loop
timeLoop->start(); do timeLoop->start(); do
{ {
...@@ -209,8 +212,9 @@ int main(int argc, char** argv) try ...@@ -209,8 +212,9 @@ 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();
// write vtk output // write vtk output on check points
vtkWriter.write(timeLoop->time()); if (timeLoop->isCheckPoint())
vtkWriter.write(timeLoop->time());
// report statistics of this time step // report statistics of this time step
timeLoop->reportTimeStep(); timeLoop->reportTimeStep();
......
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