mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-26 03:00:17 -06:00
Add skeleton of AnisotropicEikonal class and test.
This commit is contained in:
parent
dea6e8c044
commit
3001768632
49
opm/core/tof/AnisotropicEikonal.cpp
Normal file
49
opm/core/tof/AnisotropicEikonal.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
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 <opm/core/tof/AnisotropicEikonal.hpp>
|
||||
#include <opm/core/grid/GridUtilities.hpp>
|
||||
#include <opm/core/grid.h>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
/// Construct solver.
|
||||
/// \param[in] grid A 2d grid.
|
||||
AnisotropicEikonal2d::AnisotropicEikonal2d(const UnstructuredGrid& grid)
|
||||
: grid_(grid)
|
||||
{
|
||||
cell_neighbours_ = vertexNeighbours(grid);
|
||||
}
|
||||
|
||||
/// Solve the eikonal equation.
|
||||
/// \param[in] metric Array of metric tensors, M, for each cell.
|
||||
/// \param[in] startcells Array of cells where u = 0 at the centroid.
|
||||
/// \param[out] solution Array of solution to the eikonal equation.
|
||||
void AnisotropicEikonal2d::solve(const double* metric,
|
||||
const std::vector<int>& startcells,
|
||||
std::vector<double>& solution) const
|
||||
{
|
||||
// The algorithm used is described in J.A. Sethian and A. Vladimirsky,
|
||||
// "Ordered Upwind Methods for Static Hamilton-Jacobi Equations".
|
||||
|
||||
// 1.
|
||||
}
|
||||
|
||||
} // namespace Opm
|
57
opm/core/tof/AnisotropicEikonal.hpp
Normal file
57
opm/core/tof/AnisotropicEikonal.hpp
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#ifndef OPM_ANISOTROPICEIKONAL_HEADER_INCLUDED
|
||||
#define OPM_ANISOTROPICEIKONAL_HEADER_INCLUDED
|
||||
|
||||
#include <opm/core/utility/SparseTable.hpp>
|
||||
#include <vector>
|
||||
|
||||
struct UnstructuredGrid;
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
/// A solver for the anisotropic eikonal equation:
|
||||
/// \f[ || \nabla u^T M^{-1}(x) \nabla u || = 1 \qquad x \in \Omega \f]
|
||||
/// where M(x) is a symmetric positive definite matrix.
|
||||
/// The boundary conditions are assumed to be
|
||||
/// \f[ u(x) = 0 \qquad x \in \partial\Omega \f].
|
||||
class AnisotropicEikonal2d
|
||||
{
|
||||
public:
|
||||
/// Construct solver.
|
||||
/// \param[in] grid A 2d grid.
|
||||
explicit AnisotropicEikonal2d(const UnstructuredGrid& grid);
|
||||
|
||||
/// Solve the eikonal equation.
|
||||
/// \param[in] metric Array of metric tensors, M, for each cell.
|
||||
/// \param[in] startcells Array of cells where u = 0 at the centroid.
|
||||
/// \param[out] solution Array of solution to the eikonal equation.
|
||||
void solve(const double* metric,
|
||||
const std::vector<int>& startcells,
|
||||
std::vector<double>& solution) const;
|
||||
private:
|
||||
const UnstructuredGrid& grid_;
|
||||
SparseTable<int> cell_neighbours_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
|
||||
#endif // OPM_ANISOTROPICEIKONAL_HEADER_INCLUDED
|
45
tests/test_anisotropiceikonal.cpp
Normal file
45
tests/test_anisotropiceikonal.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
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 AnisotropicEikonalTest
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <opm/core/tof/AnisotropicEikonal.hpp>
|
||||
#include <opm/core/grid/GridManager.hpp>
|
||||
|
||||
using namespace Opm;
|
||||
|
||||
BOOST_AUTO_TEST_CASE(cartesian_2d)
|
||||
{
|
||||
const GridManager gm(2, 2);
|
||||
const UnstructuredGrid& grid = *gm.c_grid();
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(cartesian_3d)
|
||||
{
|
||||
const GridManager gm(3, 2, 2);
|
||||
const UnstructuredGrid& grid = *gm.c_grid();
|
||||
}
|
Loading…
Reference in New Issue
Block a user