Add missing files

This commit is contained in:
Tor Harald Sandve 2015-08-04 14:01:22 +02:00
parent 971e7e19cb
commit b596637c95
3 changed files with 309 additions and 0 deletions

View File

@ -0,0 +1,138 @@
/*
Copyright 2015 IRIS 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/>.
*/
#ifndef OPM_SIMULATORFULLYIMPLICITEXTENDEDBLACKOIL_HEADER_INCLUDED
#define OPM_SIMULATORFULLYIMPLICITEXTENDEDBLACKOIL_HEADER_INCLUDED
#include <opm/autodiff/SimulatorBase.hpp>
#include <opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp>
#include <opm/autodiff/ExtendedBlackoilState.hpp>
#include <opm/autodiff/ExtendedBlackoilModel.hpp>
#include <opm/core/utility/parameters/ParameterGroup.hpp>
#include <opm/core/utility/ErrorMacros.hpp>
#include <opm/autodiff/GeoProps.hpp>
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
#include <opm/autodiff/RateConverter.hpp>
#include <opm/autodiff/NewtonSolver.hpp>
#include <opm/autodiff/WellStateFullyImplicitBlackoilSolvent.hpp>
#include <opm/core/grid.h>
#include <opm/core/wells.h>
#include <opm/core/well_controls.h>
#include <opm/core/pressure/flow_bc.h>
#include <opm/core/simulator/SimulatorReport.hpp>
#include <opm/core/simulator/SimulatorTimer.hpp>
//#include <opm/core/simulator/AdaptiveSimulatorTimer.hpp>
#include <opm/core/utility/StopWatch.hpp>
#include <opm/core/io/vtk/writeVtkData.hpp>
#include <opm/core/utility/miscUtilities.hpp>
#include <opm/core/utility/miscUtilitiesBlackoil.hpp>
#include <opm/core/props/rock/RockCompressibility.hpp>
//#include <opm/core/simulator/AdaptiveTimeStepping.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/lexical_cast.hpp>
#include <algorithm>
#include <cstddef>
#include <cassert>
#include <functional>
#include <memory>
#include <numeric>
#include <fstream>
#include <iostream>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
namespace Opm
{
template <class GridT>
class SimulatorFullyImplicitExtendedBlackoil;
template<class GridT>
struct SimulatorTraits<SimulatorFullyImplicitExtendedBlackoil<GridT> >
{
typedef WellStateFullyImplicitBlackoilSolvent WellState;
typedef ExtendedBlackoilState ReservoirState;
typedef BlackoilOutputWriter OutputWriter;
typedef GridT Grid;
typedef ExtendedBlackoilModel<Grid> Model;
typedef NewtonSolver<Model> Solver;
};
/// Class collecting all necessary components for a blackoil simulation with polymer
/// injection.
template <class GridT>
class SimulatorFullyImplicitExtendedBlackoil
: public SimulatorBase<SimulatorFullyImplicitExtendedBlackoil<GridT> >
{
typedef SimulatorFullyImplicitExtendedBlackoil<GridT> ThisType;
typedef SimulatorBase<ThisType> BaseType;
typedef SimulatorTraits<ThisType> Traits;
typedef typename Traits::Solver Solver;
public:
SimulatorFullyImplicitExtendedBlackoil(const parameter::ParameterGroup& param,
const GridT& grid,
const DerivedGeology& geo,
BlackoilPropsAdInterface& props,
const RockCompressibility* rock_comp_props,
NewtonIterationBlackoilInterface& linsolver,
const double* gravity,
const bool disgas,
const bool vapoil,
std::shared_ptr<EclipseState> eclipse_state,
BlackoilOutputWriter& output_writer,
Opm::DeckConstPtr& deck,
const std::vector<double>& threshold_pressures_by_face,
const bool solvent);
std::unique_ptr<Solver> createSolver(const Wells* wells);
void handleAdditionalWellInflow(SimulatorTimer& timer,
WellsManager& wells_manager,
typename BaseType::WellState& well_state,
const Wells* wells);
private:
bool has_solvent_;
DeckConstPtr deck_;
};
} // namespace Opm
#include "SimulatorFullyImplicitExtendedBlackoil_impl.hpp"
#endif // OPM_SIMULATORFULLYIMPLICITEXTENDEDBLACKOIL_HEADER_INCLUDED

View File

@ -0,0 +1,130 @@
/*
Copyright 2015 IRIS 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/>.
*/
#ifndef OPM_SIMULATORFULLYIMPLICITEXTENDEDBLACKOIL_IMPL_HEADER_INCLUDED
#define OPM_SIMULATORFULLYIMPLICITEXTENDEDBLACKOIL_IMPL_HEADER_INCLUDED
namespace Opm
{
template <class GridT>
SimulatorFullyImplicitExtendedBlackoil<GridT>::
SimulatorFullyImplicitExtendedBlackoil(const parameter::ParameterGroup& param,
const GridT& grid,
const DerivedGeology& geo,
BlackoilPropsAdInterface& props,
const RockCompressibility* rock_comp_props,
NewtonIterationBlackoilInterface& linsolver,
const double* gravity,
const bool has_disgas,
const bool has_vapoil,
std::shared_ptr<EclipseState> eclipse_state,
BlackoilOutputWriter& output_writer,
Opm::DeckConstPtr& deck,
const std::vector<double>& threshold_pressures_by_face,
const bool has_solvent)
: BaseType(param,
grid,
geo,
props,
rock_comp_props,
linsolver,
gravity,
has_disgas,
has_vapoil,
eclipse_state,
output_writer,
threshold_pressures_by_face)
, has_solvent_(has_solvent)
, deck_(deck)
{
if(deck->hasKeyword("MISCIBLE")) {
std::cerr << "MISICIBLE keyword is present. Mixing is not currently supported" << std::endl;
}
}
template <class GridT>
auto SimulatorFullyImplicitExtendedBlackoil<GridT>::
createSolver(const Wells* wells)
-> std::unique_ptr<Solver>
{
typedef typename Traits::Model Model;
auto model = std::unique_ptr<Model>(new Model(BaseType::model_param_,
BaseType::grid_,
BaseType::props_,
BaseType::geo_,
BaseType::rock_comp_props_,
wells,
BaseType::solver_,
BaseType::eclipse_state_,
BaseType::has_disgas_,
BaseType::has_vapoil_,
BaseType::terminal_output_,
has_solvent_));
if (!BaseType::threshold_pressures_by_face_.empty()) {
model->setThresholdPressures(BaseType::threshold_pressures_by_face_);
}
return std::unique_ptr<Solver>(new Solver(BaseType::solver_param_, std::move(model)));
}
template <class GridT>
void SimulatorFullyImplicitExtendedBlackoil<GridT>::
handleAdditionalWellInflow(SimulatorTimer& timer,
WellsManager& wells_manager,
typename BaseType::WellState& well_state,
const Wells* wells)
{
// compute solvent inflow
// TODO: Allow for changing WSOLVENT during simulation.
if (deck_->hasKeyword("WSOLVENT")) {
const int nw = wells->number_of_wells;
std::vector<double> perfcells_fraction(wells->well_connpos[nw]);
//perfcells_fraction.resize(wells->well_connpos[nw]);
Opm::DeckKeywordConstPtr keyword = deck_->getKeyword("WSOLVENT");
const int num_keywords = keyword->size();
for (int i = 0; i < num_keywords; ++i) {
int wix = 0;
for (; wix < nw; ++wix) {
if (keyword->getRecord(i)->getItem("WELL")->getString(0) == wells->name[wix]) {
break;
}
}
if (wix == nw ) {
OPM_THROW(std::runtime_error, "Could not find a match for well "
<< keyword->getRecord(i)->getItem("WELL")->getString(0)
<< " from WSOLVENT.");
}
for (int j = wells->well_connpos[wix]; j < wells->well_connpos[wix+1]; ++j) {
perfcells_fraction[j] =
keyword->getRecord(i)->getItem("SOLVENT_FRACTION")->getSIDouble(0);
}
}
well_state.solventFraction() = perfcells_fraction;
}
}
} // namespace Opm
#endif // OPM_SIMULATORFULLYIMPLICITEXTENDEDBLACKOIL_IMPL_HEADER_INCLUDED

View File

@ -0,0 +1,41 @@
/*
Copyright 2015 IRIS 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/>.
*/
#ifndef OPM_WELLSTATEFULLYIMPLICITBLACKOILSOLVENT_HEADER_INCLUDED
#define OPM_WELLSTATEFULLYIMPLICITBLACKOILSOLVENT_HEADER_INCLUDED
#include <opm/autodiff/WellStateFullyImplicitBlackoil.hpp>
namespace Opm
{
class WellStateFullyImplicitBlackoilSolvent : public WellStateFullyImplicitBlackoil
{
typedef WellStateFullyImplicitBlackoil BaseType;
public:
std::vector<double>& solventFraction() { return solvent_fraction_; }
const std::vector<double>& solventFraction() const { return solvent_fraction_; }
private:
std::vector<double> solvent_fraction_;
};
} // namespace Opm
#endif // OPM_WELLSTATEFULLYIMPLICITBLACKOILSOLVENT_HEADER_INCLUDED