示例#1
0
 /// Construct the model. 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] param            parameters
 /// \param[in] grid             grid data structure
 /// \param[in] wells            well structure
 /// \param[in] vfp_properties   Vertical flow performance tables
 /// \param[in] linsolver        linear solver
 /// \param[in] eclState         eclipse state
 /// \param[in] terminal_output  request output to cout/cerr
 BlackoilModelEbos(Simulator& ebosSimulator,
                   const ModelParameters& param,
                   BlackoilWellModel<TypeTag>& well_model,
                   const bool terminal_output)
 : ebosSimulator_(ebosSimulator)
 , grid_(ebosSimulator_.vanguard().grid())
 , phaseUsage_(phaseUsageFromDeck(eclState()))
 , has_disgas_(FluidSystem::enableDissolvedGas())
 , has_vapoil_(FluidSystem::enableVaporizedOil())
 , has_solvent_(GET_PROP_VALUE(TypeTag, EnableSolvent))
 , has_polymer_(GET_PROP_VALUE(TypeTag, EnablePolymer))
 , has_polymermw_(GET_PROP_VALUE(TypeTag, EnablePolymerMW))
 , has_energy_(GET_PROP_VALUE(TypeTag, EnableEnergy))
 , param_( param )
 , well_model_ (well_model)
 , terminal_output_ (terminal_output)
 , current_relaxation_(1.0)
 , dx_old_(UgGridHelpers::numCells(grid_))
 {
     // compute global sum of number of cells
     global_nc_ = detail::countGlobalCells(grid_);
     convergence_reports_.reserve(300); // Often insufficient, but avoids frequent moves.
 }
示例#2
0
void ensureBlackoilApi()
{
    // here we don't want to call these methods at runtime, we just want to make sure
    // that they compile
    while (false) {
#if HAVE_OPM_PARSER
        Opm::Deck deck;
        Opm::EclipseState eclState(deck);
        FluidSystem::initFromDeck(deck, eclState);
#endif

        typedef typename FluidSystem::Scalar Scalar;
        typedef Opm::CompositionalFluidState<Evaluation, FluidSystem> FluidState;
        FluidState fluidState;
        Evaluation XoG = 0.0;
        Evaluation XgO = 0.0;
        Evaluation Rs = 0.0;
        Evaluation Rv = 0.0;
        Evaluation dummy;

        // some additional typedefs
        typedef typename FluidSystem::OilPvt OilPvt;
        typedef typename FluidSystem::GasPvt GasPvt;
        typedef typename FluidSystem::WaterPvt WaterPvt;

        // check the black-oil specific enums
        static_assert(FluidSystem::numPhases == 3, "");
        static_assert(FluidSystem::numComponents == 3, "");

        static_assert(0 <= FluidSystem::oilPhaseIdx && FluidSystem::oilPhaseIdx < 3, "");
        static_assert(0 <= FluidSystem::gasPhaseIdx && FluidSystem::gasPhaseIdx < 3, "");
        static_assert(0 <= FluidSystem::waterPhaseIdx && FluidSystem::waterPhaseIdx < 3, "");

        static_assert(0 <= FluidSystem::oilCompIdx && FluidSystem::oilCompIdx < 3, "");
        static_assert(0 <= FluidSystem::gasCompIdx && FluidSystem::gasCompIdx < 3, "");
        static_assert(0 <= FluidSystem::waterCompIdx && FluidSystem::waterCompIdx < 3, "");

        // check the non-parser initialization
        std::shared_ptr<OilPvt> oilPvt;
        std::shared_ptr<GasPvt> gasPvt;
        std::shared_ptr<WaterPvt> waterPvt;

        unsigned numPvtRegions = 2;
        FluidSystem::initBegin(numPvtRegions);
        FluidSystem::setEnableDissolvedGas(true);
        FluidSystem::setEnableVaporizedOil(true);
        FluidSystem::setGasPvt(gasPvt);
        FluidSystem::setOilPvt(oilPvt);
        FluidSystem::setWaterPvt(waterPvt);
        FluidSystem::setReferenceDensities(/*oil=*/600.0,
                                           /*water=*/1000.0,
                                           /*gas=*/1.0,
                                           /*regionIdx=*/0);
        FluidSystem::initEnd();

        // the molarMass() method has an optional argument for the PVT region
        unsigned OPM_UNUSED numRegions = FluidSystem::numRegions();
        Scalar OPM_UNUSED Mg = FluidSystem::molarMass(FluidSystem::gasCompIdx,
                                                      /*regionIdx=*/0);
        bool OPM_UNUSED b1 = FluidSystem::enableDissolvedGas();
        bool OPM_UNUSED b2 = FluidSystem::enableVaporizedOil();
        Scalar OPM_UNUSED rhoRefOil = FluidSystem::referenceDensity(FluidSystem::oilPhaseIdx,
                                                                    /*regionIdx=*/0);
        dummy = FluidSystem::convertXoGToRs(XoG, /*regionIdx=*/0);
        dummy = FluidSystem::convertXgOToRv(XgO, /*regionIdx=*/0);
        dummy = FluidSystem::convertXoGToxoG(XoG, /*regionIdx=*/0);
        dummy = FluidSystem::convertXgOToxgO(XgO, /*regionIdx=*/0);
        dummy = FluidSystem::convertRsToXoG(Rs, /*regionIdx=*/0);
        dummy = FluidSystem::convertRvToXgO(Rv, /*regionIdx=*/0);

        for (unsigned phaseIdx = 0; phaseIdx < FluidSystem::numPhases; ++ phaseIdx) {
            dummy = FluidSystem::density(fluidState, phaseIdx, /*regionIdx=*/0);
            dummy = FluidSystem::saturatedDensity(fluidState, phaseIdx, /*regionIdx=*/0);
            dummy = FluidSystem::inverseFormationVolumeFactor(fluidState, phaseIdx, /*regionIdx=*/0);
            dummy = FluidSystem::saturatedInverseFormationVolumeFactor(fluidState, phaseIdx, /*regionIdx=*/0);
            dummy = FluidSystem::viscosity(fluidState, phaseIdx, /*regionIdx=*/0);
            dummy = FluidSystem::saturatedDissolutionFactor(fluidState, phaseIdx, /*regionIdx=*/0);
            dummy = FluidSystem::saturatedDissolutionFactor(fluidState, phaseIdx, /*regionIdx=*/0, /*maxSo=*/1.0);
            dummy = FluidSystem::saturationPressure(fluidState, phaseIdx, /*regionIdx=*/0);
            for (unsigned compIdx = 0; compIdx < FluidSystem::numComponents; ++ compIdx)
                dummy = FluidSystem::fugacityCoefficient(fluidState, phaseIdx, compIdx,  /*regionIdx=*/0);
        }

        // prevent GCC from producing a "variable assigned but unused" warning
        dummy = 2.0*dummy;


        // the "not considered safe to use directly" API
        const OPM_UNUSED OilPvt &oilPvt2 = FluidSystem::oilPvt();
        const OPM_UNUSED GasPvt &gasPvt2 = FluidSystem::gasPvt();
        const OPM_UNUSED WaterPvt &waterPvt2 = FluidSystem::waterPvt();
    }
}