mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: rationalize cloud method inheritance
- a top-level cloud::nParcels() virtual, which is overloaded by the
first level of Cloud inheritance. This permits quick determination of
cloud sizes, even when retrieved from registry with the base level.
Eg,
cloud* cldPtr = mesh.cfindObject<cloud>("myCloud");
label nParcels = (cldPtr ? cldPtr->nParcels() : 0);
- make writeLagrangianPositions on by default unless explicitly
disabled in the InfoSwitches.
Flag output errors (where neither coordinates nor positions are
written) with Fatal.
- additional IOField helper functions in cloud
STYLE: simplify iterator inheritance
This commit is contained in:
committed by
Andrew Heather
parent
0cfd019b92
commit
e90eafcf18
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -48,6 +48,12 @@ Foam::cloud::geometryTypeNames
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::cloud::cloud(const objectRegistry& obr)
|
||||||
|
:
|
||||||
|
cloud(obr, defaultName)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::cloud::cloud(const objectRegistry& obr, const word& cloudName)
|
Foam::cloud::cloud(const objectRegistry& obr, const word& cloudName)
|
||||||
:
|
:
|
||||||
objectRegistry
|
objectRegistry
|
||||||
@ -67,6 +73,13 @@ Foam::cloud::cloud(const objectRegistry& obr, const word& cloudName)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::label Foam::cloud::nParcels() const
|
||||||
|
{
|
||||||
|
NotImplemented;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::cloud::autoMap(const mapPolyMesh&)
|
void Foam::cloud::autoMap(const mapPolyMesh&)
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -39,6 +39,7 @@ SourceFiles
|
|||||||
|
|
||||||
#include "objectRegistry.H"
|
#include "objectRegistry.H"
|
||||||
#include "Enum.H"
|
#include "Enum.H"
|
||||||
|
#include "point.H"
|
||||||
#include "IOField.H"
|
#include "IOField.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -46,7 +47,7 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
// Forward Declarations
|
||||||
class mapPolyMesh;
|
class mapPolyMesh;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
@ -91,8 +92,11 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct for the given objectRegistry and named cloud instance
|
//- Construct for given objectRegistry and default cloud name
|
||||||
cloud(const objectRegistry&, const word& cloudName = defaultName);
|
explicit cloud(const objectRegistry& obr);
|
||||||
|
|
||||||
|
//- Construct for given objectRegistry and named cloud instance
|
||||||
|
cloud(const objectRegistry& obr, const word& cloudName);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
@ -101,10 +105,16 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
// Sizes
|
||||||
|
|
||||||
|
//- Number of parcels for the hosting cloud
|
||||||
|
virtual label nParcels() const;
|
||||||
|
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
|
|
||||||
//- Remap the cells of particles corresponding to the
|
//- Remap the cells of particles corresponding to the
|
||||||
// mesh topology change
|
//- mesh topology change
|
||||||
virtual void autoMap(const mapPolyMesh&);
|
virtual void autoMap(const mapPolyMesh&);
|
||||||
|
|
||||||
|
|
||||||
@ -124,6 +134,40 @@ public:
|
|||||||
const label nParticle,
|
const label nParticle,
|
||||||
objectRegistry& obr
|
objectRegistry& obr
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Locate an IOField within object registry
|
||||||
|
// \return nullptr if not found or wrong type
|
||||||
|
template<class Type>
|
||||||
|
inline static const IOField<Type>* findIOField
|
||||||
|
(
|
||||||
|
const word& fieldName,
|
||||||
|
const objectRegistry& obr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return obr.cfindObject<IOField<Type>>(fieldName);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Locate the "position" IOField within object registry
|
||||||
|
// \return nullptr if not found or wrong type
|
||||||
|
inline static const IOField<point>* findIOPosition
|
||||||
|
(
|
||||||
|
const objectRegistry& obr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return obr.cfindObject<IOField<point>>("position");
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Lookup an IOField within object registry
|
||||||
|
// Fatal if not found or wrong type
|
||||||
|
template<class Type>
|
||||||
|
inline static const IOField<Type>& lookupIOField
|
||||||
|
(
|
||||||
|
const word& fieldName,
|
||||||
|
const objectRegistry& obr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return obr.lookupObject<IOField<Type>>(fieldName);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -159,7 +159,7 @@ addGeometry
|
|||||||
|
|
||||||
objPtr->writeObjects(obrTmp);
|
objPtr->writeObjects(obrTmp);
|
||||||
|
|
||||||
const auto* pointsPtr = obrTmp.findObject<vectorField>("position");
|
const auto* pointsPtr = cloud::findIOPosition(obrTmp);
|
||||||
|
|
||||||
if (!pointsPtr)
|
if (!pointsPtr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -46,7 +46,7 @@ Foam::functionObjects::runTimePostPro::geometryCloud::gatherCloud
|
|||||||
auto multiPiece = vtkSmartPointer<vtkMultiPieceDataSet>::New();
|
auto multiPiece = vtkSmartPointer<vtkMultiPieceDataSet>::New();
|
||||||
multiPiece->SetNumberOfPieces(Pstream::nProcs());
|
multiPiece->SetNumberOfPieces(Pstream::nProcs());
|
||||||
|
|
||||||
const auto* pointsPtr = obrTmp.findObject<vectorField>("position");
|
const auto* pointsPtr = cloud::findIOPosition(obrTmp);
|
||||||
|
|
||||||
if (!needsCollective())
|
if (!needsCollective())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -23,6 +23,7 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "cloud.H"
|
||||||
#include "parcelSelectionDetail.H"
|
#include "parcelSelectionDetail.H"
|
||||||
#include "scalarPredicates.H"
|
#include "scalarPredicates.H"
|
||||||
#include "labelField.H"
|
#include "labelField.H"
|
||||||
@ -167,7 +168,7 @@ bool Foam::Detail::parcelSelection::calculateFilter
|
|||||||
// Start with all parcels unselected
|
// Start with all parcels unselected
|
||||||
|
|
||||||
// Number of parcels (locally)
|
// Number of parcels (locally)
|
||||||
const auto* pointsPtr = obrTmp.findObject<vectorField>("position");
|
const auto* pointsPtr = cloud::findIOPosition(obrTmp);
|
||||||
label nParcels = pointsPtr->size();
|
label nParcels = pointsPtr->size();
|
||||||
|
|
||||||
parcelAddr_.reset();
|
parcelAddr_.reset();
|
||||||
|
|||||||
@ -71,7 +71,7 @@ bool Foam::functionObjects::dataCloud::writeCloud
|
|||||||
|
|
||||||
objPtr->writeObjects(obrTmp);
|
objPtr->writeObjects(obrTmp);
|
||||||
|
|
||||||
const auto* pointsPtr = obrTmp.findObject<vectorField>("position");
|
const auto* pointsPtr = cloud::findIOPosition(obrTmp);
|
||||||
|
|
||||||
if (!pointsPtr)
|
if (!pointsPtr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -23,6 +23,7 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "cloud.H"
|
||||||
#include "IOField.H"
|
#include "IOField.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
@ -171,7 +172,7 @@ bool Foam::functionObjects::dataCloud::writeField
|
|||||||
const objectRegistry& obrTmp
|
const objectRegistry& obrTmp
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const auto* pointsPtr = obrTmp.findObject<vectorField>("position");
|
const auto* pointsPtr = cloud::findIOPosition(obrTmp);
|
||||||
|
|
||||||
if (!pointsPtr)
|
if (!pointsPtr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -120,7 +120,7 @@ bool Foam::functionObjects::vtkCloud::writeCloud
|
|||||||
|
|
||||||
objPtr->writeObjects(obrTmp);
|
objPtr->writeObjects(obrTmp);
|
||||||
|
|
||||||
const auto* pointsPtr = obrTmp.findObject<vectorField>("position");
|
const auto* pointsPtr = cloud::findIOPosition(obrTmp);
|
||||||
|
|
||||||
if (!pointsPtr)
|
if (!pointsPtr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -140,7 +140,7 @@ class DSMCCloud
|
|||||||
Random rndGen_;
|
Random rndGen_;
|
||||||
|
|
||||||
|
|
||||||
// boundary value fields
|
// Boundary value fields
|
||||||
|
|
||||||
//- Boundary temperature
|
//- Boundary temperature
|
||||||
volScalarField boundaryT_;
|
volScalarField boundaryT_;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
@ -50,19 +50,9 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of functions
|
// Forward Declarations
|
||||||
template<class ParticleType>
|
template<class ParticleType> class Cloud;
|
||||||
class Cloud;
|
template<class ParticleType> class IOPosition;
|
||||||
|
|
||||||
template<class ParticleType>
|
|
||||||
class IOPosition;
|
|
||||||
|
|
||||||
template<class ParticleType>
|
|
||||||
Ostream& operator<<
|
|
||||||
(
|
|
||||||
Ostream&,
|
|
||||||
const Cloud<ParticleType>&
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
@ -122,14 +112,15 @@ public:
|
|||||||
|
|
||||||
typedef ParticleType particleType;
|
typedef ParticleType particleType;
|
||||||
|
|
||||||
typedef typename IDLList<ParticleType>::iterator iterator;
|
//- Parcels are just particles
|
||||||
typedef typename IDLList<ParticleType>::const_iterator const_iterator;
|
typedef ParticleType parcelType;
|
||||||
|
|
||||||
//-Runtime type information
|
|
||||||
|
//- Runtime type information
|
||||||
TypeName("Cloud");
|
TypeName("Cloud");
|
||||||
|
|
||||||
|
|
||||||
// Static data
|
// Static Data
|
||||||
|
|
||||||
//- Name of cloud properties dictionary
|
//- Name of cloud properties dictionary
|
||||||
static word cloudPropertiesName;
|
static word cloudPropertiesName;
|
||||||
@ -166,7 +157,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Return the number of particles in the cloud
|
//- Return the number of particles in the cloud
|
||||||
label size() const
|
using IDLList<ParticleType>::size;
|
||||||
|
|
||||||
|
//- Return the number of particles in the cloud
|
||||||
|
virtual label nParcels() const
|
||||||
{
|
{
|
||||||
return IDLList<ParticleType>::size();
|
return IDLList<ParticleType>::size();
|
||||||
};
|
};
|
||||||
@ -178,51 +172,27 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Iterators
|
// Iterators
|
||||||
|
|
||||||
const const_iterator begin() const
|
using typename IDLList<ParticleType>::iterator;
|
||||||
{
|
using typename IDLList<ParticleType>::const_iterator;
|
||||||
return IDLList<ParticleType>::begin();
|
|
||||||
};
|
|
||||||
|
|
||||||
const const_iterator cbegin() const
|
using IDLList<ParticleType>::begin;
|
||||||
{
|
using IDLList<ParticleType>::cbegin;
|
||||||
return IDLList<ParticleType>::cbegin();
|
using IDLList<ParticleType>::end;
|
||||||
};
|
using IDLList<ParticleType>::cend;
|
||||||
|
|
||||||
const const_iterator end() const
|
|
||||||
{
|
|
||||||
return IDLList<ParticleType>::end();
|
|
||||||
};
|
|
||||||
|
|
||||||
const const_iterator cend() const
|
|
||||||
{
|
|
||||||
return IDLList<ParticleType>::cend();
|
|
||||||
};
|
|
||||||
|
|
||||||
iterator begin()
|
|
||||||
{
|
|
||||||
return IDLList<ParticleType>::begin();
|
|
||||||
};
|
|
||||||
|
|
||||||
iterator end()
|
|
||||||
{
|
|
||||||
return IDLList<ParticleType>::end();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
|
|
||||||
void clear()
|
//- Clear the particle list
|
||||||
{
|
using IDLList<ParticleType>::clear;
|
||||||
IDLList<ParticleType>::clear();
|
|
||||||
};
|
|
||||||
|
|
||||||
//- Transfer particle to cloud
|
//- Transfer particle to cloud
|
||||||
void addParticle(ParticleType* pPtr);
|
void addParticle(ParticleType* pPtr);
|
||||||
|
|
||||||
//- Remove particle from cloud and delete
|
//- Remove particle from cloud and delete
|
||||||
void deleteParticle(ParticleType&);
|
void deleteParticle(ParticleType& p);
|
||||||
|
|
||||||
//- Remove lost particles from cloud and delete
|
//- Remove lost particles from cloud and delete
|
||||||
void deleteLostParticles();
|
void deleteLostParticles();
|
||||||
@ -289,21 +259,19 @@ public:
|
|||||||
//- Write positions to \<cloudName\>_positions.obj file
|
//- Write positions to \<cloudName\>_positions.obj file
|
||||||
void writePositions() const;
|
void writePositions() const;
|
||||||
|
|
||||||
//- Call this before a topology change. Stores the particles global
|
//- Call this before a topology change.
|
||||||
// positions in the database for use during mapping.
|
// Stores the particles global positions in the database
|
||||||
|
// for use during mapping.
|
||||||
void storeGlobalPositions() const;
|
void storeGlobalPositions() const;
|
||||||
|
|
||||||
|
|
||||||
// Ostream Operator
|
|
||||||
|
|
||||||
friend Ostream& operator<< <ParticleType>
|
|
||||||
(
|
|
||||||
Ostream&,
|
|
||||||
const Cloud<ParticleType>&
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Ostream Operator
|
||||||
|
|
||||||
|
template<class ParticleType>
|
||||||
|
Ostream& operator<<(Ostream& os, const Cloud<ParticleType>& c);
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
@ -67,10 +67,12 @@ void Foam::Cloud<ParticleType>::readCloudUniformProperties()
|
|||||||
);
|
);
|
||||||
|
|
||||||
const word procName("processor" + Foam::name(Pstream::myProcNo()));
|
const word procName("processor" + Foam::name(Pstream::myProcNo()));
|
||||||
if (uniformPropsDict.found(procName))
|
|
||||||
|
const dictionary* dictptr = uniformPropsDict.findDict(procName);
|
||||||
|
|
||||||
|
if (dictptr)
|
||||||
{
|
{
|
||||||
uniformPropsDict.subDict(procName).lookup("particleCount")
|
dictptr->readEntry("particleCount", ParticleType::particleCount_);
|
||||||
>> ParticleType::particleCount_;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -133,7 +135,7 @@ void Foam::Cloud<ParticleType>::initCloud(const bool checkClass)
|
|||||||
|
|
||||||
IOPosition<Cloud<ParticleType>> ioP(*this, geometryType_);
|
IOPosition<Cloud<ParticleType>> ioP(*this, geometryType_);
|
||||||
|
|
||||||
bool valid = ioP.headerOk();
|
const bool valid = ioP.headerOk();
|
||||||
Istream& is = ioP.readStream(checkClass ? typeName : "", valid);
|
Istream& is = ioP.readStream(checkClass ? typeName : "", valid);
|
||||||
if (valid)
|
if (valid)
|
||||||
{
|
{
|
||||||
@ -265,9 +267,9 @@ bool Foam::Cloud<ParticleType>::writeObject
|
|||||||
// * * * * * * * * * * * * * * * Ostream Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Ostream Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ParticleType>
|
template<class ParticleType>
|
||||||
Foam::Ostream& Foam::operator<<(Ostream& os, const Cloud<ParticleType>& pc)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const Cloud<ParticleType>& c)
|
||||||
{
|
{
|
||||||
pc.writeData(os);
|
c.writeData(os);
|
||||||
|
|
||||||
os.check(FUNCTION_NAME);
|
os.check(FUNCTION_NAME);
|
||||||
return os;
|
return os;
|
||||||
|
|||||||
@ -164,13 +164,7 @@ void Foam::injectedParticle::writeObjects
|
|||||||
objectRegistry& obr
|
objectRegistry& obr
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Force writing positions instead of coordinates
|
// Always writes "position", not "coordinates"
|
||||||
const bool oldWriteCoordinates = particle::writeLagrangianCoordinates;
|
|
||||||
const bool oldWritePositions = particle::writeLagrangianPositions;
|
|
||||||
|
|
||||||
particle::writeLagrangianCoordinates = false;
|
|
||||||
particle::writeLagrangianPositions = true;
|
|
||||||
|
|
||||||
particle::writeObjects(c, obr);
|
particle::writeObjects(c, obr);
|
||||||
|
|
||||||
label np = c.size();
|
label np = c.size();
|
||||||
@ -191,10 +185,6 @@ void Foam::injectedParticle::writeObjects
|
|||||||
|
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore
|
|
||||||
particle::writeLagrangianCoordinates = oldWriteCoordinates;
|
|
||||||
particle::writeLagrangianPositions = oldWritePositions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@ bool Foam::particle::writeLagrangianCoordinates = true;
|
|||||||
|
|
||||||
bool Foam::particle::writeLagrangianPositions
|
bool Foam::particle::writeLagrangianPositions
|
||||||
(
|
(
|
||||||
Foam::debug::infoSwitch("writeLagrangianPositions", 0)
|
Foam::debug::infoSwitch("writeLagrangianPositions", 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
registerInfoSwitch
|
registerInfoSwitch
|
||||||
|
|||||||
@ -53,11 +53,9 @@ Description
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
// Forward Declarations
|
||||||
class particle;
|
class particle;
|
||||||
|
|
||||||
class polyPatch;
|
class polyPatch;
|
||||||
|
|
||||||
class cyclicPolyPatch;
|
class cyclicPolyPatch;
|
||||||
class cyclicAMIPolyPatch;
|
class cyclicAMIPolyPatch;
|
||||||
class cyclicACMIPolyPatch;
|
class cyclicACMIPolyPatch;
|
||||||
@ -67,16 +65,8 @@ class symmetryPolyPatch;
|
|||||||
class wallPolyPatch;
|
class wallPolyPatch;
|
||||||
class wedgePolyPatch;
|
class wedgePolyPatch;
|
||||||
|
|
||||||
// Forward declaration of friend functions and operators
|
Ostream& operator<<(Ostream&, const particle&);
|
||||||
|
|
||||||
Ostream& operator<<
|
|
||||||
(
|
|
||||||
Ostream&,
|
|
||||||
const particle&
|
|
||||||
);
|
|
||||||
|
|
||||||
bool operator==(const particle&, const particle&);
|
bool operator==(const particle&, const particle&);
|
||||||
|
|
||||||
bool operator!=(const particle&, const particle&);
|
bool operator!=(const particle&, const particle&);
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
@ -360,7 +350,7 @@ public:
|
|||||||
static bool writeLagrangianCoordinates;
|
static bool writeLagrangianCoordinates;
|
||||||
|
|
||||||
//- Write particle positions file (v1706 format and earlier)
|
//- Write particle positions file (v1706 format and earlier)
|
||||||
//- Default is false
|
//- Default is true (disable in etc/controlDict)
|
||||||
static bool writeLagrangianPositions;
|
static bool writeLagrangianPositions;
|
||||||
|
|
||||||
|
|
||||||
@ -685,14 +675,15 @@ public:
|
|||||||
static void writeFields(const TrackCloudType& c);
|
static void writeFields(const TrackCloudType& c);
|
||||||
|
|
||||||
//- Write particle fields as objects into the obr registry
|
//- Write particle fields as objects into the obr registry
|
||||||
|
// Always writes "position", not "coordinate"
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
static void writeObjects(const CloudType& c, objectRegistry& obr);
|
static void writeObjects(const CloudType& c, objectRegistry& obr);
|
||||||
|
|
||||||
//- Write the particle barycentric coordinates and cell info
|
//- Write the particle barycentric coordinates and cell info
|
||||||
void writeCoordinates(Ostream&) const;
|
void writeCoordinates(Ostream& os) const;
|
||||||
|
|
||||||
//- Write the particle position and cell
|
//- Write the particle position and cell id
|
||||||
virtual void writePosition(Ostream&) const;
|
virtual void writePosition(Ostream& os) const;
|
||||||
|
|
||||||
|
|
||||||
// Friend Operators
|
// Friend Operators
|
||||||
|
|||||||
@ -78,6 +78,12 @@ void Foam::particle::writeFields(const TrackCloudType& c)
|
|||||||
IOPosition<TrackCloudType> ioP(c);
|
IOPosition<TrackCloudType> ioP(c);
|
||||||
ioP.write(np > 0);
|
ioP.write(np > 0);
|
||||||
}
|
}
|
||||||
|
else if (!writeLagrangianPositions)
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Must select coordinates and/or positions" << nl
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
// Optionally write positions file in v1706 format and earlier
|
// Optionally write positions file in v1706 format and earlier
|
||||||
if (writeLagrangianPositions)
|
if (writeLagrangianPositions)
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
@ -494,7 +494,10 @@ public:
|
|||||||
// Check
|
// Check
|
||||||
|
|
||||||
//- Total number of parcels
|
//- Total number of parcels
|
||||||
inline label nParcels() const;
|
virtual label nParcels() const
|
||||||
|
{
|
||||||
|
return CloudType::nParcels();
|
||||||
|
}
|
||||||
|
|
||||||
//- Total mass in system
|
//- Total mass in system
|
||||||
inline scalar massInSystem() const;
|
inline scalar massInSystem() const;
|
||||||
|
|||||||
@ -262,13 +262,6 @@ Foam::KinematicCloud<CloudType>::UIntegrator() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
|
||||||
inline Foam::label Foam::KinematicCloud<CloudType>::nParcels() const
|
|
||||||
{
|
|
||||||
return this->size();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
inline Foam::scalar Foam::KinematicCloud<CloudType>::massInSystem() const
|
inline Foam::scalar Foam::KinematicCloud<CloudType>::massInSystem() const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user