From 36ee6e82627f76fdf5f4c0d0278431878ab2f495 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 15 Sep 2011 12:49:03 +0100 Subject: [PATCH 1/4] BUG: Added missing exit() on fatal error --- .../general/solutionControl/solutionControl/solutionControl.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C index e1ea4007d5..1e4eadce04 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C @@ -76,7 +76,8 @@ void Foam::solutionControl::read(const bool absTolOnly) { FatalErrorIn("bool Foam::solutionControl::read()") << "Residual data for " << iter().keyword() - << " must be specified as a dictionary"; + << " must be specified as a dictionary" + << exit(FatalError); } } From 72a2f9b45cb466635e83c76a9f217a53fa4087e8 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 16 Sep 2011 19:18:19 +0100 Subject: [PATCH 2/4] 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; } // ************************************************************************* // From a47a04b55c85adabe30ddd5fa0f7b4e9b45bbb6f Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 19 Sep 2011 15:06:11 +0100 Subject: [PATCH 3/4] Added support for building on SGI machines --- etc/config/settings.csh | 8 ++++++++ etc/config/settings.sh | 8 ++++++++ wmake/rules/General/mplibSGIMPI | 3 +++ 3 files changed, 19 insertions(+) create mode 100644 wmake/rules/General/mplibSGIMPI diff --git a/etc/config/settings.csh b/etc/config/settings.csh index 457c1fd8ad..93f3e506ab 100644 --- a/etc/config/settings.csh +++ b/etc/config/settings.csh @@ -486,6 +486,14 @@ case QSMPI: _foamAddLib $MPI_ARCH_PATH/lib breaksw +case SGIMPI: + setenv FOAM_MPI ${MPI_ROOT##*/} + setenv MPI_ARCH_PATH $MPI_ROOT + + _foamAddPath $MPI_ARCH_PATH/bin + _foamAddLib $MPI_ARCH_PATH/lib + breaksw + default: setenv FOAM_MPI dummy breaksw diff --git a/etc/config/settings.sh b/etc/config/settings.sh index 8297f43dea..5111ef405a 100644 --- a/etc/config/settings.sh +++ b/etc/config/settings.sh @@ -510,6 +510,14 @@ QSMPI) _foamAddLib $MPI_ARCH_PATH/lib ;; +SGIMPI) + export FOAM_MPI=${MPI_ROOT##*/} + export MPI_ARCH_PATH=$MPI_ROOT + + _foamAddPath $MPI_ARCH_PATH/bin + _foamAddLib $MPI_ARCH_PATH/lib + ;; + *) export FOAM_MPI=dummy ;; diff --git a/wmake/rules/General/mplibSGIMPI b/wmake/rules/General/mplibSGIMPI new file mode 100644 index 0000000000..8595264660 --- /dev/null +++ b/wmake/rules/General/mplibSGIMPI @@ -0,0 +1,3 @@ +PFLAGS = -DSGIMPI -DMPI_NO_CPPBIND +PINC = -I$(MPI_ARCH_PATH)/include +PLIBS = -L$(MPI_ARCH_PATH)/lib -lmpi From 295c6176f2af51d06dab5a4f12b14fb36e683a49 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 19 Sep 2011 17:56:42 +0100 Subject: [PATCH 4/4] ENH: Only output local forces/moments when needed --- .../functionObjects/forces/forces/forces.C | 73 ++++++++++++------- .../functionObjects/forces/forces/forces.H | 3 + 2 files changed, 49 insertions(+), 27 deletions(-) diff --git a/src/postProcessing/functionObjects/forces/forces/forces.C b/src/postProcessing/functionObjects/forces/forces/forces.C index d585569649..b23a6d2328 100644 --- a/src/postProcessing/functionObjects/forces/forces/forces.C +++ b/src/postProcessing/functionObjects/forces/forces/forces.C @@ -190,6 +190,7 @@ Foam::forces::forces rhoRef_(VGREAT), pRef_(0), coordSys_(), + localSystem_(false), forcesFilePtr_(NULL) { // Check if the available mesh is an fvMesh otherise deactivate @@ -239,6 +240,7 @@ Foam::forces::forces rhoRef_(rhoInf), pRef_(pRef), coordSys_(coordSys), + localSystem_(false), forcesFilePtr_(NULL) {} @@ -330,6 +332,7 @@ void Foam::forces::read(const dictionary& dict) if (!dict.readIfPresent("CofR", coordSys_.origin())) { coordSys_ = coordinateSystem(dict, obr_); + localSystem_ = true; } } } @@ -382,10 +385,17 @@ void Foam::forces::writeFileHeader() { forcesFilePtr_() << "# Time" << tab - << "forces(pressure, viscous) moment(pressure, viscous)" - << tab - << "local forces(pressure, viscous) local moment(pressure, viscous)" - << endl; + << "forces(pressure, viscous) moment(pressure, viscous)"; + + if (localSystem_) + { + forcesFilePtr_() + << tab + << "local forces(pressure, viscous) " + << "local moment(pressure, viscous)"; + } + + forcesFilePtr_()<< endl; } } @@ -413,33 +423,42 @@ void Foam::forces::write() if (Pstream::master()) { - forcesMoments fmLocal; - - fmLocal.first().first() = - coordSys_.localVector(fm.first().first()); - - fmLocal.first().second() = - coordSys_.localVector(fm.first().second()); - - fmLocal.second().first() = - coordSys_.localVector(fm.second().first()); - - fmLocal.second().second() = - coordSys_.localVector(fm.second().second()); - - forcesFilePtr_() << obr_.time().value() - << tab << fm - << tab << fmLocal << endl; - if (log_) { Info<< "forces output:" << nl << " forces(pressure, viscous)" << fm.first() << nl - << " moment(pressure, viscous)" << fm.second() << nl - << " local:" << nl - << " forces(pressure, viscous)" << fmLocal.first() << nl - << " moment(pressure, viscous)" << fmLocal.second() << nl - << endl; + << " moment(pressure, viscous)" << fm.second() << nl; + + forcesFilePtr_() << obr_.time().value() << tab << fm; + + if (localSystem_) + { + forcesMoments fmLocal; + + fmLocal.first().first() = + coordSys_.localVector(fm.first().first()); + + fmLocal.first().second() = + coordSys_.localVector(fm.first().second()); + + fmLocal.second().first() = + coordSys_.localVector(fm.second().first()); + + fmLocal.second().second() = + coordSys_.localVector(fm.second().second()); + + forcesFilePtr_() << tab << fmLocal; + + + Info<< " local:" << nl + << " forces(pressure, viscous)" << fmLocal.first() + << nl + << " moment(pressure, viscous)" << fmLocal.second() + << nl; + } + + forcesFilePtr_() << endl; + Info<< endl; } } } diff --git a/src/postProcessing/functionObjects/forces/forces/forces.H b/src/postProcessing/functionObjects/forces/forces/forces.H index eb46c057d5..3d14768b2b 100644 --- a/src/postProcessing/functionObjects/forces/forces/forces.H +++ b/src/postProcessing/functionObjects/forces/forces/forces.H @@ -165,6 +165,9 @@ protected: //- Coordinate system used when evaluting forces/moments coordinateSystem coordSys_; + //- Flag to indicate whether we are using a local co-ordinate sys + bool localSystem_; + //- Forces/moment file ptr autoPtr forcesFilePtr_;