mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-27 17:50:59 -06:00
Added simple test, work in progress.
This commit is contained in:
parent
3001768632
commit
84da6a28f3
@ -29,7 +29,11 @@ namespace Opm
|
|||||||
AnisotropicEikonal2d::AnisotropicEikonal2d(const UnstructuredGrid& grid)
|
AnisotropicEikonal2d::AnisotropicEikonal2d(const UnstructuredGrid& grid)
|
||||||
: grid_(grid)
|
: grid_(grid)
|
||||||
{
|
{
|
||||||
|
if (grid.dimensions != 2) {
|
||||||
|
OPM_THROW(std::logic_error, "Grid for AnisotropicEikonal2d must be 2d.");
|
||||||
|
}
|
||||||
cell_neighbours_ = vertexNeighbours(grid);
|
cell_neighbours_ = vertexNeighbours(grid);
|
||||||
|
orderCounterClockwise(grid, cell_neighbours_);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Solve the eikonal equation.
|
/// Solve the eikonal equation.
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include <opm/core/tof/AnisotropicEikonal.hpp>
|
#include <opm/core/tof/AnisotropicEikonal.hpp>
|
||||||
#include <opm/core/grid/GridManager.hpp>
|
#include <opm/core/grid/GridManager.hpp>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
using namespace Opm;
|
using namespace Opm;
|
||||||
|
|
||||||
@ -36,10 +37,17 @@ BOOST_AUTO_TEST_CASE(cartesian_2d)
|
|||||||
{
|
{
|
||||||
const GridManager gm(2, 2);
|
const GridManager gm(2, 2);
|
||||||
const UnstructuredGrid& grid = *gm.c_grid();
|
const UnstructuredGrid& grid = *gm.c_grid();
|
||||||
}
|
AnisotropicEikonal2d ae(grid);
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(cartesian_3d)
|
const std::vector<double> metric = {
|
||||||
{
|
1, 0, 0, 1,
|
||||||
const GridManager gm(3, 2, 2);
|
1, 0, 0, 1,
|
||||||
const UnstructuredGrid& grid = *gm.c_grid();
|
1, 0, 0, 1
|
||||||
|
};
|
||||||
|
const std::vector<int> start = { 0 };
|
||||||
|
std::vector<double> sol;
|
||||||
|
ae.solve(metric.data(), start, sol);
|
||||||
|
BOOST_REQUIRE(!sol.empty());
|
||||||
|
std::vector<double> truth = { 0, 1, 1, std::sqrt(2) };
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS(sol.begin(), sol.end(), truth.begin(), truth.end());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user