Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
mattijs
2010-06-30 12:37:14 +01:00
2290 changed files with 159054 additions and 5095 deletions

View File

@ -1,17 +1,20 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
unset COMP_FLAGS LINK_FLAGS
#
# use <sys/inotify.h> if available (Linux)
# unless otherwise specified (with FOAM_USE_STAT)
# unless otherwise specified (with USE_STAT)
#
# eg, ./Allwmake FOAM_USE_STAT
# eg, ./Allwmake USE_STAT
#
if [ -f /usr/include/sys/inotify.h -a "${1%USE_STAT}" = "$1" ]
then
unset FOAM_FILE_MONITOR
echo "Found <sys/inotify.h> -- using inotify for file monitoring."
unset COMP_FLAGS
else
export FOAM_FILE_MONITOR="-DFOAM_USE_STAT"
export COMP_FLAGS="-DFOAM_USE_STAT"
fi

View File

@ -1 +1 @@
EXE_INC = $(FOAM_FILE_MONITOR)
EXE_INC = $(COMP_FLAGS)

View File

@ -207,6 +207,10 @@ public:
//- Assignment from UList
inline void operator=(const UList<T>&);
//- Assignment from UIndirectList
inline void operator=(const UIndirectList<T>&);
// IOstream operators

View File

@ -406,29 +406,6 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
}
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
(
const UList<T>& lst
)
{
if (capacity_ >= lst.size())
{
// can copy w/o reallocating, match initial size to avoid reallocation
List<T>::size(lst.size());
List<T>::operator=(lst);
}
else
{
// make everything available for the copy operation
List<T>::size(capacity_);
List<T>::operator=(lst);
capacity_ = List<T>::size();
}
}
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
(
@ -461,4 +438,49 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
}
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
(
const UList<T>& lst
)
{
if (capacity_ >= lst.size())
{
// can copy w/o reallocating, match initial size to avoid reallocation
List<T>::size(lst.size());
List<T>::operator=(lst);
}
else
{
// make everything available for the copy operation
List<T>::size(capacity_);
List<T>::operator=(lst);
capacity_ = List<T>::size();
}
}
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
(
const UIndirectList<T>& lst
)
{
if (capacity_ >= lst.size())
{
// can copy w/o reallocating, match initial size to avoid reallocation
List<T>::size(lst.size());
List<T>::operator=(lst);
}
else
{
// make everything available for the copy operation
List<T>::size(capacity_);
List<T>::operator=(lst);
capacity_ = List<T>::size();
}
}
// ************************************************************************* //

View File

@ -91,8 +91,10 @@ public:
//- Return the last element of the list.
inline const T& last() const;
//- Return the complete list
inline const UList<T>& completeList() const;
//- Return the list addressing
inline const List<label>& addressing() const;

View File

@ -64,7 +64,7 @@ inline Stream& Foam::IOobject::writeBanner(Stream& os, bool noHint)
"| ========= | |\n"
"| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |\n"
"| \\\\ / O peration | Version: " << FOAMversion << spaces << "|\n"
"| \\\\ / A nd | Web: www.OpenFOAM.org |\n"
"| \\\\ / A nd | Web: www.OpenFOAM.com |\n"
"| \\\\/ M anipulation | |\n"
"\\*---------------------------------------------------------------------------*/\n";

View File

@ -65,6 +65,8 @@ public:
// Member Operators
inline scalar operator[](const label) const;
inline oneField field() const;
};

View File

@ -33,4 +33,10 @@ inline Foam::scalar Foam::oneField::operator[](const label) const
}
inline Foam::oneField Foam::oneField::field() const
{
return oneField();
}
// ************************************************************************* //

View File

@ -64,6 +64,8 @@ public:
// Member Operators
inline scalar operator[](const label) const;
inline zeroField field() const;
};

View File

@ -32,4 +32,11 @@ inline Foam::scalar Foam::zeroField::operator[](const label) const
return scalar(0);
}
inline Foam::zeroField Foam::zeroField::field() const
{
return zeroField();
}
// ************************************************************************* //

View File

@ -836,7 +836,7 @@ void Foam::argList::printUsage() const
Info<< nl
<<"Using OpenFOAM-" << Foam::FOAMversion
<<" (build: " << Foam::FOAMbuild << ") - see www.OpenFOAM.org"
<<" (build: " << Foam::FOAMbuild << ") - see www.OpenFOAM.com"
<< nl << endl;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,7 +23,6 @@ License
\*---------------------------------------------------------------------------*/
#include "IFstream.H"
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
@ -239,7 +238,9 @@ Foam::interpolationLookUpTable<Type>::interpolationLookUpTable()
template<class Type>
Foam::interpolationLookUpTable<Type>::interpolationLookUpTable
(
const fileName& fn, const word& instance, const fvMesh& mesh
const fileName& fn,
const word& instance,
const fvMesh& mesh
)
:
List<scalarField>(),
@ -357,11 +358,11 @@ void Foam::interpolationLookUpTable<Type>::write
control.writeHeader(os);
os.writeKeyword("fields");
os << entries_ << token::END_STATEMENT << nl;
os.writeKeyword("fields")
<< entries_ << token::END_STATEMENT << nl;
os.writeKeyword("output");
os << output_ << token::END_STATEMENT << nl;
os.writeKeyword("output")
<< output_ << token::END_STATEMENT << nl;
if (this->size() == 0)
{
@ -370,8 +371,8 @@ void Foam::interpolationLookUpTable<Type>::write
"Foam::interpolationTable<Type>::write()"
) << "table is empty" << nl << exit(FatalError);
}
os.writeKeyword("values");
os << *this << token::END_STATEMENT << nl;
os.writeKeyword("values")
<< *this << token::END_STATEMENT << nl;
}
@ -381,8 +382,7 @@ template<class Type>
Foam::scalarField&
Foam::interpolationLookUpTable<Type>::operator[](const label i)
{
label ii = i;
label n = this->size();
const label n = this->size();
if (n <= 1)
{
@ -391,22 +391,22 @@ Foam::interpolationLookUpTable<Type>::operator[](const label i)
"Foam::interpolationLookUpTable<Type>::operator[](const label)"
) << "table has (" << n << ") columns" << nl << exit(FatalError);
}
else if (ii < 0)
else if (i < 0)
{
FatalErrorIn
(
"Foam::interpolationLookUpTable<Type>::operator[](const label)"
) << "index (" << ii << ") underflow" << nl << exit(FatalError);
) << "index (" << i << ") underflow" << nl << exit(FatalError);
}
else if (ii > n)
else if (i >= n)
{
FatalErrorIn
(
"Foam::interpolationLookUpTable<Type>::operator[](const label)"
) << "index (" << ii << ") overflow" << nl << exit(FatalError);
) << "index (" << i << ") overflow" << nl << exit(FatalError);
}
return List<scalarField>::operator[](ii);
return List<scalarField>::operator[](i);
}
@ -414,8 +414,7 @@ template<class Type>
const Foam::scalarField&
Foam::interpolationLookUpTable<Type>::operator[](const label i) const
{
label ii = i;
label n = this->size();
const label n = this->size();
if (n <= 1)
{
@ -425,26 +424,25 @@ Foam::interpolationLookUpTable<Type>::operator[](const label i) const
"(const label) const"
) << "table has (" << n << ") columns" << nl << exit(FatalError);
}
else if (ii < 0)
else if (i < 0)
{
FatalErrorIn
(
"Foam::interpolationLookUpTable<Type>::operator[]"
"(const label) const"
) << "index (" << ii << ") underflow" << nl << exit(FatalError);
) << "index (" << i << ") underflow" << nl << exit(FatalError);
}
else if (ii > n)
else if (i >= n)
{
FatalErrorIn
(
"Foam::interpolationLookUpTable<Type>::operator[]"
"(const label) const"
) << "index (" << ii << ") overflow" << nl
) << "index (" << i << ") overflow" << nl
<< exit(FatalError);
}
return List<scalarField>::operator[](ii);
return List<scalarField>::operator[](i);
}

View File

@ -65,7 +65,7 @@ class interpolationLookUpTable
{
private:
// Privsate data
// Private data
//- File name
fileName fileName_;
@ -88,10 +88,10 @@ private:
//- Output dictionaries
List<dictionary> output_;
//- Input indices from the look up table
//- Input indices from the lookup table
List<label> entryIndices_;
//- Output Indeces from the Look Up Table
//- Output indices from the lookup Table
List<label> outputIndices_;
//- Field names and indices
@ -118,7 +118,7 @@ private:
//- Check range of lookup value
bool checkRange(const scalar, const label) const;
//- Interpolate function return an scalar
//- Interpolate function returning a scalar
scalar interpolate
(
const label lo,
@ -159,13 +159,13 @@ public:
// Member Functions
//- Return true if the filed exists in the table
//- Return true if the field exists in the table
bool found(const word& fieldName) const;
//- Return the output list given a single input scalar
const List<scalar>& lookUp(const scalar);
//- Write Look Up Table to filename.
//- Write lookup table to filename.
void write
(
Ostream&,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -65,8 +65,8 @@ Foam::uniformInterpolationTable<Type>::uniformInterpolationTable
dict.lookup("data") >> *this;
dict.lookup("x0") >> x0_;
dict.lookup("dx") >> dx_;
dict.lookup("log10") >> log10_;
dict.lookup("bound") >> bound_;
dict.readIfPresent("log10", log10_);
dict.readIfPresent("bound", bound_);
}
checkTable();
@ -94,13 +94,13 @@ Foam::uniformInterpolationTable<Type>::uniformInterpolationTable
List<scalar>(2, 0.0),
x0_(readScalar(dict.lookup("x0"))),
dx_(readScalar(dict.lookup("dx"))),
log10_(dict.lookup("log10")),
bound_(dict.lookup("bound"))
log10_(dict.lookupOrDefault<Switch>("log10", false)),
bound_(dict.lookupOrDefault<Switch>("bound", false))
{
if (initialiseOnly)
{
scalar xMax = readScalar(dict.lookup("xMax"));
label nIntervals = static_cast<label>(xMax - x0_)/dx_ + 1;
const scalar xMax = readScalar(dict.lookup("xMax"));
const label nIntervals = static_cast<label>(xMax - x0_)/dx_ + 1;
this->setSize(nIntervals);
}
else
@ -168,9 +168,9 @@ Type Foam::uniformInterpolationTable<Type>::interpolate(scalar x) const
}
}
label i = static_cast<label>((x - x0_)/dx_);
const label i = static_cast<label>((x - x0_)/dx_);
scalar xLo = x0_ + i*dx_;
const scalar xLo = x0_ + i*dx_;
Type fx = (x - xLo)/dx_*(operator[](i+1) - operator[](i)) + operator[](i);
@ -225,8 +225,14 @@ void Foam::uniformInterpolationTable<Type>::write() const
dict.add("data", static_cast<const List<scalar>&>(*this));
dict.add("x0", x0_);
dict.add("dx", dx_);
dict.add("log10", log10_);
dict.add("bound", bound_);
if (log10_)
{
dict.add("log10", log10_);
}
if (bound_)
{
dict.add("bound", bound_);
}
dict.regIOobject::write();
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -28,12 +28,13 @@ Description
Table with uniform interval in independant variable, with linear
interpolation
Example usage (scalar): values specified in a dictionary:
Example usage (scalar): values specified within a dictionary:
@verbatim
{
x0 0; // lower limit
dx 0.2; // fixed interval
log10 true; // take log(10) when interpolating?
x0 0; // lower limit
dx 0.2; // fixed interval
log10 true; // take log(10) when interpolating?
data // list of dependent data values
(
7870 // value at x0
@ -42,6 +43,7 @@ Description
7870 // value at x0 + n*dx
);
}
@endverbatim
SourceFiles
uniformInterpolationTable.C
@ -73,7 +75,7 @@ class uniformInterpolationTable
{
// Private data
// Control parameetrs
// Control parameters
//- Lower limit
scalar x0_;
@ -81,7 +83,7 @@ class uniformInterpolationTable
//- Fixed interval
scalar dx_;
//- Flag to indicate that x data is given in log10(x) form
//- Flag to indicate that x data are given in log10(x) form
Switch log10_;
//- Bound x values
@ -101,9 +103,9 @@ public:
// Constructors
//- Construct from IOobject and readFields flag. Creates a null object
// if readFields = false
uniformInterpolationTable(const IOobject& io, const bool readFields);
//- Construct from IOobject and readFields flag.
// Creates a null object if readFields = false
uniformInterpolationTable(const IOobject&, const bool readFields);
//- Construct from name, objectRegistry and dictionary.
// If initialiseOnly flag is set, control parameters are read from
@ -111,13 +113,13 @@ public:
uniformInterpolationTable
(
const word& tableName,
const objectRegistry& db,
const dictionary& dict,
const objectRegistry&,
const dictionary&,
const bool initialiseOnly = false
);
//- Construct as copy
uniformInterpolationTable(const uniformInterpolationTable& uit);
uniformInterpolationTable(const uniformInterpolationTable&);
//- Destructor
@ -174,22 +176,10 @@ public:
// Override ancestor size() function and [] operator
//- Return the size of the table
label size() const
{
return List<Type>::size();
}
using List<Type>::size;
//- Use List[] operator for read access
Type operator[](label x) const
{
return List<Type>::operator[](x);
}
//- Use List[] operator for write access
Type& operator[](label x)
{
return List<Type>::operator[](x);
}
//- Use List[] operator for read/write access
using List<Type>::operator[];
// I-O

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) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -38,6 +38,12 @@ const Scalar pTraits<Scalar>::max = ScalarVGREAT;
const char* pTraits<Scalar>::componentNames[] = { "x" };
pTraits<Scalar>::pTraits(const Scalar& p)
:
p_(p)
{}
pTraits<Scalar>::pTraits(Istream& is)
{
is >> p_;

View File

@ -65,6 +65,9 @@ public:
// Constructors
//- Construct from primitive
explicit pTraits(const Scalar&);
//- Construct from Istream
pTraits(Istream&);

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) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -28,11 +28,17 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const char* const Foam::pTraits<bool>::typeName = "bool";
const bool Foam::pTraits<bool>::zero(false);
const bool Foam::pTraits<bool>::one(true);
const bool Foam::pTraits<bool>::zero = false;
const bool Foam::pTraits<bool>::one = true;
const char* Foam::pTraits<bool>::componentNames[] = { "x" };
Foam::pTraits<bool>::pTraits(const bool& p)
:
p_(p)
{}
Foam::pTraits<bool>::pTraits(Istream& is)
{
is >> p_;

View File

@ -91,6 +91,9 @@ public:
// Constructors
//- Construct from primitive
explicit pTraits(const bool&);
//- Construct from Istream
pTraits(Istream&);

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) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -41,6 +41,12 @@ const label pTraits<label>::max = labelMax;
const char* pTraits<label>::componentNames[] = { "x" };
pTraits<label>::pTraits(const label& p)
:
p_(p)
{}
pTraits<label>::pTraits(Istream& is)
{
is >> p_;

View File

@ -165,6 +165,9 @@ public:
// Constructors
//- Construct from primitive
explicit pTraits(const label&);
//- Construct from Istream
pTraits(Istream&);

View File

@ -41,6 +41,12 @@ const uLabel pTraits<uLabel>::max = uLabelMax;
const char* pTraits<uLabel>::componentNames[] = { "x" };
pTraits<uLabel>::pTraits(const uLabel& p)
:
p_(p)
{}
pTraits<uLabel>::pTraits(Istream& is)
{
is >> p_;

View File

@ -149,6 +149,9 @@ public:
// Constructors
//- Construct from primitive
explicit pTraits(const uLabel&);
//- Construct from Istream
pTraits(Istream&);

View File

@ -55,11 +55,13 @@ public:
// Constructors
//- Construct from primitive
pTraits(const PrimitiveType& p)
:
PrimitiveType(p)
{}
//- Construct from Istream
pTraits(Istream& is)
:
PrimitiveType(is)
@ -68,11 +70,13 @@ public:
// Member operators
//- Access to the primitive
operator PrimitiveType() const
{
return *this;
}
//- Access to the primitive
operator PrimitiveType&()
{
return *this;

View File

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile

View File

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile

View File

@ -157,6 +157,8 @@ $(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C
$(derivedFvPatchFields)/waveTransmissive/waveTransmissiveFvPatchFields.C
$(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C
$(derivedFvPatchFields)/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C
fvsPatchFields = fields/fvsPatchFields
$(fvsPatchFields)/fvsPatchField/fvsPatchFields.C
@ -354,4 +356,13 @@ fieldSources = $(general)/fieldSources
$(fieldSources)/pressureGradientExplicitSource/pressureGradientExplicitSource.C
$(fieldSources)/timeActivatedExplicitSource/timeActivatedExplicitSource.C
basicSource = $(general)/fieldSources/basicSource
$(basicSource)/basicSource/basicSource.C
$(basicSource)/basicSource/basicSourceIO.C
$(basicSource)/basicSource/basicSourceList.C
$(basicSource)/basicSource/IObasicSourceList.C
$(basicSource)/actuationDiskSource/actuationDiskSource.C
$(basicSource)/explicitSource/explicitSource.C
LIB = $(FOAM_LIBBIN)/libfiniteVolume

View File

@ -0,0 +1,193 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 3 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*----------------------------------------------------------------------------*/
#include "actuationDiskSource.H"
#include "fvMesh.H"
#include "fvMatrices.H"
#include "geometricOneField.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(actuationDiskSource, 0);
addToRunTimeSelectionTable(basicSource, actuationDiskSource, dictionary);
}
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::actuationDiskSource::checkData()
{
if (magSqr(diskArea_) <= VSMALL)
{
FatalErrorIn("Foam::actuationDiskSource::checkData()")
<< "diskArea is approximately zero"
<< exit(FatalIOError);
}
if (Cp_ <= VSMALL || Ct_ <= VSMALL)
{
FatalErrorIn("Foam::actuationDiskSource::checkData()")
<< "Cp and Ct must be greater than zero"
<< exit(FatalIOError);
}
if (mag(diskDir_) < VSMALL)
{
FatalErrorIn("Foam::actuationDiskSource::checkData()")
<< "disk direction vector is approximately zero"
<< exit(FatalIOError);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::actuationDiskSource::actuationDiskSource
(
const word& name,
const dictionary& dict,
const fvMesh& mesh
)
:
basicSource(name, dict, mesh),
cellZoneID_(mesh.cellZones().findZoneID(this->cellSetName())),
dict_(dict.subDict(typeName + "Coeffs")),
diskDir_(dict_.lookup("diskDir")),
Cp_(readScalar(dict_.lookup("Cp"))),
Ct_(readScalar(dict_.lookup("Ct"))),
diskArea_(readScalar(dict_.lookup("diskArea")))
{
Info<< " - creating actuation disk zone: "
<< this->name() << endl;
bool foundZone = (cellZoneID_ != -1);
reduce(foundZone, orOp<bool>());
if (!foundZone && Pstream::master())
{
FatalErrorIn
(
"Foam::actuationDiskSource::actuationDiskSource"
"(const word&, const dictionary&, const fvMesh&)"
) << "cannot find porous cellZone " << this->name()
<< exit(FatalError);
}
checkData();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn)
{
if (cellZoneID_ == -1)
{
return;
}
bool compressible = false;
if (UEqn.dimensions() == dimensionSet(1, 1, -2, 0, 0))
{
compressible = true;
}
const labelList& cells = mesh_.cellZones()[cellZoneID_];
const scalarField& V = this->mesh().V();
vectorField& Usource = UEqn.source();
const vectorField& U = UEqn.psi();
if (compressible)
{
addActuationDiskAxialInertialResistance
(
Usource,
cells,
V,
this->mesh().lookupObject<volScalarField>("rho"),
U
);
}
else
{
addActuationDiskAxialInertialResistance
(
Usource,
cells,
V,
geometricOneField(),
U
);
}
}
void Foam::actuationDiskSource::writeData(Ostream& os) const
{
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
os.writeKeyword("name") << this->name() << token::END_STATEMENT << nl;
if (dict_.found("note"))
{
os.writeKeyword("note") << string(dict_.lookup("note"))
<< token::END_STATEMENT << nl;
}
os << indent << "actuationDisk";
dict_.write(os);
os << decrIndent << indent << token::END_BLOCK << endl;
}
bool Foam::actuationDiskSource::read(const dictionary& dict)
{
if (basicSource::read(dict))
{
const dictionary& sourceDict = dict.subDict(name());
const dictionary& subDictCoeffs =
sourceDict.subDict(typeName + "Coeffs");
subDictCoeffs.readIfPresent("diskDir", diskDir_);
subDictCoeffs.readIfPresent("Cp", Cp_);
subDictCoeffs.readIfPresent("Ct", Ct_);
subDictCoeffs.readIfPresent("diskArea", diskArea_);
checkData();
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,215 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 3 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::actuationDiskSource
Description
Actuation disk zone definition.
Constant values for momentum source for actuation disk
T = 2*rho*A*sqr(Uo)*a*(1-a)
U1 = (1 -a)Uo
where:
A: disk area
Uo: upstream velocity
a: 1 - Cp/Ct
U1: velocity at the disk
SourceFiles
actuationDiskSource.C
actuationDiskSourceTemplates.C
\*---------------------------------------------------------------------------*/
#ifndef actuationDiskSource_H
#define actuationDiskSource_H
#include "IOdictionary.H"
#include "coordinateSystem.H"
#include "coordinateSystems.H"
#include "wordList.H"
#include "labelList.H"
#include "DimensionedField.H"
#include "volFieldsFwd.H"
#include "fvMatricesFwd.H"
#include "basicSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class actuationDiskSource Declaration
\*---------------------------------------------------------------------------*/
class actuationDiskSource
:
public basicSource
{
// Private data
//- Cell zone ID
label cellZoneID_;
//- Sub dictionary with actuationDisk information
const dictionary& dict_;
//- Disk area normal
vector diskDir_;
//- Power coefficient
scalar Cp_;
//- Thrust coefficient
scalar Ct_;
//- Disk area
scalar diskArea_;
// Private Member Functions
//- Check data
void checkData();
//- Add resistance to the UEqn
template<class RhoFieldType>
void addActuationDiskAxialInertialResistance
(
vectorField& Usource,
const labelList& cells,
const scalarField& V,
const RhoFieldType& rho,
const vectorField& U
) const;
//- Disallow default bitwise copy construct
actuationDiskSource(const actuationDiskSource&);
//- Disallow default bitwise assignment
void operator=(const actuationDiskSource&);
public:
//- Runtime type information
TypeName("actuationDiskSource");
// Constructors
//- Construct from components
actuationDiskSource
(
const word& name,
const dictionary& dict,
const fvMesh& mesh
);
//- Destructor
virtual ~actuationDiskSource()
{}
// Member Functions
// Access
//- cellZone number
label zoneId() const
{
return cellZoneID_;
}
//- Return Cp
scalar Cp() const
{
return Cp_;
}
//- Return Ct
scalar Ct() const
{
return Ct_;
}
//- Normal disk direction
const vector& diskDir() const
{
return diskDir_;
}
//- Disk area
scalar diskArea() const
{
return diskArea_;
}
// Public Functions
//-Source term to fvMatrix<vector>
virtual void addSu(fvMatrix<vector>& UEqn);
//-Source term to fvMatrix<scalar>
virtual void addSu(fvMatrix<scalar>& UEqn){}
//- Add all explicit source
virtual void addExplicitSources(){}
//- Add source to scalar field
virtual void addSu(DimensionedField<scalar, volMesh>& field){}
//- Add source to vector field
virtual void addSu(DimensionedField<vector, volMesh>& field){}
// I-O
//- Write data
virtual void writeData(Ostream&) const;
//- Read dictionary
virtual bool read(const dictionary& dict);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "actuationDiskSourceTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,65 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 3 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*----------------------------------------------------------------------------*/
#include "actuationDiskSource.H"
#include "volFields.H"
#include "fvMatrix.H"
#include "fvm.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class RhoFieldType>
void Foam::actuationDiskSource::addActuationDiskAxialInertialResistance
(
vectorField& Usource,
const labelList& cells,
const scalarField& V,
const RhoFieldType& rho,
const vectorField& U
) const
{
scalar a = 1.0 - Cp_/Ct_;
scalar totVol = 0.0;
scalarField T(cells.size());
vector uniDiskDir = diskDir_/mag(diskDir_);
tensor E(tensor::zero);
E.xx() = uniDiskDir.x();
E.yy() = uniDiskDir.y();
E.zz() = uniDiskDir.z();
vectorField U1 = (1.0 - a)*U;
forAll(cells, i)
{
totVol += V[cells[i]];
T[i] = 2.0*rho[cells[i]]*diskArea_*mag(U1[cells[i]])*a/(1.0 - a);
}
forAll(cells, i)
{
Usource[cells[i]] += ((V[cells[i]]/totVol)*T[i]*E) & U1[cells[i]];
}
}
// ************************************************************************* //

View File

@ -0,0 +1,65 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "IObasicSourceList.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::IObasicSourceList::IObasicSourceList
(
const fvMesh& mesh
)
:
IOdictionary
(
IOobject
(
"sourcesProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
basicSourceList(mesh, *this)
{}
bool Foam::IObasicSourceList::read()
{
if (regIOobject::read())
{
basicSourceList::read(*this);
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -21,55 +21,73 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::IObasicSourceList
Description
IObasicSourceList
SourceFiles
IObasicSourceList.C
\*---------------------------------------------------------------------------*/
#include "error.H"
#ifndef IObasicSourceList_H
#define IObasicSourceList_H
#include "dispersionModel.H"
#include "noDispersion.H"
#include "basicSourceList.H"
#include "IOdictionary.H"
#include "autoPtr.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
/*---------------------------------------------------------------------------*\
Class IObasicSourceList Declaration
\*---------------------------------------------------------------------------*/
autoPtr<dispersionModel> dispersionModel::New
(
const dictionary& dict,
spray& sm
)
class IObasicSourceList
:
public IOdictionary,
public basicSourceList
{
word dispersionModelType
(
dict.lookup("dispersionModel")
);
private:
Info<< "Selecting dispersionModel "
<< dispersionModelType << endl;
// Private Member Functions
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(dispersionModelType);
//- Disallow default bitwise copy construct
IObasicSourceList(const IObasicSourceList&);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalError
<< "dispersionModel::New(const dictionary&, const spray&) : "
<< endl
<< " unknown dispersionModelType type "
<< dispersionModelType
<< ", constructor not in hash table" << endl << endl
<< " Valid dispersionModel types are :" << endl;
Info<< dictionaryConstructorTablePtr_->sortedToc() << abort(FatalError);
}
//- Disallow default bitwise assignment
void operator=(const IObasicSourceList&);
return autoPtr<dispersionModel>(cstrIter()(dict, sm));
}
public:
// Constructors
//- Construct from components with list of field names
IObasicSourceList(const fvMesh& mesh);
//- Destructor
virtual ~IObasicSourceList()
{}
//- Read dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,283 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "basicSource.H"
#include "fvMesh.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(basicSource, 0);
defineRunTimeSelectionTable(basicSource, dictionary);
}
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
const Foam::wordList Foam::basicSource::selectionModeTypeNames_
(
IStringStream("(points cellSet cellZone all)")()
);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
Foam::basicSource::selectionModeType Foam::basicSource::wordToSelectionModeType
(
const word& smtName
) const
{
forAll(selectionModeTypeNames_, i)
{
if (smtName == selectionModeTypeNames_[i])
{
return selectionModeType(i);
}
}
FatalErrorIn
(
"basicSource::selectionModeType"
"basicSource::wordToSelectionModeType"
"("
"const word&"
")"
) << "Unknown selectionMode type " << smtName
<< ". Valid selectionMode types are:" << nl << selectionModeTypeNames_
<< exit(FatalError);
return selectionModeType(0);
}
Foam::word Foam::basicSource::selectionModeTypeToWord
(
const selectionModeType& smtType
) const
{
if (smtType > selectionModeTypeNames_.size())
{
return "UNKNOWN";
}
else
{
return selectionModeTypeNames_[smtType];
}
}
void Foam::basicSource::setSelection(const dictionary& dict)
{
switch (selectionMode_)
{
case smPoints:
{
// Do nothing. It should be sorted out by derived class
break;
}
case smCellSet:
{
dict.lookup("cellSet") >> cellSetName_;
break;
}
case smCellZone:
{
dict.lookup("cellZone") >> cellSetName_;
break;
}
case smAll:
{
break;
}
default:
{
FatalErrorIn
(
"basicSource::setSelection(const dictionary&)"
) << "Unknown selectionMode "
<< selectionModeTypeNames_[selectionMode_]
<< ". Valid selectionMode types are" << selectionModeTypeNames_
<< exit(FatalError);
}
}
}
void Foam::basicSource::setCellSet()
{
Info<< incrIndent << indent << "Source: " << name_ << endl;
switch (selectionMode_)
{
case smPoints:
{
break;
}
case smCellSet:
{
Info<< indent << "- selecting cells using cellSet "
<< cellSetName_ << endl;
cellSet selectedCells(mesh_, cellSetName_);
cells_ = selectedCells.toc();
break;
}
case smCellZone:
{
Info<< indent << "- selecting cells using cellZone "
<< cellSetName_ << endl;
label zoneID = mesh_.cellZones().findZoneID(cellSetName_);
if (zoneID == -1)
{
FatalErrorIn("basicSource<Type>::setCellIds()")
<< "Cannot find cellZone " << cellSetName_ << endl
<< "Valid cellZones are " << mesh_.cellZones().names()
<< exit(FatalError);
}
cells_ = mesh_.cellZones()[zoneID];
break;
}
case smAll:
{
Info<< indent << "- selecting all cells" << endl;
cells_ = identity(mesh_.nCells());
break;
}
default:
{
FatalErrorIn("basicSource<Type>::setCellIds()")
<< "Unknown selectionMode "
<< selectionModeTypeNames_[selectionMode_]
<< ". Valid selectionMode types are" << selectionModeTypeNames_
<< exit(FatalError);
}
}
// Set volume information
if (selectionMode_ != smPoints)
{
V_ = 0.0;
forAll(cells_, i)
{
V_ += mesh_.V()[cells_[i]];
}
reduce(V_, sumOp<scalar>());
Info<< indent << "- selected "
<< returnReduce(cells_.size(), sumOp<label>())
<< " cell(s) with volume " << V_ << nl << decrIndent << endl;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::basicSource::basicSource
(
const word& name,
const dictionary& dict,
const fvMesh& mesh
)
:
name_(name),
mesh_(mesh),
dict_(dict),
active_(readBool(dict_.lookup("active"))),
timeStart_(readScalar(dict_.lookup("timeStart"))),
duration_(readScalar(dict_.lookup("duration"))),
selectionMode_(wordToSelectionModeType(dict_.lookup("selectionMode"))),
cellSetName_("none"),
V_(1.0)
{
setSelection(dict_);
setCellSet();
}
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::basicSource> Foam::basicSource::New
(
const word& name,
const dictionary& dict,
const fvMesh& mesh
)
{
word typeModel(dict.lookup("typeModel"));
Info<< "Selecting model type " << typeModel << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(typeModel);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"basicSource::New(const volVectorField&, "
"const surfaceScalarField&, transportModel&)"
) << "Unknown Model type " << typeModel
<< nl << nl
<< "Valid model types are :" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<basicSource>(cstrIter()(name, dict, mesh));
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::basicSource::isActive()
{
if
(
active_
&& (mesh_.time().value() >= timeStart_)
&& (mesh_.time().value() <= timeEnd())
)
{
// Update the cell set if the mesh is changing
if (mesh_.changing())
{
setCellSet();
}
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,384 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::basicSource
Description
Basic source abtract class
Sources described by:
source1
{
typeModel actuationDiskSource; // explicitSource
active on; // on/off switch
timeStart 0.0; // start time
duration 1000.0; // duration
selectionMode cellSet; // cellSet // points //cellZone
cellSet c0; // cellSet name
actuationDiskSourceCoeffs
{
diskDir (-1 0 0); // orientation of the disk
Cp 0.53; // Cp
Ct 0.58; // Ct
diskArea 40; // disk area
}
}
source2
{
typeModel explicitSource;
active on;
timeStart 0.0;
duration 1000.0;
selectionMode points;
cellSet c0;
explicitSourceCoeffs
{
points // list of points when selectionMode = points
(
(-0.088 0.007 -0.02)
(-0.028 0.007 -0.02)
);
volumeMode specific; //absolute
fieldData //field data
{
k 30.7;
epsilon 1.5;
}
}
}
SourceFiles
basicSource.C
basicSourceIO.C
\*---------------------------------------------------------------------------*/
#ifndef basicSource_H
#define basicSource_H
#include "fvMatrices.H"
#include "cellSet.H"
#include "volFieldsFwd.H"
#include "DimensionedField.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class fvMesh;
/*---------------------------------------------------------------------------*\
Class basicSource Declaration
\*---------------------------------------------------------------------------*/
class basicSource
{
public:
// Public data
//- Enumeration for selection mode types
enum selectionModeType
{
smPoints,
smCellSet,
smCellZone,
smAll
};
//- Word list of selection mode type names
static const wordList selectionModeTypeNames_;
protected:
// Protected data
//- Source name
word name_;
//- Reference to the mesh database
const fvMesh& mesh_;
//- Dictionary containing the data of the source
const dictionary& dict_;
//- Source active flag
bool active_;
//- Time start
scalar timeStart_;
//- Duration
scalar duration_;
//- Cell selection mode
selectionModeType selectionMode_;
//- Name of cell set for "cellSet" and "cellZone" selectionMode
word cellSetName_;
//- Set of cells to apply source to
labelList cells_;
//- Sum of cell volumes
scalar V_;
// Protected functions
//- Helper function to convert from a word to a selectionModeType
selectionModeType wordToSelectionModeType(const word& smtName) const;
//- Helper function to convert from a selectionModeType to a word
word selectionModeTypeToWord(const selectionModeType& smtType) const;
//- Set the cellSet or points selection
void setSelection(const dictionary& dict);
//- Set the cell set based on the user input selection mode
void setCellSet();
public:
//- Runtime type information
TypeName("basicSource");
// Declare run-time constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
basicSource,
dictionary,
(
const word& name,
const dictionary& dict,
const fvMesh& mesh
),
(name, dict, mesh)
);
// Constructors
//- Construct from components
basicSource
(
const word& name,
const dictionary& dict,
const fvMesh& mesh
);
//- Return clone
autoPtr<basicSource> clone() const
{
notImplemented
(
"autoPtr<basicSource> clone() const"
);
return autoPtr<basicSource>(NULL);
}
//- Return pointer to new basicSource object created
// on the freestore from an Istream
class iNew
{
//- Reference to the mesh database
const fvMesh& mesh_;
const word& name_;
public:
iNew
(
const fvMesh& mesh,
const word& name
)
:
mesh_(mesh),
name_(name)
{}
autoPtr<basicSource> operator()(Istream& is) const
{
//const word name(is);
const dictionary dict(is);
return autoPtr<basicSource>
(
basicSource::New
(
name_,
dict,
mesh_
)
);
}
};
// Selectors
//- Return a reference to the selected basicSource model
static autoPtr<basicSource> New
(
const word& name,
const dictionary& dict,
const fvMesh& mesh
);
//- Destructor
virtual ~basicSource()
{}
// 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 dictionay
inline const dictionary& dictCoeffs() 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 cell selection mode
inline const selectionModeType& selectionMode() const;
//- Return const access to the name of cell set for "cellSet"
// selectionMode
inline const word& cellSetName() const;
//- Return const access to the total cell volume
inline scalar V() const;
//- Return const access to the cell set
inline const labelList& cells() 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 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 total cell volume
inline scalar& V();
//- Return access to the cell set
inline labelList& cells();
// Checks
//- Is the source active?
bool isActive();
// Evaluation
//- Add all explicit sources
virtual void addExplicitSources() = 0;
//- Add source to scalar field
virtual void addSu(DimensionedField<scalar, volMesh>& field) = 0;
//- Add source to vector field
virtual void addSu(DimensionedField<vector, volMesh>& field) = 0;
//- Add source term to vector fvMatrix
virtual void addSu(fvMatrix<vector>& Eqn) = 0;
//- Add source term to scalar fvMatrix
virtual void addSu(fvMatrix<scalar>& Eqn) = 0;
// I-O
//- Write the source properties
virtual void writeData(Ostream&) const = 0;
//- Read source dictionary
virtual bool read(const dictionary& dict) = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "basicSourceI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,144 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "basicSource.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::word& Foam::basicSource::name() const
{
return name_;
}
inline const Foam::fvMesh& Foam::basicSource::mesh() const
{
return mesh_;
}
inline const Foam::dictionary& Foam::basicSource::dictCoeffs() const
{
return dict_;
}
inline bool Foam::basicSource::active() const
{
return active_;
}
inline Foam::scalar Foam::basicSource::timeStart() const
{
return timeStart_;
}
inline Foam::scalar Foam::basicSource::duration() const
{
return duration_;
}
inline Foam::scalar Foam::basicSource::timeEnd() const
{
return timeStart_ + duration_;
}
inline const Foam::basicSource::selectionModeType&
Foam::basicSource::selectionMode() const
{
return selectionMode_;
}
inline const Foam::word& Foam::basicSource::cellSetName() const
{
return cellSetName_;
}
inline Foam::scalar Foam::basicSource::V() const
{
return V_;
}
inline const Foam::labelList& Foam::basicSource::cells() const
{
return cells_;
}
inline Foam::word& Foam::basicSource::name()
{
return name_;
}
inline bool& Foam::basicSource::active()
{
return active_;
}
inline Foam::scalar& Foam::basicSource::timeStart()
{
return timeStart_;
}
inline Foam::scalar& Foam::basicSource::duration()
{
return duration_;
}
inline Foam::word& Foam::basicSource::cellSetName()
{
return cellSetName_;
}
inline Foam::basicSource::selectionModeType&
Foam::basicSource::selectionMode()
{
return selectionMode_;
}
inline Foam::scalar& Foam::basicSource::V()
{
return V_;
}
inline Foam::labelList& Foam::basicSource::cells()
{
return cells_;
}
// ************************************************************************* //

View File

@ -0,0 +1,82 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "basicSource.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::basicSource::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_) << nl;
switch (selectionMode_)
{
case smPoints:
{
break;
}
case smCellSet:
{
os.writeKeyword("cellSet") << cellSetName_
<< token::END_STATEMENT << nl;
break;
}
default:
{
FatalErrorIn
(
"basicSource::writeData"
"("
"Ostream&, "
"bool"
") const"
) << "Unknown selectionMode "
<< selectionModeTypeToWord(selectionMode_)
<< abort(FatalError);
}
}
os << decrIndent << indent << token::END_BLOCK << endl;
}
bool Foam::basicSource::read(const dictionary& dict)
{
const dictionary& sourceDict = dict.subDict(name_);
active_ = readBool(sourceDict.lookup("active"));
timeStart_ = readScalar(sourceDict.lookup("timeStart"));
duration_ = readScalar(sourceDict.lookup("duration"));
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,182 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "basicSourceList.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::basicSourceList::basicSourceList
(
const fvMesh& mesh,
const dictionary& dict
)
:
PtrList<basicSource>(),
mesh_(mesh)
{
label count = 0;
forAllConstIter(dictionary, dict, iter)
{
// safety:
if (iter().isDict())
{
count ++;
}
}
this->setSize(count);
label i = 0;
forAllConstIter(dictionary, dict, iter)
{
const word& name = iter().keyword();
const dictionary& dict = iter().dict();
this->set
(
i++,
basicSource::New(name, dict, mesh)
);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::basicSourceList::addSu(fvMatrix<scalar>& Eqn)
{
forAll(*this, i)
{
if (this->operator[](i).isActive())
{
this->operator[](i).addSu(Eqn);
}
}
}
void Foam::basicSourceList::addSu(fvMatrix<vector>& Eqn)
{
forAll(*this, i)
{
if (this->operator[](i).isActive())
{
this->operator[](i).addSu(Eqn);
}
}
}
void Foam::basicSourceList::addExplicitSources()
{
forAll(*this, i)
{
if (this->operator[](i).isActive())
{
this->operator[](i).addExplicitSources();
}
}
}
void Foam::basicSourceList::addSu
(
DimensionedField<scalar, volMesh>& field
)
{
forAll(*this, i)
{
if (this->operator[](i).isActive())
{
this->operator[](i).addSu(field);
}
}
}
void Foam::basicSourceList::addSu
(
DimensionedField<vector, volMesh>& field
)
{
forAll(*this, i)
{
if (this->operator[](i).isActive())
{
this->operator[](i).addSu(field);
}
}
}
bool Foam::basicSourceList::read(const dictionary& dict)
{
forAll(*this, i)
{
this->operator[](i).read(dict);
}
return true;
}
bool Foam::basicSourceList::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 * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const basicSourceList& sources
)
{
sources.writeData(os);
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,130 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::basicsourceList
Description
List of explict sources
SourceFile
basicSourceList.C
\*---------------------------------------------------------------------------*/
#ifndef basicSourceList_H
#define basicSourceList_H
#include "PtrList.H"
#include "DimensionedField.H"
#include "basicSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class basicSourceList Declaration
\*---------------------------------------------------------------------------*/
class basicSourceList
:
public PtrList<basicSource>
{
private:
// Private data
//- Reference to the mesh database
const fvMesh& mesh_;
// Private Member Functions
//- Disallow default bitwise copy construct
basicSourceList(const basicSourceList&);
//- Disallow default bitwise assignment
void operator=(const basicSourceList&);
public:
// Constructors
//- Construct from components with list of field names
basicSourceList(const fvMesh& mesh, const dictionary& dict);
//- Destructor
virtual ~basicSourceList()
{}
// Member Functions
// Evaluation
//- Add all explicit sources
void addExplicitSources();
//- Add source to scalar field
void addSu(DimensionedField<scalar, volMesh>& field);
//- Add source to vector field
void addSu(DimensionedField<vector, volMesh>& field);
//- Add source terms to scalar fvMatrix
void addSu(fvMatrix<scalar>& Eq);
//- Add source terms to vector fvMatrix
void addSu(fvMatrix<vector>& Eq);
// I-O
//- Read dictionary
virtual bool read(const dictionary& dict);
//- Write data to Istream
virtual bool writeData(Ostream& os) const;
//- Ostream operator
friend Ostream& operator<<
(
Ostream& os,
const basicSourceList& sources
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,253 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "explicitSource.H"
#include "fvMesh.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "HashSet.H"
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(explicitSource, 0);
addToRunTimeSelectionTable
(
basicSource,
explicitSource,
dictionary
);
}
const Foam::wordList Foam::explicitSource::volumeModeTypeNames_
(
IStringStream("(absolute specific)")()
);
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::explicitSource::setSelectedCellsFromPoints()
{
labelHashSet selectedCells;
forAll(points_, i)
{
label cellI = this->mesh().findCell(points_[i]);
if (cellI >= 0)
{
selectedCells.insert(cellI);
}
label globalCellI = returnReduce(cellI, maxOp<label>());
if (globalCellI < 0)
{
WarningIn("explicitSource::setSelectedCellsFromPoints()")
<< "Unable to find owner cell for point " << points_[i]
<< endl;
}
}
this->cells() = selectedCells.toc();
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
Foam::explicitSource::volumeModeType
Foam::explicitSource::wordToVolumeModeType
(
const word& vmtName
) const
{
forAll(volumeModeTypeNames_, i)
{
if (vmtName == volumeModeTypeNames_[i])
{
return volumeModeType(i);
}
}
FatalErrorIn
(
"explicitSource<Type>::volumeModeType"
"explicitSource<Type>::wordToVolumeModeType(const word&)"
) << "Unknown volumeMode type " << vmtName
<< ". Valid volumeMode types are:" << nl << volumeModeTypeNames_
<< exit(FatalError);
return volumeModeType(0);
}
Foam::word Foam::explicitSource::volumeModeTypeToWord
(
const volumeModeType& vmtType
) const
{
if (vmtType > volumeModeTypeNames_.size())
{
return "UNKNOWN";
}
else
{
return volumeModeTypeNames_[vmtType];
}
}
void Foam::explicitSource::setFieldData(const dictionary& dict)
{
scalarFields_.clear();
vectorFields_.clear();
wordList fieldTypes(dict.toc().size());
wordList fieldNames(dict.toc().size());
forAll(dict.toc(), i)
{
const word& fieldName = dict.toc()[i];
IOobject io
(
fieldName,
this->mesh().time().timeName(0),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
);
if (io.headerOk())
{
fieldTypes[i] = io.headerClassName();
fieldNames[i] = dict.toc()[i];
}
else
{
FatalErrorIn
(
"explicitSource::setFieldData"
) << "header not OK " << io.name()
<< exit(FatalError);
}
}
addField(scalarFields_, fieldTypes, fieldNames, dict);
addField(vectorFields_, fieldTypes, fieldNames, dict);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::explicitSource::explicitSource
(
const word& name,
const dictionary& dict,
const fvMesh& mesh
)
:
basicSource(name, dict, mesh),
scalarFields_(0, *this),
vectorFields_(0, *this),
dict_(dict.subDict(typeName + "Coeffs")),
volumeMode_(wordToVolumeModeType(dict_.lookup("volumeMode"))),
points_(),
volSource_(this->cells().size(), 1.0)
{
setFieldData(dict_.subDict("fieldData"));
// Set points if selectionMode is smPoints
if (this->selectionMode() == smPoints)
{
dict_.lookup("points") >> points_;
setSelectedCellsFromPoints();
volSource_.setSize(points_.size(), 1.0);
}
const labelList& cellList = this->cells();
scalar V = 0.0;
if (volumeMode_ == vmAbsolute)
{
forAll(cellList, cellI)
{
volSource_[cellI] = mesh.V()[cellList[cellI]];
V += volSource_[cellI];
}
}
else
{
forAll(cellList, cellI)
{
V += mesh.V()[cellList[cellI]];
}
}
reduce(V, sumOp<scalar>());
Info<< "- selected " << returnReduce(cellList.size(), sumOp<label>())
<< " cell(s) with Volume: " << V << " in time activated sources "
<< endl;
}
void Foam::explicitSource::addSu(fvMatrix<scalar>& Eqn)
{
Field<scalar>& source = Eqn.source();
scalar data = scalarFields_[Eqn.psi().name()];
addSources<scalar>(source, data);
}
void Foam::explicitSource::addSu(fvMatrix<vector>& Eqn)
{
Field<vector>& source = Eqn.source();
vector data = vectorFields_[Eqn.psi().name()];
addSources<vector>(source, data);
}
void Foam::explicitSource::addSu(DimensionedField<scalar, volMesh>& field)
{
scalar data = scalarFields_[field.name()];
addSources<scalar>(field, data);
}
void Foam::explicitSource::addSu(DimensionedField<vector, volMesh>& field)
{
vector data = vectorFields_[field.name()];
addSources<vector>(field, data);
}
void Foam::explicitSource::addExplicitSources()
{
scalarFields_.applySources();
vectorFields_.applySources();
}
// ************************************************************************* //

View File

@ -0,0 +1,295 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::explicitSource
Description
Explicit source.
Sources described by:
explicitSourceCoeffs
{
points // list of points when selectionMode = points
(
(-0.088 0.007 -0.02)
(-0.028 0.007 -0.02)
);
volumeMode specific; //absolute
fieldData // field data - usage for multiple fields
{
k 30.7;
epsilon 1.5;
}
}
SourceFiles
explicitSource.C
\*---------------------------------------------------------------------------*/
#ifndef explicitSource_H
#define explicitSource_H
#include "cellSet.H"
#include "volFieldsFwd.H"
#include "DimensionedField.H"
#include "basicSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class explicitSource Declaration
\*---------------------------------------------------------------------------*/
class explicitSource
:
public basicSource
{
// Private classes
template<class Type>
class fieldList
:
public HashTable<Type>
{
explicitSource& OwnerPtr_;
public:
//- null Constructor
fieldList()
:
HashTable<Type>(0),
OwnerPtr_()
{}
//- Constructor
fieldList(label size, explicitSource& ownerPtr)
:
HashTable<Type>(size),
OwnerPtr_(ownerPtr)
{}
void applySources()
{
typedef GeometricField<Type, fvPatchField, volMesh>
geometricField;
forAll(this->toc(), i)
{
geometricField& field = const_cast<geometricField&>
(
OwnerPtr_.mesh().lookupObject<geometricField>
(this->toc()[i])
);
Type data = this->operator[](field.name());
OwnerPtr_.addSources<Type>(field.internalField(), data);
}
}
};
private:
// Private cdata
//- List of field types
fieldList<scalar> scalarFields_;
fieldList<vector> vectorFields_;
//- Add field names and values to field table for types.
template<class Type>
void addField
(
HashTable<Type>& fields,
const wordList& fieldTypes,
const wordList& fieldNames,
const dictionary& dict_
);
//- Add data to field source
template<class Type>
void addSources
(
Field<Type>& fieldSource,
Type& data
) const;
public:
// Public data
//- Enumeration for volume types
enum volumeModeType
{
vmAbsolute,
vmSpecific
};
//- Word list of volume mode type names
static const wordList volumeModeTypeNames_;
protected:
// Protected data
//- Sub dictionary for time activated explicit sources
const dictionary& dict_;
//- Volume mode
volumeModeType volumeMode_;
//- List of points for "points" selectionMode
List<point> points_;
//- Volume of the explicit source
scalarList volSource_;
// Protected functions
//- Helper function to convert from a word to a volumeModeType
volumeModeType wordToVolumeModeType(const word& vtName) const;
//- Helper function to convert from a volumeModeType to a word
word volumeModeTypeToWord(const volumeModeType& vtType) const;
//- Set the local field data
void setFieldData(const dictionary& dict);
//- Set selected cells when smPoint is used
void setSelectedCellsFromPoints();
public:
//- Runtime type information
TypeName("explicitSource");
// Constructors
//- Construct from components
explicitSource
(
const word& name,
const dictionary& dict,
const fvMesh& mesh
);
//- Return clone
autoPtr<explicitSource> clone() const
{
notImplemented
(
"autoPtr<explicitSource> clone() const"
);
return autoPtr<explicitSource>(NULL);
}
// Member Functions
// Access
//- Return const access to the volume mode
inline const volumeModeType& volumeMode() const;
// Edit
//- Return access to the volume mode
inline volumeModeType& volumeMode();
//- Return points
inline const List<point>& points() const;
// Evaluation
//-Source term to fvMatrix<vector>
virtual void addSu(fvMatrix<vector>& UEqn);
//-Source term to fvMatrix<scalar>
virtual void addSu(fvMatrix<scalar>& UEqn);
//- Add all explicit source
virtual void addExplicitSources();
//- Add source to scalar field
virtual void addSu(DimensionedField<vector, volMesh>& field);
//- Add source to vector field
virtual void addSu(DimensionedField<scalar, volMesh>& field);
// I-O
//- Write the source properties
virtual void writeData(Ostream&) const;
//- Read fieldData in sub-dictionary
virtual bool read(const dictionary& dict);
//- Ostream operator
friend Ostream& operator<<
(
Ostream& os,
const explicitSource& source
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "explicitSourceIO.C"
#include "explicitSourceI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "explicitSourceTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "explicitSource.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::explicitSource::volumeModeType&
Foam::explicitSource::volumeMode() const
{
return volumeMode_;
}
inline Foam::explicitSource::volumeModeType&
Foam::explicitSource::volumeMode()
{
return volumeMode_;
}
inline const Foam::List<Foam::point>&
Foam::explicitSource::points() const
{
return points_;
}
// ************************************************************************* //

View File

@ -0,0 +1,79 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "explicitSource.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::explicitSource::writeData(Ostream& os) const
{
os << indent << name_ << nl
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
os.writeKeyword("volumeMode") << volumeModeTypeToWord(volumeMode_)
<< token::END_STATEMENT << nl;
if (scalarFields_.size() > 0)
{
os.writeKeyword("scalarFields") << scalarFields_
<< token::END_STATEMENT << nl;
}
if (vectorFields_.size() > 0)
{
os.writeKeyword("vectorFields") << vectorFields_
<< token::END_STATEMENT << nl;
}
os << decrIndent << indent << token::END_BLOCK << endl;
}
bool Foam::explicitSource::read(const dictionary& dict)
{
if (basicSource::read(dict))
{
const dictionary& sourceDict = dict.subDict(name());
const dictionary& subDictCoeffs = sourceDict.subDict(typeName + "Coeffs");
setFieldData(subDictCoeffs.subDict("fieldData"));
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const explicitSource& source)
{
source.writeData(os);
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,79 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
template<class Type>
void Foam::explicitSource::addSources
(
Field<Type>& fieldSource,
Type& data
) const
{
forAll(this->cells(), i)
{
fieldSource[this->cells()[i]] = data/volSource_[i];
}
}
template <class Type>
void Foam::explicitSource::addField
(
HashTable<Type>& fields,
const wordList& fieldTypes,
const wordList& fieldNames,
const dictionary& fieldDataDict
)
{
typedef GeometricField<Type, fvPatchField, volMesh> geometricField;
forAll (fieldTypes, fieldI)
{
word fieldName = fieldNames[fieldI];
word fieldType = fieldTypes[fieldI];
if
(
(
fieldType
== GeometricField<Type, fvPatchField, volMesh>::typeName
) &&
(
this->mesh().foundObject<geometricField>(fieldName)
)
)
{
Type fieldValue = fieldDataDict.lookupOrDefault<Type>
(
fieldName,
pTraits<Type>::zero
);
fields.insert(fieldName, fieldValue);
}
}
}
// ************************************************************************* //

View File

@ -73,6 +73,8 @@ Foam::porousZone::porousZone
cellZoneID_(mesh_.cellZones().findZoneID(name)),
coordSys_(dict, mesh),
porosity_(1),
intensity_(0),
mixingLength_(0),
C0_(0),
C1_(0),
D_("D", dimensionSet(0, -2, 0, 0, 0), tensor::zero),
@ -95,21 +97,57 @@ Foam::porousZone::porousZone
// porosity
if (dict_.readIfPresent("porosity", porosity_))
if
(
dict_.readIfPresent("porosity", porosity_)
&& (porosity_ <= 0.0 || porosity_ > 1.0)
)
{
if (porosity_ <= 0.0 || porosity_ > 1.0)
{
FatalIOErrorIn
(
"Foam::porousZone::porousZone"
"(const fvMesh&, const word&, const dictionary&)",
dict_
)
<< "out-of-range porosity value " << porosity_
<< exit(FatalIOError);
}
FatalIOErrorIn
(
"Foam::porousZone::porousZone"
"(const fvMesh&, const word&, const dictionary&)",
dict_
)
<< "out-of-range porosity value " << porosity_
<< exit(FatalIOError);
}
// turbulent intensity
if
(
dict_.readIfPresent("intensity", intensity_)
&& (intensity_ <= 0.0 || intensity_ > 1.0)
)
{
FatalIOErrorIn
(
"Foam::porousZone::porousZone"
"(const fvMesh&, const word&, const dictionary&)",
dict_
)
<< "out-of-range turbulent intensity value " << intensity_
<< exit(FatalIOError);
}
// turbulent length scale
if
(
dict_.readIfPresent("mixingLength", mixingLength_)
&& (mixingLength_ <= 0.0)
)
{
FatalIOErrorIn
(
"Foam::porousZone::porousZone"
"(const fvMesh&, const word&, const dictionary&)",
dict_
)
<< "out-of-range turbulent length scale " << mixingLength_
<< exit(FatalIOError);
}
// powerLaw coefficients
if (const dictionary* dictPtr = dict_.subDictPtr("powerLaw"))
{
@ -171,9 +209,6 @@ Foam::porousZone::porousZone
}
}
// provide some feedback for the user
// writeDict(Info, false);
// it is an error not to define anything
if
(
@ -191,6 +226,12 @@ Foam::porousZone::porousZone
"nor Darcy-Forchheimer law (d/f) specified"
<< exit(FatalIOError);
}
// feedback for the user
if (dict.lookupOrDefault("printCoeffs", false))
{
writeDict(Info, false);
}
}
@ -365,7 +406,8 @@ void Foam::porousZone::writeDict(Ostream& os, bool subDict) const
if (subDict)
{
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
os.writeKeyword("name") << zoneName() << token::END_STATEMENT << nl;
os.writeKeyword("name")
<< zoneName() << token::END_STATEMENT << nl;
}
else
{
@ -375,40 +417,53 @@ void Foam::porousZone::writeDict(Ostream& os, bool subDict) const
if (dict_.found("note"))
{
os.writeKeyword("note") << string(dict_.lookup("note"))
<< token::END_STATEMENT << nl;
os.writeKeyword("note")
<< string(dict_.lookup("note")) << token::END_STATEMENT << nl;
}
coordSys_.writeDict(os, true);
if (dict_.found("porosity"))
{
os.writeKeyword("porosity") << porosity() << token::END_STATEMENT << nl;
os.writeKeyword("porosity")
<< porosity() << token::END_STATEMENT << nl;
}
if (dict_.found("intensity"))
{
os.writeKeyword("intensity")
<< intensity() << token::END_STATEMENT << nl;
}
if (dict_.found("mixingLength"))
{
os.writeKeyword("mixingLength")
<< mixingLength() << token::END_STATEMENT << nl;
}
// powerLaw coefficients
if (const dictionary* dictPtr = dict_.subDictPtr("powerLaw"))
{
os << indent << "powerLaw";
os << indent << "powerLaw";
dictPtr->write(os);
}
// Darcy-Forchheimer coefficients
if (const dictionary* dictPtr = dict_.subDictPtr("Darcy"))
{
os << indent << "Darcy";
os << indent << "Darcy";
dictPtr->write(os);
}
os << decrIndent << indent << token::END_BLOCK << endl;
os << decrIndent << indent << token::END_BLOCK << endl;
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const porousZone& pZone)
Foam::Ostream& Foam::operator<<(Ostream& os, const porousZone& pz)
{
pZone.writeDict(os);
pz.writeDict(os);
return os;
}

View File

@ -51,6 +51,25 @@ Description
The porousZones method porousZones::ddt() mirrors the normal fvm::ddt()
method, but accounts for the effective volume of the cells.
An example dictionary entry:
@verbatim
cat1
{
note "some catalyst";
coordinateSystem system_10;
porosity 0.809;
intensity 0.001; // optional
mixingLength 0.0001; // optional
printCoeffs yes; // optional: feedback for the user
Darcy
{
d d [0 -2 0 0 0] (-1000 -1000 5.3756e+07);
f f [0 -1 0 0 0] (-1000 -1000 15.83);
}
}
@endverbatim
See Also
porousZones and coordinateSystems
@ -111,6 +130,12 @@ class porousZone
// Currently unused.
scalar porosity_;
//- Turbulent intensity as fraction of the velocity
scalar intensity_;
//- Turbulent length scale
scalar mixingLength_;
//- powerLaw coefficient C0
scalar C0_;
@ -283,6 +308,30 @@ public:
return porosity_;
}
//- Return turbulent intensity
scalar intensity() const
{
return intensity_;
}
//- Edit access to turbulent intensity
scalar& intensity()
{
return intensity_;
}
//- Return turbulent length scale
scalar mixingLength() const
{
return mixingLength_;
}
//- Edit access to turbulent length scale
scalar& mixingLength()
{
return mixingLength_;
}
//- Modify time derivative elements according to porosity
template<class Type>

View File

@ -116,12 +116,13 @@ void buoyantPressureFvPatchScalarField::updateCoeffs()
const fvPatchField<scalar>& rho =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
// If the variable name is "pmh" or "pd" assume it is p - rho*g.h
// and set the gradient appropriately.
// If the variable name is "p_rgh", "ph_rgh" or "pd"
// assume it is p? - rho*g.h and set the gradient appropriately.
// Otherwise assume the variable is the static pressure.
if
(
dimensionedInternalField().name() == "pmh"
dimensionedInternalField().name() == "p_rgh"
|| dimensionedInternalField().name() == "ph_rgh"
|| dimensionedInternalField().name() == "pd"
)
{

View File

@ -0,0 +1,173 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 3 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "cylindricalInletVelocityFvPatchVectorField.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "surfaceFields.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::
cylindricalInletVelocityFvPatchVectorField::
cylindricalInletVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchField<vector>(p, iF),
axialVelocity_(0),
centre_(pTraits<vector>::zero),
axis_(pTraits<vector>::zero),
rpm_(0),
radialVelocity_(0)
{}
Foam::
cylindricalInletVelocityFvPatchVectorField::
cylindricalInletVelocityFvPatchVectorField
(
const cylindricalInletVelocityFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
axialVelocity_(ptf.axialVelocity_),
centre_(ptf.centre_),
axis_(ptf.axis_),
rpm_(ptf.rpm_),
radialVelocity_(ptf.radialVelocity_)
{}
Foam::
cylindricalInletVelocityFvPatchVectorField::
cylindricalInletVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchField<vector>(p, iF, dict),
axialVelocity_(readScalar(dict.lookup("axialVelocity"))),
centre_(dict.lookup("centre")),
axis_(dict.lookup("axis")),
rpm_(readScalar(dict.lookup("rpm"))),
radialVelocity_(readScalar(dict.lookup("radialVelocity")))
{}
Foam::
cylindricalInletVelocityFvPatchVectorField::
cylindricalInletVelocityFvPatchVectorField
(
const cylindricalInletVelocityFvPatchVectorField& ptf
)
:
fixedValueFvPatchField<vector>(ptf),
axialVelocity_(ptf.axialVelocity_),
centre_(ptf.centre_),
axis_(ptf.axis_),
rpm_(ptf.rpm_),
radialVelocity_(ptf.radialVelocity_)
{}
Foam::
cylindricalInletVelocityFvPatchVectorField::
cylindricalInletVelocityFvPatchVectorField
(
const cylindricalInletVelocityFvPatchVectorField& ptf,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchField<vector>(ptf, iF),
axialVelocity_(ptf.axialVelocity_),
centre_(ptf.centre_),
axis_(ptf.axis_),
rpm_(ptf.rpm_),
radialVelocity_(ptf.radialVelocity_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::cylindricalInletVelocityFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}
vector hatAxis = axis_/mag(axis_);
vectorField r = (patch().Cf() - centre_);
vectorField d = r - (hatAxis & r)*hatAxis;
vectorField tangVelo =
(rpm_*constant::mathematical::pi/30.0)*(hatAxis)^d;
operator==(tangVelo + axis_*axialVelocity_ + radialVelocity_*d);
fixedValueFvPatchField<vector>::updateCoeffs();
}
void Foam::cylindricalInletVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchField<vector>::write(os);
os.writeKeyword("axialVelocity") << axialVelocity_ <<
token::END_STATEMENT << nl;
os.writeKeyword("centre") << centre_ << token::END_STATEMENT << nl;
os.writeKeyword("axis") << axis_ << token::END_STATEMENT << nl;
os.writeKeyword("rpm") << rpm_ << token::END_STATEMENT << nl;
os.writeKeyword("radialVelocity") << radialVelocity_ <<
token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchVectorField,
cylindricalInletVelocityFvPatchVectorField
);
}
// ************************************************************************* //

View File

@ -0,0 +1,175 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 3 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::cylindricalInletVelocityFvPatchVectorField
Description
Describes an inlet vector boundary condition in cylindrical coordinates
given a central axis, central point, rpm, axial and radial velocity.
Example of the boundary condition specification:
@verbatim
inlet
{
type cylindricalInletVelocity;
axis (0 0 1);
centre (0 0 0);
axialVelocity 30;
rpm 100;
radialVelocity -10;
}
@endverbatim
SourceFiles
cylindricalInletVelocityFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef cylindricalInletVelocityFvPatchVectorField_H
#define cylindricalInletVelocityFvPatchVectorField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cylindricalInletVelocityFvPatchVectorField Declaration
\*---------------------------------------------------------------------------*/
class cylindricalInletVelocityFvPatchVectorField
:
public fixedValueFvPatchVectorField
{
// Private data
//- Axial velocity
const scalar axialVelocity_;
//- Central point
const vector centre_;
//- Axis
const vector axis_;
//- RPM
const scalar rpm_;
//- Radial velocity
const scalar radialVelocity_;
public:
//- Runtime type information
TypeName("cylindricalInletVelocity");
// Constructors
//- Construct from patch and internal field
cylindricalInletVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
cylindricalInletVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// flowRateInletVelocityFvPatchVectorField
// onto a new patch
cylindricalInletVelocityFvPatchVectorField
(
const cylindricalInletVelocityFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
cylindricalInletVelocityFvPatchVectorField
(
const cylindricalInletVelocityFvPatchVectorField&
);
//- Construct and return a clone
virtual tmp<fvPatchVectorField> clone() const
{
return tmp<fvPatchVectorField>
(
new cylindricalInletVelocityFvPatchVectorField(*this)
);
}
//- Construct as copy setting internal field reference
cylindricalInletVelocityFvPatchVectorField
(
const cylindricalInletVelocityFvPatchVectorField&,
const DimensionedField<vector, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchVectorField> clone
(
const DimensionedField<vector, volMesh>& iF
) const
{
return tmp<fvPatchVectorField>
(
new cylindricalInletVelocityFvPatchVectorField(*this, iF)
);
}
// Member functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -61,7 +61,8 @@ swirlFlowRateInletVelocityFvPatchVectorField
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
flowRate_(ptf.flowRate_),
phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_)
rhoName_(ptf.rhoName_),
rpm_(ptf.rpm_)
{}

View File

@ -8,10 +8,10 @@
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is 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
@ -19,14 +19,15 @@ License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::swirlFlowRateInletVelocityFvPatchVectorField
Description
Describes a volumetric/mass flow normal vector boundary condition by its
magnitude as an integral over its area, with a swirl component determined
magnitude as an integral over its area with a swirl component determined
by the RPM
The basis of the patch (volumetric or mass) is determined by the
@ -38,22 +39,14 @@ Description
@verbatim
inlet
{
type swirlFlowRateInletVelocity;
flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s]
rpm 100;
value uniform (0 0 0); // placeholder
type swirlFlowRateInletVelocity;
flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s]
rpm 100;
}
@endverbatim
Note
- The value is positive inwards
- May not work correctly for transonic inlets
- Swirl is defined in RPM about the patch centre-axis according
to a right-hand rule (inwards axis).
- Primarily useful for planar patches.
See Also
Foam::flowRateInletVelocityFvPatchVectorField
SourceFiles
swirlFlowRateInletVelocityFvPatchVectorField.C
@ -70,7 +63,7 @@ SourceFiles
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class swirlFlowRateInletVelocityFvPatchVectorField Declaration
Class swirlFlowRateInletVelocityFvPatchVectorField Declaration
\*---------------------------------------------------------------------------*/
class swirlFlowRateInletVelocityFvPatchVectorField
@ -80,16 +73,16 @@ class swirlFlowRateInletVelocityFvPatchVectorField
// Private data
//- Inlet integral flow rate
scalar flowRate_;
const scalar flowRate_;
//- Name of the flux transporting the field
word phiName_;
const word phiName_;
//- Name of the density field used to normalize the mass flux
word rhoName_;
const word rhoName_;
//- Swirl rate [rpm]
scalar rpm_;
//- RPM
const scalar rpm_;
public:
@ -171,31 +164,12 @@ public:
return flowRate_;
}
//- Return reference to the flux to allow adjustment
scalar& flowRate()
{
return flowRate_;
}
//- Return the swirl rpm
scalar rpm() const
{
return rpm_;
}
//- Return reference to the swirl rpm to allow adjustment
scalar& rpm()
{
return rpm_;
}
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};

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) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -28,6 +28,7 @@ License
#include "calculatedFvPatchFields.H"
#include "zeroGradientFvPatchFields.H"
#include "coupledFvPatchFields.H"
#include "UIndirectList.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -177,6 +178,95 @@ void Foam::fvMatrix<Type>::addBoundarySource
}
template<class Type>
template<template<class> class ListType>
void Foam::fvMatrix<Type>::setValuesFromList
(
const unallocLabelList& cellLabels,
const ListType<Type>& values
)
{
const fvMesh& mesh = psi_.mesh();
const cellList& cells = mesh.cells();
const unallocLabelList& own = mesh.owner();
const unallocLabelList& nei = mesh.neighbour();
scalarField& Diag = diag();
Field<Type>& psi =
const_cast
<
GeometricField<Type, fvPatchField, volMesh>&
>(psi_).internalField();
forAll(cellLabels, i)
{
const label celli = cellLabels[i];
const Type& value = values[i];
psi[celli] = value;
source_[celli] = value*Diag[celli];
if (symmetric() || asymmetric())
{
const cell& c = cells[celli];
forAll(c, j)
{
const label facei = c[j];
if (mesh.isInternalFace(facei))
{
if (symmetric())
{
if (celli == own[facei])
{
source_[nei[facei]] -= upper()[facei]*value;
}
else
{
source_[own[facei]] -= upper()[facei]*value;
}
upper()[facei] = 0.0;
}
else
{
if (celli == own[facei])
{
source_[nei[facei]] -= lower()[facei]*value;
}
else
{
source_[own[facei]] -= upper()[facei]*value;
}
upper()[facei] = 0.0;
lower()[facei] = 0.0;
}
}
else
{
label patchi = mesh.boundaryMesh().whichPatch(facei);
if (internalCoeffs_[patchi].size())
{
label patchFacei =
mesh.boundaryMesh()[patchi].whichFace(facei);
internalCoeffs_[patchi][patchFacei] =
pTraits<Type>::zero;
boundaryCoeffs_[patchi][patchFacei] =
pTraits<Type>::zero;
}
}
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
@ -393,92 +483,25 @@ Foam::fvMatrix<Type>::~fvMatrix()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Set solution in given cells and eliminate corresponding
// equations from the matrix
template<class Type>
void Foam::fvMatrix<Type>::setValues
(
const labelList& cellLabels,
const Field<Type>& values
const unallocLabelList& cellLabels,
const UList<Type>& values
)
{
const fvMesh& mesh = psi_.mesh();
this->setValuesFromList(cellLabels, values);
}
const cellList& cells = mesh.cells();
const unallocLabelList& own = mesh.owner();
const unallocLabelList& nei = mesh.neighbour();
scalarField& Diag = diag();
Field<Type>& psi =
const_cast
<
GeometricField<Type, fvPatchField, volMesh>&
>(psi_).internalField();
forAll(cellLabels, i)
{
label celli = cellLabels[i];
psi[celli] = values[i];
source_[celli] = values[i]*Diag[celli];
if (symmetric() || asymmetric())
{
const cell& c = cells[celli];
forAll(c, j)
{
label facei = c[j];
if (mesh.isInternalFace(facei))
{
if (symmetric())
{
if (celli == own[facei])
{
source_[nei[facei]] -= upper()[facei]*values[i];
}
else
{
source_[own[facei]] -= upper()[facei]*values[i];
}
upper()[facei] = 0.0;
}
else
{
if (celli == own[facei])
{
source_[nei[facei]] -= lower()[facei]*values[i];
}
else
{
source_[own[facei]] -= upper()[facei]*values[i];
}
upper()[facei] = 0.0;
lower()[facei] = 0.0;
}
}
else
{
label patchi = mesh.boundaryMesh().whichPatch(facei);
if (internalCoeffs_[patchi].size())
{
label patchFacei =
mesh.boundaryMesh()[patchi].whichFace(facei);
internalCoeffs_[patchi][patchFacei] =
pTraits<Type>::zero;
boundaryCoeffs_[patchi][patchFacei] =
pTraits<Type>::zero;
}
}
}
}
}
template<class Type>
void Foam::fvMatrix<Type>::setValues
(
const unallocLabelList& cellLabels,
const UIndirectList<Type>& values
)
{
this->setValuesFromList(cellLabels, values);
}

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) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -101,6 +101,8 @@ tmp<GeometricField<Type, fvPatchField, volMesh> > operator&
template<class Type>
Ostream& operator<<(Ostream&, const fvMatrix<Type>&);
template<class T> class UIndirectList;
/*---------------------------------------------------------------------------*\
Class fvMatrix Declaration
@ -112,8 +114,6 @@ class fvMatrix
public refCount,
public lduMatrix
{
public:
// Private data
//- Const reference to GeometricField<Type, fvPatchField, volMesh>
@ -139,8 +139,12 @@ public:
mutable GeometricField<Type, fvsPatchField, surfaceMesh>
*faceFluxCorrectionPtr_;
protected:
// Private Member Functions
//- Declare friendship with the fvSolver class
friend class fvSolver;
// Protected Member Functions
//- Add patch contribution to internal field
template<class Type2>
@ -193,12 +197,22 @@ public:
const bool couples=true
) const;
// Matrix manipulation functionality
//- Set solution in given cells to the specified values
template<template<class> class ListType>
void setValuesFromList
(
const unallocLabelList& cells,
const ListType<Type>& values
);
public:
//- Solver class returned by the solver function
// used for systems in which it is useful to cache the solver for reuse
// e.g. if the solver is potentialy expensive to construct (AMG) and can
// e.g. if the solver is potentially expensive to construct (AMG) and can
// be used several times (PISO)
class fvSolver
{
@ -309,12 +323,20 @@ public:
// Operations
//- Set solution in given cells and eliminate corresponding
// equations from the matrix
//- Set solution in given cells to the specified values
// and eliminate the corresponding equations from the matrix.
void setValues
(
const labelList& cells,
const Field<Type>& values
const unallocLabelList& cells,
const UList<Type>& values
);
//- Set solution in given cells to the specified values
// and eliminate the corresponding equations from the matrix.
void setValues
(
const unallocLabelList& cells,
const UIndirectList<Type>& values
);
//- Set reference level for solution

View File

@ -53,7 +53,7 @@ void Foam::MULES::explicitSolve
psi,
phi,
phiPsi,
zero(), zero(),
zeroField(), zeroField(),
psiMax, psiMin
);
}
@ -74,7 +74,7 @@ void Foam::MULES::implicitSolve
psi,
phi,
phiPsi,
zero(), zero(),
zeroField(), zeroField(),
psiMax, psiMin
);
}

View File

@ -107,19 +107,20 @@ void Foam::MULES::explicitSolve
{
psiIf =
(
mesh.Vsc0()*rho.oldTime()*psi0/(deltaT*mesh.Vsc())
+ Su
mesh.Vsc0()().field()*rho.oldTime().field()
*psi0/(deltaT*mesh.Vsc()().field())
+ Su.field()
- psiIf
)/(rho/deltaT - Sp);
)/(rho.field()/deltaT - Sp.field());
}
else
{
psiIf =
(
rho.oldTime()*psi0/deltaT
+ Su
rho.oldTime().field()*psi0/deltaT
+ Su.field()
- psiIf
)/(rho/deltaT - Sp);
)/(rho.field()/deltaT - Sp.field());
}
psi.correctBoundaryConditions();
@ -456,23 +457,32 @@ void Foam::MULES::limiter
tmp<volScalarField::DimensionedInternalField> V0 = mesh.Vsc0();
psiMaxn =
V*((rho/deltaT - Sp)*psiMaxn - Su)
- (V0()/deltaT)*rho.oldTime()*psi0
V*((rho.field()/deltaT - Sp.field())*psiMaxn - Su.field())
- (V0().field()/deltaT)*rho.oldTime().field()*psi0
+ sumPhiBD;
psiMinn =
V*(Su - (rho/deltaT - Sp)*psiMinn)
+ (V0/deltaT)*rho.oldTime()*psi0
V*(Su.field() - (rho.field()/deltaT - Sp.field())*psiMinn)
+ (V0().field()/deltaT)*rho.oldTime().field()*psi0
- sumPhiBD;
}
else
{
psiMaxn =
V*((rho/deltaT - Sp)*psiMaxn - (rho.oldTime()/deltaT)*psi0 - Su)
V
*(
(rho.field()/deltaT - Sp.field())*psiMaxn
- (rho.oldTime().field()/deltaT)*psi0
- Su.field()
)
+ sumPhiBD;
psiMinn =
V*((rho/deltaT)*psi0 - (rho.oldTime()/deltaT - Sp)*psiMinn + Su)
V
*(
(rho.field()/deltaT)*psi0
- (rho.oldTime().field()/deltaT - Sp.field())*psiMinn + Su.field()
)
- sumPhiBD;
}

View File

@ -317,18 +317,15 @@ bool Foam::KinematicParcel<ParcelType>::move(TrackData& td)
case TrackData::tpRotationalTrack:
{
Info<< "No rotational tracking implementation" << endl;
notImplemented("TrackData::tpRotationalTrack");
break;
}
default:
{
FatalErrorIn
(
"KinematicParcel<ParcelType>::move(TrackData& td)"
) << td.part()
<< " is an invalid part of the tracking method."
FatalErrorIn("KinematicParcel<ParcelType>::move(TrackData& td)")
<< td.part() << " is an invalid part of the tracking method."
<< abort(FatalError);
}
}

View File

@ -62,6 +62,7 @@ class polyLine
//- Disallow default bitwise assignment
void operator=(const polyLine&);
protected:
// Protected data
@ -75,17 +76,18 @@ protected:
//- The rational (0-1) cumulative parameter value for each point
scalarList param_;
// Protected Member Functions
//- Precalculate the rational cumulative parameter value
// and the line-length
void calcParam();
//- Return the line segment and the local parameter [0..1]
// corresponding to the global lambda [0..1]
label localParameter(scalar& lambda) const;
public:
// Constructors

View File

@ -103,7 +103,7 @@ void Foam::writeRegisteredObject::write()
(
"Foam::writeRegisteredObject::read(const dictionary&)"
) << "Object " << objectNames_[i] << " not found in "
<< "database. Available objects are:" << nl << obr_.toc()
<< "database. Available objects:" << nl << obr_.sortedToc()
<< endl;
}

View File

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile

View File

@ -0,0 +1,75 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application XXX;
startFrom latestTime;
startTime 0;
stopAt endTime;
endTime 0.1;
deltaT 1e-05;
writeControl timeStep;
writeInterval 10;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
functions
{
minMax
{
// Type of functionObject
type fieldMinMax;
// Where to load it from (if not already in solver)
functionObjectLibs ("libfieldAverage.so");
// Function object enabled flag
enabled true;
// Log to output (default: false)
log false;
// Write information to file (default: true)
write true;
// Fields to be monitored - runTime modifiable
fields
(
U
p
);
}
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -59,6 +59,7 @@ Foam::fieldMinMax::fieldMinMax
name_(name),
obr_(obr),
active_(true),
write_(true),
log_(false),
mode_(mdMag),
fieldSet_(),
@ -92,9 +93,10 @@ void Foam::fieldMinMax::read(const dictionary& dict)
{
if (active_)
{
write_ = dict.lookupOrDefault<Switch>("write", true);
log_ = dict.lookupOrDefault<Switch>("log", false);
mode_ = modeTypeNames_[dict.lookup("mode")];
mode_ = modeTypeNames_[dict.lookupOrDefault<word>("mode", "magnitude")];
dict.lookup("fields") >> fieldSet_;
}
}
@ -171,7 +173,10 @@ void Foam::fieldMinMax::write()
if (active_)
{
// Create the fieldMinMax file if not already created
makeFile();
if (write_)
{
makeFile();
}
forAll(fieldSet_, fieldI)
{
@ -195,13 +200,17 @@ void Foam::fieldMinMax::calcMinMaxFields<Foam::scalar>
{
const volScalarField& field =
obr_.lookupObject<volScalarField>(fieldName);
scalar minValue = min(field).value();
scalar maxValue = max(field).value();
const scalar minValue = min(field).value();
const scalar maxValue = max(field).value();
if (Pstream::master())
{
fieldMinMaxFilePtr_() << obr_.time().value() << tab
<< fieldName << tab << minValue << tab << maxValue << endl;
if (write_)
{
fieldMinMaxFilePtr_()
<< obr_.time().value() << tab
<< fieldName << tab << minValue << tab << maxValue << endl;
}
if (log_)
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -74,11 +74,13 @@ public:
mdCmpt
};
protected:
// Protected data
//- Mode type names
static const NamedEnum<modeType, 2> modeTypeNames_;
//- Name of this set of field min/max.
// Also used as the name of the output directory.
word name_;
@ -88,11 +90,11 @@ protected:
//- on/off switch
bool active_;
//- Switch to send output to Info as well as to file
Switch log_;
//- Switch to enable/disable writing to file
Switch write_;
//- Mode type names
static const NamedEnum<modeType, 2> modeTypeNames_;
//- Switch to send output to Info as well
Switch log_;
//- Mode for min/max - only applicable for ranks > 0
modeType mode_;
@ -100,7 +102,6 @@ protected:
//- Fields to assess min/max
wordList fieldSet_;
//- Min/max file ptr
autoPtr<OFstream> fieldMinMaxFilePtr_;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -42,14 +42,18 @@ void Foam::fieldMinMax::calcMinMaxFields(const word& fieldName)
{
case mdMag:
{
scalar minValue = min(mag(field)).value();
scalar maxValue = max(mag(field)).value();
const scalar minValue = min(mag(field)).value();
const scalar maxValue = max(mag(field)).value();
if (Pstream::master())
{
fieldMinMaxFilePtr_() << obr_.time().value() << tab
<< fieldName << tab << minValue << tab << maxValue
<< endl;
if (write_)
{
fieldMinMaxFilePtr_()
<< obr_.time().value() << tab
<< fieldName << tab << minValue << tab << maxValue
<< endl;
}
if (log_)
{
@ -65,14 +69,18 @@ void Foam::fieldMinMax::calcMinMaxFields(const word& fieldName)
}
case mdCmpt:
{
Type minValue = min(field).value();
Type maxValue = max(field).value();
const Type minValue = min(field).value();
const Type maxValue = max(field).value();
if (Pstream::master())
{
fieldMinMaxFilePtr_() << obr_.time().value() << tab
<< fieldName << tab << minValue << tab << maxValue
<< endl;
if (write_)
{
fieldMinMaxFilePtr_()
<< obr_.time().value() << tab
<< fieldName << tab << minValue << tab << maxValue
<< endl;
}
if (log_)
{

View File

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile

View File

@ -61,7 +61,7 @@ protected:
// Protected data
//- Name of this fieldValue object
//- Name of this fieldValue object
word name_;
//- Database this class is registered to

View File

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile

View File

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile

View File

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile

View File

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile

View File

@ -508,10 +508,7 @@ Foam::ODEChemistryModel<CompType, ThermoType>::tc() const
{
const Reaction<ThermoType>& R = reactions_[i];
omega
(
R, c, Ti, pi, pf, cf, lRef, pr, cr, rRef
);
omega(R, c, Ti, pi, pf, cf, lRef, pr, cr, rRef);
forAll(R.rhs(), s)
{

View File

@ -91,7 +91,7 @@ protected:
//- Chemistry solver
autoPtr<chemistrySolver<CompType, ThermoType> > solver_;
//- Chemical source term [kg/m3/s]
//- List of reaction rate per specie [kg/m3/s]
PtrList<scalarField> RR_;

View File

@ -61,10 +61,11 @@ DeardorffDiffStress::DeardorffDiffStress
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName
const word& turbulenceModelName,
const word& modelName
)
:
LESModel(typeName, rho, U, phi, thermoPhysicalModel, turbulenceModelName),
LESModel(modelName, rho, U, phi, thermoPhysicalModel, turbulenceModelName),
GenSGSStress(rho, U, phi, thermoPhysicalModel),
ck_

View File

@ -102,7 +102,8 @@ public:
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
);

View File

@ -34,6 +34,11 @@ namespace compressible
namespace LESModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameWithName(GenEddyVisc, "GenEddyVisc");
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
GenEddyVisc::GenEddyVisc
@ -42,18 +47,11 @@ GenEddyVisc::GenEddyVisc
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName
const word& turbulenceModelName,
const word& modelName
)
:
LESModel
(
word("GenEddyVisc"),
rho,
U,
phi,
thermoPhysicalModel,
turbulenceModelName
),
LESModel(modelName, rho, U, phi, thermoPhysicalModel, turbulenceModelName),
ce_
(

View File

@ -82,6 +82,9 @@ protected:
public:
//- Partial Runtime type information
static const word typeName;
// Constructors
//- Construct from components
@ -91,7 +94,8 @@ public:
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
);

View File

@ -34,6 +34,11 @@ namespace compressible
namespace LESModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameWithName(GenSGSStress, "GenSGSStress");
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
GenSGSStress::GenSGSStress
@ -42,18 +47,11 @@ GenSGSStress::GenSGSStress
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName
const word& turbulenceModelName,
const word& modelName
)
:
LESModel
(
word("GenSGSStress"),
rho,
U,
phi,
thermoPhysicalModel,
turbulenceModelName
),
LESModel(modelName, rho, U, phi, thermoPhysicalModel, turbulenceModelName),
ce_
(

View File

@ -82,6 +82,9 @@ protected:
public:
//- Partial Runtime type information
static const word typeName;
// Constructors
//- Constructor from components
@ -91,7 +94,8 @@ public:
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
);

View File

@ -69,10 +69,11 @@ Smagorinsky::Smagorinsky
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName
const word& turbulenceModelName,
const word& modelName
)
:
LESModel(typeName, rho, U, phi, thermoPhysicalModel, turbulenceModelName),
LESModel(modelName, rho, U, phi, thermoPhysicalModel, turbulenceModelName),
GenEddyVisc(rho, U, phi, thermoPhysicalModel),
ck_

View File

@ -97,7 +97,8 @@ public:
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
);

View File

@ -107,10 +107,11 @@ SpalartAllmaras::SpalartAllmaras
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName
const word& turbulenceModelName,
const word& modelName
)
:
LESModel(typeName, rho, U, phi, thermoPhysicalModel, turbulenceModelName),
LESModel(modelName, rho, U, phi, thermoPhysicalModel, turbulenceModelName),
sigmaNut_
(

View File

@ -112,7 +112,8 @@ public:
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
);

View File

@ -91,10 +91,11 @@ dynOneEqEddy::dynOneEqEddy
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName
const word& turbulenceModelName,
const word& modelName
)
:
LESModel(typeName, rho, U, phi, thermoPhysicalModel, turbulenceModelName),
LESModel(modelName, rho, U, phi, thermoPhysicalModel, turbulenceModelName),
GenEddyVisc(rho, U, phi, thermoPhysicalModel),
filterPtr_(LESfilter::New(U.mesh(), coeffDict())),

View File

@ -108,7 +108,8 @@ public:
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
);

View File

@ -64,10 +64,11 @@ lowReOneEqEddy::lowReOneEqEddy
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName
const word& turbulenceModelName,
const word& modelName
)
:
LESModel(typeName, rho, U, phi, thermoPhysicalModel, turbulenceModelName),
LESModel(modelName, rho, U, phi, thermoPhysicalModel, turbulenceModelName),
GenEddyVisc(rho, U, phi, thermoPhysicalModel),
ck_

View File

@ -99,7 +99,8 @@ public:
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
);

View File

@ -60,10 +60,11 @@ oneEqEddy::oneEqEddy
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName
const word& turbulenceModelName,
const word& modelName
)
:
LESModel(typeName, rho, U, phi, thermoPhysicalModel, turbulenceModelName),
LESModel(modelName, rho, U, phi, thermoPhysicalModel, turbulenceModelName),
GenEddyVisc(rho, U, phi, thermoPhysicalModel),
ck_

View File

@ -102,7 +102,8 @@ public:
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
);

View File

@ -51,10 +51,11 @@ LRR::LRR
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel,
const word& turbulenceModelName
const word& turbulenceModelName,
const word& modelName
)
:
RASModel(typeName, rho, U, phi, thermophysicalModel, turbulenceModelName),
RASModel(modelName, rho, U, phi, thermophysicalModel, turbulenceModelName),
Cmu_
(
@ -342,7 +343,7 @@ void LRR::correct()
volSymmTensorField P = -twoSymm(R_ & fvc::grad(U_));
volScalarField G("RASModel::G", 0.5*mag(tr(P)));
// Update espsilon and G at the wall
// Update epsilon and G at the wall
epsilon_.boundaryField().updateCoeffs();
// Dissipation equation

View File

@ -73,7 +73,10 @@ class LRR
:
public RASModel
{
// Private data
protected:
// Protected data
// Model coefficients
@ -117,7 +120,8 @@ public:
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
);

View File

@ -51,10 +51,11 @@ LaunderGibsonRSTM::LaunderGibsonRSTM
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel,
const word& turbulenceModelName
const word& turbulenceModelName,
const word& modelName
)
:
RASModel(typeName, rho, U, phi, thermophysicalModel, turbulenceModelName),
RASModel(modelName, rho, U, phi, thermophysicalModel, turbulenceModelName),
Cmu_
(
@ -380,7 +381,7 @@ void LaunderGibsonRSTM::correct()
volSymmTensorField P = -twoSymm(R_ & fvc::grad(U_));
volScalarField G("RASModel::G", 0.5*mag(tr(P)));
// Update espsilon and G at the wall
// Update epsilon and G at the wall
epsilon_.boundaryField().updateCoeffs();
// Dissipation equation

View File

@ -76,7 +76,10 @@ class LaunderGibsonRSTM
:
public RASModel
{
// Private data
protected:
// Protected data
// Model coefficients
@ -126,7 +129,8 @@ public:
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
);

View File

@ -66,10 +66,11 @@ LaunderSharmaKE::LaunderSharmaKE
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel,
const word& turbulenceModelName
const word& turbulenceModelName,
const word& modelName
)
:
RASModel(typeName, rho, U, phi, thermophysicalModel, turbulenceModelName),
RASModel(modelName, rho, U, phi, thermophysicalModel, turbulenceModelName),
Cmu_
(

View File

@ -69,7 +69,10 @@ class LaunderSharmaKE
:
public RASModel
{
// Private data
protected:
// Protected data
// Model coefficients
@ -110,7 +113,8 @@ public:
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
);

View File

@ -50,10 +50,11 @@ RNGkEpsilon::RNGkEpsilon
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel,
const word& turbulenceModelName
const word& turbulenceModelName,
const word& modelName
)
:
RASModel(typeName, rho, U, phi, thermophysicalModel, turbulenceModelName),
RASModel(modelName, rho, U, phi, thermophysicalModel, turbulenceModelName),
Cmu_
(
@ -310,7 +311,7 @@ void RNGkEpsilon::correct()
volScalarField R =
((eta*(-eta/eta0_ + scalar(1)))/(beta_*eta3 + scalar(1)));
// Update espsilon and G at the wall
// Update epsilon and G at the wall
epsilon_.boundaryField().updateCoeffs();
// Dissipation equation

View File

@ -70,7 +70,10 @@ class RNGkEpsilon
:
public RASModel
{
// Private data
protected:
// Protected data
// Model coefficients
@ -106,7 +109,8 @@ public:
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
);

View File

@ -110,10 +110,11 @@ SpalartAllmaras::SpalartAllmaras
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel,
const word& turbulenceModelName
const word& turbulenceModelName,
const word& modelName
)
:
RASModel(typeName, rho, U, phi, thermophysicalModel, turbulenceModelName),
RASModel(modelName, rho, U, phi, thermophysicalModel, turbulenceModelName),
sigmaNut_
(

View File

@ -87,7 +87,10 @@ class SpalartAllmaras
:
public RASModel
{
// Private data
protected:
// Protected data
// Model coefficients
@ -115,7 +118,7 @@ class SpalartAllmaras
wallDist d_;
// Private Member Functions
// Protected Member Functions
tmp<volScalarField> chi() const;
tmp<volScalarField> fv1(const volScalarField& chi) const;
@ -147,7 +150,8 @@ public:
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
);

View File

@ -50,10 +50,11 @@ kEpsilon::kEpsilon
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel,
const word& turbulenceModelName
const word& turbulenceModelName,
const word& modelName
)
:
RASModel(typeName, rho, U, phi, thermophysicalModel, turbulenceModelName),
RASModel(modelName, rho, U, phi, thermophysicalModel, turbulenceModelName),
Cmu_
(
@ -283,7 +284,7 @@ void kEpsilon::correct()
volScalarField G("RASModel::G", mut_*(tgradU() && dev(twoSymm(tgradU()))));
tgradU.clear();
// Update espsilon and G at the wall
// Update epsilon and G at the wall
epsilon_.boundaryField().updateCoeffs();
// Dissipation equation

View File

@ -68,7 +68,10 @@ class kEpsilon
:
public RASModel
{
// Private data
protected:
// Protected data
// Model coefficients
@ -102,7 +105,8 @@ public:
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
);

View File

@ -93,10 +93,11 @@ kOmegaSST::kOmegaSST
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel,
const word& turbulenceModelName
const word& turbulenceModelName,
const word& modelName
)
:
RASModel(typeName, rho, U, phi, thermophysicalModel, turbulenceModelName),
RASModel(modelName, rho, U, phi, thermophysicalModel, turbulenceModelName),
alphaK1_
(

Some files were not shown because too many files have changed in this diff Show More