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:
commit
71bc3510d6
@ -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
|
||||
|
||||
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)
|
||||
{
|
||||
if (os.format() == IOstream::ASCII)
|
||||
|
@ -415,7 +415,7 @@ bool Foam::functionObjects::sizeDistribution::execute()
|
||||
bool Foam::functionObjects::sizeDistribution::write()
|
||||
{
|
||||
writeFileHeader();
|
||||
writeTime(file());
|
||||
writeCurrentTime(file());
|
||||
|
||||
Log << type() << " " << name() << " write" << nl;
|
||||
|
||||
|
@ -153,19 +153,34 @@ Foam::Omanip<int> Foam::functionObjects::writeFile::valueWidth
|
||||
|
||||
// * * * * * * * * * * * * * * * * 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
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const word& prefix,
|
||||
const word& file
|
||||
const fileName& prefix,
|
||||
const word& name,
|
||||
const bool writeToFile
|
||||
)
|
||||
:
|
||||
fileObr_(obr),
|
||||
prefix_(prefix),
|
||||
fileName_(file),
|
||||
fileName_(name),
|
||||
filePtr_(),
|
||||
writePrecision_(IOstream::defaultPrecision()),
|
||||
writeToFile_(true),
|
||||
writeToFile_(writeToFile),
|
||||
writtenHeader_(false),
|
||||
useUserTime_(true),
|
||||
startTime_(obr.time().startTime().value())
|
||||
@ -175,12 +190,13 @@ Foam::functionObjects::writeFile::writeFile
|
||||
Foam::functionObjects::writeFile::writeFile
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const word& prefix,
|
||||
const word& file,
|
||||
const dictionary& dict
|
||||
const fileName& prefix,
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const bool writeToFile
|
||||
)
|
||||
:
|
||||
writeFile(obr, prefix, file)
|
||||
writeFile(obr, prefix, name, writeToFile)
|
||||
{
|
||||
read(dict);
|
||||
|
||||
@ -200,7 +216,7 @@ bool Foam::functionObjects::writeFile::read(const dictionary& dict)
|
||||
|
||||
// Only write on master
|
||||
writeToFile_ =
|
||||
Pstream::master() && dict.lookupOrDefault("writeToFile", true);
|
||||
Pstream::master() && dict.lookupOrDefault("writeToFile", writeToFile_);
|
||||
|
||||
// Use user time, e.g. CA deg in preference to seconds
|
||||
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 =
|
||||
(
|
||||
|
@ -68,7 +68,7 @@ protected:
|
||||
const objectRegistry& fileObr_;
|
||||
|
||||
//- Prefix
|
||||
const word prefix_;
|
||||
const fileName prefix_;
|
||||
|
||||
//- Name of file
|
||||
word fileName_;
|
||||
@ -124,9 +124,6 @@ protected:
|
||||
Omanip<int> valueWidth(const label offset = 0) const;
|
||||
|
||||
|
||||
//- No copy construct
|
||||
writeFile(const writeFile&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const writeFile&) = delete;
|
||||
|
||||
@ -143,8 +140,9 @@ public:
|
||||
writeFile
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const word& prefix,
|
||||
const word& file = "undefined"
|
||||
const fileName& prefix,
|
||||
const word& name = "undefined",
|
||||
const bool writeToFile = true
|
||||
);
|
||||
|
||||
//- Construct from objectRegistry, prefix, fileName
|
||||
@ -152,11 +150,15 @@ public:
|
||||
writeFile
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const word& prefix,
|
||||
const word& file,
|
||||
const dictionary& dict
|
||||
const fileName& prefix,
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const bool writeToFile = true
|
||||
);
|
||||
|
||||
//- Construct copy
|
||||
writeFile(const writeFile& wf);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~writeFile() = default;
|
||||
@ -186,7 +188,7 @@ public:
|
||||
virtual void writeHeader(Ostream& os, const string& str) const;
|
||||
|
||||
//- 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
|
||||
virtual void writeBreak(Ostream& os) const;
|
||||
|
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
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
|
||||
(
|
||||
const word& entryName,
|
||||
|
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -157,6 +158,9 @@ public:
|
||||
//- Flag to indicate when to write a property
|
||||
virtual bool writeTime() const;
|
||||
|
||||
//- Output directory
|
||||
virtual fileName localPath() const;
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
|
@ -174,7 +174,7 @@ bool Foam::functionObjects::blendingFactor::write()
|
||||
<< " blended cells : " << nCellsBlended << nl
|
||||
<< endl;
|
||||
|
||||
writeTime(file());
|
||||
writeCurrentTime(file());
|
||||
|
||||
file()
|
||||
<< token::TAB << nCellsScheme1
|
||||
|
@ -121,7 +121,7 @@ bool Foam::functionObjects::continuityError::write()
|
||||
|
||||
Ostream& os = file();
|
||||
|
||||
writeTime(os);
|
||||
writeCurrentTime(os);
|
||||
|
||||
os << local << tab
|
||||
<< global << tab
|
||||
|
@ -86,7 +86,7 @@ void Foam::functionObjects::fieldExtents::calcFieldExtents
|
||||
|
||||
Log << "field: " << fieldName << nl;
|
||||
|
||||
writeTime(file());
|
||||
writeCurrentTime(file());
|
||||
|
||||
tmp<volScalarField> tmask = calcMask<Type>(*fieldPtr);
|
||||
const volScalarField& mask = tmask();
|
||||
|
@ -152,7 +152,7 @@ bool Foam::functionObjects::fieldMinMax::write()
|
||||
{
|
||||
writeFileHeader(file());
|
||||
|
||||
if (!location_) writeTime(file());
|
||||
if (!location_) writeCurrentTime(file());
|
||||
Log << type() << " " << name() << " write:" << nl;
|
||||
|
||||
for (const word& fieldName : fieldSet_.selectionNames())
|
||||
|
@ -50,7 +50,7 @@ void Foam::functionObjects::fieldMinMax::output
|
||||
|
||||
if (location_)
|
||||
{
|
||||
writeTime(file());
|
||||
writeCurrentTime(file);
|
||||
|
||||
writeTabbed(file, fieldName);
|
||||
|
||||
|
@ -160,7 +160,7 @@ bool Foam::functionObjects::fieldValues::fieldValueDelta::write()
|
||||
region1Ptr_->write();
|
||||
region2Ptr_->write();
|
||||
|
||||
writeTime(file());
|
||||
writeCurrentTime(file());
|
||||
|
||||
Log << type() << " " << name() << " write:" << endl;
|
||||
|
||||
|
@ -992,7 +992,7 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
|
||||
|
||||
if (operation_ != opNone)
|
||||
{
|
||||
writeTime(file());
|
||||
writeCurrentTime(file());
|
||||
}
|
||||
|
||||
if (writeArea_)
|
||||
|
@ -254,7 +254,7 @@ bool Foam::functionObjects::fieldValues::volFieldValue::write()
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
writeTime(file());
|
||||
writeCurrentTime(file());
|
||||
}
|
||||
|
||||
// Only some operations need the cell volume
|
||||
|
@ -334,7 +334,7 @@ void Foam::functionObjects::momentum::writeValues(Ostream& os)
|
||||
|
||||
if (writeToFile())
|
||||
{
|
||||
writeTime(os);
|
||||
writeCurrentTime(os);
|
||||
|
||||
os << tab << sumMomentum_;
|
||||
|
||||
|
@ -728,7 +728,7 @@ bool Foam::functionObjects::stabilityBlendingFactor::write()
|
||||
|
||||
if (writeToFile_)
|
||||
{
|
||||
writeTime(file());
|
||||
writeCurrentTime(file());
|
||||
|
||||
file()
|
||||
<< tab << nCellsScheme1
|
||||
|
@ -285,7 +285,7 @@ bool Foam::functionObjects::wallHeatFlux::write()
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
writeTime(file());
|
||||
writeCurrentTime(file());
|
||||
|
||||
file()
|
||||
<< token::TAB << pp.name()
|
||||
|
@ -245,7 +245,7 @@ bool Foam::functionObjects::wallShearStress::write()
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
writeTime(file());
|
||||
writeCurrentTime(file());
|
||||
|
||||
file()
|
||||
<< token::TAB << pp.name()
|
||||
|
@ -216,7 +216,7 @@ bool Foam::functionObjects::yPlus::write()
|
||||
<< " y+ : min = " << minYplus << ", max = " << maxYplus
|
||||
<< ", average = " << avgYplus << nl;
|
||||
|
||||
writeTime(file());
|
||||
writeCurrentTime(file());
|
||||
file()
|
||||
<< token::TAB << patch.name()
|
||||
<< token::TAB << minYplus
|
||||
|
@ -209,7 +209,7 @@ void Foam::functionObjects::forceCoeffs::writeBinData
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
writeTime(os);
|
||||
writeCurrentTime(os);
|
||||
|
||||
for (label bini = 0; bini < nBin_; ++bini)
|
||||
{
|
||||
@ -411,7 +411,7 @@ bool Foam::functionObjects::forceCoeffs::execute()
|
||||
|
||||
if (writeToFile())
|
||||
{
|
||||
writeTime(coeffFilePtr_());
|
||||
writeCurrentTime(coeffFilePtr_());
|
||||
coeffFilePtr_()
|
||||
<< tab << CdTot << tab << CsTot << tab << ClTot
|
||||
<< tab << CmRollTot << tab << CmPitchTot << tab << CmYawTot
|
||||
|
@ -601,7 +601,7 @@ void Foam::functionObjects::forces::writeIntegratedForceMoment
|
||||
{
|
||||
Ostream& os = osPtr();
|
||||
|
||||
writeTime(os);
|
||||
writeCurrentTime(os);
|
||||
|
||||
os << tab << total
|
||||
<< tab << pressure
|
||||
@ -668,7 +668,7 @@ void Foam::functionObjects::forces::writeBinnedForceMoment
|
||||
|
||||
Ostream& os = osPtr();
|
||||
|
||||
writeTime(os);
|
||||
writeCurrentTime(os);
|
||||
|
||||
forAll(f[0], i)
|
||||
{
|
||||
|
@ -147,7 +147,7 @@ bool Foam::functionObjects::cloudInfo::write()
|
||||
{
|
||||
auto& os = files(cloudi);
|
||||
|
||||
writeTime(os);
|
||||
writeCurrentTime(os);
|
||||
os
|
||||
<< token::TAB << nTotParcels
|
||||
<< token::TAB << totMass
|
||||
|
@ -182,7 +182,7 @@ bool Foam::functionObjects::solverInfo::execute()
|
||||
initialised_ = true;
|
||||
}
|
||||
|
||||
writeTime(file());
|
||||
writeCurrentTime(file());
|
||||
|
||||
for (const word& fieldName : fieldSet_.selectionNames())
|
||||
{
|
||||
|
@ -103,7 +103,7 @@ bool Foam::functionObjects::timeInfo::write()
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
writeTime(file());
|
||||
writeCurrentTime(file());
|
||||
|
||||
const scalar cpuTimeNow(time_.elapsedCpuTime());
|
||||
const scalar clockTimeNow(time_.elapsedClockTime());
|
||||
|
@ -219,6 +219,15 @@ public:
|
||||
//- Read fields
|
||||
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
|
||||
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
|
||||
(
|
||||
Cloud<injectedParticle>& c,
|
||||
|
@ -666,6 +666,41 @@ public:
|
||||
|
||||
// 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
|
||||
template<class TrackCloudType>
|
||||
static void readFields(TrackCloudType& c);
|
||||
@ -674,6 +709,15 @@ public:
|
||||
template<class TrackCloudType>
|
||||
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
|
||||
template<class CloudType>
|
||||
static void readObjects(CloudType& c, const objectRegistry& obr);
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
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
|
||||
{
|
||||
if (os.format() == IOstream::ASCII)
|
||||
|
@ -40,6 +40,102 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * 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>
|
||||
void Foam::particle::readFields(TrackCloudType& c)
|
||||
{
|
||||
|
@ -323,6 +323,15 @@ public:
|
||||
template<class CloudType>
|
||||
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
|
||||
template<class CloudType>
|
||||
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 CloudType>
|
||||
void Foam::CollidingParcel<ParcelType>::readObjects
|
||||
|
@ -659,6 +659,15 @@ public:
|
||||
template<class TrackCloudType>
|
||||
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
|
||||
template<class CloudType>
|
||||
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 CloudType>
|
||||
void Foam::KinematicParcel<ParcelType>::readObjects
|
||||
|
@ -308,6 +308,15 @@ public:
|
||||
template<class CloudType>
|
||||
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
|
||||
template<class CloudType>
|
||||
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 CloudType>
|
||||
void Foam::MPPICParcel<ParcelType>::readObjects
|
||||
|
@ -371,6 +371,15 @@ public:
|
||||
template<class CloudType>
|
||||
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
|
||||
// - no composition
|
||||
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 CloudType>
|
||||
void Foam::ReactingHeterogeneousParcel<ParcelType>::readObjects
|
||||
|
@ -462,6 +462,15 @@ public:
|
||||
template<class CloudType>
|
||||
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
|
||||
// - no composition
|
||||
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 CloudType>
|
||||
void Foam::ReactingMultiphaseParcel<ParcelType>::readObjects
|
||||
|
@ -414,6 +414,14 @@ public:
|
||||
template<class CloudType>
|
||||
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
|
||||
// - 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 CloudType>
|
||||
void Foam::ReactingParcel<ParcelType>::readObjects
|
||||
|
@ -455,6 +455,15 @@ public:
|
||||
template<class CloudType>
|
||||
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
|
||||
template<class CloudType>
|
||||
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 CloudType>
|
||||
void Foam::ThermoParcel<ParcelType>::readObjects
|
||||
|
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -66,9 +66,7 @@ Foam::CloudFunctionObject<CloudType>::CloudFunctionObject
|
||||
(
|
||||
owner.mesh().time().globalPath()
|
||||
/ functionObject::outputPrefix
|
||||
/ cloud::prefix
|
||||
/ owner.name()
|
||||
/ this->modelName()
|
||||
/ this->localPath()
|
||||
);
|
||||
|
||||
outputDir_.clean(); // Remove unneeded ".."
|
||||
|
@ -40,15 +40,7 @@ Foam::label Foam::PatchPostProcessing<CloudType>::applyToPatch
|
||||
const label globalPatchi
|
||||
) const
|
||||
{
|
||||
forAll(patchIDs_, i)
|
||||
{
|
||||
if (patchIDs_[i] == globalPatchi)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
return patchIDs_.find(globalPatchi);
|
||||
}
|
||||
|
||||
|
||||
@ -100,7 +92,7 @@ void Foam::PatchPostProcessing<CloudType>::write()
|
||||
|
||||
labelList indices(sortedOrder(globalTimes));
|
||||
|
||||
string header("# Time currentProc " + parcelType::propertyList_);
|
||||
string header("# Time currentProc " + header_);
|
||||
patchOutFile<< header.c_str() << nl;
|
||||
|
||||
forAll(globalTimes, i)
|
||||
@ -132,37 +124,40 @@ Foam::PatchPostProcessing<CloudType>::PatchPostProcessing
|
||||
:
|
||||
CloudFunctionObject<CloudType>(dict, owner, modelName, typeName),
|
||||
maxStoredParcels_(this->coeffDict().getScalar("maxStoredParcels")),
|
||||
fields_(),
|
||||
patchIDs_(),
|
||||
times_(),
|
||||
patchData_()
|
||||
patchData_(),
|
||||
header_()
|
||||
{
|
||||
const wordList allPatchNames(owner.mesh().boundaryMesh().names());
|
||||
const wordReList patchNames(this->coeffDict().lookup("patches"));
|
||||
// The "fields" filter is optional
|
||||
this->coeffDict().readIfPresent("fields", fields_);
|
||||
|
||||
labelHashSet uniqIds;
|
||||
for (const wordRe& re : patchNames)
|
||||
// The "patches" are required
|
||||
const wordRes patchMatcher(this->coeffDict().lookup("patches"));
|
||||
|
||||
patchIDs_ = patchMatcher.matching(owner.mesh().boundaryMesh().names());
|
||||
|
||||
if (patchIDs_.empty())
|
||||
{
|
||||
labelList ids = findStrings(re, allPatchNames);
|
||||
|
||||
if (ids.empty())
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Cannot find any patch names matching " << re
|
||||
<< endl;
|
||||
}
|
||||
|
||||
uniqIds.insert(ids);
|
||||
WarningInFunction
|
||||
<< "No matching patches found: "
|
||||
<< flatOutput(patchMatcher) << nl;
|
||||
}
|
||||
|
||||
patchIDs_ = uniqIds.sortedToc();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Post-process fields "
|
||||
<< flatOutput(fields_) << nl;
|
||||
|
||||
Info<< "On patches (";
|
||||
|
||||
for (const label patchi : patchIDs_)
|
||||
{
|
||||
Info<< "Post-process patch "
|
||||
<< owner.mesh().boundaryMesh()[patchi].name() << endl;
|
||||
Info<< ' ' << owner.mesh().boundaryMesh()[patchi].name();
|
||||
}
|
||||
|
||||
Info<< " )" << nl;
|
||||
}
|
||||
|
||||
patchData_.setSize(patchIDs_.size());
|
||||
@ -178,9 +173,11 @@ Foam::PatchPostProcessing<CloudType>::PatchPostProcessing
|
||||
:
|
||||
CloudFunctionObject<CloudType>(ppm),
|
||||
maxStoredParcels_(ppm.maxStoredParcels_),
|
||||
fields_(ppm.fields_),
|
||||
patchIDs_(ppm.patchIDs_),
|
||||
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 localPatchi = applyToPatch(patchi);
|
||||
|
||||
if (header_.empty())
|
||||
{
|
||||
OStringStream data;
|
||||
p.writeProperties(data, fields_, " ", true);
|
||||
header_ = data.str();
|
||||
}
|
||||
|
||||
if (localPatchi != -1 && patchData_[localPatchi].size() < maxStoredParcels_)
|
||||
{
|
||||
times_[localPatchi].append(this->owner().time().value());
|
||||
|
||||
OStringStream data;
|
||||
data<< Pstream::myProcNo() << ' ' << p;
|
||||
data<< Pstream::myProcNo();
|
||||
p.writeProperties(data, fields_, " ", false);
|
||||
|
||||
patchData_[localPatchi].append(data.str());
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
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
|
||||
scalar maxStoredParcels_;
|
||||
|
||||
//- Field name filters
|
||||
wordRes fields_;
|
||||
|
||||
//- List of patch indices to post-process
|
||||
labelList patchIDs_;
|
||||
|
||||
@ -72,6 +76,9 @@ class PatchPostProcessing
|
||||
//- List of output data per patch
|
||||
List<DynamicList<string>> patchData_;
|
||||
|
||||
//- Field header
|
||||
string header_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
@ -26,6 +26,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "CloudSubModelBase.H"
|
||||
#include "cloud.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * 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>
|
||||
void Foam::CloudSubModelBase<CloudType>::write(Ostream& os) const
|
||||
{
|
||||
|
@ -109,6 +109,9 @@ public:
|
||||
//- Flag to indicate when to write a property
|
||||
virtual bool writeTime() const;
|
||||
|
||||
//- Output directory
|
||||
virtual fileName localPath() const;
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,6 +30,27 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * 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>
|
||||
Foam::LocalInteraction<CloudType>::LocalInteraction
|
||||
(
|
||||
@ -356,7 +377,7 @@ void Foam::LocalInteraction<CloudType>::info(Ostream& os)
|
||||
|
||||
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.
|
||||
labelList indexToInjector(injIdToIndex_.size());
|
||||
forAllConstIters(injIdToIndex_, iter)
|
||||
@ -364,34 +385,52 @@ void Foam::LocalInteraction<CloudType>::info(Ostream& os)
|
||||
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
|
||||
<< " - escape (injector " << indexToInjector[idx]
|
||||
<< " ) = " << npe[i][idx]
|
||||
<< ", " << mpe[i][idx] << nl
|
||||
<< " - stick (injector " << indexToInjector[idx]
|
||||
<< " ) = " << nps[i][idx]
|
||||
<< ", " << mps[i][idx] << nl;
|
||||
<< " - escape (injector " << indexToInjector[indexi]
|
||||
<< " ) = " << npe[patchi][indexi]
|
||||
<< ", " << mpe[patchi][indexi] << nl
|
||||
<< " - stick (injector " << indexToInjector[indexi]
|
||||
<< " ) = " << nps[patchi][indexi]
|
||||
<< ", " << mps[patchi][indexi] << nl;
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
<< " - escape = "
|
||||
<< npe[i][0] << ", " << mpe[i][0] << nl
|
||||
<< npe[patchi][0] << ", " << mpe[patchi][0] << nl
|
||||
<< " - 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())
|
||||
{
|
||||
this->setModelProperty("nEscape", npe);
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -61,19 +61,21 @@ class LocalInteraction
|
||||
//- List of participating patches
|
||||
const patchInteractionDataList patchData_;
|
||||
|
||||
// Bookkeeping for particle fates
|
||||
|
||||
//- Number of parcels escaped
|
||||
List<List<label>> nEscape_;
|
||||
// Bookkeeping for particle fates
|
||||
|
||||
//- Mass of parcels escaped
|
||||
List<List<scalar>> massEscape_;
|
||||
//- Number of parcels escaped
|
||||
List<List<label>> nEscape_;
|
||||
|
||||
//- Number of parcels stuck to patches
|
||||
List<List<label>> nStick_;
|
||||
//- Mass of parcels escaped
|
||||
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
|
||||
bool writeFields_;
|
||||
@ -89,6 +91,13 @@ class LocalInteraction
|
||||
autoPtr<volScalarField> massStickPtr_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Output file header information
|
||||
virtual void writeFileHeader(Ostream& os);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
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 * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
@ -120,6 +134,7 @@ Foam::PatchInteractionModel<CloudType>::PatchInteractionModel
|
||||
)
|
||||
:
|
||||
CloudSubModelBase<CloudType>(owner),
|
||||
functionObjects::writeFile(owner, this->localPath(), typeName, false),
|
||||
UName_("unknown_U"),
|
||||
escapedParcels_(0),
|
||||
escapedMass_(0.0)
|
||||
@ -135,6 +150,14 @@ Foam::PatchInteractionModel<CloudType>::PatchInteractionModel
|
||||
)
|
||||
:
|
||||
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"))),
|
||||
escapedParcels_(0),
|
||||
escapedMass_(0.0)
|
||||
@ -148,6 +171,7 @@ Foam::PatchInteractionModel<CloudType>::PatchInteractionModel
|
||||
)
|
||||
:
|
||||
CloudSubModelBase<CloudType>(pim),
|
||||
functionObjects::writeFile(pim),
|
||||
UName_(pim.UName_),
|
||||
escapedParcels_(pim.escapedParcels_),
|
||||
escapedMass_(pim.escapedMass_)
|
||||
@ -170,7 +194,7 @@ void Foam::PatchInteractionModel<CloudType>::addToEscapedParcels
|
||||
)
|
||||
{
|
||||
escapedMass_ += mass;
|
||||
escapedParcels_++;
|
||||
++escapedParcels_;
|
||||
}
|
||||
|
||||
|
||||
@ -191,6 +215,18 @@ void Foam::PatchInteractionModel<CloudType>::info(Ostream& os)
|
||||
<< " - escape = " << escapedParcelsTotal
|
||||
<< ", " << 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())
|
||||
{
|
||||
this->setBaseProperty("escapedParcels", escapedParcelsTotal);
|
||||
|
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -48,6 +49,7 @@ SourceFiles
|
||||
#include "wallPolyPatch.H"
|
||||
#include "tetIndices.H"
|
||||
#include "CloudSubModelBase.H"
|
||||
#include "writeFile.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -61,7 +63,8 @@ namespace Foam
|
||||
template<class CloudType>
|
||||
class PatchInteractionModel
|
||||
:
|
||||
public CloudSubModelBase<CloudType>
|
||||
public CloudSubModelBase<CloudType>,
|
||||
public functionObjects::writeFile
|
||||
{
|
||||
public:
|
||||
|
||||
@ -82,7 +85,7 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
// Private data
|
||||
// Protected data
|
||||
|
||||
//- Name of velocity field - default = "U"
|
||||
const word UName_;
|
||||
@ -97,6 +100,11 @@ protected:
|
||||
scalar escapedMass_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Output file header information
|
||||
virtual void writeFileHeader(Ostream& os);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -28,6 +28,29 @@ License
|
||||
|
||||
#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 * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
@ -51,8 +74,8 @@ Foam::StandardWallInteraction<CloudType>::StandardWallInteraction
|
||||
massStick_(nEscape_.size()),
|
||||
injIdToIndex_()
|
||||
{
|
||||
const bool outputByInjectorId
|
||||
= this->coeffDict().lookupOrDefault("outputByInjectorId", false);
|
||||
const bool outputByInjectorId =
|
||||
this->coeffDict().lookupOrDefault("outputByInjectorId", false);
|
||||
|
||||
switch (interactionType_)
|
||||
{
|
||||
@ -277,33 +300,48 @@ void Foam::StandardWallInteraction<CloudType>::info(Ostream& os)
|
||||
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
|
||||
<< " - escape (injector " << indexToInjector[idx]
|
||||
<< ") = " << npe[i][idx]
|
||||
<< ", " << mpe[i][idx] << nl
|
||||
<< " - stick (injector " << indexToInjector[idx]
|
||||
<< ") = " << nps[i][idx]
|
||||
<< ", " << mps[i][idx] << nl;
|
||||
<< " - escape (injector " << indexToInjector[indexi]
|
||||
<< ") = " << npe[patchi][indexi]
|
||||
<< ", " << mpe[patchi][indexi] << nl
|
||||
<< " - stick (injector " << indexToInjector[indexi]
|
||||
<< ") = " << nps[patchi][indexi]
|
||||
<< ", " << 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
|
||||
{
|
||||
forAll(npe, i)
|
||||
forAll(npe, patchi)
|
||||
{
|
||||
os << " Parcel fate: patch (number, mass) "
|
||||
<< mesh_.boundary()[i].name() << nl
|
||||
<< " - escape = "
|
||||
<< npe[i][0] << ", " << mpe[i][0] << nl
|
||||
<< " - stick = "
|
||||
<< nps[i][0] << ", " << mps[i][0] << nl;
|
||||
const word& patchName = mesh_.boundary()[patchi].name();
|
||||
|
||||
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())
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -85,19 +85,21 @@ protected:
|
||||
//- Restitution coefficient
|
||||
scalar mu_;
|
||||
|
||||
// Bookkeeping for particle fates
|
||||
|
||||
//- Number of parcels escaped
|
||||
List<List<label>> nEscape_;
|
||||
// Bookkeeping for particle fates
|
||||
|
||||
//- Mass of parcels escaped
|
||||
List<List<scalar>> massEscape_;
|
||||
//- Number of parcels escaped
|
||||
List<List<label>> nEscape_;
|
||||
|
||||
//- Number of parcels stuck to patches
|
||||
List<List<label>> nStick_;
|
||||
//- Mass of parcels escaped
|
||||
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
|
||||
bool outputByInjectorId_;
|
||||
@ -107,6 +109,12 @@ protected:
|
||||
Map<label> injIdToIndex_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Output file header information
|
||||
virtual void writeFileHeader(Ostream& os);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
|
@ -501,6 +501,15 @@ public:
|
||||
template<class CloudType>
|
||||
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
|
||||
// - no composition
|
||||
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 CloudType>
|
||||
void Foam::SprayParcel<ParcelType>::readObjects
|
||||
|
@ -165,7 +165,7 @@ bool Foam::functionObjects::sixDoFRigidBodyState::write()
|
||||
}
|
||||
}
|
||||
|
||||
writeTime(file());
|
||||
writeCurrentTime(file());
|
||||
file()
|
||||
<< tab
|
||||
<< motion.centreOfRotation() << tab
|
||||
|
@ -120,7 +120,7 @@ bool Foam::functionObjects::specieReactionRates<ChemistryModelType>::write()
|
||||
|
||||
for (label ri=0; ri<nReaction; ri++)
|
||||
{
|
||||
writeTime(file());
|
||||
writeCurrentTime(file());
|
||||
file() << token::TAB << ri;
|
||||
|
||||
for (label si=0; si<nSpecie; si++)
|
||||
|
@ -121,6 +121,8 @@ subModels
|
||||
type escape;
|
||||
}
|
||||
);
|
||||
|
||||
writeToFile yes;
|
||||
}
|
||||
|
||||
RanzMarshallCoeffs
|
||||
@ -162,6 +164,7 @@ cloudFunctions
|
||||
patchPostProcessing1
|
||||
{
|
||||
type patchPostProcessing;
|
||||
fields (position "U.*" d T nParticle);
|
||||
maxStoredParcels 20;
|
||||
patches
|
||||
(
|
||||
|
Loading…
Reference in New Issue
Block a user