From 54b5b660231607c5c4647e2cc1d3eeee2425931d Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 7 Feb 2012 08:47:50 +0000 Subject: [PATCH] ENH: wallBoundedStreamLine: updated motorBike tutorial. --- .../field/nearWallFields/controlDict | 1 + .../field/nearWallFields/nearWallFields.C | 25 ++-- .../field/streamLine/streamLine.C | 131 +----------------- .../field/streamLine/streamLine.H | 7 +- .../field/streamLine/streamLineParticle.C | 51 +------ .../field/streamLine/streamLineParticle.H | 16 +-- .../wallBoundedStreamLine.C | 4 +- .../simpleFoam/motorBike/system/controlDict | 1 + .../motorBike/system/wallBoundedStreamLines | 96 +++++++++++++ 9 files changed, 122 insertions(+), 210 deletions(-) create mode 100644 tutorials/incompressible/simpleFoam/motorBike/system/wallBoundedStreamLines diff --git a/src/postProcessing/functionObjects/field/nearWallFields/controlDict b/src/postProcessing/functionObjects/field/nearWallFields/controlDict index 3c8d512f12..a4f7bec09c 100644 --- a/src/postProcessing/functionObjects/field/nearWallFields/controlDict +++ b/src/postProcessing/functionObjects/field/nearWallFields/controlDict @@ -59,6 +59,7 @@ functions // Fields to be sampled. Per field original name and mapped field to // create. + // Note: fields only get updated when writing! fields ( (p pNear) diff --git a/src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.C b/src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.C index d586dfba0c..ee8eb8e334 100644 --- a/src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.C +++ b/src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -121,6 +121,7 @@ void Foam::nearWallFields::read(const dictionary& dict) reverseFieldMap_.insert(sampleFldName, fldName); } + Info<< "Creating " << fieldMap_.size() << " fields" << endl; createFields(vsf_); createFields(vvf_); createFields(vSpheretf_); @@ -137,14 +138,14 @@ void Foam::nearWallFields::execute() Info<< "nearWallFields:execute()" << endl; } - if (active_) - { - sampleFields(vsf_); - sampleFields(vvf_); - sampleFields(vSpheretf_); - sampleFields(vSymmtf_); - sampleFields(vtf_); - } + //if (active_) + //{ + // sampleFields(vsf_); + // sampleFields(vvf_); + // sampleFields(vSpheretf_); + // sampleFields(vSymmtf_); + // sampleFields(vtf_); + //} } @@ -172,6 +173,12 @@ void Foam::nearWallFields::write() Info<< "Writing sampled fields to " << obr_.time().timeName() << endl; + sampleFields(vsf_); + sampleFields(vvf_); + sampleFields(vSpheretf_); + sampleFields(vSymmtf_); + sampleFields(vtf_); + // Write fields forAll(vsf_, i) { diff --git a/src/postProcessing/functionObjects/field/streamLine/streamLine.C b/src/postProcessing/functionObjects/field/streamLine/streamLine.C index ab815a8df8..13400cbcef 100644 --- a/src/postProcessing/functionObjects/field/streamLine/streamLine.C +++ b/src/postProcessing/functionObjects/field/streamLine/streamLine.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -292,119 +292,6 @@ void Foam::streamLine::track() } - //- For surface following: per face the normal to constrain the velocity - // with. - pointField patchNormals; - - - if (followSurface_) - { - // Determine geometric data on the non-constraint patches - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // - point normals - // - neighbouring cells - autoPtr boundaryPatch(wallPatch()); - - // Calculate parallel consistent normal (on boundaryPatch points only) - pointField boundaryNormals - ( - PatchTools::pointNormals - ( - mesh, - boundaryPatch(), - boundaryPatch().addressing() - ) - ); - // Make sure all points know about point normal. There might be points - // which are not on boundaryPatch() but coupled to points that are. - pointField pointNormals(mesh.nPoints(), vector::zero); - UIndirectList - ( - pointNormals, - boundaryPatch().meshPoints() - ) = boundaryNormals; - boundaryNormals.clear(); - - mesh.globalData().syncPointData - ( - pointNormals, - maxMagSqrEqOp(), - mapDistribute::transform() - ); - - // Calculate per-face a single constraint normal: - // - faces on patch: face-normal - // - faces on cell with point on patch: point-normal - // - rest: vector::zero - // - // Note: the disadvantage is that we can only handle faces with one - // point on the patch - otherwise we might pick up the wrong - // velocity. - - - - patchNormals.setSize(mesh.nFaces(), vector::zero); - label nPointNormals = 0; - - // 1. faces on patch - UIndirectList(patchNormals, boundaryPatch().addressing()) = - boundaryPatch().faceNormals(); - - // 2. faces with a point on the patch - forAll(mesh.faces(), faceI) - { - if (patchNormals[faceI] == vector::zero) - { - const face& f = mesh.faces()[faceI]; - forAll(f, fp) - { - label pointI = f[fp]; - if (pointNormals[pointI] != vector::zero) - { - patchNormals[faceI] = pointNormals[pointI]; - nPointNormals++; - } - } - } - } - - // 3. cells on faces with a point on the patch - forAll(mesh.points(), pointI) - { - if (pointNormals[pointI] != vector::zero) - { - const labelList& pCells = mesh.pointCells(pointI); - forAll(pCells, i) - { - const cell& cFaces = mesh.cells()[pCells[i]]; - forAll(cFaces, j) - { - label faceI = cFaces[j]; - - if (patchNormals[faceI] == vector::zero) - { - patchNormals[faceI] = pointNormals[pointI]; - nPointNormals++; - } - } - } - } - } - - Info<< type() << " : calculated constrained-tracking normals" << nl - << "Number of faces in mesh : " - << returnReduce(mesh.nFaces(), sumOp