From a65c6f234d670937f15fd32123ec32901e18ae89 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 20 Aug 2008 12:10:43 +0100 Subject: [PATCH 01/25] make SortableList::sort always use stable sort --- .../Lists/SortableList/SortableList.C | 23 +------------------ .../Lists/SortableList/SortableList.H | 5 +--- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/src/OpenFOAM/containers/Lists/SortableList/SortableList.C b/src/OpenFOAM/containers/Lists/SortableList/SortableList.C index 7cde863a63..a4264578d1 100644 --- a/src/OpenFOAM/containers/Lists/SortableList/SortableList.C +++ b/src/OpenFOAM/containers/Lists/SortableList/SortableList.C @@ -86,28 +86,7 @@ void Foam::SortableList::sort() indices_[i] = i; } - Foam::sort(indices_, less(*this)); - - List tmpValues(this->size()); - - forAll(indices_, i) - { - tmpValues[i] = this->operator[](indices_[i]); - } - - List::transfer(tmpValues); -} - - - -template -void Foam::SortableList::stableSort() -{ - forAll(indices_, i) - { - indices_[i] = i; - } - + //Foam::sort(indices_, less(*this)); Foam::stableSort(indices_, less(*this)); List tmpValues(this->size()); diff --git a/src/OpenFOAM/containers/Lists/SortableList/SortableList.H b/src/OpenFOAM/containers/Lists/SortableList/SortableList.H index a9ab2ae829..dd0f0af0d4 100644 --- a/src/OpenFOAM/containers/Lists/SortableList/SortableList.H +++ b/src/OpenFOAM/containers/Lists/SortableList/SortableList.H @@ -109,12 +109,9 @@ public: //- Size the list. If grow can cause undefined indices (until next sort) void setSize(const label); - //- Sort the list (if changed after construction time) + //- (stable) sort the list (if changed after construction time) void sort(); - //- Sort the list (if changed after construction time) - void stableSort(); - // Member Operators From ce16ef250eeddebc70e2f5fd7a311ec818c8573a Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 20 Aug 2008 12:11:13 +0100 Subject: [PATCH 02/25] unnecessary include --- .../polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C | 1 - src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C | 2 -- src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C | 1 - src/meshTools/searchableSurface/searchableSphere.C | 1 - .../booleanOps/intersectedSurface/intersectedSurface.C | 2 -- 5 files changed, 7 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C index af86f37fed..f4e073d4e1 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C @@ -25,7 +25,6 @@ License \*---------------------------------------------------------------------------*/ #include "coupledPolyPatch.H" -#include "SortableList.H" #include "ListOps.H" #include "transform.H" #include "OFstream.H" diff --git a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C index fedd050a78..da7e6368c1 100644 --- a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C +++ b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C @@ -24,7 +24,6 @@ License \*---------------------------------------------------------------------------*/ -#include "SortableList.H" #include "dynamicRefineFvMesh.H" #include "addToRunTimeSelectionTable.H" #include "volFields.H" @@ -32,7 +31,6 @@ License #include "surfaceFields.H" #include "fvCFD.H" #include "syncTools.H" -#include "ListListOps.H" #include "pointFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C b/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C index 9c6a50177a..6d97285d73 100644 --- a/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C +++ b/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C @@ -32,7 +32,6 @@ License #include "octreeDataFace.H" #include "octree.H" #include "OFstream.H" -#include "SortableList.H" #include "IndirectList.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/meshTools/searchableSurface/searchableSphere.C b/src/meshTools/searchableSurface/searchableSphere.C index 47abfbfff5..04f3f2f2b5 100644 --- a/src/meshTools/searchableSurface/searchableSphere.C +++ b/src/meshTools/searchableSurface/searchableSphere.C @@ -26,7 +26,6 @@ License #include "searchableSphere.H" #include "addToRunTimeSelectionTable.H" -#include "SortableList.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/meshTools/triSurface/booleanOps/intersectedSurface/intersectedSurface.C b/src/meshTools/triSurface/booleanOps/intersectedSurface/intersectedSurface.C index f31b30602b..7e716c1679 100644 --- a/src/meshTools/triSurface/booleanOps/intersectedSurface/intersectedSurface.C +++ b/src/meshTools/triSurface/booleanOps/intersectedSurface/intersectedSurface.C @@ -27,8 +27,6 @@ License #include "intersectedSurface.H" #include "surfaceIntersection.H" #include "faceList.H" -#include "SortableList.H" -#include "triSurfaceTools.H" #include "faceTriangulation.H" #include "treeBoundBox.H" #include "OFstream.H" From b0e8eaf614ec612c5545507c8ebc6333c2cce24e Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 20 Aug 2008 12:11:30 +0100 Subject: [PATCH 03/25] make SortableList::sort always use stable sort --- src/triSurface/triSurface/triSurface.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/triSurface/triSurface/triSurface.C b/src/triSurface/triSurface/triSurface.C index adc28176c5..336987ade8 100644 --- a/src/triSurface/triSurface/triSurface.C +++ b/src/triSurface/triSurface/triSurface.C @@ -626,7 +626,7 @@ surfacePatchList triSurface::calcPatches(labelList& faceMap) const { sortedRegion[faceI] = operator[](faceI).region(); } - sortedRegion.stableSort(); + sortedRegion.sort(); faceMap = sortedRegion.indices(); From 3a77be2c4895ab062111338f6eb6649fc90cfabd Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 26 Aug 2008 10:57:40 +0100 Subject: [PATCH 04/25] moved constantVolume flag from massTransferModel to constantProperties --- .../Templates/ReactingParcel/ReactingParcel.C | 12 ++++++------ .../Templates/ReactingParcel/ReactingParcel.H | 6 ++++++ .../Templates/ReactingParcel/ReactingParcelI.H | 11 ++++++++++- .../ConstantRateDevolatilisation.C | 7 ------- .../ConstantRateDevolatilisation.H | 3 --- .../MassTransferModel/MassTransferModel.H | 3 --- .../NoMassTransfer/NoMassTransfer.C | 7 ------- .../NoMassTransfer/NoMassTransfer.H | 3 --- .../SingleKineticRateDevolatilisation.C | 7 ------- .../SingleKineticRateDevolatilisation.H | 3 --- 10 files changed, 22 insertions(+), 40 deletions(-) diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C index 7fe198e773..5fe3aa1633 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C @@ -191,13 +191,13 @@ void Foam::ReactingParcel::calcCoupled + YMixture_[2]*td.cloud().composition().cpSolid(YSolid_); // Update particle density or diameter - if (td.cloud().massTransfer().changesVolume()) + if (td.constProps().constantVolume()) { - this->d_ = cbrt(mass1/this->rho_*6.0/mathematicalConstant::pi); + this->rho_ = mass1/this->volume(); } else { - this->rho_ = mass1/this->volume(); + this->d_ = cbrt(mass1/this->rho_*6.0/mathematicalConstant::pi); } } } @@ -296,13 +296,13 @@ void Foam::ReactingParcel::calcUncoupled this->cp_ = cp1; // Update particle density or diameter - if (td.cloud().massTransfer().changesVolume()) + if (td.constProps().constantVolume()) { - this->d_ = cbrt(mass1/this->rho_*6.0/mathematicalConstant::pi); + this->rho_ = mass1/this->volume(); } else { - this->rho_ = mass1/this->volume(); + this->d_ = cbrt(mass1/this->rho_*6.0/mathematicalConstant::pi); } } } diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H index a6b8eb5ad5..fc4edfb797 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H @@ -92,6 +92,9 @@ public: //- Latent heat of devolatilisation [J/kg] const scalar Ldevol_; + //- Constant volume flag - e.g. during mass transfer + Switch constantVolume_; + public: @@ -108,6 +111,9 @@ public: //- Return const access to the latent heat of devolatilisation inline scalar Ldevol() const; + + //- Return const access to the constant volume flag + inline Switch constantVolume() const; }; diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelI.H b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelI.H index 0c50b0a853..d84ee3742c 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelI.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelI.H @@ -35,7 +35,8 @@ inline Foam::ReactingParcel::constantProperties::constantProperties ThermoParcel::constantProperties(dict), Tvap_(dimensionedScalar(dict.lookup("Tvap")).value()), Tbp_(dimensionedScalar(dict.lookup("Tbp")).value()), - Ldevol_(dimensionedScalar(dict.lookup("Ldevol")).value()) + Ldevol_(dimensionedScalar(dict.lookup("Ldevol")).value()), + constantVolume_(dict.lookup("constantVolume")) {} @@ -136,6 +137,14 @@ Foam::ReactingParcel::constantProperties::Ldevol() const } +template +inline Foam::Switch +Foam::ReactingParcel::constantProperties::constantVolume() const +{ + return constantVolume_; +} + + // * * * * * * * * * * * trackData Member Functions * * * * * * * * * * * * // template diff --git a/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/ConstantRateDevolatilisation/ConstantRateDevolatilisation.C b/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/ConstantRateDevolatilisation/ConstantRateDevolatilisation.C index cb2785d175..304bd6897c 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/ConstantRateDevolatilisation/ConstantRateDevolatilisation.C +++ b/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/ConstantRateDevolatilisation/ConstantRateDevolatilisation.C @@ -60,13 +60,6 @@ bool Foam::ConstantRateDevolatilisation::active() const } -template -bool Foam::ConstantRateDevolatilisation::changesVolume() const -{ - return false; -} - - template Foam::scalar Foam::ConstantRateDevolatilisation::calculate ( diff --git a/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/ConstantRateDevolatilisation/ConstantRateDevolatilisation.H b/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/ConstantRateDevolatilisation/ConstantRateDevolatilisation.H index 14e7262169..094859cbec 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/ConstantRateDevolatilisation/ConstantRateDevolatilisation.H +++ b/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/ConstantRateDevolatilisation/ConstantRateDevolatilisation.H @@ -89,9 +89,6 @@ public: //- Flag to indicate whether model activates mass transfer model bool active() const; - //- Flag to indicate whether model changes particle volume - bool changesVolume() const; - //- Update model scalar calculate ( diff --git a/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/MassTransferModel/MassTransferModel.H b/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/MassTransferModel/MassTransferModel.H index 7b16d3dc35..2c5b5159cf 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/MassTransferModel/MassTransferModel.H +++ b/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/MassTransferModel/MassTransferModel.H @@ -130,9 +130,6 @@ public: //- Flag to indicate whether model activates mass transfer model virtual bool active() const = 0; - //- Flag to indicate whether model changes particle volume - virtual bool changesVolume() const = 0; - //- Update model virtual scalar calculate ( diff --git a/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/NoMassTransfer/NoMassTransfer.C b/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/NoMassTransfer/NoMassTransfer.C index 5b21a77250..38cb63ff38 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/NoMassTransfer/NoMassTransfer.C +++ b/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/NoMassTransfer/NoMassTransfer.C @@ -55,13 +55,6 @@ bool Foam::NoMassTransfer::active() const } -template -bool Foam::NoMassTransfer::changesVolume() const -{ - return false; -} - - template Foam::scalar Foam::NoMassTransfer::calculate ( diff --git a/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/NoMassTransfer/NoMassTransfer.H b/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/NoMassTransfer/NoMassTransfer.H index fb3e30fc61..9415db1dad 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/NoMassTransfer/NoMassTransfer.H +++ b/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/NoMassTransfer/NoMassTransfer.H @@ -75,9 +75,6 @@ public: //- Flag to indicate whether model activates mass transfer model bool active() const; - //- Flag to indicate whether model changes particle volume - bool changesVolume() const; - //- Update model scalar calculate ( diff --git a/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.C b/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.C index c8b5367d50..8cf111b816 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.C +++ b/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.C @@ -62,13 +62,6 @@ bool Foam::SingleKineticRateDevolatilisation::active() const } -template -bool Foam::SingleKineticRateDevolatilisation::changesVolume() const -{ - return false; -} - - template Foam::scalar Foam::SingleKineticRateDevolatilisation::calculate ( diff --git a/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.H b/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.H index a2894e5ece..13d3d4825a 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.H +++ b/src/lagrangian/intermediate/submodels/Reacting/MassTransferModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.H @@ -91,9 +91,6 @@ public: //- Flag to indicate whether model activates mass transfer model bool active() const; - //- Flag to indicate whether model changes particle volume - bool changesVolume() const; - //- Update model scalar calculate ( From 1c06d185711296df503e0444727fed50abd6ed58 Mon Sep 17 00:00:00 2001 From: henry Date: Tue, 26 Aug 2008 11:44:42 +0100 Subject: [PATCH 05/25] New Lagrangian application. --- .../Lagrangian/kinematicParcelFoam/Make/files | 3 + .../kinematicParcelFoam/Make/options | 21 +++++ .../kinematicParcelFoam/createFields.H | 68 ++++++++++++++++ .../kinematicParcelFoam/kinematicParcelFoam.C | 78 +++++++++++++++++++ 4 files changed, 170 insertions(+) create mode 100644 applications/solvers/Lagrangian/kinematicParcelFoam/Make/files create mode 100644 applications/solvers/Lagrangian/kinematicParcelFoam/Make/options create mode 100644 applications/solvers/Lagrangian/kinematicParcelFoam/createFields.H create mode 100644 applications/solvers/Lagrangian/kinematicParcelFoam/kinematicParcelFoam.C diff --git a/applications/solvers/Lagrangian/kinematicParcelFoam/Make/files b/applications/solvers/Lagrangian/kinematicParcelFoam/Make/files new file mode 100644 index 0000000000..f98171fc93 --- /dev/null +++ b/applications/solvers/Lagrangian/kinematicParcelFoam/Make/files @@ -0,0 +1,3 @@ +kinematicParcelFoam.C + +EXE = $(FOAM_USER_APPBIN)/kinematicParcelFoam diff --git a/applications/solvers/Lagrangian/kinematicParcelFoam/Make/options b/applications/solvers/Lagrangian/kinematicParcelFoam/Make/options new file mode 100644 index 0000000000..517724be31 --- /dev/null +++ b/applications/solvers/Lagrangian/kinematicParcelFoam/Make/options @@ -0,0 +1,21 @@ +EXE_INC = \ + -I$(LIB_SRC)/lagrangian/basic/lnInclude \ + -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ + -I$(LIB_SRC)/turbulenceModels/RAS + +EXE_LIBS = \ + -llagrangian \ + -llagrangianIntermediate \ + -lfiniteVolume \ + -lmeshTools \ + -lthermophysicalFunctions \ + -lbasicThermophysicalModels \ + /* -lcombustionThermophysicalModels */ \ + -lspecie \ + -lradiation \ + -lcompressibleRASModels diff --git a/applications/solvers/Lagrangian/kinematicParcelFoam/createFields.H b/applications/solvers/Lagrangian/kinematicParcelFoam/createFields.H new file mode 100644 index 0000000000..6b87262133 --- /dev/null +++ b/applications/solvers/Lagrangian/kinematicParcelFoam/createFields.H @@ -0,0 +1,68 @@ + Info<< "Reading thermophysical properties\n" << endl; + + autoPtr thermo + ( + basicThermo::New(mesh) + ); + + volScalarField rho + ( + IOobject + ( + "rho", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + thermo->rho() + ); + + Info<< "\nReading 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 turbulence + ( + compressible::RASModel::New + ( + rho, + U, + phi, + thermo() + ) + ); + + pointMesh pMesh(mesh); + volPointInterpolation vpi(mesh, pMesh); + + word kinematicCloudName("kinematicCloud"); + + if (args.options().found("cloudName")) + { + kinematicCloudName = args.options()["cloudName"]; + } + + Info<< "Constructing kinematicCloud " << kinematicCloudName << endl; + basicKinematicCloud kinematicCloud + ( + kinematicCloudName, + vpi, + rho, + U, + thermo().mu(), + g + ); diff --git a/applications/solvers/Lagrangian/kinematicParcelFoam/kinematicParcelFoam.C b/applications/solvers/Lagrangian/kinematicParcelFoam/kinematicParcelFoam.C new file mode 100644 index 0000000000..290480583c --- /dev/null +++ b/applications/solvers/Lagrangian/kinematicParcelFoam/kinematicParcelFoam.C @@ -0,0 +1,78 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 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 + kinematicParcelFoam + +Description + Transient solver a single kinematicCloud. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "basicThermo.H" +#include "compressible/RASModel/RASModel.H" +#include "basicKinematicCloud.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + argList::validOptions.insert("cloudName", "cloud name"); + + #include "setRootCase.H" + #include "createTime.H" + #include "createMesh.H" + #include "readEnvironmentalProperties.H" + #include "createFields.H" + #include "compressibleCourantNo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + while (runTime.run()) + { + runTime++; + + Info<< "Time = " << runTime.timeName() << nl << endl; + + Info<< "Evolving " << kinematicCloud.name() << endl; + kinematicCloud.evolve(); + kinematicCloud.info(); + + runTime.write(); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return(0); +} + + +// ************************************************************************* // From 99917f38b5dbbb53043affebaf6171b3e6b65585 Mon Sep 17 00:00:00 2001 From: henry Date: Tue, 26 Aug 2008 18:19:38 +0100 Subject: [PATCH 06/25] Corrected handling of '-'s. --- README | 4 +- README.html | 484 +++++++++--------------------------- ReleaseNotes-1.5 | 4 +- ReleaseNotes-1.5.html | 559 +++++++++++++----------------------------- 4 files changed, 291 insertions(+), 760 deletions(-) diff --git a/README b/README index a51f9acb5a..093280c6fb 100644 --- a/README +++ b/README @@ -2,9 +2,9 @@ # #+TITLE: *OpenFOAM README for version 1.5* #+AUTHOR: OpenCFD Ltd. -#+DATE: 14 July 2008 +#+DATE: 26 August 2008 #+LINK: http://www.opencfd.co.uk -#+OPTIONS: author:nil +#+OPTIONS: author:nil ^:{} * Copyright OpenFOAM is free software; you can redistribute it and/or modify it under the diff --git a/README.html b/README.html index 415eb9f33a..cd1497fcad 100644 --- a/README.html +++ b/README.html @@ -1,42 +1,26 @@ - - - -<b>OpenFOAM README for version 1.5</b> - - - - - - -

OpenFOAM README for version 1.5

-
+OpenFOAM README for version 1.5 + +1 Copyright + +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. +See the file COPYING in this directory, for a description of the GNU General Public License terms under which you can +copy the files. + +2 System requirements + +OpenFOAM is developed and tested on Linux, but should work with other Unix style systems. To check your system setup, +execute the foamSystemCheck script in the bin/ directory of the OpenFOAM installation. If no problems are reported, +proceed to "3. Installation"; otherwise contact your system administrator. + +If the user wishes to run OpenFOAM in 32/64-bit mode they should consult the section "Running OpenFOAM in 32-bit mode". + +2.1 Qt (from http://trolltech.com/products/qt) + +The ParaView 3.3 visualisation package requires that Qt version 4.3.x MUST be installed on the system. Earlier or more +recent versions (4.2.x or 4.4.x) will NOT work. To check whether Qt4 is installed, and the version, type: + + * qmake

Table of Contents

    @@ -62,384 +46,152 @@ lang="en" xml:lang="en">
+–version -
-

1 Copyright

-
+The ParaView binary executables in the ThirdParty distribution will only work with PRECISELY the same version of Qt +with which it was compiled. The 64-bit version of ParaView was compiled with Qt-4.3.1 (with openSuSE-10.3) and the +32-bit version of ParaView was compiled with Qt-4.3.2 (with ubuntu-7.10). If the user finds that a ParaView binary +fails to run, then it is almost certainly due to a conflict in compiled and installed Qt versions and they will need to +consult the section below on "Compiling ParaView and the PV3FoamReader module." -

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. See the file COPYING in this directory, for a description of the GNU -General Public License terms under which you can copy the files. -

-
- -
- -
-

2 System requirements

-
- -

OpenFOAM is developed and tested on Linux, but should work with other Unix -style systems. To check your system setup, execute the foamSystemCheck script -in the bin/ directory of the OpenFOAM installation. If no problems are -reported, proceed to "3. Installation"; otherwise contact your system -administrator. -

-

-If the user wishes to run OpenFOAM in 32/64-bit mode they should consult the -section "Running OpenFOAM in 32-bit mode". -

- -
- -
-

2.1 Qt (from http://trolltech.com/products/qt)

-
- -

The ParaView 3.3 visualisation package requires that Qt version 4.3.x MUST -be installed on the system. Earlier or more recent versions (4.2.x or -4.4.x) will NOT work. To check whether Qt4 is installed, and the version, -type: -

    -
  • -qmake –version - -
  • -
- -

The ParaView binary executables in the ThirdParty distribution will only -work with PRECISELY the same version of Qt with which it was compiled. The -64-bit version of ParaView was compiled with Qt-4.3.1 (with openSuSE-10.3) -and the 32-bit version of ParaView was compiled with Qt-4.3.2 (with -ubuntu-7.10). If the user finds that a ParaView binary fails to run, then -it is almost certainly due to a conflict in compiled and installed Qt -versions and they will need to consult the section below on "Compiling -ParaView and the PV3FoamReader module." -

-

The default versions of Qt used by some GNU/Linux releases are as follows. -

    -
  • -ubuntu-7.10: Version 4.3.2 -
  • -
  • -ubuntu-8.04: Version 4.3.4 -
  • -
  • -openSuSE-10.2: Version 4.2.1 - too old -
  • -
  • -openSuSE-10.3: Version 4.3.1 -
  • -
  • -openSuSE-11.0: Version 4.4.0 - too new -
  • -
+ * ubuntu-7.10: Version 4.3.2 + * ubuntu-8.04: Version 4.3.4 + * openSuSE-10.2: Version 4.2.1 - too old + * openSuSE-10.3: Version 4.3.1 + * openSuSE-11.0: Version 4.4.0 - too new -

Compilation and running of ParaView has been successful using the libraries -downloaded in the "libqt4-dev" package on ubuntu. -

-

-If you don't have an appropriate version of Qt installed you can download -the sources from TrollTech e.g.: -ftp://ftp.trolltech.com/qt/source/qt-x11-opensource-src-4.3.5.tar.bz2 -and compile and install in /usr/local or some other location that does to -conflict with the pre-installed version. -

-
-
+Compilation and running of ParaView has been successful using the libraries downloaded in the "libqt4-dev" package on +ubuntu. -
+If you don't have an appropriate version of Qt installed you can download the sources from TrollTech e.g.: ftp:// +ftp.trolltech.com/qt/source/qt-x11-opensource-src-4.3.5.tar.bz2 and compile and install in /usr/local or some other +location that does to conflict with the pre-installed version. -
-

3 Installation

-
+3 Installation -

Download and unpack the files in the $HOME/OpenFOAM directory as described in: -http://www.OpenFOAM.org/download.html -

-

-The environment variable settings are contained in files in an etc/ directory -in the OpenFOAM release. e.g. in -

-
    -
  • -$HOME/OpenFOAM/OpenFOAM-<VERSION>/etc/ -
  • -
  • -where <VERSION> corresponds to the version 1.4, 1.5, … +Download and unpack the files in the $HOME/OpenFOAM directory as described in: http://www.OpenFOAM.org/download.html -
  • -
  • -EITHER, if running bash or ksh (if in doubt type 'echo $SHELL'), source the -etc/bashrc file by adding the following line to the end of your -$HOME/.bashrc file: +The environment variable settings are contained in files in an etc/ directory in the OpenFOAM release. e.g. in -
      -
    • -. $HOME/OpenFOAM/OpenFOAM-<VERSION>/etc/bashrc + * $HOME/OpenFOAM/OpenFOAM-/etc/ + * where corresponds to the version 1.4, 1.5, … -
    • -
    + * EITHER, if running bash or ksh (if in doubt type 'echo $SHELL'), source the etc/bashrc file by adding the following + line to the end of your $HOME/.bashrc file: -

    Then update the environment variables by sourcing the $HOME/.bashrc file by -typing in the terminal: -

    -
      -
    • -. $HOME/.bashrc + + . $HOME/OpenFOAM/OpenFOAM-/etc/bashrc -
    • -
    -
  • -
  • -OR, if running tcsh or csh, source the etc/cshrc file by adding the -following line to the end of your $HOME/.cshrc file: + Then update the environment variables by sourcing the $HOME/.bashrc file by typing in the terminal: -
      -
    • -source $HOME/OpenFOAM/OpenFOAM-<VERSION>/etc/cshrc + + . $HOME/.bashrc -
    • -
    + * OR, if running tcsh or csh, source the etc/cshrc file by adding the following line to the end of your $HOME/.cshrc + file: -

    Then update the environment variables by sourcing the $HOME/.cshrc file by -typing in the terminal: -

    -
      -
    • -source $HOME/.cshrc + + source $HOME/OpenFOAM/OpenFOAM-/etc/cshrc -
    • -
    -
  • -
+ Then update the environment variables by sourcing the $HOME/.cshrc file by typing in the terminal: -
+ + source $HOME/.cshrc -
-

3.1 Installation in alternative locations

-
+3.1 Installation in alternative locations -

OpenFOAM may also be installed in alternative locations. However, the -installation directory should be network available (e.g., NFS) if parallel -calculations are planned. -

-

-The environment variable 'FOAM_INST_DIR' can be used to find and source the -appropriate resource file. Here is a bash/ksh/sh example: -

-
    -
  • -export FOAM_INST_DIR=/data/app/OpenFOAM -
  • -
  • -foamDotFile=$FOAM_INST_DIR/OpenFOAM-<VERSION>/etc/bashrc -
  • -
  • -[ -f $foamDotFile ] && . $foamDotFile +OpenFOAM may also be installed in alternative locations. However, the installation directory should be network +available (e.g., NFS) if parallel calculations are planned. -
  • -
+The environment variable 'FOAM_INST_DIR' can be used to find and source the appropriate resource file. Here is a bash/ +ksh/sh example: -

and a csh/tcsh example: -

-
    -
  • -setenv FOAM_INST_DIR /data/app/OpenFOAM -
  • -
  • -foamDotFile=$FOAM_INST_DIR/OpenFOAM-<VERSION>/etc/bashrc -
  • -
  • -if ( -f $foamDotFile ) source $foamDotFile + * export FOAM_INST_DIR=/data/app/OpenFOAM + * foamDotFile=$FOAM_INST_DIR/OpenFOAM-/etc/bashrc + * [ -f $foamDotFile ] && . $foamDotFile -
  • -
+and a csh/tcsh example: -

The value set in '$FOAM_INST_DIR' will be used to locate the remaining parts -of the OpenFOAM installation. -

-
-
+ * setenv FOAM_INST_DIR /data/app/OpenFOAM + * foamDotFile=$FOAM_INST_DIR/OpenFOAM-/etc/bashrc + * if ( -f $foamDotFile ) source $foamDotFile -
+The value set in '$FOAM_INST_DIR' will be used to locate the remaining parts of the OpenFOAM installation. -
-

4 Building from Sources (Optional)

-
+4 Building from Sources (Optional) -

If you cannot find an appropriate binary pack for your platform, you can build -the complete OpenFOAM from the source-pack. You will first need to compile or -obtain a recent version of gcc (we recomend gcc-4.3.?) for your platform, -which may be obtained from http://gcc.gnu.org/. -

-

-Install the compiler in -$WM_PROJECT_INST_DIR/ThirdParty/gcc-<GCC_VERSION>/platforms/$WM_ARCH$WM_COMPILER_ARCH/ -and change the gcc version number in $WM_PROJECT_DIR/etc/settings.sh and -$WM_PROJECT_DIR/etc/settings.csh appropriately and finally update the -environment variables as in section 3. -

-

-Now go to the top-level source directory $WM_PROJECT_DIR and execute the -top-level build script './Allwmake'. In principle this will build everything, -but if problems occur with the build order it may be necessary to update the -environment variables and re-execute 'Allwmake'. If you experience -difficulties with building the source-pack, or your platform is not currently -supported, please contact <enquiries@OpenCFD.co.uk> to negotiate a support -contract and we will do the port and maintain it for future releases. -

-
+If you cannot find an appropriate binary pack for your platform, you can build the complete OpenFOAM from the +source-pack. You will first need to compile or obtain a recent version of gcc (we recomend gcc-4.3.?) for your +platform, which may be obtained from http://gcc.gnu.org/. -
+Install the compiler in $WM_PROJECT_INST_DIR/ThirdParty/gcc-/platforms/$WM_ARCH$WM_COMPILER_ARCH/ and +change the gcc version number in $WM_PROJECT_DIR/etc/settings.sh and $WM_PROJECT_DIR/etc/settings.csh appropriately and +finally update the environment variables as in section 3. -
-

5 Testing the installation

-
+Now go to the top-level source directory $WM_PROJECT_DIR and execute the top-level build script './Allwmake'. In +principle this will build everything, but if problems occur with the build order it may be necessary to update the +environment variables and re-execute 'Allwmake'. If you experience difficulties with building the source-pack, or your +platform is not currently supported, please contact to negotiate a support contract and we +will do the port and maintain it for future releases. -

To check your installation setup, execute the 'foamInstallationTest' script -(in the bin/ directory of the OpenFOAM installation). If no problems are -reported, proceed to getting started with OpenFOAM; otherwise, go back and -check you have installed the software correctly and/or contact your system -administrator. -

-
+5 Testing the installation -
+To check your installation setup, execute the 'foamInstallationTest' script (in the bin/ directory of the OpenFOAM +installation). If no problems are reported, proceed to getting started with OpenFOAM; otherwise, go back and check you +have installed the software correctly and/or contact your system administrator. -
-

6 Getting Started

-
+6 Getting Started -

Create a project directory within the $HOME/OpenFOAM directory named -<USER>-<VERSION> (e.g. 'chris-1.5' for user chris and OpenFOAM version 1.5) -and create a directory named 'run' within it, e.g. by typing: -

-
    -
  • -mkdir -p $HOME/OpenFOAM/${USER}-${WM_PROJECT_VERSION}/run +Create a project directory within the $HOME/OpenFOAM directory named - (e.g. 'chris-1.5' for user chris +and OpenFOAM version 1.5) and create a directory named 'run' within it, e.g. by typing: -
  • -
+ * mkdir -p $HOME/OpenFOAM/${USER}-${WM_PROJECT_VERSION}/run -

Copy the 'tutorial' examples directory in the OpenFOAM distribution to the -'run' directory. If the OpenFOAM environment variables are set correctly, -then the following command will be correct: -

-
    -
  • -cp -r $WM_PROJECT_DIR/tutorials -$HOME/OpenFOAM/${USER}-${WM_PROJECT_VERSION}/run +Copy the 'tutorial' examples directory in the OpenFOAM distribution to the 'run' directory. If the OpenFOAM environment +variables are set correctly, then the following command will be correct: -
  • -
+ * cp -r $WM_PROJECT_DIR/tutorials $HOME/OpenFOAM/${USER}-${WM_PROJECT_VERSION}/run -

Run the first example case of incompressible laminar flow in a cavity: -

-
    -
  • -cd $HOME/OpenFOAM/${USER}-${WM_PROJECT_VERSION}/run/tutorials/icoFoam/cavity -
  • -
  • -blockMesh -
  • -
  • -icoFoam -
  • -
  • -paraFoam +Run the first example case of incompressible laminar flow in a cavity: -
  • -
-
+ * cd $HOME/OpenFOAM/${USER}-${WM_PROJECT_VERSION}/run/tutorials/icoFoam/cavity + * blockMesh + * icoFoam + * paraFoam -
+7 Compiling Paraview 3.3 and the PV3FoamReader module -
-

7 Compiling Paraview 3.3 and the PV3FoamReader module

-
+A version of Qt 4.3.x must be installed to compile ParaView. The compilation is a fairly simple process using the +supplied buildParaView3.3-cvs script that has worked is our tests with other packages supplied in the ThirdParty +directory, namely cmake-2.4.6 and gcc-4.3.1. Execute the following: -

A version of Qt 4.3.x must be installed to compile ParaView. The compilation -is a fairly simple process using the supplied buildParaView3.3-cvs script that -has worked is our tests with other packages supplied in the ThirdParty -directory, namely cmake-2.4.6 and gcc-4.3.1. Execute the following: -

    -
  • -cd $FOAM_INST_DIR/ThirdParty -
  • -
  • -rm -rf ParaView3.3-cvs/platforms -
  • -
  • -buildParaView3.3-cvs + * cd $FOAM_INST_DIR/ThirdParty + * rm -rf ParaView3.3-cvs/platforms + * buildParaView3.3-cvs -
  • -
+The PV3FoamReader module is an OpenFOAM utility that can be compiled in the usual manner as follows: -

The PV3FoamReader module is an OpenFOAM utility that can be compiled in the -usual manner as follows: -

    -
  • -cd $FOAM_UTILITIES/postProcessing/graphics/PV3FoamReader -
  • -
  • -./Allwclean -
  • -
  • -./Allwmake + * cd $FOAM_UTILITIES/postProcessing/graphics/PV3FoamReader + * ./Allwclean + * ./Allwmake -
  • -
-
+8 Documentation -
+http://www.OpenFOAM.org/doc -
-

8 Documentation

- +http://www.OpenFOAM.org http://www.OpenFOAM.org/discussion.html -
+10 Reporting Bugs in OpenFOAM -
-

9 Help

-
+http://www.OpenFOAM.org/bugs.html -

http://www.OpenFOAM.org http://www.OpenFOAM.org/discussion.html -

-
+11 Running OpenFOAM in 32-bit mode on 64-bit machines -
+Linux users with a 64-bit machine may install either the OpenFOAM 32-bit version (linux) or the OpenFOAM 64-bit version +(linux64), or both. The 64-bit is the default mode on a 64-bit machine. To use an installed 32-bit version, the user +must set the environment variable WM_ARCH_OPTION to 32 before sourcing the etc/bashrc (or etc/cshrc) file. -
-

10 Reporting Bugs in OpenFOAM

-
+Date: 26 August 2008 -

http://www.OpenFOAM.org/bugs.html -

-
+HTML generated by org-mode 6.06b in emacs 23 -
- -
-

11 Running OpenFOAM in 32-bit mode on 64-bit machines

-
- -

Linux users with a 64-bit machine may install either the OpenFOAM 32-bit -version (linux) or the OpenFOAM 64-bit version (linux64), or both. The 64-bit -is the default mode on a 64-bit machine. To use an installed 32-bit version, -the user must set the environment variable $WM_32 (to anything, e.g. "on") -before sourcing the etc/bashrc (or etc/cshrc) file. -

-
-

Date: 14 July 2008

-

HTML generated by org-mode 6.05a in emacs 23

-

- diff --git a/ReleaseNotes-1.5 b/ReleaseNotes-1.5 index 7a36d0fa3c..faa5dad6b2 100644 --- a/ReleaseNotes-1.5 +++ b/ReleaseNotes-1.5 @@ -2,9 +2,9 @@ # #+TITLE: *OpenFOAM release notes for version 1.5* #+AUTHOR: OpenCFD Ltd. -#+DATE: 14 July 2008 +#+DATE: 26 August 2008 #+LINK: http://www.opencfd.co.uk -#+OPTIONS: author:nil +#+OPTIONS: author:nil ^:{} * Overview OpenFOAM-1.5 is is a significant upgrade to version 1.4 in ways which are diff --git a/ReleaseNotes-1.5.html b/ReleaseNotes-1.5.html index 480775406a..a1805d5e9d 100644 --- a/ReleaseNotes-1.5.html +++ b/ReleaseNotes-1.5.html @@ -1,42 +1,27 @@ - - - -<b>OpenFOAM release notes for version 1.5</b> - - - - - - -

OpenFOAM release notes for version 1.5

-
+OpenFOAM release notes for version 1.5 + +1 Overview + +OpenFOAM-1.5 is is a significant upgrade to version 1.4 in ways which are +outlined below. This release passes all our standard tests and the tutorials +have been broadly checked. If there are any bugs, please report them using the +instructions set out in: http://www.openfoam.org/bugs.html. + +Most of the developments for this release are in: new applications, e.g. for +multiphase flow and cavitation, buoyancy-flow and heat transfer, high speed +flows and even molecular dynamics; new utilities, e.g. for meshing and case +monitoring; and, new modelling, e.g. in Lagrangian particle tracking, +radiation and rotating frames of reference. With these new applications come +numerous new example cases. + +2 GNU/Linux version + +The 64bit binary packs of the OpenFOAM release were compiled on a machine +running SuSE GNU/Linux version 10.3 and the 32bit on a machine running Ubuntu +GNU/Linux version 7.1 and also tested on Ubuntu 8.04. We recommend that users +run OpenFOAM on one of these or a similar recent version of GNU/Linux. This +release has also been successfully compiled and tested on older GNU/Linux +releases but this re

Table of Contents

    @@ -54,376 +39,170 @@ lang="en" xml:lang="en">
+quires the installation of Qt 4.3.? for ParaView-3 to run. -
-

1 Overview

-
+3 C++ Compiler version -

OpenFOAM-1.5 is is a significant upgrade to version 1.4 in ways which are -outlined below. This release passes all our standard tests and the tutorials -have been broadly checked. If there are any bugs, please report them using -the instructions set out in: http://www.openfoam.org/bugs.html. -

-

-Most of the developments for this release are in: new applications, e.g. for -multiphase flow and cavitation, buoyancy-flow and heat transfer, high speed -flows and even molecular dynamics; new utilities, e.g. for meshing and case -monitoring; and, new modelling, e.g. in Lagrangian particle tracking, -radiation and rotating frames of reference. With these new applications come -numerous new example cases. -

-
+ * Released compiled with GCC 4.3.1, the latest version. + * Built in support for the Intel C++ 10.? compiler (untested). + * The choice of the compiler is controlled by the setting of the + $WM_COMPILER and $WM_COMPILER_ARCH environment variables in the + OpenFOAM-1.5/etc/bashrc (or cshrc) file. + * The location of the installation of the compiler is controlled by the + $WM_COMPILER_INST environment variable in the OpenFOAM-1.5/etc/settings.sh + (or settings.csh) file. -
+4 Developments to solvers (applications) -
-

2 GNU/Linux version

-
+ * New rhoCentralFoam solver for high-speed, viscous, compressible flows + using non-oscillatory, central-upwind schemes. + * New interDyMFoam solver for 2 incompressible, isothermal, immiscible + fluids using a VoF phase-fraction based interface capturing approach, with + optional mesh motion and mesh topology changes including adaptive mesh + (un)refinement. Useful for simulations such as tank filling, sloshing --- + using solid body motion e.g. SDA or SKA (6DoF) — and slamming (using the + mesh motion solver) and other large-scale applications that benefit from + the efficiency gain of adaptive mesh (un)refinement of the interface. + * New compressibleInterFoam solver for 2 compressible, isothermal, + immiscible fluids using a volume of fluid (VoF) phase-fraction approach + for interface-capturing. The momentum and other fluid properties are of + the "mixture" and a single momentum equation is solved. Turbulence is + modelled using a run-time selectable incompressible LES model. + * New interPhaseChangeFoam solver for 2 incompressible, isothermal, + immiscible fluids with phase-change, e.g. cavitation. Uses VoF interface + capturing, with momentum and other fluid properties described for the + ``mixture'' and a single momentum equation is solved. The set of + phase-change models provided are designed to simulate cavitation but other + mechanisms of phase-change are supported within this solver framework. + * New rasCavitatingFoam solver for transient cavitation using a barotropic + compressibility model, with RAS turbulence. + * New lesCavitatingFoam solver for transient cavitation using a barotropic + compressibility model, with LES turbulence. + * New chtMultiRegionFoam solver that couples conjugate heat transfer in a + solid to a buoyancy-driven flow simulation. + * New PDRFoam solver for compressible premixed/partially-premixed turbulent + combustion that includes porosity/distributed resistance (PDR) modelling + to handle regions containing solid blockages which cannot be resolved by + the mesh. Requires the PDR fields. + * New lesBuoyantFoam solver for transient, buoyant, turbulent flow of + compressible fluids for ventilation and heat-transfer. Turbulence is + modelled using a run-time selectable compressible LES model. + * New rhoPimpleFoam solver for transient, turbulent flow of compressible + fluids for ventilation and heat-transfer. Uses the flexible PIMPLE + (PISO-SIMPLE) solution for time-resolved and pseudo-transient simulations. + * New buoyantSimpleRadiationFoam solver for steady-state, buoyant, turbulent + flow of compressible fluids with radiation, for ventilation and + heat-transfer. + * New rhoTurbTwinParcelFoam solver for transient for compressible, turbulent + flow with two thermo-clouds. + * New gnemdFOAM solver for general purpose molecular dynamics that simulates + atoms in arbitrary shaped domains and average atomic/molecular quantities + to the mesh to create field data. + * New mdEqulibrationFoam solver to equilibrates and/or preconditions + molecular dynamics systems. + * Demonstration SRFSimpleFoam solver based on simpleFoam that incorporates + the SRF extensions (see below) for rotating flows. -

The 64bit binary packs of the OpenFOAM release were compiled on a machine -running SuSE GNU/Linux version 10.3 and the 32bit on a machine running Ubuntu -GNU/Linux version 7.1 and also tested on Ubuntu 8.04. We recommend that -users run OpenFOAM on one of these or a similar recent version of GNU/Linux. -This release has also been successfully compiled and tested on older GNU/Linux -releases but this requires the installation of Qt 4.3.? for ParaView-3 to run. -

-
+5 Automatic mesher -
+New snappyHexMesh utility that generates split-hex meshes automatically from +triangulated (STL) surface geometries. The mesh approximately conforms to the +surface by iteratively refining a starting mesh and morphing the resulting +split-hex mesh to the surface. An optional phase will shrink back the +resulting mesh and insert cell layers. It has a flexible specification of mesh +refinement level and robust surface handling with a pre-specified final mesh +quality. It runs in parallel with a load balancing step every iteration. -
-

3 C++ Compiler version

-
+6 Developments to utilities -
    -
  • -Released compiled with GCC 4.3.1, the latest version. -
  • -
  • -Built in support for the Intel C++ 10.? compiler (untested). -
  • -
  • -The choice of the compiler is controlled by the setting of the $WM_COMPILER -and $WM_COMPILER_ARCH environment variables in the OpenFOAM-1.5/etc/bashrc -(or cshrc) file. -
  • -
  • -The location of the installation of the compiler is controlled by the -$WM_COMPILER_INST environment variable in the OpenFOAM-1.5/etc/settings.sh -(or settings.csh) file. + * New extrude2DMesh utility that extrudes 2D meshes into a 3D mesh. 2D + meshes are described by faces with 2 points, so can be used in combination + with 2D meshes converted with ccm26ToFoam. + * New couplePatches functionality integrated into createPatch, which + optionally synchronises ("couples") points and faces of coupled (cyclic, + processor) patches. + * New applyBoundaryLayer pre-processing utility to apply 1/7th power-law + boundary layers at walls, starting from uniform or potential flow + solutions. + * New execFlowFunctionObjects utility executes functionObjects as a + post-processing activity, e.g. probes, sampling, force calculation. + * New changeDictionary utility makes batch changes to OpenFOAM input files, + e.g. to change boundary conditions of field files. + * New foamCalc utility, a generic post-processing field calculator tool + * New molConfig pre-processing utility for molecular dynamics cases. Fills + zones of a mesh with single crystal lattices of specified structure, + density, orientation, alignment and temperature. + * Extended splitMeshRegions utility to split multi-zone meshes, e.g. defined + through cellZones, into separate meshes. + * Extended the foamToVTK, decomposePar, reconstructPar and mapFields + utilities to include support for multiple particle clouds in parallel + processing. -
  • -
-
+7 Migration from ParaView 2.4 to ParaView 3.x -
+ * Rewritten OpenFOAM Reader Module for version 3, a major redesign of + ParaView. + * New features include viewing patch names, reading of Lagrangian data, + handling of cell, face and point sets, multiple views. -
-

4 Developments to solvers (applications)

-
+8 Model development -
    -
  • -New rhoCentralFoam solver for high-speed, viscous, compressible flows using -non-oscillatory, central-upwind schemes. -
  • -
  • -New interDyMFoam solver for 2 incompressible, isothermal, immiscible fluids -using a VoF phase-fraction based interface capturing approach, with optional -mesh motion and mesh topology changes including adaptive mesh -(un)refinement. Useful for simulations such as tank filling, sloshing --- -using solid body motion e.g. SDA or SKA (6DoF) — and slamming (using the -mesh motion solver) and other large-scale applications that benefit from the -efficiency gain of adaptive mesh (un)refinement of the interface. -
  • -
  • -New compressibleInterFoam solver for 2 compressible, isothermal, immiscible -fluids using a volume of fluid (VoF) phase-fraction approach for -interface-capturing. The momentum and other fluid properties are of the -"mixture" and a single momentum equation is solved. Turbulence is modelled -using a run-time selectable incompressible LES model. -
  • -
  • -New interPhaseChangeFoam solver for 2 incompressible, isothermal, immiscible -fluids with phase-change, e.g. cavitation. Uses VoF interface capturing, -with momentum and other fluid properties described for the ``mixture'' and a -single momentum equation is solved. The set of phase-change models provided -are designed to simulate cavitation but other mechanisms of phase-change are -supported within this solver framework. -
  • -
  • -New rasCavitatingFoam solver for transient cavitation using a barotropic -compressibility model, with RAS turbulence. -
  • -
  • -New lesCavitatingFoam solver for transient cavitation using a barotropic -compressibility model, with LES turbulence. -
  • -
  • -New chtMultiRegionFoam solver that couples conjugate heat transfer in a -solid to a buoyancy-driven flow simulation. -
  • -
  • -New PDRFoam solver for compressible premixed/partially-premixed turbulent -combustion that includes porosity/distributed resistance (PDR) modelling to -handle regions containing solid blockages which cannot be resolved by the -mesh. Requires the PDR fields. -
  • -
  • -New lesBuoyantFoam solver for transient, buoyant, turbulent flow of -compressible fluids for ventilation and heat-transfer. Turbulence is -modelled using a run-time selectable compressible LES model. -
  • -
  • -New rhoPimpleFoam solver for transient, turbulent flow of compressible -fluids for ventilation and heat-transfer. Uses the flexible PIMPLE -(PISO-SIMPLE) solution for time-resolved and pseudo-transient simulations. -
  • -
  • -New buoyantSimpleRadiationFoam solver for steady-state, buoyant, turbulent -flow of compressible fluids with radiation, for ventilation and -heat-transfer. -
  • -
  • -New rhoTurbTwinParcelFoam solver for transient for compressible, turbulent -flow with two thermo-clouds. -
  • -
  • -New gnemdFOAM solver for general purpose molecular dynamics that simulates -atoms in arbitrary shaped domains and average atomic/molecular quantities to -the mesh to create field data. -
  • -
  • -New mdEqulibrationFoam solver to equilibrates and/or preconditions molecular -dynamics systems. -
  • -
  • -Demonstration SRFSimpleFoam solver based on simpleFoam that incorporates the -SRF extensions (see below) for rotating flows. + * Overhauled the lagrangian library to support multiple clouds. + * New lagrangianIntermediate library incorporating a hierarchy of parcel and + cloud types, accommodating kinematic, thermodynamic and reacting + applications, including coupling to the new radiation library. Sub-models + are added at the relevant level of physics, e.g.: + + kinematic: injection, wall interaction, drag, dispersion; + + thermo: heat transfer; + + reacting: reacting composition, mass transfer, surface reactions. + * New single rotating frame of reference (SRF) library for rotating flow + applications, e.g. turbo-machinery. + * New radiation library including the P1 model and associated Marshak + boundary conditions for incident radiation. + * New displacementInterpolation motion solver for flexible mesh scaling. + * New molecularDynamics Lagrangian library to calculate intermolecular + forces between spherically symmetrical monatomic species in arbitrary + geometries. -
  • -
-
+9 New functionObjects -
+To aid common monitoring and post-processing activities. -
-

5 Automatic mesher

-
+ * forces: calculate the force and moment on a patch or set of patches, e.g. + to calculate the lift, drag and moment of an object in the flow. + * forceCoeffs: calculate the normalised force and moment on a patch or set + of patches, e.g. to calculate the lift, drag and moment coefficients of an + object in the flow. + * fieldAverage: calculate field arithmetic mean and prime-squared averages + for a list of fields. + * foamCalcFunctions: calculate field components, div, mag, magGrad or + magSqr. -

New snappyHexMesh utility that generates split-hex meshes automatically from -triangulated (STL) surface geometries. The mesh approximately conforms to -the surface by iteratively refining a starting mesh and morphing the -resulting split-hex mesh to the surface. An optional phase will shrink back -the resulting mesh and insert cell layers. It has a flexible specification -of mesh refinement level and robust surface handling with a pre-specified -final mesh quality. It runs in parallel with a load balancing step every -iteration. -

-
+10 Improvements to boundary conditions -
+ * Generalised jumpCyclic type: cyclic condition with an additional + prescribed jump in value. + * fan type: specialisation of jumpCyclic, applying a prescribed jump in + pressure to simulate a fan within a mesh. + * Generalised advective outflow boundary condition based on solving D/Dt + (psi, U) = 0 at the boundary. + * Additional turbulent flow inlet to specify mixing length and frequency. + * Generalisation of time varying set of boundary conditions. -
-

6 Developments to utilities

-
+11 Other -
    -
  • -New extrude2DMesh utility that extrudes 2D meshes into a 3D mesh. 2D meshes -are described by faces with 2 points, so can be used in combination with 2D -meshes converted with ccm26ToFoam. -
  • -
  • -New couplePatches functionality integrated into createPatch, which -optionally synchronises ("couples") points and faces of coupled (cyclic, -processor) patches. -
  • -
  • -New applyBoundaryLayer pre-processing utility to apply 1/7th power-law -boundary layers at walls, starting from uniform or potential flow solutions. -
  • -
  • -New execFlowFunctionObjects utility executes functionObjects as a -post-processing activity, e.g. probes, sampling, force calculation. -
  • -
  • -New changeDictionary utility makes batch changes to OpenFOAM input files, -e.g. to change boundary conditions of field files. -
  • -
  • -New foamCalc utility, a generic post-processing field calculator tool -
  • -
  • -New molConfig pre-processing utility for molecular dynamics cases. Fills -zones of a mesh with single crystal lattices of specified structure, -density, orientation, alignment and temperature. -
  • -
  • -Extended splitMeshRegions utility to split multi-zone meshes, e.g. defined -through cellZones, into separate meshes. -
  • -
  • -Extended the foamToVTK, decomposePar, reconstructPar and mapFields utilities -to include support for multiple particle clouds in parallel processing. + * New argument-free command execution, e.g typing "icoFoam" without root and + case directory arguments. + * Extended time command line options. + * Many enhancements to dictionary including macro substitution, optional + merging and default/overwrite behaviour, enhanced "#include" file handling + and the framework to support function evaluation. + * Cross-links between applications and Doxygen documentation with the "-doc" + argument. + * Non-blocking, non-buffered, parallel transfers with potential scaling + benefits for larger number of processors. -
  • -
-
+Date: 26 August 2008 -
+HTML generated by org-mode 6.06b in emacs 23 -
-

7 Migration from ParaView 2.4 to ParaView 3.x

-
- -
    -
  • -Rewritten OpenFOAM Reader Module for version 3, a major redesign of -ParaView. -
  • -
  • -New features include viewing patch names, reading of Lagrangian data, -handling of cell, face and point sets, multiple views. - -
  • -
-
- -
- -
-

8 Model development

-
- -
    -
  • -Overhauled the lagrangian library to support multiple clouds. -
  • -
  • -New lagrangianIntermediate library incorporating a hierarchy of parcel and -cloud types, accommodating kinematic, thermodynamic and reacting -applications, including coupling to the new radiation library. Sub-models -are added at the relevant level of physics, e.g.: -
      -
    • -kinematic: injection, wall interaction, drag, dispersion; -
    • -
    • -thermo: heat transfer; -
    • -
    • -reacting: reacting composition, mass transfer, surface reactions. -
    • -
    -
  • -
  • -New single rotating frame of reference (SRF) library for rotating flow -applications, e.g. turbo-machinery. -
  • -
  • -New radiation library including the P1 model and associated Marshak boundary -conditions for incident radiation. -
  • -
  • -New displacementInterpolation motion solver for flexible mesh scaling. -
  • -
  • -New molecularDynamics Lagrangian library to calculate intermolecular forces -between spherically symmetrical monatomic species in arbitrary geometries. - -
  • -
-
- -
- -
-

9 New functionObjects

-
- -

To aid common monitoring and post-processing activities. -

    -
  • -forces: calculate the force and moment on a patch or set of patches, e.g. to -calculate the lift, drag and moment of an object in the flow. -
  • -
  • -forceCoeffs: calculate the normalised force and moment on a patch or set of -patches, e.g. to calculate the lift, drag and moment coefficients of an -object in the flow. -
  • -
  • -fieldAverage: calculate field arithmetic mean and prime-squared averages for -a list of fields. -
  • -
  • -foamCalcFunctions: calculate field components, div, mag, magGrad or magSqr. - -
  • -
-
- -
- -
-

10 Improvements to boundary conditions

-
- -
    -
  • -Generalised jumpCyclic type: cyclic condition with an additional prescribed -jump in value. -
  • -
  • -fan type: specialisation of jumpCyclic, applying a prescribed jump in -pressure to simulate a fan within a mesh. -
  • -
  • -Generalised advective outflow boundary condition based on solving D/Dt(psi, -U) = 0 at the boundary. -
  • -
  • -Additional turbulent flow inlet to specify mixing length and frequency. -
  • -
  • -Generalisation of time varying set of boundary conditions. - -
  • -
-
- -
- -
-

11 Other

-
- -
    -
  • -New argument-free command execution, e.g typing "icoFoam" without root and -case directory arguments. -
  • -
  • -Extended time command line options. -
  • -
  • -Many enhancements to dictionary including macro substitution, optional -merging and default/overwrite behaviour, enhanced "#include" file handling -and the framework to support function evaluation. -
  • -
  • -Cross-links between applications and Doxygen documentation with the "-doc" -argument. -
  • -
  • -Non-blocking, non-buffered, parallel transfers with potential scaling -benefits for larger number of processors. -
  • -
-
-
-

Date: 14 July 2008

-

HTML generated by org-mode 6.05a in emacs 23

-

- From 15bade148dd0bd28c480244712922b51613d68f5 Mon Sep 17 00:00:00 2001 From: henry Date: Tue, 26 Aug 2008 18:20:20 +0100 Subject: [PATCH 07/25] Yet more updates to the transonic formulation. --- applications/solvers/compressible/rhoSimpleFoam/pEqn.H | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H index fc918ab9bf..e4fbe15aa4 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H @@ -16,12 +16,13 @@ if (transonic) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { - fvScalarMatrix pEqn0 + fvScalarMatrix pEqn ( fvm::div(phid, p) - fvm::laplacian(rho*rUA, p) ); - fvScalarMatrix pEqn = pEqn0; + + // Relax the pressure equation to ensure diagonal-dominance pEqn.relax(mesh.relaxationFactor("pEqn")); pEqn.setReference(pRefCell, pRefValue); @@ -39,14 +40,13 @@ if (transonic) if (nonOrth == nNonOrthCorr) { - phi == pEqn0.flux(); + phi == pEqn.flux(); } } } else { phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf()); - //phi = fvc::interpolate(rho*U) & mesh.Sf(); closedVolume = adjustPhi(phi, U, p); for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) @@ -58,7 +58,7 @@ else pEqn.setReference(pRefCell, pRefValue); - // retain the residual from the first iteration + // Retain the residual from the first iteration if (nonOrth == 0) { eqnResidual = pEqn.solve().initialResidual(); From d61b3024bb38f17112e39cff014ae52d53d1babf Mon Sep 17 00:00:00 2001 From: henry Date: Tue, 26 Aug 2008 19:05:18 +0100 Subject: [PATCH 08/25] Minor massage. --- .../clouds/Templates/KinematicCloud/KinematicCloud.H | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H index d0925be0f5..da0f1738e5 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H @@ -109,7 +109,6 @@ private: //- References to the mesh and time databases const fvMesh& mesh_; -// const Time& runTime_; //- Reference to the interpolation for the carrier phase to the parcels const volPointInterpolation& vpi_; @@ -263,9 +262,6 @@ protected: public: - //- Runtime type information -// TypeName("KinematicCloud"); - // Constructors //- Construct given carrier gas fields @@ -280,9 +276,8 @@ public: ); - // Destructor - - virtual ~KinematicCloud(); + //- Destructor + virtual ~KinematicCloud(); // Member Functions @@ -391,7 +386,6 @@ public: inline tmp SU2(volVectorField& U) const; - // Check //- Total mass injected From d88bc072a1490739ee58df236a35ef88f1435079 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 27 Aug 2008 17:58:07 +0100 Subject: [PATCH 09/25] schedule calculation; skipping unused procs --- .../mapPolyMesh/mapDistribute/mapDistribute.C | 45 ++++++------ .../mapPolyMesh/mapDistribute/mapDistribute.H | 20 +++--- .../mapDistribute/mapDistributeTemplates.C | 70 +++++++++++++++---- 3 files changed, 93 insertions(+), 42 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C index 796cb0983a..5421b328d8 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C @@ -31,7 +31,11 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::mapDistribute::calcSchedule() const +Foam::List Foam::mapDistribute::schedule +( + const labelListList& subMap, + const labelListList& constructMap +) { // Communications: send and receive processor List allComms; @@ -40,16 +44,16 @@ void Foam::mapDistribute::calcSchedule() const HashSet > commsSet(Pstream::nProcs()); // Find what communication is required - forAll(subMap_, procI) + forAll(subMap, procI) { if (procI != Pstream::myProcNo()) { - if (subMap_[procI].size() > 0) + if (subMap[procI].size() > 0) { // I need to send to procI commsSet.insert(labelPair(Pstream::myProcNo(), procI)); } - if (constructMap_[procI].size() > 0) + if (constructMap[procI].size() > 0) { // I need to receive from procI commsSet.insert(labelPair(procI, Pstream::myProcNo())); @@ -120,13 +124,7 @@ void Foam::mapDistribute::calcSchedule() const ); // Processors involved in my schedule - schedulePtr_.reset - ( - new List - ( - IndirectList(allComms, mySchedule) - ) - ); + return IndirectList(allComms, mySchedule); //if (debug) @@ -152,6 +150,22 @@ void Foam::mapDistribute::calcSchedule() const } +const Foam::List& Foam::mapDistribute::schedule() const +{ + if (!schedulePtr_.valid()) + { + schedulePtr_.reset + ( + new List + ( + schedule(subMap_, constructMap_) + ) + ); + } + return schedulePtr_(); +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // //- Construct from components @@ -257,13 +271,4 @@ Foam::mapDistribute::mapDistribute } -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - - // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H index bdc71c286d..65888ea79e 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H @@ -36,6 +36,8 @@ Note: Schedule is a list of processor pairs (one send, one receive. One of them will be myself) which forms a scheduled (i.e. non-buffered) exchange. See distribute on how to use it. + Note2: number of items send on one processor have to equal the number + of items received on the other processor. SourceFiles @@ -80,8 +82,6 @@ class mapDistribute // Private Member Functions - void calcSchedule() const; - //- Disallow default bitwise copy construct mapDistribute(const mapDistribute&); @@ -142,15 +142,15 @@ public: return constructMap_; } + //- Calculate a schedule. See above. + static List schedule + ( + const labelListList& subMap, + const labelListList& constructMap + ); + //- Return a schedule. Demand driven. See above. - const List& schedule() const - { - if (!schedulePtr_.valid()) - { - calcSchedule(); - } - return schedulePtr_(); - } + const List& schedule() const; // Other diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeTemplates.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeTemplates.C index 86ee3d96cf..6ad85c7971 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeTemplates.C +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeTemplates.C @@ -48,15 +48,28 @@ void Foam::mapDistribute::distribute // Send sub field to neighbour for (label domain = 0; domain < Pstream::nProcs(); domain++) { - if (domain != Pstream::myProcNo()) + const labelList& map = subMap[domain]; + + if (domain != Pstream::myProcNo() && map.size() > 0) { + List subField(map.size()); + forAll(map, i) + { + subField[i] = field[map[i]]; + } OPstream toNbr(Pstream::blocking, domain); - toNbr << IndirectList(field, subMap[domain])(); + toNbr << subField; } } // Subset myself - List subField(IndirectList(field, subMap[Pstream::myProcNo()])); + const labelList& mySubMap = subMap[Pstream::myProcNo()]; + + List subField(mySubMap.size()); + forAll(mySubMap, i) + { + subField[i] = field[mySubMap[i]]; + } // Receive sub field from myself (subField) const labelList& map = constructMap[Pstream::myProcNo()]; @@ -71,7 +84,11 @@ void Foam::mapDistribute::distribute // Receive sub field from neighbour for (label domain = 0; domain < Pstream::nProcs(); domain++) { - if (domain != Pstream::myProcNo()) + if + ( + domain != Pstream::myProcNo() + && constructMap[domain].size() > 0 + ) { IPstream fromNbr(Pstream::blocking, domain); List subField(fromNbr); @@ -93,7 +110,13 @@ void Foam::mapDistribute::distribute List newField(constructSize); // Subset myself - List subField(IndirectList(field, subMap[Pstream::myProcNo()])); + const labelList& mySubMap = subMap[Pstream::myProcNo()]; + + List subField(mySubMap.size()); + forAll(mySubMap, i) + { + subField[i] = field[mySubMap[i]]; + } // Receive sub field from myself (subField) const labelList& map = constructMap[Pstream::myProcNo()]; @@ -112,8 +135,16 @@ void Foam::mapDistribute::distribute if (Pstream::myProcNo() == sendProc) { // I am sender. Send to recvProc. + const labelList& map = subMap[recvProc]; + + List subField(map.size()); + forAll(map, i) + { + subField[i] = field[map[i]]; + } + OPstream toNbr(Pstream::scheduled, recvProc); - toNbr << IndirectList(field, subMap[recvProc])(); + toNbr << subField; } else { @@ -136,7 +167,13 @@ void Foam::mapDistribute::distribute List newField(constructSize); // Subset myself - List subField(IndirectList(field, subMap[Pstream::myProcNo()])); + const labelList& mySubMap = subMap[Pstream::myProcNo()]; + + List subField(mySubMap.size()); + forAll(mySubMap, i) + { + subField[i] = field[mySubMap[i]]; + } // Receive sub field from myself (subField) const labelList& map = constructMap[Pstream::myProcNo()]; @@ -149,10 +186,19 @@ void Foam::mapDistribute::distribute // Send sub field to neighbour for (label domain = 0; domain < Pstream::nProcs(); domain++) { - if (domain != Pstream::myProcNo()) + const labelList& map = subMap[domain]; + + if (domain != Pstream::myProcNo() && map.size() > 0) { + + List subField(map.size()); + forAll(map, i) + { + subField[i] = field[map[i]]; + } + OPstream toNbr(Pstream::nonBlocking, domain); - toNbr << IndirectList(field, subMap[domain])(); + toNbr << subField; } } @@ -160,13 +206,13 @@ void Foam::mapDistribute::distribute // Receive sub field from neighbour for (label domain = 0; domain < Pstream::nProcs(); domain++) { - if (domain != Pstream::myProcNo()) + const labelList& map = constructMap[domain]; + + if (domain != Pstream::myProcNo() && map.size() > 0) { IPstream fromNbr(Pstream::nonBlocking, domain); List subField(fromNbr); - const labelList& map = constructMap[domain]; - forAll(map, i) { newField[map[i]] = subField[i]; From a688017797d8928541dbab4bba9c32650c845936 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 27 Aug 2008 17:59:28 +0100 Subject: [PATCH 10/25] constructor from data with reuse --- .../PrimitivePatch/PrimitivePatch.C | 36 +++++++++++++++++++ .../PrimitivePatch/PrimitivePatch.H | 8 +++++ 2 files changed, 44 insertions(+) diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.C index a47c9c7d8c..835f884399 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.C @@ -68,6 +68,42 @@ PrimitivePatch::PrimitivePatch {} +// Construct from components +template +< + class Face, + template class FaceList, + class PointField, + class PointType +> +PrimitivePatch::PrimitivePatch +( + FaceList& faces, + Field& points, + const bool reUse +) +: + FaceList(faces, reUse), + points_(points, reUse), + edgesPtr_(NULL), + nInternalEdges_(-1), + boundaryPointsPtr_(NULL), + faceFacesPtr_(NULL), + edgeFacesPtr_(NULL), + faceEdgesPtr_(NULL), + pointEdgesPtr_(NULL), + pointFacesPtr_(NULL), + localFacesPtr_(NULL), + meshPointsPtr_(NULL), + meshPointMapPtr_(NULL), + edgeLoopsPtr_(NULL), + localPointsPtr_(NULL), + localPointOrderPtr_(NULL), + faceNormalsPtr_(NULL), + pointNormalsPtr_(NULL) +{} + + // Construct as copy template < diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H index c22514d25f..49b3be8260 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H @@ -235,6 +235,14 @@ public: const Field& points ); + //- Construct from components, reuse storage + PrimitivePatch + ( + FaceList& faces, + Field& points, + const bool reUse + ); + //- Construct as copy PrimitivePatch ( From 084473cc0c6953442051a245d9ef73f682c5dd43 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 27 Aug 2008 18:00:02 +0100 Subject: [PATCH 11/25] delayed faceEdges construction to save memory --- .../meshes/primitiveMesh/primitiveMeshEdges.C | 52 ++++++++++++++++--- 1 file changed, 46 insertions(+), 6 deletions(-) diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdges.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdges.C index 8b5fa7bb03..6b3039ff30 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdges.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdges.C @@ -467,7 +467,8 @@ const edgeList& primitiveMesh::edges() const { if (!edgesPtr_) { - calcEdges(true); + //calcEdges(true); + calcEdges(false); } return *edgesPtr_; @@ -477,10 +478,8 @@ const labelListList& primitiveMesh::pointEdges() const { if (!pePtr_) { - //// Invert edges - //pePtr_ = new labelListList(nPoints()); - //invertManyToMany(nPoints(), edges(), *pePtr_); - calcEdges(true); + //calcEdges(true); + calcEdges(false); } return *pePtr_; @@ -491,12 +490,53 @@ const labelListList& primitiveMesh::faceEdges() const { if (!fePtr_) { - calcEdges(true); + if (debug) + { + Pout<< "primitiveMesh::faceEdges() : " + << "calculating faceEdges" << endl; + } + + //calcEdges(true); + const faceList& fcs = faces(); + const labelListList& pe = pointEdges(); + const edgeList& es = edges(); + + fePtr_ = new labelListList(fcs.size()); + labelListList& faceEdges = *fePtr_; + + forAll(fcs, faceI) + { + const face& f = fcs[faceI]; + + labelList& fEdges = faceEdges[faceI]; + fEdges.setSize(f.size()); + + forAll(f, fp) + { + label pointI = f[fp]; + label nextPointI = f[f.fcIndex(fp)]; + + // Find edge between pointI, nextPontI + const labelList& pEdges = pe[pointI]; + + forAll(pEdges, i) + { + label edgeI = pEdges[i]; + + if (es[edgeI].otherVertex(pointI) == nextPointI) + { + fEdges[fp] = edgeI; + break; + } + } + } + } } return *fePtr_; } + void primitiveMesh::clearOutEdges() { deleteDemandDrivenData(edgesPtr_); From 05e733ce3a0149953aed1a10fa3d428eb58ae8e0 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 27 Aug 2008 18:01:17 +0100 Subject: [PATCH 12/25] extra checks --- .../parMetisDecomp/parMetisDecomp.C | 47 +++++++++++++++++-- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/src/decompositionAgglomeration/parMetisDecomp/parMetisDecomp.C b/src/decompositionAgglomeration/parMetisDecomp/parMetisDecomp.C index a5778bcdf0..8b3092f08f 100644 --- a/src/decompositionAgglomeration/parMetisDecomp/parMetisDecomp.C +++ b/src/decompositionAgglomeration/parMetisDecomp/parMetisDecomp.C @@ -41,8 +41,7 @@ extern "C" # include "parmetis.h" } - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { @@ -57,6 +56,8 @@ namespace Foam } +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + //- Does prevention of 0 cell domains and calls parmetis. Foam::label Foam::parMetisDecomp::decompose ( @@ -76,6 +77,16 @@ Foam::label Foam::parMetisDecomp::decompose // Number of dimensions int nDims = 3; + + if (cellCentres.size() != xadj.size()-1) + { + FatalErrorIn("parMetisDecomp::decompose(..)") + << "cellCentres:" << cellCentres.size() + << " xadj:" << xadj.size() + << abort(FatalError); + } + + // Get number of cells on all processors List nLocalCells(Pstream::nProcs()); nLocalCells[Pstream::myProcNo()] = xadj.size()-1; @@ -106,12 +117,12 @@ Foam::label Foam::parMetisDecomp::decompose // Make sure every domain has at least one cell // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // (Metis falls over with zero sized domains) - // Trickle cells from processors that have them down to those that + // Trickle cells from processors that have them up to those that // don't. - // Number of cells to send down (is same as number of cells next processor - // has to receive) + // Number of cells to send to the next processor + // (is same as number of cells next processor has to receive) List nSendCells(Pstream::nProcs(), 0); for (label procI = nLocalCells.size()-1; procI >=1; procI--) @@ -135,6 +146,15 @@ Foam::label Foam::parMetisDecomp::decompose Field prevCellWeights(fromPrevProc); Field prevFaceWeights(fromPrevProc); + if (prevXadj.size() != nSendCells[Pstream::myProcNo()-1]) + { + FatalErrorIn("parMetisDecomp::decompose(..)") + << "Expected from processor " << Pstream::myProcNo()-1 + << " connectivity for " << nSendCells[Pstream::myProcNo()-1] + << " nCells but only received " << prevXadj.size() + << abort(FatalError); + } + // Insert adjncy prepend(prevAdjncy, adjncy); // Adapt offsets and prepend xadj @@ -222,6 +242,14 @@ Foam::label Foam::parMetisDecomp::decompose } + if (nLocalCells[Pstream::myProcNo()] != (xadj.size()-1)) + { + FatalErrorIn("parMetisDecomp::decompose(..)") + << "Have connectivity for " << xadj.size()-1 + << " cells but nLocalCells:" << nLocalCells[Pstream::myProcNo()] + << abort(FatalError); + } + // Weight info int wgtFlag = 0; int* vwgtPtr = NULL; @@ -292,6 +320,15 @@ Foam::label Foam::parMetisDecomp::decompose List nextFinalDecomp(fromNextProc); + if (nextFinalDecomp.size() != nSendCells[Pstream::myProcNo()]) + { + FatalErrorIn("parMetisDecomp::decompose(..)") + << "Expected from processor " << Pstream::myProcNo()+1 + << " decomposition for " << nSendCells[Pstream::myProcNo()] + << " nCells but only received " << nextFinalDecomp.size() + << abort(FatalError); + } + append(nextFinalDecomp, finalDecomp); } From bd27a662989b6bc5dedc56fcc2b764f73e2c47bc Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 27 Aug 2008 18:01:31 +0100 Subject: [PATCH 13/25] binary output --- src/meshTools/octree/PointIndexHit.H | 44 ++++++++++++++++++++++++++-- src/meshTools/octree/pointIndexHit.H | 9 +++++- 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/src/meshTools/octree/PointIndexHit.H b/src/meshTools/octree/PointIndexHit.H index 9b72d99605..f29965748c 100644 --- a/src/meshTools/octree/PointIndexHit.H +++ b/src/meshTools/octree/PointIndexHit.H @@ -94,6 +94,12 @@ public: index_(-1) {} + //- Construct from Istream + PointIndexHit(Istream& is) + { + is >> *this; + } + // Member Functions @@ -193,13 +199,45 @@ public: friend Ostream& operator<< (Ostream& os, const PointIndexHit& pHit) { - return os << pHit.hit_ << token::SPACE << pHit.hitPoint_ - << token::SPACE << pHit.index_; + if (os.format() == IOstream::ASCII) + { + os << pHit.hit_ << token::SPACE << pHit.hitPoint_ + << token::SPACE << pHit.index_; + } + else + { + os.write + ( + reinterpret_cast(&pHit), + sizeof(PointIndexHit) + ); + } + + // Check state of Ostream + os.check("Ostream& operator<<(Ostream&, const PointIndexHit&)"); + + return os; } friend Istream& operator>>(Istream& is, PointIndexHit& pHit) { - return is >> pHit.hit_ >> pHit.hitPoint_ >> pHit.index_; + if (is.format() == IOstream::ASCII) + { + return is >> pHit.hit_ >> pHit.hitPoint_ >> pHit.index_; + } + else + { + is.read + ( + reinterpret_cast(&pHit), + sizeof(PointIndexHit) + ); + } + + // Check state of Istream + is.check("Istream& operator>>(Istream&, PointIndexHit&)"); + + return is; } }; diff --git a/src/meshTools/octree/pointIndexHit.H b/src/meshTools/octree/pointIndexHit.H index e41fd28499..b43f12d551 100644 --- a/src/meshTools/octree/pointIndexHit.H +++ b/src/meshTools/octree/pointIndexHit.H @@ -39,7 +39,14 @@ Description namespace Foam { - typedef PointIndexHit pointIndexHit; + +typedef PointIndexHit pointIndexHit; + + +//- Specify data associated with pointIndexHit type is contiguous +template<> +inline bool contiguous() {return true;} + } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // From 6e02125e05709d0444edbd8dd318554dacd4b308 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 27 Aug 2008 18:09:32 +0100 Subject: [PATCH 14/25] stats without mesh addressing; reuse constructor --- src/triSurface/triSurface/triSurface.C | 49 +++++++++++++++++++------- src/triSurface/triSurface/triSurface.H | 11 +++++- 2 files changed, 47 insertions(+), 13 deletions(-) diff --git a/src/triSurface/triSurface/triSurface.C b/src/triSurface/triSurface/triSurface.C index 336987ade8..89a48a30d6 100644 --- a/src/triSurface/triSurface/triSurface.C +++ b/src/triSurface/triSurface/triSurface.C @@ -31,6 +31,7 @@ License #include "Time.H" #include "boundBox.H" #include "SortableList.H" +#include "PackedList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -743,6 +744,26 @@ triSurface::triSurface {} +triSurface::triSurface +( + List& triangles, + const geometricSurfacePatchList& patches, + pointField& points, + const bool reUse +) +: + PrimitivePatch + ( + triangles, + points, + reUse + ), + patches_(patches), + sortedEdgeFacesPtr_(NULL), + edgeOwnerPtr_(NULL) +{} + + triSurface::triSurface ( const List& triangles, @@ -1148,9 +1169,7 @@ triSurface triSurface::subsetMesh } // Construct subsurface - triSurface subSurface(newTriangles, patches(), newPoints); - - return subSurface; + return triSurface(newTriangles, patches(), newPoints, true); } @@ -1187,30 +1206,36 @@ void triSurface::write(const Time& d) const void triSurface::writeStats(Ostream& os) const { - // Calculate bounding box without any additional addressing - // Copy of treeBoundBox code. Cannot use meshTools from triSurface... + // Unfortunately nPoints constructs meshPoints() so do compact version + // ourselves. + PackedList<1> pointIsUsed(points().size()); + pointIsUsed = 0U; + + label nPoints = 0; boundBox bb ( point(VGREAT, VGREAT, VGREAT), point(-VGREAT, -VGREAT, -VGREAT) ); + forAll(*this, triI) { const labelledTri& f = operator[](triI); forAll(f, fp) { - const point& pt = points()[f[fp]]; - bb.min() = ::Foam::min(bb.min(), pt); - bb.max() = ::Foam::max(bb.max(), pt); + label pointI = f[fp]; + if (pointIsUsed.set(pointI, 1)) + { + bb.min() = ::Foam::min(bb.min(), points()[pointI]); + bb.max() = ::Foam::max(bb.max(), points()[pointI]); + nPoints++; + } } } - // Unfortunately nPoints constructs meshPoints() ... - os << "Triangles : " << size() << endl - //<< "Edges : " << nEdges() << endl - << "Vertices : " << nPoints() << endl + << "Vertices : " << nPoints << endl << "Bounding Box : " << bb << endl; } diff --git a/src/triSurface/triSurface/triSurface.H b/src/triSurface/triSurface/triSurface.H index 56b1abc849..624b793117 100644 --- a/src/triSurface/triSurface/triSurface.H +++ b/src/triSurface/triSurface/triSurface.H @@ -36,9 +36,9 @@ SourceFiles #ifndef triSurface_H #define triSurface_H +#include "PrimitivePatch.H" #include "pointField.H" #include "labelledTri.H" -#include "PrimitivePatch.H" #include "boolList.H" #include "geometricSurfacePatchList.H" #include "surfacePatchList.H" @@ -215,6 +215,15 @@ public: const pointField& ); + //- Construct from triangles, patches, points. Reuse storage. + triSurface + ( + List&, + const geometricSurfacePatchList&, + pointField&, + const bool reUse + ); + //- Construct from triangles, points. Set patchnames to default. triSurface(const List&, const pointField&); From 4dc1c78a281f105a0f44bdd01d38cbe91a6216d4 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 27 Aug 2008 18:09:53 +0100 Subject: [PATCH 15/25] handling tiny triangles --- src/meshTools/triSurface/triangleFuncs/triangleFuncs.C | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/meshTools/triSurface/triangleFuncs/triangleFuncs.C b/src/meshTools/triSurface/triangleFuncs/triangleFuncs.C index 56f8799aec..e8c9a29552 100644 --- a/src/meshTools/triSurface/triangleFuncs/triangleFuncs.C +++ b/src/meshTools/triSurface/triangleFuncs/triangleFuncs.C @@ -101,6 +101,7 @@ bool Foam::triangleFuncs::intersectAxesBundle // Since direction is coordinate axis there is no need to do projection, // we can directly check u,v components for inclusion in triangle. + scalar localScale = max(max(magSqr(V10), magSqr(V20)), 1.0); // Get other components label i1 = (i0 + 1) % 3; @@ -114,8 +115,11 @@ bool Foam::triangleFuncs::intersectAxesBundle scalar det = v2*u1 - u2*v1; - // Fix for V0:(-31.71428 0 -15.10714) V10:(-1.285715 8.99165e-16 -1.142858) V20:(0 0 -1.678573) i0:0 - if (Foam::mag(det)/max(max(mag(V10),mag(V20)),1) < SMALL) + // Fix for V0:(-31.71428 0 -15.10714) + // V10:(-1.285715 8.99165e-16 -1.142858) + // V20:(0 0 -1.678573) + // i0:0 + if (Foam::mag(det)/localScale < SMALL) { // Triangle parallel to dir return false; @@ -132,7 +136,7 @@ bool Foam::triangleFuncs::intersectAxesBundle scalar beta = 0; bool inter = false; - if (Foam::mag(u1) < SMALL) + if (Foam::mag(u1)/localScale < SMALL) { beta = u0/u2; if ((beta >= 0) && (beta <= 1)) From ea27058384e06e6f1730347ca23428f60b194225 Mon Sep 17 00:00:00 2001 From: henry Date: Thu, 28 Aug 2008 10:42:13 +0100 Subject: [PATCH 16/25] Updates, corrections, improvements and docs. --- src/finiteVolume/Make/files | 1 + .../fluxCorrectedVelocityFvPatchVectorField.C | 20 +- .../fluxCorrectedVelocityFvPatchVectorField.H | 5 +- .../inletOutlet/inletOutletFvPatchField.C | 16 ++ .../inletOutlet/inletOutletFvPatchField.H | 5 + ...tedInletOutletVelocityFvPatchVectorField.C | 34 ++- ...tedInletOutletVelocityFvPatchVectorField.H | 42 +++- ...eDirectedInletVelocityFvPatchVectorField.C | 29 ++- ...eDirectedInletVelocityFvPatchVectorField.H | 45 +++- ...ureInletOutletVelocityFvPatchVectorField.H | 5 +- ...reInletUniformVelocityFvPatchVectorField.C | 11 + ...reInletUniformVelocityFvPatchVectorField.H | 9 +- .../pressureInletVelocityFvPatchVectorField.C | 25 +-- .../pressureInletVelocityFvPatchVectorField.H | 38 +++- ...malInletOutletVelocityFvPatchVectorField.C | 201 ++++++++++++++++++ ...malInletOutletVelocityFvPatchVectorField.H | 191 +++++++++++++++++ ...ureInletOutletVelocityFvPatchVectorField.H | 5 +- 17 files changed, 632 insertions(+), 50 deletions(-) create mode 100644 src/finiteVolume/fields/fvPatchFields/derived/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.C create mode 100644 src/finiteVolume/fields/fvPatchFields/derived/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.H diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index d4a3e0ff78..83dff1819d 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -84,6 +84,7 @@ $(derivedFvPatchFields)/oscillatingFixedValue/oscillatingFixedValueFvPatchFields $(derivedFvPatchFields)/outletInlet/outletInletFvPatchFields.C $(derivedFvPatchFields)/partialSlip/partialSlipFvPatchFields.C $(derivedFvPatchFields)/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C +$(derivedFvPatchFields)/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.C $(derivedFvPatchFields)/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C $(derivedFvPatchFields)/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C $(derivedFvPatchFields)/pressureInletUniformVelocity/pressureInletUniformVelocityFvPatchVectorField.C diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C index 2908681eb0..7082962d9f 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C @@ -74,20 +74,10 @@ fluxCorrectedVelocityFvPatchVectorField ) : zeroGradientFvPatchVectorField(p, iF), - phiName_("phi"), - rhoName_("rho") + phiName_(dict.lookupOrDefault("phi", "phi")), + rhoName_(dict.lookupOrDefault("rho", "rho")) { fvPatchVectorField::operator=(patchInternalField()); - - if (dict.found("phi")) - { - dict.lookup("phi") >> phiName_; - } - - if (dict.found("rho")) - { - dict.lookup("rho") >> rhoName_; - } } @@ -118,10 +108,8 @@ void fluxCorrectedVelocityFvPatchVectorField::evaluate zeroGradientFvPatchVectorField::evaluate(); - const surfaceScalarField& phi = db().lookupObject - ( - phiName_ - ); + const surfaceScalarField& phi = + db().lookupObject(phiName_); const fvsPatchField& phip = patch().patchField(phi); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.H index 438eb0deb9..239db2cd33 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.H @@ -26,7 +26,10 @@ Class Foam::fluxCorrectedVelocityFvPatchVectorField Description - Foam::fluxCorrectedVelocityFvPatchVectorField + Velocity outlet boundary condition for patches where the pressure is + specified. The outflow velocity is obtained by "zeroGradient" and then + corrected from the flux. If reverse flow is possible or expected use + the "pressureInletOutletVelocityFvPatchVectorField" BC instead. SourceFiles fluxCorrectedVelocityFvPatchVectorField.C diff --git a/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.C index 819807927b..c41d207724 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.C @@ -158,6 +158,22 @@ void inletOutletFvPatchField::write(Ostream& os) const } +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +template +void inletOutletFvPatchField::operator= +( + const fvPatchField& ptf +) +{ + fvPatchField::operator= + ( + this->valueFraction()*this->refValue() + + (1 - this->valueFraction())*ptf + ); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.H index 788285ff98..a7c72aa038 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.H @@ -134,6 +134,11 @@ public: //- Write virtual void write(Ostream&) const; + + + // Member operators + + virtual void operator=(const fvPatchField& pvf); }; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C index 66a535c6a7..afbccbd03a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C @@ -45,6 +45,8 @@ pressureDirectedInletOutletVelocityFvPatchVectorField ) : mixedFvPatchVectorField(p, iF), + phiName_("phi"), + rhoName_("rho"), inletDir_(p.size()) { refValue() = *this; @@ -63,6 +65,8 @@ pressureDirectedInletOutletVelocityFvPatchVectorField ) : mixedFvPatchVectorField(ptf, p, iF, mapper), + phiName_(ptf.phiName_), + rhoName_(ptf.rhoName_), inletDir_(ptf.inletDir_, mapper) {} @@ -76,6 +80,8 @@ pressureDirectedInletOutletVelocityFvPatchVectorField ) : mixedFvPatchVectorField(p, iF), + phiName_(dict.lookupOrDefault("phi", "phi")), + rhoName_(dict.lookupOrDefault("rho", "rho")), inletDir_("inletDirection", dict, p.size()) { fvPatchVectorField::operator=(vectorField("value", dict, p.size())); @@ -92,6 +98,8 @@ pressureDirectedInletOutletVelocityFvPatchVectorField ) : mixedFvPatchVectorField(pivpvf), + phiName_(pivpvf.phiName_), + rhoName_(pivpvf.rhoName_), inletDir_(pivpvf.inletDir_) {} @@ -104,6 +112,8 @@ pressureDirectedInletOutletVelocityFvPatchVectorField ) : mixedFvPatchVectorField(pivpvf, iF), + phiName_(pivpvf.phiName_), + rhoName_(pivpvf.rhoName_), inletDir_(pivpvf.inletDir_) {} @@ -129,7 +139,8 @@ void pressureDirectedInletOutletVelocityFvPatchVectorField::rmap mixedFvPatchVectorField::rmap(ptf, addr); const pressureDirectedInletOutletVelocityFvPatchVectorField& tiptf = - refCast(ptf); + refCast + (ptf); inletDir_.rmap(tiptf.inletDir_, addr); } @@ -143,7 +154,7 @@ void pressureDirectedInletOutletVelocityFvPatchVectorField::updateCoeffs() } const surfaceScalarField& phi = - db().lookupObject("phi"); + db().lookupObject(phiName_); const fvsPatchField& phip = patch().patchField(phi); @@ -158,7 +169,7 @@ void pressureDirectedInletOutletVelocityFvPatchVectorField::updateCoeffs() else if (phi.dimensions() == dimDensity*dimVelocity*dimArea) { const fvPatchField& rhop = - patch().lookupPatchField("rho"); + patch().lookupPatchField(rhoName_); refValue() = inletDir_*phip/(rhop*ndmagS); } @@ -185,11 +196,28 @@ void pressureDirectedInletOutletVelocityFvPatchVectorField:: write(Ostream& os) const { fvPatchVectorField::write(os); + os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; + os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; inletDir_.writeEntry("inletDirection", os); writeEntry("value", os); } +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +void pressureDirectedInletOutletVelocityFvPatchVectorField::operator= +( + const fvPatchField& pvf +) +{ + fvPatchField::operator= + ( + valueFraction()*(inletDir_*(inletDir_ & pvf)) + + (1 - valueFraction())*pvf + ); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // makePatchTypeField diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.H index 8907c1d1af..4eaa0586e6 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.H @@ -26,7 +26,10 @@ Class Foam::pressureDirectedInletOutletVelocityFvPatchVectorField Description - Foam::pressureDirectedInletOutletVelocityFvPatchVectorField + Velocity inlet/outlet boundary condition for pressure boundary where the + pressure is specified. zero-gradient is applied for outflow (as defined + by the flux) and for inflow the velocity is obtained from the flux with + the specified `inletDirection'. SourceFiles pressureDirectedInletOutletVelocityFvPatchVectorField.C @@ -53,7 +56,9 @@ class pressureDirectedInletOutletVelocityFvPatchVectorField public mixedFvPatchVectorField { // Private data - + + word phiName_; + word rhoName_; vectorField inletDir_; @@ -133,9 +138,35 @@ public: } - // Member functions + // Access + + //- Return the name of rho + const word& rhoName() const + { + return rhoName_; + } + + //- Return reference to the name of rho to allow adjustment + word& rhoName() + { + return rhoName_; + } + + //- Return the name of phi + const word& phiName() const + { + return phiName_; + } + + //- Return reference to the name of phi to allow adjustment + word& phiName() + { + return phiName_; + } + + // Mapping functions //- Map (and resize as needed) from self given a mapping object @@ -157,6 +188,11 @@ public: //- Write virtual void write(Ostream&) const; + + + // Member operators + + virtual void operator=(const fvPatchField& pvf); }; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C index 1fe26fd649..fa9b68f545 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C @@ -45,6 +45,8 @@ pressureDirectedInletVelocityFvPatchVectorField ) : fixedValueFvPatchVectorField(p, iF), + phiName_("phi"), + rhoName_("rho"), inletDir_(p.size()) {} @@ -59,6 +61,8 @@ pressureDirectedInletVelocityFvPatchVectorField ) : fixedValueFvPatchVectorField(ptf, p, iF, mapper), + phiName_(ptf.phiName_), + rhoName_(ptf.rhoName_), inletDir_(ptf.inletDir_, mapper) {} @@ -72,6 +76,8 @@ pressureDirectedInletVelocityFvPatchVectorField ) : fixedValueFvPatchVectorField(p, iF), + phiName_(dict.lookupOrDefault("phi", "phi")), + rhoName_(dict.lookupOrDefault("rho", "rho")), inletDir_("inletDirection", dict, p.size()) { fvPatchVectorField::operator=(vectorField("value", dict, p.size())); @@ -85,6 +91,8 @@ pressureDirectedInletVelocityFvPatchVectorField ) : fixedValueFvPatchVectorField(pivpvf), + phiName_(pivpvf.phiName_), + rhoName_(pivpvf.rhoName_), inletDir_(pivpvf.inletDir_) {} @@ -97,6 +105,8 @@ pressureDirectedInletVelocityFvPatchVectorField ) : fixedValueFvPatchVectorField(pivpvf, iF), + phiName_(pivpvf.phiName_), + rhoName_(pivpvf.rhoName_), inletDir_(pivpvf.inletDir_) {} @@ -135,8 +145,8 @@ void pressureDirectedInletVelocityFvPatchVectorField::updateCoeffs() return; } - const surfaceScalarField& phi = - db().lookupObject("phi"); + const surfaceScalarField& phi = + db().lookupObject(phiName_); const fvsPatchField& phip = patch().patchField(phi); @@ -151,7 +161,7 @@ void pressureDirectedInletVelocityFvPatchVectorField::updateCoeffs() else if (phi.dimensions() == dimDensity*dimVelocity*dimArea) { const fvPatchField& rhop = - patch().lookupPatchField("rho"); + patch().lookupPatchField(rhoName_); operator==(inletDir_*phip/(rhop*ndmagS)); } @@ -174,11 +184,24 @@ void pressureDirectedInletVelocityFvPatchVectorField::updateCoeffs() void pressureDirectedInletVelocityFvPatchVectorField::write(Ostream& os) const { fvPatchVectorField::write(os); + os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; + os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; inletDir_.writeEntry("inletDirection", os); writeEntry("value", os); } +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +void pressureDirectedInletVelocityFvPatchVectorField::operator= +( + const fvPatchField& pvf +) +{ + fvPatchField::operator=(inletDir_*(inletDir_ & pvf)); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // makePatchTypeField diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.H index a80e7779b2..4de0c84f48 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.H @@ -23,10 +23,14 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::pressureDirectedInletVelocityFvPatchVectorField + Foam::pressureDirectedInletVelocityFvPatchVectorField Description - Foam::pressureDirectedInletOutletVelocityFvPatchVectorField + Velocity inlet boundary condition for patches where the pressure is + specified. The inflow velocity is obtained from the flux with the + specified "inletDirection" direction. If reverse flow is possible or + expected use the "pressureDirectedInletOutletVelocityFvPatchVectorField" + BC instead. SourceFiles pressureDirectedInletVelocityFvPatchVectorField.C @@ -53,7 +57,9 @@ class pressureDirectedInletVelocityFvPatchVectorField public fixedValueFvPatchVectorField { // Private data - + + word phiName_; + word rhoName_; vectorField inletDir_; @@ -130,9 +136,35 @@ public: } - // Member functions + // Access + + //- Return the name of rho + const word& rhoName() const + { + return rhoName_; + } + + //- Return reference to the name of rho to allow adjustment + word& rhoName() + { + return rhoName_; + } + + //- Return the name of phi + const word& phiName() const + { + return phiName_; + } + + //- Return reference to the name of phi to allow adjustment + word& phiName() + { + return phiName_; + } + + // Mapping functions //- Map (and resize as needed) from self given a mapping object @@ -154,6 +186,11 @@ public: //- Write virtual void write(Ostream&) const; + + + // Member operators + + virtual void operator=(const fvPatchField& pvf); }; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H index 538e17ae18..29eed3bfc3 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H @@ -26,7 +26,10 @@ Class Foam::pressureInletOutletVelocityFvPatchVectorField Description - Foam::pressureInletOutletVelocityFvPatchVectorField + Velocity inlet/outlet boundary condition patches for where the pressure is + specified. zero-gradient is applied for outflow (as defined by the flux) + and for inflow the velocity is obtained from the patch-face normal + component of the internal-cell value. SourceFiles pressureInletOutletVelocityFvPatchVectorField.C diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletUniformVelocity/pressureInletUniformVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletUniformVelocity/pressureInletUniformVelocityFvPatchVectorField.C index fb2787c164..0acfc62f01 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletUniformVelocity/pressureInletUniformVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletUniformVelocity/pressureInletUniformVelocityFvPatchVectorField.C @@ -108,6 +108,17 @@ void pressureInletUniformVelocityFvPatchVectorField::updateCoeffs() } +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +void pressureInletUniformVelocityFvPatchVectorField::operator= +( + const fvPatchField& pvf +) +{ + operator==(patch().nf()*sum(patch().Sf() & pvf)/sum(patch().magSf())); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // makePatchTypeField diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletUniformVelocity/pressureInletUniformVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletUniformVelocity/pressureInletUniformVelocityFvPatchVectorField.H index 4440cdfbe8..0eadf62472 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletUniformVelocity/pressureInletUniformVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletUniformVelocity/pressureInletUniformVelocityFvPatchVectorField.H @@ -26,7 +26,9 @@ Class Foam::pressureInletUniformVelocityFvPatchVectorField Description - Foam::pressureInletUniformVelocityFvPatchVectorField + Velocity inlet boundary condition for patches where the pressure is + specified. The uniform inflow velocity is obtained by averaging the flux + over the patch and apply it in the direction normal to the patch faces. SourceFiles pressureInletUniformVelocityFvPatchVectorField.C @@ -124,6 +126,11 @@ public: //- Update the coefficients associated with the patch field virtual void updateCoeffs(); + + + // Member operators + + virtual void operator=(const fvPatchField& pvf); }; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C index c349bc3260..75242aabb5 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C @@ -70,20 +70,10 @@ pressureInletVelocityFvPatchVectorField::pressureInletVelocityFvPatchVectorField ) : fixedValueFvPatchVectorField(p, iF), - phiName_("phi"), - rhoName_("rho") + phiName_(dict.lookupOrDefault("phi", "phi")), + rhoName_(dict.lookupOrDefault("rho", "rho")) { fvPatchVectorField::operator=(vectorField("value", dict, p.size())); - - if (dict.found("phi")) - { - dict.lookup("phi") >> phiName_; - } - - if (dict.found("rho")) - { - dict.lookup("rho") >> rhoName_; - } } @@ -164,6 +154,17 @@ void pressureInletVelocityFvPatchVectorField::write(Ostream& os) const } +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +void pressureInletVelocityFvPatchVectorField::operator= +( + const fvPatchField& pvf +) +{ + fvPatchField::operator=(patch().nf()*(patch().nf() & pvf)); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // makePatchTypeField diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.H index 75348775bc..bb7b7f5b9b 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.H @@ -26,7 +26,10 @@ Class Foam::pressureInletVelocityFvPatchVectorField Description - Foam::pressureInletVelocityFvPatchVectorField + Velocity inlet boundary condition for patches where the pressure is + specified. The inflow velocity is obtained from the flux with a direction + normal to the patch faces. If reverse flow is possible or expected use + the "pressureInletOutletVelocityFvPatchVectorField" BC instead. SourceFiles pressureInletVelocityFvPatchVectorField.C @@ -57,6 +60,7 @@ class pressureInletVelocityFvPatchVectorField word phiName_; word rhoName_; + public: //- Runtime type information @@ -127,6 +131,33 @@ public: // Member functions + // Access + + //- Return the name of rho + const word& rhoName() const + { + return rhoName_; + } + + //- Return reference to the name of rho to allow adjustment + word& rhoName() + { + return rhoName_; + } + + //- Return the name of phi + const word& phiName() const + { + return phiName_; + } + + //- Return reference to the name of phi to allow adjustment + word& phiName() + { + return phiName_; + } + + //- Update the coefficients associated with the patch field virtual void updateCoeffs(); @@ -136,10 +167,7 @@ public: // Member operators - virtual void operator=(const fvPatchField& pvf) - { - fvPatchField::operator=(pvf); - } + virtual void operator=(const fvPatchField& pvf); }; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.C new file mode 100644 index 0000000000..30b7b12ff7 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.C @@ -0,0 +1,201 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 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 "pressureNormalInletOutletVelocityFvPatchVectorField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +pressureNormalInletOutletVelocityFvPatchVectorField:: +pressureNormalInletOutletVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF +) +: + mixedFvPatchVectorField(p, iF), + phiName_("phi"), + rhoName_("rho") +{ + refValue() = *this; + refGrad() = vector::zero; + valueFraction() = 0.0; +} + + +pressureNormalInletOutletVelocityFvPatchVectorField:: +pressureNormalInletOutletVelocityFvPatchVectorField +( + const pressureNormalInletOutletVelocityFvPatchVectorField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + mixedFvPatchVectorField(ptf, p, iF, mapper), + phiName_(ptf.phiName_), + rhoName_(ptf.rhoName_) +{} + + +pressureNormalInletOutletVelocityFvPatchVectorField:: +pressureNormalInletOutletVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + mixedFvPatchVectorField(p, iF), + phiName_(dict.lookupOrDefault("phi", "phi")), + rhoName_(dict.lookupOrDefault("rho", "rho")) +{ + fvPatchVectorField::operator=(vectorField("value", dict, p.size())); + refValue() = *this; + refGrad() = vector::zero; + valueFraction() = 0.0; +} + + +pressureNormalInletOutletVelocityFvPatchVectorField:: +pressureNormalInletOutletVelocityFvPatchVectorField +( + const pressureNormalInletOutletVelocityFvPatchVectorField& pivpvf +) +: + mixedFvPatchVectorField(pivpvf), + phiName_(pivpvf.phiName_), + rhoName_(pivpvf.rhoName_) +{} + + +pressureNormalInletOutletVelocityFvPatchVectorField:: +pressureNormalInletOutletVelocityFvPatchVectorField +( + const pressureNormalInletOutletVelocityFvPatchVectorField& pivpvf, + const DimensionedField& iF +) +: + mixedFvPatchVectorField(pivpvf, iF), + phiName_(pivpvf.phiName_), + rhoName_(pivpvf.rhoName_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void pressureNormalInletOutletVelocityFvPatchVectorField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const surfaceScalarField& phi = + db().lookupObject(phiName_); + + const fvsPatchField& phip = + patch().patchField(phi); + + vectorField n = patch().nf(); + const Field& magS = patch().magSf(); + + if (phi.dimensions() == dimVelocity*dimArea) + { + refValue() = n*phip/magS; + } + else if (phi.dimensions() == dimDensity*dimVelocity*dimArea) + { + const fvPatchField& rhop = + patch().lookupPatchField(rhoName_); + + refValue() = n*phip/(rhop*magS); + } + else + { + FatalErrorIn + ( + "pressureNormalInletOutletVelocityFvPatchVectorField::" + "updateCoeffs()" + ) << "dimensions of phi are not correct" + << "\n on patch " << this->patch().name() + << " of field " << this->dimensionedInternalField().name() + << " in file " << this->dimensionedInternalField().objectPath() + << exit(FatalError); + } + + valueFraction() = 1.0 - pos(phip); + + mixedFvPatchVectorField::updateCoeffs(); +} + + +void pressureNormalInletOutletVelocityFvPatchVectorField:: +write(Ostream& os) const +{ + fvPatchVectorField::write(os); + os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; + os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +void pressureNormalInletOutletVelocityFvPatchVectorField::operator= +( + const fvPatchField& pvf +) +{ + fvPatchField::operator= + ( + valueFraction()*(patch().nf()*(patch().nf() & pvf)) + + (1 - valueFraction())*pvf + ); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchVectorField, + pressureNormalInletOutletVelocityFvPatchVectorField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.H new file mode 100644 index 0000000000..e1f576d012 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.H @@ -0,0 +1,191 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 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::pressureNormalInletOutletVelocityFvPatchVectorField + +Description + Velocity inlet/outlet boundary condition for patches where the pressure is + specified. zero-gradient is applied for outflow (as defined by the flux) + and for inflow the velocity is obtained from the flux with a direction + normal to the patch faces. + +SourceFiles + pressureNormalInletOutletVelocityFvPatchVectorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef pressureNormalInletOutletVelocityFvPatchVectorField_H +#define pressureNormalInletOutletVelocityFvPatchVectorField_H + +#include "fvPatchFields.H" +#include "mixedFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class pressureNormalInletOutletVelocityFvPatch Declaration +\*---------------------------------------------------------------------------*/ + +class pressureNormalInletOutletVelocityFvPatchVectorField +: + public mixedFvPatchVectorField +{ + // Private data + + word phiName_; + word rhoName_; + + +public: + + //- Runtime type information + TypeName("pressureNormalInletOutletVelocity"); + + + // Constructors + + //- Construct from patch and internal field + pressureNormalInletOutletVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + pressureNormalInletOutletVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // pressureNormalInletOutletVelocityFvPatchVectorField + // onto a new patch + pressureNormalInletOutletVelocityFvPatchVectorField + ( + const pressureNormalInletOutletVelocityFvPatchVectorField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + pressureNormalInletOutletVelocityFvPatchVectorField + ( + const pressureNormalInletOutletVelocityFvPatchVectorField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new pressureNormalInletOutletVelocityFvPatchVectorField + ( + *this + ) + ); + } + + //- Construct as copy setting internal field reference + pressureNormalInletOutletVelocityFvPatchVectorField + ( + const pressureNormalInletOutletVelocityFvPatchVectorField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new pressureNormalInletOutletVelocityFvPatchVectorField + ( + *this, + iF + ) + ); + } + + + // Member functions + + // Access + + //- Return the name of rho + const word& rhoName() const + { + return rhoName_; + } + + //- Return reference to the name of rho to allow adjustment + word& rhoName() + { + return rhoName_; + } + + //- Return the name of phi + const word& phiName() const + { + return phiName_; + } + + + //- Return reference to the name of phi to allow adjustment + word& phiName() + { + return phiName_; + } + + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; + + + // Member operators + + virtual void operator=(const fvPatchField& pvf); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.H index e97cb203cf..86ef7a8961 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.H @@ -26,7 +26,10 @@ Class Foam::rotatingPressureInletOutletVelocityFvPatchVectorField Description - Foam::rotatingPressureInletOutletVelocityFvPatchVectorField + Velocity inlet/outlet boundary condition in a rotating frame + for patches where the pressure is specified. zero-gradient is applied for + outflow (as defined by the flux) and for inflow the velocity is obtained + from the flux with a direction normal to the patch faces. SourceFiles rotatingPressureInletOutletVelocityFvPatchVectorField.C From 76b6a5b8fc03fd60f1fc20391c7bb68dcc0ed712 Mon Sep 17 00:00:00 2001 From: henry Date: Thu, 28 Aug 2008 10:42:42 +0100 Subject: [PATCH 17/25] Minor format change. --- .../gaussConvectionScheme/gaussConvectionScheme.C | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.C b/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.C index 90b8139264..6b0f66f245 100644 --- a/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.C +++ b/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.C @@ -22,8 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - \*---------------------------------------------------------------------------*/ #include "gaussConvectionScheme.H" From 212a70a17b17f9657b3e1bdfbb728d4ce3554869 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 28 Aug 2008 15:50:11 +0100 Subject: [PATCH 18/25] boundbox intersect renaming --- .../preProcessing/mapFields/mapFields.C | 4 +- src/OpenFOAM/meshes/boundBox/boundBox.H | 2 +- .../boundaryMesh/octreeDataFaceList.C | 2 +- src/meshTools/indexedOctree/indexedOctree.C | 20 +++++----- src/meshTools/indexedOctree/indexedOctree.H | 6 +-- src/meshTools/indexedOctree/treeDataCell.C | 4 +- src/meshTools/indexedOctree/treeDataEdge.C | 4 +- src/meshTools/indexedOctree/treeDataFace.C | 4 +- .../indexedOctree/treeDataTriSurface.C | 4 +- src/meshTools/octree/octreeDataCell.C | 2 +- src/meshTools/octree/octreeDataEdges.C | 2 +- src/meshTools/octree/octreeDataFace.C | 4 +- src/meshTools/octree/treeBoundBox.C | 39 +++++++++++++++++++ src/meshTools/octree/treeBoundBox.H | 7 +++- src/meshTools/octree/treeBoundBoxI.H | 6 +-- src/meshTools/octree/treeNode.C | 16 ++++---- .../octreeData/octreeDataTriSurface.C | 4 +- .../octreeData/octreeDataTriSurfaceTreeLeaf.C | 2 +- 18 files changed, 86 insertions(+), 46 deletions(-) diff --git a/applications/utilities/preProcessing/mapFields/mapFields.C b/applications/utilities/preProcessing/mapFields/mapFields.C index 0fb8e40fff..5d4a6471e4 100644 --- a/applications/utilities/preProcessing/mapFields/mapFields.C +++ b/applications/utilities/preProcessing/mapFields/mapFields.C @@ -504,7 +504,7 @@ int main(int argc, char *argv[]) !bbsTargetSet[procITarget] || ( bbsTargetSet[procITarget] - && bbsTarget[procITarget].intersects(bbSource) + && bbsTarget[procITarget].overlaps(bbSource) ) ) { @@ -533,7 +533,7 @@ int main(int argc, char *argv[]) bbsTarget[procITarget] = meshTarget.bounds(); bbsTargetSet[procITarget] = true; - if (bbsTarget[procITarget].intersects(bbSource)) + if (bbsTarget[procITarget].overlaps(bbSource)) { if (consistent) { diff --git a/src/OpenFOAM/meshes/boundBox/boundBox.H b/src/OpenFOAM/meshes/boundBox/boundBox.H index a11aa68266..40287e53eb 100644 --- a/src/OpenFOAM/meshes/boundBox/boundBox.H +++ b/src/OpenFOAM/meshes/boundBox/boundBox.H @@ -118,7 +118,7 @@ public: // Query //- Intersects other boundingbox? - bool intersects(const boundBox& bb) const + bool overlaps(const boundBox& bb) const { if ( diff --git a/src/dynamicMesh/boundaryMesh/octreeDataFaceList.C b/src/dynamicMesh/boundaryMesh/octreeDataFaceList.C index 2249bc006e..2ce870af9d 100644 --- a/src/dynamicMesh/boundaryMesh/octreeDataFaceList.C +++ b/src/dynamicMesh/boundaryMesh/octreeDataFaceList.C @@ -399,7 +399,7 @@ bool Foam::octreeDataFaceList::overlaps const treeBoundBox& sampleBb ) const { - return sampleBb.intersects(allBb_[index]); + return sampleBb.overlaps(allBb_[index]); } diff --git a/src/meshTools/indexedOctree/indexedOctree.C b/src/meshTools/indexedOctree/indexedOctree.C index f0f8bd94d0..1a55a88547 100644 --- a/src/meshTools/indexedOctree/indexedOctree.C +++ b/src/meshTools/indexedOctree/indexedOctree.C @@ -40,7 +40,7 @@ namespace Foam // Does bb intersect a sphere around sample? Or is any corner point of bb // closer than nearestDistSqr to sample. template -bool indexedOctree::intersects +bool indexedOctree::overlaps ( const point& p0, const point& p1, @@ -84,7 +84,7 @@ bool indexedOctree::intersects // Does bb intersect a sphere around sample? Or is any corner point of bb // closer than nearestDistSqr to sample. template -bool indexedOctree::intersects +bool indexedOctree::overlaps ( const treeBoundBox& parentBb, const direction octant, @@ -94,7 +94,7 @@ bool indexedOctree::intersects { //- Speeded up version of // treeBoundBox subBb(parentBb.subBbox(mid, octant)) - // intersects + // overlaps // ( // subBb.min(), // subBb.max(), @@ -136,7 +136,7 @@ bool indexedOctree::intersects const point mid(0.5*(min+max)); - return intersects(mid, other, nearestDistSqr, sample); + return overlaps(mid, other, nearestDistSqr, sample); } @@ -567,7 +567,7 @@ void indexedOctree::findNearest const treeBoundBox& subBb = nodes_[subNodeI].bb_; - if (intersects(subBb.min(), subBb.max(), nearestDistSqr, sample)) + if (overlaps(subBb.min(), subBb.max(), nearestDistSqr, sample)) { findNearest ( @@ -584,7 +584,7 @@ void indexedOctree::findNearest { if ( - intersects + overlaps ( nod.bb_, octant, @@ -639,7 +639,7 @@ void indexedOctree::findNearest { const treeBoundBox& subBb = nodes_[getNode(index)].bb_; - if (subBb.intersects(tightest)) + if (subBb.overlaps(tightest)) { findNearest ( @@ -657,7 +657,7 @@ void indexedOctree::findNearest { const treeBoundBox subBb(nodeBb.subBbox(octant)); - if (subBb.intersects(tightest)) + if (subBb.overlaps(tightest)) { shapes_.findNearest ( @@ -1121,7 +1121,7 @@ void indexedOctree::findBox { const treeBoundBox& subBb = nodes_[getNode(index)].bb_; - if (subBb.intersects(searchBox)) + if (subBb.overlaps(searchBox)) { findBox(getNode(index), searchBox, elements); } @@ -1130,7 +1130,7 @@ void indexedOctree::findBox { const treeBoundBox subBb(nodeBb.subBbox(octant)); - if (subBb.intersects(searchBox)) + if (subBb.overlaps(searchBox)) { const labelList& indices = contents_[getContent(index)]; diff --git a/src/meshTools/indexedOctree/indexedOctree.H b/src/meshTools/indexedOctree/indexedOctree.H index 249eb1b5f1..97b6ab607c 100644 --- a/src/meshTools/indexedOctree/indexedOctree.H +++ b/src/meshTools/indexedOctree/indexedOctree.H @@ -36,9 +36,9 @@ SourceFiles #ifndef indexedOctree_H #define indexedOctree_H +#include "treeBoundBox.H" #include "pointIndexHit.H" #include "FixedList.H" -#include "treeBoundBox.H" #include "Ostream.H" #include "labelHashSet.H" #include "labelBits.H" @@ -146,7 +146,7 @@ private: //- Like above but now bb is implicitly provided as parent bb + mid // + octant - static bool intersects + static bool overlaps ( const treeBoundBox& parentBb, const direction octant, @@ -497,7 +497,7 @@ public: //- Helper: does bb intersect a sphere around sample? Or is any // corner point of bb closer than nearestDistSqr to sample. - static bool intersects + static bool overlaps ( const point& bbMin, const point& bbMax, diff --git a/src/meshTools/indexedOctree/treeDataCell.C b/src/meshTools/indexedOctree/treeDataCell.C index 2ade66780c..cb41899306 100644 --- a/src/meshTools/indexedOctree/treeDataCell.C +++ b/src/meshTools/indexedOctree/treeDataCell.C @@ -137,11 +137,11 @@ bool Foam::treeDataCell::overlaps { if (cacheBb_) { - return cubeBb.intersects(bbs_[index]); + return cubeBb.overlaps(bbs_[index]); } else { - return cubeBb.intersects(calcCellBb(cellLabels_[index])); + return cubeBb.overlaps(calcCellBb(cellLabels_[index])); } } diff --git a/src/meshTools/indexedOctree/treeDataEdge.C b/src/meshTools/indexedOctree/treeDataEdge.C index d918fab944..6b8d54399e 100644 --- a/src/meshTools/indexedOctree/treeDataEdge.C +++ b/src/meshTools/indexedOctree/treeDataEdge.C @@ -110,11 +110,11 @@ bool Foam::treeDataEdge::overlaps { if (cacheBb_) { - return cubeBb.intersects(bbs_[index]); + return cubeBb.overlaps(bbs_[index]); } else { - return cubeBb.intersects(calcBb(edgeLabels_[index])); + return cubeBb.overlaps(calcBb(edgeLabels_[index])); } } diff --git a/src/meshTools/indexedOctree/treeDataFace.C b/src/meshTools/indexedOctree/treeDataFace.C index e8d148ec23..5764841bbd 100644 --- a/src/meshTools/indexedOctree/treeDataFace.C +++ b/src/meshTools/indexedOctree/treeDataFace.C @@ -412,14 +412,14 @@ bool Foam::treeDataFace::overlaps // 1. Quick rejection: bb does not intersect face bb at all if (cacheBb_) { - if (!cubeBb.intersects(bbs_[index])) + if (!cubeBb.overlaps(bbs_[index])) { return false; } } else { - if (!cubeBb.intersects(calcBb(faceLabels_[index]))) + if (!cubeBb.overlaps(calcBb(faceLabels_[index]))) { return false; } diff --git a/src/meshTools/indexedOctree/treeDataTriSurface.C b/src/meshTools/indexedOctree/treeDataTriSurface.C index 23ba7f5116..c226de9499 100644 --- a/src/meshTools/indexedOctree/treeDataTriSurface.C +++ b/src/meshTools/indexedOctree/treeDataTriSurface.C @@ -284,13 +284,13 @@ bool Foam::treeDataTriSurface::overlaps triBb.max() = max(triBb.max(), p2); //- For testing: robust one - //return cubeBb.intersects(triBb); + //return cubeBb.overlaps(triBb); //- Exact test of triangle intersecting bb // Quick rejection. If whole bounding box of tri is outside cubeBb then // there will be no intersection. - if (!cubeBb.intersects(triBb)) + if (!cubeBb.overlaps(triBb)) { return false; } diff --git a/src/meshTools/octree/octreeDataCell.C b/src/meshTools/octree/octreeDataCell.C index 81a3600be9..17bba8b2c9 100644 --- a/src/meshTools/octree/octreeDataCell.C +++ b/src/meshTools/octree/octreeDataCell.C @@ -113,7 +113,7 @@ bool Foam::octreeDataCell::overlaps const treeBoundBox& cubeBb ) const { - return cubeBb.intersects(bbs_[index]); + return cubeBb.overlaps(bbs_[index]); } diff --git a/src/meshTools/octree/octreeDataEdges.C b/src/meshTools/octree/octreeDataEdges.C index 3974a0b91d..9828599e61 100644 --- a/src/meshTools/octree/octreeDataEdges.C +++ b/src/meshTools/octree/octreeDataEdges.C @@ -107,7 +107,7 @@ bool Foam::octreeDataEdges::overlaps const treeBoundBox& sampleBb ) const { - return sampleBb.intersects(allBb_[index]); + return sampleBb.overlaps(allBb_[index]); } diff --git a/src/meshTools/octree/octreeDataFace.C b/src/meshTools/octree/octreeDataFace.C index 46f03993cc..6a8c3f875a 100644 --- a/src/meshTools/octree/octreeDataFace.C +++ b/src/meshTools/octree/octreeDataFace.C @@ -507,12 +507,12 @@ bool Foam::octreeDataFace::overlaps const treeBoundBox& sampleBb ) const { - //return sampleBb.intersects(allBb_[index]); + //return sampleBb.overlaps(allBb_[index]); //- Exact test of face intersecting bb // 1. Quick rejection: bb does not intersect face bb at all - if (!sampleBb.intersects(allBb_[index])) + if (!sampleBb.overlaps(allBb_[index])) { return false; } diff --git a/src/meshTools/octree/treeBoundBox.C b/src/meshTools/octree/treeBoundBox.C index 042209ec7c..26530b5a3a 100644 --- a/src/meshTools/octree/treeBoundBox.C +++ b/src/meshTools/octree/treeBoundBox.C @@ -297,6 +297,45 @@ Foam::treeBoundBox Foam::treeBoundBox::subBbox } +bool Foam::treeBoundBox::overlaps +( + const point& centre, + const scalar radiusSqr +) const +{ + // Find out where centre is in relation to bb. + // Find nearest point on bb. + scalar distSqr = 0; + + for (direction dir = 0; dir < vector::nComponents; dir++) + { + scalar d0 = min()[dir] - centre[dir]; + scalar d1 = max()[dir] - centre[dir]; + + if ((d0 > 0) != (d1 > 0)) + { + // centre inside both extrema. This component does not add any + // distance. + } + else if (Foam::mag(d0) < Foam::mag(d1)) + { + distSqr += d0*d0; + } + else + { + distSqr += d1*d1; + } + + if (distSqr > radiusSqr) + { + return false; + } + } + + return true; +} + + // line intersection. Returns true if line (start to end) inside // bb or intersects bb. Sets pt to intersection. // diff --git a/src/meshTools/octree/treeBoundBox.H b/src/meshTools/octree/treeBoundBox.H index 01d7a9a6bd..02dbac38af 100644 --- a/src/meshTools/octree/treeBoundBox.H +++ b/src/meshTools/octree/treeBoundBox.H @@ -263,8 +263,11 @@ public: FixedList& octantOrder ) const; - //- Intersects other boundingbox? - inline bool intersects(const treeBoundBox&) const; + //- Overlaps other boundingbox? + inline bool overlaps(const treeBoundBox&) const; + + //- Overlaps boundingSphere (centre + sqr(radius))? + bool overlaps(const point&, const scalar radiusSqr) const; //- Intersects segment; set point to intersection position, // return true if intersection found. diff --git a/src/meshTools/octree/treeBoundBoxI.H b/src/meshTools/octree/treeBoundBoxI.H index 431eb8a04d..c444b2808a 100644 --- a/src/meshTools/octree/treeBoundBoxI.H +++ b/src/meshTools/octree/treeBoundBoxI.H @@ -24,9 +24,7 @@ License \*---------------------------------------------------------------------------*/ -#include "error.H" #include "treeBoundBox.H" -#include "point.H" #include "Random.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -414,9 +412,9 @@ inline void treeBoundBox::searchOrder // true if bb's intersect or overlap. // Note: <= to make sure we catch all. -inline bool treeBoundBox::intersects(const treeBoundBox& bb) const +inline bool treeBoundBox::overlaps(const treeBoundBox& bb) const { - return boundBox::intersects(bb); + return boundBox::overlaps(bb); } diff --git a/src/meshTools/octree/treeNode.C b/src/meshTools/octree/treeNode.C index 678bcfb694..771ef2cdd9 100644 --- a/src/meshTools/octree/treeNode.C +++ b/src/meshTools/octree/treeNode.C @@ -798,7 +798,7 @@ bool treeNode::findTightest // Node: recurse into subnodes const treeNode* subNodePtr = getNodePtr(octant); - if (subNodePtr->bb().intersects(tightest)) + if (subNodePtr->bb().overlaps(tightest)) { // there might be a better fit inside this subNode changed |= @@ -815,7 +815,7 @@ bool treeNode::findTightest // Leaf: let leaf::find handle this const treeLeaf* subLeafPtr = getLeafPtr(octant); - if (subLeafPtr->bb().intersects(tightest)) + if (subLeafPtr->bb().overlaps(tightest)) { // there might be a better fit inside this subLeaf changed |= @@ -884,7 +884,7 @@ bool treeNode::findNearest // Node const treeNode* subNodePtr = getNodePtr(octant); - if (subNodePtr->bb().intersects(tightest)) + if (subNodePtr->bb().overlaps(tightest)) { // there might be a better fit inside this subNode changed |= @@ -903,7 +903,7 @@ bool treeNode::findNearest // Leaf: let leaf::find handle this const treeLeaf* subLeafPtr = getLeafPtr(octant); - if (subLeafPtr->bb().intersects(tightest)) + if (subLeafPtr->bb().overlaps(tightest)) { // there might be a better fit inside this subNode changed |= @@ -975,7 +975,7 @@ bool treeNode::findNearest // Node const treeNode* subNodePtr = getNodePtr(octant); - if (subNodePtr->bb().intersects(tightest)) + if (subNodePtr->bb().overlaps(tightest)) { // there might be a better fit inside this subNode changed |= @@ -995,7 +995,7 @@ bool treeNode::findNearest // Leaf: let leaf::find handle this const treeLeaf* subLeafPtr = getLeafPtr(octant); - if (subLeafPtr->bb().intersects(tightest)) + if (subLeafPtr->bb().overlaps(tightest)) { // there might be a better fit inside this subNode changed |= @@ -1060,7 +1060,7 @@ bool treeNode::findBox // Node const treeNode* subNodePtr = getNodePtr(octant); - if (subNodePtr->bb().intersects(box)) + if (subNodePtr->bb().overlaps(box)) { // Visit sub node. changed |= subNodePtr->findBox(shapes, box, elements); @@ -1071,7 +1071,7 @@ bool treeNode::findBox // Leaf: let leaf::find handle this const treeLeaf* subLeafPtr = getLeafPtr(octant); - if (subLeafPtr->bb().intersects(box)) + if (subLeafPtr->bb().overlaps(box)) { // Visit sub leaf. changed |= subLeafPtr->findBox(shapes, box, elements); diff --git a/src/meshTools/triSurface/octreeData/octreeDataTriSurface.C b/src/meshTools/triSurface/octreeData/octreeDataTriSurface.C index 6a21879f35..f3dd4f3e03 100644 --- a/src/meshTools/triSurface/octreeData/octreeDataTriSurface.C +++ b/src/meshTools/triSurface/octreeData/octreeDataTriSurface.C @@ -385,12 +385,12 @@ bool Foam::octreeDataTriSurface::overlaps const treeBoundBox& cubeBb ) const { - //return cubeBb.intersects(allBb_[index]); + //return cubeBb.overlaps(allBb_[index]); //- Exact test of triangle intersecting bb // Quick rejection. - if (!cubeBb.intersects(allBb_[index])) + if (!cubeBb.overlaps(allBb_[index])) { return false; } diff --git a/src/meshTools/triSurface/octreeData/octreeDataTriSurfaceTreeLeaf.C b/src/meshTools/triSurface/octreeData/octreeDataTriSurfaceTreeLeaf.C index 6582cfd239..ca4a34975c 100644 --- a/src/meshTools/triSurface/octreeData/octreeDataTriSurfaceTreeLeaf.C +++ b/src/meshTools/triSurface/octreeData/octreeDataTriSurfaceTreeLeaf.C @@ -54,7 +54,7 @@ bool Foam::treeLeaf::findNearest label faceI = indices_[i]; // Quick rejection test. - if (tightest.intersects(allBb[faceI])) + if (tightest.overlaps(allBb[faceI])) { // Full calculation scalar dist = shapes.calcNearest(faceI, sample, nearest); From 48a74535dbcd329b2bb699c9885074dfaeeb82e8 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 28 Aug 2008 15:50:46 +0100 Subject: [PATCH 19/25] added check for non-aligned cell centres --- .../directMappedPolyPatch.C | 90 +++++++++++++++++-- .../directMappedPolyPatch.H | 6 +- 2 files changed, 87 insertions(+), 9 deletions(-) diff --git a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.C b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.C index 83f621363e..e519da59d9 100644 --- a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.C +++ b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.C @@ -29,6 +29,8 @@ License #include "ListListOps.H" #include "meshSearch.H" #include "mapDistribute.H" +#include "meshTools.H" +#include "OFstream.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,16 +49,18 @@ void Foam::directMappedPolyPatch::collectSamples ( pointField& samples, labelList& patchFaceProcs, - labelList& patchFaces + labelList& patchFaces, + pointField& patchFc ) const { - const vectorField::subField fc = this->faceCentres(); // Collect all sample points and the faces they come from. + List globalFc(Pstream::nProcs()); List globalSamples(Pstream::nProcs()); labelListList globalFaces(Pstream::nProcs()); - globalSamples[Pstream::myProcNo()] = fc+offset_; + globalFc[Pstream::myProcNo()] = this->faceCentres(); + globalSamples[Pstream::myProcNo()] = globalFc[Pstream::myProcNo()]+offset_; globalFaces[Pstream::myProcNo()] = identity(size()); // Distribute to all processors @@ -64,6 +68,8 @@ void Foam::directMappedPolyPatch::collectSamples Pstream::scatterList(globalSamples); Pstream::gatherList(globalFaces); Pstream::scatterList(globalFaces); + Pstream::gatherList(globalFc); + Pstream::scatterList(globalFc); // Rework into straight list samples = ListListOps::combine @@ -76,6 +82,11 @@ void Foam::directMappedPolyPatch::collectSamples globalFaces, accessOp() ); + patchFc = ListListOps::combine + ( + globalFc, + accessOp() + ); patchFaceProcs.setSize(patchFaces.size()); labelList nPerProc @@ -103,11 +114,14 @@ void Foam::directMappedPolyPatch::findSamples ( const pointField& samples, labelList& sampleCellProcs, - labelList& sampleCells + labelList& sampleCells, + pointField& sampleCc ) const { sampleCellProcs.setSize(samples.size()); sampleCells.setSize(samples.size()); + sampleCc.setSize(samples.size()); + sampleCc = point(-GREAT, -GREAT, -GREAT); { // Octree based search engine @@ -124,6 +138,8 @@ void Foam::directMappedPolyPatch::findSamples else { sampleCellProcs[sampleI] = Pstream::myProcNo(); + sampleCc[sampleI] = + boundaryMesh().mesh().cellCentres()[sampleCells[sampleI]]; } } } @@ -136,6 +152,9 @@ void Foam::directMappedPolyPatch::findSamples Pstream::listCombineGather(sampleCellProcs, maxEqOp