Skip to content
Snippets Groups Projects
Commit 30c7705d authored by wenqing's avatar wenqing
Browse files

[Unsat] Some corrections and changes according to the Christoph's comments

parent 92b3fa18
No related branches found
No related tags found
No related merge requests found
Showing
with 43 additions and 43 deletions
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include <array> #include <array>
#include <memory> #include <memory>
#include <sstream>
#include <string> #include <string>
#include <vector> #include <vector>
...@@ -24,7 +23,7 @@ ...@@ -24,7 +23,7 @@
#include "MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.h" #include "MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.h"
#include "RelativePermeability.h" #include "RelativePermeability.h"
#include "ReletivePermeabilityCurve.h" #include "RelativePermeabilityCurve.h"
#include "WettingPhaseVanGenuchten.h" #include "WettingPhaseVanGenuchten.h"
#include "NonWettingPhaseVanGenuchten.h" #include "NonWettingPhaseVanGenuchten.h"
#include "WettingPhaseBrookCoreyOilGas.h" #include "WettingPhaseBrookCoreyOilGas.h"
...@@ -59,11 +58,11 @@ std::unique_ptr<RelativePermeability> createWettingPhaseVanGenuchten( ...@@ -59,11 +58,11 @@ std::unique_ptr<RelativePermeability> createWettingPhaseVanGenuchten(
"The exponent parameter of WettingPhaseVanGenuchten relative\n" "The exponent parameter of WettingPhaseVanGenuchten relative\n"
" permeability model, m, must be in an interval of [0, 1]"); " permeability model, m, must be in an interval of [0, 1]");
} }
//! \ogs_file_param{material_property__porous_medium__porous_medium__relative_permeability__WettingPhaseVanGenuchten__m} //! \ogs_file_param{material_property__porous_medium__porous_medium__relative_permeability__WettingPhaseVanGenuchten__krel_min}
const double krel_max = config.getConfigParameter<double>("krel_min"); const double krel_min = config.getConfigParameter<double>("krel_min");
return std::unique_ptr<RelativePermeability>( return std::unique_ptr<RelativePermeability>(
new WettingPhaseVanGenuchten(Sr, Smax, m, krel_max)); new WettingPhaseVanGenuchten(Sr, Smax, m, krel_min));
} }
/** /**
...@@ -91,11 +90,12 @@ std::unique_ptr<RelativePermeability> createNonWettingPhaseVanGenuchten( ...@@ -91,11 +90,12 @@ std::unique_ptr<RelativePermeability> createNonWettingPhaseVanGenuchten(
"The exponent parameter of NonWettingPhaseVanGenuchten relative\n" "The exponent parameter of NonWettingPhaseVanGenuchten relative\n"
" permeability model, m, must be in an interval of [0, 1]"); " permeability model, m, must be in an interval of [0, 1]");
} }
//! \ogs_file_param{material_property__porous_medium__porous_medium__relative_permeability__NonWettingPhaseVanGenuchten__m}
const double krel_max = config.getConfigParameter<double>("krel_min"); //! \ogs_file_param{material_property__porous_medium__porous_medium__relative_permeability__NonWettingPhaseVanGenuchten__krel_min}
const double krel_min = config.getConfigParameter<double>("krel_min");
return std::unique_ptr<RelativePermeability>( return std::unique_ptr<RelativePermeability>(
new NonWettingPhaseVanGenuchten(Sr, Smax, m, krel_max)); new NonWettingPhaseVanGenuchten(Sr, Smax, m, krel_min));
} }
/** /**
...@@ -123,11 +123,12 @@ std::unique_ptr<RelativePermeability> createWettingPhaseBrookCoreyOilGas( ...@@ -123,11 +123,12 @@ std::unique_ptr<RelativePermeability> createWettingPhaseBrookCoreyOilGas(
"The exponent parameter of WettingPhaseBrookCoreyOilGas\n" "The exponent parameter of WettingPhaseBrookCoreyOilGas\n"
"relative permeability model, m, must not be smaller than 1"); "relative permeability model, m, must not be smaller than 1");
} }
//! \ogs_file_param{material_property__porous_medium__porous_medium__relative_permeability__WettingPhaseBrookCoreyOilGas__m}
const double krel_max = config.getConfigParameter<double>("krel_min"); //! \ogs_file_param{material_property__porous_medium__porous_medium__relative_permeability__WettingPhaseBrookCoreyOilGas__krel_min}
const double krel_min = config.getConfigParameter<double>("krel_min");
return std::unique_ptr<RelativePermeability>( return std::unique_ptr<RelativePermeability>(
new WettingPhaseBrookCoreyOilGas(Sr, Smax, m, krel_max)); new WettingPhaseBrookCoreyOilGas(Sr, Smax, m, krel_min));
} }
/** /**
...@@ -155,11 +156,12 @@ std::unique_ptr<RelativePermeability> createNonWettingPhaseBrookCoreyOilGas( ...@@ -155,11 +156,12 @@ std::unique_ptr<RelativePermeability> createNonWettingPhaseBrookCoreyOilGas(
"The exponent parameter of NonWettingPhaseBrookCoreyOilGas\n" "The exponent parameter of NonWettingPhaseBrookCoreyOilGas\n"
"relative permeability model, m, must not be smaller than 1"); "relative permeability model, m, must not be smaller than 1");
} }
//! \ogs_file_param{material_property__porous_medium__porous_medium__relative_permeability__NonWettingPhaseBrookCoreyOilGas__m}
const double krel_max = config.getConfigParameter<double>("krel_min"); //! \ogs_file_param{material_property__porous_medium__porous_medium__relative_permeability__NonWettingPhaseBrookCoreyOilGas__krel_min}
const double krel_min = config.getConfigParameter<double>("krel_min");
return std::unique_ptr<RelativePermeability>( return std::unique_ptr<RelativePermeability>(
new NonWettingPhaseBrookCoreyOilGas(Sr, Smax, m, krel_max)); new NonWettingPhaseBrookCoreyOilGas(Sr, Smax, m, krel_min));
} }
std::unique_ptr<RelativePermeability> createRelativePermeabilityModel( std::unique_ptr<RelativePermeability> createRelativePermeabilityModel(
...@@ -192,22 +194,22 @@ std::unique_ptr<RelativePermeability> createRelativePermeabilityModel( ...@@ -192,22 +194,22 @@ std::unique_ptr<RelativePermeability> createRelativePermeabilityModel(
//! \ogs_file_param{material_property__porous_medium__porous_medium__relative_permeability__Curve__curve} //! \ogs_file_param{material_property__porous_medium__porous_medium__relative_permeability__Curve__curve}
auto const& curve_config = config.getConfigSubtree("curve"); auto const& curve_config = config.getConfigSubtree("curve");
for ( for (
auto const& data_string : auto const& point_config :
//! \ogs_file_param{material_property__porous_medium__porous_medium__relative_permeability__Curve_curve__data} //! \ogs_file_param{material_property__porous_medium__porous_medium__relative_permeability__Curve_curve__point}
curve_config.getConfigParameterList<std::string>("data")) curve_config.getConfigSubtreeList("point"))
{ {
std::stringstream ss(data_string); const auto& point =
double var, val; //! \ogs_file_param{material_property__porous_medium__porous_medium__relative_permeability__Curve_curve__points__data}
ss >> var >> val; point_config.getConfigParameter<std::vector<double>>("data");
ss.clear(); assert(point.size() == 2);
variables.push_back(var); variables.push_back(point[0]);
values.push_back(val); values.push_back(point[1]);
} }
auto curve = std::unique_ptr<MathLib::PiecewiseLinearInterpolation>( auto curve = std::unique_ptr<MathLib::PiecewiseLinearInterpolation>(
new MathLib::PiecewiseLinearInterpolation( new MathLib::PiecewiseLinearInterpolation(
std::move(variables), std::move(values), true)); std::move(variables), std::move(values), true));
return std::unique_ptr<RelativePermeability>( return std::unique_ptr<RelativePermeability>(
new ReletivePermeabilityCurve(curve)); new RelativePermeabilityCurve(curve));
} }
else else
{ {
......
...@@ -27,7 +27,7 @@ double NonWettingPhaseBrookCoreyOilGas::getValue( ...@@ -27,7 +27,7 @@ double NonWettingPhaseBrookCoreyOilGas::getValue(
saturation_w, _Sr + _minor_offset, _Smax - _minor_offset); saturation_w, _Sr + _minor_offset, _Smax - _minor_offset);
const double Se = (S - _Sr) / (_Smax - _Sr); const double Se = (S - _Sr) / (_Smax - _Sr);
const double krel = const double krel =
std::pow(1.0 - Se, 2) * (1.0 - std::pow(Se, 1.0 + 2.0 / _mm)); (1.0 - Se) * (1.0 - Se) * (1.0 - std::pow(Se, 1.0 + 2.0 / _mm));
return krel < _krel_min ? _krel_min : krel; return krel < _krel_min ? _krel_min : krel;
} }
......
...@@ -57,7 +57,7 @@ public: ...@@ -57,7 +57,7 @@ public:
} }
/// Get relative permeability value. /// Get relative permeability value.
/// \param saturation_w Non-wetting phase saturation /// \param saturation_w Wetting phase saturation
double getValue(const double saturation_w) const override; double getValue(const double saturation_w) const override;
private: private:
......
...@@ -25,7 +25,7 @@ double NonWettingPhaseVanGenuchten::getValue(const double saturation_w) const ...@@ -25,7 +25,7 @@ double NonWettingPhaseVanGenuchten::getValue(const double saturation_w) const
const double S = MathLib::limitValueInInterval( const double S = MathLib::limitValueInInterval(
saturation_w, _Sr + _minor_offset, _Smax - _minor_offset); saturation_w, _Sr + _minor_offset, _Smax - _minor_offset);
const double Se = (S - _Sr) / (_Smax - _Sr); const double Se = (S - _Sr) / (_Smax - _Sr);
const double krel = std::pow(1.0 - Se, 1.0 / 3.0) * const double krel = std::cbrt(1.0 - Se) *
std::pow(1.0 - std::pow(Se, 1.0 / _mm), 2.0 * _mm); std::pow(1.0 - std::pow(Se, 1.0 / _mm), 2.0 * _mm);
return krel < _krel_min ? _krel_min : krel; return krel < _krel_min ? _krel_min : krel;
} }
......
...@@ -59,7 +59,7 @@ public: ...@@ -59,7 +59,7 @@ public:
} }
/// Get relative permeability value. /// Get relative permeability value.
/// \param saturation_w Non-wetting phase saturation /// \param saturation_w Wetting phase saturation
double getValue(const double saturation_w) const override; double getValue(const double saturation_w) const override;
private: private:
......
...@@ -29,7 +29,7 @@ public: ...@@ -29,7 +29,7 @@ public:
virtual std::string getName() const = 0; virtual std::string getName() const = 0;
/// Get relative permeability value. /// Get relative permeability value.
/// \param saturation Non-wetting phase saturation /// \param saturation Wetting phase saturation
virtual double getValue(const double saturation) const = 0; virtual double getValue(const double saturation) const = 0;
protected: protected:
......
...@@ -5,13 +5,13 @@ ...@@ -5,13 +5,13 @@
* See accompanying file LICENSE.txt or * See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license * http://www.opengeosys.org/project/license
* *
* \file ReletivePermeabilityCurve.h * \file RelativePermeabilityCurve.h
* *
* Created on November 2, 2016, 1:41 PM * Created on November 2, 2016, 1:41 PM
*/ */
#ifndef OGS_RELETIVE_PERMEABILITY_CURVE_H #ifndef OGS_RELATIVE_PERMEABILITY_CURVE_H
#define OGS_RELETIVE_PERMEABILITY_CURVE_H #define OGS_RELATIVE_PERMEABILITY_CURVE_H
#include <memory> #include <memory>
#include "RelativePermeability.h" #include "RelativePermeability.h"
...@@ -23,10 +23,10 @@ namespace MaterialLib ...@@ -23,10 +23,10 @@ namespace MaterialLib
{ {
namespace PorousMedium namespace PorousMedium
{ {
class ReletivePermeabilityCurve final : public RelativePermeability class RelativePermeabilityCurve final : public RelativePermeability
{ {
public: public:
ReletivePermeabilityCurve( RelativePermeabilityCurve(
std::unique_ptr<MathLib::PiecewiseLinearInterpolation>& curve_data) std::unique_ptr<MathLib::PiecewiseLinearInterpolation>& curve_data)
: _Sr(curve_data->getSupportMin()), : _Sr(curve_data->getSupportMin()),
_Smax(curve_data->getSupportMax()), _Smax(curve_data->getSupportMax()),
...@@ -57,4 +57,4 @@ private: ...@@ -57,4 +57,4 @@ private:
}; };
} // end namespace } // end namespace
} // end namespace } // end namespace
#endif /* OGS_RELETIVE_PERMEABILITY_CURVE_H */ #endif /* OGS_RELATIVE_PERMEABILITY_CURVE_H */
...@@ -25,9 +25,8 @@ double WettingPhaseVanGenuchten::getValue(const double saturation) const ...@@ -25,9 +25,8 @@ double WettingPhaseVanGenuchten::getValue(const double saturation) const
const double S = MathLib::limitValueInInterval( const double S = MathLib::limitValueInInterval(
saturation, _Sr + _minor_offset, _Smax - _minor_offset); saturation, _Sr + _minor_offset, _Smax - _minor_offset);
const double Se = (S - _Sr) / (_Smax - _Sr); const double Se = (S - _Sr) / (_Smax - _Sr);
const double krel = const double val = 1.0 - std::pow(1.0 - std::pow(Se, 1.0 / _mm), _mm);
std::sqrt(Se) * const double krel = std::sqrt(Se) * val * val;
std::pow(1.0 - std::pow(1.0 - std::pow(Se, 1.0 / _mm), _mm), 2);
return krel < _krel_min ? _krel_min : krel; return krel < _krel_min ? _krel_min : krel;
} }
......
...@@ -32,8 +32,7 @@ std::unique_ptr<RelativePermeability> createRelativePermeabilityModel( ...@@ -32,8 +32,7 @@ std::unique_ptr<RelativePermeability> createRelativePermeabilityModel(
BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror, BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror,
BaseLib::ConfigTree::onwarning); BaseLib::ConfigTree::onwarning);
auto const& sub_config = conf.getConfigSubtree("relative_permeability"); auto const& sub_config = conf.getConfigSubtree("relative_permeability");
//! \ogs_file_attr{prj__material_property__porous_medium__porous_medium__id} sub_config.ignoreConfigAttribute("id");
auto const id = sub_config.getConfigAttributeOptional<int>("id");
return MaterialLib::PorousMedium::createRelativePermeabilityModel( return MaterialLib::PorousMedium::createRelativePermeabilityModel(
sub_config); sub_config);
} }
...@@ -146,9 +145,9 @@ TEST(MaterialPorousMedium, checkReletivePermeabilityCurve) ...@@ -146,9 +145,9 @@ TEST(MaterialPorousMedium, checkReletivePermeabilityCurve)
"<relative_permeability id=\"0\">" "<relative_permeability id=\"0\">"
" <type>Curve</type>" " <type>Curve</type>"
" <curve>" " <curve>"
" <data> 0. 0.9 </data>" " <point><data> 0. 0.9 </data></point>"
" <data> 0.4 0.5 </data>" " <point><data> 0.4 0.5 </data></point>"
" <data> 0.9 0.01 </data>" " <point><data> 0.9 0.01 </data></point>"
" </curve>" " </curve>"
"</relative_permeability>"; "</relative_permeability>";
auto const perm_model = createRelativePermeabilityModel(xml); auto const perm_model = createRelativePermeabilityModel(xml);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment