ENH: re-located cloudSolution into separate files

This commit is contained in:
andy
2011-02-25 15:19:49 +00:00
parent 1e371c13b6
commit 5d40885f13
7 changed files with 520 additions and 452 deletions

View File

@ -59,6 +59,7 @@ $(THERMOINJECTION)/ThermoLookupTableInjection/thermoParcelInjectionData.C
$(THERMOINJECTION)/ThermoLookupTableInjection/thermoParcelInjectionDataIO.C
$(THERMOINJECTION)/ThermoLookupTableInjection/thermoParcelInjectionDataIOList.C
REACTINGINJECTION=submodels/Reacting/InjectionModel
$(REACTINGINJECTION)/ReactingLookupTableInjection/reactingParcelInjectionData.C
$(REACTINGINJECTION)/ReactingLookupTableInjection/reactingParcelInjectionDataIO.C
@ -79,5 +80,8 @@ phaseProperties/phaseProperties/phaseProperties.C
phaseProperties/phaseProperties/phasePropertiesIO.C
phaseProperties/phasePropertiesList/phasePropertiesList.C
/* Additional helper classes */
clouds/Templates/KinematicCloud/cloudSolution/cloudSolution.C
LIB = $(FOAM_LIBBIN)/liblagrangianIntermediate

View File

@ -34,156 +34,6 @@ License
#include "PostProcessingModel.H"
#include "SurfaceFilmModel.H"
// * * * * * * * * * * * * * * cloudSolution * * * * * * * * * * * * * * * * //
template<class CloudType>
void Foam::KinematicCloud<CloudType>::cloudSolution::read()
{
dict_.lookup("transient") >> transient_;
dict_.lookup("coupled") >> coupled_;
dict_.lookup("cellValueSourceCorrection") >> cellValueSourceCorrection_;
if (steadyState())
{
dict_.lookup("calcFrequency") >> calcFrequency_;
dict_.lookup("maxCo") >> maxCo_;
dict_.lookup("maxTrackTime") >> maxTrackTime_;
dict_.subDict("sourceTerms").lookup("resetOnStartup")
>> resetSourcesOnStartup_;
}
}
template<class CloudType>
Foam::KinematicCloud<CloudType>::cloudSolution::cloudSolution
(
const fvMesh& mesh,
const dictionary& dict
)
:
mesh_(mesh),
dict_(dict),
active_(dict.lookup("active")),
transient_(false),
calcFrequency_(1),
maxCo_(0.3),
iter_(1),
deltaT_(0.0),
coupled_(false),
cellValueSourceCorrection_(false),
maxTrackTime_(0.0),
resetSourcesOnStartup_(true)
{
if (active_)
{
read();
}
}
template<class CloudType>
Foam::KinematicCloud<CloudType>::cloudSolution::cloudSolution
(
const cloudSolution& cs
)
:
mesh_(cs.mesh_),
dict_(cs.dict_),
active_(cs.active_),
transient_(cs.transient_),
calcFrequency_(cs.calcFrequency_),
maxCo_(cs.maxCo_),
iter_(cs.iter_),
deltaT_(cs.deltaT_),
coupled_(cs.coupled_),
cellValueSourceCorrection_(cs.cellValueSourceCorrection_),
maxTrackTime_(cs.maxTrackTime_),
resetSourcesOnStartup_(cs.resetSourcesOnStartup_)
{}
template<class CloudType>
Foam::KinematicCloud<CloudType>::cloudSolution::cloudSolution
(
const fvMesh& mesh
)
:
mesh_(mesh),
dict_(dictionary::null),
active_(false),
transient_(false),
calcFrequency_(0),
maxCo_(GREAT),
iter_(0),
deltaT_(0.0),
coupled_(false),
cellValueSourceCorrection_(false),
maxTrackTime_(0.0),
resetSourcesOnStartup_(false)
{}
template<class CloudType>
Foam::KinematicCloud<CloudType>::cloudSolution::~cloudSolution()
{}
template<class CloudType>
Foam::scalar Foam::KinematicCloud<CloudType>::cloudSolution::relaxCoeff
(
const word& fieldName
) const
{
return readScalar(sourceTermDict().subDict(fieldName).lookup("alpha"));
}
template<class CloudType>
bool Foam::KinematicCloud<CloudType>::cloudSolution::semiImplicit
(
const word& fieldName
) const
{
return readBool(sourceTermDict().subDict(fieldName).lookup("semiImplicit"));
}
template<class CloudType>
bool Foam::KinematicCloud<CloudType>::cloudSolution::solveThisStep() const
{
return
active_
&& (
mesh_.time().outputTime()
|| (mesh_.time().timeIndex() % calcFrequency_ == 0)
);
}
template<class CloudType>
bool Foam::KinematicCloud<CloudType>::cloudSolution::canEvolve()
{
// Set the calculation time step
if (transient_)
{
deltaT_ = mesh_.time().deltaTValue();
}
else
{
deltaT_ = maxTrackTime_;
}
return solveThisStep();
}
template<class CloudType>
bool Foam::KinematicCloud<CloudType>::cloudSolution::output() const
{
return active_ && mesh_.time().outputTime();
}
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
template<class CloudType>

View File

@ -27,8 +27,6 @@ Class
Description
Templated base class for kinematic cloud
- holds a 'cloudSolution' class that stores all relevant solution info
- particle forces
- buoyancy
- drag
@ -59,9 +57,8 @@ SourceFiles
#include "fvMesh.H"
#include "volFields.H"
#include "fvMatrices.H"
#include "IntegrationSchemesFwd.H"
#include "cloudSolution.H"
#include "ParticleForceList.H"
@ -126,164 +123,6 @@ private:
void operator=(const KinematicCloud&);
public:
// Cloud solution helper class
class cloudSolution
{
// Private Data
//- Reference to the mesh
const fvMesh& mesh_;
//- Dictionary used during construction
dictionary dict_;
//- Cloud active flag
const Switch active_;
//- Transient flag
Switch transient_;
//- Calculation frequency - carrier steps per cloud step
// NOTE: Steady operation only
label calcFrequency_;
//- Maximum particle Courant number
// Max fraction of current cell that can be traversed in a single
// step
scalar maxCo_;
//- Current cloud iteration
label iter_;
//- Cloud solution time step
scalar deltaT_;
// Run-time options
//- Flag to indicate whether parcels are coupled to the carrier
// phase, i.e. whether or not to generate source terms for
// carrier phase
Switch coupled_;
//- Flag to correct cell values with latest transfer information
// during the lagrangian timestep
Switch cellValueSourceCorrection_;
//- Maximum particle track time [s]
scalar maxTrackTime_;
//- Flag to indicate whether coupling source terms should be
// reset on start-up/first read
Switch resetSourcesOnStartup_;
// Private Member Functions
//- Disallow default bitwise assignment
void operator=(const cloudSolution&);
public:
// Constructors
//- Construct null from mesh reference
cloudSolution(const fvMesh& mesh);
//- Construct from mesh and dictionary
cloudSolution(const fvMesh& mesh, const dictionary& dict);
//- Construct copy
cloudSolution(const cloudSolution& cs);
//- Destructor
virtual ~cloudSolution();
// Member functions
//- Read properties from dictionary
void read();
// Access
//- Return relaxation coefficient for field
scalar relaxCoeff(const word& fieldName) const;
//- Return semi-implicit flag coefficient for field
bool semiImplicit(const word& fieldName) const;
//- Return reference to the mesh
inline const fvMesh& mesh() const;
//- Return const access to the dictionary
inline const dictionary& dict() const;
//- Return the active flag
inline const Switch active() const;
//- Return const access to the transient flag
inline const Switch transient() const;
//- Return const access to the steady flag
inline const Switch steadyState() const;
//- Return const access to the calculation frequency
inline label calcFrequency() const;
//- Return const access to the max particle Courant number
inline scalar maxCo() const;
//- Return const access to the current cloud iteration
inline label iter() const;
//- Increment and return iter counter
inline label nextIter();
//- Return the time step
inline scalar deltaT() const;
//- Return const access to the coupled flag
inline const Switch coupled() const;
//- Return const access to the cell value correction flag
inline const Switch cellValueSourceCorrection() const;
//- Return const access to the particle track time
inline scalar maxTrackTime() const;
//- Return const access to the reset sources flag
inline const Switch resetSourcesOnStartup() const;
//- Source terms dictionary
inline const dictionary& sourceTermDict() const;
//- Interpolation schemes dictionary
inline const dictionary& interpolationSchemes() const;
//- Integration schemes dictionary
inline const dictionary& integrationSchemes() const;
// Helper functions
//- Returns true if performing a cloud iteration this calc step
bool solveThisStep() const;
//- Returns true if possible to evolve the cloud and sets timestep
// parameters
bool canEvolve();
//- Returns true if writing this step
bool output() const;
};
protected:
// Protected data

View File

@ -25,143 +25,6 @@ License
#include "fvmSup.H"
// * * * * * * * * * * * cloudSolution Member Functions * * * * * * * * * * //
template<class CloudType>
inline const Foam::fvMesh&
Foam::KinematicCloud<CloudType>::cloudSolution::mesh() const
{
return mesh_;
}
template<class CloudType>
inline const Foam::dictionary&
Foam::KinematicCloud<CloudType>::cloudSolution::dict() const
{
return dict_;
}
template<class CloudType>
inline const Foam::Switch
Foam::KinematicCloud<CloudType>::cloudSolution::active() const
{
return active_;
}
template<class CloudType>
inline const Foam::dictionary&
Foam::KinematicCloud<CloudType>::cloudSolution::sourceTermDict() const
{
return dict_.subDict("sourceTerms");
}
template<class CloudType>
inline const Foam::dictionary&
Foam::KinematicCloud<CloudType>::cloudSolution::interpolationSchemes() const
{
return dict_.subDict("interpolationSchemes");
}
template<class CloudType>
inline const Foam::dictionary&
Foam::KinematicCloud<CloudType>::cloudSolution::integrationSchemes() const
{
return dict_.subDict("integrationSchemes");
}
template<class CloudType>
inline const Foam::Switch
Foam::KinematicCloud<CloudType>::cloudSolution::transient() const
{
return transient_;
}
template<class CloudType>
inline const Foam::Switch
Foam::KinematicCloud<CloudType>::cloudSolution::steadyState() const
{
return !transient_;
}
template<class CloudType>
inline Foam::label
Foam::KinematicCloud<CloudType>::cloudSolution::calcFrequency() const
{
return calcFrequency_;
}
template<class CloudType>
inline Foam::scalar
Foam::KinematicCloud<CloudType>::cloudSolution::maxCo() const
{
return maxCo_;
}
template<class CloudType>
inline Foam::label Foam::KinematicCloud<CloudType>::cloudSolution::iter() const
{
return iter_;
}
template<class CloudType>
inline Foam::label Foam::KinematicCloud<CloudType>::cloudSolution::nextIter()
{
return ++iter_;
}
template<class CloudType>
inline Foam::scalar
Foam::KinematicCloud<CloudType>::cloudSolution::deltaT() const
{
return deltaT_;
}
template<class CloudType>
inline const Foam::Switch
Foam::KinematicCloud<CloudType>::cloudSolution::coupled() const
{
return coupled_;
}
template<class CloudType>
inline const Foam::Switch
Foam::KinematicCloud<CloudType>::cloudSolution::cellValueSourceCorrection()
const
{
return cellValueSourceCorrection_;
}
template<class CloudType>
inline Foam::scalar
Foam::KinematicCloud<CloudType>::cloudSolution::maxTrackTime() const
{
return maxTrackTime_;
}
template<class CloudType>
inline const Foam::Switch
Foam::KinematicCloud<CloudType>::cloudSolution::resetSourcesOnStartup() const
{
return resetSourcesOnStartup_;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
@ -188,7 +51,7 @@ Foam::KinematicCloud<CloudType>::particleProperties() const
template<class CloudType>
inline const typename Foam::KinematicCloud<CloudType>::cloudSolution&
inline const Foam::cloudSolution&
Foam::KinematicCloud<CloudType>::solution() const
{
return solution_;
@ -196,8 +59,7 @@ Foam::KinematicCloud<CloudType>::solution() const
template<class CloudType>
inline typename Foam::KinematicCloud<CloudType>::cloudSolution&
Foam::KinematicCloud<CloudType>::solution()
inline Foam::cloudSolution& Foam::KinematicCloud<CloudType>::solution()
{
return solution_;
}

View File

@ -0,0 +1,167 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "cloudSolution.H"
#include "Time.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::cloudSolution::cloudSolution
(
const fvMesh& mesh,
const dictionary& dict
)
:
mesh_(mesh),
dict_(dict),
active_(dict.lookup("active")),
transient_(false),
calcFrequency_(1),
maxCo_(0.3),
iter_(1),
deltaT_(0.0),
coupled_(false),
cellValueSourceCorrection_(false),
maxTrackTime_(0.0),
resetSourcesOnStartup_(true)
{
if (active_)
{
read();
}
}
Foam::cloudSolution::cloudSolution
(
const cloudSolution& cs
)
:
mesh_(cs.mesh_),
dict_(cs.dict_),
active_(cs.active_),
transient_(cs.transient_),
calcFrequency_(cs.calcFrequency_),
maxCo_(cs.maxCo_),
iter_(cs.iter_),
deltaT_(cs.deltaT_),
coupled_(cs.coupled_),
cellValueSourceCorrection_(cs.cellValueSourceCorrection_),
maxTrackTime_(cs.maxTrackTime_),
resetSourcesOnStartup_(cs.resetSourcesOnStartup_)
{}
Foam::cloudSolution::cloudSolution
(
const fvMesh& mesh
)
:
mesh_(mesh),
dict_(dictionary::null),
active_(false),
transient_(false),
calcFrequency_(0),
maxCo_(GREAT),
iter_(0),
deltaT_(0.0),
coupled_(false),
cellValueSourceCorrection_(false),
maxTrackTime_(0.0),
resetSourcesOnStartup_(false)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cloudSolution::~cloudSolution()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::cloudSolution::read()
{
dict_.lookup("transient") >> transient_;
dict_.lookup("coupled") >> coupled_;
dict_.lookup("cellValueSourceCorrection") >> cellValueSourceCorrection_;
if (steadyState())
{
dict_.lookup("calcFrequency") >> calcFrequency_;
dict_.lookup("maxCo") >> maxCo_;
dict_.lookup("maxTrackTime") >> maxTrackTime_;
dict_.subDict("sourceTerms").lookup("resetOnStartup")
>> resetSourcesOnStartup_;
}
}
Foam::scalar Foam::cloudSolution::relaxCoeff(const word& fieldName) const
{
return readScalar(sourceTermDict().subDict(fieldName).lookup("alpha"));
}
bool Foam::cloudSolution::semiImplicit(const word& fieldName) const
{
return readBool(sourceTermDict().subDict(fieldName).lookup("semiImplicit"));
}
bool Foam::cloudSolution::solveThisStep() const
{
return
active_
&& (
mesh_.time().outputTime()
|| (mesh_.time().timeIndex() % calcFrequency_ == 0)
);
}
bool Foam::cloudSolution::canEvolve()
{
// Set the calculation time step
if (transient_)
{
deltaT_ = mesh_.time().deltaTValue();
}
else
{
deltaT_ = maxTrackTime_;
}
return solveThisStep();
}
bool Foam::cloudSolution::output() const
{
return active_ && mesh_.time().outputTime();
}
// ************************************************************************* //

View File

@ -0,0 +1,218 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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 3 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, see <http://www.gnu.org/licenses/>.
Class
Foam::cloudSolution
Description
- Stores all relevant solution info
SourceFiles
cloudSolutionI.H
cloudSolution.C
\*---------------------------------------------------------------------------*/
#ifndef cloudSolution_H
#define cloudSolution_H
#include "fvMesh.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cloudSolution Declaration
\*---------------------------------------------------------------------------*/
class cloudSolution
{
// Private Data
//- Reference to the mesh
const fvMesh& mesh_;
//- Dictionary used during construction
dictionary dict_;
//- Cloud active flag
const Switch active_;
//- Transient flag
Switch transient_;
//- Calculation frequency - carrier steps per cloud step
// NOTE: Steady operation only
label calcFrequency_;
//- Maximum particle Courant number
// Max fraction of current cell that can be traversed in a single
// step
scalar maxCo_;
//- Current cloud iteration
label iter_;
//- Cloud solution time step
scalar deltaT_;
// Run-time options
//- Flag to indicate whether parcels are coupled to the carrier
// phase, i.e. whether or not to generate source terms for
// carrier phase
Switch coupled_;
//- Flag to correct cell values with latest transfer information
// during the lagrangian timestep
Switch cellValueSourceCorrection_;
//- Maximum particle track time [s]
scalar maxTrackTime_;
//- Flag to indicate whether coupling source terms should be
// reset on start-up/first read
Switch resetSourcesOnStartup_;
// Private Member Functions
//- Disallow default bitwise assignment
void operator=(const cloudSolution&);
public:
// Constructors
//- Construct null from mesh reference
cloudSolution(const fvMesh& mesh);
//- Construct from mesh and dictionary
cloudSolution(const fvMesh& mesh, const dictionary& dict);
//- Construct copy
cloudSolution(const cloudSolution& cs);
//- Destructor
virtual ~cloudSolution();
// Member functions
//- Read properties from dictionary
void read();
// Access
//- Return relaxation coefficient for field
scalar relaxCoeff(const word& fieldName) const;
//- Return semi-implicit flag coefficient for field
bool semiImplicit(const word& fieldName) const;
//- Return reference to the mesh
inline const fvMesh& mesh() const;
//- Return const access to the dictionary
inline const dictionary& dict() const;
//- Return the active flag
inline const Switch active() const;
//- Return const access to the transient flag
inline const Switch transient() const;
//- Return const access to the steady flag
inline const Switch steadyState() const;
//- Return const access to the calculation frequency
inline label calcFrequency() const;
//- Return const access to the max particle Courant number
inline scalar maxCo() const;
//- Return const access to the current cloud iteration
inline label iter() const;
//- Increment and return iter counter
inline label nextIter();
//- Return the time step
inline scalar deltaT() const;
//- Return const access to the coupled flag
inline const Switch coupled() const;
//- Return const access to the cell value correction flag
inline const Switch cellValueSourceCorrection() const;
//- Return const access to the particle track time
inline scalar maxTrackTime() const;
//- Return const access to the reset sources flag
inline const Switch resetSourcesOnStartup() const;
//- Source terms dictionary
inline const dictionary& sourceTermDict() const;
//- Interpolation schemes dictionary
inline const dictionary& interpolationSchemes() const;
//- Integration schemes dictionary
inline const dictionary& integrationSchemes() const;
// Helper functions
//- Returns true if performing a cloud iteration this calc step
bool solveThisStep() const;
//- Returns true if possible to evolve the cloud and sets timestep
// parameters
bool canEvolve();
//- Returns true if writing this step
bool output() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "cloudSolutionI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,128 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
inline const Foam::fvMesh& Foam::cloudSolution::mesh() const
{
return mesh_;
}
inline const Foam::dictionary& Foam::cloudSolution::dict() const
{
return dict_;
}
inline const Foam::Switch Foam::cloudSolution::active() const
{
return active_;
}
inline const Foam::dictionary& Foam::cloudSolution::sourceTermDict() const
{
return dict_.subDict("sourceTerms");
}
inline const Foam::dictionary& Foam::cloudSolution::interpolationSchemes() const
{
return dict_.subDict("interpolationSchemes");
}
inline const Foam::dictionary& Foam::cloudSolution::integrationSchemes() const
{
return dict_.subDict("integrationSchemes");
}
inline const Foam::Switch Foam::cloudSolution::transient() const
{
return transient_;
}
inline const Foam::Switch Foam::cloudSolution::steadyState() const
{
return !transient_;
}
inline Foam::label Foam::cloudSolution::calcFrequency() const
{
return calcFrequency_;
}
inline Foam::scalar Foam::cloudSolution::maxCo() const
{
return maxCo_;
}
inline Foam::label Foam::cloudSolution::iter() const
{
return iter_;
}
inline Foam::label Foam::cloudSolution::nextIter()
{
return ++iter_;
}
inline Foam::scalar Foam::cloudSolution::deltaT() const
{
return deltaT_;
}
inline const Foam::Switch Foam::cloudSolution::coupled() const
{
return coupled_;
}
inline const Foam::Switch Foam::cloudSolution::cellValueSourceCorrection() const
{
return cellValueSourceCorrection_;
}
inline Foam::scalar Foam::cloudSolution::maxTrackTime() const
{
return maxTrackTime_;
}
inline const Foam::Switch Foam::cloudSolution::resetSourcesOnStartup() const
{
return resetSourcesOnStartup_;
}
// ************************************************************************* //