diff --git a/dumux/freeflow/staggered/localresidual.hh b/dumux/freeflow/staggered/localresidual.hh index cc1d59c58d4d242ce599360bae46711b0b501920..3b18a7bfaae6d754cd1cb35392e7f6c64bfc24df 100644 --- a/dumux/freeflow/staggered/localresidual.hh +++ b/dumux/freeflow/staggered/localresidual.hh @@ -54,19 +54,15 @@ NEW_PROP_TAG(ReplaceCompEqIdx); // forward declaration -template<class TypeTag, bool enableComponentTransport, bool enableEnergyBalance> +template<class TypeTag, bool enableComponentTransport> class StaggeredNavierStokesResidualImpl; template<class TypeTag> -using StaggeredNavierStokesResidual = StaggeredNavierStokesResidualImpl<TypeTag, GET_PROP_VALUE(TypeTag, EnableComponentTransport), - GET_PROP_VALUE(TypeTag, EnableEnergyBalanceStokes)>; +using StaggeredNavierStokesResidual = StaggeredNavierStokesResidualImpl<TypeTag, GET_PROP_VALUE(TypeTag, EnableComponentTransport)>; -// template<class TypeTag> -// class StaggeredNavierStokesResidual : public Dumux::StaggeredLocalResidual<TypeTag> -// { template<class TypeTag> -class StaggeredNavierStokesResidualImpl<TypeTag, false, false> : public Dumux::StaggeredLocalResidual<TypeTag> +class StaggeredNavierStokesResidualImpl<TypeTag, false> : public Dumux::StaggeredLocalResidual<TypeTag> { using ParentType = StaggeredLocalResidual<TypeTag>; friend class StaggeredLocalResidual<TypeTag>; @@ -93,6 +89,7 @@ class StaggeredNavierStokesResidualImpl<TypeTag, false, false> : public Dumux::S using FacePrimaryVariables = typename GET_PROP_TYPE(TypeTag, FacePrimaryVariables); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); + using EnergyLocalResidual = typename GET_PROP_TYPE(TypeTag, EnergyLocalResidual); using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); @@ -161,6 +158,7 @@ public: { CellCenterPrimaryVariables storage; storage[0] = volVars.density(); + EnergyLocalResidual::fluidPhaseStorage(storage, scv, volVars); return storage; } diff --git a/dumux/freeflow/staggered/propertydefaults.hh b/dumux/freeflow/staggered/propertydefaults.hh index da89fa337765478eb1ba02b5276e469507aaa3cb..993b9a9d564494bce1f65bd7f4cfccc7773b9637 100644 --- a/dumux/freeflow/staggered/propertydefaults.hh +++ b/dumux/freeflow/staggered/propertydefaults.hh @@ -40,6 +40,7 @@ #include "vtkoutputmodule.hh" #include <dumux/implicit/staggered/localresidual.hh> +#include <dumux/freeflow/staggeredni/localresidual.hh> #include <dumux/material/fluidsystems/gasphase.hh> #include <dumux/material/fluidsystems/liquidphase.hh> #include <dumux/material/components/nullcomponent.hh> @@ -184,6 +185,7 @@ SET_TYPE_PROP(NavierStokes, VtkOutputModule, FreeFlowStaggeredVtkOutputModule<Ty SET_TYPE_PROP(NavierStokes, VelocityOutput, StaggeredFreeFlowVelocityOutput<TypeTag>); +SET_TYPE_PROP(NavierStokes, EnergyLocalResidual, FreeFlowEnergyLocalResidual<TypeTag>); //! average is used as default model to compute the effective thermal heat conductivity // SET_PROP(NavierStokesNI, ThermalConductivityModel) // { private : diff --git a/dumux/freeflow/staggeredni/localresidual.hh b/dumux/freeflow/staggeredni/localresidual.hh new file mode 100644 index 0000000000000000000000000000000000000000..39ad52191a418f72197960d582e94a7280d6e18b --- /dev/null +++ b/dumux/freeflow/staggeredni/localresidual.hh @@ -0,0 +1,94 @@ +// -*- 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/>. * + *****************************************************************************/ +/*! + * \file + * + * \brief Element-wise calculation of the local residual for non-isothermal + * fully implicit models. + */ +#ifndef DUMUX_FREE_FLOW_ENERGY_LOCAL_RESIDUAL_HH +#define DUMUX_FREE_FLOW_ENERGY_LOCAL_RESIDUAL_HH + +// #include <dumux/implicit/properties.hh> + +namespace Dumux +{ + +// property forward declarations +namespace Properties +{ +NEW_PROP_TAG(Indices); +} + +// forward declaration +template<class TypeTag, bool enableEneryBalance> +class FreeFlowEnergyLocalResidualImplementation; + +/*! + * \ingroup NIModel + * \ingroup ImplicitLocalResidual + * \brief Element-wise calculation of the energy residual for non-isothermal problems. + */ +template<class TypeTag> +using FreeFlowEnergyLocalResidual = FreeFlowEnergyLocalResidualImplementation<TypeTag, GET_PROP_VALUE(TypeTag, EnableEnergyBalanceStokes)>; + +template<class TypeTag> +class FreeFlowEnergyLocalResidualImplementation<TypeTag, false> +{ + using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); + using CellCenterPrimaryVariables = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables); + using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); + using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); + +public: + //! The energy storage in the fluid phase with index phaseIdx + static void fluidPhaseStorage(CellCenterPrimaryVariables& storage, + const SubControlVolume& scv, + const VolumeVariables& volVars) + {} +}; + +template<class TypeTag> +class FreeFlowEnergyLocalResidualImplementation<TypeTag, true> +{ + using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); + using CellCenterPrimaryVariables = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables); + using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); + using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); + using Indices = typename GET_PROP_TYPE(TypeTag, Indices); + + enum { energyBalanceIdx = Indices::energyBalanceIdx }; + +public: + + //! The energy storage in the fluid phase + static void fluidPhaseStorage(CellCenterPrimaryVariables& storage, + const SubControlVolume& scv, + const VolumeVariables& volVars) + { + storage[energyBalanceIdx] += volVars.density() + * volVars.internalEnergy(); + } +}; + +} // end namespace Dumux + +#endif