Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop

This commit is contained in:
mattijs
2017-06-14 09:06:49 +01:00
206 changed files with 10736 additions and 599 deletions

View File

@ -38,7 +38,7 @@ namespace surfaceTensionModels
(
surfaceTensionModel,
constantSurfaceTensionCoefficient,
dictionary
multiphase
);
}
}

View File

@ -40,8 +40,8 @@ Foam::surfaceTensionModel::New
Info<< "Selecting surfaceTensionModel for "
<< pair << ": " << surfaceTensionModelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(surfaceTensionModelType);
multiphaseConstructorTable::iterator cstrIter =
multiphaseConstructorTablePtr_->find(surfaceTensionModelType);
if (!cstrIter.found())
{
@ -49,7 +49,7 @@ Foam::surfaceTensionModel::New
<< "Unknown surfaceTensionModelType type "
<< surfaceTensionModelType << endl << endl
<< "Valid surfaceTensionModel types are : " << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< multiphaseConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}

View File

@ -31,7 +31,7 @@ License
namespace Foam
{
defineTypeNameAndDebug(surfaceTensionModel, 0);
defineRunTimeSelectionTable(surfaceTensionModel, dictionary);
defineRunTimeSelectionTable(surfaceTensionModel, multiphase);
}
const Foam::dimensionSet Foam::surfaceTensionModel::dimSigma(1, 0, -2, 0, 0);

View File

@ -73,7 +73,7 @@ public:
(
autoPtr,
surfaceTensionModel,
dictionary,
multiphase,
(
const dictionary& dict,
const phasePair& pair,

View File

@ -0,0 +1,10 @@
argList::validArgs.append("tool");
const wordList opts(helpType::dictionaryConstructorTablePtr_->sortedToc());
string note = "Valid <tool> options include:";
forAll(opts, i)
{
note = note + ' ' + opts[i];
}
argList::notes.append(note);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -42,6 +42,14 @@ using namespace Foam;
int main(int argc, char *argv[])
{
#include "addRegionOption.H"
#include "addToolOption.H"
// Intercept request for help
if ((argc > 0) && (strcmp(argv[1], "-help") == 0))
{
#include "setRootCase.H"
}
if (argc < 2)
{
FatalError
@ -49,8 +57,7 @@ int main(int argc, char *argv[])
<< exit(FatalError);
}
const word utilityName = argv[1];
word utilityName = argv[1];
Foam::autoPtr<Foam::helpType> utility
(
helpType::New(utilityName)

View File

@ -62,8 +62,6 @@ void Foam::helpTypes::helpBoundary::init()
{
helpType::init();
argList::validArgs.append("boundary");
argList::addOption
(
"field",

View File

@ -61,8 +61,6 @@ Foam::helpTypes::helpFunctionObject::~helpFunctionObject()
void Foam::helpTypes::helpFunctionObject::init()
{
helpType::init();
argList::validArgs.append("functionObject");
}

View File

@ -63,7 +63,6 @@ void Foam::helpTypes::helpSolver::init()
{
helpType::init();
argList::validArgs.append("solver");
argList::addBoolOption
(
"read",

View File

@ -38,28 +38,22 @@ EXE_LIBS = \
-lfvMotionSolvers \
-lfvOptions \
-lgenericPatchFields \
-limmiscibleIncompressibleTwoPhaseMixture \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModels \
-linterfaceProperties \
-llagrangian \
-llagrangianFunctionObjects \
-llagrangianIntermediate \
-llagrangian \
-llagrangianSpray \
-llagrangianTurbulence \
-llaminarFlameSpeedModels \
-lthermophysicalProperties \
-lmeshTools \
-lmolecularMeasurements \
-lmolecule \
-lODE \
-lOpenFOAM \
-lpairPatchAgglomeration \
-lphaseChangeTwoPhaseMixtures \
-lpotential \
-lpyrolysisModels \
-lradiationModels \
-lrandomProcesses \
-lreactingEulerianInterfacialCompositionModels \
-lreactingEulerianInterfacialModels \
-lreactingPhaseSystem \
@ -88,10 +82,17 @@ EXE_LIBS = \
-lsurfaceFilmModels \
-lsurfMesh \
-lthermalBaffleModels \
-lthermophysicalProperties \
-ltopoChangerFvMesh \
-lturbulenceModels \
-ltwoPhaseMixture \
-ltwoPhaseMixtureThermo \
-ltwoPhaseProperties \
-ltwoPhaseReactingTurbulenceModels \
-lutilityFunctionObjects
/*
Combinations of the following libs leads to corruption errors... ?
-limmiscibleIncompressibleTwoPhaseMixture \
-linterfaceProperties \
-lphaseChangeTwoPhaseMixtures \
-ltwoPhaseMixtureThermo \
-ltwoPhaseProperties \
*/

View File

@ -87,8 +87,11 @@ static void renumber
autoPtr<faceCoupleInfo> determineCoupledFaces
(
const bool fullMatch,
const label proci,
const label masterMeshProcStart,
const label masterMeshProcEnd,
const polyMesh& masterMesh,
const label meshToAddProcStart,
const label meshToAddProcEnd,
const polyMesh& meshToAdd,
const scalar mergeDist
)
@ -113,7 +116,6 @@ autoPtr<faceCoupleInfo> determineCoupledFaces
const polyBoundaryMesh& masterPatches = masterMesh.boundaryMesh();
const string toProcString("to" + name(proci));
DynamicList<label> masterFaces
(
@ -121,24 +123,35 @@ autoPtr<faceCoupleInfo> determineCoupledFaces
- masterMesh.nInternalFaces()
);
forAll(masterPatches, patchi)
{
const polyPatch& pp = masterPatches[patchi];
if
if (isA<processorPolyPatch>(pp))
{
for
(
isA<processorPolyPatch>(pp)
&& (
label proci=meshToAddProcStart;
proci<meshToAddProcEnd;
proci++
)
{
const string toProcString("to" + name(proci));
if (
pp.name().rfind(toProcString)
== (pp.name().size()-toProcString.size())
)
)
{
label meshFacei = pp.start();
forAll(pp, i)
{
masterFaces.append(meshFacei++);
}
break;
}
}
}
}
masterFaces.shrink();
@ -163,7 +176,19 @@ autoPtr<faceCoupleInfo> determineCoupledFaces
{
bool isConnected = false;
for (label mergedProci = 0; mergedProci < proci; mergedProci++)
for
(
label mergedProci=masterMeshProcStart;
!isConnected && (mergedProci < masterMeshProcEnd);
mergedProci++
)
{
for
(
label proci = meshToAddProcStart;
proci < meshToAddProcEnd;
proci++
)
{
const word fromProcString
(
@ -176,6 +201,7 @@ autoPtr<faceCoupleInfo> determineCoupledFaces
break;
}
}
}
if (isConnected)
{
@ -623,8 +649,15 @@ int main(int argc, char *argv[])
{
// Construct empty mesh.
Info<< "Constructing empty mesh to add to." << nl << endl;
fvMesh masterMesh
// fvMesh** masterMesh = new fvMesh*[nProcs];
PtrList<fvMesh> masterMesh(nProcs);
for (label proci=0; proci<nProcs; proci++)
{
masterMesh.set
(
proci,
new fvMesh
(
IOobject
(
@ -636,15 +669,9 @@ int main(int argc, char *argv[])
xferCopy(pointField()),
xferCopy(faceList()),
xferCopy(cellList())
)
);
for (label proci = 0; proci < nProcs; proci++)
{
Info<< "Reading mesh to add from "
<< databases[proci].caseName()
<< " for time = " << databases[proci].timeName()
<< nl << endl;
fvMesh meshToAdd
(
IOobject
@ -662,37 +689,87 @@ int main(int argc, char *argv[])
boundaryProcAddressing[proci] =
identity(meshToAdd.boundaryMesh().size());
// Find geometrically shared points/faces.
autoPtr<faceCoupleInfo> couples = determineCoupledFaces
(
fullMatch,
proci,
proci,
masterMesh[proci],
proci,
proci,
meshToAdd,
mergeDist
);
// Add elements to mesh
autoPtr<mapAddedPolyMesh> map = fvMeshAdder::add
(
masterMesh[proci],
meshToAdd,
couples
);
// Added processor
renumber(map().addedCellMap(), cellProcAddressing[proci]);
renumber(map().addedFaceMap(), faceProcAddressing[proci]);
renumber(map().addedPointMap(), pointProcAddressing[proci]);
renumber(map().addedPatchMap(), boundaryProcAddressing[proci]);
}
for (label step=2; step<nProcs*2; step*=2)
{
for (label proci=0; proci<nProcs; proci+=step)
{
label next = proci + step/2;
if(next >= nProcs)
{
continue;
}
Info<< "Merging mesh " << proci << " with " << next << endl;
// Find geometrically shared points/faces.
autoPtr<faceCoupleInfo> couples = determineCoupledFaces
(
fullMatch,
proci,
masterMesh,
meshToAdd,
next,
masterMesh[proci],
next,
proci+step,
masterMesh[next],
mergeDist
);
// Add elements to mesh
Info<< "Adding to master mesh" << nl << endl;
autoPtr<mapAddedPolyMesh> map = fvMeshAdder::add
(
masterMesh,
meshToAdd,
masterMesh[proci],
masterMesh[next],
couples
);
// Update all addressing so xxProcAddressing points to correct
// item in masterMesh.
// Processors that were already in masterMesh
for (label mergedI = 0; mergedI < proci; mergedI++)
for (label mergedI=proci; mergedI<next; mergedI++)
{
renumber(map().oldCellMap(), cellProcAddressing[mergedI]);
renumber(map().oldFaceMap(), faceProcAddressing[mergedI]);
renumber(map().oldPointMap(), pointProcAddressing[mergedI]);
renumber
(
map().oldCellMap(),
cellProcAddressing[mergedI]
);
renumber
(
map().oldFaceMap(),
faceProcAddressing[mergedI]
);
renumber
(
map().oldPointMap(),
pointProcAddressing[mergedI]
);
// Note: boundary is special since can contain -1.
renumber
(
@ -702,38 +779,79 @@ int main(int argc, char *argv[])
}
// Added processor
renumber(map().addedCellMap(), cellProcAddressing[proci]);
renumber(map().addedFaceMap(), faceProcAddressing[proci]);
renumber(map().addedPointMap(), pointProcAddressing[proci]);
renumber(map().addedPatchMap(), boundaryProcAddressing[proci]);
for
(
label addedI=next;
addedI<min(proci+step, nProcs);
addedI++
)
{
renumber
(
map().addedCellMap(),
cellProcAddressing[addedI]
);
Info<< endl;
renumber
(
map().addedFaceMap(),
faceProcAddressing[addedI]
);
renumber
(
map().addedPointMap(),
pointProcAddressing[addedI]
);
renumber
(
map().addedPatchMap(),
boundaryProcAddressing[addedI]
);
}
masterMesh.set(next, nullptr);
}
}
for (label proci=0; proci<nProcs; proci++)
{
Info<< "Reading mesh to add from "
<< databases[proci].caseName()
<< " for time = " << databases[proci].timeName()
<< nl << nl << endl;
}
// See if any points on the mastermesh have become connected
// because of connections through processor meshes.
mergeSharedPoints(mergeDist, masterMesh, pointProcAddressing);
mergeSharedPoints(mergeDist, masterMesh[0], pointProcAddressing);
// Save some properties on the reconstructed mesh
masterInternalFaces = masterMesh.nInternalFaces();
masterOwner = masterMesh.faceOwner();
masterInternalFaces = masterMesh[0].nInternalFaces();
masterOwner = masterMesh[0].faceOwner();
Info<< "\nWriting merged mesh to "
<< runTime.path()/runTime.timeName()
<< nl << endl;
if (!masterMesh.write())
if (!masterMesh[0].write())
{
FatalErrorInFunction
<< "Failed writing polyMesh."
<< exit(FatalError);
}
topoSet::removeFiles(masterMesh);
topoSet::removeFiles(masterMesh[0]);
if (writeCellDist)
{
writeCellDistance(runTime, masterMesh, cellProcAddressing);
writeCellDistance
(
runTime,
masterMesh[0],
cellProcAddressing
);
}
}
@ -810,7 +928,7 @@ int main(int argc, char *argv[])
// See reconstructPar for meaning of turning index.
forAll(faceProcAddr, procFacei)
{
label masterFacei = faceProcAddr[procFacei];
const label masterFacei = faceProcAddr[procFacei];
if
(

View File

@ -40,7 +40,7 @@ writeFormat ascii;
writePrecision 6;
writeCompression uncompressed;
writeCompression off;
timeFormat general;

View File

@ -90,7 +90,7 @@ pointNoiseCoeffs
{
csvFileData
{
fileName "pressureData";
file "pressureData";
nHeaderLine 1;
refColumn 0;
componentColumns (1);

195
bin/foamCreateBashCompletions Executable file
View File

@ -0,0 +1,195 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
# OpenFOAM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# foamCreateBashCompletions
#
# Description
# Create bash completions for OpenFOAM applications
#
#------------------------------------------------------------------------------
#set -x
usage() {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
Usage: $Script [OPTION] <file>
* Create bash completions for OpenFOAM applications and write to <file>.
By default searches directories \$FOAM_APPBIN and \$FOAM_USER_APPBIN
Options:
-d | -directory Directory to process
-h | -help Print the usage
USAGE
exit 1
}
searchDirs="$FOAM_APPBIN $FOAM_USER_APPBIN"
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help)
usage
;;
-d | -directory)
searchDirs="$2"
[ -d $searchDirs ] || usage "directory not found '$searchDirs'"
shift
;;
-*)
usage "unknown option: '$1'"
;;
*)
outFile=$1
break
;;
esac
shift
done
[ -z $outFile ] && usage
\rm -f $outFile
touch $outFile
writeFilterFunction()
{
cat<<WRITEFILTER >> $1
unset -f _filter_opts
_filter_opts()
{
local allOpts=\$1
local applied=\$2
for o in \${allOpts}; do
[ "\${applied/\$o/}" == "\${applied}" ] && echo \$o
done
}
WRITEFILTER
}
commonOptions()
{
local options=$@
local indent1=" "
local indent2=" "
for o in ${options[@]}; do
case $o in
-case)
echo "${indent1}-case)"
echo "${indent2}COMPREPLY=(\$(compgen -d -- \${cur}))"
echo "${indent2};;"
;;
-srcDoc|-help)
echo "${indent1}-srcDoc|-help)"
echo "${indent2}COMPREPLY=()"
echo "${indent2};;"
;;
-time)
echo "${indent1}-time)"
echo "${indent2}COMPREPLY=(\$(compgen -d -X '![-0-9]*' -- \${cur}))"
echo "${indent2};;"
;;
-region)
echo "${indent1}-region)"
echo "${indent2}local regions=\$(sed 's#/##g' <<< \$([ -d system ] && (\cd system && (\ls -d */ 2>/dev/null))))"
echo "${indent2}COMPREPLY=(\$(compgen -W \"\$regions\" -- \${cur}))"
echo "${indent2};;"
;;
*Dict)
echo "${indent1}*Dict)"
# echo "${indent2}local dirs=\$(\ls -d s*/)"
# echo "${indent2}local files=\$(\ls -f | grep Dict)"
# echo "${indent2}COMPREPLY=(\$(compgen -W \"\$dirs \$files\" -- \${cur}))"
echo "${indent2}COMPREPLY=(\$(compgen -f -- \${cur}))"
echo "${indent2};;"
;;
esac
done
}
writeFilterFunction $outFile
for dir in ${searchDirs}
do
echo "Processing directory $dir"
apps=($(\ls $dir))
for appName in "${apps[@]}"; do
appHelp=$($appName -help)
echo "Processing $appName"
# Options with args
optsWithArgs=($(awk '/^ {0,4}-[a-z]/ && /</ {print $1}' <<< "$appHelp"))
# Options without args
opts=($(awk '/^ {0,4}-[a-z]/ && !/</ {print $1}' <<< "$appHelp"))
cat<<WRITECOMPLETION >> $outFile
unset -f _${appName}
_${appName}()
{
local cur="\${COMP_WORDS[COMP_CWORD]}"
local prev="\${COMP_WORDS[COMP_CWORD-1]}"
local opts="${opts[@]} "
local optsWithArgs="${optsWithArgs[@]} "
case \${prev} in
$(commonOptions ${optsWithArgs[@]})
*)
if [ "\${optsWithArgs/\${prev} /}" != "\${optsWithArgs}" ]; then
# Unknown what type of arg follows - set to files
# not always correct but at least can still navigate path if
# needed...
COMPREPLY=(\$(compgen -f -- \${cur}))
else
# Catch-all - present all remaining options
opts=\$(_filter_opts "\${opts}" "\${COMP_LINE}")
optsWithArgs=\$(_filter_opts "\${optsWithArgs}" "\${COMP_LINE}")
COMPREPLY=(\$(compgen -W "\${opts} \${optsWithArgs}" -- \${cur}))
fi
;;
esac
return 0
}
complete -o nospace -F _${appName} $appName
WRITECOMPLETION
done
done
unset searchDirs writeFilterFunction commonOptions
#------------------------------------------------------------------------------

View File

@ -170,6 +170,7 @@ export PATH LD_LIBRARY_PATH MANPATH
# ~~~~~~~~~~~~~~~~~~~~~~~~~~
_foamEtc config.sh/settings
_foamEtc config.sh/aliases
_foamEtc config.sh/bashcompletion
# Source user setup files for optional packages

8185
etc/config.sh/bashcompletion Normal file

File diff suppressed because it is too large Load Diff

View File

@ -42,7 +42,7 @@ Description
Read csv format:
\verbatim
readerType csv;
fileName "$FOAM_CASE/constant/p0vsTime.csv";
file "$FOAM_CASE/constant/p0vsTime.csv";
hasHeaderLine true; // skip first line
timeColumn 0; // time is in column 0
valueColumns (1); // value starts in column 1

View File

@ -41,22 +41,28 @@ Foam::label Foam::mergePoints
{
typedef typename PointList::value_type point_type;
// Create a old to new point mapping array
pointMap.setSize(points.size());
const label nPoints = points.size();
// Create an old to new point mapping array
pointMap.setSize(nPoints);
pointMap = -1;
if (points.empty())
if (!nPoints)
{
return 0;
}
// Explicitly convert to Field to support various list types
tmp<Field<point_type>> tPoints(new Field<point_type>(points));
point_type compareOrigin = origin;
if (origin == point_type::max)
{
compareOrigin = sum(tPoints())/points.size();
// Use average of input points to define a comparison origin.
// Same as sum(points)/nPoints, but handles different list types
compareOrigin = points[0];
for (label pointi=1; pointi < nPoints; ++pointi)
{
compareOrigin += points[pointi];
}
compareOrigin /= nPoints;
}
// We're comparing distance squared to origin first.
@ -68,34 +74,31 @@ Foam::label Foam::mergePoints
// x^2+y^2+z^2 + 2*mergeTol*(x+z+y) + mergeTol^2*...
// so the difference will be 2*mergeTol*(x+y+z)
const scalar mergeTolSqr = Foam::sqr(scalar(mergeTol));
const scalar mergeTolSqr = Foam::sqr(mergeTol);
// Sort points by magSqr
const Field<point_type> d(tPoints - compareOrigin);
List<scalar> magSqrD(d.size());
forAll(d, pointi)
List<scalar> magSqrDist(nPoints);
forAll(points, pointi)
{
magSqrD[pointi] = magSqr(d[pointi]);
magSqrDist[pointi] = magSqr(points[pointi] - compareOrigin);
}
labelList order;
Foam::sortedOrder(magSqrD, order);
Foam::sortedOrder(magSqrDist, order);
Field<scalar> sortedTol(points.size());
Field<scalar> sortedTol(nPoints);
forAll(order, sortI)
{
const label pointi = order[sortI];
const point_type& pt = points[order[sortI]];
// Convert to scalar precision
// NOTE: not yet using point_type template parameter
const point pt
// Use scalar precision
sortedTol[sortI] =
2*mergeTol*
(
scalar(d[pointi].x()),
scalar(d[pointi].y()),
scalar(d[pointi].z())
mag(scalar(pt.x() - compareOrigin.x())),
+ mag(scalar(pt.y() - compareOrigin.y())),
+ mag(scalar(pt.z() - compareOrigin.z()))
);
sortedTol[sortI] = 2*mergeTol*(mag(pt.x())+mag(pt.y())+mag(pt.z()));
}
label newPointi = 0;
@ -104,11 +107,11 @@ Foam::label Foam::mergePoints
label pointi = order[0];
pointMap[pointi] = newPointi++;
for (label sortI = 1; sortI < order.size(); sortI++)
for (label sortI = 1; sortI < order.size(); ++sortI)
{
// Get original point index
const label pointi = order[sortI];
const scalar mag2 = magSqrD[order[sortI]];
const scalar mag2 = magSqrDist[order[sortI]];
// Convert to scalar precision
// NOTE: not yet using point_type template parameter
@ -127,8 +130,8 @@ Foam::label Foam::mergePoints
(
label prevSortI = sortI - 1;
prevSortI >= 0
&& (mag(magSqrD[order[prevSortI]] - mag2) <= sortedTol[sortI]);
prevSortI--
&& (mag(magSqrDist[order[prevSortI]] - mag2) <= sortedTol[sortI]);
--prevSortI
)
{
const label prevPointi = order[prevSortI];

View File

@ -39,7 +39,7 @@ Description
componentColumns (1 2 3); // component column indices
separator ","; // optional (defaults to ",")
mergeSeparators no; // merge multiple separators
fileName "fileXYZ"; // name of csv data file
file "fileXYZ"; // name of csv data file
outOfBounds clamp; // optional out-of-bounds handling
interpolationScheme linear; // optional interpolation scheme
}

View File

@ -281,22 +281,22 @@ bool Foam::fileFormats::FIREMeshWriter::write(const fileName& meshName) const
if (FIRECore::file3dExtensions.hasEnum(ext))
{
FIRECore::fileExt3d fireFileType = FIRECore::file3dExtensions[ext];
if (fireFileType == FIRECore::POLY_ASCII)
if (fireFileType == FIRECore::fileExt3d::POLY_ASCII)
{
useBinary = false;
useCompress = false;
}
else if (fireFileType == FIRECore::POLY_BINARY)
else if (fireFileType == FIRECore::fileExt3d::POLY_BINARY)
{
useBinary = true;
useCompress = false;
}
else if (fireFileType == FIRECore::POLY_ASCII_COMPRESSED)
else if (fireFileType == FIRECore::fileExt3d::POLY_ASCII_Z)
{
useBinary = false;
useCompress = true;
}
else if (fireFileType == FIRECore::POLY_BINARY_COMPRESSED)
else if (fireFileType == FIRECore::fileExt3d::POLY_BINARY_Z)
{
useBinary = true;
useCompress = true;

View File

@ -27,26 +27,15 @@ License
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
namespace Foam
{
template<>
const char* Foam::NamedEnum
<
Foam::coordSet::coordFormat,
5
>::names[] =
const Foam::Enum<Foam::coordSet::coordFormat>
Foam::coordSet::coordFormatNames_
{
"xyz",
"x",
"y",
"z",
"distance"
{ coordFormat::XYZ, "xyz" },
{ coordFormat::X, "x" },
{ coordFormat::Y, "y" },
{ coordFormat::Z, "z" },
{ coordFormat::DISTANCE, "distance" }
};
}
const Foam::NamedEnum<Foam::coordSet::coordFormat, 5>
Foam::coordSet::coordFormatNames_;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -37,6 +37,7 @@ SourceFiles
#include "pointField.H"
#include "word.H"
#include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -70,7 +71,7 @@ public:
private:
//- String representation of coordFormat enums
static const NamedEnum<coordFormat, 5> coordFormatNames_;
static const Enum<coordFormat> coordFormatNames_;
protected:

View File

@ -27,24 +27,14 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::NamedEnum<Foam::fileFormats::FIRECore::fileExt3d, 4>
Foam::fileFormats::FIRECore::file3dExtensions;
namespace Foam
{
template<>
const char* Foam::NamedEnum
<
Foam::fileFormats::FIRECore::fileExt3d,
4
>::names[] =
const Foam::Enum<Foam::fileFormats::FIRECore::fileExt3d>
Foam::fileFormats::FIRECore::file3dExtensions
{
"fpma",
"fpmb",
"fpmaz",
"fpmbz"
{ fileExt3d::POLY_ASCII, "fpma" },
{ fileExt3d::POLY_BINARY, "fpmb" },
{ fileExt3d::POLY_ASCII_Z, "fpmaz" },
{ fileExt3d::POLY_BINARY_Z, "fpmbz" }
};
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -40,7 +40,7 @@ SourceFiles
#include "labelList.H"
#include "pointField.H"
#include "IOstreams.H"
#include "NamedEnum.H"
#include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -86,8 +86,8 @@ public:
{
POLY_ASCII,
POLY_BINARY,
POLY_ASCII_COMPRESSED,
POLY_BINARY_COMPRESSED
POLY_ASCII_Z,
POLY_BINARY_Z
};
@ -97,11 +97,12 @@ public:
//- Float type (binary format)
typedef double fireReal_t;
protected:
// Protected Data
static const NamedEnum<fileExt3d, 4> file3dExtensions;
static const Enum<fileExt3d> file3dExtensions;
// Protected Member Functions

View File

@ -33,40 +33,22 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::NamedEnum<Foam::fileFormats::STARCDCore::fileHeader, 3>
Foam::fileFormats::STARCDCore::fileHeaders_;
const Foam::NamedEnum<Foam::fileFormats::STARCDCore::fileExt, 4>
Foam::fileFormats::STARCDCore::fileExtensions_;
namespace Foam
{
template<>
const char* Foam::NamedEnum
<
Foam::fileFormats::STARCDCore::fileHeader,
3
>::names[] =
const Foam::Enum<Foam::fileFormats::STARCDCore::fileHeader>
Foam::fileFormats::STARCDCore::fileHeaders_
{
"PROSTAR_CELL",
"PROSTAR_VERTEX",
"PROSTAR_BOUNDARY"
{ fileHeader::HEADER_CEL, "PROSTAR_CELL" },
{ fileHeader::HEADER_VRT, "PROSTAR_VERTEX" },
{ fileHeader::HEADER_BND, "PROSTAR_BOUNDARY" }
};
template<>
const char* Foam::NamedEnum
<
Foam::fileFormats::STARCDCore::fileExt,
4
>::names[] =
const Foam::Enum<Foam::fileFormats::STARCDCore::fileExt>
Foam::fileFormats::STARCDCore::fileExtensions_
{
"cel",
"vrt",
"bnd",
"inp"
{ fileExt::CEL_FILE, "cel" },
{ fileExt::VRT_FILE, "vrt" },
{ fileExt::BND_FILE, "bnd" },
{ fileExt::INP_FILE, "inp" }
};
}
const char* const Foam::fileFormats::STARCDCore::defaultBoundaryName =
"Default_Boundary_Region";

View File

@ -36,7 +36,7 @@ SourceFiles
#define STARCDCore_H
#include "IFstream.H"
#include "NamedEnum.H"
#include "Enum.H"
#include "pointField.H"
#include "Map.H"
#include "FixedList.H"
@ -113,8 +113,8 @@ private:
// Private Data
static const NamedEnum<fileHeader, 3> fileHeaders_;
static const NamedEnum<fileExt, 4> fileExtensions_;
static const Enum<fileHeader> fileHeaders_;
static const Enum<fileExt> fileExtensions_;
protected:

View File

@ -26,6 +26,7 @@ License
#include "STLReader.H"
#include "Map.H"
#include "IFstream.H"
#include "mergePoints.H"
#undef DEBUG_STLBINARY
@ -202,4 +203,38 @@ void Foam::fileFormats::STLReader::clear()
}
Foam::label Foam::fileFormats::STLReader::mergePointsMap
(
labelList& pointMap
) const
{
// With the merge distance depending on the input format (ASCII | BINARY),
// but must be independent of WM_SP or WM_DP flag.
// - floatScalarSMALL = 1e-6
// - doubleScalarSMALL = 1e-15
return mergePointsMap
(
(format_ == BINARY ? 10 : 100) * doubleScalarSMALL,
pointMap
);
}
Foam::label Foam::fileFormats::STLReader::mergePointsMap
(
const scalar mergeTol,
labelList& pointMap
) const
{
return Foam::mergePoints
(
points_,
mergeTol,
false, // verbose
pointMap
);
}
// ************************************************************************* //

View File

@ -61,7 +61,7 @@ class STLReader
bool sorted_;
//- The points supporting the facets
pointField points_;
List<STLpoint> points_;
//- The zones associated with the faces
List<label> zoneIds_;
@ -117,6 +117,15 @@ public:
//- Flush all values
void clear();
//- Calculate merge points mapping, return old to new pointMap.
// The merge tolerance based on ASCII or BINARY input format.
// \return number of unique points
label mergePointsMap(labelList& pointMap) const;
//- Calculate merge points mapping, return old to new pointMap.
// \return number of unique points
label mergePointsMap(const scalar mergeTol, labelList& pointMap) const;
//- File read was already sorted?
inline bool sorted() const
{
@ -124,7 +133,7 @@ public:
}
//- Return full access to the points
inline pointField& points()
inline List<STLpoint>& points()
{
return points_;
}

View File

@ -23,9 +23,10 @@ License
\*---------------------------------------------------------------------------*/
%{
%option prefix="yySTL"
%option yyclass="yySTLFlexLexer"
#undef yyFlexLexer
%{
/* ------------------------------------------------------------------------ *\
------ local definitions
@ -35,9 +36,9 @@ License
#include "OSspecific.H"
using namespace Foam;
// Dummy yyFlexLexer::yylex() to keep the linker happy. It is not called
//! \cond dummy
#if YY_FLEX_MAJOR_VERSION <= 2 && YY_FLEX_MINOR_VERSION <= 5 && YY_FLEX_SUBMINOR_VERSION < 34
int yyFlexLexer::yylex()
{
FatalErrorInFunction
@ -45,29 +46,29 @@ int yyFlexLexer::yylex()
<< abort(FatalError);
return 0;
}
#endif
//! \endcond
// Dummy yywrap to keep yylex happy at compile time.
// It is called by yylex but is not used as the mechanism to change file.
// See <<EOF>>
//! \cond dummy
#if YY_FLEX_MINOR_VERSION < 6 && YY_FLEX_SUBMINOR_VERSION < 34
#if YY_FLEX_MAJOR_VERSION <= 2 && YY_FLEX_MINOR_VERSION <= 5 && YY_FLEX_SUBMINOR_VERSION < 34
extern "C" int yywrap()
#else
int yyFlexLexer::yywrap()
int yySTLFlexLexer::yywrap()
#endif
{
return 1;
}
//! \endcond
//- A lexer for parsing STL ASCII files.
// Returns DynamicList(s) of points and facets (zoneIds).
// The facets are within a solid/endsolid grouping
class STLASCIILexer
:
public yyFlexLexer
public yySTLFlexLexer
{
// Private data
@ -76,7 +77,7 @@ class STLASCIILexer
label lineNo_;
word startError_;
DynamicList<point> points_;
DynamicList<STLpoint> points_;
DynamicList<label> facets_;
DynamicList<word> names_;
DynamicList<label> sizes_;
@ -104,7 +105,7 @@ public:
}
//- A list of unstitched triangle points
inline DynamicList<point>& points()
inline DynamicList<STLpoint>& points()
{
return points_;
}
@ -132,7 +133,7 @@ public:
STLASCIILexer::STLASCIILexer(istream* is, const label approxNpoints)
:
yyFlexLexer(is),
yySTLFlexLexer(is),
sorted_(true),
groupID_(-1),
lineNo_(1),
@ -145,6 +146,7 @@ STLASCIILexer::STLASCIILexer(istream* is, const label approxNpoints)
------ cppLexer::yylex()
\* ------------------------------------------------------------------------ */
#undef YY_DECL
#define YY_DECL int STLASCIILexer::lex()
%}
@ -202,9 +204,9 @@ endsolid {space}("endsolid"|"ENDSOLID")({some_space}{word})*
// End of read character pointer returned by strtof
// char* endPtr;
STLpoint normal;
label cmpt = 0; // Component index when reading vertex
STLpoint vertex;
label cmpt = 0; // component index used for reading vertex
// STLpoint normal;
static const char* stateNames[7] =
{
@ -238,66 +240,79 @@ endsolid {space}("endsolid"|"ENDSOLID")({some_space}{word})*
{solid} {
BEGIN(readSolidName);
}
}
<readSolidName>{string} {
word name(Foam::string::validate<word>(YYText()));
const word solidName(Foam::string::validate<word>(YYText()));
HashTable<label>::const_iterator fnd = lookup_.find(name);
if (fnd != lookup_.end())
auto iter = lookup_.cfind(solidName);
if (iter.found())
{
if (groupID_ != fnd())
if (groupID_ != iter.object())
{
// group appeared out of order
sorted_ = false;
sorted_ = false; // Group appeared out of order
groupID_ = iter.object();
}
groupID_ = fnd();
}
else
{
groupID_ = sizes_.size();
lookup_.insert(name, groupID_);
names_.append(name);
if (lookup_.insert(solidName, groupID_))
{
names_.append(solidName);
sizes_.append(0);
}
BEGIN(INITIAL);
else
{
FatalErrorInFunction<< "Duplicate solid-name: " << solidName
<< exit(FatalError);
}
}
BEGIN(INITIAL);
}
<readSolidName>{space}\n {
word name("solid");
const word solidName("solid"); // Could also use solid0, solid1, ...
HashTable<label>::const_iterator fnd = lookup_.find(name);
if (fnd != lookup_.end())
auto iter = lookup_.cfind(solidName);
if (iter.found())
{
if (groupID_ != fnd())
if (groupID_ != iter.object())
{
// group appeared out of order
sorted_ = false;
sorted_ = false; // Group appeared out of order
groupID_ = iter.object();
}
groupID_ = fnd();
}
else
{
groupID_ = sizes_.size();
lookup_.insert(name, groupID_);
names_.append(name);
if (lookup_.insert(solidName, groupID_))
{
names_.append(solidName);
sizes_.append(0);
}
lineNo_++;
BEGIN(INITIAL);
else
{
FatalErrorInFunction<< "Duplicate solid-name: " << solidName
<< exit(FatalError);
}
}
++lineNo_;
BEGIN(INITIAL);
}
{color} {
}
/* ignore 'color' */
}
{facet} {
BEGIN(readFacet);
}
}
<readFacet>{normal} {
BEGIN(readNormal);
}
}
<readNormal>{point} {
/*
@ -308,15 +323,15 @@ endsolid {space}("endsolid"|"ENDSOLID")({some_space}{word})*
normals_.append(normal);
*/
BEGIN(readFacet);
}
}
<readFacet>{outerloop} {
BEGIN(readVertices);
}
}
<readVertices>{vertex} {
BEGIN(readVertex);
}
}
<readVertex>{space}{signedInteger}{space} {
vertex[cmpt++] = atol(YYText());
@ -327,7 +342,7 @@ endsolid {space}("endsolid"|"ENDSOLID")({some_space}{word})*
points_.append(vertex);
BEGIN(readVertices);
}
}
}
<readVertex>{space}{floatNum}{space} {
vertex[cmpt++] = atof(YYText());
@ -338,26 +353,26 @@ endsolid {space}("endsolid"|"ENDSOLID")({some_space}{word})*
points_.append(vertex);
BEGIN(readVertices);
}
}
}
<readVertices>{endloop} {
BEGIN(readFacet);
}
}
<readFacet>{endfacet} {
facets_.append(groupID_);
sizes_[groupID_]++;
BEGIN(INITIAL);
}
}
{endsolid} {
}
}
/* ------------------ Ignore remaining space and \n s. -------------------- */
/* ---------------- Ignore remaining spaces and newlines ------------------ */
<*>{space} {}
<*>\n { lineNo_++; }
<*>\n { ++lineNo_; }
/* ------------------- Any other characters are errors -------------------- */
@ -365,7 +380,7 @@ endsolid {space}("endsolid"|"ENDSOLID")({some_space}{word})*
<*>. {
startError_ = YYText();
yy_push_state(stlError);
}
}
/* ---------------------------- Error handler ----------------------------- */
@ -377,14 +392,14 @@ endsolid {space}("endsolid"|"ENDSOLID")({some_space}{word})*
<< " expected " << stateExpects[YY_START]
<< " but found '" << startError_.c_str() << YYText() << "'"
<< exit(FatalError);
}
}
/* ------------------------ On EOF terminate ---------------------------- */
<<EOF>> {
yyterminate();
}
}
%%

View File

@ -47,7 +47,7 @@ namespace Foam
class STLpoint
:
public Vector<float>
public floatVector
{
public:
@ -58,28 +58,34 @@ public:
inline STLpoint()
{}
//- Construct from base class
inline STLpoint(const floatVector& v)
:
floatVector(v)
{}
//- Construct from components
inline STLpoint(float x, float y, float z)
:
Vector<float>(x, y, z)
floatVector(x, y, z)
{}
//- Construct from components
inline STLpoint(double x, double y, double z)
:
Vector<float>(float(x), float(y), float(z))
floatVector(float(x), float(y), float(z))
{}
//- Construct from point
inline STLpoint(const point& pt)
:
Vector<float>(float(pt.x()), float(pt.y()), float(pt.z()))
floatVector(float(pt.x()), float(pt.y()), float(pt.z()))
{}
//- Construct from istream
inline STLpoint(Istream& is)
:
Vector<float>(is)
floatVector(is)
{}

View File

@ -35,50 +35,39 @@ License
namespace Foam
{
defineTypeNameAndDebug(vtkUnstructuredReader, 1);
template<>
const char*
NamedEnum<vtkUnstructuredReader::vtkDataType, 8>::names[] =
{
"int",
"unsigned_int",
"long",
"unsigned_long",
"float",
"double",
"string",
"vtkIdType"
};
const NamedEnum<vtkUnstructuredReader::vtkDataType, 8>
vtkUnstructuredReader::vtkDataTypeNames;
template<>
const char*
NamedEnum<vtkUnstructuredReader::vtkDataSetType, 3>::names[] =
{
"FIELD",
"SCALARS",
"VECTORS"
};
const NamedEnum<vtkUnstructuredReader::vtkDataSetType, 3>
vtkUnstructuredReader::vtkDataSetTypeNames;
template<>
const char*
NamedEnum<vtkUnstructuredReader::parseMode, 5>::names[] =
{
"NOMODE",
"UNSTRUCTURED_GRID",
"POLYDATA",
"CELL_DATA",
"POINT_DATA"
};
const NamedEnum<vtkUnstructuredReader::parseMode, 5>
vtkUnstructuredReader::parseModeNames;
}
const Foam::Enum<Foam::vtkUnstructuredReader::vtkDataType>
Foam::vtkUnstructuredReader::vtkDataTypeNames
{
{ vtkDataType::VTK_INT, "int" },
{ vtkDataType::VTK_UINT, "unsigned_int" },
{ vtkDataType::VTK_LONG, "long" },
{ vtkDataType::VTK_ULONG, "unsigned_long" },
{ vtkDataType::VTK_FLOAT, "float" },
{ vtkDataType::VTK_DOUBLE, "double" },
{ vtkDataType::VTK_STRING, "string" },
{ vtkDataType::VTK_ID, "vtkIdType" }
};
const Foam::Enum<Foam::vtkUnstructuredReader::vtkDataSetType>
Foam::vtkUnstructuredReader::vtkDataSetTypeNames
{
{ vtkDataSetType::VTK_FIELD, "FIELD" },
{ vtkDataSetType::VTK_SCALARS, "SCALARS" },
{ vtkDataSetType::VTK_VECTORS, "VECTORS" }
};
const Foam::Enum<Foam::vtkUnstructuredReader::parseMode>
Foam::vtkUnstructuredReader::parseModeNames
{
{ parseMode::NOMODE, "NOMODE" },
{ parseMode::UNSTRUCTURED_GRID, "UNSTRUCTURED_GRID" },
{ parseMode::POLYDATA, "POLYDATA" },
{ parseMode::CELL_DATA, "CELL_DATA" },
{ parseMode::POINT_DATA, "POINT_DATA" }
};
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -51,7 +51,7 @@ SourceFiles
#include "objectRegistry.H"
#include "cellShapeList.H"
#include "HashSet.H"
#include "NamedEnum.H"
#include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -83,7 +83,7 @@ public:
VTK_ID
};
static const NamedEnum<vtkDataType, 8> vtkDataTypeNames;
static const Enum<vtkDataType> vtkDataTypeNames;
//- Enumeration defining the vtk dataset types
@ -94,11 +94,10 @@ public:
VTK_VECTORS
};
static const NamedEnum<vtkDataSetType, 3> vtkDataSetTypeNames;
static const Enum<vtkDataSetType> vtkDataSetTypeNames;
//- Enumeration defining the parse mode - what type of data is being
// read
//- Enumeration defining the parse mode - type of data being read
enum parseMode
{
NOMODE,
@ -108,7 +107,7 @@ public:
POINT_DATA
};
static const NamedEnum<parseMode, 5> parseModeNames;
static const Enum<parseMode> parseModeNames;
private:

View File

@ -59,7 +59,7 @@ Usage
componentColumns 1(1);
separator ",";
mergeSeparators no;
fileName "$FOAM_CASE/constant/pressureVsU";
file "$FOAM_CASE/constant/pressureVsU";
}
value uniform 0;
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -61,7 +61,10 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField
:
totalPressureFvPatchScalarField(p, iF),
fanCurve_(),
direction_(ffdOut)
direction_(ffdOut),
nonDimensional_(false),
rpm_(0.0),
dm_(0.0)
{}
@ -75,7 +78,10 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField
:
totalPressureFvPatchScalarField(ptf, p, iF, mapper),
fanCurve_(ptf.fanCurve_),
direction_(ptf.direction_)
direction_(ptf.direction_),
nonDimensional_(ptf.nonDimensional_),
rpm_(ptf.rpm_),
dm_(ptf.dm_)
{}
@ -88,8 +94,17 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField
:
totalPressureFvPatchScalarField(p, iF, dict),
fanCurve_(dict),
direction_(fanFlowDirectionNames_.read(dict.lookup("direction")))
{}
direction_(fanFlowDirectionNames_.read(dict.lookup("direction"))),
nonDimensional_(dict.lookupOrDefault<Switch>("nonDimensional", false)),
rpm_(dict.lookupOrDefault<scalar>("rpm", 0.0)),
dm_(dict.lookupOrDefault<scalar>("dm", 0.0))
{
if (nonDimensional_)
{
dict.lookup("rpm") >> rpm_;
dict.lookup("dm") >> dm_;
}
}
Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField
@ -99,7 +114,10 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField
:
totalPressureFvPatchScalarField(pfopsf),
fanCurve_(pfopsf.fanCurve_),
direction_(pfopsf.direction_)
direction_(pfopsf.direction_),
nonDimensional_(pfopsf.nonDimensional_),
rpm_(pfopsf.rpm_),
dm_(pfopsf.dm_)
{}
@ -111,7 +129,10 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField
:
totalPressureFvPatchScalarField(pfopsf, iF),
fanCurve_(pfopsf.fanCurve_),
direction_(pfopsf.direction_)
direction_(pfopsf.direction_),
nonDimensional_(pfopsf.nonDimensional_),
rpm_(pfopsf.rpm_),
dm_(pfopsf.dm_)
{}
@ -156,8 +177,21 @@ void Foam::fanPressureFvPatchScalarField::updateCoeffs()
<< exit(FatalError);
}
if (nonDimensional_)
{
// Create an adimensional flow rate
volFlowRate =
120.0*volFlowRate/pow3(constant::mathematical::pi)/pow3(dm_);
}
// Pressure drop for this flow rate
const scalar pdFan = fanCurve_(max(volFlowRate, 0.0));
scalar pdFan = fanCurve_(max(volFlowRate, 0.0));
if (nonDimensional_)
{
// Convert the adimensional deltap from curve into deltaP
pdFan = pdFan*pow4(constant::mathematical::pi)*rpm_*sqr(dm_)/1800;
}
totalPressureFvPatchScalarField::updateCoeffs
(
@ -173,6 +207,10 @@ void Foam::fanPressureFvPatchScalarField::write(Ostream& os) const
fanCurve_.write(os);
os.writeKeyword("direction")
<< fanFlowDirectionNames_[direction_] << token::END_STATEMENT << nl;
os.writeKeyword("nonDimensional") << nonDimensional_
<< token::END_STATEMENT << nl;
os.writeEntry("rpm", rpm_);
os.writeEntry("dm", dm_);
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,13 +31,34 @@ Description
This boundary condition can be applied to assign either a pressure inlet
or outlet total pressure condition for a fan.
The switch nonDimensional can be used for a non-dimensional table. It needs
inputs rpm and dm of the fan.
The nonDimensional flux for the table is calculate as :
phi = 4.0*mDot/(rho*sqr(PI)*dm^3*omega)
where:
dm is the mean diameter.
omega is rad/sec.
The nonDimensinal pressure :
Psi = 2 deltaP/(rho*(sqr(PI*omega*dm)))
where:
deltaP is the pressure drop
The non-dimensional table should be given as Psi = F(phi).
Usage
\table
Property | Description | Required | Default value
fileName | fan curve file name | yes |
file | fan curve file name | yes |
outOfBounds | out of bounds handling | yes |
direction | direction of flow through fan [in/out] | yes |
p0 | environmental total pressure | yes |
nonDimensional | uses non-dimensional table | no | false
rpm | fan rpm for non-dimensional table | no | 0.0
dm | mean diameter for non-dimensional table | no | 0.0
\endtable
Example of the boundary condition specification:
@ -45,7 +66,7 @@ Usage
inlet
{
type fanPressure;
fileName "fanCurve";
file "fanCurve";
outOfBounds clamp;
direction in;
p0 uniform 0;
@ -55,7 +76,7 @@ Usage
outlet
{
type fanPressure;
fileName "fanCurve";
file "fanCurve";
outOfBounds clamp;
direction out;
p0 uniform 0;
@ -116,6 +137,17 @@ private:
//- Direction of flow through the fan relative to patch
fanFlowDirection direction_;
//- Swtich for using non-dimensional curve
Switch nonDimensional_;
// Parameters for non-dimensional table
//- Fan rpm
scalar rpm_;
//- Fan mean diameter
scalar dm_;
public:

View File

@ -52,7 +52,7 @@ Usage
componentColumns (1 2 3); // Component column indices
separator ","; // Optional (defaults to ",")
mergeSeparators no; // Merge multiple separators
fileName "Uprofile.csv"; // name of csv data file
file "Uprofile.csv"; // name of csv data file
outOfBounds clamp; // Optional out-of-bounds handling
interpolationScheme linear; // Optional interpolation scheme
}

View File

@ -37,18 +37,19 @@ void Foam::LimitedScheme<Type, Limiter, LimitFunc>::calcLimiter
surfaceScalarField& limiterField
) const
{
typedef GeometricField<typename Limiter::phiType, fvPatchField, volMesh>
VolFieldType;
typedef GeometricField<typename Limiter::gradPhiType, fvPatchField, volMesh>
GradVolFieldType;
const fvMesh& mesh = this->mesh();
tmp<GeometricField<typename Limiter::phiType, fvPatchField, volMesh>>
tlPhi = LimitFunc<Type>()(phi);
tmp<VolFieldType> tlPhi = LimitFunc<Type>()(phi);
const VolFieldType& lPhi = tlPhi();
const GeometricField<typename Limiter::phiType, fvPatchField, volMesh>&
lPhi = tlPhi();
tmp<GeometricField<typename Limiter::gradPhiType, fvPatchField, volMesh>>
tgradc(fvc::grad(lPhi));
const GeometricField<typename Limiter::gradPhiType, fvPatchField, volMesh>&
gradc = tgradc();
tmp<GradVolFieldType> tgradc(fvc::grad(lPhi));
const GradVolFieldType& gradc = tgradc();
const surfaceScalarField& CDweights = mesh.surfaceInterpolation::weights();
@ -76,8 +77,7 @@ void Foam::LimitedScheme<Type, Limiter, LimitFunc>::calcLimiter
);
}
surfaceScalarField::Boundary& bLim =
limiterField.boundaryFieldRef();
surfaceScalarField::Boundary& bLim = limiterField.boundaryFieldRef();
forAll(bLim, patchi)
{
@ -128,6 +128,8 @@ void Foam::LimitedScheme<Type, Limiter, LimitFunc>::calcLimiter
pLim = 1.0;
}
}
limiterField.setOriented();
}

View File

@ -22,6 +22,8 @@ $(derivedSources)/directionalPressureGradientExplicitSource/directionalPressureG
$(derivedSources)/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSourceIO.C
$(derivedSources)/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.C
$(derivedSources)/explicitPorositySource/explicitPorositySource.C
$(derivedSources)/jouleHeatingSource/jouleHeatingSource.C
$(derivedSources)/jouleHeatingSource/jouleHeatingSourceIO.C
$(derivedSources)/meanVelocityForce/meanVelocityForce.C
$(derivedSources)/meanVelocityForce/meanVelocityForceIO.C
$(derivedSources)/meanVelocityForce/patchMeanVelocityForce/patchMeanVelocityForce.C

View File

@ -0,0 +1,215 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "jouleHeatingSource.H"
#include "fvMatrices.H"
#include "fvmLaplacian.H"
#include "fvcGrad.H"
#include "zeroGradientFvPatchField.H"
#include "basicThermo.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
defineTypeNameAndDebug(jouleHeatingSource, 0);
addToRunTimeSelectionTable
(
option,
jouleHeatingSource,
dictionary
);
}
}
const Foam::word Foam::fv::jouleHeatingSource::sigmaName(typeName + ":sigma");
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
const Foam::coordinateSystem& Foam::fv::jouleHeatingSource::coordSys() const
{
if (!coordSysPtr_.valid())
{
FatalErrorInFunction
<< "Co-ordinate system invalid"
<< abort(FatalError);
}
return coordSysPtr_();
}
Foam::tmp<Foam::volSymmTensorField>
Foam::fv::jouleHeatingSource::transformSigma
(
const volVectorField& sigmaLocal
) const
{
tmp<volSymmTensorField> tsigma
(
new volSymmTensorField
(
IOobject
(
sigmaName,
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh_,
dimensionedSymmTensor("0", sigmaLocal.dimensions(), Zero),
zeroGradientFvPatchField<symmTensor>::typeName
)
);
volSymmTensorField& sigma = tsigma.ref();
sigma.primitiveFieldRef() = coordSys().R().transformVector(sigmaLocal);
sigma.correctBoundaryConditions();
return tsigma;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::jouleHeatingSource::jouleHeatingSource
(
const word& sourceName,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
)
:
option(sourceName, modelType, dict, mesh),
TName_("T"),
V_
(
IOobject
(
typeName + ":V",
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
),
anisotropicElectricalConductivity_(false),
scalarSigmaVsTPtr_(nullptr),
vectorSigmaVsTPtr_(nullptr),
coordSysPtr_(nullptr),
curTimeIndex_(-1)
{
// Set the field name to that of the energy field from which the temperature
// is obtained
const basicThermo& thermo =
mesh_.lookupObject<basicThermo>(basicThermo::dictName);
fieldNames_.setSize(1, thermo.he().name());
applied_.setSize(fieldNames_.size(), false);
read(dict);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::fv::jouleHeatingSource::~jouleHeatingSource()
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
void Foam::fv::jouleHeatingSource::addSup
(
const volScalarField& rho,
fvMatrix<scalar>& eqn,
const label fieldi
)
{
DebugInfo<< name() << ": applying source to " << eqn.psi().name() << endl;
if (curTimeIndex_ != mesh_.time().timeIndex())
{
if (anisotropicElectricalConductivity_)
{
// Update sigma as a function of T if required
const volVectorField& sigmaLocal = updateSigma(vectorSigmaVsTPtr_);
tmp<volSymmTensorField> sigma = transformSigma(sigmaLocal);
// Solve the electrical potential equation
fvScalarMatrix VEqn(fvm::laplacian(sigma, V_));
VEqn.relax();
VEqn.solve();
}
else
{
// Update sigma as a function of T if required
const volScalarField& sigma = updateSigma(scalarSigmaVsTPtr_);
// Solve the electrical potential equation
fvScalarMatrix VEqn(fvm::laplacian(sigma, V_));
VEqn.relax();
VEqn.solve();
}
curTimeIndex_ = mesh_.time().timeIndex();
}
// Add the Joule heating contribution
const volVectorField gradV(fvc::grad(V_));
if (anisotropicElectricalConductivity_)
{
const volVectorField& sigmaLocal =
mesh_.lookupObject<volVectorField>(sigmaName);
tmp<volSymmTensorField> sigma = transformSigma(sigmaLocal);
eqn += (sigma & gradV) & gradV;
}
else
{
const volScalarField& sigma =
mesh_.lookupObject<volScalarField>(sigmaName);
eqn += (sigma*gradV) & gradV;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,278 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::fv::jouleHeatingSource
Group
grpFvOptionsSources
Description
Evolves an electrical potential equation
\f[
\grad \left( \sigma \grad V \right)
\f]
where \f$ V \f$ is electrical potential and \f$\sigma\f$ is the
electrical current
To provide a Joule heating contribution according to:
Differential form of Joule heating - power per unit volume:
\f[
\frac{d(P)}{d(V)} = J \cdot E
\f]
where \f$ J \f$ is the current density and \f$ E \f$ the electric field.
If no magnetic field is present:
\f[
J = \sigma E
\f]
The electric field given by
\f[
E = \grad V
\f]
Therefore:
\f[
\frac{d(P)}{d(V)} = J \cdot E
= (sigma E) \cdot E
= (sigma \grad V) \cdot \grad V
\f]
Usage
Isotropic (scalar) electrical conductivity
\verbatim
jouleHeatingSourceCoeffs
{
anisotropicElectricalConductivity no;
// Optionally specify the conductivity as a function of temperature
// Note: if not supplied, this will be read from the time directory
sigma table
(
(273 1e5)
(1000 1e5)
);
}
\endverbatim
Anisotropic (vectorial) electrical conductivity
jouleHeatingSourceCoeffs
{
anisotropicElectricalConductivity yes;
coordinateSystem
{
type cartesian;
origin (0 0 0);
coordinateRotation
{
type axesRotation;
e1 (1 0 0);
e3 (0 0 1);
}
}
// Optionally specify sigma as a function of temperature
//sigma (31900 63800 127600);
//
//sigma table
//(
// (0 (0 0 0))
// (1000 (127600 127600 127600))
//);
}
Where:
\table
Property | Description | Required | Default value
T | Name of temperature field | no | T
sigma | Electrical conductivity as a function of temperature |no|
anisotropicElectricalConductivity | Anisotropic flag | yes |
\endtable
The electrical conductivity can be specified using either:
- If the \c sigma entry is present the electrical conductivity is specified
as a function of temperature using a Function1 type
- If not present the sigma field will be read from file
- If the anisotropicElectricalConductivity flag is set to 'true', sigma
should be specified as a vector quantity
SourceFiles
jouleHeatingSource.C
SeeAlso
Foam::Function1
\*---------------------------------------------------------------------------*/
#ifndef fv_jouleHeatingSource_H
#define fv_jouleHeatingSource_H
#include "fvOption.H"
#include "Function1.H"
#include "coordinateSystem.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
/*---------------------------------------------------------------------------*\
Class jouleHeatingSource Declaration
\*---------------------------------------------------------------------------*/
class jouleHeatingSource
:
public option
{
// Private data
//- Name of electrical conductivity field
static const word sigmaName;
//- Name of temperature field - default = "T" (optional)
word TName_;
//- Electrical potential field / [V]
volScalarField V_;
//- Flag to indicate that the electrical conductivity is anisotropic
bool anisotropicElectricalConductivity_;
//- Electrical conductivity as a scalar function of temperature
autoPtr<Function1<scalar>> scalarSigmaVsTPtr_;
//- Electrical conductivity as a vector function of temperature
autoPtr<Function1<vector>> vectorSigmaVsTPtr_;
//- Co-ordinate system - used for vectorial electrical conductivity
autoPtr<coordinateSystem> coordSysPtr_;
//- Current time index (used for updating)
label curTimeIndex_;
// Private Member Functions
//- Disallow default bitwise copy construct
jouleHeatingSource(const jouleHeatingSource&);
//- Disallow default bitwise assignment
void operator=(const jouleHeatingSource&);
//- Return the co-ordinate system for anisotropic electrical
// conductivity
const coordinateSystem& coordSys() const;
//- Transform the anisotropic electrical conductivity into global system
tmp<volSymmTensorField> transformSigma
(
const volVectorField& sigmaLocal
) const;
//- Initialise the electrical conductivity field
template<class Type>
void initialiseSigma
(
const dictionary& dict,
autoPtr<Function1<Type>>& sigmaVsTPtr
);
//- Update the electrical conductivity field
template<class Type>
const GeometricField<Type, fvPatchField, volMesh>&
updateSigma(const autoPtr<Function1<Type>>& sigmaVsTPtr) const;
public:
//- Runtime type information
TypeName("jouleHeatingSource");
// Constructors
//- Construct from explicit source name and mesh
jouleHeatingSource
(
const word& sourceName,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
);
//- Destructor
virtual ~jouleHeatingSource();
// Member Functions
// Evaluate
//- Add explicit contribution to compressible momentum equation
virtual void addSup
(
const volScalarField& rho,
fvMatrix<scalar>& eqn,
const label fieldi
);
// IO
//- Read source dictionary
virtual bool read(const dictionary& dict);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "jouleHeatingSourceTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,59 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "jouleHeatingSource.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::fv::jouleHeatingSource::read(const dictionary& dict)
{
if (option::read(dict))
{
coeffs_.readIfPresent("T", TName_);
coeffs_.lookup("anisotropicElectricalConductivity")
>> anisotropicElectricalConductivity_;
if (anisotropicElectricalConductivity_)
{
Info<< " Using vector electrical conductivity" << endl;
initialiseSigma(coeffs_, vectorSigmaVsTPtr_);
coordSysPtr_ = coordinateSystem::New(mesh_, coeffs_);
}
else
{
Info<< " Using scalar electrical conductivity" << endl;
initialiseSigma(coeffs_, scalarSigmaVsTPtr_);
}
return true;
}
return false;
}
// ************************************************************************* //

View File

@ -0,0 +1,147 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "emptyFvPatchField.H"
template<class Type>
void Foam::fv::jouleHeatingSource::initialiseSigma
(
const dictionary& dict,
autoPtr<Function1<Type>>& sigmaVsTPtr
)
{
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
if (dict.found("sigma"))
{
// Sigma to be defined using a Funcion1 type
sigmaVsTPtr = Function1<Type>::New("sigma", dict);
tmp<VolFieldType> tsigma
(
new VolFieldType
(
IOobject
(
typeName + ":sigma",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh_,
dimensioned<Type>
(
"0",
sqr(dimCurrent)/dimPower/dimLength,
Zero
)
)
);
mesh_.objectRegistry::store(tsigma.ptr());
Info<< " Conductivity 'sigma' read from dictionary as f(T)"
<< nl << endl;
}
else
{
// Sigma to be defined by user input
tmp<VolFieldType> tsigma
(
new VolFieldType
(
IOobject
(
typeName + ":sigma",
mesh_.time().timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
)
);
mesh_.objectRegistry::store(tsigma.ptr());
Info<< " Conductivity 'sigma' read from file" << nl << endl;
}
}
template<class Type>
const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&
Foam::fv::jouleHeatingSource::updateSigma
(
const autoPtr<Function1<Type>>& sigmaVsTPtr
) const
{
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
VolFieldType& sigma =
const_cast<VolFieldType&>
(
mesh_.lookupObject<VolFieldType>(typeName + ":sigma")
);
if (!sigmaVsTPtr.valid())
{
// Electrical conductivity field, sigma, was specified by the user
return sigma;
}
const volScalarField& T = mesh_.lookupObject<volScalarField>(TName_);
// Internal field
forAll(sigma, i)
{
sigma[i] = sigmaVsTPtr->value(T[i]);
}
// Boundary field
typename VolFieldType::Boundary& bf = sigma.boundaryFieldRef();
forAll(bf, patchi)
{
fvPatchField<Type>& pf = bf[patchi];
if (!isA<emptyFvPatchField<Type>>(pf))
{
const scalarField& Tbf = T.boundaryField()[patchi];
forAll(pf, facei)
{
pf[facei] = sigmaVsTPtr->value(Tbf[facei]);
}
}
}
// Update processor patches
sigma.correctBoundaryConditions();
return sigma;
}
// ************************************************************************* //

View File

@ -200,6 +200,9 @@ void Foam::patchProbes::findElements(const fvMesh& mesh)
processor_.setSize(nearest.size());
processor_ = -1;
processor_.setSize(size());
processor_ = -1;
forAll(nearest, sampleI)
{
processor_[sampleI] = nearest[sampleI].second().second();
@ -207,7 +210,10 @@ void Foam::patchProbes::findElements(const fvMesh& mesh)
{
// Store the face to sample
faceList_[sampleI] = nearest[sampleI].first().index();
label facei = faceList_[sampleI];
processor_[sampleI] = (facei != -1 ? Pstream::myProcNo() : -1);
}
reduce(processor_[sampleI], maxOp<label>());
}
}

View File

@ -222,7 +222,7 @@ void Foam::fileFormats::FLMAsurfaceFormat<Face>::write
// Set the precision of the points data to 10
os.precision(10);
Info<< "points: " << pointLst.size() << endl;
Info<< nl << "points: " << pointLst.size() << endl;
putFireLabel(os, pointLst.size());
newline(os);

View File

@ -24,7 +24,6 @@ License
\*---------------------------------------------------------------------------*/
#include "STLsurfaceFormat.H"
#include "labelledTri.H"
#include "triPointRef.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -126,13 +125,25 @@ bool Foam::fileFormats::STLsurfaceFormat<Face>::read
{
this->clear();
// read in the values
// Read in the values
STLReader reader(filename);
// transfer points
this->storedPoints().transfer(reader.points());
// Get the map for stitched surface points, with merge tolerance depending
// on the input format
labelList pointMap;
const label nUniquePoints = reader.mergePointsMap(pointMap);
// retrieve the original zone information
const auto& readpts = reader.points();
// Assign points
pointField& pointLst = this->storedPoints();
pointLst.setSize(nUniquePoints);
forAll(readpts, pointi)
{
pointLst[pointMap[pointi]] = readpts[pointi];
}
// Retrieve the original zone information
List<word> names(reader.names().xfer());
List<label> sizes(reader.sizes().xfer());
List<label> zoneIds(reader.zoneIds().xfer());
@ -142,16 +153,21 @@ bool Foam::fileFormats::STLsurfaceFormat<Face>::read
if (reader.sorted())
{
// already sorted - generate directly
// Already sorted - generate directly
forAll(faceLst, facei)
{
const label startPt = 3*facei;
faceLst[facei] = Face{startPt, startPt+1, startPt+2};
faceLst[facei] = Face
{
pointMap[startPt],
pointMap[startPt+1],
pointMap[startPt+2]
};
}
}
else
{
// unsorted - determine the sorted order:
// Unsorted - determine the sorted order:
// avoid SortableList since we discard the main list anyhow
List<label> faceMap;
sortedOrder(zoneIds, faceMap);
@ -160,7 +176,12 @@ bool Foam::fileFormats::STLsurfaceFormat<Face>::read
forAll(faceMap, facei)
{
const label startPt = 3*faceMap[facei];
faceLst[facei] = Face{startPt, startPt+1, startPt+2};
faceLst[facei] = Face
{
pointMap[startPt],
pointMap[startPt+1],
pointMap[startPt+2]
};
}
}
zoneIds.clear();
@ -177,7 +198,6 @@ bool Foam::fileFormats::STLsurfaceFormat<Face>::read
this->addZones(sizes);
}
this->addZonesToFaces(); // for labelledTri
this->stitchFaces(SMALL);
return true;
}

View File

@ -78,13 +78,24 @@ bool Foam::fileFormats::TRIsurfaceFormat<Face>::read
{
this->clear();
// read in the values
// Read in the values
TRIsurfaceFormatCore reader(filename);
// transfer points
this->storedPoints().transfer(reader.points());
// Get the map for stitched surface points
labelList pointMap;
const label nUniquePoints = reader.mergePointsMap(pointMap);
// retrieve the original zone information
const auto& readpts = reader.points();
// Assign points
pointField& pointLst = this->storedPoints();
pointLst.setSize(nUniquePoints);
forAll(readpts, pointi)
{
pointLst[pointMap[pointi]] = readpts[pointi];
}
// Retrieve the original zone information
List<label> sizes(reader.sizes().xfer());
List<label> zoneIds(reader.zoneIds().xfer());
@ -93,16 +104,21 @@ bool Foam::fileFormats::TRIsurfaceFormat<Face>::read
if (reader.sorted())
{
// already sorted - generate directly
// Already sorted - generate directly
forAll(faceLst, facei)
{
const label startPt = 3*facei;
faceLst[facei] = Face{startPt, startPt+1, startPt+2};
faceLst[facei] = Face
{
pointMap[startPt],
pointMap[startPt+1],
pointMap[startPt+2]
};
}
}
else
{
// unsorted - determine the sorted order:
// Unsorted - determine the sorted order:
// avoid SortableList since we discard the main list anyhow
List<label> faceMap;
sortedOrder(zoneIds, faceMap);
@ -111,7 +127,12 @@ bool Foam::fileFormats::TRIsurfaceFormat<Face>::read
forAll(faceMap, facei)
{
const label startPt = 3*faceMap[facei];
faceLst[facei] = Face{startPt, startPt+1, startPt+2};
faceLst[facei] = Face
{
pointMap[startPt],
pointMap[startPt+1],
pointMap[startPt+2]
};
}
}
zoneIds.clear();
@ -121,7 +142,7 @@ bool Foam::fileFormats::TRIsurfaceFormat<Face>::read
this->addZones(sizes);
this->addZonesToFaces(); // for labelledTri
this->stitchFaces(SMALL);
return true;
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,6 +27,7 @@ License
#include "IFstream.H"
#include "IOmanip.H"
#include "IStringStream.H"
#include "mergePoints.H"
#include "Map.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -71,7 +72,7 @@ bool Foam::fileFormats::TRIsurfaceFormatCore::read
// uses similar structure as STL, just some points
// the rest of the reader resembles the STL binary reader
DynamicList<point> dynPoints;
DynamicList<STLpoint> dynPoints;
DynamicList<label> dynZones;
DynamicList<label> dynSizes;
HashTable<label> lookup;
@ -94,7 +95,7 @@ bool Foam::fileFormats::TRIsurfaceFormatCore::read
IStringStream lineStream(line);
point p
STLpoint p
(
readScalar(lineStream),
readScalar(lineStream),
@ -106,7 +107,7 @@ bool Foam::fileFormats::TRIsurfaceFormatCore::read
dynPoints.append(p);
dynPoints.append
(
point
STLpoint
(
readScalar(lineStream),
readScalar(lineStream),
@ -115,7 +116,7 @@ bool Foam::fileFormats::TRIsurfaceFormatCore::read
);
dynPoints.append
(
point
STLpoint
(
readScalar(lineStream),
readScalar(lineStream),
@ -179,4 +180,43 @@ bool Foam::fileFormats::TRIsurfaceFormatCore::read
}
void Foam::fileFormats::TRIsurfaceFormatCore::clear()
{
sorted_ = true;
points_.clear();
zoneIds_.clear();
sizes_.clear();
}
Foam::label Foam::fileFormats::TRIsurfaceFormatCore::mergePointsMap
(
labelList& pointMap
) const
{
// Use merge tolerance as per STL ascii
return mergePointsMap
(
100 * doubleScalarSMALL,
pointMap
);
}
Foam::label Foam::fileFormats::TRIsurfaceFormatCore::mergePointsMap
(
const scalar mergeTol,
labelList& pointMap
) const
{
return Foam::mergePoints
(
points_,
mergeTol,
false, // verbose
pointMap
);
}
// ************************************************************************* //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -36,7 +36,7 @@ SourceFiles
#define TRIsurfaceFormatCore_H
#include "surfaceFormatsCore.H"
#include "triFace.H"
#include "STLpoint.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -58,7 +58,7 @@ class TRIsurfaceFormatCore
bool sorted_;
//- The points supporting the facets
pointField points_;
List<STLpoint> points_;
//- The zones associated with the faces
List<label> zoneIds_;
@ -83,7 +83,7 @@ public:
// Constructors
//- Read from file, filling in the information
TRIsurfaceFormatCore(const fileName&);
TRIsurfaceFormatCore(const fileName& filename);
//- Destructor
@ -92,35 +92,39 @@ public:
// Member Functions
//- Flush all values
void clear();
//- Calculate merge points mapping, return old to new pointMap.
// Use merge tolerance as per STL ascii
// \return number of unique points
label mergePointsMap(labelList& pointMap) const;
//- Calculate merge points mapping, return old to new pointMap.
// \return number of unique points
label mergePointsMap(const scalar mergeTol, labelList& pointMap) const;
//- File read was already sorted
bool sorted() const
inline bool sorted() const
{
return sorted_;
}
//- Flush all values
void clear()
{
sorted_ = true;
points_.clear();
zoneIds_.clear();
sizes_.clear();
}
//- Return full access to the points
pointField& points()
inline List<STLpoint>& points()
{
return points_;
}
//- Return full access to the zones
List<label>& zoneIds()
inline List<label>& zoneIds()
{
return zoneIds_;
}
//- The list of zone sizes in the order of their first appearance
List<label>& sizes()
inline List<label>& sizes()
{
return sizes_;
}

View File

@ -24,7 +24,6 @@ License
\*---------------------------------------------------------------------------*/
#include "STLReader.H"
#include "mergePoints.H"
#include "triSurface.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -42,21 +41,12 @@ bool Foam::triSurface::readSTL(const fileName& STLfileName, bool forceBinary)
)
);
// Stitch points
// Get the map for stitched surface points, with merge tolerance depending
// on the input format
labelList pointMap;
label nUniquePoints = mergePoints
(
reader.points(),
(
// With the merge distance depending on the input format
(reader.stlFormat() == fileFormats::STLCore::BINARY ? 10 : 100)
* SMALL
),
false, // verbose
pointMap // old to new point map
);
const label nUniquePoints = reader.mergePointsMap(pointMap);
const pointField& readpts = reader.points();
const auto& readpts = reader.points();
const labelList& zoneIds = reader.zoneIds();
pointField& pointLst = storedPoints();
@ -84,18 +74,16 @@ bool Foam::triSurface::readSTL(const fileName& STLfileName, bool forceBinary)
f.region() = zoneIds[i];
}
// Set patch names (and sizes)
// - there is likely a more efficient means of doing this
// Set patch name/index.
if (reader.stlFormat() == fileFormats::STLCore::ASCII)
{
const List<word>& names = reader.names();
patches_.setSize(names.size());
forAll(names, namei)
forAll(patches_, patchi)
{
patches_[namei].name() = names[namei];
patches_[patchi] = geometricSurfacePatch(names[patchi], patchi);
}
setDefaultPatches();
}
return true;

View File

@ -39,7 +39,7 @@ purgeWrite 0;
writeFormat ascii;
writeCompression uncompressed;
writeCompression off;
timeFormat general;

View File

@ -39,7 +39,7 @@ purgeWrite 0;
writeFormat ascii;
writeCompression uncompressed;
writeCompression off;
timeFormat general;

View File

@ -39,7 +39,7 @@ purgeWrite 0;
writeFormat ascii;
writeCompression uncompressed;
writeCompression off;
timeFormat general;

View File

@ -39,7 +39,7 @@ purgeWrite 0;
writeFormat ascii;
writeCompression uncompressed;
writeCompression off;
timeFormat general;

View File

@ -39,7 +39,7 @@ purgeWrite 0;
writeFormat ascii;
writeCompression uncompressed;
writeCompression off;
timeFormat general;

View File

@ -59,10 +59,6 @@ functions
libs ("libutilityFunctionObjects.so");
name setDeltaT;
code
#{
#};
codeExecute
#{
const Time& runTime = mesh().time();
@ -75,6 +71,14 @@ functions
}
#};
}
fieldMinMax
{
type fieldMinMax;
libs ("libfieldFunctionObjects.so");
fields (p);
}
}
// ************************************************************************* //

View File

@ -36,7 +36,7 @@ writeFormat ascii;
writePrecision 6;
writeCompression uncompressed;
writeCompression off;
timeFormat general;

View File

@ -38,7 +38,7 @@ writeFormat ascii;
writePrecision 6;
writeCompression uncompressed;
writeCompression off;
timeFormat general;

View File

@ -37,7 +37,7 @@ writeFormat ascii;
writePrecision 6;
writeCompression uncompressed;
writeCompression off;
timeFormat general;

View File

@ -36,7 +36,7 @@ writeFormat binary;
writePrecision 6;
writeCompression uncompressed;
writeCompression off;
timeFormat general;

View File

@ -36,7 +36,7 @@ writeFormat binary;
writePrecision 6;
writeCompression uncompressed;
writeCompression off;
timeFormat general;

View File

@ -37,7 +37,7 @@ writeFormat binary;
writePrecision 10;
writeCompression no;
writeCompression off;
timeFormat general;

View File

@ -37,7 +37,7 @@ writeFormat binary;
writePrecision 10;
writeCompression no;
writeCompression off;
timeFormat general;

View File

@ -37,7 +37,7 @@ writeFormat ascii;
writePrecision 6;
writeCompression uncompressed;
writeCompression off;
timeFormat general;

View File

@ -72,6 +72,7 @@ dictionaryReplacement
qrNbr none;
qr qr;
kappa none;
thermalInertia true;
value uniform 300;
}
}

View File

@ -37,7 +37,7 @@ writeFormat ascii;
writePrecision 7;
writeCompression uncompressed;
writeCompression off;
timeFormat general;

View File

@ -43,6 +43,7 @@ dictionaryReplacement
qrNbr none;
qr none;
kappa none;
thermalInertia true;
value uniform 300;
}
@ -54,6 +55,7 @@ dictionaryReplacement
qrNbr qr;
qr none;
kappa none;
thermalInertia true;
value uniform 300;
}

View File

@ -37,6 +37,7 @@ dictionaryReplacement
qrNbr qr;
qr none;
kappa none;
thermalInertia true;
value uniform 300;
}
@ -48,6 +49,7 @@ dictionaryReplacement
qrNbr none;
qr none;
kappa none;
thermalInertia true;
value uniform 300;
}

View File

@ -0,0 +1,49 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1612+ |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0/solid";
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 0 0 0 1 0 0 0 ];
internalField uniform 500;
boundaryField
{
left
{
type fixedValue;
value uniform 500;
}
right
{
type fixedValue;
value uniform 500;
}
top
{
type zeroGradient;
}
bottom
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1612+ |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0/heater";
object jouleHeatingSource:V;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 1 2 -3 0 0 -1 0 ];
internalField uniform 0;
boundaryField
{
left
{
type fixedValue;
value uniform 1.5;
}
right
{
type fixedValue;
value uniform 0;
}
top
{
type zeroGradient;
}
bottom
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,47 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1612+ |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0/heater";
object jouleHeatingSource:sigma;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ -1 -3 3 0 0 2 0 ];
internalField uniform 127599.8469;
boundaryField
{
left
{
type zeroGradient;
}
right
{
type zeroGradient;
}
top
{
type zeroGradient;
}
bottom
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

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

View File

@ -0,0 +1,14 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase
rm -rf 0
foamCleanPolyMesh -region solid
rm -f *.OpenFOAM OF_vs_ANALYTICAL.eps
#------------------------------------------------------------------------------

View File

@ -0,0 +1,13 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
./Allrun.pre
runApplication $(getApplication)
./createGraphs
# -----------------------------------------------------------------------------

View File

@ -0,0 +1,17 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
./Allrun.pre
runApplication -s solid decomposePar -region solid
runParallel $(getApplication)
runApplication -s solid reconstructPar -latestTime -region solid
./createGraphs
# -----------------------------------------------------------------------------

View File

@ -0,0 +1,15 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
# Create meshe
runApplication -s solid blockMesh -region solid
# create dummy files for post-processing
paraFoam -touch -region solid
restore0Dir
# -----------------------------------------------------------------------------

View File

@ -0,0 +1,24 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object regionProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
regions
(
fluid ()
solid (solid)
);
// ************************************************************************* //

View File

@ -0,0 +1,54 @@
/*--------------------------------*- C++ -*----------------------------------* \
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object thermophysicalProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
thermoType
{
type heSolidThermo;
mixture pureMixture;
transport constIso;
thermo hConst;
equationOfState rhoConst;
specie specie;
energy sensibleEnthalpy;
}
mixture
{
specie
{
nMoles 1;
molWeight 12;
}
transport
{
kappa 200;
}
thermodynamics
{
Hf 0;
Cp 700;
}
equationOfState
{
rho 8000;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,87 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
# OpenFOAM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# createGraphs
#
# Description
# Creates .eps graph of OpenFOAM results vs analytical solution for the
# Joule heating case
#
#------------------------------------------------------------------------------
cd ${0%/*} || exit 1 # Run from this directory
# Stop on first error
set -e
# test if gnuplot exists on the system
if ! which gnuplot > /dev/null 2>&1
then
echo "FOAM FATAL ERROR: gnuplot not found - skipping graph creation" >&2
exit 1
fi
echo "Creating graph"
OFDATA='postProcessing/sample1/solid/20000/centreLine_T_jouleHeatingSource:V_jouleHeatingSource:sigma.xy'
if [ ! -f "$OFDATA" ]
then
echo "FOAM FATAL ERROR: OpenFOAM results not available in $OFDATA" >&2
exit 1
fi
gnuplot<<EOF
set terminal postscript eps color enhanced
set output "OF_vs_ANALYTICAL.eps"
set xlabel "Length, x / [m]"
set ylabel "Temperature / [K]"
set grid
set key left top
rho = 7.837e-6
sigma = 1/rho
kappa = 200
L = 2.5
D = 0.1
H = 0.1
vol = 2.0*L*D*H
V = 1.5
R = rho*2*L/(D*H)
I = V/R
P = I*V
Q = P/vol
Ts = 500
T(x) = Q*L*L/(2*kappa)*(1-(x/L)*(x/L)) + Ts
plot \
"$OFDATA" u 1:2 w lines title "OpenFOAM", \
T(x) w linespoints lt 0 pt 6 pi 15 title "Analytical"
EOF
echo "End"
#------------------------------------------------------------------------------

View File

@ -0,0 +1,75 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application chtMultiRegionSimpleFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 20000;
deltaT 1;
writeControl timeStep;
writeInterval 50;
purgeWrite 2;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
functions
{
sample1
{
type sets;
libs ("libsampling.so");
writeControl outputTime;
region solid;
fields (T jouleHeatingSource:V jouleHeatingSource:sigma);
interpolationScheme cellPoint;
setFormat raw;
sets
(
centreLine
{
type uniform;
axis x;
start (-2.5 0.05 0.05);
end ( 2.5 0.05 0.05);
nPoints 20;
}
);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,23 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
method scotch;
// ************************************************************************* //

View File

@ -0,0 +1,89 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(-2.5 0 0)
( 2.5 0 0)
( 2.5 0.1 0)
(-2.5 0.1 0)
(-2.5 0 0.1)
( 2.5 0 0.1)
( 2.5 0.1 0.1)
(-2.5 0.1 0.1)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (500 20 1) simpleGrading (1 1 1)
);
edges
(
);
boundary
(
top
{
type patch;
faces
(
(3 7 6 2)
);
}
bottom
{
type patch;
faces
(
(1 5 4 0)
);
}
left
{
type patch;
faces
(
(0 4 7 3)
);
}
right
{
type patch;
faces
(
(2 6 5 1)
);
}
frontAndBack
{
type empty;
faces
(
(0 3 2 1)
(4 5 6 7)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,39 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
heating
{
type jouleHeatingSource;
active true;
jouleHeatingSourceCoeffs
{
anisotropicElectricalConductivity no;
// Optionally specify sigma as a function of temperature
//sigma 127599.8469;
//
//sigma table
//(
// (0 127599.8469)
// (1000 127599.8469)
//);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default steadyState;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
default none;
}
laplacianSchemes
{
default none;
laplacian(alpha,h) Gauss linear uncorrected;
laplacian(jouleHeatingSource:sigma,jouleHeatingSource:V) Gauss linear uncorrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default uncorrected;
}
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
h
{
solver PCG;
preconditioner DIC;
tolerance 0;
relTol 0.1;
}
jouleHeatingSource:V
{
solver PCG;
preconditioner DIC;
tolerance 0;
relTol 0.1;
}
}
SIMPLE
{
nNonOrthogonalCorrectors 0;
}
relaxationFactors
{
equations
{
h 0.99;
}
}
// ************************************************************************* //

View File

@ -37,7 +37,7 @@ writeFormat ascii;
writePrecision 7;
writeCompression uncompressed;
writeCompression off;
timeFormat general;

View File

@ -37,7 +37,7 @@ writeFormat ascii;
writePrecision 6;
writeCompression uncompressed;
writeCompression off;
timeFormat general;

View File

@ -37,7 +37,7 @@ writeFormat ascii;
writePrecision 6;
writeCompression uncompressed;
writeCompression off;
timeFormat general;

View File

@ -23,12 +23,17 @@ boundaryField
{
inlet
{
type uniformTotalPressure;
p0 table
(
(0 10)
(1 40)
);
type fanPressure;
outOfBounds clamp;
direction in;
readerType openFoam;
hasHeaderLine true;
file "$FOAM_CASE/constant/FluxVsdP.dat";
//nonDimensional true;
//rpm 300;
//dm 2e-2;
outOfBounds clamp;
p0 uniform 30;
}
outlet1
{

View File

@ -0,0 +1,5 @@
(
(0 20)
(0.0023 10)
(0.003 5)
);

View File

@ -36,7 +36,7 @@ writeFormat ascii;
writePrecision 6;
writeCompression uncompressed;
writeCompression off;
timeFormat general;

View File

@ -37,7 +37,7 @@ writeFormat binary;
writePrecision 6;
writeCompression uncompressed;
writeCompression off;
timeFormat general;

View File

@ -38,7 +38,7 @@ writeFormat binary;
writePrecision 6;
writeCompression compressed;
writeCompression off;
timeFormat general;

View File

@ -39,7 +39,7 @@ writeFormat ascii;
writePrecision 6;
writeCompression compressed;
writeCompression on;
timeFormat general;

View File

@ -36,7 +36,7 @@ writeFormat ascii;
writePrecision 10;
writeCompression uncompressed;
writeCompression off;
timeFormat general;

View File

@ -36,7 +36,7 @@ writeFormat binary;
writePrecision 6;
writeCompression uncompressed;
writeCompression off;
timeFormat general;

View File

@ -37,7 +37,7 @@ writeFormat ascii;
writePrecision 6;
writeCompression uncompressed;
writeCompression off;
timeFormat general;

View File

@ -36,7 +36,7 @@ writeFormat binary;
writePrecision 12;
writeCompression uncompressed;
writeCompression off;
timeFormat general;

View File

@ -37,7 +37,7 @@ writeFormat binary;
writePrecision 6;
writeCompression uncompressed;
writeCompression off;
timeFormat general;

View File

@ -37,7 +37,7 @@ writeFormat ascii;
writePrecision 6;
writeCompression uncompressed;
writeCompression off;
timeFormat general;

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