mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'feature-particle-patch-postpro-filtering' into 'develop'
Feature particle patch postpro filtering
### Summary
Adds options to write particle-patch interactions to file, and to select particle fields to post-process for the `patchPostProcessing` cloud function object
### Resolved bugs (If applicable)
none
### Details of new models (If applicable)
Cloud patch interaction models:
Optionally write patch interaction statistics, e.g. number and mass of particles that stick, escape etc. to file using the optional `writeToFile` entry, e.g.
```
localInteractionCoeffs
{
patches
(
"(walls|cyc.*)"
{
type rebound;
}
"inlet|outlet"
{
type escape;
}
);
// New optional entry
writeToFile yes;
}
```
Cloud function objects:
New `fields` optional entry can be used to select which particle fields to post-process; if empty or the entry is not given all fields are written (to provide backwards compatibility)
```
patchPostProcessing1
{
type patchPostProcessing;
// Optional new entry
fields (position "U.*" d T nParticle);
maxStoredParcels 20;
patches
(
cycLeft_half0
cycLeft_half1
);
}
```
See the `$FOAM_TUTORIALS/lagrangian/reactingParcelFilm/filter` tutorial for an example
### Risks
Low risk
See merge request Development/openfoam!301
This commit is contained in:
@ -294,6 +294,18 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// I-O
|
||||||
|
|
||||||
|
//- Write individual parcel properties to stream
|
||||||
|
void writeProperties
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const wordRes& filters,
|
||||||
|
const word& delim,
|
||||||
|
const bool namesOnly = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
// Ostream Operator
|
// Ostream Operator
|
||||||
|
|
||||||
friend Ostream& operator<<(Ostream& os, const DTRMParticle& p);
|
friend Ostream& operator<<(Ostream& os, const DTRMParticle& p);
|
||||||
|
|||||||
@ -88,6 +88,31 @@ Foam::DTRMParticle::DTRMParticle
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::DTRMParticle::writeProperties
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const wordRes& filters,
|
||||||
|
const word& delim,
|
||||||
|
const bool namesOnly
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
particle::writeProperties(os, filters, delim, namesOnly);
|
||||||
|
|
||||||
|
#undef writeProp
|
||||||
|
#define writeProp(Name, Value) \
|
||||||
|
particle::writeProperty(os, Name, Value, namesOnly, delim, filters)
|
||||||
|
|
||||||
|
writeProp("p0", p0_);
|
||||||
|
writeProp("p1", p1_);
|
||||||
|
writeProp("I0", I0_);
|
||||||
|
writeProp("I", I_);
|
||||||
|
writeProp("dA", dA_);
|
||||||
|
writeProp("transmissiveId", transmissiveId_);
|
||||||
|
|
||||||
|
#undef writeProp
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::Ostream& Foam::operator<<(Ostream& os, const DTRMParticle& p)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const DTRMParticle& p)
|
||||||
{
|
{
|
||||||
if (os.format() == IOstream::ASCII)
|
if (os.format() == IOstream::ASCII)
|
||||||
|
|||||||
@ -415,7 +415,7 @@ bool Foam::functionObjects::sizeDistribution::execute()
|
|||||||
bool Foam::functionObjects::sizeDistribution::write()
|
bool Foam::functionObjects::sizeDistribution::write()
|
||||||
{
|
{
|
||||||
writeFileHeader();
|
writeFileHeader();
|
||||||
writeTime(file());
|
writeCurrentTime(file());
|
||||||
|
|
||||||
Log << type() << " " << name() << " write" << nl;
|
Log << type() << " " << name() << " write" << nl;
|
||||||
|
|
||||||
|
|||||||
@ -153,19 +153,34 @@ Foam::Omanip<int> Foam::functionObjects::writeFile::valueWidth
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::functionObjects::writeFile::writeFile(const writeFile& wf)
|
||||||
|
:
|
||||||
|
fileObr_(wf.fileObr_),
|
||||||
|
prefix_(wf.prefix_),
|
||||||
|
fileName_(wf.fileName_),
|
||||||
|
filePtr_(),
|
||||||
|
writePrecision_(wf.writePrecision_),
|
||||||
|
writeToFile_(wf.writeToFile_),
|
||||||
|
writtenHeader_(wf.writtenHeader_),
|
||||||
|
useUserTime_(wf.useUserTime_),
|
||||||
|
startTime_(wf.startTime_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::functionObjects::writeFile::writeFile
|
Foam::functionObjects::writeFile::writeFile
|
||||||
(
|
(
|
||||||
const objectRegistry& obr,
|
const objectRegistry& obr,
|
||||||
const word& prefix,
|
const fileName& prefix,
|
||||||
const word& file
|
const word& name,
|
||||||
|
const bool writeToFile
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fileObr_(obr),
|
fileObr_(obr),
|
||||||
prefix_(prefix),
|
prefix_(prefix),
|
||||||
fileName_(file),
|
fileName_(name),
|
||||||
filePtr_(),
|
filePtr_(),
|
||||||
writePrecision_(IOstream::defaultPrecision()),
|
writePrecision_(IOstream::defaultPrecision()),
|
||||||
writeToFile_(true),
|
writeToFile_(writeToFile),
|
||||||
writtenHeader_(false),
|
writtenHeader_(false),
|
||||||
useUserTime_(true),
|
useUserTime_(true),
|
||||||
startTime_(obr.time().startTime().value())
|
startTime_(obr.time().startTime().value())
|
||||||
@ -175,12 +190,13 @@ Foam::functionObjects::writeFile::writeFile
|
|||||||
Foam::functionObjects::writeFile::writeFile
|
Foam::functionObjects::writeFile::writeFile
|
||||||
(
|
(
|
||||||
const objectRegistry& obr,
|
const objectRegistry& obr,
|
||||||
const word& prefix,
|
const fileName& prefix,
|
||||||
const word& file,
|
const word& name,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const bool writeToFile
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
writeFile(obr, prefix, file)
|
writeFile(obr, prefix, name, writeToFile)
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
|
|
||||||
@ -200,7 +216,7 @@ bool Foam::functionObjects::writeFile::read(const dictionary& dict)
|
|||||||
|
|
||||||
// Only write on master
|
// Only write on master
|
||||||
writeToFile_ =
|
writeToFile_ =
|
||||||
Pstream::master() && dict.lookupOrDefault("writeToFile", true);
|
Pstream::master() && dict.lookupOrDefault("writeToFile", writeToFile_);
|
||||||
|
|
||||||
// Use user time, e.g. CA deg in preference to seconds
|
// Use user time, e.g. CA deg in preference to seconds
|
||||||
useUserTime_ = dict.lookupOrDefault("useUserTime", true);
|
useUserTime_ = dict.lookupOrDefault("useUserTime", true);
|
||||||
@ -275,7 +291,7 @@ void Foam::functionObjects::writeFile::writeHeader
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::writeFile::writeTime(Ostream& os) const
|
void Foam::functionObjects::writeFile::writeCurrentTime(Ostream& os) const
|
||||||
{
|
{
|
||||||
const scalar timeValue =
|
const scalar timeValue =
|
||||||
(
|
(
|
||||||
|
|||||||
@ -68,7 +68,7 @@ protected:
|
|||||||
const objectRegistry& fileObr_;
|
const objectRegistry& fileObr_;
|
||||||
|
|
||||||
//- Prefix
|
//- Prefix
|
||||||
const word prefix_;
|
const fileName prefix_;
|
||||||
|
|
||||||
//- Name of file
|
//- Name of file
|
||||||
word fileName_;
|
word fileName_;
|
||||||
@ -124,9 +124,6 @@ protected:
|
|||||||
Omanip<int> valueWidth(const label offset = 0) const;
|
Omanip<int> valueWidth(const label offset = 0) const;
|
||||||
|
|
||||||
|
|
||||||
//- No copy construct
|
|
||||||
writeFile(const writeFile&) = delete;
|
|
||||||
|
|
||||||
//- No copy assignment
|
//- No copy assignment
|
||||||
void operator=(const writeFile&) = delete;
|
void operator=(const writeFile&) = delete;
|
||||||
|
|
||||||
@ -143,8 +140,9 @@ public:
|
|||||||
writeFile
|
writeFile
|
||||||
(
|
(
|
||||||
const objectRegistry& obr,
|
const objectRegistry& obr,
|
||||||
const word& prefix,
|
const fileName& prefix,
|
||||||
const word& file = "undefined"
|
const word& name = "undefined",
|
||||||
|
const bool writeToFile = true
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from objectRegistry, prefix, fileName
|
//- Construct from objectRegistry, prefix, fileName
|
||||||
@ -152,11 +150,15 @@ public:
|
|||||||
writeFile
|
writeFile
|
||||||
(
|
(
|
||||||
const objectRegistry& obr,
|
const objectRegistry& obr,
|
||||||
const word& prefix,
|
const fileName& prefix,
|
||||||
const word& file,
|
const word& name,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const bool writeToFile = true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Construct copy
|
||||||
|
writeFile(const writeFile& wf);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~writeFile() = default;
|
virtual ~writeFile() = default;
|
||||||
@ -186,7 +188,7 @@ public:
|
|||||||
virtual void writeHeader(Ostream& os, const string& str) const;
|
virtual void writeHeader(Ostream& os, const string& str) const;
|
||||||
|
|
||||||
//- Write the current time to stream
|
//- Write the current time to stream
|
||||||
virtual void writeTime(Ostream& os) const;
|
virtual void writeCurrentTime(Ostream& os) const;
|
||||||
|
|
||||||
//- Write a break marker to the stream
|
//- Write a break marker to the stream
|
||||||
virtual void writeBreak(Ostream& os) const;
|
virtual void writeBreak(Ostream& os) const;
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -169,6 +170,17 @@ bool Foam::subModelBase::writeTime() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::fileName Foam::subModelBase::localPath() const
|
||||||
|
{
|
||||||
|
if (modelName_ != word::null)
|
||||||
|
{
|
||||||
|
return modelName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::subModelBase::getModelDict
|
bool Foam::subModelBase::getModelDict
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -157,6 +158,9 @@ public:
|
|||||||
//- Flag to indicate when to write a property
|
//- Flag to indicate when to write a property
|
||||||
virtual bool writeTime() const;
|
virtual bool writeTime() const;
|
||||||
|
|
||||||
|
//- Output directory
|
||||||
|
virtual fileName localPath() const;
|
||||||
|
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
|
|
||||||
|
|||||||
@ -174,7 +174,7 @@ bool Foam::functionObjects::blendingFactor::write()
|
|||||||
<< " blended cells : " << nCellsBlended << nl
|
<< " blended cells : " << nCellsBlended << nl
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
writeTime(file());
|
writeCurrentTime(file());
|
||||||
|
|
||||||
file()
|
file()
|
||||||
<< token::TAB << nCellsScheme1
|
<< token::TAB << nCellsScheme1
|
||||||
|
|||||||
@ -121,7 +121,7 @@ bool Foam::functionObjects::continuityError::write()
|
|||||||
|
|
||||||
Ostream& os = file();
|
Ostream& os = file();
|
||||||
|
|
||||||
writeTime(os);
|
writeCurrentTime(os);
|
||||||
|
|
||||||
os << local << tab
|
os << local << tab
|
||||||
<< global << tab
|
<< global << tab
|
||||||
|
|||||||
@ -86,7 +86,7 @@ void Foam::functionObjects::fieldExtents::calcFieldExtents
|
|||||||
|
|
||||||
Log << "field: " << fieldName << nl;
|
Log << "field: " << fieldName << nl;
|
||||||
|
|
||||||
writeTime(file());
|
writeCurrentTime(file());
|
||||||
|
|
||||||
tmp<volScalarField> tmask = calcMask<Type>(*fieldPtr);
|
tmp<volScalarField> tmask = calcMask<Type>(*fieldPtr);
|
||||||
const volScalarField& mask = tmask();
|
const volScalarField& mask = tmask();
|
||||||
|
|||||||
@ -152,7 +152,7 @@ bool Foam::functionObjects::fieldMinMax::write()
|
|||||||
{
|
{
|
||||||
writeFileHeader(file());
|
writeFileHeader(file());
|
||||||
|
|
||||||
if (!location_) writeTime(file());
|
if (!location_) writeCurrentTime(file());
|
||||||
Log << type() << " " << name() << " write:" << nl;
|
Log << type() << " " << name() << " write:" << nl;
|
||||||
|
|
||||||
for (const word& fieldName : fieldSet_.selectionNames())
|
for (const word& fieldName : fieldSet_.selectionNames())
|
||||||
|
|||||||
@ -50,7 +50,7 @@ void Foam::functionObjects::fieldMinMax::output
|
|||||||
|
|
||||||
if (location_)
|
if (location_)
|
||||||
{
|
{
|
||||||
writeTime(file());
|
writeCurrentTime(file);
|
||||||
|
|
||||||
writeTabbed(file, fieldName);
|
writeTabbed(file, fieldName);
|
||||||
|
|
||||||
|
|||||||
@ -160,7 +160,7 @@ bool Foam::functionObjects::fieldValues::fieldValueDelta::write()
|
|||||||
region1Ptr_->write();
|
region1Ptr_->write();
|
||||||
region2Ptr_->write();
|
region2Ptr_->write();
|
||||||
|
|
||||||
writeTime(file());
|
writeCurrentTime(file());
|
||||||
|
|
||||||
Log << type() << " " << name() << " write:" << endl;
|
Log << type() << " " << name() << " write:" << endl;
|
||||||
|
|
||||||
|
|||||||
@ -992,7 +992,7 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
|
|||||||
|
|
||||||
if (operation_ != opNone)
|
if (operation_ != opNone)
|
||||||
{
|
{
|
||||||
writeTime(file());
|
writeCurrentTime(file());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (writeArea_)
|
if (writeArea_)
|
||||||
|
|||||||
@ -254,7 +254,7 @@ bool Foam::functionObjects::fieldValues::volFieldValue::write()
|
|||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
writeTime(file());
|
writeCurrentTime(file());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only some operations need the cell volume
|
// Only some operations need the cell volume
|
||||||
|
|||||||
@ -334,7 +334,7 @@ void Foam::functionObjects::momentum::writeValues(Ostream& os)
|
|||||||
|
|
||||||
if (writeToFile())
|
if (writeToFile())
|
||||||
{
|
{
|
||||||
writeTime(os);
|
writeCurrentTime(os);
|
||||||
|
|
||||||
os << tab << sumMomentum_;
|
os << tab << sumMomentum_;
|
||||||
|
|
||||||
|
|||||||
@ -728,7 +728,7 @@ bool Foam::functionObjects::stabilityBlendingFactor::write()
|
|||||||
|
|
||||||
if (writeToFile_)
|
if (writeToFile_)
|
||||||
{
|
{
|
||||||
writeTime(file());
|
writeCurrentTime(file());
|
||||||
|
|
||||||
file()
|
file()
|
||||||
<< tab << nCellsScheme1
|
<< tab << nCellsScheme1
|
||||||
|
|||||||
@ -285,7 +285,7 @@ bool Foam::functionObjects::wallHeatFlux::write()
|
|||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
writeTime(file());
|
writeCurrentTime(file());
|
||||||
|
|
||||||
file()
|
file()
|
||||||
<< token::TAB << pp.name()
|
<< token::TAB << pp.name()
|
||||||
|
|||||||
@ -245,7 +245,7 @@ bool Foam::functionObjects::wallShearStress::write()
|
|||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
writeTime(file());
|
writeCurrentTime(file());
|
||||||
|
|
||||||
file()
|
file()
|
||||||
<< token::TAB << pp.name()
|
<< token::TAB << pp.name()
|
||||||
|
|||||||
@ -216,7 +216,7 @@ bool Foam::functionObjects::yPlus::write()
|
|||||||
<< " y+ : min = " << minYplus << ", max = " << maxYplus
|
<< " y+ : min = " << minYplus << ", max = " << maxYplus
|
||||||
<< ", average = " << avgYplus << nl;
|
<< ", average = " << avgYplus << nl;
|
||||||
|
|
||||||
writeTime(file());
|
writeCurrentTime(file());
|
||||||
file()
|
file()
|
||||||
<< token::TAB << patch.name()
|
<< token::TAB << patch.name()
|
||||||
<< token::TAB << minYplus
|
<< token::TAB << minYplus
|
||||||
|
|||||||
@ -209,7 +209,7 @@ void Foam::functionObjects::forceCoeffs::writeBinData
|
|||||||
Ostream& os
|
Ostream& os
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
writeTime(os);
|
writeCurrentTime(os);
|
||||||
|
|
||||||
for (label bini = 0; bini < nBin_; ++bini)
|
for (label bini = 0; bini < nBin_; ++bini)
|
||||||
{
|
{
|
||||||
@ -411,7 +411,7 @@ bool Foam::functionObjects::forceCoeffs::execute()
|
|||||||
|
|
||||||
if (writeToFile())
|
if (writeToFile())
|
||||||
{
|
{
|
||||||
writeTime(coeffFilePtr_());
|
writeCurrentTime(coeffFilePtr_());
|
||||||
coeffFilePtr_()
|
coeffFilePtr_()
|
||||||
<< tab << CdTot << tab << CsTot << tab << ClTot
|
<< tab << CdTot << tab << CsTot << tab << ClTot
|
||||||
<< tab << CmRollTot << tab << CmPitchTot << tab << CmYawTot
|
<< tab << CmRollTot << tab << CmPitchTot << tab << CmYawTot
|
||||||
|
|||||||
@ -601,7 +601,7 @@ void Foam::functionObjects::forces::writeIntegratedForceMoment
|
|||||||
{
|
{
|
||||||
Ostream& os = osPtr();
|
Ostream& os = osPtr();
|
||||||
|
|
||||||
writeTime(os);
|
writeCurrentTime(os);
|
||||||
|
|
||||||
os << tab << total
|
os << tab << total
|
||||||
<< tab << pressure
|
<< tab << pressure
|
||||||
@ -668,7 +668,7 @@ void Foam::functionObjects::forces::writeBinnedForceMoment
|
|||||||
|
|
||||||
Ostream& os = osPtr();
|
Ostream& os = osPtr();
|
||||||
|
|
||||||
writeTime(os);
|
writeCurrentTime(os);
|
||||||
|
|
||||||
forAll(f[0], i)
|
forAll(f[0], i)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -147,7 +147,7 @@ bool Foam::functionObjects::cloudInfo::write()
|
|||||||
{
|
{
|
||||||
auto& os = files(cloudi);
|
auto& os = files(cloudi);
|
||||||
|
|
||||||
writeTime(os);
|
writeCurrentTime(os);
|
||||||
os
|
os
|
||||||
<< token::TAB << nTotParcels
|
<< token::TAB << nTotParcels
|
||||||
<< token::TAB << totMass
|
<< token::TAB << totMass
|
||||||
|
|||||||
@ -182,7 +182,7 @@ bool Foam::functionObjects::solverInfo::execute()
|
|||||||
initialised_ = true;
|
initialised_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
writeTime(file());
|
writeCurrentTime(file());
|
||||||
|
|
||||||
for (const word& fieldName : fieldSet_.selectionNames())
|
for (const word& fieldName : fieldSet_.selectionNames())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -103,7 +103,7 @@ bool Foam::functionObjects::timeInfo::write()
|
|||||||
{
|
{
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
writeTime(file());
|
writeCurrentTime(file());
|
||||||
|
|
||||||
const scalar cpuTimeNow(time_.elapsedCpuTime());
|
const scalar cpuTimeNow(time_.elapsedCpuTime());
|
||||||
const scalar clockTimeNow(time_.elapsedClockTime());
|
const scalar clockTimeNow(time_.elapsedClockTime());
|
||||||
|
|||||||
@ -219,6 +219,15 @@ public:
|
|||||||
//- Read fields
|
//- Read fields
|
||||||
static void readFields(Cloud<injectedParticle>& c);
|
static void readFields(Cloud<injectedParticle>& c);
|
||||||
|
|
||||||
|
//- Write individual parcel properties to stream
|
||||||
|
void writeProperties
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const wordRes& filters,
|
||||||
|
const word& delim,
|
||||||
|
const bool namesOnly
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Write fields
|
//- Write fields
|
||||||
static void writeFields(const Cloud<injectedParticle>& c);
|
static void writeFields(const Cloud<injectedParticle>& c);
|
||||||
|
|
||||||
|
|||||||
@ -172,6 +172,29 @@ void Foam::injectedParticle::writeFields(const Cloud<injectedParticle>& c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::injectedParticle::writeProperties
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const wordRes& filters,
|
||||||
|
const word& delim,
|
||||||
|
const bool namesOnly
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
particle::writeProperties(os, filters, delim, namesOnly);
|
||||||
|
|
||||||
|
#undef writeProp
|
||||||
|
#define writeProp(Name, Value) \
|
||||||
|
particle::writeProperty(os, Name, Value, namesOnly, delim, filters)
|
||||||
|
|
||||||
|
writeProp("tag", tag_);
|
||||||
|
writeProp("soi", soi_);
|
||||||
|
writeProp("d", d_);
|
||||||
|
writeProp("U", U_);
|
||||||
|
|
||||||
|
#undef writeProp
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::injectedParticle::readObjects
|
void Foam::injectedParticle::readObjects
|
||||||
(
|
(
|
||||||
Cloud<injectedParticle>& c,
|
Cloud<injectedParticle>& c,
|
||||||
|
|||||||
@ -666,6 +666,41 @@ public:
|
|||||||
|
|
||||||
// I-O
|
// I-O
|
||||||
|
|
||||||
|
//- Write the name representation to stream
|
||||||
|
template<class Type>
|
||||||
|
static void writePropertyName
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const word& name,
|
||||||
|
const word& delim
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Write a named particle property to stream,
|
||||||
|
//- optionally filtered based on its name
|
||||||
|
template<class Type>
|
||||||
|
static void writeProperty
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const word& name,
|
||||||
|
const Type& value,
|
||||||
|
const bool nameOnly,
|
||||||
|
const word& delim,
|
||||||
|
const wordRes& filters = wordRes::null()
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Write a named particle property list to stream,
|
||||||
|
//- optionally filtered based on its name
|
||||||
|
template<class Type>
|
||||||
|
static void writeProperty
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const word& name,
|
||||||
|
const Field<Type>& values,
|
||||||
|
const bool nameOnly,
|
||||||
|
const word& delim,
|
||||||
|
const wordRes& filters = wordRes::null()
|
||||||
|
);
|
||||||
|
|
||||||
//- Read the fields associated with the owner cloud
|
//- Read the fields associated with the owner cloud
|
||||||
template<class TrackCloudType>
|
template<class TrackCloudType>
|
||||||
static void readFields(TrackCloudType& c);
|
static void readFields(TrackCloudType& c);
|
||||||
@ -674,6 +709,15 @@ public:
|
|||||||
template<class TrackCloudType>
|
template<class TrackCloudType>
|
||||||
static void writeFields(const TrackCloudType& c);
|
static void writeFields(const TrackCloudType& c);
|
||||||
|
|
||||||
|
//- Write individual particle properties to stream
|
||||||
|
void writeProperties
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const wordRes& filters,
|
||||||
|
const word& delim,
|
||||||
|
const bool namesOnly
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Read particle fields as objects from the obr registry
|
//- Read particle fields as objects from the obr registry
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
static void readObjects(CloudType& c, const objectRegistry& obr);
|
static void readObjects(CloudType& c, const objectRegistry& obr);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2018 OpenCFD Ltd.
|
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -193,6 +193,32 @@ Foam::particle::particle
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::particle::writeProperties
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const wordRes& filters,
|
||||||
|
const word& delim,
|
||||||
|
const bool namesOnly
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
#undef writeProp
|
||||||
|
#define writeProp(Name, Value) \
|
||||||
|
particle::writeProperty(os, Name, Value, namesOnly, delim, filters)
|
||||||
|
|
||||||
|
writeProp("coordinates", coordinates_);
|
||||||
|
writeProp("position", position());
|
||||||
|
writeProp("celli", celli_);
|
||||||
|
writeProp("tetFacei", tetFacei_);
|
||||||
|
writeProp("tetPti", tetPti_);
|
||||||
|
writeProp("facei", facei_);
|
||||||
|
writeProp("stepFraction", stepFraction_);
|
||||||
|
writeProp("origProc", origProc_);
|
||||||
|
writeProp("origId", origId_);
|
||||||
|
|
||||||
|
#undef writeProp
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::particle::writeCoordinates(Ostream& os) const
|
void Foam::particle::writeCoordinates(Ostream& os) const
|
||||||
{
|
{
|
||||||
if (os.format() == IOstream::ASCII)
|
if (os.format() == IOstream::ASCII)
|
||||||
|
|||||||
@ -40,6 +40,102 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::particle::writePropertyName
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const word& name,
|
||||||
|
const word& delim
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (pTraits<Type>::nComponents == 1)
|
||||||
|
{
|
||||||
|
os << name;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
os << '(';
|
||||||
|
for (int i = 0; i < pTraits<Type>::nComponents; ++i)
|
||||||
|
{
|
||||||
|
if (i) os << delim;
|
||||||
|
|
||||||
|
os << name << Foam::name(i);
|
||||||
|
}
|
||||||
|
os << ')';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::particle::writeProperty
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const word& name,
|
||||||
|
const Type& value,
|
||||||
|
const bool nameOnly,
|
||||||
|
const word& delim,
|
||||||
|
const wordRes& filters
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (!filters.empty() && !filters.match(name))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
os << delim;
|
||||||
|
if (nameOnly)
|
||||||
|
{
|
||||||
|
writePropertyName<Type>(os, name, delim);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
os << value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::particle::writeProperty
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const word& name,
|
||||||
|
const Field<Type>& values,
|
||||||
|
const bool nameOnly,
|
||||||
|
const word& delim,
|
||||||
|
const wordRes& filters
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (!filters.empty() && !filters.match(name))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nameOnly)
|
||||||
|
{
|
||||||
|
os << delim;
|
||||||
|
os << "N(";
|
||||||
|
if (values.size())
|
||||||
|
{
|
||||||
|
forAll(values, i)
|
||||||
|
{
|
||||||
|
if (i) os << delim;
|
||||||
|
const word tag(name + Foam::name(i));
|
||||||
|
writePropertyName<Type>(os, tag, delim);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
os << name;
|
||||||
|
}
|
||||||
|
os << ')';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
os << delim << values;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class TrackCloudType>
|
template<class TrackCloudType>
|
||||||
void Foam::particle::readFields(TrackCloudType& c)
|
void Foam::particle::readFields(TrackCloudType& c)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -323,6 +323,15 @@ public:
|
|||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
static void writeFields(const CloudType& c);
|
static void writeFields(const CloudType& c);
|
||||||
|
|
||||||
|
//- Write individual parcel properties to stream
|
||||||
|
void writeProperties
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const wordRes& filters,
|
||||||
|
const word& delim,
|
||||||
|
const bool namesOnly
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Read particle fields as objects from the obr registry
|
//- Read particle fields as objects from the obr registry
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
static void readObjects(CloudType& c, const objectRegistry& obr);
|
static void readObjects(CloudType& c, const objectRegistry& obr);
|
||||||
|
|||||||
@ -291,6 +291,30 @@ void Foam::CollidingParcel<ParcelType>::writeFields(const CloudType& c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ParcelType>
|
||||||
|
void Foam::CollidingParcel<ParcelType>::writeProperties
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const wordRes& filters,
|
||||||
|
const word& delim,
|
||||||
|
const bool namesOnly
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
ParcelType::writeProperties(os, filters, delim, namesOnly);
|
||||||
|
|
||||||
|
#undef writeProp
|
||||||
|
#define writeProp(Name, Value) \
|
||||||
|
ParcelType::writeProperty(os, Name, Value, namesOnly, delim, filters)
|
||||||
|
|
||||||
|
writeProp("f", f_);
|
||||||
|
writeProp("angularMomentum", angularMomentum_);
|
||||||
|
writeProp("torque", torque_);
|
||||||
|
//writeProp("collisionRecords", collisionRecords_);
|
||||||
|
|
||||||
|
#undef writeProp
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
void Foam::CollidingParcel<ParcelType>::readObjects
|
void Foam::CollidingParcel<ParcelType>::readObjects
|
||||||
|
|||||||
@ -659,6 +659,15 @@ public:
|
|||||||
template<class TrackCloudType>
|
template<class TrackCloudType>
|
||||||
static void writeFields(const TrackCloudType& c);
|
static void writeFields(const TrackCloudType& c);
|
||||||
|
|
||||||
|
//- Write individual parcel properties to stream
|
||||||
|
void writeProperties
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const wordRes& filters,
|
||||||
|
const word& delim,
|
||||||
|
const bool namesOnly = false
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Read particle fields as objects from the obr registry
|
//- Read particle fields as objects from the obr registry
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
static void readObjects(CloudType& c, const objectRegistry& obr);
|
static void readObjects(CloudType& c, const objectRegistry& obr);
|
||||||
|
|||||||
@ -266,6 +266,36 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const CloudType& c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ParcelType>
|
||||||
|
void Foam::KinematicParcel<ParcelType>::writeProperties
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const wordRes& filters,
|
||||||
|
const word& delim,
|
||||||
|
const bool namesOnly
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
ParcelType::writeProperties(os, filters, delim, namesOnly);
|
||||||
|
|
||||||
|
#undef writeProp
|
||||||
|
#define writeProp(Name, Value) \
|
||||||
|
ParcelType::writeProperty(os, Name, Value, namesOnly, delim, filters)
|
||||||
|
|
||||||
|
writeProp("active", active_);
|
||||||
|
writeProp("typeId", typeId_);
|
||||||
|
writeProp("nParticle", nParticle_);
|
||||||
|
writeProp("d", d_);
|
||||||
|
writeProp("dTarget", dTarget_);
|
||||||
|
writeProp("U", U_);
|
||||||
|
writeProp("rho", rho_);
|
||||||
|
writeProp("age", age_);
|
||||||
|
writeProp("tTurb", tTurb_);
|
||||||
|
writeProp("UTurb", UTurb_);
|
||||||
|
|
||||||
|
#undef writeProp
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
void Foam::KinematicParcel<ParcelType>::readObjects
|
void Foam::KinematicParcel<ParcelType>::readObjects
|
||||||
|
|||||||
@ -308,6 +308,15 @@ public:
|
|||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
static void writeFields(const CloudType& c);
|
static void writeFields(const CloudType& c);
|
||||||
|
|
||||||
|
//- Write individual parcel properties to stream
|
||||||
|
void writeProperties
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const wordRes& filters,
|
||||||
|
const word& delim,
|
||||||
|
const bool namesOnly = false
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Read particle fields as objects from the obr registry
|
//- Read particle fields as objects from the obr registry
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
static void readObjects(CloudType& c, const objectRegistry& obr);
|
static void readObjects(CloudType& c, const objectRegistry& obr);
|
||||||
|
|||||||
@ -133,6 +133,27 @@ void Foam::MPPICParcel<ParcelType>::writeFields(const CloudType& c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ParcelType>
|
||||||
|
void Foam::MPPICParcel<ParcelType>::writeProperties
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const wordRes& filters,
|
||||||
|
const word& delim,
|
||||||
|
const bool namesOnly
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
ParcelType::writeProperties(os, filters, delim, namesOnly);
|
||||||
|
|
||||||
|
#undef writeProp
|
||||||
|
#define writeProp(Name, Value) \
|
||||||
|
ParcelType::writeProperty(os, Name, Value, namesOnly, delim, filters)
|
||||||
|
|
||||||
|
writeProp("UCorrect", UCorrect_);
|
||||||
|
|
||||||
|
#undef writeProp
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
void Foam::MPPICParcel<ParcelType>::readObjects
|
void Foam::MPPICParcel<ParcelType>::readObjects
|
||||||
|
|||||||
@ -371,6 +371,15 @@ public:
|
|||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
static void writeFields(const CloudType& c);
|
static void writeFields(const CloudType& c);
|
||||||
|
|
||||||
|
//- Write individual parcel properties to stream
|
||||||
|
void writeProperties
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const wordRes& filters,
|
||||||
|
const word& delim,
|
||||||
|
const bool namesOnly
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Read particle fields as objects from the obr registry
|
//- Read particle fields as objects from the obr registry
|
||||||
// - no composition
|
// - no composition
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
|
|||||||
@ -251,6 +251,28 @@ void Foam::ReactingHeterogeneousParcel<ParcelType>::writeFields
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ParcelType>
|
||||||
|
void Foam::ReactingHeterogeneousParcel<ParcelType>::writeProperties
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const wordRes& filters,
|
||||||
|
const word& delim,
|
||||||
|
const bool namesOnly
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
ParcelType::writeProperties(os, filters, delim, namesOnly);
|
||||||
|
|
||||||
|
#undef writeProp
|
||||||
|
#define writeProp(Name, Value) \
|
||||||
|
ParcelType::writeProperty(os, Name, Value, namesOnly, delim, filters)
|
||||||
|
|
||||||
|
writeProp("F", F_);
|
||||||
|
writeProp("canCombust", canCombust_);
|
||||||
|
|
||||||
|
#undef writeProp
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
void Foam::ReactingHeterogeneousParcel<ParcelType>::readObjects
|
void Foam::ReactingHeterogeneousParcel<ParcelType>::readObjects
|
||||||
|
|||||||
@ -462,6 +462,15 @@ public:
|
|||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
static void writeFields(const CloudType& c);
|
static void writeFields(const CloudType& c);
|
||||||
|
|
||||||
|
//- Write individual parcel properties to stream
|
||||||
|
void writeProperties
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const wordRes& filters,
|
||||||
|
const word& delim,
|
||||||
|
const bool namesOnly = false
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Read particle fields as objects from the obr registry
|
//- Read particle fields as objects from the obr registry
|
||||||
// - no composition
|
// - no composition
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
|
|||||||
@ -282,6 +282,30 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::writeFields
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ParcelType>
|
||||||
|
void Foam::ReactingMultiphaseParcel<ParcelType>::writeProperties
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const wordRes& filters,
|
||||||
|
const word& delim,
|
||||||
|
const bool namesOnly
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
ParcelType::writeProperties(os, filters, delim, namesOnly);
|
||||||
|
|
||||||
|
#undef writeProp
|
||||||
|
#define writeProp(Name, Value) \
|
||||||
|
ParcelType::writeProperty(os, Name, Value, namesOnly, delim, filters)
|
||||||
|
|
||||||
|
writeProp("YGas", YGas_);
|
||||||
|
writeProp("YLiquid", YLiquid_);
|
||||||
|
writeProp("YSolid", YSolid_);
|
||||||
|
writeProp("canCombust", canCombust_);
|
||||||
|
|
||||||
|
#undef writeProp
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
void Foam::ReactingMultiphaseParcel<ParcelType>::readObjects
|
void Foam::ReactingMultiphaseParcel<ParcelType>::readObjects
|
||||||
|
|||||||
@ -414,6 +414,14 @@ public:
|
|||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
static void writeFields(const CloudType& c);
|
static void writeFields(const CloudType& c);
|
||||||
|
|
||||||
|
//- Write individual parcel properties to stream
|
||||||
|
void writeProperties
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const wordRes& filters,
|
||||||
|
const word& delim,
|
||||||
|
const bool namesOnly = false
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Read particle fields as objects from the obr registry
|
//- Read particle fields as objects from the obr registry
|
||||||
// - no composition
|
// - no composition
|
||||||
|
|||||||
@ -231,6 +231,28 @@ void Foam::ReactingParcel<ParcelType>::writeFields
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ParcelType>
|
||||||
|
void Foam::ReactingParcel<ParcelType>::writeProperties
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const wordRes& filters,
|
||||||
|
const word& delim,
|
||||||
|
const bool namesOnly
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
ParcelType::writeProperties(os, filters, delim, namesOnly);
|
||||||
|
|
||||||
|
#undef writeProp
|
||||||
|
#define writeProp(Name, Value) \
|
||||||
|
ParcelType::writeProperty(os, Name, Value, namesOnly, delim, filters)
|
||||||
|
|
||||||
|
writeProp("mass0", mass0_);
|
||||||
|
writeProp("Y", Y_);
|
||||||
|
|
||||||
|
#undef writeProp
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
void Foam::ReactingParcel<ParcelType>::readObjects
|
void Foam::ReactingParcel<ParcelType>::readObjects
|
||||||
|
|||||||
@ -455,6 +455,15 @@ public:
|
|||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
static void writeFields(const CloudType& c);
|
static void writeFields(const CloudType& c);
|
||||||
|
|
||||||
|
//- Write individual parcel properties to stream
|
||||||
|
void writeProperties
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const wordRes& filters,
|
||||||
|
const word& delim,
|
||||||
|
const bool namesOnly = false
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Read particle fields as objects from the obr registry
|
//- Read particle fields as objects from the obr registry
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
static void readObjects(CloudType& c, const objectRegistry& obr);
|
static void readObjects(CloudType& c, const objectRegistry& obr);
|
||||||
|
|||||||
@ -138,6 +138,28 @@ void Foam::ThermoParcel<ParcelType>::writeFields(const CloudType& c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ParcelType>
|
||||||
|
void Foam::ThermoParcel<ParcelType>::writeProperties
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const wordRes& filters,
|
||||||
|
const word& delim,
|
||||||
|
const bool namesOnly
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
ParcelType::writeProperties(os, filters, delim, namesOnly);
|
||||||
|
|
||||||
|
#undef writeProp
|
||||||
|
#define writeProp(Name, Value) \
|
||||||
|
ParcelType::writeProperty(os, Name, Value, namesOnly, delim, filters)
|
||||||
|
|
||||||
|
writeProp("T", T_);
|
||||||
|
writeProp("Cp", Cp_);
|
||||||
|
|
||||||
|
#undef writeProp
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
void Foam::ThermoParcel<ParcelType>::readObjects
|
void Foam::ThermoParcel<ParcelType>::readObjects
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -66,9 +66,7 @@ Foam::CloudFunctionObject<CloudType>::CloudFunctionObject
|
|||||||
(
|
(
|
||||||
owner.mesh().time().globalPath()
|
owner.mesh().time().globalPath()
|
||||||
/ functionObject::outputPrefix
|
/ functionObject::outputPrefix
|
||||||
/ cloud::prefix
|
/ this->localPath()
|
||||||
/ owner.name()
|
|
||||||
/ this->modelName()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
outputDir_.clean(); // Remove unneeded ".."
|
outputDir_.clean(); // Remove unneeded ".."
|
||||||
|
|||||||
@ -40,15 +40,7 @@ Foam::label Foam::PatchPostProcessing<CloudType>::applyToPatch
|
|||||||
const label globalPatchi
|
const label globalPatchi
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
forAll(patchIDs_, i)
|
return patchIDs_.find(globalPatchi);
|
||||||
{
|
|
||||||
if (patchIDs_[i] == globalPatchi)
|
|
||||||
{
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -100,7 +92,7 @@ void Foam::PatchPostProcessing<CloudType>::write()
|
|||||||
|
|
||||||
labelList indices(sortedOrder(globalTimes));
|
labelList indices(sortedOrder(globalTimes));
|
||||||
|
|
||||||
string header("# Time currentProc " + parcelType::propertyList_);
|
string header("# Time currentProc " + header_);
|
||||||
patchOutFile<< header.c_str() << nl;
|
patchOutFile<< header.c_str() << nl;
|
||||||
|
|
||||||
forAll(globalTimes, i)
|
forAll(globalTimes, i)
|
||||||
@ -132,37 +124,40 @@ Foam::PatchPostProcessing<CloudType>::PatchPostProcessing
|
|||||||
:
|
:
|
||||||
CloudFunctionObject<CloudType>(dict, owner, modelName, typeName),
|
CloudFunctionObject<CloudType>(dict, owner, modelName, typeName),
|
||||||
maxStoredParcels_(this->coeffDict().getScalar("maxStoredParcels")),
|
maxStoredParcels_(this->coeffDict().getScalar("maxStoredParcels")),
|
||||||
|
fields_(),
|
||||||
patchIDs_(),
|
patchIDs_(),
|
||||||
times_(),
|
times_(),
|
||||||
patchData_()
|
patchData_(),
|
||||||
|
header_()
|
||||||
{
|
{
|
||||||
const wordList allPatchNames(owner.mesh().boundaryMesh().names());
|
// The "fields" filter is optional
|
||||||
const wordReList patchNames(this->coeffDict().lookup("patches"));
|
this->coeffDict().readIfPresent("fields", fields_);
|
||||||
|
|
||||||
labelHashSet uniqIds;
|
// The "patches" are required
|
||||||
for (const wordRe& re : patchNames)
|
const wordRes patchMatcher(this->coeffDict().lookup("patches"));
|
||||||
|
|
||||||
|
patchIDs_ = patchMatcher.matching(owner.mesh().boundaryMesh().names());
|
||||||
|
|
||||||
|
if (patchIDs_.empty())
|
||||||
{
|
{
|
||||||
labelList ids = findStrings(re, allPatchNames);
|
WarningInFunction
|
||||||
|
<< "No matching patches found: "
|
||||||
if (ids.empty())
|
<< flatOutput(patchMatcher) << nl;
|
||||||
{
|
|
||||||
WarningInFunction
|
|
||||||
<< "Cannot find any patch names matching " << re
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
uniqIds.insert(ids);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
patchIDs_ = uniqIds.sortedToc();
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
|
Info<< "Post-process fields "
|
||||||
|
<< flatOutput(fields_) << nl;
|
||||||
|
|
||||||
|
Info<< "On patches (";
|
||||||
|
|
||||||
for (const label patchi : patchIDs_)
|
for (const label patchi : patchIDs_)
|
||||||
{
|
{
|
||||||
Info<< "Post-process patch "
|
Info<< ' ' << owner.mesh().boundaryMesh()[patchi].name();
|
||||||
<< owner.mesh().boundaryMesh()[patchi].name() << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Info<< " )" << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
patchData_.setSize(patchIDs_.size());
|
patchData_.setSize(patchIDs_.size());
|
||||||
@ -178,9 +173,11 @@ Foam::PatchPostProcessing<CloudType>::PatchPostProcessing
|
|||||||
:
|
:
|
||||||
CloudFunctionObject<CloudType>(ppm),
|
CloudFunctionObject<CloudType>(ppm),
|
||||||
maxStoredParcels_(ppm.maxStoredParcels_),
|
maxStoredParcels_(ppm.maxStoredParcels_),
|
||||||
|
fields_(ppm.fields_),
|
||||||
patchIDs_(ppm.patchIDs_),
|
patchIDs_(ppm.patchIDs_),
|
||||||
times_(ppm.times_),
|
times_(ppm.times_),
|
||||||
patchData_(ppm.patchData_)
|
patchData_(ppm.patchData_),
|
||||||
|
header_(ppm.header_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -197,12 +194,20 @@ void Foam::PatchPostProcessing<CloudType>::postPatch
|
|||||||
const label patchi = pp.index();
|
const label patchi = pp.index();
|
||||||
const label localPatchi = applyToPatch(patchi);
|
const label localPatchi = applyToPatch(patchi);
|
||||||
|
|
||||||
|
if (header_.empty())
|
||||||
|
{
|
||||||
|
OStringStream data;
|
||||||
|
p.writeProperties(data, fields_, " ", true);
|
||||||
|
header_ = data.str();
|
||||||
|
}
|
||||||
|
|
||||||
if (localPatchi != -1 && patchData_[localPatchi].size() < maxStoredParcels_)
|
if (localPatchi != -1 && patchData_[localPatchi].size() < maxStoredParcels_)
|
||||||
{
|
{
|
||||||
times_[localPatchi].append(this->owner().time().value());
|
times_[localPatchi].append(this->owner().time().value());
|
||||||
|
|
||||||
OStringStream data;
|
OStringStream data;
|
||||||
data<< Pstream::myProcNo() << ' ' << p;
|
data<< Pstream::myProcNo();
|
||||||
|
p.writeProperties(data, fields_, " ", false);
|
||||||
|
|
||||||
patchData_[localPatchi].append(data.str());
|
patchData_[localPatchi].append(data.str());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -63,6 +64,9 @@ class PatchPostProcessing
|
|||||||
//- Maximum number of parcels to store - set as a scalar for I/O
|
//- Maximum number of parcels to store - set as a scalar for I/O
|
||||||
scalar maxStoredParcels_;
|
scalar maxStoredParcels_;
|
||||||
|
|
||||||
|
//- Field name filters
|
||||||
|
wordRes fields_;
|
||||||
|
|
||||||
//- List of patch indices to post-process
|
//- List of patch indices to post-process
|
||||||
labelList patchIDs_;
|
labelList patchIDs_;
|
||||||
|
|
||||||
@ -72,6 +76,9 @@ class PatchPostProcessing
|
|||||||
//- List of output data per patch
|
//- List of output data per patch
|
||||||
List<DynamicList<string>> patchData_;
|
List<DynamicList<string>> patchData_;
|
||||||
|
|
||||||
|
//- Field header
|
||||||
|
string header_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "CloudSubModelBase.H"
|
#include "CloudSubModelBase.H"
|
||||||
|
#include "cloud.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -125,6 +126,18 @@ bool Foam::CloudSubModelBase<CloudType>::writeTime() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
Foam::fileName Foam::CloudSubModelBase<CloudType>::localPath() const
|
||||||
|
{
|
||||||
|
if (modelName_ != word::null)
|
||||||
|
{
|
||||||
|
return cloud::prefix/owner_.name()/modelName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
return cloud::prefix/owner_.name()/baseName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
void Foam::CloudSubModelBase<CloudType>::write(Ostream& os) const
|
void Foam::CloudSubModelBase<CloudType>::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -109,6 +109,9 @@ public:
|
|||||||
//- Flag to indicate when to write a property
|
//- Flag to indicate when to write a property
|
||||||
virtual bool writeTime() const;
|
virtual bool writeTime() const;
|
||||||
|
|
||||||
|
//- Output directory
|
||||||
|
virtual fileName localPath() const;
|
||||||
|
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2018 OpenCFD Ltd.
|
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -30,6 +30,27 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
void Foam::LocalInteraction<CloudType>::writeFileHeader(Ostream& os)
|
||||||
|
{
|
||||||
|
PatchInteractionModel<CloudType>::writeFileHeader(os);
|
||||||
|
|
||||||
|
forAll(nEscape_, patchi)
|
||||||
|
{
|
||||||
|
const word& patchName = patchData_[patchi].patchName();
|
||||||
|
|
||||||
|
forAll(nEscape_[patchi], injectori)
|
||||||
|
{
|
||||||
|
const word suffix = Foam::name(injectori);
|
||||||
|
this->writeTabbed(os, patchName + "_nEscape_" + suffix);
|
||||||
|
this->writeTabbed(os, patchName + "_massEscape_" + suffix);
|
||||||
|
this->writeTabbed(os, patchName + "_nStick_" + suffix);
|
||||||
|
this->writeTabbed(os, patchName + "_massStick_" + suffix);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
Foam::LocalInteraction<CloudType>::LocalInteraction
|
Foam::LocalInteraction<CloudType>::LocalInteraction
|
||||||
(
|
(
|
||||||
@ -356,7 +377,7 @@ void Foam::LocalInteraction<CloudType>::info(Ostream& os)
|
|||||||
|
|
||||||
if (injIdToIndex_.size())
|
if (injIdToIndex_.size())
|
||||||
{
|
{
|
||||||
// Since injIdToIndex_ is a one-to-one mapping (starting as zero),
|
// Since injIdToIndex_ is a one-to-one mapping (starting at zero),
|
||||||
// can simply invert it.
|
// can simply invert it.
|
||||||
labelList indexToInjector(injIdToIndex_.size());
|
labelList indexToInjector(injIdToIndex_.size());
|
||||||
forAllConstIters(injIdToIndex_, iter)
|
forAllConstIters(injIdToIndex_, iter)
|
||||||
@ -364,34 +385,52 @@ void Foam::LocalInteraction<CloudType>::info(Ostream& os)
|
|||||||
indexToInjector[iter.val()] = iter.key();
|
indexToInjector[iter.val()] = iter.key();
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(patchData_, i)
|
forAll(patchData_, patchi)
|
||||||
{
|
{
|
||||||
forAll(mpe[i], idx)
|
forAll(mpe[patchi], indexi)
|
||||||
{
|
{
|
||||||
os << " Parcel fate: patch " << patchData_[i].patchName()
|
const word& patchName = patchData_[patchi].patchName();
|
||||||
|
|
||||||
|
os << " Parcel fate: patch " << patchName
|
||||||
<< " (number, mass)" << nl
|
<< " (number, mass)" << nl
|
||||||
<< " - escape (injector " << indexToInjector[idx]
|
<< " - escape (injector " << indexToInjector[indexi]
|
||||||
<< " ) = " << npe[i][idx]
|
<< " ) = " << npe[patchi][indexi]
|
||||||
<< ", " << mpe[i][idx] << nl
|
<< ", " << mpe[patchi][indexi] << nl
|
||||||
<< " - stick (injector " << indexToInjector[idx]
|
<< " - stick (injector " << indexToInjector[indexi]
|
||||||
<< " ) = " << nps[i][idx]
|
<< " ) = " << nps[patchi][indexi]
|
||||||
<< ", " << mps[i][idx] << nl;
|
<< ", " << mps[patchi][indexi] << nl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
forAll(patchData_, i)
|
forAll(patchData_, patchi)
|
||||||
{
|
{
|
||||||
os << " Parcel fate: patch " << patchData_[i].patchName()
|
const word& patchName = patchData_[patchi].patchName();
|
||||||
|
|
||||||
|
os << " Parcel fate: patch " << patchName
|
||||||
<< " (number, mass)" << nl
|
<< " (number, mass)" << nl
|
||||||
<< " - escape = "
|
<< " - escape = "
|
||||||
<< npe[i][0] << ", " << mpe[i][0] << nl
|
<< npe[patchi][0] << ", " << mpe[patchi][0] << nl
|
||||||
<< " - stick = "
|
<< " - stick = "
|
||||||
<< nps[i][0] << ", " << mps[i][0] << nl;
|
<< nps[patchi][0] << ", " << mps[patchi][0] << nl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
forAll(npe, patchi)
|
||||||
|
{
|
||||||
|
forAll(npe[patchi], injectori)
|
||||||
|
{
|
||||||
|
this->file()
|
||||||
|
<< tab << npe[patchi][injectori]
|
||||||
|
<< tab << mpe[patchi][injectori]
|
||||||
|
<< tab << nps[patchi][injectori]
|
||||||
|
<< tab << mps[patchi][injectori];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this->file() << endl;
|
||||||
|
|
||||||
if (this->writeTime())
|
if (this->writeTime())
|
||||||
{
|
{
|
||||||
this->setModelProperty("nEscape", npe);
|
this->setModelProperty("nEscape", npe);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2018 OpenCFD Ltd.
|
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -61,19 +61,21 @@ class LocalInteraction
|
|||||||
//- List of participating patches
|
//- List of participating patches
|
||||||
const patchInteractionDataList patchData_;
|
const patchInteractionDataList patchData_;
|
||||||
|
|
||||||
// Bookkeeping for particle fates
|
|
||||||
|
|
||||||
//- Number of parcels escaped
|
// Bookkeeping for particle fates
|
||||||
List<List<label>> nEscape_;
|
|
||||||
|
|
||||||
//- Mass of parcels escaped
|
//- Number of parcels escaped
|
||||||
List<List<scalar>> massEscape_;
|
List<List<label>> nEscape_;
|
||||||
|
|
||||||
//- Number of parcels stuck to patches
|
//- Mass of parcels escaped
|
||||||
List<List<label>> nStick_;
|
List<List<scalar>> massEscape_;
|
||||||
|
|
||||||
|
//- Number of parcels stuck to patches
|
||||||
|
List<List<label>> nStick_;
|
||||||
|
|
||||||
|
//- Mass of parcels stuck to patches
|
||||||
|
List<List<scalar>> massStick_;
|
||||||
|
|
||||||
//- Mass of parcels stuck to patches
|
|
||||||
List<List<scalar>> massStick_;
|
|
||||||
|
|
||||||
//- Flag to output data as fields
|
//- Flag to output data as fields
|
||||||
bool writeFields_;
|
bool writeFields_;
|
||||||
@ -89,6 +91,13 @@ class LocalInteraction
|
|||||||
autoPtr<volScalarField> massStickPtr_;
|
autoPtr<volScalarField> massStickPtr_;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Output file header information
|
||||||
|
virtual void writeFileHeader(Ostream& os);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2016 OpenCFD Ltd.
|
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -40,6 +40,20 @@ Foam::wordList Foam::PatchInteractionModel<CloudType>::interactionTypeNames_
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
void Foam::PatchInteractionModel<CloudType>::writeFileHeader(Ostream& os)
|
||||||
|
{
|
||||||
|
this->writeHeader(os, "Particle patch interaction");
|
||||||
|
this->writeHeaderValue(os, "Model", this->modelType());
|
||||||
|
|
||||||
|
this->writeCommented(os, "Time");
|
||||||
|
this->writeTabbed(os, "escapedParcels");
|
||||||
|
this->writeTabbed(os, "escapedMass");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
@ -120,6 +134,7 @@ Foam::PatchInteractionModel<CloudType>::PatchInteractionModel
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
CloudSubModelBase<CloudType>(owner),
|
CloudSubModelBase<CloudType>(owner),
|
||||||
|
functionObjects::writeFile(owner, this->localPath(), typeName, false),
|
||||||
UName_("unknown_U"),
|
UName_("unknown_U"),
|
||||||
escapedParcels_(0),
|
escapedParcels_(0),
|
||||||
escapedMass_(0.0)
|
escapedMass_(0.0)
|
||||||
@ -135,6 +150,14 @@ Foam::PatchInteractionModel<CloudType>::PatchInteractionModel
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
CloudSubModelBase<CloudType>(owner, dict, typeName, type),
|
CloudSubModelBase<CloudType>(owner, dict, typeName, type),
|
||||||
|
functionObjects::writeFile
|
||||||
|
(
|
||||||
|
owner,
|
||||||
|
this->localPath(),
|
||||||
|
type,
|
||||||
|
this->coeffDict(),
|
||||||
|
false // Do not write by default
|
||||||
|
),
|
||||||
UName_(this->coeffDict().lookupOrDefault("U", word("U"))),
|
UName_(this->coeffDict().lookupOrDefault("U", word("U"))),
|
||||||
escapedParcels_(0),
|
escapedParcels_(0),
|
||||||
escapedMass_(0.0)
|
escapedMass_(0.0)
|
||||||
@ -148,6 +171,7 @@ Foam::PatchInteractionModel<CloudType>::PatchInteractionModel
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
CloudSubModelBase<CloudType>(pim),
|
CloudSubModelBase<CloudType>(pim),
|
||||||
|
functionObjects::writeFile(pim),
|
||||||
UName_(pim.UName_),
|
UName_(pim.UName_),
|
||||||
escapedParcels_(pim.escapedParcels_),
|
escapedParcels_(pim.escapedParcels_),
|
||||||
escapedMass_(pim.escapedMass_)
|
escapedMass_(pim.escapedMass_)
|
||||||
@ -170,7 +194,7 @@ void Foam::PatchInteractionModel<CloudType>::addToEscapedParcels
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
escapedMass_ += mass;
|
escapedMass_ += mass;
|
||||||
escapedParcels_++;
|
++escapedParcels_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -191,6 +215,18 @@ void Foam::PatchInteractionModel<CloudType>::info(Ostream& os)
|
|||||||
<< " - escape = " << escapedParcelsTotal
|
<< " - escape = " << escapedParcelsTotal
|
||||||
<< ", " << escapedMassTotal << endl;
|
<< ", " << escapedMassTotal << endl;
|
||||||
|
|
||||||
|
if (!this->writtenHeader_)
|
||||||
|
{
|
||||||
|
this->writeFileHeader(this->file());
|
||||||
|
this->writtenHeader_ = true;
|
||||||
|
this->file() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->writeCurrentTime(this->file());
|
||||||
|
this->file()
|
||||||
|
<< tab << escapedParcelsTotal << tab << escapedMassTotal;
|
||||||
|
|
||||||
|
|
||||||
if (this->writeTime())
|
if (this->writeTime())
|
||||||
{
|
{
|
||||||
this->setBaseProperty("escapedParcels", escapedParcelsTotal);
|
this->setBaseProperty("escapedParcels", escapedParcelsTotal);
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -48,6 +49,7 @@ SourceFiles
|
|||||||
#include "wallPolyPatch.H"
|
#include "wallPolyPatch.H"
|
||||||
#include "tetIndices.H"
|
#include "tetIndices.H"
|
||||||
#include "CloudSubModelBase.H"
|
#include "CloudSubModelBase.H"
|
||||||
|
#include "writeFile.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -61,7 +63,8 @@ namespace Foam
|
|||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
class PatchInteractionModel
|
class PatchInteractionModel
|
||||||
:
|
:
|
||||||
public CloudSubModelBase<CloudType>
|
public CloudSubModelBase<CloudType>,
|
||||||
|
public functionObjects::writeFile
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -82,7 +85,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Private data
|
// Protected data
|
||||||
|
|
||||||
//- Name of velocity field - default = "U"
|
//- Name of velocity field - default = "U"
|
||||||
const word UName_;
|
const word UName_;
|
||||||
@ -97,6 +100,11 @@ protected:
|
|||||||
scalar escapedMass_;
|
scalar escapedMass_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Output file header information
|
||||||
|
virtual void writeFileHeader(Ostream& os);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2018 OpenCFD Ltd.
|
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -28,6 +28,29 @@ License
|
|||||||
|
|
||||||
#include "StandardWallInteraction.H"
|
#include "StandardWallInteraction.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
void Foam::StandardWallInteraction<CloudType>::writeFileHeader(Ostream& os)
|
||||||
|
{
|
||||||
|
PatchInteractionModel<CloudType>::writeFileHeader(os);
|
||||||
|
|
||||||
|
forAll(nEscape_, patchi)
|
||||||
|
{
|
||||||
|
const word& patchName = mesh_.boundary()[patchi].name();
|
||||||
|
|
||||||
|
forAll(nEscape_[patchi], injectori)
|
||||||
|
{
|
||||||
|
const word suffix = Foam::name(injectori);
|
||||||
|
this->writeTabbed(os, patchName + "_nEscape_" + suffix);
|
||||||
|
this->writeTabbed(os, patchName + "_massEscape_" + suffix);
|
||||||
|
this->writeTabbed(os, patchName + "_nStick_" + suffix);
|
||||||
|
this->writeTabbed(os, patchName + "_massStick_" + suffix);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
@ -51,8 +74,8 @@ Foam::StandardWallInteraction<CloudType>::StandardWallInteraction
|
|||||||
massStick_(nEscape_.size()),
|
massStick_(nEscape_.size()),
|
||||||
injIdToIndex_()
|
injIdToIndex_()
|
||||||
{
|
{
|
||||||
const bool outputByInjectorId
|
const bool outputByInjectorId =
|
||||||
= this->coeffDict().lookupOrDefault("outputByInjectorId", false);
|
this->coeffDict().lookupOrDefault("outputByInjectorId", false);
|
||||||
|
|
||||||
switch (interactionType_)
|
switch (interactionType_)
|
||||||
{
|
{
|
||||||
@ -277,33 +300,48 @@ void Foam::StandardWallInteraction<CloudType>::info(Ostream& os)
|
|||||||
indexToInjector[iter.val()] = iter.key();
|
indexToInjector[iter.val()] = iter.key();
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(npe, i)
|
forAll(npe, patchi)
|
||||||
{
|
{
|
||||||
forAll(mpe[i], idx)
|
forAll(mpe[patchi], indexi)
|
||||||
{
|
{
|
||||||
os << " Parcel fate: patch " << mesh_.boundary()[i].name()
|
const word& patchName = mesh_.boundary()[patchi].name() ;
|
||||||
|
|
||||||
|
os << " Parcel fate: patch " << patchName
|
||||||
<< " (number, mass)" << nl
|
<< " (number, mass)" << nl
|
||||||
<< " - escape (injector " << indexToInjector[idx]
|
<< " - escape (injector " << indexToInjector[indexi]
|
||||||
<< ") = " << npe[i][idx]
|
<< ") = " << npe[patchi][indexi]
|
||||||
<< ", " << mpe[i][idx] << nl
|
<< ", " << mpe[patchi][indexi] << nl
|
||||||
<< " - stick (injector " << indexToInjector[idx]
|
<< " - stick (injector " << indexToInjector[indexi]
|
||||||
<< ") = " << nps[i][idx]
|
<< ") = " << nps[patchi][indexi]
|
||||||
<< ", " << mps[i][idx] << nl;
|
<< ", " << mps[patchi][indexi] << nl;
|
||||||
|
|
||||||
|
this->file()
|
||||||
|
<< tab << npe[patchi][indexi] << tab << mpe[patchi][indexi]
|
||||||
|
<< tab << nps[patchi][indexi] << tab << mps[patchi][indexi];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->file() << endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
forAll(npe, i)
|
forAll(npe, patchi)
|
||||||
{
|
{
|
||||||
os << " Parcel fate: patch (number, mass) "
|
const word& patchName = mesh_.boundary()[patchi].name();
|
||||||
<< mesh_.boundary()[i].name() << nl
|
|
||||||
<< " - escape = "
|
|
||||||
<< npe[i][0] << ", " << mpe[i][0] << nl
|
|
||||||
<< " - stick = "
|
|
||||||
<< nps[i][0] << ", " << mps[i][0] << nl;
|
|
||||||
|
|
||||||
|
os << " Parcel fate: patch (number, mass) "
|
||||||
|
<< patchName << nl
|
||||||
|
<< " - escape = "
|
||||||
|
<< npe[patchi][0] << ", " << mpe[patchi][0] << nl
|
||||||
|
<< " - stick = "
|
||||||
|
<< nps[patchi][0] << ", " << mps[patchi][0] << nl;
|
||||||
|
|
||||||
|
this->file()
|
||||||
|
<< tab << npe[patchi][0] << tab << mpe[patchi][0]
|
||||||
|
<< tab << nps[patchi][0] << tab << mps[patchi][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->file() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->writeTime())
|
if (this->writeTime())
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2018 OpenCFD Ltd.
|
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -85,19 +85,21 @@ protected:
|
|||||||
//- Restitution coefficient
|
//- Restitution coefficient
|
||||||
scalar mu_;
|
scalar mu_;
|
||||||
|
|
||||||
// Bookkeeping for particle fates
|
|
||||||
|
|
||||||
//- Number of parcels escaped
|
// Bookkeeping for particle fates
|
||||||
List<List<label>> nEscape_;
|
|
||||||
|
|
||||||
//- Mass of parcels escaped
|
//- Number of parcels escaped
|
||||||
List<List<scalar>> massEscape_;
|
List<List<label>> nEscape_;
|
||||||
|
|
||||||
//- Number of parcels stuck to patches
|
//- Mass of parcels escaped
|
||||||
List<List<label>> nStick_;
|
List<List<scalar>> massEscape_;
|
||||||
|
|
||||||
|
//- Number of parcels stuck to patches
|
||||||
|
List<List<label>> nStick_;
|
||||||
|
|
||||||
|
//- Mass of parcels stuck to patches
|
||||||
|
List<List<scalar>> massStick_;
|
||||||
|
|
||||||
//- Mass of parcels stuck to patches
|
|
||||||
List<List<scalar>> massStick_;
|
|
||||||
|
|
||||||
//- Flag to output escaped/mass particles sorted by injectorID
|
//- Flag to output escaped/mass particles sorted by injectorID
|
||||||
bool outputByInjectorId_;
|
bool outputByInjectorId_;
|
||||||
@ -107,6 +109,12 @@ protected:
|
|||||||
Map<label> injIdToIndex_;
|
Map<label> injIdToIndex_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Output file header information
|
||||||
|
virtual void writeFileHeader(Ostream& os);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
|
|||||||
@ -501,6 +501,15 @@ public:
|
|||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
static void writeFields(const CloudType& c);
|
static void writeFields(const CloudType& c);
|
||||||
|
|
||||||
|
//- Write individual parcel properties to stream
|
||||||
|
void writeProperties
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const wordRes& filters,
|
||||||
|
const word& delim,
|
||||||
|
const bool namesOnly
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Read particle fields as objects from the obr registry
|
//- Read particle fields as objects from the obr registry
|
||||||
// - no composition
|
// - no composition
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
|
|||||||
@ -323,6 +323,39 @@ void Foam::SprayParcel<ParcelType>::writeFields
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ParcelType>
|
||||||
|
void Foam::SprayParcel<ParcelType>::writeProperties
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const wordRes& filters,
|
||||||
|
const word& delim,
|
||||||
|
const bool namesOnly
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
ParcelType::writeProperties(os, filters, delim, namesOnly);
|
||||||
|
|
||||||
|
#undef writeProp
|
||||||
|
#define writeProp(Name, Value) \
|
||||||
|
ParcelType::writeProperty(os, Name, Value, namesOnly, delim, filters)
|
||||||
|
|
||||||
|
writeProp("d0", d0_);
|
||||||
|
writeProp("position0", position0_);
|
||||||
|
writeProp("sigma", sigma_);
|
||||||
|
writeProp("mu", mu_);
|
||||||
|
writeProp("liquidCore", liquidCore_);
|
||||||
|
writeProp("KHindex", KHindex_);
|
||||||
|
writeProp("y", y_);
|
||||||
|
writeProp("yDot", yDot_);
|
||||||
|
writeProp("tc", tc_);
|
||||||
|
writeProp("ms", ms_);
|
||||||
|
writeProp("injector", injector_);
|
||||||
|
writeProp("tMom", tMom_);
|
||||||
|
writeProp("user", user_);
|
||||||
|
|
||||||
|
#undef writeProp
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
void Foam::SprayParcel<ParcelType>::readObjects
|
void Foam::SprayParcel<ParcelType>::readObjects
|
||||||
|
|||||||
@ -165,7 +165,7 @@ bool Foam::functionObjects::sixDoFRigidBodyState::write()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
writeTime(file());
|
writeCurrentTime(file());
|
||||||
file()
|
file()
|
||||||
<< tab
|
<< tab
|
||||||
<< motion.centreOfRotation() << tab
|
<< motion.centreOfRotation() << tab
|
||||||
|
|||||||
@ -120,7 +120,7 @@ bool Foam::functionObjects::specieReactionRates<ChemistryModelType>::write()
|
|||||||
|
|
||||||
for (label ri=0; ri<nReaction; ri++)
|
for (label ri=0; ri<nReaction; ri++)
|
||||||
{
|
{
|
||||||
writeTime(file());
|
writeCurrentTime(file());
|
||||||
file() << token::TAB << ri;
|
file() << token::TAB << ri;
|
||||||
|
|
||||||
for (label si=0; si<nSpecie; si++)
|
for (label si=0; si<nSpecie; si++)
|
||||||
|
|||||||
@ -121,6 +121,8 @@ subModels
|
|||||||
type escape;
|
type escape;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
writeToFile yes;
|
||||||
}
|
}
|
||||||
|
|
||||||
RanzMarshallCoeffs
|
RanzMarshallCoeffs
|
||||||
@ -162,6 +164,7 @@ cloudFunctions
|
|||||||
patchPostProcessing1
|
patchPostProcessing1
|
||||||
{
|
{
|
||||||
type patchPostProcessing;
|
type patchPostProcessing;
|
||||||
|
fields (position "U.*" d T nParticle);
|
||||||
maxStoredParcels 20;
|
maxStoredParcels 20;
|
||||||
patches
|
patches
|
||||||
(
|
(
|
||||||
|
|||||||
Reference in New Issue
Block a user