From 22550fbaf7b77c1e48e814858ce48b743f13daa0 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de> Date: Thu, 8 Jun 2017 16:27:27 +0200 Subject: [PATCH] [staggered][test] Adapt channel test for NI * so additional clean-up --- test/freeflow/staggered/CMakeLists.txt | 15 +++++ test/freeflow/staggered/channeltestproblem.hh | 64 ++++++++++++------- 2 files changed, 56 insertions(+), 23 deletions(-) diff --git a/test/freeflow/staggered/CMakeLists.txt b/test/freeflow/staggered/CMakeLists.txt index 7791d45203..6b70b4d95c 100644 --- a/test/freeflow/staggered/CMakeLists.txt +++ b/test/freeflow/staggered/CMakeLists.txt @@ -22,6 +22,21 @@ add_dumux_test(test_channel_stokes test_channel_stokes test_channel.cc ${CMAKE_CURRENT_BINARY_DIR}/test_channel_stokes-00002.vtu --command "${CMAKE_CURRENT_BINARY_DIR}/test_channel_stokes") +add_dumux_test(test_channel_stokesni_convection test_channel_stokesni test_channel.cc + python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py + --script fuzzy + --files ${CMAKE_SOURCE_DIR}/test/references/channel-stokes.vtu + ${CMAKE_CURRENT_BINARY_DIR}/test_channel_stokes-00002.vtu + --command "${CMAKE_CURRENT_BINARY_DIR}/test_channel_stokesni test_channel_stokesni_convection.input") +target_compile_definitions(test_channel_stokesni PUBLIC "NONISOTHERMAL=1") + +add_dumux_test(test_channel_stokesni_conduction test_channel_stokesni test_channel.cc + python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py + --script fuzzy + --files ${CMAKE_SOURCE_DIR}/test/references/channel-stokes.vtu + ${CMAKE_CURRENT_BINARY_DIR}/test_channel_stokes-00002.vtu + --command "${CMAKE_CURRENT_BINARY_DIR}/test_channel_stokesni test_channel_stokesni_conduction.input") + add_dumux_test(test_channel_navierstokes test_channel_navierstokes test_channel.cc python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py --script fuzzy diff --git a/test/freeflow/staggered/channeltestproblem.hh b/test/freeflow/staggered/channeltestproblem.hh index 085ba3b5c0..e007647844 100644 --- a/test/freeflow/staggered/channeltestproblem.hh +++ b/test/freeflow/staggered/channeltestproblem.hh @@ -45,14 +45,22 @@ namespace Capabilities namespace Properties { +#if !NONISOTHERMAL NEW_TYPE_TAG(ChannelTestProblem, INHERITS_FROM(StaggeredModel, NavierStokes)); +#else +NEW_TYPE_TAG(ChannelTestProblem, INHERITS_FROM(StaggeredModel, NavierStokesNI)); +#endif SET_PROP(ChannelTestProblem, Fluid) { private: - typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; + using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); public: - typedef FluidSystems::LiquidPhase<Scalar, Dumux::Constant<TypeTag, Scalar> > type; +#if NONISOTHERMAL + using type = FluidSystems::LiquidPhase<Scalar, Dumux::SimpleH2O<Scalar> > ; +#else + using type = FluidSystems::LiquidPhase<Scalar, Dumux::Constant<TypeTag, Scalar> > ; +#endif }; // Set the grid type @@ -77,7 +85,7 @@ SET_BOOL_PROP(ChannelTestProblem, EnableInertiaTerms, false); } /*! - * \brief Test problem for the one-phase model: + * \brief Test problem for the one-phase (Navier-) Stokes problem in a channel: \todo doc me! */ template <class TypeTag> @@ -101,20 +109,24 @@ class ChannelTestProblem : public NavierStokesProblem<TypeTag> momentumXBalanceIdx = Indices::momentumXBalanceIdx, momentumYBalanceIdx = Indices::momentumYBalanceIdx, pressureIdx = Indices::pressureIdx, +#if NONISOTHERMAL + temperatureIdx = Indices::temperatureIdx, + energyBalanceIdx = Indices::energyBalanceIdx, +#endif velocityXIdx = Indices::velocityXIdx, velocityYIdx = Indices::velocityYIdx }; - typedef typename GET_PROP_TYPE(TypeTag, BoundaryTypes) BoundaryTypes; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; + using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); + using TimeManager = typename GET_PROP_TYPE(TypeTag, TimeManager); - typedef typename GridView::template Codim<0>::Entity Element; - typedef typename GridView::Intersection Intersection; + using Element = typename GridView::template Codim<0>::Entity; + using Intersection = typename GridView::Intersection; - typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry; - typedef typename GET_PROP_TYPE(TypeTag, SubControlVolume) SubControlVolume; + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; + using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>; using CellCenterPrimaryVariables = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables); using FacePrimaryVariables = typename GET_PROP_TYPE(TypeTag, FacePrimaryVariables); @@ -194,6 +206,13 @@ public: // set Dirichlet values for the velocity everywhere values.setDirichlet(momentumBalanceIdx); +#if NONISOTHERMAL + if(isInlet(globalPos)) + values.setDirichlet(energyBalanceIdx); + else + values.setOutflow(energyBalanceIdx); +#endif + // set a fixed pressure in one cell if (isOutlet(globalPos)) { @@ -214,23 +233,18 @@ public: */ BoundaryValues dirichletAtPos(const GlobalPosition &globalPos) const { - BoundaryValues values; - values[pressureIdx] = 1.1e+5; + BoundaryValues values = initialAtPos(globalPos); if(isInlet(globalPos)) { values[velocityXIdx] = inletVelocity_; - values[velocityYIdx] = 0.0; - } - else if(isWall(globalPos)) - { - values[velocityXIdx] = 0.0; - values[velocityYIdx] = 0.0; - } - else if(isOutlet(globalPos)) - { - values[velocityXIdx] = 1.0; - values[velocityYIdx]= 0.0; +#if NONISOTHERMAL + const Scalar time = this->timeManager().time() + this->timeManager().timeStepSize(); + + // give the system some time so that the pressure can equilibrate, then start the injection of the hot liquid + if(time > 20.0) + values[temperatureIdx] = 293.15; +#endif } return values; @@ -255,6 +269,10 @@ public: values[velocityXIdx] = 0.0; values[velocityYIdx] = 0.0; +#if NONISOTHERMAL + values[temperatureIdx] = 283.15; +#endif + return values; } -- GitLab