Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dumux-repositories
dumux
Commits
73311da9
Commit
73311da9
authored
Sep 07, 2021
by
Kilian Weishaupt
Committed by
Timo Koch
Sep 15, 2021
Browse files
[ff][staggered] Add energy model
parent
37832831
Changes
6
Hide whitespace changes
Inline
Side-by-side
dumux/freeflow/navierstokes/CMakeLists.txt
View file @
73311da9
add_subdirectory
(
energy
)
add_subdirectory
(
mass
)
add_subdirectory
(
momentum
)
add_subdirectory
(
staggered
)
...
...
dumux/freeflow/navierstokes/energy/CMakeLists.txt
0 → 100644
View file @
73311da9
file
(
GLOB DUMUX_FREEFLOW_NAVIERSTOKES_ENERGY_HEADERS *.hh *.inc
)
install
(
FILES
${
DUMUX_FREEFLOW_NAVIERSTOKES_ENERGY_HEADERS
}
DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
/dumux/freeflow/navierstokes/energy
)
dumux/freeflow/navierstokes/energy/indices.hh
0 → 100644
View file @
73311da9
// -*- 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 3 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
* \ingroup FreeflowNIModel
* \copydoc Dumux::FreeflowNonIsothermalIndices
*/
#ifndef DUMUX_FREEFLOW_NAVIER_STOKES_ENERGY_INDICES_HH
#define DUMUX_FREEFLOW_NAVIER_STOKES_ENERGY_INDICES_HH
namespace
Dumux
{
/*!
* \ingroup FreeflowNIModel
* \brief Indices for the non-isothermal Navier-Stokes model.
*
* \tparam IsothermalIndices The isothermal indices class
* \tparam numEq the number of equations of the non-isothermal model
*/
template
<
class
IsothermalIndices
,
int
numEq
>
class
NavierStokesEnergyIndices
:
public
IsothermalIndices
{
public:
static
constexpr
int
energyEqIdx
=
numEq
-
1
;
static
constexpr
int
temperatureIdx
=
numEq
-
1
;
};
}
// end namespace Dumux
#endif
dumux/freeflow/navierstokes/energy/iofields.hh
0 → 100644
View file @
73311da9
// -*- 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 3 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
* \ingroup FreeflowNIModel
* \copydoc Dumux::FreeflowNonIsothermalIOFields
*/
#ifndef DUMUX_FREEFLOW_NAVIERSTOKES_ENERGY_IO_FIELDS_HH
#define DUMUX_FREEFLOW_NAVIERSTOKES_ENERGY_IO_FIELDS_HH
#include
<dumux/io/name.hh>
namespace
Dumux
{
/*!
* \ingroup FreeflowNIModel
* \brief Adds I/O fields specific to non-isothermal free-flow models
*/
template
<
class
IsothermalIOFields
>
struct
NavierStokesEnergyIOFields
{
//! Add the non-isothermal specific output fields.
template
<
class
OutputModule
>
static
void
initOutputModule
(
OutputModule
&
out
)
{
IsothermalIOFields
::
initOutputModule
(
out
);
out
.
addVolumeVariable
([](
const
auto
&
v
){
return
v
.
temperature
();
},
IOName
::
temperature
());
out
.
addVolumeVariable
([](
const
auto
&
v
){
return
v
.
fluidThermalConductivity
();
},
"lambda"
);
}
//! return the names of the primary variables
template
<
class
ModelTraits
,
class
FluidSystem
=
void
>
static
std
::
string
primaryVariableName
(
int
pvIdx
,
int
state
=
0
)
{
if
(
pvIdx
<
ModelTraits
::
numEq
()
-
1
)
return
IsothermalIOFields
::
template
primaryVariableName
<
ModelTraits
,
FluidSystem
>(
pvIdx
,
state
);
else
return
IOName
::
temperature
();
}
};
}
// end namespace Dumux
#endif
dumux/freeflow/navierstokes/energy/model.hh
0 → 100644
View file @
73311da9
// -*- 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 3 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
* \ingroup FreeflowNIModel
*
* \brief A single-phase, non-isothermal free-flow model
*
* In addition to the momentum and mass/mole balance equations, this model also solves the <B> energy balance equation </B>:
* \f[
* \frac{\partial (\varrho v)}{\partial t}
* + \nabla \cdot \left( \varrho h {\boldsymbol{v}}
* - \lambda_\text{eff} \textbf{grad}\, T \right) - q_T = 0
* \f]
*
*
* For laminar Navier-Stokes flow the effective thermal conductivity is the fluid
* thermal conductivity: \f$ \lambda_\text{eff} = \lambda \f$.
*
* For turbulent Reynolds-averaged Navier-Stokes flow the eddy thermal conductivity is added:
* \f$ \lambda_\text{eff} = \lambda + \lambda_\text{t} \f$.
* The eddy thermal conductivity \f$ \lambda_\text{t} \f$ is related to the eddy viscosity \f$ \nu_\text{t} \f$
* by the turbulent Prandtl number:
* \f[ \lambda_\text{t} = \frac{\nu_\text{t} \varrho c_\text{p}}{\mathrm{Pr}_\text{t}} \f]
*/
#ifndef DUMUX_FREEFLOW_NAVIER_STOKES_ENERGY_MODEL_HH
#define DUMUX_FREEFLOW_NAVIER_STOKES_ENERGY_MODEL_HH
#include
"indices.hh"
#include
"iofields.hh"
namespace
Dumux
{
/*!
* \ingroup FreeflowNIModel
* \brief Specifies a number properties of non-isothermal free-flow
* flow models based on the specifics of a given isothermal model.
* \tparam IsothermalT Model traits of the isothermal model
*/
template
<
class
IsothermalT
>
struct
NavierStokesEnergyModelTraits
:
public
IsothermalT
{
//! Export the isothermal model traits
using
IsothermalTraits
=
IsothermalT
;
//! We solve for one more equation, i.e. the energy balance
static
constexpr
int
numEq
()
{
return
IsothermalTraits
::
numEq
()
+
1
;
}
//! We additionally solve for the equation balance
static
constexpr
bool
enableEnergyBalance
()
{
return
true
;
}
//! the indices
using
Indices
=
NavierStokesEnergyIndices
<
typename
IsothermalTraits
::
Indices
,
numEq
()
>
;
};
}
// end namespace Dumux
#endif
dumux/freeflow/navierstokes/energy/volumevariables.hh
0 → 100644
View file @
73311da9
// -*- 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 3 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
* \ingroup NIModel
* \brief Base class for the model specific class which provides
* access to all volume averaged quantities.
*/
#ifndef DUMUX_FREEFLOW_NAVIER_STOKES_ENERGY_VOLUME_VARIABLES_HH
#define DUMUX_FREEFLOW_NAVIER_STOKES_ENERGY_VOLUME_VARIABLES_HH
#include
<type_traits>
#include
<dune/common/std/type_traits.hh>
namespace
Dumux
{
namespace
Detail
{
struct
EmptyFreeFlowHeatCondType
{};
template
<
bool
enableEnergyBalance
,
class
Traits
>
struct
FreeFlowHeatCondType
{
using
type
=
EmptyFreeFlowHeatCondType
;
};
template
<
class
Traits
>
struct
FreeFlowHeatCondType
<
true
,
Traits
>
{
using
type
=
typename
Traits
::
HeatConductionType
;
};
}
// end namespace Detail
/*!
* \ingroup NIModel
* \brief The isothermal base class
*/
template
<
class
Traits
,
class
Impl
>
class
NavierStokesEnergyVolumeVariables
{
using
Scalar
=
typename
Traits
::
PrimaryVariables
::
value_type
;
static
constexpr
bool
enableEnergyBalance
=
Traits
::
ModelTraits
::
enableEnergyBalance
();
public:
using
FluidState
=
typename
Traits
::
FluidState
;
using
FluidSystem
=
typename
Traits
::
FluidSystem
;
using
HeatConductionType
=
typename
Detail
::
FreeFlowHeatCondType
<
enableEnergyBalance
,
Traits
>::
type
;
/*!
* \brief Returns the temperature at a given sub-control volume
*
* \param elemSol A vector containing all primary variables connected to the element
* \param problem The object specifying the problem which ought to
* be simulated
* \param element An element which contains part of the control volume
* \param scv The sub-control volume
*/
template
<
class
ElementSolution
,
class
Problem
,
class
Element
,
class
SubControlVolume
>
Scalar
getTemperature
(
const
ElementSolution
&
elemSol
,
const
Problem
&
problem
,
const
Element
&
element
,
const
SubControlVolume
&
scv
)
const
{
if
constexpr
(
enableEnergyBalance
)
return
elemSol
[
scv
.
localDofIndex
()][
Traits
::
ModelTraits
::
Indices
::
temperatureIdx
];
else
return
problem
.
temperatureAtPos
(
scv
.
dofPosition
());
}
//! The effective thermal conductivity is zero for isothermal models
void
updateEffectiveThermalConductivity
()
{
if
constexpr
(
enableEnergyBalance
)
lambdaEff_
=
Traits
::
EffectiveThermalConductivityModel
::
effectiveThermalConductivity
(
asImp_
());
}
/*!
* \brief Returns the total internal energy of a phase in the
* sub-control volume.
*
* \param phaseIdx The phase index
*/
Scalar
internalEnergy
(
const
int
phaseIdx
=
0
)
const
{
if
constexpr
(
enableEnergyBalance
)
return
asImp_
().
fluidState
().
internalEnergy
(
0
);
else
return
0.0
;
}
/*!
* \brief Returns the total enthalpy of a phase in the sub-control
* volume.
*
* \param phaseIdx The phase index
*/
Scalar
enthalpy
(
const
int
phaseIdx
=
0
)
const
{
if
constexpr
(
enableEnergyBalance
)
return
asImp_
().
fluidState
().
enthalpy
(
0
);
else
return
0.0
;
}
/*!
* \brief Returns the temperature of a fluid phase assuming thermal nonequilibrium
* the sub-control volume.
* \param phaseIdx The local index of the phases
*/
Scalar
temperatureFluid
(
const
int
phaseIdx
=
0
)
const
{
return
asImp_
().
fluidState
().
temperature
(
0
);
}
/*!
* \brief Returns the thermal conductivity \f$\mathrm{[W/(m*K)]}\f$
* of a fluid phase in the sub-control volume.
*/
Scalar
fluidThermalConductivity
(
const
int
phaseIdx
=
0
)
const
{
return
FluidSystem
::
thermalConductivity
(
asImp_
().
fluidState
(),
0
);
}
/*!
* \brief Returns the effective thermal conductivity \f$\mathrm{[W/(m*K)]}\f$ in
* the sub-control volume. Specific to equilibirum models (case fullThermalEquilibrium).
*/
Scalar
effectiveThermalConductivity
(
const
int
phaseIdx
=
0
)
const
{
return
lambdaEff_
;
}
//! The phase enthalpy is zero for isothermal models
//! This is needed for completing the fluid state
template
<
class
ParameterCache
>
static
Scalar
enthalpy
(
const
FluidState
&
fluidState
,
const
ParameterCache
&
paramCache
)
{
if
constexpr
(
enableEnergyBalance
)
return
FluidSystem
::
enthalpy
(
fluidState
,
paramCache
,
0
);
else
return
0.0
;
}
protected:
Scalar
lambdaEff_
;
const
Impl
&
asImp_
()
const
{
return
*
static_cast
<
const
Impl
*>
(
this
);
}
Impl
&
asImp_
()
{
return
*
static_cast
<
Impl
*>
(
this
);
}
};
}
// end namespace Dumux
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment