From 72a2f9b45cb466635e83c76a9f217a53fa4087e8 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 16 Sep 2011 19:18:19 +0100 Subject: [PATCH] multiphaseEulerFoam: further updates to the MRF functionality --- .../multiphase/multiphaseEulerFoam/Make/files | 1 + .../multiphaseEulerFoam/Make/options | 1 + .../multiphaseEulerFoam/createMRFZones.H | 6 + .../multiphase/multiphaseEulerFoam/pEqn.H | 3 +- src/finiteVolume/Make/files | 1 - ...phaseFixedFluxPressureFvPatchScalarField.C | 177 ------------------ ...phaseFixedFluxPressureFvPatchScalarField.H | 154 --------------- .../bubbleColumn/system/fvSolution | 18 +- .../damBreak4phase/system/fvSolution | 8 +- 9 files changed, 16 insertions(+), 353 deletions(-) delete mode 100644 src/finiteVolume/fields/fvPatchFields/derived/multiphaseFixedFluxPressure/multiphaseFixedFluxPressureFvPatchScalarField.C delete mode 100644 src/finiteVolume/fields/fvPatchFields/derived/multiphaseFixedFluxPressure/multiphaseFixedFluxPressureFvPatchScalarField.H diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/Make/files b/applications/solvers/multiphase/multiphaseEulerFoam/Make/files index f71c44324a..b5b45045f1 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/Make/files +++ b/applications/solvers/multiphase/multiphaseEulerFoam/Make/files @@ -1,3 +1,4 @@ multiphaseEulerFoam.C +multiphaseFixedFluxPressure/multiphaseFixedFluxPressureFvPatchScalarField.C EXE = $(FOAM_APPBIN)/multiphaseEulerFoam diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/Make/options b/applications/solvers/multiphase/multiphaseEulerFoam/Make/options index 8fc20e8623..06ffdda61c 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/Make/options +++ b/applications/solvers/multiphase/multiphaseEulerFoam/Make/options @@ -1,6 +1,7 @@ EXE_INC = \ -IphaseModel/lnInclude \ -ImultiphaseSystem/lnInclude \ + -ImultiphaseFixedFluxPressure \ /*-IkineticTheoryModels/lnInclude*/ \ -IinterfacialModels/lnInclude \ -I$(LIB_SRC)/transportModels \ diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/createMRFZones.H b/applications/solvers/multiphase/multiphaseEulerFoam/createMRFZones.H index 161446a8e6..326c934eaf 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/createMRFZones.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/createMRFZones.H @@ -1,2 +1,8 @@ MRFZones mrfZones(mesh); + + forAllIter(PtrDictionary, fluid.phases(), iter) + { + mrfZones.correctBoundaryVelocity(iter().U()); + } + mrfZones.correctBoundaryVelocity(U); diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H b/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H index 5f7c38ebf0..6cbfbf2d16 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H @@ -53,12 +53,12 @@ phase.U() = rAUs[phasei]*UEqns[phasei].H(); + mrfZones.absoluteFlux(phase.phi()); phase.phi() = ( (fvc::interpolate(phase.U()) & mesh.Sf()) + fvc::ddtPhiCorr(rAUs[phasei], alpha, phase.U(), phase.phi()) ); - mrfZones.relativeFlux(phase.phi()); phase.phi() += rAlphaAUfs[phasei]*(g & mesh.Sf()); @@ -241,7 +241,6 @@ } } - phase.U() = fvc::reconstruct(phase.phi()); phase.U().correctBoundaryConditions(); U += alpha*phase.U(); diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index e81819706f..337a971fb1 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -127,7 +127,6 @@ $(derivedFvPatchFields)/fan/fanFvPatchFields.C $(derivedFvPatchFields)/fanPressure/fanPressureFvPatchScalarField.C $(derivedFvPatchFields)/buoyantPressure/buoyantPressureFvPatchScalarField.C $(derivedFvPatchFields)/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C -$(derivedFvPatchFields)/multiphaseFixedFluxPressure/multiphaseFixedFluxPressureFvPatchScalarField.C $(derivedFvPatchFields)/fixedInternalValueFvPatchField/fixedInternalValueFvPatchFields.C $(derivedFvPatchFields)/fixedNormalSlip/fixedNormalSlipFvPatchFields.C $(derivedFvPatchFields)/fixedPressureCompressibleDensity/fixedPressureCompressibleDensityFvPatchScalarField.C diff --git a/src/finiteVolume/fields/fvPatchFields/derived/multiphaseFixedFluxPressure/multiphaseFixedFluxPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/multiphaseFixedFluxPressure/multiphaseFixedFluxPressureFvPatchScalarField.C deleted file mode 100644 index be534fb8fa..0000000000 --- a/src/finiteVolume/fields/fvPatchFields/derived/multiphaseFixedFluxPressure/multiphaseFixedFluxPressureFvPatchScalarField.C +++ /dev/null @@ -1,177 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "multiphaseFixedFluxPressureFvPatchScalarField.H" -#include "fvPatchFieldMapper.H" -#include "volFields.H" -#include "surfaceFields.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::multiphaseFixedFluxPressureFvPatchScalarField:: -multiphaseFixedFluxPressureFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF -) -: - fixedGradientFvPatchScalarField(p, iF), - UName_("U"), - phiName_("phi"), - rhoName_("rho") -{} - - -Foam::multiphaseFixedFluxPressureFvPatchScalarField:: -multiphaseFixedFluxPressureFvPatchScalarField -( - const multiphaseFixedFluxPressureFvPatchScalarField& ptf, - const fvPatch& p, - const DimensionedField& iF, - const fvPatchFieldMapper& mapper -) -: - fixedGradientFvPatchScalarField(ptf, p, iF, mapper), - UName_(ptf.UName_), - phiName_(ptf.phiName_), - rhoName_(ptf.rhoName_) -{} - - -Foam::multiphaseFixedFluxPressureFvPatchScalarField:: -multiphaseFixedFluxPressureFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF, - const dictionary& dict -) -: - fixedGradientFvPatchScalarField(p, iF), - UName_(dict.lookupOrDefault("U", "U")), - phiName_(dict.lookupOrDefault("phi", "phi")), - rhoName_(dict.lookupOrDefault("rho", "rho")) -{ - if (dict.found("gradient")) - { - gradient() = scalarField("gradient", dict, p.size()); - fixedGradientFvPatchScalarField::updateCoeffs(); - fixedGradientFvPatchScalarField::evaluate(); - } - else - { - fvPatchField::operator=(patchInternalField()); - gradient() = 0.0; - } -} - - -Foam::multiphaseFixedFluxPressureFvPatchScalarField:: -multiphaseFixedFluxPressureFvPatchScalarField -( - const multiphaseFixedFluxPressureFvPatchScalarField& wbppsf -) -: - fixedGradientFvPatchScalarField(wbppsf), - UName_(wbppsf.UName_), - phiName_(wbppsf.phiName_), - rhoName_(wbppsf.rhoName_) -{} - - -Foam::multiphaseFixedFluxPressureFvPatchScalarField:: -multiphaseFixedFluxPressureFvPatchScalarField -( - const multiphaseFixedFluxPressureFvPatchScalarField& wbppsf, - const DimensionedField& iF -) -: - fixedGradientFvPatchScalarField(wbppsf, iF), - UName_(wbppsf.UName_), - phiName_(wbppsf.phiName_), - rhoName_(wbppsf.rhoName_) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::multiphaseFixedFluxPressureFvPatchScalarField::updateCoeffs() -{ - if (updated()) - { - return; - } - - const fvPatchField& Up = - patch().lookupPatchField(UName_); - - const surfaceScalarField& phi = - db().lookupObject(phiName_); - - fvsPatchField phip = - patch().patchField(phi); - - if (phi.dimensions() == dimDensity*dimVelocity*dimArea) - { - const fvPatchField& rhop = - patch().lookupPatchField(rhoName_); - - phip /= rhop; - } - - const fvsPatchField& Dpp = - patch().lookupPatchField("Dp"); - - gradient() = (phip - (patch().Sf() & Up))/patch().magSf()/Dpp; - - fixedGradientFvPatchScalarField::updateCoeffs(); -} - - -void Foam::multiphaseFixedFluxPressureFvPatchScalarField::write -( - Ostream& os -) const -{ - fvPatchScalarField::write(os); - writeEntryIfDifferent(os, "U", "U", UName_); - writeEntryIfDifferent(os, "phi", "phi", phiName_); - writeEntryIfDifferent(os, "rho", "rho", rhoName_); - gradient().writeEntry("gradient", os); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - makePatchTypeField - ( - fvPatchScalarField, - multiphaseFixedFluxPressureFvPatchScalarField - ); -} - -// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/multiphaseFixedFluxPressure/multiphaseFixedFluxPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/multiphaseFixedFluxPressure/multiphaseFixedFluxPressureFvPatchScalarField.H deleted file mode 100644 index b97001a5c0..0000000000 --- a/src/finiteVolume/fields/fvPatchFields/derived/multiphaseFixedFluxPressure/multiphaseFixedFluxPressureFvPatchScalarField.H +++ /dev/null @@ -1,154 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Class - Foam::multiphaseFixedFluxPressureFvPatchScalarField - -Description - Foam::multiphaseFixedFluxPressureFvPatchScalarField - -SourceFiles - multiphaseFixedFluxPressureFvPatchScalarField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef multiphaseFixedFluxPressureFvPatchScalarFields_H -#define multiphaseFixedFluxPressureFvPatchScalarFields_H - -#include "fvPatchFields.H" -#include "fixedGradientFvPatchFields.H" -#include "Switch.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class multiphaseFixedFluxPressureFvPatch Declaration -\*---------------------------------------------------------------------------*/ - -class multiphaseFixedFluxPressureFvPatchScalarField -: - public fixedGradientFvPatchScalarField -{ - // Private data - - //- Name of the velocity field - word UName_; - - //- Name of the flux transporting the field - word phiName_; - - //- Name of the density field used to normalise the mass flux - // if neccessary - word rhoName_; - - -public: - - //- Runtime type information - TypeName("multiphaseFixedFluxPressure"); - - - // Constructors - - //- Construct from patch and internal field - multiphaseFixedFluxPressureFvPatchScalarField - ( - const fvPatch&, - const DimensionedField& - ); - - //- Construct from patch, internal field and dictionary - multiphaseFixedFluxPressureFvPatchScalarField - ( - const fvPatch&, - const DimensionedField&, - const dictionary& - ); - - //- Construct by mapping given - // multiphaseFixedFluxPressureFvPatchScalarField onto a new patch - multiphaseFixedFluxPressureFvPatchScalarField - ( - const multiphaseFixedFluxPressureFvPatchScalarField&, - const fvPatch&, - const DimensionedField&, - const fvPatchFieldMapper& - ); - - //- Construct as copy - multiphaseFixedFluxPressureFvPatchScalarField - ( - const multiphaseFixedFluxPressureFvPatchScalarField& - ); - - //- Construct and return a clone - virtual tmp clone() const - { - return tmp - ( - new multiphaseFixedFluxPressureFvPatchScalarField(*this) - ); - } - - //- Construct as copy setting internal field reference - multiphaseFixedFluxPressureFvPatchScalarField - ( - const multiphaseFixedFluxPressureFvPatchScalarField&, - const DimensionedField& - ); - - //- Construct and return a clone setting internal field reference - virtual tmp clone - ( - const DimensionedField& iF - ) const - { - return tmp - ( - new multiphaseFixedFluxPressureFvPatchScalarField(*this, iF) - ); - } - - - // Member functions - - //- Update the coefficients associated with the patch field - virtual void updateCoeffs(); - - //- Write - virtual void write(Ostream&) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/system/fvSolution b/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/system/fvSolution index 9379d3029f..cf4ce79ecf 100644 --- a/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/system/fvSolution +++ b/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/system/fvSolution @@ -97,18 +97,12 @@ PIMPLE relaxationFactors { - fields - { - } - equations - { - "U.*" 1; - "T.*" 1; - "alpha.*" 1; - "Theta.*" 1; - "k.*" 1; - "epsilon.*" 1; - } + "U.*" 1; + "T.*" 1; + "alpha.*" 1; + "Theta.*" 1; + "k.*" 1; + "epsilon.*" 1; } diff --git a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/system/fvSolution b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/system/fvSolution index 39c47f6efc..296b0cd488 100644 --- a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/system/fvSolution +++ b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/system/fvSolution @@ -88,13 +88,7 @@ PIMPLE relaxationFactors { - fields - { - } - equations - { - "U.*" 1; - } + "U.*" 1; } // ************************************************************************* //