Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Bård Skaflestad 2013-08-01 12:41:04 +02:00
commit 7215936bce
16 changed files with 106 additions and 62 deletions

View File

@ -137,6 +137,8 @@ list (APPEND MAIN_SOURCE_FILES
# find tests -name '*.cpp' -a ! -wholename '*/not-unit/*' -printf '\t%p\n' | sort # find tests -name '*.cpp' -a ! -wholename '*/not-unit/*' -printf '\t%p\n' | sort
list (APPEND TEST_SOURCE_FILES list (APPEND TEST_SOURCE_FILES
tests/test_dgbasis.cpp tests/test_dgbasis.cpp
tests/test_cartgrid.cpp
tests/test_cubic.cpp
tests/test_nonuniformtablelinear.cpp tests/test_nonuniformtablelinear.cpp
tests/test_sparsevector.cpp tests/test_sparsevector.cpp
tests/test_sparsetable.cpp tests/test_sparsetable.cpp
@ -150,6 +152,7 @@ list (APPEND TEST_SOURCE_FILES
tests/test_param.cpp tests/test_param.cpp
tests/test_blackoilfluid.cpp tests/test_blackoilfluid.cpp
tests/test_shadow.cpp tests/test_shadow.cpp
tests/test_units.cpp
) )
# originally generated with the command: # originally generated with the command:

View File

@ -0,0 +1 @@
These files are not actively maintained. Do not expect them to compile and run.

View File

@ -17,12 +17,11 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>. along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "config.h" #include "config.h"
#include <opm/core/utility/parameters/ParameterGroup.hpp> #include <opm/core/utility/parameters/ParameterGroup.hpp>
#include <opm/core/eclipse/EclipseGridParser.hpp> #include <opm/core/io/eclipse/EclipseGridParser.hpp>
#include <opm/core/eclipse/EclipseGridInspector.hpp> #include <opm/core/io/eclipse/EclipseGridInspector.hpp>
#include <opm/core/props/BlackoilPropertiesFromDeck.hpp> #include <opm/core/props/BlackoilPropertiesFromDeck.hpp>
#include <opm/core/grid.h> #include <opm/core/grid.h>

View File

@ -21,10 +21,9 @@
#include "config.h" #include "config.h"
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
#include <opm/core/utility/parameters/ParameterGroup.hpp> #include <opm/core/utility/parameters/ParameterGroup.hpp>
#include <opm/core/eclipse/EclipseGridParser.hpp> #include <opm/core/io/eclipse/EclipseGridParser.hpp>
#include <opm/core/eclipse/EclipseGridInspector.hpp> #include <opm/core/io/eclipse/EclipseGridInspector.hpp>
#include <opm/core/props/BlackoilPropertiesFromDeck.hpp> #include <opm/core/props/BlackoilPropertiesFromDeck.hpp>
#include <opm/core/grid.h> #include <opm/core/grid.h>

View File

@ -23,8 +23,8 @@
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
#include <opm/core/utility/parameters/ParameterGroup.hpp> #include <opm/core/utility/parameters/ParameterGroup.hpp>
#include <opm/core/eclipse/EclipseGridParser.hpp> #include <opm/core/io/eclipse/EclipseGridParser.hpp>
#include <opm/core/eclipse/EclipseGridInspector.hpp> #include <opm/core/io/eclipse/EclipseGridInspector.hpp>
#include <opm/core/props/BlackoilPropertiesFromDeck.hpp> #include <opm/core/props/BlackoilPropertiesFromDeck.hpp>
#include <opm/core/grid.h> #include <opm/core/grid.h>

View File

@ -108,9 +108,7 @@ int main()
// Create solver for SPD system. // Create solver for SPD system.
Opm::LinearSolverAGMG linsolve(100, 1e-9, true); Opm::LinearSolverAGMG linsolve(100, 1e-9, true);
linsolve.solve(A.get(), & b[0], & x[0]);
Opm::LinearSolverInterface::LinearSolverReport
rpt = linsolve.solve(A.get(), & b[0], & x[0]);
double e = 0.0; double e = 0.0;
for (std::size_t i = 0; i < m; ++i) { for (std::size_t i = 0; i < m; ++i) {

View File

@ -7,7 +7,6 @@
#include <suitesparse/umfpack.h> #include <suitesparse/umfpack.h>
#include <opm/core/grid.h> #include <opm/core/grid.h>
#include <opm/core/well.h>
#include <opm/core/linalg/sparse_sys.h> #include <opm/core/linalg/sparse_sys.h>

View File

@ -19,7 +19,7 @@
#include "config.h" #include "config.h"
#include <opm/core/eclipse/EclipseGridParser.hpp> #include <opm/core/io/eclipse/EclipseGridParser.hpp>
#include <opm/core/grid/GridManager.hpp> #include <opm/core/grid/GridManager.hpp>
#include <opm/core/grid/cart_grid.h> #include <opm/core/grid/cart_grid.h>
#include <opm/core/grid.h> #include <opm/core/grid.h>

View File

@ -79,7 +79,7 @@ main() {
#endif #endif
#if 0 #if 0
#include <opm/core/transport/JacobianSystem.hpp> #include <opm/core/transport/implicit/JacobianSystem.hpp>
//using namespace Opm::LinAlgSupport; //using namespace Opm::LinAlgSupport;
using namespace Opm::ImplicitTransportDefault; using namespace Opm::ImplicitTransportDefault;
@ -104,9 +104,9 @@ main() {
#if 1 #if 1
#include <opm/core/linalg/sparse_sys.h> #include <opm/core/linalg/sparse_sys.h>
#include <opm/core/transport/JacobianSystem.hpp> #include <opm/core/transport/implicit/JacobianSystem.hpp>
#include <opm/core/transport/CSRMatrixBlockAssembler.hpp> #include <opm/core/transport/implicit/CSRMatrixBlockAssembler.hpp>
#include <opm/core/transport/CSRMatrixUmfpackSolver.hpp> #include <opm/core/transport/implicit/CSRMatrixUmfpackSolver.hpp>
using namespace Opm::ImplicitTransportDefault; using namespace Opm::ImplicitTransportDefault;

View File

@ -16,7 +16,7 @@ main(void)
struct UnstructuredGrid *G1, *G2; struct UnstructuredGrid *G1, *G2;
G1 = read_grid("cart_grid_2d.txt"); G1 = read_grid("cart_grid_2d.txt");
G2 = create_grid_cart2d(2, 2); G2 = create_grid_cart2d(2, 2, 1., 1.);
destroy_grid(G2); destroy_grid(G2);
destroy_grid(G1); destroy_grid(G1);

View File

@ -36,14 +36,14 @@
#include <fstream> #include <fstream>
#include <string> #include <string>
#include <cstdlib> #include <cstdlib>
#include <opm/core/vag_format/vag.hpp> #include <opm/core/io/vag/vag.hpp>
#include <opm/core/grid.h> #include <opm/core/grid.h>
//#include "../config.h" //#include "../config.h"
/* test reading of vag grid format */ /* test reading of vag grid format */
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
using namespace std; using namespace std;
using namespace OPM; using namespace Opm;
std::string filename; std::string filename;
if (argc == 2) { if (argc == 2) {
filename = argv[1]; filename = argv[1];

View File

@ -14,7 +14,7 @@
#include "config.h" #include "config.h"
#endif #endif
#include <opm/core/eclipse/EclipseGridParser.hpp> #include <opm/core/io/eclipse/EclipseGridParser.hpp>
// Test program for reading Eclipse Polymer keywords. // Test program for reading Eclipse Polymer keywords.

View File

@ -18,7 +18,7 @@
*/ */
#include "config.h" #include "config.h"
#include <opm/core/utility/writeVtkData.hpp> #include <opm/core/io/vtk/writeVtkData.hpp>
#include <fstream> #include <fstream>
#include <array> #include <array>

View File

@ -1,5 +1,6 @@
/* /*
Copyright 2012 SINTEF ICT, Applied Mathematics. Copyright 2012 SINTEF ICT, Applied Mathematics.
Portions Copyright 2013 Uni Research AS.
This file is part of the Open Porous Media project (OPM). This file is part of the Open Porous Media project (OPM).
@ -17,25 +18,41 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>. along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "config.h" #include "config.h"
/* --- Boost.Test boilerplate --- */
#if HAVE_DYNAMIC_BOOST_TEST
#define BOOST_TEST_DYN_LINK
#endif
#define NVERBOSE // Suppress own messages when throw()ing
#define BOOST_TEST_MODULE CartGridTest
#include <boost/test/unit_test.hpp>
#include <boost/test/floating_point_comparison.hpp>
/* --- our own headers --- */
#include <opm/core/grid/cart_grid.h> #include <opm/core/grid/cart_grid.h>
#include <opm/core/grid.h> #include <opm/core/grid.h>
#include <cstdio> #include <stdio.h>
int main(void) BOOST_AUTO_TEST_SUITE ()
BOOST_AUTO_TEST_CASE (facenumbers)
{ {
using namespace std; int faces[] = { 0, 6, 1, 8,
struct UnstructuredGrid *g = create_grid_cart2d(2, 2); 1, 7, 2, 9,
3, 8, 4, 10,
4, 9, 5, 11 };
struct UnstructuredGrid *g = create_grid_cart2d(2, 2, 1., 1.);
int i; int i;
int k; int k;
for (i = 0; i < g->number_of_cells; ++i) { for (i = 0; i < g->number_of_cells; ++i) {
fprintf(stderr, "%d: ", i);
for (k = g->cell_facepos[i]; k < g->cell_facepos[i + 1]; ++k) { for (k = g->cell_facepos[i]; k < g->cell_facepos[i + 1]; ++k) {
fprintf(stderr, "%d ", g->cell_faces[k]); BOOST_REQUIRE_EQUAL (g->cell_faces[k], faces[k]);
} }
fprintf(stderr, "\n");
} }
destroy_grid(g); destroy_grid(g);
return 0;
} }
BOOST_AUTO_TEST_SUITE_END()

View File

@ -16,6 +16,7 @@
/* /*
Copyright 2009, 2010 SINTEF ICT, Applied Mathematics. Copyright 2009, 2010 SINTEF ICT, Applied Mathematics.
Copyright 2009, 2010 Statoil ASA. Copyright 2009, 2010 Statoil ASA.
Portions Copyright 2013 Uni Research AS.
This file is part of The Open Reservoir Simulator Project (OpenRS). This file is part of The Open Reservoir Simulator Project (OpenRS).
@ -34,9 +35,25 @@
*/ */
#include "config.h" #include "config.h"
#include <opm/core/utility/MonotCubicInterpolator.hpp>
int main() /* --- Boost.Test boilerplate --- */
#if HAVE_DYNAMIC_BOOST_TEST
#define BOOST_TEST_DYN_LINK
#endif
#define NVERBOSE // Suppress own messages when throw()ing
#define BOOST_TEST_MODULE CubicTest
#include <boost/test/unit_test.hpp>
#include <boost/test/floating_point_comparison.hpp>
/* --- our own headers --- */
#include <opm/core/utility/MonotCubicInterpolator.hpp>
using namespace Opm;
BOOST_AUTO_TEST_SUITE ()
BOOST_AUTO_TEST_CASE (cubic)
{ {
const int num_v = 3; const int num_v = 3;
double xv[num_v] = {0.0, 1.0, 2.0}; double xv[num_v] = {0.0, 1.0, 2.0};
@ -44,11 +61,13 @@ int main()
std::vector<double> x(xv, xv + num_v); std::vector<double> x(xv, xv + num_v);
std::vector<double> f(fv, fv + num_v); std::vector<double> f(fv, fv + num_v);
MonotCubicInterpolator interp(x, f); MonotCubicInterpolator interp(x, f);
interp.evaluate(-1.0); BOOST_REQUIRE_CLOSE (interp.evaluate(-1.0), 10., 0.00001);
interp.evaluate(0.0); BOOST_REQUIRE_CLOSE (interp.evaluate(0.0), 10., 0.00001);
interp.evaluate(0.0001); BOOST_REQUIRE_CLOSE (interp.evaluate(0.0001), 10.0011, 0.00001);
interp.evaluate(0.5); BOOST_REQUIRE_CLOSE (interp.evaluate(0.5), 17.375, 0.00001);
interp.evaluate(1.0); BOOST_REQUIRE_CLOSE (interp.evaluate(1.0), 21., 0.00001);
interp.evaluate(2.0); BOOST_REQUIRE_CLOSE (interp.evaluate(2.0), 2., 0.00001);
interp.evaluate(4.0); BOOST_REQUIRE_CLOSE (interp.evaluate(4.0), 2., 0.00001);
} }
BOOST_AUTO_TEST_SUITE_END()

View File

@ -34,6 +34,18 @@
*/ */
#include "config.h" #include "config.h"
/* --- Boost.Test boilerplate --- */
#if HAVE_DYNAMIC_BOOST_TEST
#define BOOST_TEST_DYN_LINK
#endif
#define NVERBOSE // Suppress own messages when throw()ing
#define BOOST_TEST_MODULE UnitsTest
#include <boost/test/unit_test.hpp>
#include <boost/test/floating_point_comparison.hpp>
/* --- our own headers --- */
#include <algorithm> #include <algorithm>
#include <iostream> #include <iostream>
#include <iterator> #include <iterator>
@ -46,34 +58,31 @@
using namespace Opm::prefix; using namespace Opm::prefix;
using namespace Opm::unit; using namespace Opm::unit;
int main() BOOST_AUTO_TEST_SUITE ()
BOOST_AUTO_TEST_CASE (units)
{ {
std::cout << "m = " << meter << '\n'; BOOST_REQUIRE_EQUAL (meter, 1);
std::cout << "kg = " << kilogram << '\n'; BOOST_REQUIRE_EQUAL (kilogram, 1);
std::cout << "s = " << second << '\n'; BOOST_REQUIRE_EQUAL (second, 1);
std::cout << "mD = " << milli*darcy << '\n'; BOOST_REQUIRE_CLOSE (milli*darcy, 9.86923667e-16, 0.01);
std::cout << "MD = " << mega*darcy << '\n'; BOOST_REQUIRE_CLOSE (mega*darcy, 9.86923e-7, 0.01);
BOOST_REQUIRE_CLOSE (convert::to(mega*darcy, milli*darcy), 1e9, 0.01);
std::cout << "MD = " << convert::to(mega*darcy, milli*darcy) << " mD\n"; BOOST_REQUIRE_CLOSE (convert::to(convert::from(1.0, barsa), psia), 14.5038, 0.01);
BOOST_REQUIRE_CLOSE (convert::to(1*atm, barsa), 1.01325, 0.01);
std::cout << "1 bar = " << convert::to(convert::from(1.0, barsa), psia) << " psi\n";
std::cout << "1 atm = " << convert::to(1*atm, barsa) << " bar\n";
std::vector<double> flux(10, 10000*cubic(meter)/year); std::vector<double> flux(10, 10000*cubic(meter)/year);
for (int i = 0; i < 10; ++i) {
std::cout << "flux = ["; BOOST_REQUIRE_CLOSE (flux[i], 3.17098e-4, 0.01);
std::copy(flux.begin(), flux.end(), }
std::ostream_iterator<double>(std::cout, " "));
std::cout << "\b] (m^3/s)\n";
std::transform(flux.begin(), flux.end(), flux.begin(), std::transform(flux.begin(), flux.end(), flux.begin(),
boost::bind(convert::to, _1, cubic(meter)/year)); boost::bind(convert::to, _1, cubic(meter)/year));
std::cout << " = ["; for (int i = 0; i < 10; ++i) {
std::copy(flux.begin(), flux.end(), BOOST_REQUIRE_CLOSE (flux[i], 1e4, 0.01);
std::ostream_iterator<double>(std::cout, " ")); }
std::cout << "\b] (m^3/year)\n";
return 0;
} }
BOOST_AUTO_TEST_SUITE_END()