diff --git a/applications/solvers/dsmc/dsmcFoam/Make/files b/applications/solvers/dsmc/dsmcFoam/Make/files new file mode 100755 index 0000000000..a6860410e7 --- /dev/null +++ b/applications/solvers/dsmc/dsmcFoam/Make/files @@ -0,0 +1,3 @@ +dsmcFoam.C + +EXE = $(FOAM_APPBIN)/dsmcFoam diff --git a/applications/solvers/dsmc/dsmcFoam/Make/options b/applications/solvers/dsmc/dsmcFoam/Make/options new file mode 100755 index 0000000000..bc99834af6 --- /dev/null +++ b/applications/solvers/dsmc/dsmcFoam/Make/options @@ -0,0 +1,12 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/lagrangian/basic/lnInclude \ + -I$(LIB_SRC)/lagrangian/dsmc/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +EXE_LIBS = \ + -lmeshTools \ + -lfiniteVolume \ + -llagrangian \ + -ldsmc + diff --git a/applications/solvers/dsmc/dsmcFoam/createFields.H b/applications/solvers/dsmc/dsmcFoam/createFields.H new file mode 100644 index 0000000000..d024bd2017 --- /dev/null +++ b/applications/solvers/dsmc/dsmcFoam/createFields.H @@ -0,0 +1,162 @@ + + Info<< nl << "Reading field boundaryT" << endl; + volScalarField boundaryT + ( + IOobject + ( + "boundaryT", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + Info<< nl << "Reading field boundaryU" << endl; + volVectorField boundaryU + ( + IOobject + ( + "boundaryU", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + Info<< nl << "Reading field rhoN (number density)" << endl; + volScalarField rhoN + ( + IOobject + ( + "rhoN", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + Info<< nl << "Reading field rhoM (mass density)" << endl; + volScalarField rhoM + ( + IOobject + ( + "rhoM", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + Info<< nl << "Reading field rhoNdsmc (dsmc particle density)" << endl; + volScalarField dsmcRhoN + ( + IOobject + ( + "dsmcRhoN", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + Info<< nl << "Reading field momentum (momentum density)" << endl; + volVectorField momentum + ( + IOobject + ( + "momentum", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + Info<< nl << "Reading field linearKE (linear kinetic energy density)" + << endl; + + volScalarField linearKE + ( + IOobject + ( + "linearKE", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + Info<< nl << "Reading field internalE (internal energy density)" << endl; + volScalarField internalE + ( + IOobject + ( + "internalE", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + Info<< nl << "Reading field iDof (internal degree of freedom density)" + << endl; + + volScalarField iDof + ( + IOobject + ( + "iDof", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + Info<< nl << "Reading field q (surface heat transfer)" << endl; + volScalarField q + ( + IOobject + ( + "q", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + Info<< nl << "Reading field fD (surface force density)" << endl; + volVectorField fD + ( + IOobject + ( + "fD", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + Info<< nl << "Constructing dsmcCloud " << endl; + + dsmcCloud dsmc("dsmc", boundaryT, boundaryU); diff --git a/applications/solvers/dsmc/dsmcFoam/dsmcFoam.C b/applications/solvers/dsmc/dsmcFoam/dsmcFoam.C new file mode 100644 index 0000000000..1ea52cc6aa --- /dev/null +++ b/applications/solvers/dsmc/dsmcFoam/dsmcFoam.C @@ -0,0 +1,105 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 + dsmcFoam + +Description + Direct Simulation Monte Carlo Solver for 3D, transient, multi-species flows + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "dsmcCloud.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + #include "createTime.H" + #include "createMesh.H" + #include "createFields.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + while (runTime.run()) + { + runTime++; + + Info<< "Time = " << runTime.timeName() << nl << endl; + + // Carry out dsmcCloud timestep + + dsmc.evolve(); + + // Retrieve flow field data from dsmcCloud + + rhoN = dsmc.rhoN(); + rhoN.correctBoundaryConditions(); + + rhoM = dsmc.rhoM(); + rhoM.correctBoundaryConditions(); + + dsmcRhoN = dsmc.dsmcRhoN(); + dsmcRhoN.correctBoundaryConditions(); + + momentum = dsmc.momentum(); + momentum.correctBoundaryConditions(); + + linearKE = dsmc.linearKE(); + linearKE.correctBoundaryConditions(); + + internalE = dsmc.internalE(); + internalE.correctBoundaryConditions(); + + iDof = dsmc.iDof(); + iDof.correctBoundaryConditions(); + + // Retrieve surface field data from dsmcCloud + + q = dsmc.q(); + + fD = dsmc.fD(); + + // Print status of dsmcCloud + + dsmc.info(); + + runTime.write(); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return(0); +} + + +// ************************************************************************* // diff --git a/applications/utilities/postProcessing/miscellaneous/dsmcFieldsCalc/Make/files b/applications/utilities/postProcessing/miscellaneous/dsmcFieldsCalc/Make/files new file mode 100755 index 0000000000..5cba9c270d --- /dev/null +++ b/applications/utilities/postProcessing/miscellaneous/dsmcFieldsCalc/Make/files @@ -0,0 +1,3 @@ +dsmcFieldsCalc.C + +EXE = $(FOAM_APPBIN)/dsmcFieldsCalc diff --git a/applications/utilities/postProcessing/miscellaneous/dsmcFieldsCalc/Make/options b/applications/utilities/postProcessing/miscellaneous/dsmcFieldsCalc/Make/options new file mode 100755 index 0000000000..4e81bb55de --- /dev/null +++ b/applications/utilities/postProcessing/miscellaneous/dsmcFieldsCalc/Make/options @@ -0,0 +1,16 @@ +EXE_INC = \ + -I$(LIB_SRC)/postProcessing/postCalc \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/lagrangian/basic/lnInclude \ + -I$(LIB_SRC)/postProcessing/functionObjects/utilities/lnInclude \ + -I$(LIB_SRC)/lagrangian/dsmc/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +EXE_LIBS = \ + $(FOAM_LIBBIN)/postCalc.o \ + -lmeshTools \ + -lfiniteVolume \ + -lutilityFunctionObjects \ + -llagrangian \ + -ldsmc + diff --git a/applications/utilities/postProcessing/miscellaneous/dsmcFieldsCalc/dsmcFieldsCalc.C b/applications/utilities/postProcessing/miscellaneous/dsmcFieldsCalc/dsmcFieldsCalc.C new file mode 100644 index 0000000000..ee4fd2c50f --- /dev/null +++ b/applications/utilities/postProcessing/miscellaneous/dsmcFieldsCalc/dsmcFieldsCalc.C @@ -0,0 +1,147 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 + dsmcFields + +Description + Calculate intensive fields (U and T) from averaged extensive fields from a + DSMC calculation. + +\*---------------------------------------------------------------------------*/ + +#include "calc.H" +#include "fvc.H" +#include "dsmcCloud.H" +#include "dsmcFields.H" +#include "IOobjectList.H" + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + template + bool addFieldsToList + ( + const fvMesh& mesh, + PtrList >& list, + const wordList& fieldNames + ) + { + typedef GeometricField fieldType; + + label index = 0; + forAll(fieldNames, i) + { + IOobject obj + ( + fieldNames[i], + mesh.time().timeName(), + mesh, + IOobject::MUST_READ + ); + + if (obj.headerOk() && obj.headerClassName() == fieldType::typeName) + { + list.set(index++, new fieldType(obj, mesh)); + } + else + { + Info<< "Could not find " << fieldNames[i] << endl; + + return false; + } + } + + return true; + } +} + + +void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) +{ + bool writeResults = !args.options().found("noWrite"); + + wordList extensiveVSFNames + ( + IStringStream + ( + "( \ + rhoNMean \ + rhoMMean \ + linearKEMean \ + internalEMean \ + iDofMean \ + )" + )() + ); + + PtrList extensiveVSFs(extensiveVSFNames.size()); + + if + ( + !addFieldsToList + ( + mesh, + extensiveVSFs, + extensiveVSFNames + ) + ) + { + return; + } + + wordList extensiveVVFNames(IStringStream ("(momentumMean)")()); + + PtrList extensiveVVFs(extensiveVVFNames.size()); + + if + ( + !addFieldsToList + ( + mesh, + extensiveVVFs, + extensiveVVFNames + ) + ) + { + return; + } + + dsmcFields dF + ( + "dsmcFieldsUtility", + mesh, + dictionary::null, + false + ); + + if (writeResults) + { + dF.write(); + } +} + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/dsmcInitialise/Make/files b/applications/utilities/preProcessing/dsmcInitialise/Make/files new file mode 100755 index 0000000000..7853cb2bd6 --- /dev/null +++ b/applications/utilities/preProcessing/dsmcInitialise/Make/files @@ -0,0 +1,3 @@ +dsmcInitialise.C + +EXE = $(FOAM_APPBIN)/dsmcInitialise diff --git a/applications/utilities/preProcessing/dsmcInitialise/Make/options b/applications/utilities/preProcessing/dsmcInitialise/Make/options new file mode 100755 index 0000000000..bc99834af6 --- /dev/null +++ b/applications/utilities/preProcessing/dsmcInitialise/Make/options @@ -0,0 +1,12 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/lagrangian/basic/lnInclude \ + -I$(LIB_SRC)/lagrangian/dsmc/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +EXE_LIBS = \ + -lmeshTools \ + -lfiniteVolume \ + -llagrangian \ + -ldsmc + diff --git a/applications/utilities/preProcessing/dsmcInitialise/dsmcInitialise.C b/applications/utilities/preProcessing/dsmcInitialise/dsmcInitialise.C new file mode 100644 index 0000000000..c2f797c17e --- /dev/null +++ b/applications/utilities/preProcessing/dsmcInitialise/dsmcInitialise.C @@ -0,0 +1,79 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 + dsmcFoam + +Description + Initialise a case for dsmcFoam by reading the initialisation dictionary + system/dsmcInitialise + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "dsmcCloud.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + #include "createTime.H" + #include "createMesh.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "Initialising dsmc for Time = " << runTime.timeName() << nl << endl; + + dsmcCloud dsmc("dsmc", mesh); + + label totalMolecules = dsmc.size(); + + if (Pstream::parRun()) + { + reduce(totalMolecules, sumOp