some cleaning up, no functionality change

This commit is contained in:
Kai Bao 2021-12-01 14:59:54 +01:00 committed by Trine Mykkeltvedt
parent ad4d1bee4f
commit fe42b8a5b3
2 changed files with 14 additions and 17 deletions

View File

@ -64,7 +64,7 @@ class ChiFlash
// enum { Comp1Idx = FluidSystem::Comp1Idx }; //rename for generic ? // enum { Comp1Idx = FluidSystem::Comp1Idx }; //rename for generic ?
enum { oilPhaseIdx = FluidSystem::oilPhaseIdx}; enum { oilPhaseIdx = FluidSystem::oilPhaseIdx};
enum { gasPhaseIdx = FluidSystem::gasPhaseIdx}; enum { gasPhaseIdx = FluidSystem::gasPhaseIdx};
enum { numMiscibleComponents = 2}; //octane, co2 enum { numMiscibleComponents = 2}; //octane, co2 // should be brine instead of brine here.
enum { numMisciblePhases = 2}; //oil, gas enum { numMisciblePhases = 2}; //oil, gas
enum { enum {
numEq = numEq =
@ -72,12 +72,12 @@ class ChiFlash
numMisciblePhases*numMiscibleComponents numMisciblePhases*numMiscibleComponents
};//pressure, saturation, composition };//pressure, saturation, composition
enum { /* enum {
p0PvIdx = 0, // pressure first phase primary variable index // p0PvIdx = 0, // pressure first phase primary variable index
S0PvIdx = 1, // saturation first phase primary variable index // S0PvIdx = 1, // saturation first phase primary variable index
x00PvIdx = S0PvIdx + 1, // molefraction first phase first component primary variable index // x00PvIdx = S0PvIdx + 1, // molefraction first phase first component primary variable index
//numMiscibleComponennets*numMisciblePhases-1 molefractions/primvar follow //numMiscibleComponennets*numMisciblePhases-1 molefractions/primvar follow
}; }; */
public: public:
/*! /*!
@ -526,8 +526,8 @@ protected:
} }
} }
int phaseIdx = (isGas?gasPhaseIdx:oilPhaseIdx); int phaseIdx = (isGas ? static_cast<int>(gasPhaseIdx) : static_cast<int>(oilPhaseIdx));
int phaseIdx2 = (isGas?oilPhaseIdx:gasPhaseIdx); int phaseIdx2 = (isGas ? static_cast<int>(oilPhaseIdx) : static_cast<int>(gasPhaseIdx));
for (int compIdx=0; compIdx<numComponents; ++compIdx){ for (int compIdx=0; compIdx<numComponents; ++compIdx){
fluidState_global.setMoleFraction(phaseIdx2, compIdx, globalComposition[compIdx]); fluidState_global.setMoleFraction(phaseIdx2, compIdx, globalComposition[compIdx]);
} }
@ -739,13 +739,13 @@ protected:
{ {
// Find smallest percentage update // Find smallest percentage update
Scalar w = 1.0; Scalar w = 1.0;
for (int i=0; i<x.size(); ++i){ for (size_t i=0; i<x.size(); ++i){
Scalar w_tmp = Opm::getValue(Opm::min(Opm::max(x[i] + d[i], 0.0), 1.0) - x[i]) / Opm::getValue(d[i]); Scalar w_tmp = Opm::getValue(Opm::min(Opm::max(x[i] + d[i], 0.0), 1.0) - x[i]) / Opm::getValue(d[i]);
w = Opm::min(w, w_tmp); w = Opm::min(w, w_tmp);
} }
// Loop over the solution vector and apply the smallest percentage update // Loop over the solution vector and apply the smallest percentage update
for (int i=0; i<x.size(); ++i){ for (size_t i=0; i<x.size(); ++i){
x[i] += w*d[i]; x[i] += w*d[i];
} }
} }
@ -825,7 +825,7 @@ protected:
// Calculate response of current state x // Calculate response of current state x
DefectVector x; DefectVector x;
DefectVector b0; DefectVector b0;
for(int j=0; j<xIn.size(); ++j){ for(size_t j=0; j<xIn.size(); ++j){
x[j] = xIn[j]; x[j] = xIn[j];
} }
@ -833,7 +833,7 @@ protected:
// Make the jacobian A in Newton system Ax=b // Make the jacobian A in Newton system Ax=b
Scalar epsilon = 1e-10; Scalar epsilon = 1e-10;
for(int i=0; i<b0.size(); ++i){ for(size_t i=0; i<b0.size(); ++i){
// Permutate x and calculate response // Permutate x and calculate response
x[i] += epsilon; x[i] += epsilon;
DefectVector bEps; DefectVector bEps;
@ -842,7 +842,7 @@ protected:
// Forward difference of all eqs wrt primary variable i // Forward difference of all eqs wrt primary variable i
DefectVector derivI; DefectVector derivI;
for(int j=0; j<b0.size(); ++j){ for(size_t j=0; j<b0.size(); ++j){
derivI[j] = bEps[j]; derivI[j] = bEps[j];
derivI[j] -= b0[j]; derivI[j] -= b0[j];
derivI[j] /= epsilon; derivI[j] /= epsilon;

View File

@ -61,11 +61,8 @@ class TwoPhaseThreeComponentFluidSystem
: public Opm::BaseFluidSystem<Scalar, TwoPhaseThreeComponentFluidSystem<Scalar> > : public Opm::BaseFluidSystem<Scalar, TwoPhaseThreeComponentFluidSystem<Scalar> >
{ {
using ThisType = TwoPhaseThreeComponentFluidSystem<Scalar>; using ThisType = TwoPhaseThreeComponentFluidSystem<Scalar>;
using Base = Opm::BaseFluidSystem<Scalar, ThisType>;
using PengRobinsonMixture = typename Opm::PengRobinsonMixture<Scalar, ThisType>; using PengRobinsonMixture = typename Opm::PengRobinsonMixture<Scalar, ThisType>;
using LBCviscosity = typename Opm::LBCviscosity<Scalar, ThisType>; using LBCviscosity = typename Opm::LBCviscosity<Scalar, ThisType>;
using H2O = typename Opm::H2O<Scalar>;
using Brine = typename Opm::Brine<Scalar, H2O>;
public: public:
//! \copydoc BaseFluidSystem::ParameterCache //! \copydoc BaseFluidSystem::ParameterCache
@ -347,7 +344,7 @@ public:
* \brief Returns the interaction coefficient for two components. * \brief Returns the interaction coefficient for two components.
*. *.
*/ */
static Scalar interactionCoefficient(unsigned comp1Idx, unsigned comp2Idx) static Scalar interactionCoefficient(unsigned /*comp1Idx*/, unsigned /*comp2Idx*/)
{ {
return 0.0; //-0.101;//0.1089; return 0.0; //-0.101;//0.1089;
} }