From c732cd95cc15c62133d807547af6f25d7b63e3de Mon Sep 17 00:00:00 2001 From: Timo Koch <timo.koch@iws.uni-stuttgart.de> Date: Fri, 17 Nov 2017 17:25:14 +0100 Subject: [PATCH] [1p][test] Port rest of the 1p tests to new main file structure --- .../1p/implicit/1pniconductionproblem.hh | 51 ++--- .../1p/implicit/1pniconvectionproblem.hh | 65 +++--- .../1p/implicit/1ptestspatialparams.hh | 33 ++- .../1p/implicit/CMakeLists.txt | 191 ++++++++++-------- .../1p/implicit/compressible/test_1p.input | 1 - .../1p/implicit/fractureproblem.hh | 8 +- .../pointsources/1psingularityproblem.hh | 63 ++---- .../1psingularityproblemtimedependent.hh | 34 ++-- .../1psingularityspatialparams.hh | 8 +- .../1p/implicit/pointsources/CMakeLists.txt | 47 +++-- .../test_1pfv_pointsources.cc} | 58 +----- ...ces.input => test_1pfv_pointsources.input} | 5 +- .../test_1pfv_pointsources_timedependent.cc} | 44 +--- .../pointsources/test_box1p_pointsources.cc | 61 ------ .../pointsources/test_cc1p_pointsources.cc | 61 ------ .../pointsources/test_cc1p_pointsources.input | 15 -- .../test_cc1p_pointsources_timedependent.cc | 61 ------ .../porousmediumflow/1p/implicit/test_1pfv.cc | 5 + .../1p/implicit/test_1pfv.input | 2 - ...cture2d3d.cc => test_1pfv_fracture2d3d.cc} | 9 +- .../1p/implicit/test_1pfv_fracture2d3d.input | 10 + ...est_cc1pniconduction.cc => test_1pnifv.cc} | 23 ++- .../1p/implicit/test_1pnifv_conduction.input | 18 ++ ...ion.input => test_1pnifv_convection.input} | 8 +- ...withgstat.input => test_1pwithgstat.input} | 2 +- .../1p/implicit/test_cc1pfracture2d3d.input | 9 - .../1p/implicit/test_cc1pniconduction.input | 17 -- .../1p/implicit/test_ccmpfa1p.cc | 64 ------ .../1p/implicit/test_ccmpfa1p.input | 18 -- .../references/1pniccconvection-reference.vtu | 6 +- 30 files changed, 320 insertions(+), 677 deletions(-) rename test/porousmediumflow/1p/implicit/{test_cc1pwithgstat.cc => pointsources/test_1pfv_pointsources.cc} (73%) rename test/porousmediumflow/1p/implicit/pointsources/{test_box1p_pointsources.input => test_1pfv_pointsources.input} (74%) rename test/porousmediumflow/1p/implicit/{test_cc1pniconvection.cc => pointsources/test_1pfv_pointsources_timedependent.cc} (81%) delete mode 100644 test/porousmediumflow/1p/implicit/pointsources/test_box1p_pointsources.cc delete mode 100644 test/porousmediumflow/1p/implicit/pointsources/test_cc1p_pointsources.cc delete mode 100644 test/porousmediumflow/1p/implicit/pointsources/test_cc1p_pointsources.input delete mode 100644 test/porousmediumflow/1p/implicit/pointsources/test_cc1p_pointsources_timedependent.cc rename test/porousmediumflow/1p/implicit/{test_cc1pfracture2d3d.cc => test_1pfv_fracture2d3d.cc} (96%) create mode 100644 test/porousmediumflow/1p/implicit/test_1pfv_fracture2d3d.input rename test/porousmediumflow/1p/implicit/{test_cc1pniconduction.cc => test_1pnifv.cc} (92%) create mode 100644 test/porousmediumflow/1p/implicit/test_1pnifv_conduction.input rename test/porousmediumflow/1p/implicit/{test_cc1pniconvection.input => test_1pnifv_convection.input} (61%) rename test/porousmediumflow/1p/implicit/{test_cc1pwithgstat.input => test_1pwithgstat.input} (96%) delete mode 100644 test/porousmediumflow/1p/implicit/test_cc1pfracture2d3d.input delete mode 100644 test/porousmediumflow/1p/implicit/test_cc1pniconduction.input delete mode 100644 test/porousmediumflow/1p/implicit/test_ccmpfa1p.cc delete mode 100644 test/porousmediumflow/1p/implicit/test_ccmpfa1p.input diff --git a/test/porousmediumflow/1p/implicit/1pniconductionproblem.hh b/test/porousmediumflow/1p/implicit/1pniconductionproblem.hh index bd52e24269..948d414661 100644 --- a/test/porousmediumflow/1p/implicit/1pniconductionproblem.hh +++ b/test/porousmediumflow/1p/implicit/1pniconductionproblem.hh @@ -46,7 +46,7 @@ namespace Properties { NEW_TYPE_TAG(OnePNIConductionProblem, INHERITS_FROM(OnePNI)); NEW_TYPE_TAG(OnePNIConductionBoxProblem, INHERITS_FROM(BoxModel, OnePNIConductionProblem)); -NEW_TYPE_TAG(OnePNIConductionCCProblem, INHERITS_FROM(CCTpfaModel, OnePNIConductionProblem)); +NEW_TYPE_TAG(OnePNIConductionCCTpfaProblem, INHERITS_FROM(CCTpfaModel, OnePNIConductionProblem)); NEW_TYPE_TAG(OnePNIConductionCCMpfaProblem, INHERITS_FROM(CCMpfaModel, OnePNIConductionProblem)); // Set the grid type @@ -101,6 +101,9 @@ class OnePNIConductionProblem : public PorousMediumFlowProblem<TypeTag> using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using ThermalConductivityModel = typename GET_PROP_TYPE(TypeTag, ThermalConductivityModel); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); + using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); + using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); + using IapwsH2O = H2O<Scalar>; // copy some indices for convenience using Indices = typename GET_PROP_TYPE(TypeTag, Indices); @@ -109,9 +112,6 @@ class OnePNIConductionProblem : public PorousMediumFlowProblem<TypeTag> dimWorld = GridView::dimensionworld }; - enum { isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox) }; - enum { dofCodim = isBox ? dimWorld : 0 }; - enum { // indices of the primary variables pressureIdx = Indices::pressureIdx, @@ -134,21 +134,25 @@ public: FluidSystem::init(); name_ = getParam<std::string>("Problem.Name"); - outputInterval_ = getParam<int>("Problem.OutputInterval"); temperatureHigh_ = 300.0; - time_ = 0.0; + temperatureExact_.resize(fvGridGeometry->numDofs()); } - /*! - * \brief Adds additional VTK output data to the VTKWriter. Function is called by the output module on every write. - */ - const std::vector<Scalar>& computeExactTemperatureSolution(Scalar time) + //! get the analytical temperature + const std::vector<Scalar>& getExactTemperature() + { + return temperatureExact_; + } + + //! udpate the analytical temperature + void updateExactTemperature(const SolutionVector& curSol, Scalar time) { - const auto someElement = *(elements(this->gridView()).begin()); - const ElementSolution someElemSol(someElement, this->model().curSol(), this->fvGridGeometry()); - const auto initSol = initial_(); + const auto someElement = *(elements(this->fvGridGeometry().gridView()).begin()); + + ElementSolutionVector someElemSol(someElement, curSol, this->fvGridGeometry()); + const auto someInitSol = initialAtPos(someElement.geometry().center()); - auto fvGeometry = localView(this->model().fvGridGeometry()); + auto fvGeometry = localView(this->fvGridGeometry()); fvGeometry.bindElement(someElement); const auto someScv = *(scvs(fvGeometry).begin()); @@ -157,7 +161,7 @@ public: const auto porosity = this->spatialParams().porosity(someElement, someScv, someElemSol); const auto densityW = volVars.density(); - const auto heatCapacityW = FluidSystem::heatCapacity(volVars.fluidState(), 0); + const auto heatCapacityW = IapwsH2O::liquidHeatCapacity(someInitSol[temperatureIdx], someInitSol[pressureIdx]); const auto densityS = this->spatialParams().solidDensity(someElement, someScv, someElemSol); const auto heatCapacityS = this->spatialParams().solidHeatCapacity(someElement, someScv, someElemSol); const auto storage = densityW*heatCapacityW*porosity + densityS*heatCapacityS*(1 - porosity); @@ -165,20 +169,20 @@ public: someElement, fvGeometry, someScv); using std::max; time = max(time, 1e-10); - - for (const auto& element : elements(this->fvGeometry().gridView())) + for (const auto& element : elements(this->fvGridGeometry().gridView())) { auto fvGeometry = localView(this->fvGridGeometry()); fvGeometry.bindElement(element); for (auto&& scv : scvs(fvGeometry)) { - const auto globalIdx = scv.dofIndex(); - const auto& globalPos = scv.dofPosition(); - - using std::erf; using std::sqrt; - exactTemperature_[globalIdx] = temperatureHigh_ + (initSol[temperatureIdx] - temperatureHigh_) + auto globalIdx = scv.dofIndex(); + const auto& globalPos = scv.dofPosition(); + using std::erf; + using std::sqrt; + temperatureExact_[globalIdx] = temperatureHigh_ + (someInitSol[temperatureIdx] - temperatureHigh_) *erf(0.5*sqrt(globalPos[0]*globalPos[0]*storage/time/effectiveThermalConductivity)); + } } } @@ -276,8 +280,7 @@ private: Scalar temperatureHigh_; static constexpr Scalar eps_ = 1e-6; std::string name_; - int outputInterval_; - std::vector<Scalar> exactTemperature_; + std::vector<Scalar> temperatureExact_; }; } //end namespace Dumux diff --git a/test/porousmediumflow/1p/implicit/1pniconvectionproblem.hh b/test/porousmediumflow/1p/implicit/1pniconvectionproblem.hh index 885e93ce17..23937a7a15 100644 --- a/test/porousmediumflow/1p/implicit/1pniconvectionproblem.hh +++ b/test/porousmediumflow/1p/implicit/1pniconvectionproblem.hh @@ -46,7 +46,7 @@ namespace Properties NEW_TYPE_TAG(OnePNIConvectionProblem, INHERITS_FROM(OnePNI)); NEW_TYPE_TAG(OnePNIConvectionBoxProblem, INHERITS_FROM(BoxModel, OnePNIConvectionProblem)); -NEW_TYPE_TAG(OnePNIConvectionCCProblem, INHERITS_FROM(CCTpfaModel, OnePNIConvectionProblem)); +NEW_TYPE_TAG(OnePNIConvectionCCTpfaProblem, INHERITS_FROM(CCTpfaModel, OnePNIConvectionProblem)); NEW_TYPE_TAG(OnePNIConvectionCCMpfaProblem, INHERITS_FROM(CCMpfaModel, OnePNIConvectionProblem)); // Set the grid type @@ -102,11 +102,11 @@ class OnePNIConvectionProblem : public PorousMediumFlowProblem<TypeTag> using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); - using TimeManager = typename GET_PROP_TYPE(TypeTag, TimeManager); using ThermalConductivityModel = typename GET_PROP_TYPE(TypeTag, ThermalConductivityModel); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using VtkOutputModule = typename GET_PROP_TYPE(TypeTag, VtkOutputModule); + using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); + using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using IapwsH2O = H2O<Scalar>; // copy some indices for convenience @@ -116,9 +116,6 @@ class OnePNIConvectionProblem : public PorousMediumFlowProblem<TypeTag> dimWorld = GridView::dimensionworld }; - enum { isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox) }; - enum { dofCodim = isBox ? dimWorld : 0 }; - enum { // indices of the primary variables pressureIdx = Indices::pressureIdx, @@ -143,46 +140,41 @@ public: //initialize fluid system FluidSystem::init(); - std::string name = getParam<std::string>("Problem.Name"); - outputInterval_ = getParam<int>("Problem.OutputInterval"); + name_ = getParam<std::string>("Problem.Name"); darcyVelocity_ = getParam<Scalar>("Problem.DarcyVelocity"); temperatureHigh_ = 291.0; temperatureLow_ = 290.0; pressureHigh_ = 2e5; pressureLow_ = 1e5; - } + temperatureExact_.resize(this->fvGridGeometry().numDofs()); + } - bool shouldWriteOutput() const + //! Get exact temperature vector for output + const std::vector<Scalar>& getExactTemperature() { - return - this->timeManager().timeStepIndex() == 0 || - this->timeManager().timeStepIndex() % outputInterval_ == 0 || - this->timeManager().episodeWillBeFinished() || - this->timeManager().willBeFinished(); + return temperatureExact_; } - /*! - * \brief Adds additional VTK output data to the VTKWriter. Function is called by the output module on every write. - */ - void addVtkOutputFields(VtkOutputModule& outputModule) const + //! udpate the analytical temperature + void updateExactTemperature(const SolutionVector& curSol, Scalar time) { - auto& temperatureExact = outputModule.createScalarField("temperatureExact", dofCodim); + const auto someElement = *(elements(this->fvGridGeometry().gridView()).begin()); - const auto someElement = *(elements(this->gridView()).begin()); - const auto someElemSol = this->model().elementSolution(someElement, this->model().curSol()); + ElementSolutionVector someElemSol(someElement, curSol, this->fvGridGeometry()); + const auto someInitSol = initialAtPos(someElement.geometry().center()); - auto someFvGeometry = localView(this->model().fvGridGeometry()); - someFvGeometry.bindElement(someElement); - const auto someScv = *(scvs(someFvGeometry).begin()); + auto fvGeometry = localView(this->fvGridGeometry()); + fvGeometry.bindElement(someElement); + const auto someScv = *(scvs(fvGeometry).begin()); VolumeVariables volVars; volVars.update(someElemSol, *this, someElement, someScv); const auto porosity = this->spatialParams().porosity(someElement, someScv, someElemSol); const auto densityW = volVars.density(); - const auto heatCapacityW = FluidSystem::heatCapacity(volVars.fluidState(), 0); + const auto heatCapacityW = IapwsH2O::liquidHeatCapacity(someInitSol[temperatureIdx], someInitSol[pressureIdx]); const auto storageW = densityW*heatCapacityW*porosity; const auto densityS = this->spatialParams().solidDensity(someElement, someScv, someElemSol); const auto heatCapacityS = this->spatialParams().solidHeatCapacity(someElement, someScv, someElemSol); @@ -190,19 +182,19 @@ public: std::cout << "storage: " << storageTotal << '\n'; using std::max; - const Scalar time = max(this->timeManager().time() + this->timeManager().timeStepSize(), 1e-10); + time = max(time, 1e-10); const Scalar retardedFrontVelocity = darcyVelocity_*storageW/storageTotal/porosity; std::cout << "retarded velocity: " << retardedFrontVelocity << '\n'; - for (const auto& element : elements(this->gridView())) + for (const auto& element : elements(this->fvGridGeometry().gridView())) { - auto fvGeometry = localView(this->model().fvGridGeometry()); + auto fvGeometry = localView(this->fvGridGeometry()); fvGeometry.bindElement(element); for (auto&& scv : scvs(fvGeometry)) { auto dofIdxGlobal = scv.dofIndex(); auto dofPosition = scv.dofPosition(); - temperatureExact[dofIdxGlobal] = (dofPosition[0] < retardedFrontVelocity*time) ? temperatureHigh_ : temperatureLow_; + temperatureExact_[dofIdxGlobal] = (dofPosition[0] < retardedFrontVelocity*time) ? temperatureHigh_ : temperatureLow_; } } } @@ -304,17 +296,6 @@ public: */ // \{ - /*! - * \brief Return the sources within the domain. - * - * \param values Stores the source values, acts as return value - * \param globalPos The global position - */ - PrimaryVariables sourceAtPos(const GlobalPosition &globalPos) const - { - return PrimaryVariables(0); - } - /*! * \brief Evaluate the initial value for a control volume. * @@ -348,7 +329,7 @@ private: Scalar darcyVelocity_; static constexpr Scalar eps_ = 1e-6; std::string name_; - int outputInterval_; + std::vector<Scalar> temperatureExact_; }; } //end namespace Dumux diff --git a/test/porousmediumflow/1p/implicit/1ptestspatialparams.hh b/test/porousmediumflow/1p/implicit/1ptestspatialparams.hh index 2d1469f488..c8489ccf7f 100644 --- a/test/porousmediumflow/1p/implicit/1ptestspatialparams.hh +++ b/test/porousmediumflow/1p/implicit/1ptestspatialparams.hh @@ -39,10 +39,6 @@ namespace Properties { // The spatial parameters TypeTag NEW_TYPE_TAG(OnePTestSpatialParams); - -// Set properties of the porous medium -NEW_PROP_TAG(SpatialParamsRandomField); -SET_BOOL_PROP(OnePTestSpatialParams, SpatialParamsRandomField, false); } /*! @@ -62,7 +58,6 @@ class OnePTestSpatialParams : public ImplicitSpatialParamsOneP<TypeTag> using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); using IndexSet = typename GridView::IndexSet; - using ScalarVector = std::vector<Scalar>; using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); enum { @@ -82,12 +77,12 @@ public: randomPermeability_(problem.fvGridGeometry().gridView().size(dim), 0.0), indexSet_(problem.fvGridGeometry().gridView().indexSet()) { - randomField_ = getParam<bool>("SpatialParams.RandomField"); + randomField_ = getParam<bool>("SpatialParams.RandomField", false); permeability_ = getParam<Scalar>("SpatialParams.Permeability"); if(!randomField_) permeabilityLens_ = getParam<Scalar>("SpatialParams.PermeabilityLens"); else - initRandomField(problem.fvGridGeometry().gridView()); + initRandomField(problem.fvGridGeometry()); lensLowerLeft_ = getParam<GlobalPosition>("SpatialParams.LensLowerLeft"); lensUpperRight_ = getParam<GlobalPosition>("SpatialParams.LensUpperRight"); @@ -128,32 +123,32 @@ public: * * \param gridView The GridView used by the problem */ - void initRandomField(const GridView& gridView) + void initRandomField(const FVGridGeometry& gg) { + const auto& gridView = gg.gridView(); + const auto& elementMapper = gg.elementMapper(); const auto gStatControlFile = getParam<std::string>("Gstat.ControlFile"); const auto gStatInputFile = getParam<std::string>("Gstat.InputFile"); const auto outputFilePrefix = getParam<std::string>("Gstat.OutputFilePrefix"); // create random permeability object - GstatRandomField<GridView, Scalar> randomPermeabilityField(gridView); + using RandomField = GstatRandomField<GridView, Scalar>; + RandomField randomPermeabilityField(gridView, elementMapper); randomPermeabilityField.create(gStatControlFile, gStatInputFile, outputFilePrefix + ".dat", - GstatRandomField<GridView, Scalar>::FieldType::log10, + RandomField::FieldType::log10, true); randomPermeability_.resize(gridView.size(dim), 0.0); // copy vector from the temporary gstat object - for (const auto& element : elements(gridView)) - { - auto index = indexSet_.index(element.template subEntity<dim> (/*scvIdx=*/0)); - randomPermeability_[index] = randomPermeabilityField.data(element); - } - - // output the random field to vtk - randomPermeabilityField.writeVtk(outputFilePrefix, "absolute permeability"); + randomPermeability_ = randomPermeabilityField.data(); } + //! get the permeability field for output + const std::vector<Scalar>& getPermField() const + { return randomPermeability_; } + private: bool isInLens_(const GlobalPosition &globalPos) const { @@ -169,7 +164,7 @@ private: GlobalPosition lensUpperRight_; Scalar permeability_, permeabilityLens_; - ScalarVector randomPermeability_; + std::vector<Scalar> randomPermeability_; const IndexSet& indexSet_; static constexpr Scalar eps_ = 1.5e-7; diff --git a/test/porousmediumflow/1p/implicit/CMakeLists.txt b/test/porousmediumflow/1p/implicit/CMakeLists.txt index c8958e7f77..9b9167d9ae 100644 --- a/test/porousmediumflow/1p/implicit/CMakeLists.txt +++ b/test/porousmediumflow/1p/implicit/CMakeLists.txt @@ -36,87 +36,116 @@ dune_add_test(NAME test_1pbox --command "${CMAKE_CURRENT_BINARY_DIR}/test_1pbox test_1pfv.input -Problem.Name 1ptestbox") # a gstat test (becaue it's a random permeability field we can't test against a reference solution) -dune_add_test(SOURCES test_1pwithgstat.cc - COMPILE_DEFINITIONS TYPETAG=OnePTestCCTpfaProblem) -# -# # non-isothermal tests -# add_dumux_test(test_box1pniconduction test_box1pniconduction test_box1pniconduction.cc -# python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py -# --script fuzzy -# --files ${CMAKE_SOURCE_DIR}/test/references/1pniboxconduction-reference.vtu -# ${CMAKE_CURRENT_BINARY_DIR}/box1pniconduction-00006.vtu -# --command "${CMAKE_CURRENT_BINARY_DIR}/test_box1pniconduction" -# --zeroThreshold {"velocity_H2O":1e-8}) -# -# add_dumux_test(test_box1pniconvection test_box1pniconvection test_box1pniconvection.cc -# python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py -# --script fuzzy -# --files ${CMAKE_SOURCE_DIR}/test/references/1pniboxconvection-reference.vtu -# ${CMAKE_CURRENT_BINARY_DIR}/box1pniconvection-00010.vtu -# --command "${CMAKE_CURRENT_BINARY_DIR}/test_box1pniconvection" -# --zeroThreshold {"velocity":1e-15}) -# -# add_dumux_test(test_cc1pniconduction test_cc1pniconduction test_cc1pniconduction.cc -# python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py -# --script fuzzy -# --files ${CMAKE_SOURCE_DIR}/test/references/1pniccconduction-reference.vtu -# ${CMAKE_CURRENT_BINARY_DIR}/cc1pniconduction-00006.vtu -# --command "${CMAKE_CURRENT_BINARY_DIR}/test_cc1pniconduction" -# --zeroThreshold {"velocity":1e-8}) -# -# add_dumux_test(test_cc1pniconvection test_cc1pniconvection test_cc1pniconvection.cc -# python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py -# --script fuzzy -# --files ${CMAKE_SOURCE_DIR}/test/references/1pniccconvection-reference.vtu -# ${CMAKE_CURRENT_BINARY_DIR}/cc1pniconvection-00010.vtu -# --command "${CMAKE_CURRENT_BINARY_DIR}/test_cc1pniconvection") -# -# add_dumux_test(test_ccmpfa1pniconduction test_ccmpfa1pniconduction test_ccmpfa1pniconduction.cc -# python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py -# --script fuzzy -# --files ${CMAKE_SOURCE_DIR}/test/references/ccmpfa1pniconduction-reference.vtu -# ${CMAKE_CURRENT_BINARY_DIR}/ccmpfa1pniconduction-00006.vtu -# --command "${CMAKE_CURRENT_BINARY_DIR}/test_ccmpfa1pniconduction") -# -# add_dumux_test(test_ccmpfa1pniconvection test_ccmpfa1pniconvection test_ccmpfa1pniconvection.cc -# python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py -# --script fuzzy -# --files ${CMAKE_SOURCE_DIR}/test/references/ccmpfa1pniconvection-reference.vtu -# ${CMAKE_CURRENT_BINARY_DIR}/ccmpfa1pniconvection-00010.vtu -# --command "${CMAKE_CURRENT_BINARY_DIR}/test_ccmpfa1pniconvection") +dune_add_test(NAME test_1pwithgstat + SOURCES test_1pfv.cc + COMPILE_DEFINITIONS TYPETAG=OnePTestCCTpfaProblem + CMAKE_GUARD HAVE_GSTAT) + +# non-isothermal tests +dune_add_test(NAME test_1pnibox_conduction + SOURCES test_1pnifv.cc + COMPILE_DEFINITIONS TYPETAG=OnePNIConductionBoxProblem + COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py + CMD_ARGS --script fuzzy + --files ${CMAKE_SOURCE_DIR}/test/references/1pniboxconduction-reference.vtu + ${CMAKE_CURRENT_BINARY_DIR}/1pnibox_conduction-00006.vtu + --command "${CMAKE_CURRENT_BINARY_DIR}/test_1pnibox_conduction test_1pnifv_conduction.input -Problem.Name 1pnibox_conduction" + --zeroThreshold {"velocity_H2O":1e-8}) + +dune_add_test(NAME test_1pnibox_convection + SOURCES test_1pnifv.cc + COMPILE_DEFINITIONS TYPETAG=OnePNIConvectionBoxProblem + COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py + CMD_ARGS --script fuzzy + --files ${CMAKE_SOURCE_DIR}/test/references/1pniboxconvection-reference.vtu + ${CMAKE_CURRENT_BINARY_DIR}/1pnibox_convection-00010.vtu + --command "${CMAKE_CURRENT_BINARY_DIR}/test_1pnibox_convection test_1pnifv_convection.input -Problem.Name 1pnibox_convection" + --zeroThreshold {"velocity":1e-15}) + +dune_add_test(NAME test_1pnicctpfa_conduction + SOURCES test_1pnifv.cc + COMPILE_DEFINITIONS TYPETAG=OnePNIConductionCCTpfaProblem + COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py + CMD_ARGS --script fuzzy + --files ${CMAKE_SOURCE_DIR}/test/references/1pniccconduction-reference.vtu + ${CMAKE_CURRENT_BINARY_DIR}/1pnicctpfa_conduction-00006.vtu + --command "${CMAKE_CURRENT_BINARY_DIR}/test_1pnicctpfa_conduction test_1pnifv_conduction.input -Problem.Name 1pnicctpfa_conduction" + --zeroThreshold {"velocity":1e-8}) + +dune_add_test(NAME test_1pnicctpfa_convection + SOURCES test_1pnifv.cc + COMPILE_DEFINITIONS TYPETAG=OnePNIConvectionCCTpfaProblem + COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py + CMD_ARGS --script fuzzy + --files ${CMAKE_SOURCE_DIR}/test/references/1pniccconvection-reference.vtu + ${CMAKE_CURRENT_BINARY_DIR}/1pnicctpfa_convection-00010.vtu + --command "${CMAKE_CURRENT_BINARY_DIR}/test_1pnicctpfa_convection test_1pnifv_convection.input -Problem.Name 1pnicctpfa_convection") + +# TODO: Implement interaction volume handle? +# dune_add_test(NAME test_1pniccmpfa_conduction +# SOURCES test_1pnifv.cc +# COMPILE_DEFINITIONS TYPETAG=OnePNIConductionCCMpfaProblem +# COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py +# CMD_ARGS --script fuzzy +# --files ${CMAKE_SOURCE_DIR}/test/references/ccmpfa1pniconduction-reference.vtu +# ${CMAKE_CURRENT_BINARY_DIR}/1pniccmpfa_conduction-00006.vtu +# --command "${CMAKE_CURRENT_BINARY_DIR}/test_1pniccmpfa_conduction test_1pnifv_conduction.input -Problem.Name 1pniccmpfa_conduction") # -# dim < dimWorld tests with foamgrid +# dune_add_test(NAME test_1pniccmpfa_convection +# SOURCES test_1pnifv.cc +# COMPILE_DEFINITIONS TYPETAG=OnePNIConvectionCCMpfaProblem +# COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py +# CMD_ARGS --script fuzzy +# --files ${CMAKE_SOURCE_DIR}/test/references/ccmpfa1pniconvection-reference.vtu +# ${CMAKE_CURRENT_BINARY_DIR}/1pniccmpfa_convection-00010.vtu +# --command "${CMAKE_CURRENT_BINARY_DIR}/test_1pniccmpfa_convection test_1pnifv_convection.input -Problem.Name 1pniccmpfa_convection") + +# dim < dimWorld tests with Dune::Foamgrid<1,3> dune_add_test(NAME test_1pcctpfa_network1d3d SOURCES test_1pfv_network1d3d.cc COMPILE_DEFINITIONS TYPETAG=TubesTestCCTpfaProblem - COMMAND ./tubesconvergencetest.py test_1pcctpfa_network1d3d test_1pfv_network1d3d.input -Problem.Name test_1pcctpfa_network1d3d) + CMAKE_GUARD dune-foamgrid_FOUND + COMMAND ./tubesconvergencetest.py + CMD_ARGS test_1pcctpfa_network1d3d test_1pfv_network1d3d.input -Problem.Name test_1pcctpfa_network1d3d) dune_add_test(NAME test_1pbox_network1d3d SOURCES test_1pfv_network1d3d.cc COMPILE_DEFINITIONS TYPETAG=TubesTestBoxProblem - COMMAND ./tubesconvergencetest.py test_1pbox_network1d3d test_1pfv_network1d3d.input -Problem.Name test_1pbox_network1d3d) + CMAKE_GUARD dune-foamgrid_FOUND + COMMAND ./tubesconvergencetest.py + CMD_ARGS test_1pbox_network1d3d test_1pfv_network1d3d.input -Problem.Name test_1pbox_network1d3d) -# dune_add_test(SOURCES test_box1pnetwork1d3d.cc -# NAME test_box1pnetwork1d3d -# COMMAND ./tubesconvergencetest.py test_box1pnetwork1d3d) -# -# add_dumux_test(test_box1pfracture2d3d test_box1pfracture2d3d test_box1pfracture2d3d.cc -# python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py -# --script fuzzy -# --files ${CMAKE_SOURCE_DIR}/test/references/1pboxfracture2d3d-reference.vtu -# ${CMAKE_CURRENT_BINARY_DIR}/1pboxfracture2d3d-00001.vtu -# --command "${CMAKE_CURRENT_BINARY_DIR}/test_box1pfracture2d3d") -# -# dune_add_test(SOURCES test_cc1pnetwork1d3d.cc -# NAME test_cc1pnetwork1d3d -# COMMAND ./tubesconvergencetest.py test_cc1pnetwork1d3d) -# -# add_dumux_test(test_cc1pfracture2d3d test_cc1pfracture2d3d test_cc1pfracture2d3d.cc -# python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py -# --script fuzzy -# --files ${CMAKE_SOURCE_DIR}/test/references/1pccfracture2d3d-reference.vtu -# ${CMAKE_CURRENT_BINARY_DIR}/1pccfracture2d3d-00001.vtu -# --command "${CMAKE_CURRENT_BINARY_DIR}/test_cc1pfracture2d3d") +# dim < dimWorld tests with Dune::Foamgrid<2,3> +dune_add_test(NAME test_1pbox_fracture2d3d + SOURCES test_1pfv_fracture2d3d.cc + COMPILE_DEFINITIONS TYPETAG=FractureBoxProblem + CMAKE_GUARD dune-foamgrid_FOUND + COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py + CMD_ARGS --script fuzzy + --files ${CMAKE_SOURCE_DIR}/test/references/1pboxfracture2d3d-reference.vtu + ${CMAKE_CURRENT_BINARY_DIR}/1pbox_fracture2d3d-00001.vtu + --command "${CMAKE_CURRENT_BINARY_DIR}/test_1pbox_fracture2d3d test_1pfv_fracture2d3d.input -Problem.Name 1pbox_fracture2d3d") + +dune_add_test(NAME test_1pcctpfa_fracture2d3d + SOURCES test_1pfv_fracture2d3d.cc + COMPILE_DEFINITIONS TYPETAG=FractureCCTpfaProblem + CMAKE_GUARD dune-foamgrid_FOUND + COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py + CMD_ARGS --script fuzzy + --files ${CMAKE_SOURCE_DIR}/test/references/1pccfracture2d3d-reference.vtu + ${CMAKE_CURRENT_BINARY_DIR}/1pcctpfa_fracture2d3d-00001.vtu + --command "${CMAKE_CURRENT_BINARY_DIR}/test_1pcctpfa_fracture2d3d test_1pfv_fracture2d3d.input -Problem.Name 1pcctpfa_fracture2d3d") + +# TODO: Fix this test mpfa 2d3d! +# dune_add_test(NAME test_1pccmpfa_fracture2d3d +# SOURCES test_1pfv_fracture2d3d.cc +# COMPILE_DEFINITIONS TYPETAG=FractureCCMpfaProblem +# CMAKE_GUARD dune-foamgrid_FOUND +# COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py +# CMD_ARGS --script fuzzy +# --files ${CMAKE_SOURCE_DIR}/test/references/1pccfracture2d3d-reference.vtu +# ${CMAKE_CURRENT_BINARY_DIR}/1pccmpfa_fracture2d3d-00001.vtu +# --command "${CMAKE_CURRENT_BINARY_DIR}/test_1pccmpfa_fracture2d3d test_1pfv_fracture2d3d.input -Problem.Name 1pccmpfa_fracture2d3d") #install sources install(FILES @@ -129,18 +158,8 @@ fractureproblem.hh fracturespatialparams.hh tubesproblem.hh tubesspatialparams.hh -test_box1pfracture2d3d.cc -test_box1pnetwork1d3d.cc -test_box1p.cc -test_box1pniconduction.cc -test_box1pniconvection.cc -test_box1pwithamg.cc -test_cc1pfracture2d3d.cc -test_cc1pnetwork1d3d.cc -test_cc1p.cc -test_cc1pniconduction.cc -test_cc1pniconvection.cc -test_cc1pwithamg.cc -test_ccmpfa1pniconduction.cc -test_ccmpfa1pniconvection.cc +test_1pfv.cc +test_1pnifv.cc +test_1pfv_fracture2d3d.cc +test_1pfv_network1d3d.cc DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/test/implicit/1p) diff --git a/test/porousmediumflow/1p/implicit/compressible/test_1p.input b/test/porousmediumflow/1p/implicit/compressible/test_1p.input index 05d589ba34..f2f1e8b726 100644 --- a/test/porousmediumflow/1p/implicit/compressible/test_1p.input +++ b/test/porousmediumflow/1p/implicit/compressible/test_1p.input @@ -16,4 +16,3 @@ LensUpperRight = 0.8 0.8 Permeability = 1e-10 # [m^2] PermeabilityLens = 1e-12 # [m^2] -RandomField = false diff --git a/test/porousmediumflow/1p/implicit/fractureproblem.hh b/test/porousmediumflow/1p/implicit/fractureproblem.hh index a629ce6a56..5f331c11e7 100644 --- a/test/porousmediumflow/1p/implicit/fractureproblem.hh +++ b/test/porousmediumflow/1p/implicit/fractureproblem.hh @@ -45,13 +45,13 @@ namespace Properties { NEW_TYPE_TAG(FractureProblem, INHERITS_FROM(OneP, FractureSpatialParams)); NEW_TYPE_TAG(FractureBoxProblem, INHERITS_FROM(BoxModel, FractureProblem)); -NEW_TYPE_TAG(FractureCCProblem, INHERITS_FROM(CCTpfaModel, FractureProblem)); +NEW_TYPE_TAG(FractureCCTpfaProblem, INHERITS_FROM(CCTpfaModel, FractureProblem)); NEW_TYPE_TAG(FractureCCMpfaProblem, INHERITS_FROM(CCMpfaModel, FractureProblem)); //! Enable caching (more memory, but faster runtime) -SET_BOOL_PROP(FractureCCProblem, EnableFVGridGeometryCache, true); -SET_BOOL_PROP(FractureCCProblem, EnableGlobalVolumeVariablesCache, true); -SET_BOOL_PROP(FractureCCProblem, EnableGlobalFluxVariablesCache, true); +SET_BOOL_PROP(FractureProblem, EnableFVGridGeometryCache, true); +SET_BOOL_PROP(FractureProblem, EnableGlobalVolumeVariablesCache, true); +SET_BOOL_PROP(FractureProblem, EnableGlobalFluxVariablesCache, true); #if HAVE_DUNE_FOAMGRID SET_TYPE_PROP(FractureProblem, Grid, Dune::FoamGrid<2, 3>); diff --git a/test/porousmediumflow/1p/implicit/pointsources/1psingularityproblem.hh b/test/porousmediumflow/1p/implicit/pointsources/1psingularityproblem.hh index a50608bafa..c2e14adb08 100644 --- a/test/porousmediumflow/1p/implicit/pointsources/1psingularityproblem.hh +++ b/test/porousmediumflow/1p/implicit/pointsources/1psingularityproblem.hh @@ -25,9 +25,10 @@ #ifndef DUMUX_1P_SINGULARITY_PROBLEM_HH #define DUMUX_1P_SINGULARITY_PROBLEM_HH -#include <dumux/implicit/cellcentered/tpfa/properties.hh> +#include <dumux/discretization/cellcentered/tpfa/properties.hh> +#include <dumux/discretization/box/properties.hh> #include <dumux/porousmediumflow/1p/implicit/model.hh> -#include <dumux/porousmediumflow/implicit/problem.hh> +#include <dumux/porousmediumflow/problem.hh> #include <dumux/material/components/simpleh2o.hh> #include <dumux/material/fluidsystems/liquidphase.hh> @@ -40,11 +41,11 @@ class OnePSingularityProblem; namespace Properties { -NEW_TYPE_TAG(OnePSingularityProblem, INHERITS_FROM(OneP)); -NEW_TYPE_TAG(OnePSingularityBoxProblem, INHERITS_FROM(BoxModel, OnePSingularityProblem)); -NEW_TYPE_TAG(OnePSingularityCCProblem, INHERITS_FROM(CCTpfaModel, OnePSingularityProblem)); +NEW_TYPE_TAG(OnePSingularityTypeTag, INHERITS_FROM(OneP)); +NEW_TYPE_TAG(OnePSingularityBoxTypeTag, INHERITS_FROM(BoxModel, OnePSingularityTypeTag)); +NEW_TYPE_TAG(OnePSingularityCCTpfaTypeTag, INHERITS_FROM(CCTpfaModel, OnePSingularityTypeTag)); -SET_PROP(OnePSingularityProblem, Fluid) +SET_PROP(OnePSingularityTypeTag, Fluid) { private: typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; @@ -53,20 +54,14 @@ public: }; // Set the grid type -SET_TYPE_PROP(OnePSingularityProblem, Grid, +SET_TYPE_PROP(OnePSingularityTypeTag, Grid, Dune::YaspGrid<2, Dune::EquidistantOffsetCoordinates<typename GET_PROP_TYPE(TypeTag, Scalar), 2> >); // Set the problem property -SET_TYPE_PROP(OnePSingularityProblem, Problem, OnePSingularityProblem<TypeTag> ); +SET_TYPE_PROP(OnePSingularityTypeTag, Problem, OnePSingularityProblem<TypeTag> ); // Set the spatial parameters -SET_TYPE_PROP(OnePSingularityProblem, SpatialParams, OnePSingularitySpatialParams<TypeTag> ); - -// Linear solver settings -SET_TYPE_PROP(OnePSingularityProblem, LinearSolver, ILU0BiCGSTABBackend<TypeTag> ); - -// Enable gravity -SET_BOOL_PROP(OnePSingularityProblem, ProblemEnableGravity, false); +SET_TYPE_PROP(OnePSingularityTypeTag, SpatialParams, OnePSingularitySpatialParams<TypeTag> ); } /*! @@ -84,9 +79,9 @@ SET_BOOL_PROP(OnePSingularityProblem, ProblemEnableGravity, false); * <tt>./test_cc1p_pointsources</tt> */ template <class TypeTag> -class OnePSingularityProblem : public ImplicitPorousMediaProblem<TypeTag> +class OnePSingularityProblem : public PorousMediumFlowProblem<TypeTag> { - using ParentType = ImplicitPorousMediaProblem<TypeTag>; + using ParentType = PorousMediumFlowProblem<TypeTag>; using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); @@ -105,15 +100,15 @@ class OnePSingularityProblem : public ImplicitPorousMediaProblem<TypeTag> using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); - using TimeManager = typename GET_PROP_TYPE(TypeTag, TimeManager); using PointSource = typename GET_PROP_TYPE(TypeTag, PointSource); + using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>; public: - OnePSingularityProblem(TimeManager &timeManager, const GridView &gridView) - : ParentType(timeManager, gridView) + OnePSingularityProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry) + : ParentType(fvGridGeometry) { - name_ = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, std::string, Problem, Name); + name_ = getParam<std::string>("Problem.Name"); } /*! @@ -173,19 +168,6 @@ public: return initialAtPos(globalPos); } - /*! - * \brief Evaluate the boundary conditions for a neumann - * boundary segment. - * - * For this method, the \a priVars parameter stores the mass flux - * in normal direction of each component. Negative values mean - * influx. - */ - PrimaryVariables neumannAtPos(const GlobalPosition& globalPos) const - { - return PrimaryVariables(0.0); - } - // \} /*! @@ -193,17 +175,6 @@ public: */ // \{ - /*! - * \brief Return the sources within the domain. - * - * \param values Stores the source values, acts as return value - * \param globalPos The global position - */ - PrimaryVariables sourceAtPos(const GlobalPosition &globalPos) const - { - return PrimaryVariables(0.0); - } - /*! * \brief Applies a vector of point sources. The point sources * are possibly solution dependent. @@ -241,6 +212,6 @@ private: std::string name_; }; -} //end namespace +} //end namespace Dumux #endif diff --git a/test/porousmediumflow/1p/implicit/pointsources/1psingularityproblemtimedependent.hh b/test/porousmediumflow/1p/implicit/pointsources/1psingularityproblemtimedependent.hh index 64263a9fbf..ad01ca8c0c 100644 --- a/test/porousmediumflow/1p/implicit/pointsources/1psingularityproblemtimedependent.hh +++ b/test/porousmediumflow/1p/implicit/pointsources/1psingularityproblemtimedependent.hh @@ -25,12 +25,6 @@ #ifndef DUMUX_1P_SINGULARITY_TIME_DEP_PROBLEM_HH #define DUMUX_1P_SINGULARITY_TIME_DEP_PROBLEM_HH -#include <dumux/implicit/cellcentered/tpfa/properties.hh> -#include <dumux/porousmediumflow/1p/implicit/model.hh> -#include <dumux/porousmediumflow/implicit/problem.hh> -#include <dumux/material/components/simpleh2o.hh> -#include <dumux/material/fluidsystems/liquidphase.hh> - #include "1psingularityproblem.hh" namespace Dumux @@ -40,13 +34,13 @@ class OnePSingularityProblemTimeDependent; namespace Properties { -NEW_TYPE_TAG(OnePSingularityProblemTimeDependent, INHERITS_FROM(OnePSingularityCCProblem)); +NEW_TYPE_TAG(OnePSingularityTimeDependentCCTpfaTypeTag, INHERITS_FROM(OnePSingularityCCTpfaTypeTag)); // Set the problem property -SET_TYPE_PROP(OnePSingularityProblemTimeDependent, Problem, OnePSingularityProblemTimeDependent<TypeTag>); +SET_TYPE_PROP(OnePSingularityTimeDependentCCTpfaTypeTag, Problem, OnePSingularityProblemTimeDependent<TypeTag>); // point source -SET_TYPE_PROP(OnePSingularityProblemTimeDependent, PointSource, SolDependentPointSource<TypeTag>); +SET_TYPE_PROP(OnePSingularityTimeDependentCCTpfaTypeTag, PointSource, SolDependentPointSource<TypeTag>); } /*! @@ -71,7 +65,6 @@ class OnePSingularityProblemTimeDependent : public OnePSingularityProblem<TypeTa using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); - using TimeManager = typename GET_PROP_TYPE(TypeTag, TimeManager); using PointSource = typename GET_PROP_TYPE(TypeTag, PointSource); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); @@ -79,13 +72,14 @@ class OnePSingularityProblemTimeDependent : public OnePSingularityProblem<TypeTa using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); static const int dimWorld = GridView::dimensionworld; using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>; public: - OnePSingularityProblemTimeDependent(TimeManager &timeManager, const GridView &gridView) - : ParentType(timeManager, gridView) + OnePSingularityProblemTimeDependent(std::shared_ptr<const FVGridGeometry> fvGridGeometry) + : ParentType(fvGridGeometry) {} /*! @@ -108,18 +102,28 @@ public: void addPointSources(std::vector<PointSource>& pointSources) const { // inject <time> kg/s water at position (0, 0), where <time> is the current simulation time - // we use t+1 because this is an implicit Euler scheme auto function = [](const Problem& problem, const Element& element, const FVElementGeometry& fvGeometry, const ElementVolumeVariables& elemVolVars, const SubControlVolume& scv) - { return PrimaryVariables(problem.timeManager().time() + problem.timeManager().timeStepSize()); }; + { return PrimaryVariables(problem.getTime()); }; pointSources.push_back(PointSource({0.0, 0.0}, function)); } + + //! Set the current time at which we evaluate the source + void setTime(Scalar time) + { time_ = time; } + + //! Set the current time at which we evaluate the source + Scalar getTime() const + { return time_; } + +private: + Scalar time_ = 0.0; }; -} //end namespace +} //end namespace Dumux #endif diff --git a/test/porousmediumflow/1p/implicit/pointsources/1psingularityspatialparams.hh b/test/porousmediumflow/1p/implicit/pointsources/1psingularityspatialparams.hh index 7f8120b1b9..ec2fe32672 100644 --- a/test/porousmediumflow/1p/implicit/pointsources/1psingularityspatialparams.hh +++ b/test/porousmediumflow/1p/implicit/pointsources/1psingularityspatialparams.hh @@ -52,11 +52,11 @@ public: // export permeability type using PermeabilityType = Scalar; - OnePSingularitySpatialParams(const Problem& problem, const GridView& gridView) - : ParentType(problem, gridView) + OnePSingularitySpatialParams(const Problem& problem) + : ParentType(problem) { - permeability_ = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, Scalar, SpatialParams, Permeability); - porosity_= GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, Scalar, SpatialParams, Porosity); + permeability_ = getParam<Scalar>("SpatialParams.Permeability"); + porosity_= getParam<Scalar>("SpatialParams.Porosity"); } /*! diff --git a/test/porousmediumflow/1p/implicit/pointsources/CMakeLists.txt b/test/porousmediumflow/1p/implicit/pointsources/CMakeLists.txt index 1fd5f32914..efca5c1889 100644 --- a/test/porousmediumflow/1p/implicit/pointsources/CMakeLists.txt +++ b/test/porousmediumflow/1p/implicit/pointsources/CMakeLists.txt @@ -1,31 +1,38 @@ add_input_file_links() -add_dumux_test(test_cc1p_pointsources test_cc1p_pointsources test_cc1p_pointsources.cc - python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py - --script fuzzy - --files ${CMAKE_SOURCE_DIR}/test/references/1psingularitycc-reference.vtu - ${CMAKE_CURRENT_BINARY_DIR}/1psingularitycc-00001.vtu - --command "${CMAKE_CURRENT_BINARY_DIR}/test_cc1p_pointsources") +dune_add_test(NAME test_1pcctpfa_pointsources + SOURCES test_1pfv_pointsources.cc + COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py + COMPILE_DEFINITIONS TYPETAG=OnePSingularityCCTpfaTypeTag + CMD_ARGS --script fuzzy + --files ${CMAKE_SOURCE_DIR}/test/references/1psingularitycc-reference.vtu + ${CMAKE_CURRENT_BINARY_DIR}/1pcctpfa_singularity-00001.vtu + --command "${CMAKE_CURRENT_BINARY_DIR}/test_1pcctpfa_pointsources test_1pfv_pointsources.input -Problem.Name 1pcctpfa_singularity") -add_dumux_test(test_cc1p_pointsources_timedependent test_cc1p_pointsources_timedependent test_cc1p_pointsources_timedependent.cc - python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py - --script fuzzy - --files ${CMAKE_SOURCE_DIR}/test/references/1psingularitycctimedependent-reference.vtu - ${CMAKE_CURRENT_BINARY_DIR}/1psingularitycctimedependent-00003.vtu - --command "${CMAKE_CURRENT_BINARY_DIR}/test_cc1p_pointsources_timedependent -ParameterFile test_cc1p_pointsources.input -TimeManager.TEnd 4 -Problem.Name 1psingularitycctimedependent") +dune_add_test(NAME test_1pcctpfa_pointsources_timedependent + SOURCES test_1pfv_pointsources_timedependent.cc + COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py + COMPILE_DEFINITIONS TYPETAG=OnePSingularityTimeDependentCCTpfaTypeTag + CMD_ARGS --script fuzzy + --files ${CMAKE_SOURCE_DIR}/test/references/1psingularitycctimedependent-reference.vtu + ${CMAKE_CURRENT_BINARY_DIR}/1pcctpfa_singularity_timedependent-00003.vtu + --command "${CMAKE_CURRENT_BINARY_DIR}/test_1pcctpfa_pointsources_timedependent test_1pfv_pointsources.input -TimeLoop.TEnd 4 -Problem.Name 1pcctpfa_singularity_timedependent") -add_dumux_test(test_box1p_pointsources test_box1p_pointsources test_box1p_pointsources.cc - python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py - --script fuzzy - --files ${CMAKE_SOURCE_DIR}/test/references/1psingularitybox-reference.vtu - ${CMAKE_CURRENT_BINARY_DIR}/1psingularitybox-00001.vtu - --command "${CMAKE_CURRENT_BINARY_DIR}/test_box1p_pointsources") +dune_add_test(NAME test_1pbox_pointsources + SOURCES test_1pfv_pointsources.cc + COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py + COMPILE_DEFINITIONS TYPETAG=OnePSingularityBoxTypeTag + CMD_ARGS --script fuzzy + --files ${CMAKE_SOURCE_DIR}/test/references/1psingularitybox-reference.vtu + ${CMAKE_CURRENT_BINARY_DIR}/1pbox_singularity-00001.vtu + --command "${CMAKE_CURRENT_BINARY_DIR}/test_1pbox_pointsources test_1pfv_pointsources.input -Problem.Name 1pbox_singularity") #install sources install(FILES 1psingularityproblem.hh +1psingularityproblemtimedependent.hh 1psingularityspatialparams.hh -test_cc1p_pointsources.cc -test_box1p_pointsources.cc +test_1p_pointsources.cc +test_1p_pointsources_timedependent.cc DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/test/porousmediumflow/1p/implicit/pointsources) diff --git a/test/porousmediumflow/1p/implicit/test_cc1pwithgstat.cc b/test/porousmediumflow/1p/implicit/pointsources/test_1pfv_pointsources.cc similarity index 73% rename from test/porousmediumflow/1p/implicit/test_cc1pwithgstat.cc rename to test/porousmediumflow/1p/implicit/pointsources/test_1pfv_pointsources.cc index f81f722750..c7cb58f5b7 100644 --- a/test/porousmediumflow/1p/implicit/test_cc1pwithgstat.cc +++ b/test/porousmediumflow/1p/implicit/pointsources/test_1pfv_pointsources.cc @@ -19,8 +19,7 @@ /*! * \file * - * \brief test for the one-phase CC model on geostatistical random field - * generated by gstat + * \brief test for the one-phase model with point sources */ #include <config.h> @@ -33,7 +32,7 @@ #include <dune/grid/io/file/vtk.hh> #include <dune/istl/io.hh> -#include "1ptestproblem.hh" +#include "1psingularityproblem.hh" #include <dumux/common/propertysystem.hh> #include <dumux/common/parameters.hh> @@ -52,43 +51,8 @@ #include <dumux/io/vtkoutputmodule.hh> -/*! - * \brief Provides an interface for customizing error messages associated with - * reading in parameters. - * - * \param progName The name of the program, that was tried to be started. - * \param errorMsg The error message that was issued by the start function. - * Comprises the thing that went wrong and a general help message. - */ -void usage(const char *progName, const std::string &errorMsg) -{ - if (errorMsg.size() > 0) { - std::string errorMessageOut = "\nUsage: "; - errorMessageOut += progName; - errorMessageOut += " [options]\n"; - errorMessageOut += errorMsg; - errorMessageOut += "\n\nThe list of mandatory arguments for this program is:\n" - "\t-TimeManager.TEnd End of the simulation [s] \n" - "\t-TimeManager.DtInitial Initial timestep size [s] \n" - "\t-Grid.LowerLeft Lower left corner coordinates\n" - "\t-Grid.UpperRight Upper right corner coordinates\n" - "\t-Grid.Cells Number of cells in respective coordinate directions\n" - "\t-SpatialParams.RandomField Set true to use a random field generated by gstat \n" - "\t-SpatialParams.LensLowerLeft Coordinates of the lower left corner of the lens [m] \n" - "\t-SpatialParams.LensUpperRight Coordinates of the upper right corner of the lens [m] \n" - "\t-SpatialParams.Permeability Permeability of the domain [m^2] \n" - "\t-Gstat.ControlFile Control file for generating geostatistical field using gstat \n" - "\t-Gstat.InputFile Input file generated for gstat \n" - "\t-Gstat.OutputFilePrefix Prefix of the output file generated by gstat and for the vtu\n"; - - std::cout << errorMessageOut - << "\n"; - } -} - int main(int argc, char** argv) try { -#if HAVE_GSTAT using namespace Dumux; // define the type tag for this problem @@ -102,7 +66,7 @@ int main(int argc, char** argv) try DumuxMessage::print(/*firstCall=*/true); // parse command line arguments and input file - Parameters::init(argc, argv, usage); + Parameters::init(argc, argv); // try to create a grid (from the given grid file or the input file) using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); @@ -126,9 +90,8 @@ int main(int argc, char** argv) try auto problem = std::make_shared<Problem>(fvGridGeometry); // the solution vector - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - SolutionVector x(leafGridView.size(GridView::dimension)); + SolutionVector x(fvGridGeometry->numDofs()); problem->applyInitialSolution(x); auto xOld = x; @@ -165,11 +128,11 @@ int main(int argc, char** argv) try // the linear solver using LinearSolver = AMGBackend<TypeTag>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->elementMapper()); + auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->dofMapper()); // the non-linear solver - using NewtonController = NewtonController<TypeTag>; - using NewtonMethod = NewtonMethod<TypeTag, NewtonController, Assembler, LinearSolver>; + using NewtonController = Dumux::NewtonController<TypeTag>; + using NewtonMethod = NewtonMethod<NewtonController, Assembler, LinearSolver>; auto newtonController = std::make_shared<NewtonController>(leafGridView.comm(), timeLoop); NewtonMethod nonLinearSolver(newtonController, assembler, linearSolver); @@ -230,13 +193,6 @@ int main(int argc, char** argv) try } return 0; - -#else -#warning External geostatistical module gstat needed to run this example. - std::cerr << "Test skipped, it needs gstat!" << std::endl; - return 77; -#endif - } // end main catch (Dumux::ParameterException &e) { diff --git a/test/porousmediumflow/1p/implicit/pointsources/test_box1p_pointsources.input b/test/porousmediumflow/1p/implicit/pointsources/test_1pfv_pointsources.input similarity index 74% rename from test/porousmediumflow/1p/implicit/pointsources/test_box1p_pointsources.input rename to test/porousmediumflow/1p/implicit/pointsources/test_1pfv_pointsources.input index 1b471e1d05..e19a25b1c3 100644 --- a/test/porousmediumflow/1p/implicit/pointsources/test_box1p_pointsources.input +++ b/test/porousmediumflow/1p/implicit/pointsources/test_1pfv_pointsources.input @@ -1,4 +1,4 @@ -[TimeManager] +[TimeLoop] DtInitial = 1 # [s] TEnd = 1 # [s] @@ -8,7 +8,8 @@ UpperRight = 1 1 Cells = 100 100 [Problem] -Name = 1psingularitybox +Name = 1pfv_singularity +EnableGravity = false [SpatialParams] Permeability = 1e-10 # [m^2] diff --git a/test/porousmediumflow/1p/implicit/test_cc1pniconvection.cc b/test/porousmediumflow/1p/implicit/pointsources/test_1pfv_pointsources_timedependent.cc similarity index 81% rename from test/porousmediumflow/1p/implicit/test_cc1pniconvection.cc rename to test/porousmediumflow/1p/implicit/pointsources/test_1pfv_pointsources_timedependent.cc index edd26d36c4..1321385759 100644 --- a/test/porousmediumflow/1p/implicit/test_cc1pniconvection.cc +++ b/test/porousmediumflow/1p/implicit/pointsources/test_1pfv_pointsources_timedependent.cc @@ -19,7 +19,7 @@ /*! * \file * - * \brief test for the 1pni CC model + * \brief test for the one-phase model with point sources */ #include <config.h> @@ -32,7 +32,7 @@ #include <dune/grid/io/file/vtk.hh> #include <dune/istl/io.hh> -#include "1pniconvectionproblem.hh" +#include "1psingularityproblemtimedependent.hh" #include <dumux/common/propertysystem.hh> #include <dumux/common/parameters.hh> @@ -51,32 +51,6 @@ #include <dumux/io/vtkoutputmodule.hh> -/*! - * \brief Provides an interface for customizing error messages associated with - * reading in parameters. - * - * \param progName The name of the program, that was tried to be started. - * \param errorMsg The error message that was issued by the start function. - * Comprises the thing that went wrong and a general help message. - */ -void usage(const char *progName, const std::string &errorMsg) -{ - if (errorMsg.size() > 0) { - std::string errorMessageOut = "\nUsage: "; - errorMessageOut += progName; - errorMessageOut += " [options]\n"; - errorMessageOut += errorMsg; - errorMessageOut += "\n\nThe list of mandatory options for this program is:\n" - "\t-TimeManager.TEnd End of the simulation [s] \n" - "\t-TimeManager.DtInitial Initial timestep size [s] \n" - "\t-Grid.LowerLeft Lower left corner coordinates\n" - "\t-Grid.UpperRight Upper right corner coordinates\n" - "\t-Grid.Cells Number of cells in respective coordinate directions\n"; - std::cout << errorMessageOut - << "\n"; - } -} - int main(int argc, char** argv) try { using namespace Dumux; @@ -92,7 +66,7 @@ int main(int argc, char** argv) try DumuxMessage::print(/*firstCall=*/true); // parse command line arguments and input file - Parameters::init(argc, argv, usage); + Parameters::init(argc, argv); // try to create a grid (from the given grid file or the input file) using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); @@ -116,9 +90,8 @@ int main(int argc, char** argv) try auto problem = std::make_shared<Problem>(fvGridGeometry); // the solution vector - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - SolutionVector x(leafGridView.size(GridView::dimension)); + SolutionVector x(fvGridGeometry->numDofs()); problem->applyInitialSolution(x); auto xOld = x; @@ -155,11 +128,11 @@ int main(int argc, char** argv) try // the linear solver using LinearSolver = AMGBackend<TypeTag>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->elementMapper()); + auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->dofMapper()); // the non-linear solver - using NewtonController = NewtonController<TypeTag>; - using NewtonMethod = NewtonMethod<TypeTag, NewtonController, Assembler, LinearSolver>; + using NewtonController = Dumux::NewtonController<TypeTag>; + using NewtonMethod = NewtonMethod<NewtonController, Assembler, LinearSolver>; auto newtonController = std::make_shared<NewtonController>(leafGridView.comm(), timeLoop); NewtonMethod nonLinearSolver(newtonController, assembler, linearSolver); @@ -169,6 +142,9 @@ int main(int argc, char** argv) try // set previous solution for storage evaluations assembler->setPreviousSolution(xOld); + // set the time in the problem for implicit Euler scheme + problem->setTime(timeLoop->time() + timeLoop->timeStepSize()); + // try solving the non-linear system for (int i = 0; i < maxDivisions; ++i) { diff --git a/test/porousmediumflow/1p/implicit/pointsources/test_box1p_pointsources.cc b/test/porousmediumflow/1p/implicit/pointsources/test_box1p_pointsources.cc deleted file mode 100644 index 383c5b6b70..0000000000 --- a/test/porousmediumflow/1p/implicit/pointsources/test_box1p_pointsources.cc +++ /dev/null @@ -1,61 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -// vi: set et ts=4 sw=4 sts=4: -/***************************************************************************** - * See the file COPYING for full copying permissions. * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see <http://www.gnu.org/licenses/>. * - *****************************************************************************/ -/*! - * \file - * - * \brief test for the one-phase box model with pointsources - */ -#include <config.h> -#include "1psingularityproblem.hh" -#include <dumux/common/start.hh> - -/*! - * \brief Provides an interface for customizing error messages associated with - * reading in parameters. - * - * \param progName The name of the program, that was tried to be started. - * \param errorMsg The error message that was issued by the start function. - * Comprises the thing that went wrong and a general help message. - */ -void usage(const char *progName, const std::string &errorMsg) -{ - if (errorMsg.size() > 0) { - std::string errorMessageOut = "\nUsage: "; - errorMessageOut += progName; - errorMessageOut += " [options]\n"; - errorMessageOut += errorMsg; - errorMessageOut += "\n\nThe list of mandatory arguments for this program is:\n" - "\t-TimeManager.TEnd End of the simulation [s] \n" - "\t-TimeManager.DtInitial Initial timestep size [s] \n" - "\t-Grid.LowerLeft Lower left corner coordinates\n" - "\t-Grid.UpperRight Upper right corner coordinates\n" - "\t-Grid.Cells Number of cells in respective coordinate directions\n" - "\t-SpatialParams.Permeability The intrinsic permeability in m2\n" - "\t-SpatialParams.Porosity The porosity\n"; - - std::cout << errorMessageOut - << "\n"; - } -} - -int main(int argc, char** argv) -{ - typedef TTAG(OnePSingularityBoxProblem) ProblemTypeTag; - return Dumux::start<ProblemTypeTag>(argc, argv, usage); -} diff --git a/test/porousmediumflow/1p/implicit/pointsources/test_cc1p_pointsources.cc b/test/porousmediumflow/1p/implicit/pointsources/test_cc1p_pointsources.cc deleted file mode 100644 index 5edc18e450..0000000000 --- a/test/porousmediumflow/1p/implicit/pointsources/test_cc1p_pointsources.cc +++ /dev/null @@ -1,61 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -// vi: set et ts=4 sw=4 sts=4: -/***************************************************************************** - * See the file COPYING for full copying permissions. * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see <http://www.gnu.org/licenses/>. * - *****************************************************************************/ -/*! - * \file - * - * \brief test for the one-phase CC model with pointsources - */ -#include <config.h> -#include "1psingularityproblem.hh" -#include <dumux/common/start.hh> - -/*! - * \brief Provides an interface for customizing error messages associated with - * reading in parameters. - * - * \param progName The name of the program, that was tried to be started. - * \param errorMsg The error message that was issued by the start function. - * Comprises the thing that went wrong and a general help message. - */ -void usage(const char *progName, const std::string &errorMsg) -{ - if (errorMsg.size() > 0) { - std::string errorMessageOut = "\nUsage: "; - errorMessageOut += progName; - errorMessageOut += " [options]\n"; - errorMessageOut += errorMsg; - errorMessageOut += "\n\nThe list of mandatory arguments for this program is:\n" - "\t-TimeManager.TEnd End of the simulation [s] \n" - "\t-TimeManager.DtInitial Initial timestep size [s] \n" - "\t-Grid.LowerLeft Lower left corner coordinates\n" - "\t-Grid.UpperRight Upper right corner coordinates\n" - "\t-Grid.Cells Number of cells in respective coordinate directions\n" - "\t-SpatialParams.Permeability The intrinsic permeability in m2\n" - "\t-SpatialParams.Porosity The porosity\n"; - - std::cout << errorMessageOut - << "\n"; - } -} - -int main(int argc, char** argv) -{ - typedef TTAG(OnePSingularityCCProblem) ProblemTypeTag; - return Dumux::start<ProblemTypeTag>(argc, argv, usage); -} diff --git a/test/porousmediumflow/1p/implicit/pointsources/test_cc1p_pointsources.input b/test/porousmediumflow/1p/implicit/pointsources/test_cc1p_pointsources.input deleted file mode 100644 index 53fa1292e8..0000000000 --- a/test/porousmediumflow/1p/implicit/pointsources/test_cc1p_pointsources.input +++ /dev/null @@ -1,15 +0,0 @@ -[TimeManager] -DtInitial = 1 # [s] -TEnd = 1 # [s] - -[Grid] -LowerLeft = -1 -1 -UpperRight = 1 1 -Cells = 100 100 - -[Problem] -Name = 1psingularitycc - -[SpatialParams] -Permeability = 1e-10 # [m^2] -Porosity = 0.3 diff --git a/test/porousmediumflow/1p/implicit/pointsources/test_cc1p_pointsources_timedependent.cc b/test/porousmediumflow/1p/implicit/pointsources/test_cc1p_pointsources_timedependent.cc deleted file mode 100644 index c700376698..0000000000 --- a/test/porousmediumflow/1p/implicit/pointsources/test_cc1p_pointsources_timedependent.cc +++ /dev/null @@ -1,61 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -// vi: set et ts=4 sw=4 sts=4: -/***************************************************************************** - * See the file COPYING for full copying permissions. * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see <http://www.gnu.org/licenses/>. * - *****************************************************************************/ -/*! - * \file - * - * \brief test for the one-phase CC model with time dependent pointsources - */ -#include <config.h> -#include "1psingularityproblemtimedependent.hh" -#include <dumux/common/start.hh> - -/*! - * \brief Provides an interface for customizing error messages associated with - * reading in parameters. - * - * \param progName The name of the program, that was tried to be started. - * \param errorMsg The error message that was issued by the start function. - * Comprises the thing that went wrong and a general help message. - */ -void usage(const char *progName, const std::string &errorMsg) -{ - if (errorMsg.size() > 0) { - std::string errorMessageOut = "\nUsage: "; - errorMessageOut += progName; - errorMessageOut += " [options]\n"; - errorMessageOut += errorMsg; - errorMessageOut += "\n\nThe list of mandatory arguments for this program is:\n" - "\t-TimeManager.TEnd End of the simulation [s] \n" - "\t-TimeManager.DtInitial Initial timestep size [s] \n" - "\t-Grid.LowerLeft Lower left corner coordinates\n" - "\t-Grid.UpperRight Upper right corner coordinates\n" - "\t-Grid.Cells Number of cells in respective coordinate directions\n" - "\t-SpatialParams.Permeability The intrinsic permeability in m2\n" - "\t-SpatialParams.Porosity The porosity\n"; - - std::cout << errorMessageOut - << "\n"; - } -} - -int main(int argc, char** argv) -{ - typedef TTAG(OnePSingularityProblemTimeDependent) ProblemTypeTag; - return Dumux::start<ProblemTypeTag>(argc, argv, usage); -} diff --git a/test/porousmediumflow/1p/implicit/test_1pfv.cc b/test/porousmediumflow/1p/implicit/test_1pfv.cc index 1a2523307e..c4fdf40a32 100644 --- a/test/porousmediumflow/1p/implicit/test_1pfv.cc +++ b/test/porousmediumflow/1p/implicit/test_1pfv.cc @@ -147,6 +147,11 @@ int main(int argc, char** argv) try using VtkOutputFields = typename GET_PROP_TYPE(TypeTag, VtkOutputFields); VtkOutputModule<TypeTag> vtkWriter(*problem, *fvGridGeometry, *gridVariables, x, problem->name()); VtkOutputFields::init(vtkWriter); //! Add model specific output fields + + // if we are using a random permeability field with gstat + bool isRandomField = getParam<bool>("SpatialParams.RandomField", false); + if(isRandomField) vtkWriter.addField(problem->spatialParams().getPermField(), "K"); + vtkWriter.write(0.0); // instantiate time loop diff --git a/test/porousmediumflow/1p/implicit/test_1pfv.input b/test/porousmediumflow/1p/implicit/test_1pfv.input index 394ef0c4be..91f7620d48 100644 --- a/test/porousmediumflow/1p/implicit/test_1pfv.input +++ b/test/porousmediumflow/1p/implicit/test_1pfv.input @@ -16,5 +16,3 @@ LensUpperRight = 0.8 0.8 Permeability = 1e-10 # [m^2] PermeabilityLens = 1e-12 # [m^2] - -RandomField = false diff --git a/test/porousmediumflow/1p/implicit/test_cc1pfracture2d3d.cc b/test/porousmediumflow/1p/implicit/test_1pfv_fracture2d3d.cc similarity index 96% rename from test/porousmediumflow/1p/implicit/test_cc1pfracture2d3d.cc rename to test/porousmediumflow/1p/implicit/test_1pfv_fracture2d3d.cc index 5134b32d4e..ccf0b3ce2e 100644 --- a/test/porousmediumflow/1p/implicit/test_cc1pfracture2d3d.cc +++ b/test/porousmediumflow/1p/implicit/test_1pfv_fracture2d3d.cc @@ -115,9 +115,8 @@ int main(int argc, char** argv) try auto problem = std::make_shared<Problem>(fvGridGeometry); // the solution vector - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - SolutionVector x(leafGridView.size(GridView::dimension)); + SolutionVector x(fvGridGeometry->numDofs()); problem->applyInitialSolution(x); auto xOld = x; @@ -154,11 +153,11 @@ int main(int argc, char** argv) try // the linear solver using LinearSolver = AMGBackend<TypeTag>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->elementMapper()); + auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->dofMapper()); // the non-linear solver - using NewtonController = NewtonController<TypeTag>; - using NewtonMethod = NewtonMethod<TypeTag, NewtonController, Assembler, LinearSolver>; + using NewtonController = Dumux::NewtonController<TypeTag>; + using NewtonMethod = NewtonMethod<NewtonController, Assembler, LinearSolver>; auto newtonController = std::make_shared<NewtonController>(leafGridView.comm(), timeLoop); NewtonMethod nonLinearSolver(newtonController, assembler, linearSolver); diff --git a/test/porousmediumflow/1p/implicit/test_1pfv_fracture2d3d.input b/test/porousmediumflow/1p/implicit/test_1pfv_fracture2d3d.input new file mode 100644 index 0000000000..e57ffebd69 --- /dev/null +++ b/test/porousmediumflow/1p/implicit/test_1pfv_fracture2d3d.input @@ -0,0 +1,10 @@ +[TimeLoop] +DtInitial = 1 # [s] +TEnd = 1 # [s] + +[Grid] +File = grids/fracture2d3d.msh + +[Problem] +Name = 1pfv_fracture2d3d # name passed to the output routines +EnableGravity = false diff --git a/test/porousmediumflow/1p/implicit/test_cc1pniconduction.cc b/test/porousmediumflow/1p/implicit/test_1pnifv.cc similarity index 92% rename from test/porousmediumflow/1p/implicit/test_cc1pniconduction.cc rename to test/porousmediumflow/1p/implicit/test_1pnifv.cc index 64627ab40a..890a7ee15c 100644 --- a/test/porousmediumflow/1p/implicit/test_cc1pniconduction.cc +++ b/test/porousmediumflow/1p/implicit/test_1pnifv.cc @@ -33,6 +33,7 @@ #include <dune/istl/io.hh> #include "1pniconductionproblem.hh" +#include "1pniconvectionproblem.hh" #include <dumux/common/propertysystem.hh> #include <dumux/common/parameters.hh> @@ -116,9 +117,8 @@ int main(int argc, char** argv) try auto problem = std::make_shared<Problem>(fvGridGeometry); // the solution vector - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - SolutionVector x(leafGridView.size(GridView::dimension)); + SolutionVector x(fvGridGeometry->numDofs()); problem->applyInitialSolution(x); auto xOld = x; @@ -143,8 +143,12 @@ int main(int argc, char** argv) try using VtkOutputFields = typename GET_PROP_TYPE(TypeTag, VtkOutputFields); VtkOutputModule<TypeTag> vtkWriter(*problem, *fvGridGeometry, *gridVariables, x, problem->name()); VtkOutputFields::init(vtkWriter); //! Add model specific output fields + vtkWriter.addField(problem->getExactTemperature(), "temperatureExact"); vtkWriter.write(0.0); + // output every vtkOutputInterval time step + const int vtkOutputInterval = getParam<int>("Problem.OutputInterval"); + // instantiate time loop auto timeLoop = std::make_shared<TimeLoop<Scalar>>(restartTime, dt, tEnd); timeLoop->setMaxTimeStepSize(maxDt); @@ -155,11 +159,11 @@ int main(int argc, char** argv) try // the linear solver using LinearSolver = AMGBackend<TypeTag>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->elementMapper()); + auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->dofMapper()); // the non-linear solver - using NewtonController = NewtonController<TypeTag>; - using NewtonMethod = NewtonMethod<TypeTag, NewtonController, Assembler, LinearSolver>; + using NewtonController = Dumux::NewtonController<TypeTag>; + using NewtonMethod = NewtonMethod<NewtonController, Assembler, LinearSolver>; auto newtonController = std::make_shared<NewtonController>(leafGridView.comm(), timeLoop); NewtonMethod nonLinearSolver(newtonController, assembler, linearSolver); @@ -188,6 +192,9 @@ int main(int argc, char** argv) try << "have been saved to restart files."); } + // compute the new analytical temperature field for the output + problem->updateExactTemperature(x, timeLoop->time()+timeLoop->timeStepSize()); + // make the new solution the old solution xOld = x; gridVariables->advanceTimeStep(); @@ -195,15 +202,15 @@ int main(int argc, char** argv) try // advance to the time loop to the next step timeLoop->advanceTimeStep(); - // write vtk output - vtkWriter.write(timeLoop->time()); - // report statistics of this time step timeLoop->reportTimeStep(); // set new dt as suggested by newton controller timeLoop->setTimeStepSize(newtonController->suggestTimeStepSize(timeLoop->timeStepSize())); + if (timeLoop->timeStepIndex()==0 || timeLoop->timeStepIndex() % vtkOutputInterval == 0 || timeLoop->willBeFinished()) + vtkWriter.write(timeLoop->time()); + } while (!timeLoop->finished()); timeLoop->finalize(leafGridView.comm()); diff --git a/test/porousmediumflow/1p/implicit/test_1pnifv_conduction.input b/test/porousmediumflow/1p/implicit/test_1pnifv_conduction.input new file mode 100644 index 0000000000..57679c856b --- /dev/null +++ b/test/porousmediumflow/1p/implicit/test_1pnifv_conduction.input @@ -0,0 +1,18 @@ +[TimeLoop] +DtInitial = 1 # [s] +TEnd = 1e5 # [s] +MaxTimeStepSize = 1e10 + +[Grid] +LowerLeft = 0 0 +UpperRight = 5 1 +Cells = 200 1 + +[Problem] +Name = 1pnifv_conduction # name passed to the output routines +OutputInterval = 5 # every 5th timestep an output file is written +DarcyVelocity = 1e-4 # [m/s] inflow at the left boundary +EnableGravity = false # disable gravity + +[Vtk] +AddVelocity = true # enable velocity output diff --git a/test/porousmediumflow/1p/implicit/test_cc1pniconvection.input b/test/porousmediumflow/1p/implicit/test_1pnifv_convection.input similarity index 61% rename from test/porousmediumflow/1p/implicit/test_cc1pniconvection.input rename to test/porousmediumflow/1p/implicit/test_1pnifv_convection.input index eb923a7d81..6d12eb481f 100644 --- a/test/porousmediumflow/1p/implicit/test_cc1pniconvection.input +++ b/test/porousmediumflow/1p/implicit/test_1pnifv_convection.input @@ -1,4 +1,4 @@ -[TimeManager] +[TimeLoop] DtInitial = 1 # [s] TEnd = 3e4 # [s] MaxTimeStepSize = 1e3 @@ -9,10 +9,10 @@ UpperRight = 20 1 Cells = 80 1 [Problem] -Name = cc1pniconvection # name passed to the output routines +Name = 1pnifv_conduction # name passed to the output routines OutputInterval = 5 # every 5th timestep an output file is written DarcyVelocity = 1e-4 # [m/s] inflow at the left boundary -EnableGravity = 0 # Disable gravity +EnableGravity = false # Disable gravity [Vtk] -AddVelocity = 1 # enable velocity output +AddVelocity = true # enable velocity output diff --git a/test/porousmediumflow/1p/implicit/test_cc1pwithgstat.input b/test/porousmediumflow/1p/implicit/test_1pwithgstat.input similarity index 96% rename from test/porousmediumflow/1p/implicit/test_cc1pwithgstat.input rename to test/porousmediumflow/1p/implicit/test_1pwithgstat.input index f370921891..724aa0b3aa 100644 --- a/test/porousmediumflow/1p/implicit/test_cc1pwithgstat.input +++ b/test/porousmediumflow/1p/implicit/test_1pwithgstat.input @@ -1,4 +1,4 @@ -[TimeManager] +[TimeLoop] DtInitial = 1 # [s] TEnd = 10 # [s] diff --git a/test/porousmediumflow/1p/implicit/test_cc1pfracture2d3d.input b/test/porousmediumflow/1p/implicit/test_cc1pfracture2d3d.input deleted file mode 100644 index 2683beff98..0000000000 --- a/test/porousmediumflow/1p/implicit/test_cc1pfracture2d3d.input +++ /dev/null @@ -1,9 +0,0 @@ -[TimeManager] -DtInitial = 1 # [s] -TEnd = 1 # [s] - -[Grid] -File = grids/fracture2d3d.msh - -[Problem] -Name = 1pccfracture2d3d # name passed to the output routines diff --git a/test/porousmediumflow/1p/implicit/test_cc1pniconduction.input b/test/porousmediumflow/1p/implicit/test_cc1pniconduction.input deleted file mode 100644 index 6766493626..0000000000 --- a/test/porousmediumflow/1p/implicit/test_cc1pniconduction.input +++ /dev/null @@ -1,17 +0,0 @@ -[TimeManager] -DtInitial = 1 # [s] -TEnd = 1e5 # [s] -MaxTimeStepSize = 1e10 - -[Grid] -LowerLeft = 0 0 -UpperRight = 5 1 -Cells = 200 1 - -[Problem] -Name = cc1pniconduction # name passed to the output routines -OutputInterval = 5 # every 5th timestep an output file is written -EnableGravity = 0 # disable gravity - -[Vtk] -AddVelocity= 1 # enable velocity output diff --git a/test/porousmediumflow/1p/implicit/test_ccmpfa1p.cc b/test/porousmediumflow/1p/implicit/test_ccmpfa1p.cc deleted file mode 100644 index 75a9505b7a..0000000000 --- a/test/porousmediumflow/1p/implicit/test_ccmpfa1p.cc +++ /dev/null @@ -1,64 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -// vi: set et ts=4 sw=4 sts=4: -/***************************************************************************** - * See the file COPYING for full copying permissions. * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see <http://www.gnu.org/licenses/>. * - *****************************************************************************/ -/*! - * \file - * - * \brief test for the one-phase CC model - */ -#include <config.h> -#include "1ptestproblem.hh" -#include <dumux/common/start.hh> - -/*! - * \brief Provides an interface for customizing error messages associated with - * reading in parameters. - * - * \param progName The name of the program, that was tried to be started. - * \param errorMsg The error message that was issued by the start function. - * Comprises the thing that went wrong and a general help message. - */ -void usage(const char *progName, const std::string &errorMsg) -{ - if (errorMsg.size() > 0) { - std::string errorMessageOut = "\nUsage: "; - errorMessageOut += progName; - errorMessageOut += " [options]\n"; - errorMessageOut += errorMsg; - errorMessageOut += "\n\nThe list of mandatory arguments for this program is:\n" - "\t-TimeManager.TEnd End of the simulation [s] \n" - "\t-TimeManager.DtInitial Initial timestep size [s] \n" - "\t-Grid.File Name of the file containing the grid \n" - "\t definition in DGF format\n" - "\t-SpatialParams.LensLowerLeftX x-coordinate of the lower left corner of the lens [m] \n" - "\t-SpatialParams.LensLowerLeftY y-coordinate of the lower left corner of the lens [m] \n" - "\t-SpatialParams.LensUpperRightX x-coordinate of the upper right corner of the lens [m] \n" - "\t-SpatialParams.LensUpperRightY y-coordinate of the upper right corner of the lens [m] \n" - "\t-SpatialParams.Permeability Permeability of the domain [m^2] \n" - "\t-SpatialParams.PermeabilityLens Permeability of the lens [m^2] \n"; - - std::cout << errorMessageOut - << "\n"; - } -} - -int main(int argc, char** argv) -{ - typedef TTAG(OnePTestCCMpfaProblem) ProblemTypeTag; - return Dumux::start<ProblemTypeTag>(argc, argv, usage); -} diff --git a/test/porousmediumflow/1p/implicit/test_ccmpfa1p.input b/test/porousmediumflow/1p/implicit/test_ccmpfa1p.input deleted file mode 100644 index a94210a2d1..0000000000 --- a/test/porousmediumflow/1p/implicit/test_ccmpfa1p.input +++ /dev/null @@ -1,18 +0,0 @@ -[TimeManager] -DtInitial = 1 # [s] -TEnd = 1 # [s] - -[Grid] -UpperRight = 1 1 -Cells = 10 10 - -[Problem] -Name = 1ptestccmpfa # name passed to the output routines - -[SpatialParams] -LensLowerLeft = 0.2 0.2 # [m] -LensUpperRight = 0.8 0.8 # [m] - -Permeability = 1e-10 # [m^2] -PermeabilityLens = 1e-12 # [m^2] - diff --git a/test/references/1pniccconvection-reference.vtu b/test/references/1pniccconvection-reference.vtu index 2ede38f126..6e08a4666a 100644 --- a/test/references/1pniccconvection-reference.vtu +++ b/test/references/1pniccconvection-reference.vtu @@ -2,8 +2,8 @@ <VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian"> <UnstructuredGrid> <Piece NumberOfCells="80" NumberOfPoints="162"> - <CellData Scalars="p" Vectors="velocity"> - <DataArray type="Float32" Name="p" NumberOfComponents="1" format="ascii"> + <CellData Scalars="p" Vectors="velocity_H2O (m/s)"> + <DataArray type="Float32" Name="pressure" NumberOfComponents="1" format="ascii"> 121429 121165 120901 120637 120373 120108 119844 119580 119316 119052 118788 118524 118259 117994 117729 117463 117196 116928 116659 116390 116120 115850 115580 115309 115038 114767 114497 114226 113955 113684 113413 113142 112871 112600 112329 112058 @@ -12,7 +12,7 @@ 105284 105013 104742 104471 104200 103929 103658 103387 103116 102845 102574 102303 102032 101761 101490 101219 100948 100677 100406 100135 </DataArray> - <DataArray type="Float32" Name="velocity" NumberOfComponents="3" format="ascii"> + <DataArray type="Float32" Name="velocity_H2O (m/s)" NumberOfComponents="3" format="ascii"> 0.0001 0 0 0.0001 0 0 0.0001 0 0 0.0001 0 0 0.0001 0 0 0.0001 0 0 0.0001 0 0 0.0001 0 0 0.0001 0 0 0.0001 0 0 0.0001 0 0 0.0001 0 0 -- GitLab