From 092cb1949e048224db156dab9265bd0521bff110 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 18 May 2009 12:26:23 +0100 Subject: [PATCH] Updates from Graham: Bug fixes from: http://www.cfd-online.com/Forums/openfoam-bugs/64379-bugs-moleculedynamics-model.html http://www.cfd-online.com/Forums/openfoam-bugs/64383-fix-taking-reference-temporary-object-tetherpotentiallist-c.html --- .../moleculeCloudBuildDirectInteractionList.H | 4 +-- .../pairPotentialList/pairPotentialList.C | 42 +++++++++++----------- .../tetherPotentialList/tetherPotentialList.C | 19 +++++----- 3 files changed, 32 insertions(+), 33 deletions(-) diff --git a/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudBuildDirectInteractionList.H b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudBuildDirectInteractionList.H index c5f2d88..5ee8135 100644 --- a/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudBuildDirectInteractionList.H +++ b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudBuildDirectInteractionList.H @@ -10,8 +10,6 @@ forAll (mesh_.points(), p) const label cellO(mesh_.faceOwner()[f]); - const label cellN(mesh_.faceNeighbour()[f]); - forAll(pCells, pC) { const label cellI(pCells[pC]); @@ -37,6 +35,7 @@ forAll (mesh_.points(), p) if (mesh_.isInternalFace(f)) { // boundary faces will not have neighbour information + const label cellN(mesh_.faceNeighbour()[f]); if (cellN > cellI) { @@ -125,6 +124,7 @@ forAll (mesh_.edges(), edgeIIndex) } } + // label pointJIndex; // // forAll (mesh_.points(), pointIIndex) diff --git a/src/lagrangian/molecularDynamics/potential/pairPotential/pairPotentialList/pairPotentialList.C b/src/lagrangian/molecularDynamics/potential/pairPotential/pairPotentialList/pairPotentialList.C index da5c112..dbd2bb9 100644 --- a/src/lagrangian/molecularDynamics/potential/pairPotential/pairPotentialList/pairPotentialList.C +++ b/src/lagrangian/molecularDynamics/potential/pairPotential/pairPotentialList/pairPotentialList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -79,23 +79,23 @@ void Foam::pairPotentialList::readPairPotentialDict else { FatalErrorIn("pairPotentialList::buildPotentials") << nl - << "Pair pairPotential specification subDict " - << idA << "-" << idB << " or " - << idB << "-" << idA << " not found" - << nl << abort(FatalError); + << "Pair pairPotential specification subDict " + << idA << "-" << idB << " or " + << idB << "-" << idA << " not found" + << nl << abort(FatalError); } if ( - pairPotentialDict.found(idA+"-"+idB) - && pairPotentialDict.found(idB+"-"+idA) + pairPotentialDict.found(idA + "-" + idB) + && pairPotentialDict.found(idB + "-" + idA) ) { FatalErrorIn("pairPotentialList::buildPotentials") << nl - << "Pair pairPotential specification subDict " - << idA << "-" << idB << " and " - << idB << "-" << idA << " found multiple definition" - << nl << abort(FatalError); + << "Pair pairPotential specification subDict " + << idA << "-" << idB << " and " + << idB << "-" << idA << " found multiple definition" + << nl << abort(FatalError); } } @@ -146,6 +146,7 @@ Foam::pairPotentialList::pairPotentialList() idList_() {} + Foam::pairPotentialList::pairPotentialList ( const dictionary& idListDict, @@ -189,7 +190,7 @@ const Foam::pairPotential& Foam::pairPotentialList::pairPotentialFunction const label b ) const { - return (*this)[pairPotentialIndex (a, b)]; + return (*this)[pairPotentialIndex(a, b)]; } @@ -200,7 +201,7 @@ bool Foam::pairPotentialList::rCutSqr const scalar rIJMagSqr ) const { - if (rIJMagSqr <= rCutSqr (a, b)) + if (rIJMagSqr < rCutSqr(a, b)) { return true; } @@ -217,7 +218,7 @@ Foam::scalar Foam::pairPotentialList::rMin const label b ) const { - return (*this)[pairPotentialIndex (a, b)].rMin(); + return (*this)[pairPotentialIndex(a, b)].rMin(); } @@ -227,7 +228,7 @@ Foam::scalar Foam::pairPotentialList::dr const label b ) const { - return (*this)[pairPotentialIndex (a, b)].dr(); + return (*this)[pairPotentialIndex(a, b)].dr(); } @@ -237,7 +238,7 @@ Foam::scalar Foam::pairPotentialList::rCutSqr const label b ) const { - return (*this)[pairPotentialIndex (a, b)].rCutSqr(); + return (*this)[pairPotentialIndex(a, b)].rCutSqr(); } @@ -247,7 +248,7 @@ Foam::scalar Foam::pairPotentialList::rCut const label b ) const { - return (*this)[pairPotentialIndex (a, b)].rCut(); + return (*this)[pairPotentialIndex(a, b)].rCut(); } @@ -258,7 +259,7 @@ Foam::scalar Foam::pairPotentialList::force const scalar rIJMag ) const { - scalar f = (*this)[pairPotentialIndex (a, b)].forceLookup(rIJMag); + scalar f = (*this)[pairPotentialIndex(a, b)].forceLookup(rIJMag); return f; } @@ -271,11 +272,10 @@ Foam::scalar Foam::pairPotentialList::energy const scalar rIJMag ) const { - scalar e = (*this)[pairPotentialIndex (a, b)].energyLookup(rIJMag); + scalar e = (*this)[pairPotentialIndex(a, b)].energyLookup(rIJMag); return e; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// ************************************************************************* // +// ************************************************************************* // \ No newline at end of file diff --git a/src/lagrangian/molecularDynamics/potential/tetherPotential/tetherPotentialList/tetherPotentialList.C b/src/lagrangian/molecularDynamics/potential/tetherPotential/tetherPotentialList/tetherPotentialList.C index 1d5edf0..ac72791 100644 --- a/src/lagrangian/molecularDynamics/potential/tetherPotential/tetherPotentialList/tetherPotentialList.C +++ b/src/lagrangian/molecularDynamics/potential/tetherPotential/tetherPotentialList/tetherPotentialList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -58,9 +58,9 @@ void Foam::tetherPotentialList::readTetherPotentialDict if (!tetherPotentialDict.found(tetherPotentialName)) { FatalErrorIn("tetherPotentialList::readTetherPotentialDict") - << nl << "tether potential specification subDict " - << tetherPotentialName << " not found" - << abort(FatalError); + << "tether potential specification subDict " + << tetherPotentialName << " not found" << nl + << abort(FatalError); } this->set @@ -121,7 +121,7 @@ void Foam::tetherPotentialList::buildPotentials { setSize(tetherIds.size()); - const List& idList = List(idListDict.lookup("idList")); + List idList(idListDict.lookup("idList")); readTetherPotentialDict(tetherPotentialDict, idList, tetherIds); } @@ -132,7 +132,7 @@ const Foam::tetherPotential& Foam::tetherPotentialList::tetherPotentialFunction const label a ) const { - return (*this)[tetherPotentialIndex (a)]; + return (*this)[tetherPotentialIndex(a)]; } @@ -142,7 +142,7 @@ Foam::scalar Foam::tetherPotentialList::force const scalar rITMag ) const { - scalar f = (*this)[tetherPotentialIndex (a)].force(rITMag); + scalar f = (*this)[tetherPotentialIndex(a)].force(rITMag); return f; } @@ -154,11 +154,10 @@ Foam::scalar Foam::tetherPotentialList::energy const scalar rITMag ) const { - scalar e = (*this)[tetherPotentialIndex (a)].energy(rITMag); + scalar e = (*this)[tetherPotentialIndex(a)].energy(rITMag); return e; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// ************************************************************************* // +// ************************************************************************* // \ No newline at end of file -- 2.11.4.GIT