ENH: Updated extractEulerianParticles and deps after change to barycentric tracking
This commit is contained in:
parent
e60a77442c
commit
66f473b11c
@ -314,7 +314,8 @@ void Foam::functionObjects::extractEulerianParticles::collectParticles
|
||||
tag,
|
||||
time,
|
||||
d,
|
||||
U
|
||||
U,
|
||||
false // not looking to set cell owner etc.
|
||||
);
|
||||
|
||||
cloud_.addParticle(ip);
|
||||
|
@ -76,10 +76,10 @@ Foam::Cloud<ParticleType>::Cloud
|
||||
:
|
||||
cloud(pMesh, cloudName),
|
||||
IDLList<ParticleType>(),
|
||||
geometryType_(IOPosition<Cloud<ParticleType>>::geometryType::COORDINATES),
|
||||
polyMesh_(pMesh),
|
||||
labels_(),
|
||||
globalPositionsPtr_()
|
||||
globalPositionsPtr_(),
|
||||
geometryType_(IOPosition<Cloud<ParticleType>>::geometryType::COORDINATES)
|
||||
{
|
||||
checkPatches();
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -75,9 +75,6 @@ class Cloud
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Geometry type
|
||||
typename IOPosition<Cloud<ParticleType>>::geometryType geometryType_;
|
||||
|
||||
//- Reference to the mesh database
|
||||
const polyMesh& polyMesh_;
|
||||
|
||||
@ -109,6 +106,12 @@ class Cloud
|
||||
void writeCloudUniformProperties() const;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
//- Geometry type
|
||||
typename IOPosition<Cloud<ParticleType>>::geometryType geometryType_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
friend class particle;
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -167,10 +167,10 @@ Foam::Cloud<ParticleType>::Cloud
|
||||
)
|
||||
:
|
||||
cloud(pMesh, cloudName),
|
||||
geometryType_(IOPosition<Cloud<ParticleType>>::geometryType::COORDINATES),
|
||||
polyMesh_(pMesh),
|
||||
labels_(),
|
||||
cellWallFacesPtr_()
|
||||
cellWallFacesPtr_(),
|
||||
geometryType_(IOPosition<Cloud<ParticleType>>::geometryType::COORDINATES)
|
||||
{
|
||||
checkPatches();
|
||||
|
||||
|
@ -38,6 +38,7 @@ namespace Foam
|
||||
Foam::injectedParticle::injectedParticle(const injectedParticle& p)
|
||||
:
|
||||
particle(p),
|
||||
position_(p.position_),
|
||||
tag_(p.tag_),
|
||||
soi_(p.soi_),
|
||||
d_(p.d_),
|
||||
@ -52,6 +53,7 @@ Foam::injectedParticle::injectedParticle
|
||||
)
|
||||
:
|
||||
particle(p, mesh),
|
||||
position_(p.position_),
|
||||
tag_(p.tag_),
|
||||
soi_(p.soi_),
|
||||
d_(p.d_),
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,11 +25,18 @@ Class
|
||||
Foam::injectedParticle
|
||||
|
||||
Description
|
||||
Primarly stores particle properties so that it can be injected at a later
|
||||
time. Note that this stores its own local position as opposed to the
|
||||
base particle class barycentric coordinates since the particle is not
|
||||
(usually) attached to a mesh, and instead used for post-processing.
|
||||
|
||||
SourceFiles
|
||||
injectedParticle.C
|
||||
injectedParticleIO.C
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObjects::extractEulerianParticles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef injectedParticle_H
|
||||
@ -74,6 +81,9 @@ protected:
|
||||
|
||||
// Particle properties
|
||||
|
||||
//- Position
|
||||
point position_;
|
||||
|
||||
//- Tag
|
||||
label tag_;
|
||||
|
||||
@ -125,7 +135,8 @@ public:
|
||||
const label tag,
|
||||
const scalar soi,
|
||||
const scalar d,
|
||||
const vector& U
|
||||
const vector& U,
|
||||
const bool doLocate = true
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
@ -225,6 +236,11 @@ public:
|
||||
objectRegistry& obr
|
||||
);
|
||||
|
||||
//- Write the particle position and cell
|
||||
// Note: This uses the local particle position, and bypasses the
|
||||
// barycentric description
|
||||
virtual void writePosition(Ostream&) const;
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -41,6 +41,9 @@ Foam::injectedParticleCloud::injectedParticleCloud
|
||||
:
|
||||
Cloud<injectedParticle>(mesh, cloudName, false)
|
||||
{
|
||||
geometryType_ =
|
||||
IOPosition<Cloud<injectedParticle>>::geometryType::POSITIONS;
|
||||
|
||||
if (readFields)
|
||||
{
|
||||
injectedParticle::readFields(*this);
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -33,10 +33,12 @@ inline Foam::injectedParticle::injectedParticle
|
||||
const label tag,
|
||||
const scalar soi,
|
||||
const scalar d,
|
||||
const vector& U
|
||||
const vector& U,
|
||||
const bool doLocate
|
||||
)
|
||||
:
|
||||
particle(mesh, position, -1),
|
||||
particle(mesh, position, -1, -1, -1, doLocate),
|
||||
position_(position),
|
||||
tag_(tag),
|
||||
soi_(soi),
|
||||
d_(d),
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -38,6 +38,7 @@ Foam::string Foam::injectedParticle::propertyTypes_ =
|
||||
|
||||
const std::size_t Foam::injectedParticle::sizeofFields
|
||||
(
|
||||
// Note: does not include position_
|
||||
sizeof(label) + sizeof(scalar) + sizeof(scalar) + sizeof(vector)
|
||||
);
|
||||
|
||||
@ -52,7 +53,8 @@ Foam::injectedParticle::injectedParticle
|
||||
bool newFormat
|
||||
)
|
||||
:
|
||||
particle(mesh, is, readFields, newFormat),
|
||||
particle(mesh, is, readFields, false), // force to read old positions file
|
||||
position_(Zero),
|
||||
tag_(-1),
|
||||
soi_(0.0),
|
||||
d_(0.0),
|
||||
@ -60,6 +62,11 @@ Foam::injectedParticle::injectedParticle
|
||||
{
|
||||
if (readFields)
|
||||
{
|
||||
// After the base particle class has read the fields from file and
|
||||
// constructed the necessary barcentric co-ordinates we can update the
|
||||
// particle position on this mesh
|
||||
position_ = particle::position();
|
||||
|
||||
if (is.format() == IOstream::ASCII)
|
||||
{
|
||||
tag_ = readLabel(is);
|
||||
@ -84,6 +91,8 @@ void Foam::injectedParticle::readFields(Cloud<injectedParticle>& c)
|
||||
return;
|
||||
}
|
||||
|
||||
// Note: not reading local position_ - defer to base particle class
|
||||
|
||||
particle::readFields(c);
|
||||
|
||||
IOField<label> tag(c.fieldIOobject("tag", IOobject::MUST_READ));
|
||||
@ -100,7 +109,7 @@ void Foam::injectedParticle::readFields(Cloud<injectedParticle>& c)
|
||||
|
||||
label i = 0;
|
||||
|
||||
forAllIter(Cloud<injectedParticle>, c, iter)
|
||||
forAllIters(c, iter)
|
||||
{
|
||||
injectedParticle& p = iter();
|
||||
|
||||
@ -116,8 +125,14 @@ void Foam::injectedParticle::readFields(Cloud<injectedParticle>& c)
|
||||
|
||||
void Foam::injectedParticle::writeFields(const Cloud<injectedParticle>& c)
|
||||
{
|
||||
// Force writing positions instead of coordinates
|
||||
particle::writeLagrangianCoordinates = false;
|
||||
particle::writeLagrangianPositions = true;
|
||||
|
||||
particle::writeFields(c);
|
||||
|
||||
// Note: not writing local position_ - defer to base particle class
|
||||
|
||||
label np = c.size();
|
||||
|
||||
IOField<label> tag(c.fieldIOobject("tag", IOobject::NO_READ), np);
|
||||
@ -127,7 +142,7 @@ void Foam::injectedParticle::writeFields(const Cloud<injectedParticle>& c)
|
||||
|
||||
label i = 0;
|
||||
|
||||
forAllConstIter(Cloud<injectedParticle>, c, iter)
|
||||
forAllConstIters(c, iter)
|
||||
{
|
||||
const injectedParticle& p = iter();
|
||||
|
||||
@ -152,6 +167,10 @@ void Foam::injectedParticle::writeObjects
|
||||
objectRegistry& obr
|
||||
)
|
||||
{
|
||||
// Force writing positions instead of coordinates
|
||||
particle::writeLagrangianCoordinates = false;
|
||||
particle::writeLagrangianPositions = true;
|
||||
|
||||
particle::writeObjects(c, obr);
|
||||
|
||||
label np = c.size();
|
||||
@ -163,7 +182,7 @@ void Foam::injectedParticle::writeObjects
|
||||
|
||||
label i = 0;
|
||||
|
||||
forAllConstIter(Cloud<injectedParticle>, c, iter)
|
||||
forAllConstIters(c, iter)
|
||||
{
|
||||
const injectedParticle& p = iter();
|
||||
|
||||
@ -177,6 +196,40 @@ void Foam::injectedParticle::writeObjects
|
||||
}
|
||||
|
||||
|
||||
void Foam::injectedParticle::writePosition(Ostream& os) const
|
||||
{
|
||||
if (os.format() == IOstream::ASCII)
|
||||
{
|
||||
os << position_ << token::SPACE << cell();
|
||||
}
|
||||
else
|
||||
{
|
||||
struct oldParticle
|
||||
{
|
||||
vector position;
|
||||
label celli;
|
||||
label facei;
|
||||
scalar stepFraction;
|
||||
label tetFacei;
|
||||
label tetPti;
|
||||
label origProc;
|
||||
label origId;
|
||||
} p;
|
||||
|
||||
const size_t s =
|
||||
offsetof(oldParticle, facei) - offsetof(oldParticle, position);
|
||||
|
||||
p.position = position_;
|
||||
p.celli = cell();
|
||||
|
||||
os.write(reinterpret_cast<const char*>(&p.position), s);
|
||||
}
|
||||
|
||||
// Check state of Ostream
|
||||
os.check(FUNCTION_NAME);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<
|
||||
@ -185,6 +238,8 @@ Foam::Ostream& Foam::operator<<
|
||||
const injectedParticle& p
|
||||
)
|
||||
{
|
||||
// Note: not writing local position_ - defer to base particle class
|
||||
|
||||
if (os.format() == IOstream::ASCII)
|
||||
{
|
||||
os << static_cast<const particle&>(p)
|
||||
|
@ -37,6 +37,10 @@ Foam::label Foam::particle::particleCount_ = 0;
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(particle, 0);
|
||||
bool particle::writeLagrangianCoordinates
|
||||
(
|
||||
debug::infoSwitch("writeLagrangianCoordinates", 1)
|
||||
);
|
||||
bool particle::writeLagrangianPositions
|
||||
(
|
||||
debug::infoSwitch("writeLagrangianPositions", 0)
|
||||
|
@ -87,9 +87,6 @@ class particle
|
||||
{
|
||||
// Private member data
|
||||
|
||||
//- Write particle positions file (v1706 format and earlier)
|
||||
static bool writeLagrangianPositions;
|
||||
|
||||
//- Size in bytes of the position data
|
||||
static const std::size_t sizeofPosition;
|
||||
|
||||
@ -348,6 +345,14 @@ public:
|
||||
//- Cumulative particle counter - used to provide unique ID
|
||||
static label particleCount_;
|
||||
|
||||
//- Write particle coordinates file (v1712 and later)
|
||||
//- Default is true
|
||||
static bool writeLagrangianCoordinates;
|
||||
|
||||
//- Write particle positions file (v1706 format and earlier)
|
||||
//- Default is false
|
||||
static bool writeLagrangianPositions;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -685,7 +690,7 @@ public:
|
||||
void writeCoordinates(Ostream&) const;
|
||||
|
||||
//- Write the particle position and cell
|
||||
void writePosition(Ostream&) const;
|
||||
virtual void writePosition(Ostream&) const;
|
||||
|
||||
|
||||
// Friend Operators
|
||||
|
@ -72,6 +72,7 @@ void Foam::particle::writeFields(const TrackCloudType& c)
|
||||
{
|
||||
label np = c.size();
|
||||
|
||||
if (writeLagrangianCoordinates)
|
||||
{
|
||||
IOPosition<TrackCloudType> ioP(c);
|
||||
ioP.write(np > 0);
|
||||
|
@ -27,14 +27,16 @@ copyLagrangianData()
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dir=$dir/${latestTime}/lagrangian
|
||||
udir=$dir/${latestTime}/uniform/lagrangian
|
||||
ldir=$dir/${latestTime}/lagrangian
|
||||
|
||||
if [ -d $dir ]
|
||||
then
|
||||
echo "Copying lagrangian data from $dir to 0 directory"
|
||||
\cp -r $dir 0
|
||||
echo "Copying lagrangian data from $ldir to 0 directory"
|
||||
\cp -r $ldir 0
|
||||
mkdir 0/uniform && \cp -r $udir 0/uniform
|
||||
else
|
||||
echo "Error: unable to find Lagrangian data in case $dir"
|
||||
echo "Error: unable to find Lagrangian data in case $ldir"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
@ -46,10 +48,12 @@ copyLagrangianData ${eulerianCase}
|
||||
|
||||
runApplication blockMesh
|
||||
|
||||
runApplication decomposePar
|
||||
#runApplication decomposePar
|
||||
|
||||
runParallel $(getApplication)
|
||||
#runParallel $(getApplication)
|
||||
|
||||
runApplication reconstructPar
|
||||
#runApplication reconstructPar
|
||||
|
||||
runApplication $(getApplication)
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
@ -27,14 +27,16 @@ copyLagrangianData()
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dir=$dir/${latestTime}/lagrangian
|
||||
udir=$dir/${latestTime}/uniform/lagrangian
|
||||
ldir=$dir/${latestTime}/lagrangian
|
||||
|
||||
if [ -d $dir ]
|
||||
then
|
||||
echo "Copying lagrangian data from $dir to 0 directory"
|
||||
\cp -r $dir 0
|
||||
echo "Copying lagrangian data from $ldir to 0 directory"
|
||||
\cp -r $ldir 0
|
||||
mkdir 0/uniform && \cp -r $udir 0/uniform
|
||||
else
|
||||
echo "Error: unable to find Lagrangian data in case $dir"
|
||||
echo "Error: unable to find Lagrangian data in case $ldir"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
@ -46,10 +48,13 @@ copyLagrangianData ${eulerianCase}
|
||||
|
||||
runApplication blockMesh
|
||||
|
||||
runApplication decomposePar
|
||||
#runApplication decomposePar
|
||||
|
||||
runParallel $(getApplication)
|
||||
#runParallel $(getApplication)
|
||||
|
||||
#runApplication reconstructPar
|
||||
|
||||
runApplication $(getApplication)
|
||||
|
||||
runApplication reconstructPar
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user