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/test/List/ListTest.C b/applications/test/List/ListTest.C index 3f6fcc734c..bc8901b03b 100644 --- a/applications/test/List/ListTest.C +++ b/applications/test/List/ListTest.C @@ -46,7 +46,7 @@ int main(int argc, char *argv[]) List list(IStringStream("1 ((0 1 2))")()); Info<< list << endl; - List list2(IStringStream("((0 1 2) (3 4 5) (3 4 5))")()); + List list2(IStringStream("((0 1 2) (3 4 5) (6 7 8))")()); Info<< list2 << endl; Info<< findIndex(list2, vector(3, 4, 5)) << endl; @@ -59,6 +59,13 @@ int main(int argc, char *argv[]) Info<< list2 << nl << list3 << endl; + + // Subset + const labelList map(IStringStream("2 (0 2)")()); + List subList3(list3, map); + Info<< "Elements " << map << " out of " << list3 + << " : " << subList3 << endl; + return 0; } diff --git a/applications/test/UIndirectListTest/Make/files b/applications/test/UIndirectListTest/Make/files new file mode 100644 index 0000000000..8b43119aef --- /dev/null +++ b/applications/test/UIndirectListTest/Make/files @@ -0,0 +1,3 @@ +UIndirectListTest.C + +EXE = $(FOAM_USER_APPBIN)/UIndirectListTest diff --git a/applications/test/UIndirectListTest/Make/options b/applications/test/UIndirectListTest/Make/options new file mode 100644 index 0000000000..e69de29bb2 diff --git a/applications/test/UIndirectListTest/UIndirectListTest.C b/applications/test/UIndirectListTest/UIndirectListTest.C new file mode 100644 index 0000000000..575173c51e --- /dev/null +++ b/applications/test/UIndirectListTest/UIndirectListTest.C @@ -0,0 +1,94 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 + +Description + +\*---------------------------------------------------------------------------*/ + +#include "UIndirectList.H" +#include "IOstreams.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: + +int main(int argc, char *argv[]) +{ + List completeList(10); + + forAll(completeList, i) + { + completeList[i] = 0.1*i; + } + + List