diff --git a/applications/solvers/molecularDynamics/gnemdFoam/Make/files b/applications/solvers/molecularDynamics/gnemdFoam/Make/files new file mode 100755 index 0000000000..b59e704979 --- /dev/null +++ b/applications/solvers/molecularDynamics/gnemdFoam/Make/files @@ -0,0 +1,3 @@ +gnemdFoam.C + +EXE = $(FOAM_APPBIN)/gnemdFoam diff --git a/applications/solvers/molecularDynamics/gnemdFoam/Make/options b/applications/solvers/molecularDynamics/gnemdFoam/Make/options new file mode 100755 index 0000000000..80f9773456 --- /dev/null +++ b/applications/solvers/molecularDynamics/gnemdFoam/Make/options @@ -0,0 +1,11 @@ +EXE_INC = \ + -I$(LIB_SRC)/lagrangian/molecule/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/lagrangian/basic/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +EXE_LIBS = \ + -lmeshTools \ + -lfiniteVolume \ + -llagrangian \ + -lmolecule diff --git a/applications/solvers/molecularDynamics/gnemdFoam/gnemdFoam.C b/applications/solvers/molecularDynamics/gnemdFoam/gnemdFoam.C new file mode 100755 index 0000000000..0356c42fd2 --- /dev/null +++ b/applications/solvers/molecularDynamics/gnemdFoam/gnemdFoam.C @@ -0,0 +1,90 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 + +Application + gnemdFOAM + +Description + MD for Fluid Mechanics and hybridising with a continuum solver. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "md.H" + +int main(int argc, char *argv[]) +{ + +# include "setRootCase.H" +# include "createTime.H" +# include "createMesh.H" + + moleculeCloud molecules(mesh); + +# include "createMDFields.H" + + molecules.removeHighEnergyOverlaps(); + +# include "temperatureAndPressureVariables.H" + + label nAveragingSteps = 0; + + Info << "\nStarting time loop\n" << endl; + + while (runTime.run()) + { + runTime++; + + nAveragingSteps++; + + Info << "Time = " << runTime.timeName() << endl; + + molecules.integrateEquationsOfMotion(); + +# include "meanMomentumEnergyAndNMols.H" + +# include "temperatureAndPressure.H" + +# include "calculateMDFields.H" + +# include "averageMDFields.H" + + runTime.write(); + +# include "resetMDFields.H" + + if (runTime.outputTime()) + { + nAveragingSteps = 0; + } + + Info << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info << "End\n" << endl; + + return(0); +} diff --git a/applications/solvers/molecularDynamics/mdEquilibrationFoam/Make/files b/applications/solvers/molecularDynamics/mdEquilibrationFoam/Make/files new file mode 100755 index 0000000000..c3a050bb68 --- /dev/null +++ b/applications/solvers/molecularDynamics/mdEquilibrationFoam/Make/files @@ -0,0 +1,3 @@ +mdEquilibrationFoam.C + +EXE = $(FOAM_APPBIN)/mdEquilibrationFoam diff --git a/applications/solvers/molecularDynamics/mdEquilibrationFoam/Make/options b/applications/solvers/molecularDynamics/mdEquilibrationFoam/Make/options new file mode 100755 index 0000000000..80f9773456 --- /dev/null +++ b/applications/solvers/molecularDynamics/mdEquilibrationFoam/Make/options @@ -0,0 +1,11 @@ +EXE_INC = \ + -I$(LIB_SRC)/lagrangian/molecule/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/lagrangian/basic/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +EXE_LIBS = \ + -lmeshTools \ + -lfiniteVolume \ + -llagrangian \ + -lmolecule diff --git a/applications/solvers/molecularDynamics/mdEquilibrationFoam/mdEquilibrationFoam.C b/applications/solvers/molecularDynamics/mdEquilibrationFoam/mdEquilibrationFoam.C new file mode 100755 index 0000000000..f98371327b --- /dev/null +++ b/applications/solvers/molecularDynamics/mdEquilibrationFoam/mdEquilibrationFoam.C @@ -0,0 +1,86 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 + +Application + mdEquilibrationFOAM + +Description + Equilibrates and/or preconditions MD systems + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "md.H" + +int main(int argc, char *argv[]) +{ + +# include "setRootCase.H" +# include "createTime.H" +# include "createMesh.H" + + moleculeCloud molecules(mesh); + + molecules.removeHighEnergyOverlaps(); + +# include "temperatureAndPressureVariables.H" + +# include "readmdEquilibrationDict.H" + + label nAveragingSteps = 0; + + Info << "\nStarting time loop\n" << endl; + + while (runTime.run()) + { + runTime++; + + nAveragingSteps++; + + Info << "Time = " << runTime.timeName() << endl; + + molecules.integrateEquationsOfMotion(); + +# include "meanMomentumEnergyAndNMols.H" + +# include "temperatureAndPressure.H" + +# include "temperatureEquilibration.H" + + runTime.write(); + + if (runTime.outputTime()) + { + nAveragingSteps = 0; + } + + Info << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info << "End\n" << endl; + + return(0); +} diff --git a/applications/solvers/molecularDynamics/mdEquilibrationFoam/readmdEquilibrationDict.H b/applications/solvers/molecularDynamics/mdEquilibrationFoam/readmdEquilibrationDict.H new file mode 100755 index 0000000000..b205b5ae31 --- /dev/null +++ b/applications/solvers/molecularDynamics/mdEquilibrationFoam/readmdEquilibrationDict.H @@ -0,0 +1,18 @@ +Info<< "Reading MD Equilibration Dictionary" << nl << endl; + +IOdictionary mdEquilibrationDict +( + IOobject + ( + "mdEquilibrationDict", + runTime.system(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) +); + +scalar targetTemperature = readScalar +( + mdEquilibrationDict.lookup("equilibrationTargetTemperature") +); diff --git a/applications/utilities/postProcessing/field/components/components.C b/applications/utilities/postProcessing/field/components/components.C index 5dae20f760..798d1e60a9 100644 --- a/applications/utilities/postProcessing/field/components/components.C +++ b/applications/utilities/postProcessing/field/components/components.C @@ -35,44 +35,7 @@ Description // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -template -void writeComponents -( - const IOobject& header, - const fvMesh& mesh, - bool& processed -) -{ - typedef GeometricField fieldType; - - if (header.headerClassName() == fieldType::typeName) - { - Info<< " Reading " << header.name() << endl; - fieldType field(header, mesh); - - for (direction i=0; i(fieldHeader, mesh, processed); - writeComponents(fieldHeader, mesh, processed); - writeComponents(fieldHeader, mesh, processed); - writeComponents(fieldHeader, mesh, processed); + writeComponentFields(fieldHeader, mesh, processed); + writeComponentFields + ( + fieldHeader, + mesh, + processed + ); + writeComponentFields(fieldHeader, mesh, processed); + writeComponentFields(fieldHeader, mesh, processed); if (!processed) { FatalError diff --git a/applications/utilities/postProcessing/field/components/writeComponentFields.C b/applications/utilities/postProcessing/field/components/writeComponentFields.C new file mode 100644 index 0000000000..df91bc2131 --- /dev/null +++ b/applications/utilities/postProcessing/field/components/writeComponentFields.C @@ -0,0 +1,77 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 + +Application + components + +Description + Writes scalar fields corresponding to each component of the supplied + field (name) for each time. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +void writeComponentFields +( + const IOobject& header, + const fvMesh& mesh, + bool& processed +) +{ + typedef GeometricField fieldType; + + if (header.headerClassName() == fieldType::typeName) + { + Info<< " Reading " << header.name() << endl; + fieldType field(header, mesh); + + for (direction i=0; i -void writeMagField -( - const IOobject& header, - const fvMesh& mesh, - bool& processed -) -{ - typedef GeometricField fieldType; - - if (header.headerClassName() == fieldType::typeName) - { - Info<< " Reading " << header.name() << endl; - fieldType field(header, mesh); - - Info<< " Calculating mag" << header.name() << endl; - volScalarField magField - ( - IOobject - ( - "mag" + header.name(), - mesh.time().timeName(), - mesh, - IOobject::NO_READ - ), - mag(field) - ); - magField.write(); - - processed = true; - } -} - +#include "writeMagField.C" int main(int argc, char *argv[]) { diff --git a/applications/utilities/postProcessing/field/mag/writeMagField.C b/applications/utilities/postProcessing/field/mag/writeMagField.C new file mode 100644 index 0000000000..760c785392 --- /dev/null +++ b/applications/utilities/postProcessing/field/mag/writeMagField.C @@ -0,0 +1,71 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 + +Application + mag + +Description + Calculates and writes the magnitude of a field for each time + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +void writeMagField +( + const IOobject& header, + const fvMesh& mesh, + bool& processed +) +{ + typedef GeometricField fieldType; + + if (header.headerClassName() == fieldType::typeName) + { + Info<< " Reading " << header.name() << endl; + fieldType field(header, mesh); + + Info<< " Calculating mag" << header.name() << endl; + volScalarField magField + ( + IOobject + ( + "mag" + header.name(), + mesh.time().timeName(), + mesh, + IOobject::NO_READ + ), + mag(field) + ); + magField.write(); + + processed = true; + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/utilities/postProcessing/field/magGrad/magGrad.C b/applications/utilities/postProcessing/field/magGrad/magGrad.C index 9d584fc80d..d1b1add7d9 100644 --- a/applications/utilities/postProcessing/field/magGrad/magGrad.C +++ b/applications/utilities/postProcessing/field/magGrad/magGrad.C @@ -26,23 +26,26 @@ Application magGrad Description - Calculates and writes the scalar magnitude of a scalar or vector field - at each time + Calculates and writes the magnitude of the gradient of a field for each + time \*---------------------------------------------------------------------------*/ #include "fvCFD.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Main program: + +#include "writeMagGradField.C" int main(int argc, char *argv[]) { - argList::validArgs.append("field"); + argList::validArgs.append("fieldName"); # include "addTimeOptions.H" # include "setRootCase.H" + word fieldName(args.additionalArgs()[0]); + # include "createTime.H" // Get times list @@ -51,8 +54,6 @@ int main(int argc, char *argv[]) // set startTime and endTime depending on -time and -latestTime options # include "checkTimeOptions.H" - const word fieldName(args.additionalArgs()[0]); - runTime.setTime(Times[startTime], startTime); # include "createMesh.H" @@ -63,7 +64,7 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << endl; - IOobject header + IOobject fieldHeader ( fieldName, runTime.timeName(), @@ -71,56 +72,33 @@ int main(int argc, char *argv[]) IOobject::MUST_READ ); - // Check U exists - if (header.headerOk()) + // Check field "fieldName" exists + if (fieldHeader.headerOk()) { mesh.readUpdate(); - if (header.headerClassName() == volVectorField::typeName) + bool processed = false; + writeMagGradField(fieldHeader, mesh, processed); + writeMagGradField(fieldHeader, mesh, processed); + if (!processed) { - Info<< " Reading " << fieldName << endl; - volVectorField U(header, mesh); - - volScalarField magGrad - ( - IOobject - ( - "magGrad" + fieldName, - runTime.timeName(), - mesh, - IOobject::NO_READ - ), - mag(fvc::grad(U)) - ); - Info<< " Calculating " << magGrad.name() << endl; - magGrad.write(); - } - else if (header.headerClassName() == volScalarField::typeName) - { - Info<< " Reading " << fieldName << endl; - volScalarField U(header, mesh); - - volScalarField magGrad - ( - IOobject - ( - "magGrad" + fieldName, - runTime.timeName(), - mesh, - IOobject::NO_READ - ), - mag(fvc::grad(U)) - ); - Info<< " Calculating " << magGrad.name() << endl; - magGrad.write(); + FatalError + << "Unable to process " << fieldName << nl + << "No call to magGrad for fields of type " + << fieldHeader.headerClassName() << nl << nl + << exit(FatalError); } } else { Info<< " No " << fieldName << endl; } + + Info<< endl; } + Info<< "End\n" << endl; + return(0); } diff --git a/applications/utilities/postProcessing/field/magGrad/writeMagGradField.C b/applications/utilities/postProcessing/field/magGrad/writeMagGradField.C new file mode 100644 index 0000000000..644ea449dd --- /dev/null +++ b/applications/utilities/postProcessing/field/magGrad/writeMagGradField.C @@ -0,0 +1,72 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 + +Application + magGrad + +Description + Calculates and writes the magnitude of the gradient of a field for each + time + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +void writeMagGradField +( + const IOobject& header, + const fvMesh& mesh, + bool& processed +) +{ + typedef GeometricField fieldType; + + if (header.headerClassName() == fieldType::typeName) + { + Info<< " Reading " << header.name() << endl; + fieldType field(header, mesh); + + Info<< " Calculating magGrad" << header.name() << endl; + volScalarField magGradField + ( + IOobject + ( + "magGrad" + header.name(), + mesh.time().timeName(), + mesh, + IOobject::NO_READ + ), + mag(fvc::grad(field)) + ); + magGradField.write(); + + processed = true; + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/utilities/postProcessing/field/magSqr/magSqr.C b/applications/utilities/postProcessing/field/magSqr/magSqr.C index db08c32260..6c5c4ccdb2 100644 --- a/applications/utilities/postProcessing/field/magSqr/magSqr.C +++ b/applications/utilities/postProcessing/field/magSqr/magSqr.C @@ -34,39 +34,7 @@ Description // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -template -void writeMagSqrField -( - const IOobject& header, - const fvMesh& mesh, - bool& processed -) -{ - typedef GeometricField fieldType; - - if (header.headerClassName() == fieldType::typeName) - { - Info<< " Reading " << header.name() << endl; - fieldType field(header, mesh); - - Info<< " Calculating magSqr" << header.name() << endl; - volScalarField magSqrField - ( - IOobject - ( - "magSqr" + header.name(), - mesh.time().timeName(), - mesh, - IOobject::NO_READ - ), - magSqr(field) - ); - magSqrField.write(); - - processed = true; - } -} - +#include "writeMagSqrField.C" int main(int argc, char *argv[]) { diff --git a/applications/utilities/postProcessing/field/magSqr/writeMagSqrField.C b/applications/utilities/postProcessing/field/magSqr/writeMagSqrField.C new file mode 100644 index 0000000000..7198e88df7 --- /dev/null +++ b/applications/utilities/postProcessing/field/magSqr/writeMagSqrField.C @@ -0,0 +1,72 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 + +Application + mag + +Description + Calculates and writes the magnitude-squared of a field for each time + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +void writeMagSqrField +( + const IOobject& header, + const fvMesh& mesh, + bool& processed +) +{ + typedef GeometricField fieldType; + + if (header.headerClassName() == fieldType::typeName) + { + Info<< " Reading " << header.name() << endl; + fieldType field(header, mesh); + + Info<< " Calculating magSqr" << header.name() << endl; + volScalarField magSqrField + ( + IOobject + ( + "magSqr" + header.name(), + mesh.time().timeName(), + mesh, + IOobject::NO_READ + ), + magSqr(field) + ); + magSqrField.write(); + + processed = true; + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + diff --git a/applications/utilities/preProcessing/molConfig/Make/files b/applications/utilities/preProcessing/molConfig/Make/files new file mode 100755 index 0000000000..6501e68426 --- /dev/null +++ b/applications/utilities/preProcessing/molConfig/Make/files @@ -0,0 +1,8 @@ +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 new file mode 100755 index 0000000000..196a4d66dd --- /dev/null +++ b/applications/utilities/preProcessing/molConfig/Make/options @@ -0,0 +1,15 @@ +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 new file mode 100755 index 0000000000..0c69f15c7c --- /dev/null +++ b/applications/utilities/preProcessing/molConfig/correctVelocities.H @@ -0,0 +1,21 @@ +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 new file mode 100755 index 0000000000..20318f06d6 --- /dev/null +++ b/applications/utilities/preProcessing/molConfig/createMolecules.C @@ -0,0 +1,253 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 initialPositions(0); + + DynamicList