From e3399ca2030a0f886066db9dcda657c382b66d8d Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Tue, 27 Jun 2017 15:16:22 +0200 Subject: [PATCH] fixing some compilation error after rebase. while a lot of new stuff have not entered, since many of the essential parts are in different files now. Rebasing will not incoporate the new stuff automatically. --- opm/autodiff/StandardWell.hpp | 27 ++++++------------------ opm/autodiff/StandardWell_impl.hpp | 22 +++++++++---------- opm/autodiff/StandardWellsDense_impl.hpp | 5 ++--- 3 files changed, 19 insertions(+), 35 deletions(-) diff --git a/opm/autodiff/StandardWell.hpp b/opm/autodiff/StandardWell.hpp index 3b8766845..6dc581efb 100644 --- a/opm/autodiff/StandardWell.hpp +++ b/opm/autodiff/StandardWell.hpp @@ -48,6 +48,7 @@ namespace Opm using FluidSystem = typename WellInterface::FluidSystem; using MaterialLaw = typename WellInterface::MaterialLaw; using ModelParameters = typename WellInterface::ModelParameters; + using BlackoilIndices = typename WellInterface::BlackoilIndices; // the positions of the primary variables for StandardWell // there are three primary variables, the second and the third ones are F_w and F_g @@ -61,9 +62,11 @@ namespace Opm typedef double Scalar; // static const int numEq = BlackoilIndices::numEq; - static const int numEq = 3; - static const int numWellEq = numEq; //number of wellEq is the same as numEq in the model - static const int solventCompIdx = 3; //TODO get this from ebos + static const int numEq = BlackoilIndices::numEq; + static const int numWellEq = GET_PROP_VALUE(TypeTag, EnablePolymer)? 3:numEq; // //numEq; //number of wellEq is only for 3 for polymer + static const int contiSolventEqIdx = BlackoilIndices::contiSolventEqIdx; + static const int contiPolymerEqIdx = BlackoilIndices::contiPolymerEqIdx; + typedef Dune::FieldVector VectorBlockType; typedef Dune::FieldMatrix MatrixBlockType; typedef Dune::BCRSMatrix Mat; @@ -71,24 +74,6 @@ namespace Opm typedef DenseAd::Evaluation EvalWell; typedef DenseAd::Evaluation Eval; - // for now, using the matrix and block version in StandardWellsDense. - // TODO: for bettern generality, it should contain blocksize_field and blocksize_well. - // They are allowed to be different and it will create four types of matrix blocks and two types of - // vector blocks. - - /* const static int blocksize = 3; - typedef double Scalar; - typedef Dune::FieldVector VectorBlockType; - typedef Dune::FieldMatrix MatrixBlockType; - typedef Dune::BCRSMatrix Mat; - typedef Dune::BlockVector BVector; - typedef DenseAd::Evaluation EvalWell; */ - /* using WellInterface::EvalWell; - using WellInterface::BVector; - using WellInterface::Mat; - using WellInterface::MatrixBlockType; - using WellInterface::VectorBlockType; */ - StandardWell(const Well* well, const int time_step, const Wells* wells); /// the densities of the fluid in each perforation diff --git a/opm/autodiff/StandardWell_impl.hpp b/opm/autodiff/StandardWell_impl.hpp index c7b492c2f..21a4df6a0 100644 --- a/opm/autodiff/StandardWell_impl.hpp +++ b/opm/autodiff/StandardWell_impl.hpp @@ -239,7 +239,7 @@ namespace Opm /* if (has_solvent_ ) { // TODO: investigate whether the use of the comp_frac is justified. double comp_frac = 0.0; - if (compIdx == solventCompIdx) { // solvent + if (compIdx == contiSolventEqIdx) { // solvent comp_frac = wells().comp_frac[np*wellIdx + pu.phase_pos[ Gas ]] * wsolvent(wellIdx); } else if (compIdx == pu.phase_pos[ Gas ]) { comp_frac = wells().comp_frac[np*wellIdx + compIdx] * (1.0 - wsolvent(wellIdx)); @@ -306,7 +306,7 @@ namespace Opm // TODO: handling solvent related later /* if (has_solvent_ && phase_under_control == Gas) { // for GRAT controlled wells solvent is included in the target - wellVolumeFractionScaledPhaseUnderControl += wellVolumeFractionScaled(solventCompIdx); + wellVolumeFractionScaledPhaseUnderControl += wellVolumeFractionScaled(contiSolventEqIdx); } */ if (phase == phase_under_control) { @@ -368,7 +368,7 @@ namespace Opm const WellControls* wc = wellControls(); if (well_controls_get_current_type(wc) == RESERVOIR_RATE) { - if (has_solvent && compIdx == solventCompIdx) { + if (has_solvent && compIdx == contiSolventEqIdx) { return wellVolumeFraction(compIdx); } const double* distr = well_controls_get_current_distr(wc); @@ -403,7 +403,7 @@ namespace Opm return well_variables_[GFrac]; } - if (compIdx == solventCompIdx) { + if (compIdx == contiSolventEqIdx) { return well_variables_[SFrac]; } @@ -489,7 +489,7 @@ namespace Opm b_perfcells_dense[phase] = extendEval(fs.invB(ebosPhaseIdx)); } if (has_solvent) { - b_perfcells_dense[solventCompIdx] = extendEval(intQuants.solventInverseFormationVolumeFactor()); + b_perfcells_dense[contiSolventEqIdx] = extendEval(intQuants.solventInverseFormationVolumeFactor()); } // Pressure drawdown (also used to determine direction of flow) @@ -541,7 +541,7 @@ namespace Opm } if (has_solvent) { - volumeRatio += cmix_s[solventCompIdx] / b_perfcells_dense[solventCompIdx]; + volumeRatio += cmix_s[contiSolventEqIdx] / b_perfcells_dense[contiSolventEqIdx]; } if (active()[Oil] && active()[Gas]) { @@ -657,7 +657,7 @@ namespace Opm } // Store the perforation phase flux for later usage. - if (componentIdx == solventCompIdx) {// if (flowPhaseToEbosCompIdx(componentIdx) == Solvent) + if (componentIdx == contiSolventEqIdx) {// if (flowPhaseToEbosCompIdx(componentIdx) == Solvent) well_state.perfRateSolvent()[perf] = cq_s[componentIdx].value(); } else { well_state.perfPhaseRates()[perf*np + componentIdx] = cq_s[componentIdx].value(); @@ -750,7 +750,7 @@ namespace Opm mob[phase] = extendEval(intQuants.mobility(ebosPhaseIdx)); } if (has_solvent) { - mob[solventCompIdx] = extendEval(intQuants.solventMobility()); + mob[contiSolventEqIdx] = extendEval(intQuants.solventMobility()); } } else { @@ -1518,8 +1518,8 @@ namespace Opm // We use cell values for solvent injector if (has_solvent) { - b_perf[numComp*perf + solventCompIdx] = intQuants.solventInverseFormationVolumeFactor().value(); - surf_dens_perf[numComp*perf + solventCompIdx] = intQuants.solventRefDensity(); + b_perf[numComp*perf + contiSolventEqIdx] = intQuants.solventInverseFormationVolumeFactor().value(); + surf_dens_perf[numComp*perf + contiSolventEqIdx] = intQuants.solventRefDensity(); } } } @@ -1764,7 +1764,7 @@ namespace Opm perfRates[perf*numComponent + phase] = xw.perfPhaseRates()[(first_perf_ + perf) * np + phase]; } if(has_solvent) { - perfRates[perf*numComponent + solventCompIdx] = xw.perfRateSolvent()[perf + first_perf_]; + perfRates[perf*numComponent + contiSolventEqIdx] = xw.perfRateSolvent()[perf + first_perf_]; } } diff --git a/opm/autodiff/StandardWellsDense_impl.hpp b/opm/autodiff/StandardWellsDense_impl.hpp index 13ea4fb18..b7397b2db 100644 --- a/opm/autodiff/StandardWellsDense_impl.hpp +++ b/opm/autodiff/StandardWellsDense_impl.hpp @@ -1044,7 +1044,7 @@ namespace Opm { std::vector< Scalar > maxNormWell(numComp, Scalar() ); - auto& grid = ebosSimulator.gridManager().grid(); + const auto& grid = ebosSimulator.gridManager().grid(); const auto& gridView = grid.leafGridView(); ElementContext elemCtx(ebosSimulator); const auto& elemEndIt = gridView.template end(); @@ -1088,7 +1088,6 @@ namespace Opm { } } - const auto& grid = ebosSimulator.gridManager().grid(); grid.comm().max(maxNormWell.data(), maxNormWell.size()); Vector well_flux_residual(numComp); @@ -3122,7 +3121,7 @@ namespace Opm { B += 1 / fs.invB(ebosPhaseIdx).value(); } if (has_solvent_) { - auto& B = B_avg[ solventCompIdx ]; + auto& B = B_avg[solventSaturationIdx]; B += 1 / intQuants.solventInverseFormationVolumeFactor().value(); } }