Skip to content
Snippets Groups Projects
Commit a440563a authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: cloudInfo FO updated follwing changes to functionObjectFile

Also added output of diameter info, D10, D32 and DMax
parent d856ba89
Branches
Tags
No related merge requests found
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
...@@ -37,13 +37,16 @@ namespace Foam ...@@ -37,13 +37,16 @@ namespace Foam
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::cloudInfo::writeFileHeader(const label i) void Foam::cloudInfo::writeFileHeader(Ostream& os) const
{ {
writeHeader(file(), "Cloud information"); writeHeader(os, "Cloud information");
writeCommented(file(), "Time"); writeCommented(os, "Time");
writeTabbed(file(), "nParcels"); writeTabbed(os, "nParcels");
writeTabbed(file(), "mass"); writeTabbed(os, "mass");
file() << endl; writeTabbed(os, "Dmax");
writeTabbed(os, "D10");
writeTabbed(os, "D32");
os << endl;
} }
...@@ -60,7 +63,10 @@ Foam::cloudInfo::cloudInfo ...@@ -60,7 +63,10 @@ Foam::cloudInfo::cloudInfo
functionObjectFile(obr, name), functionObjectFile(obr, name),
name_(name), name_(name),
obr_(obr), obr_(obr),
active_(true) active_(true),
log_(true),
cloudNames_(),
filePtrs_()
{ {
read(dict); read(dict);
} }
...@@ -78,47 +84,70 @@ void Foam::cloudInfo::read(const dictionary& dict) ...@@ -78,47 +84,70 @@ void Foam::cloudInfo::read(const dictionary& dict)
{ {
if (active_) if (active_)
{ {
functionObjectFile::resetNames(dict.lookup("clouds")); functionObjectFile::read(dict);
Info<< type() << " " << name_ << ": "; log_ = dict.lookupOrDefault<Switch>("log", true);
if (names().size()) dict.lookup("clouds") >> cloudNames_;
if (log_)
{ {
Info<< "applying to clouds:" << nl; Info<< type() << " " << name_ << ": ";
forAll(names(), i)
if (cloudNames_.size())
{
Info<< "applying to clouds:" << nl;
forAll(cloudNames_, i)
{
Info<< " " << cloudNames_[i] << nl;
}
Info<< endl;
}
else
{ {
Info<< " " << names()[i] << nl; Info<< "no clouds to be processed" << nl << endl;
} }
Info<< endl;
} }
else
if (writeToFile())
{ {
Info<< "no clouds to be processed" << nl << endl; filePtrs_.setSize(cloudNames_.size());
filePtrs_.clear();
forAll(filePtrs_, fileI)
{
const word& cloudName = cloudNames_[fileI];
filePtrs_.set(fileI, createFile(cloudName));
writeFileHeader(filePtrs_[fileI]);
}
} }
} }
} }
void Foam::cloudInfo::execute() void Foam::cloudInfo::execute()
{} {
// Do nothing
}
void Foam::cloudInfo::end() void Foam::cloudInfo::end()
{} {
// Do nothing
}
void Foam::cloudInfo::timeSet() void Foam::cloudInfo::timeSet()
{} {
// Do nothing
}
void Foam::cloudInfo::write() void Foam::cloudInfo::write()
{ {
if (active_) if (active_)
{ {
functionObjectFile::write(); forAll(cloudNames_, cloudI)
forAll(names(), i)
{ {
const word& cloudName = names()[i]; const word& cloudName = cloudNames_[cloudI];
const kinematicCloud& cloud = const kinematicCloud& cloud =
obr_.lookupObject<kinematicCloud>(cloudName); obr_.lookupObject<kinematicCloud>(cloudName);
...@@ -127,12 +156,31 @@ void Foam::cloudInfo::write() ...@@ -127,12 +156,31 @@ void Foam::cloudInfo::write()
scalar massInSystem = scalar massInSystem =
returnReduce(cloud.massInSystem(), sumOp<scalar>()); returnReduce(cloud.massInSystem(), sumOp<scalar>());
scalar Dmax = cloud.Dmax();
scalar D10 = cloud.Dij(1, 0);
scalar D32 = cloud.Dij(3, 2);
if (Pstream::master()) if (Pstream::master())
{ {
file(i) filePtrs_[cloudI]
<< obr_.time().value() << token::TAB << obr_.time().value() << token::TAB
<< nParcels << token::TAB << nParcels << token::TAB
<< massInSystem << endl; << massInSystem << token::TAB
<< Dmax << token::TAB
<< D10 << token::TAB
<< D32 << token::TAB
<< endl;
}
if (log_)
{
Info<< type() << " " << name_ << " output:" << nl
<< " number of parcels : " << nParcels << nl
<< " mass in system : " << massInSystem << nl
<< " maximum diameter : " << Dmax << nl
<< " D10 diameter : " << D10 << nl
<< " D32 diameter : " << D32 << nl
<< endl;
} }
} }
} }
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
...@@ -109,11 +109,20 @@ protected: ...@@ -109,11 +109,20 @@ protected:
//- on/off switch //- on/off switch
bool active_; bool active_;
//- Switch to send output to Info as well
Switch log_;
//- List of cloud names
wordList cloudNames_;
//- Output file per cloud
PtrList<OFstream> filePtrs_;
// Protected Member Functions // Protected Member Functions
//- File header information //- File header information
virtual void writeFileHeader(const label i); virtual void writeFileHeader(Ostream& os) const;
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
cloudInfo(const cloudInfo&); cloudInfo(const cloudInfo&);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment