Skip to content

Commit

Permalink
only include co2tables in cpp file
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Meyer Andersen committed Oct 16, 2024
1 parent 5e2853a commit 312559c
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 74 deletions.
1 change: 1 addition & 0 deletions CMakeLists_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
54 changes: 54 additions & 0 deletions opm/material/components/CO2Parameters.cpp
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
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 <config.h>
#include <opm/material/components/CO2Parameters.hpp>
#include <opm/material/common/MathToolbox.hpp>
#include <opm/material/common/UniformTabulated2DFunction.hpp>
#include <vector>
#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
47 changes: 43 additions & 4 deletions opm/material/components/CO2Parameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,57 @@

#ifndef OPM_CO2PARAMETERS_HPP
#define OPM_CO2PARAMETERS_HPP
#include <config.h>
#include <opm/material/common/MathToolbox.hpp>
#include <opm/material/common/UniformTabulated2DFunction.hpp>
#include <opm/material/components/helperStructs.hpp>
#include <vector>

#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<unsigned int>(tabulatedEnthalpyStruct.TabulatedEnthalpyTraits::numX);
// // numY = static_cast<unsigned int>(tabulatedEnthalpyStruct.TabulatedEnthalpyTraits::numY);
// }
// }

class CO2Parameters
{
public:
CO2Parameters(){
co2Tables_ = CO2Tables();
};

co2Tables_ = CO2Tables();
}
CO2Tables co2Tables_;
};

Expand Down
94 changes: 24 additions & 70 deletions opm/material/components/co2tables.inc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef CO2TABLES_INC
#define CO2TABLES_INC

#include <opm/material/components/helperStructs.hpp>
/* 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!
Expand Down Expand Up @@ -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<std::vector<Scalar>> 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<std::vector<Scalar>> vals;

TabulatedDensityTraits()
TabulatedDensityTraits::TabulatedDensityTraits()
: name("density"),
numX(200),
xMin(2.800000000000000e+02),
Expand Down Expand Up @@ -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<std::vector<double>> TabulatedDensityTraits::vals

Expand All @@ -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<std::vector<Scalar>> 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<std::vector<Scalar>> vals;
TabulatedEnthalpyTraits::TabulatedEnthalpyTraits()
: name("enthalpy"),
numX(200),
xMin(2.800000000000000e+02),
Expand Down Expand Up @@ -40909,7 +40908,6 @@ struct TabulatedEnthalpyTraits {
}
})
{}
};

// typedef Opm::UniformTabulated2DFunction< double > TabulatedFunction;

Expand Down Expand Up @@ -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 */
31 changes: 31 additions & 0 deletions opm/material/components/helperStructs.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

#ifndef OPM_CO2HELPER_STRUCTS_HPP
#define OPM_CO2HELPER_STRUCTS_HPP

#include <vector>
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<std::vector<Scalar>> 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<std::vector<Scalar>> vals;
TabulatedEnthalpyTraits();
};
#endif // OPM_CO2HELPER_STRUCTS_HPP

0 comments on commit 312559c

Please sign in to comment.