Go to the documentation of this file.
69 if (log_)
Info <<
type() <<
" " << name_ <<
":" <<
nl;
75 addMeanField<scalar>(fieldI);
76 addMeanField<vector>(fieldI);
77 addMeanField<sphericalTensor>(fieldI);
78 addMeanField<symmTensor>(fieldI);
79 addMeanField<tensor>(fieldI);
85 addPrime2MeanField<scalar, scalar>(fieldI);
86 addPrime2MeanField<vector, symmTensor>(fieldI);
91 if (!faItems_[fieldI].active())
94 <<
"Field " << faItems_[fieldI].fieldName()
95 <<
" not found in database for averaging";
115 const label currentTimeIndex =
116 static_cast<const fvMesh&
>(obr_).time().timeIndex();
118 if (prevTimeIndex_ == currentTimeIndex)
124 prevTimeIndex_ = currentTimeIndex;
128 <<
type() <<
" " << name_ <<
" output:" <<
nl
129 <<
" Calculating averages" <<
nl;
131 addMeanSqrToPrime2Mean<scalar, scalar>();
132 addMeanSqrToPrime2Mean<vector, symmTensor>();
134 calculateMeanFields<scalar>();
135 calculateMeanFields<vector>();
136 calculateMeanFields<sphericalTensor>();
137 calculateMeanFields<symmTensor>();
138 calculateMeanFields<tensor>();
140 calculatePrime2MeanFields<scalar, scalar>();
141 calculatePrime2MeanFields<vector, symmTensor>();
145 totalIter_[fieldI]++;
146 totalTime_[fieldI] += obr_.time().deltaTValue();
153 if (log_)
Info <<
" Writing average fields" <<
endl;
155 writeFields<scalar>();
156 writeFields<vector>();
157 writeFields<sphericalTensor>();
158 writeFields<symmTensor>();
159 writeFields<tensor>();
167 const word& fieldName = faItems_[fieldI].fieldName();
180 totalIter_.setSize(faItems_.size(), 1);
183 totalTime_.setSize(faItems_.size(), obr_.time().deltaTValue());
185 if (log_ && (resetOnRestart_ || resetOnOutput_))
187 Info<<
" Starting averaging at time " << obr_.time().timeName()
192 if (log_)
Info <<
" Restarting averaging for fields:" <<
nl;
196 const word& fieldName = faItems_[fieldI].fieldName();
197 if (foundProperty(fieldName))
200 getProperty(fieldName, fieldDict);
207 <<
" iters = " << totalIter_[fieldI]
208 <<
" time = " << totalTime_[fieldI] <<
nl;
214 <<
": starting averaging at time "
215 << obr_.time().timeName() <<
endl;
229 const bool loadFromFiles
235 resetOnRestart_(
false),
236 resetOnOutput_(
false),
244 if (setActive<fvMesh>())
263 initialised_ =
false;
265 log_.readIfPresent(
"log",
dict);
267 if (log_)
Info <<
type() <<
" " << name_ <<
":" <<
nl;
273 readAveragingProperties();
303 writeAveragingProperties();
308 <<
" Restarting averaging at time " << obr_.time().timeName()
312 totalIter_.setSize(faItems_.size(), 1);
315 totalTime_.setSize(faItems_.size(), obr_.time().deltaTValue());
virtual void writeAverages() const
Write averages.
virtual void movePoints(const polyMesh &)
Move points.
List< fieldAverageItem > faItems_
List of field average items, describing what averages to be.
A class for handling words, derived from string.
Base class for function objects, adding functionality to read/write state information (data required ...
#define forAll(list, i)
Loop across all elements in list.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
bool read(const char *, int32_t &)
void writeAveragingProperties()
Write averaging properties - steps and time.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual void timeSet()
Called when time was set at the end of the Time::operator++.
void readAveragingProperties()
Read averaging properties - steps and time.
virtual void updateMesh(const mapPolyMesh &)
Update mesh.
Mesh consisting of general polyhedral cells.
fieldAverage(const fieldAverage &)
Disallow default bitwise copy construct.
Registry of regIOobjects.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
virtual void end()
Execute the averaging at the final time-loop, currently does nothing.
virtual void execute()
Execute the averaging.
IOdictionary propsDict(IOobject("particleTrackProperties", runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED))
A list of keyword definitions, which are a keyword followed by any number of values (e....
virtual void calcAverages()
Main calculation routine.
bool found(const Key &) const
Return true if hashedEntry is found in table.
Mesh data needed to do the Finite Volume discretisation.
const objectRegistry & obr_
Reference to the database.
virtual void read(const dictionary &)
Read the field average data.
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
bool checkOut(regIOobject &) const
Remove an regIOobject from registry.
virtual ~fieldAverage()
Destructor.
label readLabel(Istream &is)
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
virtual void write()
Calculate the field average data and write.
defineTypeNameAndDebug(combustionModel, 0)
#define WarningInFunction
Report a warning using Foam::Warning.
word name(const complex &)
Return a string representation of a complex.
void initialize()
Reset lists (clear existing values) and initialize averaging.
void resetFields()
Checkout fields (causes deletion) from the database.
bool add(entry *, bool mergeEntry=false)
Add a new entry.