Remove more files moved to opm-grid.
This commit is contained in:
@@ -1,206 +0,0 @@
|
||||
RUNSPEC
|
||||
|
||||
DIMENS
|
||||
10 10 5 /
|
||||
|
||||
GRID
|
||||
|
||||
COORD
|
||||
0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00
|
||||
0.00000000E+00 0.20000000E+02 0.10000000E+02 0.00000000E+00
|
||||
0.00000000E+00 0.10000000E+02 0.00000000E+00 0.20000000E+02
|
||||
0.20000000E+02 0.00000000E+00 0.00000000E+00 0.20000000E+02
|
||||
0.00000000E+00 0.20000000E+02 0.30000000E+02 0.00000000E+00
|
||||
0.00000000E+00 0.30000000E+02 0.00000000E+00 0.20000000E+02
|
||||
0.40000000E+02 0.00000000E+00 0.00000000E+00 0.40000000E+02
|
||||
0.00000000E+00 0.20000000E+02 0.50000000E+02 0.00000000E+00
|
||||
0.00000000E+00 0.50000000E+02 0.00000000E+00 0.20000000E+02
|
||||
0.60000000E+02 0.00000000E+00 0.00000000E+00 0.60000000E+02
|
||||
0.00000000E+00 0.20000000E+02 0.70000000E+02 0.00000000E+00
|
||||
0.00000000E+00 0.70000000E+02 0.00000000E+00 0.20000000E+02
|
||||
0.80000000E+02 0.00000000E+00 0.00000000E+00 0.80000000E+02
|
||||
0.00000000E+00 0.20000000E+02 0.90000000E+02 0.00000000E+00
|
||||
0.00000000E+00 0.90000000E+02 0.00000000E+00 0.20000000E+02
|
||||
0.10000000E+03 0.00000000E+00 0.00000000E+00 0.10000000E+03
|
||||
0.00000000E+00 0.20000000E+02 0.00000000E+00 0.12000000E+02
|
||||
0.00000000E+00 0.00000000E+00 0.12000000E+02 0.20000000E+02
|
||||
0.10000000E+02 0.12000000E+02 0.00000000E+00 0.10000000E+02
|
||||
0.12000000E+02 0.20000000E+02 0.20000000E+02 0.12000000E+02
|
||||
0.00000000E+00 0.20000000E+02 0.12000000E+02 0.20000000E+02
|
||||
0.30000000E+02 0.12000000E+02 0.00000000E+00 0.30000000E+02
|
||||
0.12000000E+02 0.20000000E+02 0.40000000E+02 0.12000000E+02
|
||||
0.00000000E+00 0.40000000E+02 0.12000000E+02 0.20000000E+02
|
||||
0.50000000E+02 0.12000000E+02 0.00000000E+00 0.50000000E+02
|
||||
0.12000000E+02 0.20000000E+02 0.60000000E+02 0.12000000E+02
|
||||
0.00000000E+00 0.60000000E+02 0.12000000E+02 0.20000000E+02
|
||||
0.70000000E+02 0.12000000E+02 0.00000000E+00 0.70000000E+02
|
||||
0.12000000E+02 0.20000000E+02 0.80000000E+02 0.12000000E+02
|
||||
0.00000000E+00 0.80000000E+02 0.12000000E+02 0.20000000E+02
|
||||
0.90000000E+02 0.12000000E+02 0.00000000E+00 0.90000000E+02
|
||||
0.12000000E+02 0.20000000E+02 0.10000000E+03 0.12000000E+02
|
||||
0.00000000E+00 0.10000000E+03 0.12000000E+02 0.20000000E+02
|
||||
0.00000000E+00 0.24000000E+02 0.00000000E+00 0.00000000E+00
|
||||
0.24000000E+02 0.20000000E+02 0.10000000E+02 0.24000000E+02
|
||||
0.00000000E+00 0.10000000E+02 0.24000000E+02 0.20000000E+02
|
||||
0.20000000E+02 0.24000000E+02 0.00000000E+00 0.20000000E+02
|
||||
0.24000000E+02 0.20000000E+02 0.30000000E+02 0.24000000E+02
|
||||
0.00000000E+00 0.30000000E+02 0.24000000E+02 0.20000000E+02
|
||||
0.40000000E+02 0.24000000E+02 0.00000000E+00 0.40000000E+02
|
||||
0.24000000E+02 0.20000000E+02 0.50000000E+02 0.24000000E+02
|
||||
0.00000000E+00 0.50000000E+02 0.24000000E+02 0.20000000E+02
|
||||
0.60000000E+02 0.24000000E+02 0.00000000E+00 0.60000000E+02
|
||||
0.24000000E+02 0.20000000E+02 0.70000000E+02 0.24000000E+02
|
||||
0.00000000E+00 0.70000000E+02 0.24000000E+02 0.20000000E+02
|
||||
0.80000000E+02 0.24000000E+02 0.00000000E+00 0.80000000E+02
|
||||
0.24000000E+02 0.20000000E+02 0.90000000E+02 0.24000000E+02
|
||||
0.00000000E+00 0.90000000E+02 0.24000000E+02 0.20000000E+02
|
||||
0.10000000E+03 0.24000000E+02 0.00000000E+00 0.10000000E+03
|
||||
0.24000000E+02 0.20000000E+02 0.00000000E+00 0.36000000E+02
|
||||
0.00000000E+00 0.00000000E+00 0.36000000E+02 0.20000000E+02
|
||||
0.10000000E+02 0.36000000E+02 0.00000000E+00 0.10000000E+02
|
||||
0.36000000E+02 0.20000000E+02 0.20000000E+02 0.36000000E+02
|
||||
0.00000000E+00 0.20000000E+02 0.36000000E+02 0.20000000E+02
|
||||
0.30000000E+02 0.36000000E+02 0.00000000E+00 0.30000000E+02
|
||||
0.36000000E+02 0.20000000E+02 0.40000000E+02 0.36000000E+02
|
||||
0.00000000E+00 0.40000000E+02 0.36000000E+02 0.20000000E+02
|
||||
0.50000000E+02 0.36000000E+02 0.00000000E+00 0.50000000E+02
|
||||
0.36000000E+02 0.20000000E+02 0.60000000E+02 0.36000000E+02
|
||||
0.00000000E+00 0.60000000E+02 0.36000000E+02 0.20000000E+02
|
||||
0.70000000E+02 0.36000000E+02 0.00000000E+00 0.70000000E+02
|
||||
0.36000000E+02 0.20000000E+02 0.80000000E+02 0.36000000E+02
|
||||
0.00000000E+00 0.80000000E+02 0.36000000E+02 0.20000000E+02
|
||||
0.90000000E+02 0.36000000E+02 0.00000000E+00 0.90000000E+02
|
||||
0.36000000E+02 0.20000000E+02 0.10000000E+03 0.36000000E+02
|
||||
0.00000000E+00 0.10000000E+03 0.36000000E+02 0.20000000E+02
|
||||
0.00000000E+00 0.48000000E+02 0.00000000E+00 0.00000000E+00
|
||||
0.48000000E+02 0.20000000E+02 0.10000000E+02 0.48000000E+02
|
||||
0.00000000E+00 0.10000000E+02 0.48000000E+02 0.20000000E+02
|
||||
0.20000000E+02 0.48000000E+02 0.00000000E+00 0.20000000E+02
|
||||
0.48000000E+02 0.20000000E+02 0.30000000E+02 0.48000000E+02
|
||||
0.00000000E+00 0.30000000E+02 0.48000000E+02 0.20000000E+02
|
||||
0.40000000E+02 0.48000000E+02 0.00000000E+00 0.40000000E+02
|
||||
0.48000000E+02 0.20000000E+02 0.50000000E+02 0.48000000E+02
|
||||
0.00000000E+00 0.50000000E+02 0.48000000E+02 0.20000000E+02
|
||||
0.60000000E+02 0.48000000E+02 0.00000000E+00 0.60000000E+02
|
||||
0.48000000E+02 0.20000000E+02 0.70000000E+02 0.48000000E+02
|
||||
0.00000000E+00 0.70000000E+02 0.48000000E+02 0.20000000E+02
|
||||
0.80000000E+02 0.48000000E+02 0.00000000E+00 0.80000000E+02
|
||||
0.48000000E+02 0.20000000E+02 0.90000000E+02 0.48000000E+02
|
||||
0.00000000E+00 0.90000000E+02 0.48000000E+02 0.20000000E+02
|
||||
0.10000000E+03 0.48000000E+02 0.00000000E+00 0.10000000E+03
|
||||
0.48000000E+02 0.20000000E+02 0.00000000E+00 0.60000000E+02
|
||||
0.00000000E+00 0.00000000E+00 0.60000000E+02 0.20000000E+02
|
||||
0.10000000E+02 0.60000000E+02 0.00000000E+00 0.10000000E+02
|
||||
0.60000000E+02 0.20000000E+02 0.20000000E+02 0.60000000E+02
|
||||
0.00000000E+00 0.20000000E+02 0.60000000E+02 0.20000000E+02
|
||||
0.30000000E+02 0.60000000E+02 0.00000000E+00 0.30000000E+02
|
||||
0.60000000E+02 0.20000000E+02 0.40000000E+02 0.60000000E+02
|
||||
0.00000000E+00 0.40000000E+02 0.60000000E+02 0.20000000E+02
|
||||
0.50000000E+02 0.60000000E+02 0.00000000E+00 0.50000000E+02
|
||||
0.60000000E+02 0.20000000E+02 0.60000000E+02 0.60000000E+02
|
||||
0.00000000E+00 0.60000000E+02 0.60000000E+02 0.20000000E+02
|
||||
0.70000000E+02 0.60000000E+02 0.00000000E+00 0.70000000E+02
|
||||
0.60000000E+02 0.20000000E+02 0.80000000E+02 0.60000000E+02
|
||||
0.00000000E+00 0.80000000E+02 0.60000000E+02 0.20000000E+02
|
||||
0.90000000E+02 0.60000000E+02 0.00000000E+00 0.90000000E+02
|
||||
0.60000000E+02 0.20000000E+02 0.10000000E+03 0.60000000E+02
|
||||
0.00000000E+00 0.10000000E+03 0.60000000E+02 0.20000000E+02
|
||||
0.00000000E+00 0.72000000E+02 0.00000000E+00 0.00000000E+00
|
||||
0.72000000E+02 0.20000000E+02 0.10000000E+02 0.72000000E+02
|
||||
0.00000000E+00 0.10000000E+02 0.72000000E+02 0.20000000E+02
|
||||
0.20000000E+02 0.72000000E+02 0.00000000E+00 0.20000000E+02
|
||||
0.72000000E+02 0.20000000E+02 0.30000000E+02 0.72000000E+02
|
||||
0.00000000E+00 0.30000000E+02 0.72000000E+02 0.20000000E+02
|
||||
0.40000000E+02 0.72000000E+02 0.00000000E+00 0.40000000E+02
|
||||
0.72000000E+02 0.20000000E+02 0.50000000E+02 0.72000000E+02
|
||||
0.00000000E+00 0.50000000E+02 0.72000000E+02 0.20000000E+02
|
||||
0.60000000E+02 0.72000000E+02 0.00000000E+00 0.60000000E+02
|
||||
0.72000000E+02 0.20000000E+02 0.70000000E+02 0.72000000E+02
|
||||
0.00000000E+00 0.70000000E+02 0.72000000E+02 0.20000000E+02
|
||||
0.80000000E+02 0.72000000E+02 0.00000000E+00 0.80000000E+02
|
||||
0.72000000E+02 0.20000000E+02 0.90000000E+02 0.72000000E+02
|
||||
0.00000000E+00 0.90000000E+02 0.72000000E+02 0.20000000E+02
|
||||
0.10000000E+03 0.72000000E+02 0.00000000E+00 0.10000000E+03
|
||||
0.72000000E+02 0.20000000E+02 0.00000000E+00 0.84000000E+02
|
||||
0.00000000E+00 0.00000000E+00 0.84000000E+02 0.20000000E+02
|
||||
0.10000000E+02 0.84000000E+02 0.00000000E+00 0.10000000E+02
|
||||
0.84000000E+02 0.20000000E+02 0.20000000E+02 0.84000000E+02
|
||||
0.00000000E+00 0.20000000E+02 0.84000000E+02 0.20000000E+02
|
||||
0.30000000E+02 0.84000000E+02 0.00000000E+00 0.30000000E+02
|
||||
0.84000000E+02 0.20000000E+02 0.40000000E+02 0.84000000E+02
|
||||
0.00000000E+00 0.40000000E+02 0.84000000E+02 0.20000000E+02
|
||||
0.50000000E+02 0.84000000E+02 0.00000000E+00 0.50000000E+02
|
||||
0.84000000E+02 0.20000000E+02 0.60000000E+02 0.84000000E+02
|
||||
0.00000000E+00 0.60000000E+02 0.84000000E+02 0.20000000E+02
|
||||
0.70000000E+02 0.84000000E+02 0.00000000E+00 0.70000000E+02
|
||||
0.84000000E+02 0.20000000E+02 0.80000000E+02 0.84000000E+02
|
||||
0.00000000E+00 0.80000000E+02 0.84000000E+02 0.20000000E+02
|
||||
0.90000000E+02 0.84000000E+02 0.00000000E+00 0.90000000E+02
|
||||
0.84000000E+02 0.20000000E+02 0.10000000E+03 0.84000000E+02
|
||||
0.00000000E+00 0.10000000E+03 0.84000000E+02 0.20000000E+02
|
||||
0.00000000E+00 0.96000000E+02 0.00000000E+00 0.00000000E+00
|
||||
0.96000000E+02 0.20000000E+02 0.10000000E+02 0.96000000E+02
|
||||
0.00000000E+00 0.10000000E+02 0.96000000E+02 0.20000000E+02
|
||||
0.20000000E+02 0.96000000E+02 0.00000000E+00 0.20000000E+02
|
||||
0.96000000E+02 0.20000000E+02 0.30000000E+02 0.96000000E+02
|
||||
0.00000000E+00 0.30000000E+02 0.96000000E+02 0.20000000E+02
|
||||
0.40000000E+02 0.96000000E+02 0.00000000E+00 0.40000000E+02
|
||||
0.96000000E+02 0.20000000E+02 0.50000000E+02 0.96000000E+02
|
||||
0.00000000E+00 0.50000000E+02 0.96000000E+02 0.20000000E+02
|
||||
0.60000000E+02 0.96000000E+02 0.00000000E+00 0.60000000E+02
|
||||
0.96000000E+02 0.20000000E+02 0.70000000E+02 0.96000000E+02
|
||||
0.00000000E+00 0.70000000E+02 0.96000000E+02 0.20000000E+02
|
||||
0.80000000E+02 0.96000000E+02 0.00000000E+00 0.80000000E+02
|
||||
0.96000000E+02 0.20000000E+02 0.90000000E+02 0.96000000E+02
|
||||
0.00000000E+00 0.90000000E+02 0.96000000E+02 0.20000000E+02
|
||||
0.10000000E+03 0.96000000E+02 0.00000000E+00 0.10000000E+03
|
||||
0.96000000E+02 0.20000000E+02 0.00000000E+00 0.10800000E+03
|
||||
0.00000000E+00 0.00000000E+00 0.10800000E+03 0.20000000E+02
|
||||
0.10000000E+02 0.10800000E+03 0.00000000E+00 0.10000000E+02
|
||||
0.10800000E+03 0.20000000E+02 0.20000000E+02 0.10800000E+03
|
||||
0.00000000E+00 0.20000000E+02 0.10800000E+03 0.20000000E+02
|
||||
0.30000000E+02 0.10800000E+03 0.00000000E+00 0.30000000E+02
|
||||
0.10800000E+03 0.20000000E+02 0.40000000E+02 0.10800000E+03
|
||||
0.00000000E+00 0.40000000E+02 0.10800000E+03 0.20000000E+02
|
||||
0.50000000E+02 0.10800000E+03 0.00000000E+00 0.50000000E+02
|
||||
0.10800000E+03 0.20000000E+02 0.60000000E+02 0.10800000E+03
|
||||
0.00000000E+00 0.60000000E+02 0.10800000E+03 0.20000000E+02
|
||||
0.70000000E+02 0.10800000E+03 0.00000000E+00 0.70000000E+02
|
||||
0.10800000E+03 0.20000000E+02 0.80000000E+02 0.10800000E+03
|
||||
0.00000000E+00 0.80000000E+02 0.10800000E+03 0.20000000E+02
|
||||
0.90000000E+02 0.10800000E+03 0.00000000E+00 0.90000000E+02
|
||||
0.10800000E+03 0.20000000E+02 0.10000000E+03 0.10800000E+03
|
||||
0.00000000E+00 0.10000000E+03 0.10800000E+03 0.20000000E+02
|
||||
0.00000000E+00 0.12000000E+03 0.00000000E+00 0.00000000E+00
|
||||
0.12000000E+03 0.20000000E+02 0.10000000E+02 0.12000000E+03
|
||||
0.00000000E+00 0.10000000E+02 0.12000000E+03 0.20000000E+02
|
||||
0.20000000E+02 0.12000000E+03 0.00000000E+00 0.20000000E+02
|
||||
0.12000000E+03 0.20000000E+02 0.30000000E+02 0.12000000E+03
|
||||
0.00000000E+00 0.30000000E+02 0.12000000E+03 0.20000000E+02
|
||||
0.40000000E+02 0.12000000E+03 0.00000000E+00 0.40000000E+02
|
||||
0.12000000E+03 0.20000000E+02 0.50000000E+02 0.12000000E+03
|
||||
0.00000000E+00 0.50000000E+02 0.12000000E+03 0.20000000E+02
|
||||
0.60000000E+02 0.12000000E+03 0.00000000E+00 0.60000000E+02
|
||||
0.12000000E+03 0.20000000E+02 0.70000000E+02 0.12000000E+03
|
||||
0.00000000E+00 0.70000000E+02 0.12000000E+03 0.20000000E+02
|
||||
0.80000000E+02 0.12000000E+03 0.00000000E+00 0.80000000E+02
|
||||
0.12000000E+03 0.20000000E+02 0.90000000E+02 0.12000000E+03
|
||||
0.00000000E+00 0.90000000E+02 0.12000000E+03 0.20000000E+02
|
||||
0.10000000E+03 0.12000000E+03 0.00000000E+00 0.10000000E+03
|
||||
0.12000000E+03 0.20000000E+02
|
||||
/
|
||||
|
||||
ZCORN
|
||||
400*0.00
|
||||
800*0.40E+01
|
||||
800*0.80E+01
|
||||
800*1.20E+02
|
||||
800*1.60E+02
|
||||
400*2.00E+02
|
||||
/
|
||||
|
||||
ACTNUM
|
||||
200*0 100*1 200*0 /
|
||||
|
||||
|
||||
EDIT
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
Copyright 2012 SINTEF ICT, Applied Mathematics.
|
||||
Portions Copyright 2013 Uni Research AS.
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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.h>
|
||||
#include <stdio.h>
|
||||
|
||||
BOOST_AUTO_TEST_SUITE ()
|
||||
|
||||
BOOST_AUTO_TEST_CASE (facenumbers)
|
||||
{
|
||||
int faces[] = { 0, 6, 1, 8,
|
||||
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 k;
|
||||
for (i = 0; i < g->number_of_cells; ++i) {
|
||||
for (k = g->cell_facepos[i]; k < g->cell_facepos[i + 1]; ++k) {
|
||||
BOOST_REQUIRE_EQUAL (g->cell_faces[k], faces[k]);
|
||||
}
|
||||
}
|
||||
destroy_grid(g);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
@@ -1,166 +0,0 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if HAVE_DYNAMIC_BOOST_TEST
|
||||
#define BOOST_TEST_DYN_LINK
|
||||
#endif
|
||||
#define NVERBOSE // to suppress our messages when throwing
|
||||
|
||||
#define BOOST_TEST_MODULE ColumnExtractTest
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <opm/core/grid/ColumnExtract.hpp>
|
||||
#include <opm/core/grid/GridManager.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <iostream>
|
||||
|
||||
BOOST_AUTO_TEST_CASE(SingleColumnTest)
|
||||
{
|
||||
using namespace Opm;
|
||||
|
||||
const int size_x = 1, size_y = 1, size_z = 10;
|
||||
GridManager manager(size_x, size_y, size_z);
|
||||
|
||||
std::vector<std::vector<int> > columns;
|
||||
extractColumn(*manager.c_grid(), columns);
|
||||
|
||||
std::vector<int> correct_answer;
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
correct_answer.push_back(i);
|
||||
}
|
||||
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(correct_answer.begin(), correct_answer.end(),
|
||||
columns[0].begin(), columns[0].end());
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(FourByFourColumnTest)
|
||||
{
|
||||
const int size_x = 4, size_y = 4, size_z = 10;
|
||||
using namespace Opm;
|
||||
GridManager manager(size_x, size_y, size_z);
|
||||
|
||||
std::vector<std::vector<int> > columns;
|
||||
extractColumn(*manager.c_grid(), columns);
|
||||
|
||||
std::vector<std::vector<int> > correct_answer;
|
||||
correct_answer.resize(size_x * size_y);
|
||||
for(int i = 0; i < size_x * size_y; i++) {
|
||||
for(int j = 0; j < 10; j++) {
|
||||
correct_answer[i].push_back( i + j*size_x*size_y);
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < size_x * size_y; i++) {
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(correct_answer[i].begin(), correct_answer[i].end(),
|
||||
columns[i].begin(), columns[i].end());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(DisjointColumn)
|
||||
{
|
||||
std::string grdecl =
|
||||
"SPECGRID \n"
|
||||
"3 3 3 1 F \n"
|
||||
"/ \n"
|
||||
" \n"
|
||||
"COORD \n"
|
||||
"0.0 0 0 0.0 0 3.0 \n"
|
||||
"1.0 0 0 1.0 0 3.0 \n"
|
||||
"2.0 0 0 2.0 0 3.0 \n"
|
||||
"3.0 0 0 3.0 0 3.0 \n"
|
||||
" \n"
|
||||
"0.0 1.0 0 0.0 1.0 3.0 \n"
|
||||
"1.0 1.0 0 1.0 1.0 3.0 \n"
|
||||
"2.0 1.0 0 2.0 1.0 3.0 \n"
|
||||
"3.0 1.0 0 3.0 1.0 3.0 \n"
|
||||
" \n"
|
||||
"0.0 2.0 0 0.0 2.0 3.0 \n"
|
||||
"1.0 2.0 0 1.0 2.0 3.0 \n"
|
||||
"2.0 2.0 0 2.0 2.0 3.0 \n"
|
||||
"3.0 2.0 0 3.0 2.0 3.0 \n"
|
||||
" \n"
|
||||
"0.0 3.0 0 0.0 3.0 3.0 \n"
|
||||
"1.0 3.0 0 1.0 3.0 3.0 \n"
|
||||
"2.0 3.0 0 2.0 3.0 3.0 \n"
|
||||
"3.0 3.0 0 3.0 3.0 3.0 \n"
|
||||
"/ \n"
|
||||
" \n"
|
||||
"ZCORN \n"
|
||||
"36*0.0 \n"
|
||||
"72*1.0 \n"
|
||||
"72*2.0 \n"
|
||||
"36*3.0 \n"
|
||||
"/ \n"
|
||||
" \n"
|
||||
"ACTNUM \n"
|
||||
"13*1 \n"
|
||||
"0 \n"
|
||||
"13*1 \n"
|
||||
"/ \n"
|
||||
"\n";
|
||||
|
||||
typedef std::vector< std::vector<int> > VVI;
|
||||
|
||||
const int correct[][3] = { { 0, 9, 17 } , // 0
|
||||
{ 1, 10, 18 } , // 1
|
||||
{ 2, 11, 19 } , // 2
|
||||
{ 3, 12, 20 } , // 3
|
||||
{ 21, - 1, - 1 } , // 4
|
||||
{ 5, 13, 22 } , // 5
|
||||
{ 6, 14, 23 } , // 6
|
||||
{ 7, 15, 24 } , // 7
|
||||
{ 8, 16, 25 } , // 8
|
||||
{ 4, - 1, - 1 } }; // 9
|
||||
|
||||
const std::size_t ncol = (sizeof correct) / (sizeof correct[0]);
|
||||
|
||||
VVI correct_answer(ncol);
|
||||
|
||||
for (std::size_t i = 0; i < ncol; ++i) {
|
||||
for (std::size_t j = 0; j < 3; ++j) {
|
||||
correct_answer[i].push_back(correct[i][j]);
|
||||
}
|
||||
}
|
||||
correct_answer[4].resize(1);
|
||||
correct_answer[9].resize(1);
|
||||
|
||||
Opm::ParseContext parseContext;
|
||||
Opm::Parser parser;
|
||||
Opm::Deck deck = parser.parseString(grdecl , parseContext);
|
||||
Opm::EclipseGrid ep = Opm::EclipseGrid(deck);
|
||||
std::vector<int> actnum;
|
||||
for (size_t i = 1; i <= (3 * 3 * 3); i++)
|
||||
actnum.push_back(i != 14); // ACTNUM 13*1 0 13* 1
|
||||
ep.resetACTNUM(actnum.data());
|
||||
Opm::GridManager manager(ep);
|
||||
|
||||
VVI columns;
|
||||
Opm::extractColumn(*manager.c_grid(), columns);
|
||||
|
||||
#if 0
|
||||
for (size_t i = 0; i < columns.size(); ++i) {
|
||||
for (size_t j = 0; j < columns[i].size(); ++j) {
|
||||
std::cout << columns[i][j] << ' ';
|
||||
}
|
||||
std::cout << '\n';
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOST_CHECK_EQUAL(columns.size(), correct_answer.size());
|
||||
|
||||
for (VVI::iterator
|
||||
xb = correct_answer.begin(), xe = correct_answer.end(),
|
||||
cb = columns .begin();
|
||||
xb != xe; ++xb, ++cb) {
|
||||
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS((*xb).begin(), (*xb).end(),
|
||||
(*cb).begin(), (*cb).end());
|
||||
}
|
||||
}
|
||||
@@ -1,195 +0,0 @@
|
||||
/* Copyright 2013 Uni Research AS
|
||||
* This file is licensed under GPL3, see http://www.opm-project.org/
|
||||
*/
|
||||
#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 CompGeo2DTest
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/test/floating_point_comparison.hpp>
|
||||
|
||||
/* --- our own headers --- */
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include <opm/core/grid.h>
|
||||
#include <opm/core/grid/cornerpoint_grid.h> /* compute_geometry */
|
||||
|
||||
using namespace std;
|
||||
|
||||
/* Test properties on a grid that looks like this:
|
||||
*
|
||||
* /------
|
||||
* / | |
|
||||
* < | |
|
||||
* \ | |
|
||||
* \------
|
||||
*
|
||||
*/
|
||||
struct BackspaceGrid {
|
||||
UnstructuredGrid* g;
|
||||
|
||||
BackspaceGrid()
|
||||
{
|
||||
g = allocate_grid(
|
||||
2, /* ndims */
|
||||
2, /* number of cells */
|
||||
6, /* number of edges */
|
||||
6*2, /* six edges with two nodes each */
|
||||
3+4, /* one triangle and one quadrilateral */
|
||||
5); /* five nodes total */
|
||||
/* nodes */
|
||||
double nodes[] = {
|
||||
-1., 0., /* node 0 */
|
||||
0., 1., /* node 1 */
|
||||
1., 1., /* node 2 */
|
||||
1., -1., /* node 3 */
|
||||
0., -1., /* node 4 */
|
||||
};
|
||||
copy(nodes, nodes+sizeof(nodes)/sizeof(nodes[0]), g->node_coordinates);
|
||||
/* edges */
|
||||
int edges[] = {
|
||||
0, 1, /* edge 0 */
|
||||
1, 2, /* edge 1 */
|
||||
2, 3, /* edge 2 */
|
||||
3, 4, /* edge 3 */
|
||||
4, 0, /* edge 4 */
|
||||
4, 1, /* edge 5 */
|
||||
};
|
||||
copy(edges, edges+sizeof(edges)/sizeof(edges[0]), g->face_nodes);
|
||||
/* starting index in map for each edge */
|
||||
int edge_pos[] = {
|
||||
0, 2, 4, 6, 8, 10, 12,
|
||||
};
|
||||
copy(edge_pos, edge_pos+sizeof(edge_pos)/sizeof(edge_pos[0]), g->face_nodepos);
|
||||
/* topology, clock-wise ordering */
|
||||
int neighbours[] = {
|
||||
-1, 0, /* edge 0, between boundary and cell 0 */
|
||||
-1, 1, /* edge 1, between boundary and cell 1 */
|
||||
-1, 1, /* edge 2, between boundary and cell 1 */
|
||||
-1, 1, /* edge 3, between boundary and cell 1 */
|
||||
-1, 0, /* edge 4, between boundary and cell 0 */
|
||||
0, 1, /* edge 5, between cell 0 and cell 1 */
|
||||
};
|
||||
copy(neighbours, neighbours+sizeof(neighbours)/sizeof(neighbours[0]), g->face_cells);
|
||||
/* cells */
|
||||
int cells[] = {
|
||||
0, 5, 4, /* cell 0, clockwise */
|
||||
1, 2, 3, 5, /* cell 1, clockwise */
|
||||
};
|
||||
copy(cells, cells+sizeof(cells)/sizeof(cells[0]), g->cell_faces);
|
||||
/* starting index in map for each cell */
|
||||
int cell_pos[] = {
|
||||
0, 3, 7,
|
||||
};
|
||||
copy(cell_pos, cell_pos+sizeof(cell_pos)/sizeof(cell_pos[0]), g->cell_facepos);
|
||||
/* everything interesting actually happens here, for all tests */
|
||||
compute_geometry(g);
|
||||
}
|
||||
|
||||
~BackspaceGrid()
|
||||
{
|
||||
destroy_grid(g);
|
||||
}
|
||||
};
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE(CompGeo2D, BackspaceGrid)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(edgeMidpoints)
|
||||
{
|
||||
double midpoints[] = {
|
||||
-0.5, 0.5, /* edge 0 */
|
||||
0.5, 1., /* edge 1 */
|
||||
1., 0., /* edge 2 */
|
||||
0.5, -1., /* edge 3 */
|
||||
-0.5, -0.5, /* edge 4 */
|
||||
0., 0., /* edge 5 */
|
||||
};
|
||||
BOOST_REQUIRE (sizeof(midpoints)/sizeof(midpoints[0]) ==
|
||||
g->number_of_faces * g->dimensions);
|
||||
for (int edge = 0; edge < g->number_of_faces; ++edge)
|
||||
{
|
||||
for (int dim = 0; dim < g->dimensions; ++dim)
|
||||
{
|
||||
BOOST_REQUIRE_CLOSE (g->face_centroids[edge*g->dimensions+dim],
|
||||
midpoints[edge*g->dimensions+dim], 0.001);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(edgeNormals)
|
||||
{
|
||||
/* inward normal when doing clockwise enumeration */
|
||||
double normals[] = {
|
||||
1., -1., /* edge 0 */
|
||||
0., -1., /* edge 1 */
|
||||
-2., 0., /* edge 2 */
|
||||
0., 1., /* edge 3 */
|
||||
1., 1., /* edge 4 */
|
||||
2., 0., /* edge 5 */
|
||||
};
|
||||
BOOST_REQUIRE (sizeof(normals)/sizeof(normals[0]) ==
|
||||
g->number_of_faces * g->dimensions);
|
||||
for (int edge = 0; edge < g->number_of_faces; ++edge)
|
||||
{
|
||||
for (int dim = 0; dim < g->dimensions; ++dim)
|
||||
{
|
||||
BOOST_REQUIRE_CLOSE (g->face_normals[edge*g->dimensions+dim],
|
||||
normals[edge*g->dimensions+dim], 0.001);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(edgeLengths)
|
||||
{
|
||||
double lengths[] = {
|
||||
1.4142, /* edge 0 */
|
||||
1., /* edge 1 */
|
||||
2., /* edge 2 */
|
||||
1., /* edge 3 */
|
||||
1.4142, /* edge 4 */
|
||||
2., /* edge 5 */
|
||||
};
|
||||
BOOST_REQUIRE (sizeof(lengths)/sizeof(lengths[0]) == g->number_of_faces);
|
||||
for (int edge = 0; edge < g->number_of_faces; ++edge)
|
||||
{
|
||||
BOOST_REQUIRE_CLOSE (g->face_areas[edge], lengths[edge], 0.001);
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(cellAreas)
|
||||
{
|
||||
double areas[] = {
|
||||
1., 2.,
|
||||
};
|
||||
BOOST_REQUIRE (sizeof(areas)/sizeof(areas[0]) == g->number_of_cells);
|
||||
for (int cell = 0; cell < g->number_of_cells; ++cell)
|
||||
{
|
||||
BOOST_REQUIRE_CLOSE (g->cell_volumes[cell], areas[cell], 0.001);
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(cellCenters)
|
||||
{
|
||||
double cellCenters_var[] = {
|
||||
-1./3., 0.0, /* cell 0 */
|
||||
1./2., 0.0, /* cell 1 */
|
||||
};
|
||||
BOOST_REQUIRE (sizeof(cellCenters_var)/sizeof(cellCenters_var[0]) ==
|
||||
g->number_of_cells * g->dimensions);
|
||||
for (int cell = 0; cell < g->number_of_cells; ++cell)
|
||||
{
|
||||
for (int dim = 0; dim < g->dimensions; ++dim)
|
||||
{
|
||||
BOOST_REQUIRE_CLOSE (g->cell_centroids[cell*g->dimensions+dim],
|
||||
cellCenters_var[cell*g->dimensions+dim], 0.001);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
Copyright 2014 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if HAVE_DYNAMIC_BOOST_TEST
|
||||
#define BOOST_TEST_DYN_LINK
|
||||
#endif
|
||||
#define NVERBOSE // to suppress our messages when throwing
|
||||
|
||||
#define BOOST_TEST_MODULE GridUtilitiesTest
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <opm/core/grid/GridUtilities.hpp>
|
||||
#include <opm/core/grid/GridManager.hpp>
|
||||
|
||||
using namespace Opm;
|
||||
|
||||
BOOST_AUTO_TEST_CASE(cartesian_2d_cellNeighboursAcrossVertices)
|
||||
{
|
||||
const GridManager gm(2, 2);
|
||||
const UnstructuredGrid& grid = *gm.c_grid();
|
||||
const SparseTable<int> vnb = cellNeighboursAcrossVertices(grid);
|
||||
|
||||
const int num_elem = 12;
|
||||
const int elem[num_elem] = { 1, 2, 3, 0, 2, 3, 0, 1, 3, 0, 1, 2 };
|
||||
const int num_rows = 4;
|
||||
const int rowsizes[num_rows] = { 3, 3, 3, 3 };
|
||||
const SparseTable<int> truth(elem, elem + num_elem, rowsizes, rowsizes + num_rows);
|
||||
BOOST_CHECK(vnb == truth);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(cartesian_3d_cellNeighboursAcrossVertices)
|
||||
{
|
||||
const GridManager gm(3, 2, 2);
|
||||
const UnstructuredGrid& grid = *gm.c_grid();
|
||||
const SparseTable<int> vnb = cellNeighboursAcrossVertices(grid);
|
||||
|
||||
BOOST_CHECK_EQUAL(int(vnb.size()), grid.number_of_cells);
|
||||
BOOST_REQUIRE(!vnb.empty());
|
||||
const int n = 7;
|
||||
BOOST_CHECK_EQUAL(int(vnb[0].size()), n);
|
||||
const int nb[n] = { 1, 3, 4, 6, 7, 9, 10 };
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(vnb[0].begin(), vnb[0].end(), nb, nb + n);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(cartesian_2d_orderCounterClockwise)
|
||||
{
|
||||
const GridManager gm(2, 2);
|
||||
const UnstructuredGrid& grid = *gm.c_grid();
|
||||
SparseTable<int> vnb = cellNeighboursAcrossVertices(grid);
|
||||
orderCounterClockwise(grid, vnb);
|
||||
|
||||
BOOST_REQUIRE(!vnb.empty());
|
||||
const int num_elem = 12;
|
||||
const int elem[num_elem] = { 1, 3, 2, 3, 2, 0, 3, 0, 1, 2, 0, 1 };
|
||||
const int num_rows = 4;
|
||||
const int rowsizes[num_rows] = { 3, 3, 3, 3 };
|
||||
const SparseTable<int> truth(elem, elem + num_elem, rowsizes, rowsizes + num_rows);
|
||||
BOOST_CHECK(vnb == truth);
|
||||
for (int c = 0; c < num_rows; ++c) {
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(vnb[c].begin(), vnb[c].end(), truth[c].begin(), truth[c].end());
|
||||
}
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
/*
|
||||
Copyright 2014 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if HAVE_DYNAMIC_BOOST_TEST
|
||||
#define BOOST_TEST_DYN_LINK
|
||||
#endif
|
||||
#define NVERBOSE // to suppress our messages when throwing
|
||||
|
||||
#define BOOST_TEST_MODULE MinpvProcessorTest
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <opm/core/grid/MinpvProcessor.hpp>
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Processing)
|
||||
{
|
||||
std::vector<double> zcorn = { 0, 0, 0, 0,
|
||||
1, 1, 1, 1,
|
||||
1, 1, 1, 1,
|
||||
3, 3, 3, 3,
|
||||
3, 3, 3, 3,
|
||||
6, 6, 6, 6 };
|
||||
std::vector<double> zcorn2after = { 0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
3, 3, 3, 3,
|
||||
3, 3, 3, 3,
|
||||
6, 6, 6, 6 };
|
||||
std::vector<double> zcorn3after = { 0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
6, 6, 6, 6 };
|
||||
std::vector<double> zcorn4after = { 0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
1, 1, 1, 1,
|
||||
3, 3, 3, 3,
|
||||
3, 3, 3, 3,
|
||||
6, 6, 6, 6 };
|
||||
std::vector<double> zcorn5after = { 0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
1, 1, 1, 1,
|
||||
1, 1, 1, 1,
|
||||
3, 3, 3, 3,
|
||||
6, 6, 6, 6 };
|
||||
|
||||
std::vector<double> pv = { 1, 2, 3 };
|
||||
std::vector<int> actnum = { 1, 1, 1 };
|
||||
|
||||
Opm::MinpvProcessor mp1(1, 1, 3);
|
||||
auto z1 = zcorn;
|
||||
bool fill_removed_cells = true;
|
||||
mp1.process(pv, 0.5, actnum, fill_removed_cells, z1.data());
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(z1.begin(), z1.end(), zcorn.begin(), zcorn.end());
|
||||
|
||||
Opm::MinpvProcessor mp2(1, 1, 3);
|
||||
auto z2 = zcorn;
|
||||
mp2.process(pv, 1.5, actnum, fill_removed_cells, z2.data());
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(z2.begin(), z2.end(), zcorn2after.begin(), zcorn2after.end());
|
||||
|
||||
Opm::MinpvProcessor mp3(1, 1, 3);
|
||||
auto z3 = zcorn;
|
||||
mp3.process(pv, 2.5, actnum, fill_removed_cells, z3.data());
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(z3.begin(), z3.end(), zcorn3after.begin(), zcorn3after.end());
|
||||
|
||||
Opm::MinpvProcessor mp4(1, 1, 3);
|
||||
auto z4 = zcorn;
|
||||
mp4.process(pv, 1.5, actnum, !fill_removed_cells, z4.data());
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(z4.begin(), z4.end(), zcorn4after.begin(), zcorn4after.end());
|
||||
|
||||
Opm::MinpvProcessor mp5(1, 1, 3);
|
||||
auto z5 = zcorn;
|
||||
mp5.process(pv, 2.5, actnum, !fill_removed_cells, z5.data());
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(z5.begin(), z5.end(), zcorn5after.begin(), zcorn5after.end());
|
||||
}
|
||||
@@ -1,205 +0,0 @@
|
||||
/*
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if HAVE_DYNAMIC_BOOST_TEST
|
||||
#define BOOST_TEST_DYN_LINK
|
||||
#endif
|
||||
#define NVERBOSE // to suppress our messages when throwing
|
||||
|
||||
#define BOOST_TEST_MODULE QuadratureTest
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <opm/core/grid/CellQuadrature.hpp>
|
||||
#include <opm/core/grid/FaceQuadrature.hpp>
|
||||
#include <opm/core/grid/GridManager.hpp>
|
||||
#include <opm/core/grid.h>
|
||||
#include <cmath>
|
||||
|
||||
using namespace Opm;
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
template <class Quadrature>
|
||||
class Integrator
|
||||
{
|
||||
public:
|
||||
explicit Integrator(const UnstructuredGrid& grid, const int entity, const int degree)
|
||||
: quad_(grid, entity, degree),
|
||||
pt(grid.dimensions)
|
||||
{
|
||||
}
|
||||
template <class Func>
|
||||
double integrate(const Func& f) const
|
||||
{
|
||||
double res = 0;
|
||||
for (int quad_pt = 0; quad_pt < quad_.numQuadPts(); ++quad_pt) {
|
||||
quad_.quadPtCoord(quad_pt, &pt[0]);
|
||||
const double w = quad_.quadPtWeight(quad_pt);
|
||||
const double fval = f(&pt[0]);
|
||||
res += w*fval;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
private:
|
||||
const Quadrature quad_;
|
||||
mutable std::vector<double> pt;
|
||||
};
|
||||
|
||||
|
||||
template <class Quadrature, class Func>
|
||||
void testSingleCase(const UnstructuredGrid& grid,
|
||||
const int entity,
|
||||
const int degree,
|
||||
const double expected_answer)
|
||||
{
|
||||
Integrator<Quadrature> integrator(grid, entity, degree);
|
||||
Func f;
|
||||
const double val = integrator.integrate(f);
|
||||
BOOST_CHECK(std::fabs(val - expected_answer) < 1e-12);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
namespace cart2d
|
||||
{
|
||||
struct ConstantFunc
|
||||
{
|
||||
double operator()(const double*) const
|
||||
{
|
||||
return 1.234;
|
||||
}
|
||||
};
|
||||
|
||||
struct LinearFunc
|
||||
{
|
||||
double operator()(const double* x) const
|
||||
{
|
||||
return 1.0*x[0] + 2.0*x[1] + 3.0;
|
||||
}
|
||||
};
|
||||
|
||||
struct QuadraticFunc
|
||||
{
|
||||
double operator()(const double* x) const
|
||||
{
|
||||
return 3.0*x[0]*x[0] + 1.0*x[0]*x[1] + 2.0*x[1] + 3.0;
|
||||
}
|
||||
};
|
||||
|
||||
static void test()
|
||||
{
|
||||
// Set up 2d 1-cell cartesian case.
|
||||
GridManager g(1, 1);
|
||||
const UnstructuredGrid& grid = *g.c_grid();
|
||||
|
||||
// CellQuadrature tests.
|
||||
testSingleCase<CellQuadrature, ConstantFunc>(grid, 0, 1, 1.234);
|
||||
testSingleCase<CellQuadrature, LinearFunc>(grid, 0, 1, 4.5);
|
||||
testSingleCase<CellQuadrature, ConstantFunc>(grid, 0, 2, 1.234);
|
||||
testSingleCase<CellQuadrature, LinearFunc>(grid, 0, 2, 4.5);
|
||||
testSingleCase<CellQuadrature, QuadraticFunc>(grid, 0, 2, 5.25);
|
||||
|
||||
// FaceQuadrature tests, degree 1 precision.
|
||||
testSingleCase<FaceQuadrature, LinearFunc>(grid, 0, 1, 4);
|
||||
testSingleCase<FaceQuadrature, LinearFunc>(grid, 1, 1, 5);
|
||||
testSingleCase<FaceQuadrature, LinearFunc>(grid, 2, 1, 3.5);
|
||||
testSingleCase<FaceQuadrature, LinearFunc>(grid, 3, 1, 5.5);
|
||||
|
||||
// FaceQuadrature tests, degree 2 precision.
|
||||
testSingleCase<FaceQuadrature, LinearFunc>(grid, 0, 2, 4);
|
||||
testSingleCase<FaceQuadrature, LinearFunc>(grid, 1, 2, 5);
|
||||
testSingleCase<FaceQuadrature, LinearFunc>(grid, 2, 2, 3.5);
|
||||
testSingleCase<FaceQuadrature, LinearFunc>(grid, 3, 2, 5.5);
|
||||
|
||||
// FaceQuadrature tests, quadratic function, degree 2 precision.
|
||||
testSingleCase<FaceQuadrature, QuadraticFunc>(grid, 0, 2, 4.0);
|
||||
testSingleCase<FaceQuadrature, QuadraticFunc>(grid, 1, 2, 7.5);
|
||||
testSingleCase<FaceQuadrature, QuadraticFunc>(grid, 2, 2, 4.0);
|
||||
testSingleCase<FaceQuadrature, QuadraticFunc>(grid, 3, 2, 6.5);
|
||||
}
|
||||
} // namespace cart2d
|
||||
|
||||
|
||||
namespace cart3d
|
||||
{
|
||||
struct LinearFunc
|
||||
{
|
||||
double operator()(const double* x) const
|
||||
{
|
||||
return 1.0*x[0] + 2.0*x[1] + 1.0*x[2] + 3.0;
|
||||
}
|
||||
};
|
||||
|
||||
struct QuadraticFunc
|
||||
{
|
||||
double operator()(const double* x) const
|
||||
{
|
||||
return 1.0*x[0]*x[1] + 2.0*x[1] + 4.0*x[2] + 3.0;
|
||||
}
|
||||
};
|
||||
|
||||
static void test()
|
||||
{
|
||||
// Set up 3d 1-cell cartesian case.
|
||||
GridManager g(1, 1, 1);
|
||||
const UnstructuredGrid& grid = *g.c_grid();
|
||||
|
||||
// CellQuadrature tests.
|
||||
testSingleCase<CellQuadrature, LinearFunc>(grid, 0, 1, 5.0);
|
||||
testSingleCase<CellQuadrature, LinearFunc>(grid, 0, 2, 5.0);
|
||||
testSingleCase<CellQuadrature, QuadraticFunc>(grid, 0, 2, 6.25);
|
||||
|
||||
// FaceQuadrature tests, degree 1 precision.
|
||||
testSingleCase<FaceQuadrature, LinearFunc>(grid, 0, 1, 4.5);
|
||||
testSingleCase<FaceQuadrature, LinearFunc>(grid, 1, 1, 5.5);
|
||||
testSingleCase<FaceQuadrature, LinearFunc>(grid, 2, 1, 4.0);
|
||||
testSingleCase<FaceQuadrature, LinearFunc>(grid, 3, 1, 6.0);
|
||||
testSingleCase<FaceQuadrature, LinearFunc>(grid, 4, 1, 4.5);
|
||||
testSingleCase<FaceQuadrature, LinearFunc>(grid, 5, 1, 5.5);
|
||||
|
||||
// FaceQuadrature tests, degree 2 precision.
|
||||
testSingleCase<FaceQuadrature, LinearFunc>(grid, 0, 2, 4.5);
|
||||
testSingleCase<FaceQuadrature, LinearFunc>(grid, 1, 2, 5.5);
|
||||
testSingleCase<FaceQuadrature, LinearFunc>(grid, 2, 2, 4.0);
|
||||
testSingleCase<FaceQuadrature, LinearFunc>(grid, 3, 2, 6.0);
|
||||
testSingleCase<FaceQuadrature, LinearFunc>(grid, 4, 2, 4.5);
|
||||
testSingleCase<FaceQuadrature, LinearFunc>(grid, 5, 2, 5.5);
|
||||
|
||||
// FaceQuadrature tests, quadratic function, degree 2 precision.
|
||||
testSingleCase<FaceQuadrature, QuadraticFunc>(grid, 0, 2, 6.0);
|
||||
testSingleCase<FaceQuadrature, QuadraticFunc>(grid, 1, 2, 6.5);
|
||||
testSingleCase<FaceQuadrature, QuadraticFunc>(grid, 2, 2, 5.0);
|
||||
testSingleCase<FaceQuadrature, QuadraticFunc>(grid, 3, 2, 7.5);
|
||||
testSingleCase<FaceQuadrature, QuadraticFunc>(grid, 4, 2, 4.25);
|
||||
testSingleCase<FaceQuadrature, QuadraticFunc>(grid, 5, 2, 8.25);
|
||||
}
|
||||
|
||||
} // namespace cart3d
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_quadratures)
|
||||
{
|
||||
cart2d::test();
|
||||
cart3d::test();
|
||||
}
|
||||
@@ -1,177 +0,0 @@
|
||||
/* Copyright 2014 Statoil ASA
|
||||
* This file is licensed under GPL3, see http://www.opm-project.org/
|
||||
*/
|
||||
|
||||
#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 TEST_UG
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/test/floating_point_comparison.hpp>
|
||||
|
||||
/* --- our own headers --- */
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include <opm/core/grid.h>
|
||||
#include <opm/core/grid/cornerpoint_grid.h> /* compute_geometry */
|
||||
#include <opm/core/grid/GridManager.hpp> /* compute_geometry */
|
||||
#include <opm/core/grid/GridHelpers.hpp>
|
||||
#include <opm/core/grid/cpgpreprocess/preprocess.h>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Equal) {
|
||||
Opm::ParseContext parseContext;
|
||||
const std::string filename1 = "CORNERPOINT_ACTNUM.DATA";
|
||||
const char *deck2Data =
|
||||
"RUNSPEC\n"
|
||||
"\n"
|
||||
"DIMENS\n"
|
||||
" 10 10 10 /\n"
|
||||
"GRID\n"
|
||||
"DXV\n"
|
||||
"10*0.25 /\n"
|
||||
"DYV\n"
|
||||
"10*0.25 /\n"
|
||||
"DZV\n"
|
||||
"10*0.25 /\n"
|
||||
"TOPS\n"
|
||||
"100*0.25 /\n"
|
||||
"EDIT\n"
|
||||
"\n";
|
||||
|
||||
Opm::Parser parser;
|
||||
|
||||
Opm::Deck deck1 = parser.parseFile( filename1 , parseContext);
|
||||
Opm::EclipseState es1(deck1, parseContext);
|
||||
|
||||
Opm::Deck deck2 = parser.parseString( deck2Data , parseContext);
|
||||
Opm::EclipseState es2(deck2, parseContext);
|
||||
|
||||
BOOST_CHECK( deck1.hasKeyword("ZCORN") );
|
||||
BOOST_CHECK( deck1.hasKeyword("COORD") );
|
||||
|
||||
Opm::GridManager grid1(es1.getInputGrid());
|
||||
Opm::GridManager grid2(es2.getInputGrid());
|
||||
|
||||
const UnstructuredGrid* cgrid1 = grid1.c_grid();
|
||||
const UnstructuredGrid* cgrid2 = grid2.c_grid();
|
||||
|
||||
|
||||
|
||||
BOOST_CHECK( grid_equal( cgrid1 , cgrid1 ));
|
||||
BOOST_CHECK( grid_equal( cgrid2 , cgrid2 ));
|
||||
BOOST_CHECK( !grid_equal( cgrid1 , cgrid2 ));
|
||||
}
|
||||
|
||||
|
||||
|
||||
// TODO This method might be obsolete after using EclipseState to generate grid
|
||||
BOOST_AUTO_TEST_CASE(EqualEclipseGrid) {
|
||||
const std::string filename = "CORNERPOINT_ACTNUM.DATA";
|
||||
Opm::Parser parser;
|
||||
Opm::ParseContext parseContext;
|
||||
Opm::Deck deck = parser.parseFile( filename , parseContext);
|
||||
Opm::EclipseState es(deck, parseContext);
|
||||
auto grid = es.getInputGrid();
|
||||
|
||||
Opm::GridManager gridM(es.getInputGrid());
|
||||
const UnstructuredGrid* cgrid1 = gridM.c_grid();
|
||||
struct UnstructuredGrid * cgrid2;
|
||||
{
|
||||
struct grdecl g;
|
||||
const auto& dimens = deck.getKeyword("DIMENS");
|
||||
const auto& coord = deck.getKeyword("COORD");
|
||||
const auto& zcorn = deck.getKeyword("ZCORN");
|
||||
const auto& actnum = deck.getKeyword("ACTNUM");
|
||||
|
||||
g.dims[0] = dimens.getRecord(0).getItem("NX").get< int >(0);
|
||||
g.dims[1] = dimens.getRecord(0).getItem("NY").get< int >(0);
|
||||
g.dims[2] = dimens.getRecord(0).getItem("NZ").get< int >(0);
|
||||
|
||||
g.coord = coord.getSIDoubleData().data();
|
||||
g.zcorn = zcorn.getSIDoubleData().data();
|
||||
g.actnum = actnum.getIntData().data();
|
||||
g.mapaxes = NULL;
|
||||
|
||||
|
||||
cgrid2 = create_grid_cornerpoint(&g , 0.0);
|
||||
if (!cgrid2)
|
||||
throw std::runtime_error("Failed to construct grid.");
|
||||
}
|
||||
|
||||
|
||||
BOOST_CHECK( grid_equal( cgrid1 , cgrid2 ));
|
||||
destroy_grid( cgrid2 );
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(TOPS_Fully_Specified) {
|
||||
const char *deck1Data =
|
||||
"RUNSPEC\n"
|
||||
"\n"
|
||||
"DIMENS\n"
|
||||
" 10 10 3 /\n"
|
||||
"GRID\n"
|
||||
"DX\n"
|
||||
"300*1000 /\n"
|
||||
"DY\n"
|
||||
"300*1000 /\n"
|
||||
"DZ\n"
|
||||
"100*20 100*30 100*50 /\n"
|
||||
"TOPS\n"
|
||||
"100*8325 /\n"
|
||||
"EDIT\n"
|
||||
"\n";
|
||||
|
||||
|
||||
const char *deck2Data =
|
||||
"RUNSPEC\n"
|
||||
"\n"
|
||||
"DIMENS\n"
|
||||
" 10 10 3 /\n"
|
||||
"GRID\n"
|
||||
"DX\n"
|
||||
"300*1000 /\n"
|
||||
"DY\n"
|
||||
"300*1000 /\n"
|
||||
"DZ\n"
|
||||
"100*20 100*30 100*50 /\n"
|
||||
"TOPS\n"
|
||||
"100*8325 100*8345 100*8375/\n"
|
||||
"EDIT\n"
|
||||
"\n";
|
||||
|
||||
Opm::Parser parser;
|
||||
Opm::ParseContext parseContext;
|
||||
const Opm::Deck& deck1 = parser.parseString(deck1Data, parseContext);
|
||||
const Opm::Deck& deck2 = parser.parseString(deck2Data, parseContext);
|
||||
|
||||
Opm::EclipseState es1(deck1, parseContext);
|
||||
Opm::EclipseState es2(deck2, parseContext);
|
||||
|
||||
Opm::GridManager gridM1(es1.getInputGrid());
|
||||
Opm::GridManager gridM2(es2.getInputGrid());
|
||||
|
||||
const UnstructuredGrid* cgrid1 = gridM1.c_grid();
|
||||
const UnstructuredGrid* cgrid2 = gridM2.c_grid();
|
||||
|
||||
BOOST_CHECK(grid_equal(cgrid1, cgrid2));
|
||||
|
||||
Opm::EclipseGrid grid = Opm::UgGridHelpers::createEclipseGrid( *cgrid1 , es1.getInputGrid( ) );
|
||||
}
|
||||
Reference in New Issue
Block a user