From 18d3b81960a7b344e1687c1095ab0178e165582d Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 13 May 2013 09:38:08 +0100 Subject: [PATCH 01/33] ENH: pressurTools function object - simplified usage --- .../utilities/pressureTools/pressureTools.C | 7 +++---- .../utilities/pressureTools/pressureTools.H | 6 +----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.C b/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.C index 607d52e503..181099c007 100644 --- a/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.C +++ b/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.C @@ -70,7 +70,7 @@ Foam::dimensionedScalar Foam::pressureTools::rhoScale } else { - return dimensionedScalar("rhoRef", dimDensity, rhoRef_); + return dimensionedScalar("rhoRef", dimDensity, rhoInf_); } } @@ -100,7 +100,7 @@ Foam::tmp Foam::pressureTools::rho IOobject::NO_WRITE ), p.mesh(), - dimensionedScalar("zero", dimDensity, rhoRef_) + dimensionedScalar("zero", dimDensity, rhoInf_) ) ); } @@ -193,7 +193,6 @@ Foam::pressureTools::pressureTools pName_("p"), UName_("U"), rhoName_("rho"), - rhoRef_(1.0), calcTotal_(false), pRef_(0.0), calcCoeff_(false), @@ -242,7 +241,7 @@ void Foam::pressureTools::read(const dictionary& dict) if (p.dimensions() != dimPressure) { - dict.lookup("rhoRef") >> rhoRef_; + dict.lookup("rhoRef") >> rhoInf_; } dict.lookup("calcTotal") >> calcTotal_; diff --git a/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.H b/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.H index 11f490429d..82a44921ed 100644 --- a/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.H +++ b/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -92,7 +92,6 @@ Description \table Property | Description | Required | Default value type | type name: pressureTools| yes | - rhoRef | Reference density for incompressible cases | no | 1 calcTotal | Calculate total coefficient | yes | pRef | Reference pressure for total pressure | no | 0.0 calcCoeff | Calculate pressure coefficient | yes | @@ -150,9 +149,6 @@ class pressureTools //- Name of density field, default is "rho" word rhoName_; - //- Reference density employed for incompressible cases - scalar rhoRef_; - // Total pressure calculation From cf085c7f12b3ee0648abe61249a905fe995e8532 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 13 May 2013 09:38:30 +0100 Subject: [PATCH 02/33] STYLE: Corrected fatal error message --- .../ConeNozzleInjection/ConeNozzleInjection.C | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C index cebed76580..97c3c819a0 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -167,7 +167,8 @@ Foam::ConeNozzleInjection::ConeNozzleInjection "Foam::ConeNozzleInjection::ConeNozzleInjection" "(" "const dictionary&, " - "CloudType&" + "CloudType&, " + "const word&" ")" )<< "innerNozzleDiameter >= outerNozzleDiameter" << nl << exit(FatalError); @@ -369,6 +370,7 @@ void Foam::ConeNozzleInjection::setPositionAndCell "const scalar, " "vector&, " "label&, " + "label&, " "label&" ")" )<< "Unknown injectionMethod type" << nl From c08917f1963ed53974a560d9cb3ce2c945c855d7 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 13 May 2013 09:38:54 +0100 Subject: [PATCH 03/33] STYLE: Code formatting --- .../functions/DataEntry/DataEntry/DataEntry.H | 104 +++++++++--------- 1 file changed, 51 insertions(+), 53 deletions(-) diff --git a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H index 9cfdb66e25..a9b1686d58 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -142,62 +142,60 @@ public: virtual void convertTimeBase(const Time& t); -public: + // Evaluation + + //- Return value as a function of (scalar) independent variable + virtual Type value(const scalar x) const; + + //- Return value as a function of (scalar) independent variable + virtual tmp > value(const scalarField& x) const; + + //- Integrate between two (scalar) values + virtual Type integrate(const scalar x1, const scalar x2) const; + + //- Integrate between two (scalar) values + virtual tmp > integrate + ( + const scalarField& x1, + const scalarField& x2 + ) const; + + //- Return dimensioned type + virtual dimensioned dimValue(const scalar x) const; + + //- Return dimensioned type as a function of (scalar) + virtual tmp > > dimValue + ( + const scalarField& x + ) const; + + //- Integrate between two scalars and return a dimensioned type + virtual dimensioned dimIntegrate + ( + const scalar x1, + const scalar x2 + ) const; + + //- Integrate between two scalar fields and return a field of + // dimensioned type + virtual tmp > > dimIntegrate + ( + const scalarField& x1, + const scalarField& x2 + ) const; - // Evaluation + // I/O - //- Return value as a function of (scalar) independent variable - virtual Type value(const scalar x) const; + //- Ostream Operator + friend Ostream& operator<< + ( + Ostream& os, + const DataEntry& de + ); - //- Return value as a function of (scalar) independent variable - virtual tmp > value(const scalarField& x) const; - - //- Integrate between two (scalar) values - virtual Type integrate(const scalar x1, const scalar x2) const; - - //- Integrate between two (scalar) values - virtual tmp > integrate - ( - const scalarField& x1, - const scalarField& x2 - ) const; - - //- Return dimensioned type - virtual dimensioned dimValue(const scalar x) const; - - //- Return dimensioned type as a function of (scalar) - virtual tmp > > dimValue - ( - const scalarField& x - ) const; - - //- Integrate between two scalars and returns a dimensioned type - virtual dimensioned dimIntegrate - ( - const scalar x1, - const scalar x2 - ) const; - - //- Integrate between two scalars and returns list of dimensioned type - virtual tmp > > dimIntegrate - ( - const scalarField& x1, - const scalarField& x2 - ) const; - - - // I/O - - //- Ostream Operator - friend Ostream& operator<< - ( - Ostream& os, - const DataEntry& de - ); - - //- Write in dictionary format - virtual void writeData(Ostream& os) const; + //- Write in dictionary format + virtual void writeData(Ostream& os) const; }; From c6d61b01799bd5672227eb28b2cea39d8d302b04 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 13 May 2013 12:10:27 +0100 Subject: [PATCH 04/33] ENH: Forces function object - refactored divRhoEff function --- .../functionObjects/forces/forces/forces.C | 49 +++++++------------ 1 file changed, 17 insertions(+), 32 deletions(-) diff --git a/src/postProcessing/functionObjects/forces/forces/forces.C b/src/postProcessing/functionObjects/forces/forces/forces.C index c159b652e8..dd164d99a4 100644 --- a/src/postProcessing/functionObjects/forces/forces/forces.C +++ b/src/postProcessing/functionObjects/forces/forces/forces.C @@ -28,16 +28,12 @@ License #include "dictionary.H" #include "Time.H" #include "wordReList.H" - -#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H" -#include "incompressible/RAS/RASModel/RASModel.H" -#include "incompressible/LES/LESModel/LESModel.H" - -#include "fluidThermo.H" -#include "compressible/RAS/RASModel/RASModel.H" -#include "compressible/LES/LESModel/LESModel.H" - +#include "fvcGrad.H" #include "porosityModel.H" +#include "fluidThermo.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" +#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -70,38 +66,27 @@ void Foam::forces::writeFileHeader(const label i) Foam::tmp Foam::forces::devRhoReff() const { - if (obr_.foundObject("RASProperties")) - { - const compressible::RASModel& ras - = obr_.lookupObject("RASProperties"); + typedef compressible::turbulenceModel cmpTurbModel; + typedef incompressible::turbulenceModel icoTurbModel; - return ras.devRhoReff(); - } - else if (obr_.foundObject("RASProperties")) + if (obr_.foundObject(cmpTurbModel::typeName)) { - const incompressible::RASModel& ras - = obr_.lookupObject("RASProperties"); + const cmpTurbModel& turb = + obr_.lookupObject(cmpTurbModel::typeName); - return rho()*ras.devReff(); + return turb.devRhoReff(); } - else if (obr_.foundObject("LESProperties")) + else if (obr_.foundObject(icoTurbModel::typeName)) { - const compressible::LESModel& les = - obr_.lookupObject("LESProperties"); + const incompressible::turbulenceModel& turb = + obr_.lookupObject(icoTurbModel::typeName); - return les.devRhoReff(); + return rho()*turb.devReff(); } - else if (obr_.foundObject("LESProperties")) - { - const incompressible::LESModel& les - = obr_.lookupObject("LESProperties"); - - return rho()*les.devReff(); - } - else if (obr_.foundObject("thermophysicalProperties")) + else if (obr_.foundObject(fluidThermo::typeName)) { const fluidThermo& thermo = - obr_.lookupObject("thermophysicalProperties"); + obr_.lookupObject(fluidThermo::typeName); const volVectorField& U = obr_.lookupObject(UName_); From a41c30ff0435179d39dc7420d771330233a4d37b Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 13 May 2013 15:19:31 +0100 Subject: [PATCH 05/33] ENH: Added ranomise to lookup table injection models --- .../KinematicLookupTableInjection.C | 15 +++++++++++++-- .../KinematicLookupTableInjection.H | 5 ++++- .../ReactingLookupTableInjection.C | 15 +++++++++++++-- .../ReactingLookupTableInjection.H | 5 ++++- .../ReactingMultiphaseLookupTableInjection.C | 15 +++++++++++++-- .../ReactingMultiphaseLookupTableInjection.H | 5 ++++- .../ThermoLookupTableInjection.C | 15 +++++++++++++-- .../ThermoLookupTableInjection.H | 5 ++++- 8 files changed, 68 insertions(+), 12 deletions(-) diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/KinematicLookupTableInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/KinematicLookupTableInjection.C index c40a95fbac..293fd7d740 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/KinematicLookupTableInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/KinematicLookupTableInjection.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,6 +43,7 @@ Foam::KinematicLookupTableInjection::KinematicLookupTableInjection ( readScalar(this->coeffDict().lookup("parcelsPerSecond")) ), + randomise_(readBool(this->coeffDict().lookup("randomise"))), injectors_ ( IOobject @@ -87,6 +88,7 @@ Foam::KinematicLookupTableInjection::KinematicLookupTableInjection inputFileName_(im.inputFileName_), duration_(im.duration_), parcelsPerSecond_(im.parcelsPerSecond_), + randomise_(im.randomise_), injectors_(im.injectors_), injectorCells_(im.injectorCells_), injectorTetFaces_(im.injectorTetFaces_), @@ -177,7 +179,16 @@ void Foam::KinematicLookupTableInjection::setPositionAndCell label& tetPtI ) { - label injectorI = parcelI*injectorCells_.size()/nParcels; + label injectorI = 0; + if (randomise_) + { + cachedRandom& rnd = this->owner().rndGen(); + injectorI = rnd.position