From 5ef1b44d1275b6bf0a52493ba07611ef21388030 Mon Sep 17 00:00:00 2001 From: Sina Ackermann <sina.ackermann@iws.uni-stuttgart.de> Date: Fri, 17 Mar 2017 14:00:57 +0100 Subject: [PATCH] [staggeredGrid][nonisothermal] revise indices, propertydefaults, properties --- dumux/freeflow/staggered/localresidual.hh | 126 +++++++++--------- dumux/freeflow/staggeredni/indices.hh | 16 +-- dumux/freeflow/staggeredni/localresidual.hh | 29 +++- dumux/freeflow/staggeredni/model.hh | 14 +- dumux/freeflow/staggeredni/properties.hh | 2 +- .../freeflow/staggeredni/propertydefaults.hh | 19 ++- 6 files changed, 103 insertions(+), 103 deletions(-) diff --git a/dumux/freeflow/staggered/localresidual.hh b/dumux/freeflow/staggered/localresidual.hh index c27895d41e..e93c3134d3 100644 --- a/dumux/freeflow/staggered/localresidual.hh +++ b/dumux/freeflow/staggered/localresidual.hh @@ -353,69 +353,69 @@ private: // specialization for immiscible, non-isothermal flow -template<class TypeTag> -class StaggeredNavierStokesResidualImpl<TypeTag, false, true> : public StaggeredNavierStokesResidualImpl<TypeTag, false, false> -{ - using ParentType = StaggeredNavierStokesResidualImpl<TypeTag, false, false>; - friend class StaggeredLocalResidual<TypeTag>; - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - - enum { numEq = GET_PROP_VALUE(TypeTag, NumEq) }; - - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using Implementation = typename GET_PROP_TYPE(TypeTag, LocalResidual); - using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using Element = typename GridView::template Codim<0>::Entity; - using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); - using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); - using ElementBoundaryTypes = typename GET_PROP_TYPE(TypeTag, ElementBoundaryTypes); - using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); - using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using CellCenterSolutionVector = typename GET_PROP_TYPE(TypeTag, CellCenterSolutionVector); - using FaceSolutionVector = typename GET_PROP_TYPE(TypeTag, FaceSolutionVector); - using CellCenterPrimaryVariables = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables); - using Indices = typename GET_PROP_TYPE(TypeTag, Indices); - - - enum { - // grid and world dimension - dim = GridView::dimension, - dimWorld = GridView::dimensionworld, - - pressureIdx = Indices::pressureIdx, - velocityIdx = Indices::velocityIdx, - - massBalanceIdx = Indices::massBalanceIdx, - momentumBalanceIdx = Indices::momentumBalanceIdx, - energyBalanceIdx = Indices::energyBalanceIdx - }; - - using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - - static constexpr bool navierStokes = GET_PROP_VALUE(TypeTag, EnableInertiaTerms); - /*! - * \brief Evaluate the rate of change of all conservation - * quantites (e.g. phase mass) within a sub-control - * volume of a finite volume element for the immiscible models. - * \param scv The sub control volume - * \param volVars The current or previous volVars - * \note This function should not include the source and sink terms. - * \note The volVars can be different to allow computing - * the implicit euler time derivative here - */ - CellCenterPrimaryVariables computeStorageForCellCenter(const SubControlVolume& scv, - const VolumeVariables& volVars) - { - CellCenterPrimaryVariables storage; - storage[massBalanceIdx] = volVars.density(); - storage[energyBalanceIdx] = volVars.density() * volVars.internalEnergy(); - return storage; - } -}; +//template<class TypeTag> +//class StaggeredNavierStokesResidualImpl<TypeTag, false, true> : public StaggeredNavierStokesResidualImpl<TypeTag, false, false>; +//{ +// using ParentType = StaggeredNavierStokesResidualImpl<TypeTag, false, false>; +// friend class StaggeredLocalResidual<TypeTag>; +// using GridView = typename GET_PROP_TYPE(TypeTag, GridView); +// +// enum { numEq = GET_PROP_VALUE(TypeTag, NumEq) }; +// +// using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); +// using Implementation = typename GET_PROP_TYPE(TypeTag, LocalResidual); +// using Problem = typename GET_PROP_TYPE(TypeTag, Problem); +// using Element = typename GridView::template Codim<0>::Entity; +// using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); +// using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); +// using ElementBoundaryTypes = typename GET_PROP_TYPE(TypeTag, ElementBoundaryTypes); +// using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); +// using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); +// using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); +// using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); +// using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); +// using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); +// using CellCenterSolutionVector = typename GET_PROP_TYPE(TypeTag, CellCenterSolutionVector); +// using FaceSolutionVector = typename GET_PROP_TYPE(TypeTag, FaceSolutionVector); +// using CellCenterPrimaryVariables = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables); +// using Indices = typename GET_PROP_TYPE(TypeTag, Indices); +// +// +// enum { +// // grid and world dimension +// dim = GridView::dimension, +// dimWorld = GridView::dimensionworld, +// +// pressureIdx = Indices::pressureIdx, +// velocityIdx = Indices::velocityIdx, +// +// massBalanceIdx = Indices::massBalanceIdx, +// momentumBalanceIdx = Indices::momentumBalanceIdx, +// energyBalanceIdx = Indices::energyBalanceIdx +// }; +// +// using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); +// +// static constexpr bool navierStokes = GET_PROP_VALUE(TypeTag, EnableInertiaTerms); +// /*! +// * \brief Evaluate the rate of change of all conservation +// * quantites (e.g. phase mass) within a sub-control +// * volume of a finite volume element for the immiscible models. +// * \param scv The sub control volume +// * \param volVars The current or previous volVars +// * \note This function should not include the source and sink terms. +// * \note The volVars can be different to allow computing +// * the implicit euler time derivative here +// */ +// CellCenterPrimaryVariables computeStorageForCellCenter(const SubControlVolume& scv, +// const VolumeVariables& volVars) +// { +// CellCenterPrimaryVariables storage; +// storage[massBalanceIdx] = volVars.density(); +// storage[energyBalanceIdx] = volVars.density() * volVars.internalEnergy(); +// return storage; +// } +//}; // specialization for miscible, non-isothermal flow template<class TypeTag> diff --git a/dumux/freeflow/staggeredni/indices.hh b/dumux/freeflow/staggeredni/indices.hh index d134b7279a..ca488bdbc3 100644 --- a/dumux/freeflow/staggeredni/indices.hh +++ b/dumux/freeflow/staggeredni/indices.hh @@ -18,38 +18,32 @@ *****************************************************************************/ /*! * \file - * \brief Defines the indices for the staggered Navier-Stokes NC model. + * \brief Defines the indices for the staggered Navier-Stokes NI model. */ #ifndef DUMUX_STAGGERED_NAVIERSTOKES_NI_INDICES_HH #define DUMUX_STAGGERED_NAVIERSTOKES_NI_INDICES_HH -#include <dumux/freeflow/staggered/indices.hh> +//#include <dumux/freeflow/staggered/indices.hh> +//#include "properties.hh" namespace Dumux { // \{ /*! - * \ingroup NavierStokesNCModel + * \ingroup NavierStokesNIModel * \ingroup ImplicitIndices * \brief Indices for the staggered Navier-Stokes NI model model. * * \tparam PVOffset The first index in a primary variable vector. */ template <class TypeTag, int PVOffset = 0> -struct NavierStokesNIIndices : public NavierStokesCommonIndices<TypeTag, PVOffset> +class NavierStokesNIIndices : public NavierStokesCommonIndices<TypeTag, PVOffset> { -private: - using ParentType = NavierStokesCommonIndices<TypeTag, PVOffset>; - public: - static const int numEq = GET_PROP_VALUE(TypeTag, NumEq); static constexpr int energyBalanceIdx = PVOffset + numEq - 1; static constexpr int temperatureIdx = energyBalanceIdx; - }; - -// \} } // end namespace #endif diff --git a/dumux/freeflow/staggeredni/localresidual.hh b/dumux/freeflow/staggeredni/localresidual.hh index f52d0ee2ca..33baa4c0a3 100644 --- a/dumux/freeflow/staggeredni/localresidual.hh +++ b/dumux/freeflow/staggeredni/localresidual.hh @@ -26,15 +26,12 @@ #ifndef DUMUX_STAGGERED_NAVIERSTOKES_NI_LOCAL_RESIDUAL_HH #define DUMUX_STAGGERED_NAVIERSTOKES_NI_LOCAL_RESIDUAL_HH -//#include <dune/istl/matrix.hh> // TODO ? +#include <dune/istl/matrix.hh> // TODO ? -//#include <dumux/common/valgrind.hh> // TODO ? +#include <dumux/common/valgrind.hh> // TODO ? #include <dumux/implicit/staggered/localresidual.hh> -//#include "properties.hh" // TODO ? -// -//#include "volumevariables.hh" // TODO ? -//#include "fluxvariables.hh" // TODO ? +#include "properties.hh" // TODO ? namespace Dumux { @@ -61,21 +58,38 @@ NEW_PROP_TAG(EnableInertiaTerms); template<class TypeTag, bool enableComponentTransport, bool enableEnergyBalance> class StaggeredNavierStokesResidualImpl; +template<class TypeTag> +using StaggeredNavierStokesResidual = StaggeredNavierStokesResidualImpl<TypeTag, GET_PROP_VALUE(TypeTag, EnableComponentTransport), + GET_PROP_VALUE(TypeTag, EnableEnergyBalance)>; + + // specialization for immiscible, non-isothermal flow template<class TypeTag> class StaggeredNavierStokesResidualImpl<TypeTag, false, true> : public StaggeredNavierStokesResidualImpl<TypeTag, false, false> { friend class StaggeredLocalResidual<TypeTag>; + using ParentType = StaggeredNavierStokesResidualImpl<TypeTag, false, false>; + using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); using CellCenterPrimaryVariables = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); + using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); + + using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); + typename DofTypeIndices::CellCenterIdx cellCenterIdx; + typename DofTypeIndices::FaceIdx faceIdx; + enum { energyBalanceIdx = Indices::energyBalanceIdx }; + using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); + + static constexpr bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles); + public: /*! * \brief Evaluate the amount the additional quantities to the Stokes model @@ -95,6 +109,9 @@ public: // compute the storage of energy storage[energyBalanceIdx] = volVars.density(0) * volVars.internalEnergy(0); + std::cout << "** Subcontrolvolume " << scv.index() << ": energy storage = " + << storage[energyBalanceIdx] << std::endl; + return storage; } }; diff --git a/dumux/freeflow/staggeredni/model.hh b/dumux/freeflow/staggeredni/model.hh index 639f3b7930..8ee8338347 100644 --- a/dumux/freeflow/staggeredni/model.hh +++ b/dumux/freeflow/staggeredni/model.hh @@ -91,20 +91,10 @@ public: { ParentType::init(problem); - // register standardized vtk output fields + // add temperature to output auto& vtkOutputModule = problem.vtkOutputModule(); -// vtkOutputModule.addSecondaryVariable("rhoMolar",[](const VolumeVariables& v){ return v.molarDensity(); }); -// vtkOutputModule.addSecondaryVariable("rho",[](const VolumeVariables& v){ return v.density(); }); -// for (int j = 0; j < numComponents; ++j) -// { -// vtkOutputModule.addSecondaryVariable("X^" + FluidSystem::componentName(j) + "_" + FluidSystem::phaseName(phaseIdx), -// [j](const VolumeVariables& v){ return v.massFraction(phaseIdx,j); }); -// -// vtkOutputModule.addSecondaryVariable("x^" + FluidSystem::componentName(j) + "_" + FluidSystem::phaseName(phaseIdx), -// [j](const VolumeVariables& v){ return v.moleFraction(phaseIdx,j); }); -// } + vtkOutputModule.addSecondaryVariable("temperature", [](const VolumeVariables& v){ return v.temperature();}); -// NonIsothermalModel::maybeAddTemperature(vtkOutputModule); } }; } diff --git a/dumux/freeflow/staggeredni/properties.hh b/dumux/freeflow/staggeredni/properties.hh index ab4022f8a4..c7198e3e9e 100644 --- a/dumux/freeflow/staggeredni/properties.hh +++ b/dumux/freeflow/staggeredni/properties.hh @@ -27,8 +27,8 @@ #ifndef DUMUX_NAVIERSTOKES_NI_PROPERTIES_HH #define DUMUX_NAVIERSTOKES_NI_PROPERTIES_HH -// #include <dumux/porousmediumflow/nonisothermal/implicit/properties.hh> #include <dumux/freeflow/staggered/properties.hh> +//#include <dumux/porousmediumflow/nonisothermal/implicit/properties.hh> namespace Dumux { diff --git a/dumux/freeflow/staggeredni/propertydefaults.hh b/dumux/freeflow/staggeredni/propertydefaults.hh index a43f0cdec0..4433539c0f 100644 --- a/dumux/freeflow/staggeredni/propertydefaults.hh +++ b/dumux/freeflow/staggeredni/propertydefaults.hh @@ -30,23 +30,21 @@ #include "properties.hh" #include "model.hh" -#include "volumevariables.hh" +#include "../staggered/volumevariables.hh" #include "indices.hh" #include "localresidual.hh" +#include "fluxvariables.hh" #include "../staggered/problem.hh" // #include "../staggered/model.hh" #include "../staggered/propertydefaults.hh" - #include <dumux/implicit/staggered/localresidual.hh> #include <dumux/material/fluidsystems/gasphase.hh> #include <dumux/material/fluidsystems/liquidphase.hh> #include <dumux/material/components/nullcomponent.hh> #include <dumux/material/fluidsystems/1p.hh> -#include <dumux/material/fluidstates/compositional.hh> - - +#include <dumux/material/fluidstates/immiscible.hh> namespace Dumux @@ -65,11 +63,12 @@ NEW_PROP_TAG(FluxVariablesCache); /////////////////////////////////////////////////////////////////////////// namespace Properties { -SET_PROP(NavierStokesNI, NumEqCellCenter, GET_PROP_VALUE(TypeTag, NonIsothermalNumEq) + 1); +SET_INT_PROP(NavierStokesNI, NumEqCellCenter, 1); // temp. (additional to pressure) //! the VolumeVariables property -SET_TYPE_PROP(NavierStokesNI, VolumeVariables, NavierStokesNIVolumeVariables<TypeTag>); +SET_TYPE_PROP(NavierStokesNI, VolumeVariables, NavierStokesVolumeVariables<TypeTag>); SET_TYPE_PROP(NavierStokesNI, Model, NavierStokesNIModel<TypeTag>); +SET_TYPE_PROP(NavierStokesNI, Indices, NavierStokesNIIndices<TypeTag>); /*! @@ -84,7 +83,7 @@ SET_PROP(NavierStokesNI, FluidState) typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; public: - typedef CompositionalFluidState<Scalar, FluidSystem> type; // TODO necessary? + typedef ImmiscibleFluidState<Scalar, FluidSystem> type; }; // //! Enable advection @@ -94,7 +93,7 @@ SET_PROP(NavierStokesNI, FluidState) // SET_BOOL_PROP(NavierStokes, EnableMolecularDiffusion, false); // //! Non-Isothermal model by default -SET_BOOL_PROP(NavierStokes, EnableEnergyBalance, true); +//SET_BOOL_PROP(NavierStokesNI, EnableEnergyBalance, true); // // //! The indices required by the isothermal single-phase model // SET_TYPE_PROP(NavierStokes, Indices, NavierStokesCommonIndices<TypeTag>); @@ -172,7 +171,7 @@ SET_TYPE_PROP(NavierStokesNI, HeatConductionType, FouriersLaw<TypeTag>); // SET_INT_PROP(NavierStokesNI, IsothermalNumEq, 1); //set non-isothermal NumEq - SET_INT_PROP(NavierStokesNI, NonIsothermalNumEq, 1); +// SET_INT_PROP(NavierStokesNI, NonIsothermalNumEq, 1); // \} -- GitLab