From f355d6b28034993bbfbc9c4c7f1f48b7595f1724 Mon Sep 17 00:00:00 2001 From: andy <andy> Date: Wed, 4 Jan 2012 12:16:06 +0000 Subject: [PATCH] ENH: Updated R utility: added compatibility BCs and converted to use postCalc --- .../postProcessing/turbulence/R/Make/files | 1 + .../postProcessing/turbulence/R/Make/options | 2 + .../utilities/postProcessing/turbulence/R/R.C | 13 +- ...KineticEnergyInletFvPatchSymmTensorField.C | 115 ++++++++++++++ ...KineticEnergyInletFvPatchSymmTensorField.H | 148 ++++++++++++++++++ .../turbulence/R/createFields.H | 2 +- 6 files changed, 270 insertions(+), 11 deletions(-) create mode 100644 applications/utilities/postProcessing/turbulence/R/compatibilityFvPatchFields/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchSymmTensorField.C create mode 100644 applications/utilities/postProcessing/turbulence/R/compatibilityFvPatchFields/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchSymmTensorField.H diff --git a/applications/utilities/postProcessing/turbulence/R/Make/files b/applications/utilities/postProcessing/turbulence/R/Make/files index 2828aa9a4c8..2190c62f464 100644 --- a/applications/utilities/postProcessing/turbulence/R/Make/files +++ b/applications/utilities/postProcessing/turbulence/R/Make/files @@ -1,3 +1,4 @@ R.C +compatibilityFvPatchFields/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchSymmTensorField.C EXE = $(FOAM_APPBIN)/R diff --git a/applications/utilities/postProcessing/turbulence/R/Make/options b/applications/utilities/postProcessing/turbulence/R/Make/options index 0bab1a4e41c..a136b166617 100644 --- a/applications/utilities/postProcessing/turbulence/R/Make/options +++ b/applications/utilities/postProcessing/turbulence/R/Make/options @@ -1,10 +1,12 @@ EXE_INC = \ + -I$(LIB_SRC)/postProcessing/postCalc \ -I$(LIB_SRC)/turbulenceModels \ -I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/finiteVolume/lnInclude EXE_LIBS = \ + $(FOAM_LIBBIN)/postCalc.o \ -lincompressibleRASModels \ -lincompressibleTransportModels \ -lfiniteVolume \ diff --git a/applications/utilities/postProcessing/turbulence/R/R.C b/applications/utilities/postProcessing/turbulence/R/R.C index 0a0de92633c..b96bb03947c 100644 --- a/applications/utilities/postProcessing/turbulence/R/R.C +++ b/applications/utilities/postProcessing/turbulence/R/R.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,22 +29,17 @@ Description \*---------------------------------------------------------------------------*/ +#include "calc.H" #include "fvCFD.H" #include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H" #include "RASModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -int main(int argc, char *argv[]) +void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) { - #include "setRootCase.H" - - #include "createTime.H" - #include "createMesh.H" #include "createFields.H" - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - Info<< "\nCalculating the Reynolds Stress R\n" << endl; volSymmTensorField R @@ -63,8 +58,6 @@ int main(int argc, char *argv[]) R.write(); Info<< "End" << endl; - - return 0; } diff --git a/applications/utilities/postProcessing/turbulence/R/compatibilityFvPatchFields/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchSymmTensorField.C b/applications/utilities/postProcessing/turbulence/R/compatibilityFvPatchFields/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchSymmTensorField.C new file mode 100644 index 00000000000..37dce5e2894 --- /dev/null +++ b/applications/utilities/postProcessing/turbulence/R/compatibilityFvPatchFields/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchSymmTensorField.C @@ -0,0 +1,115 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "turbulentIntensityKineticEnergyInletFvPatchSymmTensorField.H" +#include "addToRunTimeSelectionTable.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::turbulentIntensityKineticEnergyInletFvPatchSymmTensorField:: +turbulentIntensityKineticEnergyInletFvPatchSymmTensorField +( + const fvPatch& p, + const DimensionedField<symmTensor, volMesh>& iF +) +: + fixedValueFvPatchSymmTensorField(p, iF) +{} + + +Foam::turbulentIntensityKineticEnergyInletFvPatchSymmTensorField:: +turbulentIntensityKineticEnergyInletFvPatchSymmTensorField +( + const turbulentIntensityKineticEnergyInletFvPatchSymmTensorField& ptf, + const fvPatch& p, + const DimensionedField<symmTensor, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchSymmTensorField(ptf, p, iF, mapper) +{} + + +Foam::turbulentIntensityKineticEnergyInletFvPatchSymmTensorField:: +turbulentIntensityKineticEnergyInletFvPatchSymmTensorField +( + const fvPatch& p, + const DimensionedField<symmTensor, volMesh>& iF, + const dictionary& dict +) +: + fixedValueFvPatchSymmTensorField(p, iF) +{ + + fvPatchSymmTensorField::operator=(symmTensorField("value", dict, p.size())); +} + + +Foam::turbulentIntensityKineticEnergyInletFvPatchSymmTensorField:: +turbulentIntensityKineticEnergyInletFvPatchSymmTensorField +( + const turbulentIntensityKineticEnergyInletFvPatchSymmTensorField& ptf +) +: + fixedValueFvPatchSymmTensorField(ptf) +{} + + +Foam::turbulentIntensityKineticEnergyInletFvPatchSymmTensorField:: +turbulentIntensityKineticEnergyInletFvPatchSymmTensorField +( + const turbulentIntensityKineticEnergyInletFvPatchSymmTensorField& ptf, + const DimensionedField<symmTensor, volMesh>& iF +) +: + fixedValueFvPatchSymmTensorField(ptf, iF) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::turbulentIntensityKineticEnergyInletFvPatchSymmTensorField::write +( + Ostream& os +) const +{ + fvPatchSymmTensorField::write(os); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchSymmTensorField, + turbulentIntensityKineticEnergyInletFvPatchSymmTensorField + ); +} + +// ************************************************************************* // diff --git a/applications/utilities/postProcessing/turbulence/R/compatibilityFvPatchFields/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchSymmTensorField.H b/applications/utilities/postProcessing/turbulence/R/compatibilityFvPatchFields/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchSymmTensorField.H new file mode 100644 index 00000000000..4f3fc8046fb --- /dev/null +++ b/applications/utilities/postProcessing/turbulence/R/compatibilityFvPatchFields/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchSymmTensorField.H @@ -0,0 +1,148 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::turbulentIntensityKineticEnergyInletFvPatchSymmTensorField + +Description + Dummy version of turbulentIntensityKineticEnergyInlet patch type for + symmetric tensors provided for compatibility with R utility. + + Value is given by a fixed-value condition. + + +SourceFiles + turbulentIntensityKineticEnergyInletFvPatchSymmTensorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef turbulentIntensityKineticEnergyInletFvPatchSymmTensorField_H +#define turbulentIntensityKineticEnergyInletFvPatchSymmTensorField_H + +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class turbulentIntensityKineticEnergyInletFvPatchSymmTensorField Declaration +\*---------------------------------------------------------------------------*/ + +class turbulentIntensityKineticEnergyInletFvPatchSymmTensorField +: + public fixedValueFvPatchSymmTensorField +{ +public: + + //- Runtime type information + TypeName("turbulentIntensityKineticEnergyInlet"); + + + // Constructors + + //- Construct from patch and internal field + turbulentIntensityKineticEnergyInletFvPatchSymmTensorField + ( + const fvPatch&, + const DimensionedField<symmTensor, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + turbulentIntensityKineticEnergyInletFvPatchSymmTensorField + ( + const fvPatch&, + const DimensionedField<symmTensor, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given + // turbulentIntensityKineticEnergyInletFvPatchSymmTensorField + // onto a new patch + turbulentIntensityKineticEnergyInletFvPatchSymmTensorField + ( + const turbulentIntensityKineticEnergyInletFvPatchSymmTensorField&, + const fvPatch&, + const DimensionedField<symmTensor, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + turbulentIntensityKineticEnergyInletFvPatchSymmTensorField + ( + const turbulentIntensityKineticEnergyInletFvPatchSymmTensorField& + ); + + //- Construct and return a clone + virtual tmp<fvPatchSymmTensorField> clone() const + { + return tmp<fvPatchSymmTensorField> + ( + new turbulentIntensityKineticEnergyInletFvPatchSymmTensorField + ( + *this + ) + ); + } + + //- Construct as copy setting internal field reference + turbulentIntensityKineticEnergyInletFvPatchSymmTensorField + ( + const turbulentIntensityKineticEnergyInletFvPatchSymmTensorField&, + const DimensionedField<symmTensor, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchSymmTensorField> clone + ( + const DimensionedField<symmTensor, volMesh>& iF + ) const + { + return tmp<fvPatchSymmTensorField> + ( + new turbulentIntensityKineticEnergyInletFvPatchSymmTensorField + ( + *this, + iF + ) + ); + } + + + // Member functions + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/postProcessing/turbulence/R/createFields.H b/applications/utilities/postProcessing/turbulence/R/createFields.H index d069c4545db..7c07f44f8bf 100644 --- a/applications/utilities/postProcessing/turbulence/R/createFields.H +++ b/applications/utilities/postProcessing/turbulence/R/createFields.H @@ -12,7 +12,7 @@ mesh ); -# include "createPhi.H" + #include "createPhi.H" singlePhaseTransportModel laminarTransport(U, phi); -- GitLab