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