From 281df4355f667c687ed397c95ee76536704b2c5e Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Thu, 5 Jul 2018 14:57:14 +0200 Subject: [PATCH 1/2] [material][tabulatedComponent] Improve output of init() method --- dumux/material/components/tabulatedcomponent.hh | 14 ++++++++++++-- dumux/material/fluidsystems/2p1c.hh | 7 ++----- dumux/material/fluidsystems/brineair.hh | 7 ++----- dumux/material/fluidsystems/h2oair.hh | 7 ++----- dumux/material/fluidsystems/h2oairmesitylene.hh | 7 ++----- dumux/material/fluidsystems/h2oairxylene.hh | 7 ++----- dumux/material/fluidsystems/h2oheavyoil.hh | 7 ++----- dumux/material/fluidsystems/h2on2.hh | 7 ++----- dumux/material/fluidsystems/h2on2o2.hh | 7 ++----- 9 files changed, 28 insertions(+), 42 deletions(-) diff --git a/dumux/material/components/tabulatedcomponent.hh b/dumux/material/components/tabulatedcomponent.hh index 36f828245d..497ca32364 100644 --- a/dumux/material/components/tabulatedcomponent.hh +++ b/dumux/material/components/tabulatedcomponent.hh @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -96,8 +97,8 @@ public: * \param pressMax The maximum of the pressure range in \f$\mathrm{[Pa]}\f$ * \param nPress The number of entries/steps within the pressure range */ - static void init(Scalar tempMin, Scalar tempMax, unsigned nTemp, - Scalar pressMin, Scalar pressMax, unsigned nPress) + static void init(Scalar tempMin, Scalar tempMax, std::size_t nTemp, + Scalar pressMin, Scalar pressMax, std::size_t nPress) { #ifndef NDEBUG initialized_ = true; @@ -111,6 +112,15 @@ public: nPress_ = nPress; nDensity_ = nPress_; + std::cout << "-------------------------------------------------------------------------\n" + << "Initializing tables for the " << RawComponent::name() + << " fluid properties (" << nTemp*nPress << " entries).\n" + << "Temperature -> min: " << std::scientific << std::setprecision(3) + << tempMin << ", max: " << tempMax << ", n: " << nTemp << '\n' + << "Pressure -> min: " << std::scientific << std::setprecision(3) + << pressMin << ", max: " << pressMax << ", n: " << nPress << '\n' + << "-------------------------------------------------------------------------" << std::endl; + // resize & initilialize the arrays with NaN assert(std::numeric_limits::has_quiet_NaN); const auto NaN = std::numeric_limits::quiet_NaN(); diff --git a/dumux/material/fluidsystems/2p1c.hh b/dumux/material/fluidsystems/2p1c.hh index 33d1936521..06f369f5d3 100644 --- a/dumux/material/fluidsystems/2p1c.hh +++ b/dumux/material/fluidsystems/2p1c.hh @@ -256,11 +256,8 @@ public: static void init(Scalar tempMin, Scalar tempMax, unsigned nTemp, Scalar pressMin, Scalar pressMax, unsigned nPress) { - if (Component::isTabulated) { - std::cout << "Initializing tables for the fluid properties (" - << nTemp*nPress - << " entries).\n"; - + if (Component::isTabulated) + { Component::init(tempMin, tempMax, nTemp, pressMin, pressMax, nPress); } diff --git a/dumux/material/fluidsystems/brineair.hh b/dumux/material/fluidsystems/brineair.hh index e1b1db39ff..490d037a08 100644 --- a/dumux/material/fluidsystems/brineair.hh +++ b/dumux/material/fluidsystems/brineair.hh @@ -279,11 +279,8 @@ public: else std::cout << "Using fast Brine-Air fluid system\n"; - if (H2O::isTabulated) { - std::cout << "Initializing tables for the H2O fluid properties (" - << nTemp*nPress - << " entries).\n"; - + if (H2O::isTabulated) + { H2O::init(tempMin, tempMax, nTemp, pressMin, pressMax, nPress); } diff --git a/dumux/material/fluidsystems/h2oair.hh b/dumux/material/fluidsystems/h2oair.hh index 7edace0ec2..18346200a9 100644 --- a/dumux/material/fluidsystems/h2oair.hh +++ b/dumux/material/fluidsystems/h2oair.hh @@ -345,11 +345,8 @@ public: else std::cout << "Using fast H2O-Air fluid system\n"; - if (H2O::isTabulated) { - std::cout << "Initializing tables for the H2O fluid properties (" - << nTemp*nPress - << " entries).\n"; - + if (H2O::isTabulated) + { H2O::init(tempMin, tempMax, nTemp, pressMin, pressMax, nPress); } diff --git a/dumux/material/fluidsystems/h2oairmesitylene.hh b/dumux/material/fluidsystems/h2oairmesitylene.hh index e44dcad3c8..e725bc6fe9 100644 --- a/dumux/material/fluidsystems/h2oairmesitylene.hh +++ b/dumux/material/fluidsystems/h2oairmesitylene.hh @@ -110,11 +110,8 @@ public: static void init(Scalar tempMin, Scalar tempMax, unsigned nTemp, Scalar pressMin, Scalar pressMax, unsigned nPress) { - if (H2O::isTabulated) { - std::cout << "Initializing tables for the H2O fluid properties (" - << nTemp*nPress - << " entries).\n"; - + if (H2O::isTabulated) + { H2O::init(tempMin, tempMax, nTemp, pressMin, pressMax, nPress); } diff --git a/dumux/material/fluidsystems/h2oairxylene.hh b/dumux/material/fluidsystems/h2oairxylene.hh index 1805ef2dcd..bd48994c5f 100644 --- a/dumux/material/fluidsystems/h2oairxylene.hh +++ b/dumux/material/fluidsystems/h2oairxylene.hh @@ -110,11 +110,8 @@ public: static void init(Scalar tempMin, Scalar tempMax, unsigned nTemp, Scalar pressMin, Scalar pressMax, unsigned nPress) { - if (H2O::isTabulated) { - std::cout << "Initializing tables for the H2O fluid properties (" - << nTemp*nPress - << " entries).\n"; - + if (H2O::isTabulated) + { H2O::init(tempMin, tempMax, nTemp, pressMin, pressMax, nPress); } diff --git a/dumux/material/fluidsystems/h2oheavyoil.hh b/dumux/material/fluidsystems/h2oheavyoil.hh index 14f959b814..bae72fd9c7 100644 --- a/dumux/material/fluidsystems/h2oheavyoil.hh +++ b/dumux/material/fluidsystems/h2oheavyoil.hh @@ -99,11 +99,8 @@ public: static void init(Scalar tempMin, Scalar tempMax, unsigned nTemp, Scalar pressMin, Scalar pressMax, unsigned nPress) { - if (H2O::isTabulated) { - std::cout << "Initializing tables for the H2O fluid properties (" - << nTemp*nPress - << " entries).\n"; - + if (H2O::isTabulated) + { H2O::init(tempMin, tempMax, nTemp, pressMin, pressMax, nPress); } diff --git a/dumux/material/fluidsystems/h2on2.hh b/dumux/material/fluidsystems/h2on2.hh index 1d2b2cb2e1..118a8128cf 100644 --- a/dumux/material/fluidsystems/h2on2.hh +++ b/dumux/material/fluidsystems/h2on2.hh @@ -337,11 +337,8 @@ public: else std::cout << "Using fast H2O-N2 fluid system\n"; - if (H2O::isTabulated) { - std::cout << "Initializing tables for the H2O fluid properties (" - << nTemp*nPress - << " entries).\n"; - + if (H2O::isTabulated) + { TabulatedH2O::init(tempMin, tempMax, nTemp, pressMin, pressMax, nPress); } diff --git a/dumux/material/fluidsystems/h2on2o2.hh b/dumux/material/fluidsystems/h2on2o2.hh index c2767b3bd4..11bf5b7618 100644 --- a/dumux/material/fluidsystems/h2on2o2.hh +++ b/dumux/material/fluidsystems/h2on2o2.hh @@ -409,11 +409,8 @@ public: else std::cout << "Using fast H2O-N2-O2 fluid system\n"; - if (H2O::isTabulated) { - std::cout << "Initializing tables for the H2O fluid properties (" - << nTemp*nPress - << " entries).\n"; - + if (H2O::isTabulated) + { TabulatedH2O::init(tempMin, tempMax, nTemp, pressMin, pressMax, nPress); } -- GitLab From 0c1780e9503de7cfb34531504f7a5c1ae8a13d31 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Thu, 5 Jul 2018 14:58:23 +0200 Subject: [PATCH 2/2] [material][2pimmiscible] Add init() method --- dumux/material/fluidsystems/2pimmiscible.hh | 27 ++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/dumux/material/fluidsystems/2pimmiscible.hh b/dumux/material/fluidsystems/2pimmiscible.hh index de49c4011c..e65823f8d8 100644 --- a/dumux/material/fluidsystems/2pimmiscible.hh +++ b/dumux/material/fluidsystems/2pimmiscible.hh @@ -274,7 +274,32 @@ public: * \brief Initialize the fluid system's static parameters */ static void init() - {} + { + // initialize with some default values + init(/*tempMin=*/273.15, /*tempMax=*/623.15, /*numTemp=*/100, + /*pMin=*/-10.0, /*pMax=*/20e6, /*numP=*/200); + } + + /*! + * \brief Initialize the fluid system's static parameters using + * problem specific temperature and pressure ranges + * + * \param tempMin The minimum temperature used for tabulation of water \f$\mathrm{[K]}\f$ + * \param tempMax The maximum temperature used for tabulation of water\f$\mathrm{[K]}\f$ + * \param nTemp The number of ticks on the temperature axis of the table of water + * \param pressMin The minimum pressure used for tabulation of water \f$\mathrm{[Pa]}\f$ + * \param pressMax The maximum pressure used for tabulation of water \f$\mathrm{[Pa]}\f$ + * \param nPress The number of ticks on the pressure axis of the table of water + */ + static void init(Scalar tempMin, Scalar tempMax, std::size_t nTemp, + Scalar pressMin, Scalar pressMax, std::size_t nPress) + { + if (Fluid0::Component::isTabulated) + Fluid0::Component::init(tempMin, tempMax, nTemp, pressMin, pressMax, nPress); + + if (Fluid1::Component::isTabulated) + Fluid1::Component::init(tempMin, tempMax, nTemp, pressMin, pressMax, nPress); + } using Base::density; /*! -- GitLab