diff --git a/test/freeflow/navierstokes/channel/1d/main.cc b/test/freeflow/navierstokes/channel/1d/main.cc index 4fcd1157e7bef377f440fa44b3cbc6065494bbd8..98be4afae7ba10ccda35551d8531006c784cb62d 100644 --- a/test/freeflow/navierstokes/channel/1d/main.cc +++ b/test/freeflow/navierstokes/channel/1d/main.cc @@ -120,7 +120,7 @@ int main(int argc, char** argv) try nonLinearSolver.solve(x); // write vtk output - problem->postTimeStep(x); + problem->printL2Error(x); vtkWriter.write(1.0); timer.stop(); diff --git a/test/freeflow/navierstokes/channel/1d/problem.hh b/test/freeflow/navierstokes/channel/1d/problem.hh index 74652383053661284d1f8afebdc770fc7b38c9c8..600c58a163c9933c842d79a207628095755fdf51 100644 --- a/test/freeflow/navierstokes/channel/1d/problem.hh +++ b/test/freeflow/navierstokes/channel/1d/problem.hh @@ -124,7 +124,7 @@ public: return false; } - void postTimeStep(const SolutionVector& curSol) const + void printL2Error(const SolutionVector& curSol) const { if(printL2Error_) { diff --git a/test/freeflow/navierstokes/donea/main.cc b/test/freeflow/navierstokes/donea/main.cc index 7196c57a900be112b6f89fde079cb15e29c16443..79d9334fb7791d01f6731bb18bc5226db1314d60 100644 --- a/test/freeflow/navierstokes/donea/main.cc +++ b/test/freeflow/navierstokes/donea/main.cc @@ -121,7 +121,7 @@ int main(int argc, char** argv) try nonLinearSolver.solve(x); // write vtk output - problem->postTimeStep(x); + problem->printL2Error(x); vtkWriter.write(1.0); timer.stop(); diff --git a/test/freeflow/navierstokes/donea/problem.hh b/test/freeflow/navierstokes/donea/problem.hh index 768297b70eed7b4ca0c16f0f611c98856a72cfc5..0c89e873b5e04ba72ae21f3f7ec9f88b5b14894c 100644 --- a/test/freeflow/navierstokes/donea/problem.hh +++ b/test/freeflow/navierstokes/donea/problem.hh @@ -122,7 +122,7 @@ public: return false; } - void postTimeStep(const SolutionVector& curSol) const + void printL2Error(const SolutionVector& curSol) const { if(printL2Error_) { diff --git a/test/freeflow/navierstokes/kovasznay/main.cc b/test/freeflow/navierstokes/kovasznay/main.cc index 1f5de8be37a99d4308974a34cbcfde0cd9237ec9..61477a2dea3fa5dd474aea681e2672b1a1ae0ed1 100644 --- a/test/freeflow/navierstokes/kovasznay/main.cc +++ b/test/freeflow/navierstokes/kovasznay/main.cc @@ -121,7 +121,7 @@ int main(int argc, char** argv) try // write vtk output vtkWriter.write(1.0); - problem->postTimeStep(x); + problem->printL2Error(x); timer.stop(); diff --git a/test/freeflow/navierstokes/kovasznay/problem.hh b/test/freeflow/navierstokes/kovasznay/problem.hh index 2385f1da92c45c958cc05cfc15527a32186f423f..bbbb7ab1ec1dab8c282c93977486df2f1cbda0d9 100644 --- a/test/freeflow/navierstokes/kovasznay/problem.hh +++ b/test/freeflow/navierstokes/kovasznay/problem.hh @@ -123,7 +123,7 @@ public: return false; } - void postTimeStep(const SolutionVector& curSol) const + void printL2Error(const SolutionVector& curSol) const { if(printL2Error_) { diff --git a/test/freeflow/navierstokesnc/maxwellstefan/main.cc b/test/freeflow/navierstokesnc/maxwellstefan/main.cc index acc302a408e404e5f4c2fe4203d40d68adc8822f..8353e0eb53e5712c3305eb44940510389cf90a29 100644 --- a/test/freeflow/navierstokesnc/maxwellstefan/main.cc +++ b/test/freeflow/navierstokesnc/maxwellstefan/main.cc @@ -139,7 +139,7 @@ int main(int argc, char** argv) try // make the new solution the old solution xOld = x; gridVariables->advanceTimeStep(); - problem->postTimeStep(x, *gridVariables,timeLoop->time()+timeLoop->timeStepSize()); + problem->plotComponentsOverTime(x, *gridVariables,timeLoop->time()+timeLoop->timeStepSize()); // advance to the time loop to the next step timeLoop->advanceTimeStep(); diff --git a/test/freeflow/navierstokesnc/maxwellstefan/problem.hh b/test/freeflow/navierstokesnc/maxwellstefan/problem.hh index eaf7e238bde6ec271da94bc6c6241418cba182aa..c2774ae59cf72a4b8d7b252706627acf6096b5e3 100644 --- a/test/freeflow/navierstokesnc/maxwellstefan/problem.hh +++ b/test/freeflow/navierstokesnc/maxwellstefan/problem.hh @@ -247,9 +247,9 @@ public: * \param time The time */ template<class SolutionVector, class GridVariables> - void postTimeStep(const SolutionVector& curSol, - const GridVariables& gridVariables, - const Scalar time) + void plotComponentsOverTime(const SolutionVector& curSol, + const GridVariables& gridVariables, + const Scalar time) { if (plotOutput_) diff --git a/test/multidomain/boundary/stokesdarcy/1p2c_2p2c/main.cc b/test/multidomain/boundary/stokesdarcy/1p2c_2p2c/main.cc index bdc19fa31f600a45167bd8c1cd7868203e40a551..969927d79f36f9e2c4c46ce4ca40ec651876fd8a 100644 --- a/test/multidomain/boundary/stokesdarcy/1p2c_2p2c/main.cc +++ b/test/multidomain/boundary/stokesdarcy/1p2c_2p2c/main.cc @@ -237,7 +237,7 @@ int main(int argc, char** argv) try // make the new solution the old solution solOld = sol; - darcyProblem->postTimeStep(sol[darcyIdx], *darcyGridVariables, timeLoop->timeStepSize()); + darcyProblem->printWaterMass(sol[darcyIdx], *darcyGridVariables, timeLoop->timeStepSize()); stokesGridVariables->advanceTimeStep(); darcyGridVariables->advanceTimeStep(); diff --git a/test/multidomain/boundary/stokesdarcy/1p2c_2p2c/problem_darcy.hh b/test/multidomain/boundary/stokesdarcy/1p2c_2p2c/problem_darcy.hh index f477c6681733012d07418f07ff6650990ec0b2eb..b7c966b640b69be3a891d27434d0d5df9af711c5 100644 --- a/test/multidomain/boundary/stokesdarcy/1p2c_2p2c/problem_darcy.hh +++ b/test/multidomain/boundary/stokesdarcy/1p2c_2p2c/problem_darcy.hh @@ -150,9 +150,9 @@ public: // \{ template<class SolutionVector, class GridVariables> - void postTimeStep(const SolutionVector& curSol, - const GridVariables& gridVariables, - const Scalar timeStepSize) + void printWaterMass(const SolutionVector& curSol, + const GridVariables& gridVariables, + const Scalar timeStepSize) { // compute the mass in the entire domain diff --git a/test/porousmediumflow/1p/implicit/fracture2d3d/problem.hh b/test/porousmediumflow/1p/implicit/fracture2d3d/problem.hh index b8ff602b90d41993e6a14d7929ce64289db8f102..d3610094aba356a738a858c0c8df263e661d1905 100644 --- a/test/porousmediumflow/1p/implicit/fracture2d3d/problem.hh +++ b/test/porousmediumflow/1p/implicit/fracture2d3d/problem.hh @@ -141,23 +141,6 @@ public: return name_; } - /*! - * \brief User defined output after the time integration - * - * Will be called diretly after the time integration. - */ - // void postTimeStep() - // { - // // Calculate storage terms - // PrimaryVariables storage; - // this->model().globalStorage(storage); - // - // // Write mass balance information for rank 0 - // if (this->gridView().comm().rank() == 0) { - // std::cout<<"Storage: " << storage << std::endl; - // } - // } - /*! * \brief Returns the temperature \f$ K \f$ * diff --git a/test/porousmediumflow/mpnc/implicit/kinetic/plotoverline2d.hh b/test/porousmediumflow/mpnc/implicit/kinetic/plotoverline2d.hh deleted file mode 100644 index aa06c37da764575030e0b517a68d9d436cb7cd6b..0000000000000000000000000000000000000000 --- a/test/porousmediumflow/mpnc/implicit/kinetic/plotoverline2d.hh +++ /dev/null @@ -1,209 +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 3 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 - * \ingroup MPNCTests - * \brief Plot variables over a line specified by two arguments. - * These output files are meant for visualization with another - * program (matlab, gnuplot...) - */ -#ifndef DUMUX_PLOTOVERLINE_2D_HH -#define DUMUX_PLOTOVERLINE_2D_HH - -#include <dumux/common/valgrind.hh> -#include <dumux/common/properties.hh> - -#include <dune/common/fvector.hh> -#include <dune/common/fmatrix.hh> -#include <dune/grid/common/rangegenerators.hh> - -#include <iostream> -#include <fstream> - -namespace Dumux { - -/*! - * \ingroup MPNCTests - * \brief Plot variables over a line specified by two arguments. - * These output files are meant for visualization with another - * program (matlab, gnuplot...) - */ -template<class TypeTag> -class PlotOverLine2D -{ - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using Problem = GetPropType<TypeTag, Properties::Problem>; - using GridView = GetPropType<TypeTag, Properties::GridView>; - - using FVElementGeometry = typename GetPropType<TypeTag, Properties::FVGridGeometry>::LocalView; - using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; - - using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView; - using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; - - enum { - wPhaseIdx = FluidSystem::wPhaseIdx, - nPhaseIdx = FluidSystem::nPhaseIdx, - sPhaseIdx = FluidSystem::sPhaseIdx, - wCompIdx = FluidSystem::wCompIdx, - nCompIdx = FluidSystem::nCompIdx, - - // Grid and world dimension - dim = GridView::dimension, - dimWorld = GridView::dimensionworld, - }; - using Element = typename GridView::template Codim<0>::Entity; - - using GlobalPosition = typename Element::Geometry::GlobalCoordinate; - -public: - /*! - * \brief A function that writes results over a line (like paraview's plotOverline into a text file.) - * - * The writer needs to be called in postTimeStep(). - * - * This function puts output variables (TemperaturePhase, Saturation, t, tIndex, ...) - * over space (1D, over a line) into a text file, - * so they can be read in by another program like matlab. - * The file can be found by the extension: dat - */ - void write(const Problem & problem, - const GlobalPosition & pointOne, - const GlobalPosition & pointTwo, - const bool appendData, - const std::string appendOutputName = "") - { - static_assert(dim==2, "this implements plot over Line: so far this works only for 2D"); - - FVElementGeometry fvGeometry; - ElementVolumeVariables elemVolVars; - - // so many vertices in the domain - const unsigned int numGlobalVerts = problem.gridView().size(dim); - - // check whether a vertex was already visited by true / false vector - std::vector<bool> isVisited(numGlobalVerts); - std::fill(isVisited.begin(), isVisited.end(), false); - - - // filename of the output file - std::string fileName = problem.name(); - fileName += appendOutputName; - fileName += ".dat"; - std::ofstream dataFile; - const unsigned int timeStepIndex = problem.timeManager().timeStepIndex(); - - // Writing a header into the output - if (timeStepIndex == 0 || !appendData) - { - dataFile.open(fileName.c_str()); - dataFile << "# This is a DuMuX output file for further processing with the preferred graphics program of your choice. \n"; - - dataFile << "# This output file was written from "<< __FILE__ << ", line " <<__LINE__ << "\n"; - dataFile << "# This output file was generated from code compiled at " << __TIME__ <<", "<< __DATE__<< "\n"; - dataFile << "\n"; - dataFile << "# Header\n"; - dataFile << "#timestep time x y Sw Tw Tn Ts xH2On xH2OnEquil xN2w xN2wEquil\n"; - dataFile.close(); - } - - // Looping over all elements of the domain - for (const auto& element : elements(problem.gridView())) - { - // updating the volume variables - fvGeometry.update(problem.gridView(), element); - elemVolVars.update(problem, element, fvGeometry, false); - - // number of scv - const unsigned int numScv = fvGeometry.numScv; - - for (unsigned int scvIdx=0; scvIdx < numScv; ++scvIdx) - { - // find some global identification - const unsigned int vIdxGlobal = problem.vertexMapper().subIndex(element, scvIdx, dim); - - // only write out if the vertex was not already visited - if (isVisited[vIdxGlobal]) - continue; - - isVisited[vIdxGlobal] = true ; - - // Getting the spatial coordinate - const GlobalPosition & globalPosCurrent - = fvGeometry.subContVol[scvIdx].global; - - // write output if the current location is between two specified points - if (isBetween(globalPosCurrent, pointOne, pointTwo)) - { - const Scalar time = problem.timeManager().time(); - const Scalar saturationW = elemVolVars[scvIdx].saturation(wPhaseIdx); - const Scalar Tw = elemVolVars[scvIdx].temperature(wPhaseIdx); - const Scalar Tn = elemVolVars[scvIdx].temperature(nPhaseIdx); - const Scalar Ts = elemVolVars[scvIdx].temperature(sPhaseIdx); - const Scalar xH2On = elemVolVars[scvIdx].moleFraction(nPhaseIdx, wCompIdx); - const Scalar xH2OnEquil = elemVolVars[scvIdx].xEquil(nPhaseIdx, wCompIdx); - const Scalar xN2w = elemVolVars[scvIdx].moleFraction(wPhaseIdx, nCompIdx); - const Scalar xN2wEquil = elemVolVars[scvIdx].xEquil(wPhaseIdx, nCompIdx); - - // actual output into the text file - // This could be done much more efficiently - // if writing to the text file would be done all at once. - dataFile.open(fileName.c_str(), std::ios::app); - dataFile << timeStepIndex - <<" " - << time - << " " - << globalPosCurrent[0] - << " " - << globalPosCurrent[1]; - - dataFile <<" " - << saturationW - <<" " << Tw - <<" " << Tn - <<" " << Ts - <<" " << xH2On - <<" " << xH2OnEquil - <<" " << xN2w - <<" " << xN2wEquil - ; - dataFile <<"\n"; - dataFile.close(); - } - } - } - return ; - } - - /*! - * \brief Checks whether the current point is on a line between two points - */ - bool isBetween(const GlobalPosition & globalPosCurrent, - const GlobalPosition & pointOne, - const GlobalPosition & pointTwo) const - { - return ( pointOne[0] - globalPosCurrent[0] <= 1e-5 - and pointOne[1] - globalPosCurrent[1] <= 1e-5 - and globalPosCurrent[0] - pointTwo[0] <= 1e-5 - and globalPosCurrent[1] - pointTwo[1] <= 1e-5 ); - } -}; - -} -#endif diff --git a/test/porousmediumflow/mpnc/implicit/kinetic/problem.hh b/test/porousmediumflow/mpnc/implicit/kinetic/problem.hh index 7bd9aa8b531b8bad9aaab96fa79d1b309c0a1a91..e539043254e9d4ed5786c8056dc35ccf595e74cd 100644 --- a/test/porousmediumflow/mpnc/implicit/kinetic/problem.hh +++ b/test/porousmediumflow/mpnc/implicit/kinetic/problem.hh @@ -51,8 +51,6 @@ #include <dumux/porousmediumflow/problem.hh> #include <dumux/material/fluidsystems/h2on2kinetic.hh> -#include <dumux/io/gnuplotinterface.hh> -#include "plotoverline2d.hh" #include <dumux/material/components/constant.hh> #include "spatialparams.hh" diff --git a/test/porousmediumflow/richardsnc/implicit/main.cc b/test/porousmediumflow/richardsnc/implicit/main.cc index 176b285f56d779c50af82965b8839f215b435314..38c106bc6499a98df41f6735ff3adbd9158c5142 100644 --- a/test/porousmediumflow/richardsnc/implicit/main.cc +++ b/test/porousmediumflow/richardsnc/implicit/main.cc @@ -167,7 +167,7 @@ int main(int argc, char** argv) try // make the new solution the old solution xOld = x; - problem->postTimeStep(x, *gridVariables, timeLoop->timeStepSize()); + problem->printTracerMass(x, *gridVariables, timeLoop->timeStepSize()); gridVariables->advanceTimeStep(); // advance to the time loop to the next step diff --git a/test/porousmediumflow/richardsnc/implicit/problem.hh b/test/porousmediumflow/richardsnc/implicit/problem.hh index 5911e2e1960bb9d0cd909058d9e3fce4689c2df8..f3a2115aa2cd7be6416957c18806a1946cabbde0 100644 --- a/test/porousmediumflow/richardsnc/implicit/problem.hh +++ b/test/porousmediumflow/richardsnc/implicit/problem.hh @@ -150,9 +150,9 @@ public: accumulatedSource_ = 0.0; } - void postTimeStep(const SolutionVector& curSol, - const GridVariables& gridVariables, - const Scalar timeStepSize) + void printTracerMass(const SolutionVector& curSol, + const GridVariables& gridVariables, + const Scalar timeStepSize) { // compute the mass in the entire domain to make sure the tracer is conserved diff --git a/test/porousmediumflow/tracer/multicomp/main.cc b/test/porousmediumflow/tracer/multicomp/main.cc index ecaf001ee10527823a736a1f37db37e19c13ae3a..452261b25f678c9d400d9a024b4314118870a54f 100644 --- a/test/porousmediumflow/tracer/multicomp/main.cc +++ b/test/porousmediumflow/tracer/multicomp/main.cc @@ -173,7 +173,7 @@ int main(int argc, char** argv) try // make the new solution the old solution xOld = x; gridVariables->advanceTimeStep(); - problem->postTimeStep(x, timeLoop->time() + timeLoop->timeStepSize()); + problem->plotComponentsOverTime(x, timeLoop->time() + timeLoop->timeStepSize()); // advance to the time loop to the next step timeLoop->advanceTimeStep(); diff --git a/test/porousmediumflow/tracer/multicomp/problem.hh b/test/porousmediumflow/tracer/multicomp/problem.hh index d2f204b0d2cbbe7b51b629c9136051b495306e4a..a681ae81a92083aa7e5c35166a0a8eb290a1eca9 100644 --- a/test/porousmediumflow/tracer/multicomp/problem.hh +++ b/test/porousmediumflow/tracer/multicomp/problem.hh @@ -254,7 +254,7 @@ public: { return name_; } //! Called after every time step - void postTimeStep(const SolutionVector& curSol, Scalar time) + void plotComponentsOverTime(const SolutionVector& curSol, Scalar time) { if (plotOutput_) {