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

This commit is contained in:
mattijs
2012-09-26 12:09:03 +01:00
81 changed files with 2767 additions and 1625 deletions

View File

@ -59,7 +59,6 @@ int main(int argc, char *argv[])
pimpleControl pimple(mesh);
#include "readTimeControls.H"
#include "readAdditionalSolutionControls.H"
#include "createFields.H"
#include "createRDeltaT.H"
#include "createRadiationModel.H"
@ -74,7 +73,6 @@ int main(int argc, char *argv[])
while (runTime.run())
{
#include "readAdditionalSolutionControls.H"
#include "readTimeControls.H"
runTime++;

View File

@ -9,11 +9,9 @@ tmp<fv::convectionScheme<scalar> > mvConvection
)
);
{
combustion->correct();
dQ = combustion->dQ();
if (solveSpecies)
{
label inertIndex = -1;
volScalarField Yt(0.0*Y[0]);

View File

@ -78,7 +78,6 @@ int main(int argc, char *argv[])
while (runTime.run())
{
#include "readTimeControls.H"
#include "readAdditionalSolutionControls.H"
#include "compressibleCourantNo.H"
#include "setDeltaT.H"

View File

@ -1,4 +0,0 @@
dictionary additional = mesh.solutionDict().subDict("additional");
// flag to activate solve transport for each specie (Y vector)
bool solveSpecies = additional.lookupOrDefault("solveSpecies", true);

View File

@ -60,7 +60,6 @@ int main(int argc, char *argv[])
#include "startSummary.H"
pimpleControl pimple(mesh);
bool solveSpecies = true;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -57,7 +57,6 @@ int main(int argc, char *argv[])
#include "setInitialDeltaT.H"
pimpleControl pimple(mesh);
bool solveSpecies = true;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -151,15 +151,17 @@ setenv FOAM_LIBBIN $WM_PROJECT_DIR/platforms/$WM_OPTIONS/lib
# external (ThirdParty) libraries
setenv FOAM_EXT_LIBBIN $WM_THIRD_PARTY_DIR/platforms/$WM_OPTIONS/lib
# site-specific directory
if ( $?WM_PROJECT_SITE ) then
set siteDir=$WM_PROJECT_SITE
else
set siteDir=$WM_PROJECT_INST_DIR/site
endif
# shared site executables/libraries
# similar naming convention as ~OpenFOAM expansion
if ( $?WM_PROJECT_SITE ) then
setenv FOAM_SITE_APPBIN $WM_PROJECT_SITE/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
setenv FOAM_SITE_LIBBIN $WM_PROJECT_SITE/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
else
setenv FOAM_SITE_APPBIN $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
setenv FOAM_SITE_LIBBIN $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
endif
setenv FOAM_SITE_APPBIN $siteDir/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
setenv FOAM_SITE_LIBBIN $siteDir/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
# user executables/libraries
setenv FOAM_USER_APPBIN $WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/bin
@ -182,6 +184,15 @@ if ( -d "${WM_DIR}" ) setenv PATH ${WM_DIR}:${PATH}
# add OpenFOAM scripts to the path
setenv PATH ${WM_PROJECT_DIR}/bin:${PATH}
# add site-specific scripts to path - only if they exist
if ( -d "$siteDir/bin" ) then # generic
_foamAddPath "$siteDir/bin"
endif
if ( -d "$siteDir/$WM_PROJECT_VERSION/bin" ) then # version-specific
_foamAddPath "$siteDir/$WM_PROJECT_VERSION/bin"
endif
unset siteDir
_foamAddPath ${FOAM_USER_APPBIN}:${FOAM_SITE_APPBIN}:${FOAM_APPBIN}
# Make sure to pick up dummy versions of external libraries last
_foamAddLib ${FOAM_USER_LIBBIN}:${FOAM_SITE_LIBBIN}:${FOAM_LIBBIN}:${FOAM_EXT_LIBBIN}:${FOAM_LIBBIN}/dummy

View File

@ -179,16 +179,13 @@ export FOAM_LIBBIN=$WM_PROJECT_DIR/platforms/$WM_OPTIONS/lib
# external (ThirdParty) libraries
export FOAM_EXT_LIBBIN=$WM_THIRD_PARTY_DIR/platforms/$WM_OPTIONS/lib
# site-specific directory
siteDir="${WM_PROJECT_SITE:-$WM_PROJECT_INST_DIR/site}"
# shared site executables/libraries
# similar naming convention as ~OpenFOAM expansion
if [ -n "$WM_PROJECT_SITE" ]
then
export FOAM_SITE_APPBIN=$WM_PROJECT_SITE/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
export FOAM_SITE_LIBBIN=$WM_PROJECT_SITE/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
else
export FOAM_SITE_APPBIN=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
export FOAM_SITE_LIBBIN=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
fi
export FOAM_SITE_APPBIN=$siteDir/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
export FOAM_SITE_LIBBIN=$siteDir/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
# user executables/libraries
export FOAM_USER_APPBIN=$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/bin
@ -211,6 +208,17 @@ export FOAM_RUN=$WM_PROJECT_USER_DIR/run
# add OpenFOAM scripts to the path
export PATH=$WM_PROJECT_DIR/bin:$PATH
# add site-specific scripts to path - only if they exist
if [ -d "$siteDir/bin" ] # generic
then
_foamAddPath "$siteDir/bin"
fi
if [ -d "$siteDir/$WM_PROJECT_VERSION/bin" ] # version-specific
then
_foamAddPath "$siteDir/$WM_PROJECT_VERSION/bin"
fi
unset siteDir
_foamAddPath $FOAM_USER_APPBIN:$FOAM_SITE_APPBIN:$FOAM_APPBIN
# Make sure to pick up dummy versions of external libraries last
_foamAddLib $FOAM_USER_LIBBIN:$FOAM_SITE_LIBBIN:$FOAM_LIBBIN:$FOAM_EXT_LIBBIN:$FOAM_LIBBIN/dummy
@ -232,6 +240,12 @@ fi
case "${foamCompiler}" in
OpenFOAM | ThirdParty)
case "$WM_COMPILER" in
Gcc463)
gcc_version=gcc-4.6.3
gmp_version=gmp-5.0.2
mpfr_version=mpfr-3.0.1
mpc_version=mpc-0.9
;;
Gcc | Gcc++0x | Gcc46 | Gcc46++0x)
gcc_version=gcc-4.6.1
gmp_version=gmp-5.0.4

View File

@ -67,7 +67,6 @@ turbulenceModels/Allwmake $*
wmake $makeType combustionModels
regionModels/Allwmake $*
lagrangian/Allwmake $*
postProcessing/Allwmake $*
mesh/Allwmake $*
fvAgglomerationMethods/Allwmake $*
@ -77,4 +76,6 @@ wmake $makeType engine
wmake $makeType fieldSources
postProcessing/Allwmake $*
# ----------------------------------------------------------------- end-of-file

View File

@ -62,6 +62,22 @@ Foam::basicSourceList::basicSourceList
PtrList<basicSource>(),
mesh_(mesh),
checkTimeIndex_(mesh_.time().startTimeIndex() + 2)
{
reset(dict);
}
Foam::basicSourceList::basicSourceList(const fvMesh& mesh)
:
PtrList<basicSource>(),
mesh_(mesh),
checkTimeIndex_(mesh_.time().startTimeIndex() + 2)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::basicSourceList::reset(const dictionary& dict)
{
label count = 0;
forAllConstIter(dictionary, dict, iter)
@ -85,15 +101,13 @@ Foam::basicSourceList::basicSourceList
this->set
(
i++,
basicSource::New(name, sourceDict, mesh)
basicSource::New(name, sourceDict, mesh_)
);
}
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::basicSourceList::read(const dictionary& dict)
{
checkTimeIndex_ = mesh_.time().timeIndex() + 2;

View File

@ -84,7 +84,10 @@ public:
// Constructors
//- Construct from components with list of field names
//- Construct null
basicSourceList(const fvMesh& mesh);
//- Construct from mesh and dictionary
basicSourceList(const fvMesh& mesh, const dictionary& dict);
@ -95,6 +98,9 @@ public:
// Member Functions
//- Reset the source list
void reset(const dictionary& dict);
//- Correct
template<class Type>
void correct(GeometricField<Type, fvPatchField, volMesh>& fld);

View File

@ -65,6 +65,15 @@ Foam::solverPerformance Foam::fvMatrix<Type>::solve
<< endl;
}
label maxIter = -1;
if (solverControls.readIfPresent("maxIter", maxIter))
{
if (maxIter == 0)
{
return solverPerformance();
}
}
word type(solverControls.lookupOrDefault<word>("type", "segregated"));
if (type == "segregated")

View File

@ -585,7 +585,13 @@ void Foam::InjectionModel<CloudType>::inject(TrackData& td)
pPtr->rho()
);
if ((pPtr->nParticle() >= 1.0) && (pPtr->move(td, dt)))
if (!pPtr->move(td, dt))
{
delete pPtr;
}
else
{
if (pPtr->nParticle() >= 1.0)
{
td.cloud().addParticle(pPtr);
massAdded += pPtr->nParticle()*pPtr->mass();
@ -599,6 +605,7 @@ void Foam::InjectionModel<CloudType>::inject(TrackData& td)
}
}
}
}
delayedVolume_ = delayedVolume;
}

View File

@ -4,6 +4,9 @@ partialWrite/partialWriteFunctionObject.C
removeRegisteredObject/removeRegisteredObject.C
removeRegisteredObject/removeRegisteredObjectFunctionObject.C
writeDictionary/writeDictionary.C
writeDictionary/writeDictionaryFunctionObject.C
writeRegisteredObject/writeRegisteredObject.C
writeRegisteredObject/writeRegisteredObjectFunctionObject.C

View File

@ -22,24 +22,24 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::IOpressureCoefficient
Foam::IOwriteDictionary
Description
Instance of the generic IOOutputFilter for pressureCoefficient.
Instance of the generic IOOutputFilter for writeDictionary.
\*---------------------------------------------------------------------------*/
#ifndef IOpressureCoefficient_H
#define IOpressureCoefficient_H
#ifndef IOwriteDictionary_H
#define IOwriteDictionary_H
#include "pressureCoefficient.H"
#include "writeDictionary.H"
#include "IOOutputFilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOOutputFilter<pressureCoefficient> IOpressureCoefficient;
typedef IOOutputFilter<writeDictionary> IOwriteDictionary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,199 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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 "writeDictionary.H"
#include "dictionary.H"
#include "Time.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::writeDictionary, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::writeDictionary::tryFolder
(
const label dictI,
const word& location,
bool& firstDict
)
{
IOobject dictIO
(
dictNames_[dictI],
location,
obr_,
IOobject::MUST_READ
);
if (dictIO.headerOk())
{
IOdictionary dict(dictIO);
if (dict.digest() != digests_[dictI])
{
if (firstDict)
{
Info<< type() << " output:" << nl << endl;
IOobject::writeDivider(Info);
Info<< endl;
firstDict = false;
}
Info<< dict.dictName() << dict << nl;
IOobject::writeDivider(Info);
digests_[dictI] = dict.digest();
}
return true;
}
return false;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::writeDictionary::writeDictionary
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
:
name_(name),
obr_(obr),
dictNames_(),
digests_()
{
read(dict);
execute();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::writeDictionary::~writeDictionary()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::writeDictionary::read(const dictionary& dict)
{
dict.lookup("dictNames") >> dictNames_;
digests_.setSize(dictNames_.size(), SHA1Digest());
Info<< type() << ": monitoring dictionaries:" << nl;
if (dictNames_.size())
{
forAll(dictNames_, i)
{
Info<< " " << dictNames_[i] << endl;
}
}
else
{
Info<< " none" << nl;
}
Info<< endl;
}
void Foam::writeDictionary::execute()
{
bool firstDict = true;
forAll(dictNames_, i)
{
if (obr_.foundObject<dictionary>(dictNames_[i]))
{
const dictionary& dict =
obr_.lookupObject<dictionary>(dictNames_[i]);
if (dict.digest() != digests_[i])
{
if (firstDict)
{
Info<< type() << " output:" << nl << endl;
IOobject::writeDivider(Info);
Info<< endl;
firstDict = false;
}
digests_[i] = dict.digest();
Info<< dict.dictName() << dict << nl;
IOobject::writeDivider(Info);
Info<< endl;
}
}
else
{
bool processed = tryFolder(i, obr_.time().timeName(), firstDict);
if (!processed)
{
processed = tryFolder(i, obr_.time().constant(), firstDict);
}
if (!processed)
{
processed = tryFolder(i, obr_.time().system(), firstDict);
}
if (!processed)
{
Info<< " Unable to locate dictionary " << dictNames_[i]
<< nl << endl;
}
else
{
Info<< endl;
}
}
}
}
void Foam::writeDictionary::end()
{
// do nothing
}
void Foam::writeDictionary::write()
{
// do nothing
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,24 +22,24 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::staticPressure
Foam::writeDictionary
Description
Converts kinematic pressure to static pressure, from the name of the
pressure field, and density, i.e.
p_static = density*p_kinematic
This function object writes dictionaries on start-up, and on change
SourceFiles
staticPressure.C
IOstaticPressure.H
writeDictionary.C
IOwriteDictionary.H
\*---------------------------------------------------------------------------*/
#ifndef staticPressure_H
#define staticPressure_H
#ifndef writeDictionary_H
#define writeDictionary_H
#include "pointFieldFwd.H"
#include "wordList.H"
#include "runTimeSelectionTables.H"
#include "SHA1Digest.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,51 +52,56 @@ class dictionary;
class mapPolyMesh;
/*---------------------------------------------------------------------------*\
Class staticPressure Declaration
Class writeDictionary Declaration
\*---------------------------------------------------------------------------*/
class staticPressure
class writeDictionary
{
protected:
// Private data
//- Name of this set of staticPressure objects
//- Name of this set of writeDictionary
word name_;
//- Reference to the database
const objectRegistry& obr_;
//- on/off switch
bool active_;
//- Names of dictionaries to monitor
wordList dictNames_;
//- Name of pressure field, default is "p"
word pName_;
//- Density value
scalar rho_;
//- List of changed dictionaries (only those registered to database)
List<SHA1Digest> digests_;
// Private Member Functions
//- Return true if the pressure field corresponds to kinematic pressure
bool isKinematicPressure();
//- Helper function to write the dictionary if found at location
bool tryFolder
(
const label dictI,
const word& location,
bool& firstDict
);
//- Disallow default bitwise copy construct
staticPressure(const staticPressure&);
writeDictionary(const writeDictionary&);
//- Disallow default bitwise assignment
void operator=(const staticPressure&);
void operator=(const writeDictionary&);
public:
//- Runtime type information
TypeName("staticPressure");
TypeName("writeDictionary");
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
staticPressure
writeDictionary
(
const word& name,
const objectRegistry&,
@ -106,18 +111,18 @@ public:
//- Destructor
virtual ~staticPressure();
virtual ~writeDictionary();
// Member Functions
//- Return name of the set of staticPressure
//- Return name of the writeDictionary
virtual const word& name() const
{
return name_;
}
//- Read the staticPressure data
//- Read the writeDictionary data
virtual void read(const dictionary&);
//- Execute, currently does nothing
@ -126,7 +131,7 @@ public:
//- Execute at the final time-loop, currently does nothing
virtual void end();
//- Calculate the staticPressure and write
//- Write the writeDictionary
virtual void write();
//- Update for changes of mesh

View File

@ -23,18 +23,18 @@ License
\*---------------------------------------------------------------------------*/
#include "pressureCoefficientFunctionObject.H"
#include "writeDictionaryFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(pressureCoefficientFunctionObject, 0);
defineNamedTemplateTypeNameAndDebug(writeDictionaryFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
pressureCoefficientFunctionObject,
writeDictionaryFunctionObject,
dictionary
);
}

View File

@ -0,0 +1,54 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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/>.
Typedef
Foam::writeDictionaryFunctionObject
Description
FunctionObject wrapper around writeDictionary to allow them to be
created via the functions entry within controlDict.
SourceFiles
writeDictionaryFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef writeDictionaryFunctionObject_H
#define writeDictionaryFunctionObject_H
#include "writeDictionary.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<writeDictionary>
writeDictionaryFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -29,6 +29,8 @@ License
#include "emptyPolyPatch.H"
#include "coupledPolyPatch.H"
#include "sampledSurface.H"
#include "mergePoints.H"
#include "indirectPrimitivePatch.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -222,6 +224,127 @@ void Foam::fieldValues::faceSource::sampledSurfaceFaces(const dictionary& dict)
}
void Foam::fieldValues::faceSource::combineSurfaceGeometry
(
faceList& faces,
pointField& points
) const
{
List<faceList> allFaces(Pstream::nProcs());
List<pointField> allPoints(Pstream::nProcs());
labelList globalFacesIs(faceId_);
forAll(globalFacesIs, i)
{
if (facePatchId_[i] != -1)
{
label patchI = facePatchId_[i];
globalFacesIs[i] += mesh().boundaryMesh()[patchI].start();
}
}
// Add local faces and points to the all* lists
indirectPrimitivePatch pp
(
IndirectList<face>(mesh().faces(), globalFacesIs),
mesh().points()
);
allFaces[Pstream::myProcNo()] = pp.localFaces();
allPoints[Pstream::myProcNo()] = pp.localPoints();
Pstream::gatherList(allFaces);
Pstream::gatherList(allPoints);
// Renumber and flatten
label nFaces = 0;
label nPoints = 0;
forAll(allFaces, procI)
{
nFaces += allFaces[procI].size();
nPoints += allPoints[procI].size();
}
faces.setSize(nFaces);
points.setSize(nPoints);
nFaces = 0;
nPoints = 0;
// My own data first
{
const faceList& fcs = allFaces[Pstream::myProcNo()];
forAll(fcs, i)
{
const face& f = fcs[i];
face& newF = faces[nFaces++];
newF.setSize(f.size());
forAll(f, fp)
{
newF[fp] = f[fp] + nPoints;
}
}
const pointField& pts = allPoints[Pstream::myProcNo()];
forAll(pts, i)
{
points[nPoints++] = pts[i];
}
}
// Other proc data follows
forAll(allFaces, procI)
{
if (procI != Pstream::myProcNo())
{
const faceList& fcs = allFaces[procI];
forAll(fcs, i)
{
const face& f = fcs[i];
face& newF = faces[nFaces++];
newF.setSize(f.size());
forAll(f, fp)
{
newF[fp] = f[fp] + nPoints;
}
}
const pointField& pts = allPoints[procI];
forAll(pts, i)
{
points[nPoints++] = pts[i];
}
}
}
// Merge
labelList oldToNew;
pointField newPoints;
bool hasMerged = mergePoints
(
points,
SMALL,
false,
oldToNew,
newPoints
);
if (hasMerged)
{
if (debug)
{
Pout<< "Merged from " << points.size()
<< " down to " << newPoints.size() << " points" << endl;
}
points.transfer(newPoints);
forAll(faces, i)
{
inplaceRenumber(oldToNew, faces[i]);
}
}
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
@ -291,6 +414,14 @@ void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
}
Info<< nl << endl;
if (valueOutput_)
{
surfaceWriterPtr_.reset
(
surfaceWriter::New(dict.lookup("surfaceFormat")).ptr()
);
}
}
@ -355,6 +486,7 @@ Foam::fieldValues::faceSource::faceSource
)
:
fieldValue(name, obr, dict, loadFromFiles),
surfaceWriterPtr_(NULL),
source_(sourceTypeNames_.read(dict.lookup("source"))),
operation_(operationTypeNames_.read(dict.lookup("operation"))),
weightFieldName_("none"),

View File

@ -35,8 +35,9 @@ Description
enabled true;
outputControl outputTime;
log true; // log to screen?
valueOutput true; // Write values at run-time output times?
source faceZone; // Type of face source:
valueOutput true; // write the output values
surfaceFormat none; // output value format (if valueOutput)
source faceZone; // type of face source:
// faceZone, patch, sampledSurface
sourceName f0; // faceZone name, see below
operation sum;
@ -97,6 +98,7 @@ SourceFiles
#include "fieldValue.H"
#include "surfaceFieldsFwd.H"
#include "volFieldsFwd.H"
#include "surfaceWriter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -166,11 +168,21 @@ private:
//- Set faces according to sampledSurface
void sampledSurfaceFaces(const dictionary&);
//- Combine faces and points from multiple processors
void combineSurfaceGeometry
(
faceList& faces,
pointField& points
) const;
protected:
// Protected data
//- Surface writer
autoPtr<surfaceWriter> surfaceWriterPtr_;
//- Source type
sourceType source_;
@ -196,6 +208,7 @@ protected:
// (1 use as is, -1 negate)
labelList faceSign_;
// If operating on sampledSurface
//- underlying sampledSurface

View File

@ -254,31 +254,46 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName)
combineFields(Sf);
combineFields(weightField);
// Write raw values on surface if specified
if (surfaceWriterPtr_.valid())
{
faceList faces;
pointField points;
combineSurfaceGeometry(faces, points);
fileName outputDir;
if (Pstream::parRun())
{
// Put in undecomposed case (Note: gives problems for
// distributed data running)
outputDir = obr_.time().path()/".."/name_;
}
else
{
outputDir = obr_.time().path()/name_;
}
outputDir = outputDir/"surface"/obr_.time().timeName();
surfaceWriterPtr_->write
(
outputDir,
word(sourceTypeNames_[source_]) + "_" + sourceName_,
points,
faces,
fieldName,
values,
false
);
}
// apply weight field
values *= weightField;
if (Pstream::master())
{
Type result = processValues(values, Sf, weightField);
if (valueOutput_)
{
IOField<Type>
(
IOobject
(
fieldName + "_" + sourceTypeNames_[source_] + "-"
+ sourceName_,
obr_.time().timeName(),
obr_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
values
).write();
}
outputFilePtr_()<< tab << result;
if (log_)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -27,6 +27,7 @@ License
#include "dictionary.H"
#include "Time.H"
#include "Pstream.H"
#include "IOmanip.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -89,7 +90,8 @@ void Foam::forceCoeffs::writeFileHeader()
if (forcesFilePtr_.valid())
{
forcesFilePtr_()
<< "# Time" << tab << "Cd" << tab << "Cl" << tab << "Cm" << endl;
<< "# Time" << tab << "Cm" << tab << "Cd" << tab << "Cl" << tab
<< "Cl(f)" << "Cl(r)" << endl;
}
}
@ -112,37 +114,77 @@ void Foam::forceCoeffs::write()
{
// Create the forces file if not already created
makeFile();
forcesMoments fm = forces::calcForcesMoment();
scalar pDyn = 0.5*rhoRef_*magUInf_*magUInf_;
vector totForce = fm.first().first() + fm.first().second();
vector totMoment = fm.second().first() + fm.second().second();
scalar liftForce = totForce & liftDir_;
scalar dragForce = totForce & dragDir_;
scalar pitchMoment = totMoment & pitchAxis_;
scalar Cl = liftForce/(Aref_*pDyn);
scalar Cd = dragForce/(Aref_*pDyn);
scalar Cm = pitchMoment/(Aref_*lRef_*pDyn);
forces::calcForcesMoment();
if (Pstream::master())
{
scalar pDyn = 0.5*rhoRef_*magUInf_*magUInf_;
Field<vector> totForce(force_[0] + force_[1]);
Field<vector> totMoment(moment_[0] + moment_[1]);
List<Field<scalar> > coeffs(3);
coeffs[0].setSize(nBin_);
coeffs[1].setSize(nBin_);
coeffs[2].setSize(nBin_);
// lift, drag and moment
coeffs[0] = (totForce & liftDir_)/(Aref_*pDyn);
coeffs[1] = (totForce & dragDir_)/(Aref_*pDyn);
coeffs[2] = (totMoment & pitchAxis_)/(Aref_*lRef_*pDyn);
scalar Cl = sum(coeffs[0]);
scalar Cd = sum(coeffs[1]);
scalar Cm = sum(coeffs[2]);
scalar Clf = Cl/2.0 - Cm;
scalar Clr = Cl/2.0 + Cm;
forcesFilePtr_()
<< obr_.time().value() << tab
<< Cd << tab << Cl << tab << Cm << endl;
<< Cm << tab << Cd << tab << Cl << tab << Clf << tab << Clr
<< endl;
if (log_)
{
Info<< "forceCoeffs output:" << nl
Info<< type() << " output:" << nl
<< " Cm = " << Cm << nl
<< " Cd = " << Cd << nl
<< " Cl = " << Cl << nl
<< " Cl(f) = " << Cl/2.0 - Cm << nl
<< " Cl(r) = " << Cl/2.0 + Cm << nl
<< endl;
<< " Cl(f) = " << Clf << nl
<< " Cl(r) = " << Clr << endl;
}
if (nBin_ > 1)
{
autoPtr<writer<scalar> >
binWriterPtr(writer<scalar>::New(binFormat_));
wordList fieldNames(IStringStream("(lift drag moment)")());
coordSet axis
(
"forceCoeffs",
"distance",
binPoints_,
mag(binPoints_)
);
fileName forcesDir =
baseFileDir()/"bins"/obr_.time().timeName();
mkDir(forcesDir);
if (log_)
{
Info<< " Writing bins to " << forcesDir << endl;
}
OFstream osCoeffs(forcesDir/"forceCoeffs");
binWriterPtr->write(axis, fieldNames, coeffs, osCoeffs);
}
if (log_)
{
Info<< endl;
}
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -26,7 +26,7 @@ Class
Description
Derived from the forces function object, creates a specialisation to
calculate lift and drag forces.
calculate lift, drag and moment coefficients.
SourceFiles
forceCoeffs.C
@ -81,6 +81,12 @@ class forceCoeffs
scalar Aref_;
// Bin information
//- Writer for bin data
autoPtr<writer<scalar> > binWriterPtr_;
// Private Member Functions
//- Disallow default bitwise copy construct

View File

@ -43,7 +43,78 @@ License
defineTypeNameAndDebug(Foam::forces, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
Foam::fileName Foam::forces::baseFileDir() const
{
fileName baseDir;
if (Pstream::parRun())
{
// Put in undecomposed case (Note: gives problems for
// distributed data running)
baseDir = obr_.time().path()/".."/name_;
}
else
{
baseDir = obr_.time().path()/name_;
}
return baseDir;
}
void Foam::forces::makeFile()
{
// Create the forces file if not already created
if (forcesFilePtr_.empty())
{
if (debug)
{
Info<< "Creating forces file" << endl;
}
// File update
if (Pstream::master())
{
word startTimeName =
obr_.time().timeName(obr_.time().startTime().value());
fileName forcesDir = baseFileDir()/startTimeName;
// Create directory if does not exist.
mkDir(forcesDir);
// Open new file at start up
forcesFilePtr_.reset(new OFstream(forcesDir/(type() + ".dat")));
// Add headers to output data
writeFileHeader();
}
}
}
void Foam::forces::writeFileHeader()
{
if (forcesFilePtr_.valid())
{
forcesFilePtr_()
<< "# Time" << tab
<< "forces(pressure, viscous) moment(pressure, viscous)";
if (localSystem_)
{
forcesFilePtr_()
<< tab
<< "local forces(pressure, viscous) "
<< "local moment(pressure, viscous)";
}
forcesFilePtr_()<< endl;
}
}
Foam::tmp<Foam::volSymmTensorField> Foam::forces::devRhoReff() const
{
@ -167,6 +238,85 @@ Foam::scalar Foam::forces::rho(const volScalarField& p) const
}
void Foam::forces::applyBins
(
const label patchI,
const vectorField fN,
const vectorField Md,
const vectorField fT
)
{
if (nBin_ == 1)
{
force_[0][0] = sum(fN);
force_[1][0] = sum(fT);
moment_[0][0] = sum(Md ^ fN);
moment_[1][0] = sum(Md ^ fT);
}
else
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
const vectorField& Cf = mesh.C().boundaryField()[patchI];
scalarField d((Cf & binDir_) - binMin_);
forAll(d, i)
{
label binI = floor(d[i]/binDx_);
force_[0][binI] += fN[i];
force_[1][binI] += fT[i];
moment_[0][binI] += Md[i]^fN[i];
moment_[1][binI] += Md[i]^fT[i];
}
}
}
void Foam::forces::writeBins() const
{
if (nBin_ == 1)
{
return;
}
autoPtr<writer<vector> > binWriterPtr(writer<vector>::New(binFormat_));
coordSet axis("forces", "distance", binPoints_, mag(binPoints_));
fileName forcesDir = baseFileDir()/"bins"/obr_.time().timeName();
mkDir(forcesDir);
if (log_)
{
Info<< " Writing bins to " << forcesDir << endl;
}
wordList fieldNames(IStringStream("(pressure viscous)")());
OFstream osForce(forcesDir/"force");
binWriterPtr->write(axis, fieldNames, force_, osForce);
OFstream osMoment(forcesDir/"moment");
binWriterPtr->write(axis, fieldNames, moment_, osMoment);
if (localSystem_)
{
List<Field<vector> > localForce(2);
List<Field<vector> > localMoment(2);
localForce[0] = coordSys_.localVector(force_[0]);
localForce[1] = coordSys_.localVector(force_[1]);
localMoment[0] = coordSys_.localVector(moment_[0]);
localMoment[1] = coordSys_.localVector(moment_[1]);
OFstream osLocalForce(forcesDir/"force_local");
binWriterPtr->write(axis, fieldNames, localForce, osLocalForce);
OFstream osLocalMoment(forcesDir/"moment_local");
binWriterPtr->write(axis, fieldNames, localMoment, osLocalMoment);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::forces::forces
@ -181,6 +331,8 @@ Foam::forces::forces
obr_(obr),
active_(true),
log_(false),
force_(2),
moment_(2),
patchSet_(),
pName_(word::null),
UName_(word::null),
@ -191,6 +343,12 @@ Foam::forces::forces
pRef_(0),
coordSys_(),
localSystem_(false),
nBin_(1),
binDir_(vector::zero),
binDx_(0.0),
binMin_(GREAT),
binPoints_(),
binFormat_("undefined"),
forcesFilePtr_(NULL)
{
// Check if the available mesh is an fvMesh otherise deactivate
@ -231,6 +389,8 @@ Foam::forces::forces
obr_(obr),
active_(true),
log_(false),
force_(2),
moment_(2),
patchSet_(patchSet),
pName_(pName),
UName_(UName),
@ -241,6 +401,12 @@ Foam::forces::forces
pRef_(pRef),
coordSys_(coordSys),
localSystem_(false),
nBin_(1),
binDir_(vector::zero),
binDx_(0.0),
binMin_(GREAT),
binPoints_(),
binFormat_("undefined"),
forcesFilePtr_(NULL)
{}
@ -261,11 +427,9 @@ void Foam::forces::read(const dictionary& dict)
directForceDensity_ = dict.lookupOrDefault("directForceDensity", false);
const fvMesh& mesh = refCast<const fvMesh>(obr_);
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
patchSet_ = mesh.boundaryMesh().patchSet
(
wordReList(dict.lookup("patches"))
);
patchSet_ = pbm.patchSet(wordReList(dict.lookup("patches")));
if (directForceDensity_)
{
@ -334,68 +498,77 @@ void Foam::forces::read(const dictionary& dict)
coordSys_ = coordinateSystem(dict, obr_);
localSystem_ = true;
}
// read bin information if present
if (dict.readIfPresent<label>("nBin", nBin_))
{
if (nBin_ < 0)
{
FatalIOErrorIn
(
"void Foam::forces::read(const dictionary&)", dict
) << "Number of bins (nBin) must be zero or greater"
<< exit(FatalIOError);
}
else if ((nBin_ == 0) || (nBin_ == 1))
{
nBin_ = 1;
force_[0].setSize(1);
force_[1].setSize(1);
moment_[0].setSize(1);
moment_[1].setSize(1);
}
if (nBin_ > 1)
{
dict.lookup("binDir") >> binDir_;
binDir_ /= mag(binDir_);
void Foam::forces::makeFile()
binMin_ = GREAT;
scalar binMax = -GREAT;
forAllConstIter(labelHashSet, patchSet_, iter)
{
// Create the forces file if not already created
if (forcesFilePtr_.empty())
label patchI = iter.key();
const polyPatch& pp = pbm[patchI];
scalarField d(pp.faceCentres() & binDir_);
binMin_ = min(min(d), binMin_);
binMax = max(max(d), binMax);
}
reduce(binMin_, minOp<scalar>());
reduce(binMax, maxOp<scalar>());
// slightly boost binMax so that region of interest is fully
// within bounds
binMax = 1.0001*(binMax - binMin_) + binMin_;
binDx_ = (binMax - binMin_)/scalar(nBin_);
// create the bin points used for writing
binPoints_.setSize(nBin_);
forAll(binPoints_, i)
{
if (debug)
{
Info<< "Creating forces file." << endl;
binPoints_[i] = (i + 0.5)*binDir_*binDx_;
}
// File update
if (Pstream::master())
dict.lookup("binFormat") >> binFormat_;
// allocate storage for forces and moments
forAll(force_, i)
{
fileName forcesDir;
word startTimeName =
obr_.time().timeName(obr_.time().startTime().value());
if (Pstream::parRun())
{
// Put in undecomposed case (Note: gives problems for
// distributed data running)
forcesDir = obr_.time().path()/".."/name_/startTimeName;
}
else
{
forcesDir = obr_.time().path()/name_/startTimeName;
}
// Create directory if does not exist.
mkDir(forcesDir);
// Open new file at start up
forcesFilePtr_.reset(new OFstream(forcesDir/(type() + ".dat")));
// Add headers to output data
writeFileHeader();
force_[i].setSize(nBin_);
moment_[i].setSize(nBin_);
}
}
}
void Foam::forces::writeFileHeader()
if (nBin_ == 1)
{
if (forcesFilePtr_.valid())
{
forcesFilePtr_()
<< "# Time" << tab
<< "forces(pressure, viscous) moment(pressure, viscous)";
if (localSystem_)
{
forcesFilePtr_()
<< tab
<< "local forces(pressure, viscous) "
<< "local moment(pressure, viscous)";
// allocate storage for forces and moments
force_[0].setSize(1);
force_[1].setSize(1);
moment_[0].setSize(1);
moment_[1].setSize(1);
}
forcesFilePtr_()<< endl;
}
}
@ -414,71 +587,65 @@ void Foam::forces::end()
void Foam::forces::write()
{
if (active_)
if (!active_)
{
return;
}
// Create the forces file if not already created
makeFile();
forcesMoments fm = calcForcesMoment();
calcForcesMoment();
if (Pstream::master())
{
if (log_)
{
Info<< "forces output:" << nl
<< " forces(pressure, viscous)" << fm.first() << nl
<< " moment(pressure, viscous)" << fm.second() << nl;
Info<< type() << " output:" << nl
<< " forces(pressure,viscous)"
<< "(" << sum(force_[0]) << "," << sum(force_[1]) << ")" << nl
<< " moment(pressure,viscous)"
<< "(" << sum(moment_[0]) << "," << sum(moment_[1]) << ")"
<< nl;
}
forcesFilePtr_() << obr_.time().value() << tab << fm;
forcesFilePtr_() << obr_.time().value() << tab
<< "(" << sum(force_[0]) << "," << sum(force_[1]) << ") "
<< "(" << sum(moment_[0]) << "," << sum(moment_[1]) << ")"
<< endl;
if (localSystem_)
{
forcesMoments fmLocal;
vectorField localForceP(coordSys_.localVector(force_[0]));
vectorField localForceV(coordSys_.localVector(force_[1]));
vectorField localMomentP(coordSys_.localVector(moment_[0]));
vectorField localMomentV(coordSys_.localVector(moment_[1]));
fmLocal.first().first() =
coordSys_.localVector(fm.first().first());
fmLocal.first().second() =
coordSys_.localVector(fm.first().second());
fmLocal.second().first() =
coordSys_.localVector(fm.second().first());
fmLocal.second().second() =
coordSys_.localVector(fm.second().second());
forcesFilePtr_() << tab << fmLocal;
if (log_)
{
Info<< " local:" << nl
<< " forces(pressure, viscous)" << fmLocal.first()
<< nl
<< " moment(pressure, viscous)" << fmLocal.second()
<< nl;
}
forcesFilePtr_() << obr_.time().value() << tab
<< "(" << sum(localForceP) << "," << sum(localForceV) << ") "
<< "(" << sum(localMomentP) << "," << sum(localMomentV) << ")"
<< endl;
}
forcesFilePtr_() << endl;
writeBins();
if (log_)
{
Info<< endl;
}
}
forcesFilePtr_() << endl;
}
}
Foam::forces::forcesMoments Foam::forces::calcForcesMoment() const
void Foam::forces::calcForcesMoment()
{
forcesMoments fm
(
pressureViscous(vector::zero, vector::zero),
pressureViscous(vector::zero, vector::zero)
);
force_[0] = vector::zero;
force_[1] = vector::zero;
moment_[0] = vector::zero;
moment_[1] = vector::zero;
if (directForceDensity_)
{
@ -491,32 +658,28 @@ Foam::forces::forcesMoments Foam::forces::calcForcesMoment() const
forAllConstIter(labelHashSet, patchSet_, iter)
{
label patchi = iter.key();
label patchI = iter.key();
vectorField Md
(
mesh.C().boundaryField()[patchi] - coordSys_.origin()
mesh.C().boundaryField()[patchI] - coordSys_.origin()
);
scalarField sA(mag(Sfb[patchi]));
scalarField sA(mag(Sfb[patchI]));
// Normal force = surfaceUnitNormal*(surfaceNormal & forceDensity)
vectorField fN
(
Sfb[patchi]/sA
Sfb[patchI]/sA
*(
Sfb[patchi] & fD.boundaryField()[patchi]
Sfb[patchI] & fD.boundaryField()[patchI]
)
);
fm.first().first() += sum(fN);
fm.second().first() += sum(Md ^ fN);
// Tangential force (total force minus normal fN)
vectorField fT(sA*fD.boundaryField()[patchi] - fN);
vectorField fT(sA*fD.boundaryField()[patchI] - fN);
fm.first().second() += sum(fT);
fm.second().second() += sum(Md ^ fT);
applyBins(patchI, fN, Md, fT);
}
}
else
@ -538,28 +701,38 @@ Foam::forces::forcesMoments Foam::forces::calcForcesMoment() const
forAllConstIter(labelHashSet, patchSet_, iter)
{
label patchi = iter.key();
label patchI = iter.key();
vectorField Md
(
mesh.C().boundaryField()[patchi] - coordSys_.origin()
mesh.C().boundaryField()[patchI] - coordSys_.origin()
);
vectorField pf(Sfb[patchi]*(p.boundaryField()[patchi] - pRef));
vectorField pf
(
rho(p)*Sfb[patchI]*(p.boundaryField()[patchI] - pRef)
);
fm.first().first() += rho(p)*sum(pf);
fm.second().first() += rho(p)*sum(Md ^ pf);
vectorField vf(Sfb[patchI] & devRhoReffb[patchI]);
vectorField vf(Sfb[patchi] & devRhoReffb[patchi]);
fm.first().second() += sum(vf);
fm.second().second() += sum(Md ^ vf);
applyBins(patchI, pf, Md, vf);
}
}
reduce(fm, sumOp());
Pstream::listCombineGather(force_, plusEqOp<vectorField>());
Pstream::listCombineGather(moment_, plusEqOp<vectorField>());
}
return fm;
Foam::vector Foam::forces::forceEff() const
{
return sum(force_[0]) + sum(force_[1]);
}
Foam::vector Foam::forces::momentEff() const
{
return sum(moment_[0]) + sum(moment_[1]);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -31,6 +31,13 @@ Description
Member function forces::write() calculates the forces/moments and
writes the forces/moments into the file \<timeDir\>/forces.dat
The data can optionally be collected into bins, using e.g.
\verbaitim
nBin 20; // output data into bins
binDir (1 0 0); // bin direction
binFormat gnuplot;
\endverbatim
Note
The centre of rotation for moment calculations can either be specified
by an \c CofR entry, or be taken from origin of the local coordinateSystem.
@ -66,6 +73,7 @@ SourceFiles
#include "OFstream.H"
#include "Switch.H"
#include "pointFieldFwd.H"
#include "writer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -83,46 +91,9 @@ class mapPolyMesh;
class forces
{
public:
// Tuple for pressure (.first()) and viscous (.second()) forces
typedef Tuple2<vector, vector> pressureViscous;
// Tuple for forces (.first()) and moment (.second())
// pressure/viscous forces Tuples.
typedef Tuple2<pressureViscous, pressureViscous> forcesMoments;
//- Sum operation class to accumulate pressure/viscous forces and moments
class sumOp
{
public:
forcesMoments operator()
(
const forcesMoments& fm1,
const forcesMoments& fm2
) const
{
return forcesMoments
(
pressureViscous
(
fm1.first().first() + fm2.first().first(),
fm1.first().second() + fm2.first().second()
),
pressureViscous
(
fm1.second().first() + fm2.second().first(),
fm1.second().second() + fm2.second().second()
)
);
}
};
protected:
// Private data
// Protected data
//- Name of this set of forces,
// Also used as the name of the probes directory.
@ -130,12 +101,19 @@ protected:
const objectRegistry& obr_;
//- on/off switch
//- On/off switch
bool active_;
//- Switch to send output to Info as well as to file
Switch log_;
//- Pressure and viscous force per bin
List<Field<vector> > force_;
//- Pressure and viscous pressure per bin
List<Field<vector> > moment_;
// Read from dictionary
//- Patches to integrate forces over
@ -169,11 +147,35 @@ protected:
bool localSystem_;
// Bin information
//- Number of bins
label nBin_;
//- Direction used to determine bin orientation
vector binDir_;
//- Distance between bin divisions
scalar binDx_;
//- Minimum bin bounds
scalar binMin_;
//- Bin positions along binDir
List<point> binPoints_;
//- Write format for bin data
word binFormat_;
//- Forces/moment file ptr
autoPtr<OFstream> forcesFilePtr_;
// Private Member Functions
// Protected Member Functions
//- Return the base file directory for output
fileName baseFileDir() const;
//- If the forces file has not been created create it
void makeFile();
@ -191,6 +193,18 @@ protected:
// otherwise return 1
scalar rho(const volScalarField& p) const;
//- Accumulate bin data
void applyBins
(
const label patchI,
const vectorField fN,
const vectorField Md,
const vectorField fT
);
//- Helper function to write bin data
void writeBins() const;
//- Disallow default bitwise copy construct
forces(const forces&);
@ -256,8 +270,14 @@ public:
//- Write the forces
virtual void write();
//- Calculate and return forces and moment
virtual forcesMoments calcForcesMoment() const;
//- Calculate the forces and moments
virtual void calcForcesMoment();
//- Return the total force
virtual vector forceEff() const;
//- Return the total moment
virtual vector momentEff() const;
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&)

View File

@ -218,7 +218,7 @@ void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
forces f("forces", db(), forcesDict);
forces::forcesMoments fm = f.calcForcesMoment();
f.calcForcesMoment();
// Get the forces on the patch faces at the current positions
@ -232,8 +232,8 @@ void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
motion_.updateForce
(
fm.first().first() + fm.first().second() + g_*motion_.mass(),
fm.second().first() + fm.second().second(),
f.forceEff() + g_*motion_.mass(),
f.momentEff(),
t.deltaTValue()
);

View File

@ -23,23 +23,26 @@ License
\*---------------------------------------------------------------------------*/
#include "pressureCoefficient.H"
#include "CourantNo.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "dictionary.H"
#include "zeroGradientFvPatchFields.H"
#include "fvcSurfaceIntegrate.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::pressureCoefficient, 0);
defineTypeNameAndDebug(Foam::CourantNo, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField> Foam::pressureCoefficient::rho
Foam::tmp<Foam::volScalarField> Foam::CourantNo::rho
(
const volScalarField& p
const surfaceScalarField& phi
) const
{
if (p.dimensions() == dimPressure)
if (phi.dimensions() == dimMass/dimTime)
{
return (obr_.lookupObject<volScalarField>(rhoName_));
}
@ -67,7 +70,7 @@ Foam::tmp<Foam::volScalarField> Foam::pressureCoefficient::rho
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::pressureCoefficient::pressureCoefficient
Foam::CourantNo::CourantNo
(
const word& name,
const objectRegistry& obr,
@ -78,9 +81,8 @@ Foam::pressureCoefficient::pressureCoefficient
name_(name),
obr_(obr),
active_(true),
pName_("p"),
rhoName_("rho"),
magUinf_(0.0)
phiName_("phi"),
rhoName_("rho")
{
// Check if the available mesh is an fvMesh, otherwise deactivate
if (!isA<fvMesh>(obr_))
@ -88,7 +90,7 @@ Foam::pressureCoefficient::pressureCoefficient
active_ = false;
WarningIn
(
"pressureCoefficient::pressureCoefficient"
"CourantNo::CourantNo"
"("
"const word&, "
"const objectRegistry&, "
@ -100,60 +102,94 @@ Foam::pressureCoefficient::pressureCoefficient
}
read(dict);
if (active_)
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
volScalarField* CourantNoPtr
(
new volScalarField
(
IOobject
(
type(),
mesh.time().timeName(),
mesh,
IOobject::NO_READ
),
mesh,
dimensionedScalar("0", dimless, 0.0),
zeroGradientFvPatchScalarField::typeName
)
);
mesh.objectRegistry::store(CourantNoPtr);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::pressureCoefficient::~pressureCoefficient()
Foam::CourantNo::~CourantNo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::pressureCoefficient::read(const dictionary& dict)
void Foam::CourantNo::read(const dictionary& dict)
{
if (active_)
{
pName_ = dict.lookupOrDefault<word>("pName", "p");
phiName_ = dict.lookupOrDefault<word>("phiName", "phi");
rhoName_ = dict.lookupOrDefault<word>("rhoName", "rho");
dict.lookup("magUinf") >> magUinf_;
}
}
void Foam::pressureCoefficient::execute()
void Foam::CourantNo::execute()
{
// Do nothing - only valid on write
}
void Foam::pressureCoefficient::end()
void Foam::CourantNo::end()
{
// Do nothing - only valid on write
}
void Foam::pressureCoefficient::write()
void Foam::CourantNo::write()
{
if (active_)
{
const volScalarField& p = obr_.lookupObject<volScalarField>(pName_);
const fvMesh& mesh = refCast<const fvMesh>(obr_);
volScalarField pressureCoefficient
const surfaceScalarField& phi =
mesh.lookupObject<surfaceScalarField>(phiName_);
volScalarField& CourantNo =
const_cast<volScalarField&>
(
IOobject
(
"pressureCoefficient",
obr_.time().timeName(),
obr_,
IOobject::NO_READ
),
p/(0.5*rho(p)*sqr(magUinf_))
mesh.lookupObject<volScalarField>(type())
);
pressureCoefficient.write();
scalarField& iField = CourantNo.internalField();
const scalarField sumPhi
(
fvc::surfaceSum(mag(phi))().internalField()
/rho(phi)().internalField()
);
iField = 0.5*sumPhi/mesh.V().field()*mesh.time().deltaTValue();
CourantNo.correctBoundaryConditions();
CourantNo.write();
Info<< type() << " output:" << nl
<< " writing " << CourantNo.name() << "field" << nl << endl;
}
}

View File

@ -22,28 +22,27 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::pressureCoefficient
Foam::CourantNo
Description
Calculates pressure coefficient, c_p
c_p = p/p_dyn,inf
where:
p_dyn,inf = 0.5*rho*mag(U_inf)^2
This function object calculates and outputs the Courant number as a
volScalarField. The field is stored on the mesh database so that it can
be retrieved and used for other applications.
SourceFiles
pressureCoefficient.C
IOpressureCoefficient.H
CourantNo.C
IOCourantNo.H
\*---------------------------------------------------------------------------*/
#ifndef pressureCoefficient_H
#define pressureCoefficient_H
#ifndef CourantNo_H
#define CourantNo_H
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
#include "pointFieldFwd.H"
#include "OFstream.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -56,55 +55,53 @@ class dictionary;
class mapPolyMesh;
/*---------------------------------------------------------------------------*\
Class pressureCoefficient Declaration
Class CourantNo Declaration
\*---------------------------------------------------------------------------*/
class pressureCoefficient
class CourantNo
{
// Private data
//- Name of this set of pressureCoefficient objects
//- Name of this set of CourantNo objects
word name_;
//- Reference to the database
const objectRegistry& obr_;
//- on/off switch
//- On/off switch
bool active_;
//- Name of pressure field, default is "p"
word pName_;
//- Name of flux field, default is "phi"
word phiName_;
//- Name of density field (optional)
word rhoName_;
//- Free stream velocity magnitude [m/s]
scalar magUinf_;
// Private Member Functions
//- Return 1 if the pressure field is kinematic, i.e. p/rho
// otherwise return rho from database
tmp<volScalarField> rho(const volScalarField& p) const;
//- Return 1 if the flux field is volumetric, otherwise return rho
// from the database
tmp<volScalarField> rho(const surfaceScalarField& p) const;
//- Disallow default bitwise copy construct
pressureCoefficient(const pressureCoefficient&);
CourantNo(const CourantNo&);
//- Disallow default bitwise assignment
void operator=(const pressureCoefficient&);
void operator=(const CourantNo&);
public:
//- Runtime type information
TypeName("pressureCoefficient");
TypeName("CourantNo");
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
pressureCoefficient
CourantNo
(
const word& name,
const objectRegistry&,
@ -114,18 +111,18 @@ public:
//- Destructor
virtual ~pressureCoefficient();
virtual ~CourantNo();
// Member Functions
//- Return name of the set of pressureCoefficient
//- Return name of the set of CourantNo
virtual const word& name() const
{
return name_;
}
//- Read the pressureCoefficient data
//- Read the CourantNo data
virtual void read(const dictionary&);
//- Execute, currently does nothing
@ -134,7 +131,7 @@ public:
//- Execute at the final time-loop, currently does nothing
virtual void end();
//- Calculate the pressureCoefficient and write
//- Calculate the CourantNo and write
virtual void write();
//- Update for changes of mesh

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,18 +23,18 @@ License
\*---------------------------------------------------------------------------*/
#include "staticPressureFunctionObject.H"
#include "CourantNoFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(staticPressureFunctionObject, 0);
defineNamedTemplateTypeNameAndDebug(CourantNoFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
staticPressureFunctionObject,
CourantNoFunctionObject,
dictionary
);
}

View File

@ -22,29 +22,28 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::pressureCoefficientFunctionObject
Foam::CourantNoFunctionObject
Description
FunctionObject wrapper around pressureCoefficient to allow it to be created
FunctionObject wrapper around CourantNo to allow it to be created
via the functions entry within controlDict.
SourceFiles
pressureCoefficientFunctionObject.C
CourantNoFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef pressureCoefficientFunctionObject_H
#define pressureCoefficientFunctionObject_H
#ifndef CourantNoFunctionObject_H
#define CourantNoFunctionObject_H
#include "pressureCoefficient.H"
#include "CourantNo.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<pressureCoefficient>
pressureCoefficientFunctionObject;
typedef OutputFilterFunctionObject<CourantNo> CourantNoFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,24 +22,24 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::IOstaticPressure
Foam::IOCourantNo
Description
Instance of the generic IOOutputFilter for staticPressure.
Instance of the generic IOOutputFilter for CourantNo.
\*---------------------------------------------------------------------------*/
#ifndef IOstaticPressure_H
#define IOstaticPressure_H
#ifndef IOCourantNo_H
#define IOCourantNo_H
#include "staticPressure.H"
#include "CourantNo.H"
#include "IOOutputFilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOOutputFilter<staticPressure> IOstaticPressure;
typedef IOOutputFilter<CourantNo> IOCourantNo;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,17 +1,23 @@
codedFunctionObject/codedFunctionObject.C
CourantNo/CourantNo.C
CourantNo/CourantNoFunctionObject.C
dsmcFields/dsmcFields.C
dsmcFields/dsmcFieldsFunctionObject.C
pressureCoefficient/pressureCoefficient.C
pressureCoefficient/pressureCoefficientFunctionObject.C
pressureTools/pressureTools.C
pressureTools/pressureToolsFunctionObject.C
staticPressure/staticPressure.C
staticPressure/staticPressureFunctionObject.C
scalarTransport/scalarTransport.C
scalarTransport/scalarTransportFunctionObject.C
timeActivatedFileUpdate/timeActivatedFileUpdate.C
timeActivatedFileUpdate/timeActivatedFileUpdateFunctionObject.C
wallShearStress/wallShearStress.C
wallShearStress/wallShearStressFunctionObject.C
yPlusLES/yPlusLES.C
yPlusLES/yPlusLESFunctionObject.C

View File

@ -1,5 +1,6 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/fieldSources/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/lagrangian/dsmc/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
@ -13,6 +14,7 @@ EXE_INC = \
LIB_LIBS = \
-lfiniteVolume \
-lfieldSources \
-lmeshTools \
-lsampling \
-llagrangian \

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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/>.
Typedef
Foam::IOpressureTools
Description
Instance of the generic IOOutputFilter for pressureTools.
\*---------------------------------------------------------------------------*/
#ifndef IOpressureTools_H
#define IOpressureTools_H
#include "pressureTools.H"
#include "IOOutputFilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOOutputFilter<pressureTools> IOpressureTools;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,28 +23,119 @@ License
\*---------------------------------------------------------------------------*/
#include "staticPressure.H"
#include "pressureTools.H"
#include "volFields.H"
#include "dictionary.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::staticPressure, 0);
defineTypeNameAndDebug(Foam::pressureTools, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::staticPressure::isKinematicPressure()
Foam::word Foam::pressureTools::pName() const
{
const volScalarField& p = obr_.lookupObject<volScalarField>(pName_);
word fieldName = "p";
return p.dimensions() == sqr(dimLength)/sqr(dimTime);
if (calcTotal_)
{
fieldName = "total(" + fieldName + ")";
}
else
{
fieldName = "static(" + fieldName + ")";
}
if (calcCoeff_)
{
fieldName = fieldName + "_coeff";
}
return fieldName;
}
Foam::dimensionedScalar Foam::pressureTools::rho
(
const volScalarField& p
) const
{
if (p.dimensions() == dimPressure)
{
return dimensionedScalar("1", dimless, 1.0);
}
else
{
return dimensionedScalar("rhoRef", dimDensity, rhoRef_);
}
}
Foam::dimensionedScalar Foam::pressureTools::pRef() const
{
dimensionedScalar value("pRef", dimPressure, 0.0);
if (calcTotal_)
{
value.value() += pRef_;
}
return pRef();
}
Foam::tmp<Foam::volScalarField> Foam::pressureTools::pDyn() const
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
tmp<volScalarField> tpDyn
(
new volScalarField
(
IOobject
(
"pDyn",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", dimPressure, 0.0)
)
);
if (calcTotal_)
{
const volVectorField& U = obr_.lookupObject<volVectorField>(UName_);
tpDyn() == 0.5*magSqr(U);
}
return tpDyn;
}
Foam::tmp<Foam::volScalarField> Foam::pressureTools::convertToCoeff
(
const volScalarField& p
) const
{
tmp<volScalarField> tCoeff(p);
if (calcCoeff_)
{
tCoeff() /= pDyn();
}
return tCoeff;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::staticPressure::staticPressure
Foam::pressureTools::pressureTools
(
const word& name,
const objectRegistry& obr,
@ -55,8 +146,12 @@ Foam::staticPressure::staticPressure
name_(name),
obr_(obr),
active_(true),
pName_(dict.lookupOrDefault<word>("p", "p")),
rho_(readScalar(dict.lookup("rho")))
calcTotal_(false),
calcCoeff_(false),
pName_("p"),
UName_("U"),
pRef_(0.0),
rhoRef_(1.0)
{
// Check if the available mesh is an fvMesh, otherwise deactivate
if (!isA<fvMesh>(obr_))
@ -64,7 +159,7 @@ Foam::staticPressure::staticPressure
active_ = false;
WarningIn
(
"staticPressure::staticPressure"
"pressureTools::pressureTools"
"("
"const word&, "
"const objectRegistry&, "
@ -74,25 +169,6 @@ Foam::staticPressure::staticPressure
) << "No fvMesh available, deactivating." << nl
<< endl;
}
else
{
// Check if the pressure is kinematic pressure, otherwise deactivate
if (!isKinematicPressure())
{
active_ = false;
WarningIn
(
"staticPressure::staticPressure"
"("
"const word&, "
"const objectRegistry&, "
"const dictionary&, "
"const bool"
")"
) << "Pressure is not kinematic pressure, deactivating." << nl
<< endl;
}
}
read(dict);
}
@ -100,53 +176,68 @@ Foam::staticPressure::staticPressure
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::staticPressure::~staticPressure()
Foam::pressureTools::~pressureTools()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::staticPressure::read(const dictionary& dict)
void Foam::pressureTools::read(const dictionary& dict)
{
if (active_)
{
dict.readIfPresent("p", pName_);
dict.lookup("rho") >> rho_;
dict.readIfPresent("pName", pName_);
dict.readIfPresent("UName", UName_);
const volScalarField& p = obr_.lookupObject<volScalarField>(pName_);
if (p.dimensions() != p.dimensions())
{
dict.lookup("rhoRef") >> rhoRef_;
}
dict.lookup("calcTotal") >> calcTotal_;
if (calcTotal_)
{
dict.lookup("pRef") >> pRef_;
}
dict.lookup("calcCoeff") >> calcCoeff_;
}
}
void Foam::staticPressure::execute()
void Foam::pressureTools::execute()
{
// Do nothing - only valid on write
}
void Foam::staticPressure::end()
void Foam::pressureTools::end()
{
// Do nothing - only valid on write
}
void Foam::staticPressure::write()
void Foam::pressureTools::write()
{
if (active_)
{
const volScalarField& p = obr_.lookupObject<volScalarField>(pName_);
volScalarField pStatic
volScalarField pResult
(
IOobject
(
"pStatic",
pName(),
obr_.time().timeName(),
obr_,
IOobject::NO_READ
),
dimensionedScalar("rho", dimDensity, rho_)*p
convertToCoeff(rho(p)*(p + pDyn()) + pRef())
);
pStatic.write();
pResult.write();
}
}

View File

@ -0,0 +1,194 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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::pressureTools
Description
This function object includes tools to manipulate the pressure into
different forms. These currently include:
- static pressure
p_s = rho*p_k
- total pressure
p_T = pRef + p_s + 0.5 rho |U|^2
- static pressure coefficient
Cp_s = p_s / (0.5 rho |U|^2)
- total pressure coefficient
Cp_T = p_T / (0.5 rho |U|^2)
The function object will operate on both kinematic (p_k) and static
pressure (p_s) fields, and the result is written as a volScalarField.
SourceFiles
pressureTools.C
IOpressureTools.H
\*---------------------------------------------------------------------------*/
#ifndef pressureTools_H
#define pressureTools_H
#include "volFieldsFwd.H"
#include "pointFieldFwd.H"
#include "dimensionedScalar.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class dictionary;
class mapPolyMesh;
/*---------------------------------------------------------------------------*\
Class pressureTools Declaration
\*---------------------------------------------------------------------------*/
class pressureTools
{
// Private data
//- Name of this set of pressureTools objects
word name_;
//- Reference to the database
const objectRegistry& obr_;
//- On/off switch
bool active_;
//- Flag to calculate total pressure
bool calcTotal_;
//- Flag to calculate pressure coefficient
bool calcCoeff_;
//- Name of pressure field, default is "p"
word pName_;
//- Name of velocity field, default is "U"
word UName_;
//- Reference pressure level (used for total pressure)
scalar pRef_;
//- Reference density value
scalar rhoRef_;
// Private Member Functions
//- Return the name of the derived pressure field
word pName() const;
//- Return the density scaling if supplied with kinematic pressure
dimensionedScalar rho(const volScalarField& p) const;
//- Return the reference pressure
dimensionedScalar pRef() const;
//- Calculate and return the (kinematic) dynamic pressure
tmp<volScalarField> pDyn() const;
//- Convert to coeff data by applying the pDyn scaling
tmp<volScalarField> convertToCoeff(const volScalarField& p) const;
//- Disallow default bitwise copy construct
pressureTools(const pressureTools&);
//- Disallow default bitwise assignment
void operator=(const pressureTools&);
public:
//- Runtime type information
TypeName("pressureTools");
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
pressureTools
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
);
//- Destructor
virtual ~pressureTools();
// Member Functions
//- Return name of the set of pressureTools
virtual const word& name() const
{
return name_;
}
//- Read the pressureTools data
virtual void read(const dictionary&);
//- Execute, currently does nothing
virtual void execute();
//- Execute at the final time-loop, currently does nothing
virtual void end();
//- Calculate the pressureTools and write
virtual void write();
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&)
{}
//- Update for changes of mesh
virtual void movePoints(const pointField&)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,42 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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 "pressureToolsFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(pressureToolsFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
pressureToolsFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,29 +22,29 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::staticPressureFunctionObject
Foam::pressureToolsFunctionObject
Description
FunctionObject wrapper around staticPressure to allow it to be created via
FunctionObject wrapper around pressureTools to allow it to be created via
the functions entry within controlDict.
SourceFiles
staticPressureFunctionObject.C
pressureToolsFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef staticPressureFunctionObject_H
#define staticPressureFunctionObject_H
#ifndef pressureToolsFunctionObject_H
#define pressureToolsFunctionObject_H
#include "staticPressure.H"
#include "pressureTools.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<staticPressure>
staticPressureFunctionObject;
typedef OutputFilterFunctionObject<pressureTools>
pressureToolsFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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/>.
Typedef
Foam::IOscalarTransport
Description
Instance of the generic IOOutputFilter for scalarTransport.
\*---------------------------------------------------------------------------*/
#ifndef IOscalarTransport_H
#define IOscalarTransport_H
#include "scalarTransport.H"
#include "IOOutputFilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOOutputFilter<scalarTransport> IOscalarTransport;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,271 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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 "scalarTransport.H"
#include "surfaceFields.H"
#include "dictionary.H"
#include "fixedValueFvPatchFields.H"
#include "zeroGradientFvPatchFields.H"
#include "fvScalarMatrix.H"
#include "fvmDdt.H"
#include "fvmDiv.H"
#include "fvcDiv.H"
#include "fvmLaplacian.H"
#include "fvmSup.H"
#include "incompressible/turbulenceModel/turbulenceModel.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::scalarTransport, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::wordList Foam::scalarTransport::boundaryTypes() const
{
const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_);
wordList bTypes(U.boundaryField().size());
forAll(bTypes, patchI)
{
const fvPatchField<vector>& pf = U.boundaryField()[patchI];
if (isA<fixedValueFvPatchVectorField>(pf))
{
bTypes[patchI] = fixedValueFvPatchScalarField::typeName;
}
else
{
bTypes[patchI] = zeroGradientFvPatchScalarField::typeName;
}
}
return bTypes;
}
Foam::tmp<Foam::volScalarField> Foam::scalarTransport::DT
(
const surfaceScalarField& phi
) const
{
typedef incompressible::turbulenceModel icoModel;
typedef compressible::turbulenceModel cmpModel;
if (userDT_)
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"DT",
mesh_.time().timeName(),
mesh_.time(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("DT", phi.dimensions()/dimLength, DT_)
)
);
}
else if (mesh_.foundObject<icoModel>("turbulenceModel"))
{
const icoModel& model = mesh_.lookupObject<icoModel>("turbulenceModel");
return model.nuEff();
}
else if (mesh_.foundObject<cmpModel>("turbulenceModel"))
{
const cmpModel& model = mesh_.lookupObject<cmpModel>("turbulenceModel");
return model.muEff();
}
else
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"DT",
mesh_.time().timeName(),
mesh_.time(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("DT", phi.dimensions()/dimLength, 0.0)
)
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::scalarTransport::scalarTransport
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
:
name_(name),
mesh_(refCast<const fvMesh>(obr)),
active_(true),
phiName_("phi"),
UName_("U"),
DT_(0.0),
userDT_(false),
resetOnStartUp_(false),
nCorr_(0),
autoSchemes_(false),
sources_(mesh_),
T_
(
IOobject
(
name,
mesh_.time().timeName(),
mesh_,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar("zero", dimless, 0.0),
boundaryTypes()
)
{
read(dict);
if (resetOnStartUp_)
{
T_ == dimensionedScalar("zero", dimless, 0.0);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::scalarTransport::~scalarTransport()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::scalarTransport::read(const dictionary& dict)
{
if (active_)
{
Info<< type() << ":" << nl;
phiName_ = dict.lookupOrDefault<word>("phiName", "phi");
UName_ = dict.lookupOrDefault<word>("UName", "U");
userDT_ = false;
if (dict.readIfPresent("DT", DT_))
{
userDT_ = true;
}
dict.lookup("resetOnStartUp") >> resetOnStartUp_;
dict.readIfPresent("nCorr", nCorr_);
dict.lookup("autoSchemes") >> autoSchemes_;
sources_.reset(dict.subDict("sources"));
}
}
void Foam::scalarTransport::execute()
{
Info<< type() << " output:" << endl;
const surfaceScalarField& phi =
mesh_.lookupObject<surfaceScalarField>(phiName_);
// calculate the diffusivity
volScalarField DT(this->DT(phi));
// set schemes
word schemeVar = T_.name();
if (autoSchemes_)
{
schemeVar = UName_;
}
word divScheme("div(phi," + schemeVar + ")");
word laplacianScheme("laplacian(" + DT.name() + "," + schemeVar + ")");
// set under-relaxation coeff
scalar relaxCoeff = 0.0;
if (mesh_.relaxEquation(schemeVar))
{
relaxCoeff = mesh_.equationRelaxationFactor(schemeVar);
}
// solve
for (label i = 0; i <= nCorr_; i++)
{
fvScalarMatrix TEqn
(
fvm::ddt(T_)
+ fvm::div(phi, T_, divScheme)
- fvm::laplacian(DT, T_, laplacianScheme)
==
sources_(T_)
);
TEqn.relax(relaxCoeff);
sources_.constrain(TEqn);
TEqn.solve(mesh_.solverDict(UName_));
}
Info<< endl;
}
void Foam::scalarTransport::end()
{
// Do nothing
}
void Foam::scalarTransport::write()
{
// Do nothing
}
// ************************************************************************* //

View File

@ -0,0 +1,188 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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::scalarTransport
Description
This function object evolves a passive scalar transport equation. The
field in ininitially zero, to which sources are added. The field name
is assigned the name of the function object. Boundary conditions are
automatically applied, based on the velocity boundary conditions.
- the field can be zeroed on start-up using the resetOnStartUp flag
- to employ the same numerical schemes as the flow velocity, use the
autoSchemes flag
- the diffusivity can be set manually using the DT entry, or retrieved
from the turbulence model (if applicable)
SourceFiles
scalarTransport.C
IOscalarTransport.H
SeeAlso
Foam::basicSourceList
\*---------------------------------------------------------------------------*/
#ifndef scalarTransport_H
#define scalarTransport_H
#include "volFields.H"
#include "surfaceFieldsFwd.H"
#include "pointFieldFwd.H"
#include "fvMatricesFwd.H"
#include "basicSourceList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class dictionary;
class mapPolyMesh;
/*---------------------------------------------------------------------------*\
Class scalarTransport Declaration
\*---------------------------------------------------------------------------*/
class scalarTransport
{
// Private data
//- Name of this set of scalarTransport objects
word name_;
//- Reference to the mesh database
const fvMesh& mesh_;
//- On/off switch
bool active_;
//- Name of flux field (optional)
word phiName_;
//- Name of velocity field (optional)
word UName_;
//- Diffusion coefficient (optional)
scalar DT_;
//- Flag to indicate whether user DT_ is used
bool userDT_;
//- Flag to reset scalar field on start-up
bool resetOnStartUp_;
//- Number of corrector iterations (optional)
label nCorr_;
//- Flag to employ schemes for velocity for scalar transport
bool autoSchemes_;
//- Run-time selectable sources
basicSourceList sources_;
//- The scalar field
volScalarField T_;
// Private Member Functions
//- Return the boundary types for the scalar field
wordList boundaryTypes() const;
//- Return the diffusivity field
tmp<volScalarField> DT(const surfaceScalarField& phi) const;
//- Disallow default bitwise copy construct
scalarTransport(const scalarTransport&);
//- Disallow default bitwise assignment
void operator=(const scalarTransport&);
public:
//- Runtime type information
TypeName("scalarTransport");
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
scalarTransport
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
);
//- Destructor
virtual ~scalarTransport();
// Member Functions
//- Return name of the set of scalarTransport
virtual const word& name() const
{
return name_;
}
//- Read the scalarTransport data
virtual void read(const dictionary&);
//- Execute, currently does nothing
virtual void execute();
//- Execute at the final time-loop, currently does nothing
virtual void end();
//- Calculate the scalarTransport and write
virtual void write();
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&)
{}
//- Update for changes of mesh
virtual void movePoints(const pointField&)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,42 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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 "scalarTransportFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(scalarTransportFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
scalarTransportFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -0,0 +1,54 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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/>.
Typedef
Foam::scalarTransportFunctionObject
Description
FunctionObject wrapper around scalarTransport to allow it to be
created via the functions entry within controlDict.
SourceFiles
scalarTransportFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef scalarTransportFunctionObject_H
#define scalarTransportFunctionObject_H
#include "scalarTransport.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<scalarTransport>
scalarTransportFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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/>.
Typedef
Foam::IOwallShearStress
Description
Instance of the generic IOOutputFilter for wallShearStress.
\*---------------------------------------------------------------------------*/
#ifndef IOwallShearStress_H
#define IOwallShearStress_H
#include "wallShearStress.H"
#include "IOOutputFilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOOutputFilter<wallShearStress> IOwallShearStress;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,251 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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 "wallShearStress.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "incompressible/turbulenceModel/turbulenceModel.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "wallPolyPatch.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::wallShearStress, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::wallShearStress::makeFile()
{
// Create the output file if not already created
if (outputFilePtr_.empty())
{
if (debug)
{
Info<< "Creating output file." << endl;
}
// File update
if (Pstream::master())
{
fileName outputDir;
word startTimeName =
obr_.time().timeName(obr_.time().startTime().value());
if (Pstream::parRun())
{
// Put in undecomposed case (Note: gives problems for
// distributed data running)
outputDir =
obr_.time().path()/".."/name_/startTimeName;
}
else
{
outputDir = obr_.time().path()/name_/startTimeName;
}
// Create directory if does not exist
mkDir(outputDir);
// Open new file at start up
outputFilePtr_.reset(new OFstream(outputDir/(type() + ".dat")));
// Add headers to output data
outputFilePtr_() << "# Wall shear stress" << nl
<< "# time " << token::TAB << "patch" << token::TAB
<< "min" << token::TAB << "max" << endl;
}
}
}
void Foam::wallShearStress::calcShearStress
(
const fvMesh& mesh,
const volSymmTensorField& Reff,
volVectorField& shearStress
)
{
forAll(shearStress.boundaryField(), patchI)
{
const polyPatch& pp = mesh.boundaryMesh()[patchI];
if (isA<wallPolyPatch>(pp))
{
vectorField& ssp = shearStress.boundaryField()[patchI];
const vectorField& Sfp = mesh.Sf().boundaryField()[patchI];
const scalarField& magSfp = mesh.magSf().boundaryField()[patchI];
const symmTensorField& Reffp = Reff.boundaryField()[patchI];
ssp = (-Sfp/magSfp) & Reffp;
vector minSsp = min(ssp);
vector maxSsp = max(ssp);
outputFilePtr_() << mesh.time().timeName() << token::TAB
<< pp.name() << token::TAB << minSsp
<< token::TAB << maxSsp << endl;
if (log_)
{
Info<< " min/max(" << pp.name() << ") = "
<< minSsp << ", " << maxSsp << endl;
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::wallShearStress::wallShearStress
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
:
name_(name),
obr_(obr),
active_(true),
log_(false),
phiName_("phi"),
outputFilePtr_(NULL)
{
// Check if the available mesh is an fvMesh, otherwise deactivate
if (!isA<fvMesh>(obr_))
{
active_ = false;
WarningIn
(
"wallShearStress::wallShearStress"
"("
"const word&, "
"const objectRegistry&, "
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating." << nl
<< endl;
}
makeFile();
read(dict);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::wallShearStress::~wallShearStress()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::wallShearStress::read(const dictionary& dict)
{
if (active_)
{
log_ = dict.lookupOrDefault<Switch>("log", false);
phiName_ = dict.lookupOrDefault<word>("phiName", "phi");
}
}
void Foam::wallShearStress::execute()
{
// Do nothing - only valid on write
}
void Foam::wallShearStress::end()
{
// Do nothing - only valid on write
}
void Foam::wallShearStress::write()
{
typedef compressible::turbulenceModel cmpModel;
typedef incompressible::turbulenceModel icoModel;
if (active_)
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
volVectorField wallShearStress
(
IOobject
(
"wallShearStress",
mesh.time().timeName(),
mesh,
IOobject::NO_READ
),
mesh,
dimensionedVector("0", sqr(dimLength)/sqr(dimTime), vector::zero)
);
if (log_)
{
Info<< type() << " output:" << nl;
}
const surfaceScalarField& phi =
obr_.lookupObject<surfaceScalarField>(phiName_);
tmp<volSymmTensorField> Reff;
if (phi.dimensions() == dimMass/dimTime)
{
const cmpModel& model =
mesh.lookupObject<cmpModel>("turbulenceModel");
Reff = model.devRhoReff();
}
else
{
const icoModel& model =
mesh.lookupObject<icoModel>("turbulenceModel");
Reff = model.devReff();
}
calcShearStress(mesh, Reff(), wallShearStress);
if (log_)
{
Info<< endl;
}
wallShearStress.write();
}
}
// ************************************************************************* //

View File

@ -0,0 +1,163 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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::wallShearStress
Description
Evaluates and outputs wall shear stress. Values written to time folders
as field 'wallShearStress'
SourceFiles
wallShearStress.C
IOwallShearStress.H
\*---------------------------------------------------------------------------*/
#ifndef wallShearStress_H
#define wallShearStress_H
#include "volFieldsFwd.H"
#include "pointFieldFwd.H"
#include "Switch.H"
#include "OFstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class dictionary;
class mapPolyMesh;
class fvMesh;
/*---------------------------------------------------------------------------*\
Class wallShearStress Declaration
\*---------------------------------------------------------------------------*/
class wallShearStress
{
// Private data
//- Name of this set of wallShearStress object
word name_;
const objectRegistry& obr_;
//- on/off switch
bool active_;
//- Switch to send output to Info as well as to file
Switch log_;
//- Name of mass/volume flux field (optional, default = phi)
word phiName_;
//- Output file pointer
autoPtr<OFstream> outputFilePtr_;
// Private Member Functions
//- Make the output file
virtual void makeFile();
//- Calculate the shear stress
void calcShearStress
(
const fvMesh& mesh,
const volSymmTensorField& Reff,
volVectorField& shearStress
);
//- Disallow default bitwise copy construct
wallShearStress(const wallShearStress&);
//- Disallow default bitwise assignment
void operator=(const wallShearStress&);
public:
//- Runtime type information
TypeName("wallShearStress");
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
wallShearStress
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
);
//- Destructor
virtual ~wallShearStress();
// Member Functions
//- Return name of the set of wallShearStress
virtual const word& name() const
{
return name_;
}
//- Read the wallShearStress data
virtual void read(const dictionary&);
//- Execute, currently does nothing
virtual void execute();
//- Execute at the final time-loop, currently does nothing
virtual void end();
//- Calculate the wallShearStress and write
virtual void write();
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&)
{}
//- Update for changes of mesh
virtual void movePoints(const pointField&)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,42 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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 "wallShearStressFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(wallShearStressFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
wallShearStressFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -0,0 +1,54 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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/>.
Typedef
Foam::wallShearStressFunctionObject
Description
FunctionObject wrapper around wallShearStress to allow it to be created
via the functions entry within controlDict.
SourceFiles
wallShearStressFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef wallShearStressFunctionObject_H
#define wallShearStressFunctionObject_H
#include "wallShearStress.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<wallShearStress>
wallShearStressFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -152,6 +152,25 @@ Foam::writer<Type>::~writer()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::writer<Type>::write
(
const coordSet& points,
const wordList& valueSetNames,
const List<Field<Type> >& valueSets,
Ostream& os
) const
{
List<const Field<Type>*> valueSetPtrs(valueSets.size());
forAll(valueSetPtrs, i)
{
valueSetPtrs[i] = &valueSets[i];
}
write(points, valueSetNames, valueSetPtrs, os);
}
template<class Type>
Foam::Ostream& Foam::writer<Type>::write
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,13 +40,7 @@ Description
// Output list of points and corresponding values
scalarFormatter().write
(
coordSet
(
points, // sample coordinates
"someLine", // name of coordSet
"distance", // write coordinates as distance to refPoint
points[0] // reference point
),
coordSet(...)
"U.component(0)", // name of values
vals // values
);
@ -164,6 +158,17 @@ public:
Ostream&
) const = 0;
//- General entry point for writing.
// The data is organized in a set of point with one or more values
// per point
virtual void write
(
const coordSet&,
const wordList&,
const List<Field<Type> >&,
Ostream&
) const;
//- General entry point for writing of multiple coordSets.
// Each coordSet (track) has same data variables.
// The data is per variable, per track, per point of track.

View File

@ -12,6 +12,7 @@ forces
functionObjectLibs ( "libforces.so" );
outputControl timeStep;
outputInterval 1;
log yes;
patches ( "motorBike.*" );
pName p;
@ -26,6 +27,10 @@ forces
magUInf 20;
lRef 1.42; // Wheelbase length
Aref 0.75; // Estimated
nBin 20; // output data into bins
binDir (1 0 0); // bin direction
binFormat gnuplot;
}

View File

@ -92,10 +92,5 @@ PIMPLE
alphaTemp 0.005;
}
additional
{
solveSpecies true;
}
// ************************************************************************* //

View File

@ -76,10 +76,5 @@ PIMPLE
maxDeltaT 1;
}
additional
{
solveSpecies true;
}
// ************************************************************************* //

View File

@ -1,38 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object G;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 0 -3 0 0 0 0];
internalField uniform 0;
boundaryField
{
walls
{
type MarshakRadiation;
T T;
emissivityMode lookup;
emissivity uniform 1.0;
value uniform 0;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -1,36 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object H2O;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 0.0;
boundaryField
{
walls
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -1,36 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object N2;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 0.79;
boundaryField
{
walls
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -1,36 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object O2;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 0.21;
boundaryField
{
walls
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -1,35 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
location "0";
class volScalarField;
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField uniform 400;
boundaryField
{
walls
{
type fixedValue;
value uniform 400;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -1,35 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
location "0";
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
walls
{
type fixedValue;
value uniform (0 0 0);
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -1,34 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
internalField uniform 100000;
boundaryField
{
walls
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -1,45 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object chemistryProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
rhoChemistryModel ODEChemistryModel<gasThermoPhysics>;
chemistry off;
chemistrySolver ode;
initialChemicalTimeStep 1e-07;
sequentialCoeffs
{
cTauChem 0.001;
}
EulerImplicitCoeffs
{
cTauChem 0.05;
equilibriumRateLimiter off;
}
odeCoeffs
{
solver RK;
eps 0.05;
scale 1;
}
// ************************************************************************* //

View File

@ -1,29 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object combustionProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
combustionModel PaSR<rhoChemistryCombustion>;
active false;
PaSRCoeffs
{
Cmix 1.0;
turbulentReaction off;
}
// ************************************************************************* //

View File

@ -1,85 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object foam.dat;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
O2
{
specie
{
nMoles 1;
molWeight 31.9988;
}
thermodynamics
{
Tlow 200;
Thigh 5000;
Tcommon 1000;
highCpCoeffs ( 3.69758 0.00061352 -1.25884e-07 1.77528e-11 -1.13644e-15 -1233.93 3.18917 );
lowCpCoeffs ( 3.21294 0.00112749 -5.75615e-07 1.31388e-09 -8.76855e-13 -1005.25 6.03474 );
}
transport
{
As 1.67212e-06;
Ts 170.672;
}
}
H2O
{
specie
{
nMoles 1;
molWeight 18.0153;
}
thermodynamics
{
Tlow 200;
Thigh 5000;
Tcommon 1000;
highCpCoeffs ( 2.67215 0.00305629 -8.73026e-07 1.201e-10 -6.39162e-15 -29899.2 6.86282 );
lowCpCoeffs ( 3.38684 0.00347498 -6.3547e-06 6.96858e-09 -2.50659e-12 -30208.1 2.59023 );
}
transport
{
As 1.67212e-06;
Ts 170.672;
}
}
N2
{
specie
{
nMoles 1;
molWeight 28.0134;
}
thermodynamics
{
Tlow 200;
Thigh 5000;
Tcommon 1000;
highCpCoeffs ( 2.92664 0.00148798 -5.68476e-07 1.0097e-10 -6.75335e-15 -922.798 5.98053 );
lowCpCoeffs ( 3.29868 0.00140824 -3.96322e-06 5.64152e-09 -2.44486e-12 -1020.9 3.95037 );
}
transport
{
As 1.67212e-06;
Ts 170.672;
}
}
// ************************************************************************* //

View File

@ -1,10 +0,0 @@
species
(
O2
H2O
N2
);
reactions
{}

View File

@ -1,22 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedVectorField;
location "constant";
object g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -2 0 0 0 0];
value ( 0 0 0 );
// ************************************************************************* //

View File

@ -1,69 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant/polyMesh";
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.001;
vertices
(
( 0 0 0)
(12 0 0)
(12 12 0)
( 0 12 0)
( 0 0 1)
(12 0 1)
(12 12 1)
( 0 12 1)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (20 20 1) simpleGrading (1 1 1)
);
edges
(
);
boundary
(
walls
{
type wall;
faces
(
(3 7 6 2)
(0 4 7 3)
(2 6 5 1)
(1 5 4 0)
);
}
frontAndBack
{
type empty;
faces
(
(0 3 2 1)
(4 5 6 7)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -1,35 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
2
(
walls
{
type wall;
nFaces 80;
startFace 760;
}
frontAndBack
{
type empty;
inGroups 1(empty);
nFaces 800;
startFace 840;
}
)
// ************************************************************************* //

View File

@ -1,67 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object radiationProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
radiation off;
radiationModel none;
solverFreq 10;
P1Coeffs
{
C C [ 0 0 0 0 0 0 0 ] 0;
}
absorptionEmissionModel binaryAbsorptionEmission;
binaryAbsorptionEmissionCoeffs
{
model1
{
absorptionEmissionModel constantAbsorptionEmission;
constantAbsorptionEmissionCoeffs
{
a a [ 0 -1 0 0 0 0 0 ] 0.5;
e e [ 0 -1 0 0 0 0 0 ] 0.5;
E E [ 1 -1 -3 0 0 0 0 ] 0;
}
}
model2
{
absorptionEmissionModel cloudAbsorptionEmission;
cloudAbsorptionEmissionCoeffs
{
cloudNames
(
reactingCloud1
);
}
}
}
scatterModel cloudScatter;
cloudScatterCoeffs
{
cloudNames
(
reactingCloud1
);
}
// ************************************************************************* //

View File

@ -1,44 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class vectorField;
location "constant";
object reactingCloud1Positions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
(
(0.002 0.002 0.00005)
(0.004 0.002 0.00005)
(0.006 0.002 0.00005)
(0.008 0.002 0.00005)
(0.010 0.002 0.00005)
(0.002 0.004 0.00005)
(0.004 0.004 0.00005)
(0.006 0.004 0.00005)
(0.008 0.004 0.00005)
(0.010 0.004 0.00005)
(0.002 0.006 0.00005)
(0.004 0.006 0.00005)
(0.006 0.006 0.00005)
(0.008 0.006 0.00005)
(0.010 0.006 0.00005)
(0.002 0.008 0.00005)
(0.004 0.008 0.00005)
(0.006 0.008 0.00005)
(0.008 0.008 0.00005)
(0.010 0.008 0.00005)
(0.002 0.010 0.00005)
(0.004 0.010 0.00005)
(0.006 0.010 0.00005)
(0.008 0.010 0.00005)
(0.010 0.010 0.00005)
)
// ************************************************************************* //

View File

@ -1,167 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object reactingCloud1Properties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solution
{
active true;
coupled true;
transient yes;
cellValueSourceCorrection on;
sourceTerms
{
schemes
{
rho explicit 1;
U explicit 1;
Yi explicit 1;
h explicit 1;
radiation explicit 1;
}
}
interpolationSchemes
{
rho cell;
U cellPoint;
mu cell;
T cell;
Cp cell;
p cell;
}
integrationSchemes
{
U Euler;
T analytical;
}
}
constantProperties
{
rho0 1000;
T0 300;
Cp0 4187;
youngsModulus 1e9;
poissonsRatio 0.35;
epsilon0 1;
f0 0.5;
Pr 0.7;
Tvap 273;
Tbp 373;
LDevol 0;
hRetentionCoeff 1;
constantVolume false;
}
subModels
{
particleForces
{
sphereDrag;
gravity;
}
injectionModels
{
model1
{
type manualInjection;
massTotal 1e-8;
parcelBasisType mass;
SOI 0;
positionsFile "reactingCloud1Positions";
U0 ( 0 0 0 );
sizeDistribution
{
type uniform;
uniformDistribution
{
minValue 1e-04;
maxValue 1e-04;
}
}
}
}
dispersionModel none;
patchInteractionModel standardWallInteraction;
heatTransferModel RanzMarshall;
compositionModel singleMixtureFraction;
phaseChangeModel liquidEvaporation;
devolatilisationModel none;
surfaceReactionModel none;
surfaceFilmModel none;
radiation off;
standardWallInteractionCoeffs
{
type rebound;
}
RanzMarshallCoeffs
{
BirdCorrection true;
}
singleMixtureFractionCoeffs
{
phases
(
gas
{
}
liquid
{
H2O 1;
}
solid
{
}
);
YGasTot0 0;
YLiquidTot0 1;
YSolidTot0 0;
}
liquidEvaporationCoeffs
{
enthalpyTransfer enthalpyDifference;
activeLiquids ( H2O );
}
}
cloudFunctions
{}
// ************************************************************************* //

View File

@ -1,42 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object thermophysicalProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
thermoType heRhoReactionThermo<reactingMixture<gasThermoPhysics>>;
chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/foam.inp";
foamChemistryThermoFile "$FOAM_CASE/constant/foam.dat";
inertSpecie N2;
liquids
{
H2O
{
defaultCoeffs yes;
}
}
solids
{
// none
}
// ************************************************************************* //

View File

@ -1,21 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType laminar;
// ************************************************************************* //

View File

@ -1,55 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application reactingParcelFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 0.5;
deltaT 1e-03;
writeControl adjustableRunTime;
writeInterval 0.05;
purgeWrite 0;
writeFormat ascii;
writePrecision 10;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
adjustTimeStep yes;
maxCo 0.3;
maxDeltaT 1e-03;
// ************************************************************************* //

View File

@ -1,45 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
method scotch;
simpleCoeffs
{
n ( 2 2 1 );
delta 0.001;
}
hierarchicalCoeffs
{
n ( 1 1 1 );
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "";
}
distributed no;
roots ( );
// ************************************************************************* //

View File

@ -1,70 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
grad(p) Gauss linear;
}
divSchemes
{
default none;
div(phi,U) Gauss upwind;
div(phid,p) Gauss upwind;
div(phi,K) Gauss linear;
div(phi,k) Gauss upwind;
div(phi,epsilon) Gauss upwind;
div(U) Gauss linear;
div((muEff*dev2(T(grad(U))))) Gauss linear;
div(phi,Yi_h) Gauss upwind;
}
laplacianSchemes
{
default Gauss linear corrected;
laplacian(muEff,U) Gauss linear corrected;
laplacian(mut,U) Gauss linear corrected;
laplacian(DkEff,k) Gauss linear corrected;
laplacian(DepsilonEff,epsilon) Gauss linear corrected;
laplacian(DREff,R) Gauss linear corrected;
laplacian((rho*(1|A(U))),p) Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
fluxRequired
{
default no;
p ;
}
// ************************************************************************* //

View File

@ -1,101 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
rho
{
solver PCG;
preconditioner DIC;
tolerance 1e-05;
relTol 0.1;
}
rhoFinal
{
$rho;
tolerance 1e-05;
relTol 0;
}
"(U|h)"
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-05;
relTol 0.1;
}
p
{
solver PCG;
preconditioner DIC;
tolerance 1e-06;
relTol 0.1;
}
pFinal
{
$p;
tolerance 1e-06;
relTol 0;
}
"(U|h)Final"
{
$U;
tolerance 1e-05;
relTol 0;
}
"(k|epsilon)"
{
$UFinal;
}
"(Yi|O2|N2|H2O)"
{
$UFinal;
}
}
PIMPLE
{
transonic no;
nOuterCorrectors 1;
nCorrectors 2;
nNonOrthogonalCorrectors 0;
momentumPredictor yes;
}
additional
{
solveSpecies true;
}
relaxationFactors
{
fields
{
}
equations
{
".*Final" 1;
}
}
// ************************************************************************* //

View File

@ -83,10 +83,6 @@ PIMPLE
momentumPredictor yes;
}
additional
{
}
relaxationFactors
{
fields

View File

@ -82,10 +82,6 @@ PIMPLE
momentumPredictor yes;
}
additional
{
}
relaxationFactors
{
fields

View File

@ -88,10 +88,6 @@ potentialFlow
nNonOrthogonalCorrectors 5;
}
additional
{
}
relaxationFactors
{
fields