From cefdfca02b3dff430323b67bd46652a5b9f4aabf Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <dmitri.naumov@ufz.de> Date: Mon, 9 Sep 2019 18:29:13 +0200 Subject: [PATCH] [MPL] Extract create of saturation Brooks-Corey. move include CreateSaturationBrooksCorey.h into CreateProperties.h --- MaterialLib/MPL/CreateProperty.cpp | 1 + MaterialLib/MPL/Properties/CreateProperties.h | 3 +- .../CreateSaturationBrooksCorey.cpp | 42 +++++++++++++++++++ .../Properties/CreateSaturationBrooksCorey.h | 27 ++++++++++++ .../MPL/Properties/SaturationBrooksCorey.h | 32 -------------- 5 files changed, 72 insertions(+), 33 deletions(-) create mode 100644 MaterialLib/MPL/Properties/CreateSaturationBrooksCorey.cpp create mode 100644 MaterialLib/MPL/Properties/CreateSaturationBrooksCorey.h diff --git a/MaterialLib/MPL/CreateProperty.cpp b/MaterialLib/MPL/CreateProperty.cpp index 7f754fe95ba..40f9d59442c 100644 --- a/MaterialLib/MPL/CreateProperty.cpp +++ b/MaterialLib/MPL/CreateProperty.cpp @@ -18,6 +18,7 @@ #include "BaseLib/ConfigTree.h" #include "Properties/CreateProperties.h" + #include "Properties/Properties.h" #include "Component.h" diff --git a/MaterialLib/MPL/Properties/CreateProperties.h b/MaterialLib/MPL/Properties/CreateProperties.h index 160408503fa..646a6e2213a 100644 --- a/MaterialLib/MPL/Properties/CreateProperties.h +++ b/MaterialLib/MPL/Properties/CreateProperties.h @@ -16,4 +16,5 @@ #include "CreateExponentialProperty.h" #include "CreateIdealGasLaw.h" #include "CreateLinearProperty.h" -#include "CreateParameterProperty.h" \ No newline at end of file +#include "CreateParameterProperty.h" +#include "CreateSaturationBrooksCorey.h" \ No newline at end of file diff --git a/MaterialLib/MPL/Properties/CreateSaturationBrooksCorey.cpp b/MaterialLib/MPL/Properties/CreateSaturationBrooksCorey.cpp new file mode 100644 index 00000000000..3bfcf096c69 --- /dev/null +++ b/MaterialLib/MPL/Properties/CreateSaturationBrooksCorey.cpp @@ -0,0 +1,42 @@ +/** + * \file + * \copyright + * Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + */ + +#include "BaseLib/ConfigTree.h" +#include "SaturationBrooksCorey.h" + +namespace MaterialPropertyLib +{ +std::unique_ptr<SaturationBrooksCorey> createSaturationBrooksCorey( + BaseLib::ConfigTree const& config) +{ + // check is reading the parameter, not peeking it... + //! \ogs_file_param{prj__media__medium__properties__property__SaturationBrooksCorey} + config.checkConfigParameter("type", "SaturationBrooksCorey"); + + DBUG("Create SaturationBrooksCorey medium property"); + + auto const residual_liquid_saturation = + //! \ogs_file_param{prj__media__medium__properties__property__SaturationBrooksCorey__residual_liquid_saturation} + config.getConfigParameter<double>("residual_liquid_saturation"); + auto const residual_gas_saturation = + //! \ogs_file_param{prj__media__medium__properties__property__SaturationBrooksCorey__residual_gas_saturation} + config.getConfigParameter<double>("residual_gas_saturation"); + auto const exponent = + //! \ogs_file_param{prj__media__medium__properties__property__SaturationBrooksCorey__lambda} + config.getConfigParameter<double>("lambda"); + auto const entry_pressure = + //! \ogs_file_param{prj__media__medium__properties__property__SaturationBrooksCorey__entry_pressure} + config.getConfigParameter<double>("entry_pressure"); + + return std::make_unique<SaturationBrooksCorey>(residual_liquid_saturation, + residual_gas_saturation, + exponent, entry_pressure); +} +} // namespace MaterialPropertyLib diff --git a/MaterialLib/MPL/Properties/CreateSaturationBrooksCorey.h b/MaterialLib/MPL/Properties/CreateSaturationBrooksCorey.h new file mode 100644 index 00000000000..42a8286b8d5 --- /dev/null +++ b/MaterialLib/MPL/Properties/CreateSaturationBrooksCorey.h @@ -0,0 +1,27 @@ +/** + * \file + * \copyright + * Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + */ + +#pragma once + +namespace BaseLib +{ +class ConfigTree; +} + +namespace MaterialPropertyLib +{ +class SaturationBrooksCorey; +} + +namespace MaterialPropertyLib +{ +std::unique_ptr<SaturationBrooksCorey> createSaturationBrooksCorey( + BaseLib::ConfigTree const& config); +} // namespace MaterialPropertyLib diff --git a/MaterialLib/MPL/Properties/SaturationBrooksCorey.h b/MaterialLib/MPL/Properties/SaturationBrooksCorey.h index 59a67e4bf14..2ee2c3c2c1d 100644 --- a/MaterialLib/MPL/Properties/SaturationBrooksCorey.h +++ b/MaterialLib/MPL/Properties/SaturationBrooksCorey.h @@ -14,7 +14,6 @@ #pragma once #include <limits> -#include "BaseLib/ConfigTree.h" #include "MaterialLib/MPL/Property.h" namespace MaterialPropertyLib @@ -70,35 +69,4 @@ public: ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/) const override; }; - -inline std::unique_ptr<SaturationBrooksCorey> createSaturationBrooksCorey( - BaseLib::ConfigTree const& config) -{ - // check is reading the parameter, not peeking it... - //! \ogs_file_param{prj__media__medium__properties__property__SaturationBrooksCorey} - // config.checkConfigParameter("type", "SaturationBrooksCorey"); - DBUG("Create SaturationBrooksCorey medium property"); - - auto const residual_liquid_saturation = - //! \ogs_file_param{prj__media__medium__properties__property__SaturationBrooksCorey__residual_liquid_saturation} - config.getConfigParameter<double>("residual_liquid_saturation"); - auto const residual_gas_saturation = - //! \ogs_file_param{prj__media__medium__properties__property__SaturationBrooksCorey__residual_gas_saturation} - config.getConfigParameter<double>("residual_gas_saturation"); - auto const exponent = - //! \ogs_file_param{prj__media__medium__properties__property__SaturationBrooksCorey__lambda} - config.getConfigParameter<double>("lambda"); - auto const entry_pressure = - //! \ogs_file_param{prj__media__medium__properties__property__SaturationBrooksCorey__entry_pressure} - config.getConfigParameter<double>("entry_pressure"); - if (entry_pressure < 0.) - { - OGS_FATAL("Paramater 'entry_pressure' must be positive."); - } - - return std::make_unique<SaturationBrooksCorey>(residual_liquid_saturation, - residual_gas_saturation, - exponent, entry_pressure); -} - } // namespace MaterialPropertyLib -- GitLab