mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Remove unused simulator program.
This stand-alone simulator is no longer needed since flow_polymer supports two-phase runs.
This commit is contained in:
parent
d284a657cf
commit
699b0678a0
@ -61,7 +61,6 @@ list (APPEND MAIN_SOURCE_FILES
|
||||
opm/polymer/SimulatorPolymer.cpp
|
||||
opm/polymer/TransportSolverTwophaseCompressiblePolymer.cpp
|
||||
opm/polymer/TransportSolverTwophasePolymer.cpp
|
||||
opm/polymer/fullyimplicit/FullyImplicitCompressiblePolymerSolver.cpp
|
||||
opm/polymer/fullyimplicit/PolymerPropsAd.cpp
|
||||
opm/simulators/ensureDirectoryExists.cpp
|
||||
opm/simulators/SimulatorCompressibleTwophase.cpp
|
||||
@ -122,7 +121,6 @@ list (APPEND EXAMPLE_SOURCE_FILES
|
||||
examples/opm_init_check.cpp
|
||||
examples/sim_poly2p_comp_reorder.cpp
|
||||
examples/sim_poly2p_incomp_reorder.cpp
|
||||
examples/sim_poly_fi2p_comp_ad.cpp
|
||||
examples/flow_polymer.cpp
|
||||
examples/wells_example.cpp
|
||||
)
|
||||
@ -140,7 +138,6 @@ list (APPEND PROGRAM_SOURCE_FILES
|
||||
examples/opm_init_check.cpp
|
||||
examples/sim_poly2p_comp_reorder.cpp
|
||||
examples/sim_poly2p_incomp_reorder.cpp
|
||||
examples/sim_poly_fi2p_comp_ad.cpp
|
||||
examples/flow_polymer.cpp
|
||||
)
|
||||
|
||||
@ -253,9 +250,6 @@ list (APPEND PUBLIC_HEADER_FILES
|
||||
opm/polymer/Point2D.hpp
|
||||
opm/polymer/TransportSolverTwophasePolymer.hpp
|
||||
opm/polymer/fullyimplicit/PolymerPropsAd.hpp
|
||||
opm/polymer/fullyimplicit/FullyImplicitCompressiblePolymerSolver.hpp
|
||||
opm/polymer/fullyimplicit/SimulatorFullyImplicitCompressiblePolymer.hpp
|
||||
opm/polymer/fullyimplicit/SimulatorFullyImplicitCompressiblePolymer_impl.hpp
|
||||
opm/polymer/fullyimplicit/BlackoilPolymerModel.hpp
|
||||
opm/polymer/fullyimplicit/BlackoilPolymerModel_impl.hpp
|
||||
opm/polymer/fullyimplicit/SimulatorFullyImplicitBlackoilPolymer.hpp
|
||||
|
@ -1,277 +0,0 @@
|
||||
/*
|
||||
Copyright 2014 SINTEF ICT, Applied Mathematics.
|
||||
Copyright 2014 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 // HAVE_CONFIG_H
|
||||
|
||||
#include <opm/core/pressure/FlowBCManager.hpp>
|
||||
|
||||
#include <opm/core/grid.h>
|
||||
#include <opm/core/grid/GridManager.hpp>
|
||||
#include <opm/core/wells.h>
|
||||
#include <opm/core/wells/WellsManager.hpp>
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
#include <opm/core/simulator/initState.hpp>
|
||||
#include <opm/core/simulator/SimulatorReport.hpp>
|
||||
#include <opm/simulators/timestepping/SimulatorTimer.hpp>
|
||||
#include <opm/core/utility/miscUtilities.hpp>
|
||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||
|
||||
#include <opm/material/fluidmatrixinteractions/EclMaterialLawManager.hpp>
|
||||
#include <opm/output/eclipse/EclipseIO.hpp>
|
||||
#include <opm/core/props/BlackoilPropertiesBasic.hpp>
|
||||
#include <opm/core/props/BlackoilPropertiesFromDeck.hpp>
|
||||
#include <opm/core/props/rock/RockCompressibility.hpp>
|
||||
|
||||
#include <opm/core/linalg/LinearSolverFactory.hpp>
|
||||
#include <opm/autodiff/NewtonIterationBlackoilSimple.hpp>
|
||||
#include <opm/autodiff/NewtonIterationBlackoilCPR.hpp>
|
||||
#include <opm/autodiff/createGlobalCellArray.hpp>
|
||||
|
||||
#include <opm/polymer/PolymerBlackoilState.hpp>
|
||||
#include <opm/core/simulator/WellState.hpp>
|
||||
|
||||
#include <opm/polymer/fullyimplicit/SimulatorFullyImplicitCompressiblePolymer.hpp>
|
||||
#include <opm/polymer/fullyimplicit/PolymerPropsAd.hpp>
|
||||
#include <opm/polymer/PolymerProperties.hpp>
|
||||
#include <opm/polymer/PolymerInflow.hpp>
|
||||
#include <opm/polymer/PolymerState.hpp>
|
||||
|
||||
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
|
||||
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
|
||||
#include <opm/autodiff/GeoProps.hpp>
|
||||
#include <opm/autodiff/GridHelpers.hpp>
|
||||
|
||||
#include <opm/common/OpmLog/OpmLog.hpp>
|
||||
#include <opm/common/OpmLog/StreamLog.hpp>
|
||||
#include <opm/common/OpmLog/CounterLog.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/checkDeck.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
|
||||
#include <opm/simulators/ensureDirectoryExists.hpp>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <numeric>
|
||||
#include <fstream>
|
||||
|
||||
namespace
|
||||
{
|
||||
void warnIfUnusedParams(const Opm::ParameterGroup& param)
|
||||
{
|
||||
if (param.anyUnused()) {
|
||||
std::cout << "-------------------- Unused parameters: --------------------\n";
|
||||
param.displayUsage();
|
||||
std::cout << "----------------------------------------------------------------" << std::endl;
|
||||
}
|
||||
}
|
||||
} // anon namespace
|
||||
|
||||
|
||||
|
||||
// ----------------- Main program -----------------
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
try
|
||||
{
|
||||
using namespace Opm;
|
||||
|
||||
std::cout << "\n================ Test program for fully implicit three-phase black-oil flow ===============\n\n";
|
||||
ParameterGroup param(argc, argv, false);
|
||||
std::cout << "--------------- Reading parameters ---------------" << std::endl;
|
||||
|
||||
// If we have a "deck_filename", grid and props will be read from that.
|
||||
bool use_deck = param.has("deck_filename");
|
||||
if (!use_deck) {
|
||||
OPM_THROW(std::runtime_error, "This program must be run with an input deck. "
|
||||
"Specify the deck with deck_filename=deckname.data (for example).");
|
||||
}
|
||||
std::shared_ptr<GridManager> grid;
|
||||
std::shared_ptr<BlackoilPropertiesInterface> props;
|
||||
std::shared_ptr<BlackoilPropsAdFromDeck> new_props;
|
||||
std::shared_ptr<RockCompressibility> rock_comp;
|
||||
std::unique_ptr<PolymerBlackoilState> state;
|
||||
// bool check_well_controls = false;
|
||||
// int max_well_control_iterations = 0;
|
||||
double gravity[3] = { 0.0 };
|
||||
std::string deck_filename = param.get<std::string>("deck_filename");
|
||||
|
||||
// Write parameters used for later reference.
|
||||
bool output = param.getDefault("output", true);
|
||||
std::string output_dir;
|
||||
if (output) {
|
||||
// Create output directory if needed.
|
||||
output_dir =
|
||||
param.getDefault("output_dir", std::string("output"));
|
||||
ensureDirectoryExists(output_dir);
|
||||
// Write simulation parameters.
|
||||
param.writeParam(output_dir + "/simulation.param");
|
||||
}
|
||||
|
||||
std::string logFile = output_dir + "/LOGFILE.txt";
|
||||
Opm::ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE }});
|
||||
Opm::Parser parser;
|
||||
{
|
||||
std::shared_ptr<Opm::StreamLog> streamLog = std::make_shared<Opm::StreamLog>(logFile , Opm::Log::DefaultMessageTypes);
|
||||
std::shared_ptr<Opm::CounterLog> counterLog = std::make_shared<Opm::CounterLog>(Opm::Log::DefaultMessageTypes);
|
||||
|
||||
Opm::OpmLog::addBackend( "STREAM" , streamLog );
|
||||
Opm::OpmLog::addBackend( "COUNTER" , counterLog );
|
||||
}
|
||||
|
||||
Deck deck;
|
||||
std::shared_ptr<EclipseState> eclipseState;
|
||||
try {
|
||||
deck = parser.parseFile(deck_filename , parseContext);
|
||||
Opm::checkDeck(deck, parser);
|
||||
eclipseState.reset(new Opm::EclipseState(deck , parseContext));
|
||||
}
|
||||
catch (const std::invalid_argument& e) {
|
||||
std::cerr << "Failed to create valid ECLIPSESTATE object. See logfile: " << logFile << std::endl;
|
||||
std::cerr << "Exception caught: " << e.what() << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Grid init
|
||||
|
||||
if (eclipseState->get3DProperties().hasDeckDoubleGridProperty("PORV")) {
|
||||
const auto& porv = eclipseState->get3DProperties().getDoubleGridProperty("PORV").getData();
|
||||
grid.reset(new GridManager(eclipseState->getInputGrid(), porv));
|
||||
} else {
|
||||
grid.reset(new GridManager(eclipseState->getInputGrid()));
|
||||
}
|
||||
auto &cGrid = *grid->c_grid();
|
||||
const PhaseUsage pu = Opm::phaseUsageFromDeck(deck);
|
||||
|
||||
// Rock and fluid init
|
||||
|
||||
std::vector<int> compressedToCartesianIdx;
|
||||
Opm::createGlobalCellArray(*grid->c_grid(), compressedToCartesianIdx);
|
||||
|
||||
typedef BlackoilPropsAdFromDeck::MaterialLawManager MaterialLawManager;
|
||||
auto materialLawManager = std::make_shared<MaterialLawManager>();
|
||||
materialLawManager->initFromDeck(deck, *eclipseState, compressedToCartesianIdx);
|
||||
|
||||
props.reset(new BlackoilPropertiesFromDeck( deck, *eclipseState, materialLawManager,
|
||||
Opm::UgGridHelpers::numCells(cGrid),
|
||||
Opm::UgGridHelpers::globalCell(cGrid),
|
||||
Opm::UgGridHelpers::cartDims(cGrid),
|
||||
param));
|
||||
|
||||
state.reset( new PolymerBlackoilState( Opm::UgGridHelpers::numCells(cGrid), Opm::UgGridHelpers::numFaces(cGrid), 2));
|
||||
new_props.reset(new BlackoilPropsAdFromDeck(deck, *eclipseState, materialLawManager, cGrid));
|
||||
PolymerProperties polymer_props(deck, *eclipseState);
|
||||
PolymerPropsAd polymer_props_ad(polymer_props);
|
||||
|
||||
// Rock compressibility.
|
||||
rock_comp.reset(new RockCompressibility(*eclipseState));
|
||||
|
||||
// Gravity.
|
||||
gravity[2] = deck.hasKeyword("NOGRAV") ? 0.0 : unit::gravity;
|
||||
|
||||
// Init state variables (saturation and pressure).
|
||||
if (param.has("init_saturation")) {
|
||||
initStateBasic(*grid->c_grid(), *props, param, gravity[2], *state);
|
||||
initBlackoilSurfvol(*grid->c_grid(), *props, *state);
|
||||
} else {
|
||||
initStateFromDeck(*grid->c_grid(), *props, deck, gravity[2], *state);
|
||||
}
|
||||
|
||||
bool use_gravity = (gravity[0] != 0.0 || gravity[1] != 0.0 || gravity[2] != 0.0);
|
||||
const double *grav = use_gravity ? &gravity[0] : 0;
|
||||
// Solver for Newton iterations.
|
||||
std::unique_ptr<NewtonIterationBlackoilInterface> fis_solver;
|
||||
if (param.getDefault("use_cpr", true)) {
|
||||
fis_solver.reset(new NewtonIterationBlackoilCPR(param));
|
||||
} else {
|
||||
fis_solver.reset(new NewtonIterationBlackoilSimple(param));
|
||||
}
|
||||
|
||||
const auto timeMap = eclipseState->getSchedule().getTimeMap();
|
||||
SimulatorTimer simtimer;
|
||||
simtimer.init(timeMap);
|
||||
|
||||
|
||||
SimulatorReport rep;
|
||||
// With a deck, we may have more epochs etc.
|
||||
WellState well_state;
|
||||
// Check for WPOLYMER presence in last epoch to decide
|
||||
// polymer injection control type.
|
||||
const bool use_wpolymer = deck.hasKeyword("WPOLYMER");
|
||||
if (use_wpolymer) {
|
||||
if (param.has("poly_start_days")) {
|
||||
OPM_MESSAGE("Warning: Using WPOLYMER to control injection since it was found in deck. "
|
||||
"You seem to be trying to control it via parameter poly_start_days (etc.) as well.");
|
||||
}
|
||||
}
|
||||
std::cout << "\n\n================ Starting main simulation loop ===============\n"
|
||||
<< std::flush;
|
||||
|
||||
std::unique_ptr<Opm::EclipseIO>
|
||||
eclipseWriter(new Opm::EclipseIO(*eclipseState,
|
||||
UgGridHelpers
|
||||
::createEclipseGrid( cGrid ,
|
||||
eclipseState->getInputGrid())));
|
||||
Opm::BlackoilOutputWriter
|
||||
outputWriter(cGrid, param, *eclipseState, std::move(eclipseWriter), pu);
|
||||
|
||||
SimulatorReport fullReport;
|
||||
// Create and run simulator.
|
||||
Opm::DerivedGeology geology(*grid->c_grid(), *new_props, *eclipseState, grav);
|
||||
SimulatorFullyImplicitCompressiblePolymer<UnstructuredGrid>
|
||||
simulator(param,
|
||||
*grid->c_grid(),
|
||||
geology,
|
||||
*new_props,
|
||||
polymer_props_ad,
|
||||
rock_comp->isActive() ? rock_comp.get() : 0,
|
||||
eclipseState,
|
||||
outputWriter,
|
||||
deck,
|
||||
*fis_solver,
|
||||
grav);
|
||||
fullReport= simulator.run(simtimer, *state);
|
||||
|
||||
std::cout << "\n\n================ End of simulation ===============\n\n";
|
||||
fullReport.report(std::cout);
|
||||
|
||||
if (output) {
|
||||
std::string filename = output_dir + "/walltime.param";
|
||||
std::fstream tot_os(filename.c_str(),std::fstream::trunc | std::fstream::out);
|
||||
fullReport.reportParam(tot_os);
|
||||
warnIfUnusedParams(param);
|
||||
}
|
||||
|
||||
}
|
||||
catch (const std::exception &e) {
|
||||
std::cerr << "Program threw an exception: " << e.what() << "\n";
|
||||
throw;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,337 +0,0 @@
|
||||
/*
|
||||
Copyright 2014 SINTEF ICT, Applied Mathematics.
|
||||
Copyright 2014 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/>.
|
||||
*/
|
||||
|
||||
#ifndef OPM_FULLYIMPLICITCOMPRESSIBLEPOLYMERSOLVER_HEADER_INCLUDED
|
||||
#define OPM_FULLYIMPLICITCOMPRESSIBLEPOLYMERSOLVER_HEADER_INCLUDED
|
||||
|
||||
#include <opm/autodiff/AutoDiffBlock.hpp>
|
||||
#include <opm/autodiff/AutoDiffHelpers.hpp>
|
||||
#include <opm/autodiff/BlackoilModelEnums.hpp>
|
||||
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
|
||||
#include <opm/autodiff/NewtonIterationBlackoilInterface.hpp>
|
||||
#include <opm/autodiff/LinearisedBlackoilResidual.hpp>
|
||||
#include <opm/polymer/PolymerProperties.hpp>
|
||||
#include <opm/polymer/fullyimplicit/WellStateFullyImplicitBlackoilPolymer.hpp>
|
||||
#include <opm/polymer/fullyimplicit/PolymerPropsAd.hpp>
|
||||
#include <opm/core/simulator/SimulatorReport.hpp>
|
||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||
#include <opm/simulators/timestepping/SimulatorTimerInterface.hpp>
|
||||
#include <opm/common/data/SimulationDataContainer.hpp>
|
||||
|
||||
struct UnstructuredGrid;
|
||||
struct Wells;
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class DerivedGeology;
|
||||
class RockCompressibility;
|
||||
class NewtonIterationBlackoilInterface;
|
||||
class PolymerBlackoilState;
|
||||
class WellStateFullyImplicitBlackoil;
|
||||
|
||||
/// A fully implicit solver for the oil-water with polymer problem.
|
||||
///
|
||||
/// The simulator is capable of handling oil-water-polymer problems
|
||||
/// It uses an industry-standard TPFA discretization with per-phase
|
||||
/// upwind weighting of mobilities.
|
||||
///
|
||||
/// It uses automatic differentiation via the class AutoDiffBlock
|
||||
/// to simplify assembly of the jacobian matrix.
|
||||
class FullyImplicitCompressiblePolymerSolver
|
||||
{
|
||||
public:
|
||||
typedef AutoDiffBlock<double> ADB;
|
||||
typedef ADB::V V;
|
||||
typedef ADB::M M;
|
||||
typedef Eigen::Array<double,
|
||||
Eigen::Dynamic,
|
||||
Eigen::Dynamic,
|
||||
Eigen::RowMajor> DataBlock;
|
||||
|
||||
struct ReservoirResidualQuant {
|
||||
ReservoirResidualQuant();
|
||||
std::vector<ADB> accum; // Accumulations
|
||||
ADB mflux; // Mass flux (surface conditions)
|
||||
ADB b; // Reciprocal FVF
|
||||
ADB mu; // Viscosities
|
||||
ADB rho; // Densities
|
||||
ADB kr; // Permeabilities
|
||||
ADB head; // Pressure drop across int. interfaces
|
||||
ADB mob; // Phase mobility (per cell)
|
||||
std::vector<ADB> ads; // Adsorption term.
|
||||
};
|
||||
|
||||
struct SimulatorData : public Opm::FIPDataEnums {
|
||||
SimulatorData(int num_phases)
|
||||
: rq(num_phases)
|
||||
, rsSat(ADB::null())
|
||||
, rvSat(ADB::null())
|
||||
, soMax() // FIXME: Not handled properly
|
||||
, Pb() //FIXME: Not handled properly
|
||||
, Pd() //FIXME: Not handled properly
|
||||
, krnswdc_ow() // FIXME: Not handled properly
|
||||
, krnswdc_go() // FIXME: Not handled properly
|
||||
, pcswmdc_ow() // FIXME: Not handled properly
|
||||
, pcswmdc_go() // FIXME: Not handled properly
|
||||
, fip()
|
||||
{
|
||||
}
|
||||
|
||||
using Opm::FIPDataEnums::FipId;
|
||||
using Opm::FIPDataEnums::fipValues;
|
||||
|
||||
std::vector<ReservoirResidualQuant> rq;
|
||||
ADB rsSat;
|
||||
ADB rvSat;
|
||||
std::vector<double> soMax;
|
||||
std::vector<double> Pb;
|
||||
std::vector<double> Pd;
|
||||
std::vector<double> krnswdc_ow;
|
||||
std::vector<double> krnswdc_go;
|
||||
std::vector<double> pcswmdc_ow;
|
||||
std::vector<double> pcswmdc_go;
|
||||
std::array<V, fipValues> fip;
|
||||
};
|
||||
|
||||
typedef Opm::FIPData FIPDataType;
|
||||
|
||||
|
||||
/// Construct a solver. It will retain references to the
|
||||
/// arguments of this functions, and they are expected to
|
||||
/// remain in scope for the lifetime of the solver.
|
||||
/// \param[in] grid grid data structure
|
||||
/// \param[in] fluid fluid properties
|
||||
/// \param[in] geo rock properties
|
||||
/// \param[in] rock_comp_props if non-null, rock compressibility properties
|
||||
/// \param[in] polymer_props_ad polymer properties
|
||||
/// \param[in] wells well structure
|
||||
/// \param[in] linsolver linear solver
|
||||
FullyImplicitCompressiblePolymerSolver(const UnstructuredGrid& grid ,
|
||||
const BlackoilPropsAdFromDeck& fluid,
|
||||
const DerivedGeology& geo ,
|
||||
const RockCompressibility* rock_comp_props,
|
||||
const PolymerPropsAd& polymer_props_ad,
|
||||
const Wells& wells,
|
||||
const NewtonIterationBlackoilInterface& linsolver);
|
||||
|
||||
/// Take a single forward step, modifiying
|
||||
/// state.pressure()
|
||||
/// state.faceflux()
|
||||
/// state.saturation()
|
||||
/// state.concentration()
|
||||
/// wstate.bhp()
|
||||
/// \param[in] dt time step size
|
||||
/// \param[in] state reservoir state
|
||||
/// \param[in] wstate well state
|
||||
/// \param[in] polymer_inflow polymer influx
|
||||
int
|
||||
step(const SimulatorTimerInterface& timer,
|
||||
PolymerBlackoilState& state ,
|
||||
WellStateFullyImplicitBlackoilPolymer& wstate);
|
||||
|
||||
int linearizations() const;
|
||||
int nonlinearIterations() const;
|
||||
int linearIterations() const;
|
||||
int wellIterations() const;
|
||||
|
||||
/// Not used by this class except to satisfy interface requirements.
|
||||
typedef ParameterGroup SolverParameters;
|
||||
|
||||
/// There is no separate model class for this solver, return itself.
|
||||
const FullyImplicitCompressiblePolymerSolver& model() const;
|
||||
|
||||
/// Evaluate the relative changes in the physical variables.
|
||||
double relativeChange(const PolymerBlackoilState& previous,
|
||||
const PolymerBlackoilState& current ) const;
|
||||
|
||||
/// Return reservoir simulation data (for output functionality)
|
||||
const SimulatorData& getSimulatorData(const SimulationDataContainer&) const {
|
||||
return sd_;
|
||||
}
|
||||
|
||||
/// Return reservoir simulation data (for output functionality)
|
||||
FIPDataType getFIPData() const {
|
||||
return FIPDataType( sd_.fip );
|
||||
}
|
||||
|
||||
/// Compute fluid in place.
|
||||
/// \param[in] ReservoirState
|
||||
/// \param[in] WellState
|
||||
/// \param[in] FIPNUM for active cells not global cells.
|
||||
/// \return fluid in place, number of fip regions, each region contains 5 values which are liquid, vapour, water, free gas and dissolved gas.
|
||||
std::vector<std::vector<double> >
|
||||
computeFluidInPlace(const PolymerBlackoilState& x,
|
||||
const std::vector<int>& fipnum);
|
||||
|
||||
/// return the statistics if the nonlinearIteration() method failed.
|
||||
///
|
||||
/// NOTE: for the flow_legacy simulator family this method is a stub, i.e. the
|
||||
/// failure report object will *not* contain any meaningful data.
|
||||
const SimulatorReport& failureReport() const
|
||||
{ return failureReport_; }
|
||||
|
||||
private:
|
||||
|
||||
struct SolutionState {
|
||||
SolutionState(const int np);
|
||||
ADB pressure;
|
||||
ADB temperature;
|
||||
std::vector<ADB> saturation;
|
||||
ADB concentration;
|
||||
ADB qs;
|
||||
ADB bhp;
|
||||
};
|
||||
|
||||
struct WellOps {
|
||||
WellOps(const Wells& wells);
|
||||
Eigen::SparseMatrix<double> w2p; // well -> perf (scatter)
|
||||
Eigen::SparseMatrix<double> p2w; // perf -> well (gather)
|
||||
};
|
||||
|
||||
enum { Water = Opm::Water,
|
||||
Oil = Opm::Oil };
|
||||
|
||||
// Member data
|
||||
SimulatorReport failureReport_;
|
||||
const UnstructuredGrid& grid_;
|
||||
const BlackoilPropsAdFromDeck& fluid_;
|
||||
const DerivedGeology& geo_;
|
||||
const RockCompressibility* rock_comp_props_;
|
||||
const PolymerPropsAd& polymer_props_ad_;
|
||||
const Wells& wells_;
|
||||
const NewtonIterationBlackoilInterface& linsolver_;
|
||||
const std::vector<int> cells_; // All grid cells
|
||||
HelperOps ops_;
|
||||
const WellOps wops_;
|
||||
const M grav_;
|
||||
V cmax_;
|
||||
std::vector<PhasePresence> phaseCondition_;
|
||||
SimulatorData sd_;
|
||||
// The mass_balance vector has one element for each active phase,
|
||||
// each of which has size equal to the number of cells.
|
||||
// The well_eq has size equal to the number of wells.
|
||||
LinearisedBlackoilResidual residual_;
|
||||
|
||||
unsigned int linearizations_;
|
||||
unsigned int newtonIterations_;
|
||||
unsigned int linearIterations_;
|
||||
unsigned int wellIterations_;
|
||||
|
||||
// Private methods.
|
||||
SolutionState
|
||||
constantState(const PolymerBlackoilState& x,
|
||||
const WellStateFullyImplicitBlackoil& xw);
|
||||
|
||||
SolutionState
|
||||
variableState(const PolymerBlackoilState& x,
|
||||
const WellStateFullyImplicitBlackoil& xw);
|
||||
|
||||
void
|
||||
computeAccum(const SolutionState& state,
|
||||
const int aix );
|
||||
|
||||
void
|
||||
assemble(const double dt,
|
||||
const PolymerBlackoilState& x,
|
||||
const WellStateFullyImplicitBlackoil& xw,
|
||||
const std::vector<double>& polymer_inflow);
|
||||
|
||||
V solveJacobianSystem() const;
|
||||
|
||||
void updateState(const V& dx,
|
||||
PolymerBlackoilState& state,
|
||||
WellStateFullyImplicitBlackoil& well_state) const;
|
||||
|
||||
std::vector<ADB>
|
||||
computeRelPerm(const SolutionState& state) const;
|
||||
|
||||
std::vector<ADB>
|
||||
computePressures(const SolutionState& state) const;
|
||||
|
||||
void
|
||||
computeMassFlux(const int actph ,
|
||||
const V& transi,
|
||||
const std::vector<ADB>& kr ,
|
||||
const SolutionState& state );
|
||||
|
||||
void
|
||||
computeMassFlux(const V& trans,
|
||||
const ADB& mc,
|
||||
const ADB& kro,
|
||||
const ADB& krw_eff,
|
||||
const SolutionState& state);
|
||||
|
||||
std::vector<ADB>
|
||||
computeFracFlow(const ADB& kro,
|
||||
const ADB& krw_eff,
|
||||
const ADB& c) const;
|
||||
|
||||
void
|
||||
computeCmax(PolymerBlackoilState& state);
|
||||
|
||||
ADB
|
||||
computeMc(const SolutionState& state) const;
|
||||
|
||||
ADB
|
||||
rockPorosity(const ADB& p) const;
|
||||
|
||||
ADB
|
||||
rockPermeability(const ADB& p) const;
|
||||
|
||||
double
|
||||
residualNorm() const;
|
||||
|
||||
ADB
|
||||
fluidViscosity(const int phase,
|
||||
const ADB& p ,
|
||||
const ADB& T ,
|
||||
const std::vector<PhasePresence>& cond,
|
||||
const std::vector<int>& cells) const;
|
||||
|
||||
ADB
|
||||
fluidReciprocFVF(const int phase,
|
||||
const ADB& p ,
|
||||
const ADB& T ,
|
||||
const std::vector<PhasePresence>& cond,
|
||||
const std::vector<int>& cells) const;
|
||||
|
||||
ADB
|
||||
fluidDensity(const int phase,
|
||||
const ADB& p ,
|
||||
const ADB& T ,
|
||||
const std::vector<PhasePresence>& cond,
|
||||
const std::vector<int>& cells) const;
|
||||
|
||||
ADB
|
||||
poroMult(const ADB& p) const;
|
||||
|
||||
ADB
|
||||
transMult(const ADB& p) const;
|
||||
|
||||
const std::vector<PhasePresence>
|
||||
phaseCondition() const { return phaseCondition_; }
|
||||
|
||||
void
|
||||
classifyCondition(const PolymerBlackoilState& state);
|
||||
};
|
||||
} // namespace Opm
|
||||
|
||||
|
||||
#endif // OPM_FULLYIMPLICITCOMPRESSIBLEPOLYMERSOLVER_HEADER_INCLUDED
|
@ -1,149 +0,0 @@
|
||||
/*
|
||||
Copyright 2014 SINTEF ICT, Applied Mathematics.
|
||||
Copyright 2014 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/>.
|
||||
*/
|
||||
|
||||
#ifndef OPM_SIMULATORFULLYIMPLICITCOMPRESSIBLEPOLYMER_HEADER_INCLUDED
|
||||
#define OPM_SIMULATORFULLYIMPLICITCOMPRESSIBLEPOLYMER_HEADER_INCLUDED
|
||||
|
||||
#include <opm/core/simulator/SimulatorReport.hpp>
|
||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
|
||||
#include <opm/autodiff/GeoProps.hpp>
|
||||
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
|
||||
#include <opm/autodiff/WellStateFullyImplicitBlackoil.hpp>
|
||||
#include <opm/autodiff/SimulatorBase.hpp>
|
||||
|
||||
#include <opm/polymer/fullyimplicit/FullyImplicitCompressiblePolymerSolver.hpp>
|
||||
#include <opm/polymer/fullyimplicit/BlackoilPolymerModel.hpp>
|
||||
#include <opm/core/grid.h>
|
||||
#include <opm/core/wells.h>
|
||||
#include <opm/core/pressure/flow_bc.h>
|
||||
|
||||
#include <opm/core/simulator/SimulatorReport.hpp>
|
||||
#include <opm/simulators/timestepping/SimulatorTimer.hpp>
|
||||
#include <opm/core/utility/StopWatch.hpp>
|
||||
#include <opm/output/eclipse/EclipseIO.hpp>
|
||||
#include <opm/core/utility/miscUtilities.hpp>
|
||||
#include <opm/core/utility/miscUtilitiesBlackoil.hpp>
|
||||
|
||||
#include <opm/core/wells/WellsManager.hpp>
|
||||
|
||||
#include <opm/core/props/rock/RockCompressibility.hpp>
|
||||
|
||||
#include <opm/core/grid/ColumnExtract.hpp>
|
||||
#include <opm/polymer/PolymerBlackoilState.hpp>
|
||||
#include <opm/polymer/PolymerInflow.hpp>
|
||||
#include <opm/core/simulator/WellState.hpp>
|
||||
#include <opm/core/transport/reorder/TransportSolverCompressibleTwophaseReorder.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/WellProductionProperties.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <numeric>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
template <class GridT>
|
||||
class SimulatorFullyImplicitCompressiblePolymer;
|
||||
|
||||
class StandardWells;
|
||||
|
||||
template <class GridT>
|
||||
struct SimulatorTraits<SimulatorFullyImplicitCompressiblePolymer<GridT> >
|
||||
{
|
||||
typedef PolymerBlackoilState ReservoirState;
|
||||
typedef WellStateFullyImplicitBlackoilPolymer WellState;
|
||||
typedef BlackoilOutputWriter OutputWriter;
|
||||
typedef GridT Grid;
|
||||
typedef FullyImplicitCompressiblePolymerSolver Solver;
|
||||
typedef StandardWells WellModel;
|
||||
/// Dummy class, this Solver does not use a Model.
|
||||
struct Model
|
||||
{
|
||||
typedef ParameterGroup ModelParameters;
|
||||
};
|
||||
};
|
||||
|
||||
/// Class collecting all necessary components for a two-phase simulation.
|
||||
template <class GridT>
|
||||
class SimulatorFullyImplicitCompressiblePolymer
|
||||
: public SimulatorBase<SimulatorFullyImplicitCompressiblePolymer<GridT> >
|
||||
{
|
||||
typedef SimulatorFullyImplicitCompressiblePolymer ThisType;
|
||||
typedef SimulatorBase<ThisType> BaseType;
|
||||
typedef typename BaseType::Solver Solver;
|
||||
typedef typename BaseType::WellModel WellModel;
|
||||
|
||||
public:
|
||||
/// Initialise from parameters and objects to observe.
|
||||
SimulatorFullyImplicitCompressiblePolymer(const ParameterGroup& param,
|
||||
const GridT& grid,
|
||||
DerivedGeology& geo,
|
||||
BlackoilPropsAdFromDeck& props,
|
||||
const PolymerPropsAd& polymer_props,
|
||||
const RockCompressibility* rock_comp_props,
|
||||
std::shared_ptr<EclipseState> eclipse_state,
|
||||
BlackoilOutputWriter& output_writer,
|
||||
const Deck& deck,
|
||||
NewtonIterationBlackoilInterface& linsolver,
|
||||
const double* gravity);
|
||||
|
||||
std::unique_ptr<Solver> createSolver(const WellModel& well_model);
|
||||
|
||||
void handleAdditionalWellInflow(SimulatorTimer& timer,
|
||||
WellsManager& wells_manager,
|
||||
typename BaseType::WellState& well_state,
|
||||
const Wells* wells);
|
||||
|
||||
void updateListEconLimited(const std::unique_ptr<Solver>& solver,
|
||||
const Schedule& schedule,
|
||||
const int current_step,
|
||||
const Wells* wells,
|
||||
const WellState& well_state,
|
||||
DynamicListEconLimited& list_econ_limited) const;
|
||||
|
||||
/// return the statistics if the nonlinearIteration() method failed.
|
||||
///
|
||||
/// NOTE: for the flow_legacy simulator family this method is a stub, i.e. the
|
||||
/// failure report object will *not* contain any meaningful data.
|
||||
const SimulatorReport& failureReport() const
|
||||
{ return failureReport_; }
|
||||
|
||||
private:
|
||||
SimulatorReport failureReport_;
|
||||
|
||||
const Deck& deck_;
|
||||
const PolymerPropsAd& polymer_props_;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#include "SimulatorFullyImplicitCompressiblePolymer_impl.hpp"
|
||||
|
||||
#endif // OPM_SIMULATORFULLYIMPLICITCOMPRESSIBLEPOLYMER_HEADER_INCLUDED
|
@ -1,122 +0,0 @@
|
||||
/*
|
||||
Copyright 2014 SINTEF ICT, Applied Mathematics.
|
||||
Copyright 2014 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/>.
|
||||
*/
|
||||
#ifndef OPM_SIMULATORFULLYIMPLICITCOMPRESSIBLEPOLYMER_IMPL_HEADER_INCLUDED
|
||||
#define OPM_SIMULATORFULLYIMPLICITCOMPRESSIBLEPOLYMER_IMPL_HEADER_INCLUDED
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
/// Class collecting all necessary components for a two-phase simulation.
|
||||
template <class GridT>
|
||||
SimulatorFullyImplicitCompressiblePolymer<GridT>::
|
||||
SimulatorFullyImplicitCompressiblePolymer(const ParameterGroup& param,
|
||||
const GridT& grid,
|
||||
DerivedGeology& geo,
|
||||
BlackoilPropsAdFromDeck& props,
|
||||
const PolymerPropsAd& polymer_props,
|
||||
const RockCompressibility* rock_comp_props,
|
||||
std::shared_ptr<EclipseState> eclipse_state,
|
||||
BlackoilOutputWriter& output_writer,
|
||||
const Deck& deck,
|
||||
NewtonIterationBlackoilInterface& linsolver,
|
||||
const double* gravity)
|
||||
: BaseType(param,
|
||||
grid,
|
||||
geo,
|
||||
props,
|
||||
rock_comp_props,
|
||||
linsolver,
|
||||
gravity,
|
||||
/*disgas=*/false,
|
||||
/*vapoil=*/false,
|
||||
eclipse_state,
|
||||
output_writer,
|
||||
/*threshold_pressures_by_face=*/std::vector<double>(),
|
||||
// names of deactivated wells in parallel run
|
||||
std::unordered_set<std::string>())
|
||||
, deck_(deck)
|
||||
, polymer_props_(polymer_props)
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
template <class GridT>
|
||||
auto SimulatorFullyImplicitCompressiblePolymer<GridT>::
|
||||
createSolver(const WellModel& well_model)
|
||||
-> std::unique_ptr<Solver>
|
||||
{
|
||||
return std::unique_ptr<Solver>(new Solver(BaseType::grid_,
|
||||
BaseType::props_,
|
||||
BaseType::geo_,
|
||||
BaseType::rock_comp_props_,
|
||||
polymer_props_,
|
||||
// *wells,
|
||||
// TODO: it is resulted from refactoring of other simulators.
|
||||
well_model.wells(),
|
||||
BaseType::solver_));
|
||||
}
|
||||
|
||||
template <class GridT>
|
||||
void SimulatorFullyImplicitCompressiblePolymer<GridT>::
|
||||
handleAdditionalWellInflow(SimulatorTimer& timer,
|
||||
WellsManager& wells_manager,
|
||||
typename BaseType::WellState& well_state,
|
||||
const Wells* wells)
|
||||
{
|
||||
// compute polymer inflow
|
||||
std::unique_ptr<PolymerInflowInterface> polymer_inflow_ptr;
|
||||
if (deck_.hasKeyword("WPOLYMER")) {
|
||||
if (wells_manager.c_wells() == 0) {
|
||||
OPM_THROW(std::runtime_error, "Cannot control polymer injection via WPOLYMER without wells.");
|
||||
}
|
||||
polymer_inflow_ptr.reset(new PolymerInflowFromDeck( *BaseType::eclipse_state_, *wells, Opm::UgGridHelpers::numCells(BaseType::grid_), timer.currentStepNum()));
|
||||
} else {
|
||||
polymer_inflow_ptr.reset(new PolymerInflowBasic(0.0*Opm::unit::day,
|
||||
1.0*Opm::unit::day,
|
||||
0.0));
|
||||
}
|
||||
std::vector<double> polymer_inflow_c(Opm::UgGridHelpers::numCells(BaseType::grid_));
|
||||
polymer_inflow_ptr->getInflowValues(timer.simulationTimeElapsed(),
|
||||
timer.simulationTimeElapsed() + timer.currentStepLength(),
|
||||
polymer_inflow_c);
|
||||
well_state.polymerInflow() = polymer_inflow_c;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <class GridT>
|
||||
void
|
||||
SimulatorFullyImplicitCompressiblePolymer<GridT>::
|
||||
updateListEconLimited(const std::unique_ptr<Solver>& /*solver*/,
|
||||
const Schedule& /*schedule*/,
|
||||
const int /*current_step*/,
|
||||
const Wells* /*wells*/,
|
||||
const WellState& /*well_state*/,
|
||||
DynamicListEconLimited& /*list_econ_limited*/) const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_SIMULATORFULLYIMPLICITCOMPRESSIBLEPOLYMER_HEADER_INCLUDED
|
Loading…
Reference in New Issue
Block a user