mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
3
applications/solvers/dsmc/dsmcFoam/Make/files
Executable file
3
applications/solvers/dsmc/dsmcFoam/Make/files
Executable file
@ -0,0 +1,3 @@
|
||||
dsmcFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/dsmcFoam
|
||||
12
applications/solvers/dsmc/dsmcFoam/Make/options
Executable file
12
applications/solvers/dsmc/dsmcFoam/Make/options
Executable file
@ -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
|
||||
|
||||
162
applications/solvers/dsmc/dsmcFoam/createFields.H
Normal file
162
applications/solvers/dsmc/dsmcFoam/createFields.H
Normal file
@ -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);
|
||||
105
applications/solvers/dsmc/dsmcFoam/dsmcFoam.C
Normal file
105
applications/solvers/dsmc/dsmcFoam/dsmcFoam.C
Normal file
@ -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);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -46,7 +46,7 @@ int main(int argc, char *argv[])
|
||||
List<vector> list(IStringStream("1 ((0 1 2))")());
|
||||
Info<< list << endl;
|
||||
|
||||
List<vector> list2(IStringStream("((0 1 2) (3 4 5) (3 4 5))")());
|
||||
List<vector> 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<vector> subList3(list3, map);
|
||||
Info<< "Elements " << map << " out of " << list3
|
||||
<< " : " << subList3 << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
3
applications/test/UIndirectListTest/Make/files
Normal file
3
applications/test/UIndirectListTest/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
UIndirectListTest.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/UIndirectListTest
|
||||
0
applications/test/UIndirectListTest/Make/options
Normal file
0
applications/test/UIndirectListTest/Make/options
Normal file
@ -22,79 +22,73 @@ 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::IndirectList
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
IndirectListI.H
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef IndirectList_H
|
||||
#define IndirectList_H
|
||||
#include "UIndirectList.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
#include "List.H"
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
namespace Foam
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
List<double> completeList(10);
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class IndirectList Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
forAll(completeList, i)
|
||||
{
|
||||
completeList[i] = 0.1*i;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
class IndirectList
|
||||
{
|
||||
// Private data
|
||||
List<label> addresses(5);
|
||||
addresses[0] = 1;
|
||||
addresses[1] = 0;
|
||||
addresses[2] = 7;
|
||||
addresses[3] = 8;
|
||||
addresses[4] = 5;
|
||||
|
||||
const UList<T>& completeList_;
|
||||
List<label> addresses_;
|
||||
UIndirectList<double> idl(completeList, addresses);
|
||||
|
||||
forAll(idl, i)
|
||||
{
|
||||
Info<< idl[i] << token::SPACE;
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
|
||||
idl[1] = -666;
|
||||
|
||||
Info<< "idl[1] changed:" << idl() << endl;
|
||||
|
||||
idl = -999;
|
||||
|
||||
Info<< "idl changed:" << idl() << endl;
|
||||
|
||||
UIndirectList<double> idl2(idl);
|
||||
|
||||
Info<< "idl2:" << idl2() << endl;
|
||||
|
||||
idl = idl2();
|
||||
|
||||
Info<< "idl assigned from UList:" << idl() << endl;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
List<double> realList = UIndirectList<double>(completeList, addresses);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const IndirectList<T>&);
|
||||
Info<< "realList:" << realList << endl;
|
||||
|
||||
List<double> realList2(UIndirectList<double>(completeList, addresses));
|
||||
|
||||
Info<< "realList2:" << realList2 << endl;
|
||||
|
||||
|
||||
public:
|
||||
Info << "\nEnd\n" << endl;
|
||||
|
||||
// Constructors
|
||||
return 0;
|
||||
}
|
||||
|
||||
//- Construct given the complete list and the addressing array
|
||||
inline IndirectList(const UList<T>&, const List<label>&);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
inline label size() const;
|
||||
inline const UList<T>& completeList() const;
|
||||
inline const List<label>& addresses() const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Return const access to an element
|
||||
inline const T& operator[](const label) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "IndirectListI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -177,7 +177,7 @@ label mergePatchFaces
|
||||
List<faceList> allFaceSetsFaces(allFaceSets.size());
|
||||
forAll(allFaceSets, setI)
|
||||
{
|
||||
allFaceSetsFaces[setI] = IndirectList<face>
|
||||
allFaceSetsFaces[setI] = UIndirectList<face>
|
||||
(
|
||||
mesh.faces(),
|
||||
allFaceSets[setI]
|
||||
|
||||
@ -76,7 +76,7 @@ void Foam::meshDualiser::checkPolyTopoChange(const polyTopoChange& meshMod)
|
||||
"meshDualiser::checkPolyTopoChange(const polyTopoChange&)"
|
||||
) << "duplicate verts:" << newToOld[newI]
|
||||
<< " coords:"
|
||||
<< IndirectList<point>(points, newToOld[newI])()
|
||||
<< UIndirectList<point>(points, newToOld[newI])()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
@ -226,10 +226,7 @@ Foam::label Foam::meshDualiser::addInternalFace
|
||||
|
||||
if (debug)
|
||||
{
|
||||
pointField facePoints
|
||||
(
|
||||
IndirectList<point>(meshMod.points(), newFace)()
|
||||
);
|
||||
pointField facePoints(meshMod.points(), newFace);
|
||||
|
||||
labelList oldToNew;
|
||||
pointField newPoints;
|
||||
@ -289,7 +286,7 @@ Foam::label Foam::meshDualiser::addInternalFace
|
||||
//n /= mag(n);
|
||||
//Pout<< "Generated internal dualFace:" << dualFaceI
|
||||
// << " verts:" << newFace
|
||||
// << " points:" << IndirectList<point>(meshMod.points(), newFace)()
|
||||
// << " points:" << UIndirectList<point>(meshMod.points(), newFace)()
|
||||
// << " n:" << n
|
||||
// << " between dualowner:" << dualCell0
|
||||
// << " dualneigbour:" << dualCell1
|
||||
@ -316,7 +313,7 @@ Foam::label Foam::meshDualiser::addInternalFace
|
||||
//n /= mag(n);
|
||||
//Pout<< "Generated internal dualFace:" << dualFaceI
|
||||
// << " verts:" << newFace
|
||||
// << " points:" << IndirectList<point>(meshMod.points(), newFace)()
|
||||
// << " points:" << UIndirectList<point>(meshMod.points(), newFace)()
|
||||
// << " n:" << n
|
||||
// << " between dualowner:" << dualCell1
|
||||
// << " dualneigbour:" << dualCell0
|
||||
@ -373,7 +370,7 @@ Foam::label Foam::meshDualiser::addBoundaryFace
|
||||
//n /= mag(n);
|
||||
//Pout<< "Generated boundary dualFace:" << dualFaceI
|
||||
// << " verts:" << newFace
|
||||
// << " points:" << IndirectList<point>(meshMod.points(), newFace)()
|
||||
// << " points:" << UIndirectList<point>(meshMod.points(), newFace)()
|
||||
// << " n:" << n
|
||||
// << " on dualowner:" << dualCellI
|
||||
// << endl;
|
||||
@ -568,7 +565,7 @@ void Foam::meshDualiser::createFaceFromInternalFace
|
||||
|
||||
//Pout<< "createFaceFromInternalFace : At face:" << faceI
|
||||
// << " verts:" << f
|
||||
// << " points:" << IndirectList<point>(mesh_.points(), f)()
|
||||
// << " points:" << UIndirectList<point>(mesh_.points(), f)()
|
||||
// << " started walking at edge:" << fEdges[fp]
|
||||
// << " verts:" << mesh_.edges()[fEdges[fp]]
|
||||
// << endl;
|
||||
@ -617,7 +614,7 @@ void Foam::meshDualiser::createFaceFromInternalFace
|
||||
{
|
||||
FatalErrorIn("createFacesFromInternalFace(..)")
|
||||
<< "face:" << faceI << " verts:" << f
|
||||
<< " points:" << IndirectList<point>(mesh_.points(), f)()
|
||||
<< " points:" << UIndirectList<point>(mesh_.points(), f)()
|
||||
<< " no feature edge between " << f[fp]
|
||||
<< " and " << f[nextFp] << " although have different"
|
||||
<< " dual cells." << endl
|
||||
|
||||
@ -70,7 +70,7 @@ void writePointSet
|
||||
|
||||
labelList pointLabels(set.toc());
|
||||
|
||||
pointField setPoints(IndirectList<point>(mesh.points(), pointLabels)());
|
||||
pointField setPoints(mesh.points(), pointLabels);
|
||||
|
||||
// Write points
|
||||
|
||||
|
||||
@ -22,14 +22,11 @@ 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 "regionSide.H"
|
||||
#include "meshTools.H"
|
||||
#include "primitiveMesh.H"
|
||||
#include "IndirectList.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -113,7 +110,7 @@ Foam::label Foam::regionSide::otherEdge
|
||||
) << "Cannot find other edge on face " << faceI << " that uses point "
|
||||
<< pointI << " but not point " << freePointI << endl
|
||||
<< "Edges on face:" << fEdges
|
||||
<< " verts:" << IndirectList<edge>(mesh.edges(), fEdges)()
|
||||
<< " verts:" << UIndirectList<edge>(mesh.edges(), fEdges)()
|
||||
<< " Vertices on face:"
|
||||
<< mesh.faces()[faceI]
|
||||
<< " Vertices on original edge:" << e << abort(FatalError);
|
||||
|
||||
@ -50,15 +50,12 @@ Description
|
||||
#include "attachDetach.H"
|
||||
#include "attachPolyTopoChanger.H"
|
||||
#include "regionSide.H"
|
||||
#include "primitiveFacePatch.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Calculation engine for set of faces in a mesh
|
||||
typedef PrimitivePatch<face, List, const pointField&> facePatch;
|
||||
|
||||
|
||||
// Find edge between points v0 and v1.
|
||||
label findEdge(const primitiveMesh& mesh, const label v0, const label v1)
|
||||
{
|
||||
@ -163,10 +160,16 @@ int main(int argc, char *argv[])
|
||||
// set of edges on side of this region. Use PrimitivePatch to find these.
|
||||
//
|
||||
|
||||
IndirectList<face> zoneFaces(mesh.faces(), faces);
|
||||
|
||||
// Addressing on faces only in mesh vertices.
|
||||
facePatch fPatch(zoneFaces(), mesh.points());
|
||||
primitiveFacePatch fPatch
|
||||
(
|
||||
UIndirectList<face>
|
||||
(
|
||||
mesh.faces(),
|
||||
faces
|
||||
),
|
||||
mesh.points()
|
||||
);
|
||||
|
||||
const labelList& meshPoints = fPatch.meshPoints();
|
||||
|
||||
|
||||
@ -60,7 +60,6 @@ Description
|
||||
#include "polyTopoChanger.H"
|
||||
#include "mapPolyMesh.H"
|
||||
#include "ListOps.H"
|
||||
#include "IndirectList.H"
|
||||
#include "slidingInterface.H"
|
||||
#include "perfectInterface.H"
|
||||
#include "IOobjectList.H"
|
||||
|
||||
@ -22,8 +22,6 @@ 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 "writePointSet.H"
|
||||
@ -76,7 +74,7 @@ void writePointSet
|
||||
|
||||
writeFuns::insert
|
||||
(
|
||||
IndirectList<point>(vMesh.mesh().points(), set.toc())(),
|
||||
UIndirectList<point>(vMesh.mesh().points(), set.toc())(),
|
||||
ptField
|
||||
);
|
||||
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
dsmcFieldsCalc.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/dsmcFieldsCalc
|
||||
@ -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
|
||||
|
||||
@ -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<class Type>
|
||||
bool addFieldsToList
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
PtrList<GeometricField<Type, fvPatchField, volMesh> >& list,
|
||||
const wordList& fieldNames
|
||||
)
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> 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<volScalarField> extensiveVSFs(extensiveVSFNames.size());
|
||||
|
||||
if
|
||||
(
|
||||
!addFieldsToList
|
||||
(
|
||||
mesh,
|
||||
extensiveVSFs,
|
||||
extensiveVSFNames
|
||||
)
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
wordList extensiveVVFNames(IStringStream ("(momentumMean)")());
|
||||
|
||||
PtrList<volVectorField> extensiveVVFs(extensiveVVFNames.size());
|
||||
|
||||
if
|
||||
(
|
||||
!addFieldsToList
|
||||
(
|
||||
mesh,
|
||||
extensiveVVFs,
|
||||
extensiveVVFNames
|
||||
)
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
dsmcFields dF
|
||||
(
|
||||
"dsmcFieldsUtility",
|
||||
mesh,
|
||||
dictionary::null,
|
||||
false
|
||||
);
|
||||
|
||||
if (writeResults)
|
||||
{
|
||||
dF.write();
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
3
applications/utilities/preProcessing/dsmcInitialise/Make/files
Executable file
3
applications/utilities/preProcessing/dsmcInitialise/Make/files
Executable file
@ -0,0 +1,3 @@
|
||||
dsmcInitialise.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/dsmcInitialise
|
||||
12
applications/utilities/preProcessing/dsmcInitialise/Make/options
Executable file
12
applications/utilities/preProcessing/dsmcInitialise/Make/options
Executable file
@ -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
|
||||
|
||||
@ -22,55 +22,57 @@ 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
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
#include "fvCFD.H"
|
||||
#include "dsmcCloud.H"
|
||||
|
||||
//- Construct given size
|
||||
template<class T>
|
||||
inline Foam::IndirectList<T>::IndirectList
|
||||
(
|
||||
const Foam::UList<T>& completeList,
|
||||
const Foam::List<label>& addresses
|
||||
)
|
||||
:
|
||||
completeList_(completeList),
|
||||
addresses_(addresses)
|
||||
{}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
inline Foam::label Foam::IndirectList<T>::size() const
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
return addresses_.size();
|
||||
}
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
inline const Foam::UList<T>& Foam::IndirectList<T>::
|
||||
completeList() const
|
||||
{
|
||||
return completeList_;
|
||||
}
|
||||
Info<< "Initialising dsmc for Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
dsmcCloud dsmc("dsmc", mesh);
|
||||
|
||||
template<class T>
|
||||
inline const Foam::List<Foam::label>& Foam::IndirectList<T>::addresses() const
|
||||
{
|
||||
return addresses_;
|
||||
}
|
||||
label totalMolecules = dsmc.size();
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
reduce(totalMolecules, sumOp<label>());
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
Info<< nl << "Total number of molecules added: " << totalMolecules
|
||||
<< nl << endl;
|
||||
|
||||
template<class T>
|
||||
inline const T& Foam::IndirectList<T>::operator[](const Foam::label i) const
|
||||
{
|
||||
return completeList_[addresses_[i]];
|
||||
IOstream::defaultPrecision(15);
|
||||
|
||||
if (!mesh.write())
|
||||
{
|
||||
FatalErrorIn(args.executable())
|
||||
<< "Failed writing dsmcCloud."
|
||||
<< nl << exit(FatalError);
|
||||
}
|
||||
|
||||
Info<< nl << "ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@ -306,7 +306,7 @@ label findEdge
|
||||
|
||||
FatalErrorIn("findEdge") << "Cannot find edge with labels " << v0
|
||||
<< ' ' << v1 << " in candidates " << edgeLabels
|
||||
<< " with vertices:" << IndirectList<edge>(surf.edges(), edgeLabels)()
|
||||
<< " with vertices:" << UIndirectList<edge>(surf.edges(), edgeLabels)()
|
||||
<< abort(FatalError);
|
||||
|
||||
return -1;
|
||||
@ -346,7 +346,7 @@ label otherEdge
|
||||
FatalErrorIn("otherEdge") << "Cannot find other edge on face " << faceI
|
||||
<< " verts:" << surf.localPoints()[faceI]
|
||||
<< " connected to point " << pointI
|
||||
<< " faceEdges:" << IndirectList<edge>(surf.edges(), fEdges)()
|
||||
<< " faceEdges:" << UIndirectList<edge>(surf.edges(), fEdges)()
|
||||
<< abort(FatalError);
|
||||
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user