Add parameter "new_code" to switch between old and new structuring of transport solver.

This commit is contained in:
Atgeirr Flø Rasmussen 2012-02-12 23:46:42 +01:00
parent a3dfdad3a6
commit 6b60550f6e

View File

@ -41,6 +41,7 @@
#include <opm/polymer/polymertransport.hpp> #include <opm/polymer/polymertransport.hpp>
#include <opm/polymer/polymermodel.hpp> #include <opm/polymer/polymermodel.hpp>
#include <opm/polymer/TransportModelPolymer.hpp>
#include <boost/filesystem/convenience.hpp> #include <boost/filesystem/convenience.hpp>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
@ -234,7 +235,7 @@ main(int argc, char** argv)
bool use_deck = param.has("deck_filename"); bool use_deck = param.has("deck_filename");
boost::scoped_ptr<Opm::Grid> grid; boost::scoped_ptr<Opm::Grid> grid;
boost::scoped_ptr<Opm::IncompPropertiesInterface> props; boost::scoped_ptr<Opm::IncompPropertiesInterface> props;
PolymerData polydata; Opm::PolymerData polydata;
if (use_deck) { if (use_deck) {
THROW("We do not yet read polymer keywords from deck."); THROW("We do not yet read polymer keywords from deck.");
std::string deck_filename = param.get<std::string>("deck_filename"); std::string deck_filename = param.get<std::string>("deck_filename");
@ -279,6 +280,7 @@ main(int argc, char** argv)
polydata.ads_vals[1] = 0.0015; polydata.ads_vals[1] = 0.0015;
polydata.ads_vals[2] = 0.0025; polydata.ads_vals[2] = 0.0025;
} }
bool new_code = param.getDefault("new_code", false);
// Extra rock init. // Extra rock init.
std::vector<double> porevol; std::vector<double> porevol;
@ -287,6 +289,7 @@ main(int argc, char** argv)
// Solvers init. // Solvers init.
Opm::PressureSolver psolver(grid->c_grid(), *props); Opm::PressureSolver psolver(grid->c_grid(), *props);
Opm::TransportModelPolymer tmodel(*grid->c_grid(), props->porosity(), &porevol[0], *props, polydata);
// State-related and source-related variables init. // State-related and source-related variables init.
std::vector<double> totmob; std::vector<double> totmob;
@ -359,18 +362,23 @@ main(int argc, char** argv)
// boundary flows must be accumulated into // boundary flows must be accumulated into
// source term following the same convention. // source term following the same convention.
transport_timer.start(); transport_timer.start();
polymertransport(&porevol[0], if (new_code) {
props->porosity(), tmodel.solve(&state.faceflux()[0], &reorder_src[0], stepsize, inflow_c,
&reorder_src[0], &reorder_sat[0], &state.concentration()[0], &state.cmax()[0]);
stepsize, } else {
inflow_c, polymertransport(&porevol[0],
const_cast<UnstructuredGrid*>(grid->c_grid()), props->porosity(),
props.get(), &reorder_src[0],
&polydata, stepsize,
&state.faceflux()[0], inflow_c,
&reorder_sat[0], const_cast<UnstructuredGrid*>(grid->c_grid()),
&state.concentration()[0], props.get(),
&state.cmax()[0]); &polydata,
&state.faceflux()[0],
&reorder_sat[0],
&state.concentration()[0],
&state.cmax()[0]);
}
transport_timer.stop(); transport_timer.stop();
double tt = transport_timer.secsSinceStart(); double tt = transport_timer.secsSinceStart();
std::cout << "Transport solver took: " << tt << " seconds." << std::endl; std::cout << "Transport solver took: " << tt << " seconds." << std::endl;