From 4f23395fb9f7588afca58060c1987f1d0761fdbd Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 19 Feb 2009 17:58:25 +0000 Subject: [PATCH 01/35] Added buoyancy effects - NOTE: not included pRef - still needs to be done (somehow) --- .../totalPressureFvPatchScalarField.C | 53 ++++++++++++++----- .../totalPressureFvPatchScalarField.H | 10 ++++ 2 files changed, 51 insertions(+), 12 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.C index f10681e48a..2207df3106 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.C @@ -30,7 +30,27 @@ License #include "volFields.H" #include "surfaceFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +bool Foam::totalPressureFvPatchScalarField::calcBuoyancy() const +{ + if (buoyancy_) + { + return true; + } + + if (db().foundObject("pd")) + { + const volScalarField& pd = db().lookupObject("pd"); + if (pd.dimensions() == dimPressure) + { + return true; + } + } + + return false; +} + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -46,6 +66,7 @@ Foam::totalPressureFvPatchScalarField::totalPressureFvPatchScalarField rhoName_("none"), psiName_("none"), gamma_(0.0), + buoyancy_(false), p0_(p.size(), 0.0) {} @@ -63,6 +84,7 @@ Foam::totalPressureFvPatchScalarField::totalPressureFvPatchScalarField rhoName_(dict.lookupOrDefault("rho", "none")), psiName_(dict.lookupOrDefault("psi", "none")), gamma_(readScalar(dict.lookup("gamma"))), + buoyancy_(dict.lookupOrDefault("buoyancy", false)), p0_("p0", dict, p.size()) { if (dict.found("value")) @@ -93,6 +115,7 @@ Foam::totalPressureFvPatchScalarField::totalPressureFvPatchScalarField rhoName_(ptf.rhoName_), psiName_(ptf.psiName_), gamma_(ptf.gamma_), + buoyancy_(ptf.buoyancy_), p0_(ptf.p0_, mapper) {} @@ -108,6 +131,7 @@ Foam::totalPressureFvPatchScalarField::totalPressureFvPatchScalarField rhoName_(tppsf.rhoName_), psiName_(tppsf.psiName_), gamma_(tppsf.gamma_), + buoyancy_(tppsf.buoyancy_), p0_(tppsf.p0_) {} @@ -124,6 +148,7 @@ Foam::totalPressureFvPatchScalarField::totalPressureFvPatchScalarField rhoName_(tppsf.rhoName_), psiName_(tppsf.psiName_), gamma_(tppsf.gamma_), + buoyancy_(tppsf.buoyancy_), p0_(tppsf.p0_) {} @@ -165,9 +190,18 @@ void Foam::totalPressureFvPatchScalarField::updateCoeffs(const vectorField& Up) const fvsPatchField& phip = patch().lookupPatchField(phiName_); + scalarField gh(patch().size(), 0.0); + if (calcBuoyancy()) + { + const dictionary& environmentalProperties = + db().lookupObject("environmentalProperties"); + const dimensionedVector g = environmentalProperties.lookup("g"); + gh = g.value() & patch().Cf(); + } + if (psiName_ == "none" && rhoName_ == "none") { - operator==(p0_ - 0.5*(1.0 - pos(phip))*magSqr(Up)); + operator==(p0_ - 0.5*(1.0 - pos(phip))*magSqr(Up) - gh); } else if (rhoName_ == "none") { @@ -183,7 +217,7 @@ void Foam::totalPressureFvPatchScalarField::updateCoeffs(const vectorField& Up) p0_ /pow ( - (1.0 + 0.5*psip*gM1ByG*(1.0 - pos(phip))*magSqr(Up)), + (1.0 + psip*gM1ByG*0.5*(1.0 - pos(phip))*magSqr(Up)), 1.0/gM1ByG ) ); @@ -198,7 +232,7 @@ void Foam::totalPressureFvPatchScalarField::updateCoeffs(const vectorField& Up) const fvPatchField& rho = patch().lookupPatchField(rhoName_); - operator==(p0_ - 0.5*rho*(1.0 - pos(phip))*magSqr(Up)); + operator==(p0_ - rho*(0.5*(1.0 - pos(phip))*magSqr(Up) + gh)); } else { @@ -229,17 +263,12 @@ void Foam::totalPressureFvPatchScalarField::updateCoeffs() void Foam::totalPressureFvPatchScalarField::write(Ostream& os) const { fvPatchScalarField::write(os); - if (UName_ != "U") - { - os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl; - } - if (phiName_ != "phi") - { - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - } + writeEntryIfDifferent(os, "U", "U", UName_); + writeEntryIfDifferent(os, "phi", "phi", UName_); os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl; os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl; + os.writeKeyword("buoyancy") << buoyancy_ << token::END_STATEMENT << nl; p0_.writeEntry("p0", os); writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.H index 4206f1f081..2a02502980 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.H @@ -37,6 +37,7 @@ SourceFiles #define totalPressureFvPatchScalarField_H #include "fixedValueFvPatchFields.H" +#include "Switch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -69,10 +70,19 @@ class totalPressureFvPatchScalarField //- Heat capacity ratio scalar gamma_; + //- Flag to include buoyancy effects (applying BC to pd) + Switch buoyancy_; + //- Total pressure scalarField p0_; + //- Private member functions + + //- Helper function to determine whether to include buoyancy effects + bool calcBuoyancy() const; + + public: //- Runtime type information From 1f7a41b2974c808f04fa9cf7420ed6e8d1b1f07b Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 24 Feb 2009 15:57:34 +0000 Subject: [PATCH 02/35] cosmetics --- .../PV3FoamReader/vtkPV3Foam/vtkPV3FoamVolFields.H | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamVolFields.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamVolFields.H index f217d1a889..191e2b3393 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamVolFields.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamVolFields.H @@ -312,10 +312,10 @@ void Foam::vtkPV3Foam::convertVolField const labelList& superCells = decompInfo.superCells(); vtkFloatArray* celldata = vtkFloatArray::New(); - celldata->SetNumberOfTuples( superCells.size() ); - celldata->SetNumberOfComponents( nComp ); - celldata->Allocate( nComp*superCells.size() ); - celldata->SetName( tf.name().c_str() ); + celldata->SetNumberOfTuples(superCells.size()); + celldata->SetNumberOfComponents(nComp); + celldata->Allocate(nComp*superCells.size()); + celldata->SetName(tf.name().c_str()); if (debug) { From 6b3e3c65972677bf4e4949ace75273a35ce50b88 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 24 Feb 2009 16:47:24 +0000 Subject: [PATCH 03/35] dynamicPressure -> staticPressure --- .../functionObjects/utilities/Make/files | 4 +- .../IOstaticPressure.H} | 12 +++--- .../staticPressure.C} | 22 +++++------ .../staticPressure.H} | 38 ++++++++++--------- .../staticPressureFunctionObject.C} | 6 +-- .../staticPressureFunctionObject.H} | 16 ++++---- 6 files changed, 50 insertions(+), 48 deletions(-) rename src/postProcessing/functionObjects/utilities/{dynamicPressure/IOdynamicPressure.H => staticPressure/IOstaticPressure.H} (86%) rename src/postProcessing/functionObjects/utilities/{dynamicPressure/dynamicPressure.C => staticPressure/staticPressure.C} (88%) rename src/postProcessing/functionObjects/utilities/{dynamicPressure/dynamicPressure.H => staticPressure/staticPressure.H} (82%) rename src/postProcessing/functionObjects/utilities/{dynamicPressure/dynamicPressureFunctionObject.C => staticPressure/staticPressureFunctionObject.C} (90%) rename src/postProcessing/functionObjects/utilities/{dynamicPressure/dynamicPressureFunctionObject.H => staticPressure/staticPressureFunctionObject.H} (81%) diff --git a/src/postProcessing/functionObjects/utilities/Make/files b/src/postProcessing/functionObjects/utilities/Make/files index ae95721ac8..2930260e2f 100644 --- a/src/postProcessing/functionObjects/utilities/Make/files +++ b/src/postProcessing/functionObjects/utilities/Make/files @@ -1,4 +1,4 @@ -dynamicPressure/dynamicPressure.C -dynamicPressure/dynamicPressureFunctionObject.C +staticPressure/staticPressure.C +staticPressure/staticPressureFunctionObject.C LIB = $(FOAM_LIBBIN)/libutilityFunctionObjects diff --git a/src/postProcessing/functionObjects/utilities/dynamicPressure/IOdynamicPressure.H b/src/postProcessing/functionObjects/utilities/staticPressure/IOstaticPressure.H similarity index 86% rename from src/postProcessing/functionObjects/utilities/dynamicPressure/IOdynamicPressure.H rename to src/postProcessing/functionObjects/utilities/staticPressure/IOstaticPressure.H index 97a5c27353..8409c7f103 100644 --- a/src/postProcessing/functionObjects/utilities/dynamicPressure/IOdynamicPressure.H +++ b/src/postProcessing/functionObjects/utilities/staticPressure/IOstaticPressure.H @@ -23,24 +23,24 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Typedef - Foam::IOdynamicPressure + Foam::IOstaticPressure Description - Instance of the generic IOOutputFilter for dynamicPressure. + Instance of the generic IOOutputFilter for staticPressure. \*---------------------------------------------------------------------------*/ -#ifndef IOdynamicPressure_H -#define IOdynamicPressure_H +#ifndef IOstaticPressure_H +#define IOstaticPressure_H -#include "dynamicPressure.H" +#include "staticPressure.H" #include "IOOutputFilter.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - typedef IOOutputFilter IOdynamicPressure; + typedef IOOutputFilter IOstaticPressure; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/utilities/dynamicPressure/dynamicPressure.C b/src/postProcessing/functionObjects/utilities/staticPressure/staticPressure.C similarity index 88% rename from src/postProcessing/functionObjects/utilities/dynamicPressure/dynamicPressure.C rename to src/postProcessing/functionObjects/utilities/staticPressure/staticPressure.C index a31c913ba7..9ca4f715df 100644 --- a/src/postProcessing/functionObjects/utilities/dynamicPressure/dynamicPressure.C +++ b/src/postProcessing/functionObjects/utilities/staticPressure/staticPressure.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ -#include "dynamicPressure.H" +#include "staticPressure.H" #include "volFields.H" #include "dictionary.H" @@ -32,12 +32,12 @@ License namespace Foam { - defineTypeNameAndDebug(dynamicPressure, 0); + defineTypeNameAndDebug(staticPressure, 0); } // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -bool Foam::dynamicPressure::isKinematicPressure() +bool Foam::staticPressure::isKinematicPressure() { const volScalarField& p = obr_.lookupObject(pName_); @@ -47,7 +47,7 @@ bool Foam::dynamicPressure::isKinematicPressure() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::dynamicPressure::dynamicPressure +Foam::staticPressure::staticPressure ( const word& name, const objectRegistry& obr, @@ -67,7 +67,7 @@ Foam::dynamicPressure::dynamicPressure active_ = false; WarningIn ( - "dynamicPressure::dynamicPressure" + "staticPressure::staticPressure" "(const objectRegistry&, const dictionary&)" ) << "No fvMesh available, deactivating." << nl << endl; @@ -80,7 +80,7 @@ Foam::dynamicPressure::dynamicPressure active_ = false; WarningIn ( - "dynamicPressure::dynamicPressure" + "staticPressure::staticPressure" "(const objectRegistry&, const dictionary&)" ) << "Pressure is not kinematic pressure, deactivating." << nl << endl; @@ -93,13 +93,13 @@ Foam::dynamicPressure::dynamicPressure // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::dynamicPressure::~dynamicPressure() +Foam::staticPressure::~staticPressure() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::dynamicPressure::read(const dictionary& dict) +void Foam::staticPressure::read(const dictionary& dict) { if (active_) { @@ -109,19 +109,19 @@ void Foam::dynamicPressure::read(const dictionary& dict) } -void Foam::dynamicPressure::execute() +void Foam::staticPressure::execute() { // Do nothing - only valid on write } -void Foam::dynamicPressure::end() +void Foam::staticPressure::end() { // Do nothing - only valid on write } -void Foam::dynamicPressure::write() +void Foam::staticPressure::write() { if (active_) { diff --git a/src/postProcessing/functionObjects/utilities/dynamicPressure/dynamicPressure.H b/src/postProcessing/functionObjects/utilities/staticPressure/staticPressure.H similarity index 82% rename from src/postProcessing/functionObjects/utilities/dynamicPressure/dynamicPressure.H rename to src/postProcessing/functionObjects/utilities/staticPressure/staticPressure.H index c3c6bdbb0f..0a7be2c620 100644 --- a/src/postProcessing/functionObjects/utilities/dynamicPressure/dynamicPressure.H +++ b/src/postProcessing/functionObjects/utilities/staticPressure/staticPressure.H @@ -23,20 +23,22 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::dynamicPressure + Foam::staticPressure Description - Converts kinematic pressure to dynamic pressure, from the name of the - pressure field, and density. + Converts kinematic pressure to static pressure, from the name of the + pressure field, and density, i.e. + + p_static = density*p_kinematic SourceFiles - dynamicPressure.C - IOdynamicPressure.H + staticPressure.C + IOstaticPressure.H \*---------------------------------------------------------------------------*/ -#ifndef dynamicPressure_H -#define dynamicPressure_H +#ifndef staticPressure_H +#define staticPressure_H #include "pointFieldFwd.H" @@ -51,14 +53,14 @@ class dictionary; class mapPolyMesh; /*---------------------------------------------------------------------------*\ - Class dynamicPressure Declaration + Class staticPressure Declaration \*---------------------------------------------------------------------------*/ -class dynamicPressure +class staticPressure { // Private data - //- Name of this set of dynamicPressure objects + //- Name of this set of staticPressure objects word name_; const objectRegistry& obr_; @@ -79,23 +81,23 @@ class dynamicPressure bool isKinematicPressure(); //- Disallow default bitwise copy construct - dynamicPressure(const dynamicPressure&); + staticPressure(const staticPressure&); //- Disallow default bitwise assignment - void operator=(const dynamicPressure&); + void operator=(const staticPressure&); public: //- Runtime type information - TypeName("dynamicPressure"); + TypeName("staticPressure"); // Constructors //- Construct for given objectRegistry and dictionary. // Allow the possibility to load fields from files - dynamicPressure + staticPressure ( const word& name, const objectRegistry&, @@ -106,18 +108,18 @@ public: // Destructor - virtual ~dynamicPressure(); + virtual ~staticPressure(); // Member Functions - //- Return name of the set of dynamicPressure + //- Return name of the set of staticPressure virtual const word& name() const { return name_; } - //- Read the dynamicPressure data + //- Read the staticPressure data virtual void read(const dictionary&); //- Execute, currently does nothing @@ -126,7 +128,7 @@ public: //- Execute at the final time-loop, currently does nothing virtual void end(); - //- Calculate the dynamicPressure and write + //- Calculate the staticPressure and write virtual void write(); //- Update for changes of mesh diff --git a/src/postProcessing/functionObjects/utilities/dynamicPressure/dynamicPressureFunctionObject.C b/src/postProcessing/functionObjects/utilities/staticPressure/staticPressureFunctionObject.C similarity index 90% rename from src/postProcessing/functionObjects/utilities/dynamicPressure/dynamicPressureFunctionObject.C rename to src/postProcessing/functionObjects/utilities/staticPressure/staticPressureFunctionObject.C index f7c060f586..d84c802a4a 100644 --- a/src/postProcessing/functionObjects/utilities/dynamicPressure/dynamicPressureFunctionObject.C +++ b/src/postProcessing/functionObjects/utilities/staticPressure/staticPressureFunctionObject.C @@ -24,18 +24,18 @@ License \*---------------------------------------------------------------------------*/ -#include "dynamicPressureFunctionObject.H" +#include "staticPressureFunctionObject.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - defineNamedTemplateTypeNameAndDebug(dynamicPressureFunctionObject, 0); + defineNamedTemplateTypeNameAndDebug(staticPressureFunctionObject, 0); addToRunTimeSelectionTable ( functionObject, - dynamicPressureFunctionObject, + staticPressureFunctionObject, dictionary ); } diff --git a/src/postProcessing/functionObjects/utilities/dynamicPressure/dynamicPressureFunctionObject.H b/src/postProcessing/functionObjects/utilities/staticPressure/staticPressureFunctionObject.H similarity index 81% rename from src/postProcessing/functionObjects/utilities/dynamicPressure/dynamicPressureFunctionObject.H rename to src/postProcessing/functionObjects/utilities/staticPressure/staticPressureFunctionObject.H index cca83745e8..40f425d4b1 100644 --- a/src/postProcessing/functionObjects/utilities/dynamicPressure/dynamicPressureFunctionObject.H +++ b/src/postProcessing/functionObjects/utilities/staticPressure/staticPressureFunctionObject.H @@ -23,29 +23,29 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Typedef - Foam::dynamicPressureFunctionObject + Foam::staticPressureFunctionObject Description - FunctionObject wrapper around dynamicPressure to allow it to be created via + FunctionObject wrapper around staticPressure to allow it to be created via the functions list within controlDict. SourceFiles - dynamicPressureFunctionObject.C + staticPressureFunctionObject.C \*---------------------------------------------------------------------------*/ -#ifndef dynamicPressureFunctionObject_H -#define dynamicPressureFunctionObject_H +#ifndef staticPressureFunctionObject_H +#define staticPressureFunctionObject_H -#include "dynamicPressure.H" +#include "staticPressure.H" #include "OutputFilterFunctionObject.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - typedef OutputFilterFunctionObject - dynamicPressureFunctionObject; + typedef OutputFilterFunctionObject + staticPressureFunctionObject; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // From ce99c74967cb9dc4609ccabbf59a144d256a1a9e Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 25 Feb 2009 13:43:27 +0000 Subject: [PATCH 04/35] typo --- .../liquidMixture/liquidMixture/liquidMixture.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thermophysicalModels/liquidMixture/liquidMixture/liquidMixture.H b/src/thermophysicalModels/liquidMixture/liquidMixture/liquidMixture.H index cac45b19ed..43ea408349 100644 --- a/src/thermophysicalModels/liquidMixture/liquidMixture/liquidMixture.H +++ b/src/thermophysicalModels/liquidMixture/liquidMixture/liquidMixture.H @@ -167,7 +167,7 @@ public: ) const; - //- Calculate the mean molecular weigth [kg/kmol] + //- Calculate the mean molecular weight [kg/kmol] // from mole fractions scalar W(const scalarField& x) const; From edff91a7c1843f46bf7617040e8f6544ecda0707 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 27 Feb 2009 18:40:46 +0000 Subject: [PATCH 05/35] typo --- .../derived/totalPressure/totalPressureFvPatchScalarField.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.C index 2207df3106..7cb8936f18 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.C @@ -264,7 +264,7 @@ void Foam::totalPressureFvPatchScalarField::write(Ostream& os) const { fvPatchScalarField::write(os); writeEntryIfDifferent(os, "U", "U", UName_); - writeEntryIfDifferent(os, "phi", "phi", UName_); + writeEntryIfDifferent(os, "phi", "phi", phiName_); os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl; os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl; From 6820f33509f1dd061ec56c80967c2674afe02d72 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 2 Mar 2009 15:09:23 +0000 Subject: [PATCH 06/35] incorrect read option --- .../field/fieldAverage/fieldAverage/fieldAverage.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.C b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.C index 8f047d1d41..16d3a328a0 100644 --- a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.C +++ b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.C @@ -259,7 +259,7 @@ void Foam::fieldAverage::readAveragingProperties() obr_.time().timeName(), "uniform", obr_, - IOobject::NO_READ, + IOobject::MUST_READ, IOobject::NO_WRITE, false ); From 9035b3e41904ff28580d77ce5a3cb736506e20b2 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 19 Mar 2009 11:38:47 +0000 Subject: [PATCH 07/35] added noLagrangian option --- .../reconstructPar/reconstructPar.C | 190 +++++++++--------- 1 file changed, 98 insertions(+), 92 deletions(-) diff --git a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C index 20def06b9c..d581bacd7f 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C +++ b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C @@ -51,6 +51,7 @@ int main(int argc, char *argv[]) argList::noParallel(); # include "addRegionOption.H" argList::validOptions.insert("fields", "\"(list of fields)\""); + argList::validOptions.insert("noLagrangian", ""); # include "setRootCase.H" # include "createTime.H" @@ -61,6 +62,8 @@ int main(int argc, char *argv[]) IStringStream(args.options()["fields"])() >> selectedFields; } + bool noLagrangian = args.options().found("noLagrangian"); + // determine the processor count directly label nProcs = 0; while (isDir(args.path()/(word("processor") + name(nProcs)))) @@ -269,118 +272,121 @@ int main(int argc, char *argv[]) // the first processor that has them. They are in pass2 only used // for name and type (scalar, vector etc). - HashTable cloudObjects; - - forAll (databases, procI) + if (!noLagrangian) { - fileNameList cloudDirs - ( - readDir - ( - databases[procI].timePath()/regionPrefix/"lagrangian", - fileName::DIRECTORY - ) - ); + HashTable cloudObjects; - forAll (cloudDirs, i) + forAll (databases, procI) { - // Check if we already have cloud objects for this cloudname. - HashTable::const_iterator iter = - cloudObjects.find(cloudDirs[i]); - - if (iter == cloudObjects.end()) - { - // Do local scan for valid cloud objects. - IOobjectList sprayObjs + fileNameList cloudDirs + ( + readDir ( - procMeshes.meshes()[procI], - databases[procI].timeName(), - "lagrangian"/cloudDirs[i] - ); + databases[procI].timePath()/regionPrefix/"lagrangian", + fileName::DIRECTORY + ) + ); - IOobject* positionsPtr = sprayObjs.lookup("positions"); + forAll (cloudDirs, i) + { + // Check if we already have cloud objects for this cloudname + HashTable::const_iterator iter = + cloudObjects.find(cloudDirs[i]); - if (positionsPtr) + if (iter == cloudObjects.end()) { - cloudObjects.insert(cloudDirs[i], sprayObjs); + // Do local scan for valid cloud objects + IOobjectList sprayObjs + ( + procMeshes.meshes()[procI], + databases[procI].timeName(), + "lagrangian"/cloudDirs[i] + ); + + IOobject* positionsPtr = sprayObjs.lookup("positions"); + + if (positionsPtr) + { + cloudObjects.insert(cloudDirs[i], sprayObjs); + } } } } - } - if (cloudObjects.size()) - { - // Pass2: reconstruct the cloud - forAllConstIter(HashTable, cloudObjects, iter) + if (cloudObjects.size()) { - const word cloudName = string::validate(iter.key()); + // Pass2: reconstruct the cloud + forAllConstIter(HashTable, cloudObjects, iter) + { + const word cloudName = string::validate(iter.key()); - // Objects (on arbitrary processor) - const IOobjectList& sprayObjs = iter(); + // Objects (on arbitrary processor) + const IOobjectList& sprayObjs = iter(); - Info<< "Reconstructing lagrangian fields for cloud " - << cloudName << nl << endl; + Info<< "Reconstructing lagrangian fields for cloud " + << cloudName << nl << endl; - reconstructLagrangianPositions - ( - mesh, - cloudName, - procMeshes.meshes(), - procMeshes.faceProcAddressing(), - procMeshes.cellProcAddressing() - ); - reconstructLagrangianFields