From 703fd745affd25a360dac592d3d67e36814b757d Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de> Date: Sat, 9 Dec 2017 14:23:47 +0100 Subject: [PATCH] [navierstokes] Move properties to model.hh --- dumux/freeflow/navierstokes/model.hh | 143 +++++++++++++--- dumux/freeflow/navierstokes/problem.hh | 2 +- dumux/freeflow/navierstokes/properties.hh | 154 ------------------ .../freeflow/navierstokes/volumevariables.hh | 2 +- test/freeflow/staggered/doneatestproblem.hh | 7 +- 5 files changed, 126 insertions(+), 182 deletions(-) delete mode 100644 dumux/freeflow/navierstokes/properties.hh diff --git a/dumux/freeflow/navierstokes/model.hh b/dumux/freeflow/navierstokes/model.hh index 7a1bc62219..d4afe30b7a 100644 --- a/dumux/freeflow/navierstokes/model.hh +++ b/dumux/freeflow/navierstokes/model.hh @@ -19,35 +19,134 @@ /*! * \file * - * \brief Base class for all models which use the one-phase, - * fully implicit model. - * Adaption of the fully implicit scheme to the one-phase flow model. + * \brief Isothermal Navier-Stokes model */ #ifndef DUMUX_NAVIERSTOKES_MODEL_HH #define DUMUX_NAVIERSTOKES_MODEL_HH +#include <dumux/common/properties.hh> +#include <dumux/freeflow/properties.hh> +#include <dumux/freeflow/staggeredni/properties.hh> + +#include "localresidual.hh" +#include "volumevariables.hh" +#include "fluxvariables.hh" +#include "fluxvariablescache.hh" +#include "indices.hh" +#include "vtkoutputfields.hh" + +#include <dumux/material/fluidsystems/1p.hh> /*! * \ingroup NavierStokesModel - * \brief A single-phase, isothermal flow model using the fully implicit scheme. - * - * Single-phase, isothermal flow model, which uses a standard Darcy approach as the - * equation for the conservation of momentum: - * \f[ - v = - \frac{\textbf K}{\mu} - \left(\textbf{grad}\, p - \varrho {\textbf g} \right) - * \f] - * - * and solves the mass continuity equation: - * \f[ - \phi \frac{\partial \varrho}{\partial t} + \text{div} \left\lbrace - - \varrho \frac{\textbf K}{\mu} \left( \textbf{grad}\, p -\varrho {\textbf g} \right) \right\rbrace = q, - * \f] - * All equations are discretized using a vertex-centered finite volume (box) - * or cell-centered finite volume scheme as spatial - * and the implicit Euler method as time discretization. - * The model supports compressible as well as incompressible fluids. + * \brief A single-phase, isothermal isothermal Navier-Stokes model + * TODO: doc me! */ -#endif + namespace Dumux + { + // \{ + /////////////////////////////////////////////////////////////////////////// + // properties for the isothermal Navier-Stokes model + /////////////////////////////////////////////////////////////////////////// + namespace Properties { + + ////////////////////////////////////////////////////////////////// + // Type tags + ////////////////////////////////////////////////////////////////// + + //! The type tags for the implicit single-phase problems + NEW_TYPE_TAG(NavierStokes, INHERITS_FROM(FreeFlow)); + + //! The type tags for the corresponding non-isothermal problems + NEW_TYPE_TAG(NavierStokesNI, INHERITS_FROM(NavierStokes, NavierStokesNonIsothermal)); + + ////////////////////////////////////////////////////////////////// + // Property tags + ////////////////////////////////////////////////////////////////// + + NEW_PROP_TAG(EnableInertiaTerms); //!< Returns whether to include inertia terms in the momentum balance eq or not (Stokes / Navier-Stokes) + NEW_PROP_TAG(EnableComponentTransport); //!< Returns whether to consider component transport or not + NEW_PROP_TAG(EnableEnergyTransport); //!< Returns whether to consider energy transport or not + NEW_PROP_TAG(NormalizePressure); //!< Returns whether to normalize the pressure term in the momentum balance or not + NEW_PROP_TAG(EnergyLocalResidual); //!< The energy local residual + NEW_PROP_TAG(EnergyFluxVariables); //!< The energy flux variables + + /////////////////////////////////////////////////////////////////////////// + // default property values for the isothermal single phase model + /////////////////////////////////////////////////////////////////////////// + SET_INT_PROP(NavierStokes, NumPhases, 1); //! The number of phases in the 1p model is 1 + SET_INT_PROP(NavierStokes, NumComponents, 1); //! The number of components in the 1p model is 1 + SET_INT_PROP(NavierStokes, PhaseIdx, 0); //! The default phase index + + /*! + * \brief The fluid state which is used by the volume variables to + * store the thermodynamic state. This should be chosen + * appropriately for the model ((non-)isothermal, equilibrium, ...). + * This can be done in the problem. + */ + SET_PROP(NavierStokes, FluidState){ + private: + typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; + typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; + public: + typedef Dumux::ImmiscibleFluidState<Scalar, FluidSystem> type; + }; + + //! The local residual function + SET_TYPE_PROP(NavierStokes, LocalResidual, NavierStokesResidual<TypeTag>); + + //! the VolumeVariables property + SET_TYPE_PROP(NavierStokes, VolumeVariables, NavierStokesVolumeVariables<TypeTag>); + + //! The NavierStokes FluxVariables + SET_TYPE_PROP(NavierStokes, FluxVariables, FreeFlowFluxVariables<TypeTag>); + + //! The flux variables cache class, by default the one for porous media + SET_TYPE_PROP(NavierStokes, FluxVariablesCache, FreeFlowFluxVariablesCache<TypeTag>); + + //! Enable advection + SET_BOOL_PROP(NavierStokes, EnableAdvection, true); + + //! The one-phase model has no molecular diffusion + SET_BOOL_PROP(NavierStokes, EnableMolecularDiffusion, false); + + //! The indices required by the isothermal single-phase model + SET_TYPE_PROP(NavierStokes, Indices, NavierStokesCommonIndices<TypeTag>); + + SET_TYPE_PROP(NavierStokes, EnergyLocalResidual, FreeFlowEnergyLocalResidual<TypeTag>); + + SET_TYPE_PROP(NavierStokes, EnergyFluxVariables, FreeFlowEnergyFluxVariables<TypeTag>); + + SET_BOOL_PROP(NavierStokes, EnableEnergyBalance, false); + + SET_TYPE_PROP(NavierStokes, VtkOutputFields, NavierStokesVtkOutputFields<TypeTag>); + + SET_BOOL_PROP(NavierStokes, EnableInertiaTerms, true); + + SET_BOOL_PROP(NavierStokes, EnableEnergyTransport, false); + + SET_BOOL_PROP(NavierStokes, EnableComponentTransport, false); + + //! Normalize the pressure term in the momentum balance or not + SET_BOOL_PROP(NavierStokes, NormalizePressure, true); + + ////////////////////////////////////////////////////////////////// + // Property values for isothermal model required for the general non-isothermal model + ////////////////////////////////////////////////////////////////// + + //set isothermal Indices + SET_TYPE_PROP(NavierStokesNI, IsothermalIndices, NavierStokesCommonIndices<TypeTag>); + SET_TYPE_PROP(NavierStokesNI, IsothermalVtkOutputFields, NavierStokesVtkOutputFields<TypeTag>); + + //set isothermal NumEq + SET_INT_PROP(NavierStokesNI, IsothermalNumEqCellCenter, 1); //!< set the number of equations to 1 + SET_INT_PROP(NavierStokesNI, IsothermalNumEqFace, 1); //!< set the number of equations to 1 + + // \} + } + + } // end namespace + +#endif // DUMUX_NAVIERSTOKES_MODEL_HH diff --git a/dumux/freeflow/navierstokes/problem.hh b/dumux/freeflow/navierstokes/problem.hh index 2fd8007bd0..5046e29772 100644 --- a/dumux/freeflow/navierstokes/problem.hh +++ b/dumux/freeflow/navierstokes/problem.hh @@ -26,7 +26,7 @@ #include <dumux/common/properties.hh> #include <dumux/common/staggeredfvproblem.hh> #include <dumux/discretization/methods.hh> -#include "properties.hh" +#include "model.hh" namespace Dumux { diff --git a/dumux/freeflow/navierstokes/properties.hh b/dumux/freeflow/navierstokes/properties.hh deleted file mode 100644 index 2dd0b04fe8..0000000000 --- a/dumux/freeflow/navierstokes/properties.hh +++ /dev/null @@ -1,154 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -// vi: set et ts=4 sw=4 sts=4: -/***************************************************************************** - * See the file COPYING for full copying permissions. * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see <http://www.gnu.org/licenses/>. * - *****************************************************************************/ -/*! - * \ingroup Properties - * \ingroup ImplicitProperties - * \ingroup NavierStokesModel - * \file - * - * \brief Defines the properties required for the one-phase fully implicit model. - */ -#ifndef DUMUX_NAVIERSTOKES_PROPERTIES_HH -#define DUMUX_NAVIERSTOKES_PROPERTIES_HH - -#include <dumux/freeflow/properties.hh> - -#include <dumux/implicit/staggered/localresidual.hh> -#include <dumux/freeflow/staggeredni/properties.hh> - -#include "localresidual.hh" -#include "volumevariables.hh" -#include "fluxvariables.hh" -#include "fluxvariablescache.hh" -#include "indices.hh" -#include "vtkoutputfields.hh" - -#include <dumux/material/fluidsystems/gasphase.hh> -#include <dumux/material/fluidsystems/liquidphase.hh> -#include <dumux/material/fluidsystems/1p.hh> - -#include <dumux/common/properties.hh> - -namespace Dumux -{ -// \{ -/////////////////////////////////////////////////////////////////////////// -// properties for the isothermal Navier-Stokes model -/////////////////////////////////////////////////////////////////////////// -namespace Properties { - -////////////////////////////////////////////////////////////////// -// Type tags -////////////////////////////////////////////////////////////////// - -//! The type tags for the implicit single-phase problems -NEW_TYPE_TAG(NavierStokes, INHERITS_FROM(FreeFlow)); - -//! The type tags for the corresponding non-isothermal problems -NEW_TYPE_TAG(NavierStokesNI, INHERITS_FROM(NavierStokes, NavierStokesNonIsothermal)); - -////////////////////////////////////////////////////////////////// -// Property tags -////////////////////////////////////////////////////////////////// - -NEW_PROP_TAG(EnableInertiaTerms); //!< Returns whether to include inertia terms in the momentum balance eq or not (Stokes / Navier-Stokes) -NEW_PROP_TAG(EnableComponentTransport); //!< Returns whether to consider component transport or not -NEW_PROP_TAG(EnableEnergyTransport); //!< Returns whether to consider energy transport or not -NEW_PROP_TAG(NormalizePressure); //!< Returns whether to normalize the pressure term in the momentum balance or not -NEW_PROP_TAG(EnergyLocalResidual); //!< The energy local residual -NEW_PROP_TAG(EnergyFluxVariables); //!< The energy flux variables - -/////////////////////////////////////////////////////////////////////////// -// default property values for the isothermal single phase model -/////////////////////////////////////////////////////////////////////////// -SET_INT_PROP(NavierStokes, NumPhases, 1); //! The number of phases in the 1p model is 1 -SET_INT_PROP(NavierStokes, NumComponents, 1); //! The number of components in the 1p model is 1 -SET_INT_PROP(NavierStokes, PhaseIdx, 0); //! The default phase index - -/*! - * \brief The fluid state which is used by the volume variables to - * store the thermodynamic state. This should be chosen - * appropriately for the model ((non-)isothermal, equilibrium, ...). - * This can be done in the problem. - */ -SET_PROP(NavierStokes, FluidState){ - private: - typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; - typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; - public: - typedef Dumux::ImmiscibleFluidState<Scalar, FluidSystem> type; -}; - -//! The local residual function -SET_TYPE_PROP(NavierStokes, LocalResidual, NavierStokesResidual<TypeTag>); - -//! the VolumeVariables property -SET_TYPE_PROP(NavierStokes, VolumeVariables, NavierStokesVolumeVariables<TypeTag>); - -//! The class that contains the different flux variables (i.e. darcy, diffusion, energy) -//! by default, we set the flux variables to ones for porous media -SET_TYPE_PROP(NavierStokes, FluxVariables, FreeFlowFluxVariables<TypeTag>); - -//! The flux variables cache class, by default the one for porous media -SET_TYPE_PROP(NavierStokes, FluxVariablesCache, FreeFlowFluxVariablesCache<TypeTag>); - -//! Enable advection -SET_BOOL_PROP(NavierStokes, EnableAdvection, true); - -//! The one-phase model has no molecular diffusion -SET_BOOL_PROP(NavierStokes, EnableMolecularDiffusion, false); - -//! The indices required by the isothermal single-phase model -SET_TYPE_PROP(NavierStokes, Indices, NavierStokesCommonIndices<TypeTag>); - -SET_TYPE_PROP(NavierStokes, EnergyLocalResidual, FreeFlowEnergyLocalResidual<TypeTag>); - -SET_TYPE_PROP(NavierStokes, EnergyFluxVariables, FreeFlowEnergyFluxVariables<TypeTag>); - -SET_BOOL_PROP(NavierStokes, EnableEnergyBalance, false); - -SET_TYPE_PROP(NavierStokes, VtkOutputFields, NavierStokesVtkOutputFields<TypeTag>); - -SET_BOOL_PROP(NavierStokes, EnableInertiaTerms, true); - -SET_BOOL_PROP(NavierStokes, EnableEnergyTransport, false); - -SET_BOOL_PROP(NavierStokes, EnableComponentTransport, false); - -//! Normalize the pressure term in the momentum balance or not -SET_BOOL_PROP(NavierStokes, NormalizePressure, true); - -////////////////////////////////////////////////////////////////// -// Property values for isothermal model required for the general non-isothermal model -////////////////////////////////////////////////////////////////// - -//set isothermal Indices -SET_TYPE_PROP(NavierStokesNI, IsothermalIndices, NavierStokesCommonIndices<TypeTag>); -SET_TYPE_PROP(NavierStokesNI, IsothermalVtkOutputFields, NavierStokesVtkOutputFields<TypeTag>); - -//set isothermal NumEq -SET_INT_PROP(NavierStokesNI, IsothermalNumEqCellCenter, 1); //!< set the number of equations to 1 -SET_INT_PROP(NavierStokesNI, IsothermalNumEqFace, 1); //!< set the number of equations to 1 - -// \} -} - -} // end namespace - -#endif diff --git a/dumux/freeflow/navierstokes/volumevariables.hh b/dumux/freeflow/navierstokes/volumevariables.hh index 1312c278b5..429210a47a 100644 --- a/dumux/freeflow/navierstokes/volumevariables.hh +++ b/dumux/freeflow/navierstokes/volumevariables.hh @@ -26,7 +26,7 @@ #include <dumux/common/properties.hh> -#include "properties.hh" +#include "model.hh" #include <dumux/material/fluidstates/immiscible.hh> namespace Dumux diff --git a/test/freeflow/staggered/doneatestproblem.hh b/test/freeflow/staggered/doneatestproblem.hh index 73801767f4..a51bf0168a 100644 --- a/test/freeflow/staggered/doneatestproblem.hh +++ b/test/freeflow/staggered/doneatestproblem.hh @@ -26,14 +26,13 @@ #ifndef DUMUX_DONEA_TEST_PROBLEM_HH #define DUMUX_DONEA_TEST_PROBLEM_HH -#include <dumux/freeflow/navierstokes/problem.hh> -#include <dumux/discretization/staggered/properties.hh> -#include <dumux/material/components/simpleh2o.hh> #include <dumux/material/fluidsystems/liquidphase.hh> #include <dumux/material/components/constant.hh> #include <dumux/material/fluidsystems/1p.hh> + +#include <dumux/freeflow/navierstokes/problem.hh> #include <dumux/discretization/staggered/freeflow/properties.hh> -#include <dumux/freeflow/navierstokes/properties.hh> +#include <dumux/freeflow/navierstokes/model.hh> namespace Dumux -- GitLab