From 95138cd75d22bf1010cf73c900e019c137dfaf49 Mon Sep 17 00:00:00 2001 From: Markus Wolff <markus.wolff@twt-gmbh.de> Date: Mon, 13 Feb 2012 07:47:11 +0000 Subject: [PATCH] added exact solution of the test diffusion problem as additional output git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@7721 2fb0f335-1f38-0410-981e-8018bf24f1b0 --- test/decoupled/1p/test_diffusion_problem.hh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/test/decoupled/1p/test_diffusion_problem.hh b/test/decoupled/1p/test_diffusion_problem.hh index 6994a18581..d270b47ad0 100644 --- a/test/decoupled/1p/test_diffusion_problem.hh +++ b/test/decoupled/1p/test_diffusion_problem.hh @@ -197,6 +197,7 @@ class TestDiffusionProblem: public DiffusionProblem2P<TypeTag> typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; + typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::Traits::template Codim<0>::Entity Element; typedef typename GridView::Intersection Intersection; typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; @@ -204,12 +205,13 @@ class TestDiffusionProblem: public DiffusionProblem2P<TypeTag> public: typedef typename GET_PROP(TypeTag, SolutionTypes) SolutionTypes; typedef typename SolutionTypes::PrimaryVariables PrimaryVariables; + typedef typename SolutionTypes::ScalarSolution ScalarSolution; TestDiffusionProblem(const GridView &gridView, const double delta = 1.0) : ParentType(gridView), delta_(delta), velocity_(*this) {} - //!initializes the saturation and afterwards the model + //!for this specific problem: initialize the saturation and afterwards the model void init() { this->variables().initialize(); @@ -236,6 +238,23 @@ public: // velocity_.addOutputVtkFields(this->resultWriter()); } + //! \copydoc ParentType::addOutputVtkFields() + void addOutputVtkFields() + { + ScalarSolution *exactPressure = this->resultWriter().allocateManagedBuffer(this->gridView().size(0)); + + ElementIterator eIt = this->gridView().template begin<0>(); + ElementIterator eItEnd = this->gridView().template end<0>(); + for(;eIt != eItEnd; ++eIt) + { + (*exactPressure)[this->elementMapper().map(*eIt)] = exact(eIt->geometry().center()); + } + + this->resultWriter().attachCellData(*exactPressure, "exact pressure"); + + return; + } + /*! * \brief Returns the temperature within the domain. * -- GitLab