From 35a87c38d90d4202d83fe3513e58491fb8ed2001 Mon Sep 17 00:00:00 2001 From: Timo Koch Date: Sat, 18 May 2019 15:22:10 +0200 Subject: [PATCH 1/6] [material] Prefix some header guards with DUMUX --- .../fluidmatrixinteractions/1p/thermalconductivityaverage.hh | 4 ++-- .../fluidmatrixinteractions/2p/thermalconductivityjohansen.hh | 4 ++-- .../2p/thermalconductivitysimplefluidlumping.hh | 4 ++-- .../fluidmatrixinteractions/2p/thermalconductivitysomerton.hh | 4 ++-- .../3p/thermalconductivitysomerton3p.hh | 4 ++-- .../fluidmatrixinteractions/diffusivityconstanttortuosity.hh | 4 ++-- .../fluidmatrixinteractions/diffusivitymillingtonquirk.hh | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/dumux/material/fluidmatrixinteractions/1p/thermalconductivityaverage.hh b/dumux/material/fluidmatrixinteractions/1p/thermalconductivityaverage.hh index d749f29544..e3fb2f519e 100644 --- a/dumux/material/fluidmatrixinteractions/1p/thermalconductivityaverage.hh +++ b/dumux/material/fluidmatrixinteractions/1p/thermalconductivityaverage.hh @@ -21,8 +21,8 @@ * \ingroup Fluidmatrixinteractions * \brief Reation for a simple effective thermal conductivity */ -#ifndef THERMALCONDUCTIVITY_AVERAGE_HH -#define THERMALCONDUCTIVITY_AVERAGE_HH +#ifndef DUMUX_MATERIAL_THERMALCONDUCTIVITY_AVERAGE_HH +#define DUMUX_MATERIAL_THERMALCONDUCTIVITY_AVERAGE_HH #include diff --git a/dumux/material/fluidmatrixinteractions/2p/thermalconductivityjohansen.hh b/dumux/material/fluidmatrixinteractions/2p/thermalconductivityjohansen.hh index 44ed8b858e..aa77b0cf62 100644 --- a/dumux/material/fluidmatrixinteractions/2p/thermalconductivityjohansen.hh +++ b/dumux/material/fluidmatrixinteractions/2p/thermalconductivityjohansen.hh @@ -21,8 +21,8 @@ * \ingroup Fluidmatrixinteractions * \brief Relation for the saturation-dependent effective thermal conductivity */ -#ifndef THERMALCONDUCTIVITY_JOHANSEN_HH -#define THERMALCONDUCTIVITY_JOHANSEN_HH +#ifndef DUMUX_MATERIAL_THERMALCONDUCTIVITY_JOHANSEN_HH +#define DUMUX_MATERIAL_THERMALCONDUCTIVITY_JOHANSEN_HH #include #include diff --git a/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysimplefluidlumping.hh b/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysimplefluidlumping.hh index cc8c2fe791..6af6c99348 100644 --- a/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysimplefluidlumping.hh +++ b/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysimplefluidlumping.hh @@ -21,8 +21,8 @@ * \ingroup Fluidmatrixinteractions * \brief Relation for the saturation-dependent effective thermal conductivity */ -#ifndef THERMALCONDUCTIVITY_SIMPLE_FLUID_LUMPING_HH -#define THERMALCONDUCTIVITY_SIMPLE_FLUID_LUMPING_HH +#ifndef DUMUX_MATERIAL_THERMALCONDUCTIVITY_SIMPLE_FLUID_LUMPING_HH +#define DUMUX_MATERIAL_THERMALCONDUCTIVITY_SIMPLE_FLUID_LUMPING_HH #include #include diff --git a/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh b/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh index 6f1033a355..c8e42067e5 100644 --- a/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh +++ b/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh @@ -21,8 +21,8 @@ * \ingroup Fluidmatrixinteractions * \brief Relation for the saturation-dependent effective thermal conductivity */ -#ifndef THERMALCONDUCTIVITY_SOMERTON_HH -#define THERMALCONDUCTIVITY_SOMERTON_HH +#ifndef DUMUX_MATERIAL_THERMALCONDUCTIVITY_SOMERTON_HH +#define DUMUX_MATERIAL_THERMALCONDUCTIVITY_SOMERTON_HH #include #include diff --git a/dumux/material/fluidmatrixinteractions/3p/thermalconductivitysomerton3p.hh b/dumux/material/fluidmatrixinteractions/3p/thermalconductivitysomerton3p.hh index 9becaa4597..07a25aa533 100644 --- a/dumux/material/fluidmatrixinteractions/3p/thermalconductivitysomerton3p.hh +++ b/dumux/material/fluidmatrixinteractions/3p/thermalconductivitysomerton3p.hh @@ -21,8 +21,8 @@ * \ingroup Fluidmatrixinteractions * \brief Relation for the saturation-dependent effective thermal conductivity */ -#ifndef THERMALCONDUCTIVITY_SOMERTON_3P_HH -#define THERMALCONDUCTIVITY_SOMERTON_3P_HH +#ifndef DUMUX_MATERIAL_THERMALCONDUCTIVITY_SOMERTON_3P_HH +#define DUMUX_MATERIAL_THERMALCONDUCTIVITY_SOMERTON_3P_HH #include #include diff --git a/dumux/material/fluidmatrixinteractions/diffusivityconstanttortuosity.hh b/dumux/material/fluidmatrixinteractions/diffusivityconstanttortuosity.hh index 90690ba4c2..18678f1577 100644 --- a/dumux/material/fluidmatrixinteractions/diffusivityconstanttortuosity.hh +++ b/dumux/material/fluidmatrixinteractions/diffusivityconstanttortuosity.hh @@ -21,8 +21,8 @@ * \ingroup Fluidmatrixinteractions * \brief Relation for the saturation-dependent effective diffusion coefficient */ -#ifndef DIFFUSIVITY_CONSTANT_TORTUOSITY_HH -#define DIFFUSIVITY_CONSTANT_TORTUOSITY_HH +#ifndef DUMUX_MATERIAL_DIFFUSIVITY_CONSTANT_TORTUOSITY_HH +#define DUMUX_MATERIAL_DIFFUSIVITY_CONSTANT_TORTUOSITY_HH #include diff --git a/dumux/material/fluidmatrixinteractions/diffusivitymillingtonquirk.hh b/dumux/material/fluidmatrixinteractions/diffusivitymillingtonquirk.hh index db34ccd7af..57ba6a9d66 100644 --- a/dumux/material/fluidmatrixinteractions/diffusivitymillingtonquirk.hh +++ b/dumux/material/fluidmatrixinteractions/diffusivitymillingtonquirk.hh @@ -21,8 +21,8 @@ * \ingroup Fluidmatrixinteractions * \brief Relation for the saturation-dependent effective diffusion coefficient */ -#ifndef DIFFUSIVITY_MILLINGTON_QUIRK_HH -#define DIFFUSIVITY_MILLINGTON_QUIRK_HH +#ifndef DUMUX_MATERIAL_DIFFUSIVITY_MILLINGTON_QUIRK_HH +#define DUMUX_MATERIAL_DIFFUSIVITY_MILLINGTON_QUIRK_HH #include -- GitLab From fa48965bb35debcc45675900ad64b3453895821e Mon Sep 17 00:00:00 2001 From: Timo Koch Date: Sat, 18 May 2019 15:23:14 +0200 Subject: [PATCH 2/6] [material] Simplify interface for effective thermal conductivity laws This will lead to a more unified interface for effective laws. Any dependence on spatial parameters ca be introduced via the volume variables and seems misplaced here. Also, effective diffusion laws do not have such a blown-up interface anyway. --- .../1p/thermalconductivityaverage.hh | 34 +++++++------ .../2p/thermalconductivityjohansen.hh | 29 +++++++---- .../thermalconductivitysimplefluidlumping.hh | 40 +++++++++------ .../2p/thermalconductivitysomerton.hh | 29 +++++++---- .../3p/thermalconductivitysomerton3p.hh | 50 +++++++++++-------- 5 files changed, 109 insertions(+), 73 deletions(-) diff --git a/dumux/material/fluidmatrixinteractions/1p/thermalconductivityaverage.hh b/dumux/material/fluidmatrixinteractions/1p/thermalconductivityaverage.hh index e3fb2f519e..59a449a750 100644 --- a/dumux/material/fluidmatrixinteractions/1p/thermalconductivityaverage.hh +++ b/dumux/material/fluidmatrixinteractions/1p/thermalconductivityaverage.hh @@ -26,6 +26,7 @@ #include +#include namespace Dumux { @@ -38,27 +39,32 @@ class ThermalConductivityAverage { public: /*! - * \brief Relation for a simple effective thermal conductivity \f$\mathrm{[W/(m K)]}\f$ - * - * \param volVars volume variables - * \param spatialParams spatial parameters - * \param element element (to be passed to spatialParams) - * \param fvGeometry fvGeometry (to be passed to spatialParams) - * \param scv scv (to be passed to spatialParams) - * - * \return effective thermal conductivity \f$\mathrm{[W/(m K)]}\f$ + * \brief effective thermal conductivity \f$\mathrm{[W/(m K)]}\f$ */ - template + template + DUNE_DEPRECATED_MSG("Signature deprecated. Use signature with volume variables only!") static Scalar effectiveThermalConductivity(const VolumeVariables& volVars, const SpatialParams& spatialParams, const Element& element, const FVGeometry& fvGeometry, - const SubControlVolume& scv) + const typename FVGeometry::SubControlVolume& scv) + { + return effectiveThermalConductivity(volVars); + } + + /*! + * \brief Relation for a simple effective thermal conductivity \f$\mathrm{[W/(m K)]}\f$ + * + * \param volVars volume variables + * \return effective thermal conductivity \f$\mathrm{[W/(m K)]}\f$ + */ + template + static Scalar effectiveThermalConductivity(const VolumeVariables& volVars) { //Get the thermal conductivities and the porosity from the volume variables - Scalar lambdaW = volVars.fluidThermalConductivity(0); - Scalar lambdaSolid = volVars.solidThermalConductivity(); - Scalar porosity = volVars.porosity(); + const Scalar lambdaW = volVars.fluidThermalConductivity(0); + const Scalar lambdaSolid = volVars.solidThermalConductivity(); + const Scalar porosity = volVars.porosity(); return lambdaSolid*(1-porosity) + lambdaW*porosity; } diff --git a/dumux/material/fluidmatrixinteractions/2p/thermalconductivityjohansen.hh b/dumux/material/fluidmatrixinteractions/2p/thermalconductivityjohansen.hh index aa77b0cf62..c98ef3ab5b 100644 --- a/dumux/material/fluidmatrixinteractions/2p/thermalconductivityjohansen.hh +++ b/dumux/material/fluidmatrixinteractions/2p/thermalconductivityjohansen.hh @@ -27,6 +27,8 @@ #include #include +#include + namespace Dumux { struct JohansenIndices @@ -65,15 +67,24 @@ template class ThermalConductivityJohansen { public: + /*! + * \brief effective thermal conductivity \f$\mathrm{[W/(m K)]}\f$ after Johansen (1975) \cite johansen1977
+ */ + template + DUNE_DEPRECATED_MSG("Signature deprecated. Use signature with volume variables only!") + static Scalar effectiveThermalConductivity(const VolumeVariables& volVars, + const SpatialParams& spatialParams, + const Element& element, + const FVGeometry& fvGeometry, + const typename FVGeometry::SubControlVolume& scv) + { + return effectiveThermalConductivity(volVars); + } + /*! * \brief Returns the effective thermal conductivity \f$\mathrm{[W/(m K)]}\f$ after Johansen (1975) \cite johansen1977 . * * \param volVars volume variables - * \param spatialParams spatial parameters - * \param element element (to be passed to spatialParams) - * \param fvGeometry fvGeometry (to be passed to spatialParams) - * \param scv the sub control volume (to be passed to spatialParams) - * * \return Effective thermal conductivity \f$\mathrm{[W/(m K)]}\f$ after Johansen (1975) \cite johansen1977
* * This formulation is semi-empirical and fitted to quartz sand. @@ -85,12 +96,8 @@ public: * of Sci. and Technol., Trondheim. (Draft Transl. 637. 1977. U.S. Army * Corps of Eng., Cold Regions Res. and Eng. Lab., Hanover, NH.) \cite johansen1977 */ - template - static Scalar effectiveThermalConductivity(const VolumeVariables& volVars, - const SpatialParams& spatialParams, - const Element& element, - const FVGeometry& fvGeometry, - const SubControlVolume& scv) + template + static Scalar effectiveThermalConductivity(const VolumeVariables& volVars) { const Scalar sw = volVars.saturation(Indices::wPhaseIdx); const Scalar lambdaW = volVars.fluidThermalConductivity(Indices::wPhaseIdx); diff --git a/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysimplefluidlumping.hh b/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysimplefluidlumping.hh index 6af6c99348..07cee18245 100644 --- a/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysimplefluidlumping.hh +++ b/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysimplefluidlumping.hh @@ -27,6 +27,8 @@ #include #include +#include + namespace Dumux { /*! @@ -40,29 +42,35 @@ class ThermalConductivitySimpleFluidLumping public: /*! - * \brief Effective thermal conductivity \f$\mathrm{[W/(m K)]}\f$ - * - * \param volVars volume variables - * \param spatialParams spatial parameters - * \param element element (to be passed to spatialParams) - * \param fvGeometry fvGeometry (to be passed to spatialParams) - * \param scv the sub-control volume - * \todo TODO: Fix this law for changing wettability - * \return effective thermal conductivity \f$\mathrm{[W/(m K)]}\f$ + * \brief effective thermal conductivity \f$\mathrm{[W/(m K)]}\f$ */ - template + template + DUNE_DEPRECATED_MSG("Signature deprecated. Use signature with volume variables only!") static Scalar effectiveThermalConductivity(const VolumeVariables& volVars, const SpatialParams& spatialParams, const Element& element, const FVGeometry& fvGeometry, - SubControlVolume& scv) + const typename FVGeometry::SubControlVolume& scv) + { + return effectiveThermalConductivity(volVars); + } + + /*! + * \brief Effective thermal conductivity \f$\mathrm{[W/(m K)]}\f$ + * + * \param volVars volume variables + * \return effective thermal conductivity \f$\mathrm{[W/(m K)]}\f$ + * \todo TODO: Fix this law for changing wettability + */ + template + static Scalar effectiveThermalConductivity(const VolumeVariables& volVars) { using FluidSystem = typename VolumeVariables::FluidSystem; - Scalar sw = volVars.saturation(FluidSystem::phase0Idx); - Scalar lambdaW = volVars.fluidThermalConductivity(FluidSystem::phase0Idx); - Scalar lambdaN = volVars.fluidThermalConductivity(FluidSystem::phase1Idx); - Scalar lambdaSolid = volVars.solidThermalConductivity(); - Scalar porosity = volVars.porosity(); + const Scalar sw = volVars.saturation(FluidSystem::phase0Idx); + const Scalar lambdaW = volVars.fluidThermalConductivity(FluidSystem::phase0Idx); + const Scalar lambdaN = volVars.fluidThermalConductivity(FluidSystem::phase1Idx); + const Scalar lambdaSolid = volVars.solidThermalConductivity(); + const Scalar porosity = volVars.porosity(); return effectiveThermalConductivity(sw, lambdaW, lambdaN, lambdaSolid, porosity); } diff --git a/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh b/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh index c8e42067e5..187381ea85 100644 --- a/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh +++ b/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh @@ -27,6 +27,8 @@ #include #include +#include + namespace Dumux { /*! @@ -59,15 +61,24 @@ template class ThermalConductivitySomerton { public: + /*! + * \brief effective thermal conductivity \f$\mathrm{[W/(m K)]}\f$ after Somerton (1974) \cite somerton1974
+ */ + template + DUNE_DEPRECATED_MSG("Signature deprecated. Use signature with volume variables only!") + static Scalar effectiveThermalConductivity(const VolumeVariables& volVars, + const SpatialParams& spatialParams, + const Element& element, + const FVGeometry& fvGeometry, + const typename FVGeometry::SubControlVolume& scv) + { + return effectiveThermalConductivity(volVars); + } + /*! * \brief effective thermal conductivity \f$\mathrm{[W/(m K)]}\f$ after Somerton (1974) \cite somerton1974
* * \param volVars volume variables - * \param spatialParams spatial parameters - * \param element element (to be passed to spatialParams) - * \param fvGeometry fvGeometry (to be passed to spatialParams) - * \param scv the sub control volume (to be passed to spatialParams) - * * \return effective thermal conductivity \f$\mathrm{[W/(m K)]}\f$ after Somerton (1974) \cite somerton1974
* * This gives an interpolation of the effective thermal conductivities of a porous medium @@ -76,12 +87,8 @@ public: * fluid conductivities and interpolated with the square root of the wetting saturation. * See f.e. Ebigbo, A.: Thermal Effects of Carbon Dioxide Sequestration in the Subsurface, Diploma thesis \cite ebigbo2005 . */ - template - static Scalar effectiveThermalConductivity(const VolumeVariables& volVars, - const SpatialParams& spatialParams, - const Element& element, - const FVGeometry& fvGeometry, - const typename FVGeometry::SubControlVolume& scv) + template + static Scalar effectiveThermalConductivity(const VolumeVariables& volVars) { using FluidSystem = typename VolumeVariables::FluidSystem; static_assert(FluidSystem::numPhases == 2, "ThermalConductivitySomerton only works for two-phase fluid systems!"); diff --git a/dumux/material/fluidmatrixinteractions/3p/thermalconductivitysomerton3p.hh b/dumux/material/fluidmatrixinteractions/3p/thermalconductivitysomerton3p.hh index 07a25aa533..b66b26e708 100644 --- a/dumux/material/fluidmatrixinteractions/3p/thermalconductivitysomerton3p.hh +++ b/dumux/material/fluidmatrixinteractions/3p/thermalconductivitysomerton3p.hh @@ -27,6 +27,8 @@ #include #include +#include + namespace Dumux { /*! @@ -64,14 +66,24 @@ template class ThermalConductivitySomerton { public: + /*! + * \brief effective thermal conductivity \f$\mathrm{[W/(m K)]}\f$ after Somerton (1974) extended for a three phase system + */ + template + DUNE_DEPRECATED_MSG("Signature deprecated. Use signature with volume variables only!") + static Scalar effectiveThermalConductivity(const VolumeVariables& volVars, + const SpatialParams& spatialParams, + const Element& element, + const FVGeometry& fvGeometry, + const typename FVGeometry::SubControlVolume& scv) + { + return effectiveThermalConductivity(volVars); + } + /*! * \brief effective thermal conductivity \f$\mathrm{[W/(m K)]}\f$ after Somerton (1974) extended for a three phase system * * \param volVars volume variables - * \param spatialParams spatial parameters - * \param element element (to be passed to spatialParams) - * \param fvGeometry fvGeometry (to be passed to spatialParams) - * \param scv The sub control volume * * \return effective thermal conductivity \f$\mathrm{[W/(m K)]}\f$ after Somerton (1974) * @@ -80,22 +92,18 @@ public: * These two effective conductivities are computed as geometric mean of the solid and the * fluid conductivities and interpolated with the square root of the wetting saturation. */ - template - static Scalar effectiveThermalConductivity(const VolumeVariables& volVars, - const SpatialParams& spatialParams, - const Element& element, - const FVGeometry& fvGeometry, - const typename FVGeometry::SubControlVolume& scv) + template + static Scalar effectiveThermalConductivity(const VolumeVariables& volVars) { using FluidSystem = typename VolumeVariables::FluidSystem; - Scalar sw = volVars.saturation(FluidSystem::wPhaseIdx); - Scalar sn = volVars.saturation(FluidSystem::nPhaseIdx); - Scalar lambdaW = volVars.fluidThermalConductivity(FluidSystem::wPhaseIdx); - Scalar lambdaN = volVars.fluidThermalConductivity(FluidSystem::nPhaseIdx); - Scalar lambdaG = volVars.fluidThermalConductivity(FluidSystem::gPhaseIdx); - Scalar lambdaSolid = volVars.solidThermalConductivity(); - Scalar porosity = volVars.porosity(); + const Scalar sw = volVars.saturation(FluidSystem::wPhaseIdx); + const Scalar sn = volVars.saturation(FluidSystem::nPhaseIdx); + const Scalar lambdaW = volVars.fluidThermalConductivity(FluidSystem::wPhaseIdx); + const Scalar lambdaN = volVars.fluidThermalConductivity(FluidSystem::nPhaseIdx); + const Scalar lambdaG = volVars.fluidThermalConductivity(FluidSystem::gPhaseIdx); + const Scalar lambdaSolid = volVars.solidThermalConductivity(); + const Scalar porosity = volVars.porosity(); return effectiveThermalConductivity(sw, sn, lambdaW, lambdaN, lambdaG, lambdaSolid, porosity); } @@ -131,10 +139,10 @@ public: // const Scalar lSn = 0.65; //pow(lambdaSolid, (1.0 - porosity)) * pow(lambdaN, porosity); // const Scalar lSg = 0.35; //pow(lambdaSolid, (1.0 - porosity)) * pow(lambdaG, porosity); // porosity weighted geometric mean - Scalar lSw = pow(lambdaSolid, (1.0 - porosity)) * pow(lambdaW, porosity); - Scalar lSn = pow(lambdaSolid, (1.0 - porosity)) * pow(lambdaN, porosity); - Scalar lSg = pow(lambdaSolid, (1.0 - porosity)) * pow(lambdaG, porosity); - Scalar lambdaEff = lSg + sqrt(satW) * (lSw - lSg) + sqrt(satN) * (lSn -lSg); + const Scalar lSw = pow(lambdaSolid, (1.0 - porosity)) * pow(lambdaW, porosity); + const Scalar lSn = pow(lambdaSolid, (1.0 - porosity)) * pow(lambdaN, porosity); + const Scalar lSg = pow(lambdaSolid, (1.0 - porosity)) * pow(lambdaG, porosity); + const Scalar lambdaEff = lSg + sqrt(satW) * (lSw - lSg) + sqrt(satN) * (lSn -lSg); return lambdaEff; -- GitLab From e9a835173b66fe7f042e92de0fb04195b456a2b6 Mon Sep 17 00:00:00 2001 From: Timo Koch Date: Sat, 18 May 2019 15:59:14 +0200 Subject: [PATCH 3/6] [material] Make thermalcond average work for multiple phases --- .../1p/thermalconductivityaverage.hh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/dumux/material/fluidmatrixinteractions/1p/thermalconductivityaverage.hh b/dumux/material/fluidmatrixinteractions/1p/thermalconductivityaverage.hh index 59a449a750..4dfad09861 100644 --- a/dumux/material/fluidmatrixinteractions/1p/thermalconductivityaverage.hh +++ b/dumux/material/fluidmatrixinteractions/1p/thermalconductivityaverage.hh @@ -61,13 +61,20 @@ public: template static Scalar effectiveThermalConductivity(const VolumeVariables& volVars) { - //Get the thermal conductivities and the porosity from the volume variables - const Scalar lambdaW = volVars.fluidThermalConductivity(0); + constexpr int numFluidPhases = VolumeVariables::numFluidPhases(); + + // Get the thermal conductivities and the porosity from the volume variables + Scalar lambdaFluid = 0.0; + for (int phaseIdx = 0; phaseIdx < numFluidPhases; ++phaseIdx) + lambdaFluid += volVars.fluidThermalConductivity(phaseIdx)*volVars.saturation(phaseIdx); + const Scalar lambdaSolid = volVars.solidThermalConductivity(); const Scalar porosity = volVars.porosity(); - return lambdaSolid*(1-porosity) + lambdaW*porosity; + return lambdaSolid*(1-porosity) + lambdaFluid*porosity; } }; + } // end namespace Dumux + #endif -- GitLab From bda4f0d6dee20cb6e9fa420835c62691e47bb6b8 Mon Sep 17 00:00:00 2001 From: Timo Koch Date: Sat, 18 May 2019 15:59:41 +0200 Subject: [PATCH 4/6] [material] Add static assert that ThCondJohansen only works for 2 phases --- .../fluidmatrixinteractions/2p/thermalconductivityjohansen.hh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dumux/material/fluidmatrixinteractions/2p/thermalconductivityjohansen.hh b/dumux/material/fluidmatrixinteractions/2p/thermalconductivityjohansen.hh index c98ef3ab5b..f8f74b2fc9 100644 --- a/dumux/material/fluidmatrixinteractions/2p/thermalconductivityjohansen.hh +++ b/dumux/material/fluidmatrixinteractions/2p/thermalconductivityjohansen.hh @@ -99,6 +99,10 @@ public: template static Scalar effectiveThermalConductivity(const VolumeVariables& volVars) { + using FluidSystem = typename VolumeVariables::FluidSystem; + static_assert(FluidSystem::numPhases == 2, "ThermalConductivitySomerton only works for two-phase fluid systems!"); + // TODO: there should be an assertion that the indices are correct and 0 is actually the wetting phase! + const Scalar sw = volVars.saturation(Indices::wPhaseIdx); const Scalar lambdaW = volVars.fluidThermalConductivity(Indices::wPhaseIdx); const Scalar lambdaN = volVars.fluidThermalConductivity(Indices::nPhaseIdx); -- GitLab From ace93b20d03b8bba84fcc8d2680373b6b9b9e79e Mon Sep 17 00:00:00 2001 From: Timo Koch Date: Fri, 24 May 2019 17:15:37 +0200 Subject: [PATCH 5/6] [common] Add a deprecation helper for eff thermal conductivities --- dumux/common/CMakeLists.txt | 1 + dumux/common/deprecated.hh | 87 +++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 dumux/common/deprecated.hh diff --git a/dumux/common/CMakeLists.txt b/dumux/common/CMakeLists.txt index c743fc2994..9d6635fe38 100644 --- a/dumux/common/CMakeLists.txt +++ b/dumux/common/CMakeLists.txt @@ -11,6 +11,7 @@ boundingboxtree.hh cubicspline.hh defaultmappertraits.hh defaultusagemessage.hh +deprecated.hh dimensionlessnumbers.hh dumuxmessage.hh entitymap.hh diff --git a/dumux/common/deprecated.hh b/dumux/common/deprecated.hh new file mode 100644 index 0000000000..9b6236d6d7 --- /dev/null +++ b/dumux/common/deprecated.hh @@ -0,0 +1,87 @@ +// -*- 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 . * + *****************************************************************************/ +/*! + * \file + * \ingroup Common + * \brief Helpers for deprecation + */ + +#ifndef DUMUX_COMMON_DEPRECATED_HH +#define DUMUX_COMMON_DEPRECATED_HH + +#include + +#include + +#include + +namespace Dumux { + +#ifndef DOXYGEN // hide from doxygen +// Helper classes/functions for deprecation +// Each implementation has to state after which release +// it will be removed. Implementations in the Deprecated +// namespace will be removed without +// deprecation after their usage in the code exprired, +// so most likely you don't want to use this in your code +namespace Deprecated { + +//////////////////////////////////////////////////////// +///// REMOVE THIS AFTER RELEASE 3.1 +//////////////////////////////////////////////////////// + + +// support old interface of the effective thermal conductivity laws +template +struct HasNewEffThermCondIF +{ + template + auto operator()(ETC&& e) -> decltype(e.effectiveThermalConductivity(std::declval())) {} +}; + +template()).template check())::value, int> = 0> +auto effectiveThermalConductivity(const VV& volVars, + const SpatialParams& spatialParams, + const Element& element, + const FVGeometry& fvGeometry, + const typename FVGeometry::SubControlVolume& scv) +{ + return ETC::effectiveThermalConductivity(volVars, spatialParams, element, fvGeometry, scv); +} + +template()).template check())::value, int> = 0> +auto effectiveThermalConductivity(const VV& volVars, + const SpatialParams& spatialParams, + const Element& element, + const FVGeometry& fvGeometry, + const typename FVGeometry::SubControlVolume& scv) +{ + return ETC::effectiveThermalConductivity(volVars); +} +//////////////////////////////////////////////////////// +//////////////////////////////////////////////////////// + +} // end namespace Deprecated +#endif + +} // end namespace Dumux + +#endif -- GitLab From 93f85674a17212410f79bba8a55571cfcfc81d21 Mon Sep 17 00:00:00 2001 From: Timo Koch Date: Fri, 24 May 2019 17:15:02 +0200 Subject: [PATCH 6/6] Remove deprecation warnings from eff thermal cond interface --- .../cellcentered/mpfa/tensorlambdafactory.hh | 9 ++++----- dumux/flux/box/fourierslaw.hh | 7 +++++-- dumux/flux/box/fourierslawnonequilibrium.hh | 8 ++++++-- dumux/flux/cctpfa/fourierslaw.hh | 16 ++++++---------- dumux/flux/cctpfa/fourierslawnonequilibrium.hh | 7 +++++-- .../boundary/stokesdarcy/couplingdata.hh | 4 +++- .../implicit/nonisothermal/problem_conduction.hh | 3 +-- .../1p2c/nonisothermal/conduction/problem.hh | 3 +-- .../3p/implicit/conduction/problem.hh | 3 +-- .../implicit/nonisothermal/conduction/problem.hh | 3 +-- .../implicit/nonisothermal/convection/problem.hh | 3 +-- 11 files changed, 34 insertions(+), 32 deletions(-) diff --git a/dumux/discretization/cellcentered/mpfa/tensorlambdafactory.hh b/dumux/discretization/cellcentered/mpfa/tensorlambdafactory.hh index 7821049def..f1e0076220 100644 --- a/dumux/discretization/cellcentered/mpfa/tensorlambdafactory.hh +++ b/dumux/discretization/cellcentered/mpfa/tensorlambdafactory.hh @@ -33,6 +33,8 @@ #include #include +#include // effective thermal conductivity interface + namespace Dumux { /*! @@ -87,11 +89,8 @@ public: const auto& volVars, const auto& fvGeometry, const auto& scv) - { return ThermalConductivityModel::effectiveThermalConductivity(volVars, - problem.spatialParams(), - element, - fvGeometry, - scv); }; + { return Deprecated::template effectiveThermalConductivity( + volVars, problem.spatialParams(), element, fvGeometry, scv); }; } }; diff --git a/dumux/flux/box/fourierslaw.hh b/dumux/flux/box/fourierslaw.hh index b8d2d62a4f..bfcf3c031c 100644 --- a/dumux/flux/box/fourierslaw.hh +++ b/dumux/flux/box/fourierslaw.hh @@ -28,6 +28,7 @@ #include #include #include +#include namespace Dumux { @@ -67,8 +68,10 @@ public: const auto& outsideVolVars = elemVolVars[outsideScv]; // effective diffusion tensors - auto insideLambda = ThermalConductivityModel::effectiveThermalConductivity(insideVolVars, problem.spatialParams(), element, fvGeometry, insideScv); - auto outsideLambda = ThermalConductivityModel::effectiveThermalConductivity(outsideVolVars, problem.spatialParams(), element, fvGeometry, outsideScv); + auto insideLambda = Deprecated::template effectiveThermalConductivity( + insideVolVars, problem.spatialParams(), element, fvGeometry, insideScv); + auto outsideLambda = Deprecated::template effectiveThermalConductivity( + outsideVolVars, problem.spatialParams(), element, fvGeometry, outsideScv); // scale by extrusion factor insideLambda *= insideVolVars.extrusionFactor(); diff --git a/dumux/flux/box/fourierslawnonequilibrium.hh b/dumux/flux/box/fourierslawnonequilibrium.hh index 4838dfd709..a969bfc318 100644 --- a/dumux/flux/box/fourierslawnonequilibrium.hh +++ b/dumux/flux/box/fourierslawnonequilibrium.hh @@ -29,9 +29,11 @@ #include #include +#include #include + namespace Dumux { // forward declaration @@ -81,8 +83,10 @@ public: //when number of energyEq for the fluid are smaller than numPhases that means that we need an effecitve law if (numEnergyEqFluid < ModelTraits::numFluidPhases()) { - insideLambda += ThermalConductivityModel::effectiveThermalConductivity(insideVolVars, problem.spatialParams(), element, fvGeometry, insideScv); - outsideLambda += ThermalConductivityModel::effectiveThermalConductivity(outsideVolVars, problem.spatialParams(), element, fvGeometry, outsideScv); + insideLambda += Deprecated::template effectiveThermalConductivity( + insideVolVars, problem.spatialParams(), element, fvGeometry, insideScv); + outsideLambda += Deprecated::template effectiveThermalConductivity( + outsideVolVars, problem.spatialParams(), element, fvGeometry, outsideScv); } else { diff --git a/dumux/flux/cctpfa/fourierslaw.hh b/dumux/flux/cctpfa/fourierslaw.hh index de30a6a03c..65947081bc 100644 --- a/dumux/flux/cctpfa/fourierslaw.hh +++ b/dumux/flux/cctpfa/fourierslaw.hh @@ -30,6 +30,8 @@ #include #include +#include // effective thermal conductivity interface + namespace Dumux { // forward declaration @@ -142,11 +144,8 @@ public: const auto& insideScv = fvGeometry.scv(insideScvIdx); const auto& insideVolVars = elemVolVars[insideScvIdx]; - const auto insideLambda = ThermalConductivityModel::effectiveThermalConductivity(insideVolVars, - problem.spatialParams(), - element, - fvGeometry, - insideScv); + const auto insideLambda = Deprecated::template effectiveThermalConductivity( + insideVolVars, problem.spatialParams(), element, fvGeometry, insideScv); const Scalar ti = computeTpfaTransmissibility(scvf, insideScv, insideLambda, insideVolVars.extrusionFactor()); // for the boundary (dirichlet) or at branching points we only need ti @@ -162,11 +161,8 @@ public: const auto& outsideVolVars = elemVolVars[outsideScvIdx]; const auto outsideElement = fvGeometry.fvGridGeometry().element(outsideScvIdx); - const auto outsideLambda = ThermalConductivityModel::effectiveThermalConductivity(outsideVolVars, - problem.spatialParams(), - outsideElement, - fvGeometry, - outsideScv); + const auto outsideLambda = Deprecated::template effectiveThermalConductivity( + outsideVolVars, problem.spatialParams(), outsideElement, fvGeometry, outsideScv); Scalar tj; if (dim == dimWorld) // assume the normal vector from outside is anti parallel so we save flipping a vector diff --git a/dumux/flux/cctpfa/fourierslawnonequilibrium.hh b/dumux/flux/cctpfa/fourierslawnonequilibrium.hh index 1b33d5cab8..3b478195fa 100644 --- a/dumux/flux/cctpfa/fourierslawnonequilibrium.hh +++ b/dumux/flux/cctpfa/fourierslawnonequilibrium.hh @@ -24,6 +24,7 @@ #ifndef DUMUX_DISCRETIZATION_CC_TPFA_FOURIERS_LAW_NONEQUILIBRIUM_HH #define DUMUX_DISCRETIZATION_CC_TPFA_FOURIERS_LAW_NONEQUILIBRIUM_HH +#include #include #include #include @@ -117,7 +118,8 @@ public: //when number of energyEq for the fluid are smaller than numPhases that means that we need an effecitve law if (numEnergyEqFluid < ModelTraits::numFluidPhases()) { - insideLambda += ThermalConductivityModel::effectiveThermalConductivity(insideVolVars, problem.spatialParams(), element, fvGeometry, insideScv); + insideLambda += Deprecated::template effectiveThermalConductivity( + insideVolVars, problem.spatialParams(), element, fvGeometry, insideScv); } else //numEnergyEqFluid >1 { @@ -150,7 +152,8 @@ public: //when number of energyEq for the fluid are smaller than numPhases that means that we need an effecitve law if (numEnergyEqFluid < ModelTraits::numFluidPhases()) { - outsideLambda += ThermalConductivityModel::effectiveThermalConductivity(outsideVolVars, problem.spatialParams(), element, fvGeometry, outsideScv); + outsideLambda += Deprecated::template effectiveThermalConductivity( + outsideVolVars, problem.spatialParams(), element, fvGeometry, outsideScv); } else { diff --git a/dumux/multidomain/boundary/stokesdarcy/couplingdata.hh b/dumux/multidomain/boundary/stokesdarcy/couplingdata.hh index 47162178cd..dca966f4e9 100644 --- a/dumux/multidomain/boundary/stokesdarcy/couplingdata.hh +++ b/dumux/multidomain/boundary/stokesdarcy/couplingdata.hh @@ -31,6 +31,7 @@ #include #include #include +#include namespace Dumux { @@ -423,7 +424,8 @@ protected: { using ThermalConductivityModel = GetPropType, Properties::ThermalConductivityModel>; const auto& problem = this->couplingManager().problem(darcyIdx); - return ThermalConductivityModel::effectiveThermalConductivity(volVars, problem.spatialParams(), fvGeometry.fvGridGeometry().element(scv), fvGeometry, scv); + return Deprecated::template effectiveThermalConductivity( + volVars, problem.spatialParams(), fvGeometry.fvGridGeometry().element(scv), fvGeometry, scv); } /*! diff --git a/test/porousmediumflow/1p/implicit/nonisothermal/problem_conduction.hh b/test/porousmediumflow/1p/implicit/nonisothermal/problem_conduction.hh index 917347ae46..e41a276186 100644 --- a/test/porousmediumflow/1p/implicit/nonisothermal/problem_conduction.hh +++ b/test/porousmediumflow/1p/implicit/nonisothermal/problem_conduction.hh @@ -172,8 +172,7 @@ public: const auto densityS = volVars.solidDensity(); const auto heatCapacityS = volVars.solidHeatCapacity(); const auto storage = densityW*heatCapacityW*porosity + densityS*heatCapacityS*(1 - porosity); - const auto effectiveThermalConductivity = ThermalConductivityModel::effectiveThermalConductivity(volVars, this->spatialParams(), - someElement, someFvGeometry, someScv); + const auto effectiveThermalConductivity = ThermalConductivityModel::effectiveThermalConductivity(volVars); using std::max; time = max(time, 1e-10); for (const auto& element : elements(this->fvGridGeometry().gridView())) diff --git a/test/porousmediumflow/1pnc/implicit/1p2c/nonisothermal/conduction/problem.hh b/test/porousmediumflow/1pnc/implicit/1p2c/nonisothermal/conduction/problem.hh index 144a01b6d0..30c5352e14 100644 --- a/test/porousmediumflow/1pnc/implicit/1p2c/nonisothermal/conduction/problem.hh +++ b/test/porousmediumflow/1pnc/implicit/1p2c/nonisothermal/conduction/problem.hh @@ -194,8 +194,7 @@ public: const auto densityS = volVars.solidDensity(); const auto heatCapacityS = volVars.solidHeatCapacity(); const auto storage = densityW*heatCapacityW*porosity + densityS*heatCapacityS*(1 - porosity); - const auto effectiveThermalConductivity = ThermalConductivityModel::effectiveThermalConductivity(volVars, this->spatialParams(), - someElement, someFvGeometry, someScv); + const auto effectiveThermalConductivity = ThermalConductivityModel::effectiveThermalConductivity(volVars); using std::max; time = max(time, 1e-10); for (const auto& element : elements(this->fvGridGeometry().gridView())) diff --git a/test/porousmediumflow/3p/implicit/conduction/problem.hh b/test/porousmediumflow/3p/implicit/conduction/problem.hh index fa7cf29b59..fecb632d9a 100644 --- a/test/porousmediumflow/3p/implicit/conduction/problem.hh +++ b/test/porousmediumflow/3p/implicit/conduction/problem.hh @@ -177,8 +177,7 @@ public: const auto densityS = volVars.solidDensity(); const auto heatCapacityS = volVars.solidHeatCapacity(); const auto storage = densityW*heatCapacityW*porosity + densityS*heatCapacityS*(1 - porosity); - const auto effectiveThermalConductivity = ThermalConductivityModel::effectiveThermalConductivity(volVars, this->spatialParams(), - someElement, someFvGeometry, someScv); + const auto effectiveThermalConductivity = ThermalConductivityModel::effectiveThermalConductivity(volVars); using std::max; time = max(time, 1e-10); for (const auto& element : elements(this->fvGridGeometry().gridView())) diff --git a/test/porousmediumflow/richards/implicit/nonisothermal/conduction/problem.hh b/test/porousmediumflow/richards/implicit/nonisothermal/conduction/problem.hh index 060c2579eb..5af51fd32b 100644 --- a/test/porousmediumflow/richards/implicit/nonisothermal/conduction/problem.hh +++ b/test/porousmediumflow/richards/implicit/nonisothermal/conduction/problem.hh @@ -171,8 +171,7 @@ public: const auto densityS =volVars.solidDensity(); const auto heatCapacityS = volVars.solidHeatCapacity(); const auto storage = densityW*heatCapacityW*porosity + densityS*heatCapacityS*(1 - porosity); - const auto effectiveThermalConductivity = ThermalConductivityModel::effectiveThermalConductivity(volVars, this->spatialParams(), - someElement, someFvGeometry, someScv); + const auto effectiveThermalConductivity = ThermalConductivityModel::effectiveThermalConductivity(volVars); using std::max; time = max(time, 1e-10); for (const auto& element : elements(this->fvGridGeometry().gridView())) diff --git a/test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh b/test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh index 769708d596..fc4d1241c5 100644 --- a/test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh +++ b/test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh @@ -181,8 +181,7 @@ public: const auto densityS = volVars.solidDensity(); const auto heatCapacityS = volVars.solidHeatCapacity(); const auto storage = densityW*heatCapacityW*porosity + densityS*heatCapacityS*(1 - porosity); - const auto effectiveThermalConductivity = ThermalConductivityModel::effectiveThermalConductivity(volVars, this->spatialParams(), - someElement, someFvGeometry, someScv); + const auto effectiveThermalConductivity = ThermalConductivityModel::effectiveThermalConductivity(volVars); using std::max; time = max(time, 1e-10); for (const auto& element : elements(this->fvGridGeometry().gridView())) -- GitLab