diff --git a/examples/polymer_reorder.cpp b/examples/polymer_reorder.cpp index d42dad31e..b6883ad5f 100644 --- a/examples/polymer_reorder.cpp +++ b/examples/polymer_reorder.cpp @@ -39,6 +39,7 @@ // #include #include +#include #include #include diff --git a/opm/polymer/PolymerProperties.hpp b/opm/polymer/PolymerProperties.hpp new file mode 100644 index 000000000..efd90a50e --- /dev/null +++ b/opm/polymer/PolymerProperties.hpp @@ -0,0 +1,108 @@ +/* + Copyright 2012 SINTEF ICT, Applied Mathematics. + + 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 3 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 . +*/ + +#include +#include +#include + + +#ifndef OPM_POLYMERPROPERTIES_HEADER_INCLUDED +#define OPM_POLYMERPROPERTIES_HEADER_INCLUDED + +namespace Opm +{ + class PolymerProperties + { + + public: + PolymerProperties(double c_max_limit_arg, double omega_arg, double rhor_arg, double dps_arg, + std::vector c_vals_visc, std::vector visc_mult_vals, + std::vector c_vals_ads, std::vector ads_vals) + { + c_max_limit = c_max_limit_arg; + omega = omega_arg; + rhor = rhor_arg; + dps = dps_arg; + c_vals_visc_ = c_vals_visc; + visc_mult_vals_ = visc_mult_vals; + c_vals_ads_ = c_vals_ads; + ads_vals_ = ads_vals; + } + + PolymerProperties(const EclipseGridParser& gridparser) + { + + // We assume NTMISC=1 + const std::vector& plymax = gridparser.getPLYMAX().plymax_; + c_max_limit = plymax[0]; + const std::vector& tlmixpar = gridparser.getTLMIXPAR().tlmixpar_; + omega = tlmixpar[0]; + + rhor = gridparser.getFloatingPointValue("ROCKDEN")[0]; + + // We assume NTSFUN=1 + const std::vector& plyrock = gridparser.getPLYROCK().plyrock_; + dps = plyrock[0]; + + // We assume NTPVT=1 + const PLYVISC& plyvisc = gridparser.getPLYVISC(); + c_vals_visc_ = plyvisc.concentration_; + visc_mult_vals_ = plyvisc.factor_; + + // We assume NTSFUN=1 + const PLYADS& plyads = gridparser.getPLYADS(); + c_vals_ads_ = plyads.local_concentration_; + ads_vals_ = plyads.adsorbed_concentration_; + + } + + double c_max_limit; + double omega; + double rhor; + double dps; + + double viscMult(double c) const + { + return Opm::linearInterpolation(c_vals_visc_, visc_mult_vals_, c); + } + double viscMultWithDer(double c, double* der) const + { + *der = Opm::linearInterpolationDerivative(c_vals_visc_, visc_mult_vals_, c); + return Opm::linearInterpolation(c_vals_visc_, visc_mult_vals_, c); + } + double adsorbtion(double c) const + { + return Opm::linearInterpolation(c_vals_ads_, ads_vals_, c); + } + double adsorbtionWithDer(double c, double* der) const + { + *der = Opm::linearInterpolationDerivative(c_vals_ads_, ads_vals_, c); + return Opm::linearInterpolation(c_vals_ads_, ads_vals_, c); + } + + private: + std::vector c_vals_visc_; + std::vector visc_mult_vals_; + std::vector c_vals_ads_; + std::vector ads_vals_; + }; + +} // namespace Opm + +#endif // OPM_POLYMERPROPERTIES_HEADER_INCLUDED