From 3bb182533488deef034b8d76cb4d076984d49c15 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 16 Jan 2009 14:32:58 +0000 Subject: [PATCH 01/12] removing unnecessary reduce ops --- .../functionObjects/field/fieldMinMax/fieldMinMax.C | 3 --- .../functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C | 3 --- 2 files changed, 6 deletions(-) diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C index 172a1325c8..47629bf823 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C @@ -181,9 +181,6 @@ void Foam::fieldMinMax::calcMinMaxFields scalar minValue = min(field).value(); scalar maxValue = max(field).value(); - reduce(minValue, minOp()); - reduce(maxValue, maxOp()); - if (Pstream::master()) { fieldMinMaxFilePtr_() << obr_.time().value() << tab diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C index 354668d3f4..e2a1170c29 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C @@ -42,9 +42,6 @@ void Foam::fieldMinMax::calcMinMaxFields(const word& fieldName) scalar minValue = min(mag(field)).value(); scalar maxValue = max(mag(field)).value(); - reduce(minValue, minOp()); - reduce(maxValue, maxOp()); - if (Pstream::master()) { fieldMinMaxFilePtr_() << obr_.time().value() << tab From b1800b8b928062d5990f21f69a1f6fb38f4aca51 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 16 Jan 2009 15:45:52 +0000 Subject: [PATCH 02/12] adding mag/component options --- .../field/fieldMinMax/fieldMinMax.C | 24 +++++-- .../field/fieldMinMax/fieldMinMax.H | 22 ++++++- .../field/fieldMinMax/fieldMinMaxTemplates.C | 63 +++++++++++++++---- 3 files changed, 89 insertions(+), 20 deletions(-) diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C index 47629bf823..051f9f9a6d 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C @@ -38,6 +38,18 @@ namespace Foam } +template<> +const char* Foam::NamedEnum::names[] = +{ + "magnitude", + "component" +}; + + +const Foam::NamedEnum +Foam::fieldMinMax::modeTypeNames_; + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::fieldMinMax::fieldMinMax @@ -52,6 +64,7 @@ Foam::fieldMinMax::fieldMinMax obr_(obr), active_(true), log_(false), + mode_(mdMag), fieldSet_(), fieldMinMaxFilePtr_(NULL) { @@ -85,6 +98,7 @@ void Foam::fieldMinMax::read(const dictionary& dict) { log_ = dict.lookupOrDefault("log", false); + mode_ = modeTypeNames_[dict.lookup("mode")]; dict.lookup("fields") >> fieldSet_; } } @@ -176,13 +190,13 @@ void Foam::fieldMinMax::calcMinMaxFields { if (obr_.foundObject(fieldName)) { - const volScalarField& field = - obr_.lookupObject(fieldName); - scalar minValue = min(field).value(); - scalar maxValue = max(field).value(); - if (Pstream::master()) { + const volScalarField& field = + obr_.lookupObject(fieldName); + scalar minValue = min(field).value(); + scalar maxValue = max(field).value(); + fieldMinMaxFilePtr_() << obr_.time().value() << tab << fieldName << tab << minValue << tab << maxValue << endl; diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.H b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.H index 1f2ac449c6..17cfcf54e3 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.H +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.H @@ -49,6 +49,7 @@ SourceFiles #include "OFstream.H" #include "Switch.H" #include "pointFieldFwd.H" +#include "NamedEnum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -66,9 +67,18 @@ class mapPolyMesh; class fieldMinMax { +public: + + enum modeType + { + mdMag, + mdCmpt + }; + + protected: - // Private data + // Protected data //- Name of this set of forces, // Also used as the name of the probes directory. @@ -82,11 +92,17 @@ protected: //- Switch to send output to Info as well as to file Switch log_; - //- Patches to integrate forces over + //- Mode type names + static const NamedEnum modeTypeNames_; + + //- Mode for min/max - only applicable for ranks > 0 + modeType mode_; + + //- Fields to assess min/max wordList fieldSet_; - //- Forces/moment file ptr + //- Min/max file ptr autoPtr fieldMinMaxFilePtr_; diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C index e2a1170c29..06d6bd585e 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C @@ -38,21 +38,60 @@ void Foam::fieldMinMax::calcMinMaxFields(const word& fieldName) if (obr_.foundObject(fieldName)) { - const fieldType& field = obr_.lookupObject(fieldName); - scalar minValue = min(mag(field)).value(); - scalar maxValue = max(mag(field)).value(); - if (Pstream::master()) { - fieldMinMaxFilePtr_() << obr_.time().value() << tab - << fieldName << tab << minValue << tab << maxValue << endl; - - if (log_) + const fieldType& field = obr_.lookupObject(fieldName); + switch (mode_) { - Info<< "fieldMinMax output:" << nl - << " min(mag(" << fieldName << ")) = " << minValue << nl - << " max(mag(" << fieldName << ")) = " << maxValue << nl - << endl; + case mdMag: + { + scalar minValue = min(mag(field)).value(); + scalar maxValue = max(mag(field)).value(); + + fieldMinMaxFilePtr_() << obr_.time().value() << tab + << fieldName << tab << minValue << tab << maxValue + << endl; + + if (log_) + { + Info<< "fieldMinMax output:" << nl + << " min(mag(" << fieldName << ")) = " + << minValue << nl + << " max(mag(" << fieldName << ")) = " + << maxValue << nl + << endl; + } + break; + } + case mdCmpt: + { + Type minValue = min(field).value(); + Type maxValue = max(field).value(); + + fieldMinMaxFilePtr_() << obr_.time().value() << tab + << fieldName << tab << minValue << tab << maxValue + << endl; + + if (log_) + { + Info<< "fieldMinMax output:" << nl + << " cmptMin(" << fieldName << ") = " + << minValue << nl + << " cmptMax(" << fieldName << ") = " + << maxValue << nl + << endl; + } + break; + } + default: + { + FatalErrorIn + ( + "Foam::fieldMinMax::calcMinMaxFields" + "(const word& fieldName)" + )<< "Unknown min/max mode: " << modeTypeNames_[mode_] + << exit(FatalError); + } } } } From b1dcfe66ec257913c3b612713276091935c4f910 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 19 Jan 2009 11:54:56 +0000 Subject: [PATCH 03/12] updated --- tutorials/dieselFoam/aachenBomb/0/alphat | 32 +++++++++++++++++++ tutorials/dieselFoam/aachenBomb/0/epsilon | 28 ++++++---------- tutorials/dieselFoam/aachenBomb/0/k | 28 ++++++---------- tutorials/dieselFoam/aachenBomb/0/mut | 32 +++++++++++++++++++ .../aachenBomb/constant/turbulenceProperties | 19 +++++++++++ .../dieselFoam/aachenBomb/system/fvSolution | 21 ++++++++---- 6 files changed, 117 insertions(+), 43 deletions(-) create mode 100644 tutorials/dieselFoam/aachenBomb/0/alphat create mode 100644 tutorials/dieselFoam/aachenBomb/0/mut create mode 100644 tutorials/dieselFoam/aachenBomb/constant/turbulenceProperties diff --git a/tutorials/dieselFoam/aachenBomb/0/alphat b/tutorials/dieselFoam/aachenBomb/0/alphat new file mode 100644 index 0000000000..1681c54f00 --- /dev/null +++ b/tutorials/dieselFoam/aachenBomb/0/alphat @@ -0,0 +1,32 @@ +/*--------------------------------*- 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 binary; + class volScalarField; + location "0"; + object alphat; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + walls + { + type alphatWallFunction; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/dieselFoam/aachenBomb/0/epsilon b/tutorials/dieselFoam/aachenBomb/0/epsilon index de3d91a3ed..c14d3d7e02 100644 --- a/tutorials/dieselFoam/aachenBomb/0/epsilon +++ b/tutorials/dieselFoam/aachenBomb/0/epsilon @@ -1,40 +1,32 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.5 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; - format ascii; + format binary; class volScalarField; + location "0"; object epsilon; } -// ************************************************************************* // +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [ 0 2 -3 0 0 0 0 ]; +dimensions [0 2 -3 0 0 0 0]; -internalField uniform 90.0; +internalField uniform 90; boundaryField { walls { - type zeroGradient; + type epsilonWallFunction; + value uniform 90; } - - front - { - type wedge; - } - - back - { - type wedge; - } - } + // ************************************************************************* // diff --git a/tutorials/dieselFoam/aachenBomb/0/k b/tutorials/dieselFoam/aachenBomb/0/k index 1ca9a40d69..e6e58aecfa 100644 --- a/tutorials/dieselFoam/aachenBomb/0/k +++ b/tutorials/dieselFoam/aachenBomb/0/k @@ -1,40 +1,32 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.5 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; - format ascii; + format binary; class volScalarField; + location "0"; object k; } -// ************************************************************************* // +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [ 0 2 -2 0 0 0 0 ]; +dimensions [0 2 -2 0 0 0 0]; -internalField uniform 1.0; +internalField uniform 1; boundaryField { walls { - type zeroGradient; + type kQRWallFunction; + value uniform 1; } - - front - { - type wedge; - } - - back - { - type wedge; - } - } + // ************************************************************************* // diff --git a/tutorials/dieselFoam/aachenBomb/0/mut b/tutorials/dieselFoam/aachenBomb/0/mut new file mode 100644 index 0000000000..2750ce32ec --- /dev/null +++ b/tutorials/dieselFoam/aachenBomb/0/mut @@ -0,0 +1,32 @@ +/*--------------------------------*- 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 binary; + class volScalarField; + location "0"; + object mut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + walls + { + type mutWallFunction; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/dieselFoam/aachenBomb/constant/turbulenceProperties b/tutorials/dieselFoam/aachenBomb/constant/turbulenceProperties new file mode 100644 index 0000000000..3d7edb19ec --- /dev/null +++ b/tutorials/dieselFoam/aachenBomb/constant/turbulenceProperties @@ -0,0 +1,19 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType RASModel; + +// ************************************************************************* // diff --git a/tutorials/dieselFoam/aachenBomb/system/fvSolution b/tutorials/dieselFoam/aachenBomb/system/fvSolution index 4f4a45349f..3183443d6e 100644 --- a/tutorials/dieselFoam/aachenBomb/system/fvSolution +++ b/tutorials/dieselFoam/aachenBomb/system/fvSolution @@ -16,44 +16,51 @@ FoamFile solvers { - rho PCG + rho { + solver PCG; preconditioner DIC; tolerance 1e-06; relTol 0; }; - U PBiCG + U { + solver PBiCG; preconditioner DILU; tolerance 1e-06; relTol 0; }; - p PCG + p { + solver PCG; preconditioner DIC; tolerance 1e-09; relTol 0; }; - Yi PBiCG + Yi { + solver PBiCG; preconditioner DILU; tolerance 1e-06; relTol 0; }; - h PBiCG + h { + solver PBiCG; preconditioner DILU; tolerance 1e-06; relTol 0; }; - k PBiCG + k { + solver PBiCG; preconditioner DILU; tolerance 1e-06; relTol 0; }; - epsilon PBiCG + epsilon { + solver PBiCG; preconditioner DILU; tolerance 1e-06; relTol 0; From 887ea6e066aa99bc9109652c98236b14a5cd8a7a Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 19 Jan 2009 19:11:09 +0000 Subject: [PATCH 04/12] removed boundary condition update --- src/finiteVolume/cfdTools/general/bound/bound.C | 1 - 1 file changed, 1 deletion(-) diff --git a/src/finiteVolume/cfdTools/general/bound/bound.C b/src/finiteVolume/cfdTools/general/bound/bound.C index ccceae463b..b629033754 100644 --- a/src/finiteVolume/cfdTools/general/bound/bound.C +++ b/src/finiteVolume/cfdTools/general/bound/bound.C @@ -53,7 +53,6 @@ void Foam::bound(volScalarField& vsf, const dimensionedScalar& vsf0) vsf0.value() ); - vsf.correctBoundaryConditions(); vsf.boundaryField() = max(vsf.boundaryField(), vsf0.value()); } } From e5e9902bec61cbbacdb40d7d021ada24a9c82aa7 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 20 Jan 2009 11:44:03 +0000 Subject: [PATCH 05/12] added output for areas of cyclic halves --- .../patch/patchIntegrate/patchIntegrate.C | 51 +++++++++++++++---- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C b/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C index 69ffc17f91..dc92aade57 100644 --- a/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C +++ b/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C @@ -31,6 +31,7 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" +#include "cyclicPolyPatch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Main program: @@ -75,26 +76,54 @@ int main(int argc, char *argv[]) } // Give patch area - Info<< " Patch area = " << gSum(mesh.Sf().boundaryField()[patchi]) << endl; - - if (fieldHeader.headerClassName() == "volScalarField") + if (isType(mesh.boundaryMesh()[patchi])) { - Info<< " Reading volScalarField " << fieldName << endl; - volScalarField field(fieldHeader, mesh); + Info<< " Cyclic patch area: " << nl; + label nFaces = mesh.boundaryMesh()[patchi].size(); + vector sum1 = vector::zero; + vector sum2 = vector::zero; + for (label i=0; i()); + reduce(sum2, sumOp()); + Info<< " - half 1 = " << sum1 << ", " << mag(sum1) << nl + << " - half 2 = " << sum2 << ", " << mag(sum2) << nl + << " - total = " << (sum1 + sum2) << ", " + << mag(sum1 + sum2) << endl;; + } + else + { + Info<< " Patch area = " + << gSum(mesh.Sf().boundaryField()[patchi]) << endl; + } + // Read field and calc integral + if (fieldHeader.headerClassName() == volScalarField::typeName) + { + Info<< " Reading " << volScalarField::typeName << " " + << fieldName << endl; + + volScalarField field(fieldHeader, mesh); vector sumField = gSum ( mesh.Sf().boundaryField()[patchi] - * field.boundaryField()[patchi] + *field.boundaryField()[patchi] ); Info<< " Integral of " << fieldName << " over patch " << patchName << '[' << patchi << ']' << " = " << sumField << nl; } - else if (fieldHeader.headerClassName() == "surfaceScalarField") + else if + ( + fieldHeader.headerClassName() == surfaceScalarField::typeName + ) { - Info<< " Reading surfaceScalarField " << fieldName << endl; + Info<< " Reading " << surfaceScalarField::typeName << " " + << fieldName << endl; surfaceScalarField field(fieldHeader, mesh); scalar sumField = gSum(field.boundaryField()[patchi]); @@ -106,8 +135,10 @@ int main(int argc, char *argv[]) else { FatalError - << "Only possible to integrate volScalarFields " - << "and surfaceScalarFields" << nl << exit(FatalError); + << "Only possible to integrate " + << volScalarField::typeName << "s " + << "and " << surfaceScalarField::typeName << "s" + << nl << exit(FatalError); } } else From ce12ace5a6db76409a843ca7552e04f217d9ae9a Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 20 Jan 2009 12:05:51 +0000 Subject: [PATCH 06/12] typo --- src/finiteVolume/cfdTools/general/include/setDeltaT.H | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/finiteVolume/cfdTools/general/include/setDeltaT.H b/src/finiteVolume/cfdTools/general/include/setDeltaT.H index 5b75787589..58cd25f233 100644 --- a/src/finiteVolume/cfdTools/general/include/setDeltaT.H +++ b/src/finiteVolume/cfdTools/general/include/setDeltaT.H @@ -27,7 +27,7 @@ Global Description Reset the timestep to maintain a constant maximum courant Number. - Reduction of time-step is imediate but increase is damped to avoid + Reduction of time-step is immediate, but increase is damped to avoid unstable oscillations. \*---------------------------------------------------------------------------*/ @@ -45,7 +45,7 @@ if (adjustTimeStep) maxDeltaT ) ); - + Info<< "deltaT = " << runTime.deltaT().value() << endl; } From 7e08613522a74db4fc6aa0458ad34238f2d7901e Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 20 Jan 2009 12:09:12 +0000 Subject: [PATCH 07/12] tidying up --- .../dieselEngineFoam/spraySummary.H | 17 +-- .../injector/unitInjector/unitInjector.C | 116 ++++++++++-------- .../breakupModel/reitzKHRT/reitzKHRT.C | 69 ++++------- 3 files changed, 100 insertions(+), 102 deletions(-) diff --git a/applications/solvers/combustion/dieselEngineFoam/spraySummary.H b/applications/solvers/combustion/dieselEngineFoam/spraySummary.H index 553cb52940..907784b438 100644 --- a/applications/solvers/combustion/dieselEngineFoam/spraySummary.H +++ b/applications/solvers/combustion/dieselEngineFoam/spraySummary.H @@ -1,19 +1,20 @@ label Nparcels = dieselSpray.size(); reduce(Nparcels, sumOp