diff --git a/test/decoupled/1p/test_diffusion_problem.hh b/test/decoupled/1p/test_diffusion_problem.hh index 6994a185814311474dd900a4da2ea095d057ab2a..d270b47ad04fcf1bba739f044fe790c4371beeaf 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. *