mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: residuals FO updated follwing changes to functionObjectFile and minor code formatting
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -35,6 +35,23 @@ namespace Foam
|
||||
defineTypeNameAndDebug(residuals, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
void Foam::residuals::writeFileHeader(Ostream& os) const
|
||||
{
|
||||
writeHeader(os, "Residuals");
|
||||
writeCommented(os, "Time");
|
||||
|
||||
forAll(fieldSet_, fieldI)
|
||||
{
|
||||
writeTabbed(os, fieldSet_[fieldI]);
|
||||
}
|
||||
|
||||
os << endl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::residuals::residuals
|
||||
@ -45,7 +62,7 @@ Foam::residuals::residuals
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
functionObjectFile(obr, name, typeName),
|
||||
functionObjectFile(obr, name, typeName, dict),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
@ -68,7 +85,11 @@ Foam::residuals::residuals
|
||||
<< endl;
|
||||
}
|
||||
|
||||
read(dict);
|
||||
if (active_)
|
||||
{
|
||||
read(dict);
|
||||
writeFileHeader(file());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -84,24 +105,11 @@ void Foam::residuals::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
dict.lookup("fields") >> fieldSet_;
|
||||
}
|
||||
}
|
||||
functionObjectFile::read(dict);
|
||||
|
||||
|
||||
void Foam::residuals::writeFileHeader(const label i)
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
writeHeader(file(), "Residuals");
|
||||
writeCommented(file(), "Time");
|
||||
|
||||
forAll(fieldSet_, fieldI)
|
||||
{
|
||||
writeTabbed(file(), fieldSet_[fieldI]);
|
||||
}
|
||||
|
||||
file() << endl;
|
||||
wordList allFields(dict.lookup("fields"));
|
||||
wordHashSet uniqueFields(allFields);
|
||||
fieldSet_ = uniqueFields.toc();
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,8 +136,6 @@ void Foam::residuals::write()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
functionObjectFile::write();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
file()<< obr_.time().value();
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -83,7 +83,7 @@ class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class residuals Declaration
|
||||
Class residuals Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class residuals
|
||||
@ -116,7 +116,7 @@ protected:
|
||||
void operator=(const residuals&);
|
||||
|
||||
//- Output file header information
|
||||
virtual void writeFileHeader(const label i);
|
||||
virtual void writeFileHeader(Ostream& os) const;
|
||||
|
||||
|
||||
public:
|
||||
@ -150,7 +150,7 @@ public:
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the field min/max data
|
||||
//- Read the field residuals data
|
||||
virtual void read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
@ -162,7 +162,7 @@ public:
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Calculate the field min/max
|
||||
//- Calculate the field residuals
|
||||
template<class Type>
|
||||
void writeResidual(const word& fieldName);
|
||||
|
||||
|
||||
@ -32,10 +32,7 @@ License
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::residuals::writeResidual
|
||||
(
|
||||
const word& fieldName
|
||||
)
|
||||
void Foam::residuals::writeResidual(const word& fieldName)
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user