ENH: Updated moving mesh support in function objects

This commit is contained in:
andy
2012-12-13 10:39:43 +00:00
parent 4cf6555419
commit 6aba1d08f8
8 changed files with 90 additions and 9 deletions

View File

@ -133,10 +133,10 @@ public:
} }
//- Update for changes of mesh //- Update for changes of mesh
virtual void movePoints(const pointField& points) virtual void movePoints(const polyMesh& mesh)
{ {
read(); read();
OutputFilter::movePoints(points); OutputFilter::movePoints(mesh);
} }
}; };

View File

@ -2,7 +2,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) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,6 +26,7 @@ License
#include "OutputFilterFunctionObject.H" #include "OutputFilterFunctionObject.H"
#include "IOOutputFilter.H" #include "IOOutputFilter.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "mapPolyMesh.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * Private Members * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Private Members * * * * * * * * * * * * * * //
@ -221,4 +222,30 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::read
} }
template<class OutputFilter>
void Foam::OutputFilterFunctionObject<OutputFilter>::updateMesh
(
const mapPolyMesh& mpm
)
{
if (active() && mpm.mesh().name() == regionName_)
{
ptr_->updateMesh(mpm);
}
}
template<class OutputFilter>
void Foam::OutputFilterFunctionObject<OutputFilter>::movePoints
(
const polyMesh& mesh
)
{
if (active() && mesh.name() == regionName_)
{
ptr_->movePoints(mesh);
}
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,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) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -204,6 +204,12 @@ public:
//- Read and set the function object if its data have changed //- Read and set the function object if its data have changed
virtual bool read(const dictionary&); virtual bool read(const dictionary&);
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh& mpm);
//- Update for changes of mesh
virtual void movePoints(const polyMesh& mesh);
}; };

View File

@ -2,7 +2,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) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,6 +49,8 @@ namespace Foam
// Forward declaration of classes // Forward declaration of classes
class Time; class Time;
class polyMesh;
class mapPolyMesh;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class functionObject Declaration Class functionObject Declaration
@ -157,6 +159,12 @@ public:
//- Read and set the function object if its data have changed //- Read and set the function object if its data have changed
virtual bool read(const dictionary&) = 0; virtual bool read(const dictionary&) = 0;
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh& mpm) = 0;
//- Update for changes of mesh
virtual void movePoints(const polyMesh& mesh) = 0;
}; };

View File

@ -2,7 +2,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) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,11 +25,15 @@ License
#include "functionObjectList.H" #include "functionObjectList.H"
#include "Time.H" #include "Time.H"
#include "mapPolyMesh.H"
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
Foam::functionObject* Foam::functionObject* Foam::functionObjectList::remove
Foam::functionObjectList::remove(const word& key, label& oldIndex) (
const word& key,
label& oldIndex
)
{ {
functionObject* ptr = 0; functionObject* ptr = 0;
@ -319,4 +323,28 @@ bool Foam::functionObjectList::read()
} }
void Foam::functionObjectList::updateMesh(const mapPolyMesh& mpm)
{
if (execution_)
{
forAll(*this, objectI)
{
operator[](objectI).updateMesh(mpm);
}
}
}
void Foam::functionObjectList::movePoints(const polyMesh& mesh)
{
if (execution_)
{
forAll(*this, objectI)
{
operator[](objectI).movePoints(mesh);
}
}
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,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) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,6 +49,8 @@ SourceFiles
namespace Foam namespace Foam
{ {
class mapPolyMesh;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class functionObjectList Declaration Class functionObjectList Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -163,6 +165,12 @@ public:
//- Read and set the function objects if their data have changed //- Read and set the function objects if their data have changed
virtual bool read(); virtual bool read();
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh& mpm);
//- Update for changes of mesh
virtual void movePoints(const polyMesh& mesh);
}; };

View File

@ -1173,6 +1173,8 @@ Foam::tmp<Foam::scalarField> Foam::polyMesh::movePoints
).movePoints(points_); ).movePoints(points_);
} }
const_cast<Time&>(time()).functionObjects().movePoints(*this);
return sweptVols; return sweptVols;
} }

View File

@ -109,6 +109,8 @@ void Foam::polyMesh::updateMesh(const mapPolyMesh& mpm)
) )
).updateMesh(mpm); ).updateMesh(mpm);
} }
const_cast<Time&>(time()).functionObjects().updateMesh(mpm);
} }