Add or fix foam-related indices for one- and two-phase cases.

This commit is contained in:
Atgeirr Flø Rasmussen 2019-10-10 16:08:04 +02:00
parent bc0eaca943
commit b9509cdf78
2 changed files with 19 additions and 8 deletions

View File

@ -26,7 +26,7 @@
* \copydoc Ewoms::BlackOilTwoPhaseIndices
*/
#ifndef EWOMS_BLACK_OIL_ONE_PHASE_INDICES_HH
#define EWOMS_BLACK_OIL_ONe_PHASE_INDICES_HH
#define EWOMS_BLACK_OIL_ONE_PHASE_INDICES_HH
#include <cassert>
@ -37,7 +37,7 @@ namespace Ewoms {
*
* \brief The primary variable and equation indices for the black-oil model.
*/
template <unsigned numSolventsV, unsigned numPolymersV, unsigned numEnergyV, unsigned PVOffset, unsigned canonicalCompIdx>
template <unsigned numSolventsV, unsigned numPolymersV, unsigned numEnergyV, bool enableFoam, unsigned PVOffset, unsigned canonicalCompIdx>
struct BlackOilOnePhaseIndices
{
//! Is phase enabled or not
@ -63,11 +63,14 @@ struct BlackOilOnePhaseIndices
//! Number of energy equations to be considered
static const int numEnergy = enableEnergy ? numEnergyV : 0;
//! Number of foam equations to be considered
static const int numFoam = enableFoam? 1 : 0;
//! The number of fluid phases
static const int numPhases = 1;
//! The number of equations
static const int numEq = numPhases + numSolvents + numPolymers + numEnergy;
static const int numEq = numPhases + numSolvents + numPolymers + numEnergy + numFoam;
//////////////////////////////
// Primary variable indices
@ -99,9 +102,13 @@ struct BlackOilOnePhaseIndices
static const int polymerMoleWeightIdx =
numPolymers > 1 ? polymerConcentrationIdx + 1 : -1000;
//! Index of the primary variable for the foam
static const int foamConcentrationIdx =
enableFoam ? PVOffset + numPhases + numSolvents + numPolymers : -1000;
//! Index of the primary variable for temperature
static const int temperatureIdx =
enableEnergy ? PVOffset + numPhases + numSolvents + numPolymers : - 1000;
enableEnergy ? PVOffset + numPhases + numSolvents + numPolymers + numFoam: - 1000;
//////////////////////
// Equation indices
@ -142,9 +149,13 @@ struct BlackOilOnePhaseIndices
static const int contiPolymerMWEqIdx =
numPolymers > 1 ? contiPolymerEqIdx + 1 : -1000;
//! Index of the continuity equation for the foam component
static const int contiFoamEqIdx =
enableFoam ? PVOffset + numPhases + numSolvents + numPolymers : -1000;
//! Index of the continuity equation for energy
static const int contiEnergyEqIdx =
enableEnergy ? PVOffset + numPhases + numSolvents + numPolymers : -1000;
enableEnergy ? PVOffset + numPhases + numSolvents + numPolymers + numFoam : -1000;
};
} // namespace Ewoms

View File

@ -104,7 +104,7 @@ struct BlackOilTwoPhaseIndices
//! Index of the primary variable for the foam
static const int foamConcentrationIdx =
enableFoam ? polymerMoleWeightIdx + 1 : -1000;
enableFoam ? PVOffset + numPhases + numSolvents + numPolymers : -1000;
//! Index of the primary variable for temperature
static const int temperatureIdx =
@ -167,9 +167,9 @@ struct BlackOilTwoPhaseIndices
static const int contiPolymerMWEqIdx =
numPolymers > 1 ? contiPolymerEqIdx + 1 : -1000;
//! Index of the continuity equation for the foam component
//! Index of the continuity equation for the foam component
static const int contiFoamEqIdx =
enableFoam ? contiPolymerMWEqIdx + 1 : -1000;
enableFoam ? PVOffset + numPhases + numSolvents + numPolymers : -1000;
//! Index of the continuity equation for energy
static const int contiEnergyEqIdx =