Merge branch 'master' into cvm

This commit is contained in:
graham
2011-06-30 10:21:18 +01:00
64 changed files with 2297 additions and 124 deletions

View File

@ -160,6 +160,7 @@ $(dictionaryEntry)/dictionaryEntry.C
$(dictionaryEntry)/dictionaryEntryIO.C
functionEntries = $(dictionary)/functionEntries
$(functionEntries)/calcEntry/calcEntry.C
$(functionEntries)/codeStream/codeStream.C
$(functionEntries)/functionEntry/functionEntry.C
$(functionEntries)/includeEntry/includeEntry.C

View File

@ -0,0 +1,99 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "calcEntry.H"
#include "addToMemberFunctionSelectionTable.H"
#include "dictionary.H"
#include "dynamicCode.H"
#include "codeStream.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace functionEntries
{
defineTypeNameAndDebug(calcEntry, 0);
addToMemberFunctionSelectionTable
(
functionEntry,
calcEntry,
execute,
primitiveEntryIstream
);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionEntries::calcEntry::execute
(
const dictionary& parentDict,
primitiveEntry& thisEntry,
Istream& is
)
{
Info<< "Using #calcEntry at line " << is.lineNumber()
<< " in file " << parentDict.name() << endl;
dynamicCode::checkSecurity
(
"functionEntries::calcEntry::execute(..)",
parentDict
);
// Read string
string s(is);
// Make sure we stop this entry
//is.putBack(token(token::END_STATEMENT, is.lineNumber()));
// Construct codeDict for codeStream
// must reference parent for stringOps::expand to work nicely.
dictionary codeSubDict;
codeSubDict.add("code", "os << (" + s + ");");
dictionary codeDict(parentDict, codeSubDict);
codeStream::streamingFunctionType function = codeStream::getFunction
(
parentDict,
codeDict
);
// use function to write stream
OStringStream os(is.format());
(*function)(os, parentDict);
// get the entry from this stream
IStringStream resultStream(os.str());
thisEntry.read(parentDict, resultStream);
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,111 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::functionEntries::calcEntry
Description
Uses dynamic compilation to provide calculating functionality
for entering dictionary entries.
E.g.
\verbatim
a 1.0;
b 3;
c #calc "$a/$b";
\endverbatim
Note the explicit trailing 0 ('1.0') to force a to be read (and written)
as a floating point number.
Note
Internally this is just a wrapper around codeStream functionality - the
#calc string gets used to construct a dictionary for codeStream.
SourceFiles
calcEntry.C
\*---------------------------------------------------------------------------*/
#ifndef calcEntry_H
#define calcEntry_H
#include "functionEntry.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class dlLibraryTable;
namespace functionEntries
{
/*---------------------------------------------------------------------------*\
Class calcEntry Declaration
\*---------------------------------------------------------------------------*/
class calcEntry
:
public functionEntry
{
// Private Member Functions
//- Disallow default bitwise copy construct
calcEntry(const calcEntry&);
//- Disallow default bitwise assignment
void operator=(const calcEntry&);
public:
//- Runtime type information
ClassName("calc");
// Member Functions
//- Execute the functionEntry in a sub-dict context
static bool execute
(
const dictionary& parentDict,
primitiveEntry&,
Istream&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionEntries
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -92,28 +92,13 @@ Foam::dlLibraryTable& Foam::functionEntries::codeStream::libs
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionEntries::codeStream::execute
Foam::functionEntries::codeStream::streamingFunctionType
Foam::functionEntries::codeStream::getFunction
(
const dictionary& parentDict,
primitiveEntry& entry,
Istream& is
const dictionary& codeDict
)
{
Info<< "Using #codeStream at line " << is.lineNumber()
<< " in file " << parentDict.name() << endl;
dynamicCode::checkSecurity
(
"functionEntries::codeStream::execute(..)",
parentDict
);
// get code dictionary
// must reference parent for stringOps::expand to work nicely
dictionary codeDict("#codeStream", parentDict, is);
// get code, codeInclude, codeOptions
dynamicCodeContext context(codeDict);
@ -260,6 +245,34 @@ bool Foam::functionEntries::codeStream::execute
<< " in library " << lib << exit(FatalIOError);
}
return function;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionEntries::codeStream::execute
(
const dictionary& parentDict,
primitiveEntry& entry,
Istream& is
)
{
Info<< "Using #codeStream at line " << is.lineNumber()
<< " in file " << parentDict.name() << endl;
dynamicCode::checkSecurity
(
"functionEntries::codeStream::execute(..)",
parentDict
);
// get code dictionary
// must reference parent for stringOps::expand to work nicely
dictionary codeDict("#codeStream", parentDict, is);
streamingFunctionType function = getFunction(parentDict, codeDict);
// use function to write stream
OStringStream os(is.format());
(*function)(os, parentDict);
@ -268,6 +281,7 @@ bool Foam::functionEntries::codeStream::execute
IStringStream resultStream(os.str());
entry.read(parentDict, resultStream);
return true;
}

View File

@ -103,6 +103,9 @@ class dlLibraryTable;
namespace functionEntries
{
// Forward declaration of friend classes
class calcEntry;
/*---------------------------------------------------------------------------*\
Class codeStream Declaration
\*---------------------------------------------------------------------------*/
@ -123,6 +126,14 @@ class codeStream
//- Helper function: access to dlLibraryTable of Time
static dlLibraryTable& libs(const dictionary& dict);
//- Construct, compile, load and return streaming function
static streamingFunctionType getFunction
(
const dictionary& parentDict,
const dictionary& codeDict
);
//- Disallow default bitwise copy construct
codeStream(const codeStream&);
@ -137,6 +148,11 @@ public:
//- Name of the C code template to be used
static const word codeTemplateC;
// Related types
//- Declare friendship with the calcEntry class
friend class calcEntry;
//- Runtime type information
ClassName("codeStream");

View File

@ -66,7 +66,7 @@ bool Foam::matchPoints
scalar matchDist = matchDistances[face0I];
label startI = findLower(pts1MagSqr, 0.99999*dist0 - matchDist);
label startI = findLower(pts1MagSqr, 0.99999*dist0 - 2*matchDist);
if (startI == -1)
{
@ -83,7 +83,7 @@ bool Foam::matchPoints
label j = startI;
(
(j < pts1MagSqr.size())
&& (pts1MagSqr[j] < 1.00001*dist0 + matchDist)
&& (pts1MagSqr[j] < 1.00001*dist0 + 2*matchDist)
);
j++
)
@ -117,7 +117,7 @@ bool Foam::matchPoints
label j = startI;
(
(j < pts1MagSqr.size())
&& (pts1MagSqr[j] < 1.00001*dist0 + matchDist)
&& (pts1MagSqr[j] < 1.00001*dist0 + 2*matchDist)
);
j++
)

View File

@ -328,6 +328,10 @@ Foam::string& Foam::stringOps::inplaceExpand
if (ePtr)
{
OStringStream buf;
// Force floating point numbers to be printed with at least
// some decimal digits.
buf << fixed;
buf.precision(IOstream::defaultPrecision());
if (ePtr->isDict())
{
ePtr->dict().write(buf, false);

View File

@ -1,3 +0,0 @@
EXE_INC =
EXE_LIBS =

View File

@ -369,6 +369,7 @@ $(SRF)/SRFModel/SRFModel/SRFModel.C
$(SRF)/SRFModel/SRFModel/SRFModelNew.C
$(SRF)/SRFModel/rpm/rpm.C
$(SRF)/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C
$(SRF)/derivedFvPatchFields/SRFFreestreamVelocityFvPatchVectorField/SRFFreestreamVelocityFvPatchVectorField.C
fieldSources = $(general)/fieldSources
$(fieldSources)/pressureGradientExplicitSource/pressureGradientExplicitSource.C

View File

@ -0,0 +1,146 @@
/*---------------------------------------------------------------------------* \
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "SRFFreestreamVelocityFvPatchVectorField.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "SRFModel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::SRFFreestreamVelocityFvPatchVectorField::
SRFFreestreamVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
)
:
inletOutletFvPatchVectorField(p, iF),
UInf_(vector::zero)
{}
Foam::SRFFreestreamVelocityFvPatchVectorField::
SRFFreestreamVelocityFvPatchVectorField
(
const SRFFreestreamVelocityFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
inletOutletFvPatchVectorField(ptf, p, iF, mapper),
UInf_(ptf.UInf_)
{}
Foam::SRFFreestreamVelocityFvPatchVectorField::
SRFFreestreamVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const dictionary& dict
)
:
inletOutletFvPatchVectorField(p, iF),
UInf_(dict.lookup("UInf"))
{
fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
}
Foam::SRFFreestreamVelocityFvPatchVectorField::
SRFFreestreamVelocityFvPatchVectorField
(
const SRFFreestreamVelocityFvPatchVectorField& srfvpvf
)
:
inletOutletFvPatchVectorField(srfvpvf),
UInf_(srfvpvf.UInf_)
{}
Foam::SRFFreestreamVelocityFvPatchVectorField::
SRFFreestreamVelocityFvPatchVectorField
(
const SRFFreestreamVelocityFvPatchVectorField& srfvpvf,
const DimensionedField<vector, volMesh>& iF
)
:
inletOutletFvPatchVectorField(srfvpvf, iF),
UInf_(srfvpvf.UInf_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::SRFFreestreamVelocityFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}
// Get reference to the SRF model
const SRF::SRFModel& srf =
db().lookupObject<SRF::SRFModel>("SRFProperties");
scalar time = this->db().time().value();
scalar theta = time*mag(srf.omega().value());
refValue() =
cos(theta)*UInf_ + sin(theta)*(srf.axis() ^ UInf_)
- srf.velocity(patch().Cf());
// Set the inlet-outlet choice based on the direction of the freestream
valueFraction() = 1.0 - pos(refValue() & patch().Sf());
mixedFvPatchField<vector>::updateCoeffs();
}
void Foam::SRFFreestreamVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
os.writeKeyword("UInf") << UInf_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchVectorField,
SRFFreestreamVelocityFvPatchVectorField
);
}
// ************************************************************************* //

View File

@ -0,0 +1,164 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::SRFVelocityFvPatchVectorField
Description
Freestream velocity patch to be used with SRF model
to apply the appropriate rotation transformation in time and space.
SourceFiles
SRFVelocityFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef SRFFreestreamVelocityFvPatchVectorField_H
#define SRFFreestreamVelocityFvPatchVectorField_H
#include "inletOutletFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class SRFFreestreamVelocityFvPatchVectorField Declaration
\*---------------------------------------------------------------------------*/
class SRFFreestreamVelocityFvPatchVectorField
:
public inletOutletFvPatchVectorField
{
// Private data
//- Velocity of the free stream in the absolute frame
vector UInf_;
public:
//- Runtime type information
TypeName("SRFFreestreamVelocity");
// Constructors
//- Construct from patch and internal field
SRFFreestreamVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
SRFFreestreamVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const dictionary&
);
//- Construct by mapping given SRFFreestreamVelocityFvPatchVectorField
// onto a new patch
SRFFreestreamVelocityFvPatchVectorField
(
const SRFFreestreamVelocityFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
SRFFreestreamVelocityFvPatchVectorField
(
const SRFFreestreamVelocityFvPatchVectorField&
);
//- Construct and return a clone
virtual tmp<fvPatchVectorField> clone() const
{
return tmp<fvPatchVectorField>
(
new SRFFreestreamVelocityFvPatchVectorField(*this)
);
}
//- Construct as copy setting internal field reference
SRFFreestreamVelocityFvPatchVectorField
(
const SRFFreestreamVelocityFvPatchVectorField&,
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 SRFFreestreamVelocityFvPatchVectorField(*this, iF)
);
}
// Member functions
// Access
//- Return the velocity at infinity
const vector& UInf() const
{
return UInf_;
}
//- Return reference to the velocity at infinity to allow adjustment
vector& UInf()
{
return UInf_;
}
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -5,7 +5,7 @@ EXE_INC = \
-I$(LIB_SRC)/lagrangian/molecularDynamics/potential/lnInclude \
-I$(LIB_SRC)/lagrangian/molecularDynamics/molecularMeasurements/lnInclude
EXE_LIBS = \
LIB_LIBS = \
-lfiniteVolume \
-lmeshTools \
-llagrangian \

View File

@ -763,7 +763,6 @@ void Foam::triSurfaceMesh::findLineAll
// we need something bigger since we're doing calculations)
// - if the start-end vector is zero we still progress
const vectorField dirVec(end-start);
const scalarField magSqrDirVec(magSqr(dirVec));
const vectorField smallVec
(
indexedOctree<treeDataTriSurface>::perturbTol()*dirVec

View File

@ -1,5 +1,5 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
LIB_LIBS = \
-lfiniteVolume

View File

@ -1,5 +1,5 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
LIB_LIBS = \
-lfiniteVolume

View File

@ -1,4 +1,3 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
@ -16,10 +15,10 @@ EXE_INC = \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude
EXE_LIBS = \
LIB_LIBS = \
-lregionModels \
-lsolidChemistryModel \
-lsolidThermo \
-lbasicSolidThermo \
-lfiniteVolume \
-lmeshTools \
-lcompressibleLESModels

View File

@ -1,4 +1,3 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
@ -18,8 +17,7 @@ EXE_INC = \
-I$(LIB_SRC)/regionModels/pyrolysisModels/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
EXE_LIBS = \
LIB_LIBS = \
-lregionModels \
-lpyrolysisModels \
-lsurfaceFilmModels \

View File

@ -2,6 +2,6 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
LIB_LIBS = \
-lfiniteVolume \
-lmeshTools

View File

@ -15,9 +15,9 @@ EXE_INC = \
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude
EXE_LIBS = \
LIB_LIBS = \
-lregionModels \
-lSLGThermoNew \
-lSLGThermo \
-lfiniteVolume \
-lmeshTools \
-ldistributionModels \

View File

@ -8,8 +8,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude
EXE_LIBS = \
LIB_LIBS = \
-lregionModels \
-lbasicSolidThermo \
-lfiniteVolume \

View File

@ -1,5 +1,5 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
LIB_LIBS = \
-lfiniteVolume

View File

@ -100,6 +100,7 @@ void Foam::interfaceProperties::correctContactAngle
nHatp /= (mag(nHatp) + deltaN_.value());
acap.gradient() = (nf & nHatp)*mag(gradAlphaf[patchi]);
acap.evaluate();
}
}
}

View File

@ -25,14 +25,23 @@ Class
Foam::incompressible::LESModels::kOmegaSSTSAS
Description
kOmegaSSTSAS LES turbulence model for incompressible flows
kOmegaSSTSAS LES turbulence model for incompressible flows
based on:
"Evaluation of the SST-SAS model: channel flow, asymmetric diffuser
and axi-symmetric hill".
European Conference on Computational Fluid Dynamics ECCOMAS CFD 2006.
Lars Davidson
The first term of the Qsas expression is corrected following:
DESider A European Effort on Hybrid RANS-LES Modelling:
Results of the European-Union Funded Project, 2004 - 2007
(Notes on Numerical Fluid Mechanics and Multidisciplinary Design).
Chapter 8 Formulation of the Scale-Adaptive Simulation (SAS) Model during
the DESIDER Project. Published in Springer-Verlag Berlin Heidelberg 2009.
Chapter 2, section 8 Formulation of the Scale-Adaptive Simulation (SAS)
Model during the DESIDER Project. Published in Springer-Verlag Berlin
Heidelberg 2009.
F. R. Menter and Y. Egorov.
SourceFiles