From 3355c8d9eb2823c9420bfb3213a5394592e15329 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 25 Aug 2009 12:35:48 +0100 Subject: [PATCH] initial streamlines functionobject --- .../postProcessing/sampling/sample/sampleDict | 1 + bin/tools/CleanFunctions | 1 + .../functionObjects/field/Make/files | 6 + .../functionObjects/field/Make/options | 2 + .../fieldValues/cell/cellSourceTemplates.C | 17 +- .../field/streamLine/streamLine.C | 620 ++++++++++++++++++ .../field/streamLine/streamLine.H | 219 +++++++ .../streamLine/streamLineFunctionObject.C | 43 ++ .../streamLine/streamLineFunctionObject.H | 55 ++ .../field/streamLine/streamLineParticle.C | 479 ++++++++++++++ .../field/streamLine/streamLineParticle.H | 300 +++++++++ .../streamLine/streamLineParticleCloud.C | 79 +++ .../streamLine/streamLineParticleCloud.H | 105 +++ src/sampling/Make/files | 9 +- .../triSurfaceMeshPointSet.C | 177 +++++ .../triSurfaceMeshPointSet.H | 119 ++++ .../simpleFoam/pitzDaily/system/controlDict | 62 ++ 17 files changed, 2275 insertions(+), 19 deletions(-) create mode 100644 src/postProcessing/functionObjects/field/streamLine/streamLine.C create mode 100644 src/postProcessing/functionObjects/field/streamLine/streamLine.H create mode 100644 src/postProcessing/functionObjects/field/streamLine/streamLineFunctionObject.C create mode 100644 src/postProcessing/functionObjects/field/streamLine/streamLineFunctionObject.H create mode 100644 src/postProcessing/functionObjects/field/streamLine/streamLineParticle.C create mode 100644 src/postProcessing/functionObjects/field/streamLine/streamLineParticle.H create mode 100644 src/postProcessing/functionObjects/field/streamLine/streamLineParticleCloud.C create mode 100644 src/postProcessing/functionObjects/field/streamLine/streamLineParticleCloud.H create mode 100644 src/sampling/sampledSet/triSurfaceMeshPointSet/triSurfaceMeshPointSet.C create mode 100644 src/sampling/sampledSet/triSurfaceMeshPointSet/triSurfaceMeshPointSet.H diff --git a/applications/utilities/postProcessing/sampling/sample/sampleDict b/applications/utilities/postProcessing/sampling/sample/sampleDict index 4571c924df..9c288d7cbf 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleDict +++ b/applications/utilities/postProcessing/sampling/sample/sampleDict @@ -63,6 +63,7 @@ fields // curve specified points, not nessecary on line, uses // tracking // cloud specified points, uses findCell +// triSurfaceMeshPointSet points of triSurface // // axis: how to write point coordinate. Choice of // - x/y/z: x/y/z coordinate only diff --git a/bin/tools/CleanFunctions b/bin/tools/CleanFunctions index 4a2015febf..5e0ea64c5e 100644 --- a/bin/tools/CleanFunctions +++ b/bin/tools/CleanFunctions @@ -72,6 +72,7 @@ cleanCase () constant/{cellToRegion,cellLevel*,pointLevel*} \ constant/polyMesh/sets/ \ VTK \ + sets/streamLines \ > /dev/null 2>&1 for f in `find . -name "*Dict"` diff --git a/src/postProcessing/functionObjects/field/Make/files b/src/postProcessing/functionObjects/field/Make/files index 3766cb0ba8..e950e4d4d5 100644 --- a/src/postProcessing/functionObjects/field/Make/files +++ b/src/postProcessing/functionObjects/field/Make/files @@ -12,4 +12,10 @@ fieldValues/face/faceSourceFunctionObject.C fieldValues/cell/cellSource.C fieldValues/cell/cellSourceFunctionObject.C +streamLine/streamLine.C +streamLine/streamLineParticle.C +streamLine/streamLineParticleCloud.C +streamLine/streamLineFunctionObject.C + + LIB = $(FOAM_LIBBIN)/libfieldFunctionObjects diff --git a/src/postProcessing/functionObjects/field/Make/options b/src/postProcessing/functionObjects/field/Make/options index 5166bcc9e3..1e254fd4bb 100644 --- a/src/postProcessing/functionObjects/field/Make/options +++ b/src/postProcessing/functionObjects/field/Make/options @@ -1,9 +1,11 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude LIB_LIBS = \ -lfiniteVolume \ -lmeshTools \ + -llagrangian \ -lsampling diff --git a/src/postProcessing/functionObjects/field/fieldValues/cell/cellSourceTemplates.C b/src/postProcessing/functionObjects/field/fieldValues/cell/cellSourceTemplates.C index 0b6fa1ff03..fe495fcca6 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/cell/cellSourceTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldValues/cell/cellSourceTemplates.C @@ -46,11 +46,7 @@ bool Foam::fieldValues::cellSource::setFieldValues { const vf& field = obr_.lookupObject(fieldName); - forAll(values, i) - { - label cellI = cellId_[i]; - values[i] = field[cellI]; - } + values = UIndirectList(field, cellId_); return true; } @@ -158,16 +154,7 @@ Foam::tmp > Foam::fieldValues::cellSource::filterField const Field& field ) const { - tmp > tvalues(new Field(cellId_.size())); - Field& values = tvalues(); - - forAll(values, i) - { - label cellI = cellId_[i]; - values[i] = field[cellI]; - } - - return tvalues; + return tmp >(new Field(field, cellId_)); } diff --git a/src/postProcessing/functionObjects/field/streamLine/streamLine.C b/src/postProcessing/functionObjects/field/streamLine/streamLine.C new file mode 100644 index 0000000000..b82041966f --- /dev/null +++ b/src/postProcessing/functionObjects/field/streamLine/streamLine.C @@ -0,0 +1,620 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 "Pstream.H" +#include "functionObjectList.H" +#include "streamLine.H" +#include "fvMesh.H" +#include "streamLineParticleCloud.H" +#include "ReadFields.H" +#include "meshSearch.H" +#include "sampledSet.H" +#include "globalIndex.H" +#include "mapDistribute.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(Foam::streamLine, 0); + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::streamLine::track() +{ + const Time& runTime = const_cast(obr_.time()); + const fvMesh& mesh = dynamic_cast(obr_); + + IDLList initialParticles; + streamLineParticleCloud particles + ( + mesh, + cloudName_, + initialParticles + ); + + //Pout<< "Seeding particles." << endl; + + const sampledSet& seedPoints = sampledSetPtr_(); + forAll(seedPoints, i) + { + //Pout<< "Seeded particle at " << seedPoints[i] + // << " at cell:" << seedPoints.cells()[i] + // << endl; + + particles.addParticle + ( + new streamLineParticle + ( + particles, + seedPoints[i], + seedPoints.cells()[i], + lifeTime_ // lifetime + ) + ); + } + label nSeeds = returnReduce(particles.size(), sumOp