diff --git a/applications/solvers/combustion/dieselEngineFoam/createFields.H b/applications/solvers/combustion/dieselEngineFoam/createFields.H index a75c6a7d07..37aeca4c09 100644 --- a/applications/solvers/combustion/dieselEngineFoam/createFields.H +++ b/applications/solvers/combustion/dieselEngineFoam/createFields.H @@ -6,7 +6,7 @@ autoPtr pChemistry ); psiChemistryModel& chemistry = pChemistry(); -hCombustionThermo& thermo = chemistry.thermo(); +hsCombustionThermo& thermo = chemistry.thermo(); basicMultiComponentMixture& composition = thermo.composition(); PtrList& Y = composition.Y(); @@ -50,7 +50,7 @@ volVectorField U volScalarField& p = thermo.p(); const volScalarField& psi = thermo.psi(); const volScalarField& T = thermo.T(); -volScalarField& h = thermo.h(); +volScalarField& hs = thermo.hs(); #include "compressibleCreatePhi.H" @@ -92,4 +92,18 @@ forAll(Y, i) { fields.add(Y[i]); } -fields.add(h); +fields.add(hs); + +DimensionedField chemistrySh +( + IOobject + ( + "chemistry::Sh", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("chemistrySh", dimEnergy/dimTime/dimVolume, 0.0) +); diff --git a/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C b/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C index 6507c117a0..2e6a9c4b05 100644 --- a/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C +++ b/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Application - dieselFoam + dieselEngineFoam Description Solver for diesel engine spray and combustion. @@ -103,13 +103,15 @@ int main(int argc, char *argv[]) kappa = (runTime.deltaT() + tc)/(runTime.deltaT() + tc + tk); } + chemistrySh = kappa*chemistry.Sh()(); + #include "rhoEqn.H" #include "UEqn.H" for (label ocorr=1; ocorr <= nOuterCorr; ocorr++) { #include "YEqn.H" - #include "hEqn.H" + #include "hsEqn.H" // --- PISO loop for (int corr=1; corr<=nCorr; corr++) diff --git a/applications/solvers/combustion/dieselEngineFoam/hEqn.H b/applications/solvers/combustion/dieselEngineFoam/hEqn.H deleted file mode 100644 index 0406f7fbd4..0000000000 --- a/applications/solvers/combustion/dieselEngineFoam/hEqn.H +++ /dev/null @@ -1,13 +0,0 @@ -{ - solve - ( - fvm::ddt(rho, h) - + mvConvection->fvmDiv(phi, h) - - fvm::laplacian(turbulence->alphaEff(), h) - == - DpDt - + dieselSpray.heatTransferSource() - ); - - thermo.correct(); -} diff --git a/applications/solvers/combustion/dieselEngineFoam/hsEqn.H b/applications/solvers/combustion/dieselEngineFoam/hsEqn.H new file mode 100644 index 0000000000..7ae59feb81 --- /dev/null +++ b/applications/solvers/combustion/dieselEngineFoam/hsEqn.H @@ -0,0 +1,14 @@ +{ + solve + ( + fvm::ddt(rho, hs) + + mvConvection->fvmDiv(phi, hs) + - fvm::laplacian(turbulence->alphaEff(), hs) + == + DpDt + + dieselSpray.heatTransferSource()().dimensionedInternalField() + + chemistrySh + ); + + thermo.correct(); +} diff --git a/applications/solvers/combustion/dieselFoam/dieselFoam.C b/applications/solvers/combustion/dieselFoam/dieselFoam.C index 4769a00c77..1e6ddfe0c1 100644 --- a/applications/solvers/combustion/dieselFoam/dieselFoam.C +++ b/applications/solvers/combustion/dieselFoam/dieselFoam.C @@ -100,7 +100,7 @@ int main(int argc, char *argv[]) for (label ocorr=1; ocorr <= nOuterCorr; ocorr++) { #include "YEqn.H" - #include "hEqn.H" + #include "hsEqn.H" // --- PISO loop for (int corr=1; corr<=nCorr; corr++) diff --git a/applications/solvers/combustion/fireFoam/Allwclean b/applications/solvers/combustion/fireFoam/Allwclean new file mode 100755 index 0000000000..713a055201 --- /dev/null +++ b/applications/solvers/combustion/fireFoam/Allwclean @@ -0,0 +1,8 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory +set -x + +wclean libso combustionModels +wclean + +# ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/combustion/fireFoam/Allwmake b/applications/solvers/combustion/fireFoam/Allwmake new file mode 100755 index 0000000000..f32c72860d --- /dev/null +++ b/applications/solvers/combustion/fireFoam/Allwmake @@ -0,0 +1,8 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory +set -x + +wmake libso combustionModels +wmake + +# ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/combustion/fireFoam/Make/files b/applications/solvers/combustion/fireFoam/Make/files new file mode 100644 index 0000000000..826d736bd0 --- /dev/null +++ b/applications/solvers/combustion/fireFoam/Make/files @@ -0,0 +1,4 @@ +fireFoam.C + +EXE = $(FOAM_APPBIN)/fireFoam + diff --git a/applications/solvers/combustion/fireFoam/Make/options b/applications/solvers/combustion/fireFoam/Make/options new file mode 100644 index 0000000000..3b19a78173 --- /dev/null +++ b/applications/solvers/combustion/fireFoam/Make/options @@ -0,0 +1,19 @@ +EXE_INC = \ + -I./combustionModels/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ + -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude + + +EXE_LIBS = \ + -lcombustionModels \ + -lspecie \ + -lreactionThermophysicalModels \ + -lbasicThermophysicalModels \ + -lfiniteVolume \ + -lcompressibleLESModels \ + -lcompressibleRASModels \ + -lradiation diff --git a/applications/solvers/combustion/fireFoam/UEqn.H b/applications/solvers/combustion/fireFoam/UEqn.H new file mode 100644 index 0000000000..3b61f2c7b9 --- /dev/null +++ b/applications/solvers/combustion/fireFoam/UEqn.H @@ -0,0 +1,36 @@ +fvVectorMatrix UEqn +( + fvm::ddt(rho, U) + + fvm::div(phi, U) + + turbulence->divDevRhoReff(U) +); + +UEqn.relax(); + +if (oCorr == nOuterCorr - 1) +{ + solve + ( + UEqn + == + fvc::reconstruct + ( + fvc::interpolate(rho)*(g & mesh.Sf()) + - fvc::snGrad(p)*mesh.magSf() + ), + mesh.solver("UFinal") + ); +} +else +{ + solve + ( + UEqn + == + fvc::reconstruct + ( + fvc::interpolate(rho)*(g & mesh.Sf()) + - fvc::snGrad(p)*mesh.magSf() + ) + ); +} diff --git a/applications/solvers/combustion/fireFoam/combustionModels/Make/files b/applications/solvers/combustion/fireFoam/combustionModels/Make/files new file mode 100644 index 0000000000..5b1262b70d --- /dev/null +++ b/applications/solvers/combustion/fireFoam/combustionModels/Make/files @@ -0,0 +1,9 @@ +combustionModel/combustionModel.C +combustionModel/newCombustionModel.C + +infinitelyFastChemistry/infinitelyFastChemistry.C + +noCombustion/noCombustion.C + +LIB = $(FOAM_LIBBIN)/libcombustionModels + diff --git a/applications/solvers/combustion/fireFoam/combustionModels/Make/options b/applications/solvers/combustion/fireFoam/combustionModels/Make/options new file mode 100644 index 0000000000..42f59c8e17 --- /dev/null +++ b/applications/solvers/combustion/fireFoam/combustionModels/Make/options @@ -0,0 +1,11 @@ +EXE_INC = \ + -I../sensibleEnthalpyCombustionThermophysicalModels/basic/lnInclude \ + -I../sensibleEnthalpyCombustionThermophysicalModels/reactionThermo/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(FOAM_SRC)/turbulenceModels/compressible/turbulenceModel \ + -I$(FOAM_SRC)/finiteVolume/lnInclude + +LIB_LIBS = \ + -lfiniteVolume diff --git a/applications/solvers/combustion/fireFoam/combustionModels/combustionModel/combustionModel.C b/applications/solvers/combustion/fireFoam/combustionModels/combustionModel/combustionModel.C new file mode 100644 index 0000000000..538d43073e --- /dev/null +++ b/applications/solvers/combustion/fireFoam/combustionModels/combustionModel/combustionModel.C @@ -0,0 +1,109 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "combustionModel.H" +#include "fvm.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(combustionModel, 0); + defineRunTimeSelectionTable(combustionModel, dictionary); +}; + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::combustionModel::combustionModel +( + const dictionary& combustionProperties, + const hsCombustionThermo& thermo, + const compressible::turbulenceModel& turbulence, + const surfaceScalarField& phi, + const volScalarField& rho +) +: + combustionModelCoeffs_ + ( + combustionProperties.subDict + ( + word(combustionProperties.lookup("combustionModel")) + "Coeffs" + ) + ), + thermo_(thermo), + turbulence_(turbulence), + mesh_(phi.mesh()), + phi_(phi), + rho_(rho), + stoicRatio_(thermo.lookup("stoichiometricAirFuelMassRatio")), + s_(thermo.lookup("stoichiometricOxygenFuelMassRatio")), + qFuel_(thermo_.lookup("qFuel")), + composition_(thermo.composition()) +{} + + +// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // + +Foam::combustionModel::~combustionModel() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::tmp +Foam::combustionModel::combustionModel::R(volScalarField& fu) const +{ + const basicMultiComponentMixture& composition = thermo_.composition(); + const volScalarField& ft = composition.Y("ft"); + volScalarField fres = composition.fres(ft, stoicRatio_.value()); + volScalarField wFuelNorm = this->wFuelNorm()*pos(fu - fres); + + return wFuelNorm*fres - fvm::Sp(wFuelNorm, fu); +} + + +Foam::tmp Foam::combustionModel::combustionModel::dQ +( + const fvScalarMatrix& Rfu +) const +{ + const basicMultiComponentMixture& composition = thermo_.composition(); + const volScalarField& fu = composition.Y("fu"); + + return (-qFuel_)*(Rfu & fu); +} + + +bool Foam::combustionModel::read(const dictionary& combustionProperties) +{ + combustionModelCoeffs_ = combustionProperties.subDict(type() + "Coeffs"); + + return true; +} + + +// ************************************************************************* // diff --git a/applications/solvers/combustion/fireFoam/combustionModels/combustionModel/combustionModel.H b/applications/solvers/combustion/fireFoam/combustionModels/combustionModel/combustionModel.H new file mode 100644 index 0000000000..19a3392bbb --- /dev/null +++ b/applications/solvers/combustion/fireFoam/combustionModels/combustionModel/combustionModel.H @@ -0,0 +1,210 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::combustionModel + +Description + Base class for all non-premixed combustion models. + +SourceFiles + combustionModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef combustionModel_H +#define combustionModel_H + +#include "IOdictionary.H" +#include "hsCombustionThermo.H" +#include "turbulenceModel.H" +#include "multivariateSurfaceInterpolationScheme.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class combustionModel Declaration +\*---------------------------------------------------------------------------*/ + +class combustionModel +{ + +protected: + + // Protected data + + //- Dictionary of coefficients for the particular model + dictionary combustionModelCoeffs_; + + //- Reference to the thermodynamic + const hsCombustionThermo& thermo_; + + //- Reference to the turbulence model + const compressible::turbulenceModel& turbulence_; + + //- Reference to the mesh database + const fvMesh& mesh_; + + //- Reference to mass-flux field + const surfaceScalarField& phi_; + + //- Reference to the density field + const volScalarField& rho_; + + //- Stoichiometric air-fuel mass ratio + dimensionedScalar stoicRatio_; + + //- Stoichiometric oxygen-fuel mass ratio + dimensionedScalar s_; + + //- Heat of combustion (J/Kg) + dimensionedScalar qFuel_; + + +private: + + // Private Member Functions + + //- Disallow copy construct + combustionModel(const combustionModel&); + + //- Disallow default bitwise assignment + void operator=(const combustionModel&); + + const basicMultiComponentMixture& composition_; + + +public: + + //- Runtime type information + TypeName("combustionModel"); + + + // Declare run-time constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + combustionModel, + dictionary, + ( + const dictionary& combustionProperties, + const hsCombustionThermo& thermo, + const compressible::turbulenceModel& turbulence, + const surfaceScalarField& phi, + const volScalarField& rho + ), + ( + combustionProperties, + thermo, + turbulence, + phi, + rho + ) + ); + + + // Selectors + + //- Return a reference to the selected combustion model + static autoPtr New + ( + const dictionary& combustionProperties, + const hsCombustionThermo& thermo, + const compressible::turbulenceModel& turbulence, + const surfaceScalarField& phi, + const volScalarField& rho + ); + + + // Constructors + + //- Construct from components + combustionModel + ( + const dictionary& combustionProperties, + const hsCombustionThermo& thermo, + const compressible::turbulenceModel& turbulence, + const surfaceScalarField& phi, + const volScalarField& rho + ); + + + //- Destructor + virtual ~combustionModel(); + + + // Member Functions + + // Access functions + + //- Access composition + const basicMultiComponentMixture& composition() const + { + return composition_; + } + + //- Access combustion dictionary + const dictionary combustionModelCoeffs() const + { + return combustionModelCoeffs_; + } + + //- Access heat of combustion + const dimensionedScalar qFuel() const + { + return qFuel_; + } + + //- Return normalised consumption rate of (fu - fres) + virtual tmp wFuelNorm() const = 0; + + //- Fuel consumption rate matrix i.e. source-term for the fuel equation + virtual tmp R(volScalarField& fu) const; + + //- Heat-release rate calculated from the given + // fuel consumption rate matrix + virtual tmp dQ(const fvScalarMatrix& Rfu) const; + + //- Correct combustion rate + virtual void correct() = 0; + + //- Update properties from given dictionary + virtual bool read(const dictionary& combustionProperties) = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/combustion/fireFoam/combustionModels/combustionModel/newCombustionModel.C b/applications/solvers/combustion/fireFoam/combustionModels/combustionModel/newCombustionModel.C new file mode 100644 index 0000000000..31308b8ccd --- /dev/null +++ b/applications/solvers/combustion/fireFoam/combustionModels/combustionModel/newCombustionModel.C @@ -0,0 +1,67 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "combustionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::combustionModel::New +( + const dictionary& combustionProperties, + const hsCombustionThermo& thermo, + const compressible::turbulenceModel& turbulence, + const surfaceScalarField& phi, + const volScalarField& rho +) +{ + word combustionModelTypeName = combustionProperties.lookup + ( + "combustionModel" + ); + + Info<< "Selecting combustion model " << combustionModelTypeName << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(combustionModelTypeName); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "combustionModel::New" + ) << "Unknown combustionModel type " + << combustionModelTypeName << endl << endl + << "Valid combustionModels are : " << endl + << dictionaryConstructorTablePtr_->toc() + << exit(FatalError); + } + + return autoPtr + (cstrIter()(combustionProperties, thermo, turbulence, phi, rho)); +} + + +// ************************************************************************* // diff --git a/applications/solvers/combustion/fireFoam/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C b/applications/solvers/combustion/fireFoam/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C new file mode 100644 index 0000000000..2e040e1eac --- /dev/null +++ b/applications/solvers/combustion/fireFoam/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C @@ -0,0 +1,94 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "infinitelyFastChemistry.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace combustionModels +{ + defineTypeNameAndDebug(infinitelyFastChemistry, 0); + addToRunTimeSelectionTable + ( + combustionModel, + infinitelyFastChemistry, + dictionary + ); +}; +}; + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::combustionModels::infinitelyFastChemistry::infinitelyFastChemistry +( + const dictionary& combustionProperties, + const hsCombustionThermo& thermo, + const compressible::turbulenceModel& turbulence, + const surfaceScalarField& phi, + const volScalarField& rho +) +: + combustionModel(combustionProperties, thermo, turbulence, phi, rho), + C_(readScalar(combustionModelCoeffs_.lookup("C"))) +{} + + +// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // + +Foam::combustionModels::infinitelyFastChemistry::~infinitelyFastChemistry() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::combustionModels::infinitelyFastChemistry::correct() +{} + + +Foam::tmp +Foam::combustionModels::infinitelyFastChemistry::wFuelNorm() const +{ + return rho_/(mesh_.time().deltaT()*C_); +} + + +bool Foam::combustionModels::infinitelyFastChemistry::read +( + const dictionary& combustionProperties +) +{ + combustionModel::read(combustionProperties); + combustionModelCoeffs_.lookup("C") >> C_ ; + + return true; +} + + +// ************************************************************************* // diff --git a/applications/solvers/combustion/fireFoam/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.H b/applications/solvers/combustion/fireFoam/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.H new file mode 100644 index 0000000000..4c62e5fa03 --- /dev/null +++ b/applications/solvers/combustion/fireFoam/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.H @@ -0,0 +1,119 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::combustionModels::infinitelyFastChemistry + +Description + Simple infinitely fast chemistry combustion model based on the principle + mixed is burnt. Additional parameter C is used to distribute the heat + release rate.in time + +SourceFiles + infinitelyFastChemistry.C + +\*---------------------------------------------------------------------------*/ + +#ifndef infinitelyFastChemistry_H +#define infinitelyFastChemistry_H + +#include "fvc.H" +#include "combustionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace combustionModels +{ + +/*---------------------------------------------------------------------------*\ + Class infinitelyFastChemistry Declaration +\*---------------------------------------------------------------------------*/ + +class infinitelyFastChemistry +: + public combustionModel +{ + // Private data + + //- Model constant + scalar C_; + + // Private Member Functions + + //- Disallow copy construct + infinitelyFastChemistry(const infinitelyFastChemistry&); + + //- Disallow default bitwise assignment + void operator=(const infinitelyFastChemistry&); + + +public: + + //- Runtime type information + TypeName("infinitelyFastChemistry"); + + + // Constructors + + //- Construct from components + infinitelyFastChemistry + ( + const dictionary& combustionProperties, + const hsCombustionThermo& thermo, + const compressible::turbulenceModel& turbulence, + const surfaceScalarField& phi, + const volScalarField& rho + ); + + + // Destructor + + virtual ~infinitelyFastChemistry(); + + + // Member Functions + + //- Update properties from given dictionary + virtual bool read(const dictionary& combustionProperties); + + //- Correct combustion rate + virtual void correct(); + + //- Return normalised consumption rate of (fu - fres) + virtual tmp wFuelNorm() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace combustionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/combustion/fireFoam/combustionModels/noCombustion/noCombustion.C b/applications/solvers/combustion/fireFoam/combustionModels/noCombustion/noCombustion.C new file mode 100644 index 0000000000..dd75660aae --- /dev/null +++ b/applications/solvers/combustion/fireFoam/combustionModels/noCombustion/noCombustion.C @@ -0,0 +1,103 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "noCombustion.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace combustionModels +{ + defineTypeNameAndDebug(noCombustion, 0); + addToRunTimeSelectionTable + ( + combustionModel, + noCombustion, + dictionary + ); +}; +}; + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::combustionModels::noCombustion::noCombustion +( + const dictionary& combustionProperties, + const hsCombustionThermo& thermo, + const compressible::turbulenceModel& turbulence, + const surfaceScalarField& phi, + const volScalarField& rho +) +: + combustionModel(combustionProperties, thermo, turbulence, phi, rho) +{} + + +// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // + +Foam::combustionModels::noCombustion::~noCombustion() +{} + + +void Foam::combustionModels::noCombustion::correct() +{} + + +Foam::tmp +Foam::combustionModels::noCombustion::wFuelNorm() const +{ + return tmp + ( + new volScalarField + ( + IOobject + ( + "wFuelNorm", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimensionedScalar("wFuelNorm", dimMass/dimTime/pow3(dimLength), 0.0) + ) + ); +} + + +bool Foam::combustionModels::noCombustion::read +( + const dictionary& combustionProperties +) +{ + return combustionModel::read(combustionProperties); +} + + +// ************************************************************************* // diff --git a/applications/solvers/combustion/fireFoam/combustionModels/noCombustion/noCombustion.H b/applications/solvers/combustion/fireFoam/combustionModels/noCombustion/noCombustion.H new file mode 100644 index 0000000000..e381413cd8 --- /dev/null +++ b/applications/solvers/combustion/fireFoam/combustionModels/noCombustion/noCombustion.H @@ -0,0 +1,113 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::combustionModel::noCombustion + +Description + No combustion + +SourceFiles + noCombustion.C + +\*---------------------------------------------------------------------------*/ + +#ifndef noCombustion_H +#define noCombustion_H + +#include "combustionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace combustionModels +{ + +/*---------------------------------------------------------------------------*\ + Class noCombustion Declaration +\*---------------------------------------------------------------------------*/ + +class noCombustion +: + public combustionModel +{ + // Private data + + + // Private Member Functions + + //- Disallow copy construct + noCombustion(const noCombustion&); + + //- Disallow default bitwise assignment + void operator=(const noCombustion&); + + +public: + + //- Runtime type information + TypeName("noCombustion"); + + + // Constructors + + //- Construct from components + noCombustion + ( + const dictionary& combustionProperties, + const hsCombustionThermo& thermo, + const compressible::turbulenceModel& turbulence, + const surfaceScalarField& phi, + const volScalarField& rho + ); + + + // Destructor + + virtual ~noCombustion(); + + // Member Functions + + //- Update properties from given dictionary + virtual bool read(const dictionary& combustionProperties); + + //- Correct combustion rate + virtual void correct(); + + //- Return normalised consumption rate of (fu - fres) + virtual tmp wFuelNorm() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace combustionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/combustion/fireFoam/createFields.H b/applications/solvers/combustion/fireFoam/createFields.H new file mode 100644 index 0000000000..a399df8536 --- /dev/null +++ b/applications/solvers/combustion/fireFoam/createFields.H @@ -0,0 +1,130 @@ +Info<< "Reading thermophysical properties\n" << endl; + +autoPtr pThermo +( + hsCombustionThermo::New(mesh) +); + +hsCombustionThermo& thermo = pThermo(); + +basicMultiComponentMixture& composition = thermo.composition(); + +volScalarField rho +( + IOobject + ( + "rho", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + thermo.rho() +); + +dimensionedScalar stoicRatio +( + thermo.lookup("stoichiometricAirFuelMassRatio") +); + +volScalarField& p = thermo.p(); +volScalarField& hs = thermo.hs(); + +const volScalarField& psi = thermo.psi(); + +volScalarField& ft = composition.Y("ft"); +volScalarField& fu = composition.Y("fu"); + +Info<< "Reading field U\n" << endl; + +volVectorField U +( + IOobject + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +#include "compressibleCreatePhi.H" + +Info<< "Creating turbulence model\n" << endl; +autoPtr turbulence +( + compressible::turbulenceModel::New(rho, U, phi, thermo) +); + +IOdictionary combustionProperties +( + IOobject + ( + "combustionProperties", + runTime.constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) +); + +Info<< "Creating combustion model\n" << endl; +autoPtr combustion +( + combustionModel::combustionModel::New + ( + combustionProperties, + thermo, + turbulence(), + phi, + rho + ) +); + +volScalarField dQ +( + IOobject + ( + "dQ", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar("dQ", dimMass/pow3(dimTime)/dimLength, 0.0) +); + + +Info<< "Creating field DpDt\n" << endl; +volScalarField DpDt = + fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); + + +Info<< "Calculating field g.h\n" << endl; +volScalarField gh("gh", g & mesh.C()); + +surfaceScalarField ghf("gh", g & mesh.Cf()); + +p += rho*gh; + +thermo.correct(); + +dimensionedScalar initialMass = fvc::domainIntegrate(rho); + + +multivariateSurfaceInterpolationScheme::fieldTable fields; + +if (composition.contains("ft")) +{ + fields.add(composition.Y("ft")); +} + +if (composition.contains("fu")) +{ + fields.add(composition.Y("fu")); +} + +fields.add(hs); diff --git a/applications/solvers/combustion/fireFoam/fireFoam.C b/applications/solvers/combustion/fireFoam/fireFoam.C new file mode 100644 index 0000000000..246a186c90 --- /dev/null +++ b/applications/solvers/combustion/fireFoam/fireFoam.C @@ -0,0 +1,103 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Application + fireFoam + +Description + Transient Solver for Fires and turbulent diffusion flames + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "hsCombustionThermo.H" +#include "turbulenceModel.H" +#include "combustionModel.H" + +#include "radiationModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + #include "createTime.H" + #include "createMesh.H" + #include "readGravitationalAcceleration.H" + #include "initContinuityErrs.H" + #include "createFields.H" + #include "createRadiationModel.H" + #include "readTimeControls.H" + #include "compressibleCourantNo.H" + #include "setInitialDeltaT.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + while (runTime.run()) + { + #include "readPISOControls.H" + #include "readTimeControls.H" + #include "compressibleCourantNo.H" + #include "setDeltaT.H" + + runTime++; + Info<< "Time = " << runTime.timeName() << nl << endl; + + #include "rhoEqn.H" + + // --- Pressure-velocity PIMPLE corrector loop + for (int oCorr=0; oCorrcorrect(); + + rho = thermo.rho(); + + runTime.write(); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + + } + + Info<< "End\n" << endl; + + return 0; +} + +// ************************************************************************* // diff --git a/applications/solvers/combustion/fireFoam/ftEqn.H b/applications/solvers/combustion/fireFoam/ftEqn.H new file mode 100644 index 0000000000..57406da753 --- /dev/null +++ b/applications/solvers/combustion/fireFoam/ftEqn.H @@ -0,0 +1,25 @@ +tmp > mvConvection +( + fv::convectionScheme::New + ( + mesh, + fields, + phi, + mesh.divScheme("div(phi,ft_b_h)") + ) +); + +{ + fvScalarMatrix ftEqn + ( + fvm::ddt(rho, ft) + + mvConvection->fvmDiv(phi, ft) + - fvm::laplacian(turbulence->alphaEff(), ft) + ); + + ftEqn.relax(); + ftEqn.solve(); +} + +Info<< "max(ft) = " << max(ft).value() << endl; +Info<< "min(ft) = " << min(ft).value() << endl; diff --git a/applications/solvers/combustion/fireFoam/fuhsEqn.H b/applications/solvers/combustion/fireFoam/fuhsEqn.H new file mode 100644 index 0000000000..798cee4007 --- /dev/null +++ b/applications/solvers/combustion/fireFoam/fuhsEqn.H @@ -0,0 +1,47 @@ +{ + // Solve fuel equation + // ~~~~~~~~~~~~~~~~~~~ + fvScalarMatrix R = combustion->R(fu); + + { + fvScalarMatrix fuEqn + ( + fvm::ddt(rho, fu) + + mvConvection->fvmDiv(phi, fu) + - fvm::laplacian(turbulence->alphaEff(), fu) + == + R + ); + + fuEqn.relax(); + fuEqn.solve(); + } + + Info<< "max(fu) = " << max(fu).value() << endl; + Info<< "min(fu) = " << min(fu).value() << endl; + + + // Solve sensible enthalpy equation + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + radiation->correct(); + dQ = combustion->dQ(R); + + { + fvScalarMatrix hsEqn + ( + fvm::ddt(rho, hs) + + mvConvection->fvmDiv(phi,hs) + - fvm::laplacian(turbulence->alphaEff(), hs) + == + DpDt + + dQ + + radiation->Shs(thermo) + ); + + hsEqn.relax(); + hsEqn.solve(); + } + + thermo.correct(); + combustion->correct(); +} diff --git a/applications/solvers/combustion/fireFoam/pEqn.H b/applications/solvers/combustion/fireFoam/pEqn.H new file mode 100644 index 0000000000..907398581f --- /dev/null +++ b/applications/solvers/combustion/fireFoam/pEqn.H @@ -0,0 +1,64 @@ +bool closedVolume = false; + +rho = thermo.rho(); + +volScalarField rUA = 1.0/UEqn.A(); +surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA)); +U = rUA*UEqn.H(); + +surfaceScalarField phiU +( + fvc::interpolate(rho) + *( + (fvc::interpolate(U) & mesh.Sf()) + + fvc::ddtPhiCorr(rUA, rho, U, phi) + ) +); + +phi = phiU + rhorUAf*fvc::interpolate(rho)*(g & mesh.Sf()); + +for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) +{ + surfaceScalarField rhorUAf = fvc::interpolate(rho*rUA); + + fvScalarMatrix pEqn + ( + fvm::ddt(psi,p) + + fvc::div(phi) + - fvm::laplacian(rhorUAf, p) + ); + + closedVolume = p.needReference(); + + if (corr == nCorr-1 && nonOrth == nNonOrthCorr) + { + pEqn.solve(mesh.solver(p.name() + "Final")); + } + else + { + pEqn.solve(mesh.solver(p.name())); + } + + if (nonOrth == nNonOrthCorr) + { + phi += pEqn.flux(); + } +} + +DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); + +#include "rhoEqn.H" +#include "compressibleContinuityErrs.H" + +U += rUA*fvc::reconstruct((phi - phiU)/rhorUAf); +U.correctBoundaryConditions(); + +// For closed-volume cases adjust the pressure and density levels +// to obey overall mass continuity +if (closedVolume) +{ + p += + (initialMass - fvc::domainIntegrate(thermo.psi()*p)) + /fvc::domainIntegrate(thermo.psi()); + rho = thermo.rho(); +} diff --git a/applications/solvers/combustion/reactingFoam/Make/options b/applications/solvers/combustion/reactingFoam/Make/options index e982f635a1..d85350297a 100644 --- a/applications/solvers/combustion/reactingFoam/Make/options +++ b/applications/solvers/combustion/reactingFoam/Make/options @@ -1,5 +1,4 @@ EXE_INC = \ - -I../XiFoam \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ diff --git a/applications/solvers/combustion/reactingFoam/UEqn.H b/applications/solvers/combustion/reactingFoam/UEqn.H new file mode 100644 index 0000000000..9697c6e1ed --- /dev/null +++ b/applications/solvers/combustion/reactingFoam/UEqn.H @@ -0,0 +1,15 @@ + fvVectorMatrix UEqn + ( + fvm::ddt(rho, U) + + fvm::div(phi, U) + + turbulence->divDevRhoReff(U) + == + rho*g + ); + + UEqn.relax(); + + if (momentumPredictor) + { + solve(UEqn == -fvc::grad(p)); + } diff --git a/applications/solvers/combustion/reactingFoam/chemistry.H b/applications/solvers/combustion/reactingFoam/chemistry.H index a1a978210d..8bfa872d7b 100644 --- a/applications/solvers/combustion/reactingFoam/chemistry.H +++ b/applications/solvers/combustion/reactingFoam/chemistry.H @@ -21,4 +21,6 @@ { kappa = 1.0; } + + chemistrySh = kappa*chemistry.Sh()(); } diff --git a/applications/solvers/combustion/reactingFoam/createFields.H b/applications/solvers/combustion/reactingFoam/createFields.H index 0b2238031c..bd8f7ea1fb 100644 --- a/applications/solvers/combustion/reactingFoam/createFields.H +++ b/applications/solvers/combustion/reactingFoam/createFields.H @@ -5,7 +5,7 @@ autoPtr pChemistry ); psiChemistryModel& chemistry = pChemistry(); -hCombustionThermo& thermo = chemistry.thermo(); +hsCombustionThermo& thermo = chemistry.thermo(); basicMultiComponentMixture& composition = thermo.composition(); PtrList& Y = composition.Y(); @@ -40,8 +40,8 @@ volVectorField U volScalarField& p = thermo.p(); const volScalarField& psi = thermo.psi(); -volScalarField& h = thermo.h(); - +volScalarField& hs = thermo.hs(); +const volScalarField& T = thermo.T(); #include "compressibleCreatePhi.H" @@ -81,5 +81,18 @@ forAll(Y, i) { fields.add(Y[i]); } -fields.add(h); +fields.add(hs); +DimensionedField chemistrySh +( + IOobject + ( + "chemistry::Sh", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("chemistrySh", dimEnergy/dimTime/dimVolume, 0.0) +); diff --git a/applications/solvers/combustion/reactingFoam/hsEqn.H b/applications/solvers/combustion/reactingFoam/hsEqn.H new file mode 100644 index 0000000000..e3fa4e7a13 --- /dev/null +++ b/applications/solvers/combustion/reactingFoam/hsEqn.H @@ -0,0 +1,20 @@ +{ + fvScalarMatrix hsEqn + ( + fvm::ddt(rho, hs) + + mvConvection->fvmDiv(phi, hs) + - fvm::laplacian(turbulence->alphaEff(), hs) +// - fvm::laplacian(turbulence->muEff(), hs) // unit lewis no. + == + DpDt + + chemistrySh + ); + + hsEqn.relax(); + hsEqn.solve(); + + thermo.correct(); + + Info<< "T gas min/max = " << min(T).value() << ", " + << max(T).value() << endl; +} diff --git a/applications/solvers/combustion/reactingFoam/pEqn.H b/applications/solvers/combustion/reactingFoam/pEqn.H new file mode 100644 index 0000000000..9443f909a3 --- /dev/null +++ b/applications/solvers/combustion/reactingFoam/pEqn.H @@ -0,0 +1,68 @@ +rho = thermo.rho(); + +volScalarField rUA = 1.0/UEqn.A(); +U = rUA*UEqn.H(); + +if (transonic) +{ + surfaceScalarField phid + ( + "phid", + fvc::interpolate(psi) + *( + (fvc::interpolate(U) & mesh.Sf()) + + fvc::ddtPhiCorr(rUA, rho, U, phi) + ) + ); + + for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + { + fvScalarMatrix pEqn + ( + fvm::ddt(psi, p) + + fvm::div(phid, p) + - fvm::laplacian(rho*rUA, p) + ); + + pEqn.solve(); + + if (nonOrth == nNonOrthCorr) + { + phi == pEqn.flux(); + } + } +} +else +{ + phi = + fvc::interpolate(rho) + *( + (fvc::interpolate(U) & mesh.Sf()) + + fvc::ddtPhiCorr(rUA, rho, U, phi) + ); + + for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + { + fvScalarMatrix pEqn + ( + fvm::ddt(psi, p) + + fvc::div(phi) + - fvm::laplacian(rho*rUA, p) + ); + + pEqn.solve(); + + if (nonOrth == nNonOrthCorr) + { + phi += pEqn.flux(); + } + } +} + +#include "rhoEqn.H" +#include "compressibleContinuityErrs.H" + +U -= rUA*fvc::grad(p); +U.correctBoundaryConditions(); + +DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); diff --git a/applications/solvers/combustion/reactingFoam/reactingFoam.C b/applications/solvers/combustion/reactingFoam/reactingFoam.C index 2d4ae7589a..e9fe757e3b 100644 --- a/applications/solvers/combustion/reactingFoam/reactingFoam.C +++ b/applications/solvers/combustion/reactingFoam/reactingFoam.C @@ -73,9 +73,7 @@ int main(int argc, char *argv[]) { #include "UEqn.H" #include "YEqn.H" - - #define Db turbulence->alphaEff() - #include "hEqn.H" + #include "hsEqn.H" // --- PISO loop for (int corr=1; corr<=nCorr; corr++) diff --git a/applications/solvers/combustion/rhoReactingFoam/Make/options b/applications/solvers/combustion/rhoReactingFoam/Make/options index e982f635a1..d85350297a 100644 --- a/applications/solvers/combustion/rhoReactingFoam/Make/options +++ b/applications/solvers/combustion/rhoReactingFoam/Make/options @@ -1,5 +1,4 @@ EXE_INC = \ - -I../XiFoam \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ diff --git a/applications/solvers/combustion/rhoReactingFoam/UEqn.H b/applications/solvers/combustion/rhoReactingFoam/UEqn.H new file mode 100644 index 0000000000..9697c6e1ed --- /dev/null +++ b/applications/solvers/combustion/rhoReactingFoam/UEqn.H @@ -0,0 +1,15 @@ + fvVectorMatrix UEqn + ( + fvm::ddt(rho, U) + + fvm::div(phi, U) + + turbulence->divDevRhoReff(U) + == + rho*g + ); + + UEqn.relax(); + + if (momentumPredictor) + { + solve(UEqn == -fvc::grad(p)); + } diff --git a/applications/solvers/combustion/rhoReactingFoam/chemistry.H b/applications/solvers/combustion/rhoReactingFoam/chemistry.H index a1a978210d..8bfa872d7b 100644 --- a/applications/solvers/combustion/rhoReactingFoam/chemistry.H +++ b/applications/solvers/combustion/rhoReactingFoam/chemistry.H @@ -21,4 +21,6 @@ { kappa = 1.0; } + + chemistrySh = kappa*chemistry.Sh()(); } diff --git a/applications/solvers/combustion/rhoReactingFoam/createFields.H b/applications/solvers/combustion/rhoReactingFoam/createFields.H index d2f6f5e4d4..d4119b8c92 100644 --- a/applications/solvers/combustion/rhoReactingFoam/createFields.H +++ b/applications/solvers/combustion/rhoReactingFoam/createFields.H @@ -5,7 +5,7 @@ autoPtr pChemistry ); rhoChemistryModel& chemistry = pChemistry(); -hReactionThermo& thermo = chemistry.thermo(); +hsReactionThermo& thermo = chemistry.thermo(); basicMultiComponentMixture& composition = thermo.composition(); PtrList& Y = composition.Y(); @@ -40,7 +40,8 @@ volVectorField U volScalarField& p = thermo.p(); const volScalarField& psi = thermo.psi(); -volScalarField& h = thermo.h(); +volScalarField& hs = thermo.hs(); +const volScalarField& T = thermo.T(); #include "compressibleCreatePhi.H" @@ -81,5 +82,18 @@ forAll(Y, i) { fields.add(Y[i]); } -fields.add(h); +fields.add(hs); +DimensionedField chemistrySh +( + IOobject + ( + "chemistry::Sh", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("chemistrySh", dimEnergy/dimTime/dimVolume, 0.0) +); diff --git a/applications/solvers/combustion/rhoReactingFoam/hsEqn.H b/applications/solvers/combustion/rhoReactingFoam/hsEqn.H new file mode 100644 index 0000000000..81bd6ea9d7 --- /dev/null +++ b/applications/solvers/combustion/rhoReactingFoam/hsEqn.H @@ -0,0 +1,19 @@ +{ + fvScalarMatrix hsEqn + ( + fvm::ddt(rho, hs) + + mvConvection->fvmDiv(phi, hs) + - fvm::laplacian(turbulence->alphaEff(), hs) + == + DpDt + + chemistrySh + ); + + hsEqn.relax(); + hsEqn.solve(); + + thermo.correct(); + + Info<< "T gas min/max = " << min(T).value() << ", " + << max(T).value() << endl; +} diff --git a/applications/solvers/combustion/rhoReactingFoam/rhoReactingFoam.C b/applications/solvers/combustion/rhoReactingFoam/rhoReactingFoam.C index cc37dd09c1..79b76e014d 100644 --- a/applications/solvers/combustion/rhoReactingFoam/rhoReactingFoam.C +++ b/applications/solvers/combustion/rhoReactingFoam/rhoReactingFoam.C @@ -74,7 +74,7 @@ int main(int argc, char *argv[]) { #include "UEqn.H" #include "YEqn.H" - #include "hEqn.H" + #include "hsEqn.H" // --- PISO loop for (int corr=1; corr<=nCorr; corr++) diff --git a/applications/solvers/lagrangian/coalChemistryFoam/chemistry.H b/applications/solvers/lagrangian/coalChemistryFoam/chemistry.H index 5489dfefba..50fc7f575b 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/chemistry.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/chemistry.H @@ -22,4 +22,6 @@ { kappa = 1.0; } + + chemistrySh = kappa*chemistry.Sh()(); } diff --git a/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C b/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C index 389a065935..872664f3a5 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C +++ b/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C @@ -84,16 +84,8 @@ int main(int argc, char *argv[]) coalParcels.evolve(); - coalParcels.info(); - - Info<< endl; - limestoneParcels.evolve(); - limestoneParcels.info(); - - Info<< endl; - #include "chemistry.H" #include "rhoEqn.H" @@ -102,16 +94,13 @@ int main(int argc, char *argv[]) { #include "UEqn.H" #include "YEqn.H" - #include "hEqn.H" + #include "hsEqn.H" // --- PISO loop for (int corr=1; corr<=nCorr; corr++) { #include "pEqn.H" } - - Info<< "T gas min/max = " << min(T).value() << ", " - << max(T).value() << endl; } turbulence->correct(); diff --git a/applications/solvers/lagrangian/coalChemistryFoam/createFields.H b/applications/solvers/lagrangian/coalChemistryFoam/createFields.H index d0a284a0e1..65be09775c 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/createFields.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/createFields.H @@ -6,7 +6,7 @@ ); psiChemistryModel& chemistry = pChemistry(); - hCombustionThermo& thermo = chemistry.thermo(); + hsCombustionThermo& thermo = chemistry.thermo(); basicMultiComponentMixture& composition = thermo.composition(); PtrList& Y = composition.Y(); @@ -22,7 +22,7 @@ } volScalarField& p = thermo.p(); - volScalarField& h = thermo.h(); + volScalarField& hs = thermo.hs(); const volScalarField& T = thermo.T(); const volScalarField& psi = thermo.psi(); @@ -32,7 +32,7 @@ { fields.add(Y[i]); } - fields.add(h); + fields.add(hs); volScalarField rho ( @@ -133,5 +133,19 @@ "energy", mesh, dimEnergy/dimTime/dimVolume, - "h" + "hs" + ); + + DimensionedField chemistrySh + ( + IOobject + ( + "chemistry::Sh", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("chemistrySh", dimEnergy/dimTime/dimVolume, 0.0) ); diff --git a/applications/solvers/lagrangian/coalChemistryFoam/hEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/hEqn.H deleted file mode 100644 index 2eaf6315cf..0000000000 --- a/applications/solvers/lagrangian/coalChemistryFoam/hEqn.H +++ /dev/null @@ -1,22 +0,0 @@ -{ - fvScalarMatrix hEqn - ( - fvm::ddt(rho, h) - + mvConvection->fvmDiv(phi, h) - - fvm::laplacian(turbulence->alphaEff(), h) - == - DpDt - + coalParcels.Sh() - + limestoneParcels.Sh() - + enthalpySource.Su() - + radiation->Sh(thermo) - ); - - hEqn.relax(); - - hEqn.solve(); - - thermo.correct(); - - radiation->correct(); -} diff --git a/applications/solvers/lagrangian/coalChemistryFoam/hsEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/hsEqn.H new file mode 100644 index 0000000000..ced6b64004 --- /dev/null +++ b/applications/solvers/lagrangian/coalChemistryFoam/hsEqn.H @@ -0,0 +1,26 @@ +{ + fvScalarMatrix hsEqn + ( + fvm::ddt(rho, hs) + + mvConvection->fvmDiv(phi, hs) + - fvm::laplacian(turbulence->alphaEff(), hs) + == + DpDt + + coalParcels.Sh() + + limestoneParcels.Sh() + + enthalpySource.Su() + + radiation->Shs(thermo) + + chemistrySh + ); + + hsEqn.relax(); + + hsEqn.solve(); + + thermo.correct(); + + radiation->correct(); + + Info<< "T gas min/max = " << min(T).value() << ", " + << max(T).value() << endl; +} diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/chemistry.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/chemistry.H index 5489dfefba..50fc7f575b 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/chemistry.H +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/chemistry.H @@ -22,4 +22,6 @@ { kappa = 1.0; } + + chemistrySh = kappa*chemistry.Sh()(); } diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/createFields.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/createFields.H index 68c0f8aee8..cf3f484bdb 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/createFields.H +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/createFields.H @@ -6,7 +6,7 @@ ); rhoChemistryModel& chemistry = pChemistry(); - hReactionThermo& thermo = chemistry.thermo(); + hsReactionThermo& thermo = chemistry.thermo(); basicMultiComponentMixture& composition = thermo.composition(); PtrList& Y = composition.Y(); @@ -22,7 +22,7 @@ } volScalarField& p = thermo.p(); - volScalarField& h = thermo.h(); + volScalarField& hs = thermo.hs(); const volScalarField& T = thermo.T(); const volScalarField& psi = thermo.psi(); @@ -88,4 +88,18 @@ { fields.add(Y[i]); } - fields.add(h); + fields.add(hs); + + DimensionedField chemistrySh + ( + IOobject + ( + "chemistry::Sh", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("chemistrySh", dimEnergy/dimTime/dimVolume, 0.0) + ); diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/hEqn.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/hsEqn.H similarity index 83% rename from applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/hEqn.H rename to applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/hsEqn.H index 0715989df7..73c276c294 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/hEqn.H +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/hsEqn.H @@ -32,14 +32,15 @@ { solve ( - fvm::ddt(rho, h) - + mvConvection->fvmDiv(phi, h) - - fvm::laplacian(turbulence->alphaEff(), h) + fvm::ddt(rho, hs) + + mvConvection->fvmDiv(phi, hs) + - fvm::laplacian(turbulence->alphaEff(), hs) == pWork() + parcels.Sh() - + radiation->Sh(thermo) + + radiation->Shs(thermo) + energySource.Su() + + chemistrySh ); thermo.correct(); diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C index b345ffe28a..436fda7a8b 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C @@ -33,7 +33,7 @@ Description The solver includes: - reacting multiphase parcel cloud - porous media - - point mass sources + - mass, momentum and energy sources - polynomial based, incompressible thermodynamics (f(T)) Note: ddtPhiCorr not used here when porous zones are active @@ -89,13 +89,11 @@ int main(int argc, char *argv[]) parcels.evolve(); - parcels.info(); - #include "chemistry.H" #include "rhoEqn.H" #include "UEqn.H" #include "YEqn.H" - #include "hEqn.H" + #include "hsEqn.H" // --- PISO loop for (int corr=0; corr& Y = composition.Y(); @@ -22,7 +22,7 @@ } volScalarField& p = thermo.p(); - volScalarField& h = thermo.h(); + volScalarField& hs = thermo.hs(); const volScalarField& T = thermo.T(); const volScalarField& psi = thermo.psi(); @@ -94,4 +94,18 @@ { fields.add(Y[i]); } - fields.add(h); + fields.add(hs); + + DimensionedField chemistrySh + ( + IOobject + ( + "chemistry::Sh", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("chemistry::Sh", dimEnergy/dimTime/dimVolume, 0.0) + ); diff --git a/applications/solvers/lagrangian/reactingParcelFoam/hEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/hEqn.H deleted file mode 100644 index d686e452f4..0000000000 --- a/applications/solvers/lagrangian/reactingParcelFoam/hEqn.H +++ /dev/null @@ -1,20 +0,0 @@ -{ - fvScalarMatrix hEqn - ( - fvm::ddt(rho, h) - + mvConvection->fvmDiv(phi, h) - - fvm::laplacian(turbulence->alphaEff(), h) - == - DpDt - + parcels.Sh() - + radiation->Sh(thermo) - ); - - hEqn.relax(); - - hEqn.solve(); - - thermo.correct(); - - radiation->correct(); -} diff --git a/applications/solvers/lagrangian/reactingParcelFoam/hsEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/hsEqn.H new file mode 100644 index 0000000000..ce12ec3ad4 --- /dev/null +++ b/applications/solvers/lagrangian/reactingParcelFoam/hsEqn.H @@ -0,0 +1,24 @@ +{ + fvScalarMatrix hEqn + ( + fvm::ddt(rho, hs) + + mvConvection->fvmDiv(phi, hs) + - fvm::laplacian(turbulence->alphaEff(), hs) + == + DpDt + + parcels.Sh() + + radiation->Shs(thermo) + + chemistrySh + ); + + hEqn.relax(); + + hEqn.solve(); + + thermo.correct(); + + radiation->correct(); + + Info<< "T gas min/max = " << min(T).value() << ", " + << max(T).value() << endl; +} diff --git a/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C b/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C index 4dfd367d09..ad3b5b461c 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C +++ b/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C @@ -74,8 +74,6 @@ int main(int argc, char *argv[]) parcels.evolve(); - parcels.info(); - #include "chemistry.H" #include "rhoEqn.H" @@ -88,12 +86,9 @@ int main(int argc, char *argv[]) // --- PISO loop for (int corr=1; corr<=nCorr; corr++) { - #include "hEqn.H" + #include "hsEqn.H" #include "pEqn.H" } - - Info<< "T gas min/max = " << min(T).value() << ", " - << max(T).value() << endl; } turbulence->correct(); diff --git a/applications/solvers/lagrangian/uncoupledKinematicParcelFoam/uncoupledKinematicParcelFoam.C b/applications/solvers/lagrangian/uncoupledKinematicParcelFoam/uncoupledKinematicParcelFoam.C index ee0088c397..ef1ccbd150 100644 --- a/applications/solvers/lagrangian/uncoupledKinematicParcelFoam/uncoupledKinematicParcelFoam.C +++ b/applications/solvers/lagrangian/uncoupledKinematicParcelFoam/uncoupledKinematicParcelFoam.C @@ -61,7 +61,6 @@ int main(int argc, char *argv[]) Info<< "Evolving " << kinematicCloud.name() << endl; kinematicCloud.evolve(); - kinematicCloud.info(); runTime.write(); diff --git a/applications/test/List/ListTest.C b/applications/test/List/ListTest.C index b9f69fd043..cf5b2d38ec 100644 --- a/applications/test/List/ListTest.C +++ b/applications/test/List/ListTest.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -90,7 +90,7 @@ int main(int argc, char *argv[]) if (args.optionFound("flag")) { - Info<<"-flag:" << args.option("flag") << endl; + Info<<"-flag:" << args["flag"] << endl; } if (args.optionReadIfPresent("float", xxx)) diff --git a/applications/test/ODETest/ODETest.C b/applications/test/ODETest/ODETest.C index acb444a0a5..1da2f700c5 100644 --- a/applications/test/ODETest/ODETest.C +++ b/applications/test/ODETest/ODETest.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -109,10 +109,8 @@ int main(int argc, char *argv[]) argList::validArgs.append("ODESolver"); argList args(argc, argv); - word ODESolverName(args.additionalArgs()[0]); - testODE ode; - autoPtr odeSolver = ODESolver::New(ODESolverName, ode); + autoPtr odeSolver = ODESolver::New(args[1], ode); scalar xStart = 1.0; scalarField yStart(ode.nEqns()); diff --git a/applications/test/PackedList/PackedListTest.C b/applications/test/PackedList/PackedListTest.C index e5670b3cbe..d203fad893 100644 --- a/applications/test/PackedList/PackedListTest.C +++ b/applications/test/PackedList/PackedListTest.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -130,15 +130,15 @@ int main(int argc, char *argv[]) return 0; } - else if (args.additionalArgs().empty()) + else if (args.size() <= 1) { args.printUsage(); } - forAll(args.additionalArgs(), argI) + for (label argI=1; argI < args.size(); ++argI) { - const string& srcFile = args.additionalArgs()[argI]; + const string& srcFile = args[argI]; Info<< nl << "reading " << srcFile << nl; IFstream ifs(srcFile); diff --git a/applications/test/dictionary/dictionaryTest.C b/applications/test/dictionary/dictionaryTest.C index ff2add8169..fac8dd6631 100644 --- a/applications/test/dictionary/dictionaryTest.C +++ b/applications/test/dictionary/dictionaryTest.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -51,7 +51,7 @@ int main(int argc, char *argv[]) << "FOAM_CASENAME=" << getEnv("FOAM_CASENAME") << nl << endl; - if (args.additionalArgs().empty()) + if (args.size() <= 1) { { dictionary dict1(IFstream("testDict")()); @@ -114,9 +114,9 @@ int main(int argc, char *argv[]) else { IOobject::writeDivider(Info); - forAll(args.additionalArgs(), argI) + for (label argI=1; argI < args.size(); ++argI) { - const string& dictFile = args.additionalArgs()[argI]; + const string& dictFile = args[argI]; IFstream is(dictFile); dictionary dict(is); diff --git a/applications/test/fileNameClean/fileNameCleanTest.C b/applications/test/fileNameClean/fileNameCleanTest.C index ce52da1e00..62c78fbd0f 100644 --- a/applications/test/fileNameClean/fileNameCleanTest.C +++ b/applications/test/fileNameClean/fileNameCleanTest.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -70,7 +70,7 @@ int main(int argc, char *argv[]) argList args(argc, argv, false, true); - if (args.additionalArgs().empty() && args.options().empty()) + if (args.size() <= 1 && args.options().empty()) { args.printUsage(); } @@ -90,9 +90,9 @@ int main(int argc, char *argv[]) printCleaning(pathName); } - forAll(args.additionalArgs(), argI) + for (label argI=1; argI < args.size(); ++argI) { - pathName = args.additionalArgs()[argI]; + pathName = args[argI]; printCleaning(pathName); } diff --git a/applications/test/findCell-octree/findCell-octree.C b/applications/test/findCell-octree/findCell-octree.C index 1a845d7029..a2436852fa 100644 --- a/applications/test/findCell-octree/findCell-octree.C +++ b/applications/test/findCell-octree/findCell-octree.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -45,7 +45,7 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createMesh.H" - point sample(IStringStream(args.additionalArgs()[0])()); + const point sample = args.argRead(1); treeBoundBox meshBb(mesh.points()); @@ -82,8 +82,8 @@ int main(int argc, char *argv[]) ); Info<< "Point:" << sample << " is in shape " - << oc.find(sample) << endl; - Info<< "Point:" << sample << " is in cell " + << oc.find(sample) << nl + << "Point:" << sample << " is in cell " << mesh.findCell(sample) << endl; diff --git a/applications/test/mvBak/mvBakTest.C b/applications/test/mvBak/mvBakTest.C index 5cc25161dd..a88d1cfd75 100644 --- a/applications/test/mvBak/mvBakTest.C +++ b/applications/test/mvBak/mvBakTest.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -45,20 +45,20 @@ int main(int argc, char *argv[]) argList args(argc, argv, false, true); - if (args.additionalArgs().empty()) + if (args.size() <= 1) { args.printUsage(); } label ok = 0; - forAll(args.additionalArgs(), argI) + for (label argI=1; argI < args.size(); ++argI) { - const string& srcFile = args.additionalArgs()[argI]; + const string& srcFile = args[argI]; if (args.optionFound("ext")) { - if (mvBak(srcFile, args.option("ext"))) + if (mvBak(srcFile, args["ext"])) { ok++; } @@ -72,7 +72,7 @@ int main(int argc, char *argv[]) } } - Info<< "mvBak called for " << args.additionalArgs().size() + Info<< "mvBak called for " << args.size()-1 << " files (moved " << ok << ")\n" << endl; return 0; diff --git a/applications/test/passiveParticle/passiveParticleTest.C b/applications/test/passiveParticle/passiveParticleTest.C index 15ba56f4fa..e03cb70e07 100644 --- a/applications/test/passiveParticle/passiveParticleTest.C +++ b/applications/test/passiveParticle/passiveParticleTest.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,7 +43,7 @@ int main(int argc, char *argv[]) #include "createMesh.H" runTime.functionObjects().off(); - const word cloudName(args.additionalArgs()[0]); + const word cloudName = args[1]; { // Start with empty cloud diff --git a/applications/test/primitivePatch/testPrimitivePatch.C b/applications/test/primitivePatch/testPrimitivePatch.C index cf24ab3435..b6ac551d76 100644 --- a/applications/test/primitivePatch/testPrimitivePatch.C +++ b/applications/test/primitivePatch/testPrimitivePatch.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -221,7 +221,7 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createPolyMesh.H" - word patchName(args.additionalArgs()[0]); + const word patchName = args[1]; label patchI = mesh.boundaryMesh().findPatchID(patchName); diff --git a/applications/test/readCHEMKINIII/readCHEMKINIII.C b/applications/test/readCHEMKINIII/readCHEMKINIII.C index 01653ae705..d7f06bb061 100644 --- a/applications/test/readCHEMKINIII/readCHEMKINIII.C +++ b/applications/test/readCHEMKINIII/readCHEMKINIII.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,20 +42,15 @@ int main(int argc, char *argv[]) argList args(argc, argv); fileName thermoFileName = fileName::null; - if (args.options().found("thermo")) - { - thermoFileName = args.options()["thermo"]; - } + args.optionReadIfPresent("thermo", thermoFileName); - fileName CHEMKINFileName(args.additionalArgs()[0]); + chemkinReader ck(args[1], thermoFileName); - chemkinReader ck(CHEMKINFileName, thermoFileName); - - //Info<< ck.isotopeAtomicWts() << endl; - //Info<< ck.specieNames() << endl; - //Info<< ck.speciePhase() << endl; - //Info<< ck.specieThermo() << endl; - //Info<< ck.reactions() << endl; + //Info<< ck.isotopeAtomicWts() << nl + // << ck.specieNames() << nl + // << ck.speciePhase() << nl + // << ck.specieThermo() << nl + // << ck.reactions() << endl; const SLPtrList& reactions = ck.reactions(); diff --git a/applications/test/spline/splineTest.C b/applications/test/spline/splineTest.C index 3d92a7dd24..600bf0d4f5 100644 --- a/applications/test/spline/splineTest.C +++ b/applications/test/spline/splineTest.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -58,7 +58,7 @@ int main(int argc, char *argv[]) argList args(argc, argv, false, true); - if (args.additionalArgs().empty()) + if (args.size() <= 1) { args.printUsage(); } @@ -73,9 +73,9 @@ int main(int argc, char *argv[]) useCatmullRom = true; } - forAll(args.additionalArgs(), argI) + for (label argI=1; argI < args.size(); ++argI) { - const string& srcFile = args.additionalArgs()[argI]; + const string& srcFile = args[argI]; Info<< nl << "reading " << srcFile << nl; IFstream ifs(srcFile); diff --git a/applications/test/testPointEdgeWave/testPointEdgeWave.C b/applications/test/testPointEdgeWave/testPointEdgeWave.C index 10856cbead..9011d8735d 100644 --- a/applications/test/testPointEdgeWave/testPointEdgeWave.C +++ b/applications/test/testPointEdgeWave/testPointEdgeWave.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -51,7 +51,7 @@ int main(int argc, char *argv[]) const polyBoundaryMesh& patches = mesh.boundaryMesh(); // Get name of patch - word patchName(args.additionalArgs()[0]); + const word patchName = args[1]; // Find the label in patches by name. label patchI = patches.findPatchID(patchName); diff --git a/applications/test/tokenizeTest/tokenizeTest.C b/applications/test/tokenizeTest/tokenizeTest.C index c8be29cbf3..e70c4e3361 100644 --- a/applications/test/tokenizeTest/tokenizeTest.C +++ b/applications/test/tokenizeTest/tokenizeTest.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -54,9 +54,9 @@ int main(int argc, char *argv[]) cpuTime timer; for (label count = 0; count < repeat; ++count) { - forAll(args.additionalArgs(), argI) + for (label argI=1; argI < args.size(); ++argI) { - const string& rawArg = args.additionalArgs()[argI]; + const string& rawArg = args[argI]; if (count == 0) { Info<< "input string: " << rawArg << nl; @@ -94,11 +94,11 @@ int main(int argc, char *argv[]) { for (label count = 0; count < repeat; ++count) { - IFstream is(args.option("file")); + IFstream is(args["file"]); if (count == 0) { - Info<< "tokenizing file: " << args.option("file") << nl; + Info<< "tokenizing file: " << args["file"] << nl; } while (is.good()) diff --git a/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMeshDict b/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMeshDict index d2d9941d63..9c57e17dbf 100644 --- a/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMeshDict +++ b/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMeshDict @@ -17,7 +17,7 @@ FoamFile // Surface to keep to -surface "plexi.ftr"; +surface "plexi.obj"; // What is outside. These points have to be inside a cell (so not on a face!) outsidePoints ((-0.99001 -0.99001 -0.99001)); diff --git a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C index 3f1f29b298..a0e2b15f34 100644 --- a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C +++ b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -453,8 +453,8 @@ label simplifyFaces int main(int argc, char *argv[]) { +# include "addOverwriteOption.H" argList::noParallel(); - argList::addBoolOption("overwrite"); argList::validArgs.append("edge length [m]"); argList::validArgs.append("merge angle (degrees)"); @@ -464,9 +464,9 @@ int main(int argc, char *argv[]) # include "createPolyMesh.H" const word oldInstance = mesh.pointsInstance(); - scalar minLen(readScalar(IStringStream(args.additionalArgs()[0])())); - scalar angle(readScalar(IStringStream(args.additionalArgs()[1])())); - bool overwrite = args.optionFound("overwrite"); + const scalar minLen = args.argRead(1); + const scalar angle = args.argRead(2); + const bool overwrite = args.optionFound("overwrite"); scalar maxCos = Foam::cos(degToRad(angle)); diff --git a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C index fa055e2758..e16fe07cff 100644 --- a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C +++ b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -428,10 +428,17 @@ label mergeEdges(const scalar minCos, polyMesh& mesh) int main(int argc, char *argv[]) { +# include "addOverwriteOption.H" + argList::validArgs.append("feature angle [0..180]"); - argList::addOption("concaveAngle", "[0..180]"); + argList::addOption + ( + "concaveAngle", + "[0..180]", + "specify concave angle [0..180] degrees (default: 30.0 degrees)" + ); + argList::addBoolOption("snapMesh"); - argList::addBoolOption("overwrite"); # include "setRootCase.H" # include "createTime.H" @@ -439,18 +446,16 @@ int main(int argc, char *argv[]) # include "createPolyMesh.H" const word oldInstance = mesh.pointsInstance(); - scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])())); - - scalar minCos = Foam::cos(degToRad(featureAngle)); + const scalar featureAngle = args.argRead(1); + const scalar minCos = Foam::cos(degToRad(featureAngle)); // Sin of angle between two consecutive edges on a face. // If sin(angle) larger than this the face will be considered concave. scalar concaveAngle = args.optionLookupOrDefault("concaveAngle", 30.0); - scalar concaveSin = Foam::sin(degToRad(concaveAngle)); - bool snapMeshDict = args.optionFound("snapMesh"); - bool overwrite = args.optionFound("overwrite"); + const bool snapMeshDict = args.optionFound("snapMesh"); + const bool overwrite = args.optionFound("overwrite"); Info<< "Merging all faces of a cell" << nl << " - which are on the same patch" << nl diff --git a/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C b/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C index b46a421eb3..c57820803e 100644 --- a/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C +++ b/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -328,7 +328,7 @@ label findCell(const primitiveMesh& mesh, const point& nearPoint) int main(int argc, char *argv[]) { - argList::addBoolOption("overwrite"); +# include "addOverwriteOption.H" # include "setRootCase.H" # include "createTime.H" @@ -336,7 +336,7 @@ int main(int argc, char *argv[]) # include "createPolyMesh.H" const word oldInstance = mesh.pointsInstance(); - bool overwrite = args.optionFound("overwrite"); + const bool overwrite = args.optionFound("overwrite"); Info<< "Reading modifyMeshDict\n" << endl; diff --git a/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C b/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C index 6175bd4e16..cb87a9f568 100644 --- a/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C +++ b/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -52,8 +52,9 @@ using namespace Foam; // Main program: int main(int argc, char *argv[]) { - argList::addBoolOption("overwrite"); +# include "addOverwriteOption.H" argList::validArgs.append("cellSet"); + # include "setRootCase.H" # include "createTime.H" runTime.functionObjects().off(); @@ -63,7 +64,7 @@ int main(int argc, char *argv[]) pointMesh pMesh(mesh); word cellSetName(args.args()[1]); - bool overwrite = args.optionFound("overwrite"); + const bool overwrite = args.optionFound("overwrite"); Info<< "Reading cells to refine from cellSet " << cellSetName << nl << endl; diff --git a/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C b/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C index 731eac7855..c6ad157d23 100644 --- a/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C +++ b/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -47,12 +47,12 @@ using namespace Foam; int main(int argc, char *argv[]) { +# include "addOverwriteOption.H" argList::noParallel(); argList::validArgs.append("patchName"); argList::validArgs.append("edgeWeight"); argList::addOption("useSet", "cellSet"); - argList::addBoolOption("overwrite"); # include "setRootCase.H" # include "createTime.H" @@ -60,11 +60,9 @@ int main(int argc, char *argv[]) # include "createPolyMesh.H" const word oldInstance = mesh.pointsInstance(); - word patchName(args.additionalArgs()[0]); - - scalar weight(readScalar(IStringStream(args.additionalArgs()[1])())); - bool overwrite = args.optionFound("overwrite"); - + const word patchName = args[1]; + const scalar weight = args.argRead(2); + const bool overwrite = args.optionFound("overwrite"); label patchID = mesh.boundaryMesh().findPatchID(patchName); @@ -103,20 +101,17 @@ int main(int argc, char *argv[]) // List of cells to refine // - bool useSet = args.optionFound("useSet"); - - if (useSet) + word setName; + if (args.optionReadIfPresent("useSet", setName)) { - word setName(args.option("useSet")); - - Info<< "Subsetting cells to cut based on cellSet" << setName << endl - << endl; + Info<< "Subsetting cells to cut based on cellSet" + << setName << nl << endl; cellSet cells(mesh, setName); Info<< "Read " << cells.size() << " cells from cellSet " << cells.instance()/cells.local()/cells.name() - << endl << endl; + << nl << endl; for ( @@ -127,8 +122,8 @@ int main(int argc, char *argv[]) { cutCells.erase(iter.key()); } - Info<< "Removed from cells to cut all the ones not in set " << setName - << endl << endl; + Info<< "Removed from cells to cut all the ones not in set " + << setName << nl << endl; } // Mark all meshpoints on patch @@ -182,9 +177,9 @@ int main(int argc, char *argv[]) allCutEdges.shrink(); allCutEdgeWeights.shrink(); - Info<< "Cutting:" << endl - << " cells:" << cutCells.size() << endl - << " edges:" << allCutEdges.size() << endl + Info<< "Cutting:" << nl + << " cells:" << cutCells.size() << nl + << " edges:" << allCutEdges.size() << nl << endl; // Transfer DynamicLists to straight ones. diff --git a/applications/utilities/mesh/advanced/removeFaces/removeFaces.C b/applications/utilities/mesh/advanced/removeFaces/removeFaces.C index a7d13ba2c3..decd3935cc 100644 --- a/applications/utilities/mesh/advanced/removeFaces/removeFaces.C +++ b/applications/utilities/mesh/advanced/removeFaces/removeFaces.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -48,7 +48,7 @@ using namespace Foam; int main(int argc, char *argv[]) { - argList::addBoolOption("overwrite"); +# include "addOverwriteOption.H" argList::validArgs.append("faceSet"); # include "setRootCase.H" @@ -57,9 +57,8 @@ int main(int argc, char *argv[]) # include "createMesh.H" const word oldInstance = mesh.pointsInstance(); - bool overwrite = args.optionFound("overwrite"); - - word setName(args.additionalArgs()[0]); + const word setName = args[1]; + const bool overwrite = args.optionFound("overwrite"); // Read faces faceSet candidateSet(mesh, setName); diff --git a/applications/utilities/mesh/advanced/selectCells/selectCellsDict b/applications/utilities/mesh/advanced/selectCells/selectCellsDict index eb10e23d78..87f91eafb4 100644 --- a/applications/utilities/mesh/advanced/selectCells/selectCellsDict +++ b/applications/utilities/mesh/advanced/selectCells/selectCellsDict @@ -21,7 +21,7 @@ FoamFile useSurface false; // Surface to keep to -surface "plexi.ftr"; +surface "plexi.obj"; // What is outside outsidePoints ((-1 -1 -1)); diff --git a/applications/utilities/mesh/advanced/splitCells/splitCells.C b/applications/utilities/mesh/advanced/splitCells/splitCells.C index 1e1548f517..af7023cbb0 100644 --- a/applications/utilities/mesh/advanced/splitCells/splitCells.C +++ b/applications/utilities/mesh/advanced/splitCells/splitCells.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -524,11 +524,11 @@ void collectCuts int main(int argc, char *argv[]) { +# include "addOverwriteOption.H" argList::noParallel(); argList::addOption("set", "cellSet name"); argList::addBoolOption("geometry"); argList::addOption("tol", "edge snap tolerance"); - argList::addBoolOption("overwrite"); argList::validArgs.append("edge angle [0..360]"); # include "setRootCase.H" @@ -537,14 +537,13 @@ int main(int argc, char *argv[]) # include "createPolyMesh.H" const word oldInstance = mesh.pointsInstance(); - scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])())); + const scalar featureAngle = args.argRead(1); + const scalar minCos = Foam::cos(degToRad(featureAngle)); + const scalar minSin = Foam::sin(degToRad(featureAngle)); - scalar minCos = Foam::cos(degToRad(featureAngle)); - scalar minSin = Foam::sin(degToRad(featureAngle)); - - bool readSet = args.optionFound("set"); - bool geometry = args.optionFound("geometry"); - bool overwrite = args.optionFound("overwrite"); + const bool readSet = args.optionFound("set"); + const bool geometry = args.optionFound("geometry"); + const bool overwrite = args.optionFound("overwrite"); scalar edgeTol = args.optionLookupOrDefault("tol", 0.2); @@ -553,7 +552,7 @@ int main(int argc, char *argv[]) << "edge snapping tol : " << edgeTol << nl; if (readSet) { - Info<< "candidate cells : cellSet " << args.option("set") << nl; + Info<< "candidate cells : cellSet " << args["set"] << nl; } else { @@ -581,7 +580,7 @@ int main(int argc, char *argv[]) if (readSet) { // Read cells to cut from cellSet - cellSet cells(mesh, args.option("set")); + cellSet cells(mesh, args["set"]); cellsToCut = cells; } diff --git a/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/ccm26ToFoam.C b/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/ccm26ToFoam.C index 671c9e7a7e..76fb67afa1 100644 --- a/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/ccm26ToFoam.C +++ b/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/ccm26ToFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -615,7 +615,7 @@ int main(int argc, char *argv[]) wordList foamPatchNames; { - fileName ccmFile(args.additionalArgs()[0]); + const fileName ccmFile = args[1]; if (!isFile(ccmFile)) { diff --git a/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L b/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L index d07eeb7b69..f452a9f083 100644 --- a/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L +++ b/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,7 +26,8 @@ Application ansysToFoam Description - Converts an ANSYS input mesh file, exported from I-DEAS, to FOAM format. + Converts an ANSYS input mesh file, exported from I-DEAS, + to OpenFOAM format. \*---------------------------------------------------------------------------*/ @@ -252,7 +253,7 @@ int main(int argc, char *argv[]) # include "createTime.H" - fileName ansysFile(args.additionalArgs()[0]); + const fileName ansysFile = args[1]; ifstream ansysStream(ansysFile.c_str()); if (!ansysStream) diff --git a/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C b/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C index 7ddfeb5fa2..be693be737 100644 --- a/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C +++ b/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,7 +26,7 @@ Application cfx4ToFoam Description - Converts a CFX 4 mesh to FOAM format + Converts a CFX 4 mesh to OpenFOAM format \*---------------------------------------------------------------------------*/ @@ -64,7 +64,7 @@ int main(int argc, char *argv[]) # include "createTime.H" - IFstream cfxFile(args.additionalArgs()[0]); + IFstream cfxFile(args[1]); // Read the cfx information using a fixed format reader. // Comments in the file are in C++ style, so the stream parser will remove @@ -603,7 +603,7 @@ int main(int argc, char *argv[]) Info<< "CFX patch " << patchI << ", of type " << cfxPatchTypes[patchI] << ", name " << cfxPatchNames[patchI] - << " already exists as FOAM patch " << existingPatch + << " already exists as OpenFOAM patch " << existingPatch << ". Adding faces." << endl; faceList& renumberedPatch = boundary[existingPatch]; @@ -655,7 +655,7 @@ int main(int argc, char *argv[]) Info<< "CFX patch " << patchI << ", of type " << cfxPatchTypes[patchI] << ", name " << cfxPatchNames[patchI] - << " converted into FOAM patch " << nCreatedPatches + << " converted into OpenFOAM patch " << nCreatedPatches << " type "; if (cfxPatchTypes[patchI] == "WALL") diff --git a/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L b/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L index 333188c072..b810511a76 100644 --- a/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L +++ b/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -795,7 +795,7 @@ int main(int argc, char *argv[]) # include "createTime.H" - fileName fluentFile(args.additionalArgs()[0]); + const fileName fluentFile = args[1]; IFstream fluentStream(fluentFile); if (!fluentStream) diff --git a/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L b/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L index 79a6d75633..2b75740021 100644 --- a/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L +++ b/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,7 +26,7 @@ Application fluentMeshToFoam Description - Converts a Fluent mesh to FOAM format + Converts a Fluent mesh to OpenFOAM format including multiple region and region boundary handling. \*---------------------------------------------------------------------------*/ @@ -881,12 +881,12 @@ int main(int argc, char *argv[]) scalar scaleFactor = 1.0; args.optionReadIfPresent("scale", scaleFactor); - bool writeSets = args.optionFound("writeSets"); - bool writeZones = args.optionFound("writeZones"); + const bool writeSets = args.optionFound("writeSets"); + const bool writeZones = args.optionFound("writeZones"); # include "createTime.H" - fileName fluentFile(args.additionalArgs()[0]); + const fileName fluentFile = args[1]; std::ifstream fluentStream(fluentFile.c_str()); if (!fluentStream) diff --git a/applications/utilities/mesh/conversion/foamMeshToFluent/fluentFvMesh.C b/applications/utilities/mesh/conversion/foamMeshToFluent/fluentFvMesh.C index 00b6874b5b..79f2c4753e 100644 --- a/applications/utilities/mesh/conversion/foamMeshToFluent/fluentFvMesh.C +++ b/applications/utilities/mesh/conversion/foamMeshToFluent/fluentFvMesh.C @@ -199,7 +199,8 @@ void Foam::fluentFvMesh::writeFluentMesh() const fluentMeshFile << l.size() << " "; // Note: In Fluent, all boundary faces point inwards, which is - // opposite from the FOAM convention. Turn them round on printout + // opposite from the OpenFOAM convention. + // Turn them around on printout forAllReverse (l, lI) { fluentMeshFile << l[lI] + 1 << " "; diff --git a/applications/utilities/mesh/conversion/foamMeshToFluent/foamMeshToFluent.C b/applications/utilities/mesh/conversion/foamMeshToFluent/foamMeshToFluent.C index a4d8b25f3b..b9ce333256 100644 --- a/applications/utilities/mesh/conversion/foamMeshToFluent/foamMeshToFluent.C +++ b/applications/utilities/mesh/conversion/foamMeshToFluent/foamMeshToFluent.C @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Description - Writes out the FOAM mesh in Fluent mesh format. + Writes out the OpenFOAM mesh in Fluent mesh format. \*---------------------------------------------------------------------------*/ diff --git a/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C b/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C index 9df568f1b5..ad9bb424eb 100644 --- a/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C +++ b/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,16 +39,6 @@ Usage Specify an alternative geometry scaling factor. The default is @b 1000 (scale @em [m] to @em [mm]). - @param -surface \n - Extract the surface of the volume mesh only. - This can be useful, for example, for surface morphing in an external - package. - - @param -tri \n - Extract a triangulated surface. - The @b -surface options is implicitly selected. - - Note The cellTable information available in the files @c constant/cellTable and @c constant/polyMesh/cellTableId @@ -87,34 +77,13 @@ int main(int argc, char *argv[]) "noBnd", "suppress writing the .bnd file" ); - argList::addBoolOption - ( - "tri", - "Extract a triangulated surface. Implies -surface" - ); - argList::addBoolOption - ( - "surface", - "extract the surface of the volume mesh only" - ); # include "setRootCase.H" # include "createTime.H" instantList timeDirs = timeSelector::select0(runTime, args); - bool surfaceOnly = false; - if (args.optionFound("surface") || args.optionFound("tri")) - { - surfaceOnly = true; - } - fileName exportName = meshWriter::defaultMeshName; - if (surfaceOnly) - { - exportName = meshWriter::defaultSurfaceName; - } - if (args.optionFound("case")) { exportName += '-' + args.globalCaseName(); @@ -132,7 +101,6 @@ int main(int argc, char *argv[]) # include "createPolyMesh.H" - forAll(timeDirs, timeI) { runTime.setTime(timeDirs[timeI], timeI); @@ -156,21 +124,7 @@ int main(int argc, char *argv[]) meshName += '_' + runTime.timeName(); } - if (surfaceOnly) - { - if (args.optionFound("tri")) - { - writer.writeSurface(meshName, true); - } - else - { - writer.writeSurface(meshName); - } - } - else - { - writer.write(meshName); - } + writer.write(meshName); } Info<< nl << endl; diff --git a/applications/utilities/mesh/conversion/foamToSurface/foamToSurface.C b/applications/utilities/mesh/conversion/foamToSurface/foamToSurface.C index f9a255c502..835f3cd14f 100644 --- a/applications/utilities/mesh/conversion/foamToSurface/foamToSurface.C +++ b/applications/utilities/mesh/conversion/foamToSurface/foamToSurface.C @@ -36,6 +36,9 @@ Usage Specify an alternative geometry scaling factor. Eg, use @b 1000 to scale @em [m] to @em [mm]. + @param -tri \n + Triangulate surface. + \*---------------------------------------------------------------------------*/ #include "argList.H" @@ -62,15 +65,19 @@ int main(int argc, char *argv[]) "scale", "specify geometry scaling factor" ); + argList::addBoolOption + ( + "tri", + "triangulate surface" + ); # include "setRootCase.H" - const stringList& params = args.additionalArgs(); + fileName exportName = args[1]; scalar scaleFactor = 0; args.optionReadIfPresent("scale", scaleFactor); - - fileName exportName(params[0]); + const bool doTriangulate = args.optionFound("tri"); fileName exportBase = exportName.lessExt(); word exportExt = exportName.ext(); @@ -107,6 +114,12 @@ int main(int argc, char *argv[]) surf.scalePoints(scaleFactor); Info<< "writing " << exportName; + if (doTriangulate) + { + Info<< " triangulated"; + surf.triangulate(); + } + if (scaleFactor <= 0) { Info<< " without scaling" << endl; diff --git a/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L b/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L index b17e1f6c99..36be409753 100644 --- a/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L +++ b/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,7 +26,7 @@ Application gambitToFoam Description - Converts a GAMBIT mesh to FOAM format. + Converts a GAMBIT mesh to OpenFOAM format. \*---------------------------------------------------------------------------*/ @@ -653,7 +653,7 @@ int main(int argc, char *argv[]) # include "createTime.H" - fileName gambitFile(args.additionalArgs()[0]); + const fileName gambitFile = args[1]; ifstream gambitStream(gambitFile.c_str()); if (!gambitStream) diff --git a/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C b/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C index 45d144e8ab..8218a0cb52 100644 --- a/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C +++ b/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -722,9 +722,8 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" - fileName mshName(args.additionalArgs()[0]); - - bool keepOrientation = args.optionFound("keepOrientation"); + const bool keepOrientation = args.optionFound("keepOrientation"); + IFstream inFile(args[1]); // Storage for points pointField points; @@ -749,9 +748,6 @@ int main(int argc, char *argv[]) // Version 1 or 2 format bool version2Format = false; - - IFstream inFile(mshName); - while (inFile.good()) { string line; diff --git a/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C b/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C index 259ccd2069..2a369cc68a 100644 --- a/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C +++ b/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -595,9 +595,8 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" - fileName ideasName(args.additionalArgs()[0]); - - IFstream inFile(ideasName.c_str()); + const fileName ideasName = args[1]; + IFstream inFile(ideasName); if (!inFile.good()) { diff --git a/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C b/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C index dbd32851bf..153c15e8ae 100644 --- a/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C +++ b/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,7 +26,7 @@ Application kivaToFoam Description - Converts a KIVA3v grid to FOAM format + Converts a KIVA3v grid to OpenFOAM format \*---------------------------------------------------------------------------*/ @@ -68,15 +68,12 @@ int main(int argc, char *argv[]) # include "createTime.H" fileName kivaFileName("otape17"); - if (args.optionFound("file")) - { - kivaFileName = args.option("file"); - } + args.optionReadIfPresent("file", kivaFileName); kivaVersions kivaVersion = kiva3v; if (args.optionFound("version")) { - word kivaVersionName = args.option("version"); + const word kivaVersionName = args["version"]; if (kivaVersionName == "kiva3") { diff --git a/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C b/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C index 1beea38d02..0332308702 100644 --- a/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C +++ b/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -62,10 +62,8 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" - bool readHex = args.optionFound("hex"); - - fileName mshFile(args.additionalArgs()[0]); - IFstream mshStream(mshFile); + const bool readHex = args.optionFound("hex"); + IFstream mshStream(args[1]); label nCells; mshStream >> nCells; diff --git a/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C b/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C index 41080fde78..aaade87a07 100644 --- a/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C +++ b/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -93,11 +93,7 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" - fileName neuFile(args.additionalArgs()[0]); - - - IFstream str(neuFile); - + IFstream str(args[1]); // // Read nodes. @@ -106,7 +102,6 @@ int main(int argc, char *argv[]) Info<< "nNodes:" << nNodes << endl; - pointField points(nNodes); forAll(points, pointI) diff --git a/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C b/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C index 0f2c18732b..52a64d6dde 100644 --- a/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C +++ b/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -85,7 +85,7 @@ int main(int argc, char *argv[]) # include "createTime.H" - IFstream plot3dFile(args.additionalArgs()[0]); + IFstream plot3dFile(args[1]); // Read the plot3d information using a fixed format reader. // Comments in the file are in C++ style, so the stream parser will remove diff --git a/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C b/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C index df229e4bf0..0ccb7a6862 100644 --- a/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C +++ b/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -353,6 +353,7 @@ void dumpFeatures int main(int argc, char *argv[]) { +# include "addOverwriteOption.H" argList::noParallel(); timeSelector::addOptions(true, false); @@ -360,7 +361,6 @@ int main(int argc, char *argv[]) argList::addBoolOption("splitAllFaces"); argList::addBoolOption("concaveMultiCells"); argList::addBoolOption("doNotPreserveFaceZones"); - argList::addBoolOption("overwrite"); # include "setRootCase.H" # include "createTime.H" @@ -385,9 +385,8 @@ int main(int argc, char *argv[]) } } - scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])())); - - scalar minCos = Foam::cos(degToRad(featureAngle)); + const scalar featureAngle = args.argRead(1); + const scalar minCos = Foam::cos(degToRad(featureAngle)); Info<< "Feature:" << featureAngle << endl << "minCos :" << minCos << endl diff --git a/applications/utilities/mesh/conversion/sammToFoam/readPoints.C b/applications/utilities/mesh/conversion/sammToFoam/readPoints.C index 1b83a20d30..76e182dc12 100644 --- a/applications/utilities/mesh/conversion/sammToFoam/readPoints.C +++ b/applications/utilities/mesh/conversion/sammToFoam/readPoints.C @@ -30,6 +30,6 @@ Description // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #define starMesh sammMesh -#include "../starToFoam/readPoints.C" +#include "../star3ToFoam/readPoints.C" // ************************************************************************* // diff --git a/applications/utilities/mesh/conversion/sammToFoam/sammMesh.C b/applications/utilities/mesh/conversion/sammToFoam/sammMesh.C index 3a57153c07..5b0ef44ab4 100644 --- a/applications/utilities/mesh/conversion/sammToFoam/sammMesh.C +++ b/applications/utilities/mesh/conversion/sammToFoam/sammMesh.C @@ -47,7 +47,7 @@ const cellModel* sammMesh::sammTrim4Ptr_ = cellModeller::lookup("sammTrim4"); const cellModel* sammMesh::sammTrim5Ptr_ = cellModeller::lookup("sammTrim5"); const cellModel* sammMesh::sammTrim8Ptr_ = cellModeller::lookup("hexagonalPrism"); -// lookup table giving FOAM face number when looked up with shape index +// lookup table giving OpenFOAM face number when looked up with shape index // (first index) and STAR face number // - first column is always -1 // - last column is -1 for all but hexagonal prism diff --git a/applications/utilities/mesh/conversion/sammToFoam/sammToFoam.C b/applications/utilities/mesh/conversion/sammToFoam/sammToFoam.C index d4bfaa47e2..c1bb529cd6 100644 --- a/applications/utilities/mesh/conversion/sammToFoam/sammToFoam.C +++ b/applications/utilities/mesh/conversion/sammToFoam/sammToFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,7 +26,7 @@ Application sammToFoam Description - Converts a STAR-CD SAMM mesh to FOAM format + Converts a Star-CD (v3) SAMM mesh to OpenFOAM format. \*---------------------------------------------------------------------------*/ @@ -54,8 +54,7 @@ int main(int argc, char *argv[]) # include "createTime.H" - fileName sammFile(args.additionalArgs()[0]); - sammMesh makeMesh(sammFile, runTime, scaleFactor); + sammMesh makeMesh(args[1], runTime, scaleFactor); // Set the precision of the points data to 10 IOstream::defaultPrecision(10); diff --git a/applications/utilities/mesh/conversion/starToFoam/Make/files b/applications/utilities/mesh/conversion/star3ToFoam/Make/files similarity index 85% rename from applications/utilities/mesh/conversion/starToFoam/Make/files rename to applications/utilities/mesh/conversion/star3ToFoam/Make/files index cb233cf069..c50cf188d6 100644 --- a/applications/utilities/mesh/conversion/starToFoam/Make/files +++ b/applications/utilities/mesh/conversion/star3ToFoam/Make/files @@ -14,6 +14,6 @@ createBoundaryFaces.C createPolyBoundary.C purgeCellShapes.C writeMesh.C -starToFoam.C +star3ToFoam.C -EXE = $(FOAM_APPBIN)/starToFoam +EXE = $(FOAM_APPBIN)/star3ToFoam diff --git a/applications/utilities/mesh/conversion/starToFoam/Make/options b/applications/utilities/mesh/conversion/star3ToFoam/Make/options similarity index 100% rename from applications/utilities/mesh/conversion/starToFoam/Make/options rename to applications/utilities/mesh/conversion/star3ToFoam/Make/options diff --git a/applications/utilities/mesh/conversion/starToFoam/calcPointCells.C b/applications/utilities/mesh/conversion/star3ToFoam/calcPointCells.C similarity index 100% rename from applications/utilities/mesh/conversion/starToFoam/calcPointCells.C rename to applications/utilities/mesh/conversion/star3ToFoam/calcPointCells.C diff --git a/applications/utilities/mesh/conversion/starToFoam/coupledFacePair.C b/applications/utilities/mesh/conversion/star3ToFoam/coupledFacePair.C similarity index 100% rename from applications/utilities/mesh/conversion/starToFoam/coupledFacePair.C rename to applications/utilities/mesh/conversion/star3ToFoam/coupledFacePair.C diff --git a/applications/utilities/mesh/conversion/starToFoam/coupledFacePair.H b/applications/utilities/mesh/conversion/star3ToFoam/coupledFacePair.H similarity index 100% rename from applications/utilities/mesh/conversion/starToFoam/coupledFacePair.H rename to applications/utilities/mesh/conversion/star3ToFoam/coupledFacePair.H diff --git a/applications/utilities/mesh/conversion/starToFoam/createBoundaryFaces.C b/applications/utilities/mesh/conversion/star3ToFoam/createBoundaryFaces.C similarity index 100% rename from applications/utilities/mesh/conversion/starToFoam/createBoundaryFaces.C rename to applications/utilities/mesh/conversion/star3ToFoam/createBoundaryFaces.C diff --git a/applications/utilities/mesh/conversion/starToFoam/createCoupleMatches.C b/applications/utilities/mesh/conversion/star3ToFoam/createCoupleMatches.C similarity index 100% rename from applications/utilities/mesh/conversion/starToFoam/createCoupleMatches.C rename to applications/utilities/mesh/conversion/star3ToFoam/createCoupleMatches.C diff --git a/applications/utilities/mesh/conversion/starToFoam/createPolyBoundary.C b/applications/utilities/mesh/conversion/star3ToFoam/createPolyBoundary.C similarity index 100% rename from applications/utilities/mesh/conversion/starToFoam/createPolyBoundary.C rename to applications/utilities/mesh/conversion/star3ToFoam/createPolyBoundary.C diff --git a/applications/utilities/mesh/conversion/starToFoam/createPolyCells.C b/applications/utilities/mesh/conversion/star3ToFoam/createPolyCells.C similarity index 100% rename from applications/utilities/mesh/conversion/starToFoam/createPolyCells.C rename to applications/utilities/mesh/conversion/star3ToFoam/createPolyCells.C diff --git a/applications/utilities/mesh/conversion/starToFoam/fixCollapsedEdges.C b/applications/utilities/mesh/conversion/star3ToFoam/fixCollapsedEdges.C similarity index 100% rename from applications/utilities/mesh/conversion/starToFoam/fixCollapsedEdges.C rename to applications/utilities/mesh/conversion/star3ToFoam/fixCollapsedEdges.C diff --git a/applications/utilities/mesh/conversion/starToFoam/mergeCoupleFacePoints.C b/applications/utilities/mesh/conversion/star3ToFoam/mergeCoupleFacePoints.C similarity index 100% rename from applications/utilities/mesh/conversion/starToFoam/mergeCoupleFacePoints.C rename to applications/utilities/mesh/conversion/star3ToFoam/mergeCoupleFacePoints.C diff --git a/applications/utilities/mesh/conversion/starToFoam/purgeCellShapes.C b/applications/utilities/mesh/conversion/star3ToFoam/purgeCellShapes.C similarity index 100% rename from applications/utilities/mesh/conversion/starToFoam/purgeCellShapes.C rename to applications/utilities/mesh/conversion/star3ToFoam/purgeCellShapes.C diff --git a/applications/utilities/mesh/conversion/starToFoam/readBoundary.C b/applications/utilities/mesh/conversion/star3ToFoam/readBoundary.C similarity index 100% rename from applications/utilities/mesh/conversion/starToFoam/readBoundary.C rename to applications/utilities/mesh/conversion/star3ToFoam/readBoundary.C diff --git a/applications/utilities/mesh/conversion/starToFoam/readCells.C b/applications/utilities/mesh/conversion/star3ToFoam/readCells.C similarity index 100% rename from applications/utilities/mesh/conversion/starToFoam/readCells.C rename to applications/utilities/mesh/conversion/star3ToFoam/readCells.C diff --git a/applications/utilities/mesh/conversion/starToFoam/readCouples.C b/applications/utilities/mesh/conversion/star3ToFoam/readCouples.C similarity index 100% rename from applications/utilities/mesh/conversion/starToFoam/readCouples.C rename to applications/utilities/mesh/conversion/star3ToFoam/readCouples.C diff --git a/applications/utilities/mesh/conversion/starToFoam/readPoints.C b/applications/utilities/mesh/conversion/star3ToFoam/readPoints.C similarity index 100% rename from applications/utilities/mesh/conversion/starToFoam/readPoints.C rename to applications/utilities/mesh/conversion/star3ToFoam/readPoints.C diff --git a/applications/utilities/mesh/conversion/starToFoam/readSeparatedPoints.C b/applications/utilities/mesh/conversion/star3ToFoam/readSeparatedPoints.C similarity index 100% rename from applications/utilities/mesh/conversion/starToFoam/readSeparatedPoints.C rename to applications/utilities/mesh/conversion/star3ToFoam/readSeparatedPoints.C diff --git a/applications/utilities/mesh/conversion/starToFoam/starToFoam.C b/applications/utilities/mesh/conversion/star3ToFoam/star3ToFoam.C similarity index 88% rename from applications/utilities/mesh/conversion/starToFoam/starToFoam.C rename to applications/utilities/mesh/conversion/star3ToFoam/star3ToFoam.C index 90547da3af..29d864e2aa 100644 --- a/applications/utilities/mesh/conversion/starToFoam/starToFoam.C +++ b/applications/utilities/mesh/conversion/star3ToFoam/star3ToFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,10 +23,10 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Application - starToFoam + star3ToFoam Description - Converts a STAR-CD PROSTAR mesh into FOAM format. + Converts a Star-CD (v3) pro-STAR mesh into OpenFOAM format. \*---------------------------------------------------------------------------*/ @@ -54,8 +54,7 @@ int main(int argc, char *argv[]) # include "createTime.H" - fileName starMeshFile(args.additionalArgs()[0]); - starMesh makeMesh(starMeshFile, runTime, scaleFactor); + starMesh makeMesh(args[1], runTime, scaleFactor); // Set the precision of the points data to 10 IOstream::defaultPrecision(10); diff --git a/applications/utilities/mesh/conversion/starToFoam/starMesh.C b/applications/utilities/mesh/conversion/star3ToFoam/starMesh.C similarity index 99% rename from applications/utilities/mesh/conversion/starToFoam/starMesh.C rename to applications/utilities/mesh/conversion/star3ToFoam/starMesh.C index 9f9ddfe94b..2f20a69e39 100644 --- a/applications/utilities/mesh/conversion/starToFoam/starMesh.C +++ b/applications/utilities/mesh/conversion/star3ToFoam/starMesh.C @@ -83,7 +83,7 @@ const label starMesh::sammAddressingTable[9][12] = }; -// lookup table giving FOAM face number when looked up with shape index +// lookup table giving OpenFOAM face number when looked up with shape index // (first index) and STAR face number // - first column is always -1 // - last column is -1 for all but hexagonal prism diff --git a/applications/utilities/mesh/conversion/starToFoam/starMesh.H b/applications/utilities/mesh/conversion/star3ToFoam/starMesh.H similarity index 100% rename from applications/utilities/mesh/conversion/starToFoam/starMesh.H rename to applications/utilities/mesh/conversion/star3ToFoam/starMesh.H diff --git a/applications/utilities/mesh/conversion/starToFoam/writeMesh.C b/applications/utilities/mesh/conversion/star3ToFoam/writeMesh.C similarity index 100% rename from applications/utilities/mesh/conversion/starToFoam/writeMesh.C rename to applications/utilities/mesh/conversion/star3ToFoam/writeMesh.C diff --git a/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C b/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C index e48625230c..88d51a53c2 100644 --- a/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C +++ b/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -81,7 +81,6 @@ int main(int argc, char *argv[]) argList args(argc, argv); Time runTime(args.rootPath(), args.caseName()); - const stringList& params = args.additionalArgs(); // default rescale from [mm] to [m] scalar scaleFactor = args.optionLookupOrDefault("scale", 0.001); @@ -103,7 +102,7 @@ int main(int argc, char *argv[]) IOstream::defaultPrecision(10); // remove extensions and/or trailing '.' - fileName prefix = fileName(params[0]).lessExt(); + const fileName prefix = fileName(args[1]).lessExt(); meshReaders::STARCD reader(prefix, runTime, scaleFactor); diff --git a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C index f830cfc185..7908900a3b 100644 --- a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C +++ b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -103,14 +103,12 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" + const fileName prefix = args[1]; + const bool readFaceFile = !args.optionFound("noFaceFile"); - bool readFaceFile = !args.optionFound("noFaceFile"); - - fileName prefix(args.additionalArgs()[0]); - - fileName nodeFile(prefix + ".node"); - fileName eleFile(prefix + ".ele"); - fileName faceFile(prefix + ".face"); + const fileName nodeFile(prefix + ".node"); + const fileName eleFile(prefix + ".ele"); + const fileName faceFile(prefix + ".face"); if (!readFaceFile) { diff --git a/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C b/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C index 47fc9c922f..ae35892b08 100644 --- a/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C +++ b/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -463,7 +463,7 @@ int main(int argc, char *argv[]) } if (doCellSet) { - word setName(args.option("cellSet")); + const word setName = args["cellSet"]; cellSet cells(mesh, setName); @@ -475,7 +475,7 @@ int main(int argc, char *argv[]) } if (doFaceSet) { - word setName(args.option("faceSet")); + const word setName = args["faceSet"]; faceSet faces(mesh, setName); diff --git a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C index 9140c090ec..4efd69cac8 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C +++ b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -110,7 +110,7 @@ int main(int argc, char *argv[]) if (args.optionFound("dict")) { - fileName dictPath(args.option("dict")); + const fileName dictPath = args["dict"]; meshDictIoPtr.set ( diff --git a/applications/utilities/mesh/generation/extrude2DMesh/Make/files b/applications/utilities/mesh/generation/extrude2DMesh/Make/files index 9153e6dc34..8cc4bd86cd 100644 --- a/applications/utilities/mesh/generation/extrude2DMesh/Make/files +++ b/applications/utilities/mesh/generation/extrude2DMesh/Make/files @@ -1,4 +1,4 @@ extrude2DMesh.C -doExtrude2DMesh.C +extrude2DMeshApp.C EXE = $(FOAM_APPBIN)/extrude2DMesh diff --git a/applications/utilities/mesh/generation/extrude2DMesh/doExtrude2DMesh.C b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C similarity index 95% rename from applications/utilities/mesh/generation/extrude2DMesh/doExtrude2DMesh.C rename to applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C index 0299cade00..d27176baeb 100644 --- a/applications/utilities/mesh/generation/extrude2DMesh/doExtrude2DMesh.C +++ b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,7 +38,6 @@ Usage Note Not sure about the walking of the faces to create the front and back faces. - Tested on one .ccm file. \*---------------------------------------------------------------------------*/ @@ -57,16 +56,17 @@ using namespace Foam; int main(int argc, char *argv[]) { +# include "addOverwriteOption.H" argList::validArgs.append("thickness"); - argList::addBoolOption("overwrite"); + # include "setRootCase.H" # include "createTime.H" runTime.functionObjects().off(); # include "createPolyMesh.H" const word oldInstance = mesh.pointsInstance(); - scalar thickness(readScalar(IStringStream(args.additionalArgs()[0])())); - bool overwrite = args.optionFound("overwrite"); + const scalar thickness = args.argRead(1); + const bool overwrite = args.optionFound("overwrite"); // Check that mesh is 2D diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index 528551eb51..4ab7a771be 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -120,11 +120,8 @@ void writeMesh int main(int argc, char *argv[]) { - argList::addBoolOption - ( - "overwrite", - "overwrite existing mesh files" - ); +# include "addOverwriteOption.H" + # include "setRootCase.H" # include "createTime.H" runTime.functionObjects().off(); diff --git a/applications/utilities/mesh/manipulation/attachMesh/attachMesh.C b/applications/utilities/mesh/manipulation/attachMesh/attachMesh.C index 35247413e1..066a800ab9 100644 --- a/applications/utilities/mesh/manipulation/attachMesh/attachMesh.C +++ b/applications/utilities/mesh/manipulation/attachMesh/attachMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,8 +41,8 @@ using namespace Foam; int main(int argc, char *argv[]) { +# include "addOverwriteOption.H" argList::noParallel(); - argList::addBoolOption("overwrite"); # include "setRootCase.H" # include "createTime.H" @@ -50,7 +50,7 @@ int main(int argc, char *argv[]) # include "createPolyMesh.H" const word oldInstance = mesh.pointsInstance(); - bool overwrite = args.optionFound("overwrite"); + const bool overwrite = args.optionFound("overwrite"); if (!overwrite) { diff --git a/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C b/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C index abad711392..c5fcb20d05 100644 --- a/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C +++ b/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -69,9 +69,9 @@ void collectFeatureEdges(const boundaryMesh& bMesh, labelList& markedEdges) int main(int argc, char *argv[]) { +# include "addOverwriteOption.H" argList::noParallel(); argList::validArgs.append("feature angle[0-180]"); - argList::addBoolOption("overwrite"); # include "setRootCase.H" # include "createTime.H" @@ -84,21 +84,20 @@ int main(int argc, char *argv[]) << " s\n" << endl << endl; - // - // Use boundaryMesh to reuse all the featureEdge stuff in there. - // + const scalar featureAngle = args.argRead(1); + const bool overwrite = args.optionFound("overwrite"); - boundaryMesh bMesh; - - scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])())); - bool overwrite = args.optionFound("overwrite"); - - scalar minCos = Foam::cos(degToRad(featureAngle)); + const scalar minCos = Foam::cos(degToRad(featureAngle)); Info<< "Feature:" << featureAngle << endl << "minCos :" << minCos << endl << endl; + // + // Use boundaryMesh to reuse all the featureEdge stuff in there. + // + + boundaryMesh bMesh; bMesh.read(mesh); // Set feature angle (calculate feature edges) diff --git a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C index dc94786222..06f635ef86 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C +++ b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -125,12 +125,13 @@ label findPatchID(const polyMesh& mesh, const word& name) int main(int argc, char *argv[]) { +# include "addOverwriteOption.H" # include "addRegionOption.H" + argList::validArgs.append("faceZone"); argList::validArgs.append("patch"); argList::addOption("additionalPatches", "(patch2 .. patchN)"); argList::addBoolOption("internalFacesOnly"); - argList::addBoolOption("overwrite"); # include "setRootCase.H" # include "createTime.H" @@ -142,7 +143,7 @@ int main(int argc, char *argv[]) const faceZoneMesh& faceZones = mesh.faceZones(); // Faces to baffle - faceZoneID zoneID(args.additionalArgs()[0], faceZones); + faceZoneID zoneID(args[1], faceZones); Info<< "Converting faces on zone " << zoneID.name() << " into baffles." << nl << endl; @@ -167,7 +168,7 @@ int main(int argc, char *argv[]) // Patches to put baffles into DynamicList