updating injection mechanism + added coneInjection model

This commit is contained in:
andy 2008-05-15 12:44:17 +01:00
parent 238b126c6c
commit 38ada7f58e
22 changed files with 1415 additions and 32 deletions

View File

@ -48,4 +48,8 @@ submodels/addOns/radiation/scatter/cloudScatter/cloudScatter.C
IntegrationScheme/makeIntegrationSchemes.C
/* Data entries */
submodels/IO/DataEntry/makeDataEntries.C
LIB = $(FOAM_LIBBIN)/liblagrangianIntermediate

View File

@ -437,7 +437,13 @@ void Foam::KinematicCloud<ParcelType>::inject
);
// Velocity of parcels
vector pU = this->injection().velocity(iParcel, timeInj);
vector pU = this->injection().velocity
(
iParcel,
timeInj,
this->meshInfo(),
rndGen_
);
// Determine the injection cell
label pCell = -1;
@ -496,8 +502,9 @@ void Foam::KinematicCloud<ParcelType>::postInjectCheck()
{
if (nParcelsAdded_)
{
Pout<< "\n--> Cloud: " << this->name() << nl <<
" Added " << nParcelsAdded_ << " new parcels" << nl << endl;
Pout<< "\n--> Cloud: " << this->name() << nl
<< " Added " << nParcelsAdded_
<< " new parcels" << nl << endl;
}
// Reset parcel counters

View File

@ -277,7 +277,12 @@ void Foam::ReactingCloud<ParcelType>::inject
);
// Velocity of parcels
vector pU = this->injection().velocity(iParcel, timeInj);
vector pU = this->injection().velocity
(
iParcel,
timeInj,
this->meshInfo()
);
// Determine the injection cell
label pCell = -1;

View File

@ -26,8 +26,9 @@ License
#include "basicKinematicParcel.H"
#include "KinematicCloud.H"
#include "ManualInjection.H"
#include "NoInjection.H"
#include "ManualInjection.H"
#include "ConeInjection.H"
namespace Foam
{
@ -35,6 +36,12 @@ namespace Foam
// Add instances of injection model to the table
makeInjectionModelType
(
NoInjection,
KinematicCloud,
basicKinematicParcel
);
makeInjectionModelType
(
ManualInjection,
KinematicCloud,
@ -42,7 +49,7 @@ namespace Foam
);
makeInjectionModelType
(
NoInjection,
ConeInjection,
KinematicCloud,
basicKinematicParcel
);

View File

@ -0,0 +1,90 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 "Constant.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::Constant<Type>::Constant
(
const word& entryName,
const dictionary& dict
)
:
DataEntry<Type>(typeName, entryName, dict),
value_(this->dict_.lookup("value"))
{}
template<>
Foam::Constant<Foam::label>::Constant
(
const word& entryName,
const dictionary& dict
)
:
DataEntry<label>(typeName, entryName, dict),
value_(readLabel(this->dict_.lookup("value")))
{}
template<>
Foam::Constant<Foam::scalar>::Constant
(
const word& entryName,
const dictionary& dict
)
:
DataEntry<scalar>(typeName, entryName, dict),
value_(readScalar(this->dict_.lookup("value")))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::Constant<Type>::~Constant()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Type Foam::Constant<Type>::value(const scalar x) const
{
return value_;
}
template<class Type>
Type Foam::Constant<Type>::integrate(const scalar x1, const scalar x2) const
{
return (x2 - x1)*value_;
}
// ************************************************************************* //

View File

@ -0,0 +1,129 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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::Constant
Description
Templated basic entry that holds a constant value.
@verbatim
entry Constant
entryCoeffs
{
value 100.0; // Constant value
}
@endverbatim
SourceFiles
Constant.C
\*---------------------------------------------------------------------------*/
#ifndef Constant_H
#define Constant_H
#include "DataEntry.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class Constant Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class Constant
:
public DataEntry<Type>
{
// Private data
Type value_;
// Private Member Functions
//- Disallow default bitwise copy construct
Constant(const Constant<Type>&);
//- Disallow default bitwise assignment
void operator=(const Constant<Type>&);
public:
// Runtime type information
TypeName("Constant");
// Constructors
//- Construct from dictionary
Constant
(
const word& entryName,
const dictionary& dict
);
//- Destructor
~Constant();
// Member Functions
//- Return constant value
Type value(const scalar) const;
//- Integrate between two values
Type integrate(const scalar x1, const scalar x2) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<>
Constant<label>::Constant(const word& entryName, const dictionary& dict);
template<>
Constant<scalar>::Constant(const word& entryName, const dictionary& dict);
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "Constant.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,60 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 "DataEntry.H"
// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::DataEntry<Type>::DataEntry
(
const word& typeName,
const word& entryName,
const dictionary& dict
)
:
dict_(dict.subDict(entryName + "Coeffs")),
entry_(entryName)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::DataEntry<Type>::~DataEntry()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
const Foam::dictionary& Foam::DataEntry<Type>::dict() const
{
return dict_;
}
// ************************************************************************* //

View File

@ -0,0 +1,167 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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::DataEntry
Description
SourceFiles
DataEntry.C
NewDataEntry.C
\*---------------------------------------------------------------------------*/
#ifndef DataEntry_H
#define DataEntry_H
#include "dictionary.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class DataEntry Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class DataEntry
{
// Private Member Functions
//- Disallow default bitwise copy construct
DataEntry(const DataEntry<Type>&);
//- Disallow default bitwise assignment
void operator=(const DataEntry<Type>&);
protected:
// Protected data
//- Coefficients dictionary
const dictionary dict_;
//- Name of entry
const word entry_;
public:
//- Runtime type information
TypeName("DataEntry")
//- Declare runtime constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
DataEntry,
dictionary,
(
const word& entryName,
const dictionary& dict
),
(entryName, dict)
);
// Constructor
//- Construct from type name and dictionary
DataEntry
(
const word& TypeName,
const word& entryName,
const dictionary& dict
);
//- Selector
static autoPtr<DataEntry<Type> > New
(
const word& entryName,
const dictionary& dict
);
//- Destructor
virtual ~DataEntry();
// Member Functions
// Access
//- Return the dictionary
const dictionary& dict() const;
//- Return value as a function of (scalar) independent variable
virtual Type value(const scalar x) const = 0;
//- Integrate between two (scalar) values
virtual Type integrate(const scalar x1, const scalar x2) const = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeDataEntry(Type) \
\
defineNamedTemplateTypeNameAndDebug(DataEntry<Type>, 0); \
\
defineTemplateRunTimeSelectionTable \
( \
DataEntry<Type>, \
dictionary \
);
#define makeDataEntryType(SS, Type) \
\
defineNamedTemplateTypeNameAndDebug(SS<Type>, 0); \
\
DataEntry<Type>::adddictionaryConstructorToTable<SS<Type> > \
add##SS##Type##ConstructorToTable_;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "DataEntry.C"
# include "NewDataEntry.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,62 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 "DataEntry.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
Foam::autoPtr<Foam::DataEntry<Type> > Foam::DataEntry<Type>::New
(
const word& entryName,
const dictionary& dict
)
{
word DataEntryType(dict.lookup(entryName));
// Info<< "Selecting DataEntry " << DataEntryType << endl;
typename dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(DataEntryType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"DataEntry<Type>::New(const dictionary&"
) << "Unknown DataEntry type "
<< DataEntryType << " for " << entryName
<< ", constructor not in hash table" << nl << nl
<< " Valid DataEntry types are :" << nl
<< dictionaryConstructorTablePtr_->toc() << nl
<< exit(FatalError);
}
return autoPtr<DataEntry<Type> >(cstrIter()(entryName, dict));
}
// ************************************************************************* //

View File

@ -0,0 +1,151 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 "Table.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::Table<Type>::Table
(
const word& entryName,
const dictionary& dict
)
:
DataEntry<Type>(typeName, entryName, dict),
table_(this->dict_.lookup("table"))
{
if (!table_.size())
{
FatalErrorIn
(
"Foam::Table<Type>::Table"
"("
"const word& entryName,"
"const dictionary& dict"
")"
) << "Table is invalid (empty)" << nl
<< exit(FatalError);
}
Info<< table_;
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::Table<Type>::~Table()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Type Foam::Table<Type>::value(const scalar x) const
{
// Return zero if out of bounds
if ((x > table_[table_.size()-1].first()) || (x < table_[0].first()))
{
return pTraits<Type>::zero;
}
label i = 0;
while ((table_[i].first() < x) && (i < table_.size()))
{
i++;
}
if (i == 0)
{
return table_[0].second();
}
else if (i == table_.size() - 1)
{
return table_[i-1].second();
}
else
{
return
(x - table_[i-1].first())/(table_[i].first() - table_[i-1].first())
* (table_[i].second() - table_[i-1].second())
+ table_[i-1].second();
}
}
template<class Type>
Type Foam::Table<Type>::integrate(const scalar x1, const scalar x2) const
{
// Initialise return value
Type sum = pTraits<Type>::zero;
// Return zero if out of bounds
if ((x1 > table_[table_.size()-1].first()) || (x2 < table_[0].first()))
{
return sum;
}
// Find start index
label id1 = 0;
while ((table_[id1].first() < x1) && (id1 < table_.size()))
{
id1++;
}
// Find end index
label id2 = table_.size() - 1;
while ((table_[id2].first() > x2) && (id2 >= 1))
{
id2--;
}
// 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
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

@ -0,0 +1,130 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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::Table
Description
Templated table container data entry. Items are stored in a list of
Tuple2's. First column is always stored as scalar entries. Data is read
in the form, e.g. for (scalar, vector):
@verbatim
entry Table
entryCoeffs
{
table
(
0.0 (1 2 3)
1.0 (4 5 6)
)
}
@endverbatim
SourceFiles
Table.C
\*---------------------------------------------------------------------------*/
#ifndef Table_H
#define Table_H
#include "DataEntry.H"
#include "Tuple2.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class Table Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class Table
:
public DataEntry<Type>
{
// Private data
//- Table data
List<Tuple2<scalar, Type> > table_;
// Private Member Functions
//- Disallow default bitwise copy construct
Table(const Table<Type>&);
//- Disallow default bitwise assignment
void operator=(const Table<Type>&);
public:
// Runtime type information
TypeName("Table");
// Constructors
//- Construct from dictionary
Table
(
const word& entryName,
const dictionary& dict
);
//- Destructor
~Table();
// Member Functions
//- Return Table value
Type value(const scalar x) const;
//- Integrate between two (scalar) values
Type integrate(const scalar x1, const scalar x2) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "Table.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 "DataEntry.H"
#include "Constant.H"
#include "Table.H"
#include "label.H"
#include "scalar.H"
#include "vector.H"
namespace Foam
{
makeDataEntry(label);
makeDataEntryType(Constant, label);
makeDataEntryType(Table, label);
makeDataEntry(scalar);
makeDataEntryType(Constant, scalar);
makeDataEntryType(Table, scalar);
makeDataEntry(vector);
makeDataEntryType(Constant, vector);
makeDataEntryType(Table, vector);
};
// ************************************************************************* //

View File

@ -0,0 +1,270 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 "ConeInjection.H"
#include "DataEntry.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::ConeInjection<CloudType>::ConeInjection
(
const dictionary& dict,
CloudType& owner
)
:
InjectionModel<CloudType>(dict, owner),
coeffDict_(dict.subDict(typeName + "Coeffs")),
SOI_(readScalar(coeffDict_.lookup("SOI"))),
duration_(readScalar(coeffDict_.lookup("duration"))),
position_(coeffDict_.lookup("position")),
direction_(coeffDict_.lookup("direction")),
parcelsPerSecond_(readScalar(coeffDict_.lookup("parcelsPerSecond"))),
volumeFlowRate_
(
DataEntry<scalar>::New
(
"volumeFlowRate",
coeffDict_
)
),
Umag_
(
DataEntry<scalar>::New
(
"Umag",
coeffDict_
)
),
thetaInner_
(
DataEntry<scalar>::New
(
"thetaInner",
coeffDict_
)
),
thetaOuter_
(
DataEntry<scalar>::New
(
"thetaOuter",
coeffDict_
)
),
parcelPDF_
(
pdf::New
(
coeffDict_.subDict("parcelPDF"),
owner.rndGen()
)
),
tanVec1_(vector::zero),
tanVec2_(vector::zero)
// nParticlesPerParcel_(0.0)
{
// Normalise direction vector
direction_ /= mag(direction_);
// Determine direction vectors tangential to direction
vector tangent = vector::zero;
scalar magTangent = 0.0;
Random rnd(label(0));
while (magTangent < SMALL)
{
vector v = rnd.vector01();
tangent = v - (v & direction_)*direction_;
magTangent = mag(tangent);
}
tanVec1_ = tangent/magTangent;
tanVec2_ = direction_^tanVec1_;
Info<< "tanVec1_ = " << tanVec1_ << endl;
Info<< "tanVec2_ = " << tanVec2_ << endl;
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::ConeInjection<CloudType>::~ConeInjection()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::ConeInjection<CloudType>::active() const
{
return true;
}
template<class CloudType>
Foam::scalar Foam::ConeInjection<CloudType>::timeStart() const
{
return SOI_;
}
template<class CloudType>
Foam::scalar Foam::ConeInjection<CloudType>::timeEnd() const
{
return SOI_ + duration_;
}
template<class CloudType>
Foam::vector Foam::ConeInjection<CloudType>::position
(
const label,
const scalar,
const polyMeshInfo& meshInfo,
Random&
) const
{
vector pos = position_;
if (meshInfo.caseIs2d())
{
if (meshInfo.caseIs2dWedge())
{
pos.component(meshInfo.emptyComponent()) = 0.0;
}
else if (meshInfo.caseIs2dSlab())
{
pos.component(meshInfo.emptyComponent()) =
meshInfo.centrePoint().component(meshInfo.emptyComponent());
}
else
{
FatalErrorIn
(
"Foam::vector Foam::ConeInjection<CloudType>::position"
) << "Could not determine 2-D case geometry" << nl
<< abort(FatalError);
}
}
return pos;
}
template<class CloudType>
Foam::label Foam::ConeInjection<CloudType>::nParcelsToInject
(
const label,
const scalar time0,
const scalar time1
) const
{
scalar t0 = time0 - SOI_;
scalar t1 = time1 - SOI_;
return round((t1 - t0)*parcelsPerSecond_);
}
template<class CloudType>
Foam::scalar Foam::ConeInjection<CloudType>::volume
(
const scalar time0,
const scalar time1,
const polyMeshInfo&
) const
{
scalar t0 = time0 - SOI_;
scalar t1 = time1 - SOI_;
return volumeFlowRate_().integrate(t0, t1);
}
template<class CloudType>
Foam::scalar Foam::ConeInjection<CloudType>::volumeFraction
(
const scalar time0,
const scalar time1
) const
{
scalar t0 = time0 - SOI_;
scalar t1 = time1 - SOI_;
return
volumeFlowRate_().integrate(t0, t1)
/volumeFlowRate_().integrate(SOI_, SOI_ + duration_);
}
template<class CloudType>
Foam::scalar Foam::ConeInjection<CloudType>::d0
(
const label,
const scalar
) const
{
return parcelPDF_().sample();
}
template<class CloudType>
Foam::vector Foam::ConeInjection<CloudType>::velocity
(
const label,
const scalar time,
const polyMeshInfo& meshInfo,
Random& rndGen
) const
{
const scalar deg2Rad = mathematicalConstant::pi/180.0;
scalar t = time - SOI_;
scalar ti = thetaInner_().value(t);
scalar to = thetaOuter_().value(t);
scalar coneAngle = deg2Rad*(rndGen.scalar01()*(to - ti) + ti);
scalar alpha = sin(coneAngle);
scalar dcorr = cos(coneAngle);
scalar beta = 2.0*mathematicalConstant::pi*rndGen.scalar01();
vector normal = alpha*(tanVec1_*cos(beta) + tanVec2_*sin(beta));
vector dirVec = dcorr*direction_;
dirVec += normal;
if (meshInfo.caseIs2dSlab())
{
dirVec.component(meshInfo.emptyComponent()) = 0.0;
}
dirVec /= mag(dirVec);
return Umag_().value(t)*dirVec;
}
// ************************************************************************* //

View File

@ -0,0 +1,205 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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::ConeInjection
Description
Cone injection
- User specifies
- time of start of injection
- total mass to inject
- injector position
- parcel velocity
- inner and outer cone angles
- Parcel diameters obtained by PDF model
SourceFiles
ConeInjection.C
********************************************************************
TODO: Need to include 'lost' parcels - i.e. if nParcels = 0 due to
rounding error, but volume to introduce is > 0
********************************************************************
\*---------------------------------------------------------------------------*/
#ifndef ConeInjection_H
#define ConeInjection_H
#include "InjectionModel.H"
#include "pdf.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
template<class Type>
class DataEntry;
/*---------------------------------------------------------------------------*\
Class ConeInjection Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class ConeInjection
:
public InjectionModel<CloudType>
{
// Private data
//- Coefficients dictionary
dictionary coeffDict_;
//- Start of injection [s]
const scalar SOI_;
//- Injection duration [s]
const scalar duration_;
//- Injector position [m]
const vector position_;
//- Injector direction []
vector direction_;
//- Number of parcels to introduce per second []
const label parcelsPerSecond_;
//- Volume flow rate of parcels to introduce relative to SOI [m^3]
const autoPtr<DataEntry<scalar> > volumeFlowRate_;
//- Parcel velocity magnitude relative to SOI [m/s]
const autoPtr<DataEntry<scalar> > Umag_;
//- Inner cone angle relative to SOI [deg]
const autoPtr<DataEntry<scalar> > thetaInner_;
//- Outer cone angle relative to SOI [deg]
const autoPtr<DataEntry<scalar> > thetaOuter_;
//- Parcel size PDF to SOI model
const autoPtr<pdf> parcelPDF_;
//- Number of particles represented by each parcel
// scalar nParticlesPerParcel_;
// Tangential vectors to the direction vector
//- First tangential vector
vector tanVec1_;
//- Second tangential vector
vector tanVec2_;
public:
//- Runtime type information
TypeName("ConeInjection");
// Constructors
//- Construct from dictionary
ConeInjection
(
const dictionary& dict,
CloudType& owner
);
// Destructor
~ConeInjection();
// Member Functions
bool active() const;
scalar timeStart() const;
scalar timeEnd() const;
vector position
(
const label iParcel,
const scalar time,
const polyMeshInfo& meshInfo,
Random&
) const;
label nParcelsToInject
(
const label,
const scalar time0,
const scalar time1
) const;
scalar volume
(
const scalar,
const scalar,
const polyMeshInfo&
) const;
scalar volumeFraction
(
const scalar time0,
const scalar time1
) const;
scalar d0
(
const label,
const scalar
) const;
vector velocity
(
const label,
const scalar time,
const polyMeshInfo& meshInfo,
Random& rndGen
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "ConeInjection.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -35,8 +35,7 @@ Foam::InjectionModel<CloudType>::InjectionModel
CloudType& owner
)
: dict_(dict),
owner_(owner),
rndGen_(label(0))
owner_(owner)
{}
@ -63,13 +62,6 @@ const Foam::dictionary& Foam::InjectionModel<CloudType>::dict() const
}
template<class CloudType>
Foam::Random& Foam::InjectionModel<CloudType>::rndGen()
{
return rndGen_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "NewInjectionModel.C"

View File

@ -63,9 +63,6 @@ class InjectionModel
// Reference to the owner cloud class
CloudType& owner_;
//- Random number generator
Random rndGen_;
public:
@ -118,9 +115,6 @@ public:
//- Return the dictionary
const dictionary& dict() const;
//- Return reference to random number
inline Random& rndGen();
// Member Functions
@ -176,7 +170,9 @@ public:
virtual vector velocity
(
const label iParcel,
const scalar time
const scalar time,
const polyMeshInfo& meshInfo,
Random& rndGen
) const = 0;
};

View File

@ -129,8 +129,10 @@ Foam::vector Foam::ManualInjection<CloudType>::position
}
else
{
FatalErrorIn("Foam::vector Foam::ManualInjection<CloudType>::position")
<< "Could not determine 2-D case geometry" << nl
FatalErrorIn
(
"Foam::vector Foam::ManualInjection<CloudType>::position"
) << "Could not determine 2-D case geometry" << nl
<< abort(FatalError);
}
}
@ -205,10 +207,19 @@ template<class CloudType>
Foam::vector Foam::ManualInjection<CloudType>::velocity
(
const label,
const scalar
const scalar,
const polyMeshInfo& meshInfo,
Random&
) const
{
return U0_;
vector vel = U0_;
if (meshInfo.caseIs2dSlab())
{
vel.component(meshInfo.emptyComponent()) =
meshInfo.centrePoint().component(meshInfo.emptyComponent());
}
return vel;
}

View File

@ -159,7 +159,9 @@ public:
vector velocity
(
const label,
const scalar
const scalar,
const polyMeshInfo& meshInfo,
Random&
) const;
};

View File

@ -135,7 +135,9 @@ template<class CloudType>
Foam::vector Foam::NoInjection<CloudType>::velocity
(
const label,
const scalar
const scalar,
const polyMeshInfo&,
Random&
) const
{
return vector::zero;

View File

@ -119,7 +119,9 @@ public:
vector velocity
(
const label,
const scalar
const scalar,
const polyMeshInfo&,
Random&
) const;
};

View File

@ -23,7 +23,7 @@ FoamFile
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Particle sub-models
InjectionModel ManualInjection;
InjectionModel ConeInjection;
DragModel SphereDrag;
DispersionModel StochasticDispersionRAS;
WallInteractionModel StandardWallInteraction;
@ -76,6 +76,46 @@ ManualInjectionCoeffs
}
}
ConeInjectionCoeffs
{
SOI 0.001;
duration 0.005;
position (0.025 0.25 0.05);
direction (0 -1 0);
parcelsPerSecond 1000000;
volumeFlowRate Constant;
volumeFlowRateCoeffs
{
value 0.01;
}
Umag Constant;
UmagCoeffs
{
value 50.0;
}
thetaInner Constant;
thetaInnerCoeffs
{
value 0.0;
}
thetaOuter Constant;
thetaOuterCoeffs
{
value 30.0;
}
parcelPDF
{
pdfType RosinRammler;
RosinRammlerPDF
{
minValue 50.0e-06;
maxValue 100.0e-06;
d (75.0e-06);
n (0.5);
}
}
}
StandardWallInteractionCoeffs
{
e e [ 0 0 0 0 0] 1;

View File

@ -57,11 +57,11 @@ edges
patches
(
patch top
wall top
(
(13 15 14 12)
)
patch bottom
wall bottom
(
(0 1 5 4)
(1 8 10 5)