From adb9389846a5559318f52fe038a9455eee7484a8 Mon Sep 17 00:00:00 2001 From: graham Date: Fri, 16 Apr 2010 19:04:06 +0100 Subject: [PATCH] ENH: InteractionLists/CollisionModel. Referring wall data, creating referredWallFace class to hold patch information was well as face and pointField. --- .../basic/InteractionLists/InteractionLists.C | 101 ++++++++---- .../basic/InteractionLists/InteractionLists.H | 22 ++- .../InteractionLists/InteractionListsI.H | 10 +- .../referredWallFace/referredWallFace.C | 144 ++++++++++++++++++ .../referredWallFace/referredWallFace.H | 139 +++++++++++++++++ .../referredWallFace/referredWallFaceI.H | 54 +++++++ src/lagrangian/basic/Make/files | 1 + .../PairCollision/PairCollision.C | 10 +- .../WallModel/WallModel/WallModel.H | 2 +- .../WallSpringSliderDashpot.C | 56 +++---- .../WallSpringSliderDashpot.H | 14 +- 11 files changed, 487 insertions(+), 66 deletions(-) create mode 100644 src/lagrangian/basic/InteractionLists/referredWallFace/referredWallFace.C create mode 100644 src/lagrangian/basic/InteractionLists/referredWallFace/referredWallFace.H create mode 100644 src/lagrangian/basic/InteractionLists/referredWallFace/referredWallFaceI.H diff --git a/src/lagrangian/basic/InteractionLists/InteractionLists.C b/src/lagrangian/basic/InteractionLists/InteractionLists.C index a12e339258..1dcfed86c3 100644 --- a/src/lagrangian/basic/InteractionLists/InteractionLists.C +++ b/src/lagrangian/basic/InteractionLists/InteractionLists.C @@ -372,7 +372,8 @@ void Foam::InteractionLists::fillReferredParticleCloud() { forAll(referredParticles_, refCellI) { - const IDLList& refCell = referredParticles_[refCellI]; + const IDLList& refCell = + referredParticles_[refCellI]; forAllConstIter(typename IDLList, refCell, iter) { @@ -383,6 +384,43 @@ void Foam::InteractionLists::fillReferredParticleCloud() } +template +void Foam::InteractionLists::prepareWallDataToRefer() +{ + referredWallData_.setSize + ( + wallFaceIndexAndTransformToDistribute_.size() + ); + + const volVectorField& U = mesh_.lookupObject(UName_); + + forAll(referredWallData_, rWVI) + { + const labelPair& wfiat = wallFaceIndexAndTransformToDistribute_[rWVI]; + + label wallFaceIndex = globalTransforms_.index(wfiat); + + // const vector& transform = globalTransforms_.transform + // ( + // globalTransforms_.transformIndex(wfiat) + // ); + + label patchI = mesh_.boundaryMesh().patchID() + [ + wallFaceIndex - mesh_.nInternalFaces() + ]; + + label patchFaceI = + wallFaceIndex + - mesh_.boundaryMesh()[patchI].start(); + + // Need to transform velocity when tensor transforms are + // supported + referredWallData_[rWVI] = U.boundaryField()[patchI][patchFaceI]; + } +} + + template void Foam::InteractionLists::writeReferredWallFaces() const { @@ -394,27 +432,23 @@ void Foam::InteractionLists::writeReferredWallFaces() const forAll(referredWallFaces_, rWFI) { - const Tuple2& rwf = referredWallFaces_[rWFI]; + const referredWallFace& rwf = referredWallFaces_[rWFI]; - forAll(rwf.first(), fPtI) + forAll(rwf, fPtI) { - meshTools::writeOBJ - ( - str, - rwf.second()[rwf.first()[fPtI]] - ); + meshTools::writeOBJ(str, rwf.points()[rwf[fPtI]]); } str<< 'f'; - forAll(rwf.first(), fPtI) + forAll(rwf, fPtI) { str<< ' ' << fPtI + offset; } str<< nl; - offset += rwf.first().size(); + offset += rwf.size(); } } @@ -426,7 +460,8 @@ Foam::InteractionLists::InteractionLists ( const polyMesh& mesh, scalar maxDistance, - Switch writeCloud + Switch writeCloud, + const word& UName ) : mesh_(mesh), @@ -443,9 +478,12 @@ Foam::InteractionLists::InteractionLists cellIndexAndTransformToDistribute_(), wallFaceIndexAndTransformToDistribute_(), referredWallFaces_(), + UName_(UName), + referredWallData_(), referredParticles_() { - Info<< "Building InteractionLists" << endl; + Info<< "Building InteractionLists with interaction distance " + << maxDistance_ << endl; Random rndGen(419715); @@ -704,6 +742,10 @@ Foam::InteractionLists::InteractionLists // Determine which wall faces to refer + // The referring of wall patch data relies on patches having the same + // index on each processor. + mesh_.boundaryMesh().checkParallelSync(true); + // Determine the index of all of the wall faces on this processor DynamicList