mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Added optional naming of averaging window
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -77,6 +77,8 @@ Description
|
||||
mean on;
|
||||
prime2Mean on;
|
||||
base time;
|
||||
window 10.0;
|
||||
windowName w1;
|
||||
}
|
||||
p
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -42,7 +42,15 @@ void Foam::fieldAverage::addMeanField
|
||||
|
||||
const word& fieldName = faItems_[fieldI].fieldName();
|
||||
|
||||
const word meanFieldName = fieldName + EXT_MEAN;
|
||||
word meanFieldName = fieldName + EXT_MEAN;
|
||||
if
|
||||
(
|
||||
(faItems_[fieldI].window() > 0)
|
||||
&& (faItems_[fieldI].windowName() != "")
|
||||
)
|
||||
{
|
||||
meanFieldName = meanFieldName + "_" + faItems_[fieldI].windowName();
|
||||
}
|
||||
|
||||
Info<< "Reading/calculating field " << meanFieldName << nl << endl;
|
||||
|
||||
@ -100,7 +108,16 @@ void Foam::fieldAverage::addPrime2MeanField
|
||||
|
||||
const word& fieldName = faItems_[fieldI].fieldName();
|
||||
|
||||
const word meanFieldName = fieldName + EXT_PRIME2MEAN;
|
||||
word meanFieldName = fieldName + EXT_PRIME2MEAN;
|
||||
if
|
||||
(
|
||||
(faItems_[fieldI].window() > 0)
|
||||
&& (faItems_[fieldI].windowName() != "")
|
||||
)
|
||||
{
|
||||
meanFieldName = meanFieldName + "_" + faItems_[fieldI].windowName();
|
||||
}
|
||||
|
||||
Info<< "Reading/calculating field " << meanFieldName << nl << endl;
|
||||
|
||||
if (obr_.foundObject<fieldType2>(meanFieldName))
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -54,7 +54,8 @@ Foam::fieldAverageItem::fieldAverageItem()
|
||||
mean_(0),
|
||||
prime2Mean_(0),
|
||||
base_(ITER),
|
||||
window_(-1.0)
|
||||
window_(-1.0),
|
||||
windowName_("")
|
||||
{}
|
||||
|
||||
|
||||
@ -64,7 +65,8 @@ Foam::fieldAverageItem::fieldAverageItem(const fieldAverageItem& faItem)
|
||||
mean_(faItem.mean_),
|
||||
prime2Mean_(faItem.prime2Mean_),
|
||||
base_(faItem.base_),
|
||||
window_(faItem.window_)
|
||||
window_(faItem.window_),
|
||||
windowName_(faItem.windowName_)
|
||||
{}
|
||||
|
||||
|
||||
@ -94,6 +96,7 @@ void Foam::fieldAverageItem::operator=(const fieldAverageItem& rhs)
|
||||
prime2Mean_ = rhs.prime2Mean_;
|
||||
base_ = rhs.base_;
|
||||
window_ = rhs.window_;
|
||||
windowName_ = rhs.windowName_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -34,6 +34,7 @@ Description
|
||||
prime2Mean on;
|
||||
base time; // iteration
|
||||
window 200; // optional averaging window
|
||||
windowName w1; // optional window name (default = "")
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
@ -107,6 +108,9 @@ private:
|
||||
//- Averaging window - defaults to -1 for 'all iters/time'
|
||||
scalar window_;
|
||||
|
||||
//- Averaging window name - defaults to 'window'
|
||||
word windowName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -171,6 +175,11 @@ public:
|
||||
return window_;
|
||||
}
|
||||
|
||||
const word& windowName() const
|
||||
{
|
||||
return windowName_;
|
||||
}
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
@ -190,7 +199,8 @@ public:
|
||||
&& a.mean_ == b.mean_
|
||||
&& a.prime2Mean_ == b.prime2Mean_
|
||||
&& a.base_ == b.base_
|
||||
&& a.window_ == b.window_;
|
||||
&& a.window_ == b.window_
|
||||
&& a.windowName_ == b.windowName_;
|
||||
}
|
||||
|
||||
friend bool operator!=
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -46,6 +46,7 @@ Foam::fieldAverageItem::fieldAverageItem(Istream& is)
|
||||
entry.lookup("prime2Mean") >> prime2Mean_;
|
||||
base_ = baseTypeNames_[entry.lookup("base")];
|
||||
window_ = entry.lookupOrDefault<scalar>("window", -1.0);
|
||||
windowName_ = entry.lookupOrDefault<word>("windowName", "");
|
||||
}
|
||||
|
||||
|
||||
@ -66,6 +67,7 @@ Foam::Istream& Foam::operator>>(Istream& is, fieldAverageItem& faItem)
|
||||
entry.lookup("prime2Mean") >> faItem.prime2Mean_;
|
||||
faItem.base_ = faItem.baseTypeNames_[entry.lookup("base")];
|
||||
faItem.window_ = entry.lookupOrDefault<scalar>("window", -1.0);
|
||||
faItem.windowName_ = entry.lookupOrDefault<word>("windowName", "");
|
||||
|
||||
return is;
|
||||
}
|
||||
@ -90,6 +92,12 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const fieldAverageItem& faItem)
|
||||
{
|
||||
os.writeKeyword("window") << faItem.window_
|
||||
<< token::END_STATEMENT << nl;
|
||||
|
||||
if (faItem.windowName_ != "")
|
||||
{
|
||||
os.writeKeyword("windowName") << faItem.windowName_
|
||||
<< token::END_STATEMENT << nl;
|
||||
}
|
||||
}
|
||||
|
||||
os << token::END_BLOCK << nl;
|
||||
|
||||
Reference in New Issue
Block a user