Skip to content
Snippets Groups Projects
Commit 5a029a66 authored by Kilian Weishaupt's avatar Kilian Weishaupt
Browse files

[staggeredni] Adapt properties

* Add new typeTag NavierStokesNI
parent 7ce9812a
No related branches found
No related tags found
2 merge requests!617[WIP] Next,!483Feature/staggered energy
...@@ -27,7 +27,8 @@ ...@@ -27,7 +27,8 @@
#ifndef DUMUX_NAVIERSTOKES_PROPERTIES_HH #ifndef DUMUX_NAVIERSTOKES_PROPERTIES_HH
#define DUMUX_NAVIERSTOKES_PROPERTIES_HH #define DUMUX_NAVIERSTOKES_PROPERTIES_HH
// #include <dumux/porousmediumflow/nonisothermal/implicit/properties.hh> #include <dumux/freeflow/staggeredni/properties.hh>
namespace Dumux namespace Dumux
{ {
...@@ -43,9 +44,10 @@ namespace Properties { ...@@ -43,9 +44,10 @@ namespace Properties {
//! The type tags for the implicit single-phase problems //! The type tags for the implicit single-phase problems
NEW_TYPE_TAG(NavierStokes); NEW_TYPE_TAG(NavierStokes);
// NEW_TYPE_TAG(NavierStokesNI);
//! The type tags for the corresponding non-isothermal problems //! The type tags for the corresponding non-isothermal problems
// NEW_TYPE_TAG(NavierStokesNI, INHERITS_FROM(NavierStokes, NonIsothermal)); NEW_TYPE_TAG(NavierStokesNI, INHERITS_FROM(NavierStokes, StaggeredNonIsothermal));
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
// Property tags // Property tags
...@@ -66,6 +68,8 @@ NEW_PROP_TAG(EnableComponentTransport); //!< Returns whether to consider compone ...@@ -66,6 +68,8 @@ NEW_PROP_TAG(EnableComponentTransport); //!< Returns whether to consider compone
NEW_PROP_TAG(EnableEnergyTransport); //!< Returns whether to consider energy transport or not NEW_PROP_TAG(EnableEnergyTransport); //!< Returns whether to consider energy transport or not
NEW_PROP_TAG(FaceVariables); //!< Returns whether to consider energy transport or not NEW_PROP_TAG(FaceVariables); //!< 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(NormalizePressure); //!< Returns whether to normalize the pressure term in the momentum balance or not
NEW_PROP_TAG(EnergyLocalResidual); //!< Returns whether to normalize the pressure term in the momentum balance or not
NEW_PROP_TAG(EnergyFluxVariables); //!< Returns whether to normalize the pressure term in the momentum balance or not
// \} // \}
} }
......
// -*- 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 Jacobian matrix for problems
* using the non-isothermal Stokes model with a staggered grid.
*
*/
#ifndef DUMUX_STAGGERED_NAVIERSTOKES_NI_LOCAL_RESIDUAL_HH
#define DUMUX_STAGGERED_NAVIERSTOKES_NI_LOCAL_RESIDUAL_HH
#include <dune/istl/matrix.hh>
#include <dumux/common/valgrind.hh>
#include <dumux/implicit/staggered/localresidual.hh>
#include "properties.hh"
namespace Dumux
{
namespace Properties
{
// forward declaration
NEW_PROP_TAG(EnableEnergyBalanceStokes);
NEW_PROP_TAG(EnableInertiaTerms);
}
/*!
* \ingroup StaggeredModel
* \ingroup StaggeredLocalResidual
* \brief Element-wise calculation of the residual for models
* based on the staggered grid scheme
*
* \todo Please doc me more!
*/
// forward declaration
template<class TypeTag, bool enableComponentTransport, bool enableEnergyBalance>
class StaggeredNavierStokesResidualImpl;
// 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 {
massBalanceIdx = Indices::massBalanceIdx,
energyBalanceIdx = Indices::energyBalanceIdx
};
using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables);
using GlobalFaceVars = typename GET_PROP_TYPE(TypeTag, GlobalFaceVars);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using Element = typename GridView::template Codim<0>::Entity;
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables);
// static constexpr bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles);
public:
/*!
* \brief Evaluate the cell center storage terms of the non-isothermal Stokes model.
*
* The result should be averaged over the volume (e.g. phase mass
* inside a sub control volume divided by the volume)
*
* \param scv The sub control volume
* \param volVars The volume variables
*/
CellCenterPrimaryVariables computeStorageForCellCenter(const SubControlVolume& scv, const VolumeVariables& volVars)
{
CellCenterPrimaryVariables storage(0.0);
// const Scalar density = useMoles? volVars.molarDensity() : volVars.density();
// compute storage of mass
storage = ParentType::computeStorageForCellCenter(scv, volVars);
// compute the storage of energy
storage[energyBalanceIdx] = volVars.density() * volVars.internalEnergy();
return storage;
}
/*!
* \brief Evaluate the cell center source terms of the non-isothermal Stokes model.
*
* The result should be averaged over the volume (e.g. phase mass
* inside a sub control volume divided by the volume)
*
* \param element The element
* \param fvGeometry The finite-volume geometry
* \param elemVolVars All volume variables for the element
* \param globalFaceVars The face variables
* \param scv The sub control volume
*/
CellCenterPrimaryVariables computeSourceForCellCenter(const Element &element,
const FVElementGeometry& fvGeometry,
const ElementVolumeVariables& elemVolVars,
const GlobalFaceVars& globalFaceVars,
const SubControlVolume &scv)
{
CellCenterPrimaryVariables source(0.0);
source = this->problem().sourceAtPos(scv.center())[cellCenterIdx][massBalanceIdx];
source = this->problem().sourceAtPos(scv.center())[cellCenterIdx][energyBalanceIdx];
return source;
}
};
} // end namespace
#endif
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#ifndef DUMUX_NAVIERSTOKES_NI_PROPERTIES_HH #ifndef DUMUX_NAVIERSTOKES_NI_PROPERTIES_HH
#define DUMUX_NAVIERSTOKES_NI_PROPERTIES_HH #define DUMUX_NAVIERSTOKES_NI_PROPERTIES_HH
#include <dumux/freeflow/staggered/properties.hh> // #include <dumux/freeflow/staggered/properties.hh>
namespace Dumux namespace Dumux
{ {
...@@ -42,7 +42,7 @@ namespace Properties { ...@@ -42,7 +42,7 @@ namespace Properties {
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
//! The type tags for the non-isothermal Navier Stokes problems //! The type tags for the non-isothermal Navier Stokes problems
NEW_TYPE_TAG(NavierStokesNI, INHERITS_FROM(NavierStokes)); NEW_TYPE_TAG(StaggeredNonIsothermal);
NEW_PROP_TAG(EnableEnergyBalanceStokes); NEW_PROP_TAG(EnableEnergyBalanceStokes);
...@@ -54,6 +54,29 @@ NEW_PROP_TAG(EnableEnergyBalanceStokes); ...@@ -54,6 +54,29 @@ NEW_PROP_TAG(EnableEnergyBalanceStokes);
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
NEW_PROP_TAG(PhaseIdx); //!< Defines the phaseIdx NEW_PROP_TAG(PhaseIdx); //!< Defines the phaseIdx
//////////////////////////////////////////////////////////////////
// Property tags required for the non-isothermal models
//////////////////////////////////////////////////////////////////
//TODO cleanup
NEW_PROP_TAG(IsothermalModel);
NEW_PROP_TAG(IsothermalFluxVariables);
NEW_PROP_TAG(IsothermalVolumeVariables);
NEW_PROP_TAG(IsothermalIndices);
NEW_PROP_TAG(IsothermalNumEqCellCenter);
NEW_PROP_TAG(IsothermalNumEqFace);
NEW_PROP_TAG(HaveVariableFormulation);
NEW_PROP_TAG(ThermalConductivityModel);
NEW_PROP_TAG(NiOutputLevel);
// forward declaration of other property tags
NEW_PROP_TAG(Indices);
NEW_PROP_TAG(NumPhases);
NEW_PROP_TAG(FluidSystem);
// \} // \}
} }
......
...@@ -27,35 +27,16 @@ ...@@ -27,35 +27,16 @@
#ifndef DUMUX_NAVIER_STOKES_NI_PROPERTY_DEFAULTS_HH #ifndef DUMUX_NAVIER_STOKES_NI_PROPERTY_DEFAULTS_HH
#define DUMUX_NAVIER_STOKES_NI_PROPERTY_DEFAULTS_HH #define DUMUX_NAVIER_STOKES_NI_PROPERTY_DEFAULTS_HH
// TODO clean-up
#include "properties.hh" #include "properties.hh"
#include "model.hh" #include "model.hh"
#include "volumevariables.hh" #include "volumevariables.hh"
#include "indices.hh" #include "indices.hh"
#include "localresidual.hh" #include "../staggered/propertydefaults.hh" //TODO: why do we need this include?
#include "fluxvariables.hh"
#include "../staggered/problem.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/immiscible.hh>
namespace Dumux namespace Dumux
{ {
namespace Properties
{
// forward declaration
NEW_PROP_TAG(FluxVariables);
NEW_PROP_TAG(FluxVariablesCache);
}
// \{ // \{
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
...@@ -63,20 +44,28 @@ NEW_PROP_TAG(FluxVariablesCache); ...@@ -63,20 +44,28 @@ NEW_PROP_TAG(FluxVariablesCache);
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
namespace Properties { namespace Properties {
SET_INT_PROP(NavierStokesNI, NumEqCellCenter, 2); SET_PROP(StaggeredNonIsothermal, NumEqCellCenter)
{
//! the VolumeVariables property private:
SET_TYPE_PROP(NavierStokesNI, VolumeVariables, NavierStokesNIVolumeVariables<TypeTag>); static constexpr auto isothermalNumEqCellCenter = GET_PROP_VALUE(TypeTag, IsothermalNumEqCellCenter);
SET_TYPE_PROP(NavierStokesNI, Model, NavierStokesNIModel<TypeTag>); public:
SET_TYPE_PROP(NavierStokesNI, Indices, NavierStokesNIIndices<TypeTag>); static constexpr auto value = isothermalNumEqCellCenter + 1;
};
SET_BOOL_PROP(NavierStokesNI, EnableEnergyBalanceStokes, true);
// SET_INT_PROP(StaggeredNonIsothermal, NumEqCellCenter, 2);
SET_BOOL_PROP(NavierStokesNI, UseMoles, true); //
// //! the VolumeVariables property
SET_TYPE_PROP(NavierStokesNI, HeatConductionType, FouriersLaw<TypeTag>); SET_TYPE_PROP(StaggeredNonIsothermal, VolumeVariables, NavierStokesNIVolumeVariables<TypeTag>);
SET_TYPE_PROP(StaggeredNonIsothermal, Model, StaggeredNonIsothermalModel<TypeTag>);
SET_INT_PROP(NavierStokesNI, PhaseIdx, 0); //!< Defines the phaseIdx SET_TYPE_PROP(StaggeredNonIsothermal, Indices, StaggeredNonIsothermalIndices<TypeTag>);
//
SET_BOOL_PROP(StaggeredNonIsothermal, EnableEnergyBalanceStokes, true);
//
SET_BOOL_PROP(StaggeredNonIsothermal, UseMoles, true);
//
SET_TYPE_PROP(StaggeredNonIsothermal, HeatConductionType, FouriersLaw<TypeTag>);
//
SET_INT_PROP(StaggeredNonIsothermal, PhaseIdx, 0); //!< Defines the phaseIdx
} // end namespace Properties } // end namespace Properties
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment