diff --git a/applications/solvers/molecularDynamics/gnemdFoam/Make/options b/applications/solvers/molecularDynamics/gnemdFoam/Make/options index 80f9773456..89431d0625 100755 --- a/applications/solvers/molecularDynamics/gnemdFoam/Make/options +++ b/applications/solvers/molecularDynamics/gnemdFoam/Make/options @@ -1,5 +1,6 @@ EXE_INC = \ - -I$(LIB_SRC)/lagrangian/molecule/lnInclude \ + -I$(LIB_SRC)/lagrangian/molecularDynamics/molecule/lnInclude \ + -I$(LIB_SRC)/lagrangian/molecularDynamics/potential/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude @@ -8,4 +9,5 @@ EXE_LIBS = \ -lmeshTools \ -lfiniteVolume \ -llagrangian \ - -lmolecule + -lmolecule \ + -lpotential diff --git a/applications/solvers/molecularDynamics/mdEquilibrationFoam/Make/options b/applications/solvers/molecularDynamics/mdEquilibrationFoam/Make/options index 80f9773456..89431d0625 100755 --- a/applications/solvers/molecularDynamics/mdEquilibrationFoam/Make/options +++ b/applications/solvers/molecularDynamics/mdEquilibrationFoam/Make/options @@ -1,5 +1,6 @@ EXE_INC = \ - -I$(LIB_SRC)/lagrangian/molecule/lnInclude \ + -I$(LIB_SRC)/lagrangian/molecularDynamics/molecule/lnInclude \ + -I$(LIB_SRC)/lagrangian/molecularDynamics/potential/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude @@ -8,4 +9,5 @@ EXE_LIBS = \ -lmeshTools \ -lfiniteVolume \ -llagrangian \ - -lmolecule + -lmolecule \ + -lpotential diff --git a/applications/utilities/preProcessing/molConfig/Make/options b/applications/utilities/preProcessing/molConfig/Make/options index 196a4d66dd..aab9a2ca4f 100755 --- a/applications/utilities/preProcessing/molConfig/Make/options +++ b/applications/utilities/preProcessing/molConfig/Make/options @@ -3,7 +3,8 @@ EXE_INC = \ -I$(velocityDistributions) \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ - -I$(LIB_SRC)/lagrangian/molecule/lnInclude \ + -I$(LIB_SRC)/lagrangian/molecularDynamics/molecule/lnInclude \ + -I$(LIB_SRC)/lagrangian/molecularDynamics/potential/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude @@ -12,4 +13,5 @@ EXE_LIBS = \ -ldynamicMesh \ -lfiniteVolume \ -llagrangian \ - -lmolecule + -lmolecule \ + -lpotential diff --git a/src/lagrangian/Allwmake b/src/lagrangian/Allwmake index 567f7a10de..088a4a3b5d 100755 --- a/src/lagrangian/Allwmake +++ b/src/lagrangian/Allwmake @@ -5,4 +5,7 @@ wmake libso basic wmake libso solidParticle wmake libso intermediate wmake libso dieselSpray -wmake libso molecule +wmake libso molecularDynamics/potential +wmake libso molecularDynamics/molecule + + diff --git a/src/lagrangian/molecule/Make/files b/src/lagrangian/molecularDynamics/molecule/Make/files similarity index 84% rename from src/lagrangian/molecule/Make/files rename to src/lagrangian/molecularDynamics/molecule/Make/files index d8063d0974..a490edafe1 100755 --- a/src/lagrangian/molecule/Make/files +++ b/src/lagrangian/molecularDynamics/molecule/Make/files @@ -12,9 +12,7 @@ referredCellList = referredCellList referredCell = referredCell referralLists = referralLists -potentials = potentials -pairPotential = $(potentials)/pairPotential -tetherPotential = $(potentials)/tetherPotential +tetherPotential = tetherPotential $(distribution)/distribution.C @@ -42,11 +40,6 @@ $(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 diff --git a/src/lagrangian/molecule/Make/options b/src/lagrangian/molecularDynamics/molecule/Make/options similarity index 57% rename from src/lagrangian/molecule/Make/options rename to src/lagrangian/molecularDynamics/molecule/Make/options index a0fb316eec..cc91fd4bbe 100755 --- a/src/lagrangian/molecule/Make/options +++ b/src/lagrangian/molecularDynamics/molecule/Make/options @@ -1,8 +1,10 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ + -I$(LIB_SRC)/lagrangian/molecularDynamics/potential/lnInclude EXE_LIBS = \ -lfiniteVolume \ - -llagrangian + -llagrangian \ + -lpotential diff --git a/src/lagrangian/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulator.C b/src/lagrangian/molecularDynamics/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulator.C similarity index 100% rename from src/lagrangian/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulator.C rename to src/lagrangian/molecularDynamics/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulator.C diff --git a/src/lagrangian/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulator.H b/src/lagrangian/molecularDynamics/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulator.H similarity index 98% rename from src/lagrangian/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulator.H rename to src/lagrangian/molecularDynamics/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulator.H index a42f75681d..27bd52771c 100755 --- a/src/lagrangian/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulator.H +++ b/src/lagrangian/molecularDynamics/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulator.H @@ -123,7 +123,7 @@ public: // Access - inline const label averagesTaken() const; + inline label averagesTaken() const; inline label nBuffers() const; diff --git a/src/lagrangian/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulatorI.H b/src/lagrangian/molecularDynamics/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulatorI.H similarity index 97% rename from src/lagrangian/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulatorI.H rename to src/lagrangian/molecularDynamics/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulatorI.H index 7f27130f2b..cb3bcc617e 100755 --- a/src/lagrangian/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulatorI.H +++ b/src/lagrangian/molecularDynamics/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulatorI.H @@ -46,7 +46,7 @@ inline const Field& bufferedAccumulator::accumulationBuffer() const // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -inline const label bufferedAccumulator::averagesTaken() const +inline label bufferedAccumulator::averagesTaken() const { return averagesTaken_; } diff --git a/src/lagrangian/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulatorIO.C b/src/lagrangian/molecularDynamics/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulatorIO.C similarity index 100% rename from src/lagrangian/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulatorIO.C rename to src/lagrangian/molecularDynamics/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulatorIO.C diff --git a/src/lagrangian/molecule/correlationFunction/correlationFunction.C b/src/lagrangian/molecularDynamics/molecule/correlationFunction/correlationFunction.C similarity index 100% rename from src/lagrangian/molecule/correlationFunction/correlationFunction.C rename to src/lagrangian/molecularDynamics/molecule/correlationFunction/correlationFunction.C diff --git a/src/lagrangian/molecule/correlationFunction/correlationFunction.H b/src/lagrangian/molecularDynamics/molecule/correlationFunction/correlationFunction.H similarity index 95% rename from src/lagrangian/molecule/correlationFunction/correlationFunction.H rename to src/lagrangian/molecularDynamics/molecule/correlationFunction/correlationFunction.H index f5fae016cd..fcd023e363 100644 --- a/src/lagrangian/molecule/correlationFunction/correlationFunction.H +++ b/src/lagrangian/molecularDynamics/molecule/correlationFunction/correlationFunction.H @@ -141,13 +141,13 @@ public: inline const Field< Field >& tZeroBuffers() const; - inline const scalar duration() const; + inline scalar duration() const; - inline const scalar sampleInterval() const; + inline scalar sampleInterval() const; - inline const scalar averagingInterval() const; + inline scalar averagingInterval() const; - inline const label sampleSteps() const; + inline label sampleSteps() const; inline label measurandFieldSize() const; diff --git a/src/lagrangian/molecule/correlationFunction/correlationFunctionI.H b/src/lagrangian/molecularDynamics/molecule/correlationFunction/correlationFunctionI.H similarity index 86% rename from src/lagrangian/molecule/correlationFunction/correlationFunctionI.H rename to src/lagrangian/molecularDynamics/molecule/correlationFunction/correlationFunctionI.H index 2c2a3743c0..6858f647a6 100644 --- a/src/lagrangian/molecule/correlationFunction/correlationFunctionI.H +++ b/src/lagrangian/molecularDynamics/molecule/correlationFunction/correlationFunctionI.H @@ -33,28 +33,28 @@ tZeroBuffers() const template -inline const scalar Foam::correlationFunction::duration() const +inline scalar Foam::correlationFunction::duration() const { return duration_; } template -inline const scalar Foam::correlationFunction::sampleInterval() const +inline scalar Foam::correlationFunction::sampleInterval() const { return sampleInterval_; } template -inline const scalar Foam::correlationFunction::averagingInterval() const +inline scalar Foam::correlationFunction::averagingInterval() const { return averagingInterval_; } template -inline const label Foam::correlationFunction::sampleSteps() const +inline label Foam::correlationFunction::sampleSteps() const { return sampleSteps_; } diff --git a/src/lagrangian/molecule/correlationFunction/correlationFunctionIO.C b/src/lagrangian/molecularDynamics/molecule/correlationFunction/correlationFunctionIO.C similarity index 100% rename from src/lagrangian/molecule/correlationFunction/correlationFunctionIO.C rename to src/lagrangian/molecularDynamics/molecule/correlationFunction/correlationFunctionIO.C diff --git a/src/lagrangian/molecule/distribution/distribution.C b/src/lagrangian/molecularDynamics/molecule/distribution/distribution.C similarity index 100% rename from src/lagrangian/molecule/distribution/distribution.C rename to src/lagrangian/molecularDynamics/molecule/distribution/distribution.C diff --git a/src/lagrangian/molecule/distribution/distribution.H b/src/lagrangian/molecularDynamics/molecule/distribution/distribution.H similarity index 98% rename from src/lagrangian/molecule/distribution/distribution.H rename to src/lagrangian/molecularDynamics/molecule/distribution/distribution.H index 8cefd24a81..e9bfdfccf8 100755 --- a/src/lagrangian/molecule/distribution/distribution.H +++ b/src/lagrangian/molecularDynamics/molecule/distribution/distribution.H @@ -104,7 +104,7 @@ public: // Access - inline const scalar binWidth() const; + inline scalar binWidth() const; // Member Operators diff --git a/src/lagrangian/molecule/distribution/distributionI.H b/src/lagrangian/molecularDynamics/molecule/distribution/distributionI.H similarity index 96% rename from src/lagrangian/molecule/distribution/distributionI.H rename to src/lagrangian/molecularDynamics/molecule/distribution/distributionI.H index fed3118eb5..85d5934da0 100755 --- a/src/lagrangian/molecule/distribution/distributionI.H +++ b/src/lagrangian/molecularDynamics/molecule/distribution/distributionI.H @@ -29,7 +29,7 @@ namespace Foam // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline const scalar distribution::binWidth() const +inline scalar distribution::binWidth() const { return binWidth_; } diff --git a/src/lagrangian/molecule/distribution/distributionIO.C b/src/lagrangian/molecularDynamics/molecule/distribution/distributionIO.C similarity index 100% rename from src/lagrangian/molecule/distribution/distributionIO.C rename to src/lagrangian/molecularDynamics/molecule/distribution/distributionIO.C diff --git a/src/lagrangian/molecule/mdTools/averageMDFields.H b/src/lagrangian/molecularDynamics/molecule/mdTools/averageMDFields.H similarity index 100% rename from src/lagrangian/molecule/mdTools/averageMDFields.H rename to src/lagrangian/molecularDynamics/molecule/mdTools/averageMDFields.H diff --git a/src/lagrangian/molecule/mdTools/calculateAutoCorrelationFunctions.H b/src/lagrangian/molecularDynamics/molecule/mdTools/calculateAutoCorrelationFunctions.H similarity index 84% rename from src/lagrangian/molecule/mdTools/calculateAutoCorrelationFunctions.H rename to src/lagrangian/molecularDynamics/molecule/mdTools/calculateAutoCorrelationFunctions.H index a7c4c326bb..8f7574a077 100644 --- a/src/lagrangian/molecule/mdTools/calculateAutoCorrelationFunctions.H +++ b/src/lagrangian/molecularDynamics/molecule/mdTools/calculateAutoCorrelationFunctions.H @@ -79,5 +79,27 @@ if (mesh.time().timeIndex() % pacf.sampleSteps() == 0) if (mesh.time().timeIndex() % hfacf.sampleSteps() == 0) { -// hFacf.calculateCorrelationFunction(); + + IDLList::iterator mol(molecules.begin()); + + vector s = vector::zero; + + for + ( + mol = molecules.begin(); + mol != molecules.end(); + ++mol + ) + { + s += + ( + 0.5 * mol().mass() * magSqr(mol().U()) + + + mol().potentialEnergy() + ) * mol().U() + + + 0.5 * ( mol().rf() & mol().U() ); + } + + hfacf.calculateCorrelationFunction(s); } diff --git a/src/lagrangian/molecule/mdTools/calculateMDFields.H b/src/lagrangian/molecularDynamics/molecule/mdTools/calculateMDFields.H similarity index 100% rename from src/lagrangian/molecule/mdTools/calculateMDFields.H rename to src/lagrangian/molecularDynamics/molecule/mdTools/calculateMDFields.H diff --git a/src/lagrangian/molecule/mdTools/calculateTransportProperties.H b/src/lagrangian/molecularDynamics/molecule/mdTools/calculateTransportProperties.H similarity index 81% rename from src/lagrangian/molecule/mdTools/calculateTransportProperties.H rename to src/lagrangian/molecularDynamics/molecule/mdTools/calculateTransportProperties.H index 15e0dab7e3..b0923c42db 100644 --- a/src/lagrangian/molecule/mdTools/calculateTransportProperties.H +++ b/src/lagrangian/molecularDynamics/molecule/mdTools/calculateTransportProperties.H @@ -59,7 +59,24 @@ Info<< "Viscosity = " if(writeHFacf) { - + OFstream hfacfFile + ( + runTime.path()/ + "hfacf" + ); + + if (!hfacf.writeAveraged(hfacfFile)) + { + FatalErrorIn(args.executable()) + << "Failed writing to " + << hfacfFile.name() + << abort(FatalError); + } } - +Info << "Thermal conductivity = " + << hfacf.integral() + /averageTemperature + /averageTemperature + /moleculeCloud::kb + / meshVolume + << endl; diff --git a/src/lagrangian/molecule/mdTools/createAutoCorrelationFunctions.H b/src/lagrangian/molecularDynamics/molecule/mdTools/createAutoCorrelationFunctions.H similarity index 100% rename from src/lagrangian/molecule/mdTools/createAutoCorrelationFunctions.H rename to src/lagrangian/molecularDynamics/molecule/mdTools/createAutoCorrelationFunctions.H diff --git a/src/lagrangian/molecule/mdTools/createMDFields.H b/src/lagrangian/molecularDynamics/molecule/mdTools/createMDFields.H similarity index 80% rename from src/lagrangian/molecule/mdTools/createMDFields.H rename to src/lagrangian/molecularDynamics/molecule/mdTools/createMDFields.H index f5742fd2c8..dccd1891a7 100755 --- a/src/lagrangian/molecule/mdTools/createMDFields.H +++ b/src/lagrangian/molecularDynamics/molecule/mdTools/createMDFields.H @@ -2,25 +2,25 @@ List< scalarField > allSpeciesN_RU ( - molecules.nIds(), + molecules.pairPotentials().nIds(), scalarField (mesh.nCells(), 0.0) ); List< scalarField > allSpeciesM_RU ( - molecules.nIds(), + molecules.pairPotentials().nIds(), scalarField (mesh.nCells(), 0.0) ); List< vectorField > allSpeciesVelocitySum_RU ( - molecules.nIds(), + molecules.pairPotentials().nIds(), vectorField (mesh.nCells(), vector::zero) ); List< scalarField > allSpeciesVelocityMagSquaredSum_RU ( - molecules.nIds(), + molecules.pairPotentials().nIds(), scalarField (mesh.nCells(), 0.0) ); @@ -34,13 +34,13 @@ Info << nl << "Creating fields." << endl; PtrList allSpeciesRhoN ( - molecules.nIds() + molecules.pairPotentials().nIds() ); forAll (allSpeciesRhoN, rN) { Info << " Creating number density field for " - << molecules.idList()[rN] << endl; + << molecules.pairPotentials().idList()[rN] << endl; allSpeciesRhoN.set ( @@ -49,7 +49,7 @@ forAll (allSpeciesRhoN, rN) ( IOobject ( - "rhoN_" + molecules.idList()[rN], + "rhoN_" + molecules.pairPotentials().idList()[rN], runTime.timeName(), mesh, IOobject::NO_READ, @@ -89,13 +89,13 @@ totalRhoN.correctBoundaryConditions(); PtrList allSpeciesRhoM ( - molecules.nIds() + molecules.pairPotentials().nIds() ); forAll (allSpeciesRhoM, rM) { Info << " Creating mass density field for " - << molecules.idList()[rM] << endl; + << molecules.pairPotentials().idList()[rM] << endl; allSpeciesRhoM.set ( @@ -104,7 +104,7 @@ forAll (allSpeciesRhoM, rM) ( IOobject ( - "rhoM_" + molecules.idList()[rM], + "rhoM_" + molecules.pairPotentials().idList()[rM], runTime.timeName(), mesh, IOobject::NO_READ, @@ -144,13 +144,13 @@ totalRhoM.correctBoundaryConditions(); PtrList allSpeciesVelocity ( - molecules.nIds() + molecules.pairPotentials().nIds() ); forAll (allSpeciesVelocity, v) { Info << " Creating velocity field for " - << molecules.idList()[v] << endl; + << molecules.pairPotentials().idList()[v] << endl; allSpeciesVelocity.set ( @@ -159,7 +159,7 @@ forAll (allSpeciesVelocity, v) ( IOobject ( - "velocity_" + molecules.idList()[v], + "velocity_" + molecules.pairPotentials().idList()[v], runTime.timeName(), mesh, IOobject::NO_READ, @@ -177,22 +177,40 @@ forAll (allSpeciesVelocity, v) 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(); + + volVectorField totalVelocity + ( IOobject ( - "velocity_total", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE + + "velocity_total", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), mesh, - dimVelocity, - "zeroGradient" + dimensionedVector("zero", dimVelocity, vector::zero) ); -totalVelocity.internalField() = vectorField (mesh.nCells(), vector::zero); -totalVelocity.correctBoundaryConditions(); /*---------------------------------------------------------------------------*\ Kinetic temperature @@ -200,13 +218,13 @@ totalVelocity.correctBoundaryConditions(); PtrList allSpeciesTemperature ( - molecules.nIds() + molecules.pairPotentials().nIds() ); forAll (allSpeciesTemperature, t) { Info << " Creating temperature field for " - << molecules.idList()[t] << endl; + << molecules.pairPotentials().idList()[t] << endl; allSpeciesTemperature.set ( @@ -215,7 +233,7 @@ forAll (allSpeciesTemperature, t) ( IOobject ( - "temperature_" + molecules.idList()[t], + "temperature_" + molecules.pairPotentials().idList()[t], runTime.timeName(), mesh, IOobject::NO_READ, @@ -256,13 +274,13 @@ totalTemperature.correctBoundaryConditions(); PtrList allSpeciesMeanKE ( - molecules.nIds() + molecules.pairPotentials().nIds() ); forAll (allSpeciesMeanKE, mKE) { Info << " Creating mean kinetic energy field for " - << molecules.idList()[mKE] << endl; + << molecules.pairPotentials().idList()[mKE] << endl; allSpeciesMeanKE.set ( @@ -271,7 +289,7 @@ forAll (allSpeciesMeanKE, mKE) ( IOobject ( - "meanKE_" + molecules.idList()[mKE], + "meanKE_" + molecules.pairPotentials().idList()[mKE], runTime.timeName(), mesh, IOobject::NO_READ, diff --git a/src/lagrangian/molecule/mdTools/createRefUnits.H b/src/lagrangian/molecularDynamics/molecule/mdTools/createRefUnits.H similarity index 100% rename from src/lagrangian/molecule/mdTools/createRefUnits.H rename to src/lagrangian/molecularDynamics/molecule/mdTools/createRefUnits.H diff --git a/src/lagrangian/molecule/mdTools/md.H b/src/lagrangian/molecularDynamics/molecule/mdTools/md.H similarity index 100% rename from src/lagrangian/molecule/mdTools/md.H rename to src/lagrangian/molecularDynamics/molecule/mdTools/md.H diff --git a/src/lagrangian/molecule/mdTools/meanMomentumEnergyAndNMols.H b/src/lagrangian/molecularDynamics/molecule/mdTools/meanMomentumEnergyAndNMols.H similarity index 100% rename from src/lagrangian/molecule/mdTools/meanMomentumEnergyAndNMols.H rename to src/lagrangian/molecularDynamics/molecule/mdTools/meanMomentumEnergyAndNMols.H diff --git a/src/lagrangian/molecule/mdTools/resetMDFields.H b/src/lagrangian/molecularDynamics/molecule/mdTools/resetMDFields.H similarity index 72% rename from src/lagrangian/molecule/mdTools/resetMDFields.H rename to src/lagrangian/molecularDynamics/molecule/mdTools/resetMDFields.H index e5fdbbd8a4..337647ec02 100755 --- a/src/lagrangian/molecule/mdTools/resetMDFields.H +++ b/src/lagrangian/molecularDynamics/molecule/mdTools/resetMDFields.H @@ -2,25 +2,25 @@ if (runTime.outputTime()) { allSpeciesN_RU = List< scalarField > ( - molecules.nIds(), + molecules.pairPotentials().nIds(), scalarField (mesh.nCells(), 0.0) ); allSpeciesM_RU = List< scalarField > ( - molecules.nIds(), + molecules.pairPotentials().nIds(), scalarField (mesh.nCells(), 0.0) ); allSpeciesVelocitySum_RU = List< vectorField > ( - molecules.nIds(), + molecules.pairPotentials().nIds(), vectorField (mesh.nCells(), vector::zero) ); allSpeciesVelocityMagSquaredSum_RU = List< scalarField > ( - molecules.nIds(), + molecules.pairPotentials().nIds(), scalarField (mesh.nCells(), 0.0) ); } diff --git a/src/lagrangian/molecule/mdTools/temperatureAndPressure.H b/src/lagrangian/molecularDynamics/molecule/mdTools/temperatureAndPressure.H similarity index 97% rename from src/lagrangian/molecule/mdTools/temperatureAndPressure.H rename to src/lagrangian/molecularDynamics/molecule/mdTools/temperatureAndPressure.H index 0563700cb7..0ae8b5d1ea 100755 --- a/src/lagrangian/molecule/mdTools/temperatureAndPressure.H +++ b/src/lagrangian/molecularDynamics/molecule/mdTools/temperatureAndPressure.H @@ -86,6 +86,8 @@ if (runTime.outputTime()) << " m/s" << nl << "Average temperature = " << averageTemperature << " K" << nl + << "accumulatedTotalrDotfSum = " + << accumulatedTotalrDotfSum << nl << "Average pressure = " << averagePressure << " N/m^2" << nl << "----------------------------------------" << endl; diff --git a/src/lagrangian/molecule/mdTools/temperatureAndPressureVariables.H b/src/lagrangian/molecularDynamics/molecule/mdTools/temperatureAndPressureVariables.H similarity index 100% rename from src/lagrangian/molecule/mdTools/temperatureAndPressureVariables.H rename to src/lagrangian/molecularDynamics/molecule/mdTools/temperatureAndPressureVariables.H diff --git a/src/lagrangian/molecule/mdTools/temperatureEquilibration.H b/src/lagrangian/molecularDynamics/molecule/mdTools/temperatureEquilibration.H similarity index 100% rename from src/lagrangian/molecule/mdTools/temperatureEquilibration.H rename to src/lagrangian/molecularDynamics/molecule/mdTools/temperatureEquilibration.H diff --git a/src/lagrangian/molecule/molecule/molecule.C b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.C similarity index 100% rename from src/lagrangian/molecule/molecule/molecule.C rename to src/lagrangian/molecularDynamics/molecule/molecule/molecule.C diff --git a/src/lagrangian/molecule/molecule/molecule.H b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H similarity index 96% rename from src/lagrangian/molecule/molecule/molecule.H rename to src/lagrangian/molecularDynamics/molecule/molecule/molecule.H index 68cff646b1..cbc0a7a134 100755 --- a/src/lagrangian/molecule/molecule/molecule.H +++ b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H @@ -23,10 +23,9 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::molecule + molecule Description - Foam::molecule SourceFiles moleculeI.H @@ -166,10 +165,10 @@ public: // Access //- Return id - inline const label id() const; + inline label id() const; //- Return mass - inline const scalar mass() const; + inline scalar mass() const; //- Return velocity inline const vector& U() const; @@ -180,7 +179,7 @@ public: inline vector& A(); //- Return potential energy - inline const scalar potentialEnergy() const; + inline scalar potentialEnergy() const; inline scalar& potentialEnergy(); //- Return stress contribution @@ -188,10 +187,11 @@ public: inline tensor& rf(); //- Return tethered - inline const label tethered() const; + inline label tethered() const; //- Return tetherPosition inline const vector& tetherPosition() const; + inline vector& tetherPosition(); //- Tracking diff --git a/src/lagrangian/molecule/molecule/moleculeI.H b/src/lagrangian/molecularDynamics/molecule/molecule/moleculeI.H similarity index 92% rename from src/lagrangian/molecule/molecule/moleculeI.H rename to src/lagrangian/molecularDynamics/molecule/molecule/moleculeI.H index 6dd50e337e..c9f1b9eb73 100755 --- a/src/lagrangian/molecule/molecule/moleculeI.H +++ b/src/lagrangian/molecularDynamics/molecule/molecule/moleculeI.H @@ -68,13 +68,13 @@ inline molecule::trackData::trackData // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline const label molecule::id() const +inline label molecule::id() const { return id_; } -inline const scalar molecule::mass() const +inline scalar molecule::mass() const { return mass_; } @@ -104,7 +104,7 @@ inline vector& molecule::A() } -inline const scalar molecule::potentialEnergy() const +inline scalar molecule::potentialEnergy() const { return potentialEnergy_; } @@ -128,7 +128,7 @@ inline tensor& molecule::rf() } -inline const label molecule::tethered() const +inline label molecule::tethered() const { return tethered_; } @@ -140,6 +140,12 @@ inline const vector& molecule::tetherPosition() const } +inline vector& molecule::tetherPosition() +{ + return tetherPosition_; +} + + inline moleculeCloud& molecule::trackData::molCloud() { return molCloud_; diff --git a/src/lagrangian/molecule/molecule/moleculeIO.C b/src/lagrangian/molecularDynamics/molecule/molecule/moleculeIO.C similarity index 100% rename from src/lagrangian/molecule/molecule/moleculeIO.C rename to src/lagrangian/molecularDynamics/molecule/molecule/moleculeIO.C diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloud.C b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C similarity index 100% rename from src/lagrangian/molecule/moleculeCloud/moleculeCloud.C rename to src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloud.H b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.H similarity index 94% rename from src/lagrangian/molecule/moleculeCloud/moleculeCloud.H rename to src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.H index 5175fdd0d8..600c874346 100755 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloud.H +++ b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.H @@ -97,18 +97,6 @@ private: 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 idList_; - labelList removalOrder_; labelListList directInteractionList_; @@ -189,20 +177,10 @@ public: inline scalar potentialEnergyLimit() const; - inline scalar guardRadius() const; - - inline const scalar rCutMax() const; - - inline const scalar rCutMaxSqr() const; - - inline const List& 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; diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudApplyConstraintsAndThermostats.C b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudApplyConstraintsAndThermostats.C similarity index 100% rename from src/lagrangian/molecule/moleculeCloud/moleculeCloudApplyConstraintsAndThermostats.C rename to src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudApplyConstraintsAndThermostats.C diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildCellInteractionLists.C b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudBuildCellInteractionLists.C similarity index 100% rename from src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildCellInteractionLists.C rename to src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudBuildCellInteractionLists.C diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildCellOccupancy.C b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudBuildCellOccupancy.C similarity index 89% rename from src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildCellOccupancy.C rename to src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudBuildCellOccupancy.C index f02be61f7e..89ad6cd3e6 100755 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildCellOccupancy.C +++ b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudBuildCellOccupancy.C @@ -22,13 +22,21 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +Class + moleculeCloud + +Description + \*----------------------------------------------------------------------------*/ #include "moleculeCloud.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -void Foam::moleculeCloud::buildCellOccupancy() +namespace Foam +{ + +void moleculeCloud::buildCellOccupancy() { forAll(cellOccupancy_, cO) { @@ -37,7 +45,12 @@ void Foam::moleculeCloud::buildCellOccupancy() iterator mol(this->begin()); - for (mol = this->begin(); mol != this->end(); ++mol) + for + ( + mol = this->begin(); + mol != this->end(); + ++mol + ) { cellOccupancy_[mol().cell()].append(&mol()); } @@ -50,5 +63,6 @@ void Foam::moleculeCloud::buildCellOccupancy() referredInteractionList_.referMolecules(); } +} // End namespace Foam // ************************************************************************* // diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildCellReferralLists.C b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudBuildCellReferralLists.C similarity index 100% rename from src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildCellReferralLists.C rename to src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudBuildCellReferralLists.C diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildDirectInteractionList.H b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudBuildDirectInteractionList.H similarity index 100% rename from src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildDirectInteractionList.H rename to src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudBuildDirectInteractionList.H diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildReferredInteractionList.H b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudBuildReferredInteractionList.H similarity index 100% rename from src/lagrangian/molecule/moleculeCloud/moleculeCloudBuildReferredInteractionList.H rename to src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudBuildReferredInteractionList.H diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculateExternalForce.C b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCalculateExternalForce.C similarity index 100% rename from src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculateExternalForce.C rename to src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCalculateExternalForce.C diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculateForce.C b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCalculateForce.C similarity index 100% rename from src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculateForce.C rename to src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCalculateForce.C diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculatePairForce.C b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCalculatePairForce.C similarity index 100% rename from src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculatePairForce.C rename to src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCalculatePairForce.C diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculatePairForceRealCells.H b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCalculatePairForceRealCells.H similarity index 100% rename from src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculatePairForceRealCells.H rename to src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCalculatePairForceRealCells.H diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculatePairForceRealCellsCalculationStep.H b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCalculatePairForceRealCellsCalculationStep.H similarity index 92% rename from src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculatePairForceRealCellsCalculationStep.H rename to src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCalculatePairForceRealCellsCalculationStep.H index 49e1e2d781..9f2080d02e 100755 --- a/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculatePairForceRealCellsCalculationStep.H +++ b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCalculatePairForceRealCellsCalculationStep.H @@ -6,7 +6,7 @@ rIJ = molI->position() - molJ->position(); rIJMagSq = magSqr(rIJ); -if (pairPotentials_.rCutSqr(idI, idJ, rIJMagSq)) +if(pairPotentials_.rCutSqr(idI, idJ, rIJMagSq)) { rIJMag = mag(rIJ); diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculatePairForceReferredCells.H b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCalculatePairForceReferredCells.H similarity index 100% rename from src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculatePairForceReferredCells.H rename to src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCalculatePairForceReferredCells.H diff --git a/src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculateTetherForce.C b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCalculateTetherForce.C similarity index 100% rename from src/lagrangian/molecule/moleculeCloud/moleculeCloudCalculateTetherForce.C rename to src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCalculateTetherForce.C diff --git a/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCodeSnippets.H b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCodeSnippets.H new file mode 100755 index 0000000000..a66b409b45 --- /dev/null +++ b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCodeSnippets.H @@ -0,0 +1,193 @@ +// Parallel coding to access boundary information to build up interaction cell info + +// See preservePatchTypes for how to read the boundary file. + +// Read faceProcAddressing, as per reconstructPar, to get hold of the original, +// undecomposed face label from a face on a processor mesh. See email from Mattijs: + +// > Is it a case of reading the faceProcAddressing file, in the same way as +// > something like reconstructPar? +// Correct. +// +// Note that faceProcAddressing is a bit weird since it also includes which side +// of an internal face we have. If I remember correctly: +// +// faceI == 0 illegal +// faceI > 0 we have the original owner of  faceI-1 i.e. we have the face in the +// original order. +// faceI < 0 we have the original neighbour of -faceI-1 so the face is flipped. + +// Use the same functionality as +// label polyBoundaryMesh::whichPatch(const label faceIndex) const +// To determine which patch a face was on originally. + +if (Pstream::parRun()) +{ +// if (Pstream::myProcNo() == Pstream::masterNo()) +// // { +// dictionary patchDictionary; +// +// DynamicList patchNames; +// +// { +// IOobject undecomposedBoundaryHeader +// ( +// "undecomposedBoundary", +// mesh_.time().constant(), +// polyMesh::meshSubDir, +// mesh_, +// 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\n" +// ) +// << "undecomposedBoundary file not found in " +// "constant/polyMesh" +// << abort(FatalError); +// } +// } +// +// labelIOList faceProcAddressing +// ( +// IOobject +// ( +// "faceProcAddressing", +// mesh_.time().constant(), +// polyMesh::meshSubDir, +// mesh_, +// IOobject::MUST_READ, +// IOobject::NO_WRITE, +// false +// ) +// ); + + labelList procPatches(mesh_.globalData().processorPatches()); + + forAll(procPatches,pP) + { + const processorPolyPatch& patch = + refCast + ( + mesh_.boundaryMesh()[procPatches[pP]] + ); +// +// Pout << nl << "name: " << patch.name() << nl +// << "start: " << patch.start() << nl +// << "size: " << patch.size() << nl +// << "separated: " << Switch(patch.separated()) << nl +// << "parallel: " << Switch(patch.parallel()) << nl << endl; +// +// 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; +// +// label minStart = -1; +// +// // Scanning the dictionary each time is a very ugly way of +// // finding out what patch a face originally belonged to, but +// // it proves the concept. Read the patch info a container +// // class and have a neat way of tell which patch a face is from +// // embedded in that. Split each processor face down into +// // separate lists for each different originiating patch. +// +// forAll(patchNames, patchi) +// { +// if (patchDictionary.found(patchNames[patchi])) +// { +// const dictionary& patchDict = +// patchDictionary.subDict(patchNames[patchi]); +// +// word faceName(patchNames[patchi]); +// 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 +// ) +// { +// Pout << " original patch: " << faceName << endl; +// } +// } +// } +// +// if (globalFace < minStart) +// { +// Pout << " originally an internal face" << endl; +// } +// } +// + if (patch.separated()) + { + Pout << patch.separation(); + } + + if (!patch.parallel()) + { + Pout << patch.forwardT(); + } + } +// } +// else +// { +// +// } + + // Get coords of my shared points +// vector sharedPoints(vector::one*(Pstream::myProcNo()+1)); +// label testRedLab(Pstream::myProcNo()+1); + +// Pout << testRedLab << endl; + + // Append from all processors +// combineReduce(sharedPoints, plusEqOp()); +// reduce(testRedLab, plusOp