From 312559cc8fdee5221d7f2af8df4f5d38723bd567 Mon Sep 17 00:00:00 2001 From: Tobias Meyer Andersen Date: Wed, 16 Oct 2024 07:56:08 +0200 Subject: [PATCH] only include co2tables in cpp file --- CMakeLists_files.cmake | 1 + opm/material/components/CO2Parameters.cpp | 54 +++++++++++++ opm/material/components/CO2Parameters.hpp | 47 +++++++++++- opm/material/components/co2tables.inc | 94 ++++++----------------- opm/material/components/helperStructs.hpp | 31 ++++++++ 5 files changed, 153 insertions(+), 74 deletions(-) create mode 100644 opm/material/components/CO2Parameters.cpp create mode 100644 opm/material/components/helperStructs.hpp diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index 62ecbc73c2c..3b595842b4f 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -51,6 +51,7 @@ list (APPEND MAIN_SOURCE_FILES opm/material/common/TridiagonalMatrix.cpp opm/material/common/UniformXTabulated2DFunction.cpp opm/material/components/CO2.cpp + opm/material/components/CO2Parameters.cpp opm/material/components/H2.cpp opm/material/densead/Evaluation.cpp opm/material/fluidmatrixinteractions/EclEpsScalingPoints.cpp diff --git a/opm/material/components/CO2Parameters.cpp b/opm/material/components/CO2Parameters.cpp new file mode 100644 index 00000000000..06e31020c3c --- /dev/null +++ b/opm/material/components/CO2Parameters.cpp @@ -0,0 +1,54 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/* + This file is part of the Open Porous Media project (OPM). + + OPM 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. + + OPM 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 OPM. If not, see . + + Consult the COPYING file in the top-level source directory of this + module for the precise wording of the license and the list of + copyright holders. +*/ +#include +#include +#include +#include +#include +#include "co2tables.inc" + +namespace Opm { + +CO2Tables::CO2Tables(){ + TabulatedEnthalpyTraits tabulatedEnthalpyStruct; + tabulatedEnthalpy = Opm::UniformTabulated2DFunction< double >{ + tabulatedEnthalpyStruct.xMin, + tabulatedEnthalpyStruct.xMax, + (unsigned int)tabulatedEnthalpyStruct.numX, + tabulatedEnthalpyStruct.yMin, + tabulatedEnthalpyStruct.yMax, + (unsigned int)tabulatedEnthalpyStruct.numY, + tabulatedEnthalpyStruct.vals}; + TabulatedDensityTraits tabulatedDensityStruct; + tabulatedDensity = Opm::UniformTabulated2DFunction< double >{ + tabulatedDensityStruct.xMin, + tabulatedDensityStruct.xMax, + (unsigned int)tabulatedDensityStruct.numX, + tabulatedDensityStruct.yMin, + tabulatedDensityStruct.yMax, + (unsigned int)tabulatedDensityStruct.numY, + tabulatedDensityStruct.vals}; +} +// Other method implementations + +} // namespace Opm diff --git a/opm/material/components/CO2Parameters.hpp b/opm/material/components/CO2Parameters.hpp index 200dd21ae36..8e142ffc7fd 100644 --- a/opm/material/components/CO2Parameters.hpp +++ b/opm/material/components/CO2Parameters.hpp @@ -23,18 +23,57 @@ #ifndef OPM_CO2PARAMETERS_HPP #define OPM_CO2PARAMETERS_HPP +#include +#include +#include +#include +#include -#include "co2tables.inc" namespace Opm { +class CO2Tables { +public: + Opm::UniformTabulated2DFunction< double > tabulatedEnthalpy; + Opm::UniformTabulated2DFunction< double > tabulatedDensity; + static constexpr double brineSalinity = 1.000000000000000e-01; + + CO2Tables(); + // : tabulatedEnthalpy{tabulatedEnthalpyStruct.xMin, + // tabulatedEnthalpyStruct.xMax, + // tabulatedEnthalpyStruct.numX, + // tabulatedEnthalpyStruct.yMin, + // tabulatedEnthalpyStruct.yMax, + // tabulatedEnthalpyStruct.numY, + // tabulatedEnthalpyStruct.vals}, + // tabulatedDensity{tabulatedDensityStruct.xMin, + // tabulatedDensityStruct.xMax, + // tabulatedDensityStruct.numX, + // tabulatedDensityStruct.yMin, + // tabulatedDensityStruct.yMax, + // tabulatedDensityStruct.numY, + // tabulatedDensityStruct.vals} + // {} +}; + + +// class CO2Parameters::CO2Tables { +// public: +// // Define the members and methods as needed +// CO2Tables() { +// // Initialize the members +// // Example: +// // numX = static_cast(tabulatedEnthalpyStruct.TabulatedEnthalpyTraits::numX); +// // numY = static_cast(tabulatedEnthalpyStruct.TabulatedEnthalpyTraits::numY); +// } +// } + class CO2Parameters { public: CO2Parameters(){ - co2Tables_ = CO2Tables(); - }; - + co2Tables_ = CO2Tables(); + } CO2Tables co2Tables_; }; diff --git a/opm/material/components/co2tables.inc b/opm/material/components/co2tables.inc index cff6043d355..fa89c999d7f 100644 --- a/opm/material/components/co2tables.inc +++ b/opm/material/components/co2tables.inc @@ -1,6 +1,7 @@ #ifndef CO2TABLES_INC #define CO2TABLES_INC +#include /* The data has been calculated using the CoolProp Python package https://doi.org/10.1021/ie4033999. * * THIS AN AUTO-GENERATED FILE! DO NOT EDIT IT! @@ -41,18 +42,18 @@ // inline const double TabulatedDensityTraits::yMin = 1.000000000000000e+05; // inline const double TabulatedDensityTraits::yMax = 1.000000000000000e+08; // inline const char *TabulatedDensityTraits::name = "density"; -struct TabulatedDensityTraits { - typedef double Scalar; - const char *name; - const int numX; - const Scalar xMin; - const Scalar xMax; - const int numY; - const Scalar yMin; - const Scalar yMax; - const std::vector> vals; +// struct TabulatedDensityTraits { + // typedef double Scalar; + // const char *name; + // const int numX; + // const Scalar xMin; + // const Scalar xMax; + // const int numY; + // const Scalar yMin; + // const Scalar yMax; + // const std::vector> vals; - TabulatedDensityTraits() +TabulatedDensityTraits::TabulatedDensityTraits() : name("density"), numX(200), xMin(2.800000000000000e+02), @@ -20463,8 +20464,7 @@ struct TabulatedDensityTraits { 9.308379686038276e+02, 9.313334853669594e+02, 9.318278324800351e+02, 9.323210157559163e+02, 9.328130409641589e+02 } }) - {} -}; +{} // inline const std::vector> TabulatedDensityTraits::vals @@ -20486,18 +20486,17 @@ struct TabulatedDensityTraits { // inline const double TabulatedEnthalpyTraits::yMax = 1.000000000000000e+08; // inline const char *TabulatedEnthalpyTraits::name = "enthalpy"; -struct TabulatedEnthalpyTraits { - typedef double Scalar; - const char *name; - const int numX; - const Scalar xMin; - const Scalar xMax; - const int numY; - const Scalar yMin; - const Scalar yMax; - const std::vector> vals; - - TabulatedEnthalpyTraits() +// struct TabulatedEnthalpyTraits { +// typedef double Scalar; +// const char *name; +// const int numX; +// const Scalar xMin; +// const Scalar xMax; +// const int numY; +// const Scalar yMin; +// const Scalar yMax; +// const std::vector> vals; +TabulatedEnthalpyTraits::TabulatedEnthalpyTraits() : name("enthalpy"), numX(200), xMin(2.800000000000000e+02), @@ -40909,7 +40908,6 @@ struct TabulatedEnthalpyTraits { } }) {} -}; // typedef Opm::UniformTabulated2DFunction< double > TabulatedFunction; @@ -40939,48 +40937,4 @@ struct TabulatedEnthalpyTraits { // TabulatedDensityTraits::numY, // TabulatedDensityTraits::vals}; -class CO2Tables { -public: - Opm::UniformTabulated2DFunction< double > tabulatedEnthalpy; - Opm::UniformTabulated2DFunction< double > tabulatedDensity; - static constexpr double brineSalinity = 1.000000000000000e-01; - - CO2Tables(){ - TabulatedEnthalpyTraits tabulatedEnthalpyStruct; - tabulatedEnthalpy = Opm::UniformTabulated2DFunction< double >{ - tabulatedEnthalpyStruct.xMin, - tabulatedEnthalpyStruct.xMax, - (unsigned int)tabulatedEnthalpyStruct.numX, - tabulatedEnthalpyStruct.yMin, - tabulatedEnthalpyStruct.yMax, - (unsigned int)tabulatedEnthalpyStruct.numY, - tabulatedEnthalpyStruct.vals}; - TabulatedDensityTraits tabulatedDensityStruct; - tabulatedDensity = Opm::UniformTabulated2DFunction< double >{ - tabulatedDensityStruct.xMin, - tabulatedDensityStruct.xMax, - (unsigned int)tabulatedDensityStruct.numX, - tabulatedDensityStruct.yMin, - tabulatedDensityStruct.yMax, - (unsigned int)tabulatedDensityStruct.numY, - tabulatedDensityStruct.vals}; - } - // : tabulatedEnthalpy{tabulatedEnthalpyStruct.xMin, - // tabulatedEnthalpyStruct.xMax, - // tabulatedEnthalpyStruct.numX, - // tabulatedEnthalpyStruct.yMin, - // tabulatedEnthalpyStruct.yMax, - // tabulatedEnthalpyStruct.numY, - // tabulatedEnthalpyStruct.vals}, - // tabulatedDensity{tabulatedDensityStruct.xMin, - // tabulatedDensityStruct.xMax, - // tabulatedDensityStruct.numX, - // tabulatedDensityStruct.yMin, - // tabulatedDensityStruct.yMax, - // tabulatedDensityStruct.numY, - // tabulatedDensityStruct.vals} - // {} -}; - - #endif /* CO2TABLES_INC */ diff --git a/opm/material/components/helperStructs.hpp b/opm/material/components/helperStructs.hpp new file mode 100644 index 00000000000..bcb42a1402f --- /dev/null +++ b/opm/material/components/helperStructs.hpp @@ -0,0 +1,31 @@ + +#ifndef OPM_CO2HELPER_STRUCTS_HPP +#define OPM_CO2HELPER_STRUCTS_HPP + +#include +struct TabulatedDensityTraits { + typedef double Scalar; + const char *name; + const int numX; + const Scalar xMin; + const Scalar xMax; + const int numY; + const Scalar yMin; + const Scalar yMax; + const std::vector> vals; + TabulatedDensityTraits(); +}; + +struct TabulatedEnthalpyTraits { + typedef double Scalar; + const char *name; + const int numX; + const Scalar xMin; + const Scalar xMax; + const int numY; + const Scalar yMin; + const Scalar yMax; + const std::vector> vals; + TabulatedEnthalpyTraits(); +}; +#endif // OPM_CO2HELPER_STRUCTS_HPP