mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
opm-flowdiagnostics updated to 80190c28ae0fd4a82cfe88c827559029982db83b
opm-flowdiagnostics-applications updated to 01ecb8fc22cb70d883edaad398bffc49878859c3 Which fixes error in TOF calculations.
This commit is contained in:
@@ -30,7 +30,9 @@ list (APPEND TEST_SOURCE_FILES
|
||||
)
|
||||
|
||||
list (APPEND EXAMPLE_SOURCE_FILES
|
||||
examples/computeLocalSolutions.cpp
|
||||
examples/computeToFandTracers.cpp
|
||||
examples/computeTracers.cpp
|
||||
)
|
||||
|
||||
list (APPEND PUBLIC_HEADER_FILES
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
Copyright 2017 SINTEF ICT, Applied Mathematics.
|
||||
Copyright 2017 Statoil ASA.
|
||||
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "exampleSetup.hpp"
|
||||
#include <opm/flowdiagnostics/CellSet.hpp>
|
||||
|
||||
// Syntax (typical):
|
||||
// computeToFandTracers case=<ecl_case_prefix> step=<report_number>
|
||||
int main(int argc, char* argv[])
|
||||
try {
|
||||
example::Setup setup(argc, argv);
|
||||
auto& fdTool = setup.toolbox;
|
||||
|
||||
// Create start sets from injector wells.
|
||||
std::vector<Opm::FlowDiagnostics::CellSet> start;
|
||||
for (const auto& well : setup.well_fluxes) {
|
||||
if (!well.is_injector_well) {
|
||||
continue;
|
||||
}
|
||||
std::vector<int> completion_cells;
|
||||
completion_cells.reserve(well.completions.size());
|
||||
for (const auto& completion : well.completions) {
|
||||
const int grid_index = completion.grid_index;
|
||||
const auto& ijk = completion.ijk;
|
||||
const int cell_index = setup.graph.activeCell(ijk, grid_index);
|
||||
if (cell_index >= 0) {
|
||||
completion_cells.push_back(cell_index);
|
||||
}
|
||||
}
|
||||
start.emplace_back(Opm::FlowDiagnostics::CellSetID(well.name), completion_cells);
|
||||
}
|
||||
|
||||
|
||||
// Solve for injection time of flight and tracers.
|
||||
auto sol = fdTool.computeInjectionDiagnostics(start);
|
||||
|
||||
// Get local tof for first injector.
|
||||
const auto& tof = sol.fd.timeOfFlight(start.front().id());
|
||||
|
||||
// Write it to standard out.
|
||||
std::cout.precision(16);
|
||||
for (auto item : tof) {
|
||||
std::cout << item.first << " " << item.second << '\n';
|
||||
}
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Caught exception: " << e.what() << '\n';
|
||||
}
|
||||
@@ -29,7 +29,8 @@
|
||||
// computeToFandTracers case=<ecl_case_prefix> step=<report_number>
|
||||
int main(int argc, char* argv[])
|
||||
try {
|
||||
auto fdTool = example::setup(argc, argv);
|
||||
example::Setup setup(argc, argv);
|
||||
auto& fdTool = setup.toolbox;
|
||||
|
||||
// Solve for time of flight.
|
||||
std::vector<Opm::FlowDiagnostics::CellSet> start;
|
||||
|
||||
47
ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/examples/computeTracers.cpp
vendored
Normal file
47
ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/examples/computeTracers.cpp
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
Copyright 2016 SINTEF ICT, Applied Mathematics.
|
||||
Copyright 2016 Statoil ASA.
|
||||
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "exampleSetup.hpp"
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
try {
|
||||
example::Setup setup(argc, argv);
|
||||
auto& fdTool = setup.toolbox;
|
||||
|
||||
// Solve for tracers.
|
||||
Opm::FlowDiagnostics::CellSetID id("Example start set ID");
|
||||
Opm::FlowDiagnostics::CellSet start(id, {123});
|
||||
auto sol = fdTool.computeInjectionDiagnostics({start});
|
||||
const auto& conc_sol = sol.fd.concentration(id);
|
||||
|
||||
// Write it to standard out.
|
||||
std::cout.precision(16);
|
||||
for (auto item : conc_sol) {
|
||||
std::cout << item.first << " " << item.second << '\n';
|
||||
}
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Caught exception: " << e.what() << '\n';
|
||||
}
|
||||
@@ -158,32 +158,8 @@ namespace example {
|
||||
}
|
||||
}
|
||||
|
||||
inline Opm::FlowDiagnostics::Toolbox
|
||||
initialiseFlowDiagnostics(const Opm::ECLGraph& G)
|
||||
{
|
||||
const auto connGraph = Opm::FlowDiagnostics::
|
||||
ConnectivityGraph{ static_cast<int>(G.numCells()),
|
||||
G.neighbours() };
|
||||
|
||||
// Create the Toolbox.
|
||||
auto tool = Opm::FlowDiagnostics::Toolbox{ connGraph };
|
||||
|
||||
tool.assignPoreVolume(G.poreVolume());
|
||||
tool.assignConnectionFlux(Hack::convert_flux_to_SI(extractFluxField(G)));
|
||||
|
||||
auto wsol = Opm::ECLWellSolution{};
|
||||
|
||||
const auto well_fluxes =
|
||||
wsol.solution(G.rawResultData(), G.numGrids());
|
||||
|
||||
tool.assignInflowFlux(extractWellFlows(G, well_fluxes));
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
||||
|
||||
inline auto setup(int argc, char* argv[])
|
||||
-> decltype(initialiseFlowDiagnostics(std::declval<Opm::ECLGraph>()))
|
||||
inline Opm::ECLGraph
|
||||
initGraph(int argc, char* argv[])
|
||||
{
|
||||
// Obtain parameters from command line (possibly specifying a parameter file).
|
||||
const bool verify_commandline_syntax = true;
|
||||
@@ -216,9 +192,51 @@ namespace example {
|
||||
throw std::domain_error(os.str());
|
||||
}
|
||||
|
||||
return initialiseFlowDiagnostics(graph);
|
||||
return graph;
|
||||
}
|
||||
|
||||
inline std::vector<Opm::ECLWellSolution::WellData>
|
||||
initWellFluxes(const Opm::ECLGraph& G)
|
||||
{
|
||||
auto wsol = Opm::ECLWellSolution{};
|
||||
return wsol.solution(G.rawResultData(), G.numGrids());
|
||||
}
|
||||
|
||||
inline Opm::FlowDiagnostics::Toolbox
|
||||
initToolbox(const Opm::ECLGraph& G, const std::vector<Opm::ECLWellSolution::WellData>& well_fluxes)
|
||||
{
|
||||
const auto connGraph = Opm::FlowDiagnostics::
|
||||
ConnectivityGraph{ static_cast<int>(G.numCells()),
|
||||
G.neighbours() };
|
||||
|
||||
// Create the Toolbox.
|
||||
auto tool = Opm::FlowDiagnostics::Toolbox{ connGraph };
|
||||
|
||||
tool.assignPoreVolume(G.poreVolume());
|
||||
tool.assignConnectionFlux(Hack::convert_flux_to_SI(extractFluxField(G)));
|
||||
|
||||
tool.assignInflowFlux(extractWellFlows(G, well_fluxes));
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
struct Setup
|
||||
{
|
||||
Setup(int argc, char** argv)
|
||||
: graph(initGraph(argc, argv))
|
||||
, well_fluxes(initWellFluxes(graph))
|
||||
, toolbox(initToolbox(graph, well_fluxes))
|
||||
{
|
||||
}
|
||||
|
||||
Opm::ECLGraph graph;
|
||||
std::vector<Opm::ECLWellSolution::WellData> well_fluxes;
|
||||
Opm::FlowDiagnostics::Toolbox toolbox;
|
||||
};
|
||||
|
||||
|
||||
} // namespace example
|
||||
|
||||
|
||||
@@ -202,8 +202,9 @@ namespace Opm
|
||||
// Otherwise: add data for this well.
|
||||
WellData wd;
|
||||
wd.name = trimSpacesRight(zwel[well * ih.nzwel]);
|
||||
const int ncon = iwel[well * ih.niwel + IWEL_CONNECTIONS_INDEX];
|
||||
const bool is_producer = (iwel[well * ih.niwel + IWEL_TYPE_INDEX] == IWEL_TYPE_PRODUCER);
|
||||
wd.is_injector_well = !is_producer;
|
||||
const int ncon = iwel[well * ih.niwel + IWEL_CONNECTIONS_INDEX];
|
||||
wd.completions.reserve(ncon);
|
||||
for (int comp_index = 0; comp_index < ncon; ++comp_index) {
|
||||
const int icon_offset = (well*ih.ncwma + comp_index) * ih.nicon;
|
||||
|
||||
Reference in New Issue
Block a user