예제 #1
0
// Construct tensor grid from deck.
void GridManager::initFromDeckTensorgrid(const Opm::EclipseGridParser& deck)
{
    // Extract logical cartesian size.
    std::vector<int> dims;
    if (deck.hasField("DIMENS")) {
        dims = deck.getIntegerValue("DIMENS");
    } else if (deck.hasField("SPECGRID")) {
        dims = deck.getSPECGRID().dimensions;
    } else {
        OPM_THROW(std::runtime_error, "Deck must have either DIMENS or SPECGRID.");
    }

    // Extract coordinates (or offsets from top, in case of z).
    const std::vector<double>& dxv = deck.getFloatingPointValue("DXV");
    const std::vector<double>& dyv = deck.getFloatingPointValue("DYV");
    const std::vector<double>& dzv = deck.getFloatingPointValue("DZV");
    std::vector<double> x = coordsFromDeltas(dxv);
    std::vector<double> y = coordsFromDeltas(dyv);
    std::vector<double> z = coordsFromDeltas(dzv);

    // Check that number of cells given are consistent with DIMENS/SPECGRID.
    if (dims[0] != int(dxv.size())) {
        OPM_THROW(std::runtime_error, "Number of DXV data points do not match DIMENS or SPECGRID.");
    }
    if (dims[1] != int(dyv.size())) {
        OPM_THROW(std::runtime_error, "Number of DYV data points do not match DIMENS or SPECGRID.");
    }
    if (dims[2] != int(dzv.size())) {
        OPM_THROW(std::runtime_error, "Number of DZV data points do not match DIMENS or SPECGRID.");
    }

    // Extract top corner depths, if available.
    const double* top_depths = 0;
    std::vector<double> top_depths_vec;
    if (deck.hasField("DEPTHZ")) {
        const std::vector<double>& depthz = deck.getFloatingPointValue("DEPTHZ");
        if (depthz.size() != x.size()*y.size()) {
            OPM_THROW(std::runtime_error, "Incorrect size of DEPTHZ: " << depthz.size());
        }
        top_depths = &depthz[0];
    } else if (deck.hasField("TOPS")) {
        // We only support constant values for TOPS.
        // It is not 100% clear how we best can deal with
        // varying TOPS (stair-stepping grid, or not).
        const std::vector<double>& tops = deck.getFloatingPointValue("TOPS");
        if (std::count(tops.begin(), tops.end(), tops[0]) != int(tops.size())) {
            OPM_THROW(std::runtime_error, "We do not support nonuniform TOPS, please use ZCORN/COORDS instead.");
        }
        top_depths_vec.resize(x.size()*y.size(), tops[0]);
        top_depths = &top_depths_vec[0];
    }

    // Construct grid.
    ug_ = create_grid_tensor3d(dxv.size(), dyv.size(), dzv.size(),
                               &x[0], &y[0], &z[0], top_depths);
    if (!ug_) {
        OPM_THROW(std::runtime_error, "Failed to construct grid.");
    }
}
예제 #2
0
    void Rock<dim>::assignPorosity(const Opm::EclipseGridParser& parser,
                                   const std::vector<int>& global_cell)
    {
        porosity_.assign(global_cell.size(), 1.0);

        if (parser.hasField("PORO")) {
            const std::vector<double>& poro = parser.getFloatingPointValue("PORO");

            for (int c = 0; c < int(porosity_.size()); ++c) {
                porosity_[c] = poro[global_cell[c]];
            }
        }
    }
예제 #3
0
/// Construct a 3d corner-point grid from a deck.
GridManager::GridManager(const Opm::EclipseGridParser& deck)
{
    // We accept two different ways to specify the grid.
    //    1. Corner point format.
    //       Requires ZCORN, COORDS, DIMENS or SPECGRID, optionally
    //       ACTNUM, optionally MAPAXES.
    //       For this format, we will verify that DXV, DYV, DZV,
    //       DEPTHZ and TOPS are not present.
    //    2. Tensor grid format.
    //       Requires DXV, DYV, DZV, optionally DEPTHZ or TOPS.
    //       For this format, we will verify that ZCORN, COORDS
    //       and ACTNUM are not present.
    //       Note that for TOPS, we only allow a uniform vector of values.

    if (deck.hasField("ZCORN") && deck.hasField("COORD")) {
        initFromDeckCornerpoint(deck);
    } else if (deck.hasField("DXV") && deck.hasField("DYV") && deck.hasField("DZV")) {
        initFromDeckTensorgrid(deck);
    } else {
        OPM_THROW(std::runtime_error, "Could not initialize grid from deck. "
                  "Need either ZCORN + COORD or DXV + DYV + DZV keywords.");
    }
}
예제 #4
0
    void BlackoilPVT::init(const Opm::EclipseGridParser& parser)
    {
        typedef std::vector<std::vector<std::vector<double> > > table_t;
	region_number_ = 0;

	// Surface densities. Accounting for different orders in eclipse and our code.
	if (parser.hasField("DENSITY")) {
	    const int region_number = 0;
	    enum { ECL_oil = 0, ECL_water = 1, ECL_gas = 2 };
	    const std::vector<double>& d = parser.getDENSITY().densities_[region_number];
	    densities_[Aqua]   = d[ECL_water];
	    densities_[Vapour] = d[ECL_gas];
	    densities_[Liquid] = d[ECL_oil];
	} else {
	    THROW("Input is missing DENSITY\n");
	}

        // Water PVT
        if (parser.hasField("PVTW")) {
            water_props_.reset(new MiscibilityWater(parser.getPVTW().pvtw_));
        } else {
            water_props_.reset(new MiscibilityWater(0.5*Opm::prefix::centi*Opm::unit::Poise)); // Eclipse 100 default 
        }

        // Oil PVT
        if (parser.hasField("PVDO")) {
            oil_props_.reset(new MiscibilityDead(parser.getPVDO().pvdo_));
        } else if (parser.hasField("PVTO")) {
            oil_props_.reset(new MiscibilityLiveOil(parser.getPVTO().pvto_));
        } else if (parser.hasField("PVCDO")) {
            oil_props_.reset(new MiscibilityWater(parser.getPVCDO().pvcdo_));
        } else {
            THROW("Input is missing PVDO and PVTO\n");
        }

	// Gas PVT
        if (parser.hasField("PVDG")) {
            gas_props_.reset(new MiscibilityDead(parser.getPVDG().pvdg_));
        } else if (parser.hasField("PVTG")) {
            gas_props_.reset(new MiscibilityLiveGas(parser.getPVTG().pvtg_));
        } else {
	    THROW("Input is missing PVDG and PVTG\n");
        }
    }
void build_grid(const Opm::EclipseGridParser& parser,
                const double z_tol, Dune::CpGrid& grid,
                std::tr1::array<int,3>& cartDims)
{
    Opm::EclipseGridInspector insp(parser);

    grdecl g;
    cartDims[0] = g.dims[0] = insp.gridSize()[0];
    cartDims[1] = g.dims[1] = insp.gridSize()[1];
    cartDims[2] = g.dims[2] = insp.gridSize()[2];

    g.coord = &parser.getFloatingPointValue("COORD")[0];
    g.zcorn = &parser.getFloatingPointValue("ZCORN")[0];

    if (parser.hasField("ACTNUM")) {
        g.actnum = &parser.getIntegerValue("ACTNUM")[0];
        grid.processEclipseFormat(g, z_tol, false, false);
    } else {
        std::vector<int> dflt_actnum(g.dims[0] * g.dims[1] * g.dims[2], 1);

        g.actnum = &dflt_actnum[0];
        grid.processEclipseFormat(g, z_tol, false, false);
    }
}