mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://opencfd:8007/home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -184,6 +184,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (nTracks == 0)
|
||||
{
|
||||
Info<< "\n No track data" << endl;
|
||||
@ -202,11 +203,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
// particle "age" property used to sort the tracks
|
||||
List<SortableList<scalar> > agePerTrack(nTracks);
|
||||
List<List<label> > particleMap(nTracks);
|
||||
|
||||
forAll(trackLengths, i)
|
||||
{
|
||||
const label length = trackLengths[i];
|
||||
agePerTrack[i].setSize(length);
|
||||
particleMap[i].setSize(length);
|
||||
}
|
||||
|
||||
// store the particle age per track
|
||||
@ -228,6 +231,7 @@ int main(int argc, char *argv[])
|
||||
const label trackI = particleToTrack[i];
|
||||
const label sampleI = trackSamples[trackI];
|
||||
agePerTrack[trackI][sampleI] = age[i];
|
||||
particleMap[trackI][sampleI] = i;
|
||||
trackSamples[trackI]++;
|
||||
}
|
||||
tage.clear();
|
||||
@ -251,21 +255,30 @@ int main(int argc, char *argv[])
|
||||
Info<< "\n Writing points" << endl;
|
||||
|
||||
{
|
||||
label offset = 0;
|
||||
forAll(agePerTrack, i)
|
||||
{
|
||||
agePerTrack[i].sort();
|
||||
|
||||
const labelList& ids = agePerTrack[i].indices();
|
||||
labelList& particleIds = particleMap[i];
|
||||
|
||||
{
|
||||
// update addressing
|
||||
List<label> sortedIds(ids);
|
||||
forAll(sortedIds, j)
|
||||
{
|
||||
sortedIds[j] = particleIds[ids[j]];
|
||||
}
|
||||
particleIds = sortedIds;
|
||||
}
|
||||
|
||||
forAll(ids, j)
|
||||
{
|
||||
const label localId = offset + ids[j];
|
||||
const label localId = particleIds[j];
|
||||
const vector& pos = particles[localId].position();
|
||||
os << pos.x() << ' ' << pos.y() << ' ' << pos.z()
|
||||
<< nl;
|
||||
}
|
||||
|
||||
offset += trackLengths[i];
|
||||
}
|
||||
}
|
||||
|
||||
@ -278,13 +291,14 @@ int main(int argc, char *argv[])
|
||||
// Write ids of track points to file
|
||||
{
|
||||
label globalPtI = 0;
|
||||
forAll(agePerTrack, i)
|
||||
forAll(particleMap, i)
|
||||
{
|
||||
os << agePerTrack[i].size() << nl;
|
||||
os << particleMap[i].size() << nl;
|
||||
|
||||
forAll(agePerTrack[i], j)
|
||||
forAll(particleMap[i], j)
|
||||
{
|
||||
os << ' ' << globalPtI++;
|
||||
|
||||
if (((j + 1) % 10 == 0) && (j != 0))
|
||||
{
|
||||
os << nl;
|
||||
@ -303,14 +317,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "\n Processing fields" << nl << endl;
|
||||
|
||||
processFields<label>(os, agePerTrack, userFields, cloudObjs);
|
||||
processFields<scalar>(os, agePerTrack, userFields, cloudObjs);
|
||||
processFields<vector>(os, agePerTrack, userFields, cloudObjs);
|
||||
processFields<label>(os, particleMap, userFields, cloudObjs);
|
||||
processFields<scalar>(os, particleMap, userFields, cloudObjs);
|
||||
processFields<vector>(os, particleMap, userFields, cloudObjs);
|
||||
processFields<sphericalTensor>
|
||||
(os, agePerTrack, userFields, cloudObjs);
|
||||
(os, particleMap, userFields, cloudObjs);
|
||||
processFields<symmTensor>
|
||||
(os, agePerTrack, userFields, cloudObjs);
|
||||
processFields<tensor>(os, agePerTrack, userFields, cloudObjs);
|
||||
(os, particleMap, userFields, cloudObjs);
|
||||
processFields<tensor>(os, particleMap, userFields, cloudObjs);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -57,39 +57,57 @@ tmp<Field<Type> > readParticleField
|
||||
return tmp<Field<Type> >(new Field<Type>(newField.xfer()));
|
||||
}
|
||||
|
||||
Info<< "error: cloud field name " << name << " not found" << endl;
|
||||
FatalErrorIn
|
||||
(
|
||||
"template<class Type>"
|
||||
"void readParticleField"
|
||||
"("
|
||||
"const word&, "
|
||||
"const IOobjectList"
|
||||
")"
|
||||
)
|
||||
<< "error: cloud field name " << name << " not found"
|
||||
<< abort(FatalError);
|
||||
|
||||
return Field<Type>::null();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
PtrList<List<Type> > readFields
|
||||
void readFields
|
||||
(
|
||||
PtrList<List<Type> >& values,
|
||||
const List<word>& fields,
|
||||
const List<word>& fieldNames,
|
||||
const IOobjectList& cloudObjs
|
||||
)
|
||||
{
|
||||
IOobjectList objects(cloudObjs.lookupClass(IOField<Type>::typeName));
|
||||
|
||||
label fieldI = 0;
|
||||
forAllConstIter(IOobjectList, objects, iter)
|
||||
forAll(fieldNames, j)
|
||||
{
|
||||
const IOobject& obj = *iter();
|
||||
forAll(fields, j)
|
||||
const IOobject* obj = objects.lookup(fieldNames[j]);
|
||||
if (obj != NULL)
|
||||
{
|
||||
if (obj.name() == fields[j])
|
||||
{
|
||||
Info<< " reading field " << obj.name() << endl;
|
||||
IOField<Type> newField(obj);
|
||||
values.set(fieldI++, new List<Type>(newField.xfer()));
|
||||
break;
|
||||
}
|
||||
Info<< " reading field " << fieldNames[j] << endl;
|
||||
IOField<Type> newField(*obj);
|
||||
values.set(j, new List<Type>(newField.xfer()));
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"template<class Type>"
|
||||
"void readFields"
|
||||
"("
|
||||
"PtrList<List<Type> >&, "
|
||||
"const List<word>&, "
|
||||
"const IOobjectList&"
|
||||
")"
|
||||
)
|
||||
<< "Unable to read field " << fieldNames[j]
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
|
||||
@ -109,7 +127,7 @@ void writeVTKFields
|
||||
(
|
||||
OFstream& os,
|
||||
const PtrList<List<Type> >& values,
|
||||
const List<SortableList<scalar> >& agePerTrack,
|
||||
const List<List<label> >& addr,
|
||||
const List<word>& fieldNames
|
||||
)
|
||||
{
|
||||
@ -121,9 +139,9 @@ void writeVTKFields
|
||||
os << nl << fieldNames[fieldI] << ' ' << pTraits<Type>::nComponents
|
||||
<< ' ' << values[fieldI].size() << " float" << nl;
|
||||
label offset = 0;
|
||||
forAll(agePerTrack, trackI)
|
||||
forAll(addr, trackI)
|
||||
{
|
||||
const List<label> ids = agePerTrack[trackI].indices() + offset;
|
||||
const List<label> ids(addr[trackI]);
|
||||
|
||||
List<Type> data(UIndirectList<Type>(values[fieldI], ids));
|
||||
label nData = data.size() - 1;
|
||||
@ -149,7 +167,7 @@ template<class Type>
|
||||
void processFields
|
||||
(
|
||||
OFstream& os,
|
||||
const List<SortableList<scalar> >& agePerTrack,
|
||||
const List<List<label> >& addr,
|
||||
const List<word>& userFieldNames,
|
||||
const IOobjectList& cloudObjs
|
||||
)
|
||||
@ -176,12 +194,14 @@ void processFields
|
||||
(
|
||||
os,
|
||||
values,
|
||||
agePerTrack,
|
||||
fieldNames.xfer()
|
||||
addr,
|
||||
fieldNames
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -49,7 +49,7 @@ namespace Foam
|
||||
);
|
||||
|
||||
template<class Type>
|
||||
PtrList<List<Type> > readFields
|
||||
void readFields
|
||||
(
|
||||
PtrList<List<Type> >& values,
|
||||
const List<word>& fields,
|
||||
|
||||
@ -165,6 +165,10 @@ surfaces
|
||||
|
||||
//- Optional: restrict to a particular zone
|
||||
// zone zone1;
|
||||
|
||||
//- Optional: do not triangulate (only for surfaceFormats that support
|
||||
// polygons)
|
||||
//triangulate false;
|
||||
}
|
||||
|
||||
interpolatedPlane
|
||||
|
||||
@ -1,13 +1,19 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/postProcessing/postCalc \
|
||||
-I$(LIB_SRC)/turbulenceModels \
|
||||
-I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/turbulenceModels \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions \
|
||||
-I$(LIB_SRC)/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
$(FOAM_LIBBIN)/postCalc.o \
|
||||
-lincompressibleRASModels \
|
||||
-lincompressibleTransportModels \
|
||||
-lincompressibleRASModels \
|
||||
-lfluidThermophysicalModels \
|
||||
-lspecie \
|
||||
-lcompressibleRASModels \
|
||||
-lfiniteVolume \
|
||||
-lgenericPatchFields
|
||||
-lgenericPatchFields \
|
||||
-lmeshTools \
|
||||
-lsampling
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,35 +29,140 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "calc.H"
|
||||
#include "fvCFD.H"
|
||||
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
|
||||
#include "RASModel.H"
|
||||
#include "incompressible/turbulenceModel/turbulenceModel.H"
|
||||
|
||||
#include "fluidThermo.H"
|
||||
#include "compressible/turbulenceModel/turbulenceModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
|
||||
void calcIncompressibleR
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const Time& runTime,
|
||||
const volVectorField& U
|
||||
)
|
||||
{
|
||||
#include "createFields.H"
|
||||
#include "createPhi.H"
|
||||
|
||||
Info<< "\nCalculating the Reynolds Stress R\n" << endl;
|
||||
singlePhaseTransportModel laminarTransport(U, phi);
|
||||
|
||||
volSymmTensorField R
|
||||
autoPtr<incompressible::turbulenceModel> model
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"R",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
RASModel->R()
|
||||
incompressible::turbulenceModel::New(U, phi, laminarTransport)
|
||||
);
|
||||
|
||||
R.write();
|
||||
Info<< "Writing R field" << nl << endl;
|
||||
|
||||
Info<< "End" << endl;
|
||||
model->R()().write();
|
||||
}
|
||||
|
||||
|
||||
void calcCompressibleR
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const Time& runTime,
|
||||
const volVectorField& U
|
||||
)
|
||||
{
|
||||
IOobject rhoHeader
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (!rhoHeader.headerOk())
|
||||
{
|
||||
Info<< " no " << rhoHeader.name() <<" field" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
Info<< "Reading field rho\n" << endl;
|
||||
volScalarField rho(rhoHeader, mesh);
|
||||
|
||||
#include "compressibleCreatePhi.H"
|
||||
|
||||
autoPtr<fluidThermo> pThermo(fluidThermo::New(mesh));
|
||||
fluidThermo& thermo = pThermo();
|
||||
|
||||
autoPtr<compressible::turbulenceModel> model
|
||||
(
|
||||
compressible::turbulenceModel::New
|
||||
(
|
||||
rho,
|
||||
U,
|
||||
phi,
|
||||
thermo
|
||||
)
|
||||
);
|
||||
|
||||
Info<< "Writing R field" << nl << endl;
|
||||
|
||||
model->R()().write();
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
timeSelector::addOptions();
|
||||
|
||||
#include "addRegionOption.H"
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
"compressible",
|
||||
"calculate compressible R"
|
||||
);
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
#include "createNamedMesh.H"
|
||||
|
||||
const bool compressible = args.optionFound("compressible");
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
|
||||
IOobject UHeader
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (UHeader.headerOk())
|
||||
{
|
||||
Info<< "Reading field " << UHeader.name() << nl << endl;
|
||||
volVectorField U(UHeader, mesh);
|
||||
|
||||
if (compressible)
|
||||
{
|
||||
calcCompressibleR(mesh, runTime, U);
|
||||
}
|
||||
else
|
||||
{
|
||||
calcIncompressibleR(mesh, runTime, U);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< " no " << UHeader.name() << " field" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,22 +0,0 @@
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
#include "createPhi.H"
|
||||
|
||||
singlePhaseTransportModel laminarTransport(U, phi);
|
||||
|
||||
autoPtr<incompressible::RASModel> RASModel
|
||||
(
|
||||
incompressible::RASModel::New(U, phi, laminarTransport)
|
||||
);
|
||||
Reference in New Issue
Block a user