diff --git a/applications/utilities/preProcessing/molConfig/Make/files b/applications/utilities/preProcessing/molConfig/Make/files deleted file mode 100755 index 6501e68426960c755a310e7a12b7b53548ddeb98..0000000000000000000000000000000000000000 --- a/applications/utilities/preProcessing/molConfig/Make/files +++ /dev/null @@ -1,8 +0,0 @@ -latticeStructures = latticeStructures -velocityDistributions = velocityDistributions - -createMolecules.C -molConfig.C -genMolConfig.C - -EXE = $(FOAM_APPBIN)/molConfig diff --git a/applications/utilities/preProcessing/molConfig/Make/options b/applications/utilities/preProcessing/molConfig/Make/options deleted file mode 100755 index 196a4d66ddba259f0d7547f781a9c925db63b0eb..0000000000000000000000000000000000000000 --- a/applications/utilities/preProcessing/molConfig/Make/options +++ /dev/null @@ -1,15 +0,0 @@ -EXE_INC = \ - -I$(latticeStructures) \ - -I$(velocityDistributions) \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/dynamicMesh/lnInclude \ - -I$(LIB_SRC)/lagrangian/molecule/lnInclude \ - -I$(LIB_SRC)/lagrangian/basic/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude - -EXE_LIBS = \ - -lmeshTools \ - -ldynamicMesh \ - -lfiniteVolume \ - -llagrangian \ - -lmolecule diff --git a/applications/utilities/preProcessing/molConfig/correctVelocities.H b/applications/utilities/preProcessing/molConfig/correctVelocities.H deleted file mode 100644 index 0c69f15c7cda7cff0fa4387196c1dbea09c096e1..0000000000000000000000000000000000000000 --- a/applications/utilities/preProcessing/molConfig/correctVelocities.H +++ /dev/null @@ -1,21 +0,0 @@ -for (molN = totalMols; molN < totalMols + totalZoneMols; molN++) -{ - - // Remove bulk momentum introduced by random numbers and add - // desired bulk velocity - - // For systems with molecules of significantly differing masses, this may - // need to be an iterative process or employ a better algorithm for - // removing an appropriate share of the excess momentum from each molecule. - - initialVelocities(molN) += bulkVelocity - momentumSum/totalZoneMols/mass; -} - -// momentumSum = vector::zero; -// -// for (molN = totalMols; molN < totalMols + totalZoneMols; molN++) -// { -// momentumSum += mass*initialVelocities(molN); -// } -// -// Info << "Check momentum adjustment: " << momentumSum << endl; diff --git a/applications/utilities/preProcessing/molConfig/createMolecules.C b/applications/utilities/preProcessing/molConfig/createMolecules.C deleted file mode 100644 index 20318f06d666c6979d2f875b2f82381baa892097..0000000000000000000000000000000000000000 --- a/applications/utilities/preProcessing/molConfig/createMolecules.C +++ /dev/null @@ -1,253 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "molConfig.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -void Foam::molConfig::createMolecules() -{ - Info<< nl << "Creating molecules from zone specifications\n" << endl; - - DynamicList<vector> initialPositions(0); - - DynamicList<label> initialIds(0); - - DynamicList<scalar> initialMasses(0); - - DynamicList<label> initialCelli(0); - - DynamicList<vector> initialVelocities(0); - - DynamicList<vector> initialAccelerations(0); - - DynamicList<label> initialTethered(0); - - DynamicList<vector> initialTetherPositions(0); - - label totalMols = 0; - - label idAssign; - - Random rand(clock::getTime()); - -// * * * * * * * * Building the IdList * * * * * * * * * // - -//Notes: - each processor will have an identical idList_. -// - The order of id's inside the idList_ depends on the order -// of subDicts inside the molConigDict. - - Info<< "Building the idList: " ; - - forAll(molConfigDescription_.toc(), cZs) - { - word subDictName (molConfigDescription_.toc()[cZs]); - - word iD (molConfigDescription_.subDict(subDictName).lookup("id")); - - if (findIndex(idList_,iD) == -1) - { - idList_.append(iD); - } - } - - forAll(idList_, i) - { - Info << " " << idList_[i]; - } - - Info << nl << endl; - -// * * * * * * * * Filling the Mesh * * * * * * * * * // - - const cellZoneMesh& cellZoneI = mesh_.cellZones(); - - if (cellZoneI.size()) - { - Info<< "Filling the zones with molecules." << nl << endl; - } - else - { - FatalErrorIn("void createMolecules()\n") - << "No cellZones found in mesh description." - << abort(FatalError); - } - - forAll (cellZoneI, cZ) - { - if (cellZoneI[cZ].size()) - { - if (!molConfigDescription_.found(cellZoneI[cZ].name())) - { - Info << "Zone specification subDictionary: " - << cellZoneI[cZ].name() << " not found." << endl; - } - else - { - label n = 0; - - label totalZoneMols = 0; - - label molsPlacedThisIteration; - -# include "readZoneSubDict.H" - - idAssign = findIndex(idList_,id); - -# include "startingPoint.H" - - // Continue trying to place molecules as long as at - // least one molecule is placed in each iteration. - // The "|| totalZoneMols == 0" condition means that the - // algorithm will continue if the origin is outside the - // zone - it will cause an infinite loop if no molecules - // are ever placed by the algorithm. - - if (latticeStructure != "empty") - { - - while - ( - molsPlacedThisIteration != 0 - || totalZoneMols == 0 - ) - { - molsPlacedThisIteration = 0; - - bool partOfLayerInBounds = false; - -# include "createPositions.H" - - if - ( - totalZoneMols == 0 - && !partOfLayerInBounds - ) - { - WarningIn("molConfig::createMolecules()") - << "A whole layer of unit cells was placed " - << "outside the bounds of the mesh, but no " - << "molecules have been placed in zone '" - << cellZoneI[cZ].name() - << "'. This is likely to be because the zone " - << "has few cells (" - << cellZoneI[cZ].size() - << " in this case) and no lattice position " - << "fell inside them. " - << "Aborting filling this zone." - << endl; - - break; - } - - totalZoneMols += molsPlacedThisIteration; - - n++; - } - - label molN; - - for - ( - molN = totalMols; - molN < totalMols + totalZoneMols; - molN++ - ) - { - initialIds.append(idAssign); - - initialMasses.append(mass); - - initialAccelerations.append(vector::zero); - - if (tethered) - { - initialTethered.append(1); - - initialTetherPositions.append - ( - initialPositions[molN] - ); - } - - else - { - initialTethered.append(0); - - initialTetherPositions.append(vector::zero); - } - } - -# include "createVelocities.H" - -# include "correctVelocities.H" - - } - - totalMols += totalZoneMols; - } - } - } - - idList_.shrink(); - - positions_ = initialPositions; - - positions_.setSize(initialPositions.size()); - - id_ = initialIds; - - id_.setSize(initialIds.size()); - - mass_ = initialMasses; - - mass_.setSize(initialMasses.size()); - - cells_ = initialCelli; - - cells_.setSize(initialCelli.size()); - - U_ = initialVelocities; - - U_.setSize(initialVelocities.size()); - - A_ = initialAccelerations; - - A_.setSize(initialAccelerations.size()); - - tethered_ = initialTethered; - - tethered_.setSize(initialTethered.size()); - - tetherPositions_ = initialTetherPositions; - - tetherPositions_.setSize(initialTetherPositions.size()); - - nMol_ = totalMols; -} - - -// ************************************************************************* // diff --git a/applications/utilities/preProcessing/molConfig/createPositions.H b/applications/utilities/preProcessing/molConfig/createPositions.H deleted file mode 100644 index b26486338caf7228188244aac4e989fb9380cb0d..0000000000000000000000000000000000000000 --- a/applications/utilities/preProcessing/molConfig/createPositions.H +++ /dev/null @@ -1,26 +0,0 @@ -vector latticePosition; - -vector globalPosition; - -if (latticeStructure == "SC") -{ -# include "SC.H" -} - -else if (latticeStructure == "FCC") -{ -# include "FCC.H" -} - -else if (latticeStructure == "BCC") -{ -# include "BCC.H" -} - -else -{ - FatalErrorIn("createPositions.H\n") - << "latticeStructure " << latticeStructure - << " not supported." - << abort(FatalError); -} diff --git a/applications/utilities/preProcessing/molConfig/createVelocities.H b/applications/utilities/preProcessing/molConfig/createVelocities.H deleted file mode 100644 index d014ffd146044db0be9307b511e793ee490f0464..0000000000000000000000000000000000000000 --- a/applications/utilities/preProcessing/molConfig/createVelocities.H +++ /dev/null @@ -1,13 +0,0 @@ -vector velocity; - -vector momentumSum = vector::zero; - -if (velocityDistribution == "uniform") -{ -# include "uniform.H" -} - -if (velocityDistribution == "maxwellian") -{ -# include "maxwellian.H" -} diff --git a/applications/utilities/preProcessing/molConfig/genMolConfig.C b/applications/utilities/preProcessing/molConfig/genMolConfig.C deleted file mode 100644 index 91bc5c8d246b6553d2e007f1547d79ce88d877ce..0000000000000000000000000000000000000000 --- a/applications/utilities/preProcessing/molConfig/genMolConfig.C +++ /dev/null @@ -1,129 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "molConfig.H" -#include "fvCFD.H" - -using namespace Foam; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Main program: - -int main(int argc, char *argv[]) -{ -# include "setRootCase.H" -# include "createTime.H" -# include "createMesh.H" - - Info<< nl << "Reading molecular configuration description dictionary" - << endl; - - IOobject molConfigDescriptionIOobject - ( - "molConfigDict", - runTime.system(), - runTime, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ); - - if (!molConfigDescriptionIOobject.headerOk()) - { - FatalErrorIn(args.executable()) - << "Cannot find molConfig description file " << nl - << args.caseName()/runTime.system()/"molConfig"/"molConfigDict" - << nl << exit(FatalError); - } - - IOdictionary molConfigDescription(molConfigDescriptionIOobject); - - - // Create molCloud, registering object with mesh - - Info<< nl << "Creating molecular configuration" << endl; - - molConfig molecules(molConfigDescription, mesh); - - label totalMolecules = molecules.nMol(); - - if (Pstream::parRun()) - { - reduce(totalMolecules, sumOp<label>()); - } - - Info<< nl << "Total number of molecules added: " << totalMolecules - << nl << endl; - - moleculeCloud molCloud - ( - mesh, - molecules.nMol(), - molecules.id(), - molecules.mass(), - molecules.positions(), - molecules.cells(), - molecules.U(), - molecules.A(), - molecules.tethered(), - molecules.tetherPositions() - ); - - IOdictionary idListDict - ( - IOobject - ( - "idList", - mesh.time().constant(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ) - ); - - idListDict.add("idList", molecules.molIdList()); - - IOstream::defaultPrecision(12); - - Info << nl << "Writing molecular configuration" << endl; - - if (!mesh.write()) - { - FatalErrorIn(args.executable()) - << "Failed writing moleculeCloud." - << nl << exit(FatalError); - } - - Info<< nl << "ClockTime = " << runTime.elapsedClockTime() << " s" - << nl << endl; - - Info << nl << "End\n" << endl; - - return 0; -} - - -// ************************************************************************* // diff --git a/applications/utilities/preProcessing/molConfig/latticeStructures/BCC.H b/applications/utilities/preProcessing/molConfig/latticeStructures/BCC.H deleted file mode 100644 index cd3cbdf100ba1c7fcafecca68e2c730ebfc2b97c..0000000000000000000000000000000000000000 --- a/applications/utilities/preProcessing/molConfig/latticeStructures/BCC.H +++ /dev/null @@ -1,179 +0,0 @@ -labelVector iN(0,0,0); - -vector gap = (vector::one)*pow((numberDensity/2.0),-(1.0/3.0)); - -#include "origin.H" - -// Info<< "gap = " << gap << endl; - -// Special treatment is required for the first position, i.e. iteration zero. - -if (n == 0) -{ - latticePosition.x() = (iN.x()*gap.x()); - - latticePosition.y() = (iN.y()*gap.y()); - - latticePosition.z() = (iN.z()*gap.z()); - - // Placing 2 molecules in each unit cell, using the algorithm from - // D. Rapaport, The Art of Molecular Dynamics Simulation, 2nd Ed, p68 - - for (label iU = 0; iU < 2; iU++) - { - vector unitCellLatticePosition = latticePosition; - - if (iU == 1) - { - unitCellLatticePosition += 0.5 * gap; - } - - if (originSpecifies == "corner") - { - unitCellLatticePosition -= 0.25*gap; - } - -// Info << nl << n << ", " << unitCellLatticePosition; - - globalPosition = - origin + transform(latticeToGlobal,unitCellLatticePosition); - - partOfLayerInBounds = mesh_.bounds().contains(globalPosition); - - if - ( - findIndex(mesh_.cellZones()[cZ], mesh_.findCell(globalPosition)) - != -1 - ) - { - molsPlacedThisIteration++; - - initialPositions.append(globalPosition); - - initialCelli.append(mesh_.findCell(globalPosition)); - } - } -} -else -{ - // Place top and bottom caps. - - for (iN.z() = -n; iN.z() <= n; iN.z() += 2*n) - { - for (iN.y() = -n; iN.y() <= n; iN.y()++) - { - for (iN.x() = -n; iN.x() <= n; iN.x()++) - { - latticePosition.x() = (iN.x() * gap.x()); - - latticePosition.y() = (iN.y() * gap.y()); - - latticePosition.z() = (iN.z() * gap.z()); - - for (label iU = 0; iU < 2; iU++) - { - vector unitCellLatticePosition = latticePosition; - - if (iU == 1) - { - unitCellLatticePosition += 0.5*gap; - } - - if(originSpecifies == "corner") - { - unitCellLatticePosition -= 0.25*gap; - } - -// Info << nl << iN << ", " << unitCellLatticePosition; - - globalPosition = - origin - + transform(latticeToGlobal,unitCellLatticePosition); - - partOfLayerInBounds = - mesh_.bounds().contains(globalPosition); - - if - ( - findIndex - ( - mesh_.cellZones()[cZ], - mesh_.findCell(globalPosition) - ) - != -1) - { - molsPlacedThisIteration++; - - initialPositions.append(globalPosition); - - initialCelli.append(mesh_.findCell(globalPosition)); - } - } - } - } - } - -// Placing sides - - for (iN.z() = -(n-1); iN.z() <= (n-1); iN.z()++) - { - for (label iR = 0; iR <= 2*n -1; iR++) - { - latticePosition.x() = (n*gap.x()); - - latticePosition.y() = ((-n + (iR + 1))*gap.y()); - - latticePosition.z() = (iN.z() * gap.z()); - - for (label iK = 0; iK < 4; iK++) - { - for (label iU = 0; iU < 2; iU++) - { - vector unitCellLatticePosition = latticePosition; - - if (iU == 1) - { - unitCellLatticePosition += 0.5 * gap; - } - - if (originSpecifies == "corner") - { - unitCellLatticePosition -= 0.25*gap; - } - - globalPosition = - origin - + transform(latticeToGlobal,unitCellLatticePosition); - - partOfLayerInBounds = - mesh_.bounds().contains(globalPosition); - - if - ( - findIndex - ( - mesh_.cellZones()[cZ], - mesh_.findCell(globalPosition) - ) - != -1 - ) - { - molsPlacedThisIteration++; - - initialPositions.append(globalPosition); - - initialCelli.append(mesh_.findCell(globalPosition)); - } - } - - latticePosition = - vector - ( - - latticePosition.y(), - latticePosition.x(), - latticePosition.z() - ); - } - } - } -} diff --git a/applications/utilities/preProcessing/molConfig/latticeStructures/FCC.H b/applications/utilities/preProcessing/molConfig/latticeStructures/FCC.H deleted file mode 100644 index 313ebf96cb89bf2b1111b45fe1de462133fb5197..0000000000000000000000000000000000000000 --- a/applications/utilities/preProcessing/molConfig/latticeStructures/FCC.H +++ /dev/null @@ -1,217 +0,0 @@ -labelVector iN(0,0,0); - -vector gap = (vector::one)*pow((numberDensity/4.0),-(1.0/3.0)); - -#include "origin.H" - -// Info<< "gap = " << gap << endl; - -// Special treatment is required for the first position, i.e. iteration zero. - -if (n == 0) -{ - latticePosition.x() = (iN.x() * gap.x()); - - latticePosition.y() = (iN.y() * gap.y()); - - latticePosition.z() = (iN.z() * gap.z()); - - // Placing 4 molecules in each unit cell, using the algorithm from - // D. Rapaport, The Art of Molecular Dynamics Simulation, 2nd Ed, p68 - - for (label iU = 0; iU < 4; iU++) - { - vector unitCellLatticePosition = latticePosition; - - if (iU != 3) - { - if (iU != 0) - { - unitCellLatticePosition.x() += 0.5 * gap.x(); - } - - if (iU != 1) - { - unitCellLatticePosition.y() += 0.5 * gap.y(); - } - - if (iU != 2) - { - unitCellLatticePosition.z() += 0.5 * gap.z(); - } - } - - if (originSpecifies == "corner") - { - unitCellLatticePosition -= 0.25*gap; - } - -// Info << nl << n << ", " << unitCellLatticePosition; - - globalPosition = - origin + transform(latticeToGlobal,unitCellLatticePosition); - - partOfLayerInBounds = mesh_.bounds().contains(globalPosition); - - if - ( - findIndex(mesh_.cellZones()[cZ], mesh_.findCell(globalPosition)) - != -1 - ) - { - molsPlacedThisIteration++; - - initialPositions.append(globalPosition); - - initialCelli.append(mesh_.findCell(globalPosition)); - } - } -} -else -{ - // Place top and bottom caps. - - for (iN.z() = -n; iN.z() <= n; iN.z() += 2*n) - { - for (iN.y() = -n; iN.y() <= n; iN.y()++) - { - for (iN.x() = -n; iN.x() <= n; iN.x()++) - { - latticePosition.x() = (iN.x() * gap.x()); - - latticePosition.y() = (iN.y() * gap.y()); - - latticePosition.z() = (iN.z() * gap.z()); - - for (label iU = 0; iU < 4; iU++) - { - vector unitCellLatticePosition = latticePosition; - - if (iU != 3) - { - if (iU != 0) - { - unitCellLatticePosition.x() += 0.5 * gap.x(); - } - - if (iU != 1) - { - unitCellLatticePosition.y() += 0.5 * gap.y(); - } - - if (iU != 2) - { - unitCellLatticePosition.z() += 0.5 * gap.z(); - } - } - - if (originSpecifies == "corner") - { - unitCellLatticePosition -= 0.25*gap; - } - - globalPosition = - origin - + transform(latticeToGlobal,unitCellLatticePosition); - - partOfLayerInBounds = - mesh_.bounds().contains(globalPosition); - - if - ( - findIndex - ( - mesh_.cellZones()[cZ], - mesh_.findCell(globalPosition) - ) - != -1 - ) - { - molsPlacedThisIteration++; - - initialPositions.append(globalPosition); - - initialCelli.append(mesh_.findCell(globalPosition)); - } - } - } - } - } - -// Placing sides - - for (iN.z() = -(n-1); iN.z() <= (n-1); iN.z()++) - { - for (label iR = 0; iR <= 2*n -1; iR++) - { - latticePosition.x() = (n * gap.x()); - - latticePosition.y() = ((-n + (iR + 1)) * gap.y()); - - latticePosition.z() = (iN.z() * gap.z()); - - for (label iK = 0; iK < 4; iK++) - { - for (label iU = 0; iU < 4; iU++) - { - vector unitCellLatticePosition = latticePosition; - - if (iU != 3) - { - if (iU != 0) - { - unitCellLatticePosition.x() += 0.5 * gap.x(); - } - - if (iU != 1) - { - unitCellLatticePosition.y() += 0.5 * gap.y(); - } - - if (iU != 2) - { - unitCellLatticePosition.z() += 0.5 * gap.z(); - } - } - - if (originSpecifies == "corner") - { - unitCellLatticePosition -= 0.25*gap; - } - - globalPosition = - origin - + transform(latticeToGlobal,unitCellLatticePosition); - - partOfLayerInBounds = - mesh_.bounds().contains(globalPosition); - - if - ( - findIndex - ( - mesh_.cellZones()[cZ], - mesh_.findCell(globalPosition) - ) - != -1 - ) - { - molsPlacedThisIteration++; - - initialPositions.append(globalPosition); - - initialCelli.append(mesh_.findCell(globalPosition)); - } - } - - latticePosition = - vector - ( - - latticePosition.y(), - latticePosition.x(), - latticePosition.z() - ); - } - } - } -} diff --git a/applications/utilities/preProcessing/molConfig/latticeStructures/SC.H b/applications/utilities/preProcessing/molConfig/latticeStructures/SC.H deleted file mode 100644 index dd0ff7c00f67453884b5693ed32003566f90b1b0..0000000000000000000000000000000000000000 --- a/applications/utilities/preProcessing/molConfig/latticeStructures/SC.H +++ /dev/null @@ -1,127 +0,0 @@ -labelVector iN(0,0,0); - -vector gap = (vector::one)*pow(numberDensity, -(1.0/3.0)); - -#include "origin.H" - -// Info<< "gap = " << gap << endl; - -// Special treatment is required for the first position, i.e. iteration zero. - -if (n == 0) -{ - latticePosition = vector::zero; - - if (originSpecifies == "corner") - { - latticePosition += 0.5*gap; - } - - globalPosition = origin + transform(latticeToGlobal,latticePosition); - - partOfLayerInBounds = mesh_.bounds().contains(globalPosition); - - if (findIndex(mesh_.cellZones()[cZ], mesh_.findCell(globalPosition)) != -1) - { - molsPlacedThisIteration++; - - initialPositions.append(globalPosition); - - initialCelli.append(mesh_.findCell(globalPosition)); - } -} -else -{ - for (iN.z() = -n; iN.z() <= n; iN.z() += 2*n) - { - for (iN.y() = -n; iN.y() <= n; iN.y()++) - { - for (iN.x() = -n; iN.x() <= n; iN.x()++) - { - latticePosition.x() = (iN.x() * gap.x()); - - latticePosition.y() = (iN.y() * gap.y()); - - latticePosition.z() = (iN.z() * gap.z()); - - if (originSpecifies == "corner") - { - latticePosition += 0.5*gap; - } - - globalPosition = - origin + transform(latticeToGlobal,latticePosition); - - partOfLayerInBounds = mesh_.bounds().contains(globalPosition); - - if - ( - findIndex - ( - mesh_.cellZones()[cZ], - mesh_.findCell(globalPosition) - ) - != -1 - ) - { - molsPlacedThisIteration++; - - initialPositions.append(globalPosition); - - initialCelli.append(mesh_.findCell(globalPosition)); - } - } - } - } - - tensor quarterRotate(EulerCoordinateRotation(-90, 0, 0, true).R()); - - iN.x() = n; - for (iN.z() = -(n-1); iN.z() <= (n-1); iN.z()++) - { - for (iN.y() = -(n-1); iN.y() <= n; iN.y()++) - { - latticePosition.x() = (iN.x()*gap.x()); - - latticePosition.y() = (iN.y()*gap.y()); - - latticePosition.z() = (iN.z()*gap.z()); - - for (label iR = 0; iR < 4; iR++) - { - vector offsetCorrectedLatticePosition = latticePosition; - - if (originSpecifies == "corner") - { - offsetCorrectedLatticePosition += 0.5*gap; - } - - globalPosition = - origin - + transform(latticeToGlobal,offsetCorrectedLatticePosition); - - partOfLayerInBounds = mesh_.bounds().contains(globalPosition); - - if - ( - findIndex - ( - mesh_.cellZones()[cZ], - mesh_.findCell(globalPosition) - ) - != -1 - ) - { - molsPlacedThisIteration++; - - initialPositions.append(globalPosition); - - initialCelli.append(mesh_.findCell(globalPosition)); - } - - latticePosition = transform(quarterRotate,latticePosition); - } - } - } -} - diff --git a/applications/utilities/preProcessing/molConfig/molConfig.C b/applications/utilities/preProcessing/molConfig/molConfig.C deleted file mode 100644 index e837346b9796761bd887d51fe20a95442a1a9882..0000000000000000000000000000000000000000 --- a/applications/utilities/preProcessing/molConfig/molConfig.C +++ /dev/null @@ -1,50 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "molConfig.H" - -// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * // - -Foam::molConfig::molConfig -( - IOdictionary& molConfigDescription, - const polyMesh& mesh -) -: - molConfigDescription_(molConfigDescription), - mesh_(mesh) -{ - createMolecules(); -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::molConfig::~molConfig() -{} - - -// ************************************************************************* // diff --git a/applications/utilities/preProcessing/molConfig/molConfig.H b/applications/utilities/preProcessing/molConfig/molConfig.H deleted file mode 100644 index a9d549da12cbaadb570dd633afec17e1e1f4c7cb..0000000000000000000000000000000000000000 --- a/applications/utilities/preProcessing/molConfig/molConfig.H +++ /dev/null @@ -1,147 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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::molConfig - -Description - -SourceFiles - molConfigI.H - molConfig.C - molConfigIO.C - -\*---------------------------------------------------------------------------*/ - -#ifndef molConfig_H -#define molConfig_H - -#include "labelVector.H" -#include "scalar.H" -#include "vector.H" -#include "labelField.H" -#include "scalarField.H" -#include "vectorField.H" -#include "IOField.H" -#include "EulerCoordinateRotation.H" -#include "Random.H" - -#include "Time.H" -#include "IOdictionary.H" -#include "IOstreams.H" -#include "moleculeCloud.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class molConfig Declaration -\*---------------------------------------------------------------------------*/ - -class molConfig -{ - // Private data - - const IOdictionary& molConfigDescription_; - - const polyMesh& mesh_; - - DynamicList<word> idList_; - - labelField id_; - - scalarField mass_; - - vectorField positions_; - - labelField cells_; - - vectorField U_; - - vectorField A_; - - labelField tethered_; - - vectorField tetherPositions_; - - label nMol_; - - -public: - - // Constructors - - //- Construct from IOdictionary and mesh - molConfig(IOdictionary&, const polyMesh&); - - - // Destructor - - ~molConfig(); - - - // Member Functions - - void createMolecules(); - - - // Access - - inline const List<word>& molIdList() const; - - inline const labelField& id() const; - - inline const scalarField& mass() const; - - inline const vectorField& positions() const; - - inline const labelField& cells() const; - - inline const vectorField& U() const; - - inline const vectorField& A() const; - - inline const labelField& tethered() const; - - inline const vectorField& tetherPositions() const; - - inline label nMol() const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "molConfigI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/preProcessing/molConfig/molConfigI.H b/applications/utilities/preProcessing/molConfig/molConfigI.H deleted file mode 100644 index b85a656c03a5abb0c56ca0ac0e9cf487ea08edbc..0000000000000000000000000000000000000000 --- a/applications/utilities/preProcessing/molConfig/molConfigI.H +++ /dev/null @@ -1,98 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 - -\*---------------------------------------------------------------------------*/ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -inline const List<word>& molConfig::molIdList() const -{ - return idList_; -} - - -inline const labelField& molConfig::id() const -{ - return id_; -} - - -inline const scalarField& molConfig::mass() const -{ - return mass_; -} - - -inline const vectorField& molConfig::positions() const -{ - return positions_; -} - - -inline const labelField& molConfig::cells() const -{ - return cells_; -} - - -inline const vectorField& molConfig::U() const -{ - return U_; -} - - -inline const vectorField& molConfig::A() const -{ - return A_; -} - - -inline const labelField& molConfig::tethered() const -{ - return tethered_; -} - - -inline const vectorField& molConfig::tetherPositions() const -{ - return tetherPositions_; -} - - -inline label molConfig::nMol() const -{ - return nMol_; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/applications/utilities/preProcessing/molConfig/origin.H b/applications/utilities/preProcessing/molConfig/origin.H deleted file mode 100644 index 24bc994d34fe8eaee58b7c77a71613d1bf8bc004..0000000000000000000000000000000000000000 --- a/applications/utilities/preProcessing/molConfig/origin.H +++ /dev/null @@ -1,49 +0,0 @@ -// Please refer to notes - -// 1. Determine the unit cell dimensions: xU, yU and zU - -const scalar xU = gap.x(); -const scalar yU = gap.y(); -const scalar zU = gap.z(); - -// 2. Determine the anchorPoint co-ordinates: xA, yA and zA - -const scalar xA = anchorPoint.x(); -const scalar yA = anchorPoint.y(); -const scalar zA = anchorPoint.z(); - -// 3. Determine the vector rAB from global co-ordinate system: - -const vector rAB((xMid - xA), (yMid - yA), (zMid - zA)); - -// 4. Transform vector rAS into lattice co-ordinate system: - -const vector rASTransf = transform(latticeToGlobal.T(), rAB); - -// Info << "The vector rAS = " << rAS << endl; -// Info << "The vector rAStransf = " << rAStransf << endl; - -// 5. Calculate the integer values: ni, nj and nk -scalar nIscalar = rASTransf.x()/xU; -scalar nJscalar = rASTransf.y()/yU; -scalar nKscalar = rASTransf.z()/zU; - -// Info << "The nI, nJ, nK values before are: " << nIscalar <<" "<< nJscalar <<" "<< nKscalar << endl; - -label nI = label(nIscalar + 0.5*sign(nIscalar)); -label nJ = label(nJscalar + 0.5*sign(nJscalar)); -label nK = label(nKscalar + 0.5*sign(nKscalar)); - -// Info << "The nI, nJ, nK values after are: " << nI <<" "<< nJ <<" "<< nK << endl; - -// 6. Calculate the corrected starting point, rAC (in the lattice co-ordinate system): -const vector rAC((nI*xU), (nJ*yU), (nK*zU)); - -// 7. Transform the corrected starting point in the global co-ordinate system, rC: -const vector rC = anchorPoint + transform(latticeToGlobal, rAC); - - -const vector& origin = rC; - -// Pout << "The Corrected Starting Point: " << origin << endl; - diff --git a/applications/utilities/preProcessing/molConfig/readZoneSubDict.H b/applications/utilities/preProcessing/molConfig/readZoneSubDict.H deleted file mode 100644 index 72705c761e2650f4ec4f7faa72078235e1f288df..0000000000000000000000000000000000000000 --- a/applications/utilities/preProcessing/molConfig/readZoneSubDict.H +++ /dev/null @@ -1,93 +0,0 @@ - -// Info << "Zone description subDict " << cZ <<": " << cellZoneI[cZ].name() << endl; - -const dictionary& subDictI = - molConfigDescription_.subDict(cellZoneI[cZ].name()); - -const scalar temperature(readScalar(subDictI.lookup("temperature"))); - -const word velocityDistribution(subDictI.lookup("velocityDistribution")); - -const vector bulkVelocity(subDictI.lookup("bulkVelocity")); - -const word id(subDictI.lookup("id")); - -const scalar mass(readScalar(subDictI.lookup("mass"))); - -scalar numberDensity_read(0.0); - -if (subDictI.found("numberDensity")) -{ - numberDensity_read = readScalar(subDictI.lookup("numberDensity")); -} -else if (subDictI.found("massDensity")) -{ - numberDensity_read = readScalar(subDictI.lookup("massDensity"))/mass; -} -else -{ - FatalErrorIn("readZoneSubDict.H\n") - << "massDensity or numberDensity not specified " << nl - << abort(FatalError); -} - -const scalar numberDensity(numberDensity_read); - -const word latticeStructure(subDictI.lookup("latticeStructure")); - -const vector anchorPoint(subDictI.lookup("anchor")); - -const word originSpecifies(subDictI.lookup("anchorSpecifies")); - -if -( - originSpecifies != "corner" - && originSpecifies != "molecule" -) -{ - FatalErrorIn("readZoneSubDict.H\n") - << "anchorSpecifies must be either 'corner' or 'molecule', found " - << originSpecifies << nl - << abort(FatalError); -} - -bool tethered = false; - -if (subDictI.found("tethered")) -{ - tethered = Switch(subDictI.lookup("tethered")); -} - -const vector orientationAngles(subDictI.lookup("orientationAngles")); - -scalar phi(orientationAngles.x()*mathematicalConstant::pi/180.0); -scalar theta(orientationAngles.y()*mathematicalConstant::pi/180.0); -scalar psi(orientationAngles.z()*mathematicalConstant::pi/180.0); - -const tensor latticeToGlobal -( - cos(psi)*cos(phi) - cos(theta)*sin(phi)*sin(psi), - cos(psi)*sin(phi) + cos(theta)*cos(phi)*sin(psi), - sin(psi)*sin(theta), - - sin(psi)*cos(phi) - cos(theta)*sin(phi)*cos(psi), - - sin(psi)*sin(phi) + cos(theta)*cos(phi)*cos(psi), - cos(psi)*sin(theta), - sin(theta)*sin(phi), - - sin(theta)*cos(phi), - cos(theta) -); - -// Info << "\tcells: " << cellZoneI[cZ].size() << endl; -// Info << "\tnumberDensity: " << numberDensity << endl; -// Info << "\ttemperature: " << temperature << endl; -// Info << "\tvelocityDistribution: " << velocityDistribution << endl; -// Info << "\tbulkVelocity: " << bulkVelocity << endl; -// Info << "\tid: " << id << endl; -// Info << "\tmass: " << mass << endl; -// Info << "\tlatticeStructure: " << latticeStructure << endl; -// Info << "\tanchor: " << anchorPoint << endl; -// Info << "\toriginSpecifies: " << originSpecifies << endl; -// Info << "\ttethered: " << tethered << endl; -// Info << "\torientationAngles: " << orientationAngles << endl; -// Info << "\tlatticeToGlobal: " << latticeToGlobal << endl; - diff --git a/applications/utilities/preProcessing/molConfig/startingPoint.H b/applications/utilities/preProcessing/molConfig/startingPoint.H deleted file mode 100644 index 6ae01c83f11039a01d4307816c08951f1ad33d1c..0000000000000000000000000000000000000000 --- a/applications/utilities/preProcessing/molConfig/startingPoint.H +++ /dev/null @@ -1,97 +0,0 @@ -scalar xMax = 0; - -scalar yMax = 0; - -scalar zMax = 0; - -scalar xMin = 0; - -scalar yMin = 0; - -scalar zMin = 0; - -label xMaxPtLabel = 0; - -label yMaxPtLabel = 0; - -label zMaxPtLabel = 0; - -label xMinPtLabel = 0; - -label yMinPtLabel = 0; - -label zMinPtLabel = 0; - -forAll (cellZoneI[cZ], nC) -{ - const labelList& cellPointsJ = mesh_.cellPoints()[cellZoneI[cZ][nC]]; - - forAll(cellPointsJ, nP) - { - const point& ptI = mesh_.points()[cellPointsJ[nP]]; - - const label& ptILabel = cellPointsJ[nP]; - - if (ptI.x() > xMax || nC == 0) - { - xMax = ptI.x(); - xMaxPtLabel = ptILabel; - } - if (ptI.y() > yMax || nC == 0) - { - yMax = ptI.y(); - yMaxPtLabel = ptILabel; - } - if (ptI.z() > zMax || nC == 0) - { - zMax = ptI.z(); - zMaxPtLabel = ptILabel; - } - if (ptI.x() < xMin || nC == 0) - { - xMin = ptI.x(); - xMinPtLabel = ptILabel; - } - if (ptI.y() < yMin || nC == 0) - { - yMin = ptI.y(); - yMinPtLabel = ptILabel; - } - if (ptI.z() < zMin || nC == 0) - { - zMin = ptI.z(); - zMinPtLabel = ptILabel; - } - } -} - -// Info << "Xmax: label = " << xMaxPtLabel2 << "; vector = " <<mesh_.points()[xMaxPtLabel2] -// <<"; x-component = " << mesh_.points()[xMaxPtLabel2].x() << endl; -// Info << "Ymax: label = " << yMaxPtLabel2 << "; vector = " <<mesh_.points()[yMaxPtLabel2] -// <<"; y-component = " << mesh_.points()[yMaxPtLabel2].y() << endl; -// Info << "Zmax: label = " << zMaxPtLabel2 << "; vector = " <<mesh_.points()[zMaxPtLabel2] -// <<"; z-component = " << mesh_.points()[zMaxPtLabel2].z() << endl; -// -// Info << "Xmin: label = " << xMinPtLabel << "; vector = " <<mesh_.points()[xMinPtLabel] -// <<"; x-component = " << mesh_.points()[xMinPtLabel].x() << endl; -// Info << "Ymin: label = " << yMinPtLabel << "; vector = " <<mesh_.points()[yMinPtLabel] -// <<"; y-component = " << mesh_.points()[yMinPtLabel].y() << endl; -// Info << "Zmin: label = " << zMinPtLabel << "; vector = " <<mesh_.points()[zMinPtLabel] -// <<"; z-component = " << mesh_.points()[zMinPtLabel].z() << endl; - -scalar xMid = - (mesh_.points()[xMaxPtLabel].x() - + mesh_.points()[xMinPtLabel].x()) / 2; - -scalar yMid = - (mesh_.points()[yMaxPtLabel].y() - + mesh_.points()[yMinPtLabel].y()) / 2; - -scalar zMid = - (mesh_.points()[zMaxPtLabel].z() - + mesh_.points()[zMinPtLabel].z()) / 2; - -vector rS(xMid, yMid, zMid); - -// Info << "\t The Estimated Starting Point: " << rS << endl; - diff --git a/applications/utilities/preProcessing/molConfig/velocityDistributions/maxwellian.H b/applications/utilities/preProcessing/molConfig/velocityDistributions/maxwellian.H deleted file mode 100644 index 01c3ff87168fc1a4057b4512472f58afec0bb5e0..0000000000000000000000000000000000000000 --- a/applications/utilities/preProcessing/molConfig/velocityDistributions/maxwellian.H +++ /dev/null @@ -1,26 +0,0 @@ -scalar velCmptMag = sqrt(moleculeCloud::kb*temperature/mass); - -for (molN = totalMols; molN < totalMols + totalZoneMols; molN++) -{ - // Assign velocity: random direction, magnitude determined by desired - // maxwellian distribution at temperature - - // Temperature gradients could be created by specifying a gradient in the - // zone subDict, or by reading a field from a mesh. - - // The velocities are treated on a zone-by-zone basis for the purposes of - // removal of bulk momentum - hence nMols becomes totalZoneMols - - velocity = vector - ( - velCmptMag*rand.GaussNormal(), - velCmptMag*rand.GaussNormal(), - velCmptMag*rand.GaussNormal() - ); - - momentumSum += mass*velocity; - - initialVelocities.append(velocity); -} - - diff --git a/applications/utilities/preProcessing/molConfig/velocityDistributions/uniform.H b/applications/utilities/preProcessing/molConfig/velocityDistributions/uniform.H deleted file mode 100644 index 9c178af262aabb88a239f9711b1c334cdd39e4e1..0000000000000000000000000000000000000000 --- a/applications/utilities/preProcessing/molConfig/velocityDistributions/uniform.H +++ /dev/null @@ -1,27 +0,0 @@ -scalar initVelMag = - sqrt - ( - 3.0*(1.0 - 1.0 / totalZoneMols) - *moleculeCloud::kb*temperature - /mass - ); - -for (molN = totalMols; molN < totalMols + totalZoneMols; molN++) -{ - // Assign velocity: random direction, magnitude determined by desired - // temperature - - // Temperature gradients could be created by specifying a gradient in the - // zone subDict, or by reading a field from a mesh. - - // The velocities are treated on a zone-by-zone basis for the purposes of - // removal of bulk momentum - hence nMols becomes totalZoneMols - - velocity = (2.0*rand.vector01() - vector::one); - - velocity *= initVelMag/mag(velocity); - - momentumSum += mass*velocity; - - initialVelocities.append(velocity); -} diff --git a/src/lagrangian/molecule/Make/files b/src/lagrangian/molecule/Make/files deleted file mode 100755 index d8063d097437f7ca2dfa6b8e20a74cafa47723c9..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/Make/files +++ /dev/null @@ -1,57 +0,0 @@ -correlationFunction = correlationFunction - -distribution = distribution - -molecule = molecule -moleculeCloud = moleculeCloud - -reducedUnits = reducedUnits - -referredMolecule = referredMolecule -referredCellList = referredCellList -referredCell = referredCell -referralLists = referralLists - -potentials = potentials -pairPotential = $(potentials)/pairPotential -tetherPotential = $(potentials)/tetherPotential - -$(distribution)/distribution.C - -$(reducedUnits)/reducedUnits.C -$(reducedUnits)/reducedUnitsIO.C - -$(molecule)/molecule.C -$(molecule)/moleculeIO.C - -$(moleculeCloud)/moleculeCloud.C -$(moleculeCloud)/moleculeCloudBuildCellOccupancy.C -$(moleculeCloud)/moleculeCloudBuildCellInteractionLists.C -$(moleculeCloud)/moleculeCloudBuildCellReferralLists.C - -$(moleculeCloud)/moleculeCloudTestEdgeEdgeDistance.C -$(moleculeCloud)/moleculeCloudTestPointFaceDistance.C -$(moleculeCloud)/moleculeCloudRealCellsInRangeOfSegment.C -$(moleculeCloud)/moleculeCloudReferredCellsInRangeOfSegment.C - -$(moleculeCloud)/moleculeCloudCalculateForce.C -$(moleculeCloud)/moleculeCloudCalculatePairForce.C -$(moleculeCloud)/moleculeCloudCalculateTetherForce.C -$(moleculeCloud)/moleculeCloudCalculateExternalForce.C -$(moleculeCloud)/moleculeCloudIntegrateEquationsOfMotion.C -$(moleculeCloud)/moleculeCloudRemoveHighEnergyOverlaps.C -$(moleculeCloud)/moleculeCloudApplyConstraintsAndThermostats.C - -$(pairPotential)/basic/pairPotential.C -$(pairPotential)/basic/pairPotentialList.C -$(tetherPotential)/tetherPotential.C -$(tetherPotential)/tetherPotentialList.C - -$(referralLists)/receivingReferralList.C -$(referralLists)/sendingReferralList.C -$(referredCellList)/referredCellList.C -$(referredCell)/referredCell.C -$(referredMolecule)/referredMolecule.C - -LIB = $(FOAM_LIBBIN)/libmolecule - diff --git a/src/lagrangian/molecule/Make/options b/src/lagrangian/molecule/Make/options deleted file mode 100755 index a0fb316eecd4a5e63b9f261787d2ecf29ff957b9..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/Make/options +++ /dev/null @@ -1,8 +0,0 @@ -EXE_INC = \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/lagrangian/basic/lnInclude \ - -EXE_LIBS = \ - -lfiniteVolume \ - -llagrangian - diff --git a/src/lagrangian/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulator.C b/src/lagrangian/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulator.C deleted file mode 100755 index c8a5ca0f307f5a5b5cb5a2d43a4bed5cd00aea6d..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulator.C +++ /dev/null @@ -1,238 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 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 "bufferedAccumulator.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -template<class Type> -const char* const - Foam::bufferedAccumulator<Type>::typeName("bufferedAccumulator"); - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template<class Type> -void Foam::bufferedAccumulator<Type>::accumulateAndResetBuffer(const label b) -{ - accumulationBuffer() += (*this)[b]; - - averagesTaken_++; - - (*this)[b] = Field<Type>(bufferLength(), pTraits<Type>::zero); - - bufferOffsets_[b] = 0; -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template<class Type> -Foam::bufferedAccumulator<Type>::bufferedAccumulator() -: - List< Field<Type> >(), - averagesTaken_(), - bufferOffsets_() -{} - - -template<class Type> -Foam::bufferedAccumulator<Type>::bufferedAccumulator -( - const label nBuffers, - const label bufferLength, - const label bufferingInterval -) -: - List< Field<Type> >(), - averagesTaken_(), - bufferOffsets_() -{ - setSizes - ( - nBuffers, - bufferLength, - bufferingInterval - ); -} - - -template<class Type> -Foam::bufferedAccumulator<Type>::bufferedAccumulator -( - const bufferedAccumulator<Type>& bA -) -: - List< Field<Type> >(static_cast< List< Field<Type> > >(bA)), - averagesTaken_(bA.averagesTaken()), - bufferOffsets_(bA.bufferOffsets()) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::bufferedAccumulator<Type>::~bufferedAccumulator() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class Type> -void Foam::bufferedAccumulator<Type>::setSizes -( - const label nBuffers, - const label bufferLength, - const label bufferingInterval -) -{ - (*this).setSize(nBuffers + 1); - - forAll((*this), b) - { - (*this)[b] = Field<Type>(bufferLength, pTraits<Type>::zero); - } - - averagesTaken_ = 0; - - bufferOffsets_.setSize(nBuffers); - - forAll(bufferOffsets_, bO) - { - bufferOffsets_[bO] = -bufferingInterval * bO - 1; - } -} - -template<class Type> -Foam::label Foam::bufferedAccumulator<Type>::addToBuffers -( - const List<Type>& valuesToAdd -) -{ - label bufferToRefill = -1; - - for (label b = 0; b < nBuffers(); b++) - { - Field<Type>& buf((*this)[b]); - - label& bO = bufferOffsets_[b]; - - if (bO >= 0) - { - buf[bO] = valuesToAdd[b]; - } - - bO++; - - if (bO == bufferLength()) - { - accumulateAndResetBuffer(b); - } - - if (bO == 0) - { - if (bufferToRefill != -1) - { - FatalErrorIn("bufferedAccumulator<Type>::addToBuffers ") - << "More than one bufferedAccumulator accumulation " - << "buffer filled at once, this is considered an error." - << abort(FatalError); - } - - bufferToRefill = b; - } - } - - return bufferToRefill; -} - - -template<class Type> -Foam::Field<Type> Foam::bufferedAccumulator<Type>::averaged() const -{ - if (averagesTaken_) - { - Field<Type> bA = accumulationBuffer()/averagesTaken_; - - return bA; - } - else - { - WarningIn - ( - "bufferedAccumulator<Type>::averagedbufferedAccumulator() const" - ) - << "Averaged correlation function requested but averagesTaken = " - << averagesTaken_ - << ". Returning empty field." - << endl; - - return Field<Type>(bufferLength(), pTraits<Type>::zero); - } -} - - -template<class Type> -void Foam::bufferedAccumulator<Type>::resetAveraging() -{ - accumulationBuffer() = Field<Type>(bufferLength(), pTraits<Type>::zero); - - averagesTaken_ = 0; -} - - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - -template<class Type> -void Foam::bufferedAccumulator<Type>::operator= -( - const bufferedAccumulator<Type>& rhs -) -{ - // Check for assignment to self - if (this == &rhs) - { - FatalErrorIn - ( - "bufferedAccumulator<Type>::operator=(const bufferedAccumulator&)" - ) - << "Attempted assignment to self" - << abort(FatalError); - } - - List< Field<Type> >::operator=(rhs); - - averagesTaken_ = rhs.averagesTaken(); - - bufferOffsets_ = rhs.bufferOffsets(); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -# include "bufferedAccumulatorIO.C" - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulator.H b/src/lagrangian/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulator.H deleted file mode 100755 index 27bd52771ccf64271138184a77a7ec06f980d8d3..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulator.H +++ /dev/null @@ -1,178 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 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::bufferedAccumulator - -Description - -SourceFiles - bufferedAccumulatorI.H - bufferedAccumulator.C - bufferedAccumulatorIO.C - -\*---------------------------------------------------------------------------*/ - -#ifndef bufferedAccumulator_H -#define bufferedAccumulator_H - -#include "Field.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -template<class Type> -class bufferedAccumulator; - -template<class Type> -Ostream& operator<< -( - Ostream&, - const bufferedAccumulator<Type>& -); - -/*---------------------------------------------------------------------------*\ - Class bufferedAccumulator Declaration -\*---------------------------------------------------------------------------*/ - -template<class Type> -class bufferedAccumulator -: - public List< Field<Type> > -{ - // Private data - - label averagesTaken_; - - List<label> bufferOffsets_; - - - // Private Member Functions - - inline Field<Type>& accumulationBuffer(); - - inline const Field<Type>& accumulationBuffer() const; - - void accumulateAndResetBuffer(const label b); - - -public: - - //- Component type - typedef typename pTraits<Type>::cmptType cmptType; - - - // Static data members - - static const char* const typeName; - - - // Constructors - - //- Construct null - bufferedAccumulator(); - - //- Construct from components - bufferedAccumulator - ( - const label nBuffers, - const label bufferLength, - const label bufferingInterval - ); - - //- Construct as copy - bufferedAccumulator(const bufferedAccumulator<Type>&); - - - // Destructor - - ~bufferedAccumulator(); - - - // Member Functions - - label addToBuffers(const List<Type>& valuesToAdd); - - Field<Type> averaged() const; - - void resetAveraging(); - - - // Access - - inline label averagesTaken() const; - - inline label nBuffers() const; - - inline label bufferLength() const; - - inline const List<label>& bufferOffsets() const; - - - // Edit - - void setSizes - ( - const label nBuffers, - const label bufferLength, - const label bufferingInterval - ); - - - // Member Operators - - void operator=(const bufferedAccumulator<Type>&); - - - // IOstream Operators - - friend Ostream& operator<< <Type> - ( - Ostream&, - const bufferedAccumulator<Type>& - ); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "bufferedAccumulatorI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "bufferedAccumulator.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulatorI.H b/src/lagrangian/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulatorI.H deleted file mode 100755 index cb3bcc617e478bdbd46037cbdbf8afba4bf00a9d..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulatorI.H +++ /dev/null @@ -1,80 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 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 - -\*---------------------------------------------------------------------------*/ - -namespace Foam -{ - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template<class Type> -inline Field<Type>& bufferedAccumulator<Type>::accumulationBuffer() -{ - return (*this)[nBuffers()]; -} - - -template<class Type> -inline const Field<Type>& bufferedAccumulator<Type>::accumulationBuffer() const -{ - return (*this)[nBuffers()]; -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class Type> -inline label bufferedAccumulator<Type>::averagesTaken() const -{ - return averagesTaken_; -} - - -template<class Type> -inline label bufferedAccumulator<Type>::nBuffers() const -{ - return bufferOffsets_.size(); -} - - -template<class Type> -inline label bufferedAccumulator<Type>::bufferLength() const -{ - return (*this)[0].size(); -} - - -template<class Type> -inline const List<label>& bufferedAccumulator<Type>::bufferOffsets() const -{ - return bufferOffsets_; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulatorIO.C b/src/lagrangian/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulatorIO.C deleted file mode 100755 index 5c6cf11da3eb3e98d04c0355e2d91ad5a0830fa4..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulatorIO.C +++ /dev/null @@ -1,52 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source bAD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenbAD 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 "bufferedAccumulator.H" -#include "IOstreams.H" - -// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // - -template<class Type> -Foam::Ostream& - Foam::operator<<(Ostream& os, const bufferedAccumulator<Type>& bA) -{ - - os<< bA.averagesTaken_ - << static_cast<const List< Field<Type> >&>(bA) - << bA.bufferOffsets(); - - // Check state of Ostream - os.check - ( - "Foam::Ostream& Foam::operator<<(Foam::Ostream&, " - "const Foam::bufferedAccumulator&)" - ); - - return os; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/correlationFunction/correlationFunction.C b/src/lagrangian/molecule/correlationFunction/correlationFunction.C deleted file mode 100644 index ca63e1856cd4ce6ab5a848e33bb03cbf8e6f298d..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/correlationFunction/correlationFunction.C +++ /dev/null @@ -1,224 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 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 "correlationFunction.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -template<class Type> -const char* const - Foam::correlationFunction<Type>::typeName("correlationFunction"); - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template<class Type> -void Foam::correlationFunction<Type>::setTimesAndSizes -( - const label tZeroBufferSize -) -{ - sampleSteps_ = ceil(sampleInterval_/mesh_.time().deltaT().value()); - - sampleInterval_ = sampleSteps_*mesh_.time().deltaT().value(); - - label bufferLength(ceil(duration_/sampleInterval_)); - - duration_ = bufferLength*sampleInterval_; - - label bufferingInterval(ceil(averagingInterval_/sampleInterval_)); - - averagingInterval_ = bufferingInterval*sampleInterval_; - - label nBuffers(ceil(duration_/averagingInterval_)); - - this->setSizes - ( - nBuffers, - bufferLength, - bufferingInterval - ); - - tZeroBuffers_ = - Field< Field<Type> > - ( - nBuffers, - Field<Type> - ( - tZeroBufferSize, - pTraits<Type>::zero - ) - ); -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template<class Type> -Foam::correlationFunction<Type>::correlationFunction -( - const polyMesh& mesh, - const dictionary& cfDict, - const label tZeroBufferSize -) -: - bufferedAccumulator<scalar>(), - mesh_(mesh) -{ - duration_ = readScalar(cfDict.lookup("duration")); - - sampleInterval_ = readScalar(cfDict.lookup("sampleInterval")); - - averagingInterval_ = readScalar(cfDict.lookup("averagingInterval")); - - setTimesAndSizes(tZeroBufferSize); -} - - -template<class Type> -Foam::correlationFunction<Type>::correlationFunction -( - const polyMesh& mesh, - const label tZeroBufferSize, - const scalar duration, - const scalar sampleInterval, - const scalar averagingInterval -) -: - bufferedAccumulator<scalar>(), - mesh_(mesh), - duration_(duration), - sampleInterval_(sampleInterval), - averagingInterval_(averagingInterval) -{ - setTimesAndSizes(tZeroBufferSize); -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::correlationFunction<Type>::~correlationFunction() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class Type> -void Foam::correlationFunction<Type>::calculateCorrelationFunction -( - const Field<Type>& currentValues -) -{ - if (measurandFieldSize() != currentValues.size()) - { - FatalErrorIn("correlationFunction<Type>::calculateCorrelationFunction") - << "Trying to supply a Field of length" - << currentValues.size() - <<" to calculate the correlation function. " - << "Expecting a Field of length " - << measurandFieldSize() << nl - << abort(FatalError); - } - - List<scalar> cFSums(nBuffers(),0.0); - - forAll(tZeroBuffers_, tZB) - { - scalar& cFSum = cFSums[tZB]; - - const Field<Type>& tZeroBuffer = tZeroBuffers_[tZB]; - - forAll(currentValues, cV) - { - const Type& tZeroBufferValue = tZeroBuffer[cV]; - - const Type& currentValue = currentValues[cV]; - - forAll(currentValue, component) - { - cFSum += - ( - tZeroBufferValue[component]*currentValue[component] - ); - } - } - - cFSum /= (measurandFieldSize()*currentValues[0].size()); - } - - label bufferToRefill = addToBuffers(cFSums); - - if (bufferToRefill != -1) - { - tZeroBuffers_[bufferToRefill] = currentValues; - } -} - - -template<class Type> -void Foam::correlationFunction<Type>::calculateCorrelationFunction -( - const Type& currentValue -) -{ - if( measurandFieldSize() != 1) - { - FatalErrorIn("correlationFunction<Type>::calculateCorrelationFunction") - << "Trying to supply a single value to calculate the correlation " - << "function. Expecting a Field of length " - << measurandFieldSize() - << abort(FatalError); - } - - calculateCorrelationFunction(Field<Type>(1, currentValue)); -} - - -template<class Type> -Foam::scalar Foam::correlationFunction<Type>::integral() const -{ - Field<scalar> averageCF(averaged()); - - scalar cFIntegral = 0.0; - - for(label v = 0; v < averageCF.size() - 1; v++) - { - cFIntegral += - 0.5 - *sampleInterval_ - *(averageCF[v+1] + averageCF[v]); - } - - return cFIntegral; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -# include "correlationFunctionIO.C" - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/correlationFunction/correlationFunction.H b/src/lagrangian/molecule/correlationFunction/correlationFunction.H deleted file mode 100644 index fcd023e36374f10fa089269afab0407cfd5466b3..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/correlationFunction/correlationFunction.H +++ /dev/null @@ -1,180 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 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::correlationFunction - -Description - -SourceFiles - correlationFunctionI.H - correlationFunction.C - correlationFunctionIO.C - -\*---------------------------------------------------------------------------*/ - -#ifndef correlationFunction_H -#define correlationFunction_H - -#include "bufferedAccumulator.H" -#include "dictionary.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -template<class Type> -class correlationFunction; - -template<class Type> -Ostream& operator<< -( - Ostream&, - const correlationFunction<Type>& -); - -/*---------------------------------------------------------------------------*\ - Class correlationFunction Declaration -\*---------------------------------------------------------------------------*/ - -template<class Type> -class correlationFunction -: - public bufferedAccumulator<scalar> -{ - // Private data - - const polyMesh& mesh_; - - Field< Field<Type> > tZeroBuffers_; - - scalar duration_; - scalar sampleInterval_; - scalar averagingInterval_; - - label sampleSteps_; - - - // Private Member Functions - - void setTimesAndSizes(const label); - - //- Disallow default bitwise copy construct - correlationFunction(const correlationFunction<Type>&); - - //- Disallow default bitwise assignment - void operator=(const correlationFunction<Type>&); - - -public: - - //- Component type - typedef typename pTraits<Type>::cmptType cmptType; - - - // Static data members - - static const char* const typeName; - - - // Constructors - - //- Construct from dictionary - correlationFunction - ( - const polyMesh&, - const dictionary&, - const label tZeroBufferSize - ); - - //- Construct from components - correlationFunction - ( - const polyMesh&, - const label tZeroBufferSize, - const scalar duration, - const scalar sampleInterval, - const scalar averagingInterval - - ); - - - // Destructor - - ~correlationFunction(); - - - // Member Functions - - void calculateCorrelationFunction(const Field<Type>&); - - void calculateCorrelationFunction(const Type&); - - scalar integral() const; - - bool writeAveraged(Ostream&) const; - - - // Access - - inline const Field< Field<Type> >& tZeroBuffers() const; - - inline scalar duration() const; - - inline scalar sampleInterval() const; - - inline scalar averagingInterval() const; - - inline label sampleSteps() const; - - inline label measurandFieldSize() const; - - - // IOstream Operators - - friend Ostream& operator<< <Type> - (Ostream&, const correlationFunction<Type>&); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "correlationFunctionI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "correlationFunction.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/correlationFunction/correlationFunctionI.H b/src/lagrangian/molecule/correlationFunction/correlationFunctionI.H deleted file mode 100644 index 6858f647a64478873d3b3a5d35c97033db3bd0ca..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/correlationFunction/correlationFunctionI.H +++ /dev/null @@ -1,70 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 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 - -\*---------------------------------------------------------------------------*/ - -template<class Type> -inline const Field< Field<Type> >& Foam::correlationFunction<Type>:: -tZeroBuffers() const -{ - return tZeroBuffers_; -} - - -template<class Type> -inline scalar Foam::correlationFunction<Type>::duration() const -{ - return duration_; -} - - -template<class Type> -inline scalar Foam::correlationFunction<Type>::sampleInterval() const -{ - return sampleInterval_; -} - - -template<class Type> -inline scalar Foam::correlationFunction<Type>::averagingInterval() const -{ - return averagingInterval_; -} - - -template<class Type> -inline label Foam::correlationFunction<Type>::sampleSteps() const -{ - return sampleSteps_; -} - - -template<class Type> -inline label Foam::correlationFunction<Type>::measurandFieldSize() const -{ - return tZeroBuffers_[0].size(); -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/correlationFunction/correlationFunctionIO.C b/src/lagrangian/molecule/correlationFunction/correlationFunctionIO.C deleted file mode 100644 index 0a080158aea2dc95a9b47570c1153acdf7e077f3..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/correlationFunction/correlationFunctionIO.C +++ /dev/null @@ -1,72 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 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 "correlationFunction.H" -#include "IOstreams.H" - -template<class Type> -bool Foam::correlationFunction<Type>::writeAveraged(Ostream& os) const -{ - Field<scalar> averageCF(averaged()); - - forAll(averageCF, v) - { - os<< v*sampleInterval() - << token::SPACE - << averageCF[v] - << nl; - } - - return os.good(); -} - - -template<class Type> -Foam::Ostream& Foam::operator<< -( - Ostream& os, - const correlationFunction<Type>& cF -) -{ - os<< cF.duration() - << nl << cF.sampleInterval() - << nl << cF.averagingInterval() - << nl << cF.sampleSteps() - << nl << cF.tZeroBuffers() - << nl << static_cast<const bufferedAccumulator<scalar>&>(cF); - - // Check state of Ostream - os.check - ( - "Foam::Ostream& Foam::operator<<" - "(Ostream&, const correlationFunction<Type>&)" - ); - - return os; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/distribution/distribution.C b/src/lagrangian/molecule/distribution/distribution.C deleted file mode 100755 index 717929e5e42e6ad99634e8d790f43fa3d7aa70cd..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/distribution/distribution.C +++ /dev/null @@ -1,449 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "distribution.H" - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -distribution::distribution() -: - Map<label>(), - binWidth_(1) -{} - - -distribution::distribution(const scalar binWidth) -: - Map<label>(), - binWidth_(binWidth) -{} - - -distribution::distribution(const distribution& d) -: - Map<label>(static_cast< Map<label> >(d)), - binWidth_(d.binWidth()) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -distribution::~distribution() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -label distribution::totalEntries() const -{ - label sumOfEntries = 0; - - forAllConstIter(Map<label>, *this, iter) - { - sumOfEntries += iter(); - - if (sumOfEntries < 0) - { - WarningIn("label distribution::totalEntries()") - << "Accumulated distribution values total has become negative: " - << "sumOfEntries = " << sumOfEntries - << ". This is most likely to be because too many samples " - << "have been added to the bins and the label has 'rolled " - << "round'. Try distribution::approxTotalEntries which " - << "returns a scalar." << endl; - - sumOfEntries = -1; - - break; - } - } - - return sumOfEntries; -} - - -scalar distribution::approxTotalEntries() const -{ - scalar sumOfEntries = 0; - - forAllConstIter(Map<label>, *this, iter) - { - sumOfEntries += scalar(iter()); - } - - return sumOfEntries; -} - - -scalar distribution::mean() const -{ - scalar runningSum = 0; - - scalar totEnt = approxTotalEntries(); - - List<label> keys = toc(); - - forAll(keys,k) - { - label key = keys[k]; - - runningSum += - (0.5 + scalar(key)) - *binWidth_ - *scalar((*this)[key]) - /totEnt; - } - - return runningSum; -} - - -scalar distribution::median() -{ - // From: - // http://mathworld.wolfram.com/StatisticalMedian.html - // The statistical median is the value of the distribution variable - // where the cumulative distribution = 0.5. - - scalar median = 0.0; - - scalar runningSum = 0.0; - - List< Pair<scalar> > normDist(normalised()); - - if (normDist.size()) - { - if (normDist.size() == 1) - { - median = normDist[0].first(); - } - else if - ( - normDist.size() > 1 - && normDist[0].second()*binWidth_ > 0.5 - ) - { - scalar xk = normDist[1].first(); - scalar xkm1 = normDist[0].first(); - scalar Sk = - (normDist[0].second() + normDist[1].second())*binWidth_; - scalar Skm1 = normDist[0].second()*binWidth_; - - median = (0.5 - Skm1)*(xk - xkm1)/(Sk - Skm1) + xkm1; - } - else - { - label lastNonZeroIndex = 0; - - forAll(normDist,nD) - { - if (runningSum + (normDist[nD].second()*binWidth_) > 0.5) - { - scalar xk = normDist[nD].first(); - scalar xkm1 = normDist[lastNonZeroIndex].first(); - scalar Sk = runningSum + (normDist[nD].second()*binWidth_); - scalar Skm1 = runningSum; - - median = (0.5 - Skm1)*(xk - xkm1)/(Sk - Skm1) + xkm1; - - break; - } - else if (normDist[nD].second() > 0.0) - { - runningSum += normDist[nD].second()*binWidth_; - - lastNonZeroIndex = nD; - } - } - } - } - - return median; -} - - -void distribution::add(const scalar valueToAdd) -{ - iterator iter(this->begin()); - - label n = label(valueToAdd/binWidth_) - label(neg(valueToAdd/binWidth_)); - - iter = find(n); - - if (iter == this->end()) - { - this->insert(n,1); - } - else - { - (*this)[n]++; - } - - if ((*this)[n] < 0) - { - FatalErrorIn("distribution::add(const scalar valueToAdd)") - << "Accumulated distribution value has become negative: " - << "bin = " << (0.5 + scalar(n)) * binWidth_ - << ", value = " << (*this)[n] - << ". This is most likely to be because too many samples " - << "have been added to a bin and the label has 'rolled round'" - << abort(FatalError); - } -} - - -void distribution::add(const label valueToAdd) -{ - add(scalar(valueToAdd)); -} - - -void distribution::insertMissingKeys() -{ - iterator iter(this->begin()); - - List<label> keys = toc(); - - sort(keys); - - label k; - - if (keys.size() > 0) - { - for (k = keys[0]; k < keys[keys.size()-1]; k++) - { - iter = find(k); - - if (iter == this->end()) - { - this->insert(k,0); - } - } - } -} - - -List< Pair<scalar> > distribution::normalised() -{ - scalar totEnt = approxTotalEntries(); - - insertMissingKeys(); - - List<label> keys = toc(); - - sort(keys); - - List< Pair<scalar> > normDist(size()); - - forAll(keys,k) - { - label key = keys[k]; - - normDist[k].first() = (0.5 + scalar(key))*binWidth_; - - normDist[k].second() = scalar((*this)[key])/totEnt/binWidth_; - } - - return normDist; -} - - -List< Pair<scalar> > distribution::normalisedMinusMean() -{ - return normalisedShifted(mean()); -} - - -List< Pair<scalar> > distribution::normalisedShifted(const scalar shiftValue) -{ - List< Pair<scalar> > oldDist(normalised()); - - List< Pair<scalar> > newDist(oldDist.size()); - - forAll(oldDist,u) - { - oldDist[u].first() -= shiftValue; - } - - scalar lowestOldBin = oldDist[0].first()/binWidth_ - 0.5; - - label lowestNewKey = label - ( - lowestOldBin + 0.5*sign(lowestOldBin) - ); - - scalar interpolationStartDirection = - sign(scalar(lowestNewKey) - lowestOldBin); - - label newKey = lowestNewKey; - -// Info << shiftValue -// << nl << lowestOldBin -// << nl << lowestNewKey -// << nl << interpolationStartDirection -// << endl; - -// scalar checkNormalisation = 0; - -// forAll (oldDist, oD) -// { -// checkNormalisation += oldDist[oD].second()*binWidth_; -// } - -// Info << "Initial normalisation = " << checkNormalisation << endl; - - forAll(oldDist,u) - { - newDist[u].first() = (0.5 + scalar(newKey)) * binWidth_; - - if (interpolationStartDirection < 0) - { - if (u == 0) - { - newDist[u].second() = - (0.5 + scalar(newKey))*oldDist[u].second() - - oldDist[u].second() - *(oldDist[u].first() - binWidth_)/ binWidth_; - } - else - { - newDist[u].second() = - (0.5 + scalar(newKey)) - *(oldDist[u].second() - oldDist[u-1].second()) - + - ( - oldDist[u-1].second() * oldDist[u].first() - - oldDist[u].second() * oldDist[u-1].first() - ) - /binWidth_; - } - } - else - { - if (u == oldDist.size() - 1) - { - newDist[u].second() = - (0.5 + scalar(newKey))*-oldDist[u].second() - + oldDist[u].second() * (oldDist[u].first() + binWidth_) - /binWidth_; - } - else - { - newDist[u].second() = - (0.5 + scalar(newKey)) - *(oldDist[u+1].second() - oldDist[u].second()) - + - ( - oldDist[u].second() * oldDist[u+1].first() - - oldDist[u+1].second() * oldDist[u].first() - ) - /binWidth_; - } - } - - newKey++; - } - -// checkNormalisation = 0; - -// forAll (newDist, nD) -// { -// checkNormalisation += newDist[nD].second()*binWidth_; -// } - -// Info << "Shifted normalisation = " << checkNormalisation << endl; - - return newDist; -} - - -List< Pair<scalar> > distribution::raw() -{ - insertMissingKeys(); - - List<label> keys = toc(); - - sort(keys); - - List< Pair<scalar> > rawDist(size()); - - forAll(keys,k) - { - label key = keys[k]; - - rawDist[k].first() = (0.5 + scalar(key)) * binWidth_; - - rawDist[k].second() = scalar((*this)[key]); - } - - return rawDist; -} - - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - -void distribution::operator=(const distribution& rhs) -{ - // Check for assignment to self - if (this == &rhs) - { - FatalErrorIn("distribution::operator=(const distribution&)") - << "Attempted assignment to self" - << abort(FatalError); - } - - Map<label>::operator=(rhs); - - binWidth_ = rhs.binWidth(); -} - - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - -Ostream& operator<<(Ostream& os, const distribution& d) -{ - os << d.binWidth_ - << static_cast<const Map<label>&>(d); - - // Check state of Ostream - os.check - ( - "Ostream& operator<<(Ostream&, " - "const distribution&)" - ); - - return os; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/distribution/distribution.H b/src/lagrangian/molecule/distribution/distribution.H deleted file mode 100755 index c2de1055c16f1607c17aad261772828126cf6381..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/distribution/distribution.H +++ /dev/null @@ -1,133 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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::distribution - -Description - -SourceFiles - distributionI.H - distribution.C - distributionIO.C - -\*---------------------------------------------------------------------------*/ - -#ifndef distribution_H -#define distribution_H - -#include "Map.H" -#include "Pair.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class distribution Declaration -\*---------------------------------------------------------------------------*/ - -class distribution -: - public Map<label> -{ - // Private data - - scalar binWidth_; - - -public: - - // Constructors - - //- Construct null - distribution(); - - //- Construct from binWidth - distribution(const scalar binWidth); - - //- Construct as copy - distribution(const distribution&); - - - // Destructor - - ~distribution(); - - - // Member Functions - - label totalEntries() const; - - scalar approxTotalEntries() const; - - scalar mean() const; - - scalar median(); - - //- Add a value to the appropriate bin of the distribution. - void add(const scalar valueToAdd); - - void add(const label valueToAdd); - - void insertMissingKeys(); - - List<Pair<scalar> > normalised(); - - List<Pair<scalar> > normalisedMinusMean(); - - List<Pair<scalar> > normalisedShifted(const scalar shiftValue); - - List<Pair<scalar> > raw(); - - // Access - - inline scalar binWidth() const; - - - // Member Operators - - void operator=(const distribution&); - - - // IOstream Operators - - friend Ostream& operator<<(Ostream&, const distribution&); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "distributionI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/distribution/distributionI.H b/src/lagrangian/molecule/distribution/distributionI.H deleted file mode 100755 index 754ea8a0031755e47975d979d2406979bd90e699..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/distribution/distributionI.H +++ /dev/null @@ -1,35 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 - -\*---------------------------------------------------------------------------*/ - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -inline Foam::scalar Foam::distribution::binWidth() const -{ - return binWidth_; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/distribution/distributionIO.C b/src/lagrangian/molecule/distribution/distributionIO.C deleted file mode 100755 index 57f6e774bb1743a9b1522921de87420bd14af456..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/distribution/distributionIO.C +++ /dev/null @@ -1,35 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "distribution.H" -#include "IOstreams.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -// construct from Istream - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/mdTools/averageMDFields.H b/src/lagrangian/molecule/mdTools/averageMDFields.H deleted file mode 100755 index db0c24bc95e00bc77c0de6f358e5434ecffbf0fa..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/mdTools/averageMDFields.H +++ /dev/null @@ -1,227 +0,0 @@ -if (runTime.outputTime()) -{ - /*-----------------------------------------------------------------------*\ - Number density - \*-----------------------------------------------------------------------*/ - - scalarField totalRhoN_sum(mesh.nCells(), 0.0); - - forAll (allSpeciesRhoN, rN) - { - allSpeciesRhoN[rN].internalField() = - allSpeciesN_RU[rN] - /mesh.cellVolumes() - /nAveragingSteps; - - totalRhoN_sum += allSpeciesRhoN[rN].internalField(); - } - - totalRhoN.internalField() = totalRhoN_sum; - - - /*-----------------------------------------------------------------------*\ - Mass density - \*-----------------------------------------------------------------------*/ - - scalarField totalRhoM_sum(mesh.nCells(), 0.0); - - forAll (allSpeciesRhoM, rM) - { - allSpeciesRhoM[rM].internalField() = - allSpeciesM_RU[rM] - /mesh.cellVolumes() - /nAveragingSteps; - - totalRhoM_sum += allSpeciesRhoM[rM].internalField(); - } - - totalRhoM.internalField() = totalRhoM_sum; - - /*-----------------------------------------------------------------------*\ - Bulk velocity - \*-----------------------------------------------------------------------*/ - - vectorField totalMomentum_sum(mesh.nCells(), vector::zero); - - scalarField totalMass_sum(mesh.nCells(), 0.0); - - forAll (allSpeciesVelocity, v) - { - // A check for 1/0 molecules is required. - - vectorField& singleSpeciesVelocity - ( - allSpeciesVelocity[v].internalField() - ); - - forAll(singleSpeciesVelocity, sSV) - { - if(allSpeciesN_RU[v][sSV]) - { - singleSpeciesVelocity[sSV] = - allSpeciesVelocitySum_RU[v][sSV] - /allSpeciesN_RU[v][sSV]; - - totalMomentum_sum[sSV] += - allSpeciesM_RU[v][sSV] - /allSpeciesN_RU[v][sSV] - *allSpeciesVelocitySum_RU[v][sSV]; - - totalMass_sum[sSV] += allSpeciesM_RU[v][sSV]; - } - else - { - singleSpeciesVelocity[sSV] = vector::zero; - } - } - } - - forAll(totalVelocity.internalField(), tV) - { - if(totalMass_sum[tV] > VSMALL) - { - totalVelocity.internalField()[tV] = - totalMomentum_sum[tV] - /totalMass_sum[tV]; - } - else - { - totalVelocity.internalField()[tV] = - vector::zero; - } - } - - /*-----------------------------------------------------------------------*\ - Kinetic temperature - \*-----------------------------------------------------------------------*/ - - scalarField totalTemperatureVTerms_sum(mesh.nCells(), 0.0); - - scalarField totalN_sum(mesh.nCells(), 0.0); - - forAll (allSpeciesTemperature, t) - { - // A check for 1/0 molecules is required. - - scalarField& singleSpeciesTemp - ( - allSpeciesTemperature[t].internalField() - ); - - forAll(singleSpeciesTemp, sST) - { - if(allSpeciesN_RU[t][sST]) - { - singleSpeciesTemp[sST] = - allSpeciesM_RU[t][sST] - /allSpeciesN_RU[t][sST] - /(3.0 * moleculeCloud::kb * allSpeciesN_RU[t][sST]) - * - ( - allSpeciesVelocityMagSquaredSum_RU[t][sST] - - - ( - allSpeciesVelocitySum_RU[t][sST] - & - allSpeciesVelocitySum_RU[t][sST] - ) - /allSpeciesN_RU[t][sST] - ); - - totalTemperatureVTerms_sum[sST] += - allSpeciesM_RU[t][sST] - /allSpeciesN_RU[t][sST] - * - ( - allSpeciesVelocityMagSquaredSum_RU[t][sST] - - - ( - allSpeciesVelocitySum_RU[t][sST] - & - allSpeciesVelocitySum_RU[t][sST] - ) - /allSpeciesN_RU[t][sST] - ); - - totalN_sum[sST] += allSpeciesN_RU[t][sST]; - } - else - { - singleSpeciesTemp[sST] = 0.0; - } - } - } - - forAll(totalTemperature.internalField(), tT) - { - if(totalN_sum[tT] > 0) - { - totalTemperature.internalField()[tT] = - totalTemperatureVTerms_sum[tT] - /(3.0 * moleculeCloud::kb * totalN_sum[tT]); - } - else - { - totalTemperature.internalField()[tT] = 0.0; - } - } - - /*-----------------------------------------------------------------------*\ - Mean kinetic energy - \*-----------------------------------------------------------------------*/ - - scalarField totalKE_sum(mesh.nCells(), 0.0); - - forAll (allSpeciesMeanKE, mKE) - { - // A check for 1/0 molecules is required. - - scalarField& singleSpeciesMeanKE - ( - allSpeciesMeanKE[mKE].internalField() - ); - - forAll(singleSpeciesMeanKE, sSMKE) - { - if(allSpeciesN_RU[mKE][sSMKE]) - { - singleSpeciesMeanKE[sSMKE] = - allSpeciesM_RU[mKE][sSMKE] - /allSpeciesN_RU[mKE][sSMKE] - /(2.0 * allSpeciesN_RU[mKE][sSMKE]) - * - ( - allSpeciesVelocityMagSquaredSum_RU[mKE][sSMKE] - ); - - totalKE_sum[sSMKE] += - allSpeciesM_RU[mKE][sSMKE] - /allSpeciesN_RU[mKE][sSMKE] - /2.0 - * - ( - allSpeciesVelocityMagSquaredSum_RU[mKE][sSMKE] - ); - } - else - { - singleSpeciesMeanKE[sSMKE] = 0.0; - } - } - } - - forAll(totalMeanKE.internalField(), tMKE) - { - if(totalN_sum[tMKE] > 0) - { - totalMeanKE.internalField()[tMKE] = - totalKE_sum[tMKE] - /totalN_sum[tMKE]; - } - else - { - totalMeanKE.internalField()[tMKE] = 0.0; - } - } -} - diff --git a/src/lagrangian/molecule/mdTools/calculateAutoCorrelationFunctions.H b/src/lagrangian/molecule/mdTools/calculateAutoCorrelationFunctions.H deleted file mode 100644 index a7c4c326bb3c4dc17aa510f095bc44054bce25ab..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/mdTools/calculateAutoCorrelationFunctions.H +++ /dev/null @@ -1,83 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 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 - -\*---------------------------------------------------------------------------*/ - -if (mesh.time().timeIndex() % vacf.sampleSteps() == 0) -{ - IDLList<molecule>::iterator mol(molecules.begin()); - - Field<vector> uVals(molecules.size()); - - label uV = 0; - - for - ( - mol = molecules.begin(); - mol != molecules.end(); - ++mol, uV++ - ) - { - uVals[uV] = mol().U(); - } - - vacf.calculateCorrelationFunction(uVals); -} - -if (mesh.time().timeIndex() % pacf.sampleSteps() == 0) -{ - IDLList<molecule>::iterator mol(molecules.begin()); - - vector p = vector::zero; - - for - ( - mol = molecules.begin(); - mol != molecules.end(); - ++mol - ) - { - p.x() += - mol().mass() * mol().U().y() * mol().U().z() - + - 0.5 * mol().rf().yz(); - - p.y() += - mol().mass() * mol().U().z() * mol().U().x() - + - 0.5 * mol().rf().zx(); - - p.z() += - mol().mass() * mol().U().x() * mol().U().y() - + - 0.5 * mol().rf().xy(); - } - - pacf.calculateCorrelationFunction(p); -} - -if (mesh.time().timeIndex() % hfacf.sampleSteps() == 0) -{ -// hFacf.calculateCorrelationFunction(); -} diff --git a/src/lagrangian/molecule/mdTools/calculateMDFields.H b/src/lagrangian/molecule/mdTools/calculateMDFields.H deleted file mode 100755 index af5c938da43cf3308ea2caf8ded6466cc27d09ad..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/mdTools/calculateMDFields.H +++ /dev/null @@ -1,23 +0,0 @@ -const List<DynamicList<molecule*> >& cellOccupancy = molecules.cellOccupancy(); - -forAll(cellOccupancy, cell) -{ - const List<molecule*>& molsInCell = cellOccupancy[cell]; - - forAll(molsInCell, mIC) - { - molecule* mol = molsInCell[mIC]; - - const label molId = mol->id(); - - const vector& molU = mol->U(); - - allSpeciesN_RU[molId][cell]++; - - allSpeciesM_RU[molId][cell] += mol->mass(); - - allSpeciesVelocitySum_RU[molId][cell] += molU; - - allSpeciesVelocityMagSquaredSum_RU[molId][cell] += molU & molU; - } -} diff --git a/src/lagrangian/molecule/mdTools/calculateTransportProperties.H b/src/lagrangian/molecule/mdTools/calculateTransportProperties.H deleted file mode 100644 index 15e0dab7e34c468856704e799a537d1889169ee7..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/mdTools/calculateTransportProperties.H +++ /dev/null @@ -1,65 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 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 - -\*---------------------------------------------------------------------------*/ - -if (writeVacf) -{ - OFstream vacfFile(runTime.path()/"vacf"); - - if (!vacf.writeAveraged(vacfFile)) - { - FatalErrorIn(args.executable()) - << "Failed writing to " - << vacfFile.name() - << abort(FatalError); - } -} - -Info << "Diffusion coefficient = " - << vacf.integral() << endl; - -if (writePacf) -{ - OFstream pacfFile(runTime.path()/"pacf"); - - if (!pacf.writeAveraged(pacfFile)) - { - FatalErrorIn(args.executable()) - << "Failed writing to " - << pacfFile.name() - << abort(FatalError); - } -} - -Info<< "Viscosity = " - << pacf.integral()/averageTemperature/moleculeCloud::kb/meshVolume - << endl; - -if(writeHFacf) -{ - -} - - diff --git a/src/lagrangian/molecule/mdTools/createAutoCorrelationFunctions.H b/src/lagrangian/molecule/mdTools/createAutoCorrelationFunctions.H deleted file mode 100644 index 3bec4493dcccb186c2c02206281ea6919cc5155e..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/mdTools/createAutoCorrelationFunctions.H +++ /dev/null @@ -1,99 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 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 - -\*---------------------------------------------------------------------------*/ - -Info << nl << "Creating autocorrelation functions." << endl; - -IOdictionary mdTransportProperitesDict -( - IOobject - ( - "mdTransportProperitesDict", - mesh.time().system(), - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ) -); - -const dictionary& autocorrelationFunctionDict -( - mdTransportProperitesDict.subDict("autocorrelationFunctions") -); - -//- Velocity autocorrelation function - -Info << tab << "velocty" << endl; - -const dictionary& velocityACFDict -( - autocorrelationFunctionDict.subDict("velocity") -); - -correlationFunction<vector> vacf -( - mesh, - velocityACFDict, - molecules.size() -); - -bool writeVacf(Switch(velocityACFDict.lookup("writeFile"))); - -//- Pressure autocorrelation function - -Info << tab << "pressure" << endl; - -const dictionary& pressureACFDict -( - autocorrelationFunctionDict.subDict("pressure") -); - -correlationFunction<vector> pacf -( - mesh, - pressureACFDict, - 1 -); - -bool writePacf(Switch(pressureACFDict.lookup("writeFile"))); - -//- Heat flux autocorrelation function - -Info << tab << "heat flux" << endl; - -const dictionary& heatFluxACFDict -( - autocorrelationFunctionDict.subDict("heatFlux") -); - -correlationFunction<vector> hfacf -( - mesh, - heatFluxACFDict, - 1 -); - -bool writeHFacf(Switch(heatFluxACFDict.lookup("writeFile"))); diff --git a/src/lagrangian/molecule/mdTools/createMDFields.H b/src/lagrangian/molecule/mdTools/createMDFields.H deleted file mode 100755 index f5742fd2c8fd89afdb9428abb5b90ff3e6523967..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/mdTools/createMDFields.H +++ /dev/null @@ -1,306 +0,0 @@ -// Fields for data gathering - -List< scalarField > allSpeciesN_RU -( - molecules.nIds(), - scalarField (mesh.nCells(), 0.0) -); - -List< scalarField > allSpeciesM_RU -( - molecules.nIds(), - scalarField (mesh.nCells(), 0.0) -); - -List< vectorField > allSpeciesVelocitySum_RU -( - molecules.nIds(), - vectorField (mesh.nCells(), vector::zero) -); - -List< scalarField > allSpeciesVelocityMagSquaredSum_RU -( - molecules.nIds(), - scalarField (mesh.nCells(), 0.0) -); - -// Geometric Fields for IO - -Info << nl << "Creating fields." << endl; - -/*---------------------------------------------------------------------------*\ - Number density -\*---------------------------------------------------------------------------*/ - -PtrList<volScalarField> allSpeciesRhoN -( - molecules.nIds() -); - -forAll (allSpeciesRhoN, rN) -{ - Info << " Creating number density field for " - << molecules.idList()[rN] << endl; - - allSpeciesRhoN.set - ( - rN, - new volScalarField - ( - IOobject - ( - "rhoN_" + molecules.idList()[rN], - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimless/dimVolume, - "zeroGradient" - ) - ); - allSpeciesRhoN[rN].internalField() = scalarField (mesh.nCells(), 0.0); - allSpeciesRhoN[rN].correctBoundaryConditions(); -} - -Info << " Creating total number density field" << endl; - -volScalarField totalRhoN -( - IOobject - ( - "rhoN_total", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimless/dimVolume, - "zeroGradient" -); -totalRhoN.internalField() = scalarField (mesh.nCells(), 0.0); -totalRhoN.correctBoundaryConditions(); - -/*---------------------------------------------------------------------------*\ - Mass density -\*---------------------------------------------------------------------------*/ - -PtrList<volScalarField> allSpeciesRhoM -( - molecules.nIds() -); - -forAll (allSpeciesRhoM, rM) -{ - Info << " Creating mass density field for " - << molecules.idList()[rM] << endl; - - allSpeciesRhoM.set - ( - rM, - new volScalarField - ( - IOobject - ( - "rhoM_" + molecules.idList()[rM], - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimMass/dimVolume, - "zeroGradient" - ) - ); - allSpeciesRhoM[rM].internalField() = scalarField (mesh.nCells(), 0.0); - allSpeciesRhoM[rM].correctBoundaryConditions(); -} - -Info << " Creating total mass density field" << endl; - -volScalarField totalRhoM -( - IOobject - ( - "rhoM_total", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimMass/dimVolume, - "zeroGradient" -); -totalRhoM.internalField() = scalarField (mesh.nCells(), 0.0); -totalRhoM.correctBoundaryConditions(); - -/*---------------------------------------------------------------------------*\ - Bulk velocity -\*---------------------------------------------------------------------------*/ - -PtrList<volVectorField> allSpeciesVelocity -( - molecules.nIds() -); - -forAll (allSpeciesVelocity, v) -{ - Info << " Creating velocity field for " - << molecules.idList()[v] << endl; - - allSpeciesVelocity.set - ( - v, - new volVectorField - ( - IOobject - ( - "velocity_" + molecules.idList()[v], - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimVelocity, - "zeroGradient" - ) - ); - allSpeciesVelocity[v].internalField() = - vectorField (mesh.nCells(), vector::zero); - allSpeciesVelocity[v].correctBoundaryConditions(); -} - -Info << " Creating total velocity field" << endl; - -volVectorField totalVelocity -( - IOobject - ( - "velocity_total", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimVelocity, - "zeroGradient" -); -totalVelocity.internalField() = vectorField (mesh.nCells(), vector::zero); -totalVelocity.correctBoundaryConditions(); - -/*---------------------------------------------------------------------------*\ - Kinetic temperature -\*---------------------------------------------------------------------------*/ - -PtrList<volScalarField> allSpeciesTemperature -( - molecules.nIds() -); - -forAll (allSpeciesTemperature, t) -{ - Info << " Creating temperature field for " - << molecules.idList()[t] << endl; - - allSpeciesTemperature.set - ( - t, - new volScalarField - ( - IOobject - ( - "temperature_" + molecules.idList()[t], - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimTemperature, - "zeroGradient" - ) - ); - allSpeciesTemperature[t].internalField() = scalarField (mesh.nCells(), 0.0); - allSpeciesTemperature[t].correctBoundaryConditions(); -} - -Info << " Creating total temperature field" << endl; - -volScalarField totalTemperature -( - IOobject - ( - "temperature_total", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimTemperature, - "zeroGradient" -); -totalTemperature.internalField() = scalarField (mesh.nCells(), 0.0); -totalTemperature.correctBoundaryConditions(); - -/*---------------------------------------------------------------------------*\ - Mean kinetic energy -\*---------------------------------------------------------------------------*/ - - -PtrList<volScalarField> allSpeciesMeanKE -( - molecules.nIds() -); - -forAll (allSpeciesMeanKE, mKE) -{ - Info << " Creating mean kinetic energy field for " - << molecules.idList()[mKE] << endl; - - allSpeciesMeanKE.set - ( - mKE, - new volScalarField - ( - IOobject - ( - "meanKE_" + molecules.idList()[mKE], - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionSet(1, 2, -2, 0, 0, 0, 0), - "zeroGradient" - ) - ); - allSpeciesMeanKE[mKE].internalField() = scalarField (mesh.nCells(), 0.0); - allSpeciesMeanKE[mKE].correctBoundaryConditions(); -} - -Info << " Creating total mean kinetic energy field" << endl; - -volScalarField totalMeanKE -( - IOobject - ( - "meanKE_total", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionSet(1, 2, -2, 0, 0, 0, 0), - "zeroGradient" -); -totalMeanKE.internalField() = scalarField (mesh.nCells(), 0.0); -totalMeanKE.correctBoundaryConditions(); diff --git a/src/lagrangian/molecule/mdTools/createRefUnits.H b/src/lagrangian/molecule/mdTools/createRefUnits.H deleted file mode 100644 index bbd6c6daf7bc378e10c1cec250febb9184dc9769..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/mdTools/createRefUnits.H +++ /dev/null @@ -1,22 +0,0 @@ -reducedUnits refUnits; - -IOobject reducedUnitsDictIOobject -( - "reducedUnitsDict", - runTime.system(), - mesh, - IOobject::READ_IF_PRESENT, - IOobject::NO_WRITE -); - -if (reducedUnitsDictIOobject.headerOk()) -{ - Info << nl - << "Reading reference quantities from reducedUnitsDict file." << endl; - - IOdictionary reducedUnitsDict(reducedUnitsDictIOobject); - - refUnits.setRefValues(reducedUnitsDict); -} - -Info << refUnits << endl; diff --git a/src/lagrangian/molecule/mdTools/md.H b/src/lagrangian/molecule/mdTools/md.H deleted file mode 100755 index 5c018694bd04e9554017011a0e87bded4cc5486e..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/mdTools/md.H +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef md_H -#define md_H - -# include "moleculeCloud.H" - -# include "correlationFunction.H" -# include "distribution.H" -# include "reducedUnits.H" - -#endif - diff --git a/src/lagrangian/molecule/mdTools/meanMomentumEnergyAndNMols.H b/src/lagrangian/molecule/mdTools/meanMomentumEnergyAndNMols.H deleted file mode 100755 index 043e63c5431e75e8c2cb620eae5831bce9fd0de2..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/mdTools/meanMomentumEnergyAndNMols.H +++ /dev/null @@ -1,130 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 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 - -Global - meanMomentumEnergyAndNMols.H - -Description - Calculates and prints the mean momentum and energy in the system - and the number of molecules. - -\*---------------------------------------------------------------------------*/ - - -vector singleStepTotalMomentum(vector::zero); - -scalar singleStepMaxVelocityMag = 0.0; - -scalar singleStepTotalMass = 0.0; - -scalar singleStepTotalKE = 0.0; - -scalar singleStepTotalPE = 0.0; - -scalar singleStepTotalrDotf = 0.0; - -{ - IDLList<molecule>::iterator mol(molecules.begin()); - - for - ( - mol = molecules.begin(); - mol != molecules.end(); - ++mol - ) - { - const scalar molM(mol().mass()); - - const vector& molU(mol().U()); - - singleStepTotalMomentum += molU * molM; - - singleStepTotalMass += molM; - - if(mag(molU) > singleStepMaxVelocityMag) - { - singleStepMaxVelocityMag = mag(molU); - } - - singleStepTotalKE += 0.5*molM*magSqr(molU); - - singleStepTotalPE += mol().potentialEnergy(); - - singleStepTotalrDotf += tr(mol().rf()); - } -} - -label singleStepNMols = molecules.size(); - -if (Pstream::parRun()) -{ - reduce(singleStepTotalMomentum, sumOp<vector>()); - - reduce(singleStepMaxVelocityMag, maxOp<scalar>()); - - reduce(singleStepTotalMass, sumOp<scalar>()); - - reduce(singleStepTotalKE, sumOp<scalar>()); - - reduce(singleStepTotalPE, sumOp<scalar>()); - - reduce(singleStepTotalrDotf, sumOp<scalar>()); - - reduce(singleStepNMols, sumOp<label>()); -} - -if (singleStepNMols) -{ - Info << "Number of mols in system = " - << singleStepNMols << nl - << "Overall number density = " - << singleStepNMols/meshVolume << " m^-3" << nl - << "Overall mass density = " - << singleStepTotalMass/meshVolume << " kg/m^3" << nl - << "Average velocity per mol = " - << singleStepTotalMomentum/singleStepTotalMass << " m/s" << nl - << "Maximum |velocity| = " - << singleStepMaxVelocityMag << " m/s" << nl - << "Average KE per mol = " - << singleStepTotalKE/singleStepNMols << " J" << nl - << "Average PE per mol = " - << singleStepTotalPE/singleStepNMols << " J" << nl - << "Average TE per mol = " - << (singleStepTotalKE + singleStepTotalPE)/singleStepNMols << " J" - << endl; - -// Info << singleStepNMols << " " -// // << singleStepTotalMomentum/singleStepTotalMass << " " -// << singleStepMaxVelocityMag << " " -// << singleStepTotalKE/singleStepNMols << " " -// << singleStepTotalPE/singleStepNMols << " " -// << (singleStepTotalKE + singleStepTotalPE)/singleStepNMols << endl; -} -else -{ - Info << "No molecules in system" << endl; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/mdTools/resetMDFields.H b/src/lagrangian/molecule/mdTools/resetMDFields.H deleted file mode 100755 index e5fdbbd8a46b4947abf691e179ca205c3ab6f03a..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/mdTools/resetMDFields.H +++ /dev/null @@ -1,26 +0,0 @@ -if (runTime.outputTime()) -{ - allSpeciesN_RU = List< scalarField > - ( - molecules.nIds(), - scalarField (mesh.nCells(), 0.0) - ); - - allSpeciesM_RU = List< scalarField > - ( - molecules.nIds(), - scalarField (mesh.nCells(), 0.0) - ); - - allSpeciesVelocitySum_RU = List< vectorField > - ( - molecules.nIds(), - vectorField (mesh.nCells(), vector::zero) - ); - - allSpeciesVelocityMagSquaredSum_RU = List< scalarField > - ( - molecules.nIds(), - scalarField (mesh.nCells(), 0.0) - ); -} diff --git a/src/lagrangian/molecule/mdTools/temperatureAndPressure.H b/src/lagrangian/molecule/mdTools/temperatureAndPressure.H deleted file mode 100755 index 0563700cb73d1008a4ce10857143e907abb3b29e..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/mdTools/temperatureAndPressure.H +++ /dev/null @@ -1,114 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 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 - -Global - temperatureAndPressure.H - -Description - Accumulates values for temperature and pressure measurement, and - calculates and outputs the average values at output times. - Requires temperatureAndPressureVariables.H to be declared before the - timeloop. - -\*---------------------------------------------------------------------------*/ - -accumulatedTotalMomentum += singleStepTotalMomentum; - -accumulatedTotalMass += singleStepTotalMass; - -accumulatedTotalKE += singleStepTotalKE; - -accumulatedTotalPE += singleStepTotalPE; - -accumulatedTotalrDotfSum += singleStepTotalrDotf; - -accumulatedNMols += singleStepNMols; - -if (runTime.outputTime()) -{ - // calculate averages - - if (accumulatedNMols) - { - Info << "calculating averages" << endl; - - averageTemperature = - ( - 2.0/(3.0 * moleculeCloud::kb * accumulatedNMols) - * - ( - accumulatedTotalKE - - - 0.5*magSqr(accumulatedTotalMomentum)/accumulatedTotalMass - ) - ); - - averagePressure = - ( - ( - (accumulatedNMols/nAveragingSteps) - * - moleculeCloud::kb * averageTemperature - + - accumulatedTotalrDotfSum/(6.0 * nAveragingSteps) - ) - / - meshVolume - ); - - // output values - - Info << "----------------------------------------" << nl - << "Averaged properties" << nl - << "Average |velocity| = " - << mag(accumulatedTotalMomentum)/accumulatedTotalMass - << " m/s" << nl - << "Average temperature = " - << averageTemperature << " K" << nl - << "Average pressure = " - << averagePressure << " N/m^2" << nl - << "----------------------------------------" << endl; - } - else - { - Info << "Not averaging temperature and pressure: " - << "no molecules in system" << endl; - } - - // reset counters - - accumulatedTotalMomentum = vector::zero; - - accumulatedTotalMass = 0.0; - - accumulatedTotalKE = 0.0; - - accumulatedTotalPE = 0.0; - - accumulatedTotalrDotfSum = 0.0; - - accumulatedNMols = 0; -} - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/mdTools/temperatureAndPressureVariables.H b/src/lagrangian/molecule/mdTools/temperatureAndPressureVariables.H deleted file mode 100755 index 258cfac314a22658aeee8490f31b55ce46a4d400..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/mdTools/temperatureAndPressureVariables.H +++ /dev/null @@ -1,59 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 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 - -Global - temperatureAndPressureVariables.H - -Description - Provides accumulation variables for temperatureAndPressure.H - -\*---------------------------------------------------------------------------*/ - -vector accumulatedTotalMomentum(vector::zero); - -scalar accumulatedTotalMass = 0.0; - -scalar accumulatedTotalKE = 0.0; - -scalar accumulatedTotalPE = 0.0; - -scalar accumulatedTotalrDotfSum = 0.0; - -label accumulatedNMols = 0; - -scalar averageTemperature = 0.0; - -scalar averagePressure = 0.0; - -const scalarField& cellVols = mesh.cellVolumes(); - -scalar meshVolume = sum(cellVols); - -if (Pstream::parRun()) -{ - reduce(meshVolume, sumOp<scalar>()); -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/mdTools/temperatureEquilibration.H b/src/lagrangian/molecule/mdTools/temperatureEquilibration.H deleted file mode 100755 index c640809cda8fb1d5a5d60ec41f2e638340058840..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/mdTools/temperatureEquilibration.H +++ /dev/null @@ -1,43 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 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 - -Global - temperatureEquilibration.H - -Description - Applies temperature control to molecules - -\*---------------------------------------------------------------------------*/ - -if (runTime.outputTime()) -{ - molecules.applyConstraintsAndThermostats - ( - targetTemperature, - averageTemperature - ); -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/molecule/molecule.C b/src/lagrangian/molecule/molecule/molecule.C deleted file mode 100755 index 0a46a0ca2cd67192e57bde7c8398cb04cdbe204a..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/molecule/molecule.C +++ /dev/null @@ -1,214 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "moleculeCloud.H" -#include "Random.H" -#include "Time.H" - -namespace Foam -{ - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - -bool molecule::move(molecule::trackData& td) -{ - td.switchProcessor = false; - td.keepParticle = true; - - scalar deltaT = cloud().pMesh().time().deltaT().value(); - scalar tEnd = (1.0 - stepFraction())*deltaT; - scalar dtMax = tEnd; - - moleculeCloud::integrationMethods method - = td.molCloud().integrationMethod(); - - if (method == moleculeCloud::imVerletLeapfrog) - { - if (td.part() == 1) // Leapfrog 1st Part - { - if (stepFraction() < VSMALL) - { - U_ += 0.5*deltaT*A_; - } - - while (td.keepParticle && !td.switchProcessor && tEnd > SMALL) - { - // set the lagrangian time-step - scalar dt = min(dtMax, tEnd); - - dt *= trackToFace(position() + dt*U_, td); - - tEnd -= dt; - stepFraction() = 1.0 - tEnd/deltaT; - } - } - else if (td.part() == 2) // Leapfrog 2nd Part - { - U_ += 0.5*deltaT*A_; - } - else - { - FatalErrorIn("molecule::move(molecule::trackData& td)") << nl - << td.part() - << " is an invalid part of integration method: " - << method << nl - << abort(FatalError); - } - } - else if (method == moleculeCloud::imPredictorCorrector) - { - if (td.part() == 1) // Predictor Part - { - - } - else if (td.part() == 2) // Corrector Part - { - - } - else - { - FatalErrorIn("molecule::move(molecule::trackData& td)") << nl - << td.part() << " is an invalid part of integration method: " - << method - << abort(FatalError); - } - } - else - { - FatalErrorIn("molecule::move(molecule::trackData& td)") << nl - << "Unknown integration method: " - << method - << abort(FatalError); - } - - return td.keepParticle; -} - - -void molecule::transformProperties(const tensor& T) -{} - - -void molecule::transformProperties(const vector& separation) -{ - if (tethered_) - { - tetherPosition_ += separation; - } -} - - -void molecule::hitProcessorPatch -( - const processorPolyPatch&, - molecule::trackData& td -) -{ - td.switchProcessor = true; -} - - -void molecule::hitProcessorPatch -( - const processorPolyPatch&, - int& -) -{} - - -void molecule::hitWallPatch -( - const wallPolyPatch& wpp, - molecule::trackData& td -) -{ - vector nw = wpp.faceAreas()[wpp.whichFace(face())]; - nw /= mag(nw); - - scalar Un = U_ & nw; -// vector Ut = U_ - Un*nw; - -// Random rand(clock::getTime()); - -// scalar tmac = 0.8; - -// scalar wallTemp = 2.5; - -// if (rand.scalar01() < tmac) -// { -// // Diffuse reflection -// -// vector tw1 = Ut/mag(Ut); -// -// vector tw2 = nw ^ tw1; -// -// U_ = sqrt(wallTemp/mass_)*rand.GaussNormal()*tw1 -// + sqrt(wallTemp/mass_)*rand.GaussNormal()*tw2 -// - mag(sqrt(wallTemp/mass_)*rand.GaussNormal())*nw; -// } - -// else -// { - // Specular reflection - - if (Un > 0) - { - U_ -= 2*Un*nw; - } -// } - -} - - -void molecule::hitWallPatch -( - const wallPolyPatch&, - int& -) -{} - - -void molecule::hitPatch -( - const polyPatch&, - molecule::trackData& td -) -{ - td.keepParticle = false; -} - - -void molecule::hitPatch -( - const polyPatch&, - int& -) -{} - -} // End namespace Foam - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/molecule/molecule.H b/src/lagrangian/molecule/molecule/molecule.H deleted file mode 100755 index a3e2099589e6c775fb3d889888b2930e049a367b..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/molecule/molecule.H +++ /dev/null @@ -1,271 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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::molecule - -Description - Foam::molecule - -SourceFiles - moleculeI.H - molecule.C - moleculeIO.C - -\*---------------------------------------------------------------------------*/ - -#ifndef molecule_H -#define molecule_H - -#include "Particle.H" -#include "IOstream.H" -#include "autoPtr.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// Class forward declarations -class moleculeCloud; - -/*---------------------------------------------------------------------------*\ - Class molecule Declaration -\*---------------------------------------------------------------------------*/ - -class molecule -: - public Particle<molecule> -{ - // Private data - - //- Be careful with the ordering of data. It has an impact on binary - // transfer: - // 1) Put the largest data members 1st - // 2) Pair up labels, - // 3) Don't go scalar-label, scalar-label, becasue in 64bit mode, - // the labels will be padded by 4bytes. - - // - mass of molecule - scalar mass_; - - // - Velocity of molecule - vector U_; - - // - Acceleration of molecule - vector A_; - - // - Tether position - vector tetherPosition_; - - // - Potential energy that this molecules posseses - scalar potentialEnergy_; - - // - r_ij f_ij, stress dyad - tensor rf_; - - // - Is the molecule tethered? - label tethered_; - - // - id (type) of molecule - label id_; - - -public: - - friend class Cloud<molecule>; - - //- Class used to pass tracking data to the trackToFace function - class trackData - : - public Particle<molecule>::trackData - { - //- Reference to the cloud containing this particle - moleculeCloud& molCloud_; - - // label specifying which part of the integration algorithm is taking - // place (i.e. leapfrog 1 or leapfrog 2. Predictor or Corrector) - label part_; - - - public: - - // Constructors - - inline trackData - ( - moleculeCloud& molCloud, - label part - ); - - // Member functions - - inline moleculeCloud& molCloud(); - - inline label part() const; - }; - - // Constructors - - //- Construct from components - inline molecule - ( - const Cloud<molecule>& c, - const vector& position, - const label celli, - const scalar mass, - const vector& U, - const vector& A, - const vector& tetherPosition, - const label tethered, - const label id - ); - - //- Construct from Istream - molecule - ( - const Cloud<molecule>& c, - Istream& is, - bool readFields = true - ); - - //- Construct and return a clone - autoPtr<molecule> clone() const - { - return autoPtr<molecule>(new molecule(*this)); - } - - - // Member Functions - - void transformProperties(const tensor& T); - - void transformProperties(const vector& separation); - - // Access - - //- Return id - inline label id() const; - - //- Return mass - inline scalar mass() const; - - //- Return velocity - inline const vector& U() const; - inline vector& U(); - - //- Return acceleration - inline const vector& A() const; - inline vector& A(); - - //- Return potential energy - inline scalar potentialEnergy() const; - inline scalar& potentialEnergy(); - - //- Return stress contribution - inline const tensor& rf() const; - inline tensor& rf(); - - //- Return tethered - inline label tethered() const; - - //- Return tetherPosition - inline const vector& tetherPosition() const; - - - //- Tracking - bool move(trackData&); - - - // Member Operators - - //- Overridable function to handle the particle hitting a - // processorPatch - void hitProcessorPatch - ( - const processorPolyPatch&, - molecule::trackData& td - ); - - //- Overridable function to handle the particle hitting a - // processorPatch without trackData - void hitProcessorPatch - ( - const processorPolyPatch&, - int& - ); - - //- Overridable function to handle the particle hitting a wallPatch - void hitWallPatch - ( - const wallPolyPatch&, - molecule::trackData& td - ); - - //- Overridable function to handle the particle hitting a wallPatch - //- without trackData - void hitWallPatch - ( - const wallPolyPatch&, - int& - ); - - //- Overridable function to handle the particle hitting a polyPatch - void hitPatch - ( - const polyPatch&, - molecule::trackData& td - ); - - //- Overridable function to handle the particle hitting a polyPatch - //- without trackData - void hitPatch - ( - const polyPatch&, - int& - ); - - static void readFields(moleculeCloud& mC); - - static void writeFields(const moleculeCloud& mC); - - - // IOstream Operators - - friend Ostream& operator<<(Ostream&, const molecule&); -}; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "moleculeI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/molecule/moleculeI.H b/src/lagrangian/molecule/molecule/moleculeI.H deleted file mode 100755 index bfbda044b14f3d43b864ab3c9eea0ce71ab2c855..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/molecule/moleculeI.H +++ /dev/null @@ -1,152 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 - -\*---------------------------------------------------------------------------*/ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -inline Foam::molecule::molecule -( - const Cloud<molecule>& c, - const vector& position, - const label celli, - const scalar mass, - const vector& U, - const vector& A, - const vector& tetherPosition, - const label tethered, - const label id -) -: - Particle<molecule>(c, position, celli), - mass_(mass), - U_(U), - A_(A), - tetherPosition_(tetherPosition), - potentialEnergy_(0.0), - rf_(tensor::zero), - tethered_(tethered), - id_(id) -{} - - -inline Foam::molecule::trackData::trackData -( - moleculeCloud& molCloud, - label part -) -: - Particle<molecule>::trackData(refCast<Cloud<molecule> >(molCloud)), - molCloud_(molCloud), - part_(part) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -inline Foam::label Foam::molecule::id() const -{ - return id_; -} - - -inline Foam::scalar Foam::molecule::mass() const -{ - return mass_; -} - - -inline const Foam::vector& Foam::molecule::U() const -{ - return U_; -} - - -inline Foam::vector& Foam::molecule::U() -{ - return U_; -} - - -inline const Foam::vector& Foam::molecule::A() const -{ - return A_; -} - - -inline Foam::vector& Foam::molecule::A() -{ - return A_; -} - - -inline Foam::scalar Foam::molecule::potentialEnergy() const -{ - return potentialEnergy_; -} - - -inline Foam::scalar& Foam::molecule::potentialEnergy() -{ - return potentialEnergy_; -} - - -inline const Foam::tensor& Foam::molecule::rf() const -{ - return rf_; -} - - -inline Foam::tensor& Foam::molecule::rf() -{ - return rf_; -} - - -inline Foam::label Foam::molecule::tethered() const -{ - return tethered_; -} - - -inline const Foam::vector& Foam::molecule::tetherPosition() const -{ - return tetherPosition_; -} - - -inline Foam::moleculeCloud& Foam::molecule::trackData::molCloud() -{ - return molCloud_; -} - - -inline Foam::label Foam::molecule::trackData::part() const -{ - return part_; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/molecule/moleculeIO.C b/src/lagrangian/molecule/molecule/moleculeIO.C deleted file mode 100755 index f87b80cd46a56f2de62b1b720141b4c4a30e847f..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/molecule/moleculeIO.C +++ /dev/null @@ -1,208 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "molecule.H" -#include "IOstreams.H" - -#include "moleculeCloud.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::molecule::molecule -( - const Cloud<molecule>& cloud, - Istream& is, - bool readFields -) -: - Particle<molecule>(cloud, is) -{ - if (readFields) - { - if (is.format() == IOstream::ASCII) - { - id_ = readLabel(is); - mass_ = readScalar(is); - is >> U_; - is >> A_; - is >> potentialEnergy_; - is >> rf_; - is >> tethered_; - is >> tetherPosition_; - } - else - { - is.read - ( - reinterpret_cast<char*>(&mass_), - sizeof(mass_) - + sizeof(U_) - + sizeof(A_) - + sizeof(tetherPosition_) - + sizeof(potentialEnergy_) - + sizeof(rf_) - + sizeof(tethered_) - + sizeof(id_) - ); - } - } - - // Check state of Istream - is.check("Foam::molecule::molecule(Foam::Istream&)"); -} - - -namespace Foam -{ - -void molecule::readFields(moleculeCloud& mC) -{ - if (!mC.size()) - { - return; - } - - IOField<label> id(mC.fieldIOobject("id")); - mC.checkFieldIOobject(mC, id); - - IOField<scalar> mass(mC.fieldIOobject("mass")); - mC.checkFieldIOobject(mC, mass); - - IOField<vector> U(mC.fieldIOobject("U")); - mC.checkFieldIOobject(mC, U); - - IOField<vector> A(mC.fieldIOobject("A")); - mC.checkFieldIOobject(mC, A); - - IOField<label> tethered(mC.fieldIOobject("tethered")); - mC.checkFieldIOobject(mC, tethered); - - IOField<vector> tetherPositions(mC.fieldIOobject("tetherPositions")); - mC.checkFieldIOobject(mC, tetherPositions); - - label i = 0; - forAllIter(moleculeCloud, mC, iter) - { - molecule& mol = iter(); - - mol.id_ = id[i]; - mol.mass_ = mass[i]; - mol.U_ = U[i]; - mol.A_ = A[i]; - mol.potentialEnergy_ = 0.0; - mol.rf_ = tensor::zero; - mol.tethered_ = tethered[i]; - mol.tetherPosition_ = tetherPositions[i]; - i++; - } -} - - -void molecule::writeFields(const moleculeCloud& mC) -{ - Particle<molecule>::writeFields(mC); - - label np = mC.size(); - - IOField<label> id(mC.fieldIOobject("id"), np); - IOField<scalar> mass(mC.fieldIOobject("mass"), np); - IOField<vector> U(mC.fieldIOobject("U"), np); - IOField<vector> A(mC.fieldIOobject("A"), np); - IOField<label> tethered(mC.fieldIOobject("tethered"), np); - IOField<vector> tetherPositions(mC.fieldIOobject("tetherPositions"), np); - - label i = 0; - forAllConstIter(moleculeCloud, mC, iter) - { - const molecule& mol = iter(); - - id[i] = mol.id_; - mass[i] = mol.mass_; - U[i] = mol.U_; - A[i] = mol.A_; - tethered[i] = mol.tethered_; - tetherPositions[i] = mol.tetherPosition_; - i++; - } - - id.write(); - mass.write(); - U.write(); - A.write(); - tethered.write(); - tetherPositions.write(); -} - -}; // end of namespace Foam - - -// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // - -Foam::Ostream& Foam::operator<<(Ostream& os, const molecule& mol) -{ - if (os.format() == IOstream::ASCII) - { - os << mol.id_ - << token::SPACE << mol.mass_ - << token::SPACE << static_cast<const Particle<molecule>&>(mol) - << token::SPACE << mol.face() - << token::SPACE << mol.stepFraction() - << token::SPACE << mol.U_ - << token::SPACE << mol.A_ - << token::SPACE << mol.potentialEnergy_ - << token::SPACE << mol.rf_ - << token::SPACE << mol.tethered_ - << token::SPACE << mol.tetherPosition_; - } - else - { - os << static_cast<const Particle<molecule>&>(mol); - os.write - ( - reinterpret_cast<const char*>(&mol.mass_), - sizeof(mol.mass_) - + sizeof(mol.U_) - + sizeof(mol.A_) - + sizeof(mol.tetherPosition_) - + sizeof(mol.potentialEnergy_) - + sizeof(mol.rf_) - + sizeof(mol.tethered_) - + sizeof(mol.id_) - ); - } - - // Check state of Ostream - os.check - ( - "Foam::Ostream& Foam::operator<<" - "(Foam::Ostream&, const Foam::molecule&)" - ); - - return os; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloud.C b/src/lagrangian/molecule/moleculeCloud/moleculeCloud.C deleted file mode 100755 index cf0ebebc7c98d4f70348551f1daf6afa06d9656e..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloud.C +++ /dev/null @@ -1,135 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "moleculeCloud.H" -#include "fvMesh.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - defineParticleTypeNameAndDebug(molecule, 0); - defineTemplateTypeNameAndDebug(Cloud<molecule>, 0); -}; - - -template<> -const char* Foam::NamedEnum<Foam::moleculeCloud:: -integrationMethods, 2>::names[] = -{ - "verletLeapfrog", - "predictorCorrector" -}; - -const Foam::NamedEnum<Foam::moleculeCloud::integrationMethods, 2> - Foam::moleculeCloud::integrationMethodNames_; - - -Foam::scalar Foam::moleculeCloud::transTol = 1e-12; - -Foam::scalar Foam::moleculeCloud::kb = 1.380650277e-23; - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::moleculeCloud::moleculeCloud(const polyMesh& mesh) -: - Cloud<molecule>(mesh, "moleculeCloud", false), - mesh_(mesh), - referredInteractionList_(*this) -{ - molecule::readFields(*this); - -# include "moleculeCloudReadMDParameters.H" - - buildCellInteractionLists(); - - buildCellReferralLists(); - - buildCellOccupancy(); -} - - -Foam::moleculeCloud::moleculeCloud -( - const polyMesh& mesh, - label nMol, - const labelField& id, - const scalarField& mass, - const vectorField& positions, - const labelField& cells, - const vectorField& U, - const vectorField& A, - const labelField& tethered, - const vectorField& tetherPositions -) -: - Cloud<molecule>(mesh, "moleculeCloud", false), - mesh_(mesh), - referredInteractionList_(*this) -{ - molecule::readFields(*this); - - clear(); - - // This clear ()is here for the moment to stop existing files - // being appended to, this would be better accomplished by getting - // mesh.removeFiles(mesh.instance()); (or equivalent) to work. - - int i; - - const Cloud<molecule>& cloud = *this; - - for (i=0; i<nMol; i++) - { - addParticle - ( - new molecule - ( - cloud, - positions[i], - cells[i], - mass[i], - U[i], - A[i], - tetherPositions[i], - tethered[i], - id[i] - ) - ); - } -}; - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::moleculeCloud::writeFields() const -{ - molecule::writeFields(*this); -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloud.H b/src/lagrangian/molecule/moleculeCloud/moleculeCloud.H deleted file mode 100755 index 37d8cf22bb1270c08da53ae2e2cd5fcaeea2577a..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloud.H +++ /dev/null @@ -1,350 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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::moleculeCloud - -Description - -SourceFiles - moleculeCloudApplyConstraintsAndThermostats.C - moleculeCloudBuildCellInteractionLists.C - moleculeCloudBuildCellOccupancy.C - moleculeCloudBuildCellReferralLists.C - moleculeCloud.C - moleculeCloudCalculateAndAccumulateProperties.C - moleculeCloudCalculateExternalForce.C - moleculeCloudCalculateForce.C - moleculeCloudCalculatePairForce.C - moleculeCloudCalculateTetherForce.C - moleculeCloudIntegrateEquationsOfMotion.C - moleculeCloudRemoveHighEnergyOverlaps.C - - -\*---------------------------------------------------------------------------*/ - -#ifndef moleculeCloud_H -#define moleculeCloud_H - -#include "Cloud.H" -#include "molecule.H" -#include "IOdictionary.H" -#include "vector2D.H" - -#include "pairPotentialList.H" -#include "tetherPotentialList.H" - -#include "receivingReferralList.H" -#include "sendingReferralList.H" -#include "referredCellList.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class moleculeCloud Declaration -\*---------------------------------------------------------------------------*/ - -class moleculeCloud -: - public Cloud<molecule> -{ - -public: - - enum integrationMethods - { - imVerletLeapfrog, - imPredictorCorrector - }; - - -private: - - // Private data - - const polyMesh& mesh_; - - // MD solution parameters - - static const NamedEnum<integrationMethods, 2> - integrationMethodNames_; - - integrationMethods integrationMethod_; - - scalar potentialEnergyLimit_; - - scalar guardRadius_; - - scalar rCutMax_; - - //- storing rCutMaxSqr in class as well as rCutMax to - //- avoid needing to calculate it often. - //- Possibilty of inconsistency if tinkered with. - - scalar rCutMaxSqr_; - - List<word> idList_; - - labelList removalOrder_; - - labelListList directInteractionList_; - - referredCellList referredInteractionList_; - - labelList realCellsWithinRCutMaxOfAnyReferringPatch_; - - labelList realFacesWithinRCutMaxOfAnyReferringPatch_; - - labelList realEdgesWithinRCutMaxOfAnyReferringPatch_; - - labelList realPointsWithinRCutMaxOfAnyReferringPatch_; - - List<sendingReferralList> cellSendingReferralLists_; - - List<receivingReferralList> cellReceivingReferralLists_; - - pairPotentialList pairPotentials_; - - tetherPotentialList tetherPotentials_; - - vector gravity_; - - List< DynamicList<molecule*> > cellOccupancy_; - - - // Private Member Functions - - //- Disallow default bitwise copy construct - moleculeCloud(const moleculeCloud&); - - //- Disallow default bitwise assignment - void operator=(const moleculeCloud&); - - -public: - - // Static data members - - //- Tolerance for checking that faces on a patch segment - static scalar transTol; - - static scalar kb; - - - // Constructors - - //- Construct given mesh - moleculeCloud(const polyMesh&); - - //- Construct given polyMesh and fields of position, cell, mass, - //- id, U ands A. Intended for use by the molConfig utility - moleculeCloud - ( - const polyMesh& mesh, - label nMol, - const labelField& id, - const scalarField& mass, - const vectorField& positions, - const labelField& cells, - const vectorField& U, - const vectorField& A, - const labelField& tethered, - const vectorField& tetherPositions - ); - - - // Member Functions - - // Access - - inline const polyMesh& mesh() const; - - // MD solution parameters - - inline const integrationMethods& integrationMethod() const; - - inline scalar potentialEnergyLimit() const; - - inline scalar guardRadius() const; - - inline scalar rCutMax() const; - - inline scalar rCutMaxSqr() const; - - inline const List<word>& idList() const; - - inline const labelList& removalOrder() const; - - inline label nPairPotentials() const; - - inline label nIds() const; - - inline const labelListList& directInteractionList() const; - - inline const referredCellList& referredInteractionList() const; - - inline const labelList& - realCellsWithinRCutMaxOfAnyReferringPatch() const; - - inline const labelList& - realFacesWithinRCutMaxOfAnyReferringPatch() const; - - inline const labelList& - realEdgesWithinRCutMaxOfAnyReferringPatch() const; - - inline const labelList& - realPointsWithinRCutMaxOfAnyReferringPatch() const; - - inline const List<sendingReferralList>& - cellSendingReferralLists() const; - - inline const List<receivingReferralList>& - cellReceivingReferralLists() const; - - inline label nInteractingProcs() const; - - inline const pairPotentialList& pairPotentials() const; - - inline const tetherPotentialList& tetherPotentials() const; - - inline const vector& gravity() const; - - inline const List< DynamicList<molecule*> >& cellOccupancy() const; - - void buildCellInteractionLists(); - - //- Build referralLists which define how to send information - // to referredCells to source cells - void buildCellReferralLists(); - - bool testPointFaceDistance - ( - const label p, - const label faceNo - ) const; - - bool testPointFaceDistance - ( - const label p, - const referredCell& refCell - ) const; - - bool testPointFaceDistance - ( - const vectorList& pointsToTest, - const label faceNo - ) const; - - bool testPointFaceDistance - ( - const vector& p, - const label faceNo - ) const; - - bool testPointFaceDistance - ( - const vector& p, - const labelList& faceToTest, - const vectorList& points, - const vector& faceC, - const vector& faceA - ) const; - - bool testEdgeEdgeDistance - ( - const edge& eI, - const edge& eJ - ) const; - - bool testEdgeEdgeDistance - ( - const edge& eI, - const vector& eJs, - const vector& eJe - ) const; - - const labelList realCellsInRangeOfSegment - ( - const labelList& segmentFaces, - const labelList& segmentEdges, - const labelList& segmentPoints - ) const; - - const labelList referredCellsInRangeOfSegment - ( - const List<referredCell>& referredInteractionList, - const labelList& segmentFaces, - const labelList& segmentEdges, - const labelList& segmentPoints - ) const; - - //- Determine which molecules are in which cells - void buildCellOccupancy(); - - //- Integrate the equations of motion using algorithm selected at - // runtime from a dictionary. This will also call the function - // to calculate the intermolecular forces (calculatePairForce()). - - void integrateEquationsOfMotion(); - - void applyConstraintsAndThermostats - ( - const scalar targetTemperature, - const scalar measuredTemperature - ); - - void calculateForce(); - - void calculatePairForce(); - - void calculateTetherForce(); - - void calculateExternalForce(); - - void removeHighEnergyOverlaps(); - - - // Member Operators - - //- Write fields - void writeFields() const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "moleculeCloudI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudApplyConstraintsAndThermostats.C b/src/lagrangian/molecule/moleculeCloud/moleculeCloudApplyConstraintsAndThermostats.C deleted file mode 100755 index d44b247d7bf73b039d57aeec612311440ea0d83f..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudApplyConstraintsAndThermostats.C +++ /dev/null @@ -1,60 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "moleculeCloud.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -void Foam::moleculeCloud::applyConstraintsAndThermostats -( - const scalar targetTemperature, - const scalar measuredTemperature -) -{ - scalar temperatureCorrectionFactor = - sqrt(targetTemperature/measuredTemperature); - - Info<< "----------------------------------------" << nl - << "Temperature equilibration" << nl - << "Target temperature = " - << targetTemperature << nl - << "Measured temperature = " - << measuredTemperature << nl - << "Temperature correction factor =" - << temperatureCorrectionFactor << nl - << "----------------------------------------" - << endl; - - iterator mol(this->begin()); - - for (mol = this->begin(); mol != this->end(); ++mol) - { - mol().U() *= temperatureCorrectionFactor; - } -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildCellInteractionLists.C b/src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildCellInteractionLists.C deleted file mode 100755 index a8d9cc8db5678dffa1bc86605a0d67613a773bfe..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildCellInteractionLists.C +++ /dev/null @@ -1,80 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "moleculeCloud.H" -#include "polyBoundaryMeshEntries.H" -#include "PstreamCombineReduceOps.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -void Foam::moleculeCloud::buildCellInteractionLists() -{ -// # include "moleculeCloudCodeSnippets.H" - - List<DynamicList<label> > directInteractionList(mesh_.nCells()); - -# include "moleculeCloudBuildDirectInteractionList.H" - - directInteractionList_.setSize(mesh_.nCells()); - - forAll(directInteractionList, transDIL) - { - directInteractionList_[transDIL].transfer - ( - directInteractionList[transDIL].shrink() - ); - } - -// for sorting DILs - -// forAll(directInteractionList_, dIL) -// { -// sort(directInteractionList_[dIL]); -// } - - cellOccupancy_.setSize(mesh_.nCells()); - - DynamicList<referredCell> referredInteractionList; - -# include "moleculeCloudBuildReferredInteractionList.H" - -//# include "moleculeCloudBuildReferredInteractionList_old.H" - - referredInteractionList_.setSize - ( - referredInteractionList.size() - ); - - forAll(referredInteractionList, rIL) - { - referredInteractionList_[rIL] = referredInteractionList[rIL]; - } - - referredInteractionList_.setRealCellsInRange(); -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildCellOccupancy.C b/src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildCellOccupancy.C deleted file mode 100755 index f02be61f7efc30adfca2faee72eea507cd81c983..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildCellOccupancy.C +++ /dev/null @@ -1,54 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "moleculeCloud.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -void Foam::moleculeCloud::buildCellOccupancy() -{ - forAll(cellOccupancy_, cO) - { - cellOccupancy_[cO].clear(); - } - - iterator mol(this->begin()); - - for (mol = this->begin(); mol != this->end(); ++mol) - { - cellOccupancy_[mol().cell()].append(&mol()); - } - - forAll(cellOccupancy_, cO) - { - cellOccupancy_[cO].shrink(); - } - - referredInteractionList_.referMolecules(); -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildCellReferralLists.C b/src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildCellReferralLists.C deleted file mode 100755 index ea1521800f82b6c20b49f6f2f39f24d4efa4bab3..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildCellReferralLists.C +++ /dev/null @@ -1,194 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "moleculeCloud.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -void Foam::moleculeCloud::buildCellReferralLists() -{ - Info<< nl << "Determining molecule referring schedule" << endl; - - const referredCellList& refIntL(referredInteractionList()); - - DynamicList<label> referralProcs; - - // Run through all referredCells to build list of interacting processors - - forAll(refIntL, rIL) - { - const referredCell& rC(refIntL[rIL]); - - if (findIndex(referralProcs, rC.sourceProc()) == -1) - { - referralProcs.append(rC.sourceProc()); - } - } - - referralProcs.shrink(); - -// Pout << "referralProcs: " << nl << referralProcs << endl; - - List<DynamicList<label> > cellSendingReferralLists(referralProcs.size()); - - List<DynamicList<DynamicList<label> > > - cellReceivingReferralLists(referralProcs.size()); - - // Run through all referredCells again building up send and receive info - - forAll(refIntL, rIL) - { - const referredCell& rC(refIntL[rIL]); - - label rPI = findIndex(referralProcs, rC.sourceProc()); - - DynamicList<DynamicList<label> >& rRL(cellReceivingReferralLists[rPI]); - - DynamicList<label>& sRL(cellSendingReferralLists[rPI]); - - label existingSource = findIndex(sRL, rC.sourceCell()); - - // Check to see if this source cell has already been allocated to - // come to this processor. If not, add the source cell to the sending - // list and add the current referred cell to the receiving list. - - // It shouldn't be possible for the sending and receiving lists to be - // different lengths, because their append operations happen at the - // same time. - - if (existingSource == -1) - { - sRL.append(rC.sourceCell()); - - rRL.append - ( - DynamicList<label> (labelList(1,rIL)) - ); - } - else - { - rRL[existingSource].append(rIL); - - rRL[existingSource].shrink(); - } - } - - forAll(referralProcs, rPI) - { - DynamicList<DynamicList<label> >& rRL(cellReceivingReferralLists[rPI]); - - DynamicList<label>& sRL(cellSendingReferralLists[rPI]); - - sRL.shrink(); - - rRL.shrink(); - } - - // It is assumed that cell exchange is reciprocal, if proc A has cells to - // send to proc B, then proc B must have some to send to proc A. - - cellReceivingReferralLists_.setSize(referralProcs.size()); - - cellSendingReferralLists_.setSize(referralProcs.size()); - - forAll(referralProcs, rPI) - { - DynamicList<DynamicList<label> >& rRL(cellReceivingReferralLists[rPI]); - - labelListList translLL(rRL.size()); - - forAll(rRL, rRLI) - { - translLL[rRLI] = rRL[rRLI]; - } - - cellReceivingReferralLists_[rPI] = receivingReferralList - ( - referralProcs[rPI], - translLL - ); - } - - // Send sendingReferralLists to each interacting processor. - - forAll(referralProcs, rPI) - { - - DynamicList<label>& sRL(cellSendingReferralLists[rPI]); - - if (referralProcs[rPI] != Pstream::myProcNo()) - { - if (Pstream::parRun()) - { - OPstream toInteractingProc - ( - Pstream::blocking, - referralProcs[rPI] - ); - - toInteractingProc << sendingReferralList - ( - Pstream::myProcNo(), - sRL - ); - } - } - } - - // Receive sendingReferralLists from each interacting processor. - - forAll(referralProcs, rPI) - { - if (referralProcs[rPI] != Pstream::myProcNo()) - { - if (Pstream::parRun()) - { - IPstream fromInteractingProc - ( - Pstream::blocking, - referralProcs[rPI] - ); - - fromInteractingProc >> cellSendingReferralLists_[rPI]; - } - } - else - { - cellSendingReferralLists_[rPI] = sendingReferralList - ( - Pstream::myProcNo(), - cellSendingReferralLists[rPI] - ); - } - } - -// Pout << "receiving list: " << nl << cellReceivingReferralLists_ << endl; - -// Pout << "sending list: " << nl << cellSendingReferralLists_ << endl; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildCellsFoundInRange.H b/src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildCellsFoundInRange.H deleted file mode 100755 index 16c58efea3af289a1d8b518ece6b14225cdf8683..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildCellsFoundInRange.H +++ /dev/null @@ -1,52 +0,0 @@ -forAll (pointsOnThisSegment, pS) -{ - const point& ptP = mesh_.points()[pointsOnThisSegment[pS]]; - - // Assessing real cells in range is only required on the 1st iteration - // because they do not change from iteration to iteration. - - if (iterationNo == 0) - { - forAll (mesh_.points(), pointIIndex) - { - - // Compare separation of ptP to all other points in the mesh, - // add unique reference to cell with any point within rCutMax_ - // to realCellsFoundInRange. - - const point& ptI(mesh_.points()[pointIIndex]); - - if (magSqr(ptP - ptI) <= rCutMaxSqr) - { - const labelList& ptICells(mesh_.pointCells()[pointIIndex]); - - forAll(ptICells, pIC) - { - const label cellI(ptICells[pIC]); - - if(findIndex(realCellsFoundInRange, cellI) == -1) - { - realCellsFoundInRange.append(cellI); - } - } - } - } - } - - forAll(referredInteractionList, rIL) - { - const vectorList& refCellPoints = - referredInteractionList[rIL].vertexPositions(); - - forAll(refCellPoints, rCP) - { - if (magSqr(ptP - refCellPoints[rCP]) <= rCutMaxSqr) - { - if(findIndex(referredCellsFoundInRange, rIL) == -1) - { - referredCellsFoundInRange.append(rIL); - } - } - } - } -} diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildDirectInteractionList.H b/src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildDirectInteractionList.H deleted file mode 100755 index c5f2d887bf59e62a6ce2fcc887a4ef7a89493f2f..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildDirectInteractionList.H +++ /dev/null @@ -1,188 +0,0 @@ -Info << nl << "Building list of direct interaction neighbours" << endl; - -forAll (mesh_.points(), p) -{ - forAll(mesh_.faces(), f) - { - if(testPointFaceDistance(p, f)) - { - const labelList& pCells(mesh_.pointCells()[p]); - - const label cellO(mesh_.faceOwner()[f]); - - const label cellN(mesh_.faceNeighbour()[f]); - - forAll(pCells, pC) - { - const label cellI(pCells[pC]); - - // cells are not added to their own DIL - - if (cellO > cellI) - { - if (findIndex(directInteractionList[cellI], cellO) == -1) - { - directInteractionList[cellI].append(cellO); - } - } - - if (cellI > cellO) - { - if (findIndex(directInteractionList[cellO], cellI) == -1) - { - directInteractionList[cellO].append(cellI); - } - } - - if (mesh_.isInternalFace(f)) - { - // boundary faces will not have neighbour information - - if (cellN > cellI) - { - if - ( - findIndex(directInteractionList[cellI], cellN) - == -1 - ) - { - directInteractionList[cellI].append(cellN); - } - } - - if (cellI > cellN) - { - if - ( - findIndex(directInteractionList[cellN], cellI) - == -1 - ) - { - directInteractionList[cellN].append(cellI); - } - } - } - } - } - } -} - -label edgeJIndex; - -forAll (mesh_.edges(), edgeIIndex) -{ - const edge& eI(mesh_.edges()[edgeIIndex]); - - for - ( - edgeJIndex = edgeIIndex + 1; - edgeJIndex != mesh_.edges().size(); - ++edgeJIndex - ) - { - const edge& eJ(mesh_.edges()[edgeJIndex]); - - if (testEdgeEdgeDistance(eI, eJ)) - { - const labelList& eICells(mesh_.edgeCells()[edgeIIndex]); - - const labelList& eJCells(mesh_.edgeCells()[edgeJIndex]); - - forAll(eICells, eIC) - { - const label cellI(eICells[eIC]); - - forAll(eJCells, eJC) - { - const label cellJ(eJCells[eJC]); - - if (cellJ > cellI) - { - if - ( - findIndex(directInteractionList[cellI], cellJ) - == -1 - ) - { - directInteractionList[cellI].append(cellJ); - } - } - - if (cellI > cellJ) - { - if - ( - findIndex(directInteractionList[cellJ], cellI) - == -1 - ) - { - directInteractionList[cellJ].append(cellI); - } - } - } - } - } - } -} - -// label pointJIndex; -// -// forAll (mesh_.points(), pointIIndex) -// { -// const point& ptI -// ( -// mesh_.points()[pointIIndex] -// ); -// -// for -// ( -// pointJIndex = pointIIndex; -// pointJIndex != mesh_.points().size(); -// ++pointJIndex -// ) -// { -// const point& ptJ -// ( -// mesh_.points()[pointJIndex] -// ); -// -// if (magSqr(ptI - ptJ) <= rCutMaxSqr) -// { -// const labelList& ptICells -// ( -// mesh_.pointCells()[pointIIndex] -// ); -// -// const labelList& ptJCells -// ( -// mesh_.pointCells()[pointJIndex] -// ); -// -// forAll(ptICells, pIC) -// { -// const label cellI(ptICells[pIC]); -// -// forAll(ptJCells, pJC) -// { -// const label cellJ(ptJCells[pJC]); -// -// if (cellJ > cellI) -// { -// if(findIndex(directInteractionList[cellI], cellJ) == -1) -// { -// directInteractionList[cellI].append(cellJ); -// } -// } -// -// if (cellI > cellJ) -// { -// if(findIndex(directInteractionList[cellJ], cellI) == -1) -// { -// directInteractionList[cellJ].append(cellI); -// } -// } -// } -// } -// } -// } -// } diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildReferredInteractionList.H b/src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildReferredInteractionList.H deleted file mode 100755 index 5e1de7206281e1b13805615048a1d11559c4ed7e..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildReferredInteractionList.H +++ /dev/null @@ -1,1285 +0,0 @@ -Info << nl << "Building list of referred interaction neighbours" << endl; - -labelListList processorPatchSegmentMapping -( - mesh_.globalData().processorPatches().size() -); - -List<vectorList> allNeighbourFaceCentres -( - mesh_.globalData().processorPatches().size() -); - -List<vectorList> allNeighbourFaceAreas -( - mesh_.globalData().processorPatches().size() -); - -label nUndecomposedPatches = 0; - -if (Pstream::parRun()) -{ - dictionary patchDictionary; - - DynamicList<word> patchNames; - -// IOobject undecomposedBoundaryHeader -// ( -// "undecomposedBoundary", -// mesh_.time().constant(), -// polyMesh::meshSubDir, -// mesh_, -// IOobject::MUST_READ, -// IOobject::NO_WRITE, -// false -// ); - - Time undecomposedTime - ( - Time::controlDictName, - mesh_.time().rootPath(), - mesh_.time().caseName().path() - ); - - IOobject undecomposedBoundaryHeader - ( - "boundary", - undecomposedTime.constant(), - polyMesh::meshSubDir, - undecomposedTime, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ); - - if (undecomposedBoundaryHeader.headerOk()) - { - polyBoundaryMeshEntries undecomposedPatchEntries - ( - undecomposedBoundaryHeader - ); - - forAll(undecomposedPatchEntries, patchi) - { - patchNames.append - ( - undecomposedPatchEntries[patchi].keyword() - ); - - patchDictionary.add - ( - undecomposedPatchEntries[patchi] - ); - } - } - else - { - FatalErrorIn - ( - "moleculeCloudBuildCellInteractionLists.C" - ) - << nl << "unable to read undecomposed boundary file from " - "constant/polyMesh" << nl - << abort(FatalError); - } - - labelIOList faceProcAddressing - ( - IOobject - ( - "faceProcAddressing", - mesh_.time().constant(), - polyMesh::meshSubDir, - mesh_, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ) - ); - - labelList procPatches(mesh_.globalData().processorPatches()); - - nUndecomposedPatches = patchNames.size(); - - // processorPatchSegmentMapping works by mapping the original patch - // and half that a face on a processor patch was on before decomposition. - // This creates a patch segment for each half of each original (cyclic) - // patch which can be assessed separately. - // There are n = patchNames.size() original patches, k = 0 to n-1. - // The mapping is: - // value = 0: originally an internal face - // value = k, was originally on the on the patch k-1, 1st half - // value = -k, was originally on the on the patch k-1, 2nd half - - forAll(procPatches,pP) - { - const processorPolyPatch& patch = - refCast<const processorPolyPatch> - ( - mesh_.boundaryMesh()[procPatches[pP]] - ); - - labelList& procPatchSegMap = processorPatchSegmentMapping[pP]; - - procPatchSegMap.setSize(patch.size()); - - forAll (patch, pI) - { - label decomposedMeshFace = patch.start() + pI; - - label faceProcAdd = faceProcAddressing[decomposedMeshFace]; - - label globalFace = abs(faceProcAdd)-1; - -// Pout << "Patch index: " << pI -// << " " << patch[pI] -// << " Mesh index: " << decomposedMeshFace -// << " faceProcAdd: " << faceProcAdd -// << " globalFace:" << globalFace << endl; - - label minStart = -1; - - forAll(patchNames, pN) - { - if (patchDictionary.found(patchNames[pN])) - { - const dictionary& patchDict = - patchDictionary.subDict(patchNames[pN]); - -// word faceName(patchNames[pN]); - label startFace(readLabel(patchDict.lookup("startFace"))); - label nFaces(readLabel(patchDict.lookup("nFaces"))); - - if (minStart < 0 || startFace < minStart) - { - minStart = startFace; - } - - if - ( - globalFace >= startFace - && globalFace < startFace + nFaces/2 - ) - { - procPatchSegMap[pI] = pN + 1; - } - else if - ( - globalFace >= startFace + nFaces/2 - && globalFace < startFace + nFaces - ) - { - procPatchSegMap[pI] = -(pN + 1); - } - } - } - - if (globalFace < minStart) - { - procPatchSegMap[pI] = 0; - } - } - } - - forAll(procPatches,pP) - { - const processorPolyPatch& patch = - refCast<const processorPolyPatch> - ( - mesh_.boundaryMesh()[procPatches[pP]] - ); - - { - OPstream toNeighbProc - ( - Pstream::blocking, - patch.neighbProcNo(), - + 2*(sizeof(label) + patch.size()*sizeof(vector)) - ); - - toNeighbProc - << patch.faceCentres() - << patch.faceAreas(); - -// Pout << "sending face info to processor " -// << patch.neighbProcNo() << ", size = " -// << patch.size() << endl; - } - } - - forAll(procPatches,pP) - { - const processorPolyPatch& patch = - refCast<const processorPolyPatch> - ( - mesh_.boundaryMesh()[procPatches[pP]] - ); - - vectorList& neighbFaceCentres = allNeighbourFaceCentres[pP]; - - neighbFaceCentres.setSize(patch.size()); - - vectorList& neighbFaceAreas = allNeighbourFaceAreas[pP]; - - neighbFaceAreas.setSize(patch.size()); - - { - IPstream fromNeighbProc - ( - Pstream::blocking, - patch.neighbProcNo(), - 2*(sizeof(label) + patch.size()*sizeof(vector)) - ); - fromNeighbProc - >> neighbFaceCentres - >> neighbFaceAreas; - -// Pout << "receiving face info from processor " -// << patch.neighbProcNo() << ", size = " -// << patch.size() << endl; - } - } - - // ************************************************************* - // Tests that all processor patch segments from different - // original patches prior to decomposition produce the same - // transform. Check before 1st iteration. - // ************************************************************* - - forAll(procPatches,pP) - { - const processorPolyPatch& patch = - refCast<const processorPolyPatch> - ( - mesh_.boundaryMesh()[procPatches[pP]] - ); - - const vectorList& neighbFaceCentres = allNeighbourFaceCentres[pP]; - - const vectorList& neighbFaceAreas = allNeighbourFaceAreas[pP]; - - label nUP; - - for - ( - nUP = -nUndecomposedPatches; - nUP <= nUndecomposedPatches; - nUP++ - ) - { - DynamicList<vector> refOff; - - DynamicList<tensor> refTrans; - - forAll (patch, faceI) - { - if (processorPatchSegmentMapping[pP][faceI] == nUP) - { - referredCell testRefCell - ( - mesh_, - -1, - -1, - patch.faceCentres()[faceI], - neighbFaceCentres[faceI], - patch.faceNormals()[faceI], - neighbFaceAreas[faceI] - /(mag(neighbFaceAreas[faceI]) + VSMALL) - ); - - refOff.append(testRefCell.offset()); - - refTrans.append(testRefCell.rotation()); - } - } - - refOff.shrink(); - - refTrans.shrink(); - - if (refOff.size()) - { - if - ( - sum(mag(refOff-refOff[0]))/refOff.size() > transTol - || sum(mag(refTrans-refTrans[0]))/refTrans.size() > transTol - ) - { - FatalErrorIn - ( - "moleculeCloud::buildCellInteractionLists" - ) - << nl << "Face pairs on patch " - << patch.name() - << ", segment " << patchNames[nUP] - << " do not give the same referring " - << " transformations to within tolerance of " - << transTol << nl - << " Referring offsets:" << refOff << nl - << " Average sum of mag difference: " - << sum(mag(refOff-refOff[0]))/refOff.size() << nl - << " Referring transforms:" << refTrans << nl - << " Average sum of mag difference: " - << sum(mag(refTrans-refTrans[0]))/refTrans.size() - << nl << abort(FatalError); - } - } - } - } -} - -label cellsReferredThisIteration = 1; - -label iterationNo = 0; - -DynamicList<label> realCellsWithinRCutMaxOfAnyReferringPatch; - -while(cellsReferredThisIteration) -{ - label refIntListStartSize = referredInteractionList.size(); - - forAll (mesh_.boundaryMesh(), patchI) - { - // Treat local cyclics on each processor before processor boundaries. - // Separate treatment allows the serial version to run transparently. - - if (mesh_.boundaryMesh()[patchI].type() == "cyclic") - { - const cyclicPolyPatch& patch = - refCast<const cyclicPolyPatch> - ( - mesh_.boundaryMesh()[patchI] - ); - - if(patch.size()) - { - // Pout << patch << endl; - - if (iterationNo == 0) - { - // Tests that all combinations of face pairs produce the - // same transform. Only check on 1st iteration. - - label faceL; - // A face in the 1st half of the patch - - label faceM; - // Face corresponding to faceL in the 2nd half of the - // patch. Assumes correct face ordering. - - vectorList refOff(patch.size()/2); - - List<tensor> refTrans(patch.size()/2); - - for - ( - faceL = 0, faceM = patch.size()/2; - faceL < patch.size()/2; - faceL++, faceM++ - ) - { - referredCell testRefCell - ( - mesh_, - -1, - -1, - patch.faceCentres()[faceL], - patch.faceCentres()[faceM], - patch.faceNormals()[faceL], - patch.faceNormals()[faceM] - ); - - refOff[faceL] = testRefCell.offset(); - - refTrans[faceL] = testRefCell.rotation(); - } - - if - ( - sum(mag(refOff - refOff[0]))/(patch.size()/2) - > transTol - || sum(mag(refTrans - refTrans[0]))/(patch.size()/2) - > transTol - ) - { - FatalErrorIn - ( - "moleculeCloud::buildCellInteractionLists" - ) - << nl << "Face pairs on patch " - << patch.name() - << " do not give the same referring " - << " transformations to within tolerance of " - << transTol << nl - << " Referring offsets:" << refOff << nl - << " Average sum of mag difference: " - << sum(mag(refOff-refOff[0]))/refOff.size() << nl - << " Referring transforms:" << refTrans << nl - << " Average sum of mag difference: " - << sum(mag(refTrans-refTrans[0]))/refTrans.size() - << nl << abort(FatalError); - } - } - - // *********************************************************** - // 1st half of face list - 1st side of boundary - // *********************************************************** - - label faceI; - - DynamicList<label> meshFacesOnThisSegment; - - for (faceI = 0; faceI < patch.size()/2; faceI++) - { - // unable to use the normal accessors for the polyPatch - // because points on separate halves need used separately - - meshFacesOnThisSegment.append(faceI + patch.start()); - } - - meshFacesOnThisSegment.shrink(); - - DynamicList<label> meshEdgesOnThisSegment; - - DynamicList<label> meshPointsOnThisSegment; - - forAll(meshFacesOnThisSegment, mFOTS) - { - const label segFace = meshFacesOnThisSegment[mFOTS]; - - const labelList& faceEdges = mesh_.faceEdges()[segFace]; - - forAll (faceEdges, fE) - { - const label faceEdge(faceEdges[fE]); - - if (findIndex(meshEdgesOnThisSegment, faceEdge) == -1) - { - meshEdgesOnThisSegment.append(faceEdge); - } - } - - const face& facePoints(mesh_.faces()[segFace]); - - forAll (facePoints, fP) - { - const label facePoint(facePoints[fP]); - - if - ( - findIndex(meshPointsOnThisSegment, facePoint) - == -1 - ) - { - meshPointsOnThisSegment.append(facePoint); - } - } - } - - meshEdgesOnThisSegment.shrink(); - - meshPointsOnThisSegment.shrink(); - - if (iterationNo == 0) - { - // Assessing real cells in range is only required on - // the 1st iteration because they do not change from - // iteration to iteration. - - labelList realCellsFoundInRange - ( - realCellsInRangeOfSegment - ( - meshFacesOnThisSegment, - meshEdgesOnThisSegment, - meshPointsOnThisSegment - ) - ); - - forAll(realCellsFoundInRange,cFIR) - { - const label realCell = realCellsFoundInRange[cFIR]; - - referredCell cellToRefer - ( - mesh_, - Pstream::myProcNo(), - realCell, - patch.faceCentres()[0], - patch.faceCentres()[patch.size()/2], - patch.faceNormals()[0], - patch.faceNormals()[patch.size()/2] - ); - - // Test all existing referred and real cells to - // check duplicates are not being made or cells - // aren't being referred back onto themselves - - bool addCellToRefer = true; - - // Check if cellToRefer is an existing referred cell - - forAll(referredInteractionList, rIL) - { - if - ( - cellToRefer.duplicate - ( - referredInteractionList[rIL] - ) - ) - { - addCellToRefer = false; - - break; - } - } - - // Check for cellToRefer being referred back - // ontop of a real cell - - if - ( - cellToRefer.duplicate - ( - Pstream::myProcNo(), - mesh_.nCells() - ) - ) - { - addCellToRefer = false; - } - - if (addCellToRefer) - { - referredInteractionList.append(cellToRefer); - } - - // add real cells found in range of cyclic patch - // to whole mesh list - - if - ( - findIndex - ( - realCellsWithinRCutMaxOfAnyReferringPatch, - realCell - ) == -1 - ) - { - realCellsWithinRCutMaxOfAnyReferringPatch.append - ( - realCell - ); - } - } - } - - referredInteractionList.shrink(); - - labelList referredCellsFoundInRange - ( - referredCellsInRangeOfSegment - ( - referredInteractionList, - meshFacesOnThisSegment, - meshEdgesOnThisSegment, - meshPointsOnThisSegment - ) - ); - - forAll(referredCellsFoundInRange,cFIR) - { - referredCell& existingRefCell = referredInteractionList - [ - referredCellsFoundInRange[cFIR] - ]; - - referredCell cellToReRefer = existingRefCell.reRefer - ( - patch.faceCentres()[0], - patch.faceCentres()[patch.size()/2], - patch.faceNormals()[0], - patch.faceNormals()[patch.size()/2] - ); - - // Test all existing referred and real cells to check - // duplicates are not being made or cells aren't being - // referred back onto themselves - - bool addCellToReRefer = true; - - // Check if cellToRefer is an existing referred cell - - forAll(referredInteractionList, rIL) - { - if - ( - cellToReRefer.duplicate - ( - referredInteractionList[rIL] - ) - ) - { - addCellToReRefer = false; - - break; - } - } - - // Check for cellToRefer being referred back - // ontop of a real cell - - if - ( - cellToReRefer.duplicate - ( - Pstream::myProcNo(), - mesh_.nCells() - ) - ) - { - addCellToReRefer = false; - } - - if(addCellToReRefer) - { - referredInteractionList.append(cellToReRefer); - } - } - - // *********************************************************** - // 2nd half of face list - 2nd side of boundary - // *********************************************************** - - meshFacesOnThisSegment.clear(); - - for (faceI = patch.size()/2; faceI < patch.size(); faceI++) - { - // unable to use the normal accessors for the polyPatch - // because points on separate halves need used separately - - meshFacesOnThisSegment.append(faceI + patch.start()); - } - - meshFacesOnThisSegment.shrink(); - - meshEdgesOnThisSegment.clear(); - - meshPointsOnThisSegment.clear(); - - forAll(meshFacesOnThisSegment, mFOTS) - { - const label segFace = meshFacesOnThisSegment[mFOTS]; - - const labelList& faceEdges = mesh_.faceEdges()[segFace]; - - forAll (faceEdges, fE) - { - const label faceEdge(faceEdges[fE]); - - if(findIndex(meshEdgesOnThisSegment, faceEdge) == -1) - { - meshEdgesOnThisSegment.append(faceEdge); - } - } - - const face& facePoints(mesh_.faces()[segFace]); - - forAll (facePoints, fP) - { - const label facePoint(facePoints[fP]); - - if - ( - findIndex(meshPointsOnThisSegment, facePoint) - == -1 - ) - { - meshPointsOnThisSegment.append(facePoint); - } - } - } - - meshEdgesOnThisSegment.shrink(); - - meshPointsOnThisSegment.shrink(); - - if (iterationNo == 0) - { - // Assessing real cells in range is only required on - // the 1st iteration because they do not change from - // iteration to iteration. - - labelList realCellsFoundInRange - ( - realCellsInRangeOfSegment - ( - meshFacesOnThisSegment, - meshEdgesOnThisSegment, - meshPointsOnThisSegment - ) - ); - - forAll(realCellsFoundInRange,cFIR) - { - const label realCell = realCellsFoundInRange[cFIR]; - - referredCell cellToRefer - ( - mesh_, - Pstream::myProcNo(), - realCell, - patch.faceCentres()[patch.size()/2], - patch.faceCentres()[0], - patch.faceNormals()[patch.size()/2], - patch.faceNormals()[0] - ); - - // Test all existing referred and real cells to - // check duplicates are not being made or cells - // aren't being referred back onto themselves - - bool addCellToRefer = true; - - // Check if cellToRefer is an existing referred cell - - forAll(referredInteractionList, rIL) - { - if - ( - cellToRefer.duplicate - ( - referredInteractionList[rIL] - ) - ) - { - addCellToRefer = false; - - break; - } - } - - // Check for cellToRefer being referred back - // ontop of a real cell - - if - ( - cellToRefer.duplicate - ( - Pstream::myProcNo(), - mesh_.nCells() - ) - ) - { - addCellToRefer = false; - } - - if (addCellToRefer) - { - referredInteractionList.append(cellToRefer); - } - - // add real cells found in range of cyclic patch - // to whole mesh list - - if - ( - findIndex - ( - realCellsWithinRCutMaxOfAnyReferringPatch, - realCell - ) == -1 - ) - { - realCellsWithinRCutMaxOfAnyReferringPatch.append - ( - realCell - ); - } - } - } - - referredInteractionList.shrink(); - - referredCellsFoundInRange = referredCellsInRangeOfSegment - ( - referredInteractionList, - meshFacesOnThisSegment, - meshEdgesOnThisSegment, - meshPointsOnThisSegment - ); - - forAll(referredCellsFoundInRange,cFIR) - { - referredCell& existingRefCell = referredInteractionList - [ - referredCellsFoundInRange[cFIR] - ]; - - referredCell cellToReRefer = existingRefCell.reRefer - ( - patch.faceCentres()[patch.size()/2], - patch.faceCentres()[0], - patch.faceNormals()[patch.size()/2], - patch.faceNormals()[0] - ); - - // Test all existing referred and real cells to check - // duplicates are not being made or cells aren't being - // referred back onto themselves - - bool addCellToReRefer = true; - - // Check if cellToRefer is an existing referred cell - - forAll(referredInteractionList, rIL) - { - if - ( - cellToReRefer.duplicate - ( - referredInteractionList[rIL] - ) - ) - { - addCellToReRefer = false; - - break; - } - } - - // Check for cellToRefer being referred back - // ontop of a real cell - - if - ( - cellToReRefer.duplicate - ( - Pstream::myProcNo(), - mesh_.nCells() - ) - ) - { - addCellToReRefer = false; - } - - if (addCellToReRefer) - { - referredInteractionList.append(cellToReRefer); - } - } - } - } - } - - if (Pstream::parRun()) - { - labelList procPatches(mesh_.globalData().processorPatches()); - - forAll(procPatches,pP) - { - const processorPolyPatch& patch = - refCast<const processorPolyPatch> - ( - mesh_.boundaryMesh()[procPatches[pP]] - ); - - DynamicList<referredCell> referredCellsToTransfer; - - const vectorList& neighbFaceCentres = allNeighbourFaceCentres[pP]; - - const vectorList& neighbFaceAreas = allNeighbourFaceAreas[pP]; - - label nUP; - - for - ( - nUP = -nUndecomposedPatches; - nUP <= nUndecomposedPatches; - nUP++ - ) - { - // faceT is used to specify one face on this patch segment that - // will be used to calculate the transformation values. All - // faces are guaranteed to produce the same transform because - // of the checks carried out at the start of the function. - // Setting to -1 until the 1st face on this segment is found. - - label faceT = -1; - - DynamicList<label> meshFacesOnThisSegment; - - forAll (patch, faceI) - { - if (processorPatchSegmentMapping[pP][faceI] == nUP) - { - if (faceT == -1) - { - faceT = faceI; - } - - meshFacesOnThisSegment.append(faceI + patch.start()); - } - } - - meshFacesOnThisSegment.shrink(); - - DynamicList<label> meshEdgesOnThisSegment; - - DynamicList<label> meshPointsOnThisSegment; - - forAll(meshFacesOnThisSegment, mFOTS) - { - const label segFace = meshFacesOnThisSegment[mFOTS]; - - const labelList& faceEdges = mesh_.faceEdges()[segFace]; - - forAll (faceEdges, fE) - { - const label faceEdge(faceEdges[fE]); - - if(findIndex(meshEdgesOnThisSegment, faceEdge) == -1) - { - meshEdgesOnThisSegment.append(faceEdge); - } - } - - const face& facePoints(mesh_.faces()[segFace]); - - forAll (facePoints, fP) - { - const label facePoint(facePoints[fP]); - - if - ( - findIndex(meshPointsOnThisSegment, facePoint) - == -1 - ) - { - meshPointsOnThisSegment.append(facePoint); - } - } - } - - meshEdgesOnThisSegment.shrink(); - - meshPointsOnThisSegment.shrink(); - - if (meshFacesOnThisSegment.size()) - { - if (faceT == -1) - { - FatalErrorIn - ( - "moleculeCloudBuildReferredInteractionList.H" - ) - << nl << "faceT == -1 encountered but " - << meshFacesOnThisSegment.size() - << " faces found on patch segment." - << abort(FatalError); - } - - if (iterationNo == 0) - { - // Assessing real cells in range is only required on - // the 1st iteration because they do not change from - // iteration to iteration. - - labelList realCellsFoundInRange - ( - realCellsInRangeOfSegment - ( - meshFacesOnThisSegment, - meshEdgesOnThisSegment, - meshPointsOnThisSegment - ) - ); - - forAll(realCellsFoundInRange,cFIR) - { - const label realCell = realCellsFoundInRange[cFIR]; - - referredCell cellToRefer - ( - mesh_, - Pstream::myProcNo(), - realCell, - patch.faceCentres()[faceT], - neighbFaceCentres[faceT], - patch.faceNormals()[faceT], - neighbFaceAreas[faceT] - /(mag(neighbFaceAreas[faceT]) + VSMALL) - ); - - referredCellsToTransfer.append(cellToRefer); - - // add real cells found in range of processor patch - // to whole mesh list - - if - ( - findIndex - ( - realCellsWithinRCutMaxOfAnyReferringPatch, - realCell - ) - == -1 - ) - { - realCellsWithinRCutMaxOfAnyReferringPatch.append - ( - realCell - ); - } - } - } - - referredInteractionList.shrink(); - - labelList referredCellsFoundInRange - ( - referredCellsInRangeOfSegment - ( - referredInteractionList, - meshFacesOnThisSegment, - meshEdgesOnThisSegment, - meshPointsOnThisSegment - ) - ); - - forAll(referredCellsFoundInRange,cFIR) - { - referredCell& existingRefCell - = referredInteractionList[referredCellsFoundInRange[cFIR]]; - - referredCell cellToReRefer = existingRefCell.reRefer - ( - patch.faceCentres()[faceT], - neighbFaceCentres[faceT], - patch.faceNormals()[faceT], - neighbFaceAreas[faceT] - /(mag(neighbFaceAreas[faceT]) + VSMALL) - ); - - referredCellsToTransfer.append(cellToReRefer); - } - } - } - - referredCellsToTransfer.shrink(); - - // Send these cells to the neighbouring processor. - - { - OPstream toNeighbProc - ( - Pstream::blocking, - patch.neighbProcNo() - ); - -// Pout << "Processor " << Pstream::myProcNo() -// << " sending to " << patch.neighbProcNo() -// << nl << referredCellsToTransfer << endl; - - toNeighbProc << referredCellsToTransfer; - } - } - - forAll(procPatches,pP) - { - const processorPolyPatch& patch = - refCast<const processorPolyPatch> - ( - mesh_.boundaryMesh()[procPatches[pP]] - ); - - - // Receive the cells from neighbour - - List<referredCell> referredCellsFromNeighbour(patch.size()); - - { - IPstream fromNeighbProc - ( - Pstream::blocking, - patch.neighbProcNo() - ); - - fromNeighbProc >> referredCellsFromNeighbour; - -// Pout << "Processor " << Pstream::myProcNo() -// << " receiving from " << patch.neighbProcNo() -// << nl << referredCellsFromNeighbour << endl; - } - - // Check to see if they are duplicates, if not append - // them to the referredInteractionList - - forAll(referredCellsFromNeighbour,rCFN) - { - referredCell& cellToRefer - = referredCellsFromNeighbour[rCFN]; - - // Test all existing referred and real cells to check duplicates - // are not being made or cells aren't being referred back onto - // themselves - - bool addCellToRefer = true; - - // Check if cellToRefer is an existing referred cell - - forAll(referredInteractionList, rIL) - { - if(cellToRefer.duplicate(referredInteractionList[rIL])) - { - addCellToRefer = false; - - break; - } - } - - // Check for cellToRefer being referred back ontop of a real cell - - if - ( - cellToRefer.duplicate - ( - Pstream::myProcNo(), - mesh_.nCells() - ) - ) - { - addCellToRefer = false; - } - - if (addCellToRefer) - { - referredInteractionList.append(cellToRefer); - } - } - } - } - - if (iterationNo == 0) - { - // record all real cells in range of any referring patch (cyclic or - // processor) on the first iteration when the real cells are evaluated. - - realCellsWithinRCutMaxOfAnyReferringPatch_.transfer - ( - realCellsWithinRCutMaxOfAnyReferringPatch.shrink() - ); - - // construct {faces, edges, points}WithinRCutMaxOfAnyReferringPatch_ - - DynamicList<label> realFacesWithinRCutMaxOfAnyReferringPatch; - - DynamicList<label> realEdgesWithinRCutMaxOfAnyReferringPatch; - - DynamicList<label> realPointsWithinRCutMaxOfAnyReferringPatch; - - forAll(realCellsWithinRCutMaxOfAnyReferringPatch_, rCWR) - { - const label realCell - ( - realCellsWithinRCutMaxOfAnyReferringPatch_[rCWR] - ); - - const labelList& rCFaces - ( - mesh_.cells()[realCell] - ); - - forAll(rCFaces, rCF) - { - const label f(rCFaces[rCF]); - - if - ( - findIndex(realFacesWithinRCutMaxOfAnyReferringPatch,f) - == -1 - ) - { - realFacesWithinRCutMaxOfAnyReferringPatch.append(f); - } - } - - const labelList& rCEdges - ( - mesh_.cellEdges()[realCell] - ); - - forAll(rCEdges, rCE) - { - const label e(rCEdges[rCE]); - - if - ( - findIndex(realEdgesWithinRCutMaxOfAnyReferringPatch,e) - == -1 - ) - { - realEdgesWithinRCutMaxOfAnyReferringPatch.append(e); - } - } - - const labelList& rCPoints - ( - mesh_.cellPoints()[realCell] - ); - - forAll(rCPoints, rCP) - { - const label p(rCPoints[rCP]); - - if - ( - findIndex(realPointsWithinRCutMaxOfAnyReferringPatch,p) - == -1 - ) - { - realPointsWithinRCutMaxOfAnyReferringPatch.append(p); - } - } - } - - realFacesWithinRCutMaxOfAnyReferringPatch_.transfer - ( - realFacesWithinRCutMaxOfAnyReferringPatch.shrink() - ); - - realEdgesWithinRCutMaxOfAnyReferringPatch_.transfer - ( - realEdgesWithinRCutMaxOfAnyReferringPatch.shrink() - ); - - realPointsWithinRCutMaxOfAnyReferringPatch_.transfer - ( - realPointsWithinRCutMaxOfAnyReferringPatch.shrink() - ); - } - - iterationNo++; - - cellsReferredThisIteration = - referredInteractionList.size() - refIntListStartSize; - -// Pout << tab << "Cells added this iteration: " -// << cellsReferredThisIteration << endl; - - reduce(cellsReferredThisIteration, sumOp<label>()); - - Info << tab << "Cells added this iteration: " - << cellsReferredThisIteration << endl; -} - -referredInteractionList.shrink(); - -// Info << "referredInteractionList.size() = " -// << referredInteractionList.size() << endl; - -// forAll(referredInteractionList,rIL) -// { -// Info << referredInteractionList[rIL]; -// } diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculateExternalForce.C b/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculateExternalForce.C deleted file mode 100755 index ea6320ecb5c459b4f266a39e442f3f7d3a0ec4c2..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculateExternalForce.C +++ /dev/null @@ -1,42 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "moleculeCloud.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -void Foam::moleculeCloud::calculateExternalForce() -{ - iterator mol(this->begin()); - - for (mol = this->begin(); mol != this->end(); ++mol) - { - mol().A() += gravity_; - } -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculateForce.C b/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculateForce.C deleted file mode 100755 index 54aa9b1a426b5517caeaf153b26e644129745ddc..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculateForce.C +++ /dev/null @@ -1,59 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "moleculeCloud.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -void Foam::moleculeCloud::calculateForce() -{ - buildCellOccupancy(); - - iterator mol(this->begin()); - - // Set all accumulated quantities to zero - for (mol = this->begin(); mol != this->end(); ++mol) - { - mol().A() = vector::zero; - - mol().potentialEnergy() = 0.0; - - mol().rf() = tensor::zero; - } - - calculatePairForce(); - - calculateTetherForce(); - - calculateExternalForce(); -} - - -// ************************************************************************* // - - - - diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculatePairForce.C b/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculatePairForce.C deleted file mode 100755 index 14b65c5a3c5a13fa5b1f1e527b27a4b85c2b0aac..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculatePairForce.C +++ /dev/null @@ -1,41 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "moleculeCloud.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -void Foam::moleculeCloud::calculatePairForce() -{ - iterator mol(this->begin()); - -# include "moleculeCloudCalculatePairForceRealCells.H" - -# include "moleculeCloudCalculatePairForceReferredCells.H" -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculatePairForceRealCells.H b/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculatePairForceRealCells.H deleted file mode 100755 index c3b3f1e7cc431e61c36ff3381e29ff12fbda1a10..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculatePairForceRealCells.H +++ /dev/null @@ -1,49 +0,0 @@ - -vector rIJ; - -scalar rIJMag; - -scalar rIJMagSq; - -vector fIJ; - -label idI; - -label idJ; - -mol = this->begin(); - -molecule* molI = &mol(); - -molecule* molJ = &mol(); - -forAll(directInteractionList_, dIL) -{ - forAll(cellOccupancy_[dIL],cellIMols) - { - molI = cellOccupancy_[dIL][cellIMols]; - - forAll(directInteractionList_[dIL], interactingCells) - { - List< molecule* > cellJ = - cellOccupancy_[directInteractionList_[dIL][interactingCells]]; - - forAll(cellJ, cellJMols) - { - molJ = cellJ[cellJMols]; - -# include "moleculeCloudCalculatePairForceRealCellsCalculationStep.H" - } - } - - forAll(cellOccupancy_[dIL],cellIOtherMols) - { - molJ = cellOccupancy_[dIL][cellIOtherMols]; - - if (molJ > molI) - { -# include "moleculeCloudCalculatePairForceRealCellsCalculationStep.H" - } - } - } -} diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculatePairForceRealCellsCalculationStep.H b/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculatePairForceRealCellsCalculationStep.H deleted file mode 100755 index 49e1e2d781b2462e80d44c6133be77acd9c5cdf9..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculatePairForceRealCellsCalculationStep.H +++ /dev/null @@ -1,33 +0,0 @@ -idI = molI->id(); - -idJ = molJ->id(); - -rIJ = molI->position() - molJ->position(); - -rIJMagSq = magSqr(rIJ); - -if (pairPotentials_.rCutSqr(idI, idJ, rIJMagSq)) -{ - rIJMag = mag(rIJ); - - fIJ = (rIJ/rIJMag)*pairPotentials_.force(idI, idJ, rIJMag); - - // Acceleration increment for molI - molI->A() += fIJ/(molI->mass()); - - // Acceleration increment for molJ - molJ->A() += -fIJ/(molJ->mass()); - - scalar potentialEnergy - ( - pairPotentials_.energy(idI, idJ, rIJMag) - ); - - molI->potentialEnergy() += 0.5*potentialEnergy; - - molJ->potentialEnergy() += 0.5*potentialEnergy; - - molI->rf() += rIJ * fIJ; - - molJ->rf() += rIJ * fIJ; -} diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculatePairForceReferredCells.H b/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculatePairForceReferredCells.H deleted file mode 100755 index c2fab2d10ef8cc14e55bff6cea7beeff9325ff4f..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculatePairForceReferredCells.H +++ /dev/null @@ -1,59 +0,0 @@ -vector rKL; - -scalar rKLMag; - -scalar rKLMagSq; - -vector fKL; - -label idK; - -label idL; - -molecule* molK = &mol(); - -forAll(referredInteractionList_, rIL) -{ - const List<label>& realCells = - referredInteractionList_[rIL].realCellsForInteraction(); - - forAll(referredInteractionList_[rIL], refMols) - { - referredMolecule* molL = &(referredInteractionList_[rIL][refMols]); - - forAll(realCells, rC) - { - List<molecule*> cellK = cellOccupancy_[realCells[rC]]; - - forAll(cellK, cellKMols) - { - molK = cellK[cellKMols]; - - idK = molK->id(); - - idL = molL->id(); - - rKL = molK->position() - molL->position(); - - rKLMagSq = magSqr(rKL); - - if (pairPotentials_.rCutSqr(idK, idL, rKLMagSq)) - { - rKLMag = mag(rKL); - - fKL = (rKL/rKLMag)*pairPotentials_.force(idK, idL, rKLMag); - - // Acceleration increment for molK - molK->A() += fKL/(molK->mass()); - - // Adding a contribution of 1/2 of the potential energy - // from this interaction - molK->potentialEnergy() += - 0.5*pairPotentials_.energy(idK, idL, rKLMag); - - molK->rf() += rKL * fKL; - } - } - } - } -} diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculateTetherForce.C b/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculateTetherForce.C deleted file mode 100755 index 32b39a4089d8208884f24b5ed50edfd2b362da2c..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculateTetherForce.C +++ /dev/null @@ -1,69 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "moleculeCloud.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -void Foam::moleculeCloud::calculateTetherForce() -{ - iterator mol(this->begin()); - - vector rIT; - - scalar rITMag; - - vector fIT; - - for (mol = this->begin(); mol != this->end(); ++mol) - { - if (mol().tethered()) - { - rIT = mol().position() - mol().tetherPosition(); - - rITMag = mag(rIT); - - fIT = (rIT/rITMag) * tetherPotentials_.force - ( - mol().id(), - rITMag - ); - - mol().A() += fIT/(mol().mass()); - - mol().potentialEnergy() += tetherPotentials_.energy - ( - mol().id(), - rITMag - ); - - mol().rf() += rIT*fIT; - } - } -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudI.H b/src/lagrangian/molecule/moleculeCloud/moleculeCloudI.H deleted file mode 100755 index 330fa031dec088ad7fa8f6d729da932455cdb592..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudI.H +++ /dev/null @@ -1,184 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 - -\*---------------------------------------------------------------------------*/ - -namespace Foam -{ - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -inline const polyMesh& moleculeCloud::mesh() const -{ - return mesh_; -} - - -// MD solution parameters - -inline const moleculeCloud::integrationMethods& - moleculeCloud::integrationMethod() const -{ - return integrationMethod_; -} - - -inline scalar moleculeCloud::potentialEnergyLimit() const -{ - return potentialEnergyLimit_; -} - - -inline scalar moleculeCloud::guardRadius() const -{ - return guardRadius_; -} - - -inline scalar moleculeCloud::rCutMax() const -{ - return rCutMax_; -} - - -inline scalar moleculeCloud::rCutMaxSqr() const -{ - return rCutMaxSqr_; -} - - -inline const List<word>& moleculeCloud::idList() const -{ - return idList_; -} - - -inline label moleculeCloud::nPairPotentials() const -{ - return pairPotentials_.size(); -} - - -inline label moleculeCloud::nIds() const -{ - return idList_.size(); -} - - -inline const labelList& moleculeCloud::removalOrder() const -{ - return removalOrder_; -} - - -inline const labelListList& moleculeCloud::directInteractionList() const -{ - return directInteractionList_; -} - - -inline const referredCellList& moleculeCloud::referredInteractionList() const -{ - return referredInteractionList_; -} - - -inline const labelList& - moleculeCloud::realCellsWithinRCutMaxOfAnyReferringPatch() const -{ - return realCellsWithinRCutMaxOfAnyReferringPatch_; -} - - -inline const labelList& - moleculeCloud::realFacesWithinRCutMaxOfAnyReferringPatch() const -{ - return realFacesWithinRCutMaxOfAnyReferringPatch_; -} - - -inline const labelList& - moleculeCloud::realEdgesWithinRCutMaxOfAnyReferringPatch() const -{ - return realEdgesWithinRCutMaxOfAnyReferringPatch_; -} - - -inline const labelList& - moleculeCloud::realPointsWithinRCutMaxOfAnyReferringPatch() const -{ - return realPointsWithinRCutMaxOfAnyReferringPatch_; -} - - -inline const List<sendingReferralList>& - moleculeCloud::cellSendingReferralLists() const -{ - return cellSendingReferralLists_; -} - - -inline const List<receivingReferralList>& - moleculeCloud::cellReceivingReferralLists() const -{ - return cellReceivingReferralLists_; -} - - -inline label moleculeCloud::nInteractingProcs() const -{ - return cellReceivingReferralLists_.size(); -} - - -inline const pairPotentialList& moleculeCloud::pairPotentials() const -{ - return pairPotentials_; -} - - -inline const tetherPotentialList& moleculeCloud::tetherPotentials() const -{ - return tetherPotentials_; -} - - -inline const vector& moleculeCloud::gravity() const -{ - return gravity_; -} - - -inline const List< DynamicList<molecule*> >& - moleculeCloud::cellOccupancy() const -{ - return cellOccupancy_; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudIntegrateEquationsOfMotion.C b/src/lagrangian/molecule/moleculeCloud/moleculeCloudIntegrateEquationsOfMotion.C deleted file mode 100755 index dc2177d10b924017989d0f7266965093e96731a6..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudIntegrateEquationsOfMotion.C +++ /dev/null @@ -1,50 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "moleculeCloud.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -void Foam::moleculeCloud::integrateEquationsOfMotion() -{ - // Supply trackData to the move method to tell it whether this is the - // leapfrog stage 1 or stage 2 - // or whether it is the - // predictor or corrector step. - - molecule::trackData td1(*this, 1); - - Cloud<molecule>::move(td1); - - calculateForce(); - - molecule::trackData td2(*this, 2); - - Cloud<molecule>::move(td2); -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudReadMDParameters/moleculeCloudReadIdList.H b/src/lagrangian/molecule/moleculeCloud/moleculeCloudReadMDParameters/moleculeCloudReadIdList.H deleted file mode 100755 index 8ddc55ed45dcbfe4e545976f849d44bf0d81dcd0..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudReadMDParameters/moleculeCloudReadIdList.H +++ /dev/null @@ -1,14 +0,0 @@ -IOdictionary idListDict -( - IOobject - ( - "idList", - mesh_.time().constant(), - mesh_, - IOobject::MUST_READ, - IOobject::NO_WRITE - ) -); - -idList_ = List<word>(idListDict.lookup("idList")); - diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudReadMDParameters/moleculeCloudReadMDParameters.H b/src/lagrangian/molecule/moleculeCloud/moleculeCloudReadMDParameters/moleculeCloudReadMDParameters.H deleted file mode 100755 index f6d090bfb8c382da5d1b2d75da03e3bda06e1c53..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudReadMDParameters/moleculeCloudReadMDParameters.H +++ /dev/null @@ -1,6 +0,0 @@ - -# include "moleculeCloudReadMDSolution.H" - -# include "moleculeCloudReadIdList.H" - -# include "moleculeCloudReadPotentials.H" diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudReadMDParameters/moleculeCloudReadMDSolution.H b/src/lagrangian/molecule/moleculeCloud/moleculeCloudReadMDParameters/moleculeCloudReadMDSolution.H deleted file mode 100755 index 07c6b30ff04bf4cac42342ad3e882a5c66499c15..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudReadMDParameters/moleculeCloudReadMDSolution.H +++ /dev/null @@ -1,27 +0,0 @@ -Info<< nl << "Reading MD solution parameters:" << endl; - -IOdictionary mdSolution -( - IOobject - ( - "mdSolution", - mesh_.time().system(), - mesh_, - IOobject::MUST_READ, - IOobject::NO_WRITE - ) -); - -integrationMethod_ = integrationMethodNames_.read -( - mdSolution.lookup("integrationMethod") -); -Info<< "integrationMethod =\t\t\t" - << integrationMethodNames_[integrationMethod_] << endl; - -potentialEnergyLimit_ = readScalar(mdSolution.lookup("potentialEnergyLimit")); -Info<< "potentialEnergyLimit =\t\t\t" << potentialEnergyLimit_ << endl; - -guardRadius_ = readScalar(mdSolution.lookup("guardRadius")); -Info<< "guardRadius =\t\t\t\t" << guardRadius_ << endl; - diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudReadMDParameters/moleculeCloudReadPotentials.H b/src/lagrangian/molecule/moleculeCloud/moleculeCloudReadMDParameters/moleculeCloudReadPotentials.H deleted file mode 100755 index b1bdb2045cce399db459b4b3eab29ede64bebacb..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudReadMDParameters/moleculeCloudReadPotentials.H +++ /dev/null @@ -1,327 +0,0 @@ -IOdictionary potentialDict -( - IOobject - ( - "potentialDict", - mesh_.time().system(), - mesh_, - IOobject::MUST_READ, - IOobject::NO_WRITE - ) -); - -// **************************************************************************** -// Pair potentials - -Info << nl << "Creating pair potentials:" << nl << endl; - -if (!potentialDict.found("pair")) -{ - FatalErrorIn("moleculeCloudReadPotentials.H") << nl - << "pair potential specification subDict not found" - << abort(FatalError); -} - -const dictionary& pairDict = potentialDict.subDict("pair"); - -pairPotentials_.setSizeAndNIds(nIds()); - -label a; - -label b; - -rCutMax_ = 0.0; - -for -( - a = 0; - a < idList_.size(); - ++a -) -{ - word idA = idList_[a]; - - for - ( - b = a; - b < idList_.size(); - ++b - ) - { - word idB = idList_[b]; - - word pairPotentialName; - - if (a==b) - { - - - if(pairDict.found(idA+"-"+idB)) - { - pairPotentialName = idA+"-"+idB; - } - - else - { - FatalErrorIn("moleculeCloudReadPotentials.H") << nl - << "Pair pairPotential specification subDict " - << idA+"-"+idB << " not found" - << abort(FatalError); - } - } - - else - { - if(pairDict.found(idA+"-"+idB)) - { - pairPotentialName = idA+"-"+idB; - } - - else if(pairDict.found(idB+"-"+idA)) - { - pairPotentialName = idB+"-"+idA; - } - - else - { - FatalErrorIn("moleculeCloudReadPotentials.H") << nl - << "Pair pairPotential specification subDict " - << idA+"-"+idB << " or " << idB+"-"+idA << " not found" - << abort(FatalError); - } - - if - ( - pairDict.found(idA+"-"+idB) - && pairDict.found(idB+"-"+idA) - ) - { - FatalErrorIn("moleculeCloudReadPotentials.H") << nl - << "Pair pairPotential specification subDict " - << idA+"-"+idB << " and " - << idB+"-"+idA << " found - multiple definition" - << abort(FatalError); - } - } - - word pairPotentialType - ( - pairDict.subDict(pairPotentialName).lookup("potentialType") - ); - - if - ( - pairPotentialType == "maitlandSmithTabulated" - ) - { - scalar rCut = readScalar - ( - pairDict.subDict(pairPotentialName).lookup("rCut") - ); - - if(rCut > rCutMax_) - { - rCutMax_ = rCut; - } - - pairPotentials_.addPotential - ( - a, - b, - pairPotential - ( - pairDict.subDict(pairPotentialName) - ) - ); - } - else - { - FatalErrorIn("moleculeCloudReadPotentials.H") << nl - << "pairPotentialType "<< pairPotentialType << " unknown" - << abort(FatalError); - } - - Info << pairPotentialName << ": " - << pairPotentials_.pairPotentialFunction(a,b) << endl; - } -} - -rCutMax_ += guardRadius_; - -rCutMaxSqr_ = rCutMax_ * rCutMax_; - -Info << nl << "rCutMax + guardRadius = " << rCutMax_ << endl; - -if (potentialDict.found("removalOrder")) -{ - List<word> remOrd = potentialDict.lookup("removalOrder"); - - removalOrder_.setSize(remOrd.size()); - - forAll(removalOrder_, rO) - { - removalOrder_[rO] = findIndex(idList_, remOrd[rO]); - } -} - -// **************************************************************************** -// Tether potentials - -iterator mol(this->begin()); - -DynamicList<label> tetherIds; - -for -( - mol = this->begin(); - mol != this->end(); - ++mol -) -{ - if (mol().tethered()) - { - if (findIndex(tetherIds, mol().id()) == -1) - { - tetherIds.append - ( - mol().id() - ); - } - } -} - -if (Pstream::parRun()) -{ - List< labelList > allTetherIds(Pstream::nProcs()); - - allTetherIds[Pstream::myProcNo()] = tetherIds; - - Pstream::gatherList(allTetherIds); - - if (Pstream::master()) - { - DynamicList<label> globalTetherIds; - - forAll(allTetherIds, procN) - { - const labelList& procNTetherIds = allTetherIds[procN]; - - forAll(procNTetherIds, id) - { - if (findIndex(globalTetherIds, procNTetherIds[id]) == -1) - { - globalTetherIds.append - ( - procNTetherIds[id] - ); - } - } - } - - globalTetherIds.shrink(); - - tetherIds = globalTetherIds; - } - - Pstream::scatter(tetherIds); -} - -tetherIds.shrink(); - -if (tetherIds.size()) -{ - Info << nl << "Creating tether potentials:" << endl; - - if (!potentialDict.found("tether")) - { - FatalErrorIn("moleculeCloudReadPotentials.H") << nl - << "tether potential specification subDict not found" - << abort(FatalError); - } - - const dictionary& tetherDict = potentialDict.subDict("tether"); - - tetherPotentials_.setSizeAndTetherIds(tetherIds); - - forAll (tetherIds, tid) - { - word tetherPotentialName = idList_[tetherIds[tid]]; - - if (!tetherDict.found(tetherPotentialName)) - { - FatalErrorIn("moleculeCloudReadPotentials.H") << nl - << "tether potential specification subDict " - << tetherPotentialName << " not found" - << abort(FatalError); - } - - Info << nl << tetherPotentialName << endl; - - word tetherPotentialType = - tetherDict.subDict(tetherPotentialName).lookup("potentialType"); - - if - ( - tetherPotentialType == "harmonicSpring" - ) - { - - Info << "\tpotentialType = " << tetherPotentialType << endl; - - scalar springConstant - ( - readScalar - ( - tetherDict.subDict(tetherPotentialName).lookup - ( - "springConstant" - ) - ) - ); - - Info << "\tspringConstant = " << springConstant << endl; - - tetherPotentials_.addPotential - ( - tetherIds[tid], - tetherPotential - ( - tetherPotentialName, - tetherPotentialType, - springConstant - ) - ); - } - - else - { - FatalErrorIn("moleculeCloudReadPotentials.H") << nl - << "tetherPotentialType " - << tetherPotentialType << " unknown" - << abort(FatalError); - } - } -} - -// **************************************************************************** -// External Forces - -gravity_ = vector::zero; - -if (potentialDict.found("external")) -{ - - Info << nl << "Reading external forces:" << endl; - - const dictionary& externalDict = potentialDict.subDict("external"); - - // ************************************************************************ - // gravity - - if (externalDict.found("gravity")) - { - gravity_ = externalDict.lookup("gravity"); - } -} - -Info << nl << tab << "gravity = " << gravity_ << endl; diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudRealCellsInRangeOfSegment.C b/src/lagrangian/molecule/moleculeCloud/moleculeCloudRealCellsInRangeOfSegment.C deleted file mode 100755 index 03100cfd3b1d2580f004f5c8add9ac72c531fb82..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudRealCellsInRangeOfSegment.C +++ /dev/null @@ -1,152 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "moleculeCloud.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -const Foam::labelList Foam::moleculeCloud::realCellsInRangeOfSegment -( - const labelList& segmentFaces, - const labelList& segmentEdges, - const labelList& segmentPoints -) const -{ - DynamicList<label> realCellsFoundInRange; - - forAll(segmentFaces, sF) - { - const label f = segmentFaces[sF]; - - forAll (mesh_.points(), p) - { - if (testPointFaceDistance(p, f)) - { - const labelList& pCells(mesh_.pointCells()[p]); - - forAll(pCells, pC) - { - const label cellI(pCells[pC]); - - if (findIndex(realCellsFoundInRange, cellI) == -1) - { - realCellsFoundInRange.append(cellI); - } - } - } - } - } - - forAll(segmentPoints, sP) - { - const label p = segmentPoints[sP]; - - forAll(mesh_.faces(), f) - { - if (testPointFaceDistance(p, f)) - { - const label cellO(mesh_.faceOwner()[f]); - - if (findIndex(realCellsFoundInRange, cellO) == -1) - { - realCellsFoundInRange.append(cellO); - } - - if (mesh_.isInternalFace(f)) - { - // boundary faces will not have neighbour information - - const label cellN(mesh_.faceNeighbour()[f]); - - if (findIndex(realCellsFoundInRange, cellN) == -1) - { - realCellsFoundInRange.append(cellN); - } - } - } - } - } - - forAll(segmentEdges, sE) - { - const edge& eJ(mesh_.edges()[segmentEdges[sE]]); - - forAll (mesh_.edges(), edgeIIndex) - { - const edge& eI(mesh_.edges()[edgeIIndex]); - - if (testEdgeEdgeDistance(eI, eJ)) - { - const labelList& eICells(mesh_.edgeCells()[edgeIIndex]); - - forAll(eICells, eIC) - { - const label cellI(eICells[eIC]); - - if (findIndex(realCellsFoundInRange, cellI) == -1) - { - realCellsFoundInRange.append(cellI); - } - } - } - } - } - -// forAll (points, p) -// { -// const point& ptI = mesh_.points()[points[p]]; -// -// forAll(mesh_.faces(), f) -// { -// if (testPointFaceDistance(ptI, f)) -// { -// const label cellO(mesh_.faceOwner()[f]); -// -// if (findIndex(realCellsFoundInRange, cellO) == -1) -// { -// realCellsFoundInRange.append(cellO); -// } -// -// if (mesh_.isInternalFace(f)) -// { -// // boundary faces will not have neighbour information -// -// const label cellN(mesh_.faceNeighbour()[f]); -// -// if (findIndex(realCellsFoundInRange, cellN) == -1) -// { -// realCellsFoundInRange.append(cellN); -// } -// } -// } -// } -// } -// - return realCellsFoundInRange.shrink(); -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudReferredCellsInRangeOfSegment.C b/src/lagrangian/molecule/moleculeCloud/moleculeCloudReferredCellsInRangeOfSegment.C deleted file mode 100755 index f2e553a85350aadd8f8b655f2879478637aba298..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudReferredCellsInRangeOfSegment.C +++ /dev/null @@ -1,117 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "moleculeCloud.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -const Foam::labelList Foam::moleculeCloud::referredCellsInRangeOfSegment -( - const List<referredCell>& referredInteractionList, - const labelList& segmentFaces, - const labelList& segmentEdges, - const labelList& segmentPoints -) const -{ - DynamicList<label> referredCellsFoundInRange; - - forAll(segmentFaces, sF) - { - const label f = segmentFaces[sF]; - - forAll(referredInteractionList, rIL) - { - const vectorList& refCellPoints - = referredInteractionList[rIL].vertexPositions(); - - if (testPointFaceDistance(refCellPoints, f)) - { - if (findIndex(referredCellsFoundInRange, rIL) == -1) - { - referredCellsFoundInRange.append(rIL); - } - } - } - } - - forAll(segmentPoints, sP) - { - const label p = segmentPoints[sP]; - - forAll(referredInteractionList, rIL) - { - const referredCell& refCell(referredInteractionList[rIL]); - - if (testPointFaceDistance(p, refCell)) - { - if (findIndex(referredCellsFoundInRange, rIL) == -1) - { - referredCellsFoundInRange.append(rIL); - } - } - } - } - - forAll(segmentEdges, sE) - { - const edge& eI(mesh_.edges()[segmentEdges[sE]]); - - forAll(referredInteractionList, rIL) - { - const vectorList& refCellPoints - = referredInteractionList[rIL].vertexPositions(); - - const edgeList& refCellEdges - = referredInteractionList[rIL].edges(); - - forAll(refCellEdges, rCE) - { - const edge& eJ(refCellEdges[rCE]); - - if - ( - testEdgeEdgeDistance - ( - eI, - refCellPoints[eJ.start()], - refCellPoints[eJ.end()] - ) - ) - { - if(findIndex(referredCellsFoundInRange, rIL) == -1) - { - referredCellsFoundInRange.append(rIL); - } - } - } - } - } - - return referredCellsFoundInRange.shrink(); -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudRemoveHighEnergyOverlaps.C b/src/lagrangian/molecule/moleculeCloud/moleculeCloudRemoveHighEnergyOverlaps.C deleted file mode 100755 index ac4385574fa69fa65a1f2116fff5debe6bbd1a76..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudRemoveHighEnergyOverlaps.C +++ /dev/null @@ -1,67 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "moleculeCloud.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -void Foam::moleculeCloud::removeHighEnergyOverlaps() -{ - Info << nl << "Removing high energy overlaps, removal order:"; - - forAll(removalOrder_, rO) - { - Info << " " << idList_[removalOrder_[rO]]; - } - - Info << nl ; - - label initialSize = this->size(); - - buildCellOccupancy(); - - iterator mol(this->begin()); - -# include "moleculeCloudRemoveHighEnergyOverlapsRealCells.H" - - buildCellOccupancy(); - -# include "moleculeCloudRemoveHighEnergyOverlapsReferredCells.H" - - buildCellOccupancy(); - - label molsRemoved = initialSize - this->size(); - - if (Pstream::parRun()) - { - reduce(molsRemoved, sumOp<label>()); - } - - Info << tab << molsRemoved << " molecules removed" << endl; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudRemoveHighEnergyOverlapsRealCells.H b/src/lagrangian/molecule/moleculeCloud/moleculeCloudRemoveHighEnergyOverlapsRealCells.H deleted file mode 100755 index fe6d792842bac5c1abc2510dc27b194c0855da92..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudRemoveHighEnergyOverlapsRealCells.H +++ /dev/null @@ -1,55 +0,0 @@ -{ - vector rIJ; - - scalar rIJMag; - - scalar rIJMagSq; - - label idI; - - label idJ; - - mol = this->begin(); - - molecule* molI = &mol(); - - molecule* molJ = &mol(); - - DynamicList<molecule*> molsToDelete; - - forAll(directInteractionList_, dIL) - { - forAll(cellOccupancy_[dIL],cellIMols) - { - molI = cellOccupancy_[dIL][cellIMols]; - - forAll(directInteractionList_[dIL], interactingCells) - { - List< molecule* > cellJ = - cellOccupancy_[directInteractionList_[dIL][interactingCells]]; - - forAll(cellJ, cellJMols) - { - molJ = cellJ[cellJMols]; - -# include "moleculeCloudRemoveHighEnergyOverlapsRealCellsCalculationStep.H" - } - } - - forAll(cellOccupancy_[dIL],cellIOtherMols) - { - molJ = cellOccupancy_[dIL][cellIOtherMols]; - - if (molJ > molI) - { -# include "moleculeCloudRemoveHighEnergyOverlapsRealCellsCalculationStep.H" - } - } - } - } - - forAll (molsToDelete, mTD) - { - deleteParticle(*(molsToDelete[mTD])); - } -} diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudRemoveHighEnergyOverlapsRealCellsCalculationStep.H b/src/lagrangian/molecule/moleculeCloud/moleculeCloudRemoveHighEnergyOverlapsRealCellsCalculationStep.H deleted file mode 100755 index bc36a600958e02e58c2b33d4b4e828d71063ffa5..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudRemoveHighEnergyOverlapsRealCellsCalculationStep.H +++ /dev/null @@ -1,70 +0,0 @@ -idI = molI->id(); - -idJ = molJ->id(); - -rIJ = molI->position() - molJ->position(); - -rIJMagSq = magSqr(rIJ); - -if (pairPotentials_.rCutSqr(idI, idJ, rIJMagSq)) -{ - rIJMag = mag(rIJ); - - bool remove = false; - - if (rIJMag < SMALL) - { - WarningIn("moleculeCloud::removeHighEnergyOverlaps()") - << "Real molecule pair " - << " idI = " << idI - << " at position " << molI->position() - << " idJ = " << idJ - << " at position " << molJ->position() - << " are closer than " << SMALL - << ": mag separation = " << rIJMag - << ". These may have been placed on top of each" - << " other by a rounding error in molConfig in parallel" - << " or a block filled with molecules twice." - << " Removing one of the molecules." - << endl; - - remove = true; - } - - // Guard against pairPotentials_.energy being evaluated - // if rIJMag < SMALL. A floating point exception will - // happen otherwise. - - if (!remove) - { - if - ( - pairPotentials_.energy(idI, idJ, rIJMag) > potentialEnergyLimit_ - ) - { - remove = true; - } - } - - if (remove) - { - if - ( - idI == idJ - || findIndex(removalOrder_, idJ) < findIndex(removalOrder_, idI) - ) - { - if (findIndex(molsToDelete, molJ) == -1) - { - molsToDelete.append(molJ); - } - } - else - { - if (findIndex(molsToDelete, molI) == -1) - { - molsToDelete.append(molI); - } - } - } -} diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudRemoveHighEnergyOverlapsReferredCells.H b/src/lagrangian/molecule/moleculeCloud/moleculeCloudRemoveHighEnergyOverlapsReferredCells.H deleted file mode 100755 index 5b6b76135f2066dd765012858fe1ef12c4a21236..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudRemoveHighEnergyOverlapsReferredCells.H +++ /dev/null @@ -1,144 +0,0 @@ -{ - vector rKL; - - scalar rKLMag; - - scalar rKLMagSq; - - label idK; - - label idL; - - molecule* molK = &mol(); - - DynamicList<molecule*> molsToDelete; - - forAll(referredInteractionList_, rIL) - { - referredCell& refCell = referredInteractionList_[rIL]; - - forAll(refCell, refMols) - { - referredMolecule* molL = &(refCell[refMols]); - - List <label> realCells = refCell.realCellsForInteraction(); - - forAll(realCells, rC) - { - label cellK = realCells[rC]; - - List<molecule*> cellKMols = cellOccupancy_[cellK]; - - forAll(cellKMols, cKM) - { - molK = cellKMols[cKM]; - - idK = molK->id(); - - idL = molL->id(); - - rKL = molK->position() - molL->position(); - - rKLMagSq = magSqr(rKL); - - if (pairPotentials_.rCutSqr(idK, idL, rKLMagSq)) - { - rKLMag = mag(rKL); - - bool remove = false; - - if (rKLMag < SMALL) - { - WarningIn - ( - "moleculeCloud::removeHighEnergyOverlaps()" - ) - << "Real-referred molecule pair " - << " idK = " << idK << " (real)" - << " at position " << molK->position() - << " idL = " << idL << " (referred)" - << " at position " << molL->position() - << " are closer than " << SMALL - << ": mag separation = " << rKLMag - << ". These may have been placed on top of each" - << " other by a rounding error in molConfig in" - << " parallel, a block filled with molecules" - << " twice, or a lattice ending very close" - << " to the edge of the mesh." - << " Removing one of the molecules." - << endl; - - remove = true; - } - - // Guard against pairPotentials_.energy being evaluated - // if rKLMag < SMALL. A floating point exception will - // happen otherwise. - - if (!remove) - { - if - ( - pairPotentials_.energy(idK, idL, rKLMag) - > potentialEnergyLimit_ - ) - { - remove = true; - } - } - - if (remove) - { - if - ( - findIndex(removalOrder_, idK) - < findIndex(removalOrder_, idL) - ) - { - if (findIndex(molsToDelete, molK) == -1) - { - molsToDelete.append(molK); - } - } - - else if - ( - findIndex(removalOrder_, idK) - == findIndex(removalOrder_, idL) - ) - { - if - ( - Pstream::myProcNo() == refCell.sourceProc() - && cellK <= refCell.sourceCell() - ) - { - if (findIndex(molsToDelete, molK) == -1) - { - molsToDelete.append(molK); - } - } - - else if - ( - Pstream::myProcNo() < refCell.sourceProc() - ) - { - if (findIndex(molsToDelete, molK) == -1) - { - molsToDelete.append(molK); - } - } - } - } - } - } - } - } - } - - forAll (molsToDelete, mTD) - { - deleteParticle(*(molsToDelete[mTD])); - } -} diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudTestEdgeEdgeDistance.C b/src/lagrangian/molecule/moleculeCloud/moleculeCloudTestEdgeEdgeDistance.C deleted file mode 100755 index 285447974cf216b8ee508747e96918e9deb6200d..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudTestEdgeEdgeDistance.C +++ /dev/null @@ -1,86 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "moleculeCloud.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -bool Foam::moleculeCloud::testEdgeEdgeDistance -( - const edge& eI, - const edge& eJ -) const -{ - const vector& eJs(mesh_.points()[eJ.start()]); - const vector& eJe(mesh_.points()[eJ.end()]); - - return testEdgeEdgeDistance(eI, eJs, eJe); -} - -bool Foam::moleculeCloud::testEdgeEdgeDistance -( - const edge& eI, - const vector& eJs, - const vector& eJe -) const -{ - vector a(eI.vec(mesh_.points())); - vector b(eJe - eJs); - - const vector& eIs(mesh_.points()[eI.start()]); - - vector c(eJs - eIs); - - vector crossab = a ^ b; - scalar magCrossSqr = magSqr(crossab); - - if (magCrossSqr > VSMALL) - { - // If the edges are parallel then a point-face - // search will pick them up - - scalar s = ((c ^ b) & crossab)/magCrossSqr; - scalar t = ((c ^ a) & crossab)/magCrossSqr; - - // Check for end points outside of range 0..1 - // If the closest point is outside this range - // a point-face search will have found it. - - return - ( - s >= 0 - && s <= 1 - && t >= 0 - && t <= 1 - && magSqr(eIs + a*s - eJs - b*t) <= rCutMaxSqr() - ); - } - - return false; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudTestPointFaceDistance.C b/src/lagrangian/molecule/moleculeCloud/moleculeCloudTestPointFaceDistance.C deleted file mode 100755 index e01be864769728a17f9727db4a3fd4c194439e21..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudTestPointFaceDistance.C +++ /dev/null @@ -1,235 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "moleculeCloud.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -bool Foam::moleculeCloud::testPointFaceDistance -( - const label p, - const label faceNo -) const -{ - const vector& pointPosition(mesh_.points()[p]); - - return testPointFaceDistance(pointPosition, faceNo); -} - -bool Foam::moleculeCloud::testPointFaceDistance -( - const label p, - const referredCell& refCell -) const -{ - const vector& pointPosition(mesh_.points()[p]); - - forAll (refCell.faces(), rCF) - { - if - ( - testPointFaceDistance - ( - pointPosition, - refCell.faces()[rCF], - refCell.vertexPositions(), - refCell.faceCentres()[rCF], - refCell.faceAreas()[rCF] - ) - ) - { - return true; - } - } - - return false; -} - -bool Foam::moleculeCloud::testPointFaceDistance -( - const vectorList& pointsToTest, - const label faceNo -) const -{ - forAll(pointsToTest, pTT) - { - const vector& p(pointsToTest[pTT]); - - // if any point in the list is in range of the face - // then the rest do not need to be tested and - // true can be returned - - if (testPointFaceDistance(p, faceNo)) - { - return true; - } - } - - return false; -} - -bool Foam::moleculeCloud::testPointFaceDistance -( - const vector& p, - const label faceNo -) const -{ - const face& faceToTest(mesh_.faces()[faceNo]); - - const vector& faceC(mesh_.faceCentres()[faceNo]); - - const vector& faceA(mesh_.faceAreas()[faceNo]); - - const vectorList& points(mesh_.points()); - - return testPointFaceDistance - ( - p, - faceToTest, - points, - faceC, - faceA - ); -} - -bool Foam::moleculeCloud::testPointFaceDistance -( - const vector& p, - const labelList& faceToTest, - const vectorList& points, - const vector& faceC, - const vector& faceA -) const -{ - vector faceN(faceA/mag(faceA)); - - scalar perpDist((p - faceC) & faceN); - - if (mag(perpDist) > rCutMax()) - { - return false; - } - - vector pointOnPlane = (p - faceN * perpDist); - - if (magSqr(faceC - pointOnPlane) < rCutMaxSqr()*1e-8) - { - // If pointOnPlane is very close to the face centre - // then defining the local axes will be inaccurate - // and it is very likely that pointOnPlane will be - // inside the face, so return true if the points - // are in range to be safe - - return (magSqr(pointOnPlane - p) <= rCutMaxSqr()); - } - - vector xAxis = (faceC - pointOnPlane)/mag(faceC - pointOnPlane); - - vector yAxis = - ((faceC - pointOnPlane) ^ faceN) - /mag((faceC - pointOnPlane) ^ faceN); - - List<vector2D> local2DVertices(faceToTest.size()); - - forAll(faceToTest, fTT) - { - const vector& V(points[faceToTest[fTT]]); - - if (magSqr(V-p) <= rCutMaxSqr()) - { - return true; - } - - local2DVertices[fTT] = vector2D - ( - ((V - pointOnPlane) & xAxis), - ((V - pointOnPlane) & yAxis) - ); - } - - scalar localFaceCx((faceC - pointOnPlane) & xAxis); - - scalar la_valid = -1; - - forAll(local2DVertices, fV) - { - const vector2D& va(local2DVertices[fV]); - - const vector2D& vb - ( - local2DVertices[(fV + 1) % local2DVertices.size()] - ); - - if (mag(vb.y()-va.y()) > SMALL) - { - scalar la = - ( - va.x() - va.y()*((vb.x() - va.x())/(vb.y() - va.y())) - ) - /localFaceCx; - - scalar lv = -va.y()/(vb.y() - va.y()); - - - if (la >= 0 && la <= 1 && lv >= 0 && lv <= 1) - { - la_valid = la; - - break; - } - } - } - - if (la_valid < 0) - { - // perpendicular point inside face, nearest point is pointOnPlane; - return (magSqr(pointOnPlane-p) <= rCutMaxSqr()); - } - else - { - // perpendicular point outside face, nearest point is - // on edge that generated la_valid; - return - ( - magSqr(pointOnPlane + la_valid*(faceC - pointOnPlane) - p) - <= rCutMaxSqr() - ); - } - - // if the algorithm hasn't returned anything by now then something has - // gone wrong. - - FatalErrorIn("moleculeCloudTestPointAndFaceDistance.C") << nl - << "point " << p << " to face " << faceToTest - << " comparison did not find a nearest point" - << " to be inside or outside face." - << abort(FatalError); - - return false; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/potentials/pairPotential/basic/pairPotential.C b/src/lagrangian/molecule/potentials/pairPotential/basic/pairPotential.C deleted file mode 100755 index f7c96414e4282553fe26bfe9dfd39318035ddcde..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/potentials/pairPotential/basic/pairPotential.C +++ /dev/null @@ -1,308 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "pairPotential.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -void Foam::pairPotential::setLookupTables() -{ - label N = label((rCut_ - rMin_)/dr_) + 1; - - forceLookup_.setSize(N); - - energyLookup_.setSize(N); - - forAll(forceLookup_, k) - { - forceLookup_[k] = force(k*dr_ + rMin_); - - energyLookup_[k] = energy(k*dr_ + rMin_); - } - - forceLookup_[N-1] = 0.0; - energyLookup_[N-1] = 0.0; -} - - -void Foam::pairPotential::setConstants() -{ - scalar nr = n(rCut_); - - u_at_rCut_ = - epsilon_ - *( - (6.0/(nr - 6.0))*Foam::pow( (rCut_/rm_), -nr) - - (nr/(nr - 6.0))*Foam::pow( (rCut_/rm_), -6) - ); - - du_by_dr_at_rCut_ = - -6.0 * epsilon_ * gamma_ - *( - Foam::pow( (rCut_/rm_),-nr) - *( - (rCut_/rm_) - *(1.0 / (nr - 6.0) + log(rCut_ / rm_) + 1.0) - + (m_/gamma_) - - 1.0 - ) - - Foam::pow((rCut_/rm_),-6.0) - *(rCut_ / ( (nr - 6.0) * rm_) + (nr/gamma_)) - ) - /(rCut_*(nr - 6.0)); -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::pairPotential::pairPotential() -{} - - -Foam::pairPotential::pairPotential(const dictionary& pPDict) -: - forceLookup_(), - energyLookup_(), - m_(), - gamma_(), - rm_(), - epsilon_(), - rCut_(), - rCutSqr_(), - u_at_rCut_(), - du_by_dr_at_rCut_(), - rMin_(), - dr_() -{ - - m_ = readScalar(pPDict.lookup("m")); - - gamma_ = readScalar(pPDict.lookup("gamma")); - - rm_ = readScalar(pPDict.lookup("rm")); - - epsilon_ = readScalar(pPDict.lookup("epsilon")); - - rCut_ = readScalar(pPDict.lookup("rCut")); - - rCutSqr_ = rCut_ * rCut_; - - rMin_ = readScalar(pPDict.lookup("rMin")); - - dr_ = readScalar(pPDict.lookup("dr")); - - setConstants(); - - setLookupTables(); -} - - -Foam::pairPotential::pairPotential -( - const scalar m, - const scalar gamma, - const scalar rm, - const scalar epsilon, - const scalar rCut, - const scalar rMin, - const scalar dr -) -: - forceLookup_(), - energyLookup_(), - m_(m), - gamma_(gamma), - rm_(rm), - epsilon_(epsilon), - rCut_(rCut), - rCutSqr_(rCut*rCut), - u_at_rCut_(), - du_by_dr_at_rCut_(), - rMin_(rMin), - dr_(dr) -{ - setConstants(); - - setLookupTables(); -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::pairPotential::~pairPotential() -{} - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::pairPotential::write(Ostream& os) const -{ - os<< "Shifted force Maitland Smith pair potential." - << nl << tab << "m = " << m_ - << nl << tab << "gamma = " << gamma_ - << nl << tab << "rm = " << rm_ - << nl << tab << "epsilon = " << epsilon_ - << nl << tab << "rCut = " << rCut_ - << nl << tab << "rMin = " << rMin_ - << nl << tab << "dr = " << dr_ - << endl; -} - - -Foam::scalar Foam::pairPotential::n(const scalar rIJMag) const -{ - return (m_ + gamma_*(rIJMag/rm_ - 1.0)); -} - - -Foam::scalar Foam::pairPotential::force(const scalar rIJMag) const -{ - scalar nr(n(rIJMag)); - - scalar r = rIJMag/rm_; - - scalar rN = Foam::pow(r,-nr); - - scalar f = - - epsilon_ - *( - - 6.0/(nr - 6.0)/(nr - 6.0)*(gamma_/rm_)*rN - + 6.0/(nr - 6.0)*rN - *((gamma_ - m_)/rIJMag - (gamma_/rm_)*(log(r) + 1.0)) - + 6.0/(nr - 6.0) - *(1.0/(nr - 6.0)*(gamma_/rm_) + nr/rIJMag)*Foam::pow(r, -6) - ) - + du_by_dr_at_rCut_; - - return f; -} - - -Foam::scalar Foam::pairPotential::forceLookup(const scalar rIJMag) const -{ - scalar k_rIJ = (rIJMag - rMin_)/dr_; - - label k(k_rIJ); - - if (k < 0) - { - FatalErrorIn("pairPotential.C") << nl - << "rIJMag less than rMin" << nl - << abort(FatalError); - } - - scalar f = - (k_rIJ - k)*forceLookup_[k+1] - + (k + 1 - k_rIJ)*forceLookup_[k]; - - return f; -} - - -Foam::List< Foam::Pair< Foam::scalar > > -Foam::pairPotential::forceTable() const -{ - List< Pair<scalar> > forceTab(forceLookup_.size()); - - forAll(forceLookup_,k) - { - forceTab[k].first() = rMin_ + k*dr_; - - forceTab[k].second() = forceLookup_[k]; - } - - return forceTab; -} - - -Foam::scalar Foam::pairPotential::energy(const scalar rIJMag) const -{ - scalar nr = n(rIJMag); - - scalar e = - epsilon_ - *( - (6.0 / (nr - 6.0))*Foam::pow( rIJMag/rm_, -nr) - - (nr / (nr - 6.0))*Foam::pow( rIJMag/rm_, -6) - ) - - u_at_rCut_ - - (rIJMag - rCut_) - *du_by_dr_at_rCut_; - - return e; -} - - -Foam::scalar Foam::pairPotential::energyLookup(const scalar rIJMag) const -{ - scalar k_rIJ = (rIJMag - rMin_)/dr_; - - label k(k_rIJ); - - if (k < 0) - { - FatalErrorIn("pairPotential.C") << nl - << "rIJMag less than rMin" << nl - << abort(FatalError); - } - - scalar e = - (k_rIJ - k)*energyLookup_[k+1] - + (k + 1 - k_rIJ)*energyLookup_[k]; - - return e; -} - - -Foam::List< Foam::Pair< Foam::scalar > > - Foam::pairPotential::energyTable() const -{ - List< Pair<scalar> > energyTab(energyLookup_.size()); - - forAll(energyLookup_,k) - { - energyTab[k].first() = rMin_ + k*dr_; - - energyTab[k].second() = energyLookup_[k]; - } - - return energyTab; -} - - -// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // - -Foam::Ostream& Foam::operator<<(Ostream& os, const pairPotential& pot) -{ - pot.write(os); - os.check - ( - "Foam::Ostream& Foam::pperator<<(Ostream& f, const pairPotential& pot" - ); - return os; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/potentials/pairPotential/basic/pairPotential.H b/src/lagrangian/molecule/potentials/pairPotential/basic/pairPotential.H deleted file mode 100755 index 42b507586acfec5ebaa500d2374e6a3b8387ba34..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/potentials/pairPotential/basic/pairPotential.H +++ /dev/null @@ -1,196 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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::pairPotential - -Description - - At the moment this is hard coded to be a shifted force - "maitlandSmith" potential. - In future use templated classes virtual functions, - function pointers and all kinds of good stuff to make - this a generic pair force, - -SourceFiles - pairPotentialI.H - pairPotential.C - -\*---------------------------------------------------------------------------*/ - -#ifndef pairPotential_H -#define pairPotential_H - -#include "vector.H" -#include "dictionary.H" -#include "List.H" -#include "Pair.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class pairPotential Declaration -\*---------------------------------------------------------------------------*/ - -class pairPotential -{ - // Private data - - List<scalar> forceLookup_; - - List<scalar> energyLookup_; - - scalar m_; - - scalar gamma_; - - scalar rm_; - - scalar epsilon_; - - scalar rCut_; - - scalar rCutSqr_; - - scalar u_at_rCut_; - - scalar du_by_dr_at_rCut_; - - scalar rMin_; - - scalar dr_; - - - // Private Member Functions - - void setLookupTables(); - - void setConstants(); - - -public: - - // Constructors - - //- Construct null - pairPotential(); - - //- Construct from dictionary - pairPotential(const dictionary& pPDict); - - //- Construct from components - pairPotential - ( - const scalar m, - const scalar gamma, - const scalar rm, - const scalar epsilon, - const scalar rCut, - const scalar rMin, - const scalar dr - ); - - - // Destructor - - virtual ~pairPotential(); - - - // Member Functions - - // Access - - inline scalar m() const; - - inline scalar gamma() const ; - - inline scalar rm() const; - - inline scalar epsilon() const; - - inline scalar rCut() const; - - inline scalar rCutSqr() const; - - inline scalar rMin() const; - - inline scalar dr() const; - - - // Write - - virtual void write(Ostream&) const; - - scalar n(const scalar rIJMag) const; - - scalar force(const scalar rIJMag) const; - - scalar forceLookup(const scalar rIJMag) const; - - List<Pair<scalar> > forceTable() const; - - scalar energy(const scalar rIJMag) const; - - scalar energyLookup(const scalar rIJMag) const; - - List<Pair<scalar> > energyTable() const; - - - // Friend Operators - - inline friend bool operator== - ( - const pairPotential& a, - const pairPotential& b - ); - - inline friend bool operator!= - ( - const pairPotential& a, - const pairPotential& b - ); - - - // IOstream Operators - - friend Ostream& operator<<(Ostream&, const pairPotential&); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "pairPotentialI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/potentials/pairPotential/basic/pairPotentialI.H b/src/lagrangian/molecule/potentials/pairPotential/basic/pairPotentialI.H deleted file mode 100755 index 3a3efa223aa8a269bf58ffaa18e9e6c194fc9f46..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/potentials/pairPotential/basic/pairPotentialI.H +++ /dev/null @@ -1,102 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 - -\*---------------------------------------------------------------------------*/ - -inline Foam::scalar Foam::pairPotential::m() const -{ - return m_; -} - - -inline Foam::scalar Foam::pairPotential::gamma() const -{ - return gamma_; -} - - -inline Foam::scalar Foam::pairPotential::rm() const -{ - return rm_; -} - - -inline Foam::scalar Foam::pairPotential::epsilon() const -{ - return epsilon_; -} - - -inline Foam::scalar Foam::pairPotential::rCut() const -{ - return rCut_; -} - - -inline Foam::scalar Foam::pairPotential::rCutSqr() const -{ - return rCutSqr_; -} - - -inline Foam::scalar Foam::pairPotential::rMin() const -{ - return rMin_; -} - - -inline Foam::scalar Foam::pairPotential::dr() const -{ - return dr_; -} - - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - -inline bool Foam::operator== -( - const pairPotential& a, - const pairPotential& b -) -{ - return - (a.m() == b.m()) - && (a.gamma() == b.gamma()) - && (a.rm() == b.rm()) - && (a.epsilon() == b.epsilon()) - && (a.rCut() == b.rCut()); -} - - -inline bool Foam::operator!= -( - const pairPotential& a, - const pairPotential& b -) -{ - return !(a == b); -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/potentials/pairPotential/basic/pairPotentialList.C b/src/lagrangian/molecule/potentials/pairPotential/basic/pairPotentialList.C deleted file mode 100755 index b38687dfc00d963e2e9ed1392a196e20934bb03e..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/potentials/pairPotential/basic/pairPotentialList.C +++ /dev/null @@ -1,180 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "pairPotentialList.H" - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::pairPotentialList::pairPotentialList() -: - List<pairPotential> () -{} - - -Foam::pairPotentialList::pairPotentialList -( - const label nIds -) -: - List<pairPotential> ((nIds * (nIds + 1))/2), - nIds_(nIds) -{} - - -Foam::pairPotentialList::pairPotentialList -( - const List<pairPotential>& pairPotentials, - const label nIds -) -: - List<pairPotential> (pairPotentials), - nIds_(nIds) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -pairPotentialList::~pairPotentialList() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void pairPotentialList::setSizeAndNIds (const label nIds) -{ - nIds_ = nIds; - setSize((nIds * (nIds + 1))/2); -} - - -void pairPotentialList::addPotential -( - const label a, - const label b, - const pairPotential& pot -) -{ - if (pairPotentialIndex (a,b) > size()-1) - { - FatalErrorIn - ( - "Foam::pairPotentialList::addPotential " - "(const label a, const label b, const pairPotential& pot)" - )<< "Attempting to add a pairPotential with too high an index" - << nl - << "Check if the pairPotentialList has been constructed " - << "with the number of ids to expect" - << nl << abort(FatalError); - } - else - { - (*this)[pairPotentialIndex (a,b)] = pot; - } -} - - -const pairPotential& pairPotentialList::pairPotentialFunction -( - const label a, - const label b -) const -{ - return (*this)[pairPotentialIndex (a,b)]; -} - - -bool pairPotentialList::rCutSqr -( - const label a, - const label b, - const scalar rIJMagSqr -) const -{ - if(rIJMagSqr <= rCutSqr (a,b)) - { - return true; - } - else - { - return false; - } -} - - -scalar pairPotentialList::rCutSqr -( - const label a, - const label b -) const -{ - return (*this)[pairPotentialIndex (a,b)].rCutSqr(); -} - - -scalar pairPotentialList::rCut -( - const label a, - const label b -) const -{ - return (*this)[pairPotentialIndex (a,b)].rCut(); -} - - -scalar pairPotentialList::force -( - const label a, - const label b, - const scalar rIJMag -) const -{ - scalar f = (*this)[pairPotentialIndex (a,b)].forceLookup(rIJMag); - - return f; -} - - -scalar pairPotentialList::energy -( - const label a, - const label b, - const scalar rIJMag -) const -{ - scalar e = (*this)[pairPotentialIndex (a,b)].energyLookup(rIJMag); - - return e; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/potentials/pairPotential/basic/pairPotentialList.H b/src/lagrangian/molecule/potentials/pairPotential/basic/pairPotentialList.H deleted file mode 100755 index 910ab5ab38667a2c2a152d677aaaf30f5ca847c7..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/potentials/pairPotential/basic/pairPotentialList.H +++ /dev/null @@ -1,169 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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::pairPotentialList - -Description - -SourceFiles - pairPotentialListI.H - pairPotentialList.C - -\*---------------------------------------------------------------------------*/ - -#ifndef pairPotentialList_H -#define pairPotentialList_H - -#include "pairPotential.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class pairPotentialList Declaration -\*---------------------------------------------------------------------------*/ - -class pairPotentialList -: - public List<pairPotential> -{ - // Private data - - label nIds_; - - - // Private Member Functions - - inline label pairPotentialIndex - ( - const label a, - const label b - ) const; - - //- Disallow default bitwise assignment - void operator=(const pairPotentialList&); - - //- Disallow default bitwise copy construct - pairPotentialList(const pairPotentialList&); - - -public: - - // Constructors - - //- Construct null - pairPotentialList(); - - //- Construct from number of Ids - pairPotentialList - ( - const label nIds - ); - - //- Construct from components - pairPotentialList - ( - const List<pairPotential>& pairPotentials, - const label nIds - ); - - - // Destructor - - ~pairPotentialList(); - - - // Member Functions - - // Access - - inline label nIds() const; - - void setSizeAndNIds (const label); - - void addPotential - ( - const label a, - const label b, - const pairPotential& pot - ); - - const pairPotential& pairPotentialFunction - ( - const label a, - const label b - ) const; - - // Return true if rIJ is within rCut for this pair. - bool rCutSqr - ( - const label a, - const label b, - const scalar rIJMagSqr - ) const; - - scalar rCutSqr - ( - const label a, - const label b - ) const; - - scalar rCut - ( - const label a, - const label b - ) const; - - scalar force - ( - const label a, - const label b, - const scalar rIJMag - ) const; - - scalar energy - ( - const label a, - const label b, - const scalar rIJMag - ) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "pairPotentialListI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/potentials/pairPotential/basic/pairPotentialListI.H b/src/lagrangian/molecule/potentials/pairPotential/basic/pairPotentialListI.H deleted file mode 100755 index d58fa545df485ccc2984f7aa03fa586155a02372..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/potentials/pairPotential/basic/pairPotentialListI.H +++ /dev/null @@ -1,59 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 - -\*---------------------------------------------------------------------------*/ - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -inline Foam::label Foam::pairPotentialList::pairPotentialIndex -( - const label a, - const label b -) const -{ - label index; - - if (a < b) - { - index = a*(2*nIds_ - a - 1)/2 + b; - } - - else - { - index = b*(2*nIds_ - b - 1)/2 + a; - } - - return index; -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -inline Foam::label Foam::pairPotentialList::nIds() const -{ - return nIds_; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/potentials/pairPotential/derived/lennardJones.C b/src/lagrangian/molecule/potentials/pairPotential/derived/lennardJones.C deleted file mode 100755 index 1eab1aa40a1fb753f089f7257de7f4f3387bcac5..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/potentials/pairPotential/derived/lennardJones.C +++ /dev/null @@ -1,132 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "pairPotential.H" - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -pairPotential::pairPotential() -{} - - -// Construct from components -pairPotential::pairPotential -( - const word& pairPotentialName, - const word& pairPotentialType, - const scalar sigma, - const scalar epsilon, - const scalar rCut -) -: - pairPotentialName_(pairPotentialName), - pairPotentialType_(pairPotentialType), - sigma_(sigma), - epsilon_(epsilon), - rCut_(rCut), - rCutSqr_(rCut*rCut) -{ - // rCutShiftedForcePotentialConstTerm - rCutSFPotConst_ = (pow((rCut_/sigma_),-12) - pow((rCut_/sigma_),-6)); - - // rCutShiftedForceConstTerm - rCutSFConst_ = - (pow((rCut_/sigma_),-14) - 0.5*pow((rCut_/sigma_),-8))*rCut_; -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -pairPotential::~pairPotential() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void pairPotential::write(Ostream& os) const -{ - os << pairPotentialName_ - << nl << pairPotentialType_ - << nl << sigma_ - << nl << epsilon_ - << nl << rCut_ - << endl; -} - - -scalar pairPotential::force(const scalar rIJMag) const -{ - // (rIJ/sigma)^-2 - scalar rIJoSMagSqInv = (sigma_/rIJMag)*(sigma_/rIJMag); - - // (rIJ/sigma)^-6 - scalar rIJoSMagSqInvCu = rIJoSMagSqInv*rIJoSMagSqInv*rIJoSMagSqInv; - - scalar f = 48.0*epsilon_/(sigma_*sigma_) - *(rIJoSMagSqInvCu*(rIJoSMagSqInvCu - 0.5)*rIJoSMagSqInv - - rCutSFConst_/rIJMag); - - return f; -} - - -scalar pairPotential::energy(const scalar rIJMag) const -{ - // (rIJ/sigma)^-2 - scalar rIJoSMagSqInv = (sigma_/rIJMag)*(sigma_/rIJMag); - - // (rIJ/sigma)^-6 - scalar rIJoSMagSqInvCu = rIJoSMagSqInv*rIJoSMagSqInv*rIJoSMagSqInv; - - scalar e = 4*epsilon_ - *( - rIJoSMagSqInvCu*(rIJoSMagSqInvCu - 1.0) - - rCutSFPotConst_ - + 12*(rIJMag - rCut_)/(sigma_*sigma_)*rCutSFConst_ - ); - - return e; -} - - -// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // - -Ostream& operator<<(Ostream& os, const pairPotential& pot) -{ - pot.write(os); - os.check("Ostream& operator<<(Ostream& f, const pairPotential& pot"); - return os; -} - - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/potentials/pairPotential/derived/lennardJones.H b/src/lagrangian/molecule/potentials/pairPotential/derived/lennardJones.H deleted file mode 100755 index 57dea3ab725b00c805cf34f9518dad9b57d83516..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/potentials/pairPotential/derived/lennardJones.H +++ /dev/null @@ -1,148 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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::pairPotential - -Description - -SourceFiles - pairPotentialI.H - pairPotential.C - -\*---------------------------------------------------------------------------*/ - -#ifndef pairPotential_H -#define pairPotential_H - -#include "vector.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - - -/*---------------------------------------------------------------------------*\ - Class pairPotential Declaration -\*---------------------------------------------------------------------------*/ - -class pairPotential -{ - // Private data - - // At the moment this is hard coded to be a "shiftedLennardJones" - // potential. In future use templated classes virtual functions, - // function pointers and all kinds of good stuff to make this a - // generic pair force, - - // Not strictly necessary, but useful to keep track of what's what. - word pairPotentialName_; - - // To be used when runTime selection of potential function is working. - word pairPotentialType_; - - scalar sigma_; - - scalar epsilon_; - - scalar rCut_; - - scalar rCutSqr_; - - // rCutShiftedForcePotentialConstTerm - scalar rCutSFPotConst_; - - // rCutShiftedForceConstTerm - scalar rCutSFConst_; - - -public: - - // Constructors - - //- Construct null - pairPotential(); - - //- Construct from components - pairPotential - ( - const word& pairPotentialName, - const word& pairPotentialType, - const scalar sigma, - const scalar epsilon, - const scalar rCut - ); - - - // Destructor - - virtual ~pairPotential(); - - - // Member Functions - - // Access - - inline const word& pairPotentialName() const; - - inline const word& pairPotentialType() const; - - inline scalar sigma() const; - - inline scalar epsilon() const; - - inline scalar rCut() const; - - inline scalar rCutSqr() const; - - - // Write - - virtual void write(Ostream&) const; - - scalar force(const scalar rIJMag) const; - - scalar energy(const scalar rIJMag) const; - - - // IOstream Operators - - friend Ostream& operator<<(Ostream&, const pairPotential&); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "pairPotentialI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/potentials/pairPotential/derived/lennardJonesI.H b/src/lagrangian/molecule/potentials/pairPotential/derived/lennardJonesI.H deleted file mode 100755 index 4e3a1a2f27c63584a5e6e0cdd8e512a4660b94d0..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/potentials/pairPotential/derived/lennardJonesI.H +++ /dev/null @@ -1,69 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 - -\*---------------------------------------------------------------------------*/ - -namespace Foam -{ - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -inline const word& pairPotential::pairPotentialName() const -{ - return pairPotentialName_; -} - - -inline const word& pairPotential::pairPotentialType() const -{ - return pairPotentialType_; -} - - -inline scalar pairPotential::sigma() const -{ - return sigma_; -} - - -inline scalar pairPotential::epsilon() const -{ - return epsilon_; -} - - -inline scalar pairPotential::rCut() const -{ - return rCut_; -} - - -inline scalar pairPotential::rCutSqr() const -{ - return rCutSqr_; -} - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/potentials/tetherPotential/tetherPotential.C b/src/lagrangian/molecule/potentials/tetherPotential/tetherPotential.C deleted file mode 100755 index 46c097b36d5abf8473bd8676ea24abb7787dd970..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/potentials/tetherPotential/tetherPotential.C +++ /dev/null @@ -1,94 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "tetherPotential.H" - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -tetherPotential::tetherPotential() -{} - - -tetherPotential::tetherPotential -( - const word& tetherPotentialName, - const word& tetherPotentialType, - const scalar springConstant -) -: - tetherPotentialName_(tetherPotentialName), - tetherPotentialType_(tetherPotentialType), - springConstant_(springConstant) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -tetherPotential::~tetherPotential() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void tetherPotential::write(Ostream& os) const -{ - os << tetherPotentialName_ - << nl << tetherPotentialType_ - << nl << springConstant_ - << endl; -} - - -scalar tetherPotential::force(const scalar rITMag) const -{ - return -springConstant_ * rITMag; -} - - -scalar tetherPotential::energy(const scalar rITMag) const -{ - return 0.5*springConstant_*rITMag*rITMag; -} - - -// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // - -Ostream& operator<<(Ostream& os, const tetherPotential& pot) -{ - pot.write(os); - os.check("Ostream& operator<<(Ostream& f, const tetherPotential& pot"); - return os; -} - - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/potentials/tetherPotential/tetherPotential.H b/src/lagrangian/molecule/potentials/tetherPotential/tetherPotential.H deleted file mode 100755 index afa9a35e69d1ba4974a1688bdfc9c17036248765..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/potentials/tetherPotential/tetherPotential.H +++ /dev/null @@ -1,125 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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::tetherPotential - -Description - -SourceFiles - tetherPotentialI.H - tetherPotential.C - -\*---------------------------------------------------------------------------*/ - -#ifndef tetherPotential_H -#define tetherPotential_H - -#include "vector.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class tetherPotential Declaration -\*---------------------------------------------------------------------------*/ - -class tetherPotential -{ - // Private data - - // At the moment this is hard coded to be a "harmonicSpring" - // potential. In future use templated classes virtual functions, - // function pointers and all kinds of good stuff to make this a - // generic tether force, - - word tetherPotentialName_; - - word tetherPotentialType_; - - scalar springConstant_; - - -public: - - // Constructors - - //- Construct null - tetherPotential(); - - //- Construct from components - tetherPotential - ( - const word& tetherPotentialName, - const word& tetherPotentialType, - const scalar springConstant_ - ); - - - // Destructor - - virtual ~tetherPotential(); - - - // Member Functions - - // Access - - inline const word& tetherPotentialName() const; - - inline const word& tetherPotentialType() const; - - inline scalar springConstant() const; - - scalar force(const scalar rITMag) const; - - scalar energy(const scalar rITMag) const; - - - // Write - - virtual void write(Ostream&) const; - - - // IOstream Operators - - friend Ostream& operator<<(Ostream&, const tetherPotential&); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "tetherPotentialI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/potentials/tetherPotential/tetherPotentialI.H b/src/lagrangian/molecule/potentials/tetherPotential/tetherPotentialI.H deleted file mode 100755 index d9ca0dae1a60582760f914e8ae621621a2b19d16..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/potentials/tetherPotential/tetherPotentialI.H +++ /dev/null @@ -1,56 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 - -\*---------------------------------------------------------------------------*/ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -inline const word& tetherPotential::tetherPotentialName() const -{ - return tetherPotentialName_; -} - - -inline const word& tetherPotential::tetherPotentialType() const -{ - return tetherPotentialType_; -} - - -inline scalar tetherPotential::springConstant() const -{ - return springConstant_; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/potentials/tetherPotential/tetherPotentialList.C b/src/lagrangian/molecule/potentials/tetherPotential/tetherPotentialList.C deleted file mode 100755 index ac32daf60fa662f827d64e189f56469e721a8c49..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/potentials/tetherPotential/tetherPotentialList.C +++ /dev/null @@ -1,146 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "tetherPotentialList.H" - -namespace Foam -{ - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -label tetherPotentialList::tetherPotentialIndex(const label a) -{ - label index(findIndex(tetherIds_,a)); - - if (index == -1) - { - FatalErrorIn - ( - "Foam::tetherPotentialList::tetherPotentialIndex(const label a)" - ) - << "Attempting to access a tetherPotential with an unknown id" - << abort(FatalError); - - return 0; - } - else - { - return index; - } -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::tetherPotentialList::tetherPotentialList() -: - List<tetherPotential> () -{} - - -Foam::tetherPotentialList::tetherPotentialList -( - const List<label> tetherIds -) -: - List<tetherPotential> (tetherIds.size()), - tetherIds_(tetherIds_) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -tetherPotentialList::~tetherPotentialList() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void tetherPotentialList::setSizeAndTetherIds (const List<label>& tetherIds) -{ - tetherIds_ = tetherIds; - setSize(tetherIds.size()); -} - - -void tetherPotentialList::addPotential -( - const label a, - const tetherPotential& pot -) -{ - (*this)[tetherPotentialIndex (a)] = pot; -} - - -tetherPotential& tetherPotentialList::tetherPotentialFunction (const label a) -{ - return (*this)[tetherPotentialIndex (a)]; -} - - -scalar tetherPotentialList::force (const label a, const scalar rITMag) -{ - scalar f = (*this)[tetherPotentialIndex (a)].force(rITMag); - - return f; -} - - -scalar tetherPotentialList::energy (const label a, const scalar rITMag) -{ - scalar e = (*this)[tetherPotentialIndex (a)].energy(rITMag); - - return e; -} - - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - -void tetherPotentialList::operator=(const tetherPotentialList& rhs) -{ - // Check for assignment to self - if (this == &rhs) - { - FatalErrorIn - ( - "Foam::tetherPotentialList::operator=" - "(const Foam::tetherPotentialList&)" - ) << "Attempted assignment to self" - << abort(FatalError); - } - - List<tetherPotential>::operator=(rhs); - - tetherIds_ = rhs.tetherIds(); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/potentials/tetherPotential/tetherPotentialList.H b/src/lagrangian/molecule/potentials/tetherPotential/tetherPotentialList.H deleted file mode 100755 index ebd24e57f00f6a916cfc8d8b33dd3caa31989e41..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/potentials/tetherPotential/tetherPotentialList.H +++ /dev/null @@ -1,125 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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::tetherPotentialList - -Description - -SourceFiles - tetherPotentialListI.H - tetherPotentialList.C - -\*---------------------------------------------------------------------------*/ - -#ifndef tetherPotentialList_H -#define tetherPotentialList_H - -#include "ListOps.H" -#include "tetherPotential.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class tetherPotentialList Declaration -\*---------------------------------------------------------------------------*/ - -class tetherPotentialList -: - public List<tetherPotential> -{ - // Private data - - List<label> tetherIds_; - - - // Private Member Functions - - label tetherPotentialIndex(const label a); - - //- Disallow default bitwise copy construct - tetherPotentialList(const tetherPotentialList&); - - -public: - - // Constructors - - //- Construct null - tetherPotentialList(); - - //- Construct from list of tetherIDs - tetherPotentialList(const List<label> tetherIds); - - - // Destructor - - ~tetherPotentialList(); - - - // Member Functions - - // Access - - inline const List<label>& tetherIds() const; - - inline label nTetherPotentials() const; - - void setSizeAndTetherIds (const List<label>&); - - void addPotential - ( - const label a, - const tetherPotential& pot - ); - - tetherPotential& tetherPotentialFunction (const label a); - - scalar force (const label a, const scalar rITMag); - - scalar energy (const label a, const scalar rITMag); - - - // Member Operators - - void operator=(const tetherPotentialList&); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "tetherPotentialListI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/potentials/tetherPotential/tetherPotentialListI.H b/src/lagrangian/molecule/potentials/tetherPotential/tetherPotentialListI.H deleted file mode 100755 index 4f897839183ae2779d93e98a5a4f1e493145952a..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/potentials/tetherPotential/tetherPotentialListI.H +++ /dev/null @@ -1,50 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 - -\*---------------------------------------------------------------------------*/ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -inline const List<label>& tetherPotentialList::tetherIds() const -{ - return tetherIds_; -} - - -inline label tetherPotentialList::nTetherPotentials() const -{ - return tetherIds_.size(); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/reducedUnits/reducedUnits.C b/src/lagrangian/molecule/reducedUnits/reducedUnits.C deleted file mode 100644 index 3536893f8e96efd64f9fbaeb0be484dfcd79bff7..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/reducedUnits/reducedUnits.C +++ /dev/null @@ -1,165 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 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 "reducedUnits.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -const Foam::scalar Foam::reducedUnits::kb = 1.3806504e-23; - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -void Foam::reducedUnits::calcRefValues() -{ - if - ( - refTime_ < VSMALL - || refLength_ < VSMALL - || refMass_ < VSMALL - ) - { - FatalErrorIn("Foam::reducedUnits::calcRefValues() ") - << "One of more referencence values too small for floating point " - << "calculation: " - << "refTime_ = " << refTime_ - << ", refLength = " << refTemp_ - << ", refMass = " << refMass_ - << nl << abort(FatalError); - } - - refEnergy_ = refLength_*refLength_*refMass_/(refTime_*refTime_); - - refTemp_ = refEnergy_ / kb; - - refForce_ = refEnergy_/refLength_; - - refVelocity_ = Foam::sqrt(refEnergy_/refMass_); - - refVolume_ = Foam::pow(refLength_,3.0); - - refPressure_ = refEnergy_/refVolume_; - - refMassDensity_ = refMass_/refVolume_; - - refNumberDensity_ = 1.0/refVolume_; -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::reducedUnits::reducedUnits() -: - refLength_(1e-9), - refTime_(1e-12), - refMass_(1.660538782e-27) -{ - calcRefValues(); -} - - -Foam::reducedUnits::reducedUnits -( - scalar refLength, - scalar refTime, - scalar refMass -) -: - refLength_(refLength), - refTime_(refTime), - refMass_(refMass) -{ - calcRefValues(); -} - - -Foam::reducedUnits::reducedUnits(const IOdictionary& reducedUnitsDict) -: - refLength_(), - refTime_(), - refMass_() -{ - setRefValues(reducedUnitsDict); -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::reducedUnits::~reducedUnits() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::reducedUnits::setRefValues -( - scalar refLength, - scalar refTime, - scalar refMass -) -{ - refLength_ = refLength; - - refTime_ = refTime; - - refMass_ = refMass; - - calcRefValues(); -} - - -void Foam::reducedUnits::setRefValues -( - const IOdictionary& reducedUnitsDict -) -{ - refLength_ = readScalar(reducedUnitsDict.lookup("refLength")); - - refTime_ = readScalar(reducedUnitsDict.lookup("refTime")); - - refMass_ = readScalar(reducedUnitsDict.lookup("refMass")); - - calcRefValues(); -} - - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - -void Foam::reducedUnits::operator=(const reducedUnits& rhs) -{ - // Check for assignment to self - if (this == &rhs) - { - FatalErrorIn - ( - "Foam::reducedUnits::operator=(const Foam::reducedUnits&)" - ) << "Attempted assignment to self" - << abort(FatalError); - } -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/reducedUnits/reducedUnits.H b/src/lagrangian/molecule/reducedUnits/reducedUnits.H deleted file mode 100644 index 7adc1051fd414ac75a66e64c79bacada4a5ba045..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/reducedUnits/reducedUnits.H +++ /dev/null @@ -1,184 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 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::reducedUnits - -Description - -SourceFiles - reducedUnitsI.H - reducedUnits.C - reducedUnitsIO.C - -\*---------------------------------------------------------------------------*/ - -#ifndef reducedUnits_H -#define reducedUnits_H - -#include "scalar.H" -#include "IOdictionary.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class reducedUnits Declaration -\*---------------------------------------------------------------------------*/ - -class reducedUnits -{ - // Private data - - // Reduced units - - // Fundamental values - - scalar refLength_; - - scalar refTime_; - - scalar refMass_; - - // Derived values - - scalar refEnergy_; - - scalar refTemp_; - - scalar refForce_; - - scalar refVelocity_; - - scalar refVolume_; - - scalar refPressure_; - - scalar refMassDensity_; - - scalar refNumberDensity_; - - - // Private Member Functions - - void calcRefValues(); - - //- Disallow default bitwise copy construct - reducedUnits(const reducedUnits&); - - //- Disallow default bitwise assignment - void operator=(const reducedUnits&); - - -public: - - // Static data members - - //- Static data someStaticData - static const scalar kb; - - - // Constructors - - //- Construct with no argument, uses default values: - // length = 1nm - // mass = 1.660538782e−27kg (unified atomic mass unit) - // temperature = 1K (therefore, energy = 1*kb) - reducedUnits(); - - //- Construct from components - reducedUnits - ( - scalar refLength, - scalar refTime, - scalar refMass - ); - - //- Construct from dictionary - reducedUnits(const IOdictionary& reducedUnitsDict); - - - // Destructor - - ~reducedUnits(); - - - // Member Functions - - void setRefValues - ( - scalar refLength, - scalar refTime, - scalar refMass - ); - - void setRefValues(const IOdictionary& reducedUnitsDict); - - - // Access - - inline scalar refLength() const; - - inline scalar refTime() const; - - inline scalar refMass() const; - - inline scalar refTemp() const; - - inline scalar refEnergy() const; - - inline scalar refForce() const; - - inline scalar refVelocity() const; - - inline scalar refVolume() const; - - inline scalar refPressure() const; - - inline scalar refMassDensity() const; - - inline scalar refNumberDensity() const; - - - // IOstream Operators - - friend Ostream& operator<<(Ostream&, const reducedUnits&); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "reducedUnitsI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/reducedUnits/reducedUnitsI.H b/src/lagrangian/molecule/reducedUnits/reducedUnitsI.H deleted file mode 100644 index 8098885d68663306aaaabc2d21672258e06e68c4..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/reducedUnits/reducedUnitsI.H +++ /dev/null @@ -1,95 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 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 - -\*---------------------------------------------------------------------------*/ - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -inline Foam::scalar Foam::reducedUnits::refLength() const -{ - return refLength_; -} - - -inline Foam::scalar Foam::reducedUnits::refTime() const -{ - return refTime_; -} - - -inline Foam::scalar Foam::reducedUnits::refMass() const -{ - return refMass_; -} - - -inline Foam::scalar Foam::reducedUnits::refTemp() const -{ - return refTemp_; -} - - -inline Foam::scalar Foam::reducedUnits::refEnergy() const -{ - return refEnergy_; -} - - -inline Foam::scalar Foam::reducedUnits::refForce() const -{ - return refForce_; -} - - -inline Foam::scalar Foam::reducedUnits::refVelocity() const -{ - return refVelocity_; -} - - -inline Foam::scalar Foam::reducedUnits::refVolume() const -{ - return refVolume_; -} - - -inline Foam::scalar Foam::reducedUnits::refPressure() const -{ - return refPressure_; -} - - -inline Foam::scalar Foam::reducedUnits::refMassDensity() const -{ - return refMassDensity_; -} - - -inline Foam::scalar Foam::reducedUnits::refNumberDensity() const -{ - return refNumberDensity_; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/reducedUnits/reducedUnitsIO.C b/src/lagrangian/molecule/reducedUnits/reducedUnitsIO.C deleted file mode 100644 index 88d110a5be2e1e4e9d32dfd93fc2dfc812f35fe6..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/reducedUnits/reducedUnitsIO.C +++ /dev/null @@ -1,61 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 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 "reducedUnits.H" -#include "IOstreams.H" - -// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // - -Foam::Ostream& Foam::operator<<(Ostream& os, const reducedUnits& rU) -{ - os << nl << "Defined: " << nl - << tab << "refLength = " << rU.refLength() << " m" << nl - << tab << "refTime = " << rU.refTime() << " s" << nl - << tab << "refMass = " << rU.refMass() << " kg" << nl - << tab << "Boltzmann constant, kb = " << reducedUnits::kb << " J/K" - << nl << "Calculated: " << nl - << tab << "refEnergy = " << rU.refEnergy() << " J" << nl - << tab << "refTemp = " << rU.refTemp() << " K" << nl - << tab << "refForce = " << rU.refForce() << " N" << nl - << tab << "refVelocity = " << rU.refVelocity() << " m/s" << nl - << tab << "refVolume = " << rU.refVolume() << " m^3" << nl - << tab << "refPressure = " << rU.refPressure() << " N/m^2" << nl - << tab << "refMassDensity = " << rU.refMassDensity() << " kg/m^3" << nl - << tab << "refNumberDensity = " << rU.refNumberDensity() << " m^-3" - << endl; - - // Check state of Ostream - os.check - ( - "Foam::Ostream& Foam::operator<<(Foam::Ostream&, " - "const Foam::reducedUnits&)" - ); - - return os; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/referralLists/receivingReferralList.C b/src/lagrangian/molecule/referralLists/receivingReferralList.C deleted file mode 100755 index e35c660b741d1661f4b07cddaec55c07a5629683..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/referralLists/receivingReferralList.C +++ /dev/null @@ -1,181 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "receivingReferralList.H" - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -receivingReferralList::receivingReferralList() -: - labelListList(), - sourceProc_(-1) -{} - - -receivingReferralList::receivingReferralList -( - const label sourceProc, - const labelListList& refCellsToSendTo -) -: - labelListList(refCellsToSendTo), - sourceProc_(sourceProc) -{} - - -receivingReferralList::receivingReferralList -( - const receivingReferralList& rL -) -: - labelListList(rL), - sourceProc_(rL.sourceProc()) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -receivingReferralList::~receivingReferralList() -{} - - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - -void receivingReferralList::operator=(const receivingReferralList& rhs) -{ - // Check for assignment to self - if (this == &rhs) - { - FatalErrorIn - ( - "Foam::receivingReferralList::operator=" - "(const Foam::receivingReferralList&)" - ) - << "Attempted assignment to self" - << abort(FatalError); - } - - labelListList::operator=(rhs); - - sourceProc_ = rhs.sourceProc(); -} - - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - -bool operator== -( - const receivingReferralList& a, - const receivingReferralList& b -) -{ - // Trivial reject: lists are different size - if (a.size() != b.size()) - { - return false; - } - - // Or if source processors are not the same. - if (a.sourceProc() != b.sourceProc()) - { - return false; - } - - List<bool> fnd(a.size(), false); - - forAll (b, bI) - { - labelList curLList = b[bI]; - - bool found = false; - - forAll (a, aI) - { - if (a[aI] == curLList) - { - found = true; - fnd[aI] = true; - break; - } - } - - if (!found) - { - return false; - } - } - - // check if all LLists on a were marked - bool result = true; - - forAll (fnd, aI) - { - result = (result && fnd[aI]); - } - - return result; -} - - -Istream& operator>>(Istream& is, receivingReferralList& rRL) -{ - is >> rRL.sourceProc_ >> static_cast<labelListList&>(rRL); - - is.check - ( - "Istream& operator<<(Istream& f, const receivingReferralList& rRL" - ); - - return is; -} - - -Ostream& operator<< -( - Ostream& os, - const receivingReferralList& rRL -) -{ - os << rRL.sourceProc() << token::SPACE - << static_cast< const labelListList& >(rRL); - - os.check - ( - "Ostream& operator<<(Ostream& f, const receivingReferralList& rRL" - ); - - return os; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/referralLists/receivingReferralList.H b/src/lagrangian/molecule/referralLists/receivingReferralList.H deleted file mode 100755 index e64a0836f802dd8ee4049b8c9970863f6c00d8c3..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/referralLists/receivingReferralList.H +++ /dev/null @@ -1,138 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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::receivingReferralList - -Description - -SourceFiles - receivingReferralListI.H - receivingReferralList.C - receivingReferralListIO.C - -\*---------------------------------------------------------------------------*/ - -#ifndef receivingReferralList_H -#define receivingReferralList_H - -#include "labelList.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class receivingReferralList Declaration -\*---------------------------------------------------------------------------*/ - -class receivingReferralList -: - public labelListList -{ - // Private data - - label sourceProc_; - - -public: - - // Constructors - - //- Construct null - receivingReferralList(); - - //- Construct from components - receivingReferralList - ( - const label sourceProc, - const labelListList& refCellsToSendTo - ); - - //- Construct as copy - receivingReferralList(const receivingReferralList&); - - - // Destructor - - ~receivingReferralList(); - - - // Member Functions - - // Access - - inline label sourceProc() const; - - - // Member Operators - - void operator=(const receivingReferralList&); - - - // Friend Operators - - friend bool operator== - ( - const receivingReferralList& a, - const receivingReferralList& b - ); - - inline friend bool operator!= - ( - const receivingReferralList& a, - const receivingReferralList& b - ); - - - // IOstream Operators - - friend Istream& operator>> - ( - Istream&, - receivingReferralList& - ); - - friend Ostream& operator<< - ( - Ostream&, - const receivingReferralList& - ); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "receivingReferralListI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/referralLists/receivingReferralListI.H b/src/lagrangian/molecule/referralLists/receivingReferralListI.H deleted file mode 100755 index d91e01fe080cec457a3ac1aea27180ecda9adff1..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/referralLists/receivingReferralListI.H +++ /dev/null @@ -1,56 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 - -\*---------------------------------------------------------------------------*/ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -inline label receivingReferralList::sourceProc() const -{ - return sourceProc_; -} - - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - -inline bool operator!= -( - const receivingReferralList& a, - const receivingReferralList& b -) -{ - return (!(a == b)); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/referralLists/sendingReferralList.C b/src/lagrangian/molecule/referralLists/sendingReferralList.C deleted file mode 100755 index 90651021932a9ce6c68f940a9393af78ee33e1fa..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/referralLists/sendingReferralList.C +++ /dev/null @@ -1,178 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "sendingReferralList.H" - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -sendingReferralList::sendingReferralList() -: - labelList(), - destinationProc_(-1) -{} - - -sendingReferralList::sendingReferralList -( - const label destinationProc, - const labelList& cellsToSend -) -: - labelList(cellsToSend), - destinationProc_(destinationProc) -{} - - -sendingReferralList::sendingReferralList -( - const sendingReferralList& rL -) -: - labelList(rL), - destinationProc_(rL.destinationProc()) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -sendingReferralList::~sendingReferralList() -{} - - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - -void sendingReferralList::operator=(const sendingReferralList& rhs) -{ - // Check for assignment to self - if (this == &rhs) - { - FatalErrorIn - ( - "Foam::distribution::operator=(const Foam::distribution&)" - ) - << "Attempted assignment to self" - << abort(FatalError); - } - - labelList::operator=(rhs); - - destinationProc_ = rhs.destinationProc(); -} - - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - -bool operator== -( - const sendingReferralList& a, - const sendingReferralList& b -) -{ - // Trivial reject: lists are different size - if (a.size() != b.size()) - { - return false; - } - - // Or if source processors are not the same. - if (a.destinationProc() != b.destinationProc()) - { - return false; - } - - List<bool> fnd(a.size(), false); - - forAll (b, bI) - { - label curLabel = b[bI]; - - bool found = false; - - forAll (a, aI) - { - if (a[aI] == curLabel) - { - found = true; - fnd[aI] = true; - break; - } - } - - if (!found) - { - return false; - } - } - - // check if all labels on a were marked - bool result = true; - - forAll (fnd, aI) - { - result = (result && fnd[aI]); - } - - return result; -} - - -Istream& operator>> -( - Istream& is, - sendingReferralList& sRL -) -{ - is >> sRL.destinationProc_ >> static_cast<labelList&>(sRL); - - is.check("Istream& operator<<(Istream& f, const sendingReferralList& sRL"); - - return is; -} - - -Ostream& operator<< -( - Ostream& os, - const sendingReferralList& rL -) -{ - os << rL.destinationProc() << token::SPACE - << static_cast< const labelList& >(rL); - - os.check("Ostream& operator<<(Ostream& f, const sendingReferralList& rL"); - - return os; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/referralLists/sendingReferralList.H b/src/lagrangian/molecule/referralLists/sendingReferralList.H deleted file mode 100755 index 0d729e35bed30f11b0b9da2e60dc3a5307669ab7..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/referralLists/sendingReferralList.H +++ /dev/null @@ -1,138 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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::sendingReferralList - -Description - -SourceFiles - sendingReferralListI.H - sendingReferralList.C - sendingReferralListIO.C - -\*---------------------------------------------------------------------------*/ - -#ifndef sendingReferralList_H -#define sendingReferralList_H - -#include "labelList.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class sendingReferralList Declaration -\*---------------------------------------------------------------------------*/ - -class sendingReferralList -: - public labelList -{ - // Private data - - label destinationProc_; - - -public: - - // Constructors - - //- Construct null - sendingReferralList(); - - //- Construct from components - sendingReferralList - ( - const label destinationProc, - const labelList& cellsToSend - ); - - //- Construct as copy - sendingReferralList(const sendingReferralList&); - - - // Destructor - - ~sendingReferralList(); - - - // Member Functions - - // Access - - inline label destinationProc() const; - - - // Member Operators - - void operator=(const sendingReferralList&); - - - // Friend Operators - - friend bool operator== - ( - const sendingReferralList& a, - const sendingReferralList& b - ); - - inline friend bool operator!= - ( - const sendingReferralList& a, - const sendingReferralList& b - ); - - - // IOstream Operators - - friend Istream& operator>> - ( - Istream&, - sendingReferralList& - ); - - friend Ostream& operator<< - ( - Ostream&, - const sendingReferralList& - ); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "sendingReferralListI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/referralLists/sendingReferralListI.H b/src/lagrangian/molecule/referralLists/sendingReferralListI.H deleted file mode 100755 index d571962f5ddf7af3eeb176638db62707e5c44b2d..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/referralLists/sendingReferralListI.H +++ /dev/null @@ -1,56 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 - -\*---------------------------------------------------------------------------*/ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -inline label sendingReferralList::destinationProc() const -{ - return destinationProc_; -} - - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - -inline bool operator!= -( - const sendingReferralList& a, - const sendingReferralList& b -) -{ - return (!(a == b)); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/referredCell/referredCell.C b/src/lagrangian/molecule/referredCell/referredCell.C deleted file mode 100755 index c60ae69bf41ef6b76db13f9dd1001409639818e5..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/referredCell/referredCell.C +++ /dev/null @@ -1,441 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "referredCell.H" -#include "moleculeCloud.H" - -namespace Foam -{ - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -void referredCell::setConstructionData -( - const polyMesh& mesh, - const label sourceCell -) -{ - // * * * * * * * * * * * Points * * * * * * * * * * * - - const labelList& points = mesh.cellPoints()[sourceCell]; - - vectorList sourceCellVertices(points.size()); - - forAll(sourceCellVertices, sCV) - { - sourceCellVertices[sCV] = mesh.points()[points[sCV]]; - } - - vertexPositions_ = referPositions(sourceCellVertices); - - // * * * * * * * * * * * Edges * * * * * * * * * * * - - const labelList& edges = mesh.cellEdges()[sourceCell]; - - edgeList sourceCellEdges(edges.size()); - - forAll(sourceCellEdges, sCE) - { - sourceCellEdges[sCE] = mesh.edges()[edges[sCE]]; - } - - locallyMapEdgeList(points, sourceCellEdges); - - // * * * * * * * * * * * Faces * * * * * * * * * * * - - labelList faces(mesh.cells()[sourceCell]); - - vectorList sourceCellFaceCentres(faces.size()); - - vectorList sourceCellFaceAreas(faces.size()); - - labelListList sourceCellFaces(faces.size()); - - forAll(faces, f) - { - sourceCellFaces[f] = mesh.faces()[faces[f]]; - - sourceCellFaceCentres[f] = mesh.faceCentres()[faces[f]]; - - sourceCellFaceAreas[f] = mesh.faceAreas()[faces[f]]; - } - - locallyMapFaceList(points, sourceCellFaces); - - faceCentres_ = referPositions(sourceCellFaceCentres); - - faceAreas_ = rotateVectors(sourceCellFaceAreas); -} - - -void referredCell::locallyMapEdgeList -( - const labelList& points, - const edgeList& sourceCellEdges -) -{ - edges_.setSize(sourceCellEdges.size()); - - forAll(sourceCellEdges, sCE) - { - const edge& e(sourceCellEdges[sCE]); - - edges_[sCE].start() = findIndex(points, e.start()); - - edges_[sCE].end() = findIndex(points, e.end()); - - if - ( - edges_[sCE].start() == -1 - || edges_[sCE].end() == -1 - ) - { - FatalErrorIn("Foam::referredCell::locallyMapEdgeList") - << "edgeList and points labelList for " - << "referred cell do not match: " - << nl << "points: " << points - << nl << "egdes: " << sourceCellEdges - << abort(FatalError); - } - } -} - - -void referredCell::locallyMapFaceList -( - const labelList& points, - const labelListList& sourceCellFaces -) -{ - faces_.setSize(sourceCellFaces.size()); - - forAll(sourceCellFaces, sCF) - { - const labelList& sourceCellFace(sourceCellFaces[sCF]); - - labelList& localFace(faces_[sCF]); - - localFace.setSize(sourceCellFace.size()); - - forAll(sourceCellFace, p) - { - localFace[p] = findIndex(points, sourceCellFace[p]); - - if (localFace[p] == -1) - { - FatalErrorIn("Foam::referredCell::locallyMapEdgeList") - << "edgeList and points labelList for " - << "referred cell do not match: " - << nl << "points: " << points - << nl << "faces: " << sourceCellFaces - << abort(FatalError); - } - } - } -} - - -vector referredCell::referPosition(const vector& positionToRefer) -{ - return offset_ + (rotation_ & positionToRefer); -} - - -vectorList referredCell::referPositions(const vectorList& positionsToRefer) -{ - return offset_ + (rotation_ & positionsToRefer); -} - - -vector referredCell::rotateVector(const vector& vectorToRotate) -{ - return rotation_ & vectorToRotate; -} - - -vectorList referredCell::rotateVectors(const vectorList& vectorsToRotate) -{ - return rotation_ & vectorsToRotate; -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -referredCell::referredCell() -: - DynamicList<referredMolecule>(), - sourceProc_(-1), - sourceCell_(-1), - vertexPositions_(), - offset_(vector::zero), - rotation_(I) -{} - - -referredCell::referredCell -( - const polyMesh& mesh, - const label sourceProc, - const label sourceCell, - const vector& offset, - const tensor& rotation -) -: - DynamicList<referredMolecule>(), - sourceProc_(sourceProc), - sourceCell_(sourceCell), - offset_(offset), - rotation_(rotation) -{ - setConstructionData(mesh, sourceCell); -} - - -referredCell::referredCell -( - const label sourceProc, - const label sourceCell, - const vectorList& vertexPositions, - const edgeList& localEdges, - const labelListList& localFaces, - const vectorList& faceCentres, - const vectorList& faceAreas, - const vector& offset, - const tensor& rotation -) -: - DynamicList<referredMolecule>(), - sourceProc_(sourceProc), - sourceCell_(sourceCell), - edges_(localEdges), - faces_(localFaces), - offset_(offset), - rotation_(rotation) -{ - // Supplied vertexPositions, faceCentres and faceAreas are of the - // "original" cell, and need to be transformed to the referred - // locations on construction - - vertexPositions_ = referPositions(vertexPositions); - - faceCentres_ = referPositions(faceCentres); - - faceAreas_ = rotateVectors(faceAreas); -} - - -referredCell::referredCell -( - const polyMesh& mesh, - const label sourceProc, - const label sourceCell, - const vector& cS, - const vector& cD, - const vector& nS, - const vector& nD -) -: - DynamicList<referredMolecule>(), - sourceProc_(sourceProc), - sourceCell_(sourceCell) -{ - // It is assumed that the vectors originating from the faces being referred - // here are correct periodic faces - i.e. they have the same area etc. - - vector nA = -nS/mag(nS); - vector nB = nD/mag(nD); - - rotation_ = rotationTensor(nA, nB); - - offset_ = cD - (rotation_ & cS); - - // Allow sourceCell = -1 to create a dummy referredCell - // to obtain the transformation - - if(sourceCell >= 0) - { - setConstructionData(mesh, sourceCell); - } -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -referredCell::~referredCell() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -referredCell referredCell::reRefer -( - const vector& cS, - const vector& cD, - const vector& nS, - const vector& nD -) -{ - vector nA = -nS/mag(nS); - vector nB = nD/mag(nD); - - tensor newRotation = rotationTensor(nA, nB); - - vector newOffset = cD - (newRotation & cS); - - tensor reReferredRotation = newRotation & rotation_; - - vector reReferredOffset = newOffset + (newRotation & offset_); - - return referredCell - ( - sourceProc_, - sourceCell_, - rotation_.T() & (vertexPositions_ - offset_), - edges_, - faces_, - rotation_.T() & (faceCentres_ - offset_), - rotation_.T() & (faceAreas_), - reReferredOffset, - reReferredRotation - ); -} - - -vector referredCell::referPosition(const vector& positionToRefer) const -{ - return offset_ + (rotation_ & positionToRefer); -} - - -vectorList referredCell::referPositions -( - const vectorList& positionsToRefer -) const -{ - return offset_ + (rotation_ & positionsToRefer); -} - - -vector referredCell::rotateVector(const vector& vectorToRotate) const -{ - return rotation_ & vectorToRotate; -} - - -vectorList referredCell::rotateVectors(const vectorList& vectorsToRotate) const -{ - return rotation_ & vectorsToRotate; -} - - -void referredCell::referInMols(const List<referredMolecule>& incomingMols) -{ - clear(); - - forAll(incomingMols, iM) - { - append - ( - referredMolecule - ( - incomingMols[iM].id(), - referPosition - ( - incomingMols[iM].position() - ) - ) - ); - } -} - - -bool referredCell::duplicate(const referredCell& refCellDupl) const -{ - return - ( - sourceProc_ == refCellDupl.sourceProc() - && sourceCell_ == refCellDupl.sourceCell() - && mag(offset_ - refCellDupl.offset()) < moleculeCloud::transTol - ); -} - - -bool referredCell::duplicate(const label procNo,const label nCells) const -{ - return - ( - sourceProc_ == procNo - && sourceCell_ < nCells - && mag(offset_) < moleculeCloud::transTol - ); -} - - -// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // - -Istream& operator>>(Istream& is, referredCell& rC) -{ - - is >> rC.sourceProc_ - >> rC.sourceCell_ - >> rC.vertexPositions_ - >> rC.edges_ - >> rC.faces_ - >> rC.faceCentres_ - >> rC.faceAreas_ - >> rC.offset_ - >> rC.rotation_; - - is.check("Istream& operator<<(Istream& f, const referredCell& rC"); - - return is; -} - - -Ostream& operator<<(Ostream& os, const referredCell& rC) -{ - - os << rC.sourceProc() - << token::SPACE << rC.sourceCell() - << token::SPACE << rC.vertexPositions() - << token::SPACE << rC.edges() - << token::SPACE << rC.faces() - << token::SPACE << rC.faceCentres() - << token::SPACE << rC.faceAreas() - << token::SPACE << rC.offset() - << token::SPACE << rC.rotation(); - - os.check("Ostream& operator<<(Ostream& f, const referredCell& rC"); - - return os; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/referredCell/referredCell.H b/src/lagrangian/molecule/referredCell/referredCell.H deleted file mode 100755 index 27aaf730fc6b978757f53aebebad403be161b0c9..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/referredCell/referredCell.H +++ /dev/null @@ -1,277 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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::referredCell - -Description - -SourceFiles - referredCellI.H - referredCell.C - -\*---------------------------------------------------------------------------*/ - -#ifndef referredCell_H -#define referredCell_H - -#include "vector.H" -#include "vectorList.H" -#include "tensor.H" -#include "transform.H" -#include "DynamicList.H" -#include "labelList.H" -#include "edgeList.H" -#include "polyMesh.H" - -#include "referredMolecule.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class referredCell Declaration -\*---------------------------------------------------------------------------*/ - -class referredCell -: - public DynamicList<referredMolecule> -{ - // Private data - - label sourceProc_; - - label sourceCell_; - - //- Referred vertex positions - vectorList vertexPositions_; - - edgeList edges_; - - labelListList faces_; - - vectorList faceCentres_; - - vectorList faceAreas_; - - labelList realCellsForInteraction_; - - vector offset_; - - tensor rotation_; - - - // Private Member Functions - - void setConstructionData - ( - const polyMesh& mesh, - const label sourceCell - ); - - void locallyMapEdgeList - ( - const labelList& points, - const edgeList& sourceCellEdges - ); - - void locallyMapFaceList - ( - const labelList& points, - const labelListList& sourceCellFaces - ); - - vector referPosition(const vector& positionToRefer); - - vectorList referPositions(const vectorList& positionsToRefer); - - vector rotateVector(const vector& vectorToRotate); - - vectorList rotateVectors(const vectorList& vectorsToRotate); - - -public: - - // Constructors - - //- Construct null - - referredCell(); - - //- Construct from components with external edge information - referredCell - ( - const polyMesh& mesh, - const label sourceProc, - const label sourceCell, - const vector& offset, - const tensor& rotation - ); - - //- Construct from components with existing local edge information - referredCell - ( - const label sourceProc, - const label sourceCell, - const vectorList& vertexPositions, - const edgeList& localEdges, - const labelListList& localFaces, - const vectorList& faceCentres, - const vectorList& faceAreas, - const vector& offset, - const tensor& rotation - ); - - //- Construct from pair of face centers (c) and plain - // face normals (n) (no need to make unit vectors or - // reverse one direction) - // Order of vectors important (S = source, D = Destination). - // External edge information. - - referredCell - ( - const polyMesh& mesh, - const label sourceProc, - const label sourceCell, - const vector& cS, - const vector& cD, - const vector& nS, - const vector& nD - ); - - - // Destructor - - virtual ~referredCell(); - - - // Member Functions - - //- Take this referredCell object that has already had it's transform - // calculated and refer it on again, retaining same source info. - referredCell reRefer - ( - const vector& cS, - const vector& cD, - const vector& nS, - const vector& nD - ); - - //- Use internal transformatation values to transform the given - // postion to its new location. - vector referPosition(const vector& positionToRefer) const; - - //- Use internal transformatation values to transform the given - // list of postions to their new locations. - vectorList referPositions(const vectorList& positionsToRefer) const; - - //- Use internal transformatation values to rotate the given vector - vector rotateVector(const vector& vectorToRotate) const; - - //- Use internal transformatation values to rotate the given - // list of vectors - vectorList rotateVectors(const vectorList& vectorsToRotate) const; - - //- referInMols clears, the stored list of referred mols and takes - // in a list of referred mols coming from a source processor, - // transformingtheir positions - void referInMols(const List<referredMolecule>& incomingMols); - - //- duplicate() function to test whether a referred or real cell - // supplied by arguement is a duplicate of this referredCell. - // Can be used bi-directionally - i.e. can be called on an existing - // referred cell with a proposed referredCell as argument, - // or vice versa. Can only be called by a proposed referredCell with - // a real cell index as arguement to test to see if the proposed - // referredCell is a duplicate. - // A duplicate cell is defined as one which has the same source - // processor, source cell, and an equal offset. Real cells have zero - // offset by definition. - bool duplicate(const referredCell& refCellDupl) const; - - bool duplicate(const label procNo, const label nCells) const; - - - // Access - - inline label sourceProc() const; - - inline label sourceCell() const; - - inline const vector& offset() const; - - inline const tensor& rotation() const; - - inline const vectorList& vertexPositions() const; - - inline const edgeList& edges() const; - - inline const labelListList& faces() const; - - inline const vectorList& faceCentres() const; - - inline const vectorList& faceAreas() const; - - inline labelList& realCells(); - - inline const labelList& realCellsForInteraction() const; - - - // Friend Operators - - inline friend bool operator== - ( - const referredCell& a, - const referredCell& b - ); - - inline friend bool operator!= - ( - const referredCell& a, - const referredCell& b - ); - - - // IOstream Operators - - friend Istream& operator>>(Istream&, referredCell&); - friend Ostream& operator<<(Ostream&, const referredCell&); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "referredCellI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/referredCell/referredCellI.H b/src/lagrangian/molecule/referredCell/referredCellI.H deleted file mode 100755 index 4135f7ff6e952da5f993bbef8590b456911ba663..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/referredCell/referredCellI.H +++ /dev/null @@ -1,127 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 - -\*---------------------------------------------------------------------------*/ - -namespace Foam -{ - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -inline label referredCell::sourceProc() const -{ - return sourceProc_; -} - - -inline label referredCell::sourceCell() const -{ - return sourceCell_; -} - - -inline const vector& referredCell::offset() const -{ - return offset_; -} - - -inline const tensor& referredCell::rotation() const -{ - return rotation_; -} - - -inline const vectorList& referredCell::vertexPositions() const -{ - return vertexPositions_; -} - - -inline const edgeList& referredCell::edges() const -{ - return edges_; -} - - -inline const labelListList& referredCell::faces() const -{ - return faces_; -} - - -inline const vectorList& referredCell::faceCentres() const -{ - return faceCentres_; -} - - -inline const vectorList& referredCell::faceAreas() const -{ - return faceAreas_; -} - - -inline labelList& referredCell::realCells() -{ - return realCellsForInteraction_; -} - - -inline const labelList& referredCell::realCellsForInteraction() const -{ - return realCellsForInteraction_; -} - - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - -inline bool operator== -( - const referredCell& a, - const referredCell& b -) -{ - return const_cast<referredCell&>(a).duplicate - ( - const_cast<const referredCell&>(b) - ); -} - - -inline bool operator!= -( - const referredCell& a, - const referredCell& b -) -{ - return !(a == b); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/referredCellList/referredCellList.C b/src/lagrangian/molecule/referredCellList/referredCellList.C deleted file mode 100755 index cd69a1d9d4ddeb968e3c53137ae198ad5daa33f4..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/referredCellList/referredCellList.C +++ /dev/null @@ -1,327 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "referredCellList.H" -#include "moleculeCloud.H" - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -referredCellList::referredCellList(moleculeCloud& molCloud) -: - List<referredCell >(), - molCloud_(molCloud) -{} - - -referredCellList::referredCellList -( - moleculeCloud& molCloud, - const List<referredCell>& referredCells, - const List<label>& realCells -) -: - List< referredCell >(referredCells), - molCloud_(molCloud) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -referredCellList::~referredCellList() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void referredCellList::setRealCellsInRange() -{ - Info<< nl << "Finding real cells in range of referred cells" << endl; - - forAll(*this, rC) - { - const polyMesh& mesh(molCloud_.mesh()); - - referredCell& refCell = (*this)[rC]; - - DynamicList<label> realCellsFoundInRange; - - const vectorList& refCellPoints = refCell.vertexPositions(); - - forAll(molCloud_.realFacesWithinRCutMaxOfAnyReferringPatch(), rCF) - { - const label f - ( - molCloud_.realFacesWithinRCutMaxOfAnyReferringPatch()[rCF] - ); - - if (molCloud_.testPointFaceDistance(refCellPoints,f)) - { - const label cellO(mesh.faceOwner()[f]); - - if (findIndex(realCellsFoundInRange, cellO) == -1) - { - realCellsFoundInRange.append(cellO); - } - - if (mesh.isInternalFace(f)) - { - // boundary faces will not have neighbour information - - const label cellN(mesh.faceNeighbour()[f]); - - if (findIndex(realCellsFoundInRange, cellN) == -1) - { - realCellsFoundInRange.append(cellN); - } - } - } - } - - forAll(molCloud_.realPointsWithinRCutMaxOfAnyReferringPatch(), rCP) - { - const label p - ( - molCloud_.realPointsWithinRCutMaxOfAnyReferringPatch()[rCP] - ); - - if (molCloud_.testPointFaceDistance(p,refCell)) - { - const labelList& pCells(mesh.pointCells()[p]); - - forAll(pCells, pC) - { - const label cellI(pCells[pC]); - - if (findIndex(realCellsFoundInRange, cellI) == -1) - { - realCellsFoundInRange.append(cellI); - } - } - } - } - - - const edgeList& refCellEdges = refCell.edges(); - - forAll(molCloud_.realEdgesWithinRCutMaxOfAnyReferringPatch(), rCE) - { - const label edgeIIndex - ( - molCloud_.realEdgesWithinRCutMaxOfAnyReferringPatch()[rCE] - ); - - const edge& eI(mesh.edges()[edgeIIndex]); - - forAll(refCellEdges, rCE) - { - const edge& eJ(refCellEdges[rCE]); - - if - ( - molCloud_.testEdgeEdgeDistance - ( - eI, - refCellPoints[eJ.start()], - refCellPoints[eJ.end()] - ) - ) - { - const labelList& eICells(mesh.edgeCells()[edgeIIndex]); - - forAll(eICells, eIC) - { - const label cellI(eICells[eIC]); - - if (findIndex(realCellsFoundInRange, cellI) == -1) - { - realCellsFoundInRange.append(cellI); - } - } - } - } - } - -// scalar rCutMaxSqr = molCloud_.rCutMax()*molCloud_.rCutMax(); -// -// forAll (molCloud_.mesh().points(), pointIIndex) -// { -// const point& ptI -// ( -// molCloud_.mesh().points()[pointIIndex] -// ); -// -// forAll(refCellPoints, rCP) -// { -// if (magSqr(ptI - refCellPoints[rCP]) <= rCutMaxSqr) -// { -// const labelList& ptICells -// ( -// molCloud_.mesh().pointCells()[pointIIndex] -// ); -// -// forAll(ptICells, pIC) -// { -// const label cellI(ptICells[pIC]); -// -// if(findIndex(realCellsFoundInRange, cellI) == -1) -// { -// realCellsFoundInRange.append(cellI); -// } -// } -// } -// } -// } - - refCell.realCells() = realCellsFoundInRange.shrink(); - } -} - - -void referredCellList::referMolecules() -{ - // Create referred molecules for sending using cell occupancy and - // cellSendingReferralLists - - const List<DynamicList<molecule*> >& cellOccupancy - ( - molCloud_.cellOccupancy() - ); - - forAll(molCloud_.cellSendingReferralLists(), cSRL) - { - const sendingReferralList& sRL - ( - molCloud_.cellSendingReferralLists()[cSRL] - ); - - List<DynamicList<referredMolecule> > molsToReferOut(sRL.size()); - - forAll(sRL, sRLI) - { - List<molecule*> realMols = cellOccupancy[sRL[sRLI]]; - - forAll (realMols, rM) - { - molecule* mol = realMols[rM]; - - molsToReferOut[sRLI].append - ( - referredMolecule - ( - mol->id(), - mol->position() - ) - ); - } - - molsToReferOut[sRLI].shrink(); - } - - // Send lists of referred molecules to other processors - - if (sRL.destinationProc() != Pstream::myProcNo()) - { - if (Pstream::parRun()) - { - OPstream toInteractingProc - ( - Pstream::blocking, - sRL.destinationProc() - ); - - toInteractingProc << molsToReferOut; - } - } - else - { - // Refer molecules directly for referred cells on the same - // processor. - - const receivingReferralList& rRL - ( - molCloud_.cellReceivingReferralLists()[cSRL] - ); - - forAll(rRL, rRLI) - { - forAll(rRL[rRLI], rC) - { - referredCell& refCellToRefMolsTo = (*this)[rRL[rRLI][rC]]; - - refCellToRefMolsTo.referInMols(molsToReferOut[rRLI]); - } - } - } - } - - // Receive referred molecule lists to and distribute to referredCells - // according tocellReceivingReferralLists, referredCells deal with the - // transformations themselves - - forAll(molCloud_.cellReceivingReferralLists(), cRRL) - { - const receivingReferralList& rRL - ( - molCloud_.cellReceivingReferralLists()[cRRL] - ); - - List<List<referredMolecule> > molsToReferIn(rRL.size()); - - if (rRL.sourceProc() != Pstream::myProcNo()) - { - if (Pstream::parRun()) - { - IPstream fromInteractingProc - ( - Pstream::blocking, - rRL.sourceProc() - ); - - fromInteractingProc >> molsToReferIn; - } - - forAll(rRL, rRLI) - { - forAll(rRL[rRLI], rC) - { - referredCell& refCellToRefMolsTo = (*this)[rRL[rRLI][rC]]; - - refCellToRefMolsTo.referInMols(molsToReferIn[rRLI]); - } - } - } - } -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/referredCellList/referredCellList.H b/src/lagrangian/molecule/referredCellList/referredCellList.H deleted file mode 100755 index c025de52eb158617b3281f7ad5d1f8a7a742f038..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/referredCellList/referredCellList.H +++ /dev/null @@ -1,103 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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::referredCellList - -Description - -SourceFiles - referredCellListI.H - referredCellList.C - -\*---------------------------------------------------------------------------*/ - -#ifndef referredCellList_H -#define referredCellList_H - -#include "referredCell.H" -#include "molecule.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class referredCellList Declaration -\*---------------------------------------------------------------------------*/ - -class referredCellList -: - public List< referredCell > -{ - // Private data - - moleculeCloud& molCloud_; - - -public: - - // Constructors - - //- Construct from moleculeCloud - referredCellList(moleculeCloud& molCloud); - - //- Construct from components - referredCellList - ( - moleculeCloud& molCloud, - const List<referredCell>& referredCells, - const List<label>& realCells - ); - - - // Destructor - - ~referredCellList(); - - - // Member Functions - - void setRealCellsInRange(); - - void referMolecules(); - - inline const moleculeCloud& molCloud(); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "referredCellListI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/referredCellList/referredCellListI.H b/src/lagrangian/molecule/referredCellList/referredCellListI.H deleted file mode 100755 index 34767d88b6f24406a876f8af37a5b7abfa20ddce..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/referredCellList/referredCellListI.H +++ /dev/null @@ -1,42 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 - -\*---------------------------------------------------------------------------*/ - -namespace Foam -{ - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - -inline const Foam::moleculeCloud& Foam::referredCellList::molCloud() -{ - return molCloud_; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/referredMolecule/referredMolecule.C b/src/lagrangian/molecule/referredMolecule/referredMolecule.C deleted file mode 100755 index 2453ca2f58f5a388ef875a7fa54550c36dc7630d..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/referredMolecule/referredMolecule.C +++ /dev/null @@ -1,89 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 "referredMolecule.H" - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -referredMolecule::referredMolecule() -{} - - -referredMolecule::referredMolecule -( - const label id, - const vector& position -) -: - id_(id), - position_(position) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -referredMolecule::~referredMolecule() -{} - - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - -Istream& operator>> -( - Istream& is, - referredMolecule& rM -) -{ - is >> rM.id_ >> rM.position_; - - is.check("Istream& operator<<(Istream& f, const referredMolecule& sRL"); - - return is; -} - - -Ostream& operator<< -( - Ostream& os, - const referredMolecule& rM -) -{ - os << rM.id() << token::SPACE << rM.position(); - - os.check("Ostream& operator<<(Ostream& f, const referredMolecule& rM"); - - return os; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/referredMolecule/referredMolecule.H b/src/lagrangian/molecule/referredMolecule/referredMolecule.H deleted file mode 100755 index fcac7925a9100e773f97cf773868c832ec393994..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/referredMolecule/referredMolecule.H +++ /dev/null @@ -1,129 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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::referredMolecule - -Description - -SourceFiles - referredMoleculeI.H - referredMolecule.C - -\*---------------------------------------------------------------------------*/ - -#ifndef referredMolecule_H -#define referredMolecule_H - -#include "vector.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -/*---------------------------------------------------------------------------*\ - Class referredMolecule Declaration -\*---------------------------------------------------------------------------*/ - -class referredMolecule -{ - // Private data - - label id_; - - vector position_; - - -public: - - // Constructors - - //- Construct null - referredMolecule(); - - //- Construct from components - referredMolecule - ( - const label id, - const vector& position - ); - - - // Destructor - - virtual ~referredMolecule(); - - - // Member Functions - - // Access - - inline label id() const; - - inline const vector& position() const; - - - // Friend Operators - - inline friend bool operator== - ( - const referredMolecule& a, - const referredMolecule& b - ); - - inline friend bool operator!= - ( - const referredMolecule& a, - const referredMolecule& b - ); - - // IOstream Operators - - friend Istream& operator>> - ( - Istream&, - referredMolecule& - ); - - friend Ostream& operator<< - ( - Ostream&, - const referredMolecule& - ); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "referredMoleculeI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/molecule/referredMolecule/referredMoleculeI.H b/src/lagrangian/molecule/referredMolecule/referredMoleculeI.H deleted file mode 100755 index b51b56035dc9b85a0352cb70c72cf45de734901d..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecule/referredMolecule/referredMoleculeI.H +++ /dev/null @@ -1,75 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2005 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 - -\*---------------------------------------------------------------------------*/ - -namespace Foam -{ - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -inline label referredMolecule::id() const -{ - return id_; -} - - -inline const vector& referredMolecule::position() const -{ - return position_; -} - - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - -inline bool operator== -( - const referredMolecule& a, - const referredMolecule& b -) -{ - return - ( - a.id() == b.id() - && a.position() == b.position() - ); -} - - -inline bool operator!= -( - const referredMolecule& a, - const referredMolecule& b -) -{ - return !(a == b); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - - -// ************************************************************************* // diff --git a/tutorials/mdEquilibrationFoam/periodicCube/Allrun b/tutorials/mdEquilibrationFoam/periodicCube/Allrun deleted file mode 100755 index 1960716ea2235f8507db8493beeeb85c24684aa6..0000000000000000000000000000000000000000 --- a/tutorials/mdEquilibrationFoam/periodicCube/Allrun +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# Source tutorial run functions -. $WM_PROJECT_DIR/bin/tools/RunFunctions - -# Get application name from directory -application="mdEquilibrationFoam" - -runApplication blockMesh -runApplication molConfig -runApplication $application diff --git a/tutorials/mdEquilibrationFoam/periodicCube/constant/polyMesh/blockMeshDict b/tutorials/mdEquilibrationFoam/periodicCube/constant/polyMesh/blockMeshDict deleted file mode 100644 index 23a2ee9874ef09ad03276bbe470cc179802a227c..0000000000000000000000000000000000000000 --- a/tutorials/mdEquilibrationFoam/periodicCube/constant/polyMesh/blockMeshDict +++ /dev/null @@ -1,73 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.3 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -FoamFile -{ - version 2.0; - format ascii; - - root ""; - case ""; - instance ""; - local ""; - - class dictionary; - object blockMeshDict; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -convertToMeters 2.462491658e-9; - -vertices -( - (-1 -1 -1) - (1 -1 -1) - (1 1 -1) - (-1 1 -1) - (-1 -1 1) - (1 -1 1) - (1 1 1) - (-1 1 1) -); - -blocks -( - hex (0 1 2 3 4 5 6 7) liquid (12 12 12) simpleGrading (1 1 1) -); - -patches -( - cyclic - periodicX - ( - (1 2 6 5) - (0 4 7 3) - ) - - cyclic - periodicY - ( - (2 3 7 6) - (0 1 5 4) - ) - - cyclic - periodicZ - ( - (0 3 2 1) - (4 5 6 7) - ) -) - -mergePatchPairs -( -); - - -// ************************************************************************* // diff --git a/tutorials/mdEquilibrationFoam/periodicCube/system/controlDict b/tutorials/mdEquilibrationFoam/periodicCube/system/controlDict deleted file mode 100644 index c3205b3ad1467e74f631cddba96f1537124cf22b..0000000000000000000000000000000000000000 --- a/tutorials/mdEquilibrationFoam/periodicCube/system/controlDict +++ /dev/null @@ -1,55 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.4 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -FoamFile -{ - version 2.0; - format ascii; - - root ""; - case ""; - instance ""; - local ""; - - class dictionary; - object controlDict; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -startFrom startTime; - -startTime 0; - -stopAt endTime; - -endTime 4e-10; - -deltaT 1e-14; - -writeControl runTime; - -writeInterval 5e-11; - -purgeWrite 0; - -writeFormat ascii; - -writePrecision 12; - -writeCompression uncompressed; - -timeFormat general; - -timePrecision 6; - -runTimeModifiable yes; - -adjustTimeStep no; - -// ************************************************************************* // diff --git a/tutorials/mdEquilibrationFoam/periodicCube/system/decomposeParDict b/tutorials/mdEquilibrationFoam/periodicCube/system/decomposeParDict deleted file mode 100644 index 1678f7f1b22a8fa0690862420bcb8668cb274c98..0000000000000000000000000000000000000000 --- a/tutorials/mdEquilibrationFoam/periodicCube/system/decomposeParDict +++ /dev/null @@ -1,70 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.3 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -FoamFile -{ - version 2.0; - format ascii; - - root ""; - case ""; - instance ""; - local ""; - - class dictionary; - object decomposeParDict; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - -numberOfSubdomains 2; - -method simple; - -simpleCoeffs -{ - n (2 1 1); - delta 0.001; -} - -hierarchicalCoeffs -{ - n (1 1 1); - delta 0.001; - order xyz; -} - -metisCoeffs -{ - processorWeights - ( - 1 - 1 - 1 - 4 - 1 - 5 - 1 - 2 - ); -} - -manualCoeffs -{ - dataFile ""; -} - -distributed no; - -roots -( -); - - -// ************************************************************************* // diff --git a/tutorials/mdEquilibrationFoam/periodicCube/system/fvSchemes b/tutorials/mdEquilibrationFoam/periodicCube/system/fvSchemes deleted file mode 100644 index 8504e0fd45187a8698a014b6428e758d6b408424..0000000000000000000000000000000000000000 --- a/tutorials/mdEquilibrationFoam/periodicCube/system/fvSchemes +++ /dev/null @@ -1,67 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.3 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -FoamFile -{ - version 2.0; - format ascii; - - root ""; - case ""; - instance ""; - local ""; - - class dictionary; - object fvSchemes; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -ddtSchemes -{ - default Euler; -} - -gradSchemes -{ - default Gauss linear; - grad(p) Gauss linear; -} - -divSchemes -{ - default none; - div(phi,U) Gauss linear; -} - -laplacianSchemes -{ - default none; - laplacian(nu,U) Gauss linear corrected; - laplacian(1|A(U),p) Gauss linear corrected; -} - -interpolationSchemes -{ - default linear; - interpolate(HbyA) linear; -} - -snGradSchemes -{ - default corrected; -} - -fluxRequired -{ - default no; - p; -} - - -// ************************************************************************* // diff --git a/tutorials/mdEquilibrationFoam/periodicCube/system/fvSolution b/tutorials/mdEquilibrationFoam/periodicCube/system/fvSolution deleted file mode 100644 index c85c7b791bf5766697f1b4c93699a69792329295..0000000000000000000000000000000000000000 --- a/tutorials/mdEquilibrationFoam/periodicCube/system/fvSolution +++ /dev/null @@ -1,40 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.3 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -FoamFile -{ - version 2.0; - format ascii; - - root ""; - case ""; - instance ""; - local ""; - - class dictionary; - object fvSolution; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -solvers -{ - p ICCG 1e-06 0; - U BICCG 1e-05 0; -} - -PISO -{ - nCorrectors 2; - nNonOrthogonalCorrectors 0; - pRefCell 0; - pRefValue 0; -} - - -// ************************************************************************* // diff --git a/tutorials/mdEquilibrationFoam/periodicCube/system/mdEquilibrationDict b/tutorials/mdEquilibrationFoam/periodicCube/system/mdEquilibrationDict deleted file mode 100644 index e2323961f5d07742db511acae8b961f49c4fa0ae..0000000000000000000000000000000000000000 --- a/tutorials/mdEquilibrationFoam/periodicCube/system/mdEquilibrationDict +++ /dev/null @@ -1,27 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.4.1 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -FoamFile -{ - version 2.0; - format ascii; - - root ""; - case ""; - instance ""; - local ""; - - class dictionary; - object mdEquilibrationDict; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -equilibrationTargetTemperature 300.0; - -// ************************************************************************* // \ No newline at end of file diff --git a/tutorials/mdEquilibrationFoam/periodicCube/system/mdSolution b/tutorials/mdEquilibrationFoam/periodicCube/system/mdSolution deleted file mode 100644 index 681963175de629fcb9ebab3a3a3ebd0b5893e716..0000000000000000000000000000000000000000 --- a/tutorials/mdEquilibrationFoam/periodicCube/system/mdSolution +++ /dev/null @@ -1,31 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.3 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -FoamFile -{ - version 2.0; - format ascii; - - root ""; - case ""; - instance ""; - local ""; - - class dictionary; - object mdSolution; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -integrationMethod verletLeapfrog; - -potentialEnergyLimit 5.256e-20; - -guardRadius 0; - -// ************************************************************************* // \ No newline at end of file diff --git a/tutorials/mdEquilibrationFoam/periodicCube/system/molConfigDict b/tutorials/mdEquilibrationFoam/periodicCube/system/molConfigDict deleted file mode 100644 index b01cd00edbb678fe9d1979de1442d6c23d1f0e6b..0000000000000000000000000000000000000000 --- a/tutorials/mdEquilibrationFoam/periodicCube/system/molConfigDict +++ /dev/null @@ -1,43 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.3 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -FoamFile -{ - version 2.0; - format ascii; - - root ""; - case ""; - instance ""; - local ""; - - class dictionary; - object molConfigDict; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// Euler angles, expressed in degrees as phi, theta, psi, -// see http://mathworld.wolfram.com/EulerAngles.html - -liquid -{ - massDensity 1220.0; - temperature 300.0; - velocityDistribution maxwellian; - bulkVelocity (0.0 0.0 0.0); - id Ar; - mass 6.63352033e-26; - latticeStructure SC; - anchor (0.0 0.0 0.0); - anchorSpecifies molecule; - tethered no; - orientationAngles (0 0 0); -} - -// ************************************************************************* // diff --git a/tutorials/mdEquilibrationFoam/periodicCube/system/potentialDict b/tutorials/mdEquilibrationFoam/periodicCube/system/potentialDict deleted file mode 100644 index 78fa1c77465f435999e8df2b11c6388c64fa3b6b..0000000000000000000000000000000000000000 --- a/tutorials/mdEquilibrationFoam/periodicCube/system/potentialDict +++ /dev/null @@ -1,89 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.3 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -FoamFile -{ - version 2.0; - format ascii; - - root ""; - case ""; - instance ""; - local ""; - - class dictionary; - object potentials; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// Subdictionaries specifying types of intermoleular potential. -// Sub-sub dictionaries specify the potentials themselves. - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Removal order - -// This is the order in which to remove overlapping pairs if more than one -// type of molecule is present. The most valuable molecule type is at the -// right hand end, the molecule that will be removed 1st is 1st on the list. -// Not all types need to be present, a molecule that is not present is -// automatically less valuable than any on the list. For molecules of the -// same type there is no control over which is removed. - -removalOrder 1 (Ar); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Pair potentials - -// If there are r different type of molecules, and a pair force is required -// between all combinations, then there are C = r(r+1)/2 combinations, -// i.e. for r = {1,2,3,4}, C = {1,3,6,10} (sum of triangular numbers). - -// Pair potentials are specified by the combinaition of their ids, -// for MOLA and MOLB, "MOLA-MOLB" OR "MOLB-MOLA" is acceptable -// (strictly OR, both or neither will thrown an error) - -pair -{ - Ar-Ar - { - potentialType maitlandSmithTabulated; - m 13.0; - gamma 7.5; - rm 0.3756e-9; - epsilon 1.990108438e-21; - rCut 1.0e-9; - rMin 0.15e-9; - dr 2e-14; - } -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Tethering Potentials - -tether -{ - Ar - { - potentialType harmonicSpring; - springConstant 0.0277; - } -} - -// ************************************************************************* // - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// External Forces - -// Bulk external forces (namely gravity) will be specified as forces rather -// than potentials to allow their direction to be controlled. - -external -{ - gravity (0 0 0); -}