diff --git a/applications/solvers/combustion/dieselEngineFoam/createFields.H b/applications/solvers/combustion/dieselEngineFoam/createFields.H index a75c6a7d07a677bf92d8456b845b40655d059869..37aeca4c091586b1a6c852afa1228d04d9264a93 100644 --- a/applications/solvers/combustion/dieselEngineFoam/createFields.H +++ b/applications/solvers/combustion/dieselEngineFoam/createFields.H @@ -6,7 +6,7 @@ autoPtr<psiChemistryModel> pChemistry ); psiChemistryModel& chemistry = pChemistry(); -hCombustionThermo& thermo = chemistry.thermo(); +hsCombustionThermo& thermo = chemistry.thermo(); basicMultiComponentMixture& composition = thermo.composition(); PtrList<volScalarField>& 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<scalar, volMesh> 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 6507c117a010738ab146419030813033fe591709..2e6a9c4b05c17d50ffe7c8e986e74528c8f71b57 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 0406f7fbd492100a3814d0531ef25487636df4c1..0000000000000000000000000000000000000000 --- 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 0000000000000000000000000000000000000000..7ae59feb8199fc909983ed77cdba242f4d443b6c --- /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 4769a00c77efa19c1ab497ac0c7fb39b71f99d29..1e6ddfe0c190a5ea3e61f854f3d76b3c9ad6d940 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 0000000000000000000000000000000000000000..713a0552018db8ec0774d506ed003e54a58054df --- /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 0000000000000000000000000000000000000000..f32c72860dbd12c0d8ea29e4b94bc36fb7b85547 --- /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 0000000000000000000000000000000000000000..826d736bd0f66081e00d868f15363948aa6211a5 --- /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 0000000000000000000000000000000000000000..3b19a78173ce42e021d36d76f9546e95de7d6f48 --- /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 0000000000000000000000000000000000000000..3b61f2c7b95cfd705eb219d208fcd55f5dc02185 --- /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 0000000000000000000000000000000000000000..5b1262b70d476c5b469d5fcad4404f3a75f08512 --- /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 0000000000000000000000000000000000000000..42f59c8e176d991d138c6378b6dd260e163101b0 --- /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 0000000000000000000000000000000000000000..538d43073e63526057913e064e11ea093cd4039a --- /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::fvScalarMatrix> +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::volScalarField> 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 0000000000000000000000000000000000000000..19a3392bbb6ad05c6e00baf4ae9128da5055ef1b --- /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<combustionModel> 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<volScalarField> wFuelNorm() const = 0; + + //- Fuel consumption rate matrix i.e. source-term for the fuel equation + virtual tmp<fvScalarMatrix> R(volScalarField& fu) const; + + //- Heat-release rate calculated from the given + // fuel consumption rate matrix + virtual tmp<volScalarField> 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 0000000000000000000000000000000000000000..31308b8ccd5875ec6b073e92f5e4a5cea9209dd3 --- /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> 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<combustionModel> + (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 0000000000000000000000000000000000000000..2e040e1eac95e6f20c995279547335b6441e7c0e --- /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::volScalarField> +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 0000000000000000000000000000000000000000..4c62e5fa03d7f12d090a202a2fef4fbcbe81e45d --- /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<volScalarField> 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 0000000000000000000000000000000000000000..dd75660aae354b7d3ddca810ceb4f22355641da1 --- /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::volScalarField> +Foam::combustionModels::noCombustion::wFuelNorm() const +{ + return tmp<Foam::volScalarField> + ( + 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 0000000000000000000000000000000000000000..e381413cd8f208d77d5c2553bfbccb22a62fe968 --- /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<volScalarField> 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 0000000000000000000000000000000000000000..a399df8536723747cd9f2a32b379e6c5bc9dd996 --- /dev/null +++ b/applications/solvers/combustion/fireFoam/createFields.H @@ -0,0 +1,130 @@ +Info<< "Reading thermophysical properties\n" << endl; + +autoPtr<hsCombustionThermo> 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<compressible::turbulenceModel> 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<combustionModel::combustionModel> 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<scalar>::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 0000000000000000000000000000000000000000..246a186c903546aaa10a17e732beb87d1745bd71 --- /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; oCorr<nOuterCorr; oCorr++) + { + #include "UEqn.H" + + #include "ftEqn.H" + #include "fuhsEqn.H" + + // --- PISO loop + for (int corr=0; corr<nCorr; corr++) + { + #include "pEqn.H" + } + } + + turbulence->correct(); + + 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 0000000000000000000000000000000000000000..57406da753360b61b8b352bf5f737a64cb057bf3 --- /dev/null +++ b/applications/solvers/combustion/fireFoam/ftEqn.H @@ -0,0 +1,25 @@ +tmp<fv::convectionScheme<scalar> > mvConvection +( + fv::convectionScheme<scalar>::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 0000000000000000000000000000000000000000..798cee4007e4979d948a7ba4d44af90aba62f5cb --- /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 0000000000000000000000000000000000000000..907398581f2db2bc49275614b726c2ca2aeedabe --- /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 e982f635a14fefba2fa2a03153961be4e1bf8fca..d85350297af19cb8ab7f15cd023735aa2c579571 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 0000000000000000000000000000000000000000..9697c6e1ed2d0753f9c0803081cc6929050ef446 --- /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 a1a978210dd2866432bddbd5a9dc6f0d7cff8362..8bfa872d7b395dd0907d4fdb6355322d97853731 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 0b2238031ca8d51e5e579e42232ae05820eee9c2..bd8f7ea1fb176bd69dc9d87c9afe30c62fa69750 100644 --- a/applications/solvers/combustion/reactingFoam/createFields.H +++ b/applications/solvers/combustion/reactingFoam/createFields.H @@ -5,7 +5,7 @@ autoPtr<psiChemistryModel> pChemistry ); psiChemistryModel& chemistry = pChemistry(); -hCombustionThermo& thermo = chemistry.thermo(); +hsCombustionThermo& thermo = chemistry.thermo(); basicMultiComponentMixture& composition = thermo.composition(); PtrList<volScalarField>& 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<scalar, volMesh> 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 0000000000000000000000000000000000000000..e3fa4e7a135adb1539de8d1e548329a8f97c7a06 --- /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 0000000000000000000000000000000000000000..9443f909a356699185bfbc8497cf46e26fd1ed3b --- /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 2d4ae7589ad1074be113b39e3a047ea7e658aef5..e9fe757e3ba4d96b40ecd955242c41ffd023c8aa 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 e982f635a14fefba2fa2a03153961be4e1bf8fca..d85350297af19cb8ab7f15cd023735aa2c579571 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 0000000000000000000000000000000000000000..9697c6e1ed2d0753f9c0803081cc6929050ef446 --- /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 a1a978210dd2866432bddbd5a9dc6f0d7cff8362..8bfa872d7b395dd0907d4fdb6355322d97853731 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 d2f6f5e4d498ef70f1550a89b1b4332747a9ab88..d4119b8c9263bfdfc3c3eb8942b0dfc6b6007ac9 100644 --- a/applications/solvers/combustion/rhoReactingFoam/createFields.H +++ b/applications/solvers/combustion/rhoReactingFoam/createFields.H @@ -5,7 +5,7 @@ autoPtr<rhoChemistryModel> pChemistry ); rhoChemistryModel& chemistry = pChemistry(); -hReactionThermo& thermo = chemistry.thermo(); +hsReactionThermo& thermo = chemistry.thermo(); basicMultiComponentMixture& composition = thermo.composition(); PtrList<volScalarField>& 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<scalar, volMesh> 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 0000000000000000000000000000000000000000..81bd6ea9d7bb4a03834d5db86deb7d728eb3d9db --- /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 cc37dd09c1847278b0459ae42669ab72b5607da4..79b76e014d63eecee191ccd063ddca5455ac653f 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 5489dfefbaaa07425e5c0e84576c5ed001a64435..50fc7f575b5e721711a250fa2b7d9d8ddf184fda 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 389a065935004bd9f11154db9447fa86989f59d1..872664f3a52a717d3794d02c800602598100a4f4 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 d0a284a0e17039e394a7d806ba1a5ce84f24a4ee..65be09775caccc5a228e74991dcdaf5bc150c368 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<volScalarField>& 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<scalar, volMesh> 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 2eaf6315cfb9fabe9f4f2ae6e1149fbd111c9739..0000000000000000000000000000000000000000 --- 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 0000000000000000000000000000000000000000..ced6b6400448a84182e7fba55a56bb06d18f14ab --- /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 5489dfefbaaa07425e5c0e84576c5ed001a64435..50fc7f575b5e721711a250fa2b7d9d8ddf184fda 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 68c0f8aee8c32092a4870766e9f7c09f904cdb44..cf3f484bdbcb97ef4cccdc73a8154db9bf8b203c 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<volScalarField>& 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<scalar, volMesh> 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 0715989df7a77d848fae8000cc82f34cc4d53b5b..73c276c2942d857e689c31bfeba9ed9cac565a68 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 b345ffe28a08c484e72213ef802af355c27879de..436fda7a8bb9089cda3c62e1dd48fd38461aabea 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<nCorr; corr++) diff --git a/applications/solvers/lagrangian/reactingParcelFoam/chemistry.H b/applications/solvers/lagrangian/reactingParcelFoam/chemistry.H index 5489dfefbaaa07425e5c0e84576c5ed001a64435..50fc7f575b5e721711a250fa2b7d9d8ddf184fda 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/chemistry.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/chemistry.H @@ -22,4 +22,6 @@ { kappa = 1.0; } + + chemistrySh = kappa*chemistry.Sh()(); } diff --git a/applications/solvers/lagrangian/reactingParcelFoam/createFields.H b/applications/solvers/lagrangian/reactingParcelFoam/createFields.H index e825c2cffbc87910a3612c41818abe0f651a3096..e071ac8b3d32e5ab0969fea6ba1621ee1fe19f51 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/createFields.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/createFields.H @@ -6,7 +6,7 @@ ); psiChemistryModel& chemistry = pChemistry(); - hCombustionThermo& thermo = chemistry.thermo(); + hsCombustionThermo& thermo = chemistry.thermo(); basicMultiComponentMixture& composition = thermo.composition(); PtrList<volScalarField>& 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<scalar, volMesh> 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 d686e452f46f053c7b52f7b19872f964d9c054ef..0000000000000000000000000000000000000000 --- 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 0000000000000000000000000000000000000000..ce12ec3ad48f74de6a2977558cead524ffc6e460 --- /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 4dfd367d0920ab2b5a15406eb1969cdcc7c80f37..ad3b5b461c465f2c2f3f7078222ad646297e31c7 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 ee0088c3974b5b5fe651337c1818c1951333427e..ef1ccbd150ca959eff343b108feeee6b092e596b 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 b9f69fd043691f4c5fc036b65d2ffb956457dc4d..cf5b2d38ec344b9038a7dea52587adba31ec5ec2 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<scalar>("float", xxx)) diff --git a/applications/test/ODETest/ODETest.C b/applications/test/ODETest/ODETest.C index acb444a0a52828e54d233ac88f83d398889cc9b3..1da2f700c58c8044b365cecbff8d73ebd2dfc042 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 = ODESolver::New(ODESolverName, ode); + autoPtr<ODESolver> 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 e5670b3cbe91c9c033d01b0f8984fed4e3256e34..d203fad8931b903209cd7857c0deb03f2a4dbda7 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 ff2add8169b156cd75213095cfad581c9d286daa..fac8dd663103fdc03a87800e7b51fd8c7d3b46f1 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 ce52da1e00e745a21195e100be72d0a78c5ab8f1..62c78fbd0fb514cd94a20f2160596bd2c795cf79 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 1a845d7029c9563886c2a614c80a31d05ece8b66..a2436852fa630bf737f05d3cd014af8361a508d3 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<point>(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 5cc25161dd54516f1566f171925eadbbbc6ae33c..a88d1cfd750168fcd743d17588487d745db7b000 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 15ba56f4faef9275bf25eee2d798395e94461a53..e03cb70e07e72d7ec895f9378ddcdc54bda1d355 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 cf24ab3435f7fe5be5d5dca5e3ec2ab45b36ae5e..b6ac551d768477eeb3f1395233049bc5a74da203 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 01653ae705946dc92da3d8fa3111e1046569ff99..d7f06bb061348b912b5dbdab1064ded45de94f3d 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"]; - } - - fileName CHEMKINFileName(args.additionalArgs()[0]); + args.optionReadIfPresent("thermo", thermoFileName); - chemkinReader ck(CHEMKINFileName, thermoFileName); + chemkinReader ck(args[1], 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<gasReaction>& reactions = ck.reactions(); diff --git a/applications/test/spline/splineTest.C b/applications/test/spline/splineTest.C index 3d92a7dd241357d2a840cfa456d4503953c84607..600bf0d4f5d4230ea0101c7fc8671cddbd81364a 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 10856cbead9564fcf9ba5601a66eab5aab87913d..9011d8735dd988c3a43eabe0eeaa449bad3f2bc9 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 c8be29cbf35383c4885640547f9a613e16984dec..e70c4e336151507f33708c0fceb23610b76bae9c 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 d2d9941d63d11f7c2e220a15594f52b122c84619..9c57e17dbf70a84b8d7155cf2b96babd832612cb 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 3f1f29b29846d86447fe029442dd3994304b6a8f..a0e2b15f34f17c15b190761b3030bb4be2326cf0 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<scalar>(1); + const scalar angle = args.argRead<scalar>(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 fa055e2758fb85235933cc50f41f08cbe03686e8..e16fe07cffc17ef408a06129471826ff672a7a6a 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<scalar>(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 b46a421eb37c35c99781a2f40014a3712ecaf014..c57820803e87e540fcde98497aeba1d77cef60c0 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 6175bd4e168bcdf6efab04f11cffad11500e83d4..cb87a9f568f79a86d01fcadf339730361618f075 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 731eac7855b059c01cd3ea7ed09314a35340735b..c6ad157d236b993e5d0b35fb9c0b2ea423bf4a6e 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<scalar>(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 a7d13ba2c3de3b8cf7fa79168ce9f8cb9811a308..decd3935cca7787bf510baff47dc6cc66fa8ed70 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 eb10e23d7880fefd65caa91ab5f009d0a8f17046..87f91eafb40ef9afbbfbeeb0bee439cee8a13a31 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 1e1548f517e281544167e6ad3a896d5530b60742..af7023cbb0a0a9e28b0065d027e79ff267817c8d 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<scalar>(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 671c9e7a7ef3a93361c3595660781b65947326d5..76fb67afa1f529ead3024dff86b5f61a6b25840d 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 d07eeb7b69629255a079f96dfb8f88a0a8ffb99a..f452a9f083b3f7449a45bf52575871d71cf460b8 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 7ddfeb5fa23e90a649a755255cc0211d3c6dd039..be693be7377aa94c53e57eb7eb645f2032f3cca7 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 333188c072b7aea06a31559985bebbb674f8034c..b810511a7604829a7b45d414833e1e48f08e45f9 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 79a6d75633fa2682bc99a0e71a87cf64dfec0092..2b75740021ed6f17743282808336d343df622956 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 00b6874b5b256324820bcc3b2073652a8a94b6fa..79f2c4753e0c7eb6f97e6f9682d144570ade9e3d 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 a4d8b25f3be24cf67d4379cc85c9e177ab95e06d..b9ce333256144ba45d5f7c07f408f0f90a1218a7 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 9df568f1b54602fe22fef8c5cbb76cc0422b2360..ad9bb424ebe96215c0b2974ae96e613eff836247 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 f9a255c502109cdf2e2415c138e0c18a5fa892e4..835f3cd14f93fa9f752e9259b7f5d1c31796a108 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<scalar>("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 b17e1f6c99488257b198003a4d36fcdcf304922e..36be409753d3eb00afba9e1757615cc2e6cf6f19 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 45d144e8ab79e9e290b35bc44767b65ffa58742d..8218a0cb52275a4bbc5a6624ae077355f3f171f2 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 259ccd2069b02213f3cc48f12dbe04bf4def823e..2a369cc68a92225772484a5cec7f6fbdf609c249 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 dbd32851bfba14feefbad3a98a772ab1521b571f..153c15e8ae51b8eb1510c61ed5367c501644a961 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 1beea38d029568dfb78a2afa8bac6dbccd5c9670..033230870248d7954fbd5743f4fa6b3a6455a13a 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 41080fde783799b158a71eb898acd8dd0107294c..aaade87a07a7523d82c401dc6934630aea2fe472 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 0f2c18732b8c996183e773bb95922451d578526d..52a64d6ddeace75675ade4f46325f88bc480c476 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 df229e4bf0428e59183165c350a32c6cc65476ad..0ccb7a686202a727242ab81ba062d4a4a0db30ba 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<scalar>(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 1b83a20d3051d4bb00abd62fa8cf96b13b5d9b0a..76e182dc122b2a5d94e6419d18a4335630af242b 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 3a57153c071291488d844f6c07c33c4982bd1d29..5b0ef44ab4f5ae56e9d8d7f5d2e1979e54f6db3d 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 d4bfaa47e23d345e5754b15a451897767baa653e..c1bb529cd6c7b5700de0c288ae27d4411f630dbd 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 cb233cf06906a82444893098dc6b37a2f7304f90..c50cf188d692a088e0dd26276544f3f61c1ce8d6 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 90547da3afd5bf1a990c41f11780ddf2f750d40e..29d864e2aa150ec0a97a096d622acafad4db2ac6 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 9f9ddfe94b5fff50caef4dfead37a9b963e1c3d9..2f20a69e3900444f96adad29aec20330144e5617 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 e48625230c05af3cbe7b4b1e1cf0fc9f7cfd5c0c..88d51a53c2149bf90436a430d50bebb0ef5605f8 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 f830cfc18535e1861e6eb27591cccec967d81b33..7908900a3bfc35d1b061eb9a3a24dbe8da9691f5 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 47fc9c922f3a8dff0ea6a5958736566d249e12a0..ae35892b08cffdafaae66f603c22871989e4343a 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 9140c090ec605054c6619107c6499121627e572a..4efd69cac8f180e5e1e3a43ed9337383b0a960b1 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 9153e6dc347581c615aed4cf7ce2919424f4a7e4..8cc4bd86cdfe7a24a9eefb19037eeabc80556be6 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 0299cade00c112a13970ef939e3cdb6cccc63229..d27176baeb547e1eed911967641f6ee3b2e56402 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<scalar>(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 528551eb51a5ba176d2c42df26a50614f41d0301..4ab7a771beaafd2d4be95f18cc6b2ab68312c656 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 35247413e1f51c154a762c252969a29bcaf8ece5..066a800ab933cf9ce021c4fa7717f979308bbd0f 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 abad71139266d839b94bb5da7adc8b60a98d10d4..c5fcb20d0543a7cbcfc1393521a1de635f5848e8 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. - // - - boundaryMesh bMesh; - - scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])())); - bool overwrite = args.optionFound("overwrite"); + const scalar featureAngle = args.argRead<scalar>(1); + const 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 dc947862224c73c8c513729b0efdb8288d89cde5..06f635ef86c3147f935b1f26cee3229803f35351 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<label> newPatches(1); - word patchName(args.additionalArgs()[1]); + const word patchName = args[2]; newPatches.append(findPatchID(mesh, patchName)); Info<< "Using patch " << patchName << " at index " << newPatches[0] << endl; @@ -191,9 +192,8 @@ int main(int argc, char *argv[]) } - bool overwrite = args.optionFound("overwrite"); - - bool internalFacesOnly = args.optionFound("internalFacesOnly"); + const bool overwrite = args.optionFound("overwrite"); + const bool internalFacesOnly = args.optionFound("internalFacesOnly"); if (internalFacesOnly) { diff --git a/applications/utilities/mesh/manipulation/createPatch/createPatch.C b/applications/utilities/mesh/manipulation/createPatch/createPatch.C index d59f7317b9412212bce8799084fe3db66417225c..90f6377b6d60681be64a17d8d348f56181665c21 100644 --- a/applications/utilities/mesh/manipulation/createPatch/createPatch.C +++ b/applications/utilities/mesh/manipulation/createPatch/createPatch.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 @@ -516,8 +516,8 @@ void syncPoints int main(int argc, char *argv[]) { +# include "addOverwriteOption.H" # include "addRegionOption.H" - argList::addBoolOption("overwrite"); # include "setRootCase.H" # include "createTime.H" diff --git a/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C b/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C index f438a1f9637537c09dffbed428cc84d341494fbd..d9e2d89ec94fba264d348820721876a48c714b1b 100644 --- a/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C +++ b/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.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,7 +47,7 @@ int main(int argc, char *argv[]) # include "setRootCase.H" - scalar scaleFactor(readScalar(IStringStream(args.additionalArgs()[0])())); + const scalar scaleFactor = args.argRead<scalar>(1); # include "createTime.H" # include "createMesh.H" diff --git a/applications/utilities/mesh/manipulation/insideCells/insideCells.C b/applications/utilities/mesh/manipulation/insideCells/insideCells.C index 194b9a4c556477d79533e378b3beb008623066d8..20ae6041699fbc28c0aedfd46810a355649bdab4 100644 --- a/applications/utilities/mesh/manipulation/insideCells/insideCells.C +++ b/applications/utilities/mesh/manipulation/insideCells/insideCells.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,9 +51,8 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createPolyMesh.H" - fileName surfName(args.additionalArgs()[0]); - fileName setName(args.additionalArgs()[1]); - + const fileName surfName = args[1]; + const fileName setName = args[2]; // Read surface Info<< "Reading surface from " << surfName << endl; diff --git a/applications/utilities/mesh/manipulation/mergeMeshes/mergeMeshes.C b/applications/utilities/mesh/manipulation/mergeMeshes/mergeMeshes.C index 620201ba91795b2bfbb362b3c603811fded8cfba..475d92770dc7b7be970255fd11b4f7d23670051d 100644 --- a/applications/utilities/mesh/manipulation/mergeMeshes/mergeMeshes.C +++ b/applications/utilities/mesh/manipulation/mergeMeshes/mergeMeshes.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 diff --git a/applications/utilities/mesh/manipulation/mergeMeshes/setRoots.H b/applications/utilities/mesh/manipulation/mergeMeshes/setRoots.H index 2f421ba957abc7be112fa1f8e013b2b62decbd9d..3d1fdd0132b050324b56971beb69950c9e3a933e 100644 --- a/applications/utilities/mesh/manipulation/mergeMeshes/setRoots.H +++ b/applications/utilities/mesh/manipulation/mergeMeshes/setRoots.H @@ -15,13 +15,13 @@ FatalError.exit(); } - fileName rootDirMaster(args.additionalArgs()[0]); - fileName caseDirMaster(args.additionalArgs()[1]); + fileName rootDirMaster = args[1]; + fileName caseDirMaster = args[2]; word masterRegion = polyMesh::defaultRegion; args.optionReadIfPresent("masterRegion", masterRegion); - fileName rootDirToAdd(args.additionalArgs()[2]); - fileName caseDirToAdd(args.additionalArgs()[3]); + fileName rootDirToAdd = args[3]; + fileName caseDirToAdd = args[4]; word addRegion = polyMesh::defaultRegion; args.optionReadIfPresent("addRegion", addRegion); @@ -29,3 +29,4 @@ << " region " << masterRegion << nl << "mesh to add: " << rootDirToAdd << " " << caseDirToAdd << " region " << addRegion << endl; + diff --git a/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C b/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C index 5053c95071c8f117e0d9954394b504f89d78f5b0..c950eb8a9222c54716d871a0ed773c697cc711e6 100644 --- a/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C +++ b/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.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 @@ -222,19 +222,20 @@ labelList findBaffles(const polyMesh& mesh, const labelList& boundaryFaces) int main(int argc, char *argv[]) { +# include "addOverwriteOption.H" # include "addRegionOption.H" argList::addBoolOption("split"); - argList::addBoolOption("overwrite"); argList::addBoolOption("detectOnly"); + # include "setRootCase.H" # include "createTime.H" runTime.functionObjects().off(); # include "createNamedMesh.H" const word oldInstance = mesh.pointsInstance(); - bool split = args.optionFound("split"); - bool overwrite = args.optionFound("overwrite"); - bool detectOnly = args.optionFound("detectOnly"); + const bool split = args.optionFound("split"); + const bool overwrite = args.optionFound("overwrite"); + const bool detectOnly = args.optionFound("detectOnly"); // Collect all boundary faces labelList boundaryFaces(mesh.nFaces() - mesh.nInternalFaces()); diff --git a/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C b/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C index cf0b6ccd2790117f2e5437c4574186b9c8c528ae..dba1d6d7214136b1844f523dee9727003975393e 100644 --- a/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C +++ b/applications/utilities/mesh/manipulation/objToVTK/objToVTK.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 @@ -116,8 +116,8 @@ int main(int argc, char *argv[]) argList::validArgs.append("output VTK file"); argList::argList args(argc, argv); - fileName objName(args.additionalArgs()[0]); - fileName outName(args.additionalArgs()[1]); + const fileName objName = args[1]; + const fileName outName = args[2]; std::ifstream OBJfile(objName.c_str()); diff --git a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C index a33afdf711b450e8fa62760674d7e090519e2034..85da9ce113ba8961dfdd5736c567a9aa934a773a 100644 --- a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C +++ b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.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 @@ -291,8 +291,8 @@ label twoDNess(const polyMesh& mesh) int main(int argc, char *argv[]) { +# include "addOverwriteOption.H" argList::addBoolOption("dict"); - argList::addBoolOption("overwrite"); # include "setRootCase.H" # include "createTime.H" @@ -307,8 +307,8 @@ int main(int argc, char *argv[]) // Read/construct control dictionary // - bool readDict = args.optionFound("dict"); - bool overwrite = args.optionFound("overwrite"); + const bool readDict = args.optionFound("dict"); + const bool overwrite = args.optionFound("overwrite"); // List of cells to refine labelList refCells; diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C index 099cdcdeadae62a92e440d1c2b94c4b5557bc9e5..ab310515cc46a408e73a8fba7b3eb51c9459f4ff 100644 --- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C +++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.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 anispulation | ------------------------------------------------------------------------------- License @@ -367,8 +367,8 @@ int main(int argc, char *argv[]) argList::addBoolOption("blockOrder"); argList::addBoolOption("orderPoints"); argList::addBoolOption("writeMaps"); - argList::addBoolOption("overwrite"); +# include "addOverwriteOption.H" # include "addTimeOptions.H" # include "setRootCase.H" @@ -409,7 +409,7 @@ int main(int argc, char *argv[]) << endl; } - bool overwrite = args.optionFound("overwrite"); + const bool overwrite = args.optionFound("overwrite"); label band = getBand(mesh.faceOwner(), mesh.faceNeighbour()); diff --git a/applications/utilities/mesh/manipulation/rotateMesh/rotateMesh.C b/applications/utilities/mesh/manipulation/rotateMesh/rotateMesh.C index 84b2ed78a79419c78012888731c4b5e3d522450a..e51d4409b64818b28a2ebba528cac741a68c12a6 100644 --- a/applications/utilities/mesh/manipulation/rotateMesh/rotateMesh.C +++ b/applications/utilities/mesh/manipulation/rotateMesh/rotateMesh.C @@ -2,8 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. - \\/ M anispulation | + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -75,10 +75,10 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" - vector n1(IStringStream(args.additionalArgs()[0])()); + vector n1 = args.argRead<vector>(1); n1 /= mag(n1); - vector n2(IStringStream(args.additionalArgs()[1])()); + vector n2 = args.argRead<vector>(2); n2 /= mag(n2); tensor T = rotationTensor(n1, n2); diff --git a/applications/utilities/mesh/manipulation/setSet/setSet.C b/applications/utilities/mesh/manipulation/setSet/setSet.C index bb187dc36101a8295d1404d24b2d3a4fe3f10a50..b3d98d40ef1000b11c5683ca9773682e2498ab8d 100644 --- a/applications/utilities/mesh/manipulation/setSet/setSet.C +++ b/applications/utilities/mesh/manipulation/setSet/setSet.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 @@ -835,15 +835,14 @@ int main(int argc, char *argv[]) # include "createTime.H" instantList timeDirs = timeSelector::select0(runTime, args); - bool writeVTK = !args.optionFound("noVTK"); - bool loop = args.optionFound("loop"); - bool batch = args.optionFound("batch"); - + const bool writeVTK = !args.optionFound("noVTK"); + const bool loop = args.optionFound("loop"); + const bool batch = args.optionFound("batch"); if (loop && !batch) { FatalErrorIn(args.executable()) - << "Can only loop when in batch mode." + << "Can only loop in batch mode." << exit(FatalError); } @@ -885,7 +884,7 @@ int main(int argc, char *argv[]) if (batch) { - fileName batchFile(args.option("batch")); + const fileName batchFile = args["batch"]; Info<< "Reading commands from file " << batchFile << endl; diff --git a/applications/utilities/mesh/manipulation/singleCellMesh/singleCellMesh.C b/applications/utilities/mesh/manipulation/singleCellMesh/singleCellMesh.C index 927d8ca8549173daf49081db0b4347cb439573e4..44238b51b69a5a7ba5a11a49b1b7bb58564e9a68 100644 --- a/applications/utilities/mesh/manipulation/singleCellMesh/singleCellMesh.C +++ b/applications/utilities/mesh/manipulation/singleCellMesh/singleCellMesh.C @@ -66,9 +66,9 @@ void interpolateFields int main(int argc, char *argv[]) { - argList::addBoolOption("overwrite"); - +# include "addOverwriteOption.H" # include "addTimeOptions.H" + # include "setRootCase.H" # include "createTime.H" // Get times list @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) # include "createMesh.H" const word oldInstance = mesh.pointsInstance(); - bool overwrite = args.optionFound("overwrite"); + const bool overwrite = args.optionFound("overwrite"); // Read objects in time directory diff --git a/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C b/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C index 0d8fe6490d811de6046cc67b8bf9c074bf4901c5..4f9e7b7c4f7ae6c7a793d0b6cdfdf1fff9c573e6 100644 --- a/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C +++ b/applications/utilities/mesh/manipulation/splitMesh/splitMesh.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 @@ -111,11 +111,11 @@ void checkPatch(const polyBoundaryMesh& bMesh, const word& name) int main(int argc, char *argv[]) { argList::noParallel(); +# include "addOverwriteOption.H" argList::validArgs.append("faceSet"); argList::validArgs.append("masterPatch"); argList::validArgs.append("slavePatch"); - argList::addBoolOption("overwrite"); # include "setRootCase.H" # include "createTime.H" @@ -123,10 +123,10 @@ int main(int argc, char *argv[]) # include "createPolyMesh.H" const word oldInstance = mesh.pointsInstance(); - word setName(args.additionalArgs()[0]); - word masterPatch(args.additionalArgs()[1]); - word slavePatch(args.additionalArgs()[2]); - bool overwrite = args.optionFound("overwrite"); + const word setName = args[1]; + const word masterPatch = args[2]; + const word slavePatch = args[3]; + const bool overwrite = args.optionFound("overwrite"); // List of faces to split faceSet facesSet(mesh, setName); diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index a584789167936e2ced0cc9f8d925d34a49ea6ce3..7b9d5ea8cef40a92f51bdf95ffa56ee545ae5bea 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.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 @@ -1309,13 +1309,13 @@ label findCorrespondingRegion int main(int argc, char *argv[]) { +# include "addOverwriteOption.H" argList::addBoolOption("cellZones"); argList::addBoolOption("cellZonesOnly"); argList::addOption("blockedFaces", "faceSet"); argList::addBoolOption("makeCellZones"); argList::addBoolOption("largestOnly"); argList::addOption("insidePoint", "point"); - argList::addBoolOption("overwrite"); argList::addBoolOption("detectOnly"); argList::addBoolOption("sloppyCellZones"); @@ -1326,21 +1326,20 @@ int main(int argc, char *argv[]) const word oldInstance = mesh.pointsInstance(); word blockedFacesName; - if (args.optionFound("blockedFaces")) + if (args.optionReadIfPresent("blockedFaces", blockedFacesName)) { - blockedFacesName = args.option("blockedFaces"); Info<< "Reading blocked internal faces from faceSet " << blockedFacesName << nl << endl; } - bool makeCellZones = args.optionFound("makeCellZones"); - bool largestOnly = args.optionFound("largestOnly"); - bool insidePoint = args.optionFound("insidePoint"); - bool useCellZones = args.optionFound("cellZones"); - bool useCellZonesOnly = args.optionFound("cellZonesOnly"); - bool overwrite = args.optionFound("overwrite"); - bool detectOnly = args.optionFound("detectOnly"); - bool sloppyCellZones = args.optionFound("sloppyCellZones"); + const bool makeCellZones = args.optionFound("makeCellZones"); + const bool largestOnly = args.optionFound("largestOnly"); + const bool insidePoint = args.optionFound("insidePoint"); + const bool useCellZones = args.optionFound("cellZones"); + const bool useCellZonesOnly = args.optionFound("cellZonesOnly"); + const bool overwrite = args.optionFound("overwrite"); + const bool detectOnly = args.optionFound("detectOnly"); + const bool sloppyCellZones = args.optionFound("sloppyCellZones"); if (insidePoint && largestOnly) { @@ -1882,7 +1881,7 @@ int main(int argc, char *argv[]) if (insidePoint) { - point insidePoint(args.optionLookup("insidePoint")()); + const point insidePoint = args.optionRead<point>("insidePoint"); label regionI = -1; diff --git a/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C b/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C index 553ea07138efbe9203492a52e424801328bbc182..b382a79d0d6eec8bdbe5f23a21be980468f4f67e 100644 --- a/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C +++ b/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.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 @@ -96,6 +96,7 @@ void checkPatch(const polyBoundaryMesh& bMesh, const word& name) int main(int argc, char *argv[]) { argList::noParallel(); +# include "addOverwriteOption.H" # include "addRegionOption.H" argList::validArgs.append("masterPatch"); @@ -103,7 +104,6 @@ int main(int argc, char *argv[]) argList::addBoolOption("partial"); argList::addBoolOption("perfect"); - argList::addBoolOption("overwrite"); argList::addOption("toleranceDict", "file with tolerances"); @@ -113,13 +113,12 @@ int main(int argc, char *argv[]) # include "createNamedMesh.H" const word oldInstance = mesh.pointsInstance(); + const word masterPatchName = args[1]; + const word slavePatchName = args[2]; - word masterPatchName(args.additionalArgs()[0]); - word slavePatchName(args.additionalArgs()[1]); - - bool partialCover = args.optionFound("partial"); - bool perfectCover = args.optionFound("perfect"); - bool overwrite = args.optionFound("overwrite"); + const bool partialCover = args.optionFound("partial"); + const bool perfectCover = args.optionFound("perfect"); + const bool overwrite = args.optionFound("overwrite"); if (partialCover && perfectCover) { diff --git a/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C b/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C index fac26e6815c108abe2f3b67de8e4a0f3b3394874..2c854ecb2081b97ff33164608fcdedc8bc3e227e 100644 --- a/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C +++ b/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.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 @@ -151,9 +151,9 @@ void subsetPointFields int main(int argc, char *argv[]) { +# include "addOverwriteOption.H" argList::validArgs.append("set"); argList::addOption("patch", "patch name"); - argList::addBoolOption("overwrite"); # include "setRootCase.H" # include "createTime.H" @@ -161,8 +161,8 @@ int main(int argc, char *argv[]) # include "createMesh.H" const word oldInstance = mesh.pointsInstance(); - word setName(args.additionalArgs()[0]); - bool overwrite = args.optionFound("overwrite"); + const word setName = args[1]; + const bool overwrite = args.optionFound("overwrite"); Info<< "Reading cell set from " << setName << endl << endl; @@ -174,7 +174,7 @@ int main(int argc, char *argv[]) if (args.optionFound("patch")) { - word patchName(args.option("patch")); + const word patchName = args["patch"]; patchI = mesh.boundaryMesh().findPatchID(patchName); diff --git a/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C b/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C index acf7ce0708866a896f1a85357c9b0d2d83e2a773..488a74694a0ecdc3c7e336b853d3bc8db3620199 100644 --- a/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C +++ b/applications/utilities/mesh/manipulation/transformPoints/transformPoints.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 @@ -210,7 +210,9 @@ int main(int argc, char *argv[]) ) ); + const bool doRotateFields = args.optionFound("rotateFields"); + // this is not actually stringent enough: if (args.options().empty()) { FatalErrorIn(args.executable()) @@ -219,18 +221,20 @@ int main(int argc, char *argv[]) << exit(FatalError); } - if (args.optionFound("translate")) + vector v; + if (args.optionReadIfPresent("translate", v)) { - vector transVector(args.optionLookup("translate")()); + Info<< "Translating points by " << v << endl; - Info<< "Translating points by " << transVector << endl; - - points += transVector; + points += v; } if (args.optionFound("rotate")) { - Pair<vector> n1n2(args.optionLookup("rotate")()); + Pair<vector> n1n2 + ( + args.optionLookup("rotate")() + ); n1n2[0] /= mag(n1n2[0]); n1n2[1] /= mag(n1n2[1]); tensor T = rotationTensor(n1n2[0], n1n2[1]); @@ -239,20 +243,17 @@ int main(int argc, char *argv[]) points = transform(T, points); - if (args.optionFound("rotateFields")) + if (doRotateFields) { rotateFields(args, runTime, T); } } - else if (args.optionFound("rollPitchYaw")) + else if (args.optionReadIfPresent("rollPitchYaw", v)) { - vector v(args.optionLookup("rollPitchYaw")()); - Info<< "Rotating points by" << nl << " roll " << v.x() << nl << " pitch " << v.y() << nl - << " yaw " << v.z() << endl; - + << " yaw " << v.z() << nl; // Convert to radians v *= pi/180.0; @@ -262,20 +263,17 @@ int main(int argc, char *argv[]) Info<< "Rotating points by quaternion " << R << endl; points = transform(R, points); - if (args.optionFound("rotateFields")) + if (doRotateFields) { rotateFields(args, runTime, R.R()); } } - else if (args.optionFound("yawPitchRoll")) + else if (args.optionReadIfPresent("yawPitchRoll", v)) { - vector v(args.optionLookup("yawPitchRoll")()); - Info<< "Rotating points by" << nl << " yaw " << v.x() << nl << " pitch " << v.y() << nl - << " roll " << v.z() << endl; - + << " roll " << v.z() << nl; // Convert to radians v *= pi/180.0; @@ -291,21 +289,19 @@ int main(int argc, char *argv[]) Info<< "Rotating points by quaternion " << R << endl; points = transform(R, points); - if (args.optionFound("rotateFields")) + if (doRotateFields) { rotateFields(args, runTime, R.R()); } } - if (args.optionFound("scale")) + if (args.optionReadIfPresent("scale", v)) { - vector scaleVector(args.optionLookup("scale")()); - - Info<< "Scaling points by " << scaleVector << endl; + Info<< "Scaling points by " << v << endl; - points.replace(vector::X, scaleVector.x()*points.component(vector::X)); - points.replace(vector::Y, scaleVector.y()*points.component(vector::Y)); - points.replace(vector::Z, scaleVector.z()*points.component(vector::Z)); + points.replace(vector::X, v.x()*points.component(vector::X)); + points.replace(vector::Y, v.y()*points.component(vector::Y)); + points.replace(vector::Z, v.z()*points.component(vector::Z)); } // Set the precision of the points data to 10 diff --git a/applications/utilities/miscellaneous/expandDictionary/expandDictionary.C b/applications/utilities/miscellaneous/expandDictionary/expandDictionary.C index 02d0e1e9569903333514191dcbe16fdb190605c3..98a5da97d3524c89b223006b3947f34462b82b9e 100644 --- a/applications/utilities/miscellaneous/expandDictionary/expandDictionary.C +++ b/applications/utilities/miscellaneous/expandDictionary/expandDictionary.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 @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) argList::validArgs.append("inputDict"); argList args(argc, argv); - const string& dictName = args.additionalArgs()[0]; + const string dictName = args[1]; Info<<"//\n// expansion of dictionary " << dictName << "\n//\n"; diff --git a/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C b/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C index 41abe8dcdb3b913898f0bcf4c7e184342a8205e6..7c05ba5a29e55d212063abbec08262ba191846d8 100644 --- a/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C +++ b/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.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 @@ -66,7 +66,7 @@ int main(int argc, char *argv[]) { fileName dictFileName ( - args.rootPath()/args.caseName()/args.option("dictionary") + args.rootPath()/args.caseName()/args["dictionary"] ); IFstream dictFile(dictFileName); @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) true // wildcards ); - for (int i=1; i<entryNames.size(); i++) + for (int i=1; i<entryNames.size(); ++i) { if (entPtr->dict().found(entryNames[i])) { @@ -118,7 +118,7 @@ int main(int argc, char *argv[]) { FatalErrorIn(args.executable()) << "Cannot find sub-entry " << entryNames[i] - << " in entry " << args.option("entry") + << " in entry " << args["entry"] << " in dictionary " << dictFileName; FatalError.exit(3); } @@ -131,7 +131,7 @@ int main(int argc, char *argv[]) { FatalErrorIn(args.executable()) << "Cannot find entry " - << args.option("entry") + << args["entry"] << " in dictionary " << dictFileName << " is not a sub-dictionary"; FatalError.exit(4); diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C index ea8ffe9469ffe7ab2ef1ef62fc9610af9138d0a1..02d8005e923f0930c177f8ae3f9843f8bf700ea7 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C @@ -34,8 +34,8 @@ Usage - decomposePar [OPTION] @param -cellDist \n - Write the cell distribution as a labelList for use with 'manual' - decomposition method and as a volScalarField for post-processing. + Write the cell distribution as a labelList, for use with 'manual' + decomposition method or as a volScalarField for post-processing. @param -region regionName \n Decompose named region. Does not check for existence of processor*. @@ -84,7 +84,12 @@ int main(int argc, char *argv[]) { argList::noParallel(); # include "addRegionOption.H" - argList::addBoolOption("cellDist"); + argList::addBoolOption + ( + "cellDist", + "write cell distribution as a labelList - for use with 'manual' " + "decomposition method or as a volScalarField for post-processing." + ); argList::addBoolOption ( "copyUniform", @@ -106,6 +111,11 @@ int main(int argc, char *argv[]) "only decompose geometry if the number of domains has changed" ); + argList::addNote + ( + "decompose a mesh and fields of a case for parallel execution" + ); + # include "setRootCase.H" word regionName = fvMesh::defaultRegion; @@ -666,7 +676,7 @@ int main(int argc, char *argv[]) ) ); - pointMesh procPMesh(procMesh, true); + pointMesh procPMesh(procMesh); pointFieldDecomposer fieldDecomposer ( diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C index 1fc35607632c0b44d6456d3a24cc3d9725561dd6..eb9d5b02b9b0088a93aff42cb90915bbe7ccacf2 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C @@ -109,7 +109,6 @@ Foam::domainDecomposition::domainDecomposition(const IOobject& io) procNeighbourProcessors_(nProcs_), procProcessorPatchSize_(nProcs_), procProcessorPatchStartIndex_(nProcs_), - globallySharedPoints_(0), cyclicParallel_(false) { if (decompositionDict_.found("distributed")) @@ -132,15 +131,6 @@ bool Foam::domainDecomposition::writeDecomposition() { Info<< "\nConstructing processor meshes" << endl; - // Make a lookup map for globally shared points - Map<label> sharedPointLookup(2*globallySharedPoints_.size()); - - forAll(globallySharedPoints_, pointi) - { - sharedPointLookup.insert(globallySharedPoints_[pointi], pointi); - } - - // Mark point/faces/cells that are in zones. // -1 : not in zone // -2 : in multiple zones diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H index 3c871420170a523f4e55a5078bdc5c5917b829a4..81c36eed39c14bbbe3f7472086ba5b534c2f522c 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H @@ -103,9 +103,6 @@ class domainDecomposition //- Start indices for inter-processor patches labelListList procProcessorPatchStartIndex_; - //- List of globally shared point labels - labelList globallySharedPoints_; - //- Are there cyclic-parallel faces bool cyclicParallel_; diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C b/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C index f54eb62a4aff255fc0a99494b36d36eb76854f0a..9028a0e10d4fb6b66c0aaa8350076e0a83091a1b 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C @@ -643,79 +643,6 @@ void Foam::domainDecomposition::decomposeMesh() // Reset the size of used points procPointLabels.setSize(nUsedPoints); } - - // Gather data about globally shared points - - // Memory management - { - labelList pointsUsage(nPoints(), 0); - - // Globally shared points are the ones used by more than 2 processors - // Size the list approximately and gather the points - labelHashSet gSharedPoints - ( - min(100, nPoints()/1000) - ); - - // Loop through all the processors and mark up points used by - // processor boundaries. When a point is used twice, it is a - // globally shared point - - for (label procI = 0; procI < nProcs_; procI++) - { - // Get list of face labels - const labelList& curFaceLabels = procFaceAddressing_[procI]; - - // Get start of processor faces - const labelList& curProcessorPatchStarts = - procProcessorPatchStartIndex_[procI]; - - const labelList& curProcessorPatchSizes = - procProcessorPatchSize_[procI]; - - // Reset the lookup list - pointsUsage = 0; - - forAll(curProcessorPatchStarts, patchi) - { - const label curStart = curProcessorPatchStarts[patchi]; - const label curEnd = curStart + curProcessorPatchSizes[patchi]; - - for - ( - label facei = curStart; - facei < curEnd; - facei++ - ) - { - // Mark the original face as used - // Remember to decrement the index by one (turning index) - // - const label curF = mag(curFaceLabels[facei]) - 1; - - const face& f = fcs[curF]; - - forAll(f, pointi) - { - if (pointsUsage[f[pointi]] == 0) - { - // Point not previously used - pointsUsage[f[pointi]] = patchi + 1; - } - else if (pointsUsage[f[pointi]] != patchi + 1) - { - // Point used by some other patch = global point! - gSharedPoints.insert(f[pointi]); - } - } - } - } - } - - // Grab the result from the hash list - globallySharedPoints_ = gSharedPoints.toc(); - sort(globallySharedPoints_); - } } // ************************************************************************* // diff --git a/applications/utilities/parallelProcessing/decomposePar/pointFieldDecomposerDecomposeFields.C b/applications/utilities/parallelProcessing/decomposePar/pointFieldDecomposerDecomposeFields.C index b1c78e2486cfc0b3bb10a4ef735a07f55136a156..6b7e1e71ac0022a895d1241d5482063c55a7fca7 100644 --- a/applications/utilities/parallelProcessing/decomposePar/pointFieldDecomposerDecomposeFields.C +++ b/applications/utilities/parallelProcessing/decomposePar/pointFieldDecomposerDecomposeFields.C @@ -26,7 +26,6 @@ License #include "pointFieldDecomposer.H" #include "processorPointPatchFields.H" -#include "globalPointPatchFields.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -40,12 +39,8 @@ Foam::pointFieldDecomposer::decomposeField // Create and map the internal field values Field<Type> internalField(field.internalField(), pointAddressing_); - // Create a list of pointers for the patchFields including one extra - // for the global patch - PtrList<pointPatchField<Type> > patchFields - ( - boundaryAddressing_.size() + 1 - ); + // Create a list of pointers for the patchFields + PtrList<pointPatchField<Type> > patchFields(boundaryAddressing_.size()); // Create and map the patch field values forAll(boundaryAddressing_, patchi) @@ -78,17 +73,6 @@ Foam::pointFieldDecomposer::decomposeField } } - // Add the global patch - patchFields.set - ( - boundaryAddressing_.size(), - new globalPointPatchField<Type> - ( - procMesh_.boundary().globalPatch(), - DimensionedField<Type, pointMesh>::null() - ) - ); - // Create the field for the processor return tmp<GeometricField<Type, pointPatchField, pointMesh> > ( diff --git a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C index c412010cbd32808b6e4ab52f3138981087aea50b..d2dcd818cade4bd3d76106df808672c968ecd1cd 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C +++ b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.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 @@ -50,8 +50,18 @@ int main(int argc, char *argv[]) timeSelector::addOptions(true, true); argList::noParallel(); # include "addRegionOption.H" - argList::addOption("fields", "\"(list of fields)\""); - argList::addBoolOption("noLagrangian"); + argList::addOption + ( + "fields", + "list", + "specify a list of fields to be reconstructed. Eg, '(U T p)' - " + "regular expressions not currently supported" + ); + argList::addBoolOption + ( + "noLagrangian", + "skip reconstructing lagrangian positions and fields" + ); # include "setRootCase.H" # include "createTime.H" @@ -62,7 +72,7 @@ int main(int argc, char *argv[]) args.optionLookup("fields")() >> selectedFields; } - bool noLagrangian = args.optionFound("noLagrangian"); + const bool noLagrangian = args.optionFound("noLagrangian"); // determine the processor count directly label nProcs = 0; @@ -111,10 +121,10 @@ int main(int argc, char *argv[]) } # include "createNamedMesh.H" - fileName regionPrefix = ""; + word regionDir = word::null; if (regionName != fvMesh::defaultRegion) { - regionPrefix = regionName; + regionDir = regionName; } // Set all times on processor meshes equal to reconstructed mesh @@ -260,11 +270,31 @@ int main(int argc, char *argv[]) procMeshes.boundaryProcAddressing() ); - pointReconstructor.reconstructFields<scalar>(objects); - pointReconstructor.reconstructFields<vector>(objects); - pointReconstructor.reconstructFields<sphericalTensor>(objects); - pointReconstructor.reconstructFields<symmTensor>(objects); - pointReconstructor.reconstructFields<tensor>(objects); + pointReconstructor.reconstructFields<scalar> + ( + objects, + selectedFields + ); + pointReconstructor.reconstructFields<vector> + ( + objects, + selectedFields + ); + pointReconstructor.reconstructFields<sphericalTensor> + ( + objects, + selectedFields + ); + pointReconstructor.reconstructFields<symmTensor> + ( + objects, + selectedFields + ); + pointReconstructor.reconstructFields<tensor> + ( + objects, + selectedFields + ); } else { @@ -289,7 +319,7 @@ int main(int argc, char *argv[]) ( readDir ( - databases[procI].timePath()/regionPrefix/cloud::prefix, + databases[procI].timePath() / regionDir / cloud::prefix, fileName::DIRECTORY ) ); diff --git a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C index a14335645032ec91413847db7ac1fed605876874..2bc95be4e73deec99c19f971080eb130ffc55095 100644 --- a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C +++ b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.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 @@ -281,8 +281,23 @@ autoPtr<mapPolyMesh> mergeSharedPoints int main(int argc, char *argv[]) { argList::noParallel(); - argList::addOption("mergeTol", "relative merge distance"); - argList::addBoolOption("fullMatch"); + argList::addOption + ( + "mergeTol", + "scalar", + "specify the merge distance relative to the bounding box size " + "(default 1E-7)" + ); + argList::addBoolOption + ( + "fullMatch", + "do (slower) geometric matching on all boundary faces" + ); + + argList::addNote + ( + "reconstruct a mesh using geometric information only" + ); # include "addTimeOptions.H" # include "addRegionOption.H" @@ -306,11 +321,11 @@ int main(int argc, char *argv[]) word regionName = polyMesh::defaultRegion; - fileName regionPrefix = ""; - if (args.optionFound("region")) + word regionDir = word::null; + + if (args.optionReadIfPresent("region", regionName)) { - regionName = args.option("region"); - regionPrefix = regionName; + regionDir = regionName; Info<< "Operating on region " << regionName << nl << endl; } @@ -425,7 +440,7 @@ int main(int argc, char *argv[]) ( databases[procI].findInstance ( - regionPrefix/polyMesh::meshSubDir, + regionDir / polyMesh::meshSubDir, "points" ) ); @@ -454,10 +469,10 @@ int main(int argc, char *argv[]) "points", databases[procI].findInstance ( - regionPrefix/polyMesh::meshSubDir, + regionDir / polyMesh::meshSubDir, "points" ), - regionPrefix/polyMesh::meshSubDir, + regionDir / polyMesh::meshSubDir, databases[procI], IOobject::MUST_READ, IOobject::NO_WRITE, diff --git a/applications/utilities/postProcessing/dataConversion/foamDataToFluent/foamDataToFluent.C b/applications/utilities/postProcessing/dataConversion/foamDataToFluent/foamDataToFluent.C index 77781311f36a89192f68e2e775f2f87db537e90b..7f5ead65f3e1fe9d06acc2181d0aed63b0b61a63 100644 --- a/applications/utilities/postProcessing/dataConversion/foamDataToFluent/foamDataToFluent.C +++ b/applications/utilities/postProcessing/dataConversion/foamDataToFluent/foamDataToFluent.C @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Description - Translates FOAM data to Fluent format. + Translates OpenFOAM data to Fluent format. \*---------------------------------------------------------------------------*/ diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C index 2521f7b1d24a1daaa4c93d48f71a86c21c644d1e..1204ac59768e0c4c172d86f13b17db0abd210d6c 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C @@ -110,30 +110,40 @@ void writeAllData { if (nPrims) { + PstreamBuffers pBufs(Pstream::nonBlocking); + + if (!Pstream::master()) + { + UOPstream toMaster(Pstream::masterNo(), pBufs); + for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++) + { + toMaster<< map(vf, prims, cmpt); + } + } + + pBufs.finishedSends(); + if (Pstream::master()) { ensightFile << key << nl; + PtrList<UIPstream> fromSlaves(Pstream::nProcs()); + for (int slave=1; slave<Pstream::nProcs(); slave++) + { + fromSlaves.set(slave, new UIPstream(slave, pBufs)); + } + for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++) { writeData(map(vf, prims, cmpt), ensightFile); for (int slave=1; slave<Pstream::nProcs(); slave++) { - IPstream fromSlave(Pstream::scheduled, slave); - scalarField data(fromSlave); + scalarField data(fromSlaves[slave]); writeData(data, ensightFile); } } } - else - { - for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++) - { - OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< map(vf, prims, cmpt); - } - } } } @@ -150,30 +160,40 @@ void writeAllDataBinary { if (nPrims) { + PstreamBuffers pBufs(Pstream::nonBlocking); + + if (!Pstream::master()) + { + UOPstream toMaster(Pstream::masterNo(), pBufs); + for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++) + { + toMaster<< map(vf, prims, cmpt); + } + } + + pBufs.finishedSends(); + if (Pstream::master()) { writeEnsDataBinary(key,ensightFile); + PtrList<UIPstream> fromSlaves(Pstream::nProcs()); + for (int slave=1; slave<Pstream::nProcs(); slave++) + { + fromSlaves.set(slave, new UIPstream(slave, pBufs)); + } + for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++) { writeEnsDataBinary(map(vf, prims, cmpt), ensightFile); for (int slave=1; slave<Pstream::nProcs(); slave++) { - IPstream fromSlave(Pstream::scheduled, slave); - scalarField data(fromSlave); + scalarField data(fromSlaves[slave]); writeEnsDataBinary(data, ensightFile); } } } - else - { - for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++) - { - OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< map(vf, prims, cmpt); - } - } } } @@ -190,31 +210,40 @@ void writeAllFaceData { if (nPrims) { + PstreamBuffers pBufs(Pstream::nonBlocking); + + if (!Pstream::master()) + { + UOPstream toMaster(Pstream::masterNo(), pBufs); + for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++) + { + toMaster<< map(pf, prims, cmpt); + } + } + + pBufs.finishedSends(); + if (Pstream::master()) { ensightFile << key << nl; + PtrList<UIPstream> fromSlaves(Pstream::nProcs()); + for (int slave=1; slave<Pstream::nProcs(); slave++) + { + fromSlaves.set(slave, new UIPstream(slave, pBufs)); + } + for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++) { writeData(map(pf, prims, cmpt), ensightFile); for (int slave=1; slave<Pstream::nProcs(); slave++) { - IPstream fromSlave(Pstream::scheduled, slave); - scalarField pf(fromSlave); - + scalarField pf(fromSlaves[slave]); writeData(pf, ensightFile); } } } - else - { - for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++) - { - OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< map(pf, prims, cmpt); - } - } } } @@ -231,31 +260,40 @@ void writeAllFaceDataBinary { if (nPrims) { + PstreamBuffers pBufs(Pstream::nonBlocking); + + if (!Pstream::master()) + { + UOPstream toMaster(Pstream::masterNo(), pBufs); + for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++) + { + toMaster<< map(pf, prims, cmpt); + } + } + + pBufs.finishedSends(); + if (Pstream::master()) { writeEnsDataBinary(key,ensightFile); + PtrList<UIPstream> fromSlaves(Pstream::nProcs()); + for (int slave=1; slave<Pstream::nProcs(); slave++) + { + fromSlaves.set(slave, new UIPstream(slave, pBufs)); + } + for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++) { writeEnsDataBinary(map(pf, prims, cmpt), ensightFile); for (int slave=1; slave<Pstream::nProcs(); slave++) { - IPstream fromSlave(Pstream::scheduled, slave); - scalarField pf(fromSlave); - + scalarField pf(fromSlaves[slave]); writeEnsDataBinary(pf, ensightFile); } } } - else - { - for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++) - { - OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< map(pf, prims, cmpt); - } - } } } @@ -554,10 +592,29 @@ void ensightFieldAscii if (meshCellSets.nHexesWedges) { + PstreamBuffers pBufs(Pstream::nonBlocking); + + if (!Pstream::master()) + { + UOPstream toMaster(Pstream::masterNo(), pBufs); + for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++) + { + toMaster<< map(vf, hexes, wedges, cmpt); + } + } + + pBufs.finishedSends(); + if (Pstream::master()) { ensightFile << "hexa8" << nl; + PtrList<UIPstream> fromSlaves(Pstream::nProcs()); + for (int slave=1; slave<Pstream::nProcs(); slave++) + { + fromSlaves.set(slave, new UIPstream(slave, pBufs)); + } + for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++) { writeData @@ -568,20 +625,11 @@ void ensightFieldAscii for (int slave=1; slave<Pstream::nProcs(); slave++) { - IPstream fromSlave(Pstream::scheduled, slave); - scalarField data(fromSlave); + scalarField data(fromSlaves[slave]); writeData(data, ensightFile); } } } - else - { - for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++) - { - OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< map(vf, hexes, wedges, cmpt); - } - } } writeAllData("penta6", vf, prisms, meshCellSets.nPrisms, ensightFile); @@ -695,10 +743,29 @@ void ensightFieldBinary if (meshCellSets.nHexesWedges) { + PstreamBuffers pBufs(Pstream::nonBlocking); + + if (!Pstream::master()) + { + UOPstream toMaster(Pstream::masterNo(), pBufs); + for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++) + { + toMaster<< map(vf, hexes, wedges, cmpt); + } + } + + pBufs.finishedSends(); + if (Pstream::master()) { writeEnsDataBinary("hexa8",ensightFile); + PtrList<UIPstream> fromSlaves(Pstream::nProcs()); + for (int slave=1; slave<Pstream::nProcs(); slave++) + { + fromSlaves.set(slave, new UIPstream(slave, pBufs)); + } + for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++) { writeEnsDataBinary @@ -709,20 +776,11 @@ void ensightFieldBinary for (int slave=1; slave<Pstream::nProcs(); slave++) { - IPstream fromSlave(Pstream::scheduled, slave); - scalarField data(fromSlave); + scalarField data(fromSlaves[slave]); writeEnsDataBinary(data, ensightFile); } } } - else - { - for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++) - { - OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< map(vf, hexes, wedges, cmpt); - } - } } writeAllDataBinary diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C index 48435c749b37f81874c5d703edf172e54b4a0a3b..5f848736bebbf01ee65cb361cbf04236ec65ec11 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.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 @@ -30,13 +30,10 @@ License #include "fvMesh.H" #include "globalMeshData.H" #include "PstreamCombineReduceOps.H" -#include "processorPolyPatch.H" #include "cellModeller.H" #include "IOmanip.H" #include "itoa.H" #include "ensightWriteBinary.H" -#include "globalIndex.H" -#include "PackedBoolList.H" #include "mapDistribute.H" #include <fstream> @@ -83,7 +80,10 @@ Foam::ensightMesh::ensightMesh if (args.optionFound("patches")) { - wordList patchNameList(args.optionLookup("patches")()); + wordList patchNameList + ( + args.optionLookup("patches")() + ); if (patchNameList.empty()) { @@ -470,104 +470,125 @@ void Foam::ensightMesh::writeAllPolys } // Number of faces for each poly cell - if (Pstream::master()) { - // Master - writePolysNFaces - ( - meshCellSets_.polys, - cellFaces, - ensightGeometryFile - ); - // Slaves - for (int slave=1; slave<Pstream::nProcs(); slave++) + PstreamBuffers pBufs(Pstream::nonBlocking); + + if (!Pstream::master()) { - IPstream fromSlave(Pstream::scheduled, slave); - labelList polys(fromSlave); - cellList cellFaces(fromSlave); + UOPstream toMaster(Pstream::masterNo(), pBufs); + toMaster<< meshCellSets_.polys << cellFaces; + } + pBufs.finishedSends(); + + if (Pstream::master()) + { + // Master writePolysNFaces ( - polys, + meshCellSets_.polys, cellFaces, ensightGeometryFile ); + // Slaves + for (int slave=1; slave<Pstream::nProcs(); slave++) + { + UIPstream fromSlave(slave, pBufs); + labelList polys(fromSlave); + cellList cellFaces(fromSlave); + + writePolysNFaces + ( + polys, + cellFaces, + ensightGeometryFile + ); + } } } - else - { - OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< meshCellSets_.polys << cellFaces; - } // Number of points for each face of the above list - if (Pstream::master()) { - // Master - writePolysNPointsPerFace - ( - meshCellSets_.polys, - cellFaces, - faces, - ensightGeometryFile - ); - // Slaves - for (int slave=1; slave<Pstream::nProcs(); slave++) + PstreamBuffers pBufs(Pstream::nonBlocking); + + if (!Pstream::master()) { - IPstream fromSlave(Pstream::scheduled, slave); - labelList polys(fromSlave); - cellList cellFaces(fromSlave); - faceList faces(fromSlave); + UOPstream toMaster(Pstream::masterNo(), pBufs); + toMaster<< meshCellSets_.polys << cellFaces << faces; + } + pBufs.finishedSends(); + if (Pstream::master()) + { + // Master writePolysNPointsPerFace ( - polys, + meshCellSets_.polys, cellFaces, faces, ensightGeometryFile ); + // Slaves + for (int slave=1; slave<Pstream::nProcs(); slave++) + { + UIPstream fromSlave(slave, pBufs); + labelList polys(fromSlave); + cellList cellFaces(fromSlave); + faceList faces(fromSlave); + + writePolysNPointsPerFace + ( + polys, + cellFaces, + faces, + ensightGeometryFile + ); + } } } - else - { - OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< meshCellSets_.polys << cellFaces << faces; - } + // List of points id for each face of the above list - if (Pstream::master()) { - // Master - writePolysPoints - ( - meshCellSets_.polys, - cellFaces, - faces, - ensightGeometryFile - ); - // Slaves - for (int slave=1; slave<Pstream::nProcs(); slave++) + PstreamBuffers pBufs(Pstream::nonBlocking); + + if (!Pstream::master()) { - IPstream fromSlave(Pstream::scheduled, slave); - labelList polys(fromSlave); - cellList cellFaces(fromSlave); - faceList faces(fromSlave); + UOPstream toMaster(Pstream::masterNo(), pBufs); + toMaster<< meshCellSets_.polys << cellFaces << faces; + } + + pBufs.finishedSends(); + if (Pstream::master()) + { + // Master writePolysPoints ( - polys, + meshCellSets_.polys, cellFaces, faces, ensightGeometryFile ); + // Slaves + for (int slave=1; slave<Pstream::nProcs(); slave++) + { + UIPstream fromSlave(slave, pBufs); + labelList polys(fromSlave); + cellList cellFaces(fromSlave); + faceList faces(fromSlave); + + writePolysPoints + ( + polys, + cellFaces, + faces, + ensightGeometryFile + ); + } } } - else - { - OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< meshCellSets_.polys << cellFaces << faces; - } } } @@ -662,103 +683,124 @@ void Foam::ensightMesh::writeAllPolysBinary } // Number of faces for each poly cell - if (Pstream::master()) { - // Master - writePolysNFacesBinary - ( - meshCellSets_.polys, - cellFaces, - ensightGeometryFile - ); - // Slaves - for (int slave=1; slave<Pstream::nProcs(); slave++) + PstreamBuffers pBufs(Pstream::nonBlocking); + + if (!Pstream::master()) { - IPstream fromSlave(Pstream::scheduled, slave); - labelList polys(fromSlave); - cellList cellFaces(fromSlave); + UOPstream toMaster(Pstream::masterNo(), pBufs); + toMaster<< meshCellSets_.polys << cellFaces; + } + pBufs.finishedSends(); + + if (Pstream::master()) + { + // Master writePolysNFacesBinary ( - polys, + meshCellSets_.polys, cellFaces, ensightGeometryFile ); + // Slaves + for (int slave=1; slave<Pstream::nProcs(); slave++) + { + UIPstream fromSlave(slave, pBufs); + labelList polys(fromSlave); + cellList cellFaces(fromSlave); + + writePolysNFacesBinary + ( + polys, + cellFaces, + ensightGeometryFile + ); + } } } - else - { - OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< meshCellSets_.polys << cellFaces; - } // Number of points for each face of the above list - if (Pstream::master()) { - // Master - writePolysNPointsPerFaceBinary - ( - meshCellSets_.polys, - cellFaces, - faces, - ensightGeometryFile - ); - // Slaves - for (int slave=1; slave<Pstream::nProcs(); slave++) + PstreamBuffers pBufs(Pstream::nonBlocking); + + if (!Pstream::master()) { - IPstream fromSlave(Pstream::scheduled, slave); - labelList polys(fromSlave); - cellList cellFaces(fromSlave); - faceList faces(fromSlave); + UOPstream toMaster(Pstream::masterNo(), pBufs); + toMaster<< meshCellSets_.polys << cellFaces << faces; + } + pBufs.finishedSends(); + + if (Pstream::master()) + { + // Master writePolysNPointsPerFaceBinary ( - polys, + meshCellSets_.polys, cellFaces, faces, ensightGeometryFile ); + // Slaves + for (int slave=1; slave<Pstream::nProcs(); slave++) + { + UIPstream fromSlave(slave, pBufs); + labelList polys(fromSlave); + cellList cellFaces(fromSlave); + faceList faces(fromSlave); + + writePolysNPointsPerFaceBinary + ( + polys, + cellFaces, + faces, + ensightGeometryFile + ); + } } } - else - { - OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< meshCellSets_.polys << cellFaces << faces; - } // List of points id for each face of the above list - if (Pstream::master()) { - // Master - writePolysPointsBinary - ( - meshCellSets_.polys, - cellFaces, - faces, - ensightGeometryFile - ); - // Slaves - for (int slave=1; slave<Pstream::nProcs(); slave++) + PstreamBuffers pBufs(Pstream::nonBlocking); + + if (!Pstream::master()) { - IPstream fromSlave(Pstream::scheduled, slave); - labelList polys(fromSlave); - cellList cellFaces(fromSlave); - faceList faces(fromSlave); + UOPstream toMaster(Pstream::masterNo(), pBufs); + toMaster<< meshCellSets_.polys << cellFaces << faces; + } + + pBufs.finishedSends(); + if (Pstream::master()) + { + // Master writePolysPointsBinary ( - polys, + meshCellSets_.polys, cellFaces, faces, ensightGeometryFile ); + // Slaves + for (int slave=1; slave<Pstream::nProcs(); slave++) + { + UIPstream fromSlave(slave, pBufs); + labelList polys(fromSlave); + cellList cellFaces(fromSlave); + faceList faces(fromSlave); + + writePolysPointsBinary + ( + polys, + cellFaces, + faces, + ensightGeometryFile + ); + } } } - else - { - OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< meshCellSets_.polys << cellFaces << faces; - } } } @@ -773,6 +815,16 @@ void Foam::ensightMesh::writeAllPrims { if (nPrims) { + PstreamBuffers pBufs(Pstream::nonBlocking); + + if (!Pstream::master()) + { + UOPstream toMaster(Pstream::masterNo(), pBufs); + toMaster<< cellShapes; + } + + pBufs.finishedSends(); + if (Pstream::master()) { ensightGeometryFile << key << nl << setw(10) << nPrims << nl; @@ -781,17 +833,12 @@ void Foam::ensightMesh::writeAllPrims for (int slave=1; slave<Pstream::nProcs(); slave++) { - IPstream fromSlave(Pstream::scheduled, slave); + UIPstream fromSlave(slave, pBufs); cellShapeList cellShapes(fromSlave); writePrims(cellShapes, ensightGeometryFile); } } - else - { - OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< cellShapes; - } } } @@ -806,6 +853,16 @@ void Foam::ensightMesh::writeAllPrimsBinary { if (nPrims) { + PstreamBuffers pBufs(Pstream::nonBlocking); + + if (!Pstream::master()) + { + UOPstream toMaster(Pstream::masterNo(), pBufs); + toMaster<< cellShapes; + } + + pBufs.finishedSends(); + if (Pstream::master()) { writeEnsDataBinary(key,ensightGeometryFile); @@ -815,17 +872,12 @@ void Foam::ensightMesh::writeAllPrimsBinary for (int slave=1; slave<Pstream::nProcs(); slave++) { - IPstream fromSlave(Pstream::scheduled, slave); + UIPstream fromSlave(slave, pBufs); cellShapeList cellShapes(fromSlave); writePrimsBinary(cellShapes, ensightGeometryFile); } } - else - { - OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< cellShapes; - } } } @@ -836,18 +888,15 @@ void Foam::ensightMesh::writeFacePrims OFstream& ensightGeometryFile ) const { - if (patchFaces.size()) + forAll(patchFaces, i) { - forAll(patchFaces, i) - { - const face& patchFace = patchFaces[i]; + const face& patchFace = patchFaces[i]; - forAll(patchFace, pointI) - { - ensightGeometryFile << setw(10) << patchFace[pointI] + 1; - } - ensightGeometryFile << nl; + forAll(patchFace, pointI) + { + ensightGeometryFile << setw(10) << patchFace[pointI] + 1; } + ensightGeometryFile << nl; } } @@ -858,16 +907,13 @@ void Foam::ensightMesh::writeFacePrimsBinary std::ofstream& ensightGeometryFile ) const { - if (patchFaces.size()) + forAll(patchFaces, i) { - forAll(patchFaces, i) - { - const face& patchFace = patchFaces[i]; + const face& patchFace = patchFaces[i]; - forAll(patchFace, pointI) - { - writeEnsDataBinary(patchFace[pointI] + 1, ensightGeometryFile); - } + forAll(patchFace, pointI) + { + writeEnsDataBinary(patchFace[pointI] + 1, ensightGeometryFile); } } } @@ -884,6 +930,16 @@ void Foam::ensightMesh::writeAllFacePrims { if (nPrims) { + PstreamBuffers pBufs(Pstream::nonBlocking); + + if (!Pstream::master()) + { + UOPstream toMaster(Pstream::masterNo(), pBufs); + toMaster<< UIndirectList<face>(patchFaces, prims); + } + + pBufs.finishedSends(); + if (Pstream::master()) { ensightGeometryFile << key << nl << setw(10) << nPrims << nl; @@ -896,17 +952,12 @@ void Foam::ensightMesh::writeAllFacePrims for (int slave=1; slave<Pstream::nProcs(); slave++) { - IPstream fromSlave(Pstream::scheduled, slave); + UIPstream fromSlave(slave, pBufs); faceList patchFaces(fromSlave); writeFacePrims(patchFaces, ensightGeometryFile); } } - else - { - OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< UIndirectList<face>(patchFaces, prims); - } } } @@ -951,54 +1002,68 @@ void Foam::ensightMesh::writeAllNSided } // Number of points for each face - if (Pstream::master()) { - writeNSidedNPointsPerFace - ( - UIndirectList<face>(patchFaces, prims)(), - ensightGeometryFile - ); + PstreamBuffers pBufs(Pstream::nonBlocking); - for (int slave=1; slave<Pstream::nProcs(); slave++) + if (!Pstream::master()) { - IPstream fromSlave(Pstream::scheduled, slave); - faceList patchFaces(fromSlave); + UOPstream toMaster(Pstream::masterNo(), pBufs); + toMaster<< UIndirectList<face>(patchFaces, prims); + } + pBufs.finishedSends(); + + if (Pstream::master()) + { writeNSidedNPointsPerFace ( - patchFaces, + UIndirectList<face>(patchFaces, prims)(), ensightGeometryFile ); + + for (int slave=1; slave<Pstream::nProcs(); slave++) + { + UIPstream fromSlave(slave, pBufs); + faceList patchFaces(fromSlave); + + writeNSidedNPointsPerFace + ( + patchFaces, + ensightGeometryFile + ); + } } } - else - { - OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< UIndirectList<face>(patchFaces, prims); - } // List of points id for each face - if (Pstream::master()) { - writeNSidedPoints - ( - UIndirectList<face>(patchFaces, prims)(), - ensightGeometryFile - ); + PstreamBuffers pBufs(Pstream::nonBlocking); - for (int slave=1; slave<Pstream::nProcs(); slave++) + if (!Pstream::master()) { - IPstream fromSlave(Pstream::scheduled, slave); - faceList patchFaces(fromSlave); + UOPstream toMaster(Pstream::masterNo(), pBufs); + toMaster<< UIndirectList<face>(patchFaces, prims); + } + + pBufs.finishedSends(); - writeNSidedPoints(patchFaces, ensightGeometryFile); + if (Pstream::master()) + { + writeNSidedPoints + ( + UIndirectList<face>(patchFaces, prims)(), + ensightGeometryFile + ); + + for (int slave=1; slave<Pstream::nProcs(); slave++) + { + UIPstream fromSlave(slave, pBufs); + faceList patchFaces(fromSlave); + + writeNSidedPoints(patchFaces, ensightGeometryFile); + } } } - else - { - OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< UIndirectList<face>(patchFaces, prims); - } } } @@ -1043,54 +1108,72 @@ void Foam::ensightMesh::writeAllNSidedBinary } // Number of points for each face - if (Pstream::master()) { - writeNSidedNPointsPerFaceBinary - ( - UIndirectList<face>(patchFaces, prims)(), - ensightGeometryFile - ); + PstreamBuffers pBufs(Pstream::nonBlocking); - for (int slave=1; slave<Pstream::nProcs(); slave++) + if (!Pstream::master()) { - IPstream fromSlave(Pstream::scheduled, slave); - faceList patchFaces(fromSlave); + UOPstream toMaster(Pstream::masterNo(), pBufs); + toMaster<< UIndirectList<face>(patchFaces, prims); + } + pBufs.finishedSends(); + + if (Pstream::master()) + { writeNSidedNPointsPerFaceBinary ( - patchFaces, + UIndirectList<face>(patchFaces, prims)(), ensightGeometryFile ); + + for (int slave=1; slave<Pstream::nProcs(); slave++) + { + UIPstream fromSlave(slave, pBufs); + faceList patchFaces(fromSlave); + + writeNSidedNPointsPerFaceBinary + ( + patchFaces, + ensightGeometryFile + ); + } } } - else - { - OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< UIndirectList<face>(patchFaces, prims); - } // List of points id for each face - if (Pstream::master()) { - writeNSidedPointsBinary - ( - UIndirectList<face>(patchFaces, prims)(), - ensightGeometryFile - ); + PstreamBuffers pBufs(Pstream::nonBlocking); - for (int slave=1; slave<Pstream::nProcs(); slave++) + if (!Pstream::master()) { - IPstream fromSlave(Pstream::scheduled, slave); - faceList patchFaces(fromSlave); + UOPstream toMaster(Pstream::masterNo(), pBufs); + toMaster<< UIndirectList<face>(patchFaces, prims); + } + + pBufs.finishedSends(); - writeNSidedPointsBinary(patchFaces, ensightGeometryFile); + if (Pstream::master()) + { + writeNSidedPointsBinary + ( + UIndirectList<face>(patchFaces, prims)(), + ensightGeometryFile + ); + + for (int slave=1; slave<Pstream::nProcs(); slave++) + { + UIPstream fromSlave(slave, pBufs); + faceList patchFaces(fromSlave); + + writeNSidedPointsBinary + ( + patchFaces, + ensightGeometryFile + ); + } } } - else - { - OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< UIndirectList<face>(patchFaces, prims); - } } } @@ -1106,33 +1189,35 @@ void Foam::ensightMesh::writeAllFacePrimsBinary { if (nPrims) { + PstreamBuffers pBufs(Pstream::nonBlocking); + + if (!Pstream::master()) + { + UOPstream toMaster(Pstream::masterNo(), pBufs); + toMaster<< UIndirectList<face>(patchFaces, prims); + } + + pBufs.finishedSends(); + if (Pstream::master()) { writeEnsDataBinary(key,ensightGeometryFile); writeEnsDataBinary(nPrims,ensightGeometryFile); - if (&prims != NULL) - { - writeFacePrimsBinary - ( - UIndirectList<face>(patchFaces, prims)(), - ensightGeometryFile - ); - } + writeFacePrimsBinary + ( + UIndirectList<face>(patchFaces, prims)(), + ensightGeometryFile + ); for (int slave=1; slave<Pstream::nProcs(); slave++) { - IPstream fromSlave(Pstream::scheduled, slave); + UIPstream fromSlave(slave, pBufs); faceList patchFaces(fromSlave); writeFacePrimsBinary(patchFaces, ensightGeometryFile); } } - else - { - OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< UIndirectList<face>(patchFaces, prims); - } } } @@ -1251,34 +1336,47 @@ void Foam::ensightMesh::writeAscii { label nPoints = globalPoints.size(); - if (Pstream::master()) { - ensightGeometryFile - << "part" << nl - << setw(10) << 1 << nl - << "internalMesh" << nl - << "coordinates" << nl - << setw(10) << nPoints - << endl; - - for (direction d=0; d<vector::nComponents; d++) - { - writePoints(uniquePoints.component(d), ensightGeometryFile); + PstreamBuffers pBufs(Pstream::nonBlocking); - for (int slave=1; slave<Pstream::nProcs(); slave++) + if (!Pstream::master()) + { + UOPstream toMaster(Pstream::masterNo(), pBufs); + for (direction d=0; d<vector::nComponents; d++) { - IPstream fromSlave(Pstream::scheduled, slave); - scalarField pointsComponent(fromSlave); - writePoints(pointsComponent, ensightGeometryFile); + toMaster<< uniquePoints.component(d); } } - } - else - { - for (direction d=0; d<vector::nComponents; d++) + + pBufs.finishedSends(); + + if (Pstream::master()) { - OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< uniquePoints.component(d); + ensightGeometryFile + << "part" << nl + << setw(10) << 1 << nl + << "internalMesh" << nl + << "coordinates" << nl + << setw(10) << nPoints + << endl; + + + PtrList<UIPstream> fromSlaves(Pstream::nProcs()); + for (int slave=1; slave<Pstream::nProcs(); slave++) + { + fromSlaves.set(slave, new UIPstream(slave, pBufs)); + } + + for (direction d=0; d<vector::nComponents; d++) + { + writePoints(uniquePoints.component(d), ensightGeometryFile); + + for (int slave=1; slave<Pstream::nProcs(); slave++) + { + scalarField pointsComponent(fromSlaves[slave]); + writePoints(pointsComponent, ensightGeometryFile); + } + } } } @@ -1348,17 +1446,17 @@ void Foam::ensightMesh::writeAscii // Renumber the patch points/faces into unique points labelList pointToGlobal; - labelList uniquePointLabels; + labelList uniqueMeshPointLabels; autoPtr<globalIndex> globalPointsPtr = mesh_.globalData().mergePoints ( p.meshPoints(), p.meshPointMap(), pointToGlobal, - uniquePointLabels + uniqueMeshPointLabels ); - pointField uniquePoints(p.localPoints(), uniquePointLabels); + pointField uniquePoints(mesh_.points(), uniqueMeshPointLabels); // Renumber the patch faces faceList patchFaces(p.localFaces()); forAll(patchFaces, i) @@ -1367,49 +1465,60 @@ void Foam::ensightMesh::writeAscii } - if (Pstream::master()) { - ensightGeometryFile - << "part" << nl - << setw(10) << ensightPatchI++ << nl - << patchName << nl - << "coordinates" << nl - << setw(10) << globalPointsPtr().size() - << endl; - - for (direction d=0; d<vector::nComponents; d++) + PstreamBuffers pBufs(Pstream::nonBlocking); + + if (!Pstream::master()) { - writePoints - ( - uniquePoints.component(d), - ensightGeometryFile - ); + UOPstream toMaster(Pstream::masterNo(), pBufs); + for (direction d=0; d<vector::nComponents; d++) + { + toMaster<< uniquePoints.component(d); + } + } + + pBufs.finishedSends(); + if (Pstream::master()) + { + ensightGeometryFile + << "part" << nl + << setw(10) << ensightPatchI++ << nl + << patchName << nl + << "coordinates" << nl + << setw(10) << globalPointsPtr().size() + << endl; + + PtrList<UIPstream> fromSlaves(Pstream::nProcs()); for (int slave=1; slave<Pstream::nProcs(); slave++) { - IPstream fromSlave(Pstream::scheduled, slave); - scalarField patchPointsComponent(fromSlave); + fromSlaves.set(slave, new UIPstream(slave, pBufs)); + } + for (direction d=0; d<vector::nComponents; d++) + { writePoints ( - patchPointsComponent, + uniquePoints.component(d), ensightGeometryFile ); + + for (int slave=1; slave<Pstream::nProcs(); slave++) + { + scalarField patchPointsComponent + ( + fromSlaves[slave] + ); + + writePoints + ( + patchPointsComponent, + ensightGeometryFile + ); + } } } } - else - { - for (direction d=0; d<vector::nComponents; d++) - { - OPstream toMaster - ( - Pstream::scheduled, - Pstream::masterNo() - ); - toMaster<< uniquePoints.component(d); - } - } writeAllFacePrims ( @@ -1502,36 +1611,52 @@ void Foam::ensightMesh::writeBinary { label nPoints = globalPoints.size(); - if (Pstream::master()) { - writeEnsDataBinary("part",ensightGeometryFile); - writeEnsDataBinary(1,ensightGeometryFile); - writeEnsDataBinary("internalMesh",ensightGeometryFile); - writeEnsDataBinary("coordinates",ensightGeometryFile); - writeEnsDataBinary(nPoints,ensightGeometryFile); + PstreamBuffers pBufs(Pstream::nonBlocking); - for (direction d=0; d<vector::nComponents; d++) + if (!Pstream::master()) { - writeEnsDataBinary - ( - uniquePoints.component(d), - ensightGeometryFile - ); - - for (int slave=1; slave<Pstream::nProcs(); slave++) + UOPstream toMaster(Pstream::masterNo(), pBufs); + for (direction d=0; d<vector::nComponents; d++) { - IPstream fromSlave(Pstream::scheduled, slave); - scalarField pointsComponent(fromSlave); - writeEnsDataBinary(pointsComponent, ensightGeometryFile); + toMaster<< uniquePoints.component(d); } } - } - else - { - for (direction d=0; d<vector::nComponents; d++) + + pBufs.finishedSends(); + + if (Pstream::master()) { - OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< uniquePoints.component(d); + writeEnsDataBinary("part",ensightGeometryFile); + writeEnsDataBinary(1,ensightGeometryFile); + writeEnsDataBinary("internalMesh",ensightGeometryFile); + writeEnsDataBinary("coordinates",ensightGeometryFile); + writeEnsDataBinary(nPoints,ensightGeometryFile); + + PtrList<UIPstream> fromSlaves(Pstream::nProcs()); + for (int slave=1; slave<Pstream::nProcs(); slave++) + { + fromSlaves.set(slave, new UIPstream(slave, pBufs)); + } + + for (direction d=0; d<vector::nComponents; d++) + { + writeEnsDataBinary + ( + uniquePoints.component(d), + ensightGeometryFile + ); + + for (int slave=1; slave<Pstream::nProcs(); slave++) + { + scalarField pointsComponent(fromSlaves[slave]); + writeEnsDataBinary + ( + pointsComponent, + ensightGeometryFile + ); + } + } } } @@ -1601,16 +1726,16 @@ void Foam::ensightMesh::writeBinary // Renumber the patch points/faces into unique points labelList pointToGlobal; - labelList uniquePointLabels; + labelList uniqueMeshPointLabels; autoPtr<globalIndex> globalPointsPtr = mesh_.globalData().mergePoints ( p.meshPoints(), p.meshPointMap(), pointToGlobal, - uniquePointLabels + uniqueMeshPointLabels ); - pointField uniquePoints(p.localPoints(), uniquePointLabels); + pointField uniquePoints(mesh_.points(), uniqueMeshPointLabels); // Renumber the patch faces faceList patchFaces(p.localFaces()); forAll(patchFaces, i) @@ -1619,54 +1744,70 @@ void Foam::ensightMesh::writeBinary } - if (Pstream::master()) { - writeEnsDataBinary("part",ensightGeometryFile); - writeEnsDataBinary(ensightPatchI++,ensightGeometryFile); - //writeEnsDataBinary(patchName.c_str(),ensightGeometryFile); - writeEnsDataBinary(patchName.c_str(),ensightGeometryFile); - writeEnsDataBinary("coordinates",ensightGeometryFile); - writeEnsDataBinary - ( - globalPointsPtr().size(), - ensightGeometryFile - ); + PstreamBuffers pBufs(Pstream::nonBlocking); - for (direction d=0; d<vector::nComponents; d++) + if (!Pstream::master()) { - //writePointsBinary + UOPstream toMaster(Pstream::masterNo(), pBufs); + for (direction d=0; d<vector::nComponents; d++) + { + toMaster<< uniquePoints.component(d); + } + } + + pBufs.finishedSends(); + + if (Pstream::master()) + { + writeEnsDataBinary("part",ensightGeometryFile); + writeEnsDataBinary(ensightPatchI++,ensightGeometryFile); + //writeEnsDataBinary + //(patchName.c_str(),ensightGeometryFile); + writeEnsDataBinary + ( + patchName.c_str(), + ensightGeometryFile + ); + writeEnsDataBinary("coordinates",ensightGeometryFile); writeEnsDataBinary ( - uniquePoints.component(d), + globalPointsPtr().size(), ensightGeometryFile ); + PtrList<UIPstream> fromSlaves(Pstream::nProcs()); for (int slave=1; slave<Pstream::nProcs(); slave++) { - IPstream fromSlave(Pstream::scheduled, slave); - scalarField patchPointsComponent(fromSlave); + fromSlaves.set(slave, new UIPstream(slave, pBufs)); + } + for (direction d=0; d<vector::nComponents; d++) + { //writePointsBinary writeEnsDataBinary ( - patchPointsComponent, + uniquePoints.component(d), ensightGeometryFile ); + + for (int slave=1; slave<Pstream::nProcs(); slave++) + { + scalarField patchPointsComponent + ( + fromSlaves[slave] + ); + + //writePointsBinary + writeEnsDataBinary + ( + patchPointsComponent, + ensightGeometryFile + ); + } } } } - else - { - for (direction d=0; d<vector::nComponents; d++) - { - OPstream toMaster - ( - Pstream::scheduled, - Pstream::masterNo() - ); - toMaster<< uniquePoints.component(d); - } - } writeAllFacePrimsBinary ( diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C index 2ffb2256992246d3f7552e3aeeaf1cb8e9538c47..7378bdc7a401d59041e1737810309094b910f416 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Description - Translates FOAM data to EnSight format. + Translates OpenFOAM data to EnSight format. An Ensight part is created for the internalMesh and for each patch. diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/foamToTecplot360.C b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/foamToTecplot360.C index 44384b7efe560600e4a7736e13445f07631b426c..2d11a6538d65bff0cc2ca0d396889e170f049632 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/foamToTecplot360.C +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/foamToTecplot360.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 @@ -215,9 +215,8 @@ int main(int argc, char *argv[]) word cellSetName; string vtkName; - if (args.optionFound("cellSet")) + if (args.optionReadIfPresent("cellSet", cellSetName)) { - cellSetName = args.option("cellSet"); vtkName = cellSetName; } else if (Pstream::parRun()) @@ -738,7 +737,7 @@ int main(int argc, char *argv[]) if (args.optionFound("faceSet")) { // Load the faceSet - word setName(args.option("faceSet")); + const word setName = args["faceSet"]; labelList faceLabels(faceSet(mesh, setName).toc()); // Filename as if patch with same name. diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C index 73dc60b762c92a9b66b726eb64e8b53652062514..68556854143310fab203f46f279d3a58ab41d57e 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.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 @@ -329,9 +329,8 @@ int main(int argc, char *argv[]) word cellSetName; string vtkName = runTime.caseName(); - if (args.optionFound("cellSet")) + if (args.optionReadIfPresent("cellSet", cellSetName)) { - cellSetName = args.option("cellSet"); vtkName = cellSetName; } else if (Pstream::parRun()) @@ -423,7 +422,7 @@ int main(int argc, char *argv[]) if (args.optionFound("faceSet")) { // Load the faceSet - faceSet set(mesh, args.option("faceSet")); + faceSet set(mesh, args["faceSet"]); // Filename as if patch with same name. mkDir(fvPath/set.name()); @@ -446,7 +445,7 @@ int main(int argc, char *argv[]) if (args.optionFound("pointSet")) { // Load the pointSet - pointSet set(mesh, args.option("pointSet")); + pointSet set(mesh, args["pointSet"]); // Filename as if patch with same name. mkDir(fvPath/set.name()); diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/lagrangianWriter.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/lagrangianWriter.H index bd13ec2571a7622d70e0c243098c8104348b48bb..8c4f23a2e58a148ab9e2e5373d270bc3d2913041 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/lagrangianWriter.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/lagrangianWriter.H @@ -37,7 +37,6 @@ SourceFiles #ifndef lagrangianWriter_H #define lagrangianWriter_H -#include "globalPointPatch.H" #include "OFstream.H" #include "Cloud.H" #include "volFields.H" diff --git a/applications/utilities/postProcessing/dataConversion/smapToFoam/smapToFoam.C b/applications/utilities/postProcessing/dataConversion/smapToFoam/smapToFoam.C index ee450c1200c74628ff6f986fc5bf62f9d2befc77..decdc195af44b4b15e06f07ce085e462540759a4 100644 --- a/applications/utilities/postProcessing/dataConversion/smapToFoam/smapToFoam.C +++ b/applications/utilities/postProcessing/dataConversion/smapToFoam/smapToFoam.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,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Description - Translates a STAR-CD SMAP data file into FOAM field format. + Translates a STAR-CD SMAP data file into OpenFOAM field format. \*---------------------------------------------------------------------------*/ @@ -65,7 +65,7 @@ int main(int argc, char *argv[]) # include "createMesh.H" - IFstream smapFile(args.additionalArgs()[0]); + IFstream smapFile(args[1]); if (!smapFile.good()) { diff --git a/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C b/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C index b9310ffc92c5a51be55475d778465399da550a32..751e80503ab0d19bdbbc5b2410751e23f38a469e 100644 --- a/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C +++ b/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.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 @@ -59,7 +59,7 @@ namespace Foam ( IOobject ( - args.option("dict"), + args["dict"], runTime.system(), runTime, IOobject::MUST_READ diff --git a/applications/utilities/postProcessing/patch/patchAverage/patchAverage.C b/applications/utilities/postProcessing/patch/patchAverage/patchAverage.C index 2ad0d5cf35c844a2db24a0b2371ac32187e37a82..9e091ff936dad7e3b37c753536951f01bb5e3a03 100644 --- a/applications/utilities/postProcessing/patch/patchAverage/patchAverage.C +++ b/applications/utilities/postProcessing/patch/patchAverage/patchAverage.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,8 +45,8 @@ int main(int argc, char *argv[]) instantList timeDirs = timeSelector::select0(runTime, args); # include "createMesh.H" - word fieldName(args.additionalArgs()[0]); - word patchName(args.additionalArgs()[1]); + const word fieldName = args[1]; + const word patchName = args[2]; forAll(timeDirs, timeI) { diff --git a/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C b/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C index 8d189dfe28b9df13ea30516a8bfbf390585268c0..8b474d2ac0f30854b0f0849b30047258c3d0b2e1 100644 --- a/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C +++ b/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.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,8 +47,8 @@ int main(int argc, char *argv[]) instantList timeDirs = timeSelector::select0(runTime, args); # include "createNamedMesh.H" - word fieldName(args.additionalArgs()[0]); - word patchName(args.additionalArgs()[1]); + const word fieldName = args[1]; + const word patchName = args[2]; forAll(timeDirs, timeI) { diff --git a/applications/utilities/preProcessing/mapFields/setRoots.H b/applications/utilities/preProcessing/mapFields/setRoots.H index 3758fbee6a2419c57bb7cf464f126bf04b8aad00..d7651306b463bf5f2cbcca41d425dd3bb254c266 100644 --- a/applications/utilities/preProcessing/mapFields/setRoots.H +++ b/applications/utilities/preProcessing/mapFields/setRoots.H @@ -17,14 +17,14 @@ fileName rootDirTarget(args.rootPath()); fileName caseDirTarget(args.globalCaseName()); - fileName casePath(args.additionalArgs()[0]); - fileName rootDirSource = casePath.path(); - fileName caseDirSource = casePath.name(); + const fileName casePath = args[1]; + const fileName rootDirSource = casePath.path(); + const fileName caseDirSource = casePath.name(); Info<< "Source: " << rootDirSource << " " << caseDirSource << nl << "Target: " << rootDirTarget << " " << caseDirTarget << endl; - bool parallelSource = args.optionFound("parallelSource"); - bool parallelTarget = args.optionFound("parallelTarget"); - bool consistent = args.optionFound("consistent"); + const bool parallelSource = args.optionFound("parallelSource"); + const bool parallelTarget = args.optionFound("parallelTarget"); + const bool consistent = args.optionFound("consistent"); diff --git a/applications/utilities/preProcessing/mapFields/setTimeIndex.H b/applications/utilities/preProcessing/mapFields/setTimeIndex.H index 80dfb3efca44c97b028783125de210640642793e..20012e3d20433b91b73f96658ff8bf25a32c411b 100644 --- a/applications/utilities/preProcessing/mapFields/setTimeIndex.H +++ b/applications/utilities/preProcessing/mapFields/setTimeIndex.H @@ -2,7 +2,7 @@ label sourceTimeIndex = runTimeSource.timeIndex(); if (args.optionFound("sourceTime")) { - if (args.option("sourceTime") == "latestTime") + if (args["sourceTime"] == "latestTime") { sourceTimeIndex = sourceTimes.size() - 1; } diff --git a/applications/utilities/surface/surfaceAdd/surfaceAdd.C b/applications/utilities/surface/surfaceAdd/surfaceAdd.C index 305c9d48c2f707830c2f23c45897b817171745cd..be0baad23d0719086749d3f264bf0682b234617e 100644 --- a/applications/utilities/surface/surfaceAdd/surfaceAdd.C +++ b/applications/utilities/surface/surfaceAdd/surfaceAdd.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 @@ -57,12 +57,12 @@ int main(int argc, char *argv[]) argList args(argc, argv); - fileName inFileName1(args.additionalArgs()[0]); - fileName inFileName2(args.additionalArgs()[1]); - fileName outFileName(args.additionalArgs()[2]); + const fileName inFileName1 = args[1]; + const fileName inFileName2 = args[2]; + const fileName outFileName = args[3]; - bool addPoint = args.optionFound("points"); - bool mergeRegions = args.optionFound("mergeRegions"); + const bool addPoint = args.optionFound("points"); + const bool mergeRegions = args.optionFound("mergeRegions"); if (addPoint) { @@ -71,7 +71,7 @@ int main(int argc, char *argv[]) << nl << endl; Info<< "Surface : " << inFileName1<< nl - << "Points : " << args.option("points") << nl + << "Points : " << args["points"] << nl << "Writing : " << outFileName << nl << endl; } else @@ -113,7 +113,7 @@ int main(int argc, char *argv[]) if (addPoint) { - IFstream pointsFile(args.option("points")); + IFstream pointsFile(args["points"]); pointField extraPoints(pointsFile); Info<< "Additional Points:" << extraPoints.size() << endl; diff --git a/applications/utilities/surface/surfaceAutoPatch/surfaceAutoPatch.C b/applications/utilities/surface/surfaceAutoPatch/surfaceAutoPatch.C index 0a7d8a2cc59af865eaa1cd6fcf4782f253ab8993..5d570e74ebabb49b9f6291112ed0374240084911 100644 --- a/applications/utilities/surface/surfaceAutoPatch/surfaceAutoPatch.C +++ b/applications/utilities/surface/surfaceAutoPatch/surfaceAutoPatch.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 @@ -53,11 +53,11 @@ int main(int argc, char *argv[]) argList::validArgs.append("included angle [0..180]"); argList args(argc, argv); - fileName inFileName(args.additionalArgs()[0]); - fileName outFileName(args.additionalArgs()[1]); - scalar includedAngle(readScalar(IStringStream(args.additionalArgs()[2])())); + const fileName inFileName = args[1]; + const fileName outFileName = args[2]; + const scalar includedAngle = args.argRead<scalar>(3); - Pout<< "Surface : " << inFileName << nl + Info<< "Surface : " << inFileName << nl << endl; @@ -81,7 +81,7 @@ int main(int argc, char *argv[]) surfaceFeatures set(surf, includedAngle); - Pout<< nl + Info<< nl << "Feature set:" << nl << " feature points : " << set.featurePoints().size() << nl << " feature edges : " << set.featureEdges().size() << nl diff --git a/applications/utilities/surface/surfaceCheck/surfaceCheck.C b/applications/utilities/surface/surfaceCheck/surfaceCheck.C index da3bccb7d4b184d02bec82d659c993a6f5e8229d..647ed18b07281c06861cd15af6c3ff8d51f2f993 100644 --- a/applications/utilities/surface/surfaceCheck/surfaceCheck.C +++ b/applications/utilities/surface/surfaceCheck/surfaceCheck.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 @@ -188,10 +188,10 @@ int main(int argc, char *argv[]) argList args(argc, argv); - bool checkSelfIntersection = args.optionFound("checkSelfIntersection"); - bool verbose = args.optionFound("verbose"); + const fileName surfFileName = args[1]; + const bool checkSelfIntersect = args.optionFound("checkSelfIntersection"); + const bool verbose = args.optionFound("verbose"); - fileName surfFileName(args.additionalArgs()[0]); Info<< "Reading surface from " << surfFileName << " ..." << nl << endl; @@ -616,7 +616,7 @@ int main(int argc, char *argv[]) surfFileNameBase.lessExt() + "_" + name(zone) - + ".ftr" + + ".obj" ); Info<< "writing part " << zone << " size " << subSurf.size() @@ -657,7 +657,7 @@ int main(int argc, char *argv[]) // Check self-intersection // ~~~~~~~~~~~~~~~~~~~~~~~ - if (checkSelfIntersection) + if (checkSelfIntersect) { Info<< "Checking self-intersection." << endl; diff --git a/applications/utilities/surface/surfaceClean/surfaceClean.C b/applications/utilities/surface/surfaceClean/surfaceClean.C index 64323527a367ae5fc343d09da63f212048d56be1..52fe9a549033838cde21459ca21c5122910f0964 100644 --- a/applications/utilities/surface/surfaceClean/surfaceClean.C +++ b/applications/utilities/surface/surfaceClean/surfaceClean.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,21 +54,21 @@ int main(int argc, char *argv[]) argList::validArgs.append("output surface file"); argList::argList args(argc, argv); - fileName inFileName(args.additionalArgs()[0]); - scalar minLen(readScalar(IStringStream(args.additionalArgs()[1])())); - fileName outFileName(args.additionalArgs()[2]); + const fileName inFileName = args[1]; + const scalar minLen = args.argRead<scalar>(2); + const fileName outFileName = args[3]; - Pout<< "Reading surface " << inFileName << nl + Info<< "Reading surface " << inFileName << nl << "Collapsing all triangles with edges or heights < " << minLen << nl << "Writing result to " << outFileName << nl << endl; - Pout<< "Reading surface from " << inFileName << " ..." << nl << endl; + Info<< "Reading surface from " << inFileName << " ..." << nl << endl; triSurface surf(inFileName); - surf.writeStats(Pout); + surf.writeStats(Info); - Pout<< "Collapsing triangles to edges ..." << nl << endl; + Info<< "Collapsing triangles to edges ..." << nl << endl; while (true) { @@ -89,15 +89,15 @@ int main(int argc, char *argv[]) } } - Pout<< nl << "Resulting surface:" << endl; - surf.writeStats(Pout); - Pout<< nl; + Info<< nl + << "Resulting surface:" << endl; + surf.writeStats(Info); - Pout<< "Writing refined surface to " << outFileName << " ..." << endl; + Info<< nl + << "Writing refined surface to " << outFileName << " ..." << endl; surf.write(outFileName); - Pout<< nl; - Pout<< "End\n" << endl; + Info<< "\nEnd\n" << endl; return 0; } diff --git a/applications/utilities/surface/surfaceCoarsen/surfaceCoarsen.C b/applications/utilities/surface/surfaceCoarsen/surfaceCoarsen.C index e293596ab16abc1e70ff8f1fc4d6138bea29c205..d9d41379a154d64b54421325ced753eacc0af5fa 100644 --- a/applications/utilities/surface/surfaceCoarsen/surfaceCoarsen.C +++ b/applications/utilities/surface/surfaceCoarsen/surfaceCoarsen.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 @@ -30,7 +30,6 @@ Description mailto:melax@cs.ualberta.ca http://www.cs.ualberta.ca/~melax - \*---------------------------------------------------------------------------*/ #include "argList.H" @@ -72,9 +71,9 @@ int main(int argc, char *argv[]) argList::validArgs.append("Foam output file"); argList args(argc, argv); - fileName inFileName(args.additionalArgs()[0]); - - scalar reduction(readScalar(IStringStream(args.additionalArgs()[1])())); + const fileName inFileName = args[1]; + const scalar reduction = args.argRead<scalar>(2); + const fileName outFileName = args[3]; if (reduction <= 0 || reduction > 1) { @@ -85,8 +84,6 @@ int main(int argc, char *argv[]) << exit(FatalError); } - fileName outFileName(args.additionalArgs()[2]); - Info<< "Input surface :" << inFileName << endl << "Reduction factor:" << reduction << endl << "Output surface :" << outFileName << endl << endl; diff --git a/applications/utilities/surface/surfaceConvert/surfaceConvert.C b/applications/utilities/surface/surfaceConvert/surfaceConvert.C index 8481addc0316f9277e0c2ba4759895296aee8947..35589360c0c0bfbd2c759299d463d6b4e66605b3 100644 --- a/applications/utilities/surface/surfaceConvert/surfaceConvert.C +++ b/applications/utilities/surface/surfaceConvert/surfaceConvert.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,10 +69,9 @@ int main(int argc, char *argv[]) argList::addOption("scale", "scale"); argList args(argc, argv); - const stringList& params = args.additionalArgs(); - fileName importName(params[0]); - fileName exportName(params[1]); + const fileName importName = args[1]; + const fileName exportName = args[2]; if (importName == exportName) { diff --git a/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C b/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C index ee221f992aef843ce920c86629c0124a3ea1297b..7bf03a7b8a9f0a9276f41a9b47de8f971207d359 100644 --- a/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C +++ b/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.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 @@ -59,10 +59,9 @@ int main(int argc, char *argv[]) argList args(argc, argv); Time runTime(args.rootPath(), args.caseName()); - const stringList& params = args.additionalArgs(); - const fileName importName(params[0]); - const fileName exportName(params[1]); + const fileName importName = args[1]; + const fileName exportName = args[2]; // disable inplace editing if (importName == exportName) diff --git a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C index eb15baa6dd9a1f81c5d2d71079b5ee08be8232e5..4890830345e956318bd472618f2528fc998931f0 100644 --- a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C +++ b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.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 @@ -49,7 +49,7 @@ void dumpBox(const treeBoundBox& bb, const fileName& fName) { OFstream str(fName); - Pout<< "Dumping bounding box " << bb << " as lines to obj file " + Info<< "Dumping bounding box " << bb << " as lines to obj file " << str.name() << endl; @@ -111,14 +111,14 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" - Pout<< "Feature line extraction is only valid on closed manifold surfaces." + Info<< "Feature line extraction is only valid on closed manifold surfaces." << endl; - fileName surfFileName(args.additionalArgs()[0]); - fileName outFileName(args.additionalArgs()[1]); + const fileName surfFileName = args[1]; + const fileName outFileName = args[2]; - Pout<< "Surface : " << surfFileName << nl + Info<< "Surface : " << surfFileName << nl << "Output feature set : " << outFileName << nl << endl; @@ -128,9 +128,9 @@ int main(int argc, char *argv[]) triSurface surf(surfFileName); - Pout<< "Statistics:" << endl; - surf.writeStats(Pout); - Pout<< endl; + Info<< "Statistics:" << endl; + surf.writeStats(Info); + Info<< endl; @@ -141,9 +141,9 @@ int main(int argc, char *argv[]) if (args.optionFound("set")) { - fileName setName(args.option("set")); + const fileName setName = args["set"]; - Pout<< "Reading existing feature set from file " << setName << endl; + Info<< "Reading existing feature set from file " << setName << endl; set = surfaceFeatures(surf, setName); } @@ -151,12 +151,12 @@ int main(int argc, char *argv[]) { scalar includedAngle = args.optionRead<scalar>("includedAngle"); - Pout<< "Constructing feature set from included angle " << includedAngle + Info<< "Constructing feature set from included angle " << includedAngle << endl; set = surfaceFeatures(surf, includedAngle); - Pout<< endl << "Writing initial features" << endl; + Info<< nl << "Writing initial features" << endl; set.write("initial.fSet"); set.writeObj("initial"); } @@ -170,7 +170,7 @@ int main(int argc, char *argv[]) } - Pout<< nl + Info<< nl << "Initial feature set:" << nl << " feature points : " << set.featurePoints().size() << nl << " feature edges : " << set.featureEdges().size() << nl @@ -189,20 +189,20 @@ int main(int argc, char *argv[]) scalar minLen = -GREAT; if (args.optionReadIfPresent("minLen", minLen)) { - Pout<< "Removing features of length < " << minLen << endl; + Info<< "Removing features of length < " << minLen << endl; } label minElem = 0; if (args.optionReadIfPresent("minElem", minElem)) { - Pout<< "Removing features with number of edges < " << minElem << endl; + Info<< "Removing features with number of edges < " << minElem << endl; } // Trim away small groups of features if (minElem > 0 || minLen > 0) { set.trimFeatures(minLen, minElem); - Pout<< endl << "Removed small features" << endl; + Info<< endl << "Removed small features" << endl; } @@ -215,9 +215,12 @@ int main(int argc, char *argv[]) if (args.optionFound("subsetBox")) { - treeBoundBox bb(args.optionLookup("subsetBox")()); + treeBoundBox bb + ( + args.optionLookup("subsetBox")() + ); - Pout<< "Removing all edges outside bb " << bb << endl; + Info<< "Removing all edges outside bb " << bb << endl; dumpBox(bb, "subsetBox.obj"); deleteBox @@ -230,9 +233,12 @@ int main(int argc, char *argv[]) } else if (args.optionFound("deleteBox")) { - treeBoundBox bb(args.optionLookup("deleteBox")()); + treeBoundBox bb + ( + args.optionLookup("deleteBox")() + ); - Pout<< "Removing all edges inside bb " << bb << endl; + Info<< "Removing all edges inside bb " << bb << endl; dumpBox(bb, "deleteBox.obj"); deleteBox @@ -247,13 +253,13 @@ int main(int argc, char *argv[]) surfaceFeatures newSet(surf); newSet.setFromStatus(edgeStat); - Pout<< endl << "Writing trimmed features to " << outFileName << endl; + Info<< endl << "Writing trimmed features to " << outFileName << endl; newSet.write(outFileName); - Pout<< endl << "Writing edge objs." << endl; + Info<< endl << "Writing edge objs." << endl; newSet.writeObj("final"); - Pout<< nl + Info<< nl << "Final feature set:" << nl << " feature points : " << newSet.featurePoints().size() << nl << " feature edges : " << newSet.featureEdges().size() << nl @@ -278,7 +284,7 @@ int main(int argc, char *argv[]) feMesh.write(); - Pout<< nl << "End\n" << endl; + Info<< "End\n" << endl; return 0; } diff --git a/applications/utilities/surface/surfaceFind/surfaceFind.C b/applications/utilities/surface/surfaceFind/surfaceFind.C index 8e36fc25ecaab5ce7a55b224ee2486ab93776c3a..e5e25260c4769b3f950838672e81e23479c7423f 100644 --- a/applications/utilities/surface/surfaceFind/surfaceFind.C +++ b/applications/utilities/surface/surfaceFind/surfaceFind.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 @@ -60,7 +60,7 @@ int main(int argc, char *argv[]) Info<< "Reading surf ..." << endl; - meshedSurface surf1(args.additionalArgs()[0]); + meshedSurface surf1(args[1]); // // Nearest vertex diff --git a/applications/utilities/surface/surfaceInertia/surfaceInertia.C b/applications/utilities/surface/surfaceInertia/surfaceInertia.C index 30e91425a820afe078f6b0c19143153beb4a6541..db3d62c15e44cacd2ea51d48294eba384a719e4e 100644 --- a/applications/utilities/surface/surfaceInertia/surfaceInertia.C +++ b/applications/utilities/surface/surfaceInertia/surfaceInertia.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 @@ -285,14 +285,12 @@ int main(int argc, char *argv[]) argList::addNote ( "Calculates the inertia tensor and principal axes and moments " - "of a command line specified triSurface. Inertia can either " - "be of the solid body or of a thin shell." + "of the specified surface.\n" + "Inertia can either be of the solid body or of a thin shell." ); argList::noParallel(); - argList::validArgs.append("surface file"); - argList::addBoolOption("shellProperties"); argList::addOption @@ -312,16 +310,14 @@ int main(int argc, char *argv[]) argList args(argc, argv); - fileName surfFileName(args.additionalArgs()[0]); - - triSurface surf(surfFileName); - - scalar density = args.optionLookupOrDefault("density", 1.0); + const fileName surfFileName = args[1]; + const scalar density = args.optionLookupOrDefault("density", 1.0); vector refPt = vector::zero; - bool calcAroundRefPt = args.optionReadIfPresent("referencePoint", refPt); + triSurface surf(surfFileName); + triFaceList faces(surf.size()); forAll(surf, i) diff --git a/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C b/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C index 017085c49968065c722178e2e7f135636556ffeb..9ba19b5f96d32bb121693dee0799c82df12972f9 100644 --- a/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C +++ b/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.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 @@ -50,6 +50,9 @@ Usage @param -to \<coordinateSystem\> \n Specify a coordinate System when writing files. + @param -tri \n + Triangulate surface. + Note The filename extensions are used to determine the file format type. @@ -73,20 +76,53 @@ int main(int argc, char *argv[]) argList::validArgs.append("inputFile"); argList::validArgs.append("outputFile"); - argList::addBoolOption("clean"); + argList::addBoolOption + ( + "clean", + "perform some surface checking/cleanup on the input surface" + ); + argList::addOption + ( + "scaleIn", + "scale", + "specify input geometry scaling factor" + ); + argList::addOption + ( + "scaleOut", + "scale", + "specify output geometry scaling factor" + ); + argList::addOption + ( + "dict", + "file", + "specify alternative dictionary for the coordinateSystems descriptions" + ); + argList::addOption + ( + "from", + "system", + "specify the source coordinate system, applied after '-scaleIn'" + ); + argList::addOption + ( + "to", + "system", + "specify the target coordinate system, applied before '-scaleOut'" + ); + argList::addBoolOption + ( + "tri", + "triangulate surface" + ); - argList::addOption("scaleIn", "scale"); - argList::addOption("scaleOut", "scale"); - argList::addOption("dict", "coordinateSystemsDict"); - argList::addOption("from", "sourceCoordinateSystem"); - argList::addOption("to", "targetCoordinateSystem"); argList args(argc, argv); Time runTime(args.rootPath(), args.caseName()); - const stringList& params = args.additionalArgs(); - fileName importName(params[0]); - fileName exportName(params[1]); + const fileName importName = args[1]; + const fileName exportName = args[2]; // disable inplace editing if (importName == exportName) @@ -117,7 +153,7 @@ int main(int argc, char *argv[]) if (args.optionFound("dict")) { - fileName dictPath(args.option("dict")); + const fileName dictPath = args["dict"]; csDictIoPtr.set ( @@ -164,7 +200,7 @@ int main(int argc, char *argv[]) if (args.optionFound("from")) { - const word csName(args.option("from")); + const word csName = args["from"]; label csId = csLst.find(csName); if (csId < 0) @@ -180,7 +216,7 @@ int main(int argc, char *argv[]) if (args.optionFound("to")) { - const word csName(args.option("to")); + const word csName = args["to"]; label csId = csLst.find(csName); if (csId < 0) @@ -242,6 +278,12 @@ int main(int argc, char *argv[]) surf.scalePoints(scaleOut); } + if (args.optionFound("tri")) + { + Info<< "triangulate" << endl; + surf.triangulate(); + } + Info<< "writing " << exportName; surf.write(exportName); } diff --git a/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C b/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C index 22c37c2379ed2aadc97a4599204ad33995b98694..11008d1ad925e6ef9399aaadc6673a77c347f4d8 100644 --- a/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C +++ b/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.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 @@ -86,13 +86,11 @@ int main(int argc, char *argv[]) argList::addOption("scale", "scale"); # include "setRootCase.H" - const stringList& params = args.additionalArgs(); - scalar scaleFactor = 0; - args.optionReadIfPresent("scale", scaleFactor); + const scalar scaleFactor = args.optionLookupOrDefault("scale", 0.0); - fileName importName(params[0]); - fileName exportName(params[1]); + const fileName importName = args[1]; + const fileName exportName = args[2]; if (importName == exportName) { diff --git a/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C b/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C index 98445dde2b15a22a1109efa686ba7be34d3cc768..851f4ac784636a3827e9b221911e586fbdda8928 100644 --- a/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C +++ b/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.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 @@ -87,10 +87,9 @@ int main(int argc, char *argv[]) argList args(argc, argv); Time runTime(args.rootPath(), args.caseName()); - const stringList& params = args.additionalArgs(); - fileName exportName(params[0]); - word importName = args.optionLookupOrDefault<word>("name", "default"); + const fileName exportName = args[1]; + const word importName = args.optionLookupOrDefault<word>("name", "default"); // check that writing is supported if (!MeshedSurface<face>::canWriteType(exportName.ext(), true)) @@ -109,7 +108,7 @@ int main(int argc, char *argv[]) if (args.optionFound("dict")) { - fileName dictPath(args.option("dict")); + const fileName dictPath = args["dict"]; ioPtr.set ( @@ -156,7 +155,7 @@ int main(int argc, char *argv[]) if (args.optionFound("from")) { - const word csName(args.option("from")); + const word csName = args["from"]; label csId = csLst.find(csName); if (csId < 0) @@ -172,7 +171,7 @@ int main(int argc, char *argv[]) if (args.optionFound("to")) { - const word csName(args.option("to")); + const word csName = args["to"]; label csId = csLst.find(csName); if (csId < 0) diff --git a/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C b/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C index a8552bbb05b52d10acd530fa103ce250a3580e2b..a260598d359aca315f4508269f070248de322a11 100644 --- a/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C +++ b/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.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 @@ -88,8 +88,6 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" - const stringList& params = args.additionalArgs(); - // try for the latestTime, but create "constant" as needed instantList Times = runTime.times(); if (Times.size()) @@ -103,9 +101,8 @@ int main(int argc, char *argv[]) } - fileName importName(params[0]); - word exportName("default"); - args.optionReadIfPresent("name", exportName); + const fileName importName = args[1]; + const word exportName = args.optionLookupOrDefault<word>("name", "default"); // check that reading is supported if (!MeshedSurface<face>::canRead(importName, true)) @@ -124,7 +121,7 @@ int main(int argc, char *argv[]) if (args.optionFound("dict")) { - fileName dictPath(args.option("dict")); + const fileName dictPath = args["dict"]; ioPtr.set ( @@ -171,7 +168,7 @@ int main(int argc, char *argv[]) if (args.optionFound("from")) { - const word csName(args.option("from")); + const word csName = args["from"]; label csId = csLst.find(csName); if (csId < 0) @@ -187,7 +184,7 @@ int main(int argc, char *argv[]) if (args.optionFound("to")) { - const word csName(args.option("to")); + const word csName = args["to"]; label csId = csLst.find(csName); if (csId < 0) diff --git a/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C b/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C index 51c8425d665fc7c25b9848dcc8484f05f3db5bc5..b87201fdfc0e199dd9ed03e77c3adb31024e7ca1 100644 --- a/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C +++ b/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.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 @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" - fileName outFileName(runTime.path()/args.additionalArgs()[0]); + const fileName outFileName(runTime.path()/args[1]); Info<< "Extracting triSurface from boundaryMesh ..." << endl << endl; @@ -85,12 +85,14 @@ int main(int argc, char *argv[]) if (args.optionFound("patches")) { - wordList patchNames(args.optionLookup("patches")()); + const wordList patchNames + ( + args.optionLookup("patches")() + ); forAll(patchNames, patchNameI) { const word& patchName = patchNames[patchNameI]; - label patchI = bMesh.findPatchID(patchName); if (patchI == -1) @@ -140,7 +142,7 @@ int main(int argc, char *argv[]) else { // Write local surface - fileName localPath = runTime.path()/runTime.caseName() + ".ftr"; + fileName localPath = runTime.path()/runTime.caseName() + ".obj"; Pout<< "Writing local surface to " << localPath << endl; @@ -313,7 +315,7 @@ int main(int argc, char *argv[]) ( runTime.rootPath() / globalCasePath - / args.additionalArgs()[0] + / args[1] ); allSurf.write(globalPath); diff --git a/applications/utilities/surface/surfaceOrient/surfaceOrient.C b/applications/utilities/surface/surfaceOrient/surfaceOrient.C index 39620435b16483b5df77056730be6930cb6a1806..5e47b628240c93db9a709a4070d125a136b40f35 100644 --- a/applications/utilities/surface/surfaceOrient/surfaceOrient.C +++ b/applications/utilities/surface/surfaceOrient/surfaceOrient.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,13 +48,14 @@ int main(int argc, char *argv[]) argList::addBoolOption("inside"); argList args(argc, argv); - fileName surfFileName(args.additionalArgs()[0]); - Info<< "Reading surface from " << surfFileName << endl; + const fileName surfFileName = args[1]; + const point visiblePoint = args.argRead<point>(2); + const fileName outFileName = args[3]; - point visiblePoint(IStringStream(args.additionalArgs()[1])()); - Info<< "Visible point " << visiblePoint << endl; + const bool orientInside = args.optionFound("inside"); - bool orientInside = args.optionFound("inside"); + Info<< "Reading surface from " << surfFileName << endl; + Info<< "Visible point " << visiblePoint << endl; if (orientInside) { @@ -67,7 +68,6 @@ int main(int argc, char *argv[]) << " is outside" << endl; } - fileName outFileName(args.additionalArgs()[2]); Info<< "Writing surface to " << outFileName << endl; diff --git a/applications/utilities/surface/surfacePointMerge/surfacePointMerge.C b/applications/utilities/surface/surfacePointMerge/surfacePointMerge.C index f206f6e931eed12b13ec8d832df2ace5e6caef4b..c958f7c360438ce3685eb9f578a58dc016cac80d 100644 --- a/applications/utilities/surface/surfacePointMerge/surfacePointMerge.C +++ b/applications/utilities/surface/surfacePointMerge/surfacePointMerge.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 @@ -49,9 +49,9 @@ int main(int argc, char *argv[]) argList::validArgs.append("output file"); argList args(argc, argv); - fileName surfFileName(args.additionalArgs()[0]); - scalar mergeTol(readScalar(IStringStream(args.additionalArgs()[1])())); - fileName outFileName(args.additionalArgs()[2]); + const fileName surfFileName = args[1]; + const scalar mergeTol = args.argRead<scalar>(2); + const fileName outFileName = args[3]; Info<< "Reading surface from " << surfFileName << " ..." << endl; Info<< "Merging points within " << mergeTol << " meter." << endl; diff --git a/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C b/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C index 24a6facb0f4b4d3e138fbff7fbac9cf13f3c89f3..e875b27af65000e4e5231365e1e5bad8eb88f5c3 100644 --- a/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C +++ b/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.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 @@ -108,16 +108,16 @@ int main(int argc, char *argv[]) # include "createTime.H" runTime.functionObjects().off(); - fileName surfFileName(args.additionalArgs()[0]); - Info<< "Reading surface from " << surfFileName << nl << endl; + const fileName surfFileName = args[1]; + const word distType = args[2]; - const word distType(args.additionalArgs()[1]); - - Info<< "Using distribution method " + Info<< "Reading surface from " << surfFileName << nl + << nl + << "Using distribution method " << distributedTriSurfaceMesh::distributionTypeNames_[distType] << " " << distType << nl << endl; - bool keepNonMapped = args.options().found("keepNonMapped"); + const bool keepNonMapped = args.options().found("keepNonMapped"); if (keepNonMapped) { diff --git a/applications/utilities/surface/surfaceRefineRedGreen/surfaceRefineRedGreen.C b/applications/utilities/surface/surfaceRefineRedGreen/surfaceRefineRedGreen.C index 7b94ca60e2b89dedca57beddc72936ba1103492c..63bf1c25d89dc8e21509b0f2d9b540188dcd3d8b 100644 --- a/applications/utilities/surface/surfaceRefineRedGreen/surfaceRefineRedGreen.C +++ b/applications/utilities/surface/surfaceRefineRedGreen/surfaceRefineRedGreen.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 @@ -53,8 +53,8 @@ int main(int argc, char *argv[]) argList::validArgs.append("output surface file"); argList::argList args(argc, argv); - fileName surfFileName(args.additionalArgs()[0]); - fileName outFileName(args.additionalArgs()[1]); + const fileName surfFileName = args[1]; + const fileName outFileName = args[2]; Info<< "Reading surface from " << surfFileName << " ..." << endl; diff --git a/applications/utilities/surface/surfaceSmooth/surfaceSmooth.C b/applications/utilities/surface/surfaceSmooth/surfaceSmooth.C index e68f6ab20b2f6d5fb0a281312944d2ced07d1daf..8c57255afecf50f5beafb0497fc33380127a4583 100644 --- a/applications/utilities/surface/surfaceSmooth/surfaceSmooth.C +++ b/applications/utilities/surface/surfaceSmooth/surfaceSmooth.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 @@ -50,17 +50,18 @@ int main(int argc, char *argv[]) argList::validArgs.append("output file"); argList args(argc, argv); - fileName surfFileName(args.additionalArgs()[0]); - scalar relax(readScalar(IStringStream(args.additionalArgs()[1])())); - if ((relax <= 0) || (relax > 1)) + const fileName surfFileName = args[1]; + const scalar relax = args.argRead<scalar>(2); + const label iters = args.argRead<label>(3); + const fileName outFileName = args[4]; + + if (relax <= 0 || relax > 1) { FatalErrorIn(args.executable()) << "Illegal relaxation factor " << relax << endl << "0: no change 1: move vertices to average of neighbours" << exit(FatalError); } - label iters(readLabel(IStringStream(args.additionalArgs()[2])())); - fileName outFileName(args.additionalArgs()[3]); Info<< "Relax:" << relax << nl << "Iters:" << iters << nl diff --git a/applications/utilities/surface/surfaceSplitByPatch/surfaceSplitByPatch.C b/applications/utilities/surface/surfaceSplitByPatch/surfaceSplitByPatch.C index a597fc5c2c199030c810a24a3ae7dccc79c3c64c..099ccadf40b855d470ba7ce4d6dec02cfac78ec1 100644 --- a/applications/utilities/surface/surfaceSplitByPatch/surfaceSplitByPatch.C +++ b/applications/utilities/surface/surfaceSplitByPatch/surfaceSplitByPatch.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,7 +42,7 @@ int main(int argc, char *argv[]) argList::validArgs.append("input file"); argList::argList args(argc, argv); - fileName surfName(args.additionalArgs()[0]); + const fileName surfName = args[1]; Info<< "Reading surf from " << surfName << " ..." << nl << endl; diff --git a/applications/utilities/surface/surfaceSplitNonManifolds/surfaceSplitNonManifolds.C b/applications/utilities/surface/surfaceSplitNonManifolds/surfaceSplitNonManifolds.C index 3e8500bee4ea8283728790267d582d450b33b458..8da72b80c44cbac169faf329e0b9b1995995375d 100644 --- a/applications/utilities/surface/surfaceSplitNonManifolds/surfaceSplitNonManifolds.C +++ b/applications/utilities/surface/surfaceSplitNonManifolds/surfaceSplitNonManifolds.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 @@ -545,9 +545,9 @@ void calcPointVecs if (face0I == -1 && face1I == -1) { - Info<< "Writing surface to errorSurf.ftr" << endl; + Info<< "Writing surface to errorSurf.obj" << endl; - surf.write("errorSurf.ftr"); + surf.write("errorSurf.obj"); FatalErrorIn("calcPointVecs(..)") << "Cannot find two faces using border edge " << edgeI @@ -557,7 +557,7 @@ void calcPointVecs << " face1I:" << face1I << nl << "faceToEdge:" << faceToEdge << nl << "faceToPoint:" << faceToPoint - << "Written surface to errorSurf.ftr" + << "Written surface to errorSurf.obj" << abort(FatalError); } @@ -692,9 +692,9 @@ int main(int argc, char *argv[]) argList args(argc, argv); - fileName inSurfName(args.additionalArgs()[0]); - fileName outSurfName(args.additionalArgs()[1]); - bool debug = args.optionFound("debug"); + const fileName inSurfName = args[1]; + const fileName outSurfName = args[2]; + const bool debug = args.optionFound("debug"); Info<< "Reading surface from " << inSurfName << endl; diff --git a/applications/utilities/surface/surfaceSubset/surfaceSubset.C b/applications/utilities/surface/surfaceSubset/surfaceSubset.C index 6cc8ee4678438534a81367192ebfe3d04b48d42b..9b782166d7efcc69e6993cb73eb6306d9d0d473c 100644 --- a/applications/utilities/surface/surfaceSubset/surfaceSubset.C +++ b/applications/utilities/surface/surfaceSubset/surfaceSubset.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,12 +54,15 @@ int main(int argc, char *argv[]) argList::validArgs.append("output file"); argList args(argc, argv); - Info<< "Reading dictionary " << args.additionalArgs()[0] << " ..." << endl; - IFstream dictFile(args.additionalArgs()[0]); + Info<< "Reading dictionary " << args[1] << " ..." << endl; + IFstream dictFile(args[1]); dictionary meshSubsetDict(dictFile); - Info<< "Reading surface " << args.additionalArgs()[1] << " ..." << endl; - triSurface surf1(args.additionalArgs()[1]); + Info<< "Reading surface " << args[2] << " ..." << endl; + triSurface surf1(args[2]); + + const fileName outFileName(args[3]); + Info<< "Original:" << endl; surf1.writeStats(Info); @@ -361,8 +364,6 @@ int main(int argc, char *argv[]) surf2.writeStats(Info); Info<< endl; - fileName outFileName(args.additionalArgs()[2]); - Info<< "Writing surface to " << outFileName << endl; surf2.write(outFileName); diff --git a/applications/utilities/surface/surfaceToPatch/surfaceToPatch.C b/applications/utilities/surface/surfaceToPatch/surfaceToPatch.C index c4adb969a36cf01fd5065cf899b4692954e465e7..1a55d03f2d95318472602281c6874820659db816 100644 --- a/applications/utilities/surface/surfaceToPatch/surfaceToPatch.C +++ b/applications/utilities/surface/surfaceToPatch/surfaceToPatch.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 @@ -173,12 +173,12 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createPolyMesh.H" - fileName surfName(args.additionalArgs()[0]); + const fileName surfName = args[1]; Info<< "Reading surface from " << surfName << " ..." << endl; word setName; - bool readSet = args.optionReadIfPresent("faceSet", setName); + const bool readSet = args.optionReadIfPresent("faceSet", setName); if (readSet) { diff --git a/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C b/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C index 387471521ed37b2e7d0968715aa251c920b97525..e5dd518b11d79884e690b221241ba5bff6da760d 100644 --- a/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C +++ b/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.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 @@ -98,14 +98,11 @@ int main(int argc, char *argv[]) ); argList args(argc, argv); - fileName surfFileName(args.additionalArgs()[0]); - - Info<< "Reading surf from " << surfFileName << " ..." << endl; - - fileName outFileName(args.additionalArgs()[1]); - - Info<< "Writing surf to " << outFileName << " ..." << endl; + const fileName surfFileName = args[1]; + const fileName outFileName = args[2]; + Info<< "Reading surf from " << surfFileName << " ..." << nl + << "Writing surf to " << outFileName << " ..." << endl; if (args.options().empty()) { @@ -119,18 +116,20 @@ int main(int argc, char *argv[]) pointField points(surf1.points()); - if (args.optionFound("translate")) + vector v; + if (args.optionReadIfPresent("translate", v)) { - vector transVector(args.optionLookup("translate")()); - - Info<< "Translating points by " << transVector << endl; + Info<< "Translating points by " << v << endl; - points += transVector; + points += v; } if (args.optionFound("rotate")) { - Pair<vector> n1n2(args.optionLookup("rotate")()); + Pair<vector> n1n2 + ( + args.optionLookup("rotate")() + ); n1n2[0] /= mag(n1n2[0]); n1n2[1] /= mag(n1n2[1]); @@ -140,15 +139,12 @@ int main(int argc, char *argv[]) points = transform(T, points); } - else if (args.optionFound("rollPitchYaw")) + else if (args.optionReadIfPresent("rollPitchYaw", v)) { - vector v(args.optionLookup("rollPitchYaw")()); - Info<< "Rotating points by" << nl << " roll " << v.x() << nl << " pitch " << v.y() << nl - << " yaw " << v.z() << endl; - + << " yaw " << v.z() << nl; // Convert to radians v *= pi/180.0; @@ -158,14 +154,12 @@ int main(int argc, char *argv[]) Info<< "Rotating points by quaternion " << R << endl; points = transform(R, points); } - else if (args.optionFound("yawPitchRoll")) + else if (args.optionReadIfPresent("yawPitchRoll", v)) { - vector v(args.optionLookup("yawPitchRoll")()); - Info<< "Rotating points by" << nl << " yaw " << v.x() << nl << " pitch " << v.y() << nl - << " roll " << v.z() << endl; + << " roll " << v.z() << nl; // Convert to radians @@ -183,15 +177,13 @@ int main(int argc, char *argv[]) points = transform(R, points); } - if (args.optionFound("scale")) + if (args.optionReadIfPresent("scale", v)) { - vector scaleVector(args.optionLookup("scale")()); - - Info<< "Scaling points by " << scaleVector << endl; + Info<< "Scaling points by " << v << endl; - points.replace(vector::X, scaleVector.x()*points.component(vector::X)); - points.replace(vector::Y, scaleVector.y()*points.component(vector::Y)); - points.replace(vector::Z, scaleVector.z()*points.component(vector::Z)); + points.replace(vector::X, v.x()*points.component(vector::X)); + points.replace(vector::Y, v.y()*points.component(vector::Y)); + points.replace(vector::Z, v.z()*points.component(vector::Z)); } surf1.movePoints(points); diff --git a/applications/utilities/thermophysical/adiabaticFlameT/adiabaticFlameT.C b/applications/utilities/thermophysical/adiabaticFlameT/adiabaticFlameT.C index e893520b065b4ab1d6f9573ef330fd06f7868d22..a29e0d2106e2df1a7e9797ff407df3ff383b50ad 100644 --- a/applications/utilities/thermophysical/adiabaticFlameT/adiabaticFlameT.C +++ b/applications/utilities/thermophysical/adiabaticFlameT/adiabaticFlameT.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,7 +54,7 @@ int main(int argc, char *argv[]) argList::validArgs.append("controlFile"); argList args(argc, argv); - fileName controlFileName(args.additionalArgs()[0]); + const fileName controlFileName = args[1]; // Construct control dictionary IFstream controlFile(controlFileName); diff --git a/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C b/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C index f1cb5ee1b3f174f625713041ed5bfe8a6d43a2ed..3cf8ef503172a5301ff2539422ef37505c99374d 100644 --- a/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C +++ b/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.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,7 +23,8 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Description - Converts CHEMKINIII thermodynamics and reaction data files into FOAM format + Converts CHEMKINIII thermodynamics and reaction data files into + OpenFOAM format. \*---------------------------------------------------------------------------*/ @@ -45,19 +46,14 @@ int main(int argc, char *argv[]) argList::validArgs.append("FOAMThermodynamicsFile"); argList args(argc, argv); - fileName CHEMKINFileName(args.additionalArgs()[0]); - fileName thermoFileName(args.additionalArgs()[1]); - fileName FOAMChemistryFileName(args.additionalArgs()[2]); - fileName FOAMThermodynamicsFileName(args.additionalArgs()[3]); + chemkinReader cr(args[1], args[2]); - chemkinReader cr(CHEMKINFileName, thermoFileName); - - OFstream reactionsFile(FOAMChemistryFileName); + OFstream reactionsFile(args[3]); reactionsFile << "species" << cr.species() << token::END_STATEMENT << nl << nl << "reactions" << cr.reactions() << token::END_STATEMENT << endl; - OFstream thermoFile(FOAMThermodynamicsFileName); + OFstream thermoFile(args[4]); thermoFile<< cr.speciesThermo() << endl; Info<< "End\n" << endl; diff --git a/applications/utilities/thermophysical/equilibriumFlameT/equilibriumFlameT.C b/applications/utilities/thermophysical/equilibriumFlameT/equilibriumFlameT.C index c2186b642df5c6fbbdb1a0d52d0b38b5b82d515a..6ba8fd6bbeee57aeccb2c2ba367f2b8d23f701e1 100644 --- a/applications/utilities/thermophysical/equilibriumFlameT/equilibriumFlameT.C +++ b/applications/utilities/thermophysical/equilibriumFlameT/equilibriumFlameT.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 @@ -55,7 +55,7 @@ int main(int argc, char *argv[]) argList::validArgs.append("controlFile"); argList args(argc, argv); - fileName controlFileName(args.additionalArgs()[0]); + const fileName controlFileName = args[1]; // Construct control dictionary IFstream controlFile(controlFileName); diff --git a/applications/utilities/thermophysical/mixtureAdiabaticFlameT/mixtureAdiabaticFlameT.C b/applications/utilities/thermophysical/mixtureAdiabaticFlameT/mixtureAdiabaticFlameT.C index 5e4c41dbe9ff9a0d4c2a8d4ab9791d867992e340..90b6eb8d9c7b24672c1fab66a38132a2f8bf3488 100644 --- a/applications/utilities/thermophysical/mixtureAdiabaticFlameT/mixtureAdiabaticFlameT.C +++ b/applications/utilities/thermophysical/mixtureAdiabaticFlameT/mixtureAdiabaticFlameT.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,7 +54,7 @@ int main(int argc, char *argv[]) argList::validArgs.append("controlFile"); argList args(argc, argv); - fileName controlFileName(args.additionalArgs()[0]); + const fileName controlFileName(args[1]); // Construct control dictionary IFstream controlFile(controlFileName); diff --git a/doc/Doxygen/FoamFooter.html b/doc/Doxygen/FoamFooter.html index 352a32682cd2625f3da76a115ca00a283118c057..3e70a02e792365dc6bf344fbdc3ed0752370a497 100644 --- a/doc/Doxygen/FoamFooter.html +++ b/doc/Doxygen/FoamFooter.html @@ -1,4 +1,4 @@ -Copyright © 2000-2009 OpenCFD Ltd +Copyright © 2000-2010 <a href="http://www.openfoam.com/about">OpenCFD Ltd.</a> </td></tr> </table> </body> diff --git a/doc/Doxygen/FoamHeader.html b/doc/Doxygen/FoamHeader.html index 3314d3dd6cf2c078b924ed1095808bdaec2e0fc4..3d16a4804a35f9a65114646da5885a558b7c3596 100644 --- a/doc/Doxygen/FoamHeader.html +++ b/doc/Doxygen/FoamHeader.html @@ -1,17 +1,13 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<html > +<html> <head> - <title> OpenFOAM programmer's C++ documentation - </title> + <title> OpenFOAM programmer's C++ documentation </title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/mn.html)"> -<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/mn.html)"> <!-- html,info --> -<meta name="src" content="index.tex"> -<meta name="date" content="2007-04-12 00:02:00"> <link rel="stylesheet" type="text/css" href="../Doxygen.css"> <link rel="stylesheet" type="text/css" href="../tabs.css"> +<link href="../OpenFOAMicon.png" type="image/png" rel="icon" /> <meta name="keywords" content="computational fluid dynamics, CFD, OpenCFD, OpenFOAM, open source CFD, open source"> <meta name="description" content="OpenCFD Ltd, leaders in open source Computational Fluid Dynamics (CFD), the developers and maintainers of OpenFOAM: the open source CFD toolbox. We supply support and contracted developments for OpenFOAM"> </head> @@ -22,7 +18,7 @@ <tr> <td style="width: 9px; height:54px"></td> <td style="width: 250px; height:54px; vertical-align:middle; -horizontal-align: left; "> + horizontal-align: left;"> <img alt="OpenFOAM logo" src="../OpenFOAMlogo.jpg"> </td> <td style="width:350px; height:54px; vertical-align:middle; horizontal-align: left; "> @@ -35,36 +31,35 @@ horizontal-align: left; "> </tr> </table> <!-- Button banner --> -<table style="border-width: 0px; width: 800px; background: #ffffff;" cellspacing=0 cellpadding=0> +<table + style="border-width: 0px; width: 800px; background: #ffffff;" + cellspacing="0" cellpadding="0"> <tr> -<td valign=top> - <table width=801 border=0 cellspacing=1 cellpadding=0 bgcolor="#ffffff"> +<td valign="top"> + <table width="801" border="0" cellspacing="1" cellpadding="0" bgcolor="#ffffff"> <tr> <td class=leftmenu> - <a href="http://foam.sourceforge.net/doc/Doxygen/html" - class=menuLefton >Source Guide</a> + <a href="http://foam.sourceforge.net/doc/Doxygen/html" + class="menuLefton">Source Guide</a> </td> <td class=topmenu> - <a href="http://www.opencfd.co.uk/index.html" - class=menuTopoff >OpenCFD</a> + <a href="http://www.openfoam.com/about/" + class="menuTopoff">OpenCFD</a> </td> <td class=topmenu> - <a href="http://www.opencfd.co.uk/solutions/index.html" - class=menuTopoff >Solutions</a> + <a href="http://www.openfoam.com/features/" + class="menuTopoff">Features</a> </td> <td class=topmenu> - <a href="http://www.opencfd.co.uk/contact/index.html" - class=menuTopoff >Contact</a> + <a href="http://www.openfoam.com/contact/" + class="menuTopoff">Contact</a> </td> <td class=topmenu> - <a href="http://www.opencfd.co.uk/openfoam/index.html" - class=menuTopoff >OpenFOAM</a> - </td> - </tr> - <tr> - <td> + <a href="http://www.openfoam.com/" + class="menuTopoff">OpenFOAM</a> </td> </tr> + <tr><td></td></tr> </table> </td> </tr> diff --git a/doc/Doxygen/OpenFOAMicon.png b/doc/Doxygen/OpenFOAMicon.png new file mode 100644 index 0000000000000000000000000000000000000000..073c65b684d0ddaa64412ce6637f8e5776bbb2a9 Binary files /dev/null and b/doc/Doxygen/OpenFOAMicon.png differ diff --git a/etc/apps/paraview3/bashrc b/etc/apps/paraview3/bashrc index 60b40255d2f18f41a10f9ebd122ec2235c177d84..24bfa9887ddf916a0f3700c4dbb25e4b44c91f65 100644 --- a/etc/apps/paraview3/bashrc +++ b/etc/apps/paraview3/bashrc @@ -35,7 +35,7 @@ # determine the cmake to be used unset CMAKE_HOME -for cmake in cmake-2.6.4 cmake-2.6.2 cmake-2.4.6 +for cmake in cmake-2.8.0 cmake-2.6.4 cmake-2.6.2 cmake-2.4.6 do cmake=$WM_THIRD_PARTY_DIR/$cmake/platforms/$WM_ARCH if [ -r $cmake ] diff --git a/etc/apps/paraview3/cshrc b/etc/apps/paraview3/cshrc index d22f25012dd6c54e400683dc4b6f48aa066a444d..2cbfa0e281d5acc7c35ac00554358d8088be3fc1 100644 --- a/etc/apps/paraview3/cshrc +++ b/etc/apps/paraview3/cshrc @@ -35,7 +35,7 @@ # determine the cmake to be used unsetenv CMAKE_HOME -foreach cmake ( cmake-2.6.4 cmake-2.6.2 cmake-2.4.6 ) +foreach cmake ( cmake-2.8.0 cmake-2.6.4 cmake-2.6.2 cmake-2.4.6 ) set cmake=$WM_THIRD_PARTY_DIR/$cmake/platforms/$WM_ARCH if ( -r $cmake ) then setenv CMAKE_HOME $cmake diff --git a/etc/controlDict b/etc/controlDict index a1df85c9a153ab39ca646dc837903c70ef0a5a9b..878f686a95b118d5f8a569078c4ab62ecdc258e9 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -643,7 +643,6 @@ DebugSwitches perfectInterface 0; pointIndexHitList 0; pointPatchField 0; - pointPatchInterpolation 0; pointScalarField 0; pointScalarField::DimensionedInternalField 0; pointSet 0; diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index d8634de6dfdc75f0852cab846fd032ff45c8da8b..17da5aefef5c108eff6d9aa9e81ca5e23385bb5b 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -453,7 +453,9 @@ $(constraintPointPatches)/processor/processorPointPatch.C derivedPointPatches = $(pointPatches)/derived $(derivedPointPatches)/coupled/coupledFacePointPatch.C +/* $(derivedPointPatches)/global/globalPointPatch.C +*/ $(derivedPointPatches)/wall/wallPointPatch.C pointBoundaryMesh = $(pointMesh)/pointBoundaryMesh @@ -508,7 +510,9 @@ $(constraintPointPatchFields)/processor/processorPointPatchFields.C derivedPointPatchFields = $(pointPatchFields)/derived $(derivedPointPatchFields)/slip/slipPointPatchFields.C +/* $(derivedPointPatchFields)/global/globalPointPatchFields.C +*/ $(derivedPointPatchFields)/uniformFixedValue/uniformFixedValuePointPatchFields.C $(derivedPointPatchFields)/timeVaryingUniformFixedValue/timeVaryingUniformFixedValuePointPatchFields.C diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/IPstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/IPstream.C index a970d6104cef67f4fd68e867bbdb73b8b839f97f..884276809857d563b8be24f4cfe984f47bd1da9a 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/IPstream.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/IPstream.C @@ -38,7 +38,8 @@ Foam::IPstream::IPstream ) : Pstream(commsType, bufSize), - UIPstream(commsType, fromProcNo, buf_) + UIPstream(commsType, fromProcNo, buf_, externalBufPosition_), + externalBufPosition_(0) {} diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/IPstream.H b/src/OpenFOAM/db/IOstreams/Pstreams/IPstream.H index acc59de87bf045db5171eec073e39c8030f5c83f..201e1b7f1d324e9926a1d4eb10cd49125d5aedde 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/IPstream.H +++ b/src/OpenFOAM/db/IOstreams/Pstreams/IPstream.H @@ -55,6 +55,9 @@ class IPstream public UIPstream { + //- Receive index + label externalBufPosition_; + public: // Constructors diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.C b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.C index 41cb1c4f110bc75c61dfdcd904812cc77d13eac3..b2e4d8df06dd8be31eeaef26c4fa37e9ee88901e 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.C @@ -51,10 +51,31 @@ Foam::PstreamBuffers::PstreamBuffers version_(version), sendBuf_(UPstream::nProcs()), recvBuf_(UPstream::nProcs()), + recvBufPos_(UPstream::nProcs(), 0), finishedSendsCalled_(false) {} +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::PstreamBuffers::~PstreamBuffers() +{ + // Check that all data has been consumed. + forAll(recvBufPos_, procI) + { + if (recvBufPos_[procI] < recvBuf_[procI].size()) + { + FatalErrorIn("PstreamBuffers::~PstreamBuffers()") + << "Message from processor " << procI + << " not fully consumed. messageSize:" << recvBuf_[procI].size() + << " bytes of which only " << recvBufPos_[procI] + << " consumed." + << Foam::abort(FatalError); + } + } +} + + // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // void Foam::PstreamBuffers::finishedSends(const bool block) diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.H b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.H index 75f26f1d6a9468d6caba8174921895dbf84fe1b2..c2dc745beac925af1a48362787dd740036a76ca6 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.H +++ b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.H @@ -106,6 +106,9 @@ class PstreamBuffers //- receive buffer List<DynamicList<char> > recvBuf_; + //- read position in recvBuf_ + labelList recvBufPos_; + bool finishedSendsCalled_; // Private member functions @@ -129,6 +132,10 @@ public: IOstream::versionNumber version=IOstream::currentVersion ); + // Destructor + + ~PstreamBuffers(); + // Member functions diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.C index 4c38db6c692cb0598618a85b5496519fdc7f7d9d..f4c37633f352cde9c57fed2b48d1a6e31ec9a449 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.C @@ -77,20 +77,6 @@ inline void Foam::UIPstream::readFromBuffer } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::UIPstream::~UIPstream() -{ - if (externalBufPosition_ < messageSize_) - { - FatalErrorIn("UIPstream::~UIPstream()") - << "Message not fully consumed. messageSize:" << messageSize_ - << " bytes of which only " << externalBufPosition_ - << " consumed." << Foam::abort(FatalError); - } -} - - // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // Foam::Istream& Foam::UIPstream::read(token& t) diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.H b/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.H index aebef123b1586d5855ac301feda4779c60fef8ef..30e4e9611976bad7c21b42fe5186b30a8d5c396b 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.H +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.H @@ -63,7 +63,7 @@ class UIPstream DynamicList<char>& externalBuf_; - label externalBufPosition_; + label& externalBufPosition_; const int tag_; @@ -94,6 +94,7 @@ public: const commsTypes commsType, const int fromProcNo, DynamicList<char>& externalBuf, + label& externalBufPosition, const int tag = UPstream::msgType(), streamFormat format=BINARY, versionNumber version=currentVersion @@ -103,11 +104,6 @@ public: UIPstream(const int fromProcNo, PstreamBuffers&); - // Destructor - - ~UIPstream(); - - // Member functions // Inquiry diff --git a/src/OpenFOAM/fields/pointPatchFields/basic/coupled/coupledPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/basic/coupled/coupledPointPatchField.H index e49a96330e2ff818168e2953aaf608e9dcfe0e11..d0be734d55896ee3d8db8b795ea1e8334fb68470 100644 --- a/src/OpenFOAM/fields/pointPatchFields/basic/coupled/coupledPointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/basic/coupled/coupledPointPatchField.H @@ -121,11 +121,19 @@ public: ) = 0; //- Initialise swap of patch point values - virtual void initSwapAdd(Field<Type>&) const + virtual void initSwapAddSeparated + ( + const Pstream::commsTypes, + Field<Type>& + ) const {} //- Complete swap of patch point values and add to local values - virtual void swapAdd(Field<Type>&) const = 0; + virtual void swapAddSeparated + ( + const Pstream::commsTypes, + Field<Type>& + ) const = 0; }; diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.C index 40aa26a36aa1c207fab90f3012456c2f84277635..b5ded6b394d78c85f56232743ac324014a4c61ec 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.C @@ -122,7 +122,11 @@ cyclicPointPatchField<Type>::cyclicPointPatchField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> -void cyclicPointPatchField<Type>::swapAdd(Field<Type>& pField) const +void cyclicPointPatchField<Type>::swapAddSeparated +( + const Pstream::commsTypes, + Field<Type>& pField +) const { Field<Type> pf(this->patchInternalField(pField)); @@ -145,7 +149,7 @@ void cyclicPointPatchField<Type>::swapAdd(Field<Type>& pField) const } } - addToInternalField(pField, pf); + addToInternalField(pField, pf, cyclicPatch_.separatedPoints()); } diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.H index df9068d9e8e240d0c2f306f7f42343be4e82183e..94daa63473f8357a83f6d7dfe8cb92d63b1aafe8 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.H @@ -159,7 +159,11 @@ public: {} //- Complete swap of patch point values and add to local values - virtual void swapAdd(Field<Type>&) const; + virtual void swapAddSeparated + ( + const Pstream::commsTypes commsType, + Field<Type>& + ) const; }; diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.C index c5b8c8334d1fdda7847c8569cb25c5b020b422f2..687d9779e7b5e3d6e9ffc69ff47fcdf587fc639d 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.C @@ -96,16 +96,28 @@ processorPointPatchField<Type>::~processorPointPatchField() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> -void processorPointPatchField<Type>::initSwapAdd(Field<Type>& pField) const +void processorPointPatchField<Type>::initSwapAddSeparated +( + const Pstream::commsTypes commsType, + Field<Type>& pField +) +const { if (Pstream::parRun()) { - // Get internal field into my point order - Field<Type> pf(this->patchInternalField(pField)); + // Get internal field into correct order for opposite side + Field<Type> pf + ( + this->patchInternalField + ( + pField, + procPatch_.reverseMeshPoints() + ) + ); OPstream::write ( - Pstream::blocking, + commsType, procPatch_.neighbProcNo(), reinterpret_cast<const char*>(pf.begin()), pf.byteSize() @@ -115,7 +127,11 @@ void processorPointPatchField<Type>::initSwapAdd(Field<Type>& pField) const template<class Type> -void processorPointPatchField<Type>::swapAdd(Field<Type>& pField) const +void processorPointPatchField<Type>::swapAddSeparated +( + const Pstream::commsTypes commsType, + Field<Type>& pField +) const { if (Pstream::parRun()) { @@ -123,7 +139,7 @@ void processorPointPatchField<Type>::swapAdd(Field<Type>& pField) const IPstream::read ( - Pstream::blocking, + commsType, procPatch_.neighbProcNo(), reinterpret_cast<char*>(pnf.begin()), pnf.byteSize() @@ -140,22 +156,20 @@ void processorPointPatchField<Type>::swapAdd(Field<Type>& pField) const } else { - const labelList& nonGlobalPatchPoints = - procPatch_.nonGlobalPatchPoints(); const labelListList& pointFaces = ppp.pointFaces(); - forAll(nonGlobalPatchPoints, pfi) + forAll(pointFaces, pfi) { pnf[pfi] = transform ( - forwardT[pointFaces[nonGlobalPatchPoints[pfi]][0]], + forwardT[pointFaces[pfi][0]], pnf[pfi] ); } } } - addToInternalField(pField, pnf); + addToInternalField(pField, pnf, procPatch_.separatedPoints()); } } diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H index a49c28c54b083ed7403d8bf70b0fb07b5561c56d..f0e9b0adee8eee9d2c91f6debe8737e82c60e848 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H @@ -169,11 +169,19 @@ public: ) {} - //- Initialise swap of patch point values - virtual void initSwapAdd(Field<Type>&) const; + //- Initialise swap of non-collocated patch point values + virtual void initSwapAddSeparated + ( + const Pstream::commsTypes commsType, + Field<Type>& + ) const; //- Complete swap of patch point values and add to local values - virtual void swapAdd(Field<Type>&) const; + virtual void swapAddSeparated + ( + const Pstream::commsTypes commsType, + Field<Type>& + ) const; }; diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/global/globalPointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/derived/global/globalPointPatchField.C deleted file mode 100644 index cce542b124da5df31eee48ef7547813c28e25128..0000000000000000000000000000000000000000 --- a/src/OpenFOAM/fields/pointPatchFields/derived/global/globalPointPatchField.C +++ /dev/null @@ -1,169 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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 "globalPointPatchField.H" -#include "PstreamCombineReduceOps.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * // - -template<class Type> -globalPointPatchField<Type>::globalPointPatchField -( - const pointPatch& p, - const DimensionedField<Type, pointMesh>& iF -) -: - coupledPointPatchField<Type>(p, iF), - globalPointPatch_(refCast<const globalPointPatch>(p)) -{} - - -template<class Type> -globalPointPatchField<Type>::globalPointPatchField -( - const pointPatch& p, - const DimensionedField<Type, pointMesh>& iF, - const dictionary& dict -) -: - coupledPointPatchField<Type>(p, iF, dict), - globalPointPatch_(refCast<const globalPointPatch>(p)) -{ - if (!isType<globalPointPatch>(p)) - { - FatalIOErrorIn - ( - "globalPointPatchField<Type>::globalPointPatchField\n" - "(\n" - " const pointPatch& p,\n" - " const Field<Type>& field,\n" - " const dictionary& dict\n" - ")\n", - dict - ) << "patch " << this->patch().index() - << " not processorPoint type. " - << "Patch type = " << p.type() - << exit(FatalIOError); - } -} - - -template<class Type> -globalPointPatchField<Type>::globalPointPatchField -( - const globalPointPatchField<Type>& ptf, - const pointPatch& p, - const DimensionedField<Type, pointMesh>& iF, - const pointPatchFieldMapper& mapper -) -: - coupledPointPatchField<Type>(ptf, p, iF, mapper), - globalPointPatch_(refCast<const globalPointPatch>(ptf.patch())) -{ - if (!isType<globalPointPatch>(this->patch())) - { - FatalErrorIn - ( - "globalPointPatchField<Type>::globalPointPatchField\n" - "(\n" - " const globalPointPatchField<Type>& ptf,\n" - " const pointPatch& p,\n" - " const DimensionedField<Type, pointMesh>& iF,\n" - " const pointPatchFieldMapper& mapper\n" - ")\n" - ) << "Field type does not correspond to patch type for patch " - << this->patch().index() << "." << endl - << "Field type: " << typeName << endl - << "Patch type: " << this->patch().type() - << exit(FatalError); - } -} - - -template<class Type> -globalPointPatchField<Type>::globalPointPatchField -( - const globalPointPatchField<Type>& ptf, - const DimensionedField<Type, pointMesh>& iF -) -: - coupledPointPatchField<Type>(ptf, iF), - globalPointPatch_(refCast<const globalPointPatch>(ptf.patch())) -{} - - -// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -globalPointPatchField<Type>::~globalPointPatchField() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // - -template<class Type> -void globalPointPatchField<Type>::swapAdd(Field<Type>& pField) const -{ - // Create the global list and insert local values - if (globalPointPatch_.globalPointSize() > 0) - { - Field<Type> lpf = patchInternalField(pField); - const labelList& addr = globalPointPatch_.sharedPointAddr(); - - Field<Type> gpf - ( - globalPointPatch_.globalPointSize(), - pTraits<Type>::zero - ); - - forAll(addr, i) - { - gpf[addr[i]] += lpf[i]; - } - - combineReduce(gpf, plusEqOp<Field<Type> >()); - - // Extract local data - forAll (addr, i) - { - lpf[i] = gpf[addr[i]]; - } - - setInInternalField(pField, lpf); - } -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/global/globalPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/derived/global/globalPointPatchField.H deleted file mode 100644 index bd7285d16c14fa9a198db1a911c3cf619aad158e..0000000000000000000000000000000000000000 --- a/src/OpenFOAM/fields/pointPatchFields/derived/global/globalPointPatchField.H +++ /dev/null @@ -1,166 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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::globalPointPatchField - -Description - Foam::globalPointPatchField - -SourceFiles - globalPointPatchField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef globalPointPatchField_H -#define globalPointPatchField_H - -#include "coupledPointPatchField.H" -#include "globalPointPatch.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class globalPointPatchField Declaration -\*---------------------------------------------------------------------------*/ - -template<class Type> -class globalPointPatchField -: - public coupledPointPatchField<Type> -{ - // Private data - - //- Local reference to processorPoint patch - const globalPointPatch& globalPointPatch_; - - -public: - - //- Runtime type information - TypeName("global"); - - - // Constructors - - //- Construct from patch and internal field - globalPointPatchField - ( - const pointPatch&, - const DimensionedField<Type, pointMesh>& - ); - - //- Construct from patch, internal field and dictionary - globalPointPatchField - ( - const pointPatch&, - const DimensionedField<Type, pointMesh>&, - const dictionary& - ); - - //- Construct by mapping given patchField<Type> onto a new patch - globalPointPatchField - ( - const globalPointPatchField<Type>&, - const pointPatch&, - const DimensionedField<Type, pointMesh>&, - const pointPatchFieldMapper& - ); - - //- Construct and return a clone - virtual autoPtr<pointPatchField<Type> > clone() const - { - return autoPtr<pointPatchField<Type> > - ( - new globalPointPatchField<Type> - ( - *this - ) - ); - } - - //- Construct as copy setting internal field reference - globalPointPatchField - ( - const globalPointPatchField<Type>&, - const DimensionedField<Type, pointMesh>& - ); - - //- Construct and return a clone setting internal field reference - virtual autoPtr<pointPatchField<Type> > clone - ( - const DimensionedField<Type, pointMesh>& iF - ) const - { - return autoPtr<pointPatchField<Type> > - ( - new globalPointPatchField - <Type> - ( - *this, - iF - ) - ); - } - - - // Destructor - - ~globalPointPatchField(); - - - // Member functions - - // Evaluation functions - - //- Evaluate the patch field - virtual void evaluate - ( - const Pstream::commsTypes commsType=Pstream::blocking - ) - {} - - //- Complete swap of patch point values and add to local values - virtual void swapAdd(Field<Type>&) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "globalPointPatchField.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.C index e697ccc20b44d9391f2d47528c4e27866481f6ee..684ea7e8a5569ad70377546280e97b670db8bf17 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.C @@ -124,7 +124,8 @@ template<class Type> template<class Type1> tmp<Field<Type1> > pointPatchField<Type>::patchInternalField ( - const Field<Type1>& iF + const Field<Type1>& iF, + const labelList& meshPoints ) const { // Check size @@ -141,9 +142,6 @@ tmp<Field<Type1> > pointPatchField<Type>::patchInternalField << abort(FatalError); } - // get addressing - const labelList& meshPoints = patch().meshPoints(); - tmp<Field<Type1> > tvalues(new Field<Type1>(meshPoints.size())); Field<Type1>& values = tvalues(); @@ -156,6 +154,17 @@ tmp<Field<Type1> > pointPatchField<Type>::patchInternalField } +template<class Type> +template<class Type1> +tmp<Field<Type1> > pointPatchField<Type>::patchInternalField +( + const Field<Type1>& iF +) const +{ + return patchInternalField(iF, patch().meshPoints()); +} + + template<class Type> template<class Type1> void pointPatchField<Type>::addToInternalField @@ -201,6 +210,53 @@ void pointPatchField<Type>::addToInternalField } +template<class Type> +template<class Type1> +void pointPatchField<Type>::addToInternalField +( + Field<Type1>& iF, + const Field<Type1>& pF, + const labelList& points +) const +{ + // Check size + if (iF.size() != internalField().size()) + { + FatalErrorIn + ( + "void pointPatchField<Type>::" + "addToInternalField(" + "Field<Type1>& iF, const Field<Type1>& iF, const labelList&) const" + ) << "given internal field does not correspond to the mesh. " + << "Field size: " << iF.size() + << " mesh size: " << internalField().size() + << abort(FatalError); + } + + if (pF.size() != size()) + { + FatalErrorIn + ( + "void pointPatchField<Type>::" + "addToInternalField(" + "Field<Type1>& iF, const Field<Type1>& iF, const labelList&) const" + ) << "given patch field does not correspond to the mesh. " + << "Field size: " << pF.size() + << " mesh size: " << size() + << abort(FatalError); + } + + // Get the addressing + const labelList& mp = patch().meshPoints(); + + forAll(points, i) + { + label pointI = points[i]; + iF[mp[pointI]] += pF[pointI]; + } +} + + template<class Type> template<class Type1> void pointPatchField<Type>::setInInternalField diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H index 79903dd217336ca3ccdf5cadcd9d5d5068d18d50..4cd206cf13b0697f09c3b952d7296ef59d89ffe5 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H @@ -291,6 +291,15 @@ public: const Field<Type1>& iF ) const; + //- Return field created from selected internal field values + // given internal field reference + template<class Type1> + tmp<Field<Type1> > patchInternalField + ( + const Field<Type1>& iF, + const labelList& meshPoints + ) const; + //- Given the internal field and a patch field, // add the patch field to the internal field template<class Type1> @@ -300,6 +309,16 @@ public: const Field<Type1>& pF ) const; + //- Given the internal field and a patch field, + // add selected elements of the patch field to the internal field + template<class Type1> + void addToInternalField + ( + Field<Type1>& iF, + const Field<Type1>& pF, + const labelList& points + ) const; + //- Given the internal field and a patch field, // set the patch field in the internal field template<class Type1> diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index f574fde3e6e2b20aa0394032b98525fa74c04278..0dba0f482928c30fc25f3f5aa282fa641ad6e54e 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.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 @@ -251,7 +251,7 @@ bool Foam::argList::regroupArgv(int& argc, char**& argv) // note: we also re-write directly into args_ // and use a second pass to sort out args/options - for (int argI = 0; argI < argc; argI++) + for (int argI = 0; argI < argc; ++argI) { if (strcmp(argv[argI], "(") == 0) { @@ -369,7 +369,7 @@ Foam::argList::argList { // Check if this run is a parallel run by searching for any parallel option // If found call runPar which might filter argv - for (int argI = 0; argI < argc; argI++) + for (int argI = 0; argI < argc; ++argI) { if (argv[argI][0] == '-') { @@ -395,7 +395,7 @@ Foam::argList::argList int nArgs = 1; string argListString = args_[0]; - for (int argI = 1; argI < args_.size(); argI++) + for (int argI = 1; argI < args_.size(); ++argI) { argListString += ' '; argListString += args_[argI]; @@ -751,12 +751,6 @@ Foam::argList::~argList() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::stringList::subList Foam::argList::additionalArgs() const -{ - return stringList::subList(args_, args_.size() - 1, 1); -} - - void Foam::argList::printUsage() const { Info<< "\nUsage: " << executable_ << " [OPTIONS]"; diff --git a/src/OpenFOAM/global/argList/argList.H b/src/OpenFOAM/global/argList/argList.H index da75c4d066295f2026e3fa79b7a7e582a762e8d0..a39b0f0c86f5cd3f7028294c4cc367421e0b36bf 100644 --- a/src/OpenFOAM/global/argList/argList.H +++ b/src/OpenFOAM/global/argList/argList.H @@ -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 @@ -193,7 +193,7 @@ public: // Access - //- Name of executable + //- Name of executable without the path inline const word& executable() const; //- Return root path @@ -211,9 +211,25 @@ public: //- Return arguments inline const stringList& args() const; - //- Return additional arguments, - // i.e. those additional to the executable itself - stringList::subList additionalArgs() const; + //- Return the argument corresponding to index. + inline const string& arg(const label index) const; + + //- Return the number of arguments + inline label size() const; + + //- Read a value from the argument at index. + // Index 0 corresponds to the name of the executable. + // Index 1 corresponds to the first argument. + template<class T> + inline T argRead(const label index) const; + + //- Return arguments that are additional to the executable + // @deprecated use operator[] directly (deprecated Feb 2010) + stringList::subList additionalArgs() const + { + return stringList::subList(args_, args_.size()-1, 1); + } + //- Return options inline const Foam::HashTable<string>& options() const; @@ -264,6 +280,14 @@ public: } + //- Return the argument corresponding to index. + // Index 0 corresponds to the name of the executable. + // Index 1 corresponds to the first argument. + inline const string& operator[](const label index) const; + + //- Return the argument string associated with the named option + // @sa option() + inline const string& operator[](const word& opt) const; // Edit diff --git a/src/OpenFOAM/global/argList/argListI.H b/src/OpenFOAM/global/argList/argListI.H index 6b9b462de0b0a77c7279018de84a27f304eacf18..7e8edcbd1f1504936ccc293cdefe4d403bc705ea 100644 --- a/src/OpenFOAM/global/argList/argListI.H +++ b/src/OpenFOAM/global/argList/argListI.H @@ -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 @@ -64,6 +64,18 @@ inline const Foam::stringList& Foam::argList::args() const } +inline const Foam::string& Foam::argList::arg(const label index) const +{ + return args_[index]; +} + + +inline Foam::label Foam::argList::size() const +{ + return args_.size(); +} + + inline const Foam::HashTable<Foam::string>& Foam::argList::options() const { return options_; @@ -72,7 +84,7 @@ inline const Foam::HashTable<Foam::string>& Foam::argList::options() const inline const Foam::string& Foam::argList::option(const word& opt) const { - return options_.operator[](opt); + return options_[opt]; } @@ -84,7 +96,7 @@ inline bool Foam::argList::optionFound(const word& opt) const inline Foam::IStringStream Foam::argList::optionLookup(const word& opt) const { - return IStringStream(option(opt)); + return IStringStream(options_[opt]); } @@ -92,12 +104,36 @@ inline Foam::IStringStream Foam::argList::optionLookup(const word& opt) const namespace Foam { + // Template specialization for string + template<> + inline Foam::string + Foam::argList::argRead<Foam::string>(const label index) const + { + return args_[index]; + } + + // Template specialization for word + template<> + inline Foam::word + Foam::argList::argRead<Foam::word>(const label index) const + { + return args_[index]; + } + + // Template specialization for fileName + template<> + inline Foam::fileName + Foam::argList::argRead<Foam::fileName>(const label index) const + { + return args_[index]; + } + // Template specialization for string template<> inline Foam::string Foam::argList::optionRead<Foam::string>(const word& opt) const { - return option(opt); + return options_[opt]; } // Template specialization for word @@ -105,7 +141,7 @@ namespace Foam inline Foam::word Foam::argList::optionRead<Foam::word>(const word& opt) const { - return option(opt); + return options_[opt]; } // Template specialization for fileName @@ -113,13 +149,23 @@ namespace Foam inline Foam::fileName Foam::argList::optionRead<Foam::fileName>(const word& opt) const { - return option(opt); + return options_[opt]; } } // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template<class T> +inline T Foam::argList::argRead(const label index) const +{ + T val; + + IStringStream(args_[index])() >> val; + return val; +} + + template<class T> inline T Foam::argList::optionRead(const word& opt) const { @@ -187,4 +233,18 @@ inline T Foam::argList::optionLookupOrDefault } +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +inline const Foam::string& Foam::argList::operator[](const label index) const +{ + return args_[index]; +} + + +inline const Foam::string& Foam::argList::operator[](const word& opt) const +{ + return options_[opt]; +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/global/argList/parRun.H b/src/OpenFOAM/global/argList/parRun.H index c1e5b544bc54001b640931781b24ee76b71d8f04..d2b926d8a4b911d9bab0ee7b77e3846288cec272 100644 --- a/src/OpenFOAM/global/argList/parRun.H +++ b/src/OpenFOAM/global/argList/parRun.H @@ -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 diff --git a/src/OpenFOAM/global/foamVersion.H b/src/OpenFOAM/global/foamVersion.H index f6f8a7c6dec87ec8282c5539b2c4501bbbe78fe9..50bf27591c0fcba4300efde51605a55552b3eb22 100644 --- a/src/OpenFOAM/global/foamVersion.H +++ b/src/OpenFOAM/global/foamVersion.H @@ -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 @@ -44,6 +44,40 @@ Description SourceFiles global.Cver + +@mainpage OpenFOAM®: open source CFD + +@section about About OpenFOAM + + OpenFOAM is a free, open source CFD software package produced by + a commercial company, + <a href="http://www.openfoam.com/about">OpenCFD Ltd</a>. + It has a + large user base across most areas of engineering and science, + from both commercial and academic organisations. OpenFOAM has an + extensive range of features to solve anything from complex fluid + flows involving chemical reactions, turbulence and heat transfer, + to solid dynamics and electromagnetics. + <a href="http://www.openfoam.com/features">More ...</a> + +@section users Our commitment to the users + + OpenFOAM comes with full commercial support from OpenCFD, including + <a href="http://www.openfoam.com/support/software.php">software support</a>, + <a href="http://www.openfoam.com/support/development.php">contracted developments</a> and + a programme of <a href="http://www.openfoam.com/training">training courses</a>. + These activities fund the development, maintenance and release of + OpenFOAM to make it an extremely viable commercial open source product. + +@section opensource Our commitment to open source + + OpenCFD is committed to open source software, continually developing and + maintaining OpenFOAM under the + <a href="http://www.gnu.org/copyleft/gpl.html">GNU General Public Licence</a>. + OpenFOAM will <strong>always</strong> be free of charge and open source. + In addition, we endeavour to support other viable open source initiatives + that will benefit science and engineering. + \*---------------------------------------------------------------------------*/ #ifndef foamVersion_H diff --git a/src/OpenFOAM/include/addOverwriteOption.H b/src/OpenFOAM/include/addOverwriteOption.H new file mode 100644 index 0000000000000000000000000000000000000000..c61548f06bbc894cc8dcfbf4a406e7a0042aa377 --- /dev/null +++ b/src/OpenFOAM/include/addOverwriteOption.H @@ -0,0 +1,10 @@ +// +// addOverwriteOption.H +// ~~~~~~~~~~~~~~~~~~~~ + + Foam::argList::addOption + ( + "overwrite", + "overwrite existing mesh/results files" + ); + diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduInterface.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduInterface.H index a7075d47e5e8fdc2392f6d684a53852bbd58bf82..6ff21e35ffcf58b53a3d5bd6d6b4003b8cab74af 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduInterface.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduInterface.H @@ -39,6 +39,7 @@ SourceFiles #include "labelField.H" #include "typeInfo.H" +#include "Pstream.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/lduInterfaceField/lduInterfaceField.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/lduInterfaceField/lduInterfaceField.H index 1a6c9a395da67e6447546c178e30af8895b781a3..08443546ba4a0649051313b16e8adcf424ff166f 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/lduInterfaceField/lduInterfaceField.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/lduInterfaceField/lduInterfaceField.H @@ -39,6 +39,7 @@ SourceFiles #include "lduInterface.H" #include "primitiveFieldsFwd.H" +#include "Pstream.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/BICCG/BICCG.H b/src/OpenFOAM/matrices/lduMatrix/solvers/BICCG/BICCG.H index e31b6108f784eba247a1a965119a3c870de79146..bf9b67a763bd7bfe23c3c459a99b27720fb25433 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/BICCG/BICCG.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/BICCG/BICCG.H @@ -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 @@ -32,7 +32,7 @@ Description Deprecated This solver is present for backward-compatibility and the PBiCG solver - should be used instead. + should be used instead. (deprecated Apr 2008) SourceFiles BICCG.C diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/ICCG/ICCG.H b/src/OpenFOAM/matrices/lduMatrix/solvers/ICCG/ICCG.H index ddf1a7a8f8ebba03dadbca372b568fe456f8517a..8ac919a31ea711c703667cfa5c10f600915db03e 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/ICCG/ICCG.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/ICCG/ICCG.H @@ -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 @@ -32,7 +32,7 @@ Description Deprecated This solver is present for backward-compatibility and the PCG solver - should be used for preference. + should be used for preference. (deprecated Apr 2008) SourceFiles ICCG.C diff --git a/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.C b/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.C index 36e6fe6afd0dec94487e2e37baa79080d2a0125b..cc81ee3fb961dc4b93bdfda13d174eb05d9c29eb 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.C +++ b/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.C @@ -27,7 +27,7 @@ License #include "pointBoundaryMesh.H" #include "polyBoundaryMesh.H" #include "facePointPatch.H" -#include "globalPointPatch.H" +#include "pointMesh.H" #include "PstreamBuffers.H" #include "lduSchedule.H" #include "globalMeshData.H" @@ -105,31 +105,6 @@ void Foam::pointBoundaryMesh::calcGeometry() } -const Foam::globalPointPatch& -Foam::pointBoundaryMesh::globalPatch() const -{ - const pointPatchList& patches = *this; - - forAll (patches, patchI) - { - if (isType<globalPointPatch>(patches[patchI])) - { - return refCast<const globalPointPatch>(patches[patchI]); - } - } - - FatalErrorIn - ( - "const pointBoundaryMesh::" - "globalPointPatch& globalPatch() const" - ) << "patch not found." - << abort(FatalError); - - // Dummy return - return refCast<const globalPointPatch>(patches[0]); -} - - void Foam::pointBoundaryMesh::movePoints(const pointField& p) { PstreamBuffers pBufs(Pstream::defaultCommsType); diff --git a/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.H b/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.H index 3a15a8b70bb499278f0101121bce440529aa2b47..e4948123da4cdb2a47dc912dc6b35e95179507c7 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.H +++ b/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.H @@ -46,7 +46,6 @@ namespace Foam // Forward declaration of classes class pointMesh; class polyBoundaryMesh; -class globalPointPatch; /*---------------------------------------------------------------------------*\ Class pointBoundaryMesh Declaration @@ -98,9 +97,6 @@ public: return mesh_; } - //- Return reference to globalPointPatch - const globalPointPatch& globalPatch() const; - //- Correct polyBoundaryMesh after moving points void movePoints(const pointField&); diff --git a/src/OpenFOAM/meshes/pointMesh/pointMesh.C b/src/OpenFOAM/meshes/pointMesh/pointMesh.C index 70d3f1f6f453b757dd147a73769e5b83534f9d7d..8376cb71c9c36f021547e8548b9854702cd1ab72 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointMesh.C +++ b/src/OpenFOAM/meshes/pointMesh/pointMesh.C @@ -26,7 +26,6 @@ License #include "pointMesh.H" #include "globalMeshData.H" -#include "globalPointPatch.H" #include "pointMeshMapper.H" #include "pointFields.H" #include "MapGeometricFields.H" @@ -56,36 +55,12 @@ void Foam::pointMesh::mapFields(const mapPolyMesh& mpm) // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::pointMesh::pointMesh -( - const polyMesh& pMesh, - bool alwaysConstructGlobalPatch -) +Foam::pointMesh::pointMesh(const polyMesh& pMesh) : MeshObject<polyMesh, pointMesh>(pMesh), GeoMesh<polyMesh>(pMesh), boundary_(*this, pMesh.boundaryMesh()) { - // Add the globalPointPatch if there are global points - if - ( - alwaysConstructGlobalPatch - || GeoMesh<polyMesh>::mesh_.globalData().nGlobalPoints() - ) - { - boundary_.setSize(boundary_.size() + 1); - - boundary_.set - ( - boundary_.size() - 1, - new globalPointPatch - ( - boundary_, - boundary_.size() - 1 - ) - ); - } - // Calculate the geometry for the patches (transformation tensors etc.) boundary_.calcGeometry(); } diff --git a/src/OpenFOAM/meshes/pointMesh/pointMesh.H b/src/OpenFOAM/meshes/pointMesh/pointMesh.H index a41f725c459022d507a616417b90642563ca84de..70fdc7ef0494d1428fc39724ddd356d81aee66d5 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointMesh.H +++ b/src/OpenFOAM/meshes/pointMesh/pointMesh.H @@ -79,11 +79,7 @@ public: // Constructors //- Construct from polyMesh - explicit pointMesh - ( - const polyMesh& pMesh, - bool alwaysConstructGlobalPatch = false - ); + explicit pointMesh(const polyMesh& pMesh); // Member Functions diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/generic/genericPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/generic/genericPointPatch.H index 3f63ca4857b4b4974bc5e8f865fd84dc015bda4a..9738454733a2d81326e2156675343bda9358fe3e 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/generic/genericPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/generic/genericPointPatch.H @@ -26,7 +26,8 @@ Class Foam::genericPointPatch Description - DirectMapped patch. + Substitute for unknown patches. Used for postprocessing when only + basic polyPatch info is needed. SourceFiles genericPointPatch.C diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.C b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.C index 4a888315322b49dfa60f672201cd6a7c18bba82c..e25244da12c60a6198f34273afc9fded56ca9708 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.C +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.C @@ -28,7 +28,6 @@ License #include "pointBoundaryMesh.H" #include "addToRunTimeSelectionTable.H" #include "pointMesh.H" -#include "globalPointPatch.H" #include "edgeList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -51,9 +50,7 @@ addToRunTimeSelectionTable // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // void Foam::cyclicPointPatch::initGeometry(PstreamBuffers&) -{ - transformPairs_.setSize(0); -} +{} void Foam::cyclicPointPatch::calcGeometry(PstreamBuffers&) @@ -61,94 +58,22 @@ void Foam::cyclicPointPatch::calcGeometry(PstreamBuffers&) const edgeList& cp = cyclicPolyPatch_.coupledPoints(); const labelList& mp = cyclicPolyPatch_.meshPoints(); - // If there are no global points create a 1->1 map - if (!boundaryMesh().mesh().globalData().nGlobalPoints()) + DynamicList<label> separated; + forAll(cp, i) { - nonGlobalPatchPoints_.setSize(mp.size()); - forAll(nonGlobalPatchPoints_, i) - { - nonGlobalPatchPoints_[i] = i; - } - - meshPoints_ = cyclicPolyPatch_.meshPoints(); - transformPairs_ = cp; + const edge& coupledSet = cp[i]; + + // Assume all points are separated. + separated.append(coupledSet[0]); + separated.append(coupledSet[1]); } - else + separatedPoints_.transfer(separated); + + if (debug) { - // Get reference to shared points - const labelList& sharedPoints = - boundaryMesh().globalPatch().meshPoints(); - - nonGlobalPatchPoints_.setSize(mp.size()); - meshPoints_.setSize(mp.size()); - - labelList pointMap(mp.size(), -1); - - label noFiltPoints = 0; - - forAll (mp, pointI) - { - label curP = mp[pointI]; - - bool found = false; - - forAll (sharedPoints, sharedI) - { - if (sharedPoints[sharedI] == curP) - { - found = true; - break; - } - } - - if (!found) - { - pointMap[pointI] = noFiltPoints; - nonGlobalPatchPoints_[noFiltPoints] = pointI; - meshPoints_[noFiltPoints] = curP; - noFiltPoints++; - } - } - - nonGlobalPatchPoints_.setSize(noFiltPoints); - meshPoints_.setSize(noFiltPoints); - - - transformPairs_.setSize(cp.size()); - - label noFiltPointPairs = 0; - - forAll(cp, i) - { - if (pointMap[cp[i][0]] != -1 && pointMap[cp[i][1]] != -1) - { - transformPairs_[noFiltPointPairs][0] = pointMap[cp[i][0]]; - transformPairs_[noFiltPointPairs][1] = pointMap[cp[i][1]]; - noFiltPointPairs++; - } - else if (pointMap[cp[i][0]] == -1 && pointMap[cp[i][1]] != -1) - { - FatalErrorIn - ( - "cyclicPointPatch::calcGeometry(PstreamBuffers&) const" - ) << "Point " << cp[i][0] << "of point-pair " << i - << " is a global point but the other point " - << cp[i][1] << " is not" - << exit(FatalError); - } - else if (pointMap[cp[i][0]] != -1 && pointMap[cp[i][1]] == -1) - { - FatalErrorIn - ( - "cyclicPointPatch::calcGeometry(PstreamBuffers&) const" - ) << "Point " << cp[i][1] << "of point-pair " << i - << " is a global point but the other point " - << cp[i][0] << " is not" - << exit(FatalError); - } - } - - transformPairs_.setSize(noFiltPointPairs); + Pout<< "cyclic:" << cyclicPolyPatch_.name() + << " separated:" << separatedPoints_.size() + << " out of points:" << mp.size() << endl; } } @@ -198,7 +123,13 @@ cyclicPointPatch::~cyclicPointPatch() const edgeList& cyclicPointPatch::transformPairs() const { - return transformPairs_; + return cyclicPolyPatch_.coupledPoints(); +} + + +const labelList& cyclicPointPatch::separatedPoints() const +{ + return separatedPoints_; } diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.H index 1d013f3421c085903b098436a8df0f4d96f5eb0d..28e7e0142faa97bb58248c4d9e8ff5199f53059e 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.H @@ -57,6 +57,8 @@ class cyclicPointPatch //- Local reference cast into the cyclic patch const cyclicPolyPatch& cyclicPolyPatch_; + //- List of local points that are not collocated + mutable labelList separatedPoints_; // Private Member Functions @@ -69,10 +71,6 @@ class cyclicPointPatch // Demand driven private data - //- The set of pairs of points that require transformation - // and/or mapping - edgeList transformPairs_; - //- Initialise the calculation of the patch geometry virtual void initGeometry(PstreamBuffers&); @@ -147,6 +145,9 @@ public: //- Return the set of pairs of points that require transformation // and/or mapping virtual const edgeList& transformPairs() const; + + //- List of separated coupled points + virtual const labelList& separatedPoints() const; }; diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.C b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.C index d3aae3ec877fe54fc7fb68a8548ec09ef894f32e..7f6c3f571fb03007653a0585bf682a78e57fc08c 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.C +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.C @@ -28,7 +28,6 @@ License #include "pointBoundaryMesh.H" #include "addToRunTimeSelectionTable.H" #include "pointMesh.H" -#include "globalPointPatch.H" #include "faceList.H" #include "primitiveFacePatch.H" #include "emptyPolyPatch.H" @@ -58,34 +57,22 @@ void Foam::processorPointPatch::initGeometry(PstreamBuffers& pBufs) // Depending on whether the patch is a master or a slave, get the primitive // patch points and filter away the points from the global patch. - if (isMaster()) - { - meshPoints_ = procPolyPatch_.meshPoints(); - } - else - { - // Slave side. Create the reversed patch and pick up its points - // so that the order is correct - const polyPatch& pp = patch(); + // Create the reversed patch and pick up its points + // so that the order is correct + const polyPatch& pp = patch(); - faceList masterFaces(pp.size()); - - forAll (pp, faceI) - { - masterFaces[faceI] = pp[faceI].reverseFace(); - } + faceList masterFaces(pp.size()); - meshPoints_ = primitiveFacePatch - ( - masterFaces, - pp.points() - ).meshPoints(); - } - - if (Pstream::parRun()) + forAll (pp, faceI) { - initPatchPatchPoints(pBufs); + masterFaces[faceI] = pp[faceI].reverseFace(); } + + reverseMeshPoints_ = primitiveFacePatch + ( + masterFaces, + pp.points() + ).meshPoints(); } @@ -93,261 +80,46 @@ void Foam::processorPointPatch::calcGeometry(PstreamBuffers& pBufs) { if (Pstream::parRun()) { - calcPatchPatchPoints(pBufs); - } + const boolList& collocated = procPolyPatch_.collocated(); - // If it is not runing parallel or there are no global points - // create a 1->1 map - if - ( - !Pstream::parRun() - || !boundaryMesh().mesh().globalData().nGlobalPoints() - ) - { - nonGlobalPatchPoints_.setSize(meshPoints_.size()); - forAll(nonGlobalPatchPoints_, i) + if (collocated.size() == 0) { - nonGlobalPatchPoints_[i] = i; + separatedPoints_.setSize(0); } - } - else - { - // Get reference to shared points - const labelList& sharedPoints = - boundaryMesh().globalPatch().meshPoints(); - - nonGlobalPatchPoints_.setSize(meshPoints_.size()); - - label noFiltPoints = 0; - - forAll (meshPoints_, pointI) + else if (collocated.size() == 1) { - label curP = meshPoints_[pointI]; - - bool found = false; - - forAll (sharedPoints, sharedI) + // Uniformly + if (collocated[0]) { - if (sharedPoints[sharedI] == curP) - { - found = true; - break; - } + separatedPoints_.setSize(0); } - - if (!found) + else { - nonGlobalPatchPoints_[noFiltPoints] = pointI; - meshPoints_[noFiltPoints] = curP; - noFiltPoints++; + separatedPoints_ = identity(size()); } } - - nonGlobalPatchPoints_.setSize(noFiltPoints); - meshPoints_.setSize(noFiltPoints); - } -} - - -void processorPointPatch::initPatchPatchPoints(PstreamBuffers& pBufs) -{ - if (debug) - { - Info<< "processorPointPatch::initPatchPatchPoints(PstreamBuffers&) : " - << "constructing patch-patch points" - << endl; - } - - const polyBoundaryMesh& bm = boundaryMesh().mesh()().boundaryMesh(); - - // Get the mesh points for this patch corresponding to the faces - const labelList& ppmp = meshPoints(); - - // Create a HashSet of the point labels for this patch - Map<label> patchPointSet(2*ppmp.size()); - - forAll (ppmp, ppi) - { - patchPointSet.insert(ppmp[ppi], ppi); - } - - - // Create the lists of patch-patch points - labelListList patchPatchPoints(bm.size()); - - // Create the lists of patch-patch point normals - List<List<vector> > patchPatchPointNormals(bm.size()); - - // Loop over all patches looking for other patches that share points - forAll(bm, patchi) - { - if - ( - patchi != index() // Ignore self-self - && !isA<emptyPolyPatch>(bm[patchi]) // Ignore empty - && !bm[patchi].coupled() // Ignore other couples - ) + else { - // Get the meshPoints for the other patch - const labelList& meshPoints = bm[patchi].meshPoints(); + // Per face collocated or not. + const labelListList& pointFaces = procPolyPatch_.pointFaces(); - // Get the normals for the other patch - const vectorField& normals = bm[patchi].pointNormals(); - - label pppi = 0; - forAll(meshPoints, pointi) + DynamicList<label> separated; + forAll(pointFaces, pfi) { - label ppp = meshPoints[pointi]; - - // Check to see if the point of the other patch is shared with - // this patch - Map<label>::iterator iter = patchPointSet.find(ppp); - - if (iter != patchPointSet.end()) + if (!collocated[pointFaces[pfi][0]]) { - // If it is shared initialise the patchPatchPoints for this - // patch - if (!patchPatchPoints[patchi].size()) - { - patchPatchPoints[patchi].setSize(ppmp.size()); - patchPatchPointNormals[patchi].setSize(ppmp.size()); - } - - // and add the entry - patchPatchPoints[patchi][pppi] = iter(); - patchPatchPointNormals[patchi][pppi] = normals[pointi]; - pppi++; + separated.append(pfi); } } - - // Resise the list of shared points and normals for the patch - // being considerd - patchPatchPoints[patchi].setSize(pppi); - patchPatchPointNormals[patchi].setSize(pppi); + separatedPoints_.transfer(separated); } } - // Send the patchPatchPoints to the neighbouring processor - - UOPstream toNeighbProc(neighbProcNo(), pBufs); - - toNeighbProc - << ppmp.size() // number of points for checking - << patchPatchPoints - << patchPatchPointNormals; - if (debug) { - Info<< "processorPointPatch::initPatchPatchPoints() : " - << "constructed patch-patch points" - << endl; - } -} - - -void Foam::processorPointPatch::calcPatchPatchPoints(PstreamBuffers& pBufs) -{ - // Get the patchPatchPoints from the neighbouring processor - UIPstream fromNeighbProc(neighbProcNo(), pBufs); - - label nbrNPoints(readLabel(fromNeighbProc)); - labelListList patchPatchPoints(fromNeighbProc); - List<List<vector> > patchPatchPointNormals(fromNeighbProc); - - pointBoundaryMesh& pbm = const_cast<pointBoundaryMesh&>(boundaryMesh()); - const labelList& ppmp = meshPoints(); - - // Simple check for the very rare situation when not the same number - // of points on both sides. This can happen with decomposed cyclics. - // If on one side the cyclic shares a point with proc faces coming from - // internal faces it will have a different number of points from - // the situation where the cyclic and the 'normal' proc faces are fully - // separate. - if (nbrNPoints != ppmp.size()) - { - WarningIn("processorPointPatch::calcPatchPatchPoints(PstreamBuffers&)") - << "Processor patch " << name() - << " has " << ppmp.size() << " points; coupled patch has " - << nbrNPoints << " points." << endl - << " (usually due to decomposed cyclics)." - << " This might give problems" << endl - << " when using point fields (interpolation, mesh motion)." - << endl; - } - - - - // Loop over the patches looking for other patches that share points - forAll(patchPatchPoints, patchi) - { - const labelList& patchPoints = patchPatchPoints[patchi]; - const List<vector>& patchPointNormals = patchPatchPointNormals[patchi]; - - // If there are potentially shared points for the patch being considered - if (patchPoints.size()) - { - // Get the current meshPoints list for the patch - facePointPatch& fpp = refCast<facePointPatch>(pbm[patchi]); - const labelList& fmp = fpp.meshPoints(); - labelList& mp = fpp.meshPoints_; - - const vectorField& fnormals = fpp.pointNormals(); - vectorField& normals = fpp.pointNormals_; - - // Create a HashSet of the point labels for the patch - Map<label> patchPointSet(2*fmp.size()); - - forAll (fmp, ppi) - { - patchPointSet.insert(fmp[ppi], ppi); - } - - label nPoints = mp.size(); - label lpi = 0; - bool resized = false; - - // For each potentially shared point... - forAll(patchPoints, ppi) - { - // Check if it is not already in the patch, - // i.e. not part of a face of the patch - if (!patchPointSet.found(ppmp[patchPoints[ppi]])) - { - // If it isn't already in the patch check if the local - // meshPoints is already set and if not initialise the - // meshPoints_ and pointNormals_ - if (!resized) - { - if (!mp.size() && fmp.size()) - { - mp = fmp; - normals = fnormals; - - nPoints = mp.size(); - } - - mp.setSize(nPoints + patchPoints.size()); - loneMeshPoints_.setSize(patchPoints.size()); - normals.setSize(nPoints + patchPoints.size()); - resized = true; - } - - // Add the new point to the patch - mp[nPoints] = ppmp[patchPoints[ppi]]; - loneMeshPoints_[lpi++] = ppmp[patchPoints[ppi]]; - normals[nPoints++] = patchPointNormals[ppi]; - } - } - - // If the lists have been resized points have been added. - // Shrink the lists to the current size. - if (resized) - { - mp.setSize(nPoints); - loneMeshPoints_.setSize(lpi); - normals.setSize(nPoints); - } - } + Pout<< "processor:" << name() + << " separated:" << separatedPoints_.size() + << " out of points:" << size() << endl; } } @@ -393,6 +165,20 @@ processorPointPatch::~processorPointPatch() {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +const labelList& processorPointPatch::reverseMeshPoints() const +{ + return reverseMeshPoints_; +} + + +const labelList& processorPointPatch::separatedPoints() const +{ + return separatedPoints_; +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H index df7b8d96a3ec48964c0860f1aaa35cb2616fae70..642522890c956321efa00462bff10777f8f95e4a 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H @@ -64,6 +64,9 @@ class processorPointPatch const processorPolyPatch& procPolyPatch_; + mutable labelList reverseMeshPoints_; + + mutable labelList separatedPoints_; // Private Member Functions @@ -73,14 +76,6 @@ class processorPointPatch //- Calculate the patch geometry virtual void calcGeometry(PstreamBuffers&); - //- Initialise the points on this patch which are should also be - // on a neighbouring patch but are not part of faces of that patch - void initPatchPatchPoints(PstreamBuffers&); - - //- Calculate the points on this patch which are should also be - // on a neighbouring patch but are not part of faces of that patch - void calcPatchPatchPoints(PstreamBuffers&); - //- Initialise the patches for moving points virtual void initMovePoints(PstreamBuffers&, const pointField&); @@ -165,6 +160,13 @@ public: { return procPolyPatch_; } + + //- Return mesh points in the correct order for the receiving side + const labelList& reverseMeshPoints() const; + + //- List of separated coupled points + virtual const labelList& separatedPoints() const; + }; diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.C b/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.C index f3b2fb1454400085c412af876f4139493bad6589..c8b33c58374371e08c671eaee3fb07695f3aa584 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.C +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.C @@ -57,25 +57,6 @@ coupledFacePointPatch::~coupledFacePointPatch() {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -const labelList& coupledFacePointPatch::nonGlobalPatchPoints() const -{ - return nonGlobalPatchPoints_; -} - -const labelList& coupledFacePointPatch::loneMeshPoints() const -{ - return loneMeshPoints_; -} - -const vectorField& coupledFacePointPatch::pointNormals() const -{ - notImplemented("coupledFacePointPatch::pointNormals() const"); - return Field<vector>::null(); -} - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.H index ec5ae840e4f8a01f0bb377a0c79838ce90717e4e..5b37f6a3adaff46b270ef01eb46ba9c3b74cb16b 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.H @@ -73,16 +73,6 @@ class coupledFacePointPatch protected: - // Demand driven private data - - //- The set of labels of the pointPatch points which are - // non-global, i.e. present only in this coupledPointPatch. - // MUST be initialised by calcGeometry()! - labelList nonGlobalPatchPoints_; - - labelList loneMeshPoints_; - - // Construction of demand-driven data //- Calculate mesh points @@ -120,20 +110,8 @@ public: return true; } - - // Access functions for demand driven data - - //- Return the set of labels of the pointPatch points which are - // non-global, i.e. present in this coupledFacePointPatch - virtual const labelList& nonGlobalPatchPoints() const; - - //- Return the set of labels of the pointPatch points which are - // lone, i.e. present in this coupledFacePointPatch but not - // associated with any faces - virtual const labelList& loneMeshPoints() const; - - //- Return point unit normals. Not implemented. - virtual const vectorField& pointNormals() const; + //- List of separated coupled points + virtual const labelList& separatedPoints() const = 0; }; diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/global/globalPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/global/globalPointPatch.H deleted file mode 100644 index ba89ca950cb2f3ce3b0eb6cc7e96e0cf3cb59af9..0000000000000000000000000000000000000000 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/global/globalPointPatch.H +++ /dev/null @@ -1,209 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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::globalPointPatch - -Description - Foam::globalPointPatch - -SourceFiles - globalPointPatch.C - -\*---------------------------------------------------------------------------*/ - -#ifndef globalPointPatch_H -#define globalPointPatch_H - -#include "pointPatch.H" -#include "coupledPointPatch.H" -#include "globalMeshData.H" -#include "pointMesh.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class globalPointPatch Declaration -\*---------------------------------------------------------------------------*/ - -class globalPointPatch -: - public pointPatch, - public coupledPointPatch -{ - // Private data - - // //- Reference to the basic globalMeshData - // const globalMeshData& globalMeshData_; - - //- Index in the boundary mesh - label index_; - - - // Protected Member Functions - - //- Initialise the calculation of the patch geometry - virtual void initGeometry(PstreamBuffers&) - {} - - //- Calculate the patch geometry - virtual void calcGeometry(PstreamBuffers&) - {} - - //- Initialise the patches for moving points - virtual void initMovePoints(PstreamBuffers&, const pointField&) - {} - - //- Correct patches after moving points - virtual void movePoints(PstreamBuffers&, const pointField&) - {} - - //- Initialise the update of the patch topology - virtual void initUpdateMesh(PstreamBuffers&) - {} - - //- Update of the patch topology - virtual void updateMesh(PstreamBuffers&) - {} - - - // Private Member Functions - - //- Disallow default construct as copy - globalPointPatch - ( - const globalPointPatch& - ); - - //- Disallow default assignment - void operator=(const globalPointPatch&); - - -public: - - //- Runtime type information - TypeName("global"); - - // Constructors - - //- Construct from components - globalPointPatch - ( - const pointBoundaryMesh&, - const label index - ); - - - // Destructor - - virtual ~globalPointPatch(); - - - // Member functions - - //- Return name - virtual const word& name() const - { - // There can only be a single patch of this type - therefore - // its name is hard-coded. - return type(); - } - - //- Return size - virtual label size() const - { - return meshPoints().size(); - } - - //- Return true if running parallel - virtual bool coupled() const - { - if (Pstream::parRun()) - { - return true; - } - else - { - return false; - } - } - - //- Return number of faces - virtual label nFaces() const - { - return 0; - } - - //- Return the index of this patch in the pointBoundaryMesh - virtual label index() const - { - return index_; - } - - //- Return mesh points - virtual const labelList& meshPoints() const - { - return boundaryMesh().mesh().globalData().sharedPointLabels(); - } - - //- Return local points. Not implemented - virtual const pointField& localPoints() const - { - notImplemented("globalPointPatch::localPoints() const"); - return pointField::null(); - } - - //- Return point normals. Not implemented - virtual const vectorField& pointNormals() const - { - notImplemented("globalPointPatch::pointNormals() const"); - return vectorField::null(); - } - - //- Return total number of shared points - virtual label globalPointSize() const - { - return boundaryMesh().mesh().globalData().nGlobalPoints(); - } - - //- Return addressing into the global points list - const labelList& sharedPointAddr() const - { - return boundaryMesh().mesh().globalData().sharedPointAddr(); - } -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.C b/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.C index fb15ac4b96733f71451bfff030f53bfc710425f7..8e139675ef84020b1393495f772d83c73dcaf041 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.C +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.C @@ -52,11 +52,7 @@ addToRunTimeSelectionTable // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // void facePointPatch::initGeometry(PstreamBuffers&) -{ - meshPoints_.setSize(0); - localPoints_.setSize(0); - pointNormals_.setSize(0); -} +{} void facePointPatch::calcGeometry(PstreamBuffers&) @@ -94,60 +90,6 @@ facePointPatch::facePointPatch {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -const labelList& facePointPatch::meshPoints() const -{ - if (meshPoints_.size()) - { - return meshPoints_; - } - else - { - return polyPatch_.meshPoints(); - } -} - - -const pointField& facePointPatch::localPoints() const -{ - if (meshPoints_.size()) - { - if (localPoints_.size() != meshPoints_.size()) - { - const labelList& meshPts = meshPoints(); - - localPoints_.setSize(meshPts.size()); - const pointField& points = polyPatch_.points(); - - forAll (meshPts, pointi) - { - localPoints_[pointi] = points[meshPts[pointi]]; - } - } - - return localPoints_; - } - else - { - return polyPatch_.localPoints(); - } -} - - -const vectorField& facePointPatch::pointNormals() const -{ - if (pointNormals_.size()) - { - return pointNormals_; - } - else - { - return polyPatch_.pointNormals(); - } -} - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.H index 0094d4ce1a0030f71beb7d1ee96a31b0edc5427f..27e74682e585b532597325214e9cd4c174842f12 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.H @@ -30,7 +30,6 @@ Description SourceFiles facePointPatch.C - facePointPatchM.C newPointPatch.C \*---------------------------------------------------------------------------*/ @@ -65,13 +64,6 @@ protected: //- Reference to the underlying polyPatch const polyPatch& polyPatch_; - // Optional data used if the pointPatch has points not associated - // with faces, i.e. not accessible via polyPatch - - mutable labelList meshPoints_; - mutable pointField localPoints_; - mutable vectorField pointNormals_; - // Protected Member Functions @@ -182,13 +174,24 @@ public: } //- Return mesh points - virtual const labelList& meshPoints() const; + virtual const labelList& meshPoints() const + { + return polyPatch_.meshPoints(); + } + //- Return pointField of points in patch - virtual const pointField& localPoints() const; + virtual const pointField& localPoints() const + { + return polyPatch_.localPoints(); + } + //- Return point unit normals - virtual const vectorField& pointNormals() const; + virtual const vectorField& pointNormals() const + { + return polyPatch_.pointNormals(); + } }; diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C index c3650ccb5a19c516d4fda6c9021c8b661b12704c..6f9f311d119dd65e9b775beb8e790c18b6ddaa83 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C @@ -1705,7 +1705,7 @@ Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints const labelList& meshPoints, const Map<label>& meshPointMap, labelList& pointToGlobal, - labelList& uniquePoints + labelList& uniqueMeshPoints ) const { const indirectPrimitivePatch& cpp = coupledPatch(); @@ -1713,125 +1713,175 @@ Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints const mapDistribute& pointSlavesMap = globalPointSlavesMap(); - // 1. Count number of masters on my processor. - label nCoupledMaster = 0; - label nCoupledSlave = 0; - PackedBoolList isMaster(meshPoints.size(), 1); + // The patch points come in two variants: + // - not on a coupled patch so guaranteed unique + // - on a coupled patch + // If the point is on a coupled patch the problem is that the + // master-slave structure (globalPointSlaves etc.) assigns one of the + // coupled points to be the master but this master point is not + // necessarily on the patch itself! (it might just be connected to the + // patch point via coupled patches). + // So this means that all master point loops should be over the + // master-slave structure, not over the patch points and that the unique + // point returned is a mesh point. + // (unless we want to do the whole master-slave analysis again for the + // current patch only). + - forAll(meshPoints, localPointI) + // Determine mapping from coupled point to patch point and vice versa + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + labelList patchToCoupled(meshPoints.size(), -1); + label nCoupled = 0; + labelList coupledToPatch(pointSlavesMap.constructSize(), -1); + + // Note: loop over patch since usually smaller + forAll(meshPoints, patchPointI) { - label meshPointI = meshPoints[localPointI]; + label meshPointI = meshPoints[patchPointI]; Map<label>::const_iterator iter = cpp.meshPointMap().find(meshPointI); if (iter != cpp.meshPointMap().end()) { - // My localPointI is a coupled point. + patchToCoupled[patchPointI] = iter(); + coupledToPatch[iter()] = patchPointI; + nCoupled++; + } + } - label coupledPointI = iter(); + //Pout<< "Patch:" << nl + // << " points:" << meshPoints.size() << nl + // << " of which on coupled patch:" << nCoupled << endl; - if (pointSlaves[coupledPointI].size() > 0) + + // Pull coupled-to-patch information to master + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + pointSlavesMap.distribute(coupledToPatch); + + + // Check on master whether point is anywhere on patch + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + // List of master points that are on the patch + DynamicList<label> masterPoints(pointSlaves.size()); + + forAll(pointSlaves, coupledPointI) + { + const labelList& slaves = pointSlaves[coupledPointI]; + + if (slaves.size() > 0) + { + // I am master. Is this point on the patch on myself or on any + // any slave? + if (coupledToPatch[coupledPointI] != -1) { - nCoupledMaster++; + masterPoints.append(coupledPointI); } else { - isMaster[localPointI] = 0; - nCoupledSlave++; + forAll(slaves, i) + { + if (coupledToPatch[slaves[i]] != -1) + { + masterPoints.append(coupledPointI); + break; + } + } } } } - label myUniquePoints = meshPoints.size() - nCoupledSlave; - Pout<< "Points :" << nl - << " patch : " << meshPoints.size() << nl - << " of which coupled : " << nCoupledMaster+nCoupledSlave << nl - << " of which master : " << nCoupledMaster << nl - << " of which slave : " << nCoupledSlave << nl - << endl; + // Create global indexing + // ~~~~~~~~~~~~~~~~~~~~~~ + // 1. patch points that are not on coupled patch: + // meshPoints.size()-nCoupled + // 2. master points that are on patch: + // masterPoints.size() + label myUniquePoints = meshPoints.size()-nCoupled+masterPoints.size(); + autoPtr<globalIndex> globalPointsPtr(new globalIndex(myUniquePoints)); + //Pout<< "CoupledPatch:" << nl + // << " points:" << cpp.nPoints() << nl + // << " of which on patch:" << masterPoints.size() << endl; - // 2. Create global indexing for unique points. - autoPtr<globalIndex> globalPointsPtr(new globalIndex(myUniquePoints)); + // Allocate unique points + // ~~~~~~~~~~~~~~~~~~~~~~ - // 3. Assign global point numbers. Keep slaves unset. pointToGlobal.setSize(meshPoints.size()); pointToGlobal = -1; - uniquePoints.setSize(myUniquePoints); - label nMaster = 0; + uniqueMeshPoints.setSize(myUniquePoints); - forAll(isMaster, localPointI) + // Allocate globals for uncoupled patch points + label nMaster = 0; + forAll(patchToCoupled, patchPointI) { - if (isMaster[localPointI]) + if (patchToCoupled[patchPointI] == -1) { - pointToGlobal[localPointI] = globalPointsPtr().toGlobal(nMaster); - uniquePoints[nMaster] = localPointI; + // Allocate global point + label globalI = globalPointsPtr().toGlobal(nMaster); + pointToGlobal[patchPointI] = globalI; + uniqueMeshPoints[nMaster] = meshPoints[patchPointI]; nMaster++; } } + // Allocate globals for master + labelList masterToGlobal(pointSlavesMap.constructSize(), -456); - // 4. Push global index for coupled points to slaves. + forAll(masterPoints, i) { - labelList masterToGlobal(pointSlavesMap.constructSize(), -1); + label coupledPointI = masterPoints[i]; - forAll(meshPoints, localPointI) + // Allocate global point + label globalI = globalPointsPtr().toGlobal(nMaster); + if (coupledToPatch[coupledPointI] != -1) { - label meshPointI = meshPoints[localPointI]; + pointToGlobal[coupledToPatch[coupledPointI]] = globalI; + } + uniqueMeshPoints[nMaster] = cpp.meshPoints()[coupledPointI]; + nMaster++; - Map<label>::const_iterator iter = cpp.meshPointMap().find - ( - meshPointI - ); + // Put global into slave slots + const labelList& slaves = pointSlaves[coupledPointI]; + masterToGlobal[coupledPointI] = globalI; // not really necessary + forAll(slaves, i) + { + masterToGlobal[slaves[i]] = globalI; + } + } - if (iter != cpp.meshPointMap().end()) - { - // My localPointI is a coupled point. - label coupledPointI = iter(); - const labelList& slaves = pointSlaves[coupledPointI]; + if (nMaster != myUniquePoints) + { + FatalErrorIn("globalMeshData::mergePoints(..)") + << "problem." << abort(FatalError); + } - if (slaves.size() > 0) - { - // Duplicate master globalpoint into slave slots - masterToGlobal[coupledPointI] = pointToGlobal[localPointI]; - forAll(slaves, i) - { - masterToGlobal[slaves[i]] = pointToGlobal[localPointI]; - } - } - } - } - // Send back - pointSlavesMap.reverseDistribute(cpp.nPoints(), masterToGlobal); + // Send back (from slave slots) to originating processor + pointSlavesMap.reverseDistribute(cpp.nPoints(), masterToGlobal); - // On slave copy master index into overal map. - forAll(meshPoints, localPointI) - { - label meshPointI = meshPoints[localPointI]; + // On slaves take over global number + forAll(patchToCoupled, patchPointI) + { + label coupledPointI = patchToCoupled[patchPointI]; - Map<label>::const_iterator iter = cpp.meshPointMap().find - ( - meshPointI - ); + if (coupledPointI != -1) + { + const labelList& slaves = pointSlaves[coupledPointI]; - if (iter != cpp.meshPointMap().end()) + if (slaves.size() == 0) { - // My localPointI is a coupled point. - label coupledPointI = iter(); - const labelList& slaves = pointSlaves[coupledPointI]; - - if (slaves.size() == 0) - { - pointToGlobal[localPointI] = masterToGlobal[coupledPointI]; - } + pointToGlobal[patchPointI] = masterToGlobal[coupledPointI]; } } } + return globalPointsPtr; } diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.H b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.H index f397d69ae146ca3946051bb36dc9cb9fbcb4f92e..77f6159768001d58b962301713bb31ea568e4c05 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.H +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.H @@ -319,6 +319,17 @@ class globalMeshData void calcGlobalEdgeAllSlaves() const; + //- Synchronise pointwise data + template<class Type, class CombineOp> + void syncPointData + ( + List<Type>& pointData, + const labelListList& slaves, + const mapDistribute& slavesMap, + const CombineOp& cop + ) const; + + //- Disallow default bitwise copy construct globalMeshData(const globalMeshData&); @@ -505,6 +516,13 @@ public: // distributed by below map. const labelListList& globalPointSlaves() const; const mapDistribute& globalPointSlavesMap() const; + //- Helper to synchronise mesh data + template<class Type, class CombineOp> + void syncPointData + ( + List<Type>& pointData, + const CombineOp& cop + ) const; // Coupled edge to coupled edges. @@ -539,6 +557,13 @@ public: const globalIndex& globalPointAllNumbering()const; const labelListList& globalPointAllSlaves() const; const mapDistribute& globalPointAllSlavesMap() const; + //- Helper to synchronise mesh data + template<class Type, class CombineOp> + void syncPointAllData + ( + List<Type>& pointData, + const CombineOp& cop + ) const; // Coupled edge to all coupled edges (same numbering as // collocated) @@ -560,13 +585,17 @@ public: ) const; //- Helper for merging patch point data. Takes maps from - // local points to/from mesh + // local points to/from mesh. Determines + // - my unique points. These are mesh points, not patch points + // since the master might not be on the patch. + // - global numbering over all unique indices. + // - the global number for all local points. autoPtr<globalIndex> mergePoints ( const labelList& meshPoints, const Map<label>& meshPointMap, labelList& pointToGlobal, - labelList& uniquePoints + labelList& uniqueMeshPoints ) const; @@ -596,6 +625,13 @@ public: } // End namespace Foam +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "globalMeshDataTemplates.C" +#endif + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshDataTemplates.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshDataTemplates.C new file mode 100644 index 0000000000000000000000000000000000000000..5e6415941eea6e67c08d83d7e904d39eab1d6941 --- /dev/null +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshDataTemplates.C @@ -0,0 +1,128 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "globalMeshData.H" +#include "polyMesh.H" +#include "mapDistribute.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Type, class CombineOp> +void Foam::globalMeshData::syncPointData +( + List<Type>& pointData, + const labelListList& slaves, + const mapDistribute& slavesMap, + const CombineOp& cop +) const +{ + if (pointData.size() != mesh_.nPoints()) + { + FatalErrorIn("globalMeshData::syncPointData(..)") + << "Number of elements in data:" << pointData.size() + << " differs from number of points in mesh:" << mesh_.nPoints() + << abort(FatalError); + } + + const indirectPrimitivePatch& cpp = coupledPatch(); + const labelList& meshPoints = cpp.meshPoints(); + + // Copy mesh (point)data to coupled patch (point)data + Field<Type> cppFld(slavesMap.constructSize()); + forAll(meshPoints, patchPointI) + { + cppFld[patchPointI] = pointData[meshPoints[patchPointI]]; + } + + // Pull slave data onto master + slavesMap.distribute(cppFld); + + // Combine master data with slave data + forAll(slaves, patchPointI) + { + const labelList& slavePoints = slaves[patchPointI]; + + // Combine master with slave data + forAll(slavePoints, i) + { + cop(cppFld[patchPointI], cppFld[slavePoints[i]]); + } + // Copy result back to slave slots + forAll(slavePoints, i) + { + cppFld[slavePoints[i]] = cppFld[patchPointI]; + } + } + + // Push master data back to slaves + slavesMap.reverseDistribute(meshPoints.size(), cppFld); + + // Update mesh (point)data from coupled patch (point)data + forAll(meshPoints, patchPointI) + { + pointData[meshPoints[patchPointI]] = cppFld[patchPointI]; + } +} + + +template<class Type, class CombineOp> +void Foam::globalMeshData::syncPointData +( + List<Type>& pointData, + const CombineOp& cop +) const +{ + const labelListList& slaves = globalPointSlaves(); + const mapDistribute& map = globalPointSlavesMap(); + + syncPointData + ( + pointData, + slaves, + map, + cop + ); +} + + +template<class Type, class CombineOp> +void Foam::globalMeshData::syncPointAllData +( + List<Type>& pointData, + const CombineOp& cop +) const +{ + syncPointData + ( + pointData, + globalPointAllSlaves(), + globalPointAllSlavesMap(), + cop + ); +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C index f62527b2722c71f58e586aebab7f83f4652107cf..2bb331fee8a6d9abd4783c73a5897669ac22d0cc 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C @@ -35,141 +35,50 @@ defineTypeNameAndDebug(Foam::globalPoints, 0); const Foam::label Foam::globalPoints::fromCollocated = labelMax/2; -const Foam::scalar Foam::globalPoints::mergeDist = ROOTVSMALL; - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // Routines to handle global indices // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -bool Foam::globalPoints::noTransform(const tensor& tt, const scalar mergeDist) -{ - return - (mag(tt.xx()-1) < mergeDist) - && (mag(tt.yy()-1) < mergeDist) - && (mag(tt.zz()-1) < mergeDist) - && (mag(tt.xy()) < mergeDist) - && (mag(tt.xz()) < mergeDist) - && (mag(tt.yx()) < mergeDist) - && (mag(tt.yz()) < mergeDist) - && (mag(tt.zx()) < mergeDist) - && (mag(tt.zy()) < mergeDist); -} - - -// Calculates per face whether couple is collocated. -Foam::PackedBoolList Foam::globalPoints::collocatedFaces +Foam::PackedBoolList Foam::globalPoints::collocatedPoints ( - const coupledPolyPatch& pp, - const scalar mergeDist + const coupledPolyPatch& pp ) { // Initialise to false - PackedBoolList collocated(pp.size()); + PackedBoolList isCollocated(pp.nPoints()); - const vectorField& separation = pp.separation(); - const tensorField& forwardT = pp.forwardT(); + const boolList& collocated = pp.collocated(); - if (forwardT.size() == 0) - { - // Parallel. - if (separation.size() == 0) - { - collocated = 1u; - } - else if (separation.size() == 1) - { - // Fully separate. Do not synchronise. - } - else - { - // Per face separation. - forAll(pp, faceI) - { - if (mag(separation[faceI]) < mergeDist) - { - collocated[faceI] = 1u; - } - } - } - } - else if (forwardT.size() == 1) + if (collocated.size() == 0) { - // Fully transformed. - } - else - { - // Per face transformation. - forAll(pp, faceI) - { - if (noTransform(forwardT[faceI], mergeDist)) - { - collocated[faceI] = 1u; - } - } + isCollocated = 1; } - return collocated; -} - - -Foam::PackedBoolList Foam::globalPoints::collocatedPoints -( - const coupledPolyPatch& pp, - const scalar mergeDist -) -{ - // Initialise to false - PackedBoolList collocated(pp.nPoints()); - - const vectorField& separation = pp.separation(); - const tensorField& forwardT = pp.forwardT(); - - if (forwardT.size() == 0) + else if (collocated.size() == 1) { - // Parallel. - if (separation.size() == 0) - { - collocated = 1u; - } - else if (separation.size() == 1) + // Uniform. + if (collocated[0]) { - // Fully separate. + isCollocated = 1; } - else - { - // Per face separation. - for (label pointI = 0; pointI < pp.nPoints(); pointI++) - { - label faceI = pp.pointFaces()[pointI][0]; - - if (mag(separation[faceI]) < mergeDist) - { - collocated[pointI] = 1u; - } - } - } - } - else if (forwardT.size() == 1) - { - // Fully transformed. } else { - // Per face transformation. - for (label pointI = 0; pointI < pp.nPoints(); pointI++) - { - label faceI = pp.pointFaces()[pointI][0]; + // Per face collocated or not. + const labelListList& pointFaces = pp.pointFaces(); - if (noTransform(forwardT[faceI], mergeDist)) + forAll(pointFaces, pfi) + { + if (collocated[pointFaces[pfi][0]]) { - collocated[pointI] = 1u; + isCollocated[pfi] = 1; } } } - return collocated; + return isCollocated; } - + Foam::label Foam::globalPoints::toGlobal ( @@ -467,8 +376,7 @@ void Foam::globalPoints::initOwnPoints ( collocatedPoints ( - refCast<const coupledPolyPatch>(pp), - mergeDist + refCast<const coupledPolyPatch>(pp) ) ); @@ -563,8 +471,7 @@ void Foam::globalPoints::sendPatchPoints ( collocatedPoints ( - procPatch, - mergeDist + procPatch ) ); @@ -663,8 +570,7 @@ void Foam::globalPoints::receivePatchPoints ( collocatedPoints ( - procPatch, - mergeDist + procPatch ) ); @@ -726,8 +632,7 @@ void Foam::globalPoints::receivePatchPoints ( collocatedPoints ( - cycPatch, - mergeDist + cycPatch ) ); @@ -1233,8 +1138,7 @@ void Foam::globalPoints::receiveSharedPoints ( collocatedPoints ( - cycPatch, - mergeDist + cycPatch ) ); diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.H b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.H index 246842632abfb96673a18bfd5879a3db4fa9ad4d..5498e46bb936ec86a4495ee7cff7291cc2e60b76 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.H +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.H @@ -127,9 +127,6 @@ class globalPoints // collocated coupled points. static const label fromCollocated; - //- Distance to check whether points/faces are collocated. - static const scalar mergeDist; - // Private data @@ -162,22 +159,9 @@ class globalPoints // Private Member Functions - //- Is identity transform? - static bool noTransform(const tensor&, const scalar mergeDist); - - //- Return per face collocated status - static PackedBoolList collocatedFaces - ( - const coupledPolyPatch&, - const scalar mergeDist - ); - //- Return per point collocated status - static PackedBoolList collocatedPoints - ( - const coupledPolyPatch&, - const scalar mergeDist - ); + static PackedBoolList collocatedPoints(const coupledPolyPatch&); + // Wrappers around global point numbering to add collocated bit diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C index 1947c126476126743ffeb9fa8139b45017ca579c..b7b53cae4fabe75210fa1860b8b7e5854ec053da 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C @@ -294,13 +294,13 @@ Foam::polyMesh::polyMesh(const IOobject& io) // Calculate the geometry for the patches (transformation tensors etc.) boundary_.calcGeometry(); - // Warn if global empty mesh (constructs globalData!) - if (globalData().nTotalPoints() == 0) + // Warn if global empty mesh + if (returnReduce(nPoints(), sumOp<label>()) == 0) { WarningIn("polyMesh(const IOobject&)") << "no points in mesh" << endl; } - if (globalData().nTotalCells() == 0) + if (returnReduce(nCells(), sumOp<label>()) == 0) { WarningIn("polyMesh(const IOobject&)") << "no cells in mesh" << endl; @@ -743,8 +743,12 @@ void Foam::polyMesh::resetPrimitives // Calculate the geometry for the patches (transformation tensors etc.) boundary_.calcGeometry(); - // Warn if global empty mesh (constructs globalData!) - if (globalData().nTotalPoints() == 0 || globalData().nTotalCells() == 0) + // Warn if global empty mesh + if + ( + (returnReduce(nPoints(), sumOp<label>()) == 0) + || (returnReduce(nCells(), sumOp<label>()) == 0) + ) { FatalErrorIn ( diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C index 8e18f68c771482b8b073b4fdaed7bde8310d415b..ba92292d422a2f07f3fb67a720c1f0493c1c575e 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C @@ -285,6 +285,7 @@ void Foam::coupledPolyPatch::calcTransformTensors separation_.setSize(0); forwardT_ = I; reverseT_ = I; + collocated_.setSize(0); } else { @@ -299,10 +300,14 @@ void Foam::coupledPolyPatch::calcTransformTensors { // Rotation, no separation + // Assume per-face differening transformation, correct later + separation_.setSize(0); forwardT_.setSize(Cf.size()); reverseT_.setSize(Cf.size()); + collocated_.setSize(Cf.size()); + collocated_ = false; forAll (forwardT_, facei) { @@ -321,6 +326,7 @@ void Foam::coupledPolyPatch::calcTransformTensors { forwardT_.setSize(1); reverseT_.setSize(1); + collocated_.setSize(1); if (debug) { @@ -332,11 +338,15 @@ void Foam::coupledPolyPatch::calcTransformTensors } else { + // No rotation, possible separation + forwardT_.setSize(0); reverseT_.setSize(0); separation_ = (nf&(Cr - Cf))*nf; + collocated_.setSize(separation_.size()); + // Three situations: // - separation is zero. No separation. // - separation is same. Single separation vector. @@ -344,15 +354,23 @@ void Foam::coupledPolyPatch::calcTransformTensors // Check for different separation per face bool sameSeparation = true; + bool doneWarning = false; forAll(separation_, facei) { scalar smallSqr = sqr(smallDist[facei]); + collocated_[facei] = (magSqr(separation_[facei]) < smallSqr); + + // Check if separation differing w.r.t. face 0. if (magSqr(separation_[facei] - separation_[0]) > smallSqr) { - if (debug) + sameSeparation = false; + + if (!doneWarning && debug) { + doneWarning = true; + Pout<< " separation " << separation_[facei] << " at " << facei << " differs from separation[0] " << separation_[0] @@ -360,15 +378,13 @@ void Foam::coupledPolyPatch::calcTransformTensors << smallDist[facei] << ". Assuming non-uniform separation." << endl; } - sameSeparation = false; - break; } } if (sameSeparation) { // Check for zero separation (at 0 so everywhere) - if (magSqr(separation_[0]) < sqr(smallDist[0])) + if (collocated_[0]) { if (debug) { @@ -378,6 +394,7 @@ void Foam::coupledPolyPatch::calcTransformTensors } separation_.setSize(0); + collocated_ = boolList(1, true); } else { @@ -389,6 +406,7 @@ void Foam::coupledPolyPatch::calcTransformTensors } separation_.setSize(1); + collocated_ = boolList(1, false); } } } diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H index e1afad60a812a2aa6fe09267fe4e0b830e091645..6da230d3007d7663c6fcecfa77a1a2b35cb60ee4 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H @@ -64,6 +64,9 @@ class coupledPolyPatch //- Neighbour-cell transformation tensor mutable tensorField reverseT_; + //- Are faces collocated. Either size 0,1 or length of patch. + mutable boolList collocated_; + public: // Static data members @@ -261,7 +264,6 @@ public: return separation_; } - //- Are the cyclic planes parallel bool parallel() const { @@ -280,6 +282,12 @@ public: return reverseT_; } + //- Are faces collocated. Either size 0,1 or length of patch + const boolList& collocated() const + { + return collocated_; + } + //- Initialize ordering for primitivePatch. Does not // refer to *this (except for name() and type() etc.) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.H index ae8f7cbedb08f8f0eba9c1f09480ed1e5981b552..2ac9cba9379c4f78f6b12e7c0df4e46bd15643a2 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.H @@ -26,8 +26,8 @@ Class Foam::genericPolyPatch Description - Determines a mapping between patch face centres and mesh cell centres and - processors they're on. + Substitute for unknown patches. Used for postprocessing when only + basic polyPatch info is needed. Note Storage is not optimal. It stores all face centres and cells on all diff --git a/src/OpenFOAM/primitives/bools/Switch/Switch.H b/src/OpenFOAM/primitives/bools/Switch/Switch.H index adda09cf4ecfa2895f61f167f3d66d300b79b845..0f57de5e97ae579c6e7fad5da29ef3e040575e92 100644 --- a/src/OpenFOAM/primitives/bools/Switch/Switch.H +++ b/src/OpenFOAM/primitives/bools/Switch/Switch.H @@ -74,6 +74,17 @@ public: //- The various text representations for a switch value. // These also correspond to the entries in names. +# undef FALSE +# undef TRUE +# undef OFF +# undef ON +# undef NO +# undef YES +# undef NO_1 +# undef YES_1 +# undef NONE +# undef PLACEHOLDER +# undef INVALID enum switchType { FALSE = 0, TRUE = 1, diff --git a/src/OpenFOAM/primitives/ops/ops.H b/src/OpenFOAM/primitives/ops/ops.H index f18ac144080288414c65dd82eee9c13876277ef7..2706657f1b32a5d666082bf5206ed1562c070739 100644 --- a/src/OpenFOAM/primitives/ops/ops.H +++ b/src/OpenFOAM/primitives/ops/ops.H @@ -82,6 +82,8 @@ EqOp(orEq, x = (x || y)) EqOp(eqMinus, x = -y) +EqOp(nopEq, (void)x) + #undef EqOp diff --git a/src/Pstream/dummy/UIPread.C b/src/Pstream/dummy/UIPread.C index a91a007e43eb60a60926d6ab3f6ed6c39743f1b5..da9613af37d1c807336171b32eab946d3cc1a59a 100644 --- a/src/Pstream/dummy/UIPread.C +++ b/src/Pstream/dummy/UIPread.C @@ -36,6 +36,7 @@ Foam::UIPstream::UIPstream const commsTypes commsType, const int fromProcNo, DynamicList<char>& externalBuf, + label& externalBufPosition, const int tag, streamFormat format, versionNumber version @@ -45,7 +46,7 @@ Foam::UIPstream::UIPstream Istream(format, version), fromProcNo_(fromProcNo), externalBuf_(externalBuf), - externalBufPosition_(0), + externalBufPosition_(externalBufPosition), tag_(tag), messageSize_(0) { @@ -56,6 +57,7 @@ Foam::UIPstream::UIPstream "const commsTypes," "const int fromProcNo," "DynamicList<char>&," + "label&," "const int tag," "streamFormat, versionNumber" ")" diff --git a/src/Pstream/mpi/UIPread.C b/src/Pstream/mpi/UIPread.C index fb6a9ec7d7b45930a594280a75bc0707194654e4..9a70f456b9da3e10b5a9229da3cb7a922610932b 100644 --- a/src/Pstream/mpi/UIPread.C +++ b/src/Pstream/mpi/UIPread.C @@ -40,6 +40,7 @@ Foam::UIPstream::UIPstream const commsTypes commsType, const int fromProcNo, DynamicList<char>& externalBuf, + label& externalBufPosition, const int tag, streamFormat format, versionNumber version @@ -49,7 +50,7 @@ Foam::UIPstream::UIPstream Istream(format, version), fromProcNo_(fromProcNo), externalBuf_(externalBuf), - externalBufPosition_(0), + externalBufPosition_(externalBufPosition), tag_(tag), messageSize_(0) { @@ -122,7 +123,7 @@ Foam::UIPstream::UIPstream(const int fromProcNo, PstreamBuffers& buffers) Istream(buffers.format_, buffers.version_), fromProcNo_(fromProcNo), externalBuf_(buffers.recvBuf_[fromProcNo]), - externalBufPosition_(0), + externalBufPosition_(buffers.recvBufPos_[fromProcNo]), tag_(buffers.tag_), messageSize_(0) { diff --git a/src/Pstream/mpi/UOPwrite.C b/src/Pstream/mpi/UOPwrite.C index 9f8726d9a036d2e4af275f51bd4a20140bc7521d..8d272fc0ca5f3420b2a6c9e2a9d6c46d9dab8924 100644 --- a/src/Pstream/mpi/UOPwrite.C +++ b/src/Pstream/mpi/UOPwrite.C @@ -45,7 +45,7 @@ bool Foam::UOPstream::write { if (debug) { - Pout<< "UIPstream::write : starting write to:" << toProcNo + Pout<< "UOPstream::write : starting write to:" << toProcNo << " tag:" << tag << " size:" << label(bufSize) << " commsType:" << UPstream::commsTypeNames[commsType] << Foam::endl; @@ -67,7 +67,7 @@ bool Foam::UOPstream::write if (debug) { - Pout<< "UIPstream::write : finished write to:" << toProcNo + Pout<< "UOPstream::write : finished write to:" << toProcNo << " tag:" << tag << " size:" << label(bufSize) << " commsType:" << UPstream::commsTypeNames[commsType] << Foam::endl; @@ -87,7 +87,7 @@ bool Foam::UOPstream::write if (debug) { - Pout<< "UIPstream::write : finished write to:" << toProcNo + Pout<< "UOPstream::write : finished write to:" << toProcNo << " tag:" << tag << " size:" << label(bufSize) << " commsType:" << UPstream::commsTypeNames[commsType] << Foam::endl; @@ -110,7 +110,7 @@ bool Foam::UOPstream::write if (debug) { - Pout<< "UIPstream::write : started write to:" << toProcNo + Pout<< "UOPstream::write : started write to:" << toProcNo << " tag:" << tag << " size:" << label(bufSize) << " commsType:" << UPstream::commsTypeNames[commsType] << " request:" << PstreamGlobals::outstandingRequests_.size() diff --git a/src/conversion/meshWriter/meshWriter.C b/src/conversion/meshWriter/meshWriter.C index 67a6054658daf639f04586f72e3f5e4d28596291..a51675adf1cd1d41e8a66518e151a5fe9e92dc59 100644 --- a/src/conversion/meshWriter/meshWriter.C +++ b/src/conversion/meshWriter/meshWriter.C @@ -29,6 +29,9 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +Foam::string Foam::meshWriter::defaultMeshName = "meshExport"; + + const Foam::cellModel* Foam::meshWriter::unknownModel = Foam::cellModeller:: lookup ( @@ -64,10 +67,6 @@ lookup ); -Foam::string Foam::meshWriter::defaultMeshName = "meshExport"; -Foam::string Foam::meshWriter::defaultSurfaceName = "surfExport"; - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::meshWriter::meshWriter(const polyMesh& mesh, const scalar scaleFactor) diff --git a/src/conversion/meshWriter/meshWriter.H b/src/conversion/meshWriter/meshWriter.H index e86a74cc46a508448574a3085cfad73eaadebcc3..7e367cb67b5c36e84d0546af2bc5fc8f8fd27cde 100644 --- a/src/conversion/meshWriter/meshWriter.H +++ b/src/conversion/meshWriter/meshWriter.H @@ -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 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class meshWriter Declaration + Class meshWriter Declaration \*---------------------------------------------------------------------------*/ class meshWriter @@ -133,13 +133,12 @@ public: // Static data members + //- Specify a default mesh name static string defaultMeshName; - static string defaultSurfaceName; - // Constructors - //- Ccreate a writer obejct + //- Create a writer obejct meshWriter ( const polyMesh&, @@ -167,26 +166,14 @@ public: writeBoundary_ = false; } - // Write - //- Write volume mesh - // subclass must to supply this method + //- Write volume mesh. Subclass must supply this method virtual bool write ( const fileName& timeName = fileName::null ) const = 0; - //- Write surface mesh with optional triangulation - // subclass could supply this information - virtual bool writeSurface - ( - const fileName& timeName = fileName::null, - const bool triangulate = false - ) const - { - return false; - } }; diff --git a/src/conversion/meshWriter/starcd/STARCDMeshWriter.C b/src/conversion/meshWriter/starcd/STARCDMeshWriter.C index 630dd20f43055c57bb72a3a88950e4756823bfd2..17e6d117dd4ff205ae11f26162dfa5d8327a9911 100644 --- a/src/conversion/meshWriter/starcd/STARCDMeshWriter.C +++ b/src/conversion/meshWriter/starcd/STARCDMeshWriter.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 @@ -527,201 +527,4 @@ bool Foam::meshWriters::STARCD::write(const fileName& meshName) const } -bool Foam::meshWriters::STARCD::writeSurface -( - const fileName& meshName, - const bool triangulate -) const -{ - fileName baseName(meshName); - - if (baseName.empty()) - { - baseName = meshWriter::defaultSurfaceName; - - if - ( - mesh_.time().timeName() != "0" - && mesh_.time().timeName() != "constant" - ) - { - baseName += "_" + mesh_.time().timeName(); - } - } - - rmFiles(baseName); - - OFstream celFile(baseName + ".cel"); - writeHeader(celFile, "CELL"); - - Info<< "Writing " << celFile.name() << endl; - - // mesh and patch info - const pointField& points = mesh_.points(); - const labelList& owner = mesh_.faceOwner(); - const faceList& meshFaces = mesh_.faces(); - const polyBoundaryMesh& patches = mesh_.boundaryMesh(); - - label shapeId = 3; // shell/baffle element - label typeId = 4; // 4(shell) - - // remember which points need to be written - labelHashSet pointHash; - - // write boundary faces as normal STAR-CD mesh - if (triangulate) - { - // cell Id has no particular meaning - just increment - // use the cellTable id from the patch Number - label cellId = 0; - - forAll(patches, patchI) - { - label patchStart = patches[patchI].start(); - label patchSize = patches[patchI].size(); - - label ctableId = patchI + 1; - - for - ( - label faceI = patchStart; - faceI < (patchStart + patchSize); - ++faceI - ) - { - const face& f = meshFaces[faceI]; - - label nTri = f.nTriangles(points); - faceList triFaces; - - // triangulate polygons, but not quads - if (nTri <= 2) - { - triFaces.setSize(1); - triFaces[0] = f; - } - else - { - triFaces.setSize(nTri); - nTri = 0; - f.triangles(points, nTri, triFaces); - } - - forAll(triFaces, faceI) - { - const labelList& vrtList = triFaces[faceI]; - - celFile - << cellId + 1 << " " - << shapeId << " " - << vrtList.size() << " " - << ctableId << " " - << typeId; - - // must be 3 (triangle) but could be quad - label count = 0; - forAll(vrtList, i) - { - if ((count % 8) == 0) - { - celFile - << nl - << " " << cellId + 1; - } - // remember which points we'll need to write - pointHash.insert(vrtList[i]); - celFile << " " << vrtList[i] + 1; - count++; - } - celFile << endl; - - cellId++; - } - } - } - } - else - { - // cell Id is the OpenFOAM face Id - // use the cellTable id from the face owner - // - allows separation of parts - forAll(patches, patchI) - { - label patchStart = patches[patchI].start(); - label patchSize = patches[patchI].size(); - - for - ( - label faceI = patchStart; - faceI < (patchStart + patchSize); - ++faceI - ) - { - const labelList& vrtList = meshFaces[faceI]; - label cellId = faceI; - - celFile - << cellId + 1 << " " - << shapeId << " " - << vrtList.size() << " " - << cellTableId_[owner[faceI]] << " " - << typeId; - - // likely <= 8 vertices, but prevent overrun anyhow - label count = 0; - forAll(vrtList, i) - { - if ((count % 8) == 0) - { - celFile - << nl - << " " << cellId + 1; - } - // remember which points we'll need to write - pointHash.insert(vrtList[i]); - celFile << " " << vrtList[i] + 1; - count++; - } - celFile << endl; - } - } - } - - OFstream vrtFile(baseName + ".vrt"); - writeHeader(vrtFile, "VERTEX"); - - vrtFile.precision(10); - vrtFile.setf(std::ios::showpoint); // force decimal point for Fortran - - Info<< "Writing " << vrtFile.name() << endl; - - // build sorted table of contents - SortableList<label> toc(pointHash.size()); - { - label i = 0; - forAllConstIter(labelHashSet, pointHash, iter) - { - toc[i++] = iter.key(); - } - } - toc.sort(); - toc.shrink(); - pointHash.clear(); - - // write points in sorted order - forAll(toc, i) - { - label vrtId = toc[i]; - vrtFile - << vrtId + 1 - << " " << scaleFactor_ * points[vrtId].x() - << " " << scaleFactor_ * points[vrtId].y() - << " " << scaleFactor_ * points[vrtId].z() - << endl; - } - - return true; -} - - // ************************************************************************* // diff --git a/src/conversion/meshWriter/starcd/STARCDMeshWriter.H b/src/conversion/meshWriter/starcd/STARCDMeshWriter.H index 9e2cfeb0b33c5c243c7a75bb10e11cabf94b61a0..31f1acbfb44b95407d2a419a97b4eb32f5033457 100644 --- a/src/conversion/meshWriter/starcd/STARCDMeshWriter.H +++ b/src/conversion/meshWriter/starcd/STARCDMeshWriter.H @@ -28,11 +28,6 @@ Class Description Writes polyMesh in pro-STAR (v4) bnd/cel/vrt format - Alternatively, extracts the surface of the FOAM mesh into - pro-STAR (v4) .cel/.vrt/ format. - This can be useful, for example, for surface morphing in an external - package. - The cellTableId and cellTable information are used (if available). Otherwise the cellZones are used (if available). @@ -131,12 +126,6 @@ public: const fileName& meshName = fileName::null ) const; - //- Write surface mesh with optional triangulation - virtual bool writeSurface - ( - const fileName& meshName = fileName::null, - const bool triangulate = false - ) const; }; diff --git a/src/dynamicMesh/motionSmoother/motionSmootherTemplates.C b/src/dynamicMesh/motionSmoother/motionSmootherTemplates.C index 4ea2fa926067f395da7be27f6e7f68dcca4283eb..7569817adbb1cab4fe7dd15b865f62991416d1d5 100644 --- a/src/dynamicMesh/motionSmoother/motionSmootherTemplates.C +++ b/src/dynamicMesh/motionSmoother/motionSmootherTemplates.C @@ -27,7 +27,6 @@ License #include "motionSmoother.H" #include "meshTools.H" #include "processorPointPatchFields.H" -#include "globalPointPatchFields.H" #include "pointConstraint.H" #include "syncTools.H" diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index e12c715250b1588d64f65bd95ee9ab4787bfbf95..622d8bf842563e71afe9f9ae1431c64bc6fe923b 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -187,7 +187,7 @@ $(interpolation)/interpolationCellPointWallModified/cellPointWeightWallModified/ $(interpolation)/interpolationCellPointWallModified/makeInterpolationCellPointWallModified.C volPointInterpolation = interpolation/volPointInterpolation -$(volPointInterpolation)/pointPatchInterpolation/pointPatchInterpolation.C +/* $(volPointInterpolation)/pointPatchInterpolation/pointPatchInterpolation.C */ $(volPointInterpolation)/volPointInterpolation.C surfaceInterpolation = interpolation/surfaceInterpolation diff --git a/src/finiteVolume/interpolation/volPointInterpolation/pointPatchInterpolation/pointPatchInterpolate.C b/src/finiteVolume/interpolation/volPointInterpolation/pointPatchInterpolation/pointPatchInterpolate.C deleted file mode 100644 index d7307e0d1f7a5df1f357d0dee8ed1832c33e1105..0000000000000000000000000000000000000000 --- a/src/finiteVolume/interpolation/volPointInterpolation/pointPatchInterpolation/pointPatchInterpolate.C +++ /dev/null @@ -1,208 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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 "pointPatchInterpolation.H" -#include "volFields.H" -#include "pointFields.H" -#include "emptyFvPatch.H" -#include "valuePointPatchField.H" -#include "coupledPointPatchField.H" -#include "coupledFacePointPatch.H" -#include "transform.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -template<class Type> -void pointPatchInterpolation::interpolate -( - const GeometricField<Type, fvPatchField, volMesh>& vf, - GeometricField<Type, pointPatchField, pointMesh>& pf, - bool overrideFixedValue -) const -{ - if (debug) - { - Info<< "pointPatchInterpolation::interpolate(" - << "const GeometricField<Type, fvPatchField, volMesh>&, " - << "GeometricField<Type, pointPatchField, pointMesh>&) : " - << "interpolating field from cells to points" - << endl; - } - - // Interpolate patch values: over-ride the internal values for the points - // on the patch with the interpolated point values from the faces of the - // patch - - const fvBoundaryMesh& bm = fvMesh_.boundary(); - const pointBoundaryMesh& pbm = pointMesh::New(fvMesh_).boundary(); - - forAll(bm, patchi) - { - if (!isA<emptyFvPatch>(bm[patchi]) && !bm[patchi].coupled()) - { - pointPatchField<Type>& ppf = pf.boundaryField()[patchi]; - - // Only map the values corresponding to the points associated with - // faces, not "lone" points due to decomposition - ppf.setInInternalField - ( - pf.internalField(), - patchInterpolators_[patchi] - .faceToPointInterpolate(vf.boundaryField()[patchi])(), - bm[patchi].patch().meshPoints() - ); - - if - ( - overrideFixedValue - && isA<valuePointPatchField<Type> >(ppf) - ) - { - refCast<valuePointPatchField<Type> >(ppf) = ppf; - } - } - else if (bm[patchi].coupled()) - { - // Initialise the "lone" points on the coupled patch to zero, - // these values are obtained from the couple-transfer - - const labelList& loneMeshPoints = - refCast<const coupledFacePointPatch>(pbm[patchi]) - .loneMeshPoints(); - - forAll(loneMeshPoints, i) - { - pf[loneMeshPoints[i]] = pTraits<Type>::zero; - } - } - - } - - - // Correct patch-patch boundary points by interpolation "around" corners - const labelListList& PointFaces = fvMesh_.pointFaces(); - - forAll(patchPatchPoints_, pointi) - { - const label curPoint = patchPatchPoints_[pointi]; - const labelList& curFaces = PointFaces[curPoint]; - - label fI = 0; - - // Reset the boundary value before accumulation - pf[curPoint] = pTraits<Type>::zero; - - // Go through all the faces - forAll(curFaces, facei) - { - if (!fvMesh_.isInternalFace(curFaces[facei])) - { - label patchi = - fvMesh_.boundaryMesh().whichPatch(curFaces[facei]); - - if (!isA<emptyFvPatch>(bm[patchi]) && !bm[patchi].coupled()) - { - label faceInPatchi = - bm[patchi].patch().whichFace(curFaces[facei]); - - pf[curPoint] += - patchPatchPointWeights_[pointi][fI] - *vf.boundaryField()[patchi][faceInPatchi]; - - fI++; - } - } - } - } - - // Update coupled boundaries - forAll(pf.boundaryField(), patchi) - { - if (pf.boundaryField()[patchi].coupled()) - { - refCast<coupledPointPatchField<Type> >(pf.boundaryField()[patchi]) - .initSwapAdd(pf.internalField()); - } - } - - forAll(pf.boundaryField(), patchi) - { - if (pf.boundaryField()[patchi].coupled()) - { - refCast<coupledPointPatchField<Type> >(pf.boundaryField()[patchi]) - .swapAdd(pf.internalField()); - } - } - - - // Override constrained pointPatchField types with the constraint value. - // This relys on only constrained pointPatchField implementing the evaluate - // function - pf.correctBoundaryConditions(); - - - // Apply multiple constraints on edge/corner points - applyCornerConstraints(pf); - - - if (debug) - { - Info<< "pointPatchInterpolation::interpolate(" - << "const GeometricField<Type, fvPatchField, volMesh>&, " - << "GeometricField<Type, pointPatchField, pointMesh>&) : " - << "finished interpolating field from cells to points" - << endl; - } -} - - -template<class Type> -void pointPatchInterpolation::applyCornerConstraints -( - GeometricField<Type, pointPatchField, pointMesh>& pf -) const -{ - forAll(patchPatchPointConstraintPoints_, pointi) - { - pf[patchPatchPointConstraintPoints_[pointi]] = transform - ( - patchPatchPointConstraintTensors_[pointi], - pf[patchPatchPointConstraintPoints_[pointi]] - ); - } -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/finiteVolume/interpolation/volPointInterpolation/pointPatchInterpolation/pointPatchInterpolation.C b/src/finiteVolume/interpolation/volPointInterpolation/pointPatchInterpolation/pointPatchInterpolation.C deleted file mode 100644 index 6cebe3369bd95024213b75f113292a0dc5b9e5c2..0000000000000000000000000000000000000000 --- a/src/finiteVolume/interpolation/volPointInterpolation/pointPatchInterpolation/pointPatchInterpolation.C +++ /dev/null @@ -1,337 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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 "pointPatchInterpolation.H" -#include "fvMesh.H" -#include "volFields.H" -#include "pointFields.H" -#include "emptyFvPatch.H" -#include "demandDrivenData.H" -#include "coupledPointPatchFields.H" -#include "pointConstraint.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(pointPatchInterpolation, 0); - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -void pointPatchInterpolation::makePatchPatchAddressing() -{ - if (debug) - { - Info<< "pointPatchInterpolation::makePatchPatchAddressing() : " - << "constructing boundary addressing" - << endl; - } - - const fvBoundaryMesh& bm = fvMesh_.boundary(); - const pointBoundaryMesh& pbm = pointMesh::New(fvMesh_).boundary(); - - // first count the total number of patch-patch points - - label nPatchPatchPoints = 0; - - forAll(bm, patchi) - { - if (!isA<emptyFvPatch>(bm[patchi]) && !bm[patchi].coupled()) - { - nPatchPatchPoints += bm[patchi].patch().boundaryPoints().size(); - } - } - - - // Go through all patches and mark up the external edge points - Map<label> patchPatchPointSet(2*nPatchPatchPoints); - - patchPatchPoints_.setSize(nPatchPatchPoints); - - List<pointConstraint> patchPatchPointConstraints(nPatchPatchPoints); - - label pppi = 0; - - forAll(bm, patchi) - { - if (!isA<emptyFvPatch>(bm[patchi]) && !bm[patchi].coupled()) - { - const labelList& bp = bm[patchi].patch().boundaryPoints(); - const labelList& meshPoints = bm[patchi].patch().meshPoints(); - - forAll(bp, pointi) - { - label ppp = meshPoints[bp[pointi]]; - - Map<label>::iterator iter = patchPatchPointSet.find(ppp); - - if (iter == patchPatchPointSet.end()) - { - patchPatchPointSet.insert(ppp, pppi); - patchPatchPoints_[pppi] = ppp; - - pbm[patchi].applyConstraint - ( - bp[pointi], - patchPatchPointConstraints[pppi] - ); - pppi++; - } - else - { - pbm[patchi].applyConstraint - ( - bp[pointi], - patchPatchPointConstraints[iter()] - ); - } - } - } - } - - nPatchPatchPoints = pppi; - patchPatchPoints_.setSize(nPatchPatchPoints); - patchPatchPointConstraints.setSize(nPatchPatchPoints); - - patchPatchPointConstraintPoints_.setSize(nPatchPatchPoints); - patchPatchPointConstraintTensors_.setSize(nPatchPatchPoints); - - label nConstraints = 0; - - forAll(patchPatchPointConstraints, i) - { - if (patchPatchPointConstraints[i].first() != 0) - { - patchPatchPointConstraintPoints_[nConstraints] = - patchPatchPoints_[i]; - - patchPatchPointConstraintTensors_[nConstraints] = - patchPatchPointConstraints[i].constraintTransformation(); - - nConstraints++; - } - } - - patchPatchPointConstraintPoints_.setSize(nConstraints); - patchPatchPointConstraintTensors_.setSize(nConstraints); - - - patchInterpolators_.clear(); - patchInterpolators_.setSize(bm.size()); - - forAll(bm, patchi) - { - patchInterpolators_.set - ( - patchi, - new primitivePatchInterpolation(bm[patchi].patch()) - ); - } - - if (debug) - { - Info<< "pointPatchInterpolation::makePatchPatchAddressing() : " - << "finished constructing boundary addressing" - << endl; - } -} - - -void pointPatchInterpolation::makePatchPatchWeights() -{ - if (debug) - { - Info<< "pointPatchInterpolation::makePatchPatchWeights() : " - << "constructing boundary weighting factors" - << endl; - } - - patchPatchPointWeights_.clear(); - patchPatchPointWeights_.setSize(patchPatchPoints_.size()); - - const labelListList& pf = fvMesh_.pointFaces(); - const volVectorField& centres = fvMesh_.C(); - const fvBoundaryMesh& bm = fvMesh_.boundary(); - - pointScalarField sumWeights - ( - IOobject - ( - "sumWeights", - fvMesh_.polyMesh::instance(), - fvMesh_ - ), - pointMesh::New(fvMesh_), - dimensionedScalar("zero", dimless, 0) - ); - - forAll(patchPatchPoints_, pointi) - { - const label curPoint = patchPatchPoints_[pointi]; - const labelList& curFaces = pf[curPoint]; - - patchPatchPointWeights_[pointi].setSize(curFaces.size()); - scalarList& pw = patchPatchPointWeights_[pointi]; - - label nFacesAroundPoint = 0; - - const vector& pointLoc = fvMesh_.points()[curPoint]; - - forAll(curFaces, facei) - { - if (!fvMesh_.isInternalFace(curFaces[facei])) - { - label patchi = - fvMesh_.boundaryMesh().whichPatch(curFaces[facei]); - - if (!isA<emptyFvPatch>(bm[patchi]) && !bm[patchi].coupled()) - { - vector d = - pointLoc - - centres.boundaryField()[patchi] - [bm[patchi].patch().whichFace(curFaces[facei])]; - - pw[nFacesAroundPoint] = 1.0/(mag(d)+VSMALL); - - nFacesAroundPoint++; - } - } - } - - // Reset the sizes of the local weights - pw.setSize(nFacesAroundPoint); - - // Collect the sum of weights for parallel correction - sumWeights[curPoint] += sum(pw); - } - - // Do parallel correction of weights - - // Update coupled boundaries - forAll(sumWeights.boundaryField(), patchi) - { - if (sumWeights.boundaryField()[patchi].coupled()) - { - refCast<coupledPointPatchScalarField> - (sumWeights.boundaryField()[patchi]).initSwapAdd - ( - sumWeights.internalField() - ); - } - } - - forAll(sumWeights.boundaryField(), patchi) - { - if (sumWeights.boundaryField()[patchi].coupled()) - { - refCast<coupledPointPatchScalarField> - (sumWeights.boundaryField()[patchi]).swapAdd - ( - sumWeights.internalField() - ); - } - } - - - // Re-scale the weights for the current point - forAll(patchPatchPoints_, pointi) - { - scalarList& pw = patchPatchPointWeights_[pointi]; - scalar sumw = sumWeights[patchPatchPoints_[pointi]]; - - forAll(pw, facei) - { - pw[facei] /= sumw; - } - } - - - if (debug) - { - Info<< "pointPatchInterpolation::makePatchPatchWeights() : " - << "finished constructing boundary weighting factors" - << endl; - } -} - - -// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * // - -pointPatchInterpolation::pointPatchInterpolation(const fvMesh& vm) -: - fvMesh_(vm) -{ - updateMesh(); -} - - -// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * // - -pointPatchInterpolation::~pointPatchInterpolation() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void pointPatchInterpolation::updateMesh() -{ - makePatchPatchAddressing(); - makePatchPatchWeights(); -} - - -bool pointPatchInterpolation::movePoints() -{ - forAll(patchInterpolators_, patchi) - { - patchInterpolators_[patchi].movePoints(); - } - - makePatchPatchWeights(); - - return true; -} - - -// Specialisaion of applyCornerConstraints for scalars because -// no constraint need be applied -template<> -void pointPatchInterpolation::applyCornerConstraints<scalar> -( - GeometricField<scalar, pointPatchField, pointMesh>& pf -) const -{} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/finiteVolume/interpolation/volPointInterpolation/pointPatchInterpolation/pointPatchInterpolation.H b/src/finiteVolume/interpolation/volPointInterpolation/pointPatchInterpolation/pointPatchInterpolation.H deleted file mode 100644 index 5a26e6e46d431665968fcf868a83edeb9ccdef32..0000000000000000000000000000000000000000 --- a/src/finiteVolume/interpolation/volPointInterpolation/pointPatchInterpolation/pointPatchInterpolation.H +++ /dev/null @@ -1,169 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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::pointPatchInterpolation - -Description - Foam::pointPatchInterpolation - -SourceFiles - pointPatchInterpolation.C - -\*---------------------------------------------------------------------------*/ - -#ifndef pointPatchInterpolation_H -#define pointPatchInterpolation_H - -#include "primitivePatchInterpolation.H" -#include "PtrList.H" -#include "volFieldsFwd.H" -#include "pointFieldsFwd.H" -#include "scalarList.H" -#include "className.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// Forward declaration of classes -class fvMesh; -class pointMesh; - -/*---------------------------------------------------------------------------*\ - Class pointPatchInterpolation Declaration -\*---------------------------------------------------------------------------*/ - -class pointPatchInterpolation -{ - // Private data - - const fvMesh& fvMesh_; - - //- Primitive patch interpolators - PtrList<primitivePatchInterpolation> patchInterpolators_; - - //- List of patch-patch edge points that require special treatement - labelList patchPatchPoints_; - - //- Weights for patch-patch boundary points - scalarListList patchPatchPointWeights_; - - labelList patchPatchPointConstraintPoints_; - tensorField patchPatchPointConstraintTensors_; - - - // Private member functions - - //- Construct addressing for patch-patch boundary points - void makePatchPatchAddressing(); - - //- Construct weights for patch-patch boundary points - void makePatchPatchWeights(); - - - //- Disallow default bitwise copy construct - pointPatchInterpolation(const pointPatchInterpolation&); - - //- Disallow default bitwise assignment - void operator=(const pointPatchInterpolation&); - - -public: - - // Declare name of the class and its debug switch - ClassName("pointPatchInterpolation"); - - - // Constructors - - //- Constructor given fvMesh and pointMesh. - pointPatchInterpolation(const fvMesh&); - - - // Destructor - - ~pointPatchInterpolation(); - - - // Member functions - - // Access - - const fvMesh& mesh() const - { - return fvMesh_; - } - - - // Edit - - //- Update mesh topology using the morph engine - void updateMesh(); - - //- Correct weighting factors for moving mesh. - bool movePoints(); - - - // Interpolation functions - - template<class Type> - void interpolate - ( - const GeometricField<Type, fvPatchField, volMesh>&, - GeometricField<Type, pointPatchField, pointMesh>&, - bool overrideFixedValue - ) const; - - template<class Type> - void applyCornerConstraints - ( - GeometricField<Type, pointPatchField, pointMesh>& pf - ) const; -}; - - -template<> -void pointPatchInterpolation::applyCornerConstraints<scalar> -( - GeometricField<scalar, pointPatchField, pointMesh>& pf -) const; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "pointPatchInterpolate.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolate.C b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolate.C index 1adc4046c73819ced0e64c00090a69d7286a06f7..fbb4963fd381fde9313cbf650cc8f4d0e6900314 100644 --- a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolate.C +++ b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolate.C @@ -27,7 +27,11 @@ License #include "volPointInterpolation.H" #include "volFields.H" #include "pointFields.H" -#include "globalPointPatch.H" +#include "emptyFvPatch.H" +#include "mapDistribute.H" +#include "coupledPointPatchField.H" +#include "valuePointPatchField.H" +#include "transform.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -36,6 +40,48 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +template<class Type> +void volPointInterpolation::addSeparated +( + GeometricField<Type, pointPatchField, pointMesh>& pf +) const +{ + if (debug) + { + Pout<< "volPointInterpolation::addSeparated" << endl; + } + + forAll(pf.boundaryField(), patchI) + { + if (pf.boundaryField()[patchI].coupled()) + { + refCast<coupledPointPatchField<Type> > + (pf.boundaryField()[patchI]).initSwapAddSeparated + ( + Pstream::blocking, //Pstream::nonBlocking, + pf.internalField() + ); + } + } + + // Block for any outstanding requests + //Pstream::waitRequests(); + + forAll(pf.boundaryField(), patchI) + { + if (pf.boundaryField()[patchI].coupled()) + { + refCast<coupledPointPatchField<Type> > + (pf.boundaryField()[patchI]).swapAddSeparated + ( + Pstream::blocking, //Pstream::nonBlocking, + pf.internalField() + ); + } + } +} + + template<class Type> void volPointInterpolation::interpolateInternalField ( @@ -45,7 +91,7 @@ void volPointInterpolation::interpolateInternalField { if (debug) { - Info<< "volPointInterpolation::interpolateInternalField(" + Pout<< "volPointInterpolation::interpolateInternalField(" << "const GeometricField<Type, fvPatchField, volMesh>&, " << "GeometricField<Type, pointPatchField, pointMesh>&) : " << "interpolating field from cells to points" @@ -57,16 +103,163 @@ void volPointInterpolation::interpolateInternalField // Multiply volField by weighting factor matrix to create pointField forAll(pointCells, pointi) { - const scalarList& pw = pointWeights_[pointi]; - const labelList& ppc = pointCells[pointi]; + if (!isPatchPoint_[pointi]) + { + const scalarList& pw = pointWeights_[pointi]; + const labelList& ppc = pointCells[pointi]; + + pf[pointi] = pTraits<Type>::zero; + + forAll(ppc, pointCelli) + { + pf[pointi] += pw[pointCelli]*vf[ppc[pointCelli]]; + } + } + } +} + + +template<class Type> +tmp<Field<Type> > volPointInterpolation::flatBoundaryField +( + const GeometricField<Type, fvPatchField, volMesh>& vf +) const +{ + const fvMesh& mesh = vf.mesh(); + const fvBoundaryMesh& bm = mesh.boundary(); + + tmp<Field<Type> > tboundaryVals + ( + new Field<Type>(mesh.nFaces()-mesh.nInternalFaces()) + ); + Field<Type>& boundaryVals = tboundaryVals(); + + forAll(vf.boundaryField(), patchI) + { + label bFaceI = bm[patchI].patch().start() - mesh.nInternalFaces(); + + if (!isA<emptyFvPatch>(bm[patchI]) && !bm[patchI].coupled()) + { + SubList<Type> + ( + boundaryVals, + vf.boundaryField()[patchI].size(), + bFaceI + ).assign(vf.boundaryField()[patchI]); + } + else + { + const polyPatch& pp = bm[patchI].patch(); + + forAll(pp, i) + { + boundaryVals[bFaceI++] = pTraits<Type>::zero; + } + } + } + + return tboundaryVals; +} + + +template<class Type> +void volPointInterpolation::interpolateBoundaryField +( + const GeometricField<Type, fvPatchField, volMesh>& vf, + GeometricField<Type, pointPatchField, pointMesh>& pf, + const bool overrideFixedValue +) const +{ + const primitivePatch& boundary = boundaryPtr_(); + + Field<Type>& pfi = pf.internalField(); + + // Get face data in flat list + tmp<Field<Type> > tboundaryVals(flatBoundaryField(vf)); + const Field<Type>& boundaryVals = tboundaryVals(); + + + // Do points on 'normal' patches from the surrounding patch faces + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + forAll(boundary.meshPoints(), i) + { + label pointI = boundary.meshPoints()[i]; + + if (isPatchPoint_[pointI]) + { + const labelList& pFaces = boundary.pointFaces()[i]; + const scalarList& pWeights = boundaryPointWeights_[i]; + + Type& val = pfi[pointI]; + + val = pTraits<Type>::zero; + forAll(pFaces, j) + { + if (boundaryIsPatchFace_[pFaces[j]]) + { + val += pWeights[j]*boundaryVals[pFaces[j]]; + } + } + } + } + + // Sum collocated contributions + mesh().globalData().syncPointData(pfi, plusEqOp<Type>()); - pf[pointi] = pTraits<Type>::zero; + // And add separated contributions + addSeparated(pf); - forAll(ppc, pointCelli) + // Push master data to slaves. It is possible (not sure how often) for + // a coupled point to have its master on a different patch so + // to make sure just push master data to slaves. Reuse the syncPointData + // structure. + mesh().globalData().syncPointData(pfi, nopEqOp<Type>()); + + + + if (overrideFixedValue) + { + forAll(pf.boundaryField(), patchI) { - pf[pointi] += pw[pointCelli]*vf[ppc[pointCelli]]; + pointPatchField<Type>& ppf = pf.boundaryField()[patchI]; + + if (isA<valuePointPatchField<Type> >(ppf)) + { + refCast<valuePointPatchField<Type> >(ppf) = + ppf.patchInternalField(); + } } } + + + // Override constrained pointPatchField types with the constraint value. + // This relys on only constrained pointPatchField implementing the evaluate + // function + pf.correctBoundaryConditions(); + + // Sync any dangling points + mesh().globalData().syncPointData(pfi, nopEqOp<Type>()); + + // Apply multiple constraints on edge/corner points + applyCornerConstraints(pf); +} + + +template<class Type> +void volPointInterpolation::applyCornerConstraints +( + GeometricField<Type, pointPatchField, pointMesh>& pf +) const +{ + forAll(patchPatchPointConstraintPoints_, pointi) + { + pf[patchPatchPointConstraintPoints_[pointi]] = transform + ( + patchPatchPointConstraintTensors_[pointi], + pf[patchPatchPointConstraintPoints_[pointi]] + ); + } } @@ -79,7 +272,7 @@ void volPointInterpolation::interpolate { if (debug) { - Info<< "volPointInterpolation::interpolate(" + Pout<< "volPointInterpolation::interpolate(" << "const GeometricField<Type, fvPatchField, volMesh>&, " << "GeometricField<Type, pointPatchField, pointMesh>&) : " << "interpolating field from cells to points" @@ -89,7 +282,7 @@ void volPointInterpolation::interpolate interpolateInternalField(vf, pf); // Interpolate to the patches preserving fixed value BCs - boundaryInterpolator_.interpolate(vf, pf, false); + interpolateBoundaryField(vf, pf, false); } @@ -101,23 +294,7 @@ volPointInterpolation::interpolate const wordList& patchFieldTypes ) const { - wordList types(patchFieldTypes); - - const pointMesh& pMesh = pointMesh::New(vf.mesh()); - - // If the last patch of the pointBoundaryMesh is the global patch - // it must be added to the list of patchField types - if - ( - isType<globalPointPatch> - ( - pMesh.boundary()[pMesh.boundary().size() - 1] - ) - ) - { - types.setSize(types.size() + 1); - types[types.size()-1] = pMesh.boundary()[types.size()-1].type(); - } + const pointMesh& pm = pointMesh::New(vf.mesh()); // Construct tmp<pointField> tmp<GeometricField<Type, pointPatchField, pointMesh> > tpf @@ -128,18 +305,18 @@ volPointInterpolation::interpolate ( "volPointInterpolate(" + vf.name() + ')', vf.instance(), - pMesh.thisDb() + pm.thisDb() ), - pMesh, + pm, vf.dimensions(), - types + patchFieldTypes ) ); interpolateInternalField(vf, tpf()); // Interpolate to the patches overriding fixed value BCs - boundaryInterpolator_.interpolate(vf, tpf(), true); + interpolateBoundaryField(vf, tpf(), true); return tpf; } @@ -186,7 +363,7 @@ volPointInterpolation::interpolate ); interpolateInternalField(vf, tpf()); - boundaryInterpolator_.interpolate(vf, tpf(), false); + interpolateBoundaryField(vf, tpf(), false); return tpf; } diff --git a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.C b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.C index 0c9235021d2db8520c5abe19b3b8540b26ed0874..7338bb232b9977c11a3122ffdcb5f68a800e05ea 100644 --- a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.C +++ b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.C @@ -44,15 +44,114 @@ defineTypeNameAndDebug(volPointInterpolation, 0); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void volPointInterpolation::makeWeights() +void volPointInterpolation::calcBoundaryAddressing() { if (debug) { - Info<< "volPointInterpolation::makeWeights() : " - << "constructing weighting factors" + Pout<< "volPointInterpolation::calcBoundaryAddressing() : " + << "constructing boundary addressing" << endl; } + boundaryPtr_.reset + ( + new primitivePatch + ( + SubList<face> + ( + mesh().faces(), + mesh().nFaces()-mesh().nInternalFaces(), + mesh().nInternalFaces() + ), + mesh().points() + ) + ); + const primitivePatch& boundary = boundaryPtr_(); + + boundaryIsPatchFace_.setSize(boundary.size()); + boundaryIsPatchFace_ = false; + + isPatchPoint_.setSize(mesh().nPoints()); + isPatchPoint_ = false; + + const polyBoundaryMesh& pbm = mesh().boundaryMesh(); + + forAll(pbm, patchI) + { + const polyPatch& pp = pbm[patchI]; + + if (!isA<emptyPolyPatch>(pp) && !pp.coupled()) + { + label bFaceI = pp.start()-mesh().nInternalFaces(); + + forAll(pp, i) + { + boundaryIsPatchFace_[bFaceI] = true; + + const face& f = boundary[bFaceI++]; + + forAll(f, fp) + { + isPatchPoint_[f[fp]] = true; + } + } + } + } + + // Make sure point status is synchronised so even processor that holds + // no face of a certain patch still can have boundary points marked. + if (debug) + { + + boolList oldData(isPatchPoint_); + + mesh().globalData().syncPointData(isPatchPoint_, orEqOp<bool>()); + + forAll(isPatchPoint_, pointI) + { + if (isPatchPoint_[pointI] != oldData[pointI]) + { + Pout<< "volPointInterpolation::calcBoundaryAddressing():" + << " added dangling mesh point:" << pointI + << " at:" << mesh().points()[pointI] + << endl; + } + } + + label nPatchFace = 0; + forAll(boundaryIsPatchFace_, i) + { + if (boundaryIsPatchFace_[i]) + { + nPatchFace++; + } + } + label nPatchPoint = 0; + forAll(isPatchPoint_, i) + { + if (isPatchPoint_[i]) + { + nPatchPoint++; + } + } + Pout<< "boundary:" << nl + << " faces :" << boundary.size() << nl + << " of which on proper patch:" << nPatchFace << nl + << " points:" << boundary.nPoints() << nl + << " of which on proper patch:" << nPatchPoint << endl; + } +} + + +void volPointInterpolation::makeInternalWeights(scalarField& sumWeights) +{ + if (debug) + { + Pout<< "volPointInterpolation::makeInternalWeights() : " + << "constructing weighting factors for internal and non-coupled" + << " points." << endl; + } + const pointField& points = mesh().points(); const labelListList& pointCells = mesh().pointCells(); const vectorField& cellCentres = mesh().cellCentres(); @@ -61,11 +160,91 @@ void volPointInterpolation::makeWeights() pointWeights_.clear(); pointWeights_.setSize(points.size()); - forAll(pointWeights_, pointi) + // Calculate inverse distances between cell centres and points + // and store in weighting factor array + forAll(points, pointi) { - pointWeights_[pointi].setSize(pointCells[pointi].size()); + if (!isPatchPoint_[pointi]) + { + const labelList& pcp = pointCells[pointi]; + + scalarList& pw = pointWeights_[pointi]; + pw.setSize(pcp.size()); + + forAll(pcp, pointCelli) + { + pw[pointCelli] = + 1.0/mag(points[pointi] - cellCentres[pcp[pointCelli]]); + + sumWeights[pointi] += pw[pointCelli]; + } + } + } +} + + +void volPointInterpolation::makeBoundaryWeights(scalarField& sumWeights) +{ + if (debug) + { + Pout<< "volPointInterpolation::makeBoundaryWeights() : " + << "constructing weighting factors for boundary points." << endl; } + const pointField& points = mesh().points(); + const pointField& faceCentres = mesh().faceCentres(); + + const primitivePatch& boundary = boundaryPtr_(); + + boundaryPointWeights_.clear(); + boundaryPointWeights_.setSize(boundary.meshPoints().size()); + + forAll(boundary.meshPoints(), i) + { + label pointI = boundary.meshPoints()[i]; + + if (isPatchPoint_[pointI]) + { + const labelList& pFaces = boundary.pointFaces()[i]; + + scalarList& pw = boundaryPointWeights_[i]; + pw.setSize(pFaces.size()); + + sumWeights[pointI] = 0.0; + + forAll(pFaces, i) + { + if (boundaryIsPatchFace_[pFaces[i]]) + { + label faceI = mesh().nInternalFaces() + pFaces[i]; + + pw[i] = 1.0/mag(points[pointI] - faceCentres[faceI]); + sumWeights[pointI] += pw[i]; + } + else + { + pw[i] = 0.0; + } + } + } + } +} + + +void volPointInterpolation::makeWeights() +{ + if (debug) + { + Pout<< "volPointInterpolation::makeWeights() : " + << "constructing weighting factors" + << endl; + } + + // Update addressing over all boundary faces + calcBoundaryAddressing(); + + + // Running sum of weights pointScalarField sumWeights ( IOobject @@ -78,60 +257,344 @@ void volPointInterpolation::makeWeights() dimensionedScalar("zero", dimless, 0) ); - // Calculate inverse distances between cell centres and points - // and store in weighting factor array - forAll(points, pointi) + + // Create internal weights; add to sumWeights + makeInternalWeights(sumWeights); + + + // Create boundary weights; add to sumWeights + makeBoundaryWeights(sumWeights); + + + //forAll(boundary.meshPoints(), i) + //{ + // label pointI = boundary.meshPoints()[i]; + // + // if (isPatchPoint_[pointI]) + // { + // Pout<< "Calculated Weight at boundary point:" << i + // << " at:" << mesh().points()[pointI] + // << " sumWeight:" << sumWeights[pointI] + // << " from:" << boundaryPointWeights_[i] + // << endl; + // } + //} + + + // Sum collocated contributions + mesh().globalData().syncPointData(sumWeights, plusEqOp<scalar>()); + + // And add separated contributions + addSeparated(sumWeights); + + // Push master data to slaves. It is possible (not sure how often) for + // a coupled point to have its master on a different patch so + // to make sure just push master data to slaves. Reuse the syncPointData + // structure. + mesh().globalData().syncPointData(sumWeights, nopEqOp<scalar>()); + + + // Normalise internal weights + forAll(pointWeights_, pointI) { - scalarList& pw = pointWeights_[pointi]; - const labelList& pcp = pointCells[pointi]; + scalarList& pw = pointWeights_[pointI]; + // Note:pw only sized for !isPatchPoint + forAll(pw, i) + { + pw[i] /= sumWeights[pointI]; + } + } - forAll(pcp, pointCelli) + // Normalise boundary weights + const primitivePatch& boundary = boundaryPtr_(); + + forAll(boundary.meshPoints(), i) + { + label pointI = boundary.meshPoints()[i]; + + scalarList& pw = boundaryPointWeights_[i]; + // Note:pw only sized for isPatchPoint + forAll(pw, i) { - pw[pointCelli] = - 1.0/mag(points[pointi] - cellCentres[pcp[pointCelli]]); + pw[i] /= sumWeights[pointI]; + } + } - sumWeights[pointi] += pw[pointCelli]; + + if (debug) + { + Pout<< "volPointInterpolation::makeWeights() : " + << "finished constructing weighting factors" + << endl; + } +} + + +void volPointInterpolation::makePatchPatchAddressing() +{ + if (debug) + { + Pout<< "volPointInterpolation::makePatchPatchAddressing() : " + << "constructing boundary addressing" + << endl; + } + + const fvBoundaryMesh& bm = mesh().boundary(); + const pointBoundaryMesh& pbm = pointMesh::New(mesh()).boundary(); + + + // first count the total number of patch-patch points + + label nPatchPatchPoints = 0; + + forAll(bm, patchi) + { + if (!isA<emptyFvPatch>(bm[patchi]) && !bm[patchi].coupled()) + { + nPatchPatchPoints += bm[patchi].patch().boundaryPoints().size(); + + if (debug) + { + Pout<< "On patch:" << bm[patchi].patch() + << " nBoundaryPoints:" + << bm[patchi].patch().boundaryPoints().size() << endl; + } } } - forAll(sumWeights.boundaryField(), patchi) + if (debug) { - if (sumWeights.boundaryField()[patchi].coupled()) + Pout<< "Found nPatchPatchPoints:" << nPatchPatchPoints << endl; + } + + + // Go through all patches and mark up the external edge points + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + // From meshpoint to index in patchPatchPointConstraints. + Map<label> patchPatchPointSet(2*nPatchPatchPoints); + + // Constraints (initialised to unconstrained) + List<pointConstraint> patchPatchPointConstraints(nPatchPatchPoints); + + // From constraint index to mesh point + labelList patchPatchPoints(nPatchPatchPoints); + + label pppi = 0; + + forAll(bm, patchi) + { + if (!isA<emptyFvPatch>(bm[patchi]) && !bm[patchi].coupled()) { - refCast<coupledPointPatchScalarField> - (sumWeights.boundaryField()[patchi]).initSwapAdd + const labelList& bp = bm[patchi].patch().boundaryPoints(); + const labelList& meshPoints = bm[patchi].patch().meshPoints(); + + forAll(bp, pointi) + { + label ppp = meshPoints[bp[pointi]]; + + Map<label>::iterator iter = patchPatchPointSet.find(ppp); + + label constraintI = -1; + + if (iter == patchPatchPointSet.end()) + { + patchPatchPointSet.insert(ppp, pppi); + patchPatchPoints[pppi] = ppp; + constraintI = pppi++; + } + else + { + constraintI = iter(); + } + + // Apply to patch constraints + pbm[patchi].applyConstraint ( - sumWeights.internalField() + bp[pointi], + patchPatchPointConstraints[constraintI] ); + } } } - forAll(sumWeights.boundaryField(), patchi) + if (debug) + { + Pout<< "Have (local) constrained points:" + << nPatchPatchPoints << endl; + } + + + // Extend set with constraints across coupled points + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + { - if (sumWeights.boundaryField()[patchi].coupled()) + const globalMeshData& gd = mesh().globalData(); + const labelListList& globalPointSlaves = gd.globalPointSlaves(); + const mapDistribute& globalPointSlavesMap = gd.globalPointSlavesMap(); + const Map<label>& cpPointMap = gd.coupledPatch().meshPointMap(); + const labelList& cpMeshPoints = gd.coupledPatch().meshPoints(); + + // Constraints on coupled points + List<pointConstraint> constraints + ( + globalPointSlavesMap.constructSize() + ); + + // Copy from patchPatch constraints into coupledConstraints. + forAll(bm, patchi) { - refCast<coupledPointPatchScalarField> - (sumWeights.boundaryField()[patchi]).swapAdd - ( - sumWeights.internalField() - ); + if (!isA<emptyFvPatch>(bm[patchi]) && !bm[patchi].coupled()) + { + const labelList& bp = bm[patchi].patch().boundaryPoints(); + const labelList& meshPoints = bm[patchi].patch().meshPoints(); + + forAll(bp, pointi) + { + label ppp = meshPoints[bp[pointi]]; + + Map<label>::const_iterator fnd = cpPointMap.find(ppp); + if (fnd != cpPointMap.end()) + { + // Can just copy (instead of apply) constraint + // will already be consistent across multiple patches. + constraints[fnd()] = patchPatchPointConstraints + [ + patchPatchPointSet[ppp] + ]; + } + } + } + } + + // Exchange data + globalPointSlavesMap.distribute(constraints); + + // Combine master with slave constraints + forAll(globalPointSlaves, pointI) + { + const labelList& slaves = globalPointSlaves[pointI]; + + // Combine master constraint with slave constraints + forAll(slaves, i) + { + constraints[pointI].combine(constraints[slaves[i]]); + } + // Duplicate master constraint into slave slots + forAll(slaves, i) + { + constraints[slaves[i]] = constraints[pointI]; + } + } + + // Send back + globalPointSlavesMap.reverseDistribute + ( + cpMeshPoints.size(), + constraints + ); + + // Add back into patchPatch constraints + forAll(constraints, coupledPointI) + { + if (constraints[coupledPointI].first() != 0) + { + label meshPointI = cpMeshPoints[coupledPointI]; + + Map<label>::iterator iter = patchPatchPointSet.find(meshPointI); + + label constraintI = -1; + + if (iter == patchPatchPointSet.end()) + { + //Pout<< "on meshpoint:" << meshPointI + // << " coupled:" << coupledPointI + // << " at:" << mesh().points()[meshPointI] + // << " have new constraint:" + // << constraints[coupledPointI] + // << endl; + + // Allocate new constraint + if (patchPatchPoints.size() <= pppi) + { + patchPatchPoints.setSize(pppi+100); + } + patchPatchPointSet.insert(meshPointI, pppi); + patchPatchPoints[pppi] = meshPointI; + constraintI = pppi++; + } + else + { + //Pout<< "on meshpoint:" << meshPointI + // << " coupled:" << coupledPointI + // << " at:" << mesh().points()[meshPointI] + // << " have possibly extended constraint:" + // << constraints[coupledPointI] + // << endl; + + constraintI = iter(); + } + + // Combine (new or existing) constraint with one + // on coupled. + patchPatchPointConstraints[constraintI].combine + ( + constraints[coupledPointI] + ); + } } } - forAll(points, pointi) + + + nPatchPatchPoints = pppi; + patchPatchPoints.setSize(nPatchPatchPoints); + patchPatchPointConstraints.setSize(nPatchPatchPoints); + + + if (debug) { - scalarList& pw = pointWeights_[pointi]; + Pout<< "Have (global) constrained points:" + << nPatchPatchPoints << endl; + } + + + // Copy out all non-trivial constraints + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - forAll(pw, pointCelli) + patchPatchPointConstraintPoints_.setSize(nPatchPatchPoints); + patchPatchPointConstraintTensors_.setSize(nPatchPatchPoints); + + label nConstraints = 0; + + forAll(patchPatchPointConstraints, i) + { + if (patchPatchPointConstraints[i].first() != 0) { - pw[pointCelli] /= sumWeights[pointi]; + patchPatchPointConstraintPoints_[nConstraints] = + patchPatchPoints[i]; + + patchPatchPointConstraintTensors_[nConstraints] = + patchPatchPointConstraints[i].constraintTransformation(); + + nConstraints++; } } if (debug) { - Info<< "volPointInterpolation::makeWeights() : " - << "finished constructing weighting factors" + Pout<< "Have non-trivial constrained points:" + << nConstraints << endl; + } + + patchPatchPointConstraintPoints_.setSize(nConstraints); + patchPatchPointConstraintTensors_.setSize(nConstraints); + + + if (debug) + { + Pout<< "volPointInterpolation::makePatchPatchAddressing() : " + << "finished constructing boundary addressing" << endl; } } @@ -141,8 +604,7 @@ void volPointInterpolation::makeWeights() volPointInterpolation::volPointInterpolation(const fvMesh& vm) : - MeshObject<fvMesh, volPointInterpolation>(vm), - boundaryInterpolator_(vm) + MeshObject<fvMesh, volPointInterpolation>(vm) { updateMesh(); } @@ -159,19 +621,27 @@ volPointInterpolation::~volPointInterpolation() void volPointInterpolation::updateMesh() { makeWeights(); - boundaryInterpolator_.updateMesh(); } bool volPointInterpolation::movePoints() { makeWeights(); - boundaryInterpolator_.movePoints(); return true; } +// Specialisaion of applyCornerConstraints for scalars because +// no constraint need be applied +template<> +void volPointInterpolation::applyCornerConstraints<scalar> +( + GeometricField<scalar, pointPatchField, pointMesh>& pf +) const +{} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.H b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.H index d5772c8c3c41744ac54e14749630129f964aa964..31e499f28512b05985a15e16498b712bdbd52baa 100644 --- a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.H +++ b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.H @@ -38,7 +38,9 @@ SourceFiles #define volPointInterpolation_H #include "MeshObject.H" -#include "pointPatchInterpolation.H" +#include "scalarList.H" +#include "volFields.H" +#include "pointFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -58,18 +60,80 @@ class volPointInterpolation { // Private data - //- Boundary interpolation engine. - pointPatchInterpolation boundaryInterpolator_; - //- Interpolation scheme weighting factor array. scalarListList pointWeights_; + // Boundary handling + + //- Boundary addressing + autoPtr<primitivePatch> boundaryPtr_; + + //- Per boundary face whether is on non-coupled patch + boolList boundaryIsPatchFace_; + + //- Per mesh(!) point whether is on non-coupled patch (on any + // processor) + boolList isPatchPoint_; + + //- Per boundary point the weights per pointFaces. + scalarListList boundaryPointWeights_; + + // Patch-patch constraints + + //- Mesh points on which to apply special constraints + labelList patchPatchPointConstraintPoints_; + //- Special constraints + tensorField patchPatchPointConstraintTensors_; + + + // Private member functions - //- Construct point weighting factors + //- Construct addressing over all boundary faces + void calcBoundaryAddressing(); + + //- Make weights for internal and coupled-only boundarypoints + void makeInternalWeights(scalarField& sumWeights); + + //- Make weights for points on uncoupled patches + void makeBoundaryWeights(scalarField& sumWeights); + + //- Construct all point weighting factors void makeWeights(); + //- Make patch-patch constraints + void makePatchPatchAddressing(); + + //- Get boundary field in same order as boundary faces. Field is + // zero on all coupled and empty patches + template<class Type> + tmp<Field<Type> > flatBoundaryField + ( + const GeometricField<Type, fvPatchField, volMesh>& vf + ) const; + + template<class Type> + void interpolateBoundaryField + ( + const GeometricField<Type, fvPatchField, volMesh>& vf, + GeometricField<Type, pointPatchField, pointMesh>& pf, + const bool overrideFixedValue + ) const; + + template<class Type> + void applyCornerConstraints + ( + GeometricField<Type, pointPatchField, pointMesh>& pf + ) const; + + //- Add separated contributions + template<class Type> + void addSeparated + ( + GeometricField<Type, pointPatchField, pointMesh>& + ) const; + //- Disallow default bitwise copy construct volPointInterpolation(const volPointInterpolation&); @@ -96,14 +160,6 @@ public: // Member functions - // Access - - const fvMesh& mesh() const - { - return boundaryInterpolator_.mesh(); - } - - // Edit //- Update mesh topology using the morph engine @@ -169,6 +225,13 @@ public: }; +template<> +void volPointInterpolation::applyCornerConstraints<scalar> +( + GeometricField<scalar, pointPatchField, pointMesh>& pf +) const; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C index 5bf513341af7d22348d4441bbaaca725ab765670..eada673091954827ec941b2467b88f8a64c2552d 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C @@ -151,6 +151,34 @@ displacementComponentLaplacianFvMotionSolver : -1 ) { + if (points0_.size() != mesh.nPoints()) + { + FatalErrorIn + ( + "displacementComponentLaplacianFvMotionSolver::" + "displacementComponentLaplacianFvMotionSolver\n" + "(\n" + " const polyMesh&,\n" + " Istream&\n" + ")" + ) << "Number of points in mesh " << mesh.nPoints() + << " differs from number of points " << points0_.size() + << " read from file " + << + IOobject + ( + "points", + mesh.time().constant(), + polyMesh::meshSubDir, + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ).filePath() + << exit(FatalError); + } + + IOobject io ( "pointLocation", diff --git a/src/lagrangian/dieselSpray/parcel/parcel.C b/src/lagrangian/dieselSpray/parcel/parcel.C index c0913258454b21767a30404b33b1176fefd756ee..5c555e1940265d0647229ffc6b66c8e1c624bd04 100644 --- a/src/lagrangian/dieselSpray/parcel/parcel.C +++ b/src/lagrangian/dieselSpray/parcel/parcel.C @@ -247,7 +247,7 @@ bool Foam::parcel::move(spray& sDB) { oMass[i] = m()*oYf[i]; label j = sDB.liquidToGasIndex()[i]; - oHg += oYf[i]*sDB.gasProperties()[j].H(T()); + oHg += oYf[i]*sDB.gasProperties()[j].Hs(T()); } vector oMom = m()*U(); @@ -273,7 +273,7 @@ bool Foam::parcel::move(spray& sDB) { nMass[i] = m()*nYf[i]; label j = sDB.liquidToGasIndex()[i]; - nHg += nYf[i]*sDB.gasProperties()[j].H(T()); + nHg += nYf[i]*sDB.gasProperties()[j].Hs(T()); } vector nMom = m()*U(); @@ -286,11 +286,9 @@ bool Foam::parcel::move(spray& sDB) { sDB.srhos()[i][celli] += oMass[i] - nMass[i]; } - sDB.sms()[celli] += oMom - nMom; + sDB.sms()[celli] += oMom - nMom; - sDB.shs()[celli] += - oTotMass*(oH + oPE) - - m()*(nH + nPE); + sDB.shs()[celli] += oTotMass*(oH + oPE) - m()*(nH + nPE); // Remove evaporated mass from stripped mass ms() -= ms()*(oTotMass-m())/oTotMass; @@ -446,7 +444,7 @@ void Foam::parcel::updateParcelProperties for (label i=0; i<Nf; i++) { label j = sDB.liquidToGasIndex()[i]; - oldhg += Yf0[i]*sDB.gasProperties()[j].H(T()); + oldhg += Yf0[i]*sDB.gasProperties()[j].Hs(T()); } scalar oldhv = fuels.hl(pg, T(), X()); @@ -478,7 +476,7 @@ void Foam::parcel::updateParcelProperties for (label i=0; i<Nf; i++) { label j = sDB.liquidToGasIndex()[i]; - newhg += Ynew[i]*sDB.gasProperties()[j].H(Tnew); + newhg += Ynew[i]*sDB.gasProperties()[j].Hs(Tnew); } newhv = fuels.hl(pg, Tnew, X()); @@ -616,7 +614,8 @@ void Foam::parcel::updateParcelProperties { if (n>100) { - Info<< "n = " << n << ", T = " << Td << ", pv = " << pAtSurface << endl; + Info<< "n = " << n << ", T = " << Td << ", pv = " + << pAtSurface << endl; } } } diff --git a/src/lagrangian/dieselSpray/parcel/parcel.H b/src/lagrangian/dieselSpray/parcel/parcel.H index c6084d08ee47bd655a3d546c91eac514a1d47650..b917802927abc772d7ce529e00d01cd08108add5 100644 --- a/src/lagrangian/dieselSpray/parcel/parcel.H +++ b/src/lagrangian/dieselSpray/parcel/parcel.H @@ -185,7 +185,8 @@ public: //- Return the names of the liquid components inline const List<word>& liquidNames() const; - //- Return the names of the liquid fuel components - identical with liquidNames + //- Return the names of the liquid fuel components + // - identical with liquidNames inline const List<word>& fuelNames() const; //- Return diameter of droplets in parcel diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index f0c3c5f033d1f6c4f668359985499bd99031317e..29130c69dc7d160545531debfc9d518292e48764 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C @@ -260,6 +260,9 @@ void Foam::KinematicCloud<ParcelType>::evolve() evolveCloud(); postEvolve(); + + info(); + Info<< endl; } } diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C index 210a58990295273771899169e3a8368da5e952fd..f0ccd58f197895f55a5f9c6091f979f86bd1108a 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C @@ -272,6 +272,9 @@ void Foam::ReactingCloud<ParcelType>::evolve() evolveCloud(); postEvolve(); + + info(); + Info<< endl; } } diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C index b783cb2b0826f934080f927a9cd7b8f79c1ce3e5..3df450724bfc342545e8a9d5b006559209480d1e 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C @@ -228,6 +228,9 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::evolve() evolveCloud(); postEvolve(); + + info(); + Info<< endl; } } diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C index 0d12d286b95438090b7e657a3569ec89b78e951a..b3135ce81c9b5a0324b62629a3a1893de012499c 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C @@ -160,20 +160,6 @@ Foam::ThermoCloud<ParcelType>::ThermoCloud ), this->mesh(), dimensionedScalar("zero", dimEnergy, 0.0) - ), - hcTrans_ - ( - IOobject - ( - this->name() + "hcTrans", - this->db().time().timeName(), - this->db(), - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ), - this->mesh(), - dimensionedScalar("zero", dimEnergy, 0.0) ) { if (readFields) @@ -220,7 +206,6 @@ void Foam::ThermoCloud<ParcelType>::resetSourceTerms() { KinematicCloud<ParcelType>::resetSourceTerms(); hsTrans_.field() = 0.0; - hcTrans_.field() = 0.0; } @@ -234,6 +219,9 @@ void Foam::ThermoCloud<ParcelType>::evolve() evolveCloud(); postEvolve(); + + info(); + Info<< endl; } } diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H index c0e2d5864a0ed874b145059831cf729752cf69d1..b5d9f27b8b79de66443138530f057967fded0b82 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H @@ -108,15 +108,9 @@ protected: // Sources - //- Sensible enthalpy transfer + //- Sensible enthalpy transfer [J/kg] DimensionedField<scalar, volMesh> hsTrans_; - //- Chemical enthalpy transfer - // - If solving for total enthalpy, the carrier phase enthalpy will - // receive the full enthalpy of reaction via creation of reaction - // products - DimensionedField<scalar, volMesh> hcTrans_; - // Protected member functions @@ -194,19 +188,10 @@ public: // Enthalpy - //- Return reference to sensible enthalpy source + //- Sensible enthalpy transfer [J/kg] inline DimensionedField<scalar, volMesh>& hsTrans(); - //- Return tmp total sensible enthalpy source term - inline tmp<DimensionedField<scalar, volMesh> > Shs() const; - - //- Return reference to chemical enthalpy source - inline DimensionedField<scalar, volMesh>& hcTrans(); - - //- Return tmp chemical enthalpy source term - inline tmp<DimensionedField<scalar, volMesh> > Shc() const; - - //- Return tmp total enthalpy source term + //- Return enthalpy source [J/kg/m3/s] inline tmp<DimensionedField<scalar, volMesh> > Sh() const; diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H index f537f6283adf7776f014abc1226da51b07acd183..249906311dd3eee28f33434df6f11765c9bc93db 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H @@ -85,82 +85,6 @@ Foam::ThermoCloud<ParcelType>::hsTrans() } -template<class ParcelType> -inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> > -Foam::ThermoCloud<ParcelType>::Shs() const -{ - tmp<DimensionedField<scalar, volMesh> > tShs - ( - new DimensionedField<scalar, volMesh> - ( - IOobject - ( - this->name() + "Shs", - this->db().time().timeName(), - this->mesh(), - IOobject::NO_READ, - IOobject::AUTO_WRITE, - false - ), - this->mesh(), - dimensionedScalar - ( - "zero", - dimMass/dimLength/pow3(dimTime), - 0.0 - ) - ) - ); - - scalarField& Shs = tShs().field(); - Shs = hsTrans_/(this->mesh().V()*this->db().time().deltaT()); - - return tShs; -} - - -template<class ParcelType> -inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>& -Foam::ThermoCloud<ParcelType>::hcTrans() -{ - return hcTrans_; -} - - -template<class ParcelType> -inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> > -Foam::ThermoCloud<ParcelType>::Shc() const -{ - tmp<DimensionedField<scalar, volMesh> > tShc - ( - new DimensionedField<scalar, volMesh> - ( - IOobject - ( - this->name() + "Shc", - this->db().time().timeName(), - this->mesh(), - IOobject::NO_READ, - IOobject::AUTO_WRITE, - false - ), - this->mesh(), - dimensionedScalar - ( - "zero", - dimMass/dimLength/pow3(dimTime), - 0.0 - ) - ) - ); - - scalarField& Shc = tShc().field(); - Shc = hcTrans_/(this->mesh().V()*this->db().time().deltaT()); - - return tShc; -} - - template<class ParcelType> inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> > Foam::ThermoCloud<ParcelType>::Sh() const @@ -178,19 +102,10 @@ Foam::ThermoCloud<ParcelType>::Sh() const IOobject::AUTO_WRITE, false ), - this->mesh(), - dimensionedScalar - ( - "zero", - dimMass/dimLength/pow3(dimTime), - 0.0 - ) + hsTrans_/(this->mesh().V()*this->db().time().deltaT()) ) ); - scalarField& Sh = tSh().field(); - Sh = (hsTrans_ + hcTrans_)/(this->mesh().V()*this->db().time().deltaT()); - return tSh; } @@ -205,7 +120,7 @@ Foam::ThermoCloud<ParcelType>::Ep() const ( IOobject ( - this->name() + "radiationEp", + this->name() + "radiation::Ep", this->db().time().timeName(), this->db(), IOobject::NO_READ, @@ -248,7 +163,7 @@ Foam::ThermoCloud<ParcelType>::ap() const ( IOobject ( - this->name() + "radiationAp", + this->name() + "radiation::ap", this->db().time().timeName(), this->db(), IOobject::NO_READ, @@ -291,7 +206,7 @@ Foam::ThermoCloud<ParcelType>::sigmap() const ( IOobject ( - this->name() + "radiationSigmap", + this->name() + "radiation::sigmap", this->db().time().timeName(), this->db(), IOobject::NO_READ, diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C index c1914e5ed50eb5616717a6fa26ba9b30d3b1e784..8d32c6a70996e6d9854b7f377db7dfe92ad76b4d 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C @@ -267,7 +267,6 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc YLiquid_, dMassPC, Sh, - dhsTrans, Ne, NCpW, Cs @@ -296,7 +295,6 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc canCombust_, dMassDV, Sh, - dhsTrans, Ne, NCpW, Cs @@ -398,19 +396,11 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc { label gid = td.cloud().composition().localToGlobalCarrierId(GAS, i); td.cloud().rhoTrans(gid)[cellI] += np0*dMassGas[i]; - td.cloud().hcTrans()[cellI] += - np0 - *dMassGas[i] - *td.cloud().mcCarrierThermo().speciesData()[gid].Hc(); } forAll(YLiquid_, i) { label gid = td.cloud().composition().localToGlobalCarrierId(LIQ, i); td.cloud().rhoTrans(gid)[cellI] += np0*dMassLiquid[i]; - td.cloud().hcTrans()[cellI] += - np0 - *dMassLiquid[i] - *td.cloud().mcCarrierThermo().speciesData()[gid].Hc(); } /* // No mapping between solid components and carrier phase @@ -418,19 +408,11 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc { label gid = td.cloud().composition().localToGlobalCarrierId(SLD, i); td.cloud().rhoTrans(gid)[cellI] += np0*dMassSolid[i]; - td.cloud().hcTrans()[cellI] += - np0 - *dMassSolid[i] - *td.cloud().mcCarrierThermo().speciesData()[gid].Hc(); } */ forAll(dMassSRCarrier, i) { td.cloud().rhoTrans(i)[cellI] += np0*dMassSRCarrier[i]; - td.cloud().hcTrans()[cellI] += - np0 - *dMassSRCarrier[i] - *td.cloud().mcCarrierThermo().speciesData()[i].Hc(); } // Update momentum transfer @@ -476,7 +458,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc */ td.cloud().UTrans()[cellI] += np0*mass1*U1; td.cloud().hsTrans()[cellI] += - np0*mass1*HEff(td, pc, T1, idG, idL, idS); + np0*mass1*HEff(td, pc, T1, idG, idL, idS); // using total h } } @@ -520,7 +502,6 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcDevolatilisation bool& canCombust, scalarField& dMassDV, scalar& Sh, - scalar& dhsTrans, scalar& N, scalar& NCpW, scalarField& Cs diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H index 1bc1ee99d73136a48dbbb4311814d98148c70f44..3951688cc30576da96fcd1c6f7683f85b538dc2d 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H @@ -238,7 +238,6 @@ protected: bool& canCombust, // 'can combust' flag scalarField& dMassDV, // mass transfer - local to particle scalar& Sh, // explicit particle enthalpy source - scalar& dhsTrans, // sensible enthalpy transfer to carrier scalar& N, // flux of species emitted from particle scalar& NCpW, // sum of N*Cp*W of emission species scalarField& Cs // carrier conc. of emission species diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C index 92525ea2b1d96bb4a375acd4d7c888287d1eb6f5..edfb377176245dea9bbfe81ca8fdcea7d153ff9f 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C @@ -287,7 +287,6 @@ void Foam::ReactingParcel<ParcelType>::calc Y_, dMassPC, Sh, - dhsTrans, Ne, NCpW, Cs @@ -341,10 +340,6 @@ void Foam::ReactingParcel<ParcelType>::calc { label gid = td.cloud().composition().localToGlobalCarrierId(0, i); td.cloud().rhoTrans(gid)[cellI] += np0*dMassPC[i]; - td.cloud().hcTrans()[cellI] += - np0 - *dMassPC[i] - *td.cloud().mcCarrierThermo().speciesData()[gid].Hc(); } // Update momentum transfer @@ -371,7 +366,7 @@ void Foam::ReactingParcel<ParcelType>::calc td.cloud().rhoTrans(gid)[cellI] += np0*mass1*Y_[i]; } td.cloud().UTrans()[cellI] += np0*mass1*U1; - td.cloud().hcTrans()[cellI] += + td.cloud().hsTrans()[cellI] += np0*mass1*td.cloud().composition().H(0, Y_, pc_, T1); } } @@ -417,7 +412,6 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange const scalarField& YComponents, scalarField& dMassPC, scalar& Sh, - scalar& dhsTrans, // TODO: not used scalar& N, scalar& NCpW, scalarField& Cs @@ -469,6 +463,7 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange td.cloud().composition().localToGlobalCarrierId(idPhase, i); const label idl = td.cloud().composition().globalIds(idPhase)[i]; + // Calculate enthalpy transfer if ( td.cloud().phaseChange().enthalpyTransfer() diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H index 41d7c6d30c224fe87011cee76cadb0a583d99eac..1c7ed466d2cbd2bfe46b06b149544b0bb3c54af2 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H @@ -209,7 +209,6 @@ protected: const scalarField& YComponents, // component mass fractions scalarField& dMassPC, // mass transfer - local to particle scalar& Sh, // explicit particle enthalpy source - scalar& dhsTrans, // sensible enthalpy transfer to carrier scalar& N, // flux of species emitted from particle scalar& NCpW, // sum of N*Cp*W of emission species scalarField& Cs // carrier conc. of emission species diff --git a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C index 6ae3dabb6fd1ab3ac3efac2f5526adee30e0f3d1..e06b4925bef95542756404767b778d94d5eb03c5 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C +++ b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C @@ -410,6 +410,130 @@ Foam::scalar Foam::CompositionModel<CloudType>::H } +template<class CloudType> +Foam::scalar Foam::CompositionModel<CloudType>::Hs +( + const label phaseI, + const scalarField& Y, + const scalar p, + const scalar T +) const +{ + const phaseProperties& props = phaseProps_[phaseI]; + scalar HsMixture = 0.0; + switch (props.phase()) + { + case phaseProperties::GAS: + { + forAll(Y, i) + { + label gid = props.globalIds()[i]; + HsMixture += Y[i]*mcCarrierThermo_.speciesData()[gid].Hs(T); + } + break; + } + case phaseProperties::LIQUID: + { + forAll(Y, i) + { + label gid = props.globalIds()[i]; + HsMixture += + Y[i] + *( + this->liquids().properties()[gid].h(p, T) + - this->liquids().properties()[gid].h(p, 298.25) + ); + } + break; + } + case phaseProperties::SOLID: + { + forAll(Y, i) + { + label gid = props.globalIds()[i]; + HsMixture += Y[i]*this->solids().properties()[gid].cp()*T; + } + break; + } + default: + { + FatalErrorIn + ( + "Foam::scalar Foam::CompositionModel<CloudType>::Hs" + "(" + " const label, " + " const scalarField&, " + " const scalar, " + " const scalar" + ") const" + ) << "Unknown phase enumeration" << nl << abort(FatalError); + } + } + + return HsMixture; +} + + +template<class CloudType> +Foam::scalar Foam::CompositionModel<CloudType>::Hc +( + const label phaseI, + const scalarField& Y, + const scalar p, + const scalar T +) const +{ + const phaseProperties& props = phaseProps_[phaseI]; + scalar HcMixture = 0.0; + switch (props.phase()) + { + case phaseProperties::GAS: + { + forAll(Y, i) + { + label gid = props.globalIds()[i]; + HcMixture += Y[i]*mcCarrierThermo_.speciesData()[gid].Hc(); + } + break; + } + case phaseProperties::LIQUID: + { + forAll(Y, i) + { + label gid = props.globalIds()[i]; + HcMixture += + Y[i]*this->liquids().properties()[gid].h(p, 298.15); + } + break; + } + case phaseProperties::SOLID: + { + forAll(Y, i) + { + label gid = props.globalIds()[i]; + HcMixture += Y[i]*this->solids().properties()[gid].Hf(); + } + break; + } + default: + { + FatalErrorIn + ( + "Foam::scalar Foam::CompositionModel<CloudType>::Hc" + "(" + " const label, " + " const scalarField&, " + " const scalar, " + " const scalar" + ") const" + ) << "Unknown phase enumeration" << nl << abort(FatalError); + } + } + + return HcMixture; +} + + template<class CloudType> Foam::scalar Foam::CompositionModel<CloudType>::cp ( diff --git a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H index b3f0949defcc84b06f7f8c4b4b0a9ff900d1b079..a3a8e9c724ad14b240609f9033f38b2fb9559e83 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H +++ b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H @@ -226,7 +226,7 @@ public: // Evaluation - //- Return enthalpy for the phase phaseI + //- Return total enthalpy for the phase phaseI virtual scalar H ( const label phaseI, @@ -235,6 +235,24 @@ public: const scalar T ) const; + //- Return sensible enthalpy for the phase phaseI + virtual scalar Hs + ( + const label phaseI, + const scalarField& Y, + const scalar p, + const scalar T + ) const; + + //- Return chemical enthalpy for the phase phaseI + virtual scalar Hc + ( + const label phaseI, + const scalarField& Y, + const scalar p, + const scalar T + ) const; + //- Return specific heat caoacity for the phase phaseI virtual scalar cp ( diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C index c4ea71f4346f7757813e5e22f67407c423872d98..daebc4306368d4924756645fbe7f94b0411d197f 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C @@ -44,7 +44,6 @@ License #include "pointFields.H" #include "slipPointPatchFields.H" #include "fixedValuePointPatchFields.H" -#include "globalPointPatchFields.H" #include "calculatedPointPatchFields.H" #include "processorPointPatch.H" #include "globalIndex.H" @@ -1409,11 +1408,7 @@ Foam::tmp<Foam::pointVectorField> Foam::meshRefinement::makeDisplacementField forAll(pointPatches, patchI) { - if (isA<globalPointPatch>(pointPatches[patchI])) - { - patchFieldTypes[patchI] = globalPointPatchVectorField::typeName; - } - else if (isA<processorPointPatch>(pointPatches[patchI])) + if (isA<processorPointPatch>(pointPatches[patchI])) { patchFieldTypes[patchI] = calculatedPointPatchVectorField::typeName; } diff --git a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H b/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H index 429d6ef8effe190a914f140dafc7f49cc9c2459b..3ed390c307818e177ace26cc5659696a411d080a 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H +++ b/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H @@ -65,6 +65,7 @@ Deprecated Specifying the local vectors as an @c axis (corresponding to e3) and a @c direction (corresponding to e1), is allowed for backwards compatibility, but this terminology is generally a bit confusing. + (deprecated Apr 2008) \*---------------------------------------------------------------------------*/ diff --git a/src/meshTools/coordinateSystems/coordinateSystem.H b/src/meshTools/coordinateSystems/coordinateSystem.H index cfdecfd398e35f3ede00c2a6936aff138b6c9ab4..61dadf278f2f11a1579e75530c1a1cbd3a0ae3c4 100644 --- a/src/meshTools/coordinateSystems/coordinateSystem.H +++ b/src/meshTools/coordinateSystems/coordinateSystem.H @@ -365,14 +365,14 @@ public: } //- Return axis (e3: local Cartesian z-axis) - // @deprecated method e3 is preferred + // @deprecated method e3 is preferred (deprecated Apr 2008) const vector& axis() const { return Rtr_.z(); } //- Return direction (e1: local Cartesian x-axis) - // @deprecated method e1 is preferred + // @deprecated method e1 is preferred (deprecated Apr 2008) const vector& direction() const { return Rtr_.x(); diff --git a/src/meshTools/triSurface/booleanOps/booleanSurface/booleanSurface.C b/src/meshTools/triSurface/booleanOps/booleanSurface/booleanSurface.C index fdccecf61778000882eeb37d6a50135ae62956f6..8839badd67760d4720036c47b629797a26868ce6 100644 --- a/src/meshTools/triSurface/booleanOps/booleanSurface/booleanSurface.C +++ b/src/meshTools/triSurface/booleanOps/booleanSurface/booleanSurface.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 @@ -411,9 +411,8 @@ Foam::booleanSurface::booleanSurface Pout<< "booleanSurface : Generated cutSurf1: " << endl; cutSurf1.writeStats(Pout); - Pout<< "Writing to file cutSurf1.ftr" << endl; - OFstream cutSurf1Stream("cutSurf1.ftr"); - cutSurf1.write(cutSurf1Stream); + Pout<< "Writing to file cutSurf1.obj" << endl; + cutSurf1.write("cutSurf1.obj"); } if (debug) @@ -430,9 +429,8 @@ Foam::booleanSurface::booleanSurface Pout<< "booleanSurface : Generated cutSurf2: " << endl; cutSurf2.writeStats(Pout); - Pout<< "Writing to file cutSurf2.ftr" << endl; - OFstream cutSurf2Stream("cutSurf2.ftr"); - cutSurf2.write(cutSurf2Stream); + Pout<< "Writing to file cutSurf2.obj" << endl; + cutSurf2.write("cutSurf2.obj"); } @@ -768,9 +766,8 @@ Foam::booleanSurface::booleanSurface Pout<< "booleanSurface : Generated cutSurf1: " << endl; cutSurf1.writeStats(Pout); - Pout<< "Writing to file cutSurf1.ftr" << endl; - OFstream cutSurf1Stream("cutSurf1.ftr"); - cutSurf1.write(cutSurf1Stream); + Pout<< "Writing to file cutSurf1.obj" << endl; + cutSurf1.write("cutSurf1.obj"); } @@ -792,9 +789,8 @@ Foam::booleanSurface::booleanSurface Pout<< "booleanSurface : Generated cutSurf2: " << endl; cutSurf2.writeStats(Pout); - Pout<< "Writing to file cutSurf2.ftr" << endl; - OFstream cutSurf2Stream("cutSurf2.ftr"); - cutSurf2.write(cutSurf2Stream); + Pout<< "Writing to file cutSurf2.obj" << endl; + cutSurf2.write("cutSurf2.obj"); } @@ -920,9 +916,8 @@ Foam::booleanSurface::booleanSurface Pout<< "booleanSurface : Generated combinedSurf: " << endl; combinedSurf.writeStats(Pout); - Pout<< "Writing to file combinedSurf.ftr" << endl; - OFstream combinedSurfStream("combinedSurf.ftr"); - combinedSurf.write(combinedSurfStream); + Pout<< "Writing to file combinedSurf.obj" << endl; + combinedSurf.write("combinedSurf.obj"); } diff --git a/src/parallel/reconstruct/pointFieldReconstructor.H b/src/parallel/reconstruct/pointFieldReconstructor.H index 7ab04c3d41d69cafc49df1016a397cda2019e0cb..3be8ba3a7a76ebdf50883cb912552bc963fde162 100644 --- a/src/parallel/reconstruct/pointFieldReconstructor.H +++ b/src/parallel/reconstruct/pointFieldReconstructor.H @@ -138,7 +138,11 @@ public: //- Reconstruct and write all fields template<class Type> - void reconstructFields(const IOobjectList& objects); + void reconstructFields + ( + const IOobjectList& objects, + const HashSet<word>& selectedFields + ); }; diff --git a/src/parallel/reconstruct/pointFieldReconstructorReconstructFields.C b/src/parallel/reconstruct/pointFieldReconstructorReconstructFields.C index c96fcfa7edbc14770fcc0110dc92a38fb8610efe..9b8e161483415000930c0d756aa53ab383642160 100644 --- a/src/parallel/reconstruct/pointFieldReconstructorReconstructFields.C +++ b/src/parallel/reconstruct/pointFieldReconstructorReconstructFields.C @@ -143,7 +143,8 @@ Foam::pointFieldReconstructor::reconstructField(const IOobject& fieldIoObject) template<class Type> void Foam::pointFieldReconstructor::reconstructFields ( - const IOobjectList& objects + const IOobjectList& objects, + const HashSet<word>& selectedFields ) { word fieldClassName @@ -157,16 +158,18 @@ void Foam::pointFieldReconstructor::reconstructFields { Info<< " Reconstructing " << fieldClassName << "s\n" << endl; - for - ( - IOobjectList::iterator fieldIter = fields.begin(); - fieldIter != fields.end(); - ++fieldIter - ) + forAllConstIter(IOobjectList, fields, fieldIter) { - Info<< " " << fieldIter()->name() << endl; + if + ( + !selectedFields.size() + || selectedFields.found(fieldIter()->name()) + ) + { + Info<< " " << fieldIter()->name() << endl; - reconstructField<Type>(*fieldIter())().write(); + reconstructField<Type>(*fieldIter())().write(); + } } Info<< endl; diff --git a/src/postProcessing/foamCalcFunctions/basic/addSubtract/addSubtract.C b/src/postProcessing/foamCalcFunctions/basic/addSubtract/addSubtract.C index ca0c0a757857d417846eed1ce3f3e2ca836d0703..9859d56546235d67a4717da5ebc2798d90cd9d3b 100644 --- a/src/postProcessing/foamCalcFunctions/basic/addSubtract/addSubtract.C +++ b/src/postProcessing/foamCalcFunctions/basic/addSubtract/addSubtract.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -213,8 +213,8 @@ void Foam::calcTypes::addSubtract::preCalc const fvMesh& mesh ) { - baseFieldName_ = args.additionalArgs()[1]; - word calcModeName = args.additionalArgs()[2]; + baseFieldName_ = args[2]; + const word calcModeName = args[3]; if (calcModeName == "add") { @@ -232,14 +232,12 @@ void Foam::calcTypes::addSubtract::preCalc << exit(FatalError); } - if (args.optionFound("field")) + if (args.optionReadIfPresent("field", addSubtractFieldName_)) { - addSubtractFieldName_ = args.option("field"); calcType_ = FIELD; } - else if (args.optionFound("value")) + else if (args.optionReadIfPresent("value", addSubtractValueStr_)) { - addSubtractValueStr_ = args.option("value"); calcType_ = VALUE; } else @@ -249,10 +247,7 @@ void Foam::calcTypes::addSubtract::preCalc << nl << exit(FatalError); } - if (args.optionFound("resultName")) - { - resultName_ = args.option("resultName"); - } + args.optionReadIfPresent("resultName", resultName_); } diff --git a/src/postProcessing/foamCalcFunctions/field/components/components.C b/src/postProcessing/foamCalcFunctions/field/components/components.C index 35254bbca26c5d8befc4eb48a15a7163eb1dacd5..33b9013a8e99778ccb4af3601c11b2812aeaad7b 100644 --- a/src/postProcessing/foamCalcFunctions/field/components/components.C +++ b/src/postProcessing/foamCalcFunctions/field/components/components.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 @@ -78,7 +78,7 @@ void Foam::calcTypes::components::calc const fvMesh& mesh ) { - const word& fieldName = args.additionalArgs()[1]; + const word fieldName = args[2]; IOobject fieldHeader ( diff --git a/src/postProcessing/foamCalcFunctions/field/div/div.C b/src/postProcessing/foamCalcFunctions/field/div/div.C index 0b1492dc39aacda9e7635f9f8d8f95c14737a48b..e43723f8ef4b20c2c7f36476581c0c2894b18882 100644 --- a/src/postProcessing/foamCalcFunctions/field/div/div.C +++ b/src/postProcessing/foamCalcFunctions/field/div/div.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 @@ -78,7 +78,7 @@ void Foam::calcTypes::div::calc const fvMesh& mesh ) { - const word& fieldName = args.additionalArgs()[1]; + const word fieldName = args[2]; IOobject fieldHeader ( diff --git a/src/postProcessing/foamCalcFunctions/field/interpolate/interpolate.C b/src/postProcessing/foamCalcFunctions/field/interpolate/interpolate.C index 9a00b63386385521587ae612b0c83eddb9379485..f826a334e397c863efaa9d876d82f9aaf1392397 100644 --- a/src/postProcessing/foamCalcFunctions/field/interpolate/interpolate.C +++ b/src/postProcessing/foamCalcFunctions/field/interpolate/interpolate.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -78,7 +78,7 @@ void Foam::calcTypes::interpolate::calc const fvMesh& mesh ) { - const word& fieldName = args.additionalArgs()[1]; + const word fieldName = args[2]; IOobject fieldHeader ( diff --git a/src/postProcessing/foamCalcFunctions/field/mag/mag.C b/src/postProcessing/foamCalcFunctions/field/mag/mag.C index cc86e8fa89ecda6e8e0862312e5ef62467ecb5c0..dcbf964991d36953c9ba174d9fdcdfe347b7d9f0 100644 --- a/src/postProcessing/foamCalcFunctions/field/mag/mag.C +++ b/src/postProcessing/foamCalcFunctions/field/mag/mag.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 @@ -78,7 +78,7 @@ void Foam::calcTypes::mag::calc const fvMesh& mesh ) { - const word& fieldName = args.additionalArgs()[1]; + const word fieldName = args[2]; IOobject fieldHeader ( diff --git a/src/postProcessing/foamCalcFunctions/field/magGrad/magGrad.C b/src/postProcessing/foamCalcFunctions/field/magGrad/magGrad.C index 92722d917cb3712aed884d5d0d03d02f39f5e310..5e002044acedf12e0d481c148830a8e5ef8bd942 100644 --- a/src/postProcessing/foamCalcFunctions/field/magGrad/magGrad.C +++ b/src/postProcessing/foamCalcFunctions/field/magGrad/magGrad.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 @@ -78,7 +78,7 @@ void Foam::calcTypes::magGrad::calc const fvMesh& mesh ) { - const word& fieldName = args.additionalArgs()[1]; + const word fieldName = args[2]; IOobject fieldHeader ( diff --git a/src/postProcessing/foamCalcFunctions/field/magSqr/magSqr.C b/src/postProcessing/foamCalcFunctions/field/magSqr/magSqr.C index 5bce397e0796bf9ffc02815bcf3267b0000e0d2d..d241685208a6235a67e965ed00be38e18702c6e9 100644 --- a/src/postProcessing/foamCalcFunctions/field/magSqr/magSqr.C +++ b/src/postProcessing/foamCalcFunctions/field/magSqr/magSqr.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 @@ -78,7 +78,7 @@ void Foam::calcTypes::magSqr::calc const fvMesh& mesh ) { - const word& fieldName = args.additionalArgs()[1]; + const word fieldName = args[2]; IOobject fieldHeader ( diff --git a/src/postProcessing/foamCalcFunctions/field/randomise/randomise.C b/src/postProcessing/foamCalcFunctions/field/randomise/randomise.C index 8a956c1911656f20866fd8ac6c9b993eaa0e56f5..c156a30fb2b8cffa4ca9f8b26e1791be16417e54 100644 --- a/src/postProcessing/foamCalcFunctions/field/randomise/randomise.C +++ b/src/postProcessing/foamCalcFunctions/field/randomise/randomise.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -79,9 +79,8 @@ void Foam::calcTypes::randomise::calc const fvMesh& mesh ) { - const stringList& params = args.additionalArgs(); - const scalar pertMag = readScalar(IStringStream(params[1])()); - const word& fieldName = params[2]; + const scalar pertMag = args.argRead<scalar>(2); + const word fieldName = args[3]; Random rand(1234567); diff --git a/src/surfMesh/surfaceFormats/ftr/FTRsurfaceFormat.H b/src/surfMesh/surfaceFormats/ftr/FTRsurfaceFormat.H index 767bf19707e11f862cb54cda49f08af05c1bc5bb..e5e353a72248aba4c74990c2491a9a479bed505c 100644 --- a/src/surfMesh/surfaceFormats/ftr/FTRsurfaceFormat.H +++ b/src/surfMesh/surfaceFormats/ftr/FTRsurfaceFormat.H @@ -29,6 +29,9 @@ Description Reading of the (now deprecated and infrequently used) Foam Trisurface Format. +Deprecated + Other formats are better. (deprecated Mar 2009) + SourceFiles FTRsurfaceFormat.C diff --git a/src/surfMesh/surfaceFormats/obj/OBJsurfaceFormat.C b/src/surfMesh/surfaceFormats/obj/OBJsurfaceFormat.C index df10f47d43d51c3e6074e92d66bccfc8131da177..d836909382c2e83e8ee0440c2a6e995a92af291d 100644 --- a/src/surfMesh/surfaceFormats/obj/OBJsurfaceFormat.C +++ b/src/surfMesh/surfaceFormats/obj/OBJsurfaceFormat.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 @@ -225,9 +225,9 @@ void Foam::fileFormats::OBJsurfaceFormat<Face>::write // for no zones, suppress the group name const List<surfZone>& zones = ( - surf.surfZones().size() > 1 - ? surf.surfZones() - : oneZone(faceLst, "") + surf.surfZones().empty() + ? oneZone(faceLst, "") + : surf.surfZones() ); const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1); diff --git a/src/surfMesh/surfaceFormats/smesh/SMESHsurfaceFormat.C b/src/surfMesh/surfaceFormats/smesh/SMESHsurfaceFormat.C index 085de6d904609aeb76539dfabbb996e563ffdfd4..4bfff60e5641495073ba667f704239b3144537f4 100644 --- a/src/surfMesh/surfaceFormats/smesh/SMESHsurfaceFormat.C +++ b/src/surfMesh/surfaceFormats/smesh/SMESHsurfaceFormat.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,9 +52,9 @@ void Foam::fileFormats::SMESHsurfaceFormat<Face>::write const List<surfZone>& zones = ( - surf.surfZones().size() > 1 - ? surf.surfZones() - : oneZone(faceLst) + surf.surfZones().empty() + ? oneZone(faceLst) + : surf.surfZones() ); const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1); diff --git a/src/surfMesh/surfaceFormats/starcd/STARCDsurfaceFormat.C b/src/surfMesh/surfaceFormats/starcd/STARCDsurfaceFormat.C index a2ba35550279343acdad24214bfe192a92a78775..7d9d05578de90c697cd7c3d0a1a91d13ccf2ac99 100644 --- a/src/surfMesh/surfaceFormats/starcd/STARCDsurfaceFormat.C +++ b/src/surfMesh/surfaceFormats/starcd/STARCDsurfaceFormat.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 @@ -256,9 +256,9 @@ void Foam::fileFormats::STARCDsurfaceFormat<Face>::write const List<surfZone>& zones = ( - surf.surfZones().size() > 1 - ? surf.surfZones() - : oneZone(faceLst) + surf.surfZones().empty() + ? oneZone(faceLst) + : surf.surfZones() ); const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1); diff --git a/src/surfMesh/surfaceFormats/stl/STLsurfaceFormat.C b/src/surfMesh/surfaceFormats/stl/STLsurfaceFormat.C index af3f3fff81bd40f2bc99b9dd746c7ae405de6fc2..ce63aab7ab666cbd70d53791c2e7353c34ec3d8c 100644 --- a/src/surfMesh/surfaceFormats/stl/STLsurfaceFormat.C +++ b/src/surfMesh/surfaceFormats/stl/STLsurfaceFormat.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 @@ -213,9 +213,9 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::writeAscii const List<surfZone>& zones = ( - surf.surfZones().size() > 1 - ? surf.surfZones() - : oneZone(faceLst) + surf.surfZones().empty() + ? oneZone(faceLst) + : surf.surfZones() ); const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1); diff --git a/src/surfMesh/surfaceFormats/tri/TRIsurfaceFormat.C b/src/surfMesh/surfaceFormats/tri/TRIsurfaceFormat.C index f1db14b73dee324fe8f18e672752f1e1a61e9f8b..a97b8d7c381532fa2a8d12cfbd080cee0525c436 100644 --- a/src/surfMesh/surfaceFormats/tri/TRIsurfaceFormat.C +++ b/src/surfMesh/surfaceFormats/tri/TRIsurfaceFormat.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 @@ -139,9 +139,9 @@ void Foam::fileFormats::TRIsurfaceFormat<Face>::write const List<surfZone>& zones = ( - surf.surfZones().size() > 1 - ? surf.surfZones() - : oneZone(faceLst) + surf.surfZones().empty() + ? oneZone(faceLst) + : surf.surfZones() ); const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1); diff --git a/src/surfMesh/surfaceFormats/vtk/VTKsurfaceFormat.C b/src/surfMesh/surfaceFormats/vtk/VTKsurfaceFormat.C index 2b09481030efa3d5af5af110df973b9beafe43ba..9c18a87ad77ea34e5326399c6af7538a73200e5f 100644 --- a/src/surfMesh/surfaceFormats/vtk/VTKsurfaceFormat.C +++ b/src/surfMesh/surfaceFormats/vtk/VTKsurfaceFormat.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 @@ -70,9 +70,9 @@ void Foam::fileFormats::VTKsurfaceFormat<Face>::write const List<surfZone>& zones = ( - surf.surfZones().size() > 1 - ? surf.surfZones() - : oneZone(faceLst) + surf.surfZones().empty() + ? oneZone(faceLst) + : surf.surfZones() ); const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1); diff --git a/src/surfMesh/surfaceFormats/wrl/WRLsurfaceFormat.C b/src/surfMesh/surfaceFormats/wrl/WRLsurfaceFormat.C index e141096fbc3de04225c05ed79877bf2d0419e299..edc8d3d71948e502893ed99e6b03b061dbf4d054 100644 --- a/src/surfMesh/surfaceFormats/wrl/WRLsurfaceFormat.C +++ b/src/surfMesh/surfaceFormats/wrl/WRLsurfaceFormat.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 @@ -53,9 +53,9 @@ void Foam::fileFormats::WRLsurfaceFormat<Face>::write // for no zones, suppress the group name const List<surfZone>& zones = ( - surf.surfZones().size() > 1 - ? surf.surfZones() - : oneZone(faceLst, "") + surf.surfZones().empty() + ? oneZone(faceLst, "") + : surf.surfZones() ); const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1); diff --git a/src/surfMesh/surfaceFormats/x3d/X3DsurfaceFormat.C b/src/surfMesh/surfaceFormats/x3d/X3DsurfaceFormat.C index 0150168ff9d6bb388e29a2bed6e4de8bdb22fb07..3523b9cc02f83f016adfed19c323cc9f5b9bee0b 100644 --- a/src/surfMesh/surfaceFormats/x3d/X3DsurfaceFormat.C +++ b/src/surfMesh/surfaceFormats/x3d/X3DsurfaceFormat.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 @@ -55,9 +55,9 @@ void Foam::fileFormats::X3DsurfaceFormat<Face>::write // for no zones, suppress the group name const List<surfZone>& zones = ( - surf.surfZones().size() > 1 - ? surf.surfZones() - : oneZone(faceLst, "") + surf.surfZones().empty() + ? oneZone(faceLst, "") + : surf.surfZones() ); const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1); diff --git a/src/thermophysicalModels/basic/Make/files b/src/thermophysicalModels/basic/Make/files index dcf9c8f4c0cbe6686de6b4db1b501dea7e45ed6a..59f8f822ea2e6b6e6301c19e86fe8e6067740ef3 100644 --- a/src/thermophysicalModels/basic/Make/files +++ b/src/thermophysicalModels/basic/Make/files @@ -6,11 +6,13 @@ basicThermo/basicThermo.C psiThermo/basicPsiThermo/basicPsiThermo.C psiThermo/basicPsiThermo/newBasicPsiThermo.C psiThermo/hPsiThermo/hPsiThermos.C +psiThermo/hsPsiThermo/hsPsiThermos.C psiThermo/ePsiThermo/ePsiThermos.C rhoThermo/basicRhoThermo/basicRhoThermo.C rhoThermo/basicRhoThermo/newBasicRhoThermo.C rhoThermo/hRhoThermo/hRhoThermos.C +rhoThermo/hsRhoThermo/hsRhoThermos.C derivedFvPatchFields/fixedEnthalpy/fixedEnthalpyFvPatchScalarField.C derivedFvPatchFields/gradientEnthalpy/gradientEnthalpyFvPatchScalarField.C diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.C b/src/thermophysicalModels/basic/basicThermo/basicThermo.C index 3de20158ad0c345b33e5dd237166c761e0af03e9..67f0de7092ba3bcc1ba3919c59d9b4789b1936a6 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.C +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.C @@ -143,7 +143,6 @@ void Foam::basicThermo::eBoundaryCorrection(volScalarField& e) } } - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::basicThermo::basicThermo(const fvMesh& mesh) @@ -300,6 +299,57 @@ Foam::tmp<Foam::scalarField> Foam::basicThermo::h } +Foam::volScalarField& Foam::basicThermo::hs() +{ + notImplemented("basicThermo::hs()"); + return const_cast<volScalarField&>(volScalarField::null()); +} + + +const Foam::volScalarField& Foam::basicThermo::hs() const +{ + notImplemented("basicThermo::hs() const"); + return volScalarField::null(); +} + + +Foam::tmp<Foam::scalarField> Foam::basicThermo::hs +( + const scalarField& T, + const labelList& cells +) const +{ + notImplemented + ( + "basicThermo::hs" + "(const scalarField& T, const labelList& cells) const" + ); + return tmp<scalarField>(NULL); +} + + +Foam::tmp<Foam::scalarField> Foam::basicThermo::hs +( + const scalarField& T, + const label patchi +) const +{ + notImplemented + ( + "basicThermo::hs" + "(const scalarField& T, const label patchi) const" + ); + return tmp<scalarField>(NULL); +} + + +Foam::tmp<Foam::volScalarField> Foam::basicThermo::hc() const +{ + notImplemented("basicThermo::hc()"); + return volScalarField::null(); +} + + Foam::volScalarField& Foam::basicThermo::e() { notImplemented("basicThermo::e()"); diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.H b/src/thermophysicalModels/basic/basicThermo/basicThermo.H index 1b5425852530ca30ec9cb6328adb12b777d473ab..4f28779a30294b6401f229b9f6ce9c00984973e5 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.H +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.H @@ -141,27 +141,51 @@ public: //- Compressibility [s^2/m^2] virtual const volScalarField& psi() const; - //- Enthalpy [J/kg] + //- Total enthalpy [J/kg] // Non-const access allowed for transport equations virtual volScalarField& h(); - //- Enthalpy [J/kg] + //- Total enthalpy [J/kg] virtual const volScalarField& h() const; - //- Enthalpy for cell-set [J/kg] + //- Total enthalpy for cell-set [J/kg] virtual tmp<scalarField> h ( const scalarField& T, const labelList& cells ) const; - //- Enthalpy for patch [J/kg] + //- Total enthalpy for patch [J/kg] virtual tmp<scalarField> h ( const scalarField& T, const label patchi ) const; + //- Sensible enthalpy [J/kg] + // Non-const access allowed for transport equations + virtual volScalarField& hs(); + + //- Sensible enthalpy [J/kg] + virtual const volScalarField& hs() const; + + //- Sensible enthalpy for cell-set [J/kg] + virtual tmp<scalarField> hs + ( + const scalarField& T, + const labelList& cells + ) const; + + //- Sensible enthalpy for patch [J/kg] + virtual tmp<scalarField> hs + ( + const scalarField& T, + const label patchi + ) const; + + //- Chemical enthalpy [J/kg] + virtual tmp<volScalarField> hc() const; + //- Internal energy [J/kg] // Non-const access allowed for transport equations virtual volScalarField& e(); @@ -176,7 +200,7 @@ public: const labelList& cells ) const; - //-Internal energy for patch [J/kg] + //- Internal energy for patch [J/kg] virtual tmp<scalarField> e ( const scalarField& T, diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/fixedEnthalpy/fixedEnthalpyFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/fixedEnthalpy/fixedEnthalpyFvPatchScalarField.C index 19e345abe0b321bcfd619c1068a28417539a4b16..4679801fd334e4fba208e7b83562c330dfef2e67 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/fixedEnthalpy/fixedEnthalpyFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/fixedEnthalpy/fixedEnthalpyFvPatchScalarField.C @@ -30,14 +30,9 @@ License #include "volFields.H" #include "basicThermo.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField +Foam::fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF @@ -47,7 +42,7 @@ fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField {} -fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField +Foam::fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField ( const fixedEnthalpyFvPatchScalarField& ptf, const fvPatch& p, @@ -59,7 +54,7 @@ fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField {} -fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField +Foam::fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, @@ -70,7 +65,7 @@ fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField {} -fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField +Foam::fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField ( const fixedEnthalpyFvPatchScalarField& tppsf ) @@ -79,7 +74,7 @@ fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField {} -fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField +Foam::fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField ( const fixedEnthalpyFvPatchScalarField& tppsf, const DimensionedField<scalar, volMesh>& iF @@ -91,7 +86,7 @@ fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void fixedEnthalpyFvPatchScalarField::updateCoeffs() +void Foam::fixedEnthalpyFvPatchScalarField::updateCoeffs() { if (updated()) { @@ -109,7 +104,14 @@ void fixedEnthalpyFvPatchScalarField::updateCoeffs() const_cast<fvPatchScalarField&>(thermo.T().boundaryField()[patchi]); Tw.evaluate(); - operator==(thermo.h(Tw, patchi)); + if (dimensionedInternalField().name() == "h") + { + operator==(thermo.h(Tw, patchi)); + } + else + { + operator==(thermo.hs(Tw, patchi)); + } fixedValueFvPatchScalarField::updateCoeffs(); } @@ -117,10 +119,14 @@ void fixedEnthalpyFvPatchScalarField::updateCoeffs() // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makePatchTypeField(fvPatchScalarField, fixedEnthalpyFvPatchScalarField); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + fixedEnthalpyFvPatchScalarField + ); +} -} // End namespace Foam // ************************************************************************* // diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/fixedEnthalpy/fixedEnthalpyFvPatchScalarField.H b/src/thermophysicalModels/basic/derivedFvPatchFields/fixedEnthalpy/fixedEnthalpyFvPatchScalarField.H index 725ca85df22258892d208a8112f9c5c4244df041..654b5c1af6e2b049a35324cf54e5309bccd6c6ca 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/fixedEnthalpy/fixedEnthalpyFvPatchScalarField.H +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/fixedEnthalpy/fixedEnthalpyFvPatchScalarField.H @@ -44,7 +44,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class fixedEnthalpyFvPatchScalarField Declaration + Class fixedEnthalpyFvPatchScalarField Declaration \*---------------------------------------------------------------------------*/ class fixedEnthalpyFvPatchScalarField diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnthalpy/gradientEnthalpyFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnthalpy/gradientEnthalpyFvPatchScalarField.C index ed3a4a6ca34ca13267aaafb4bd1273cae5966c2f..cb9b74020f5dfd19281b241eb24e5662fe9ba7d3 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnthalpy/gradientEnthalpyFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnthalpy/gradientEnthalpyFvPatchScalarField.C @@ -30,14 +30,9 @@ License #include "volFields.H" #include "basicThermo.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField +Foam::gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF @@ -47,7 +42,7 @@ gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField {} -gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField +Foam::gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField ( const gradientEnthalpyFvPatchScalarField& ptf, const fvPatch& p, @@ -59,7 +54,7 @@ gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField {} -gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField +Foam::gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, @@ -70,7 +65,7 @@ gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField {} -gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField +Foam::gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField ( const gradientEnthalpyFvPatchScalarField& tppsf ) @@ -79,7 +74,7 @@ gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField {} -gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField +Foam::gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField ( const gradientEnthalpyFvPatchScalarField& tppsf, const DimensionedField<scalar, volMesh>& iF @@ -91,7 +86,7 @@ gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void gradientEnthalpyFvPatchScalarField::updateCoeffs() +void Foam::gradientEnthalpyFvPatchScalarField::updateCoeffs() { if (updated()) { @@ -110,12 +105,24 @@ void gradientEnthalpyFvPatchScalarField::updateCoeffs() Tw.evaluate(); - gradient() = thermo.Cp(Tw, patchi)*Tw.snGrad() - + patch().deltaCoeffs()* + if (dimensionedInternalField().name() == "h") + { + gradient() = thermo.Cp(Tw, patchi)*Tw.snGrad() + + patch().deltaCoeffs()* ( thermo.h(Tw, patchi) - thermo.h(Tw, patch().faceCells()) ); + } + else + { + gradient() = thermo.Cp(Tw, patchi)*Tw.snGrad() + + patch().deltaCoeffs()* + ( + thermo.hs(Tw, patchi) + - thermo.hs(Tw, patch().faceCells()) + ); + } fixedGradientFvPatchScalarField::updateCoeffs(); } @@ -123,10 +130,14 @@ void gradientEnthalpyFvPatchScalarField::updateCoeffs() // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makePatchTypeField(fvPatchScalarField, gradientEnthalpyFvPatchScalarField); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + gradientEnthalpyFvPatchScalarField + ); +} -} // End namespace Foam // ************************************************************************* // diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnthalpy/mixedEnthalpyFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnthalpy/mixedEnthalpyFvPatchScalarField.C index 3d64c9a0d221c9ce4f39fde82853ef321f5fbd93..cfe404d38e845fb44f89deff045fc46a17a17092 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnthalpy/mixedEnthalpyFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnthalpy/mixedEnthalpyFvPatchScalarField.C @@ -30,14 +30,9 @@ License #include "volFields.H" #include "basicThermo.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField +Foam::mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF @@ -51,7 +46,7 @@ mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField } -mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField +Foam::mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField ( const mixedEnthalpyFvPatchScalarField& ptf, const fvPatch& p, @@ -63,7 +58,7 @@ mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField {} -mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField +Foam::mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, @@ -74,7 +69,7 @@ mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField {} -mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField +Foam::mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField ( const mixedEnthalpyFvPatchScalarField& tppsf ) @@ -83,7 +78,7 @@ mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField {} -mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField +Foam::mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField ( const mixedEnthalpyFvPatchScalarField& tppsf, const DimensionedField<scalar, volMesh>& iF @@ -95,7 +90,7 @@ mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void mixedEnthalpyFvPatchScalarField::updateCoeffs() +void Foam::mixedEnthalpyFvPatchScalarField::updateCoeffs() { if (updated()) { @@ -117,13 +112,27 @@ void mixedEnthalpyFvPatchScalarField::updateCoeffs() Tw.evaluate(); valueFraction() = Tw.valueFraction(); - refValue() = thermo.h(Tw.refValue(), patchi); - refGrad() = thermo.Cp(Tw, patchi)*Tw.refGrad() - + patch().deltaCoeffs()* - ( + + if (dimensionedInternalField().name() == "h") + { + refValue() = thermo.h(Tw.refValue(), patchi); + refGrad() = thermo.Cp(Tw, patchi)*Tw.refGrad() + + patch().deltaCoeffs()* + ( thermo.h(Tw, patchi) - thermo.h(Tw, patch().faceCells()) - ); + ); + } + else + { + refValue() = thermo.hs(Tw.refValue(), patchi); + refGrad() = thermo.Cp(Tw, patchi)*Tw.refGrad() + + patch().deltaCoeffs()* + ( + thermo.hs(Tw, patchi) + - thermo.hs(Tw, patch().faceCells()) + ); + } mixedFvPatchScalarField::updateCoeffs(); } @@ -131,10 +140,14 @@ void mixedEnthalpyFvPatchScalarField::updateCoeffs() // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makePatchTypeField(fvPatchScalarField, mixedEnthalpyFvPatchScalarField); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + mixedEnthalpyFvPatchScalarField + ); +} -} // End namespace Foam // ************************************************************************* // diff --git a/src/thermophysicalModels/basic/psiThermo/ePsiThermo/ePsiThermo.C b/src/thermophysicalModels/basic/psiThermo/ePsiThermo/ePsiThermo.C index 789f35bed9e275c24e24abb0555fd92ce54b9894..2d255977be71b3a007a9c3cd6268e519540942ff 100644 --- a/src/thermophysicalModels/basic/psiThermo/ePsiThermo/ePsiThermo.C +++ b/src/thermophysicalModels/basic/psiThermo/ePsiThermo/ePsiThermo.C @@ -246,8 +246,7 @@ Foam::tmp<Foam::volScalarField> Foam::ePsiThermo<MixtureType>::Cp() const IOobject::NO_WRITE ), mesh, - dimensionSet(0, 2, -2, -1, 0), - this->T_.boundaryField().types() + dimensionSet(0, 2, -2, -1, 0) ) ); diff --git a/src/thermophysicalModels/basic/psiThermo/hPsiThermo/hPsiThermo.C b/src/thermophysicalModels/basic/psiThermo/hPsiThermo/hPsiThermo.C index ab85557cf478222b30631345410042555ac97b9b..11f1e1b2b6cf257c62195e9bf8c0cd66d799c8aa 100644 --- a/src/thermophysicalModels/basic/psiThermo/hPsiThermo/hPsiThermo.C +++ b/src/thermophysicalModels/basic/psiThermo/hPsiThermo/hPsiThermo.C @@ -244,8 +244,7 @@ Foam::tmp<Foam::volScalarField> Foam::hPsiThermo<MixtureType>::Cp() const IOobject::NO_WRITE ), mesh, - dimensionSet(0, 2, -2, -1, 0), - this->T_.boundaryField().types() + dimensionSet(0, 2, -2, -1, 0) ) ); diff --git a/src/thermophysicalModels/basic/psiThermo/hsPsiThermo/hsPsiThermo.C b/src/thermophysicalModels/basic/psiThermo/hsPsiThermo/hsPsiThermo.C new file mode 100644 index 0000000000000000000000000000000000000000..cb33763fd680116e47aacffe2ccb69d1bffa68bc --- /dev/null +++ b/src/thermophysicalModels/basic/psiThermo/hsPsiThermo/hsPsiThermo.C @@ -0,0 +1,346 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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 "hsPsiThermo.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template<class MixtureType> +void Foam::hsPsiThermo<MixtureType>::calculate() +{ + const scalarField& hsCells = hs_.internalField(); + const scalarField& pCells = this->p_.internalField(); + + scalarField& TCells = this->T_.internalField(); + scalarField& psiCells = this->psi_.internalField(); + scalarField& muCells = this->mu_.internalField(); + scalarField& alphaCells = this->alpha_.internalField(); + + forAll(TCells, celli) + { + const typename MixtureType::thermoType& mixture_ = + this->cellMixture(celli); + + TCells[celli] = mixture_.THs(hsCells[celli], TCells[celli]); + psiCells[celli] = mixture_.psi(pCells[celli], TCells[celli]); + + muCells[celli] = mixture_.mu(TCells[celli]); + alphaCells[celli] = mixture_.alpha(TCells[celli]); + } + + forAll(T_.boundaryField(), patchi) + { + fvPatchScalarField& pp = this->p_.boundaryField()[patchi]; + fvPatchScalarField& pT = this->T_.boundaryField()[patchi]; + fvPatchScalarField& ppsi = this->psi_.boundaryField()[patchi]; + + fvPatchScalarField& phs = hs_.boundaryField()[patchi]; + + fvPatchScalarField& pmu = this->mu_.boundaryField()[patchi]; + fvPatchScalarField& palpha = this->alpha_.boundaryField()[patchi]; + + if (pT.fixesValue()) + { + forAll(pT, facei) + { + const typename MixtureType::thermoType& mixture_ = + this->patchFaceMixture(patchi, facei); + + phs[facei] = mixture_.Hs(pT[facei]); + + ppsi[facei] = mixture_.psi(pp[facei], pT[facei]); + pmu[facei] = mixture_.mu(pT[facei]); + palpha[facei] = mixture_.alpha(pT[facei]); + } + } + else + { + forAll(pT, facei) + { + const typename MixtureType::thermoType& mixture_ = + this->patchFaceMixture(patchi, facei); + + pT[facei] = mixture_.THs(phs[facei], pT[facei]); + + ppsi[facei] = mixture_.psi(pp[facei], pT[facei]); + pmu[facei] = mixture_.mu(pT[facei]); + palpha[facei] = mixture_.alpha(pT[facei]); + } + } + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class MixtureType> +Foam::hsPsiThermo<MixtureType>::hsPsiThermo(const fvMesh& mesh) +: + basicPsiThermo(mesh), + MixtureType(*this, mesh), + + hs_ + ( + IOobject + ( + "hs", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimEnergy/dimMass, + this->hBoundaryTypes() + ) +{ + scalarField& hsCells = hs_.internalField(); + const scalarField& TCells = this->T_.internalField(); + + forAll(hsCells, celli) + { + hsCells[celli] = this->cellMixture(celli).Hs(TCells[celli]); + } + + forAll(hs_.boundaryField(), patchi) + { + hs_.boundaryField()[patchi] == + hs(this->T_.boundaryField()[patchi], patchi); + } + + hBoundaryCorrection(hs_); + + calculate(); + + // Switch on saving old time + this->psi_.oldTime(); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class MixtureType> +Foam::hsPsiThermo<MixtureType>::~hsPsiThermo() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class MixtureType> +void Foam::hsPsiThermo<MixtureType>::correct() +{ + if (debug) + { + Info<< "entering hsPsiThermo<MixtureType>::correct()" << endl; + } + + // force the saving of the old-time values + this->psi_.oldTime(); + + calculate(); + + if (debug) + { + Info<< "exiting hsPsiThermo<MixtureType>::correct()" << endl; + } +} + + +template<class MixtureType> +Foam::tmp<Foam::scalarField> Foam::hsPsiThermo<MixtureType>::hs +( + const scalarField& T, + const labelList& cells +) const +{ + tmp<scalarField> ths(new scalarField(T.size())); + scalarField& hs = ths(); + + forAll(T, celli) + { + hs[celli] = this->cellMixture(cells[celli]).Hs(T[celli]); + } + + return ths; +} + + +template<class MixtureType> +Foam::tmp<Foam::scalarField> Foam::hsPsiThermo<MixtureType>::hs +( + const scalarField& T, + const label patchi +) const +{ + tmp<scalarField> ths(new scalarField(T.size())); + scalarField& hs = ths(); + + forAll(T, facei) + { + hs[facei] = this->patchFaceMixture(patchi, facei).Hs(T[facei]); + } + + return ths; +} + + +template<class MixtureType> +Foam::tmp<Foam::scalarField> Foam::hsPsiThermo<MixtureType>::Cp +( + const scalarField& T, + const label patchi +) const +{ + tmp<scalarField> tCp(new scalarField(T.size())); + scalarField& cp = tCp(); + + forAll(T, facei) + { + cp[facei] = this->patchFaceMixture(patchi, facei).Cp(T[facei]); + } + + return tCp; +} + + +template<class MixtureType> +Foam::tmp<Foam::volScalarField> Foam::hsPsiThermo<MixtureType>::Cp() const +{ + const fvMesh& mesh = this->T_.mesh(); + + tmp<volScalarField> tCp + ( + new volScalarField + ( + IOobject + ( + "Cp", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionSet(0, 2, -2, -1, 0) + ) + ); + + volScalarField& cp = tCp(); + + forAll(this->T_, celli) + { + cp[celli] = this->cellMixture(celli).Cp(this->T_[celli]); + } + + forAll(this->T_.boundaryField(), patchi) + { + const fvPatchScalarField& pT = this->T_.boundaryField()[patchi]; + fvPatchScalarField& pCp = cp.boundaryField()[patchi]; + + forAll(pT, facei) + { + pCp[facei] = this->patchFaceMixture(patchi, facei).Cp(pT[facei]); + } + } + + return tCp; +} + + +template<class MixtureType> +Foam::tmp<Foam::scalarField> Foam::hsPsiThermo<MixtureType>::Cv +( + const scalarField& T, + const label patchi +) const +{ + tmp<scalarField> tCv(new scalarField(T.size())); + scalarField& cv = tCv(); + + forAll(T, facei) + { + cv[facei] = this->patchFaceMixture(patchi, facei).Cv(T[facei]); + } + + return tCv; +} + + +template<class MixtureType> +Foam::tmp<Foam::volScalarField> Foam::hsPsiThermo<MixtureType>::Cv() const +{ + const fvMesh& mesh = this->T_.mesh(); + + tmp<volScalarField> tCv + ( + new volScalarField + ( + IOobject + ( + "Cv", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimEnergy/dimMass/dimTemperature + ) + ); + + volScalarField& cv = tCv(); + + forAll(this->T_, celli) + { + cv[celli] = this->cellMixture(celli).Cv(this->T_[celli]); + } + + forAll(this->T_.boundaryField(), patchi) + { + cv.boundaryField()[patchi] = + Cv(this->T_.boundaryField()[patchi], patchi); + } + + return tCv; +} + + +template<class MixtureType> +bool Foam::hsPsiThermo<MixtureType>::read() +{ + if (basicPsiThermo::read()) + { + MixtureType::read(*this); + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/psiThermo/hsPsiThermo/hsPsiThermo.H b/src/thermophysicalModels/basic/psiThermo/hsPsiThermo/hsPsiThermo.H new file mode 100644 index 0000000000000000000000000000000000000000..0c24ad84ce8d4936de4ea53e74375a19d4374720 --- /dev/null +++ b/src/thermophysicalModels/basic/psiThermo/hsPsiThermo/hsPsiThermo.H @@ -0,0 +1,178 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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::hsPsiThermo + +Description + Sensible enthalpy for a mixture based on compressibility + +SourceFiles + hsPsiThermo.C + +\*---------------------------------------------------------------------------*/ + +#ifndef hsPsiThermo_H +#define hsPsiThermo_H + +#include "basicPsiThermo.H" +#include "basicMixture.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class hsPsiThermo Declaration +\*---------------------------------------------------------------------------*/ + +template<class MixtureType> +class hsPsiThermo +: + public basicPsiThermo, + public MixtureType +{ + // Private data + + //- Sensible enthalpy field [J/kg] + volScalarField hs_; + + + // Private member functions + + //- Calculate the thermo variables + void calculate(); + + //- Construct as copy (not implemented) + hsPsiThermo(const hsPsiThermo<MixtureType>&); + + +public: + + //- Runtime type information + TypeName("hsPsiThermo"); + + + // Constructors + + //- Construct from mesh + hsPsiThermo(const fvMesh&); + + + //- Destructor + virtual ~hsPsiThermo(); + + + // Member functions + + //- Return the compostion of the mixture + virtual basicMixture& composition() + { + return *this; + } + + //- Return the compostion of the mixture + virtual const basicMixture& composition() const + { + return *this; + } + + //- Update properties + virtual void correct(); + + + // Access to thermodynamic state variables + + //- Sensible enthalpy [J/kg] + // Non-const access allowed for transport equations + virtual volScalarField& hs() + { + return hs_; + } + + //- Sensible enthalpy [J/kg] + virtual const volScalarField& hs() const + { + return hs_; + } + + + // Fields derived from thermodynamic state variables + + //- Enthalpy for cell-set [J/kg] + virtual tmp<scalarField> hs + ( + const scalarField& T, + const labelList& cells + ) const; + + //- Enthalpy for patch [J/kg] + virtual tmp<scalarField> hs + ( + const scalarField& T, + const label patchi + ) const; + + //- Heat capacity at constant pressure for patch [J/kg/K] + virtual tmp<scalarField> Cp + ( + const scalarField& T, + const label patchi + ) const; + + //- Heat capacity at constant pressure [J/kg/K] + virtual tmp<volScalarField> Cp() const; + + //- Heat capacity at constant volume for patch [J/kg/K] + virtual tmp<scalarField> Cv + ( + const scalarField& T, + const label patchi + ) const; + + //- Heat capacity at constant volume [J/kg/K] + virtual tmp<volScalarField> Cv() const; + + + //- Read thermophysicalProperties dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + +#ifdef NoRepository +# include "hsPsiThermo.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/global/globalPointPatchFields.H b/src/thermophysicalModels/basic/psiThermo/hsPsiThermo/hsPsiThermos.C similarity index 66% rename from src/OpenFOAM/fields/pointPatchFields/derived/global/globalPointPatchFields.H rename to src/thermophysicalModels/basic/psiThermo/hsPsiThermo/hsPsiThermos.C index 53535e9ab2e92bad620f7cd21c8a3cc027d8c2a3..3fad4dd806d3ef989a6dbc0d2e7a858ee536ba60 100644 --- a/src/OpenFOAM/fields/pointPatchFields/derived/global/globalPointPatchFields.H +++ b/src/thermophysicalModels/basic/psiThermo/hsPsiThermo/hsPsiThermos.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) 2010-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,28 +24,57 @@ License \*---------------------------------------------------------------------------*/ -#ifndef globalPointPatchFields_H -#define globalPointPatchFields_H +#include "makeBasicPsiThermo.H" -#include "globalPointPatchField.H" +#include "perfectGas.H" -#include "fieldTypes.H" +#include "hConstThermo.H" +#include "janafThermo.H" +#include "specieThermo.H" + +#include "constTransport.H" +#include "sutherlandTransport.H" + +#include "hsPsiThermo.H" +#include "pureMixture.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ + +makeBasicPsiThermo +( + hsPsiThermo, + pureMixture, + constTransport, + hConstThermo, + perfectGas +); + +makeBasicPsiThermo +( + hsPsiThermo, + pureMixture, + sutherlandTransport, + hConstThermo, + perfectGas +); + +makeBasicPsiThermo +( + hsPsiThermo, + pureMixture, + sutherlandTransport, + janafThermo, + perfectGas +); -makePointPatchFieldTypedefs(global); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - // ************************************************************************* // diff --git a/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.C b/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.C index ce3486fa152124a02503f5bdd6c6787eb888438c..3aca91c1242119a82e9d90002c82671063e67746 100644 --- a/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.C +++ b/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.C @@ -243,8 +243,7 @@ Foam::tmp<Foam::volScalarField> Foam::hRhoThermo<MixtureType>::Cp() const IOobject::NO_WRITE ), mesh, - dimensionSet(0, 2, -2, -1, 0), - this->T_.boundaryField().types() + dimensionSet(0, 2, -2, -1, 0) ) ); diff --git a/src/thermophysicalModels/basic/rhoThermo/hsRhoThermo/hsRhoThermo.C b/src/thermophysicalModels/basic/rhoThermo/hsRhoThermo/hsRhoThermo.C new file mode 100644 index 0000000000000000000000000000000000000000..fe0a4aedc440766ce6a850c3e255ceace0f31644 --- /dev/null +++ b/src/thermophysicalModels/basic/rhoThermo/hsRhoThermo/hsRhoThermo.C @@ -0,0 +1,345 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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 "hsRhoThermo.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template<class MixtureType> +void Foam::hsRhoThermo<MixtureType>::calculate() +{ + const scalarField& hsCells = this->hs_.internalField(); + const scalarField& pCells = this->p_.internalField(); + + scalarField& TCells = this->T_.internalField(); + scalarField& psiCells = this->psi_.internalField(); + scalarField& rhoCells = this->rho_.internalField(); + scalarField& muCells = this->mu_.internalField(); + scalarField& alphaCells = this->alpha_.internalField(); + + forAll(TCells, celli) + { + const typename MixtureType::thermoType& mixture_ = + this->cellMixture(celli); + + TCells[celli] = mixture_.THs(hsCells[celli], TCells[celli]); + psiCells[celli] = mixture_.psi(pCells[celli], TCells[celli]); + rhoCells[celli] = mixture_.rho(pCells[celli], TCells[celli]); + + muCells[celli] = mixture_.mu(TCells[celli]); + alphaCells[celli] = mixture_.alpha(TCells[celli]); + } + + forAll(this->T_.boundaryField(), patchi) + { + fvPatchScalarField& pp = this->p_.boundaryField()[patchi]; + fvPatchScalarField& pT = this->T_.boundaryField()[patchi]; + fvPatchScalarField& ppsi = this->psi_.boundaryField()[patchi]; + fvPatchScalarField& prho = this->rho_.boundaryField()[patchi]; + + fvPatchScalarField& phs = this->hs_.boundaryField()[patchi]; + + fvPatchScalarField& pmu = this->mu_.boundaryField()[patchi]; + fvPatchScalarField& palpha = this->alpha_.boundaryField()[patchi]; + + if (pT.fixesValue()) + { + forAll(pT, facei) + { + const typename MixtureType::thermoType& mixture_ = + this->patchFaceMixture(patchi, facei); + + phs[facei] = mixture_.Hs(pT[facei]); + + ppsi[facei] = mixture_.psi(pp[facei], pT[facei]); + prho[facei] = mixture_.rho(pp[facei], pT[facei]); + pmu[facei] = mixture_.mu(pT[facei]); + palpha[facei] = mixture_.alpha(pT[facei]); + } + } + else + { + forAll(pT, facei) + { + const typename MixtureType::thermoType& mixture_ = + this->patchFaceMixture(patchi, facei); + + pT[facei] = mixture_.THs(phs[facei], pT[facei]); + + ppsi[facei] = mixture_.psi(pp[facei], pT[facei]); + prho[facei] = mixture_.rho(pp[facei], pT[facei]); + pmu[facei] = mixture_.mu(pT[facei]); + palpha[facei] = mixture_.alpha(pT[facei]); + } + } + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class MixtureType> +Foam::hsRhoThermo<MixtureType>::hsRhoThermo(const fvMesh& mesh) +: + basicRhoThermo(mesh), + MixtureType(*this, mesh), + + hs_ + ( + IOobject + ( + "hs", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimEnergy/dimMass, + this->hBoundaryTypes() + ) +{ + scalarField& hsCells = hs_.internalField(); + const scalarField& TCells = this->T_.internalField(); + + forAll(hsCells, celli) + { + hsCells[celli] = this->cellMixture(celli).Hs(TCells[celli]); + } + + forAll(hs_.boundaryField(), patchi) + { + hs_.boundaryField()[patchi] == + hs(this->T_.boundaryField()[patchi], patchi); + } + + hBoundaryCorrection(hs_); + + calculate(); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class MixtureType> +Foam::hsRhoThermo<MixtureType>::~hsRhoThermo() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class MixtureType> +void Foam::hsRhoThermo<MixtureType>::correct() +{ + if (debug) + { + Info<< "entering hsRhoThermo<MixtureType>::correct()" << endl; + } + + calculate(); + + if (debug) + { + Info<< "exiting hsRhoThermo<MixtureType>::correct()" << endl; + } +} + + +template<class MixtureType> +Foam::tmp<Foam::scalarField> Foam::hsRhoThermo<MixtureType>::hs +( + const scalarField& T, + const labelList& cells +) const +{ + tmp<scalarField> ths(new scalarField(T.size())); + scalarField& hs = ths(); + + forAll(T, celli) + { + hs[celli] = this->cellMixture(cells[celli]).Hs(T[celli]); + } + + return ths; +} + + +template<class MixtureType> +Foam::tmp<Foam::scalarField> Foam::hsRhoThermo<MixtureType>::hs +( + const scalarField& T, + const label patchi +) const +{ + tmp<scalarField> ths(new scalarField(T.size())); + scalarField& hs = ths(); + + forAll(T, facei) + { + hs[facei] = this->patchFaceMixture(patchi, facei).Hs(T[facei]); + } + + return ths; +} + + +template<class MixtureType> +Foam::tmp<Foam::scalarField> Foam::hsRhoThermo<MixtureType>::Cp +( + const scalarField& T, + const label patchi +) const +{ + tmp<scalarField> tCp(new scalarField(T.size())); + scalarField& cp = tCp(); + + forAll(T, facei) + { + cp[facei] = this->patchFaceMixture(patchi, facei).Cp(T[facei]); + } + + return tCp; +} + + +template<class MixtureType> +Foam::tmp<Foam::volScalarField> Foam::hsRhoThermo<MixtureType>::Cp() const +{ + const fvMesh& mesh = this->T_.mesh(); + + tmp<volScalarField> tCp + ( + new volScalarField + ( + IOobject + ( + "Cp", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimEnergy/dimMass/dimTemperature + ) + ); + + volScalarField& cp = tCp(); + + forAll(this->T_, celli) + { + cp[celli] = this->cellMixture(celli).Cp(this->T_[celli]); + } + + forAll(this->T_.boundaryField(), patchi) + { + const fvPatchScalarField& pT = this->T_.boundaryField()[patchi]; + fvPatchScalarField& pCp = cp.boundaryField()[patchi]; + + forAll(pT, facei) + { + pCp[facei] = this->patchFaceMixture(patchi, facei).Cp(pT[facei]); + } + } + + return tCp; +} + + +template<class MixtureType> +Foam::tmp<Foam::scalarField> Foam::hsRhoThermo<MixtureType>::Cv +( + const scalarField& T, + const label patchi +) const +{ + tmp<scalarField> tCv(new scalarField(T.size())); + scalarField& cv = tCv(); + + forAll(T, facei) + { + cv[facei] = this->patchFaceMixture(patchi, facei).Cv(T[facei]); + } + + return tCv; +} + + +template<class MixtureType> +Foam::tmp<Foam::volScalarField> Foam::hsRhoThermo<MixtureType>::Cv() const +{ + const fvMesh& mesh = this->T_.mesh(); + + tmp<volScalarField> tCv + ( + new volScalarField + ( + IOobject + ( + "Cv", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimEnergy/dimMass/dimTemperature + ) + ); + + volScalarField& cv = tCv(); + + forAll(this->T_, celli) + { + cv[celli] = this->cellMixture(celli).Cv(this->T_[celli]); + } + + forAll(this->T_.boundaryField(), patchi) + { + cv.boundaryField()[patchi] = + Cv(this->T_.boundaryField()[patchi], patchi); + } + + return tCv; +} + + +template<class MixtureType> +bool Foam::hsRhoThermo<MixtureType>::read() +{ + if (basicRhoThermo::read()) + { + MixtureType::read(*this); + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/rhoThermo/hsRhoThermo/hsRhoThermo.H b/src/thermophysicalModels/basic/rhoThermo/hsRhoThermo/hsRhoThermo.H new file mode 100644 index 0000000000000000000000000000000000000000..8ce55f07a648bd72c45611895ab4c7e56677b348 --- /dev/null +++ b/src/thermophysicalModels/basic/rhoThermo/hsRhoThermo/hsRhoThermo.H @@ -0,0 +1,178 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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::hsRhoThermo + +Description + Sensible enthalpy for a mixture based on density + +SourceFiles + hsRhoThermo.C + +\*---------------------------------------------------------------------------*/ + +#ifndef hsRhoThermo_H +#define hsRhoThermo_H + +#include "basicRhoThermo.H" +#include "basicMixture.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class hsRhoThermo Declaration +\*---------------------------------------------------------------------------*/ + +template<class MixtureType> +class hsRhoThermo +: + public basicRhoThermo, + public MixtureType +{ + // Private data + + //- Sensible enthalpy field [J/kg] + volScalarField hs_; + + + // Private member functions + + //- Calculate the thermo variables + void calculate(); + + //- Construct as copy (not implemented) + hsRhoThermo(const hsRhoThermo<MixtureType>&); + + +public: + + //- Runtime type information + TypeName("hsRhoThermo"); + + + // Constructors + + //- Construct from mesh + hsRhoThermo(const fvMesh&); + + + //- Destructor + virtual ~hsRhoThermo(); + + + // Member functions + + //- Return the compostion of the combustion mixture + virtual basicMixture& composition() + { + return *this; + } + + //- Return the compostion of the combustion mixture + virtual const basicMixture& composition() const + { + return *this; + } + + //- Update properties + virtual void correct(); + + + // Access to thermodynamic state variables + + //- Sensible enthalpy [J/kg] + // Non-const access allowed for transport equations + virtual volScalarField& hs() + { + return hs_; + } + + //- Sensible enthalpy [J/kg] + virtual const volScalarField& hs() const + { + return hs_; + } + + + // Fields derived from thermodynamic state variables + + //- Sensible enthalpy for cell-set [J/kg] + virtual tmp<scalarField> hs + ( + const scalarField& T, + const labelList& cells + ) const; + + //- Sensible enthalpy for patch [J/kg] + virtual tmp<scalarField> hs + ( + const scalarField& T, + const label patchi + ) const; + + //- Heat capacity at constant pressure for patch [J/kg/K] + virtual tmp<scalarField> Cp + ( + const scalarField& T, + const label patchi + ) const; + + //- Heat capacity at constant pressure [J/kg/K] + virtual tmp<volScalarField> Cp() const; + + //- Heat capacity at constant volume for patch [J/kg/K] + virtual tmp<scalarField> Cv + ( + const scalarField& T, + const label patchi + ) const; + + //- Heat capacity at constant volume [J/kg/K] + virtual tmp<volScalarField> Cv() const; + + + //- Read thermophysicalProperties dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + +#ifdef NoRepository +# include "hsRhoThermo.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/global/globalPointPatchFields.C b/src/thermophysicalModels/basic/rhoThermo/hsRhoThermo/hsRhoThermos.C similarity index 66% rename from src/OpenFOAM/fields/pointPatchFields/derived/global/globalPointPatchFields.C rename to src/thermophysicalModels/basic/rhoThermo/hsRhoThermo/hsRhoThermos.C index f34a90e949dec9bbe85869a56ca835dd35f61ca3..ba1741c53739836764c93304210751dacb620fca 100644 --- a/src/OpenFOAM/fields/pointPatchFields/derived/global/globalPointPatchFields.C +++ b/src/thermophysicalModels/basic/rhoThermo/hsRhoThermo/hsRhoThermos.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) 2010-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,18 +24,54 @@ License \*---------------------------------------------------------------------------*/ -#include "globalPointPatchFields.H" -#include "pointPatchFields.H" -#include "addToRunTimeSelectionTable.H" +#include "makeBasicRhoThermo.H" + +#include "perfectGas.H" + +#include "hConstThermo.H" +#include "janafThermo.H" +#include "specieThermo.H" + +#include "constTransport.H" +#include "sutherlandTransport.H" + +#include "hsRhoThermo.H" +#include "pureMixture.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ + +makeBasicRhoThermo +( + hsRhoThermo, + pureMixture, + constTransport, + hConstThermo, + perfectGas +); + +makeBasicRhoThermo +( + hsRhoThermo, + pureMixture, + sutherlandTransport, + hConstThermo, + perfectGas +); + +makeBasicRhoThermo +( + hsRhoThermo, + pureMixture, + sutherlandTransport, + janafThermo, + perfectGas +); -makePointPatchFields(global); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C index 1b9b15fc8edaf241924576f3cfb08a28376d2ef9..fd9c2060530ca644f5f626cde8bd0635e3fadace 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C @@ -466,7 +466,7 @@ Foam::ODEChemistryModel<CompType, ThermoType>::tc() const this->thermo().rho() ); - tmp<volScalarField> tsource + tmp<volScalarField> ttc ( new volScalarField ( @@ -484,7 +484,7 @@ Foam::ODEChemistryModel<CompType, ThermoType>::tc() const ) ); - scalarField& t = tsource(); + scalarField& tc = ttc(); label nReaction = reactions_.size(); @@ -517,65 +517,88 @@ Foam::ODEChemistryModel<CompType, ThermoType>::tc() const forAll(R.rhs(), s) { scalar sr = R.rhs()[s].stoichCoeff; - t[celli] += sr*pf*cf; + tc[celli] += sr*pf*cf; } } - t[celli] = nReaction*cSum/t[celli]; + tc[celli] = nReaction*cSum/tc[celli]; } } - tsource().correctBoundaryConditions(); + ttc().correctBoundaryConditions(); - return tsource; + return ttc; } template<class CompType, class ThermoType> Foam::tmp<Foam::volScalarField> -Foam::ODEChemistryModel<CompType, ThermoType>::dQ() const +Foam::ODEChemistryModel<CompType, ThermoType>::Sh() const { - tmp<volScalarField> tdQ + tmp<volScalarField> tSh ( new volScalarField ( IOobject ( - "dQ", + "Sh", this->mesh_.time().timeName(), this->mesh_, IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + false ), this->mesh_, - dimensionedScalar - ( - "zero", - dimensionSet(0, 2, -3 , 0, 0, 0, 0), - 0.0 - ) + dimensionedScalar("zero", dimEnergy/dimTime/dimVolume, 0.0), + zeroGradientFvPatchScalarField::typeName ) ); if (this->chemistry_) { - scalarField& dQ = tdQ(); - - scalarField rhoEff(dQ.size(), 0.0); + scalarField& Sh = tSh(); forAll(Y_, i) { - forAll(dQ, cellI) + forAll(Sh, cellI) { - scalar Ti = this->thermo().T()[cellI]; - scalar pi = this->thermo().p()[cellI]; - rhoEff[cellI] += Y_[i][cellI]*specieThermo_[i].rho(pi, Ti); - scalar hi = specieThermo_[i].H(Ti); - dQ[cellI] -= hi*RR_[i][cellI]; + scalar hi = specieThermo_[i].Hc(); + Sh[cellI] -= hi*RR_[i][cellI]; } } + } + + return tSh; +} + + +template<class CompType, class ThermoType> +Foam::tmp<Foam::volScalarField> +Foam::ODEChemistryModel<CompType, ThermoType>::dQ() const +{ + tmp<volScalarField> tdQ + ( + new volScalarField + ( + IOobject + ( + "dQ", + this->mesh_.time().timeName(), + this->mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + this->mesh_, + dimensionedScalar("dQ", dimEnergy/dimTime, 0.0), + zeroGradientFvPatchScalarField::typeName + ) + ); - dQ /= rhoEff; + if (this->chemistry_) + { + volScalarField& dQ = tdQ(); + dQ.dimensionedInternalField() = this->mesh_.V()*Sh()(); } return tdQ; @@ -678,6 +701,9 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve scalar deltaTMin = GREAT; + tmp<volScalarField> thc = this->thermo().hc(); + const scalarField& hc = thc(); + forAll(rho, celli) { for (label i=0; i<nSpecie_; i++) @@ -687,7 +713,7 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve scalar rhoi = rho[celli]; scalar Ti = this->thermo().T()[celli]; - scalar hi = this->thermo().h()[celli]; + scalar hi = this->thermo().hs()[celli] + hc[celli]; scalar pi = this->thermo().p()[celli]; scalarField c(nSpecie_); diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.H b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.H index 6a5820ff192d8cd35d0b1010223f91b2b5fc533b..59ab6baed58d8bf25e1e358613728e00c1241abd 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.H @@ -39,9 +39,9 @@ SourceFiles #ifndef ODEChemistryModel_H #define ODEChemistryModel_H -#include "hCombustionThermo.H" #include "Reaction.H" #include "ODE.H" +#include "volFieldsFwd.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -49,6 +49,8 @@ namespace Foam { // Forward declaration of classes +class fvMesh; + template<class CompType, class ThermoType> class chemistrySolver; @@ -180,6 +182,9 @@ public: //- Return the chemical time scale virtual tmp<volScalarField> tc() const; + //- Return source for enthalpy equation [kg/m/s3] + virtual tmp<volScalarField> Sh() const; + //- Return the heat release, i.e. enthalpy/sec [m2/s3] virtual tmp<volScalarField> dQ() const; diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModelI.H b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModelI.H index b5264a28d43c2c9dd88ac18610ce0b14ae918cfa..712b067e298500e3398d8b3bfaa9ef5a468f7209 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModelI.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModelI.H @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ +#include "volFields.H" #include "zeroGradientFvPatchFields.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -96,7 +97,7 @@ Foam::ODEChemistryModel<CompType, ThermoType>::RR IOobject::NO_WRITE ), this->mesh(), - dimensionedScalar("zero", dimensionSet(1, -3, -1, 0, 0), 0.0), + dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0), zeroGradientFvPatchScalarField::typeName ) ); diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.H b/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.H index c8fcdd9863e58ec43bc58046c845634c128fb864..290c3b62e18dbef7b2a64fb9a5156c2b16e80386 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.H @@ -120,7 +120,7 @@ public: // Fields - //- Return const access to chemical source terms + //- Return const access to chemical source terms [kg/m3/s] virtual tmp<volScalarField> RR(const label i) const = 0; @@ -133,7 +133,10 @@ public: //- Return the chemical time scale virtual tmp<volScalarField> tc() const = 0; - //- Return the heat release + //- Return source for enthalpy equation [kg/m/s3] + virtual tmp<volScalarField> Sh() const = 0; + + //- Return the heat release, i.e. enthalpy/sec [m2/s3] virtual tmp<volScalarField> dQ() const = 0; }; diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModel.C index 7381d12a1df87d1a9aebe58a622c990173eb98ef..11978f2ddb4e6ea6de2108c8059480c12673dafd 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModel.C @@ -45,7 +45,7 @@ Foam::psiChemistryModel::psiChemistryModel ) : basicChemistryModel(mesh), - thermo_(hCombustionThermo::NewType(mesh, thermoTypeName)) + thermo_(hsCombustionThermo::NewType(mesh, thermoTypeName)) {} diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModel.H b/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModel.H index 4cf7af58ec89920d63395302ee0d84feb72df17c..617d627aab6c53afb8c55cd0ac1b7b7492f8b814 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModel.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModel.H @@ -41,7 +41,7 @@ SourceFiles #include "basicChemistryModel.H" #include "autoPtr.H" #include "runTimeSelectionTables.H" -#include "hCombustionThermo.H" +#include "hsCombustionThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -73,7 +73,7 @@ protected: // Protected data //- Thermo package - autoPtr<hCombustionThermo> thermo_; + autoPtr<hsCombustionThermo> thermo_; public: @@ -114,10 +114,10 @@ public: // Member Functions //- Return access to the thermo package - inline hCombustionThermo& thermo(); + inline hsCombustionThermo& thermo(); //- Return const access to the thermo package - inline const hCombustionThermo& thermo() const; + inline const hsCombustionThermo& thermo() const; }; diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModelI.H b/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModelI.H index a6122b8b6840fbcf94afb92a5b99227000719d01..bea773122844d9478c636402c1e21c1724e2c140 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModelI.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModelI.H @@ -26,13 +26,13 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline Foam::hCombustionThermo& Foam::psiChemistryModel::thermo() +inline Foam::hsCombustionThermo& Foam::psiChemistryModel::thermo() { return thermo_(); } -inline const Foam::hCombustionThermo& Foam::psiChemistryModel::thermo() const +inline const Foam::hsCombustionThermo& Foam::psiChemistryModel::thermo() const { return thermo_(); } diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModel.C index 73a3f00e9cf8c4fc81e5532264566a9b5c0eadc5..9684adaf77a4c874a557ab0857fb46622c49c7b0 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModel.C @@ -45,7 +45,7 @@ Foam::rhoChemistryModel::rhoChemistryModel ) : basicChemistryModel(mesh), - thermo_(hReactionThermo::NewType(mesh, thermoTypeName)) + thermo_(hsReactionThermo::NewType(mesh, thermoTypeName)) {} diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModel.H b/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModel.H index 8991f250f9c5fe9adb97b147ca94378d66c3c6ec..4f22904b8fb64511d68c1333c22d215b3618ef3c 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModel.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModel.H @@ -41,7 +41,7 @@ SourceFiles #include "basicChemistryModel.H" #include "autoPtr.H" #include "runTimeSelectionTables.H" -#include "hReactionThermo.H" +#include "hsReactionThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -73,7 +73,7 @@ protected: // Protected data //- Thermo package - autoPtr<hReactionThermo> thermo_; + autoPtr<hsReactionThermo> thermo_; public: @@ -114,10 +114,10 @@ public: // Member Functions //- Return access to the thermo package - inline hReactionThermo& thermo(); + inline hsReactionThermo& thermo(); //- Return const access to the thermo package - inline const hReactionThermo& thermo() const; + inline const hsReactionThermo& thermo() const; }; diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModelI.H b/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModelI.H index d96171001b694bb6fdd721b835a358c52eaef13f..cff2455ebc399d5607130f3bc94197c45f79ad4b 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModelI.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModelI.H @@ -26,13 +26,13 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline Foam::hReactionThermo& Foam::rhoChemistryModel::thermo() +inline Foam::hsReactionThermo& Foam::rhoChemistryModel::thermo() { return thermo_(); } -inline const Foam::hReactionThermo& Foam::rhoChemistryModel::thermo() const +inline const Foam::hsReactionThermo& Foam::rhoChemistryModel::thermo() const { return thermo_(); } diff --git a/src/thermophysicalModels/radiation/radiationModel/radiationModel/radiationModel.C b/src/thermophysicalModels/radiation/radiationModel/radiationModel/radiationModel.C index be93dc011eddef10cb16c01d0348a0253cf6f224..d1f844f5925405ec492fb22fef09744d5290bc08 100644 --- a/src/thermophysicalModels/radiation/radiationModel/radiationModel/radiationModel.C +++ b/src/thermophysicalModels/radiation/radiationModel/radiationModel/radiationModel.C @@ -156,4 +156,22 @@ Foam::tmp<Foam::fvScalarMatrix> Foam::radiation::radiationModel::Sh } +Foam::tmp<Foam::fvScalarMatrix> Foam::radiation::radiationModel::Shs +( + basicThermo& thermo +) const +{ + volScalarField& hs = thermo.hs(); + const volScalarField cp = thermo.Cp(); + const volScalarField T3 = pow3(T_); + + return + ( + Ru() + - fvm::Sp(4.0*Rp()*T3/cp, hs) + - Rp()*T3*(T_ - 4.0*hs/cp) + ); +} + + // ************************************************************************* // diff --git a/src/thermophysicalModels/radiation/radiationModel/radiationModel/radiationModel.H b/src/thermophysicalModels/radiation/radiationModel/radiationModel/radiationModel.H index aae443461e1955fd61c7781d94d0cf0bddf8f9d2..3e1a8019cf4da2c26957b93b70c60e30f96424a4 100644 --- a/src/thermophysicalModels/radiation/radiationModel/radiationModel/radiationModel.H +++ b/src/thermophysicalModels/radiation/radiationModel/radiationModel/radiationModel.H @@ -163,7 +163,7 @@ public: virtual void calculate() = 0; //- Read radiationProperties dictionary - virtual bool read(); + virtual bool read() = 0; // Access @@ -176,6 +176,9 @@ public: //- Enthalpy source term virtual tmp<fvScalarMatrix> Sh(basicThermo& thermo) const; + + //- Sensible enthalpy source term + virtual tmp<fvScalarMatrix> Shs(basicThermo& thermo) const; }; @@ -189,4 +192,3 @@ public: #endif // ************************************************************************* // - diff --git a/src/thermophysicalModels/reactionThermo/Make/files b/src/thermophysicalModels/reactionThermo/Make/files index c2f9612ec5d5a462cbf6139bc7086ef1d0b55dae..471dbb114d2f8e0d08ee523660c0bcaf2415b5cb 100644 --- a/src/thermophysicalModels/reactionThermo/Make/files +++ b/src/thermophysicalModels/reactionThermo/Make/files @@ -8,6 +8,10 @@ combustionThermo/hCombustionThermo/hCombustionThermo.C combustionThermo/hCombustionThermo/newhCombustionThermo.C combustionThermo/hCombustionThermo/hCombustionThermos.C +combustionThermo/hsCombustionThermo/hsCombustionThermo.C +combustionThermo/hsCombustionThermo/newhsCombustionThermo.C +combustionThermo/hsCombustionThermo/hsCombustionThermos.C + combustionThermo/hhuCombustionThermo/hhuCombustionThermo.C combustionThermo/hhuCombustionThermo/newhhuCombustionThermo.C combustionThermo/hhuCombustionThermo/hhuCombustionThermos.C @@ -16,6 +20,9 @@ reactionThermo/hReactionThermo/hReactionThermo.C reactionThermo/hReactionThermo/newhReactionThermo.C reactionThermo/hReactionThermo/hReactionThermos.C +reactionThermo/hsReactionThermo/hsReactionThermo.C +reactionThermo/hsReactionThermo/newhsReactionThermo.C +reactionThermo/hsReactionThermo/hsReactionThermos.C derivedFvPatchFields/fixedUnburntEnthalpy/fixedUnburntEnthalpyFvPatchScalarField.C derivedFvPatchFields/gradientUnburntEnthalpy/gradientUnburntEnthalpyFvPatchScalarField.C diff --git a/src/thermophysicalModels/reactionThermo/combustionThermo/hCombustionThermo/hCombustionThermo.H b/src/thermophysicalModels/reactionThermo/combustionThermo/hCombustionThermo/hCombustionThermo.H index b4b66b55bdb3dcefc0ad5143773cb400e03d2f78..cfcf5c3834b3b5f889c721c9e91692b40126ff57 100644 --- a/src/thermophysicalModels/reactionThermo/combustionThermo/hCombustionThermo/hCombustionThermo.H +++ b/src/thermophysicalModels/reactionThermo/combustionThermo/hCombustionThermo/hCombustionThermo.H @@ -128,12 +128,6 @@ public: } - //- Sensible enthalpy [J/kg] - virtual tmp<volScalarField> hs() const = 0; - - //- Chemical enthalpy [J/kg] - virtual tmp<volScalarField> hc() const = 0; - //- Update properties virtual void correct() = 0; }; diff --git a/src/thermophysicalModels/reactionThermo/combustionThermo/hCombustionThermo/makeCombustionThermo.H b/src/thermophysicalModels/reactionThermo/combustionThermo/hCombustionThermo/makeCombustionThermo.H index 4ee0c2a022a3ed2c37656e4910724923b580a2b4..39079cfb31d68a218eb13884283fe698624a3b67 100644 --- a/src/thermophysicalModels/reactionThermo/combustionThermo/hCombustionThermo/makeCombustionThermo.H +++ b/src/thermophysicalModels/reactionThermo/combustionThermo/hCombustionThermo/makeCombustionThermo.H @@ -25,8 +25,6 @@ License InClass Foam::hCombustionThermo -Description - \*---------------------------------------------------------------------------*/ #ifndef makeCombustionThermo_H diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/global/globalPointPatch.C b/src/thermophysicalModels/reactionThermo/combustionThermo/hsCombustionThermo/hsCombustionThermo.C similarity index 72% rename from src/OpenFOAM/meshes/pointMesh/pointPatches/derived/global/globalPointPatch.C rename to src/thermophysicalModels/reactionThermo/combustionThermo/hsCombustionThermo/hsCombustionThermo.C index 53ac14e268d61931bdb0f335e2485351b0634db6..55d8984301fd1effe924f1fd145925605c9c4c38 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/global/globalPointPatch.C +++ b/src/thermophysicalModels/reactionThermo/combustionThermo/hsCombustionThermo/hsCombustionThermo.C @@ -24,35 +24,44 @@ License \*---------------------------------------------------------------------------*/ -#include "globalPointPatch.H" +#include "hsCombustionThermo.H" +#include "fvMesh.H" -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::globalPointPatch, 0); +namespace Foam +{ + defineTypeNameAndDebug(hsCombustionThermo, 0); + defineRunTimeSelectionTable(hsCombustionThermo, fvMesh); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::globalPointPatch::globalPointPatch -( - const pointBoundaryMesh& bm, - const label index -) +Foam::hsCombustionThermo::hsCombustionThermo(const fvMesh& mesh) : - pointPatch(bm), - coupledPointPatch(bm), - index_(index) + basicPsiThermo(mesh), + + hs_ + ( + IOobject + ( + "hs", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimEnergy/dimMass, + this->hBoundaryTypes() + ) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::globalPointPatch::~globalPointPatch() +Foam::hsCombustionThermo::~hsCombustionThermo() {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/combustionThermo/hsCombustionThermo/hsCombustionThermo.H b/src/thermophysicalModels/reactionThermo/combustionThermo/hsCombustionThermo/hsCombustionThermo.H new file mode 100644 index 0000000000000000000000000000000000000000..2d7be88a741f22cfd4fd985e0ce862ad456af42a --- /dev/null +++ b/src/thermophysicalModels/reactionThermo/combustionThermo/hsCombustionThermo/hsCombustionThermo.H @@ -0,0 +1,144 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::hsCombustionThermo + +Description + Sensible enthalpy variant of combustionThermo + +SourceFiles + hsCombustionThermo.C + +\*---------------------------------------------------------------------------*/ + +#ifndef hsCombustionThermo_H +#define hsCombustionThermo_H + +#include "basicPsiThermo.H" +#include "basicMultiComponentMixture.H" +#include "autoPtr.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class hsCombustionThermo Declaration +\*---------------------------------------------------------------------------*/ + +class hsCombustionThermo +: + public basicPsiThermo +{ + +protected: + + // Protected data + + //- Sensible enthalpy field + volScalarField hs_; + + +public: + + //- Runtime type information + TypeName("hsCombustionThermo"); + + + //- Declare run-time constructor selection tables + declareRunTimeSelectionTable + ( + autoPtr, + hsCombustionThermo, + fvMesh, + (const fvMesh& mesh), + (mesh) + ); + + + // Constructors + + //- Construct from dictionary and mesh + hsCombustionThermo(const fvMesh&); + + + // Selectors + + //- Standard selection based on fvMesh + static autoPtr<hsCombustionThermo> New(const fvMesh&); + + //- Select and check that package contains 'thermoType' + static autoPtr<hsCombustionThermo> NewType + ( + const fvMesh&, + const word& thermoType + ); + + + //- Destructor + virtual ~hsCombustionThermo(); + + + // Member functions + + //- Return the composition of the multi-component mixture + virtual basicMultiComponentMixture& composition() = 0; + + //- Return the composition of the multi-component mixture + virtual const basicMultiComponentMixture& composition() const = 0; + + + // Access to thermodynamic state variables + + //- Sensible enthalpy [J/kg] + // Non-const access allowed for transport equations + virtual volScalarField& hs() + { + return hs_; + } + + //- Sensible enthalpy [J/kg] + virtual const volScalarField& hs() const + { + return hs_; + } + + + //- Update properties + virtual void correct() = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/combustionThermo/hsCombustionThermo/hsCombustionThermos.C b/src/thermophysicalModels/reactionThermo/combustionThermo/hsCombustionThermo/hsCombustionThermos.C new file mode 100644 index 0000000000000000000000000000000000000000..e3332c7bb8d3b14150f4128d7707e3b5537ac424 --- /dev/null +++ b/src/thermophysicalModels/reactionThermo/combustionThermo/hsCombustionThermo/hsCombustionThermos.C @@ -0,0 +1,153 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "makeHsCombustionThermo.H" + +#include "hsCombustionThermo.H" +#include "hsPsiMixtureThermo.H" + +#include "perfectGas.H" + +#include "hConstThermo.H" +#include "janafThermo.H" +#include "specieThermo.H" + +#include "constTransport.H" +#include "sutherlandTransport.H" + +#include "dieselMixture.H" +#include "homogeneousMixture.H" +#include "inhomogeneousMixture.H" +#include "veryInhomogeneousMixture.H" + +#include "reactingMixture.H" +#include "multiComponentMixture.H" + +#include "thermoPhysicsTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makeHsCombustionThermo +( + hsCombustionThermo, + hsPsiMixtureThermo, + homogeneousMixture, + constTransport, + hConstThermo, + perfectGas +); + +makeHsCombustionThermo +( + hsCombustionThermo, + hsPsiMixtureThermo, + inhomogeneousMixture, + constTransport, + hConstThermo, + perfectGas +); + +makeHsCombustionThermo +( + hsCombustionThermo, + hsPsiMixtureThermo, + veryInhomogeneousMixture, + constTransport, + hConstThermo, + perfectGas +); + +makeHsCombustionThermo +( + hsCombustionThermo, + hsPsiMixtureThermo, + homogeneousMixture, + sutherlandTransport, + janafThermo, + perfectGas +); + +makeHsCombustionThermo +( + hsCombustionThermo, + hsPsiMixtureThermo, + inhomogeneousMixture, + sutherlandTransport, + janafThermo, + perfectGas +); + +makeHsCombustionThermo +( + hsCombustionThermo, + hsPsiMixtureThermo, + veryInhomogeneousMixture, + sutherlandTransport, + janafThermo, + perfectGas +); + +makeHsCombustionThermo +( + hsCombustionThermo, + hsPsiMixtureThermo, + dieselMixture, + sutherlandTransport, + janafThermo, + perfectGas +); + +// Multi-component thermo + +makeHsCombustionMixtureThermo +( + hsCombustionThermo, + hsPsiMixtureThermo, + multiComponentMixture, + gasThermoPhysics +); + + +// Multi-component reaction thermo + +makeHsCombustionMixtureThermo +( + hsCombustionThermo, + hsPsiMixtureThermo, + reactingMixture, + gasThermoPhysics +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/combustionThermo/hsCombustionThermo/makeHsCombustionThermo.H b/src/thermophysicalModels/reactionThermo/combustionThermo/hsCombustionThermo/makeHsCombustionThermo.H new file mode 100644 index 0000000000000000000000000000000000000000..41962dfc54f95d82c718047f975796267729f725 --- /dev/null +++ b/src/thermophysicalModels/reactionThermo/combustionThermo/hsCombustionThermo/makeHsCombustionThermo.H @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 + +InClass + Foam::hsCombustionThermo + +\*---------------------------------------------------------------------------*/ + +#ifndef makeHsCombustionThermo_H +#define makeHsCombustionThermo_H + +#include "addToRunTimeSelectionTable.H" +#include "basicPsiThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeHsCombustionThermo(CThermo,MixtureThermo,Mixture,Transport,Thermo,EqnOfState) \ + \ +typedef MixtureThermo \ + <Mixture<Transport<specieThermo<Thermo<EqnOfState> > > > > \ + MixtureThermo##Mixture##Transport##Thermo##EqnOfState; \ + \ +defineTemplateTypeNameAndDebugWithName \ +( \ + MixtureThermo##Mixture##Transport##Thermo##EqnOfState, \ + #MixtureThermo \ + "<"#Mixture"<"#Transport"<specieThermo<"#Thermo"<"#EqnOfState">>>>>", \ + 0 \ +); \ + \ +addToRunTimeSelectionTable \ +( \ + basicPsiThermo, \ + MixtureThermo##Mixture##Transport##Thermo##EqnOfState, \ + fvMesh \ +); \ + \ +addToRunTimeSelectionTable \ +( \ + CThermo, \ + MixtureThermo##Mixture##Transport##Thermo##EqnOfState, \ + fvMesh \ +) + + +#define makeHsCombustionMixtureThermo(CThermo,MixtureThermo,Mixture,ThermoPhys) \ + \ +typedef MixtureThermo<Mixture<ThermoPhys> > \ + MixtureThermo##Mixture##ThermoPhys; \ + \ +defineTemplateTypeNameAndDebugWithName \ +( \ + MixtureThermo##Mixture##ThermoPhys, \ + #MixtureThermo"<"#Mixture"<"#ThermoPhys">>", \ + 0 \ +); \ + \ +addToRunTimeSelectionTable \ +( \ + basicPsiThermo, \ + MixtureThermo##Mixture##ThermoPhys, \ + fvMesh \ +); \ + \ +addToRunTimeSelectionTable \ +( \ + CThermo, \ + MixtureThermo##Mixture##ThermoPhys, \ + fvMesh \ +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/combustionThermo/hsCombustionThermo/newhsCombustionThermo.C b/src/thermophysicalModels/reactionThermo/combustionThermo/hsCombustionThermo/newhsCombustionThermo.C new file mode 100644 index 0000000000000000000000000000000000000000..9d39667dd3d66cffaa76e4f991553d18582b9404 --- /dev/null +++ b/src/thermophysicalModels/reactionThermo/combustionThermo/hsCombustionThermo/newhsCombustionThermo.C @@ -0,0 +1,151 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "hsCombustionThermo.H" +#include "fvMesh.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Foam::autoPtr<Foam::hsCombustionThermo> Foam::hsCombustionThermo::New +( + const fvMesh& mesh +) +{ + word hsCombustionThermoTypeName; + + // Enclose the creation of the thermophysicalProperties to ensure it is + // deleted before the turbulenceModel is created otherwise the dictionary + // is entered in the database twice + { + IOdictionary thermoDict + ( + IOobject + ( + "thermophysicalProperties", + mesh.time().constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ); + + thermoDict.lookup("thermoType") >> hsCombustionThermoTypeName; + } + + Info<< "Selecting thermodynamics package " << hsCombustionThermoTypeName + << endl; + + fvMeshConstructorTable::iterator cstrIter = + fvMeshConstructorTablePtr_->find(hsCombustionThermoTypeName); + + if (cstrIter == fvMeshConstructorTablePtr_->end()) + { + FatalErrorIn("hsCombustionThermo::New(const fvMesh&)") + << "Unknown hsCombustionThermo type " + << hsCombustionThermoTypeName << nl << nl + << "Valid hsCombustionThermo types are:" << nl + << fvMeshConstructorTablePtr_->toc() << nl + << exit(FatalError); + } + + return autoPtr<hsCombustionThermo>(cstrIter()(mesh)); +} + + +Foam::autoPtr<Foam::hsCombustionThermo> Foam::hsCombustionThermo::NewType +( + const fvMesh& mesh, + const word& thermoType +) +{ + word hsCombustionThermoTypeName; + + // Enclose the creation of the thermophysicalProperties to ensure it is + // deleted before the turbulenceModel is created otherwise the dictionary + // is entered in the database twice + { + IOdictionary thermoDict + ( + IOobject + ( + "thermophysicalProperties", + mesh.time().constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ); + + thermoDict.lookup("thermoType") >> hsCombustionThermoTypeName; + + if (hsCombustionThermoTypeName.find(thermoType) == string::npos) + { + wordList allModels = fvMeshConstructorTablePtr_->toc(); + DynamicList<word> validModels; + forAll(allModels, i) + { + if (allModels[i].find(thermoType) != string::npos) + { + validModels.append(allModels[i]); + } + } + + FatalErrorIn + ( + "autoPtr<hsCombustionThermo> hsCombustionThermo::NewType" + "(" + "const fvMesh&, " + "const word&" + ")" + ) << "Inconsistent thermo package selected:" << nl << nl + << hsCombustionThermoTypeName << nl << nl << "Please select a " + << "thermo package based on " << thermoType + << ". Valid options include:" << nl << validModels << nl + << exit(FatalError); + } + } + + Info<< "Selecting thermodynamics package " << hsCombustionThermoTypeName + << endl; + + fvMeshConstructorTable::iterator cstrIter = + fvMeshConstructorTablePtr_->find(hsCombustionThermoTypeName); + + if (cstrIter == fvMeshConstructorTablePtr_->end()) + { + FatalErrorIn("hsCombustionThermo::New(const fvMesh&)") + << "Unknown hsCombustionThermo type " + << hsCombustionThermoTypeName << nl << nl + << "Valid hsCombustionThermo types are:" << nl + << fvMeshConstructorTablePtr_->toc() << nl + << exit(FatalError); + } + + return autoPtr<hsCombustionThermo>(cstrIter()(mesh)); +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hPsiMixtureThermo/hPsiMixtureThermo.C b/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hPsiMixtureThermo/hPsiMixtureThermo.C index 5a788049a62d2a649e1761ca4ae1df31f9d80047..b3623a7b17403eeb3e879ea7d1ec523f89fc99c9 100644 --- a/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hPsiMixtureThermo/hPsiMixtureThermo.C +++ b/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hPsiMixtureThermo/hPsiMixtureThermo.C @@ -155,53 +155,6 @@ void Foam::hPsiMixtureThermo<MixtureType>::correct() } -template<class MixtureType> -Foam::tmp<Foam::volScalarField> -Foam::hPsiMixtureThermo<MixtureType>::hs() const -{ - const fvMesh& mesh = T_.mesh(); - - tmp<volScalarField> ths - ( - new volScalarField - ( - IOobject - ( - "hs", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - h_.dimensions() - ) - ); - - volScalarField& hsf = ths(); - scalarField& hsCells = hsf.internalField(); - const scalarField& TCells = T_.internalField(); - - forAll(TCells, celli) - { - hsCells[celli] = this->cellMixture(celli).Hs(TCells[celli]); - } - - forAll(T_.boundaryField(), patchi) - { - scalarField& hsp = hsf.boundaryField()[patchi]; - const scalarField& Tp = T_.boundaryField()[patchi]; - - forAll(Tp, facei) - { - hsp[facei] = this->patchFaceMixture(patchi, facei).Hs(Tp[facei]); - } - } - - return ths; -} - - template<class MixtureType> Foam::tmp<Foam::volScalarField> Foam::hPsiMixtureThermo<MixtureType>::hc() const @@ -327,7 +280,7 @@ Foam::hPsiMixtureThermo<MixtureType>::Cp() const IOobject::NO_WRITE ), mesh, - dimensionSet(0, 2, -2, -1, 0) + dimEnergy/dimMass/dimTemperature ) ); diff --git a/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hPsiMixtureThermo/hPsiMixtureThermo.H b/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hPsiMixtureThermo/hPsiMixtureThermo.H index 64503284478016985773a5cef53b5de87af8d299..bf932f8a9bccc9d5c434a951b5c75798e4fd6660 100644 --- a/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hPsiMixtureThermo/hPsiMixtureThermo.H +++ b/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hPsiMixtureThermo/hPsiMixtureThermo.H @@ -94,15 +94,12 @@ public: //- Update properties virtual void correct(); - //- Sensible enthalpy [J/kg] - virtual tmp<volScalarField> hs() const; - - //- Chemical enthalpy [J/kg] - virtual tmp<volScalarField> hc() const; - // Fields derived from thermodynamic state variables + //- Chemical enthalpy [J/kg] + virtual tmp<volScalarField> hc() const; + //- Enthalpy for cell-set [J/kg] virtual tmp<scalarField> h ( diff --git a/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hhuMixtureThermo/hhuMixtureThermo.C b/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hhuMixtureThermo/hhuMixtureThermo.C index 0af469ecf910cff475c9f37738e85fd6f84fb389..2f6de08965bddf6ba07d90bba51dae33e5ce890a 100644 --- a/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hhuMixtureThermo/hhuMixtureThermo.C +++ b/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hhuMixtureThermo/hhuMixtureThermo.C @@ -174,54 +174,6 @@ void Foam::hhuMixtureThermo<MixtureType>::correct() } -template<class MixtureType> -Foam::tmp<Foam::volScalarField> -Foam::hhuMixtureThermo<MixtureType>::hs() const -{ - const fvMesh& mesh = T_.mesh(); - - tmp<volScalarField> ths - ( - new volScalarField - ( - IOobject - ( - "hs", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - h_.dimensions() - ) - ); - - volScalarField& hsf = ths(); - - scalarField& hsCells = hsf.internalField(); - const scalarField& TCells = T_.internalField(); - - forAll(TCells, celli) - { - hsCells[celli] = this->cellMixture(celli).Hs(TCells[celli]); - } - - forAll(T_.boundaryField(), patchi) - { - scalarField& hsp = hsf.boundaryField()[patchi]; - const scalarField& Tp = T_.boundaryField()[patchi]; - - forAll(Tp, facei) - { - hsp[facei] = this->patchFaceMixture(patchi, facei).Hs(Tp[facei]); - } - } - - return ths; -} - - template<class MixtureType> Foam::tmp<Foam::volScalarField> Foam::hhuMixtureThermo<MixtureType>::hc() const @@ -344,7 +296,7 @@ Foam::hhuMixtureThermo<MixtureType>::Cp() const IOobject::NO_WRITE ), mesh, - dimensionSet(0, 2, -2, -1, 0) + dimEnergy/dimMass/dimTemperature ) ); diff --git a/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hhuMixtureThermo/hhuMixtureThermo.H b/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hhuMixtureThermo/hhuMixtureThermo.H index 5e9834e86c086b036855efa7f9ba3ae66a1a0e33..c55e0a9216a4616a6ce97ac3ba9810e28387e808 100644 --- a/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hhuMixtureThermo/hhuMixtureThermo.H +++ b/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hhuMixtureThermo/hhuMixtureThermo.H @@ -36,8 +36,6 @@ SourceFiles #ifndef hhuMixtureThermo_H #define hhuMixtureThermo_H -//#include "hPsiMixtureThermo.H" - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -94,9 +92,6 @@ public: //- Update properties virtual void correct(); - //- Sensible enthalpy [J/kg] - virtual tmp<volScalarField> hs() const; - //- Chemical enthalpy [J/kg] virtual tmp<volScalarField> hc() const; diff --git a/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hsPsiMixtureThermo/hsPsiMixtureThermo.C b/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hsPsiMixtureThermo/hsPsiMixtureThermo.C new file mode 100644 index 0000000000000000000000000000000000000000..83a40c834973b34cce123e1f683143f5cef7249b --- /dev/null +++ b/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hsPsiMixtureThermo/hsPsiMixtureThermo.C @@ -0,0 +1,318 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "hsPsiMixtureThermo.H" +#include "fvMesh.H" +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class MixtureType> +Foam::hsPsiMixtureThermo<MixtureType>::hsPsiMixtureThermo(const fvMesh& mesh) +: + hsCombustionThermo(mesh), + MixtureType(*this, mesh) +{ + scalarField& hCells = hs_.internalField(); + const scalarField& TCells = T_.internalField(); + + forAll(hCells, celli) + { + hCells[celli] = this->cellMixture(celli).Hs(TCells[celli]); + } + + forAll(hs_.boundaryField(), patchi) + { + hs_.boundaryField()[patchi] == hs(T_.boundaryField()[patchi], patchi); + } + + hBoundaryCorrection(hs_); + + calculate(); + psi_.oldTime(); // Switch on saving old time +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class MixtureType> +Foam::hsPsiMixtureThermo<MixtureType>::~hsPsiMixtureThermo() +{} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template<class MixtureType> +void Foam::hsPsiMixtureThermo<MixtureType>::calculate() +{ + const scalarField& hsCells = hs_.internalField(); + const scalarField& pCells = p_.internalField(); + + scalarField& TCells = T_.internalField(); + scalarField& psiCells = psi_.internalField(); + scalarField& muCells = mu_.internalField(); + scalarField& alphaCells = alpha_.internalField(); + + forAll(TCells, celli) + { + const typename MixtureType::thermoType& mixture_ = + this->cellMixture(celli); + + TCells[celli] = mixture_.THs(hsCells[celli], TCells[celli]); + psiCells[celli] = mixture_.psi(pCells[celli], TCells[celli]); + + muCells[celli] = mixture_.mu(TCells[celli]); + alphaCells[celli] = mixture_.alpha(TCells[celli]); + } + + forAll(T_.boundaryField(), patchi) + { + fvPatchScalarField& pp = p_.boundaryField()[patchi]; + fvPatchScalarField& pT = T_.boundaryField()[patchi]; + fvPatchScalarField& ppsi = psi_.boundaryField()[patchi]; + + fvPatchScalarField& phs = hs_.boundaryField()[patchi]; + + fvPatchScalarField& pmu_ = mu_.boundaryField()[patchi]; + fvPatchScalarField& palpha_ = alpha_.boundaryField()[patchi]; + + if (pT.fixesValue()) + { + forAll(pT, facei) + { + const typename MixtureType::thermoType& mixture_ = + this->patchFaceMixture(patchi, facei); + + phs[facei] = mixture_.Hs(pT[facei]); + + ppsi[facei] = mixture_.psi(pp[facei], pT[facei]); + pmu_[facei] = mixture_.mu(pT[facei]); + palpha_[facei] = mixture_.alpha(pT[facei]); + } + } + else + { + forAll(pT, facei) + { + const typename MixtureType::thermoType& mixture_ = + this->patchFaceMixture(patchi, facei); + + pT[facei] = mixture_.THs(phs[facei], pT[facei]); + + ppsi[facei] = mixture_.psi(pp[facei], pT[facei]); + pmu_[facei] = mixture_.mu(pT[facei]); + palpha_[facei] = mixture_.alpha(pT[facei]); + } + } + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class MixtureType> +void Foam::hsPsiMixtureThermo<MixtureType>::correct() +{ + if (debug) + { + Info<< "entering hMixtureThermo<MixtureType>::correct()" << endl; + } + + // force the saving of the old-time values + psi_.oldTime(); + + calculate(); + + if (debug) + { + Info<< "exiting hMixtureThermo<MixtureType>::correct()" << endl; + } +} + +template<class MixtureType> +Foam::tmp<Foam::volScalarField> +Foam::hsPsiMixtureThermo<MixtureType>::hc() const +{ + const fvMesh& mesh = T_.mesh(); + + tmp<volScalarField> thc + ( + new volScalarField + ( + IOobject + ( + "hc", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + hs_.dimensions() + ) + ); + + volScalarField& hcf = thc(); + scalarField& hcCells = hcf.internalField(); + + forAll(hcCells, celli) + { + hcCells[celli] = this->cellMixture(celli).Hc(); + } + + forAll(hcf.boundaryField(), patchi) + { + scalarField& hcp = hcf.boundaryField()[patchi]; + + forAll(hcp, facei) + { + hcp[facei] = this->patchFaceMixture(patchi, facei).Hc(); + } + } + + return thc; +} + + +template<class MixtureType> +Foam::tmp<Foam::scalarField> +Foam::hsPsiMixtureThermo<MixtureType>::hs +( + const scalarField& T, + const labelList& cells +) const +{ + tmp<scalarField> ths(new scalarField(T.size())); + scalarField& hs = ths(); + + forAll(T, celli) + { + hs[celli] = this->cellMixture(cells[celli]).Hs(T[celli]); + } + + return ths; +} + + +template<class MixtureType> +Foam::tmp<Foam::scalarField> +Foam::hsPsiMixtureThermo<MixtureType>::hs +( + const scalarField& T, + const label patchi +) const +{ + tmp<scalarField> ths(new scalarField(T.size())); + scalarField& hs = ths(); + + forAll(T, facei) + { + hs[facei] = this->patchFaceMixture(patchi, facei).Hs(T[facei]); + } + + return ths; +} + + +template<class MixtureType> +Foam::tmp<Foam::scalarField> +Foam::hsPsiMixtureThermo<MixtureType>::Cp +( + const scalarField& T, + const label patchi +) const +{ + tmp<scalarField> tCp(new scalarField(T.size())); + + scalarField& cp = tCp(); + + forAll(T, facei) + { + cp[facei] = this->patchFaceMixture(patchi, facei).Cp(T[facei]); + } + + return tCp; +} + + +template<class MixtureType> +Foam::tmp<Foam::volScalarField> +Foam::hsPsiMixtureThermo<MixtureType>::Cp() const +{ + const fvMesh& mesh = T_.mesh(); + + tmp<volScalarField> tCp + ( + new volScalarField + ( + IOobject + ( + "Cp", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimEnergy/dimMass/dimTemperature + ) + ); + + volScalarField& cp = tCp(); + + scalarField& cpCells = cp.internalField(); + const scalarField& TCells = T_.internalField(); + + forAll(TCells, celli) + { + cpCells[celli] = this->cellMixture(celli).Cp(TCells[celli]); + } + + forAll(T_.boundaryField(), patchi) + { + cp.boundaryField()[patchi] = Cp(T_.boundaryField()[patchi], patchi); + } + + return tCp; +} + + +template<class MixtureType> +bool Foam::hsPsiMixtureThermo<MixtureType>::read() +{ + if (hsCombustionThermo::read()) + { + MixtureType::read(*this); + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hsPsiMixtureThermo/hsPsiMixtureThermo.H b/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hsPsiMixtureThermo/hsPsiMixtureThermo.H new file mode 100644 index 0000000000000000000000000000000000000000..b022b0eeb20fbc28612f5bcc5a5ef2c4fb0c443e --- /dev/null +++ b/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hsPsiMixtureThermo/hsPsiMixtureThermo.H @@ -0,0 +1,147 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::hsPsiMixtureThermo + +Description + Foam::hsPsiMixtureThermo + +SourceFiles + hsPsiMixtureThermo.C + +\*---------------------------------------------------------------------------*/ + +#ifndef hsPsiMixtureThermo_H +#define hsPsiMixtureThermo_H + +#include "hsCombustionThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class hsPsiMixtureThermo Declaration +\*---------------------------------------------------------------------------*/ + +template<class MixtureType> +class hsPsiMixtureThermo +: + public hsCombustionThermo, + public MixtureType +{ + // Private member functions + + void calculate(); + + //- Construct as copy (not implemented) + hsPsiMixtureThermo(const hsPsiMixtureThermo<MixtureType>&); + + +public: + + //- Runtime type information + TypeName("hsPsiMixtureThermo"); + + + // Constructors + + //- Construct from mesh + hsPsiMixtureThermo(const fvMesh&); + + + //- Destructor + virtual ~hsPsiMixtureThermo(); + + + // Member functions + + //- Return the compostion of the multi-component mixture + virtual basicMultiComponentMixture& composition() + { + return *this; + } + + //- Return the compostion of the multi-component mixture + virtual const basicMultiComponentMixture& composition() const + { + return *this; + } + + //- Update properties + virtual void correct(); + + + // Fields derived from thermodynamic state variables + + //- Chemical enthalpy [J/kg] + virtual tmp<volScalarField> hc() const; + + //- Sensible enthalpy for cell-set [J/kg] + virtual tmp<scalarField> hs + ( + const scalarField& T, + const labelList& cells + ) const; + + //- Sensible enthalpy for patch [J/kg] + virtual tmp<scalarField> hs + ( + const scalarField& T, + const label patchi + ) const; + + //- Heat capacity at constant pressure for patch [J/kg/K] + virtual tmp<scalarField> Cp + ( + const scalarField& T, + const label patchi + ) const; + + //- Heat capacity at constant pressure [J/kg/K] + virtual tmp<volScalarField> Cp() const; + + + //- Read thermophysicalProperties dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "hsPsiMixtureThermo.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/reactionThermo/hReactionThermo/hReactionThermo.H b/src/thermophysicalModels/reactionThermo/reactionThermo/hReactionThermo/hReactionThermo.H index 3d5c37614c3c16e3ec5fd7786bc667da322bb900..ef801b2e9669a6d1e59472d04d64f40daa8bfa24 100644 --- a/src/thermophysicalModels/reactionThermo/reactionThermo/hReactionThermo/hReactionThermo.H +++ b/src/thermophysicalModels/reactionThermo/reactionThermo/hReactionThermo/hReactionThermo.H @@ -128,12 +128,6 @@ public: } - //- Sensible enthalpy [J/kg] - virtual tmp<volScalarField> hs() const = 0; - - //- Chemical enthalpy [J/kg] - virtual tmp<volScalarField> hc() const = 0; - //- Update properties virtual void correct() = 0; }; diff --git a/src/thermophysicalModels/reactionThermo/reactionThermo/hReactionThermo/makeReactionThermo.H b/src/thermophysicalModels/reactionThermo/reactionThermo/hReactionThermo/makeReactionThermo.H index a74bded0bf74e571e8e43d9d9126075112034ea9..214602c84442424db415cec17e6284359bb0d8b6 100644 --- a/src/thermophysicalModels/reactionThermo/reactionThermo/hReactionThermo/makeReactionThermo.H +++ b/src/thermophysicalModels/reactionThermo/reactionThermo/hReactionThermo/makeReactionThermo.H @@ -25,8 +25,6 @@ License InClass Foam::hReactionThermo -Description - \*---------------------------------------------------------------------------*/ #ifndef makeReactionThermo_H diff --git a/src/thermophysicalModels/reactionThermo/reactionThermo/hsReactionThermo/hsReactionThermo.C b/src/thermophysicalModels/reactionThermo/reactionThermo/hsReactionThermo/hsReactionThermo.C new file mode 100644 index 0000000000000000000000000000000000000000..7f255de38a14b241348aa869b341cbf594e3fcc2 --- /dev/null +++ b/src/thermophysicalModels/reactionThermo/reactionThermo/hsReactionThermo/hsReactionThermo.C @@ -0,0 +1,67 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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 "hsReactionThermo.H" +#include "fvMesh.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(hsReactionThermo, 0); + defineRunTimeSelectionTable(hsReactionThermo, fvMesh); +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::hsReactionThermo::hsReactionThermo(const fvMesh& mesh) +: + basicRhoThermo(mesh), + + hs_ + ( + IOobject + ( + "hs", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimEnergy/dimMass, + this->hBoundaryTypes() + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::hsReactionThermo::~hsReactionThermo() +{} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/reactionThermo/hsReactionThermo/hsReactionThermo.H b/src/thermophysicalModels/reactionThermo/reactionThermo/hsReactionThermo/hsReactionThermo.H new file mode 100644 index 0000000000000000000000000000000000000000..ae038b0b3174b3be27e2669474f2fb31c4372bdf --- /dev/null +++ b/src/thermophysicalModels/reactionThermo/reactionThermo/hsReactionThermo/hsReactionThermo.H @@ -0,0 +1,144 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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::hsReactionThermo + +Description + Sensible enthalpy variant for reactionThermo + +SourceFiles + hReactionThermo.C + +\*---------------------------------------------------------------------------*/ + +#ifndef hsReactionThermo_H +#define hsReactionThermo_H + +#include "basicRhoThermo.H" +#include "basicMultiComponentMixture.H" +#include "autoPtr.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class hsReactionThermo Declaration +\*---------------------------------------------------------------------------*/ + +class hsReactionThermo +: + public basicRhoThermo +{ + +protected: + + // Protected data + + //- Sensible enthalpy [J/kg] + volScalarField hs_; + + +public: + + //- Runtime type information + TypeName("hsReactionThermo"); + + + //- Declare run-time constructor selection tables + declareRunTimeSelectionTable + ( + autoPtr, + hsReactionThermo, + fvMesh, + (const fvMesh& mesh), + (mesh) + ); + + + // Constructors + + //- Construct from dictionary and mesh + hsReactionThermo(const fvMesh&); + + + // Selectors + + //- Standard selection based on fvMesh + static autoPtr<hsReactionThermo> New(const fvMesh&); + + //- Select and check that package contains 'thermoType' + static autoPtr<hsReactionThermo> NewType + ( + const fvMesh&, + const word& thermoType + ); + + + //- Destructor + virtual ~hsReactionThermo(); + + + // Member functions + + //- Return the composition of the multi-component mixture + virtual basicMultiComponentMixture& composition() = 0; + + //- Return the composition of the multi-component mixture + virtual const basicMultiComponentMixture& composition() const = 0; + + + // Access to thermodynamic state variables + + //- Sensible enthalpy [J/kg] + // Non-const access allowed for transport equations + virtual volScalarField& hs() + { + return hs_; + } + + //- Sensible enthalpy [J/kg] + virtual const volScalarField& hs() const + { + return hs_; + } + + + //- Update properties + virtual void correct() = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/reactionThermo/hsReactionThermo/hsReactionThermos.C b/src/thermophysicalModels/reactionThermo/reactionThermo/hsReactionThermo/hsReactionThermos.C new file mode 100644 index 0000000000000000000000000000000000000000..be0e7967dea5d7828f00ee14ebca4b425ed0c2fb --- /dev/null +++ b/src/thermophysicalModels/reactionThermo/reactionThermo/hsReactionThermo/hsReactionThermos.C @@ -0,0 +1,171 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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 "makeHsReactionThermo.H" + +#include "hsReactionThermo.H" +#include "hsRhoMixtureThermo.H" + +#include "perfectGas.H" + +#include "hConstThermo.H" +#include "janafThermo.H" +#include "specieThermo.H" + +#include "constTransport.H" +#include "sutherlandTransport.H" + +#include "homogeneousMixture.H" +#include "inhomogeneousMixture.H" +#include "veryInhomogeneousMixture.H" +#include "dieselMixture.H" +#include "multiComponentMixture.H" +#include "reactingMixture.H" + +#include "thermoPhysicsTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makeHsReactionThermo +( + hsReactionThermo, + hsRhoMixtureThermo, + homogeneousMixture, + constTransport, + hConstThermo, + perfectGas +); + +makeHsReactionThermo +( + hsReactionThermo, + hsRhoMixtureThermo, + inhomogeneousMixture, + constTransport, + hConstThermo, + perfectGas +); + +makeHsReactionThermo +( + hsReactionThermo, + hsRhoMixtureThermo, + veryInhomogeneousMixture, + constTransport, + hConstThermo, + perfectGas +); + +makeHsReactionThermo +( + hsReactionThermo, + hsRhoMixtureThermo, + homogeneousMixture, + sutherlandTransport, + janafThermo, + perfectGas +); + +makeHsReactionThermo +( + hsReactionThermo, + hsRhoMixtureThermo, + inhomogeneousMixture, + sutherlandTransport, + janafThermo, + perfectGas +); + +makeHsReactionThermo +( + hsReactionThermo, + hsRhoMixtureThermo, + veryInhomogeneousMixture, + sutherlandTransport, + janafThermo, + perfectGas +); + + +makeHsReactionThermo +( + hsReactionThermo, + hsRhoMixtureThermo, + dieselMixture, + sutherlandTransport, + janafThermo, + perfectGas +); + + +// Multi-component thermo + +makeHsReactionMixtureThermo +( + hsReactionThermo, + hsRhoMixtureThermo, + multiComponentMixture, + icoPoly8ThermoPhysics +); + +makeHsReactionMixtureThermo +( + hsReactionThermo, + hsRhoMixtureThermo, + multiComponentMixture, + gasThermoPhysics +); + + +// Multi-component reaction thermo + +makeHsReactionMixtureThermo +( + hsReactionThermo, + hsRhoMixtureThermo, + reactingMixture, + icoPoly8ThermoPhysics +); + +makeHsReactionMixtureThermo +( + hsReactionThermo, + hsRhoMixtureThermo, + reactingMixture, + gasThermoPhysics +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/reactionThermo/hsReactionThermo/makeHsReactionThermo.H b/src/thermophysicalModels/reactionThermo/reactionThermo/hsReactionThermo/makeHsReactionThermo.H new file mode 100644 index 0000000000000000000000000000000000000000..321d2cc86229b5397dbe47cf836b7f67e503838d --- /dev/null +++ b/src/thermophysicalModels/reactionThermo/reactionThermo/hsReactionThermo/makeHsReactionThermo.H @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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 + +InClass + Foam::hReactionThermo + +\*---------------------------------------------------------------------------*/ + +#ifndef makeReactionThermo_H +#define makeReactionThermo_H + +#include "addToRunTimeSelectionTable.H" +#include "basicRhoThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeHsReactionThermo(CThermo,MixtureThermo,Mixture,Transport,Thermo,EqnOfState)\ + \ +typedef MixtureThermo \ + <Mixture<Transport<specieThermo<Thermo<EqnOfState> > > > > \ + MixtureThermo##Mixture##Transport##Thermo##EqnOfState; \ + \ +defineTemplateTypeNameAndDebugWithName \ +( \ + MixtureThermo##Mixture##Transport##Thermo##EqnOfState, \ + #MixtureThermo \ + "<"#Mixture"<"#Transport"<specieThermo<"#Thermo"<"#EqnOfState">>>>>", \ + 0 \ +); \ + \ +addToRunTimeSelectionTable \ +( \ + basicRhoThermo, \ + MixtureThermo##Mixture##Transport##Thermo##EqnOfState, \ + fvMesh \ +); \ + \ +addToRunTimeSelectionTable \ +( \ + CThermo, \ + MixtureThermo##Mixture##Transport##Thermo##EqnOfState, \ + fvMesh \ +) + + +#define makeHsReactionMixtureThermo(CThermo,MixtureThermo,Mixture,ThermoPhys) \ + \ +typedef MixtureThermo<Mixture<ThermoPhys> > \ + MixtureThermo##Mixture##ThermoPhys; \ + \ +defineTemplateTypeNameAndDebugWithName \ +( \ + MixtureThermo##Mixture##ThermoPhys, \ + #MixtureThermo"<"#Mixture"<"#ThermoPhys">>", \ + 0 \ +); \ + \ +addToRunTimeSelectionTable \ +( \ + basicRhoThermo, \ + MixtureThermo##Mixture##ThermoPhys, \ + fvMesh \ +); \ + \ +addToRunTimeSelectionTable \ +( \ + CThermo, \ + MixtureThermo##Mixture##ThermoPhys, \ + fvMesh \ +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/reactionThermo/hsReactionThermo/newhsReactionThermo.C b/src/thermophysicalModels/reactionThermo/reactionThermo/hsReactionThermo/newhsReactionThermo.C new file mode 100644 index 0000000000000000000000000000000000000000..00457f5674c1616edcbdb9e95c0c8f8e0c6b9daa --- /dev/null +++ b/src/thermophysicalModels/reactionThermo/reactionThermo/hsReactionThermo/newhsReactionThermo.C @@ -0,0 +1,151 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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 "hsReactionThermo.H" +#include "fvMesh.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Foam::autoPtr<Foam::hsReactionThermo> Foam::hsReactionThermo::New +( + const fvMesh& mesh +) +{ + word hsReactionThermoTypeName; + + // Enclose the creation of the thermophysicalProperties to ensure it is + // deleted before the turbulenceModel is created otherwise the dictionary + // is entered in the database twice + { + IOdictionary thermoDict + ( + IOobject + ( + "thermophysicalProperties", + mesh.time().constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ); + + thermoDict.lookup("thermoType") >> hsReactionThermoTypeName; + } + + Info<< "Selecting thermodynamics package " << hsReactionThermoTypeName + << endl; + + fvMeshConstructorTable::iterator cstrIter = + fvMeshConstructorTablePtr_->find(hsReactionThermoTypeName); + + if (cstrIter == fvMeshConstructorTablePtr_->end()) + { + FatalErrorIn("hsReactionThermo::New(const fvMesh&)") + << "Unknown hsReactionThermo type " + << hsReactionThermoTypeName << nl << nl + << "Valid hsReactionThermo types are:" << nl + << fvMeshConstructorTablePtr_->sortedToc() << nl + << exit(FatalError); + } + + return autoPtr<hsReactionThermo>(cstrIter()(mesh)); +} + + +Foam::autoPtr<Foam::hsReactionThermo> Foam::hsReactionThermo::NewType +( + const fvMesh& mesh, + const word& thermoType +) +{ + word hsReactionThermoTypeName; + + // Enclose the creation of the thermophysicalProperties to ensure it is + // deleted before the turbulenceModel is created otherwise the dictionary + // is entered in the database twice + { + IOdictionary thermoDict + ( + IOobject + ( + "thermophysicalProperties", + mesh.time().constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ); + + thermoDict.lookup("thermoType") >> hsReactionThermoTypeName; + + if (hsReactionThermoTypeName.find(thermoType) == string::npos) + { + wordList allModels = fvMeshConstructorTablePtr_->sortedToc(); + DynamicList<word> validModels; + forAll(allModels, i) + { + if (allModels[i].find(thermoType) != string::npos) + { + validModels.append(allModels[i]); + } + } + + FatalErrorIn + ( + "autoPtr<hsReactionThermo> hsReactionThermo::NewType" + "(" + "const fvMesh&, " + "const word&" + ")" + ) << "Inconsistent thermo package selected:" << nl << nl + << hsReactionThermoTypeName << nl << nl << "Please select a " + << "thermo package based on " << thermoType + << ". Valid options include:" << nl << validModels << nl + << exit(FatalError); + } + } + + Info<< "Selecting thermodynamics package " << hsReactionThermoTypeName + << endl; + + fvMeshConstructorTable::iterator cstrIter = + fvMeshConstructorTablePtr_->find(hsReactionThermoTypeName); + + if (cstrIter == fvMeshConstructorTablePtr_->end()) + { + FatalErrorIn("hsReactionThermo::New(const fvMesh&)") + << "Unknown hsReactionThermo type " + << hsReactionThermoTypeName << nl << nl + << "Valid hsReactionThermo types are:" << nl + << fvMeshConstructorTablePtr_->sortedToc() << nl + << exit(FatalError); + } + + return autoPtr<hsReactionThermo>(cstrIter()(mesh)); +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hRhoMixtureThermo/hRhoMixtureThermo.C b/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hRhoMixtureThermo/hRhoMixtureThermo.C index 9cbf9202dee94885edbc428ad5d4f51a10d2a111..e12fadf8a1e86c91f3eba988e76dee9f26932097 100644 --- a/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hRhoMixtureThermo/hRhoMixtureThermo.C +++ b/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hRhoMixtureThermo/hRhoMixtureThermo.C @@ -154,53 +154,6 @@ void Foam::hRhoMixtureThermo<MixtureType>::correct() } -template<class MixtureType> -Foam::tmp<Foam::volScalarField> -Foam::hRhoMixtureThermo<MixtureType>::hs() const -{ - const fvMesh& mesh = T_.mesh(); - - tmp<volScalarField> ths - ( - new volScalarField - ( - IOobject - ( - "hs", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - h_.dimensions() - ) - ); - - volScalarField& hsf = ths(); - scalarField& hsCells = hsf.internalField(); - const scalarField& TCells = T_.internalField(); - - forAll(TCells, celli) - { - hsCells[celli] = this->cellMixture(celli).Hs(TCells[celli]); - } - - forAll(T_.boundaryField(), patchi) - { - scalarField& hsp = hsf.boundaryField()[patchi]; - const scalarField& Tp = T_.boundaryField()[patchi]; - - forAll(Tp, facei) - { - hsp[facei] = this->patchFaceMixture(patchi, facei).Hs(Tp[facei]); - } - } - - return ths; -} - - template<class MixtureType> Foam::tmp<Foam::volScalarField> Foam::hRhoMixtureThermo<MixtureType>::hc() const diff --git a/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hRhoMixtureThermo/hRhoMixtureThermo.H b/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hRhoMixtureThermo/hRhoMixtureThermo.H index 570f696bac41be646b72fdf814b648c1811b285f..28e95270d91c63fee986c1bf258ffe355f9ffe6e 100644 --- a/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hRhoMixtureThermo/hRhoMixtureThermo.H +++ b/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hRhoMixtureThermo/hRhoMixtureThermo.H @@ -94,9 +94,6 @@ public: //- Update properties virtual void correct(); - //- Sensible enthalpy [J/kg] - virtual tmp<volScalarField> hs() const; - //- Chemical enthalpy [J/kg] virtual tmp<volScalarField> hc() const; diff --git a/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hsRhoMixtureThermo/hsRhoMixtureThermo.C b/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hsRhoMixtureThermo/hsRhoMixtureThermo.C new file mode 100644 index 0000000000000000000000000000000000000000..e17bd8d120a251635c57248f23dbc158fb2d3265 --- /dev/null +++ b/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hsRhoMixtureThermo/hsRhoMixtureThermo.C @@ -0,0 +1,320 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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 "hsRhoMixtureThermo.H" +#include "fvMesh.H" +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template<class MixtureType> +void Foam::hsRhoMixtureThermo<MixtureType>::calculate() +{ + const scalarField& hsCells = hs_.internalField(); + const scalarField& pCells = p_.internalField(); + + scalarField& TCells = T_.internalField(); + scalarField& psiCells = psi_.internalField(); + scalarField& rhoCells = rho_.internalField(); + scalarField& muCells = mu_.internalField(); + scalarField& alphaCells = alpha_.internalField(); + + forAll(TCells, celli) + { + const typename MixtureType::thermoType& mixture = + this->cellMixture(celli); + + TCells[celli] = mixture.THs(hsCells[celli], TCells[celli]); + psiCells[celli] = mixture.psi(pCells[celli], TCells[celli]); + rhoCells[celli] = mixture.rho(pCells[celli], TCells[celli]); + + muCells[celli] = mixture.mu(TCells[celli]); + alphaCells[celli] = mixture.alpha(TCells[celli]); + } + + forAll(T_.boundaryField(), patchi) + { + fvPatchScalarField& pp = p_.boundaryField()[patchi]; + fvPatchScalarField& pT = T_.boundaryField()[patchi]; + fvPatchScalarField& ppsi = psi_.boundaryField()[patchi]; + fvPatchScalarField& prho = rho_.boundaryField()[patchi]; + + fvPatchScalarField& phs = hs_.boundaryField()[patchi]; + + fvPatchScalarField& pmu_ = mu_.boundaryField()[patchi]; + fvPatchScalarField& palpha_ = alpha_.boundaryField()[patchi]; + + if (pT.fixesValue()) + { + forAll(pT, facei) + { + const typename MixtureType::thermoType& mixture = + this->patchFaceMixture(patchi, facei); + + phs[facei] = mixture.Hs(pT[facei]); + + ppsi[facei] = mixture.psi(pp[facei], pT[facei]); + prho[facei] = mixture.rho(pp[facei], pT[facei]); + pmu_[facei] = mixture.mu(pT[facei]); + palpha_[facei] = mixture.alpha(pT[facei]); + } + } + else + { + forAll(pT, facei) + { + const typename MixtureType::thermoType& mixture = + this->patchFaceMixture(patchi, facei); + + pT[facei] = mixture.THs(phs[facei], pT[facei]); + + ppsi[facei] = mixture.psi(pp[facei], pT[facei]); + prho[facei] = mixture.rho(pp[facei], pT[facei]); + pmu_[facei] = mixture.mu(pT[facei]); + palpha_[facei] = mixture.alpha(pT[facei]); + } + } + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class MixtureType> +Foam::hsRhoMixtureThermo<MixtureType>::hsRhoMixtureThermo(const fvMesh& mesh) +: + hsReactionThermo(mesh), + MixtureType(*this, mesh) +{ + scalarField& hsCells = hs_.internalField(); + const scalarField& TCells = T_.internalField(); + + forAll(hsCells, celli) + { + hsCells[celli] = this->cellMixture(celli).Hs(TCells[celli]); + } + + forAll(hs_.boundaryField(), patchi) + { + hs_.boundaryField()[patchi] == hs(T_.boundaryField()[patchi], patchi); + } + + hBoundaryCorrection(hs_); + + calculate(); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class MixtureType> +Foam::hsRhoMixtureThermo<MixtureType>::~hsRhoMixtureThermo() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class MixtureType> +void Foam::hsRhoMixtureThermo<MixtureType>::correct() +{ + if (debug) + { + Info<< "entering hsRhoMixtureThermo<MixtureType>::correct()" << endl; + } + + calculate(); + + if (debug) + { + Info<< "exiting hsRhoMixtureThermo<MixtureType>::correct()" << endl; + } +} + + +template<class MixtureType> +Foam::tmp<Foam::volScalarField> +Foam::hsRhoMixtureThermo<MixtureType>::hc() const +{ + const fvMesh& mesh = T_.mesh(); + + tmp<volScalarField> thc + ( + new volScalarField + ( + IOobject + ( + "hc", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + hs_.dimensions() + ) + ); + + volScalarField& hcf = thc(); + scalarField& hcCells = hcf.internalField(); + + forAll(hcCells, celli) + { + hcCells[celli] = this->cellMixture(celli).Hc(); + } + + forAll(hcf.boundaryField(), patchi) + { + scalarField& hcp = hcf.boundaryField()[patchi]; + + forAll(hcp, facei) + { + hcp[facei] = this->patchFaceMixture(patchi, facei).Hc(); + } + } + + return thc; +} + + +template<class MixtureType> +Foam::tmp<Foam::scalarField> +Foam::hsRhoMixtureThermo<MixtureType>::hs +( + const scalarField& T, + const labelList& cells +) const +{ + tmp<scalarField> ths(new scalarField(T.size())); + scalarField& hs = ths(); + + forAll(T, celli) + { + hs[celli] = this->cellMixture(cells[celli]).Hs(T[celli]); + } + + return ths; +} + + +template<class MixtureType> +Foam::tmp<Foam::scalarField> +Foam::hsRhoMixtureThermo<MixtureType>::hs +( + const scalarField& T, + const label patchi +) const +{ + tmp<scalarField> ths(new scalarField(T.size())); + scalarField& hs = ths(); + + forAll(T, facei) + { + hs[facei] = this->patchFaceMixture(patchi, facei).Hs(T[facei]); + } + + return ths; +} + + +template<class MixtureType> +Foam::tmp<Foam::scalarField> +Foam::hsRhoMixtureThermo<MixtureType>::Cp +( + const scalarField& T, + const label patchi +) const +{ + tmp<scalarField> tCp(new scalarField(T.size())); + + scalarField& cp = tCp(); + + forAll(T, facei) + { + cp[facei] = this->patchFaceMixture(patchi, facei).Cp(T[facei]); + } + + return tCp; +} + + +template<class MixtureType> +Foam::tmp<Foam::volScalarField> +Foam::hsRhoMixtureThermo<MixtureType>::Cp() const +{ + const fvMesh& mesh = T_.mesh(); + + tmp<volScalarField> tCp + ( + new volScalarField + ( + IOobject + ( + "Cp", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimEnergy/dimMass/dimTemperature + ) + ); + + volScalarField& cp = tCp(); + + scalarField& cpCells = cp.internalField(); + const scalarField& TCells = T_.internalField(); + + forAll(TCells, celli) + { + cpCells[celli] = this->cellMixture(celli).Cp(TCells[celli]); + } + + forAll(T_.boundaryField(), patchi) + { + cp.boundaryField()[patchi] = Cp(T_.boundaryField()[patchi], patchi); + } + + return tCp; +} + + +template<class MixtureType> +bool Foam::hsRhoMixtureThermo<MixtureType>::read() +{ + if (hsReactionThermo::read()) + { + MixtureType::read(*this); + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hsRhoMixtureThermo/hsRhoMixtureThermo.H b/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hsRhoMixtureThermo/hsRhoMixtureThermo.H new file mode 100644 index 0000000000000000000000000000000000000000..f11b02e599a36a361f356846d807aa16bb908977 --- /dev/null +++ b/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hsRhoMixtureThermo/hsRhoMixtureThermo.H @@ -0,0 +1,148 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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::hsRhoMixtureThermo + +Description + Foam::hsRhoMixtureThermo + +SourceFiles + hsRhoMixtureThermo.C + +\*---------------------------------------------------------------------------*/ + +#ifndef hsRhoMixtureThermo_H +#define hsRhoMixtureThermo_H + +#include "hsReactionThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class hsRhoMixtureThermo Declaration +\*---------------------------------------------------------------------------*/ + +template<class MixtureType> +class hsRhoMixtureThermo +: + public hsReactionThermo, + public MixtureType +{ + // Private member functions + + void calculate(); + + //- Construct as copy (not implemented) + hsRhoMixtureThermo(const hsRhoMixtureThermo<MixtureType>&); + + +public: + + //- Runtime type information + TypeName("hsRhoMixtureThermo"); + + + // Constructors + + //- Construct from mesh + hsRhoMixtureThermo(const fvMesh&); + + + //- Destructor + virtual ~hsRhoMixtureThermo(); + + + // Member functions + + //- Return the compostion of the multi-component mixture + virtual basicMultiComponentMixture& composition() + { + return *this; + } + + //- Return the compostion of the multi-component mixture + virtual const basicMultiComponentMixture& composition() const + { + return *this; + } + + //- Update properties + virtual void correct(); + + + // Fields derived from thermodynamic state variables + + //- Chemical enthalpy [J/kg] + virtual tmp<volScalarField> hc() const; + + + //- Sensible nthalpy for cell-set [J/kg] + virtual tmp<scalarField> hs + ( + const scalarField& T, + const labelList& cells + ) const; + + //- Sensible enthalpy for patch [J/kg] + virtual tmp<scalarField> hs + ( + const scalarField& T, + const label patchi + ) const; + + //- Heat capacity at constant pressure for patch [J/kg/K] + virtual tmp<scalarField> Cp + ( + const scalarField& T, + const label patchi + ) const; + + //- Heat capacity at constant pressure [J/kg/K] + virtual tmp<volScalarField> Cp() const; + + + //- Read thermophysicalProperties dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "hsRhoMixtureThermo.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/thermo/specieThermo/specieThermo.H b/src/thermophysicalModels/specie/thermo/specieThermo/specieThermo.H index 560f8f4145f7e9faed0f176f3a8946a1ae752e9c..7ec9d97959625189c1ee0713004415dbd0508bd6 100644 --- a/src/thermophysicalModels/specie/thermo/specieThermo/specieThermo.H +++ b/src/thermophysicalModels/specie/thermo/specieThermo/specieThermo.H @@ -242,6 +242,9 @@ public: //- Temperature from Enthalpy given an initial temperature T0 inline scalar TH(const scalar H, const scalar T0) const; + //- Temperature from sensible Enthalpy given an initial T0 + inline scalar THs(const scalar Hs, const scalar T0) const; + //- Temperature from internal energy given an initial temperature T0 inline scalar TE(const scalar E, const scalar T0) const; diff --git a/src/thermophysicalModels/specie/thermo/specieThermo/specieThermoI.H b/src/thermophysicalModels/specie/thermo/specieThermo/specieThermoI.H index 215ea7b2032eff381cd5512f7f239bb6e82484dc..788f6b9055464eb9ba99a5af6db330b549e98621 100644 --- a/src/thermophysicalModels/specie/thermo/specieThermo/specieThermoI.H +++ b/src/thermophysicalModels/specie/thermo/specieThermo/specieThermoI.H @@ -281,6 +281,17 @@ inline Foam::scalar Foam::specieThermo<thermo>::TH } +template<class thermo> +inline Foam::scalar Foam::specieThermo<thermo>::THs +( + const scalar hs, + const scalar T0 +) const +{ + return T(hs, T0, &specieThermo<thermo>::Hs, &specieThermo<thermo>::Cp); +} + + template<class thermo> inline Foam::scalar Foam::specieThermo<thermo>::TE ( diff --git a/tutorials/combustion/dieselFoam/aachenBomb/constant/thermophysicalProperties b/tutorials/combustion/dieselFoam/aachenBomb/constant/thermophysicalProperties index 0cda0abcd2ac7bf094a452e574af8b343b2ed9bf..e5fbb0bd7836dae94db2bd4250c037c7359fd7d2 100644 --- a/tutorials/combustion/dieselFoam/aachenBomb/constant/thermophysicalProperties +++ b/tutorials/combustion/dieselFoam/aachenBomb/constant/thermophysicalProperties @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -thermoType hPsiMixtureThermo<reactingMixture<gasThermoPhysics>>; +thermoType hsPsiMixtureThermo<reactingMixture<gasThermoPhysics>>; CHEMKINFile "$FOAM_CASE/chemkin/chem.inp"; diff --git a/tutorials/combustion/dieselFoam/aachenBomb/system/fvSchemes b/tutorials/combustion/dieselFoam/aachenBomb/system/fvSchemes index fb78bfbd25ab185c7be42dd1a6d09d825a164c76..1ac217a85784ac3bc3beed344c241dcdecec2e4a 100644 --- a/tutorials/combustion/dieselFoam/aachenBomb/system/fvSchemes +++ b/tutorials/combustion/dieselFoam/aachenBomb/system/fvSchemes @@ -39,7 +39,7 @@ divSchemes { fu limitedLinear 1; ft limitedLinear 1; - h limitedLinear 1; + hs limitedLinear 1; }; div((muEff*dev2(grad(U).T()))) Gauss linear; } @@ -50,7 +50,7 @@ laplacianSchemes laplacian(muEff,U) Gauss linear corrected; laplacian(muEff,ft) Gauss linear corrected; laplacian(muEff,fu) Gauss linear corrected; - laplacian(((alphah*mut)+alpha),h) Gauss linear corrected; + laplacian(((alphah*mut)+alpha),hs) Gauss linear corrected; laplacian((rho|A(U)),p) Gauss linear corrected; laplacian(rhoD,k) Gauss linear corrected; laplacian(rhoD,epsilon) Gauss linear corrected; diff --git a/tutorials/combustion/dieselFoam/aachenBomb/system/fvSolution b/tutorials/combustion/dieselFoam/aachenBomb/system/fvSolution index a1ebddd2ca4ce89c5fb7504d63bc9eceda0b6a3c..90bf7e8dac0a15614c63505a48517830cd029dfd 100644 --- a/tutorials/combustion/dieselFoam/aachenBomb/system/fvSolution +++ b/tutorials/combustion/dieselFoam/aachenBomb/system/fvSolution @@ -31,7 +31,7 @@ solvers tolerance 1e-06; } - "(U|Yi|h|k|epsilon)" + "(U|Yi|hs|k|epsilon)" { solver PBiCG; preconditioner DILU; diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/G b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/G new file mode 100644 index 0000000000000000000000000000000000000000..fd0982491c620462f6851cb538d2be2efe95d6c9 --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/G @@ -0,0 +1,32 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object G; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 0 -3 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + ".*" + { + type MarshakRadiation; + T T; + emissivity 1; + value uniform 0; + } +} + +// ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/IDefault b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/IDefault new file mode 100644 index 0000000000000000000000000000000000000000..61b02dea13d844c93a773502a5c9288b99978b97 --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/IDefault @@ -0,0 +1,32 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object IDefault; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 0 -3 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + ".*" + { + type greyDiffusiveRadiation; + T T; + emissivity 1.0 + value uniform 0; + } +} + +// ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/T b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/T new file mode 100755 index 0000000000000000000000000000000000000000..1c7d1ebb4d55cb4cfb065e9a471cc237c216ecb0 --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/T @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object T; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 300; + +boundaryField +{ + outlet + { + type inletOutlet; + inletValue uniform 300; + value uniform 300; + } + sides + { + type inletOutlet; + inletValue uniform 300; + value uniform 300; + } + base + { + type zeroGradient; + } + inlet + { + type fixedValue; + value uniform 300; + } + frontBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/U b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/U new file mode 100755 index 0000000000000000000000000000000000000000..48e4aab470ddcae4baead5ef0e43b75acc0903d9 --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/U @@ -0,0 +1,55 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + location "0"; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + outlet + { + + type inletOutlet; + inletValue uniform (0 0 0); + value uniform (0 0 0); + + } + sides + { + type pressureInletOutletVelocity; + outletValue uniform (0 0 0); + value uniform (0 0 0); + } + base + { + type fixedValue; + value uniform (0 0 0); + } + inlet + { + type fixedValue; + value uniform (0 0.05 0); + } + frontBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/alphaSgs b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/alphaSgs new file mode 100755 index 0000000000000000000000000000000000000000..c840a07a08e78775f21a5ff3ea0cc2cc6b821f97 --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/alphaSgs @@ -0,0 +1,47 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object alphaSgs; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + outlet + { + type zeroGradient; + } + sides + { + type zeroGradient; + } + base + { + type zeroGradient; + } + inlet + { + type zeroGradient; + } + frontBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/b b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/b new file mode 100755 index 0000000000000000000000000000000000000000..0fbbd652fef5c361395a5502ae033ccb19005d7d --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/b @@ -0,0 +1,47 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object b; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + outlet + { + type zeroGradient; + } + sides + { + type zeroGradient; + } + base + { + type zeroGradient; + } + inlet + { + type zeroGradient; + } + frontBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/ft b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/ft new file mode 100755 index 0000000000000000000000000000000000000000..44b0a149551af8622f9968807576310b0de84173 --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/ft @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object ft; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + outlet + { + type inletOutlet; + inletValue uniform 0; + value uniform 0; + } + sides + { + type inletOutlet; + inletValue uniform 0; + value uniform 0; + } + base + { + type zeroGradient; + } + inlet + { + type fixedValue; + value uniform 1.0; + } + frontBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/fu b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/fu new file mode 100755 index 0000000000000000000000000000000000000000..e3b3011de317a317c710f4fc6b42d666046f8c91 --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/fu @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object fu; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + outlet + { + type inletOutlet; + inletValue uniform 0; + value uniform 0; + } + sides + { + type inletOutlet; + inletValue uniform 0; + value uniform 0; + } + base + { + type zeroGradient; + } + inlet + { + type fixedValue; + value uniform 1.0; + } + frontBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/k b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/k new file mode 100755 index 0000000000000000000000000000000000000000..80db42f64f8d054dd7a85b2de03ce68589e01a0f --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/k @@ -0,0 +1,53 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 1e-4; + +boundaryField +{ + outlet + { + type inletOutlet; + inletValue uniform 1e-4; + value uniform 1e-4; + } + sides + { + type inletOutlet; + inletValue uniform 1e-4; + value uniform 1e-4; + } + base + { + type fixedValue; + value uniform 1e-4; + } + inlet + { + type fixedValue; + value uniform 1e-4; + } + frontBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/muSgs b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/muSgs new file mode 100755 index 0000000000000000000000000000000000000000..f8b645f718b5ca5fe7094bb6e9b642641f632528 --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/muSgs @@ -0,0 +1,47 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object muSgs; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + outlet + { + type zeroGradient; + } + sides + { + type zeroGradient; + } + base + { + type zeroGradient; + } + inlet + { + type zeroGradient; + } + frontBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/p b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/p new file mode 100755 index 0000000000000000000000000000000000000000..d25a0c7e11d1bf93f25afe42aa3f1bcdeaab1f6b --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/p @@ -0,0 +1,55 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 101325; + +boundaryField +{ + outlet + { + type buoyantPressure; + value uniform 101325; + } + + sides + { + type uniformDensityHydrostaticPressure; + rho 1.2; + pRefValue 101325; + pRefPoint (0 0 0); + value $internalField; + } + base + { + type buoyantPressure; + value $internalField; + } + inlet + { + type buoyantPressure; + value $internalField; + } + frontBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/Allrun b/tutorials/combustion/fireFoam/les/smallPoolFire2D/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..4d995124bb70bd6509a91a1cf07f4b2cb15c0bff --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/Allrun @@ -0,0 +1,13 @@ +#!/bin/sh + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +runApplication blockMesh +runApplication setSet -batch makeFaceSet.setSet +runApplication createPatch -overwrite + +# Run +runApplication fireFoam + +# ----------------------------------------------------------------------------- diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/LESProperties b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/LESProperties new file mode 100644 index 0000000000000000000000000000000000000000..17f30efd1fb7fd5e67a17052137394e3de003448 --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/LESProperties @@ -0,0 +1,84 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.openfoam.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +FoamFile +{ + version 2.0; + format binary; + class dictionary; + location "constant"; + object LESProperties; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +LESModel oneEqEddy; + +delta cubeRootVol; + +turbulence on; + +printCoeffs on; + + +cubeRootVolCoeffs +{ + deltaCoeff 1; +} + +PrandtlCoeffs +{ + delta cubeRootVol; + cubeRootVolCoeffs + { + deltaCoeff 1; + } + smoothCoeffs + { + delta cubeRootVol; + cubeRootVolCoeffs + { + deltaCoeff 1; + } + maxDeltaRatio 1.1; + } + Cdelta 0.158; +} + +vanDriestCoeffs +{ + delta cubeRootVol; + cubeRootVolCoeffs + { + deltaCoeff 1; + } + smoothCoeffs + { + delta cubeRootVol; + cubeRootVolCoeffs + { + deltaCoeff 1; + } + maxDeltaRatio 1.1; + } + Aplus 26; + Cdelta 0.158; +} + +smoothCoeffs +{ + delta cubeRootVol; + cubeRootVolCoeffs + { + deltaCoeff 1; + } + maxDeltaRatio 1.1; +} + + +// ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/SpeciesTable b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/SpeciesTable new file mode 100644 index 0000000000000000000000000000000000000000..98d27237ea171a717c84e0497a66cbad00a75484 --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/SpeciesTable @@ -0,0 +1,491 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object SpeciesTable; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +fields +1 +( + +{ + name ft; + min 0; + max 1; + N 100; +} + +) +; +output +5 +( + +{ + name CH4; +} + + +{ + name CO2; +} + + +{ + name H2O; +} + + +{ + name CO; +} + + +{ + name soot; +} + +) +; +values +6 +( + +101 +( +0.001 +0.011 +0.021 +0.031 +0.041 +0.051 +0.061 +0.071 +0.081 +0.091 +0.101 +0.111 +0.121 +0.131 +0.141 +0.151 +0.161 +0.171 +0.181 +0.191 +0.201 +0.211 +0.221 +0.231 +0.241 +0.251 +0.261 +0.271 +0.281 +0.291 +0.301 +0.311 +0.321 +0.331 +0.341 +0.351 +0.361 +0.371 +0.381 +0.391 +0.401 +0.411 +0.421 +0.431 +0.441 +0.451 +0.461 +0.471 +0.481 +0.491 +0.501 +0.511 +0.521 +0.531 +0.541 +0.551 +0.561 +0.571 +0.581 +0.591 +0.601 +0.611 +0.621 +0.631 +0.641 +0.651 +0.661 +0.671 +0.681 +0.691 +0.701 +0.711 +0.721 +0.731 +0.741 +0.751 +0.761 +0.771 +0.781 +0.791 +0.801 +0.811 +0.821 +0.831 +0.841 +0.851 +0.861 +0.871 +0.881 +0.891 +0.901 +0.911 +0.921 +0.931 +0.941 +0.951 +0.961 +0.971 +0.981 +0.991 +0.999 +) + + +101 +( +0 +0 +0 +0 +0 +0 +0.0105883 +0.0285208 +0.0461843 +0.0635849 +0.0807284 +0.0976204 +0.114266 +0.130672 +0.146842 +0.162782 +0.178496 +0.193989 +0.209266 +0.224332 +0.23919 +0.253845 +0.268301 +0.282563 +0.296633 +0.310517 +0.324216 +0.337736 +0.35108 +0.364251 +0.377252 +0.390087 +0.402759 +0.415271 +0.427625 +0.439826 +0.451876 +0.463777 +0.475532 +0.487144 +0.498616 +0.50995 +0.521148 +0.532214 +0.543149 +0.553955 +0.564635 +0.575191 +0.585626 +0.595941 +0.606138 +0.61622 +0.626187 +0.636044 +0.64579 +0.655428 +0.66496 +0.674387 +0.683712 +0.692935 +0.702059 +0.711085 +0.720014 +0.728849 +0.73759 +0.74624 +0.754799 +0.763269 +0.771652 +0.779948 +0.788159 +0.796287 +0.804332 +0.812297 +0.820181 +0.827987 +0.835715 +0.843367 +0.850943 +0.858445 +0.865875 +0.873232 +0.880518 +0.887735 +0.894882 +0.901961 +0.908974 +0.91592 +0.922802 +0.929619 +0.936373 +0.943064 +0.949694 +0.956263 +0.962772 +0.969222 +0.975614 +0.981948 +0.988226 +0.994448 +0.999385 +) + + +101 +( +0.00200328 +0.0213922 +0.0396804 +0.0569589 +0.0733092 +0.088804 +0.0940165 +0.0923125 +0.0906341 +0.0889806 +0.0873516 +0.0857465 +0.0841647 +0.0826058 +0.0810693 +0.0795547 +0.0780615 +0.0765893 +0.0751376 +0.073706 +0.0722942 +0.0709016 +0.0695279 +0.0681728 +0.0668357 +0.0655165 +0.0642147 +0.06293 +0.0616621 +0.0604105 +0.0591751 +0.0579555 +0.0567514 +0.0555625 +0.0543885 +0.0532292 +0.0520842 +0.0509534 +0.0498363 +0.0487329 +0.0476428 +0.0465658 +0.0455017 +0.0444503 +0.0434112 +0.0423844 +0.0413695 +0.0403664 +0.0393749 +0.0383948 +0.0374258 +0.0364678 +0.0355206 +0.0345841 +0.033658 +0.0327421 +0.0318364 +0.0309406 +0.0300546 +0.0291781 +0.0283112 +0.0274535 +0.026605 +0.0257655 +0.0249349 +0.024113 +0.0232997 +0.0224948 +0.0216983 +0.0209099 +0.0201297 +0.0193573 +0.0185928 +0.0178361 +0.0170869 +0.0163452 +0.0156108 +0.0148837 +0.0141638 +0.0134509 +0.0127449 +0.0120458 +0.0113535 +0.0106678 +0.00998859 +0.00931588 +0.00864953 +0.00798947 +0.00733558 +0.0066878 +0.00604604 +0.00541021 +0.00478022 +0.00415601 +0.00353749 +0.00292458 +0.00231721 +0.00171531 +0.00111879 +0.000527591 +5.8413e-05 +) + + +101 +( +0.00400655 +0.0427844 +0.0793607 +0.113918 +0.146618 +0.177608 +0.188033 +0.184625 +0.181268 +0.177961 +0.174703 +0.171493 +0.168329 +0.165212 +0.162139 +0.159109 +0.156123 +0.153179 +0.150275 +0.147412 +0.144588 +0.141803 +0.139056 +0.136346 +0.133671 +0.131033 +0.128429 +0.12586 +0.123324 +0.120821 +0.11835 +0.115911 +0.113503 +0.111125 +0.108777 +0.106458 +0.104168 +0.101907 +0.0996727 +0.0974658 +0.0952856 +0.0931317 +0.0910035 +0.0889006 +0.0868225 +0.0847688 +0.082739 +0.0807328 +0.0787498 +0.0767895 +0.0748516 +0.0729356 +0.0710413 +0.0691682 +0.067316 +0.0654843 +0.0636728 +0.0618812 +0.0601091 +0.0583563 +0.0566223 +0.054907 +0.05321 +0.051531 +0.0498697 +0.0482259 +0.0465993 +0.0449896 +0.0433965 +0.0418198 +0.0402593 +0.0387147 +0.0371857 +0.0356721 +0.0341737 +0.0326903 +0.0312216 +0.0297674 +0.0283276 +0.0269018 +0.0254899 +0.0240917 +0.022707 +0.0213355 +0.0199772 +0.0186318 +0.0172991 +0.0159789 +0.0146712 +0.0133756 +0.0120921 +0.0108204 +0.00956045 +0.00831202 +0.00707498 +0.00584917 +0.00463443 +0.00343062 +0.00223758 +0.00105518 +0.000116826 +) + +101{0} +101{0} +) +; diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/combustionProperties b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/combustionProperties new file mode 100644 index 0000000000000000000000000000000000000000..9619d659c77bdf65ae6bf5dd1f49a9b446f25ad8 --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/combustionProperties @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object combustionProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +combustionModel infinitelyFastChemistry; + +infinitelyFastChemistryCoeffs +{ + C 10.0; +} + +noCombustionCoeffs +{ +} + + +// ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/g b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/g new file mode 100644 index 0000000000000000000000000000000000000000..2845e492e925860efc7e2c85e2ab0069aee643fd --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/g @@ -0,0 +1,21 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value (0 -9.8 0); + +// ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/polyMesh/blockMeshDict b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/polyMesh/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..0f18c0d733830bc2768ff312ea9078a0c821ce14 --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/polyMesh/blockMeshDict @@ -0,0 +1,67 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 1; + +vertices +( + (-0.5 0 -0.01) + ( 0.5 0 -0.01) + ( 0.5 1 -0.01) + (-0.5 1 -0.01) + (-0.5 0 0.01) + ( 0.5 0 0.01) + ( 0.5 1 0.01) + (-0.5 1 0.01) + +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (150 150 1) simpleGrading (1 1 1) +); + +edges +( +); + +patches +( + patch base + ( + (0 1 5 4) + ) + patch outlet + ( + (3 2 6 7) + ) + patch sides + ( + (1 5 6 2) + (0 4 7 3) + ) + empty frontAndBack + ( + (0 1 2 3) + (4 5 6 7) + ) +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/polyMesh/boundary b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/polyMesh/boundary new file mode 100644 index 0000000000000000000000000000000000000000..ce658ffe2525b139025eff2cb449728439bbadf9 --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/polyMesh/boundary @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class polyBoundaryMesh; + location "constant/polyMesh"; + object boundary; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +5 +( + base + { + type patch; + nFaces 134; + startFace 44700; + } + outlet + { + type patch; + nFaces 150; + startFace 44834; + } + sides + { + type patch; + nFaces 300; + startFace 44984; + } + frontAndBack + { + type empty; + nFaces 45000; + startFace 45284; + } + inlet + { + type patch; + nFaces 16; + startFace 90284; + } +) + +// ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/radiationProperties b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/radiationProperties new file mode 100644 index 0000000000000000000000000000000000000000..5cf96fad766a735835295727ca5a507edd3b4d49 --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/radiationProperties @@ -0,0 +1,149 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object radiationProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +radiation on; + +radiationModel fvDOM; + +noRadiation +{ +} + +P1Coeffs +{ +} + +fvDOMCoeffs +{ + nPhi 4; // azimuthal angles in PI/2 on X-Y.(from Y to X) + nTheta 0; // polar angles in PI (from Z to X-Y plane) + convergence 1e-3; // convergence criteria for radiation iteration + maxIter 1; // maximum number of iterations +} + +// Number of flow iterations per radiation iteration +solverFreq 10; + +absorptionEmissionModel greyMeanAbsorptionEmission; + +constantAbsorptionEmissionCoeffs +{ + a a [ 0 -1 0 0 0 0 0 ] 0.01; + e e [ 0 -1 0 0 0 0 0 ] 0; + E E [ 1 -1 -3 0 0 0 0 ] 0; +} + +greyMeanAbsorptionEmissionCoeffs +{ + lookUpTableFileName "SpeciesTable"; + + EhrrCoeff 0.0; + + CO2 + { + Tcommon 300; //Common Temp + invTemp true; //Is the polynomio using inverse temperature. + Tlow 200; //Low Temp + Thigh 2500; //High Temp + + loTcoeffs //coefss for T < Tcommon + ( + 0 // a0 + + 0 // a1*T + + 0 // a2*T^(+/-)2 + + 0 // a3*T^(+/-)3 + + 0 // a4*T^(+/-)4 + + 0 // a5*T^(+/-)5 + + ); + hiTcoeffs //coefss for T > Tcommon + ( + 18.741 + -121.31e3 + 273.5e6 + -194.05e9 + 56.31e12 + -5.8169e15 + ); + + } + + H2O + { + Tcommon 300; + invTemp true; + Tlow 200; + Thigh 2500; + + loTcoeffs + ( + 0 + 0 + 0 + 0 + 0 + 0 + ); + hiTcoeffs + ( + -0.23093 + -1.12390e3 + 9.4153e6 + -2.99885e9 + 0.51382e12 + -1.868e10 + ); + } + + CH4 + { + Tcommon 300; + Tlow 200; + Thigh 2500; + invTemp false; + + loTcoeffs + ( + 0 + 0 + 0 + 0 + 0 + 0 + ); + hiTcoeffs + ( + 6.6334 + -0.0035686 + 1.6682e-8 + 2.5611e-10 + -2.6558e-14 + 0 + ); + } + +} + +scatterModel constantScatter; + +constantScatterCoeffs +{ + sigma sigma [ 0 -1 0 0 0 0 0 ] 0; + C C [ 0 0 0 0 0 0 0 ] 0; +} + + +// ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/thermophysicalProperties b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/thermophysicalProperties new file mode 100644 index 0000000000000000000000000000000000000000..2e4a2e74af5eccb9b5c187a22a7ac761db6e1355 --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/thermophysicalProperties @@ -0,0 +1,55 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.openfoam.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object thermophysicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermoType hsPsiMixtureThermo<veryInhomogeneousMixture<sutherlandTransport<specieThermo<janafThermo<perfectGas>>>>>; + +stoichiometricAirFuelMassRatio stoichiometricAirFuelMassRatio [0 0 0 0 0 0 0] 17.1271; +stoichiometricOxygenFuelMassRatio stoichiometricOxygenFuelMassRatio [0 0 0 0 0 0 0] 4.0; +qFuel qFuel [0 2 -2 0 0 0 0] 5.00264e+07; + +fuel fuel 1 16.0428 + 200 6000 1000 + 1.63543 0.0100844 -3.36924e-06 5.34973e-10 -3.15528e-14 -10005.6 9.9937 + 5.14988 -0.013671 4.91801e-05 -4.84744e-08 1.66694e-11 -10246.6 -4.64132 + 1.67212e-06 170.672; + +oxidant oxidant 1 28.8504 + 200 6000 1000 + 3.10131 0.00124137 -4.18816e-07 6.64158e-11 -3.91274e-15 -985.266 5.35597 + 3.58378 -0.000727005 1.67057e-06 -1.09203e-10 -4.31765e-13 -1050.53 3.11239 + 1.67212e-06 170.672; + +reactants reactants 1 27.6004 + 200 6000 1000 + 2.95825 0.00210441 -7.06762e-07 1.12145e-10 -6.61028e-15 -1865.61 5.80859 + 3.73662 -0.00199028 6.30727e-06 -4.82941e-09 1.23723e-12 -1948.03 2.35566 + 1.67212e-06 170.672; + +burntProducts burntProducts 1 27.6334 + 200 6000 1000 + 3.0602 0.00182422 -5.93878e-07 8.93807e-11 -4.97595e-15 -10998.7 5.32209 + 3.54628 0.000378279 2.02797e-07 9.31602e-10 -6.84016e-13 -11102.1 2.90098 + 1.67212e-06 170.672; + +products products 1 27.6004 + 200 6000 1000 + 3.05615 0.0018477 -6.01767e-07 9.06474e-11 -5.05149e-15 -10995.9 5.33537 + 3.55084 0.000338343 3.42018e-07 7.91162e-10 -6.34688e-13 -11099.7 2.87954 + 1.67212e-06 170.672; + + +// ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/turbulenceProperties b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..d44ea0a37125e0c4a34ba83ae4a6c556f39236d4 --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/turbulenceProperties @@ -0,0 +1,23 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.openfoam.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +FoamFile +{ + version 2.0; + format binary; + class dictionary; + location "constant"; + object turbulenceProperties; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType LESModel; + + +// ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/makeFaceSet.setSet b/tutorials/combustion/fireFoam/les/smallPoolFire2D/makeFaceSet.setSet new file mode 100644 index 0000000000000000000000000000000000000000..78681a7505850cc0519ce586eb04590d655ab63e --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/makeFaceSet.setSet @@ -0,0 +1 @@ +faceSet f0 new boxToFace (-0.0529 -0.001 -0.1)(0.0529 0.002 0.1) diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/system/controlDict b/tutorials/combustion/fireFoam/les/smallPoolFire2D/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..aa179ea0851a6c7aa5a9f38829869a9358f55234 --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/system/controlDict @@ -0,0 +1,55 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.openfoam.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application fireFoam; + +startFrom startTime; + +startTime 0.0; + +stopAt endTime; + +endTime 3.0; + +deltaT 0.001; + +writeControl adjustableRunTime; + +writeInterval 0.1; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +graphFormat raw; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 0.25; + +maxDeltaT 0.1; + +// ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/system/createPatchDict b/tutorials/combustion/fireFoam/les/smallPoolFire2D/system/createPatchDict new file mode 100644 index 0000000000000000000000000000000000000000..1db65e4d32e9f44abb11309efbfdd2554a47cd5c --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/system/createPatchDict @@ -0,0 +1,80 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object createPatchDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// This application/dictionary controls: +// - optional: create new patches from boundary faces (either given as +// a set of patches or as a faceSet) +// - always: order faces on coupled patches such that they are opposite. This +// is done for all coupled faces, not just for any patches created. +// - optional: synchronise points on coupled patches. + +// 1. Create cyclic: +// - specify where the faces should come from +// - specify the type of cyclic. If a rotational specify the rotationAxis +// and centre to make matching easier +// - pointSync true to guarantee points to line up. + +// 2. Correct incorrect cyclic: +// This will usually fail upon loading: +// "face 0 area does not match neighbour 2 by 0.0100005%" +// " -- possible face ordering problem." +// - change patch type from 'cyclic' to 'patch' in the polyMesh/boundary file. +// - loosen match tolerance to get case to load +// - regenerate cyclic as above + + +// Tolerance used in matching faces. Absolute tolerance is span of +// face times this factor. To load incorrectly matches meshes set this +// to a higher value. +matchTolerance 1E-3; + +// Do a synchronisation of coupled points after creation of any patches. +pointSync true; + +// Patches to create. +patchInfo +( + { + // Name of new patch + name inlet; + + // Type of new patch + dictionary + { + type patch; + + // Optional: explicitly set transformation tensor. + // Used when matching and synchronising points. + //transform translational; + //separationVector (-2289 0 0); + transform rotational; + rotationAxis (1 0 0); + rotationCentre (0 0 0); + } + + // How to construct: either from 'patches' or 'set' + constructFrom set; + + // If constructFrom = patches : names of patches. Wildcards allowed. + patches ("periodic.*"); + + // If constructFrom = set : name of faceSet + set f0; + } +); + +// ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/system/fvSchemes b/tutorials/combustion/fireFoam/les/smallPoolFire2D/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..8b24cb3469fc56cae3a762677be34b696decc0b5 --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/system/fvSchemes @@ -0,0 +1,76 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.openfoam.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; + div(phi,U) Gauss limitedLinear 1; + div(phi,k) Gauss limitedLinear 1; + flux(phi,ft) Gauss limitedLinear01 1; + div(phi,ft_b_h) Gauss multivariateSelection + { + fu limitedLinear01 1; + ft limitedLinear01 1; + hs limitedLinear 1; + }; + div((muEff*dev2(grad(U).T()))) Gauss linear; + div(phiU,p) Gauss linear; + div(Ji,Ii_h) Gauss upwind; +} + +laplacianSchemes +{ + default none; + laplacian(muEff,U) Gauss linear corrected; + laplacian(DkEff,k) Gauss linear corrected; + laplacian(DBEff,B) Gauss linear corrected; + laplacian(alphaEff,hs) Gauss linear uncorrected; + laplacian(alphaEff,fu) Gauss linear uncorrected; + laplacian(alphaEff,ft) Gauss linear uncorrected; + laplacian((((rho*(1|A(U)))*rho)*gh)) Gauss linear uncorrected; + laplacian(interpolate((rho*(1|A(U)))),p) Gauss linear uncorrected; + laplacian(gammaRad,G) Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; + p; +} + + +// ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/system/fvSolution b/tutorials/combustion/fireFoam/les/smallPoolFire2D/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..ac4b5ee3ed9fb59fec01e8353c90274f565a9e29 --- /dev/null +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/system/fvSolution @@ -0,0 +1,138 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.openfoam.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + rho + { + solver PCG; + preconditioner DIC; + tolerance 0; + relTol 0; + }; + + p + { + solver GAMG; + tolerance 1e-7; + relTol 0.01; + smoother GaussSeidel; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + }; + + pFinal + { + solver GAMG; + tolerance 1e-7; + relTol 0; + smoother GaussSeidel; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + }; + + + ft + { + solver smoothSolver; + smoother GaussSeidel; + tolerance 1e-7; + relTol 0; + nSweeps 1; + }; + + fu + { + solver smoothSolver; + smoother GaussSeidel; + tolerance 1e-7; + relTol 0; + nSweeps 1; + }; + + + U + { + solver smoothSolver; + smoother GaussSeidel; + tolerance 1e-7; + relTol 0.1; + nSweeps 1; + }; + + UFinal + { + solver smoothSolver; + smoother GaussSeidel; + tolerance 1e-7; + relTol 0; + nSweeps 1; + }; + + k + { + solver smoothSolver; + smoother GaussSeidel; + tolerance 1e-7; + relTol 0; + nSweeps 1; + }; + + hs + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-7; + relTol 0; + }; + + Ii + { + solver GAMG; + tolerance 1e-4; + relTol 0; + smoother DILU; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } + + G + { + solver PCG; + preconditioner DIC; + tolerance 1e-06; + relTol 0; + } + +} + +PISO +{ + momentumPredictor yes; + nOuterCorrectors 1; + nCorrectors 2; + nNonOrthogonalCorrectors 0; +} + +// ************************************************************************* // diff --git a/tutorials/combustion/reactingFoam/ras/counterFlowFlame2D/constant/thermophysicalProperties b/tutorials/combustion/reactingFoam/ras/counterFlowFlame2D/constant/thermophysicalProperties index 1586cb545cc98a9c3d08bd3d72f63682b28a92b0..6faf5b59ba5cd4f51b10cf64afe2083e6d1351c0 100644 --- a/tutorials/combustion/reactingFoam/ras/counterFlowFlame2D/constant/thermophysicalProperties +++ b/tutorials/combustion/reactingFoam/ras/counterFlowFlame2D/constant/thermophysicalProperties @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -thermoType hPsiMixtureThermo<reactingMixture<gasThermoPhysics>>; +thermoType hsPsiMixtureThermo<reactingMixture<gasThermoPhysics>>; inertSpecie N2; diff --git a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/Allrun b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/Allrun index 29cc29abd53a0b7cd6506cbaa037e9dc112923fc..c2ae406306c56931aba8c609367cf52dc07d85ef 100755 --- a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/Allrun +++ b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/Allrun @@ -7,11 +7,12 @@ application=`getApplication` runStarToFoam () { - if [ -f log.starToFoam ] ; then - echo "starToFoam already run on $PWD: remove log file to run" + if [ -f log.star3ToFoam -o -f log.starToFoam ] + then + echo "star3ToFoam already run on $PWD: remove log file to run" else - echo "starToFoam: converting mesh $1" - starToFoam $1 > log.starToFoam 2>&1 + echo "star3ToFoam: converting mesh $1" + star3ToFoam $1 > log.star3ToFoam 2>&1 fi } @@ -21,3 +22,5 @@ sed -e s/"\([\t ]*type[\t ]*\)symmetryPlane"/"\1empty"/g \ temp > constant/polyMesh/boundary rm temp runApplication $application + +# end-of-file diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allclean b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..a76e8dff53cb6dd7c244c39473ce569b56389e1d --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allclean @@ -0,0 +1,21 @@ +#!/bin/sh + +# Source tutorial clean functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +cleanCase +rm -rf VTK +rm -rf constant/cellToRegion constant/polyMesh/sets +rm -rf 0/bottomAir +rm -rf 0/topAir +rm -rf 0/heater +rm -rf 0/leftSolid +rm -rf 0/rightSolid +rm -f 0/cellToRegion +rm -rf constant/bottomAir/polyMesh +rm -rf constant/topAir/polyMesh +rm -rf constant/heater/polyMesh +rm -rf constant/leftSolid/polyMesh +rm -rf constant/rightSolid/polyMesh + +# ----------------------------------------------------------------------------- diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allrun b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allrun index 56cc2a348ccf26e36ab8bb0e017ceb1f25ea363e..231c46e6ec332c7aaed3b9e8d7c63cf01f835571 100755 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allrun +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allrun @@ -11,7 +11,7 @@ runApplication setSet -batch makeCellSets.setSet rm -f constant/polyMesh/sets/*_old runApplication setsToZones -noFlipMap -runApplication splitMeshRegions -cellZones +runApplication splitMeshRegions -cellZones -overwrite # remove fluid fields from solid regions (important for post-processing) for i in heater leftSolid rightSolid diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allclean b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allclean index 6771f180d8824b2b5187c97d9dca6282e744cbf8..a76e8dff53cb6dd7c244c39473ce569b56389e1d 100755 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allclean +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allclean @@ -11,6 +11,7 @@ rm -rf 0/topAir rm -rf 0/heater rm -rf 0/leftSolid rm -rf 0/rightSolid +rm -f 0/cellToRegion rm -rf constant/bottomAir/polyMesh rm -rf constant/topAir/polyMesh rm -rf constant/heater/polyMesh diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/thermophysicalProperties b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/thermophysicalProperties index 50b814b4dc87f42e913ed0d45f549bcaf809bf21..d1bada5e1d5fe47ca966770e4335f895a10baec1 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/thermophysicalProperties +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/thermophysicalProperties @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -thermoType hPsiMixtureThermo<reactingMixture<gasThermoPhysics>>; +thermoType hsPsiMixtureThermo<reactingMixture<gasThermoPhysics>>; chemistryReader foamChemistryReader; diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSchemes b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSchemes index 1bd64bed7b63bc7645eb4471589ccc0459887717..07351539c15f30ebcae0c5098f4af958bc45bf20 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSchemes +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSchemes @@ -32,7 +32,7 @@ divSchemes div(phi,U) Gauss upwind; div(phid,p) Gauss upwind; div(phiU,p) Gauss linear; - div(phi,h) Gauss upwind; + div(phi,hs) Gauss upwind; div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; div(U) Gauss linear; @@ -49,7 +49,7 @@ laplacianSchemes laplacian(DepsilonEff,epsilon) Gauss linear corrected; laplacian(DREff,R) Gauss linear corrected; laplacian((rho*(1|A(U))),p) Gauss linear corrected; - laplacian(alphaEff,h) Gauss linear corrected; + laplacian(alphaEff,hs) Gauss linear corrected; } interpolationSchemes diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSolution b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSolution index d875b9f976d6367f17222502394f996705169314..d98907822a88088c7a7037ed454b18bb4fada482 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSolution +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSolution @@ -33,7 +33,7 @@ solvers relTol 0; } - "(U|h|R|k|epsilon)" + "(U|hs|R|k|epsilon)" { solver PBiCG; preconditioner DILU; diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/Allclean b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/Allclean index cb015f101f857c660d1c713a3bddcfe491030155..1dac791f4b9848b3cdfca87df338be508d1fc70e 100755 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/Allclean +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/Allclean @@ -8,5 +8,8 @@ cleanCase # remove 0 directory rm -rf 0 +# remove post-processing folder +rm -rf postProcessing + # copy 0.org to 0 cp -r 0.org 0 diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/constant/thermophysicalProperties b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/constant/thermophysicalProperties index 8af627dc121c2091ee45263f9b88af7b91c5245d..faa859ed18de5aa6fc1e9a56e63d216f6f8fff68 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/constant/thermophysicalProperties +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/constant/thermophysicalProperties @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -thermoType hRhoMixtureThermo<reactingMixture<icoPoly8ThermoPhysics>>; +thermoType hsRhoMixtureThermo<reactingMixture<icoPoly8ThermoPhysics>>; chemistryReader foamChemistryReader; diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/system/fvSchemes b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/system/fvSchemes index 1bd64bed7b63bc7645eb4471589ccc0459887717..07351539c15f30ebcae0c5098f4af958bc45bf20 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/system/fvSchemes +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/system/fvSchemes @@ -32,7 +32,7 @@ divSchemes div(phi,U) Gauss upwind; div(phid,p) Gauss upwind; div(phiU,p) Gauss linear; - div(phi,h) Gauss upwind; + div(phi,hs) Gauss upwind; div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; div(U) Gauss linear; @@ -49,7 +49,7 @@ laplacianSchemes laplacian(DepsilonEff,epsilon) Gauss linear corrected; laplacian(DREff,R) Gauss linear corrected; laplacian((rho*(1|A(U))),p) Gauss linear corrected; - laplacian(alphaEff,h) Gauss linear corrected; + laplacian(alphaEff,hs) Gauss linear corrected; } interpolationSchemes diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/system/fvSolution b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/system/fvSolution index 8083f38051cc8f2c5ba48081a3fab925102bedcc..d1da25fa5a07282775b0048a98fb8900b59106ad 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/system/fvSolution +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/system/fvSolution @@ -25,7 +25,7 @@ solvers relTol 0; } - "(U|h|k|epsilon)" + "(U|hs|k|epsilon)" { solver PBiCG; preconditioner DILU; diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/energySourceProperties b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/energySourceProperties new file mode 100644 index 0000000000000000000000000000000000000000..e9e651eb49a9f56d97451451fa813cbbcd56ad46 --- /dev/null +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/energySourceProperties @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object energySourcesProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +( + // none +); + +// ************************************************************************* // diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/pointMassSourcesProperties b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/massSourceProperties similarity index 90% rename from tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/pointMassSourcesProperties rename to tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/massSourceProperties index 4a838a9e79178010ed63ef126e02e73fb6f4f6c7..41a0251b15a7b88025319b8a6cc56059b89e9b5a 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/pointMassSourcesProperties +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/massSourceProperties @@ -11,15 +11,13 @@ FoamFile format ascii; class dictionary; location "constant"; - object pointMassSourcesProperties; + object massSourcesProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -active false; - -pointSources ( -//none + // none ); + // ************************************************************************* // diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/pointMassSourcesProperties b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/momentumSourceProperties similarity index 90% rename from tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/pointMassSourcesProperties rename to tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/momentumSourceProperties index 2698204f7ce06b1851c2c6b3a49c4be1e0833ee1..6decc46694431e71202db9e1cf5ee0d875bdb1ca 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/pointMassSourcesProperties +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/momentumSourceProperties @@ -11,15 +11,13 @@ FoamFile format ascii; class dictionary; location "constant"; - object pointMassSourcesProperties; + object momentumSourcesProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -active false; - -pointSources ( - //none + // none ); + // ************************************************************************* // diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/thermophysicalProperties b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/thermophysicalProperties index fbb4d94eb246537263e879359134454cf3e1a1ea..e83b1d1183bc5242c14a77f0bdd6c4d1a83d8ab5 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/thermophysicalProperties +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/thermophysicalProperties @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -thermoType hRhoMixtureThermo<reactingMixture<icoPoly8ThermoPhysics>>; +thermoType hsRhoMixtureThermo<reactingMixture<icoPoly8ThermoPhysics>>; chemistryReader foamChemistryReader; diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/system/fvSchemes b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/system/fvSchemes index 99e07cad3dba5f11e04b385e3b8ad8dc982deacf..e2d5c43f934c4564e526286a9498b6c603bb7550 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/system/fvSchemes +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/system/fvSchemes @@ -24,8 +24,6 @@ gradSchemes { default Gauss linear; grad(p) Gauss linear; -// grad(U) cellLimited Gauss linear 1; -// grad(k) cellLimited Gauss linear 1; } divSchemes @@ -34,7 +32,7 @@ divSchemes div(phi,U) Gauss upwind; div(phid,p) Gauss upwind; div(phiU,p) Gauss linear; - div(phi,h) Gauss upwind; + div(phi,hs) Gauss upwind; div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; div(phi,omega) Gauss upwind; @@ -46,16 +44,6 @@ divSchemes laplacianSchemes { default Gauss linear uncorrected; -/* - laplacian(muEff,U) Gauss linear corrected; - laplacian(mut,U) Gauss linear corrected; - laplacian(DkEff,k) Gauss linear corrected; - laplacian(DepsilonEff,epsilon) Gauss linear corrected; - laplacian(DepsilonEff,omega) Gauss linear corrected; - laplacian(DREff,R) Gauss linear corrected; - laplacian((rho*(1|A(U))),p) Gauss linear corrected; - laplacian(alphaEff,h) Gauss linear corrected; -*/ } interpolationSchemes diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/system/fvSolution b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/system/fvSolution index 6d53c944858527baf4787780a1cbef7e63335122..496ce336c9b5b1b651acb50c9e7f973b7052b7f3 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/system/fvSolution +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/system/fvSolution @@ -49,7 +49,7 @@ solvers tolerance 1e-06; relTol 0; }; - "(Yi|h|)" + "(Yi|hs)" { solver PBiCG; preconditioner DILU; diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/Allclean b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/Allclean index 4843b685f3beeb2e4bdf69fb14eb483efd5fd773..fbf6469b87cff2c2e53cbbcb68525ad3ff1e240a 100755 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/Allclean +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/Allclean @@ -2,8 +2,9 @@ # Source tutorial clean functions . $WM_PROJECT_DIR/bin/tools/CleanFunctions -# remove old time folders -rm -rf 0 *[1-9]* processor* +# remove old time and post-processing folders +rm -rf 0 *[1-9]* processor* postProcessing + # copy 0.org to 0 cp -r 0.org 0 diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/energySourceProperties b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/energySourceProperties new file mode 100644 index 0000000000000000000000000000000000000000..e9e651eb49a9f56d97451451fa813cbbcd56ad46 --- /dev/null +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/energySourceProperties @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object energySourcesProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +( + // none +); + +// ************************************************************************* // diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/massSourceProperties b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/massSourceProperties new file mode 100644 index 0000000000000000000000000000000000000000..41a0251b15a7b88025319b8a6cc56059b89e9b5a --- /dev/null +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/massSourceProperties @@ -0,0 +1,23 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object massSourcesProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +( + // none +); + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/momentumSourceProperties b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/momentumSourceProperties new file mode 100644 index 0000000000000000000000000000000000000000..6decc46694431e71202db9e1cf5ee0d875bdb1ca --- /dev/null +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/momentumSourceProperties @@ -0,0 +1,23 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object momentumSourcesProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +( + // none +); + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/thermophysicalProperties b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/thermophysicalProperties index fbb4d94eb246537263e879359134454cf3e1a1ea..e83b1d1183bc5242c14a77f0bdd6c4d1a83d8ab5 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/thermophysicalProperties +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/thermophysicalProperties @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -thermoType hRhoMixtureThermo<reactingMixture<icoPoly8ThermoPhysics>>; +thermoType hsRhoMixtureThermo<reactingMixture<icoPoly8ThermoPhysics>>; chemistryReader foamChemistryReader; diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/system/fvSchemes b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/system/fvSchemes index 12543c5fd7c97d1402c4a9adef8a8f84fb0937eb..fb7c45a4c8c9fffeb1e5c1b37b6336a299a2cc8a 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/system/fvSchemes +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/system/fvSchemes @@ -34,7 +34,7 @@ divSchemes div(phi,U) Gauss upwind; div(phid,p) Gauss upwind; div(phiU,p) Gauss linear; - div(phi,h) Gauss upwind; + div(phi,hs) Gauss upwind; div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; div(phi,omega) Gauss upwind; diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/system/fvSolution b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/system/fvSolution index 1ccb5e9656f19e00c4eb61bba4b3451c0bcd7d10..473d8c68f83eb90e9f4e66aba7ebc897289ae4b1 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/system/fvSolution +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/system/fvSolution @@ -49,7 +49,7 @@ solvers tolerance 1e-06; relTol 0; }; - "(Yi|h|)" + "(Yi|hs)" { solver PBiCG; preconditioner DILU; diff --git a/tutorials/lagrangian/reactingParcelFoam/evaporationTest/system/fvSchemes b/tutorials/lagrangian/reactingParcelFoam/evaporationTest/system/fvSchemes index 1bd64bed7b63bc7645eb4471589ccc0459887717..07351539c15f30ebcae0c5098f4af958bc45bf20 100644 --- a/tutorials/lagrangian/reactingParcelFoam/evaporationTest/system/fvSchemes +++ b/tutorials/lagrangian/reactingParcelFoam/evaporationTest/system/fvSchemes @@ -32,7 +32,7 @@ divSchemes div(phi,U) Gauss upwind; div(phid,p) Gauss upwind; div(phiU,p) Gauss linear; - div(phi,h) Gauss upwind; + div(phi,hs) Gauss upwind; div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; div(U) Gauss linear; @@ -49,7 +49,7 @@ laplacianSchemes laplacian(DepsilonEff,epsilon) Gauss linear corrected; laplacian(DREff,R) Gauss linear corrected; laplacian((rho*(1|A(U))),p) Gauss linear corrected; - laplacian(alphaEff,h) Gauss linear corrected; + laplacian(alphaEff,hs) Gauss linear corrected; } interpolationSchemes diff --git a/tutorials/lagrangian/reactingParcelFoam/evaporationTest/system/fvSolution b/tutorials/lagrangian/reactingParcelFoam/evaporationTest/system/fvSolution index 736a2e3e70cd325597ce9b8613537c684b685466..613b764228e3ff1aee58afcc20fec8d382a0c702 100644 --- a/tutorials/lagrangian/reactingParcelFoam/evaporationTest/system/fvSolution +++ b/tutorials/lagrangian/reactingParcelFoam/evaporationTest/system/fvSolution @@ -25,7 +25,7 @@ solvers relTol 0; } - "(U|h|k|epsilon)" + "(U|hs|k|epsilon)" { solver PBiCG; preconditioner DILU; diff --git a/tutorials/lagrangian/rhoPisoTwinParcelFoam/rhoPisoTwinParcelFoam/createFields.H b/tutorials/lagrangian/rhoPisoTwinParcelFoam/rhoPisoTwinParcelFoam/createFields.H index cebd44cfd4041042584f6706484083b3a4dad9b0..46bbe2d917b17d5c65410242885b49a2975dfdd1 100644 --- a/tutorials/lagrangian/rhoPisoTwinParcelFoam/rhoPisoTwinParcelFoam/createFields.H +++ b/tutorials/lagrangian/rhoPisoTwinParcelFoam/rhoPisoTwinParcelFoam/createFields.H @@ -7,7 +7,7 @@ basicPsiThermo& thermo = pThermo(); volScalarField& p = thermo.p(); - volScalarField& h = thermo.h(); + volScalarField& hs = thermo.hs(); const volScalarField& psi = thermo.psi(); volScalarField rho diff --git a/tutorials/lagrangian/rhoPisoTwinParcelFoam/rhoPisoTwinParcelFoam/hEqn.H b/tutorials/lagrangian/rhoPisoTwinParcelFoam/rhoPisoTwinParcelFoam/hEqn.H deleted file mode 100644 index 2b3b60ce980cd23324343c7647de47caba0658cf..0000000000000000000000000000000000000000 --- a/tutorials/lagrangian/rhoPisoTwinParcelFoam/rhoPisoTwinParcelFoam/hEqn.H +++ /dev/null @@ -1,17 +0,0 @@ -{ - fvScalarMatrix hEqn - ( - fvm::ddt(rho, h) - + fvm::div(phi, h) - - fvm::laplacian(turbulence->alphaEff(), h) - == - DpDt - + thermoCloud1.Sh() - ); - - hEqn.relax(); - - hEqn.solve(); - - thermo.correct(); -} diff --git a/tutorials/lagrangian/rhoPisoTwinParcelFoam/rhoPisoTwinParcelFoam/hsEqn.H b/tutorials/lagrangian/rhoPisoTwinParcelFoam/rhoPisoTwinParcelFoam/hsEqn.H new file mode 100644 index 0000000000000000000000000000000000000000..3a1c6e57552a055a1b9ec89257d52ec9600fd52d --- /dev/null +++ b/tutorials/lagrangian/rhoPisoTwinParcelFoam/rhoPisoTwinParcelFoam/hsEqn.H @@ -0,0 +1,17 @@ +{ + fvScalarMatrix hsEqn + ( + fvm::ddt(rho, hs) + + fvm::div(phi, hs) + - fvm::laplacian(turbulence->alphaEff(), hs) + == + DpDt + + thermoCloud1.Sh() + ); + + hsEqn.relax(); + + hsEqn.solve(); + + thermo.correct(); +} diff --git a/tutorials/lagrangian/rhoPisoTwinParcelFoam/rhoPisoTwinParcelFoam/rhoPisoTwinParcelFoam.C b/tutorials/lagrangian/rhoPisoTwinParcelFoam/rhoPisoTwinParcelFoam/rhoPisoTwinParcelFoam.C index b20e73b487ee743bf0ee6fe7a1faeb7a2243558c..f93437068fa04d518d5c6f4ce7a77cf38d99da00 100644 --- a/tutorials/lagrangian/rhoPisoTwinParcelFoam/rhoPisoTwinParcelFoam/rhoPisoTwinParcelFoam.C +++ b/tutorials/lagrangian/rhoPisoTwinParcelFoam/rhoPisoTwinParcelFoam/rhoPisoTwinParcelFoam.C @@ -86,7 +86,7 @@ int main(int argc, char *argv[]) // --- PISO loop for (int corr=1; corr<=nCorr; corr++) { - #include "hEqn.H" + #include "hsEqn.H" #include "pEqn.H" } } diff --git a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/thermoCloud1Properties b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/thermoCloud1Properties index 1756757d0d8631fef6b0ac15bdad1b5f0caf1abd..9460e2e028fe28e84ce3abee27be54758d4f11e3 100644 --- a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/thermoCloud1Properties +++ b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/thermoCloud1Properties @@ -99,6 +99,7 @@ StandardWallInteractionCoeffs RanzMarshallCoeffs { + // thermal shielding BirdCorrection false; } diff --git a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/thermophysicalProperties b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/thermophysicalProperties index 36a5ad071a2f13ed45bc7f78f23d83200cb15fe7..a56b7fee60d0b5a68f100cc7c3947b6dab7826bb 100644 --- a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/thermophysicalProperties +++ b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/thermophysicalProperties @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -thermoType hPsiThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>>>>>; +thermoType hsPsiThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>>>>>; mixture air 1 28.9 1007 0 1.84e-05 0.7; diff --git a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/system/fvSchemes b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/system/fvSchemes index 1bd64bed7b63bc7645eb4471589ccc0459887717..840a87f8b5dd150a6933d5e5d614c2ec36abf304 100644 --- a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/system/fvSchemes +++ b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/system/fvSchemes @@ -32,7 +32,7 @@ divSchemes div(phi,U) Gauss upwind; div(phid,p) Gauss upwind; div(phiU,p) Gauss linear; - div(phi,h) Gauss upwind; + div(phi,hs) Gauss upwind; div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; div(U) Gauss linear; @@ -49,7 +49,7 @@ laplacianSchemes laplacian(DepsilonEff,epsilon) Gauss linear corrected; laplacian(DREff,R) Gauss linear corrected; laplacian((rho*(1|A(U))),p) Gauss linear corrected; - laplacian(alphaEff,h) Gauss linear corrected; + laplacian(alphaEff,hs) Gauss linear corrected; } interpolationSchemes @@ -65,7 +65,7 @@ snGradSchemes fluxRequired { default no; - p ; + p; } diff --git a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/system/fvSolution b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/system/fvSolution index 0cdd3e30cfd3ee7a9c46af0b059f9150a84b8c76..481d14fbf6bc41bffd804c0d3c638740f479b4c8 100644 --- a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/system/fvSolution +++ b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/system/fvSolution @@ -33,7 +33,7 @@ solvers relTol 0; } - "(U|h|R|k|epsilon)" + "(U|hs|R|k|epsilon)" { $p; tolerance 1e-05; diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/0.org/pointDisplacement b/tutorials/multiphase/interDyMFoam/ras/floatingObject/0.org/pointDisplacement index 09a981a619c817a79e1ead66d4896866728186de..a994b15b8986d5000f9ca914596659ab3a452092 100644 --- a/tutorials/multiphase/interDyMFoam/ras/floatingObject/0.org/pointDisplacement +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/0.org/pointDisplacement @@ -38,12 +38,6 @@ boundaryField momentOfInertia (0.08622222 0.08622222 0.144); mass 9.6; rhoInf 1; // for forces calculation - // See sixDoFRigidBodyMotionState - Q (1 0 0 0 1 0 0 0 1); - v (0 0 0); - a (0 0 0); - pi (0 0 0); - tau (0 0 0); value uniform (0 0 0); } } diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSolution b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSolution index bbe6b39db4c5ac879a9d67cc11fad5888a0bcf90..9edecbae820fb5193805aa624c9e06ff6a3e0895 100644 --- a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSolution +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSolution @@ -18,7 +18,7 @@ FoamFile solvers { cellDisplacement - { + { solver GAMG; tolerance 1e-08; relTol 0; @@ -27,7 +27,7 @@ solvers nCellsInCoarsestLevel 10; agglomerator faceAreaPair; mergeLevels 1; - } + } pcorr { @@ -117,7 +117,7 @@ PISO nAlphaCorr 1; nAlphaSubCycles 1; cAlpha 1.5; - correctPhi no; + correctPhi yes; } relaxationFactors diff --git a/wmake/rules/General/coco b/wmake/rules/General/coco-cpp similarity index 66% rename from wmake/rules/General/coco rename to wmake/rules/General/coco-cpp index 7f7bd2ff29b58e6d8b869fa567b2aa00cf2b1bd4..e5da9c33954d8d622be1d38f5a45c21160bd89cd 100644 --- a/wmake/rules/General/coco +++ b/wmake/rules/General/coco-cpp @@ -1,4 +1,7 @@ -# handie Coco/R attributed grammars +# handle Coco/R attributed grammars written for the C++ version +# http://www.ssw.uni-linz.ac.at/Coco/ +# http://github.com/olesenm/coco-cpp/ +# .SUFFIXES: .atg diff --git a/wmake/rules/General/standard b/wmake/rules/General/standard index 3188ac4413f749392e8e11bd094bd767fc5cf7b7..9b2cbd252757e50e2ef531d032d14f6e896be68c 100644 --- a/wmake/rules/General/standard +++ b/wmake/rules/General/standard @@ -4,7 +4,7 @@ include $(GENERAL_RULES)/sourceToDep include $(GENERAL_RULES)/flex include $(GENERAL_RULES)/flex++ -include $(GENERAL_RULES)/coco +include $(GENERAL_RULES)/coco-cpp ## include $(GENERAL_RULES)/byacc ## include $(GENERAL_RULES)/btyacc++ include $(GENERAL_RULES)/bison diff --git a/wmake/src/wmkdependParser.atg b/wmake/src/wmkdependParser.atg index 2da6ebd31333d55539958a446f00affb782332e0..5e514f55017d901b7b1662b131ef6eea0e0b5d90 100644 --- a/wmake/src/wmkdependParser.atg +++ b/wmake/src/wmkdependParser.atg @@ -1,7 +1,11 @@ /*---------------------------------------------------------------------------*\ Attributed Grammar for Coco/R (-*- C++ -*- version) compile with: - coco-cpp wmkdependParser.atg + coco-cpp wmkdependParser.atg + For example, + $WM_THIRD_PARTY_DIR/coco-cpp/platforms/$WM_ARCH$WM_COMPILER/bin/coco-cpp \ + -frames $WM_THIRD_PARTY_DIR/coco-cpp/platforms/share/coco-cpp \ + wmkdependParser.atg \*---------------------------------------------------------------------------*/ [copy] /*---------------------------------*- C++ -*---------------------------------*\ @@ -42,140 +46,7 @@ SourceFiles #include <iostream> #include <string> #include <list> - -//! @brief A simple HashTable implementation -/** - * @note This hash table is only vaguely STL-like. In accordance with - * its present purpose, this hash table only supports a constIterator - * and no deletions. For simplicity, the constIterator increment is - * simply via a next() method. Instead of comparing to an end value, - * the constIterator valid() method is used. - * For example, - * @code - * for - * ( - * HashTable<foo>::constIterator iter = myHash.begin(); - * iter.valid(); - * iter.next() - * ) - * { - * std::cerr<< "key: " << iter.key() << "\n"; - * } - * @endcode - * - */ -class StringHashSet -{ - //! An entry within the HashTable - struct hashedEntry - { - const std::string key_; //<! The lookup key - hashedEntry *next_; //<! Pointer to next hashedEntry in sub-list - - hashedEntry(const std::string& key, hashedEntry *next=0) - : - key_(key), next_(next) - {} - }; - - const int size_; //<! fixed HashTable size - hashedEntry** table_; - -public: - - //! Construct with a default size - StringHashSet(int size = 500) - : - size_(size), - table_(new hashedEntry*[size_]) - { - memset(table_, 0, size_ * sizeof(hashedEntry*)); - } - - //! Destructor - ~StringHashSet() - { - for (int hashIdx = 0; hashIdx < size_; ++hashIdx) - { - hashedEntry* ep = table_[hashIdx]; - while (ep) - { - hashedEntry* del = ep; - ep = ep->next_; - delete del; - } - } - delete[] table_; - table_ = 0; - } - - //! Return hash index for lookup name in hash table - bool hashKeyIndex(const std::string& name) const - { - int hashIdx = 0; - - // calculate hash index - for - ( - std::string::const_iterator iter = name.begin(); - iter != name.end(); - ++iter - ) - { - hashIdx = hashIdx << 1 ^ *iter; - } - - if (hashIdx < 0) - { - hashIdx = -hashIdx; - } - - return hashIdx % size_; - } - - - //! Return true if name is found in hash table - bool found(const std::string& name) const - { - const int hashIdx = hashKeyIndex(name); - - for (hashedEntry* ep = table_[hashIdx]; ep; ep = ep->next_) - { - if (name == ep->key_) - { - // found - return true; - } - } - - // entry not found - return false; - } - - - //! Return true if name is found in hash table, insert if not found - bool foundOrInsert(const std::string& name) - { - const int hashIdx = hashKeyIndex(name); - - for (hashedEntry* ep = table_[hashIdx]; ep; ep = ep->next_) - { - if (name == ep->key_) - { - // found - return true - return true; - } - } - - // not found - insert it - table_[hashIdx] = new hashedEntry(name, table_[hashIdx]); - - // entry not found (but was added) - return false - return false; - } - -}; - +#include <set> /*---------------------------------------------------------------------------*/ @@ -188,11 +59,11 @@ COMPILER wmkdepend /*---------------------------------------------------------------------------*/ private: - //! Hash of files already visited - static StringHashSet visitedFiles_; + //! Set of files already visited + static std::set<std::string> visitedFiles_; - //! Hash of (java) directories already visited - static StringHashSet visitedDirs_; + //! Set of (java) directories already visited + static std::set<std::string> visitedDirs_; //! Replace all '.' with '/' static void dotToSlash(std::string& name); @@ -224,8 +95,8 @@ public: #include <sys/types.h> #include <dirent.h> -StringHashSet Parser::visitedFiles_; -StringHashSet Parser::visitedDirs_; +std::set<std::string> Parser::visitedFiles_; +std::set<std::string> Parser::visitedDirs_; std::list<std::string> Parser::includeDirs; std::string Parser::sourceFile; @@ -246,15 +117,15 @@ void Parser::dotToSlash(std::string& name) void Parser::ignoreDir(const std::string& name) { - visitedDirs_.foundOrInsert(name); + visitedDirs_.insert(name); } void Parser::includeFile(const std::string& name) { - if (visitedFiles_.foundOrInsert(name)) + if (!visitedFiles_.insert(name).second) { - return; + return; // already existed (did not insert) } // use stdio and buffering within Coco/R -- (faster) @@ -312,7 +183,7 @@ void Parser::importFile(const std::string& name) std::string dirGlob = name.substr(0, dotPos); dirGlob += ".*"; - if (visitedDirs_.found(dirGlob)) + if (visitedDirs_.find(dirGlob) != visitedDirs_.end()) { return; } @@ -329,9 +200,9 @@ void Parser::importFile(const std::string& name) void Parser::importDir(const std::string& name) { - if (visitedDirs_.foundOrInsert(name)) + if (!visitedDirs_.insert(name).second) { - return; + return; // already existed (did not insert) } std::string dirName = name; @@ -427,16 +298,16 @@ wmkdepend [ "include" [ - string (. - if (isUTF8()) - { - includeFile(t->toStringUTF8(1, t->length()-2)); - } - else - { - includeFile(t->toString(1, t->length()-2)); - } - .) + string (. + if (isUTF8()) + { + includeFile(t->toStringUTF8(1, t->length()-2)); + } + else + { + includeFile(t->toString(1, t->length()-2)); + } + .) ] ] [ ANY { ANY } ] '\n' // skip trailing junk @@ -444,42 +315,42 @@ wmkdepend // Fortran-style includes | "include" [ - sqstring (. - if (isUTF8()) - { - includeFile(t->toStringUTF8(1, t->length()-2)); - } - else - { - includeFile(t->toString(1, t->length()-2)); - } - .) + sqstring (. + if (isUTF8()) + { + includeFile(t->toStringUTF8(1, t->length()-2)); + } + else + { + includeFile(t->toString(1, t->length()-2)); + } + .) ] [ ANY { ANY } ] '\n' // skip trailing junk // Java imports | "import" ( - package_dir (. - if (isUTF8()) - { - importDir(t->toStringUTF8()); - } - else - { - importDir(t->toString()); - } - .) - | package_name (. - if (isUTF8()) - { - importFile(t->toStringUTF8()); - } - else - { - importFile(t->toString()); - } - .) + package_dir (. + if (isUTF8()) + { + importDir(t->toStringUTF8()); + } + else + { + importDir(t->toString()); + } + .) + | package_name (. + if (isUTF8()) + { + importFile(t->toStringUTF8()); + } + else + { + importFile(t->toString()); + } + .) ) ';' [ ANY { ANY } ] '\n' // skip trailing junk diff --git a/wmake/src/wmkdependParser.cpp b/wmake/src/wmkdependParser.cpp index b6d5e4e71a11114a14ee50bcc579ea249a807684..4b4a8e4c218493a800ed06516d25fbc17d56e830 100644 --- a/wmake/src/wmkdependParser.cpp +++ b/wmake/src/wmkdependParser.cpp @@ -52,8 +52,8 @@ namespace wmake { #include <sys/types.h> #include <dirent.h> -StringHashSet Parser::visitedFiles_; -StringHashSet Parser::visitedDirs_; +std::set<std::string> Parser::visitedFiles_; +std::set<std::string> Parser::visitedDirs_; std::list<std::string> Parser::includeDirs; std::string Parser::sourceFile; @@ -74,15 +74,15 @@ void Parser::dotToSlash(std::string& name) void Parser::ignoreDir(const std::string& name) { - visitedDirs_.foundOrInsert(name); + visitedDirs_.insert(name); } void Parser::includeFile(const std::string& name) { - if (visitedFiles_.foundOrInsert(name)) + if (!visitedFiles_.insert(name).second) { - return; + return; // already existed (did not insert) } // use stdio and buffering within Coco/R -- (faster) @@ -140,7 +140,7 @@ void Parser::importFile(const std::string& name) std::string dirGlob = name.substr(0, dotPos); dirGlob += ".*"; - if (visitedDirs_.found(dirGlob)) + if (visitedDirs_.find(dirGlob) != visitedDirs_.end()) { return; } @@ -157,9 +157,9 @@ void Parser::importFile(const std::string& name) void Parser::importDir(const std::string& name) { - if (visitedDirs_.foundOrInsert(name)) + if (!visitedDirs_.insert(name).second) { - return; + return; // already existed (did not insert) } std::string dirName = name; diff --git a/wmake/src/wmkdependParser.h b/wmake/src/wmkdependParser.h index 8c7703adbd6a2eece7c06394cdff879d21e89cb1..b91f364f2742c2cd9dbf9c85da51a36e6134abe6 100644 --- a/wmake/src/wmkdependParser.h +++ b/wmake/src/wmkdependParser.h @@ -44,140 +44,7 @@ SourceFiles #include <iostream> #include <string> #include <list> - -//! @brief A simple HashTable implementation -/** - * @note This hash table is only vaguely STL-like. In accordance with - * its present purpose, this hash table only supports a constIterator - * and no deletions. For simplicity, the constIterator increment is - * simply via a next() method. Instead of comparing to an end value, - * the constIterator valid() method is used. - * For example, - * @code - * for - * ( - * HashTable<foo>::constIterator iter = myHash.begin(); - * iter.valid(); - * iter.next() - * ) - * { - * std::cerr<< "key: " << iter.key() << "\n"; - * } - * @endcode - * - */ -class StringHashSet -{ - //! An entry within the HashTable - struct hashedEntry - { - const std::string key_; //<! The lookup key - hashedEntry *next_; //<! Pointer to next hashedEntry in sub-list - - hashedEntry(const std::string& key, hashedEntry *next=0) - : - key_(key), next_(next) - {} - }; - - const int size_; //<! fixed HashTable size - hashedEntry** table_; - -public: - - //! Construct with a default size - StringHashSet(int size = 500) - : - size_(size), - table_(new hashedEntry*[size_]) - { - memset(table_, 0, size_ * sizeof(hashedEntry*)); - } - - //! Destructor - ~StringHashSet() - { - for (int hashIdx = 0; hashIdx < size_; ++hashIdx) - { - hashedEntry* ep = table_[hashIdx]; - while (ep) - { - hashedEntry* del = ep; - ep = ep->next_; - delete del; - } - } - delete[] table_; - table_ = 0; - } - - //! Return hash index for lookup name in hash table - bool hashKeyIndex(const std::string& name) const - { - int hashIdx = 0; - - // calculate hash index - for - ( - std::string::const_iterator iter = name.begin(); - iter != name.end(); - ++iter - ) - { - hashIdx = hashIdx << 1 ^ *iter; - } - - if (hashIdx < 0) - { - hashIdx = -hashIdx; - } - - return hashIdx % size_; - } - - - //! Return true if name is found in hash table - bool found(const std::string& name) const - { - const int hashIdx = hashKeyIndex(name); - - for (hashedEntry* ep = table_[hashIdx]; ep; ep = ep->next_) - { - if (name == ep->key_) - { - // found - return true; - } - } - - // entry not found - return false; - } - - - //! Return true if name is found in hash table, insert if not found - bool foundOrInsert(const std::string& name) - { - const int hashIdx = hashKeyIndex(name); - - for (hashedEntry* ep = table_[hashIdx]; ep; ep = ep->next_) - { - if (name == ep->key_) - { - // found - return true - return true; - } - } - - // not found - insert it - table_[hashIdx] = new hashedEntry(name, table_[hashIdx]); - - // entry not found (but was added) - return false - return false; - } - -}; - +#include <set> /*---------------------------------------------------------------------------*/ @@ -191,7 +58,7 @@ namespace wmake { /*---------------------------------------------------------------------------*\ Class Errors Declaration \*---------------------------------------------------------------------------*/ -//! Parser error handing +//! Parser error handling class Errors { public: @@ -255,11 +122,11 @@ public: private: - //! Hash of files already visited - static StringHashSet visitedFiles_; + //! Set of files already visited + static std::set<std::string> visitedFiles_; - //! Hash of (java) directories already visited - static StringHashSet visitedDirs_; + //! Set of (java) directories already visited + static std::set<std::string> visitedDirs_; //! Replace all '.' with '/' static void dotToSlash(std::string& name); diff --git a/wmake/src/wmkdependScanner.h b/wmake/src/wmkdependScanner.h index a72bf4b9684c2b8cd847484213e681981c09acab..7520b01ebd9a892f1a3ca3576499252f87272da7 100644 --- a/wmake/src/wmkdependScanner.h +++ b/wmake/src/wmkdependScanner.h @@ -200,7 +200,7 @@ public: Class Buffer Declaration \*---------------------------------------------------------------------------*/ /*! - * @brief Scanner Buffer Token + * @brief Scanner Buffer * * This Buffer supports the following cases: * -# seekable stream (file)