From 8774fca3225b577bcf5487e4b14ef78842a06e01 Mon Sep 17 00:00:00 2001 From: renchao_lu <renchao.lu@gmail.com> Date: Fri, 7 Jan 2022 17:21:02 +0100 Subject: [PATCH] [T|Docu] unit test for Verma-Pruess model and documentation. --- .../VermaPruessModel/c_VermaPruessModel.md | 1 + .../VermaPruessModel/t_critical_porosity.md | 1 + .../property/VermaPruessModel/t_exponent.md | 1 + .../t_initial_permeability.md | 1 + .../VermaPruessModel/t_initial_porosity.md | 1 + .../TestMPLPermeabilityVermaPruessModel.cpp | 62 +++++++++++++++++++ 6 files changed, 67 insertions(+) create mode 100644 Documentation/ProjectFile/properties/property/VermaPruessModel/c_VermaPruessModel.md create mode 100644 Documentation/ProjectFile/properties/property/VermaPruessModel/t_critical_porosity.md create mode 100644 Documentation/ProjectFile/properties/property/VermaPruessModel/t_exponent.md create mode 100644 Documentation/ProjectFile/properties/property/VermaPruessModel/t_initial_permeability.md create mode 100644 Documentation/ProjectFile/properties/property/VermaPruessModel/t_initial_porosity.md create mode 100644 Tests/MaterialLib/TestMPLPermeabilityVermaPruessModel.cpp diff --git a/Documentation/ProjectFile/properties/property/VermaPruessModel/c_VermaPruessModel.md b/Documentation/ProjectFile/properties/property/VermaPruessModel/c_VermaPruessModel.md new file mode 100644 index 00000000000..6b2271877d0 --- /dev/null +++ b/Documentation/ProjectFile/properties/property/VermaPruessModel/c_VermaPruessModel.md @@ -0,0 +1 @@ +\copydoc MaterialPropertyLib::VermaPruessModel diff --git a/Documentation/ProjectFile/properties/property/VermaPruessModel/t_critical_porosity.md b/Documentation/ProjectFile/properties/property/VermaPruessModel/t_critical_porosity.md new file mode 100644 index 00000000000..3f788ce88f9 --- /dev/null +++ b/Documentation/ProjectFile/properties/property/VermaPruessModel/t_critical_porosity.md @@ -0,0 +1 @@ +\copydoc MaterialPropertyLib::VermaPruessModel::_phi_c diff --git a/Documentation/ProjectFile/properties/property/VermaPruessModel/t_exponent.md b/Documentation/ProjectFile/properties/property/VermaPruessModel/t_exponent.md new file mode 100644 index 00000000000..7aba8bba477 --- /dev/null +++ b/Documentation/ProjectFile/properties/property/VermaPruessModel/t_exponent.md @@ -0,0 +1 @@ +\copydoc MaterialPropertyLib::VermaPruessModel::_n diff --git a/Documentation/ProjectFile/properties/property/VermaPruessModel/t_initial_permeability.md b/Documentation/ProjectFile/properties/property/VermaPruessModel/t_initial_permeability.md new file mode 100644 index 00000000000..bc5c0a25bfc --- /dev/null +++ b/Documentation/ProjectFile/properties/property/VermaPruessModel/t_initial_permeability.md @@ -0,0 +1 @@ +\copydoc MaterialPropertyLib::VermaPruessModel::_k0 diff --git a/Documentation/ProjectFile/properties/property/VermaPruessModel/t_initial_porosity.md b/Documentation/ProjectFile/properties/property/VermaPruessModel/t_initial_porosity.md new file mode 100644 index 00000000000..165f9a38119 --- /dev/null +++ b/Documentation/ProjectFile/properties/property/VermaPruessModel/t_initial_porosity.md @@ -0,0 +1 @@ +\copydoc MaterialPropertyLib::VermaPruessModel::_phi0 diff --git a/Tests/MaterialLib/TestMPLPermeabilityVermaPruessModel.cpp b/Tests/MaterialLib/TestMPLPermeabilityVermaPruessModel.cpp new file mode 100644 index 00000000000..6ac49935001 --- /dev/null +++ b/Tests/MaterialLib/TestMPLPermeabilityVermaPruessModel.cpp @@ -0,0 +1,62 @@ +/** + * \copyright + * Copyright (c) 2012-2022, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + * \file + * + * Created on November 2, 2016, 3:09 PM + */ + +#include <gtest/gtest.h> + +#include <vector> + +#include "MaterialLib/MPL/Properties/CreateVermaPruessModel.h" +#include "MaterialLib/MPL/Properties/VermaPruessModel.h" +#include "MaterialLib/MPL/Utils/FormEigenTensor.h" +#include "ParameterLib/ConstantParameter.h" +#include "TestMPL.h" +#include "Tests/TestTools.h" + +TEST(MaterialPropertyLib, PermeabilityVermaPruessModel) +{ + ParameterLib::ConstantParameter<double> const k0("permeability_ini", + 1.5e-14); + ParameterLib::ConstantParameter<double> const phi0("porosity_ini", 0.46); + ParameterLib::ConstantParameter<double> const phi_c("critical_porosity", + 0.3956); + ParameterLib::ConstantParameter<double> const n("exponent", 5); + + auto const k_model = MPL::VermaPruessModel(k0, phi0, phi_c, n); + + ParameterLib::SpatialPosition const pos; + double const t = std::numeric_limits<double>::quiet_NaN(); + double const dt = std::numeric_limits<double>::quiet_NaN(); + + std::vector<double> const porosity{0.44, 0.38}; + std::vector<double> const k_expected{2.3365591132239605e-15, 0.}; + + MPL::VariableArray vars; + + for (std::size_t i = 0; i < porosity.size(); ++i) + { + vars[static_cast<int>(MaterialPropertyLib::Variable::porosity)] = + porosity[i]; + + auto const k = MPL::formEigenTensor<1>(k_model.value(vars, pos, t, dt)); + + // Compare the calculated value with the expected value. + if (k_expected[i] == 0.) + { + ASSERT_EQ(k_expected[i], k(0, 0)); + } + else + { + ASSERT_LE(std::fabs(k_expected[i] - k(0, 0)) / k_expected[i], + 1e-10); + } + } +} -- GitLab