diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/AnisothermalPhaseModel/AnisothermalPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/AnisothermalPhaseModel/AnisothermalPhaseModel.C index a6c4297a2b..eaa6b097d0 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/AnisothermalPhaseModel/AnisothermalPhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/AnisothermalPhaseModel/AnisothermalPhaseModel.C @@ -62,10 +62,11 @@ Foam::AnisothermalPhaseModel::AnisothermalPhaseModel ( const phaseSystem& fluid, const word& phaseName, + const bool referencePhase, const label index ) : - BasePhaseModel(fluid, phaseName, index) + BasePhaseModel(fluid, phaseName, referencePhase, index) {} diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/AnisothermalPhaseModel/AnisothermalPhaseModel.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/AnisothermalPhaseModel/AnisothermalPhaseModel.H index 0f2a60f467..51b6b27d7d 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/AnisothermalPhaseModel/AnisothermalPhaseModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/AnisothermalPhaseModel/AnisothermalPhaseModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -69,6 +69,7 @@ public: ( const phaseSystem& fluid, const word& phaseName, + const bool referencePhase, const label index ); diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/InertPhaseModel/InertPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/InertPhaseModel/InertPhaseModel.C index 88c43b8787..79c8dd7ae4 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/InertPhaseModel/InertPhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/InertPhaseModel/InertPhaseModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,10 +33,11 @@ Foam::InertPhaseModel::InertPhaseModel ( const phaseSystem& fluid, const word& phaseName, + const bool referencePhase, const label index ) : - BasePhaseModel(fluid, phaseName, index) + BasePhaseModel(fluid, phaseName, referencePhase, index) {} diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/InertPhaseModel/InertPhaseModel.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/InertPhaseModel/InertPhaseModel.H index 74961d34f5..d2c238d413 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/InertPhaseModel/InertPhaseModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/InertPhaseModel/InertPhaseModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -60,6 +60,7 @@ public: ( const phaseSystem& fluid, const word& phaseName, + const bool referencePhase, const label index ); diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/IsothermalPhaseModel/IsothermalPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/IsothermalPhaseModel/IsothermalPhaseModel.C index dd8c66f33c..c18f8d4904 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/IsothermalPhaseModel/IsothermalPhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/IsothermalPhaseModel/IsothermalPhaseModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,10 +33,11 @@ Foam::IsothermalPhaseModel::IsothermalPhaseModel ( const phaseSystem& fluid, const word& phaseName, + const bool referencePhase, const label index ) : - BasePhaseModel(fluid, phaseName, index) + BasePhaseModel(fluid, phaseName, referencePhase, index) {} diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/IsothermalPhaseModel/IsothermalPhaseModel.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/IsothermalPhaseModel/IsothermalPhaseModel.H index 3114a48ee8..7eb15dfc2e 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/IsothermalPhaseModel/IsothermalPhaseModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/IsothermalPhaseModel/IsothermalPhaseModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -61,6 +61,7 @@ public: ( const phaseSystem& fluid, const word& phaseName, + const bool referencePhase, const label index ); diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C index bb31b2529e..0f4eab24f8 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C @@ -117,10 +117,11 @@ Foam::MovingPhaseModel::MovingPhaseModel ( const phaseSystem& fluid, const word& phaseName, + const bool referencePhase, const label index ) : - BasePhaseModel(fluid, phaseName, index), + BasePhaseModel(fluid, phaseName, referencePhase, index), U_ ( IOobject diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.H index 7ed4af3d32..452e973347 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.H @@ -123,6 +123,7 @@ public: ( const phaseSystem& fluid, const word& phaseName, + const bool referencePhase, const label index ); diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MultiComponentPhaseModel/MultiComponentPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MultiComponentPhaseModel/MultiComponentPhaseModel.C index 9ee2f16fc9..2242039485 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MultiComponentPhaseModel/MultiComponentPhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MultiComponentPhaseModel/MultiComponentPhaseModel.C @@ -42,10 +42,11 @@ Foam::MultiComponentPhaseModel::MultiComponentPhaseModel ( const phaseSystem& fluid, const word& phaseName, + const bool referencePhase, const label index ) : - BasePhaseModel(fluid, phaseName, index), + BasePhaseModel(fluid, phaseName, referencePhase, index), residualAlpha_ ( "residualAlpha", diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MultiComponentPhaseModel/MultiComponentPhaseModel.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MultiComponentPhaseModel/MultiComponentPhaseModel.H index d7dd0bb50d..63ea62f3b3 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MultiComponentPhaseModel/MultiComponentPhaseModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MultiComponentPhaseModel/MultiComponentPhaseModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -74,6 +74,7 @@ public: ( const phaseSystem& fluid, const word& phaseName, + const bool referencePhase, const label index ); diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/PurePhaseModel/PurePhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/PurePhaseModel/PurePhaseModel.C index 277ae64d86..9e110bf700 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/PurePhaseModel/PurePhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/PurePhaseModel/PurePhaseModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,10 +33,11 @@ Foam::PurePhaseModel::PurePhaseModel ( const phaseSystem& fluid, const word& phaseName, + const bool referencePhase, const label index ) : - BasePhaseModel(fluid, phaseName, index) + BasePhaseModel(fluid, phaseName, referencePhase, index) {} diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/PurePhaseModel/PurePhaseModel.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/PurePhaseModel/PurePhaseModel.H index af9abb6040..8f08f36764 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/PurePhaseModel/PurePhaseModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/PurePhaseModel/PurePhaseModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -68,6 +68,7 @@ public: ( const phaseSystem& fluid, const word& phaseName, + const bool referencePhase, const label index ); diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/ReactingPhaseModel/ReactingPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/ReactingPhaseModel/ReactingPhaseModel.C index 82bcad722a..24ab8080d5 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/ReactingPhaseModel/ReactingPhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/ReactingPhaseModel/ReactingPhaseModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,10 +34,11 @@ Foam::ReactingPhaseModel::ReactingPhaseModel ( const phaseSystem& fluid, const word& phaseName, + const bool referencePhase, const label index ) : - BasePhaseModel(fluid, phaseName, index), + BasePhaseModel(fluid, phaseName, referencePhase, index), reaction_(ReactionType::New(this->thermo_(), this->turbulence_())) {} diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/ReactingPhaseModel/ReactingPhaseModel.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/ReactingPhaseModel/ReactingPhaseModel.H index a6d57788a0..468ca177e0 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/ReactingPhaseModel/ReactingPhaseModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/ReactingPhaseModel/ReactingPhaseModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -68,6 +68,7 @@ public: ( const phaseSystem& fluid, const word& phaseName, + const bool referencePhase, const label index ); diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/StationaryPhaseModel/StationaryPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/StationaryPhaseModel/StationaryPhaseModel.C index ae2dcb3f56..9a8ab37d39 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/StationaryPhaseModel/StationaryPhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/StationaryPhaseModel/StationaryPhaseModel.C @@ -32,10 +32,11 @@ Foam::StationaryPhaseModel::StationaryPhaseModel ( const phaseSystem& fluid, const word& phaseName, + const bool referencePhase, const label index ) : - BasePhaseModel(fluid, phaseName, index) + BasePhaseModel(fluid, phaseName, referencePhase, index) {} diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/StationaryPhaseModel/StationaryPhaseModel.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/StationaryPhaseModel/StationaryPhaseModel.H index 6bd365a89a..f30bc27cd3 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/StationaryPhaseModel/StationaryPhaseModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/StationaryPhaseModel/StationaryPhaseModel.H @@ -66,6 +66,7 @@ public: ( const phaseSystem& fluid, const word& phaseName, + const bool referencePhase, const label index ); diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/ThermoPhaseModel/ThermoPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/ThermoPhaseModel/ThermoPhaseModel.C index 76b3a50a7b..7e85626098 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/ThermoPhaseModel/ThermoPhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/ThermoPhaseModel/ThermoPhaseModel.C @@ -33,10 +33,11 @@ Foam::ThermoPhaseModel::ThermoPhaseModel ( const phaseSystem& fluid, const word& phaseName, + const bool referencePhase, const label index ) : - BasePhaseModel(fluid, phaseName, index), + BasePhaseModel(fluid, phaseName, referencePhase, index), thermo_(ThermoModel::New(fluid.mesh(), this->name())) { thermo_->validate diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/ThermoPhaseModel/ThermoPhaseModel.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/ThermoPhaseModel/ThermoPhaseModel.H index 62ea437bee..5a5106168c 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/ThermoPhaseModel/ThermoPhaseModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/ThermoPhaseModel/ThermoPhaseModel.H @@ -74,6 +74,7 @@ public: ( const phaseSystem& fluid, const word& phaseName, + const bool referencePhase, const label index ); diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/newPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/newPhaseModel.C index 9ecb78827f..030e09ae41 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/newPhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/newPhaseModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,6 +32,7 @@ Foam::autoPtr Foam::phaseModel::New ( const phaseSystem& fluid, const word& phaseName, + const bool referencePhase, const label index ) { @@ -53,7 +54,7 @@ Foam::autoPtr Foam::phaseModel::New << exit(FatalError); } - return cstrIter()(fluid, phaseName, index); + return cstrIter()(fluid, phaseName, referencePhase, index); } // ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C index ddac7038c4..40a3709dd6 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C @@ -42,21 +42,38 @@ Foam::phaseModel::phaseModel ( const phaseSystem& fluid, const word& phaseName, + const bool referencePhase, const label index ) : volScalarField ( - IOobject + referencePhase + ? volScalarField ( - IOobject::groupName("alpha", phaseName), - fluid.mesh().time().timeName(), + IOobject + ( + IOobject::groupName("alpha", phaseName), + fluid.mesh().time().timeName(), + fluid.mesh(), + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), fluid.mesh(), - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - fluid.mesh(), - dimensionedScalar(dimless, 0) + dimensionedScalar(dimless, 0) + ) + : volScalarField + ( + IOobject + ( + IOobject::groupName("alpha", phaseName), + fluid.mesh().time().timeName(), + fluid.mesh(), + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + fluid.mesh() + ) ), fluid_(fluid), diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H index 9852660de2..3bbbc3f1c4 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H @@ -95,9 +95,10 @@ public: ( const phaseSystem& fluid, const word& phaseName, + const bool referencePhase, const label index ), - (fluid, phaseName, index) + (fluid, phaseName, referencePhase, index) ); @@ -107,6 +108,7 @@ public: ( const phaseSystem& fluid, const word& phaseName, + const bool referencePhase, const label index ); @@ -120,6 +122,7 @@ public: ( const phaseSystem& fluid, const word& phaseName, + const bool referencePhase, const label index ); @@ -128,25 +131,37 @@ public: class iNew { const phaseSystem& fluid_; + const word& referencePhaseName_; mutable label indexCounter_; public: iNew ( - const phaseSystem& fluid + const phaseSystem& fluid, + const word& referencePhaseName ) : fluid_(fluid), + referencePhaseName_(referencePhaseName), indexCounter_(-1) {} autoPtr operator()(Istream& is) const { indexCounter_++; + + const word phaseName(is); + return autoPtr ( - phaseModel::New(fluid_, word(is), indexCounter_) + phaseModel::New + ( + fluid_, + phaseName, + phaseName == referencePhaseName_, + indexCounter_ + ) ); } }; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.C index 6dd6792328..e7a85acd9a 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.C @@ -210,7 +210,20 @@ Foam::phaseSystem::phaseSystem mesh_(mesh), - phaseModels_(lookup("phases"), phaseModel::iNew(*this)), + referencePhaseName_ + ( + // Temporary hack for backward compatibility with + // reactingTwoPhaseEulerFoam + lookup("type").find("TwoPhase") != string::npos + ? lookup("phases")[1] + : lookupOrDefault("referencePhase", word::null) + ), + + phaseModels_ + ( + lookup("phases"), + phaseModel::iNew(*this, referencePhaseName_) + ), phi_(calcPhi(phaseModels_)), @@ -295,6 +308,23 @@ Foam::phaseSystem::phaseSystem // Update motion fields correctKinematics(); + + // Set the optional reference phase fraction from the other phases + if (referencePhaseName_ != word::null) + { + phaseModel* referencePhasePtr = &phases()[referencePhaseName_]; + volScalarField& referenceAlpha = *referencePhasePtr; + + referenceAlpha = 1; + + forAll(phaseModels_, phasei) + { + if (&phaseModels_[phasei] != referencePhasePtr) + { + referenceAlpha -= phaseModels_[phasei]; + } + } + } } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.H index 01e380f763..90cf38f8f2 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.H @@ -138,6 +138,10 @@ protected: //- Reference to the mesh const fvMesh& mesh_; + //- Name of optional reference phase which is not solved for + // but obtained from the sum of the other phases + word referencePhaseName_; + //- Phase models phaseModelList phaseModels_; diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C index 1e8885c5d5..a477beee5e 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C @@ -365,9 +365,9 @@ void Foam::multiphaseSystem::solve // i.e. the moving phases less the optional reference phase phaseModelPartialList solvePhases; - if (found("referencePhase")) + if (referencePhaseName_ != word::null) { - referencePhasePtr = &phases()[lookup("referencePhase")]; + referencePhasePtr = &phases()[referencePhaseName_]; solvePhases.setSize(movingPhases().size() - 1); label solvePhasesi = 0; @@ -422,6 +422,23 @@ void Foam::multiphaseSystem::solve } } + // Calculate the void fraction + volScalarField alphaVoid + ( + IOobject + ( + "alphaVoid", + mesh_.time().timeName(), + mesh_ + ), + mesh_, + dimensionedScalar(dimless, 1) + ); + forAll(stationaryPhases(), stationaryPhasei) + { + alphaVoid -= stationaryPhases()[stationaryPhasei]; + } + for (int acorr=0; acorr trSubDeltaT; @@ -448,23 +465,6 @@ void Foam::multiphaseSystem::solve !(++alphaSubCycle).end(); ) { - // Calculate the void fraction - volScalarField alphaVoid - ( - IOobject - ( - "alphaVoid", - mesh_.time().timeName(), - mesh_ - ), - mesh_, - dimensionedScalar(dimless, 1) - ); - forAll(stationaryPhases(), stationaryPhasei) - { - alphaVoid -= stationaryPhases()[stationaryPhasei]; - } - // Generate face-alphas PtrList alphafs(phases().size()); if (solvePhases.size() > 1) @@ -729,23 +729,10 @@ void Foam::multiphaseSystem::solve } } - if (referencePhasePtr) - { - phaseModel& referencePhase = *referencePhasePtr; - - volScalarField& referenceAlpha = referencePhase; - referenceAlpha = alphaVoid; - - forAll(solvePhases, solvePhasei) - { - referenceAlpha -= solvePhases[solvePhasei]; - } - } - // Report the phase fractions and the phase fraction sum - forAll(phases(), phasei) + forAll(solvePhases, solvePhasei) { - phaseModel& phase = phases()[phasei]; + phaseModel& phase = solvePhases[solvePhasei]; Info<< phase.name() << " fraction, min, max = " << phase.weightedAverage(mesh_.V()).value() @@ -754,33 +741,36 @@ void Foam::multiphaseSystem::solve << endl; } - volScalarField sumAlphaMoving - ( - IOobject + if (!referencePhasePtr) + { + volScalarField sumAlphaMoving ( - "sumAlphaMoving", - mesh_.time().timeName(), - mesh_ - ), - mesh_, - dimensionedScalar(dimless, 0) - ); - forAll(movingPhases(), movingPhasei) - { - sumAlphaMoving += movingPhases()[movingPhasei]; - } + IOobject + ( + "sumAlphaMoving", + mesh_.time().timeName(), + mesh_ + ), + mesh_, + dimensionedScalar(dimless, 0) + ); + forAll(movingPhases(), movingPhasei) + { + sumAlphaMoving += movingPhases()[movingPhasei]; + } - Info<< "Phase-sum volume fraction, min, max = " - << (sumAlphaMoving + 1 - alphaVoid)() - .weightedAverage(mesh_.V()).value() - << ' ' << min(sumAlphaMoving + 1 - alphaVoid).value() - << ' ' << max(sumAlphaMoving + 1 - alphaVoid).value() - << endl; + Info<< "Phase-sum volume fraction, min, max = " + << (sumAlphaMoving + 1 - alphaVoid)() + .weightedAverage(mesh_.V()).value() + << ' ' << min(sumAlphaMoving + 1 - alphaVoid).value() + << ' ' << max(sumAlphaMoving + 1 - alphaVoid).value() + << endl; - // Correct the sum of the phase fractions to avoid drift - forAll(movingPhases(), movingPhasei) - { - movingPhases()[movingPhasei] *= alphaVoid/sumAlphaMoving; + // Correct the sum of the phase fractions to avoid drift + forAll(movingPhases(), movingPhasei) + { + movingPhases()[movingPhasei] *= alphaVoid/sumAlphaMoving; + } } } @@ -820,6 +810,14 @@ void Foam::multiphaseSystem::solve referencePhase.correctInflowOutflow(referencePhase.alphaPhiRef()); referencePhase.alphaRhoPhiRef() = fvc::interpolate(referencePhase.rho())*referencePhase.alphaPhi(); + + volScalarField& referenceAlpha = referencePhase; + referenceAlpha = alphaVoid; + + forAll(solvePhases, solvePhasei) + { + referenceAlpha -= solvePhases[solvePhasei]; + } } calcAlphas(); diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseSystem/multiphaseSystem.H b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseSystem/multiphaseSystem.H index 34bbe07d6d..f20d7a4f3b 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseSystem/multiphaseSystem.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseSystem/multiphaseSystem.H @@ -53,8 +53,6 @@ class multiphaseSystem : public phaseSystem { -private: - // Private Typedefs typedef HashTable @@ -67,7 +65,7 @@ private: // for oil, etc... volScalarField alphas_; - //- + //- Interface compression coefficients cAlphaTable cAlphas_; //- Stabilisation for normalisation of the interface normal diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C index e97a74b1c1..ef02e97921 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C @@ -61,8 +61,6 @@ Foam::twoPhaseSystem::twoPhaseSystem phase1_(phaseModels_[0]), phase2_(phaseModels_[1]) { - phase2_.volScalarField::operator=(scalar(1) - phase1_); - volScalarField& alpha1 = phase1_; mesh.setFluxRequired(alpha1.name()); } diff --git a/tutorials/multiphase/reactingMultiphaseEulerFoam/laminar/bubbleColumn/0/Theta b/tutorials/multiphase/reactingMultiphaseEulerFoam/laminar/bubbleColumn/0/Theta deleted file mode 100644 index 377979b988..0000000000 --- a/tutorials/multiphase/reactingMultiphaseEulerFoam/laminar/bubbleColumn/0/Theta +++ /dev/null @@ -1,47 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Version: dev - \\/ M anipulation | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - object Theta; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 2 -2 0 0 0 0]; - -internalField uniform 0.0; - -boundaryField -{ - inlet - { - type fixedValue; - value uniform 1.0e-7; - } - - outlet - { - type inletOutlet; - inletValue uniform 1.0e-7; - value uniform 1.0e-7; - } - - walls - { - type zeroGradient; - } - - defaultFaces - { - type empty; - } -} - -// ************************************************************************* // diff --git a/tutorials/multiphase/reactingMultiphaseEulerFoam/laminar/bubbleColumn/constant/phaseProperties b/tutorials/multiphase/reactingMultiphaseEulerFoam/laminar/bubbleColumn/constant/phaseProperties index c97daf2a92..beee62494f 100644 --- a/tutorials/multiphase/reactingMultiphaseEulerFoam/laminar/bubbleColumn/constant/phaseProperties +++ b/tutorials/multiphase/reactingMultiphaseEulerFoam/laminar/bubbleColumn/constant/phaseProperties @@ -19,6 +19,8 @@ type basicMultiphaseSystem; phases (air water); +referencePhase water; + air { type purePhaseModel;