From d8bb07d362a9809c5b0c7879e1c534f09a3d0edc Mon Sep 17 00:00:00 2001 From: Markus Wolff <markus.wolff@twt-gmbh.de> Date: Tue, 24 Aug 2010 16:48:02 +0000 Subject: [PATCH] some changes in update and output functions git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@4159 2fb0f335-1f38-0410-981e-8018bf24f1b0 --- .../decoupled/2p/diffusion/fv/fvpressure2p.hh | 16 +++++++- .../decoupled/2p/diffusion/fv/fvvelocity2p.hh | 10 +++++ .../2p/transport/fv/fvsaturation2p.hh | 39 +++++++++++++------ 3 files changed, 52 insertions(+), 13 deletions(-) diff --git a/dumux/decoupled/2p/diffusion/fv/fvpressure2p.hh b/dumux/decoupled/2p/diffusion/fv/fvpressure2p.hh index 592f560df8..a279ff90d3 100644 --- a/dumux/decoupled/2p/diffusion/fv/fvpressure2p.hh +++ b/dumux/decoupled/2p/diffusion/fv/fvpressure2p.hh @@ -143,7 +143,6 @@ public: void initialize(bool solveTwice = true) { - updateMaterialLaws(); assemble(true); @@ -188,6 +187,15 @@ public: return; } + void update() + { + updateMaterialLaws(); + + pressure(false); + + return; + } + // serialization methods template<class Restarter> void serialize(Restarter &res) @@ -246,6 +254,12 @@ public: *viscosityNonwetting = problem_.variables().viscosityNonwetting(); writer.addCellData(viscosityNonwetting, "nonwetting viscosity"); +// typename Variables::ScalarSolutionType *saturation = writer.template createField<Scalar, 1> (problem_.gridView().size(0)); +// +// *saturation = problem_.variables().saturation(); +// +// writer.addCellData(saturation, "wetting saturation"); + return; } diff --git a/dumux/decoupled/2p/diffusion/fv/fvvelocity2p.hh b/dumux/decoupled/2p/diffusion/fv/fvvelocity2p.hh index 941d18134b..da9d0cd9c9 100644 --- a/dumux/decoupled/2p/diffusion/fv/fvvelocity2p.hh +++ b/dumux/decoupled/2p/diffusion/fv/fvvelocity2p.hh @@ -50,6 +50,7 @@ template<class TypeTag> class FVVelocity2P: public FVPressure2P<TypeTag> { typedef FVVelocity2P<TypeTag> ThisType; + typedef FVPressure2P<TypeTag> ParentType; typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView; typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar; typedef typename GET_PROP_TYPE(TypeTag, PTAG(Problem)) Problem; @@ -151,6 +152,15 @@ public: */ void calculateVelocity(); + void update() + { + ParentType::update(); + + calculateVelocity(); + + return; + } + private: static const int velocityType_ = GET_PROP_VALUE(TypeTag, PTAG(VelocityFormulation)); //!< gives kind of velocity used (\f$ 0 = v_w\f$, \f$ 1 = v_n\f$, \f$ 2 = v_t\f$) }; diff --git a/dumux/decoupled/2p/transport/fv/fvsaturation2p.hh b/dumux/decoupled/2p/transport/fv/fvsaturation2p.hh index 66a97cbe58..a895bf952b 100644 --- a/dumux/decoupled/2p/transport/fv/fvsaturation2p.hh +++ b/dumux/decoupled/2p/transport/fv/fvsaturation2p.hh @@ -57,12 +57,13 @@ namespace Dumux template<class TypeTag> class FVSaturation2P { - typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView; - typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar; - typedef typename GET_PROP_TYPE(TypeTag, PTAG(Problem)) Problem; - typedef typename GET_PROP(TypeTag, PTAG(ReferenceElements)) ReferenceElements; - typedef typename ReferenceElements::Container ReferenceElementContainer; - typedef typename ReferenceElements::ContainerFaces ReferenceElementFaceContainer; + typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView; + typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar; + typedef typename GET_PROP_TYPE(TypeTag, PTAG(Problem)) Problem; + typedef typename GET_PROP_TYPE(TypeTag, PTAG(Variables)) Variables; + typedef typename GET_PROP(TypeTag, PTAG(ReferenceElements)) ReferenceElements; + typedef typename ReferenceElements::Container ReferenceElementContainer; + typedef typename ReferenceElements::ContainerFaces ReferenceElementFaceContainer; typedef typename GET_PROP_TYPE(TypeTag, PTAG(DiffusivePart)) DiffusivePart; typedef typename GET_PROP_TYPE(TypeTag, PTAG(ConvectivePart)) ConvectivePart; @@ -164,12 +165,26 @@ public: */ void updateMaterialLaws(RepresentationType& saturation, bool iterate); - template<class MultiWriter> - void addOutputVtkFields(MultiWriter &writer) - { - problem_.variables().addOutputVtkFields(writer); - return; - } + //! \brief Write data files + /* \param name file name */ + template<class MultiWriter> + void addOutputVtkFields(MultiWriter &writer) + { + typename Variables::ScalarSolutionType *saturation = writer.template createField<Scalar, 1> (problem_.gridView().size(0)); + + *saturation = problem_.variables().saturation(); + + if (saturationType_ == Sw) + { + writer.addCellData(saturation, "wetting saturation"); + } + if (saturationType_ == Sn) + { + writer.addCellData(saturation, "nonwetting saturation"); + } + + return; + } // serialization methods template<class Restarter> -- GitLab