mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Function object updates
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -159,10 +159,7 @@ void Foam::fieldMinMax::write()
|
||||
{
|
||||
functionObjectFile::write();
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
}
|
||||
Info(log_)<< type() << " " << name_ << " output:" << nl;
|
||||
|
||||
forAll(fieldSet_, fieldI)
|
||||
{
|
||||
@ -173,10 +170,7 @@ void Foam::fieldMinMax::write()
|
||||
calcMinMaxFields<tensor>(fieldSet_[fieldI], mode_);
|
||||
}
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< endl;
|
||||
}
|
||||
Info(log_)<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -139,6 +139,20 @@ protected:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Helper function to write the output
|
||||
template<class Type>
|
||||
void output
|
||||
(
|
||||
const word& fieldName,
|
||||
const word& outputName,
|
||||
const vector& minC,
|
||||
const vector& maxC,
|
||||
const label minProcI,
|
||||
const label maxProcI,
|
||||
const Type& minValue,
|
||||
const Type& maxValue
|
||||
);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
fieldMinMax(const fieldMinMax&);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -31,6 +31,62 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::fieldMinMax::output
|
||||
(
|
||||
const word& fieldName,
|
||||
const word& outputName,
|
||||
const vector& minC,
|
||||
const vector& maxC,
|
||||
const label minProcI,
|
||||
const label maxProcI,
|
||||
const Type& minValue,
|
||||
const Type& maxValue
|
||||
)
|
||||
{
|
||||
file()<< obr_.time().value();
|
||||
writeTabbed(file(), fieldName);
|
||||
|
||||
file()
|
||||
<< token::TAB << minValue
|
||||
<< token::TAB << minC;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
file()<< token::TAB << minProcI;
|
||||
}
|
||||
|
||||
file()
|
||||
<< token::TAB << maxValue
|
||||
<< token::TAB << maxC;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
file()<< token::TAB << maxProcI;
|
||||
}
|
||||
|
||||
file() << endl;
|
||||
|
||||
Info(log_)<< " min(" << outputName << ") = "
|
||||
<< minValue << " at position " << minC;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
Info(log_)<< " on processor " << minProcI;
|
||||
}
|
||||
|
||||
Info(log_)<< nl << " max(" << outputName << ") = "
|
||||
<< maxValue << " at position " << maxC;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
Info(log_)<< " on processor " << maxProcI;
|
||||
}
|
||||
|
||||
Info(log_)<< endl;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::fieldMinMax::calcMinMaxFields
|
||||
(
|
||||
@ -111,49 +167,17 @@ void Foam::fieldMinMax::calcMinMaxFields
|
||||
scalar maxValue = maxVs[maxI];
|
||||
const vector& maxC = maxCs[maxI];
|
||||
|
||||
file()<< obr_.time().value();
|
||||
writeTabbed(file(), fieldName);
|
||||
|
||||
file()
|
||||
<< token::TAB << minValue
|
||||
<< token::TAB << minC;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
file()<< token::TAB << minI;
|
||||
}
|
||||
|
||||
file()
|
||||
<< token::TAB << maxValue
|
||||
<< token::TAB << maxC;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
file()<< token::TAB << maxI;
|
||||
}
|
||||
|
||||
file() << endl;
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< " min(mag(" << fieldName << ")) = "
|
||||
<< minValue << " at position " << minC;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
Info<< " on processor " << minI;
|
||||
}
|
||||
|
||||
Info<< nl << " max(mag(" << fieldName << ")) = "
|
||||
<< maxValue << " at position " << maxC;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
Info<< " on processor " << maxI;
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
}
|
||||
output
|
||||
(
|
||||
fieldName,
|
||||
word("mag(" + fieldName + ")"),
|
||||
minC,
|
||||
maxC,
|
||||
minI,
|
||||
maxI,
|
||||
minValue,
|
||||
maxValue
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -216,49 +240,17 @@ void Foam::fieldMinMax::calcMinMaxFields
|
||||
Type maxValue = maxVs[maxI];
|
||||
const vector& maxC = maxCs[maxI];
|
||||
|
||||
file()<< obr_.time().value();
|
||||
writeTabbed(file(), fieldName);
|
||||
|
||||
file()
|
||||
<< token::TAB << minValue
|
||||
<< token::TAB << minC;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
file()<< token::TAB << minI;
|
||||
}
|
||||
|
||||
file()
|
||||
<< token::TAB << maxValue
|
||||
<< token::TAB << maxC;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
file()<< token::TAB << maxI;
|
||||
}
|
||||
|
||||
file() << endl;
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< " min(" << fieldName << ") = "
|
||||
<< minValue << " at position " << minC;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
Info<< " on processor " << minI;
|
||||
}
|
||||
|
||||
Info<< nl << " max(" << fieldName << ") = "
|
||||
<< maxValue << " at position " << maxC;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
Info<< " on processor " << maxI;
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
}
|
||||
output
|
||||
(
|
||||
fieldName,
|
||||
fieldName,
|
||||
minC,
|
||||
maxC,
|
||||
minI,
|
||||
maxI,
|
||||
minValue,
|
||||
maxValue
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user