Commit 82fb5093 authored by Andrew Heather's avatar Andrew Heather
Browse files

adding post-processing modelling capabilities

parent 88ea18c3
......@@ -31,6 +31,7 @@ License
#include "DispersionModel.H"
#include "DragModel.H"
#include "InjectionModel.H"
#include "PostProcessingModel.H"
#include "WallInteractionModel.H"
......@@ -131,6 +132,14 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
*this
)
),
postProcessingModel_
(
PostProcessingModel<KinematicCloud<ParcelType> >::New
(
this->particleProperties_,
*this
)
),
wallInteractionModel_
(
WallInteractionModel<KinematicCloud<ParcelType> >::New
......@@ -227,6 +236,8 @@ void Foam::KinematicCloud<ParcelType>::evolve()
}
Cloud<ParcelType>::move(td);
this->postProcessing().post();
}
......
......@@ -71,6 +71,9 @@ class DragModel;
template<class CloudType>
class InjectionModel;
template<class CloudType>
class PostProcessingModel;
template<class CloudType>
class WallInteractionModel;
......@@ -153,6 +156,10 @@ class KinematicCloud
autoPtr<InjectionModel<KinematicCloud<ParcelType> > >
injectionModel_;
//- Post-processing model
autoPtr<PostProcessingModel<KinematicCloud<ParcelType> > >
postProcessingModel_;
//- Wall interaction model
autoPtr<WallInteractionModel<KinematicCloud<ParcelType> > >
wallInteractionModel_;
......@@ -295,6 +302,10 @@ public:
inline InjectionModel<KinematicCloud<ParcelType> >&
injection();
//- Return reference to post-processing model
inline PostProcessingModel<KinematicCloud<ParcelType> >&
postProcessing();
//- Return reference to wall interaction model
inline const WallInteractionModel<KinematicCloud<ParcelType> >&
wallInteraction() const;
......
......@@ -166,6 +166,14 @@ Foam::KinematicCloud<ParcelType>::injection()
}
template<class ParcelType>
inline Foam::PostProcessingModel<Foam::KinematicCloud<ParcelType> >&
Foam::KinematicCloud<ParcelType>::postProcessing()
{
return postProcessingModel_();
}
template<class ParcelType>
inline const Foam::WallInteractionModel<Foam::KinematicCloud<ParcelType> >&
Foam::KinematicCloud<ParcelType>::wallInteraction() const
......
......@@ -215,6 +215,8 @@ void Foam::ReactingCloud<ParcelType>::evolve()
}
Cloud<ParcelType>::move(td);
this->postProcessing().post();
}
......
......@@ -190,6 +190,8 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::evolve()
}
Cloud<ParcelType>::move(td);
this->postProcessing().post();
}
......
......@@ -212,6 +212,8 @@ void Foam::ThermoCloud<ParcelType>::evolve()
}
Cloud<ParcelType>::move(td);
this->postProcessing().post();
}
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "NoPostProcessing.H"
// * * * * * * * * * * * * * protected Member Functions * * * * * * * * * * //
template<class CloudType>
void Foam::NoPostProcessing<CloudType>::write()
{
// do nothing
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::NoPostProcessing<CloudType>::NoPostProcessing
(
const dictionary&,
CloudType& owner
)
:
PostProcessingModel<CloudType>(owner)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::NoPostProcessing<CloudType>::~NoPostProcessing()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::NoPostProcessing<CloudType>::active() const
{
return false;
}
template<class CloudType>
void Foam::NoPostProcessing<CloudType>::postPatch
(
const typename CloudType::parcelType&,
const label
)
{
// do nothing
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::NoPostProcessing
Description
Place holder for 'none' option
SourceFiles
NoPostProcessing.C
\*---------------------------------------------------------------------------*/
#ifndef NoPostProcessing_H
#define NoPostProcessing_H
#include "PostProcessingModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class NoPostProcessing Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class NoPostProcessing
:
public PostProcessingModel<CloudType>
{
protected:
// Protected member functions
//- Write post-processing info
void write();
public:
//- Runtime type information
TypeName("none");
// Constructors
//- Construct from components
NoPostProcessing(const dictionary&, CloudType&);
//- Destructor
virtual ~NoPostProcessing();
// Member Functions
// Evaluation
//- Flag to indicate whether model activates post-processing model
bool active() const;
//- Gather post-processing info on patch
void postPatch
(
const typename CloudType::parcelType& p,
const label patchI
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "NoPostProcessing.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "PostProcessingModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::autoPtr<Foam::PostProcessingModel<CloudType> >
Foam::PostProcessingModel<CloudType>::New
(
const dictionary& dict,
CloudType& owner
)
{
word PostProcessingModelType(dict.lookup("PostProcessingModel"));
Info<< "Selecting PostProcessingModel " << PostProcessingModelType << endl;
typename dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(PostProcessingModelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"PostProcessingModel<CloudType>::New"
"("
"const dictionary&, "
"CloudType&"
")"
) << "Unknown PostProcessingModelType type "
<< PostProcessingModelType
<< ", constructor not in hash table" << nl << nl
<< " Valid PostProcessingModel types are:" << nl
<< dictionaryConstructorTablePtr_->toc() << exit(FatalError);
}
return autoPtr<PostProcessingModel<CloudType> >(cstrIter()(dict, owner));
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "PostProcessingModel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::PostProcessingModel<CloudType>::PostProcessingModel(CloudType& owner)
:
dict_(dictionary::null),
owner_(owner),
coeffDict_(dictionary::null)
{}
template<class CloudType>
Foam::PostProcessingModel<CloudType>::PostProcessingModel
(
const dictionary& dict,
CloudType& owner,
const word& type
)
:
dict_(dict),
owner_(owner),
coeffDict_(dict.subDict(type + "Coeffs"))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::PostProcessingModel<CloudType>::~PostProcessingModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::PostProcessingModel<CloudType>::post()
{
if (owner_.time().outputTime())
{
this->write();
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "NewPostProcessingModel.C"
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::PostProcessingModel
Description
Templated post-processing model class
SourceFiles
PostProcessingModel.C
NewPostProcessingModel.C
\*---------------------------------------------------------------------------*/
#ifndef PostProcessingModel_H
#define PostProcessingModel_H
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class PostProcessingModel Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class PostProcessingModel
{
// Private data
//- The cloud dictionary
const dictionary& dict_;
//- Reference to the owner cloud class
CloudType& owner_;
//- The coefficients dictionary
const dictionary coeffDict_;
protected:
// Protected member functions
//- Write post-processing info
virtual void write() = 0;
public:
//- Runtime type information
TypeName("PostProcessingModel");
//- Declare runtime constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
PostProcessingModel,
dictionary,
(
const dictionary& dict,
CloudType& owner
),
(dict, owner)
);
// Constructors
//- Construct null from owner
PostProcessingModel(CloudType& owner);
//- Construct from dictionary
PostProcessingModel
(
const dictionary& dict,
CloudType& owner,
const word& type
);
//- Destructor
virtual ~PostProcessingModel();
//- Selector
static autoPtr<PostProcessingModel<CloudType> > New
(
const dictionary& dict,
CloudType& owner
);
// Member Functions
// Access
//- Return the owner cloud dictionary
inline const dictionary& dict() const;
//- Return const access the owner cloud object
inline const CloudType& owner() const;
//- Return non-const access the owner cloud object for manipulation
inline CloudType& owner();
//- Return the coefficients dictionary
inline const dictionary& coeffDict() const;