From 14a26960cfc3bea1df6a9038fc8b849937a29404 Mon Sep 17 00:00:00 2001 From: Bernd Flemisch <bernd@iws.uni-stuttgart.de> Date: Tue, 24 Aug 2010 08:35:08 +0000 Subject: [PATCH] test for adapting svn history git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@4129 2fb0f335-1f38-0410-981e-8018bf24f1b0 --- dumux/boxmodels/1p/1pmodel.hh | 94 ++++++++--------------------------- 1 file changed, 21 insertions(+), 73 deletions(-) diff --git a/dumux/boxmodels/1p/1pmodel.hh b/dumux/boxmodels/1p/1pmodel.hh index 7ff7847337..f74d0cb83d 100644 --- a/dumux/boxmodels/1p/1pmodel.hh +++ b/dumux/boxmodels/1p/1pmodel.hh @@ -14,13 +14,13 @@ * * * This program is distributed WITHOUT ANY WARRANTY. * *****************************************************************************/ -#ifndef DUMUX_1P_MODEL_HH -#define DUMUX_1P_MODEL_HH +#ifndef DUMUX_1P_BOX_MODEL_HH +#define DUMUX_1P_BOX_MODEL_HH -#include <dumux/boxmodels/common/boxmodel.hh> +#include <dumux/boxmodels/boxscheme/boxscheme.hh> -#include "1plocalresidual.hh" -#include "1pproblem.hh" +#include "1pboxjacobian.hh" +#include "1pboxproblem.hh" namespace Dumux { @@ -49,81 +49,29 @@ namespace Dumux * single phase flow modeling, if in the problem file a fluid with constant density is chosen. */ template<class TypeTag > -class OnePBoxModel : public BoxModel<TypeTag> +class OnePBoxModel : public BoxScheme<TypeTag, OnePBoxModel<TypeTag> > { - typedef OnePBoxModel<TypeTag> ThisType; - typedef BoxModel<TypeTag> ParentType; + typedef OnePBoxModel<TypeTag> ThisType; + typedef BoxScheme<TypeTag, ThisType> ParentType; - typedef typename GET_PROP_TYPE(TypeTag, PTAG(Problem)) Problem; - typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar; - typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView; - typedef typename GridView::template Codim<0>::Entity Element; - typedef typename GridView::template Codim<0>::Iterator ElementIterator; - - typedef typename GET_PROP_TYPE(TypeTag, PTAG(FVElementGeometry)) FVElementGeometry; - typedef typename GET_PROP_TYPE(TypeTag, PTAG(VolumeVariables)) VolumeVariables; - typedef typename GET_PROP_TYPE(TypeTag, PTAG(ElementVolumeVariables)) ElementVolumeVariables; - typedef typename GET_PROP_TYPE(TypeTag, PTAG(ElementBoundaryTypes)) ElementBoundaryTypes; - typedef typename GET_PROP_TYPE(TypeTag, PTAG(VertexMapper)) VertexMapper; - typedef typename GET_PROP_TYPE(TypeTag, PTAG(ElementMapper)) ElementMapper; - typedef typename GET_PROP_TYPE(TypeTag, PTAG(SolutionVector)) SolutionVector; - typedef typename GET_PROP_TYPE(TypeTag, PTAG(OnePIndices)) Indices; - - enum { - dim = GridView::dimension, - }; + typedef typename GET_PROP_TYPE(TypeTag, PTAG(Problem)) Problem; + typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar; + typedef typename GET_PROP_TYPE(TypeTag, PTAG(LocalJacobian)) LocalJacobian; public: + OnePBoxModel(Problem &prob) + : ParentType(prob) + { + } + /*! - * \brief Append all quantities of interest which can be derived - * from the solution of the current time step to the VTK - * writer. + * \brief All relevant primary and secondary of the current + * solution to an ouput writer. */ - template<class MultiWriter> - void addOutputVtkFields(const SolutionVector &sol, - MultiWriter &writer) + template <class MultiWriter> + void addOutputVtkFields(MultiWriter &writer) { - typedef Dune::BlockVector<Dune::FieldVector<Scalar, 1> > ScalarField; - - // create the required scalar fields - unsigned numVertices = this->problem_().gridView().size(dim); - ScalarField *p = writer.template createField<Scalar, 1> (numVertices); - - unsigned numElements = this->gridView_().size(0); - ScalarField *rank = - writer.template createField<Scalar, 1> (numElements); - - FVElementGeometry fvElemGeom; - VolumeVariables volVars; - ElementBoundaryTypes elemBcTypes; - - ElementIterator elemIt = this->gridView_().template begin<0>(); - ElementIterator elemEndIt = this->gridView_().template end<0>(); - for (; elemIt != elemEndIt; ++elemIt) - { - int idx = this->problem_().model().elementMapper().map(*elemIt); - (*rank)[idx] = this->gridView_().comm().rank(); - - fvElemGeom.update(this->gridView_(), *elemIt); - elemBcTypes.update(this->problem_(), *elemIt, fvElemGeom); - - int numVerts = elemIt->template count<dim> (); - for (int i = 0; i < numVerts; ++i) - { - int globalIdx = this->vertexMapper().map(*elemIt, i, dim); - volVars.update(sol[globalIdx], - this->problem_(), - *elemIt, - fvElemGeom, - i, - false); - - (*p)[globalIdx] = volVars.pressure; - }; - } - - writer.addVertexData(p, "p"); - writer.addCellData(rank, "process rank"); + this->localJacobian().addOutputVtkFields(writer, this->curSol()); } }; } -- GitLab