Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2010-02-08 19:13:37 +00:00
93 changed files with 5041 additions and 2548 deletions

View File

@ -77,52 +77,53 @@ public:
// Member Functions
// Check
// Check
//- Return true if the autoPtr is empty (ie, no pointer set).
inline bool empty() const;
//- Return true if the autoPtr is empty (ie, no pointer set).
inline bool empty() const;
//- Return true if the autoPtr valid (ie, the pointer is set).
inline bool valid() const;
//- Return true if the autoPtr valid (ie, the pointer is set).
inline bool valid() const;
// Edit
// Edit
//- Return object pointer for reuse
inline T* ptr();
//- Return object pointer for reuse
inline T* ptr();
//- Set pointer to that given.
// If object pointer already set issue a FatalError.
inline void set(T*);
//- Set pointer to that given.
// If object pointer already set issue a FatalError.
inline void set(T*);
//- If object pointer already set, delete object and set to given pointer
inline void reset(T* = 0);
//- If object pointer already set, delete object and set to given
// pointer
inline void reset(T* = 0);
//- Delete object and set pointer to NULL, if the pointer is valid.
inline void clear();
//- Delete object and set pointer to NULL, if the pointer is valid.
inline void clear();
// Member operators
// Member operators
//- Return reference to the object data
inline T& operator()();
//- Return reference to the object data
inline T& operator()();
//- Return const reference to the object data
inline const T& operator()() const;
//- Return const reference to the object data
inline const T& operator()() const;
// inline T& operator*();
// inline const T& operator*() const;
// inline T& operator*();
// inline const T& operator*() const;
inline operator const T&() const;
inline operator const T&() const;
//- Return object pointer
inline T* operator->();
//- Return object pointer
inline T* operator->();
//- Return const object pointer
inline const T* operator->() const;
//- Return const object pointer
inline const T* operator->() const;
//- Take over object pointer from parameter
inline void operator=(const autoPtr<T>&);
//- Take over object pointer from parameter
inline void operator=(const autoPtr<T>&);
};

View File

@ -1742,7 +1742,7 @@ Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
}
}
label myUniquePoints = meshPoints.size() + nCoupledMaster - nCoupledSlave;
label myUniquePoints = meshPoints.size() - nCoupledSlave;
Pout<< "Points :" << nl
<< " patch : " << meshPoints.size() << nl
@ -1796,10 +1796,10 @@ Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
if (slaves.size() > 0)
{
// Duplicate master globalpoint into slave slots
masterToGlobal[coupledPointI] = pointToGlobal[meshPointI];
masterToGlobal[coupledPointI] = pointToGlobal[localPointI];
forAll(slaves, i)
{
masterToGlobal[slaves[i]] = pointToGlobal[meshPointI];
masterToGlobal[slaves[i]] = pointToGlobal[localPointI];
}
}
}
@ -1826,7 +1826,7 @@ Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
if (slaves.size() == 0)
{
pointToGlobal[meshPointI] = masterToGlobal[coupledPointI];
pointToGlobal[localPointI] = masterToGlobal[coupledPointI];
}
}
}

View File

@ -341,10 +341,5 @@ $(SRF)/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVect
fieldSources = $(general)/fieldSources
$(fieldSources)/pressureGradientExplicitSource/pressureGradientExplicitSource.C
$(fieldSources)/timeActivatedExplicitSource/timeActivatedExplicitSource.C
$(fieldSources)/timeActivatedExplicitCellSource/timeActivatedExplicitCellSource.C
$(fieldSources)/timeActivatedExplicitMulticomponentPointSource/timeActivatedExplicitMulticomponentPointSource.C
$(fieldSources)/timeActivatedExplicitMulticomponentPointSource/pointSourceProperties/pointSourceProperties.C
$(fieldSources)/timeActivatedExplicitMulticomponentPointSource/pointSourceProperties/pointSourcePropertiesIO.C
LIB = $(FOAM_LIBBIN)/libfiniteVolume

View File

@ -1,175 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "timeActivatedExplicitCellSource.H"
#include "volFields.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::timeActivatedExplicitCellSource::updateCellSet()
{
cellSelector_->applyToSet(topoSetSource::NEW, selectedCellSet_);
Info<< " " << name_ << ": selected "
<< returnReduce(selectedCellSet_.size(), sumOp<label>())
<< " cells" << nl << endl;
V_ = scalarField(selectedCellSet_.size(), 1.0);
if (volumeType_ == vtAbsolute)
{
label i = 0;
forAllConstIter(cellSet, selectedCellSet_, iter)
{
V_[i++] = mesh_.V()[iter.key()];
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::timeActivatedExplicitCellSource::timeActivatedExplicitCellSource
(
const word& name,
const fvMesh& mesh,
const dimensionSet& dims
)
:
timeActivatedExplicitSource(name, mesh, dims),
onValue_(readScalar(lookup("onValue"))),
offValue_(readScalar(lookup("offValue"))),
V_(0),
cellSource_(lookup("cellSource")),
cellSelector_
(
topoSetSource::New
(
cellSource_,
mesh,
subDict(cellSource_ + "Coeffs")
)
),
selectedCellSet_
(
mesh,
name + "SourceCellSet",
mesh.nCells()/10 + 1 // Reasonable size estimate.
)
{
// Create the cell set
updateCellSet();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::scalar Foam::timeActivatedExplicitCellSource::onValue() const
{
return onValue_;
}
Foam::scalar Foam::timeActivatedExplicitCellSource::offValue() const
{
return offValue_;
}
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::timeActivatedExplicitCellSource::Su()
{
tmp<DimensionedField<scalar, volMesh> > tSource
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
name_ + "Su",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("zero", dimensions_, 0.0)
)
);
scalar value = offValue_;
if
(
active_
&& (runTime_.time().value() >= timeStart_)
&& (runTime_.time().value() <= timeStart_ + duration_)
)
{
// Update the cell set if the mesh is changing
if (mesh_.changing())
{
updateCellSet();
}
value = onValue_;
}
DimensionedField<scalar, volMesh>& sourceField = tSource();
label i = 0;
forAllConstIter(cellSet, selectedCellSet_, iter)
{
sourceField[iter.key()] = value/V_[i++];
}
return tSource;
}
bool Foam::timeActivatedExplicitCellSource::read()
{
if (timeActivatedExplicitSource::read())
{
lookup("onValue") >> onValue_;
lookup("offValue") >> offValue_;
lookup("cellSource") >> cellSource_;
cellSelector_ =
topoSetSource::New
(
cellSource_,
mesh_,
subDict(cellSource_ + "Coeffs")
);
updateCellSet();
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -1,143 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::timeActivatedExplicitSourceNew
Description
Creates a cell set source that is activated at a given time, and remains
active for a specified duration. The source value is either in specific
(XX/m3) or absolute (XX) units.
SourceFiles
timeActivatedExplicitCellSource.C
\*---------------------------------------------------------------------------*/
#ifndef timeActivatedExplicitCellSource_H
#define timeActivatedExplicitCellSource_H
#include "timeActivatedExplicitSource.H"
#include "topoSetSource.H"
#include "cellSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class timeActivatedExplicitCellSource Declaration
\*---------------------------------------------------------------------------*/
class timeActivatedExplicitCellSource
:
public timeActivatedExplicitSource
{
private:
// Private member functions
//- Update the cell set that the source is acting on
void updateCellSet();
// Private Member Functions
//- Disallow default bitwise copy construct
timeActivatedExplicitCellSource(const timeActivatedExplicitCellSource&);
//- Disallow default bitwise assignment
void operator=(const timeActivatedExplicitCellSource&);
protected:
// Protected data
// Source properties
//- Value when "on"
scalar onValue_;
//- Value when "off"
scalar offValue_;
// Cell set
//- Cell volumes
scalarList V_;
//- Name of cell source (XXXToCell)
word cellSource_;
//- Method by which the cells will be selected
autoPtr<topoSetSource> cellSelector_;
//- Set of selected cells
cellSet selectedCellSet_;
public:
// Constructors
//- Construct from explicit source name and mesh
timeActivatedExplicitCellSource
(
const word&,
const fvMesh&,
const dimensionSet&
);
// Member Functions
// Access
//- Return the "on" value
virtual scalar onValue() const;
//- Return the "off" value
virtual scalar offValue() const;
//- Return a tmp field of the source
virtual tmp<DimensionedField<scalar, volMesh> > Su();
//- Read properties dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,87 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "pointSourceProperties.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::pointSourceProperties::pointSourceProperties()
:
name_("unknownPointSourceName"),
timeStart_(0.0),
duration_(0.0),
location_(point::zero),
fieldData_()
{}
Foam::pointSourceProperties::pointSourceProperties(const dictionary& dict)
:
name_(dict.name().name()),
timeStart_(readScalar(dict.lookup("timeStart"))),
duration_(readScalar(dict.lookup("duration"))),
location_(dict.lookup("location")),
fieldData_(dict.lookup("fieldData"))
{}
Foam::pointSourceProperties::pointSourceProperties
(
const pointSourceProperties& psp
)
:
name_(psp.name_),
timeStart_(psp.timeStart_),
duration_(psp.duration_),
location_(psp.location_),
fieldData_(psp.fieldData_)
{}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::pointSourceProperties::operator=(const pointSourceProperties& rhs)
{
// Check for assignment to self
if (this == &rhs)
{
FatalErrorIn
(
"pointSourceProperties::operator=(const pointSourceProperties&)"
) << "Attempted assignment to self" << nl
<< abort(FatalError);
}
// Set updated values
name_ = rhs.name_;
timeStart_ = rhs.timeStart_;
duration_ = rhs.duration_;
location_ = rhs.location_;
fieldData_ = rhs.fieldData_;}
// ************************************************************************* //

View File

@ -1,158 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::pointSourceProperties
Description
Helper class to describe point source properties
SourceFiles
pointSourceProperties.C
\*---------------------------------------------------------------------------*/
#ifndef pointSourceProperties_H
#define pointSourceProperties_H
#include "IOdictionary.H"
#include "fvMesh.H"
#include "Time.H"
#include "Tuple2.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class pointSourceProperties Declaration
\*---------------------------------------------------------------------------*/
class pointSourceProperties
{
protected:
// Protected data
typedef Tuple2<word, scalar> fieldNameValuePair;
//- Source name
word name_;
//- Time start
scalar timeStart_;
//- Duration
scalar duration_;
//- Point location
point location_;
//- List of source field name vs value pairs
List<fieldNameValuePair> fieldData_;
public:
// Constructors
//- Construct null
pointSourceProperties();
//- Construct from dictionary
pointSourceProperties(const dictionary& dict);
//- Construct from Istream
pointSourceProperties(Istream& is);
//- Copy constructor
pointSourceProperties(const pointSourceProperties&);
// Member Functions
// Access
//- Return const access to the source name
inline const word& name() const;
//- Return const access to the time start
inline scalar timeStart() const;
//- Return const access to the time end
inline scalar timeEnd() const;
//- Return const access to the duration
inline scalar duration() const;
//- Return const access to the point location
inline const point& location() const;
//- Return const access to the source field name vs value pairs
inline const List<fieldNameValuePair>& fieldData() const;
// Edit
//- Return access to the source name
inline word& name();
//- Return access to the time start
inline scalar& timeStart();
//- Return access to the duration
inline scalar& duration();
//- Return access to the point location
inline point& location();
//- Return access to the source field name vs value pairs
inline List<fieldNameValuePair>& fieldData();
// Member Operators
void operator=(const pointSourceProperties&);
// IOstream operators
friend Istream& operator>>(Istream&, pointSourceProperties&);
friend Ostream& operator<<(Ostream&, const pointSourceProperties&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "pointSourcePropertiesI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,88 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "pointSourceProperties.H"
#include "dictionaryEntry.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::pointSourceProperties::pointSourceProperties(Istream& is)
:
name_("unknownPointSourceName"),
timeStart_(0.0),
duration_(0.0),
location_(point::zero),
fieldData_()
{
is.check("pointSourceProperties(Istream&)");
const dictionaryEntry entry(dictionary::null, is);
name_ = entry.keyword();
entry.lookup("timeStart") >> timeStart_;
entry.lookup("duration") >> duration_;
entry.lookup("location") >> location_;
entry.lookup("fieldData") >> fieldData_;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::Istream& Foam::operator>>(Istream& is, pointSourceProperties& psp)
{
is.check("Istream& operator>>(Istream&, pointSourceProperties&)");
const dictionaryEntry entry(dictionary::null, is);
psp.name_ = entry.keyword();
entry.lookup("timeStart") >> psp.timeStart_;
entry.lookup("duration") >> psp.duration_;
entry.lookup("location") >> psp.location_;
entry.lookup("fieldData") >> psp.fieldData_;
return is;
}
Foam::Ostream& Foam::operator<<(Ostream& os, const pointSourceProperties& psp)
{
os.check("Ostream& operator<<(Ostream&, const pointSourceProperties&)");
os << psp.name_ << nl << token::BEGIN_BLOCK << nl;
os.writeKeyword("timeStart") << psp.timeStart_ << token::END_STATEMENT << nl;
os.writeKeyword("duration") << psp.duration_ << token::END_STATEMENT << nl;
os.writeKeyword("location") << psp.location_ << token::END_STATEMENT << nl;
os.writeKeyword("fieldData") << psp.fieldData_ << token::END_STATEMENT << nl;
os << token::END_BLOCK << nl;
os.check("Ostream& operator<<(Ostream&, const pointSourceProperties&)");
return os;
}
// ************************************************************************* //

View File

@ -1,292 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "timeActivatedExplicitMulticomponentPointSource.H"
#include "volFields.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::label
Foam::timeActivatedExplicitMulticomponentPointSource::carrierFieldId
(
const word& fieldName
)
{
forAll(carrierFields_, fieldI)
{
if (carrierFields_[fieldI].name() == fieldName)
{
return fieldI;
}
}
return -1;
}
void Foam::timeActivatedExplicitMulticomponentPointSource::updateAddressing()
{
forAll(pointSources_, sourceI)
{
const pointSourceProperties& psp = pointSources_[sourceI];
bool foundCell = false;
label cid = mesh_.findCell(psp.location());
if (cid >= 0)
{
foundCell = mesh_.pointInCell(psp.location(), cid);
}
reduce(foundCell, orOp<bool>());
if (!foundCell)
{
label cid = mesh_.findNearestCell(psp.location());
if (cid >= 0)
{
foundCell = mesh_.pointInCell(psp.location(), cid);
}
}
reduce(foundCell, orOp<bool>());
if (!foundCell)
{
FatalErrorIn
(
"timeActivatedExplicitMulticomponentPointSource::"
"updateAddressing()"
) << "Unable to find location " << psp.location() << " in mesh "
<< "for source " << psp.name() << nl
<< exit(FatalError);
}
else
{
cellOwners_[sourceI] = cid;
}
fieldIds_[sourceI].setSize(psp.fieldData().size());
forAll(psp.fieldData(), fieldI)
{
const word& fieldName = psp.fieldData()[fieldI].first();
label cfid = carrierFieldId(fieldName);
if (cfid < 0)
{
FatalErrorIn
(
"timeActivatedExplicitMulticomponentPointSource::"
"updateAddressing()"
) << "Unable to find field " << fieldName << " in carrier "
<< "fields for source " << psp.name() << nl
<< exit(FatalError);
}
else
{
fieldIds_[sourceI][fieldI] = cfid;
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::timeActivatedExplicitMulticomponentPointSource::
timeActivatedExplicitMulticomponentPointSource
(
const word& name,
const fvMesh& mesh,
const PtrList<volScalarField>& carrierFields,
const dimensionSet& dims
)
:
IOdictionary
(
IOobject
(
name + "Properties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
name_(name),
mesh_(mesh),
runTime_(mesh.time()),
dimensions_(dims),
carrierFields_(carrierFields),
active_(lookup("active")),
pointSources_(lookup("pointSources")),
cellOwners_(pointSources_.size()),
fieldIds_(pointSources_.size())
{
// Initialise the field addressing
updateAddressing();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::timeActivatedExplicitMulticomponentPointSource::Su
(
const label fieldI
)
{
if (mesh_.changing())
{
updateAddressing();
}
tmp<DimensionedField<scalar, volMesh> > tSource
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
name_ + carrierFields_[fieldI].name() + "Su",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("zero", dimensions_, 0.0)
)
);
if (active_)
{
DimensionedField<scalar, volMesh>& sourceField = tSource();
const scalarField& V = mesh_.V();
const scalar dt = runTime_.deltaTValue();
forAll(pointSources_, sourceI)
{
const pointSourceProperties& psp = pointSources_[sourceI];
forAll(fieldIds_[sourceI], i)
{
if
(
fieldIds_[sourceI][i] == fieldI
&& (runTime_.time().value() >= psp.timeStart())
&& (runTime_.time().value() <= psp.timeEnd())
)
{
const label cid = cellOwners_[sourceI];
if (cid >= 0)
{
sourceField[cid] +=
dt*psp.fieldData()[i].second()/V[cid];
}
}
}
}
}
return tSource;
}
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::timeActivatedExplicitMulticomponentPointSource::Su()
{
if (mesh_.changing())
{
updateAddressing();
}
tmp<DimensionedField<scalar, volMesh> > tSource
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
name_ + "TotalSu",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("zero", dimensions_, 0.0)
)
);
if (active_)
{
DimensionedField<scalar, volMesh>& sourceField = tSource();
const scalarField& V = mesh_.V();
const scalar dt = runTime_.deltaTValue();
forAll(pointSources_, sourceI)
{
const pointSourceProperties& psp = pointSources_[sourceI];
forAll(fieldIds_[sourceI], i)
{
if
(
(runTime_.time().value() >= psp.timeStart())
&& (runTime_.time().value() <= psp.timeEnd())
)
{
const label cid = cellOwners_[sourceI];
if (cid >= 0)
{
sourceField[cid] +=
dt*psp.fieldData()[i].second()/V[cid];
}
}
}
}
}
return tSource;
}
bool Foam::timeActivatedExplicitMulticomponentPointSource::read()
{
if (regIOobject::read())
{
lookup("active") >> active_;
lookup("pointSources") >> pointSources_;
cellOwners_.setSize(pointSources_.size());
updateAddressing();
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -1,185 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::timeActivatedExplicitMulticomponentPointSourceNew
Description
Provides a mechanism to introduce point sources to a set of carrier fields.
Carrier fields are supplied on consruction, and interrogated to provide the
field indices of the sources.
Source values are assumed to be in <quantity>/s, and divided through by the
cell volumes before being returned, e.g. for a kg/s source
Properties are described in a <name>Properties dictionary
active true; // are sources active (true/false)
pointSources
(
source1 // source name
{
timeStart 0.0;
duration 1.0;
location (0 0 0);
fieldData
(
(H2O 0.1) // kg/s
(O2 0.05) // kg/s
);
}
source2 // source name
{
timeStart 0.5;
duration 2.0;
location (1 1 1);
fieldData
(
(NO 0.1) // kg/s
(CO2 0.05) // kg/s
(H2 0.001) // kg/s
);
}
);
SourceFiles
timeActivatedExplicitMulticomponentPointSourceNew.C
\*---------------------------------------------------------------------------*/
#ifndef timeActivatedExplicitMulticomponentPointSource_H
#define timeActivatedExplicitMulticomponentPointSource_H
#include "IOdictionary.H"
#include "fvMesh.H"
#include "Time.H"
#include "pointSourceProperties.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class timeActivatedExplicitMulitcomponentPointSource Declaration
\*---------------------------------------------------------------------------*/
class timeActivatedExplicitMulticomponentPointSource
:
public IOdictionary
{
protected:
// Protected data
//- Name of the source
word name_;
//- Reference to the mesh
const fvMesh& mesh_;
//- Reference to time database
const Time& runTime_;
//- Source dimensions
const dimensionSet& dimensions_;
//- Reference to the multicomponent carrier fields
const PtrList<volScalarField>& carrierFields_;
//- Active flag
Switch active_;
//- List of point source properties
List<pointSourceProperties> pointSources_;
//- List of cell owners for point source locations
List<label> cellOwners_;
//- List of field ids for each source
List<labelList> fieldIds_;
// Protected Member Functions
//- Return the id of field given its name
label carrierFieldId(const word& fieldName);
//- Update the addressing between source and carrier fields
void updateAddressing();
//- Disallow default bitwise copy construct
timeActivatedExplicitMulticomponentPointSource
(
const timeActivatedExplicitMulticomponentPointSource&
);
//- Disallow default bitwise assignment
void operator=(const timeActivatedExplicitMulticomponentPointSource&);
public:
// Constructors
//- Construct from components
timeActivatedExplicitMulticomponentPointSource
(
const word&,
const fvMesh&,
const PtrList<volScalarField>&,
const dimensionSet&
);
// Member Functions
// Access
//- Return a tmp field of the source for field fieldI
virtual tmp<DimensionedField<scalar, volMesh> > Su
(
const label fieldI
);
//- Return a tmp field of the total source
virtual tmp<DimensionedField<scalar, volMesh> > Su();
//- Read properties dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,360 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "TimeActivatedExplicitSource.H"
#include "fvMesh.H"
#include "volFields.H"
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
template<class Type>
const Foam::wordList Foam::TimeActivatedExplicitSource<Type>::
selectionModeTypeNames_
(
IStringStream("(points cellSet)")()
);
template<class Type>
const Foam::wordList Foam::TimeActivatedExplicitSource<Type>::
volumeModeTypeNames_
(
IStringStream("(absolute specific)")()
);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class Type>
typename Foam::TimeActivatedExplicitSource<Type>::selectionModeType
Foam::TimeActivatedExplicitSource<Type>::wordToSelectionModeType
(
const word& smtName
) const
{
forAll(selectionModeTypeNames_, i)
{
if (smtName == selectionModeTypeNames_[i])
{
return selectionModeType(i);
}
}
FatalErrorIn
(
"TimeActivatedExplicitSource<Type>::selectionModeType"
"TimeActivatedExplicitSource<Type>::wordToSelectionModeType"
"("
"const word&"
")"
) << "Unknown selectionMode type " << smtName
<< ". Valid selectionMode types are:" << nl << selectionModeTypeNames_
<< exit(FatalError);
return selectionModeType(0);
}
template<class Type>
typename Foam::TimeActivatedExplicitSource<Type>::volumeModeType
Foam::TimeActivatedExplicitSource<Type>::wordToVolumeModeType
(
const word& vmtName
) const
{
forAll(volumeModeTypeNames_, i)
{
if (vmtName == volumeModeTypeNames_[i])
{
return volumeModeType(i);
}
}
FatalErrorIn
(
"TimeActivatedExplicitSource<Type>::volumeModeType"
"TimeActivatedExplicitSource<Type>::wordToVolumeModeType(const word&)"
) << "Unknown volumeMode type " << vmtName
<< ". Valid volumeMode types are:" << nl << volumeModeTypeNames_
<< exit(FatalError);
return volumeModeType(0);
}
template<class Type>
Foam::word Foam::TimeActivatedExplicitSource<Type>::selectionModeTypeToWord
(
const selectionModeType& smtType
) const
{
if (smtType > selectionModeTypeNames_.size())
{
return "UNKNOWN";
}
else
{
return selectionModeTypeNames_[smtType];
}
}
template<class Type>
Foam::word Foam::TimeActivatedExplicitSource<Type>::volumeModeTypeToWord
(
const volumeModeType& vmtType
) const
{
if (vmtType > volumeModeTypeNames_.size())
{
return "UNKNOWN";
}
else
{
return volumeModeTypeNames_[vmtType];
}
}
template<class Type>
void Foam::TimeActivatedExplicitSource<Type>::setSelection
(
const dictionary& dict
)
{
switch (selectionMode_)
{
case smPoints:
{
dict.lookup("points") >> points_;
break;
}
case smCellSet:
{
dict.lookup("cellSet") >> cellSetName_;
break;
}
default:
{
FatalErrorIn
(
"TimeActivatedExplicitSource::setSelection(const dictionary&)"
) << "Unknown selectionMode "
<< selectionModeTypeNames_[selectionMode_]
<< ". Valid selectionMode types are" << selectionModeTypeNames_
<< exit(FatalError);
}
}
}
template<class Type>
void Foam::TimeActivatedExplicitSource<Type>::setFieldData
(
const dictionary& dict,
const wordList& fieldNames
)
{
dict.lookup("fieldData") >> fieldData_;
labelList localFieldIds(fieldData_.size(), -1);
forAll(fieldNames, i)
{
forAll(fieldData_, j)
{
const word& fdName = fieldData_[j].first();
if (fdName == fieldNames[i])
{
fieldIds_[i] = j;
localFieldIds[j] = i;
break;
}
}
}
forAll(localFieldIds, i)
{
if (localFieldIds[i] < 0)
{
FatalErrorIn
(
"TimeActivatedExplicitSource<Type>::setFieldData"
"("
"const dictionary&, "
"const wordList&"
")"
) << "Field " << fieldData_[i].first() << " not found in "
<< "field list. Available fields are: " << nl << fieldNames
<< exit(FatalError);
}
}
}
template<class Type>
void Foam::TimeActivatedExplicitSource<Type>::setCellSet()
{
Info<< incrIndent << indent << "Source: " << name_ << endl;
switch (selectionMode_)
{
case smPoints:
{
Info<< indent << "- selecting cells using points" << endl;
labelHashSet cellOwners;
forAll(points_, i)
{
label cellI = mesh_.findCell(points_[i]);
if (cellI >= 0)
{
cellOwners.insert(cellI);
}
label globalCellI = returnReduce(cellI, maxOp<label>());
if (globalCellI < 0)
{
WarningIn("TimeActivatedExplicitSource<Type>::setCellIds()")
<< "Unable to find owner cell for point " << points_[i]
<< endl;
}
}
cellsPtr_.reset(new cellSet(mesh_, "points", cellOwners));
break;
}
case smCellSet:
{
Info<< indent << "- selecting cells using cellSet "
<< cellSetName_ << endl;
cellsPtr_.reset(new cellSet(mesh_, cellSetName_));
break;
}
default:
{
FatalErrorIn("TimeActivatedExplicitSource<Type>::setCellIds()")
<< "Unknown selectionMode "
<< selectionModeTypeNames_[selectionMode_]
<< ". Valid selectionMode types are" << selectionModeTypeNames_
<< exit(FatalError);
}
}
const cellSet& cSet = cellsPtr_();
// Set volume normalisation
V_ = scalarField(cSet.size(), 1.0);
if (volumeMode_ == vmAbsolute)
{
label i = 0;
forAllConstIter(cellSet, cSet, iter)
{
V_[i++] = mesh_.V()[iter.key()];
}
}
Info<< indent << "- selected " << returnReduce(cSet.size(), sumOp<label>())
<< " cell(s)" << nl << decrIndent << endl;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::TimeActivatedExplicitSource<Type>::TimeActivatedExplicitSource
(
const word& name,
const dictionary& dict,
const fvMesh& mesh,
const wordList& fieldNames
)
:
name_(name),
mesh_(mesh),
active_(dict.lookup("active")),
timeStart_(readScalar(dict.lookup("timeStart"))),
duration_(readScalar(dict.lookup("duration"))),
volumeMode_(wordToVolumeModeType(dict.lookup("volumeMode"))),
selectionMode_(wordToSelectionModeType(dict.lookup("selectionMode"))),
points_(),
cellSetName_("none"),
V_(),
cellsPtr_(),
fieldData_(),
fieldIds_(fieldNames.size(), -1)
{
setSelection(dict);
if (fieldNames.size() == 1)
{
fieldData_.setSize(1);
fieldData_[0].first() = fieldNames[0];
dict.lookup("fieldData") >> fieldData_[0].second();
fieldIds_[0] = 0;
}
else
{
setFieldData(dict, fieldNames);
}
setCellSet();
}
template<class Type>
void Foam::TimeActivatedExplicitSource<Type>::addToField
(
DimensionedField<Type, volMesh>& Su,
const label fieldI
)
{
const label fid = fieldIds_[fieldI];
if
(
active_
&& (fid >= 0)
&& (mesh_.time().value() >= timeStart_)
&& (mesh_.time().value() <= timeEnd())
)
{
// Update the cell set if the mesh is changing
if (mesh_.changing())
{
setCellSet();
}
const cellSet& cSet = cellsPtr_();
label i = 0;
forAllConstIter(cellSet, cSet, iter)
{
Su[iter.key()] = fieldData_[fid].second()/V_[i++];
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,392 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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::TimeActivatedExplicitSource
Description
Time activated explicit source.
Sources described by:
{
active true; // on/off switch
timeStart 0.2; // start time
duration 2.0; // duration
selectionMode points; // cellSet
volumeMode absolute; // specific
fieldData // field data - usage for multiple fields
(
(H2O 0.005)
);
fieldData 0.005; // field data - usage for single field
points // list of points when selectionMode = points
(
(2.75 0.5 0)
);
cellSet c0; // cellSet name when selectionMode = cekllSet
}
SourceFiles
TimeActivatedExplicitSource.C
\*---------------------------------------------------------------------------*/
#ifndef TimeActivatedExplicitSource_H
#define TimeActivatedExplicitSource_H
#include "Tuple2.H"
#include "cellSet.H"
#include "volFieldsFwd.H"
#include "DimensionedField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class fvMesh;
template<class Type>
class TimeActivatedExplicitSource;
// Forward declaration of friend functions
template<class Type>
Ostream& operator<<
(
Ostream&,
const TimeActivatedExplicitSource<Type>&
);
/*---------------------------------------------------------------------------*\
Class TimeActivatedExplicitSource Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class TimeActivatedExplicitSource
{
public:
// Public data
//- Enumeration for selection mode types
enum selectionModeType
{
smPoints,
smCellSet
};
//- Word list of selection mode type names
static const wordList selectionModeTypeNames_;
//- Enumeration for volume types
enum volumeModeType
{
vmAbsolute,
vmSpecific
};
//- Word list of volume mode type names
static const wordList volumeModeTypeNames_;
protected:
// Protected data
typedef Tuple2<word, Type> fieldNameValuePair;
//- Source name
word name_;
//- Reference to the mesh database
const fvMesh& mesh_;
//- Source active flag
bool active_;
//- Time start
scalar timeStart_;
//- Duration
scalar duration_;
//- Volume mode
volumeModeType volumeMode_;
//- Cell selection mode
selectionModeType selectionMode_;
//- List of points for "points" selectionMode
List<point> points_;
//- Name of cell set for "cellSet" selectionMode
word cellSetName_;
//- Field of cell volumes according to cell set cells
scalarList V_;
//- Cell set
autoPtr<cellSet> cellsPtr_;
//- List of source field name vs value pairs
List<fieldNameValuePair> fieldData_;
//- Map of fields ids from supplied fields to local field source ids
labelList fieldIds_;
// Protected functions
//- Helper function to convert from a word to a selectionModeType
selectionModeType wordToSelectionModeType(const word& smtName) const;
//- Helper function to convert from a word to a volumeModeType
volumeModeType wordToVolumeModeType(const word& vtName) const;
//- Helper function to convert from a selectionModeType to a word
word selectionModeTypeToWord(const selectionModeType& smtType) const;
//- Helper function to convert from a volumeModeType to a word
word volumeModeTypeToWord(const volumeModeType& vtType) const;
//- Set the cellSet or points selection
void setSelection(const dictionary& dict);
//- Set the local field data
void setFieldData(const dictionary& dict, const wordList& fieldNames);
//- Set the cell set based on the user input selection mode
void setCellSet();
public:
// Constructors
//- Construct from components
TimeActivatedExplicitSource
(
const word& name,
const dictionary& dict,
const fvMesh& mesh,
const wordList& fieldNames
);
//- Return clone
autoPtr<TimeActivatedExplicitSource> clone() const
{
notImplemented
(
"autoPtr<TimeActivatedExplicitSource> clone() const"
);
return autoPtr<TimeActivatedExplicitSource>(NULL);
}
//- Return pointer to new TimeActivatedExplicitSource object created
// on the freestore from an Istream
class iNew
{
//- Reference to the mesh database
const fvMesh& mesh_;
//- List of field names
const wordList& fieldNames_;
public:
iNew
(
const fvMesh& mesh,
const wordList& fieldNames
)
:
mesh_(mesh),
fieldNames_(fieldNames)
{}
autoPtr<TimeActivatedExplicitSource> operator()(Istream& is) const
{
const word name(is);
const dictionary dict(is);
return autoPtr<TimeActivatedExplicitSource>
(
new TimeActivatedExplicitSource
(
name,
dict,
mesh_,
fieldNames_
)
);
}
};
// Member Functions
// Access
//- Return const access to the source name
inline const word& name() const;
//- Return const access to the mesh database
inline const fvMesh& mesh() const;
//- Return const access to the source active flag
inline bool active() const;
//- Return const access to the time start
inline scalar timeStart() const;
//- Return const access to the duration
inline scalar duration() const;
//- Return const access to the time end
inline scalar timeEnd() const;
//- Return const access to the volume mode
inline const volumeModeType& volumeMode() const;
//- Return const access to the cell selection mode
inline const selectionModeType& selectionMode() const;
//- Return const access to the list of points for "points"
// selectionMode
inline const List<point>& points() const;
//- Return const access to the name of cell set for "cellSet"
// selectionMode
inline const word& cellSetName() const;
//- Return const access to the field of cell volumes according to
// cell set cells
inline const scalarList& V() const;
//- Return const access to the cell set
inline const cellSet& cells() const;
//- Return const access to the source field name vs value pairs
inline const List<fieldNameValuePair>& fieldData() const;
//- Return const access to the the map of fields ids from supplied
// fields to local field source ids
inline const labelList& fieldIds() const;
// Edit
//- Return access to the source name
inline word& name();
//- Return access to the source active flag
inline bool& active();
//- Return access to the time start
inline scalar& timeStart();
//- Return access to the duration
inline scalar& duration();
//- Return access to the volume mode
inline volumeModeType& volumeMode();
//- Return access to the cell selection mode
inline selectionModeType& selectionMode();
//- Return access to the list of points for "points" selectionMode
inline List<point>& points();
//- Return access to the name of cell set for "cellSet"
// selectionMode
inline word& cellSetName();
//- Return access to the field of cell volumes according to
// cell set cells
inline scalarList& V();
//- Return access to the cell set
inline cellSet& cells();
//- Return access to the source field name vs value pairs
inline List<fieldNameValuePair>& fieldData();
//- Return access to the the map of fields ids from supplied
// fields to local field source ids
inline labelList& fieldIds();
// Evaluation
//- Add the source contribution to field Su
void addToField
(
DimensionedField<Type, volMesh>& Su,
const label fieldI
);
// I-O
//- Write the source properties
void writeData(Ostream&) const;
//- Ostream operator
friend Ostream& operator<< <Type>
(
Ostream& os,
const TimeActivatedExplicitSource& source
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "TimeActivatedExplicitSource.C"
# include "TimeActivatedExplicitSourceIO.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "TimeActivatedExplicitSourceI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,227 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "TimeActivatedExplicitSource.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
inline const Foam::word& Foam::TimeActivatedExplicitSource<Type>::name() const
{
return name_;
}
template<class Type>
inline const Foam::fvMesh& Foam::TimeActivatedExplicitSource<Type>::mesh() const
{
return mesh_;
}
template<class Type>
inline bool Foam::TimeActivatedExplicitSource<Type>::active() const
{
return active_;
}
template<class Type>
inline Foam::scalar Foam::TimeActivatedExplicitSource<Type>::timeStart() const
{
return timeStart_;
}
template<class Type>
inline Foam::scalar Foam::TimeActivatedExplicitSource<Type>::duration() const
{
return duration_;
}
template<class Type>
inline Foam::scalar Foam::TimeActivatedExplicitSource<Type>::timeEnd() const
{
return timeStart_ + duration_;
}
template<class Type>
inline const typename Foam::TimeActivatedExplicitSource<Type>::volumeModeType&
Foam::TimeActivatedExplicitSource<Type>::volumeMode() const
{
return volumeMode_;
}
template<class Type>
inline const typename Foam::TimeActivatedExplicitSource<Type>::
selectionModeType&
Foam::TimeActivatedExplicitSource<Type>::selectionMode() const
{
return selectionMode_;
}
template<class Type>
inline const Foam::List<Foam::point>&
Foam::TimeActivatedExplicitSource<Type>::points() const
{
return points_;
}
template<class Type>
inline const Foam::word&
Foam::TimeActivatedExplicitSource<Type>::cellSetName() const
{
return cellSetName_;
}
template<class Type>
inline const Foam::scalarList&
Foam::TimeActivatedExplicitSource<Type>::V() const
{
return V_;
}
template<class Type>
inline const Foam::cellSet&
Foam::TimeActivatedExplicitSource<Type>::cells() const
{
return cellsPtr_();
}
template<class Type>
inline const Foam::List<typename Foam::TimeActivatedExplicitSource<Type>::
fieldNameValuePair>&
Foam::TimeActivatedExplicitSource<Type>::fieldData() const
{
return fieldData_;
}
template<class Type>
inline const Foam::labelList&
Foam::TimeActivatedExplicitSource<Type>::fieldIds() const
{
return fieldIds_;
}
template<class Type>
inline Foam::word& Foam::TimeActivatedExplicitSource<Type>::name()
{
return name_;
}
template<class Type>
inline bool& Foam::TimeActivatedExplicitSource<Type>::active()
{
return active_;
}
template<class Type>
inline Foam::scalar& Foam::TimeActivatedExplicitSource<Type>::timeStart()
{
return timeStart_;
}
template<class Type>
inline Foam::scalar& Foam::TimeActivatedExplicitSource<Type>::duration()
{
return duration_;
}
template<class Type>
inline typename Foam::TimeActivatedExplicitSource<Type>::volumeModeType&
Foam::TimeActivatedExplicitSource<Type>::volumeMode()
{
return volumeMode_;
}
template<class Type>
inline typename Foam::TimeActivatedExplicitSource<Type>::selectionModeType&
Foam::TimeActivatedExplicitSource<Type>::selectionMode()
{
return selectionMode_;
}
template<class Type>
inline Foam::List<Foam::point>&
Foam::TimeActivatedExplicitSource<Type>::points()
{
return points_;
}
template<class Type>
inline Foam::word& Foam::TimeActivatedExplicitSource<Type>::cellSetName()
{
return cellSetName_;
}
template<class Type>
inline Foam::scalarList& Foam::TimeActivatedExplicitSource<Type>::V()
{
return V_;
}
template<class Type>
inline Foam::cellSet& Foam::TimeActivatedExplicitSource<Type>::cells()
{
return cellsPtr_();
}
template<class Type>
inline Foam::List<typename Foam::TimeActivatedExplicitSource<Type>::fieldNameValuePair>&
Foam::TimeActivatedExplicitSource<Type>::fieldData()
{
return fieldData_;
}
template<class Type>
inline Foam::labelList& Foam::TimeActivatedExplicitSource<Type>::fieldIds()
{
return fieldIds_;
}
// ************************************************************************* //

View File

@ -0,0 +1,102 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "TimeActivatedExplicitSource.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::TimeActivatedExplicitSource<Type>::writeData(Ostream& os) const
{
os << indent << name_ << nl
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
os.writeKeyword("active") << active_ << token::END_STATEMENT << nl;
os.writeKeyword("timeStart") << timeStart_ << token::END_STATEMENT << nl;
os.writeKeyword("duration") << duration_ << token::END_STATEMENT << nl;
os.writeKeyword("selectionMode") << selectionModeTypeToWord(selectionMode_)
<< token::END_STATEMENT << nl;
os.writeKeyword("volumeMode") << volumeModeTypeToWord(volumeMode_)
<< token::END_STATEMENT << nl;
if (fieldIds_.size() == 1)
{
os.writeKeyword("fieldData") << fieldData_[0].second()
<< token::END_STATEMENT << nl;
}
else
{
os.writeKeyword("fieldData") << fieldData_ << nl;
}
switch (selectionMode_)
{
case smPoints:
{
os.writeKeyword("points") << nl << indent << points_
<< token::END_STATEMENT << nl;
break;
}
case smCellSet:
{
os.writeKeyword("cellSet") << cellSetName_
<< token::END_STATEMENT << nl;
break;
}
default:
{
FatalErrorIn
(
"TimeActivatedExplicitSource<Type>::writeData"
"("
"Ostream&, "
"bool"
") const"
) << "Unknown selectionMode "
<< selectionModeTypeToWord(selectionMode_)
<< abort(FatalError);
}
}
os << decrIndent << indent << token::END_BLOCK << endl;
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Type>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const TimeActivatedExplicitSource<Type>& source
)
{
source.writeData(os);
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,223 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "TimeActivatedExplicitSourceList.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::TimeActivatedExplicitSourceList<Type>::TimeActivatedExplicitSourceList
(
const word& name,
const fvMesh& mesh,
const dimensionSet& dimensions,
const wordList& fieldNames
)
:
IOPtrList<TimeActivatedExplicitSource<Type> >
(
IOobject
(
name + "SourceProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
typename TimeActivatedExplicitSource<Type>::iNew(mesh, fieldNames)
),
name_(name),
mesh_(mesh),
dimensions_(dimensions),
fieldNames_(fieldNames)
{}
template<class Type>
Foam::TimeActivatedExplicitSourceList<Type>::TimeActivatedExplicitSourceList
(
const word& name,
const fvMesh& mesh,
const dimensionSet& dimensions,
const word& fieldName
)
:
IOPtrList<TimeActivatedExplicitSource<Type> >
(
IOobject
(
name + "SourceProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
typename TimeActivatedExplicitSource<Type>::iNew
(
mesh,
IStringStream('(' + fieldName + ')')()
)
),
name_(name),
mesh_(mesh),
dimensions_(dimensions),
fieldNames_(1, fieldName)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::tmp<Foam::DimensionedField<Type, Foam::volMesh> >
Foam::TimeActivatedExplicitSourceList<Type>::Su(const label fieldI)
{
tmp<DimensionedField<Type, volMesh> > tSu
(
new DimensionedField<Type, volMesh>
(
IOobject
(
name_ + "Source_" + fieldNames_[fieldI],
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensioned<Type>("zero", dimensions_, pTraits<Type>::zero)
)
);
DimensionedField<Type, volMesh>& Su = tSu();
forAll(*this, i)
{
this->operator[](i).addToField(Su, fieldI);
}
return tSu;
}
template<class Type>
Foam::tmp<Foam::DimensionedField<Type, Foam::volMesh> >
Foam::TimeActivatedExplicitSourceList<Type>::SuTot()
{
tmp<DimensionedField<Type, volMesh> > tSuTot
(
new DimensionedField<Type, volMesh>
(
IOobject
(
name_ + "TotalSource",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensioned<Type>("zero", dimensions_, pTraits<Type>::zero)
)
);
DimensionedField<Type, volMesh>& SuTot = tSuTot();
forAll(fieldNames_, fieldI)
{
forAll(*this, sourceI)
{
this->operator[](sourceI).addToField(SuTot, fieldI);
}
}
return tSuTot;
}
template<class Type>
bool Foam::TimeActivatedExplicitSourceList<Type>::readData(Istream& is)
{
this->clear();
IOPtrList<TimeActivatedExplicitSource<Type> > newSources
(
IOobject
(
name_ + "TimeActivatedExplicitSource",
mesh_.time().constant(),
mesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
),
typename TimeActivatedExplicitSource<Type>::iNew(mesh_, fieldNames_)
);
transfer(newSources);
return is.good();
}
template<class Type>
bool Foam::TimeActivatedExplicitSourceList<Type>::writeData(Ostream& os) const
{
// Write size of list
os << nl << this->size();
// Write beginning of contents
os << nl << token::BEGIN_LIST;
// Write list contents
forAll(*this, i)
{
os << nl;
this->operator[](i).writeData(os);
}
// Write end of contents
os << token::END_LIST << token::END_STATEMENT << nl;
// Check state of IOstream
return os.good();
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Type>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const TimeActivatedExplicitSourceList<Type>& sources
)
{
sources.writeData(os);
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,172 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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::TimeActivatedExplicitSourceList
Description
List of time activeted explict sources
SourceFiles
TimeActivatedExplicitSourceList.C
\*---------------------------------------------------------------------------*/
#ifndef TimeActivatedExplicitSourceList_H
#define TimeActivatedExplicitSourceList_H
#include "IOPtrList.H"
#include "TimeActivatedExplicitSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class fvMesh;
template<class Type>
class TimeActivatedExplicitSource;
template<class Type>
class TimeActivatedExplicitSourceList;
// Forward declaration of friend functions
template<class Type>
Ostream& operator<<
(
Ostream&,
const TimeActivatedExplicitSourceList<Type>&
);
/*---------------------------------------------------------------------------*\
Class TimeActivatedExplicitSourceList Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class TimeActivatedExplicitSourceList
:
public IOPtrList<TimeActivatedExplicitSource<Type> >
{
private:
// Private data
//- Name of source properties list
word name_;
//- Reference to the mesh database
const fvMesh& mesh_;
//- Dimensions of source properties
dimensionSet dimensions_;
//- List of field names the source is working on
wordList fieldNames_;
// Private member functions
//- Disallow default bitwise copy construct
TimeActivatedExplicitSourceList
(
const TimeActivatedExplicitSourceList<Type>&
);
//- Disallow default bitwise assignment
void operator=(const TimeActivatedExplicitSourceList<Type>&);
public:
// Constructors
//- Construct from components with list of field names
TimeActivatedExplicitSourceList
(
const word& name,
const fvMesh& mesh,
const dimensionSet& dimensions,
const wordList& fieldNames
);
//- Construct from components with single field name
TimeActivatedExplicitSourceList
(
const word& name,
const fvMesh& mesh,
const dimensionSet& dimensions,
const word& fieldName
);
// Member Functions
// Evaluation
//- Return the source for field, fieldI
tmp<DimensionedField<Type, volMesh> > Su
(
const label fieldI = 0
);
//- Return the total source for all fields
tmp<DimensionedField<Type, volMesh> > SuTot();
// I-O
//- Read data from Istream
bool readData(Istream& is);
//- Write data to Istream
bool writeData(Ostream& os) const;
//- Ostream operator
friend Ostream& operator<< <Type>
(
Ostream& os,
const TimeActivatedExplicitSourceList& sources
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "TimeActivatedExplicitSourceList.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,131 +25,21 @@ License
\*---------------------------------------------------------------------------*/
#include "timeActivatedExplicitSource.H"
#include "volFields.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<>
const char* Foam::NamedEnum
<
Foam::timeActivatedExplicitSource::volumeType,
2
>::names[] =
namespace Foam
{
"specific",
"absolute"
};
const Foam::NamedEnum<Foam::timeActivatedExplicitSource::volumeType, 2>
Foam::timeActivatedExplicitSource::volumeTypeNames_;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::timeActivatedExplicitSource::timeActivatedExplicitSource
(
const word& name,
const fvMesh& mesh,
const dimensionSet& dims
)
:
IOdictionary
defineTemplateTypeNameAndDebug
(
IOobject
(
name + "Properties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
mesh_(mesh),
runTime_(mesh.time()),
name_(name),
active_(lookup("active")),
dimensions_(dims),
volumeType_(volumeTypeNames_.read(lookup("volumeType"))),
timeStart_(readScalar(lookup("timeStart"))),
duration_(readScalar(lookup("duration")))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::fvMesh& Foam::timeActivatedExplicitSource::mesh() const
{
return mesh_;
IOPtrList<scalarTimeActivatedExplicitSource>,
0
);
defineTemplateTypeNameAndDebug
(
IOPtrList<vectorTimeActivatedExplicitSource>,
0
);
}
const Foam::Time& Foam::timeActivatedExplicitSource::runTime() const
{
return runTime_;
}
const Foam::word& Foam::timeActivatedExplicitSource::name() const
{
return name_;
}
const Foam::Switch& Foam::timeActivatedExplicitSource::active() const
{
return active_;
}
const Foam::dimensionSet& Foam::timeActivatedExplicitSource::dimensions() const
{
return dimensions_;
}
const Foam::timeActivatedExplicitSource::volumeType&
Foam::timeActivatedExplicitSource::volume() const
{
return volumeType_;
}
Foam::scalar Foam::timeActivatedExplicitSource::timeStart() const
{
return timeStart_;
}
Foam::scalar Foam::timeActivatedExplicitSource::duration() const
{
return duration_;
}
bool Foam::timeActivatedExplicitSource::read()
{
if (regIOobject::read())
{
lookup("active") >> active_;
if (active_)
{
volumeType_ = volumeTypeNames_.read(lookup("volumeType"));
lookup("timeStart") >> duration_;
lookup("duration") >> duration_;
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,150 +22,43 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Typedef
Foam::timeActivatedExplicitSource
Description
Base class for field sources. Provides:
- name
- references to mesh and time databases
- dimensions
- volume type
- startTime
- duration
- read (from <sourceName>Properties dictionary)
SourceFiles
timeActivatedExplicitSource.C
\*---------------------------------------------------------------------------*/
#ifndef timeActivatedExplicitSource_H
#define timeActivatedExplicitSource_H
#include "IOdictionary.H"
#include "autoPtr.H"
#include "fvMesh.H"
#include "Time.H"
#include "NamedEnum.H"
#include "TimeActivatedExplicitSource.H"
#include "TimeActivatedExplicitSourceList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef TimeActivatedExplicitSource<scalar>
scalarTimeActivatedExplicitSource;
typedef TimeActivatedExplicitSource<vector>
vectorTimeActivatedExplicitSource;
typedef TimeActivatedExplicitSource<sphericalTensor>
sphericalTensorTimeActivatedExplicitSource;
typedef TimeActivatedExplicitSource<symmTensor>
symmTensorTimeActivatedExplicitSource;
typedef TimeActivatedExplicitSource<tensor>
tensorTimeActivatedExplicitSource;
/*---------------------------------------------------------------------------*\
Class timeActivatedExplicitSource Declaration
\*---------------------------------------------------------------------------*/
class timeActivatedExplicitSource
:
public IOdictionary
{
public:
enum volumeType
{
vtSpecific,
vtAbsolute
};
static const NamedEnum<volumeType, 2> volumeTypeNames_;
private:
// Private Member Functions
//- Disallow default bitwise copy construct
timeActivatedExplicitSource(const timeActivatedExplicitSource&);
//- Disallow default bitwise assignment
void operator=(const timeActivatedExplicitSource&);
protected:
// Protected data
//- Reference to the mesh
const fvMesh& mesh_;
//- Reference to time database
const Time& runTime_;
// Source properties
//- Name of the source
word name_;
//- Active flag
Switch active_;
//- Dimensions
const dimensionSet dimensions_;
//- Volume type
volumeType volumeType_;
//- Time start [s]
scalar timeStart_;
//- Duration [s]
scalar duration_;
public:
// Constructors
//- Construct from explicit source name and mesh
timeActivatedExplicitSource
(
const word&,
const fvMesh&,
const dimensionSet&
);
// Member Functions
// Access
//- Return the reference to the mesh
virtual const fvMesh& mesh() const;
//- Return the reference to the time database
virtual const Time& runTime() const;
//- Return the source name
virtual const word& name() const;
//- Return the active flag
virtual const Switch& active() const;
//- Return the dimensions
virtual const dimensionSet& dimensions() const;
//- Return the volume type
virtual const volumeType& volume() const;
//- Return the start time
virtual scalar timeStart() const;
//- Return the duration
virtual scalar duration() const;
//- Read properties dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
typedef TimeActivatedExplicitSourceList<scalar>
scalarTimeActivatedExplicitSourceList;
typedef TimeActivatedExplicitSourceList<vector>
vectorTimeActivatedExplicitSourceList;
typedef TimeActivatedExplicitSourceList<sphericalTensor>
sphericalTensorTimeActivatedExplicitSourceList;
typedef TimeActivatedExplicitSourceList<symmTensor>
symmTensorTimeActivatedExplicitSourceList;
typedef TimeActivatedExplicitSourceList<tensor>
tensorTimeActivatedExplicitSourceList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -45,10 +45,32 @@ $(REACTINGMPPARCEL)/makeBasicReactingMultiphaseParcelSubmodels.C
/* bolt-on models */
submodels/addOns/radiation/absorptionEmission/cloudAbsorptionEmission/cloudAbsorptionEmission.C
submodels/addOns/radiation/scatter/cloudScatter/cloudScatter.C
RADIATION=submodels/addOns/radiation
$(RADIATION)/absorptionEmission/cloudAbsorptionEmission/cloudAbsorptionEmission.C
$(RADIATION)/scatter/cloudScatter/cloudScatter.C
submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.C
KINEMATICINJECTION=submodels/Kinematic/InjectionModel
$(KINEMATICINJECTION)/KinematicLookupTableInjection/kinematicParcelInjectionData.C
$(KINEMATICINJECTION)/KinematicLookupTableInjection/kinematicParcelInjectionDataIO.C
$(KINEMATICINJECTION)/KinematicLookupTableInjection/kinematicParcelInjectionDataIOList.C
THERMOINJECTION=submodels/Thermodynamic/InjectionModel
$(THERMOINJECTION)/ThermoLookupTableInjection/thermoParcelInjectionData.C
$(THERMOINJECTION)/ThermoLookupTableInjection/thermoParcelInjectionDataIO.C
$(THERMOINJECTION)/ThermoLookupTableInjection/thermoParcelInjectionDataIOList.C
REACTINGINJECTION=submodels/Reacting/InjectionModel
$(REACTINGINJECTION)/ReactingLookupTableInjection/reactingParcelInjectionData.C
$(REACTINGINJECTION)/ReactingLookupTableInjection/reactingParcelInjectionDataIO.C
$(REACTINGINJECTION)/ReactingLookupTableInjection/reactingParcelInjectionDataIOList.C
REACTINGMPINJECTION=submodels/ReactingMultiphase/InjectionModel
$(REACTINGMPINJECTION)/ReactingMultiphaseLookupTableInjection/reactingMultiphaseParcelInjectionData.C
$(REACTINGMPINJECTION)/ReactingMultiphaseLookupTableInjection/reactingMultiphaseParcelInjectionDataIO.C
$(REACTINGMPINJECTION)/ReactingMultiphaseLookupTableInjection/reactingMultiphaseParcelInjectionDataIOList.C
/* data entries */
submodels/IO/DataEntry/makeDataEntries.C

View File

@ -38,6 +38,7 @@ License
#include "ManualInjection.H"
#include "NoInjection.H"
#include "PatchInjection.H"
#include "ReactingMultiphaseLookupTableInjection.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -108,6 +109,13 @@ License
ParcelType, \
ThermoType \
); \
makeInjectionModelThermoType \
( \
ReactingMultiphaseLookupTableInjection, \
KinematicCloud, \
ParcelType, \
ThermoType \
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -94,46 +94,56 @@ Type Foam::Table<Type>::integrate(const scalar x1, const scalar x2) const
Type sum = pTraits<Type>::zero;
// Return zero if out of bounds
if ((x1 > table_[table_.size()-1].first()) || (x2 < table_[0].first()))
if ((x1 > table_.last().first()) || (x2 < table_[0].first()))
{
return sum;
}
// Find start index
// Find next index greater than x1
label id1 = 0;
while ((table_[id1].first() < x1) && (id1 < table_.size()))
{
id1++;
}
// Find end index
// Find next index less than x2
label id2 = table_.size() - 1;
while ((table_[id2].first() > x2) && (id2 >= 1))
{
id2--;
}
// Integrate table body
for (label i=id1; i<id2; i++)
if ((id1 - id2) == 1)
{
sum +=
(table_[i].second() + table_[i+1].second())
* (table_[i+1].first() - table_[i].first());
// x1 and x2 lie within 1 interval
sum = 0.5*(value(x1) + value(x2))*(x2 - x1);
}
sum *= 0.5;
else
{
// x1 and x2 cross multiple intervals
// Add table ends (partial segments)
if (id1 > 0)
{
sum += 0.5
* (value(x1) + table_[id1].second())
* (table_[id1].first() - x1);
}
if (id2 < table_.size() - 1)
{
sum += 0.5
* (table_[id2].second() + value(x2))
* (x2 - table_[id2].first());
// Integrate table body
for (label i=id1; i<id2; i++)
{
sum +=
(table_[i].second() + table_[i+1].second())
* (table_[i+1].first() - table_[i].first());
}
sum *= 0.5;
// Add table ends (partial segments)
if (id1 > 0)
{
sum += 0.5
* (value(x1) + table_[id1].second())
* (table_[id1].first() - x1);
}
if (id2 < table_.size() - 1)
{
sum += 0.5
* (table_[id2].second() + value(x2))
* (x2 - table_[id2].first());
}
}
return sum;

View File

@ -27,11 +27,6 @@ License
#include "KinematicLookupTableInjection.H"
#include "scalarIOList.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class CloudType>
Foam::label Foam::KinematicLookupTableInjection<CloudType>::INPUT_FILE_COLS = 9;
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class CloudType>
@ -62,9 +57,9 @@ Foam::scalar Foam::KinematicLookupTableInjection<CloudType>::volumeToInject
scalar volume = 0.0;
if ((time0 >= 0.0) && (time0 < duration_))
{
forAll(mDot_, injectorI)
forAll(injectors_, i)
{
volume += mDot_[injectorI]/rho_[injectorI]*(time1 - time0);
volume += injectors_[i].mDot()/injectors_[i].rho()*(time1 - time0);
}
}
@ -88,14 +83,7 @@ Foam::KinematicLookupTableInjection<CloudType>::KinematicLookupTableInjection
(
readScalar(this->coeffDict().lookup("parcelsPerSecond"))
),
x_(0),
U_(0),
d_(0),
rho_(0),
mDot_(0),
injectorCells_(0)
{
scalarListIOList injectorData
injectors_
(
IOobject
(
@ -105,55 +93,21 @@ Foam::KinematicLookupTableInjection<CloudType>::KinematicLookupTableInjection
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
x_.setSize(injectorData.size());
U_.setSize(injectorData.size());
d_.setSize(injectorData.size());
rho_.setSize(injectorData.size());
mDot_.setSize(injectorData.size());
// Populate lists
forAll(injectorData, injectorI)
{
if (injectorData[injectorI].size() != INPUT_FILE_COLS)
{
FatalErrorIn
(
"KinematicLookupTableInjection"
"("
"const dictionary&,"
"CloudType& owner"
")"
) << "Incorrect number of entries in injector specification "
<< "- found " << injectorData[injectorI].size()
<< ", expected " << INPUT_FILE_COLS << ":" << nl
<< " x0 x1 x2 u0 u1 u2 d rho mDot " << nl
<< exit(FatalError);
}
x_[injectorI].component(0) = injectorData[injectorI][0];
x_[injectorI].component(1) = injectorData[injectorI][1];
x_[injectorI].component(2) = injectorData[injectorI][2];
U_[injectorI].component(0) = injectorData[injectorI][3];
U_[injectorI].component(1) = injectorData[injectorI][4];
U_[injectorI].component(2) = injectorData[injectorI][5];
d_[injectorI] = injectorData[injectorI][6];
rho_[injectorI] = injectorData[injectorI][7];
mDot_[injectorI] = injectorData[injectorI][8];
}
),
injectorCells_(0)
{
// Set/cache the injector cells
injectorCells_.setSize(injectorData.size());
forAll(x_, injectorI)
injectorCells_.setSize(injectors_.size());
forAll(injectors_, i)
{
this->findCellAtPosition(injectorCells_[injectorI], x_[injectorI]);
this->findCellAtPosition(injectorCells_[i], injectors_[i].x());
}
// Determine volume of particles to inject
this->volumeTotal_ = 0.0;
forAll(mDot_, injectorI)
forAll(injectors_, i)
{
this->volumeTotal_ += mDot_[injectorI]/rho_[injectorI];
this->volumeTotal_ += injectors_[i].mDot()/injectors_[i].rho();
}
this->volumeTotal_ *= duration_;
}
@ -194,7 +148,7 @@ void Foam::KinematicLookupTableInjection<CloudType>::setPositionAndCell
{
label injectorI = parcelI*injectorCells_.size()/nParcels;
position = x_[injectorI];
position = injectors_[injectorI].x();
cellOwner = injectorCells_[injectorI];
}
@ -211,13 +165,13 @@ void Foam::KinematicLookupTableInjection<CloudType>::setProperties
label injectorI = parcelI*injectorCells_.size()/nParcels;
// set particle velocity
parcel.U() = U_[injectorI];
parcel.U() = injectors_[injectorI].U();
// set particle diameter
parcel.d() = d_[injectorI];
parcel.d() = injectors_[injectorI].d();
// set particle density
parcel.rho() = rho_[injectorI];
parcel.rho() = injectors_[injectorI].rho();
}

View File

@ -30,7 +30,10 @@ Description
an injection site.
(
(x y z u v w d rho mDot)
(x y z) (u v w) d rho mDot // injector 1
(x y z) (u v w) d rho mDot // injector 2
...
(x y z) (u v w) d rho mDot // injector N
);
where:
@ -49,7 +52,7 @@ SourceFiles
#define KinematicLookupTableInjection_H
#include "InjectionModel.H"
#include "pdf.H"
#include "kinematicParcelInjectionDataIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -76,27 +79,12 @@ class KinematicLookupTableInjection
//- Number of parcels per injector - common to all injection sources
const label nParcelsPerSecond_;
//- List of parcel position per injector / [m]
List<point> x_;
//- List of parcel velocity per injector / [m]
List<vector> U_;
//- List of parcel diameter per injector / [m]
List<scalar> d_;
//- List of parcel fluid density pre injector / [kg/m3]
List<scalar> rho_;
//- List of parcel injection mass flow per injector / [kg/s]
List<scalar> mDot_;
//- List of injectors
kinematicParcelInjectionDataIOList injectors_;
//- List of injector cells per injector
List<label> injectorCells_;
//- Number of columns expected in input file
static label INPUT_FILE_COLS;
protected:

View File

@ -0,0 +1,66 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "kinematicParcelInjectionData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(kinematicParcelInjectionData, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::kinematicParcelInjectionData::kinematicParcelInjectionData()
:
x_(point::zero),
U_(vector::zero),
d_(0.0),
rho_(0.0),
mDot_(0.0)
{}
Foam::kinematicParcelInjectionData::kinematicParcelInjectionData
(
const dictionary& dict
)
:
x_(dict.lookup("x")),
U_(dict.lookup("U")),
d_(readScalar(dict.lookup("d"))),
rho_(readScalar(dict.lookup("rho"))),
mDot_(readScalar(dict.lookup("mDot")))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::kinematicParcelInjectionData::~kinematicParcelInjectionData()
{}
// ************************************************************************* //

View File

@ -0,0 +1,216 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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::kinematicParcelInjectionData
Description
Container class to provide injection data for kinematic parcels
SourceFiles
kinematicParcelInjectionData.C
\*---------------------------------------------------------------------------*/
#ifndef kinematicParcelInjectionData_H
#define kinematicParcelInjectionData_H
#include "dictionary.H"
#include "vector.H"
#include "point.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class kinematicParcelInjectionData;
// Forward declaration of friend functions
Ostream& operator<<
(
Ostream&,
const kinematicParcelInjectionData&
);
Istream& operator>>
(
Istream&,
kinematicParcelInjectionData&
);
/*---------------------------------------------------------------------------*\
Class kinematicParcelInjectionData Declaration
\*---------------------------------------------------------------------------*/
class kinematicParcelInjectionData
{
protected:
// Parcel properties
//- Position [m]
point x_;
//- Velocity [m/s]
vector U_;
//- Diameter [m]
scalar d_;
//- Density [kg/m3]
scalar rho_;
//- Mass flow rate [kg/s]
scalar mDot_;
public:
//- Runtime type information
TypeName("kinematicParcelInjectionData");
// Constructors
//- Null constructor
kinematicParcelInjectionData();
//- Construct from dictionary
kinematicParcelInjectionData(const dictionary& dict);
//- Construct from Istream
kinematicParcelInjectionData(Istream& is);
//-Destructor
virtual ~kinematicParcelInjectionData();
// Access
//- Return const access to the position
inline const point& x() const;
//- Return const access to the velocity
inline const vector& U() const;
//- Return const access to the diameter
inline scalar d() const;
//- Return const access to the density
inline scalar rho() const;
//- Return const access to the mass flow rate
inline scalar mDot() const;
// Edit
//- Return access to the position
inline point& x();
//- Return access to the velocity
inline vector& U();
//- Return access to the diameter
inline scalar& d();
//- Return access to the density
inline scalar& rho();
//- Return access to the mass flow rate
inline scalar& mDot();
// I-O
// Friend Operators
friend bool operator==
(
const kinematicParcelInjectionData& a,
const kinematicParcelInjectionData& b
)
{
notImplemented
(
"operator=="
"("
"const kinematicParcelInjectionData&, "
"const kinematicParcelInjectionData&"
")"
);
return false;
}
friend bool operator!=
(
const kinematicParcelInjectionData& a,
const kinematicParcelInjectionData& b
)
{
notImplemented
(
"operator=="
"("
"const kinematicParcelInjectionData&, "
"const kinematicParcelInjectionData&"
")"
);
return false;
}
//- Ostream operator
friend Ostream& operator<<
(
Ostream& os,
const kinematicParcelInjectionData& data
);
//- Istream operator
friend Istream& operator>>
(
Istream& is,
kinematicParcelInjectionData& data
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "kinematicParcelInjectionDataI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -24,75 +24,67 @@ License
\*---------------------------------------------------------------------------*/
#include "pointSourceProperties.H"
#include "kinematicParcelInjectionData.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::word& Foam::pointSourceProperties::name() const
inline const Foam::point& Foam::kinematicParcelInjectionData::x() const
{
return name_;
return x_;
}
inline Foam::scalar Foam::pointSourceProperties::timeStart() const
inline const Foam::vector& Foam::kinematicParcelInjectionData::U() const
{
return timeStart_;
return U_;
}
inline Foam::scalar Foam::pointSourceProperties::timeEnd() const
inline Foam::scalar Foam::kinematicParcelInjectionData::d() const
{
return timeStart_ + duration_;
return d_;
}
inline Foam::scalar Foam::pointSourceProperties::duration() const
inline Foam::scalar Foam::kinematicParcelInjectionData::rho() const
{
return duration_;
return rho_;
}
inline const Foam::point& Foam::pointSourceProperties::location() const
inline Foam::scalar Foam::kinematicParcelInjectionData::mDot() const
{
return location_;
return mDot_;
}
inline const Foam::List<Foam::pointSourceProperties::fieldNameValuePair>&
Foam::pointSourceProperties::fieldData() const
inline Foam::point& Foam::kinematicParcelInjectionData::x()
{
return fieldData_;
return x_;
}
inline Foam::word& Foam::pointSourceProperties::name()
inline Foam::vector& Foam::kinematicParcelInjectionData::U()
{
return name_;
return U_;
}
inline Foam::scalar& Foam::pointSourceProperties::timeStart()
inline Foam::scalar& Foam::kinematicParcelInjectionData::d()
{
return timeStart_;
return d_;
}
inline Foam::scalar& Foam::pointSourceProperties::duration()
inline Foam::scalar& Foam::kinematicParcelInjectionData::rho()
{
return duration_;
return rho_;
}
inline Foam::point& Foam::pointSourceProperties::location()
inline Foam::scalar& Foam::kinematicParcelInjectionData::mDot()
{
return location_;
}
inline Foam::List<Foam::pointSourceProperties::fieldNameValuePair>&
Foam::pointSourceProperties::fieldData()
{
return fieldData_;
return mDot_;
}

View File

@ -0,0 +1,89 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "kinematicParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::kinematicParcelInjectionData::kinematicParcelInjectionData(Istream& is)
{
is.check("reading (Px Py Pz)");
is >> x_;
is.check("reading (Ux Uy Uz)");
is >> U_;
is.check("reading d");
is >> d_;
is.check("reading rho");
is >> rho_;
is.check("reading mDot");
is >> mDot_;
is.check("kinematicParcelInjectionData(Istream& is)");
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const kinematicParcelInjectionData& data
)
{
os << data.x_ << data.U_ << data.d_ << data.rho_ << data.mDot_;
return os;
}
Foam::Istream& Foam::operator>>(Istream& is, kinematicParcelInjectionData& data)
{
is.check("reading (Px Py Pz)");
is >> data.x_;
is.check("reading (Ux Uy Uz)");
is >> data.U_;
is.check("reading d");
is >> data.d_;
is.check("reading rho");
is >> data.rho_;
is.check("reading mDot");
is >> data.mDot_;
is.check("operator(Istream&, kinematicParcelInjectionData&)");
return is;
}
// ************************************************************************* //

View File

@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "kinematicParcelInjectionDataIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebug(IOList<kinematicParcelInjectionData>, 0);
}
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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
Description
SourceFiles
kinematicParcelInjectionDataIOList.C
\*---------------------------------------------------------------------------*/
#ifndef kinematicParcelInjectionDataIOList_H
#define kinematicParcelInjectionDataIOList_H
#include "IOList.H"
#include "kinematicParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOList<kinematicParcelInjectionData>
kinematicParcelInjectionDataIOList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -25,12 +25,6 @@ License
\*---------------------------------------------------------------------------*/
#include "ReactingLookupTableInjection.H"
#include "scalarIOList.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class CloudType>
Foam::label Foam::ReactingLookupTableInjection<CloudType>::INPUT_FILE_COLS = 12;
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
@ -62,9 +56,9 @@ Foam::scalar Foam::ReactingLookupTableInjection<CloudType>::volumeToInject
scalar volume = 0.0;
if ((time0 >= 0.0) && (time0 < duration_))
{
forAll(mDot_, injectorI)
forAll(injectors_, i)
{
volume += mDot_[injectorI]/rho_[injectorI]*(time1 - time0);
volume += injectors_[i].mDot()/injectors_[i].rho()*(time1 - time0);
}
}
@ -88,17 +82,7 @@ Foam::ReactingLookupTableInjection<CloudType>::ReactingLookupTableInjection
(
readScalar(this->coeffDict().lookup("parcelsPerSecond"))
),
x_(0),
U_(0),
d_(0),
rho_(0),
mDot_(0),
T_(0),
cp_(0),
Y_(0),
injectorCells_(0)
{
scalarListIOList injectorData
injectors_
(
IOobject
(
@ -108,75 +92,21 @@ Foam::ReactingLookupTableInjection<CloudType>::ReactingLookupTableInjection
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
x_.setSize(injectorData.size());
U_.setSize(injectorData.size());
d_.setSize(injectorData.size());
rho_.setSize(injectorData.size());
mDot_.setSize(injectorData.size());
T_.setSize(injectorData.size());
cp_.setSize(injectorData.size());
Y_.setSize(injectorData.size());
// Populate lists
forAll(injectorData, injectorI)
{
if (injectorData[injectorI].size() != INPUT_FILE_COLS)
{
FatalErrorIn
(
"ReactingLookupTableInjection"
"("
"const dictionary&,"
"CloudType& owner"
")"
) << "Incorrect number of entries in injector specification "
<< "- found " << injectorData[injectorI].size()
<< ", expected a minimum of " << INPUT_FILE_COLS << ":" << nl
<< " x0 x1 x2 u0 u1 u2 d rho mDot T cp Y0..YN"
<< nl << exit(FatalError);
}
x_[injectorI].component(0) = injectorData[injectorI][0];
x_[injectorI].component(1) = injectorData[injectorI][1];
x_[injectorI].component(2) = injectorData[injectorI][2];
U_[injectorI].component(0) = injectorData[injectorI][3];
U_[injectorI].component(1) = injectorData[injectorI][4];
U_[injectorI].component(2) = injectorData[injectorI][5];
d_[injectorI] = injectorData[injectorI][6];
rho_[injectorI] = injectorData[injectorI][7];
mDot_[injectorI] = injectorData[injectorI][8];
T_[injectorI] = injectorData[injectorI][9];
cp_[injectorI] = injectorData[injectorI][10];
Y_[injectorI].setSize
(
injectorData[injectorI].size() - INPUT_FILE_COLS + 1
);
label Yi = 0;
for
(
label i = INPUT_FILE_COLS-1;
i < injectorData[injectorI].size();
i++
)
{
Y_[injectorI][Yi++] = injectorData[injectorI][i];
}
}
),
injectorCells_(0)
{
// Set/cache the injector cells
injectorCells_.setSize(injectorData.size());
forAll(x_, injectorI)
injectorCells_.setSize(injectors_.size());
forAll(injectors_, i)
{
this->findCellAtPosition(injectorCells_[injectorI], x_[injectorI]);
this->findCellAtPosition(injectorCells_[i], injectors_[i].x());
}
// Determine volume of particles to inject
this->volumeTotal_ = 0.0;
forAll(mDot_, injectorI)
forAll(injectors_, i)
{
this->volumeTotal_ += mDot_[injectorI]/rho_[injectorI];
this->volumeTotal_ += injectors_[i].mDot()/injectors_[i].rho();
}
this->volumeTotal_ *= duration_;
}
@ -217,7 +147,7 @@ void Foam::ReactingLookupTableInjection<CloudType>::setPositionAndCell
{
label injectorI = parcelI*injectorCells_.size()/nParcels;
position = x_[injectorI];
position = injectors_[injectorI].x();
cellOwner = injectorCells_[injectorI];
}
@ -234,22 +164,22 @@ void Foam::ReactingLookupTableInjection<CloudType>::setProperties
label injectorI = parcelI*injectorCells_.size()/nParcels;
// set particle velocity
parcel.U() = U_[injectorI];
parcel.U() = injectors_[injectorI].U();
// set particle diameter
parcel.d() = d_[injectorI];
parcel.d() = injectors_[injectorI].d();
// set particle density
parcel.rho() = rho_[injectorI];
parcel.rho() = injectors_[injectorI].rho();
// set particle temperature
parcel.T() = T_[injectorI];
parcel.T() = injectors_[injectorI].T();
// set particle specific heat capacity
parcel.cp() = cp_[injectorI];
parcel.cp() = injectors_[injectorI].cp();
// set particle component mass fractions
parcel.Y() = Y_[injectorI];
parcel.Y() = injectors_[injectorI].Y();
}

View File

@ -30,7 +30,10 @@ Description
an injection site.
(
(x y z u v w d rho mDot T cp Y0..YN)
(x y z) (u v w) d rho mDot T cp (Y0..YN) // injector 1
(x y z) (u v w) d rho mDot T cp (Y0..YN) // injector 2
...
(x y z) (u v w) d rho mDot T cp (Y0..YN) // injector N
);
where:
@ -41,6 +44,7 @@ Description
mDot = mass flow rate [kg/m3]
T = temperature [K]
cp = specific heat capacity [J/kg/K]
Y = list of mass fractions
SourceFiles
ReactingLookupTableInjection.C
@ -51,7 +55,7 @@ SourceFiles
#define ReactingLookupTableInjection_H
#include "InjectionModel.H"
#include "pdf.H"
#include "reactingParcelInjectionDataIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -78,36 +82,12 @@ class ReactingLookupTableInjection
//- Number of parcels per injector - common to all injection sources
const label nParcelsPerSecond_;
//- List of parcel position per injector / [m]
List<point> x_;
//- List of parcel velocity per injector / [m]
List<vector> U_;
//- List of parcel diameter per injector / [m]
List<scalar> d_;
//- List of parcel fluid density pre injector / [kg/m3]
List<scalar> rho_;
//- List of parcel injection mass flow per injector / [kg/s]
List<scalar> mDot_;
//- List of parcel temperature flow per injector / [K]
List<scalar> T_;
//- List of parcel specific heat capacity per injector / [J/kg/K]
List<scalar> cp_;
//- List of parcel specie mass fractions per injector / []
List<scalarList> Y_;
//- List of injectors
reactingParcelInjectionDataIOList injectors_;
//- List of injector cells per injector
List<label> injectorCells_;
//- Number of columns expected in input file
static label INPUT_FILE_COLS;
protected:

View File

@ -0,0 +1,60 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "reactingParcelInjectionData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(reactingParcelInjectionData, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::reactingParcelInjectionData::reactingParcelInjectionData()
:
thermoParcelInjectionData(),
Y_()
{}
Foam::reactingParcelInjectionData::reactingParcelInjectionData
(
const dictionary& dict
)
:
thermoParcelInjectionData(dict),
Y_(dict.lookup("Y"))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::reactingParcelInjectionData::~reactingParcelInjectionData()
{}
// ************************************************************************* //

View File

@ -0,0 +1,181 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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::reactingParcelInjectionData
Description
Container class to provide injection data for reacting parcels
SourceFiles
reactingParcelInjectionData.C
\*---------------------------------------------------------------------------*/
#ifndef reactingParcelInjectionData_H
#define reactingParcelInjectionData_H
#include "thermoParcelInjectionData.H"
#include "scalarList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class reactingParcelInjectionData;
// Forward declaration of friend functions
Ostream& operator<<
(
Ostream&,
const reactingParcelInjectionData&
);
Istream& operator>>
(
Istream&,
reactingParcelInjectionData&
);
/*---------------------------------------------------------------------------*\
Class reactingParcelInjectionData Declaration
\*---------------------------------------------------------------------------*/
class reactingParcelInjectionData
:
public thermoParcelInjectionData
{
protected:
// Parcel properties
//- List of mass fractions
scalarList Y_;
public:
//- Runtime type information
TypeName("reactingParcelInjectionData");
// Constructors
//- Null constructor
reactingParcelInjectionData();
//- Construct from dictionary
reactingParcelInjectionData(const dictionary& dict);
//- Construct from Istream
reactingParcelInjectionData(Istream& is);
//-Destructor
virtual ~reactingParcelInjectionData();
// Access
//- Return const access to the list of mass fractions
inline const scalarList& Y() const;
// Edit
//- Return access to the mass fractions
inline scalarList& Y();
// I-O
// Friend Operators
friend bool operator==
(
const reactingParcelInjectionData& a,
const reactingParcelInjectionData& b
)
{
notImplemented
(
"operator=="
"("
"const reactingParcelInjectionData&, "
"const reactingParcelInjectionData&"
")"
);
return false;
}
friend bool operator!=
(
const reactingParcelInjectionData& a,
const reactingParcelInjectionData& b
)
{
notImplemented
(
"operator=="
"("
"const reactingParcelInjectionData&, "
"const reactingParcelInjectionData&"
")"
);
return false;
}
//- Ostream operator
friend Ostream& operator<<
(
Ostream& os,
const reactingParcelInjectionData& data
);
//- Istream operator
friend Istream& operator>>
(
Istream& is,
reactingParcelInjectionData& data
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "reactingParcelInjectionDataI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "reactingParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::scalarList& Foam::reactingParcelInjectionData::Y() const
{
return Y_;
}
inline Foam::scalarList& Foam::reactingParcelInjectionData::Y()
{
return Y_;
}
// ************************************************************************* //

View File

@ -0,0 +1,71 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "reactingParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::reactingParcelInjectionData::reactingParcelInjectionData(Istream& is)
:
thermoParcelInjectionData(is)
{
is.check("reading Y's");
is >> Y_;
is.check("reactingParcelInjectionData(Istream& is)");
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const reactingParcelInjectionData& data
)
{
os << static_cast<const thermoParcelInjectionData&>(data);
os << data.Y_;
return os;
}
Foam::Istream& Foam::operator>>(Istream& is, reactingParcelInjectionData& data)
{
is >> static_cast<thermoParcelInjectionData&>(data);
is.check("reading Y's");
is >> data.Y_;
is.check("operator(Istream&, reactingParcelInjectionData&)");
return is;
}
// ************************************************************************* //

View File

@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "reactingParcelInjectionDataIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebug(IOList<reactingParcelInjectionData>, 0);
}
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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
Description
SourceFiles
reactingParcelInjectionDataIOList.C
\*---------------------------------------------------------------------------*/
#ifndef reactingParcelInjectionDataIOList_H
#define reactingParcelInjectionDataIOList_H
#include "IOList.H"
#include "reactingParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOList<reactingParcelInjectionData>
reactingParcelInjectionDataIOList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,218 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-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 "ReactingMultiphaseLookupTableInjection.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class CloudType>
Foam::label
Foam::ReactingMultiphaseLookupTableInjection<CloudType>::parcelsToInject
(
const scalar time0,
const scalar time1
) const
{
if ((time0 >= 0.0) && (time0 < duration_))
{
return round(injectorCells_.size()*(time1 - time0)*nParcelsPerSecond_);
}
else
{
return 0;
}
}
template<class CloudType>
Foam::scalar
Foam::ReactingMultiphaseLookupTableInjection<CloudType>::volumeToInject
(
const scalar time0,
const scalar time1
) const
{
scalar volume = 0.0;
if ((time0 >= 0.0) && (time0 < duration_))
{
forAll(injectors_, i)
{
volume += injectors_[i].mDot()/injectors_[i].rho()*(time1 - time0);
}
}
return volume;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::ReactingMultiphaseLookupTableInjection<CloudType>::
ReactingMultiphaseLookupTableInjection
(
const dictionary& dict,
CloudType& owner
)
:
InjectionModel<CloudType>(dict, owner, typeName),
inputFileName_(this->coeffDict().lookup("inputFile")),
duration_(readScalar(this->coeffDict().lookup("duration"))),
nParcelsPerSecond_
(
readScalar(this->coeffDict().lookup("parcelsPerSecond"))
),
injectors_
(
IOobject
(
inputFileName_,
owner.db().time().constant(),
owner.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
injectorCells_(0)
{
// Set/cache the injector cells
injectorCells_.setSize(injectors_.size());
forAll(injectors_, i)
{
this->findCellAtPosition(injectorCells_[i], injectors_[i].x());
}
// Determine volume of particles to inject
this->volumeTotal_ = 0.0;
forAll(injectors_, i)
{
this->volumeTotal_ += injectors_[i].mDot()/injectors_[i].rho();
}
this->volumeTotal_ *= duration_;
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::ReactingMultiphaseLookupTableInjection<CloudType>::
~ReactingMultiphaseLookupTableInjection()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::ReactingMultiphaseLookupTableInjection<CloudType>::active() const
{
return true;
}
template<class CloudType>
Foam::scalar
Foam::ReactingMultiphaseLookupTableInjection<CloudType>::timeEnd() const
{
return this->SOI_ + duration_;
}
template<class CloudType>
void Foam::ReactingMultiphaseLookupTableInjection<CloudType>::setPositionAndCell
(
const label parcelI,
const label nParcels,
const scalar time,
vector& position,
label& cellOwner
)
{
label injectorI = parcelI*injectorCells_.size()/nParcels;
position = injectors_[injectorI].x();
cellOwner = injectorCells_[injectorI];
}
template<class CloudType>
void Foam::ReactingMultiphaseLookupTableInjection<CloudType>::setProperties
(
const label parcelI,
const label nParcels,
const scalar,
typename CloudType::parcelType& parcel
)
{
label injectorI = parcelI*injectorCells_.size()/nParcels;
// set particle velocity
parcel.U() = injectors_[injectorI].U();
// set particle diameter
parcel.d() = injectors_[injectorI].d();
// set particle density
parcel.rho() = injectors_[injectorI].rho();
// set particle temperature
parcel.T() = injectors_[injectorI].T();
// set particle specific heat capacity
parcel.cp() = injectors_[injectorI].cp();
// set particle component mass fractions
parcel.Y() = injectors_[injectorI].Y();
// set particle gaseous component mass fractions
parcel.YGas() = injectors_[injectorI].YGas();
// set particle liquid component mass fractions
parcel.YLiquid() = injectors_[injectorI].YLiquid();
// set particle solid component mass fractions
parcel.YSolid() = injectors_[injectorI].YSolid();
}
template<class CloudType>
bool
Foam::ReactingMultiphaseLookupTableInjection<CloudType>::fullyDescribed() const
{
return true;
}
template<class CloudType>
bool Foam::ReactingMultiphaseLookupTableInjection<CloudType>::validInjection
(
const label
)
{
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,187 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-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::ReactingMultiphaseLookupTableInjection
Description
Particle injection sources read from look-up table. Each row corresponds to
an injection site.
(
(x y z) (u v w) d rho mDot T cp (Y0..Y2) (Yg0..YgN) (Yl0..YlN) (Ys0..YsN)
(x y z) (u v w) d rho mDot T cp (Y0..Y2) (Yg0..YgN) (Yl0..YlN) (Ys0..YsN)
...
(x y z) (u v w) d rho mDot T cp (Y0..Y2) (Yg0..YgN) (Yl0..YlN) (Ys0..YsN)
);
where:
x, y, z = global cartesian co-ordinates [m]
u, v, w = global cartesian velocity components [m/s]
d = diameter [m]
rho = density [kg/m3]
mDot = mass flow rate [kg/m3]
T = temperature [K]
cp = specific heat capacity [J/kg/K]
Y(3) = total mass fraction of gas (Y0), liquid (Y1), solid (Y3)
Yg(Ngas) = mass fractions of gaseous components
Yl(Nliq) = mass fractions of liquid components
Ys(Nsld) = mass fractions of solid components
SourceFiles
ReactingMultiphaseLookupTableInjection.C
\*---------------------------------------------------------------------------*/
#ifndef ReactingMultiphaseLookupTableInjection_H
#define ReactingMultiphaseLookupTableInjection_H
#include "InjectionModel.H"
#include "reactingMultiphaseParcelInjectionDataIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class ReactingMultiphaseLookupTableInjection Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class ReactingMultiphaseLookupTableInjection
:
public InjectionModel<CloudType>
{
// Private data
//- Name of file containing injector/parcel data
const word inputFileName_;
//- Injection duration - common to all injection sources
const scalar duration_;
//- Number of parcels per injector - common to all injection sources
const label nParcelsPerSecond_;
//- List of injectors
reactingMultiphaseParcelInjectionDataIOList injectors_;
//- List of injector cells per injector
List<label> injectorCells_;
protected:
// Protected member functions
//- Number of parcels to introduce over the time step relative to SOI
label parcelsToInject
(
const scalar time0,
const scalar time1
) const;
//- Volume of parcels to introduce over the time step relative to SOI
scalar volumeToInject
(
const scalar time0,
const scalar time1
) const;
public:
//- Runtime type information
TypeName("ReactingMultiphaseLookupTableInjection");
// Constructors
//- Construct from dictionary
ReactingMultiphaseLookupTableInjection
(
const dictionary& dict,
CloudType& owner
);
//- Destructor
virtual ~ReactingMultiphaseLookupTableInjection();
// Member Functions
//- Flag to indicate whether model activates injection model
bool active() const;
//- Return the end-of-injection time
scalar timeEnd() const;
// Injection geometry
//- Set the injection position and owner cell
virtual void setPositionAndCell
(
const label parcelI,
const label nParcels,
const scalar time,
vector& position,
label& cellOwner
);
//- Set the parcel properties
virtual void setProperties
(
const label parcelI,
const label nParcels,
const scalar time,
typename CloudType::parcelType& parcel
);
//- Flag to identify whether model fully describes the parcel
virtual bool fullyDescribed() const;
//- Return flag to identify whether or not injection of parcelI is
// permitted
virtual bool validInjection(const label parcelI);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "ReactingMultiphaseLookupTableInjection.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,67 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "reactingMultiphaseParcelInjectionData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(reactingMultiphaseParcelInjectionData, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::reactingMultiphaseParcelInjectionData::
reactingMultiphaseParcelInjectionData()
:
reactingParcelInjectionData(),
YGas_(),
YLiquid_(),
YSolid_()
{}
Foam::reactingMultiphaseParcelInjectionData::
reactingMultiphaseParcelInjectionData
(
const dictionary& dict
)
:
reactingParcelInjectionData(dict),
YGas_(dict.lookup("YGas")),
YLiquid_(dict.lookup("YLiquid")),
YSolid_(dict.lookup("YSolid"))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::reactingMultiphaseParcelInjectionData::
~reactingMultiphaseParcelInjectionData()
{}
// ************************************************************************* //

View File

@ -0,0 +1,198 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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::reactingMultiphaseParcelInjectionData
Description
Container class to provide injection data for reacting multiphase parcels
SourceFiles
reactingMultiphaseParcelInjectionData.C
\*---------------------------------------------------------------------------*/
#ifndef reactingMultiphaseParcelInjectionData_H
#define reactingMultiphaseParcelInjectionData_H
#include "reactingParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class reactingMultiphaseParcelInjectionData;
// Forward declaration of friend functions
Ostream& operator<<
(
Ostream&,
const reactingMultiphaseParcelInjectionData&
);
Istream& operator>>
(
Istream&,
reactingMultiphaseParcelInjectionData&
);
/*---------------------------------------------------------------------------*\
Class reactingMultiphaseParcelInjectionData Declaration
\*---------------------------------------------------------------------------*/
class reactingMultiphaseParcelInjectionData
:
public reactingParcelInjectionData
{
protected:
// Parcel properties
//- List of gaseous mass fractions
scalarList YGas_;
//- List of liquid mass fractions
scalarList YLiquid_;
//- List of solid mass fractions
scalarList YSolid_;
public:
//- Runtime type information
TypeName("reactingMultiphaseParcelInjectionData");
// Constructors
//- Null constructor
reactingMultiphaseParcelInjectionData();
//- Construct from dictionary
reactingMultiphaseParcelInjectionData(const dictionary& dict);
//- Construct from Istream
reactingMultiphaseParcelInjectionData(Istream& is);
//-Destructor
virtual ~reactingMultiphaseParcelInjectionData();
// Access
//- Return const access to the list of gaseous mass fractions
inline const scalarList& YGas() const;
//- Return const access to the list of liquid mass fractions
inline const scalarList& YLiquid() const;
//- Return const access to the list of solid mass fractions
inline const scalarList& YSolid() const;
// Edit
//- Return access to the gaseous mass fractions
inline scalarList& YGas();
//- Return access to the liquid mass fractions
inline scalarList& YLiquid();
//- Return access to the solid mass fractions
inline scalarList& YSolid();
// I-O
// Friend Operators
friend bool operator==
(
const reactingMultiphaseParcelInjectionData& a,
const reactingMultiphaseParcelInjectionData& b
)
{
notImplemented
(
"operator=="
"("
"const reactingMultiphaseParcelInjectionData&, "
"const reactingMultiphaseParcelInjectionData&"
")"
);
return false;
}
friend bool operator!=
(
const reactingMultiphaseParcelInjectionData& a,
const reactingMultiphaseParcelInjectionData& b
)
{
notImplemented
(
"operator=="
"("
"const reactingMultiphaseParcelInjectionData&, "
"const reactingMultiphaseParcelInjectionData&"
")"
);
return false;
}
//- Ostream operator
friend Ostream& operator<<
(
Ostream& os,
const reactingMultiphaseParcelInjectionData& data
);
//- Istream operator
friend Istream& operator>>
(
Istream& is,
reactingMultiphaseParcelInjectionData& data
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "reactingMultiphaseParcelInjectionDataI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,70 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "reactingMultiphaseParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::scalarList&
Foam::reactingMultiphaseParcelInjectionData::YGas() const
{
return YGas_;
}
inline const Foam::scalarList&
Foam::reactingMultiphaseParcelInjectionData::YLiquid() const
{
return YLiquid_;
}
inline const Foam::scalarList&
Foam::reactingMultiphaseParcelInjectionData::YSolid() const
{
return YSolid_;
}
inline Foam::scalarList& Foam::reactingMultiphaseParcelInjectionData::YGas()
{
return YGas_;
}
inline Foam::scalarList& Foam::reactingMultiphaseParcelInjectionData::YLiquid()
{
return YLiquid_;
}
inline Foam::scalarList& Foam::reactingMultiphaseParcelInjectionData::YSolid()
{
return YSolid_;
}
// ************************************************************************* //

View File

@ -0,0 +1,88 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "reactingMultiphaseParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::reactingMultiphaseParcelInjectionData::
reactingMultiphaseParcelInjectionData(Istream& is)
:
reactingParcelInjectionData(is)
{
is.check("reading YGas's");
is >> YGas_;
is.check("reading YLiquid's");
is >> YLiquid_;
is.check("reading YSolid's");
is >> YSolid_;
is.check("reactingMultiphaseParcelInjectionData(Istream& is)");
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const reactingMultiphaseParcelInjectionData& data
)
{
os << static_cast<const reactingParcelInjectionData&>(data);
os << data.YGas_ << data.YLiquid_ << data.YSolid_;
return os;
}
Foam::Istream& Foam::operator>>
(
Istream& is,
reactingMultiphaseParcelInjectionData& data
)
{
is >> static_cast<reactingParcelInjectionData&>(data);
is.check("reading YGas's");
is >> data.YGas_;
is.check("reading YLiquid's");
is >> data.YLiquid_;
is.check("reading YSolid's");
is >> data.YSolid_;
is.check("operator(Istream&, reactingMultiphaseParcelInjectionData&)");
return is;
}
// ************************************************************************* //

View File

@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "reactingMultiphaseParcelInjectionDataIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebug(IOList<reactingMultiphaseParcelInjectionData>, 0);
}
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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
Description
SourceFiles
reactingMultiphaseParcelInjectionDataIOList.C
\*---------------------------------------------------------------------------*/
#ifndef reactingMultiphaseParcelInjectionDataIOList_H
#define reactingMultiphaseParcelInjectionDataIOList_H
#include "IOList.H"
#include "reactingMultiphaseParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOList<reactingMultiphaseParcelInjectionData>
reactingMultiphaseParcelInjectionDataIOList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -27,11 +27,6 @@ License
#include "ThermoLookupTableInjection.H"
#include "scalarIOList.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class CloudType>
Foam::label Foam::ThermoLookupTableInjection<CloudType>::INPUT_FILE_COLS = 11;
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class CloudType>
@ -62,9 +57,9 @@ Foam::scalar Foam::ThermoLookupTableInjection<CloudType>::volumeToInject
scalar volume = 0.0;
if ((time0 >= 0.0) && (time0 < duration_))
{
forAll(mDot_, injectorI)
forAll(injectors_, i)
{
volume += mDot_[injectorI]/rho_[injectorI]*(time1 - time0);
volume += injectors_[i].mDot()/injectors_[i].rho()*(time1 - time0);
}
}
@ -88,16 +83,7 @@ Foam::ThermoLookupTableInjection<CloudType>::ThermoLookupTableInjection
(
readScalar(this->coeffDict().lookup("parcelsPerSecond"))
),
x_(0),
U_(0),
d_(0),
rho_(0),
mDot_(0),
T_(0),
cp_(0),
injectorCells_(0)
{
scalarListIOList injectorData
injectors_
(
IOobject
(
@ -107,59 +93,21 @@ Foam::ThermoLookupTableInjection<CloudType>::ThermoLookupTableInjection
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
x_.setSize(injectorData.size());
U_.setSize(injectorData.size());
d_.setSize(injectorData.size());
rho_.setSize(injectorData.size());
mDot_.setSize(injectorData.size());
T_.setSize(injectorData.size());
cp_.setSize(injectorData.size());
// Populate lists
forAll(injectorData, injectorI)
{
if (injectorData[injectorI].size() != INPUT_FILE_COLS)
{
FatalErrorIn
(
"ThermoLookupTableInjection"
"("
"const dictionary&,"
"CloudType& owner"
")"
) << "Incorrect number of entries in injector specification "
<< "- found " << injectorData[injectorI].size()
<< ", expected " << INPUT_FILE_COLS << ":" << nl
<< " x0 x1 x2 u0 u1 u2 d rho mDot T cp"
<< nl << exit(FatalError);
}
x_[injectorI].component(0) = injectorData[injectorI][0];
x_[injectorI].component(1) = injectorData[injectorI][1];
x_[injectorI].component(2) = injectorData[injectorI][2];
U_[injectorI].component(0) = injectorData[injectorI][3];
U_[injectorI].component(1) = injectorData[injectorI][4];
U_[injectorI].component(2) = injectorData[injectorI][5];
d_[injectorI] = injectorData[injectorI][6];
rho_[injectorI] = injectorData[injectorI][7];
mDot_[injectorI] = injectorData[injectorI][8];
T_[injectorI] = injectorData[injectorI][9];
cp_[injectorI] = injectorData[injectorI][10];
}
),
injectorCells_(0)
{
// Set/cache the injector cells
injectorCells_.setSize(injectorData.size());
forAll(x_, injectorI)
injectorCells_.setSize(injectors_.size());
forAll(injectors_, i)
{
this->findCellAtPosition(injectorCells_[injectorI], x_[injectorI]);
this->findCellAtPosition(injectorCells_[injectorI], injectors_[i].x());
}
// Determine volume of particles to inject
this->volumeTotal_ = 0.0;
forAll(mDot_, injectorI)
forAll(injectors_, i)
{
this->volumeTotal_ += mDot_[injectorI]/rho_[injectorI];
this->volumeTotal_ += injectors_[i].mDot()/injectors_[i].rho();
}
this->volumeTotal_ *= duration_;
}
@ -200,7 +148,7 @@ void Foam::ThermoLookupTableInjection<CloudType>::setPositionAndCell
{
label injectorI = parcelI*injectorCells_.size()/nParcels;
position = x_[injectorI];
position = injectors_[injectorI].x();
cellOwner = injectorCells_[injectorI];
}
@ -217,19 +165,19 @@ void Foam::ThermoLookupTableInjection<CloudType>::setProperties
label injectorI = parcelI*injectorCells_.size()/nParcels;
// set particle velocity
parcel.U() = U_[injectorI];
parcel.U() = injectors_[injectorI].U();
// set particle diameter
parcel.d() = d_[injectorI];
parcel.d() = injectors_[injectorI].d();
// set particle density
parcel.rho() = rho_[injectorI];
parcel.rho() = injectors_[injectorI].rho();
// set particle temperature
parcel.T() = T_[injectorI];
parcel.T() = injectors_[injectorI].T();
// set particle specific heat capacity
parcel.cp() = cp_[injectorI];
parcel.cp() = injectors_[injectorI].cp();
}

View File

@ -30,7 +30,10 @@ Description
an injection site.
(
(x y z u v w d rho mDot T cp)
(x y z) (u v w) d rho mDot T cp // injector 1
(x y z) (u v w) d rho mDot T cp // injector 2
...
(x y z) (u v w) d rho mDot T cp // injector N
);
where:
@ -51,7 +54,7 @@ SourceFiles
#define ThermoLookupTableInjection_H
#include "InjectionModel.H"
#include "pdf.H"
#include "kinematicParcelInjectionDataIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -78,33 +81,12 @@ class ThermoLookupTableInjection
//- Number of parcels per injector - common to all injection sources
const label nParcelsPerSecond_;
//- List of parcel position per injector / [m]
List<point> x_;
//- List of parcel velocity per injector / [m]
List<vector> U_;
//- List of parcel diameter per injector / [m]
List<scalar> d_;
//- List of parcel fluid density pre injector / [kg/m3]
List<scalar> rho_;
//- List of parcel injection mass flow per injector / [kg/s]
List<scalar> mDot_;
//- List of parcel temperature flow per injector / [K]
List<scalar> T_;
//- List of parcel specific heat capacity per injector / [J/kg/K]
List<scalar> cp_;
//- List of injectors
kinematicParcelInjectionDataIOList injectors_;
//- List of injector cells per injector
List<label> injectorCells_;
//- Number of columns expected in input file
static label INPUT_FILE_COLS;
protected:

View File

@ -0,0 +1,62 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "thermoParcelInjectionData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(thermoParcelInjectionData, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::thermoParcelInjectionData::thermoParcelInjectionData()
:
kinematicParcelInjectionData(),
T_(0.0),
cp_(0.0)
{}
Foam::thermoParcelInjectionData::thermoParcelInjectionData
(
const dictionary& dict
)
:
kinematicParcelInjectionData(dict),
T_(readScalar(dict.lookup("T"))),
cp_(readScalar(dict.lookup("cp")))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::thermoParcelInjectionData::~thermoParcelInjectionData()
{}
// ************************************************************************* //

View File

@ -0,0 +1,189 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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::thermoParcelInjectionData
Description
Container class to provide injection data for thermodynamic parcels
SourceFiles
thermoParcelInjectionData.C
\*---------------------------------------------------------------------------*/
#ifndef thermoParcelInjectionData_H
#define thermoParcelInjectionData_H
#include "kinematicParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class thermoParcelInjectionData;
// Forward declaration of friend functions
Ostream& operator<<
(
Ostream&,
const thermoParcelInjectionData&
);
Istream& operator>>
(
Istream&,
thermoParcelInjectionData&
);
/*---------------------------------------------------------------------------*\
Class thermoParcelInjectionData Declaration
\*---------------------------------------------------------------------------*/
class thermoParcelInjectionData
:
public kinematicParcelInjectionData
{
protected:
// Parcel properties
//- Temperature [K]
scalar T_;
//- Specific heat capacity [J/kg/K]
scalar cp_;
public:
//- Runtime type information
TypeName("thermoParcelInjectionData");
// Constructors
//- Null constructor
thermoParcelInjectionData();
//- Construct from dictionary
thermoParcelInjectionData(const dictionary& dict);
//- Construct from Istream
thermoParcelInjectionData(Istream& is);
//-Destructor
virtual ~thermoParcelInjectionData();
// Access
//- Return const access to the temperature
inline scalar T() const;
//- Return const access to the specific heat capacity
inline scalar cp() const;
// Edit
//- Return access to the temperature
inline scalar& T();
//- Return access to the specific heat capacity
inline scalar& cp();
// I-O
// Friend Operators
friend bool operator==
(
const thermoParcelInjectionData& a,
const thermoParcelInjectionData& b
)
{
notImplemented
(
"operator=="
"("
"const thermoParcelInjectionData&, "
"const thermoParcelInjectionData&"
")"
);
return false;
}
friend bool operator!=
(
const thermoParcelInjectionData& a,
const thermoParcelInjectionData& b
)
{
notImplemented
(
"operator=="
"("
"const thermoParcelInjectionData&, "
"const thermoParcelInjectionData&"
")"
);
return false;
}
//- Ostream operator
friend Ostream& operator<<
(
Ostream& os,
const thermoParcelInjectionData& data
);
//- Istream operator
friend Istream& operator>>
(
Istream& is,
thermoParcelInjectionData& data
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "thermoParcelInjectionDataI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,55 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "thermoParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline Foam::scalar Foam::thermoParcelInjectionData::T() const
{
return T_;
}
inline Foam::scalar Foam::thermoParcelInjectionData::cp() const
{
return cp_;
}
inline Foam::scalar& Foam::thermoParcelInjectionData::T()
{
return T_;
}
inline Foam::scalar& Foam::thermoParcelInjectionData::cp()
{
return cp_;
}
// ************************************************************************* //

View File

@ -0,0 +1,77 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "thermoParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::thermoParcelInjectionData::thermoParcelInjectionData(Istream& is)
:
kinematicParcelInjectionData(is)
{
is.check("reading T");
is >> T_;
is.check("reading cp");
is >> cp_;
is.check("thermoParcelInjectionData(Istream& is)");
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const thermoParcelInjectionData& data
)
{
os << static_cast<const kinematicParcelInjectionData&>(data);
os << data.T_ << data.cp_;
return os;
}
Foam::Istream& Foam::operator>>(Istream& is, thermoParcelInjectionData& data)
{
is >> static_cast<kinematicParcelInjectionData&>(data);
is.check("reading T");
is >> data.T_;
is.check("reading cp");
is >> data.cp_;
is.check("operator(Istream&, thermoParcelInjectionData&)");
return is;
}
// ************************************************************************* //

View File

@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "thermoParcelInjectionDataIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebug(IOList<thermoParcelInjectionData>, 0);
}
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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
Description
SourceFiles
thermoParcelInjectionDataIOList.C
\*---------------------------------------------------------------------------*/
#ifndef thermoParcelInjectionDataIOList_H
#define thermoParcelInjectionDataIOList_H
#include "IOList.H"
#include "thermoParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOList<thermoParcelInjectionData>
thermoParcelInjectionDataIOList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -51,13 +51,12 @@ class cellSet
:
public topoSet
{
// Private Member Functions
//- Disallow default bitwise copy construct
cellSet(const cellSet&);
public:
//- Runtime type information
@ -66,7 +65,6 @@ public:
// Constructors
//- Construct from IOobject. No checking.
cellSet(const IOobject& obj);
@ -161,7 +159,6 @@ public:
const primitiveMesh&,
const label maxLen
) const;
};

View File

@ -309,8 +309,8 @@ List<specieElement> currentSpecieComposition(5);
scalar currentLowT = 0;
scalar currentHighT = 0;
scalar currentCommonT = 0;
gasThermoPhysics::coeffArray highCpCoeffs;
gasThermoPhysics::coeffArray lowCpCoeffs;
gasThermoPhysics::coeffArray highCpCoeffs = {0, 0, 0, 0, 0, 0, 0};
gasThermoPhysics::coeffArray lowCpCoeffs = {0, 0, 0, 0, 0, 0, 0};
gasReaction::specieCoeffs currentSpecieCoeff;

View File

@ -26,7 +26,8 @@ Class
Foam::basicMultiComponentMixture
Description
combustion mixture
Multi-component mixture. Provides a list of mass fraction fields and helper
functions to query mixture composition.
SourceFiles
basicMultiComponentMixture.C

View File

@ -23,6 +23,7 @@ $(mutWallFunctions)/mutkWallFunction/mutkWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutUWallFunction/mutUWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.C
epsilonWallFunctions = $(wallFunctions)/epsilonWallFunctions
$(epsilonWallFunctions)/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C

View File

@ -0,0 +1,118 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "mutLowReWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<scalarField> mutLowReWallFunctionFvPatchScalarField::calcMut() const
{
return tmp<scalarField>(new scalarField(patch().size(), 0.0));
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
mutLowReWallFunctionFvPatchScalarField::mutLowReWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
mutkWallFunctionFvPatchScalarField(p, iF)
{}
mutLowReWallFunctionFvPatchScalarField::mutLowReWallFunctionFvPatchScalarField
(
const mutLowReWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
mutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
{}
mutLowReWallFunctionFvPatchScalarField::mutLowReWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
mutkWallFunctionFvPatchScalarField(p, iF, dict)
{}
mutLowReWallFunctionFvPatchScalarField::mutLowReWallFunctionFvPatchScalarField
(
const mutLowReWallFunctionFvPatchScalarField& mlrwfpsf
)
:
mutkWallFunctionFvPatchScalarField(mlrwfpsf)
{}
mutLowReWallFunctionFvPatchScalarField::mutLowReWallFunctionFvPatchScalarField
(
const mutLowReWallFunctionFvPatchScalarField& mlrwfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
mutkWallFunctionFvPatchScalarField(mlrwfpsf, iF)
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
mutLowReWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,149 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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::compressible::RASModels::mutLowReWallFunctionFvPatchScalarField
Description
Boundary condition for turbulent (kinematic) viscosity when for use with
low Reynolds number models.
Sets mut to zero, and provides an access to calculate y+.
SourceFiles
mutLowReWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef compressibleMutLowReWallFunctionFvPatchScalarField_H
#define compressibleMutLowReWallFunctionFvPatchScalarField_H
#include "mutkWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class mutLowReWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class mutLowReWallFunctionFvPatchScalarField
:
public mutkWallFunctionFvPatchScalarField
{
protected:
// Private member functions
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcMut() const;
public:
//- Runtime type information
TypeName("mutLowReWallFunction");
// Constructors
//- Construct from patch and internal field
mutLowReWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
mutLowReWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// mutLowReWallFunctionFvPatchScalarField
// onto a new patch
mutLowReWallFunctionFvPatchScalarField
(
const mutLowReWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
mutLowReWallFunctionFvPatchScalarField
(
const mutLowReWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new mutLowReWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
mutLowReWallFunctionFvPatchScalarField
(
const mutLowReWallFunctionFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new mutLowReWallFunctionFvPatchScalarField(*this, iF)
);
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef compressibleMutWallFunctionFvPatchScalarField_H
#define compressibleMutWallFunctionFvPatchScalarField_H
#ifndef compressibleMutkWallFunctionFvPatchScalarField_H
#define compressibleMutkWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"

View File

@ -27,6 +27,7 @@ $(nutWallFunctions)/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarFiel
$(nutWallFunctions)/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutUWallFunction/nutUWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.C
epsilonWallFunctions = $(wallFunctions)/epsilonWallFunctions
$(epsilonWallFunctions)/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C

View File

@ -0,0 +1,114 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "nutLowReWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace RASModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<scalarField> nutLowReWallFunctionFvPatchScalarField::calcNut() const
{
return tmp<scalarField>(new scalarField(patch().size(), 0.0));
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
nutkWallFunctionFvPatchScalarField(p, iF)
{}
nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
(
const nutLowReWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
nutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
{}
nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
nutkWallFunctionFvPatchScalarField(p, iF, dict)
{}
nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
(
const nutLowReWallFunctionFvPatchScalarField& nlrwfpsf
)
:
nutkWallFunctionFvPatchScalarField(nlrwfpsf)
{}
nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
(
const nutLowReWallFunctionFvPatchScalarField& nlrwfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
nutkWallFunctionFvPatchScalarField(nlrwfpsf, iF)
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, nutLowReWallFunctionFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace incompressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,149 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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::incompressible::RASModels::nutLowReWallFunctionFvPatchScalarField
Description
Boundary condition for turbulent (kinematic) viscosity when for use with
low Reynolds number models.
Sets nut to zero, and provides an access function to calculate y+.
SourceFiles
nutLowReWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef nutLowReWallFunctionFvPatchScalarField_H
#define nutLowReWallFunctionFvPatchScalarField_H
#include "nutkWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class nutLowReWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class nutLowReWallFunctionFvPatchScalarField
:
public nutkWallFunctionFvPatchScalarField
{
protected:
// Protected member functions
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcNut() const;
public:
//- Runtime type information
TypeName("nutLowReWallFunction");
// Constructors
//- Construct from patch and internal field
nutLowReWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
nutLowReWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// nutLowReWallFunctionFvPatchScalarField
// onto a new patch
nutLowReWallFunctionFvPatchScalarField
(
const nutLowReWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
nutLowReWallFunctionFvPatchScalarField
(
const nutLowReWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new nutLowReWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
nutLowReWallFunctionFvPatchScalarField
(
const nutLowReWallFunctionFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new nutLowReWallFunctionFvPatchScalarField(*this, iF)
);
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace incompressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //