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

This commit is contained in:
mattijs
2016-11-23 12:10:33 +00:00
487 changed files with 2902 additions and 2297 deletions

View File

@ -51,7 +51,7 @@ int main(int argc, char *argv[])
{
argList::addOption
(
"cloudName",
"cloud",
"name",
"specify alternative cloud name. default is 'kinematicCloud'"
);

View File

@ -11,7 +11,7 @@ word continuousPhaseName
mesh,
IOobject::MUST_READ
)
).lookup("continuousPhaseName")
).lookup("continuousPhase")
);
Info<< "Reading field U\n" << endl;
@ -123,7 +123,7 @@ volScalarField alphac
);
word kinematicCloudName("kinematicCloud");
args.optionReadIfPresent("cloudName", kinematicCloudName);
args.optionReadIfPresent("cloud", kinematicCloudName);
Info<< "Constructing kinematicCloud " << kinematicCloudName << endl;
basicKinematicTypeCloud kinematicCloud

View File

@ -58,7 +58,7 @@ volScalarField mu
);
word kinematicCloudName("kinematicCloud");
args.optionReadIfPresent("cloudName", kinematicCloudName);
args.optionReadIfPresent("cloud", kinematicCloudName);
Info<< "Constructing kinematicCloud " << kinematicCloudName << endl;
basicKinematicCollidingCloud kinematicCloud

View File

@ -47,7 +47,7 @@ int main(int argc, char *argv[])
{
argList::addOption
(
"cloudName",
"cloud",
"name",
"specify alternative cloud name. default is 'kinematicCloud'"
);

View File

@ -46,7 +46,7 @@ int main(int argc, char *argv[])
{
argList::addOption
(
"cloudName",
"cloud",
"name",
"specify alternative cloud name. default is 'kinematicCloud'"
);

View File

@ -51,7 +51,7 @@ autoPtr<compressible::turbulenceModel> turbulence
const word kinematicCloudName
(
args.optionLookupOrDefault<word>("cloudName", "kinematicCloud")
args.optionLookupOrDefault<word>("cloud", "kinematicCloud")
);
Info<< "Constructing kinematicCloud " << kinematicCloudName << endl;

View File

@ -45,7 +45,7 @@ int main(int argc, char *argv[])
{
argList::addOption
(
"cloudName",
"cloud",
"name",
"specify alternative cloud name. default is 'kinematicCloud'"
);

View File

@ -126,35 +126,35 @@
{
surfaceScalarField phir(phic*mixture.nHatf());
tmp<surfaceScalarField> talphaPhiUn
(
fvc::flux
alphaPhiUn =
(
phi,
alpha1,
alphaScheme
)
+ fvc::flux
(
-fvc::flux(-phir, alpha2, alpharScheme),
alpha1,
alpharScheme
)
);
fvc::flux
(
phi,
alpha1,
alphaScheme
)
+ fvc::flux
(
-fvc::flux(-phir, alpha2, alpharScheme),
alpha1,
alpharScheme
)
);
// Calculate the Crank-Nicolson off-centred alpha flux
if (ocCoeff > 0)
{
talphaPhiUn =
cnCoeff*talphaPhiUn + (1.0 - cnCoeff)*alphaPhi.oldTime();
alphaPhiUn =
cnCoeff*alphaPhiUn + (1.0 - cnCoeff)*alphaPhi.oldTime();
}
if (MULESCorr)
{
tmp<surfaceScalarField> talphaPhiCorr(talphaPhiUn() - alphaPhi);
tmp<surfaceScalarField> talphaPhiCorr(alphaPhiUn - alphaPhi);
volScalarField alpha10("alpha10", alpha1);
MULES::correct(alpha1, talphaPhiUn(), talphaPhiCorr.ref(), 1, 0);
MULES::correct(alpha1, alphaPhiUn, talphaPhiCorr.ref(), 1, 0);
// Under-relax the correction for all but the 1st corrector
if (aCorr == 0)
@ -169,7 +169,7 @@
}
else
{
alphaPhi = talphaPhiUn;
alphaPhi = alphaPhiUn;
MULES::explicitSolve(alpha1, phiCN, alphaPhi, 1, 0);
}

View File

@ -135,6 +135,21 @@ surfaceScalarField alphaPhi
phi*fvc::interpolate(alpha1)
);
// MULES compressed flux is registered in case scalarTransport FO needs it.
surfaceScalarField alphaPhiUn
(
IOobject
(
"alphaPhiUn",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", phi.dimensions(), 0.0)
);
// MULES Correction
tmp<surfaceScalarField> talphaPhiCorr0;

View File

@ -49,7 +49,7 @@ Foam::copiedFixedValueFvPatchScalarField::copiedFixedValueFvPatchScalarField
)
:
fixedValueFvPatchScalarField(p, iF, dict),
sourceFieldName_(dict.lookup("sourceFieldName"))
sourceFieldName_(dict.lookup("sourceField"))
{}
@ -109,7 +109,7 @@ void Foam::copiedFixedValueFvPatchScalarField::updateCoeffs()
void Foam::copiedFixedValueFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
os.writeKeyword("sourceFieldName")
os.writeKeyword("sourceField")
<< sourceFieldName_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}

View File

@ -62,7 +62,7 @@ int main(int argc, char *argv[])
#include "createTime.H"
#include "createMesh.H"
const Switch inflate(args.args()[1]);
const Switch inflate(args[1]);
if (inflate)
{

View File

@ -66,7 +66,7 @@ int main(int argc, char *argv[])
const pointConstraints& pc = pointConstraints::New(pointMesh::New(mesh));
const Switch inflate(args.args()[1]);
const Switch inflate(args[1]);
if (inflate)
{

View File

@ -36,7 +36,7 @@ Description
int main(int argc, char *argv[])
{
argList::validArgs.append("cloudName");
argList::validArgs.append("cloud");
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"

View File

@ -602,8 +602,8 @@ int main(int argc, char *argv[])
const word& key = iter().keyword();
const dictionary& dict = iter().dict();
const word cyclicName = dict.lookup("cyclicMasterPatchName");
const word wallName = dict.lookup("wallPatchName");
const word cyclicName = dict.lookup("cyclicMasterPatch");
const word wallName = dict.lookup("wallPatch");
FixedList<word, 3> nameAndType;
nameAndType[0] = key;
nameAndType[1] = wallName;

View File

@ -72,7 +72,7 @@ int main(int argc, char *argv[])
#include "createNamedMesh.H"
const word oldInstance = mesh.pointsInstance();
word cellSetName(args.args()[1]);
word cellSetName(args[1]);
const bool overwrite = args.optionFound("overwrite");
const bool minSet = args.optionFound("minSet");

View File

@ -58,7 +58,7 @@ int main(int argc, char *argv[])
#include "createTime.H"
std::ifstream plot3dFile(args.args()[1].c_str());
std::ifstream plot3dFile(args[1].c_str());
string line;
std::getline(plot3dFile, line);

View File

@ -811,7 +811,7 @@ int main(int argc, char *argv[])
args.optionReadIfPresent("ignoreCellGroups", ignoreCellGroups);
args.optionReadIfPresent("ignoreFaceGroups", ignoreFaceGroups);
cubitFile = args.options().found("cubit");
cubitFile = args.optionFound("cubit");
if (cubitFile)
{

View File

@ -128,16 +128,12 @@ int main(int argc, char *argv[])
fileName dictPath;
// Check if the dictionary is specified on the command-line
if (args.optionFound("dict"))
if (args.optionReadIfPresent("dict", dictPath))
{
dictPath = args["dict"];
dictPath =
(
isDir(dictPath)
? dictPath/dictName
: dictPath
);
if (isDir(dictPath))
{
dictPath = dictPath / dictName;
}
}
// Check if dictionary is present in the constant directory
else if

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) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -67,14 +67,7 @@ int main(int argc, char *argv[])
// Allow override of decomposeParDict location
fileName decompDictFile;
if (args.optionReadIfPresent("decomposeParDict", decompDictFile))
{
if (isDir(decompDictFile))
{
decompDictFile = decompDictFile / "decomposeParDict";
}
}
args.optionReadIfPresent("decomposeParDict", decompDictFile);
IOdictionary foamyHexMeshDict
(

View File

@ -524,13 +524,7 @@ int main(int argc, char *argv[])
// Allow override of decomposeParDict location
fileName decompDictFile;
if (args.optionReadIfPresent("decomposeParDict", decompDictFile))
{
if (isDir(decompDictFile))
{
decompDictFile = decompDictFile / "decomposeParDict";
}
}
args.optionReadIfPresent("decomposeParDict", decompDictFile);
labelList decomp = decompositionModel::New
(

View File

@ -374,7 +374,7 @@ int main(int argc, char *argv[])
#include "createTime.H"
runTime.functionObjects().off();
const fileName exportName = args.args()[1];
const fileName exportName = args[1];
Info<< "Reading surfaces as specified in the foamyHexMeshDict and"
<< " writing a re-sampled surface to " << exportName

View File

@ -36,6 +36,7 @@ Description
#include "searchableSurfaces.H"
#include "conformationSurfaces.H"
#include "triSurfaceMesh.H"
#include "labelVector.H"
#include "MarchingCubes.h"
@ -52,7 +53,6 @@ int main(int argc, char *argv[])
(
"Re-sample surfaces used in foamyHexMesh operation"
);
//argList::validArgs.append("inputFile");
argList::validArgs.append("(nx ny nz)");
argList::validArgs.append("outputName");
@ -60,8 +60,8 @@ int main(int argc, char *argv[])
#include "createTime.H"
runTime.functionObjects().off();
const Vector<label> n(IStringStream(args.args()[1])());
const fileName exportName = args.args()[2];
const labelVector n(args.argRead<labelVector>(1));
const fileName exportName = args[2];
Info<< "Reading surfaces as specified in the foamyHexMeshDict and"
<< " writing re-sampled " << n << " to " << exportName

View File

@ -93,10 +93,9 @@ int main(int argc, char *argv[])
// ~~~~~~~~~~~~~~~~~~~~~~
CV2D mesh(runTime, controlDict);
if (args.options().found("pointsFile"))
if (args.optionFound("pointsFile"))
{
fileName pointFileName(IStringStream(args.options()["pointsFile"])());
mesh.insertPoints(pointFileName);
mesh.insertPoints(args["pointsFile"]);
}
else
{

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 | Copyright 2015-2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -905,13 +905,7 @@ int main(int argc, char *argv[])
if (Pstream::parRun())
{
fileName decompDictFile;
if (args.optionReadIfPresent("decomposeParDict", decompDictFile))
{
if (isDir(decompDictFile))
{
decompDictFile = decompDictFile/"decomposeParDict";
}
}
args.optionReadIfPresent("decomposeParDict", decompDictFile);
decomposeDict = IOdictionary
(

View File

@ -297,13 +297,13 @@ int main(int argc, char *argv[])
// set up the tolerances for the sliding mesh
dictionary slidingTolerances;
if (args.options().found("toleranceDict"))
if (args.optionFound("toleranceDict"))
{
IOdictionary toleranceFile
(
IOobject
(
args.options()["toleranceDict"],
args["toleranceDict"],
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,

View File

@ -15,10 +15,12 @@ EXE_LIBS = \
-lchemistryModel \
-lcoalCombustion \
-lcombustionModels \
-lcompressibleTransportModels \
-lcompressibleEulerianInterfacialModels \
-lcompressibleMultiphaseEulerianInterfacialModels \
-lcompressibleTurbulenceModels \
-lconversion \
-ldecompose \
-lCompressibleTwoPhaseMixtureTurbulenceModels \
-lcompressibleTwoPhaseSystem \
-lconformalVoronoiMesh \
-ldecompositionMethods \
-ldistributed \
-ldistributionModels \
@ -35,29 +37,32 @@ EXE_LIBS = \
-lfileFormats \
-lfiniteVolume \
-lfluidThermophysicalModels \
-lfoamToVTK \
-lforces \
-lfvMotionSolvers \
-lfvOptions \
-lgenericPatchFields \
-limmiscibleIncompressibleTwoPhaseMixture \
-lhelpTypes \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModels \
-linterfaceProperties \
-llagrangianFunctionObjects \
-llagrangianIntermediate \
-llagrangian \
-llagrangianSpray \
-llagrangianTurbulence \
-llaminarFlameSpeedModels \
-lliquidMixtureProperties \
-lliquidPropertiesFvPatchFields \
-lliquidProperties \
-lmeshTools \
-lmolecularMeasurements \
-lmolecule \
-lmultiphaseInterFoam \
-lmultiphaseMixtureThermo \
-lmultiphaseReactingTurbulenceModels \
-lmultiphaseSystem \
-lODE \
-lOpenFOAM \
-lpairPatchAgglomeration \
-lphaseChangeTwoPhaseMixtures \
-lphaseCompressibleTurbulenceModels \
-lphaseTemperatureChangeTwoPhaseMixtures \
-lpotential \
-lpyrolysisModels \
-lradiationModels \
@ -68,7 +73,6 @@ EXE_LIBS = \
-lreactingPhaseSystem \
-lreactingTwoPhaseSystem \
-lreactionThermophysicalModels \
-lreconstruct \
-lregionCoupled \
-lregionCoupling \
-lregionModels \
@ -79,11 +83,9 @@ EXE_LIBS = \
-lsampling \
-lscotchDecomp \
-lsixDoFRigidBodyMotion \
-lSLGThermo \
-lSloanRenumber \
-lsnappyHexMesh \
-lsolidChemistryModel \
-lsolidMixtureProperties \
-lsolidParticle \
-lsolidProperties \
-lsolidSpecie \
-lsolidThermo \
@ -92,13 +94,12 @@ EXE_LIBS = \
-lsurfaceFilmDerivedFvPatchFields \
-lsurfaceFilmModels \
-lsurfMesh \
-ltabulatedWallFunctions \
-lthermalBaffleModels \
-lthermophysicalFunctions \
-ltopoChangerFvMesh \
-ltriSurface \
-lturbulenceModelSchemes \
-lturbulenceModels \
-ltwoPhaseMixture \
-ltwoPhaseMixtureThermo \
-ltwoPhaseProperties \
-ltwoPhaseReactingTurbulenceModels \
-lutilityFunctionObjects

View File

@ -270,14 +270,7 @@ int main(int argc, char *argv[])
// Allow override of decomposeParDict location
fileName decompDictFile;
if (args.optionReadIfPresent("decomposeParDict", decompDictFile))
{
if (isDir(decompDictFile))
{
decompDictFile = decompDictFile/"decomposeParDict";
}
}
args.optionReadIfPresent("decomposeParDict", decompDictFile);
wordList regionNames;
wordList regionDirs;
@ -360,7 +353,6 @@ int main(int argc, char *argv[])
),
decompDictFile
)
).lookup("numberOfSubdomains")
);

View File

@ -64,6 +64,7 @@ Usage
#include "fvMeshTools.H"
#include "fvMeshDistribute.H"
#include "decompositionMethod.H"
#include "decompositionModel.H"
#include "timeSelector.H"
#include "PstreamReduceOps.H"
#include "volFields.H"
@ -74,7 +75,6 @@ Usage
#include "loadOrCreateMesh.H"
#include "processorFvPatchField.H"
#include "zeroGradientFvPatchFields.H"
#include "decompositionModel.H"
#include "parFvFieldReconstructor.H"
#include "parLagrangianRedistributor.H"
@ -2152,7 +2152,6 @@ int main(int argc, char *argv[])
bool newTimes = args.optionFound("newTimes");
if (env("FOAM_SIGFPE"))
{
WarningInFunction
@ -2245,8 +2244,6 @@ int main(int argc, char *argv[])
Pstream::scatter(decompose);
// If running distributed we have problem of new processors not finding
// a system/controlDict. However if we switch on the master-only reading
// the problem becomes that the time directories are differing sizes and
@ -2330,7 +2327,6 @@ int main(int argc, char *argv[])
// Determine any region
word regionName = polyMesh::defaultRegion;
fileName meshSubDir;
if (args.optionReadIfPresent("region", regionName))
{
meshSubDir = regionName/polyMesh::meshSubDir;
@ -2774,13 +2770,7 @@ int main(int argc, char *argv[])
// Allow override of decomposeParDict location
fileName decompDictFile;
if (args.optionReadIfPresent("decomposeParDict", decompDictFile))
{
if (isDir(decompDictFile))
{
decompDictFile = decompDictFile / "decomposeParDict";
}
}
args.optionReadIfPresent("decomposeParDict", decompDictFile);
// Determine decomposition

View File

@ -18,8 +18,10 @@ if (!fieldsToUse.found(fieldName))
fieldName,
timeDirs[n1].name(),
mesh,
IOobject::NO_READ
).typeHeaderOk<volScalarField>(false)
IOobject::NO_READ,
IOobject::NO_WRITE,
false // no register
).typeHeaderOk<volScalarField>(false, false)
);
if (variableGood)

View File

@ -7,8 +7,6 @@ if (timeDirs.size() > 1 && Pstream::master())
// We already loaded a mesh (usually from constant).
// See if any other "polyMesh/points" files exist too.
const fileName& baseDir = mesh.time().path();
Info<< "Search for moving mesh ... " << flush;
forAll(timeDirs, timeI)
{
@ -17,7 +15,6 @@ if (timeDirs.size() > 1 && Pstream::master())
meshMoving =
(
timeName != mesh.pointsInstance()
&& isDir(baseDir/timeName/polyMesh::meshSubDir)
&& IOobject
(
"points",
@ -27,7 +24,7 @@ if (timeDirs.size() > 1 && Pstream::master())
IOobject::NO_READ,
IOobject::NO_WRITE,
false // no register
).typeHeaderOk<pointIOField>(true)
).typeHeaderOk<pointIOField>(true, false)
);
if (meshMoving)

View File

@ -8,15 +8,12 @@ if (timeDirs.size() > 1 && Pstream::master())
// We already loaded a mesh (usually from constant).
// See if any other "polyMesh/points" files exist too.
const fileName& baseDir = mesh.time().path();
Info<< "Search for moving mesh ... " << flush;
forAll(timeDirs, timeI)
{
meshMoving =
(
isDir(baseDir/timeDirs[timeI].name()/polyMesh::meshSubDir)
&& IOobject
IOobject
(
"points",
timeDirs[timeI].name(),
@ -25,7 +22,7 @@ if (timeDirs.size() > 1 && Pstream::master())
IOobject::NO_READ,
IOobject::NO_WRITE,
false // no register
).typeHeaderOk<pointIOField>(true)
).typeHeaderOk<pointIOField>(true, false)
);
if (meshMoving)

View File

@ -21,10 +21,10 @@
runTime,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
false
false // no register
);
if (io.typeHeaderOk<IOdictionary>(true))
if (io.typeHeaderOk<IOdictionary>(true, false))
{
io.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
IOdictionary timeObject(io);

View File

@ -4,10 +4,13 @@
"points",
runTime.timeName(),
polyMesh::meshSubDir,
mesh
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
false // no register
);
if (io.typeHeaderOk<pointIOField>(true))
if (io.typeHeaderOk<pointIOField>(true, false))
{
// Read new points
io.readOpt() = IOobject::MUST_READ;

View File

@ -1,27 +1,20 @@
IOobject ioPoints
(
"points",
runTime.timeName(),
mesh.name(),
mesh
);
if (ioPoints.typeHeaderOk<pointIOField>(true))
{
Info<< "new points available" << endl;
// Reading new points
pointIOField newPoints
IOobject io
(
IOobject
(
"points",
runTime.timeName(),
mesh.name(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
"points",
runTime.timeName(),
mesh.name(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
false // no register
);
mesh.movePoints(newPoints);
if (io.typeHeaderOk<pointIOField>(true, false))
{
Info<< "new points available" << endl;
// Read new points
io.readOpt() = IOobject::MUST_READ;
mesh.movePoints(pointIOField(io));
}
}

View File

@ -9,7 +9,7 @@ IOdictionary propsDict
)
);
const word cloudName(propsDict.lookup("cloudName"));
const word cloudName(propsDict.lookup("cloud"));
label sampleFrequency(readLabel(propsDict.lookup("sampleFrequency")));

View File

@ -4,6 +4,6 @@ const word dictName("particleTrackDict");
IOdictionary propsDict(dictIO);
word cloudName(propsDict.lookup("cloudName"));
word cloudName(propsDict.lookup("cloud"));
List<word> userFields(propsDict.lookup("fields"));

View File

@ -51,13 +51,11 @@ int readNumProcs
const Time& runTime
)
{
const word dictName = "decomposeParDict";
fileName dictFile;
if (args.optionReadIfPresent(optionName, dictFile))
if (args.optionReadIfPresent(optionName, dictFile) && isDir(dictFile))
{
if (isDir(dictFile))
{
dictFile = dictFile/"decomposeParDict";
}
dictFile = dictFile / dictName;
}
return readInt
@ -68,7 +66,7 @@ int readNumProcs
(
IOobject
(
"decomposeParDict",
dictName,
runTime.system(),
runTime,
IOobject::MUST_READ_IF_MODIFIED,
@ -376,7 +374,7 @@ int main(int argc, char *argv[])
if (parallelSource && !parallelTarget)
{
int nProcs = readNumProcs
const int nProcs = readNumProcs
(
args,
"sourceDecomposeParDict",
@ -448,7 +446,7 @@ int main(int argc, char *argv[])
}
else if (!parallelSource && parallelTarget)
{
int nProcs = readNumProcs
const int nProcs = readNumProcs
(
args,
"targetDecomposeParDict",
@ -521,13 +519,13 @@ int main(int argc, char *argv[])
}
else if (parallelSource && parallelTarget)
{
int nProcsSource = readNumProcs
const int nProcsSource = readNumProcs
(
args,
"sourceDecomposeParDict",
runTimeSource
);
int nProcsTarget = readNumProcs
const int nProcsTarget = readNumProcs
(
args,
"targetDecomposeParDict",

View File

@ -1558,12 +1558,14 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
word action(args.args()[1]);
const word action(args[1]);
HashTable<booleanSurface::booleanOpType> validActions;
validActions.insert("intersection", booleanSurface::INTERSECTION);
validActions.insert("union", booleanSurface::UNION);
validActions.insert("difference", booleanSurface::DIFFERENCE);
const HashTable<booleanSurface::booleanOpType> validActions
{
{"intersection", booleanSurface::INTERSECTION},
{"union", booleanSurface::UNION},
{"difference", booleanSurface::DIFFERENCE}
};
if (!validActions.found(action))
{
@ -1580,7 +1582,7 @@ int main(int argc, char *argv[])
}
const word surf1Name(args.args()[2]);
const word surf1Name(args[2]);
Info<< "Reading surface " << surf1Name << endl;
triSurfaceMesh surf1
(

View File

@ -605,7 +605,7 @@ int main(int argc, char *argv[])
#include "createTime.H"
runTime.functionObjects().off();
const word inputName(args.args()[1]);
const word inputName(args[1]);
const scalar distance(args.argRead<scalar>(2));
const scalar extendFactor(args.argRead<scalar>(3));
const bool checkSelfIntersect = args.optionFound("checkSelfIntersection");

View File

@ -157,14 +157,10 @@ int main(int argc, char *argv[])
// Note: cannot use setSystemRunTimeDictionaryIO.H since dictionary
// is in constant
fileName dictPath = "";
if (args.optionFound("dict"))
fileName dictPath;
if (args.optionReadIfPresent("dict", dictPath) && isDir(dictPath))
{
dictPath = args["dict"];
if (isDir(dictPath))
{
dictPath = dictPath / dictName;
}
dictPath = dictPath / dictName;
}
if (dictPath.size())

View File

@ -1,9 +1,12 @@
EXE_INC = \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \
-I$(LIB_SRC)/parallel/decompose/decompose/lnInclude \
-I$(LIB_SRC)/parallel/distributed/lnInclude
EXE_LIBS = \
-ldistributed \
-lmeshTools \
-ltriSurface
-ltriSurface \
-ldecompose

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 | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -46,6 +46,7 @@ Note
#include "distributedTriSurfaceMesh.H"
#include "mapDistribute.H"
#include "localIOdictionary.H"
#include "decompositionModel.H"
using namespace Foam;
@ -103,7 +104,8 @@ int main(int argc, char *argv[])
{
argList::addNote
(
"redistribute a triSurface"
"Redistribute a triSurface. "
"The specified surface must be located in the constant/triSurface directory"
);
argList::validArgs.append("triSurfaceMesh");
@ -127,7 +129,7 @@ int main(int argc, char *argv[])
<< "Using distribution method "
<< distTypeName << nl << endl;
const bool keepNonMapped = args.options().found("keepNonMapped");
const bool keepNonMapped = args.optionFound("keepNonMapped");
if (keepNonMapped)
{
@ -151,6 +153,37 @@ int main(int argc, char *argv[])
Random rndGen(653213);
// For independent decomposition, ensure that distributedTriSurfaceMesh
// can find the alternative decomposeParDict specified via the
// -decomposeParDict option.
if (distType == distributedTriSurfaceMesh::INDEPENDENT)
{
fileName decompDictFile;
args.optionReadIfPresent("decomposeParDict", decompDictFile);
IOdictionary* dict = new IOdictionary
(
decompositionModel::selectIO
(
IOobject
(
"decomposeParDict",
runTime.system(),
runTime,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
),
decompDictFile
)
);
// The object must have the expected "decomposeParDict" name.
// This also implies that it cannot be changed during the run.
dict->rename("decomposeParDict");
runTime.store(dict);
}
// Determine mesh bounding boxes:
List<List<treeBoundBox>> meshBb(Pstream::nProcs());
if (distType == distributedTriSurfaceMesh::FOLLOW)

View File

@ -86,7 +86,7 @@ export WM_COMPILE_OPTION=Opt
#- MPI implementation:
# WM_MPLIB = SYSTEMOPENMPI | OPENMPI | SYSTEMMPI | MPICH | MPICH-GM | HPMPI
# | MPI | QSMPI | SGIMPI
export WM_MPLIB=OPENMPI
export WM_MPLIB=SYSTEMOPENMPI
#- Operating System:
# WM_OSTYPE = POSIX | ???

View File

@ -95,6 +95,7 @@ $(strings)/fileName/fileNameIO.C
$(strings)/keyType/keyType.C
$(strings)/wordRe/wordRe.C
$(strings)/lists/hashedWordList.C
$(strings)/lists/wordReListMatcher.C
$(strings)/stringOps/stringOps.C
ops = primitives/ops

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) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -417,7 +417,7 @@ Foam::fileName Foam::IOobject::path
}
Foam::fileName Foam::IOobject::localFilePath() const
Foam::fileName Foam::IOobject::localFilePath(const bool search) const
{
if (instance().isAbsolute())
{
@ -443,7 +443,7 @@ Foam::fileName Foam::IOobject::localFilePath() const
}
else
{
if (!isDir(path))
if (!isDir(path) && search)
{
word newInstancePath = time().findInstancePath
(
@ -471,7 +471,7 @@ Foam::fileName Foam::IOobject::localFilePath() const
}
Foam::fileName Foam::IOobject::globalFilePath() const
Foam::fileName Foam::IOobject::globalFilePath(const bool search) const
{
if (instance().isAbsolute())
{
@ -536,8 +536,8 @@ Foam::fileName Foam::IOobject::globalFilePath() const
}
}
// Check for approximately same time
if (!isDir(path))
// Check for approximately same (local) time
if (!isDir(path) && search)
{
word newInstancePath = time().findInstancePath
(

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) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -400,7 +400,7 @@ public:
fileName path
(
const word& instance,
const fileName& local = ""
const fileName& local = fileName::null
) const;
//- Return complete path + object name
@ -409,11 +409,15 @@ public:
return path()/name();
}
//- Helper for filePath that searches locally
fileName localFilePath() const;
//- Helper for filePath that searches locally.
// When search is false, simply use the current instance,
// otherwise search previous instances.
fileName localFilePath(const bool search=true) const;
//- Helper for filePath that searches up if in parallel
fileName globalFilePath() const;
// When search is false, simply use the current instance,
// otherwise search previous instances.
fileName globalFilePath(const bool search=true) const;
// Reading
@ -421,10 +425,16 @@ public:
//- Read header
bool readHeader(Istream&);
//- Read header (uses typeFilePath to find file) and check header
// info. Optionally checks headerClassName against type
//- Read header (uses typeFilePath to find file) and check its info.
// Optionally checks headerClassName against the type-name.
// When search is false, simply use the current instance,
// otherwise search previous instances.
template<class Type>
bool typeHeaderOk(const bool checkType = true);
bool typeHeaderOk
(
const bool checkType = true,
const bool search = true
);
//- Helper: warn that type does not support re-reading
template<class Type>
@ -485,18 +495,23 @@ template<>
Ostream& operator<<(Ostream& os, const InfoProxy<IOobject>& ip);
//- Template function for obtaining global status
//- Template function for obtaining global vs. local status
template<class T>
inline bool typeGlobal()
{
return false;
}
//- Template function for obtaining filePath
//- Template function for obtaining local or global filePath
template<class T>
inline fileName typeFilePath(const IOobject& io)
inline fileName typeFilePath(const IOobject& io, const bool search=true)
{
return (typeGlobal<T>() ? io.globalFilePath() : io.localFilePath());
return
(
typeGlobal<T>()
? io.globalFilePath(search)
: io.localFilePath(search)
);
}

View File

@ -32,7 +32,11 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
bool Foam::IOobject::typeHeaderOk(const bool checkType)
bool Foam::IOobject::typeHeaderOk
(
const bool checkType,
const bool search
)
{
bool ok = true;
@ -48,7 +52,7 @@ bool Foam::IOobject::typeHeaderOk(const bool checkType)
// Determine local status
if (!masterOnly || Pstream::master())
{
Istream* isPtr = objectStream(typeFilePath<Type>(*this));
Istream* isPtr = objectStream(typeFilePath<Type>(*this, search));
// If the stream has failed return
if (!isPtr)

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,11 +30,11 @@ namespace Foam
{
defineTemplateTypeNameAndDebug(IOMap<dictionary>, 0);
//- Template specialisation for obtaining filePath
//- Template specialization for global status
template<>
fileName typeFilePath<IOMap<dictionary>>(const IOobject& io)
bool typeGlobal<IOMap<dictionary>>()
{
return io.globalFilePath();
return true;
}
}

View File

@ -27,8 +27,8 @@ Class
Description
IOdictionary is derived from dictionary and IOobject to give the dictionary
automatic IO functionality via the objectRegistry. To facilitate IO,
IOdictioanry is provided with a constructor from IOobject and writeData and
write functions.
IOdictionary is provided with a constructor from IOobject and with
readData/writeData functions.
SourceFiles
IOdictionary.C
@ -47,7 +47,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class IOdictionary Declaration
Class IOdictionary Declaration
\*---------------------------------------------------------------------------*/
class IOdictionary

View File

@ -28,8 +28,8 @@ Description
baseIOdictionary is derived from dictionary and IOobject to give the
dictionary automatic IO functionality via the objectRegistry.
To facilitate IO,
IOdictioanry is provided with a constructor from IOobject and writeData and
write functions.
baseIOdictionary is provided with a constructor from IOobject and with
readData/writeData functions.
SourceFiles
baseIOdictionary.C
@ -49,7 +49,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class baseIOdictionary Declaration
Class baseIOdictionary Declaration
\*---------------------------------------------------------------------------*/
class baseIOdictionary

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 | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -614,10 +614,29 @@ void Foam::argList::parse
// Establish rootPath_/globalCase_/case_ for master
getRootCase();
// See if running distributed (different roots for different procs)
label dictNProcs = -1;
fileName source;
// Establish location of decomposeParDict, allow override with
// the -decomposeParDict option.
fileName source = rootPath_/globalCase_/"system"/"decomposeParDict";
if (options_.found("decomposeParDict"))
{
bool adjustOpt = false;
source = options_["decomposeParDict"];
if (isDir(source))
{
adjustOpt = true;
source = source/"decomposeParDict";
}
// Could also check for absolute path, but shouldn't be needed
if (adjustOpt)
{
source.clean();
options_.set("decomposeParDict", source);
}
}
// If running distributed (different roots for different procs)
label dictNProcs = -1;
if (options_.found("roots"))
{
source = "-roots";
@ -631,16 +650,8 @@ void Foam::argList::parse
}
else
{
source = rootPath_/globalCase_/"system"/"decomposeParDict";
// Override with -decomposeParDict
if (options_.found("decomposeParDict"))
{
source = options_["decomposeParDict"];
if (isDir(source))
{
source = source/"decomposeParDict";
}
}
// Use values from decomposeParDict, the location was already
// established above.
IFstream decompDictStream(source);

View File

@ -1,7 +1,6 @@
fileName dictPath = "";
if (args.optionFound("dict"))
fileName dictPath;
if (args.optionReadIfPresent("dict", dictPath))
{
dictPath = args["dict"];
if (isDir(dictPath))
{
dictPath = dictPath / dictName;

View File

@ -1,7 +1,6 @@
fileName dictPath = "";
if (args.optionFound("dict"))
fileName dictPath;
if (args.optionReadIfPresent("dict", dictPath))
{
dictPath = args["dict"];
if (isDir(dictPath))
{
dictPath = dictPath / dictName;

View File

@ -1,7 +1,6 @@
fileName dictPath = "";
if (args.optionFound("dict"))
fileName dictPath;
if (args.optionReadIfPresent("dict", dictPath))
{
dictPath = args["dict"];
if (isDir(dictPath))
{
dictPath = dictPath / dictName;

View File

@ -0,0 +1,56 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 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 "wordReListMatcher.H"
#include "HashSet.H"
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
Foam::wordReList Foam::wordReListMatcher::uniq(const UList<wordRe>& input)
{
wordReList retain(input.size());
wordHashSet uniqWord;
label nUniq = 0;
forAll(input, i)
{
const wordRe& select = input[i];
if
(
select.isPattern()
|| uniqWord.insert(static_cast<const word&>(select))
)
{
retain[nUniq++] = select;
}
}
retain.setSize(nUniq);
return retain;
}
// ************************************************************************* //

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) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -77,13 +77,20 @@ public:
inline const UList<wordRe>& operator()() const;
// Searching
// Searching
//- Return true if string matches any of the regular expressions
// Smart match as regular expression or as a string.
// Optionally specify a literal match only.
inline bool match(const string&, bool literalMatch=false) const;
// Helpers
//- Return a wordReList with duplicate words filtered out.
// No filtering is done on regular expressions.
static wordReList uniq(const UList<wordRe>& input);
};

View File

@ -13,6 +13,7 @@ $(BCs)/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C
$(BCs)/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.C
$(BCs)/fixedIncidentRadiation/fixedIncidentRadiationFvPatchScalarField.C
$(BCs)/lumpedMassWallTemperature/lumpedMassWallTemperatureFvPatchScalarField.C
$(BCs)/outletMappedUniformInletHeatAddition/outletMappedUniformInletHeatAdditionFvPatchField.C
turbulentFluidThermoModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatWallFunction/alphatWallFunctionFvPatchScalarField.C
turbulentFluidThermoModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C

View File

@ -36,9 +36,9 @@ Description
Usage
\table
Property | Description | Required | Default value
kappa | thermal conductivity option | yes |
Cp | Heat capacity [J/Kg K]] | yes |
mass | Total mass [Kg] | yes |
kappaMethod | thermal conductivity option | yes |
Cp | Heat capacity [J/kg.K] | yes |
mass | Total mass [kg] | yes |
\endtable
Example of the boundary condition specification:
@ -47,7 +47,7 @@ Usage
{
type lumpedMassWallTemperature;
kappaMethod fluidThermo;
kappaName none;
kappa none;
mass 1000;
Cp 4100;
value uniform 300.0;
@ -86,7 +86,7 @@ private:
//- Specifc heat capacity [J/kg/K]
scalar Cp_;
//- Mass / [kg]
//- Mass [kg]
scalar mass_;
//- Current time index (used for updating)

View File

@ -0,0 +1,233 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 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 "outletMappedUniformInletHeatAdditionFvPatchField.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "basicThermo.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::outletMappedUniformInletHeatAdditionFvPatchField::
outletMappedUniformInletHeatAdditionFvPatchField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
outletPatchName_(),
phiName_("phi"),
Q_(0),
minTempLimit_(0),
maxTempLimit_(5000)
{}
Foam::outletMappedUniformInletHeatAdditionFvPatchField::
outletMappedUniformInletHeatAdditionFvPatchField
(
const outletMappedUniformInletHeatAdditionFvPatchField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
outletPatchName_(ptf.outletPatchName_),
phiName_(ptf.phiName_),
Q_(ptf.Q_),
minTempLimit_(ptf.minTempLimit_),
maxTempLimit_(ptf.maxTempLimit_)
{}
Foam::outletMappedUniformInletHeatAdditionFvPatchField::
outletMappedUniformInletHeatAdditionFvPatchField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict),
outletPatchName_(dict.lookup("outletPatch")),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
Q_(readScalar(dict.lookup("Q"))),
minTempLimit_(dict.lookupOrDefault<scalar>("minTempLimit", 0)),
maxTempLimit_(dict.lookupOrDefault<scalar>("maxTempLimit", 5000))
{}
Foam::outletMappedUniformInletHeatAdditionFvPatchField::
outletMappedUniformInletHeatAdditionFvPatchField
(
const outletMappedUniformInletHeatAdditionFvPatchField& ptf
)
:
fixedValueFvPatchScalarField(ptf),
outletPatchName_(ptf.outletPatchName_),
phiName_(ptf.phiName_),
Q_(ptf.Q_),
minTempLimit_(ptf.minTempLimit_),
maxTempLimit_(ptf.maxTempLimit_)
{}
Foam::outletMappedUniformInletHeatAdditionFvPatchField::
outletMappedUniformInletHeatAdditionFvPatchField
(
const outletMappedUniformInletHeatAdditionFvPatchField& ptf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(ptf, iF),
outletPatchName_(ptf.outletPatchName_),
phiName_(ptf.phiName_),
Q_(ptf.Q_),
minTempLimit_(ptf.minTempLimit_),
maxTempLimit_(ptf.maxTempLimit_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::outletMappedUniformInletHeatAdditionFvPatchField::updateCoeffs()
{
if (this->updated())
{
return;
}
const GeometricField<scalar, fvPatchField, volMesh>& f
(
dynamic_cast<const GeometricField<scalar, fvPatchField, volMesh>&>
(
this->internalField()
)
);
const fvPatch& p = this->patch();
label outletPatchID =
p.patch().boundaryMesh().findPatchID(outletPatchName_);
if (outletPatchID < 0)
{
FatalErrorInFunction
<< "Unable to find outlet patch " << outletPatchName_
<< abort(FatalError);
}
const fvPatch& outletPatch = p.boundaryMesh()[outletPatchID];
const fvPatchField<scalar>& outletPatchField =
f.boundaryField()[outletPatchID];
const surfaceScalarField& phi =
this->db().lookupObject<surfaceScalarField>
(
phiName_
);
const scalarField& outletPatchPhi = phi.boundaryField()[outletPatchID];
scalar sumOutletPatchPhi = gSum(outletPatchPhi);
if (sumOutletPatchPhi > SMALL)
{
const basicThermo& thermo =
this->db().lookupObject<basicThermo>(basicThermo::dictName);
scalar averageOutletField =
gSum(outletPatchPhi*outletPatchField)/sumOutletPatchPhi;
const scalarField Cpf(thermo.Cp()().boundaryField()[outletPatchID]);
scalar totalPhiCp = gSum(outletPatchPhi)*gAverage(Cpf);
operator==
(
min
(
max
(
averageOutletField + Q_/totalPhiCp,
minTempLimit_
),
maxTempLimit_
)
);
}
else
{
scalar averageOutletField =
gSum(outletPatch.magSf()*outletPatchField)
/gSum(outletPatch.magSf());
operator==(averageOutletField);
}
fixedValueFvPatchScalarField::updateCoeffs();
}
void Foam::outletMappedUniformInletHeatAdditionFvPatchField::write
(
Ostream& os
) const
{
fvPatchScalarField::write(os);
os.writeKeyword("outletPatch")
<< outletPatchName_ << token::END_STATEMENT << nl;
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
os.writeKeyword("Q") << Q_ << token::END_STATEMENT << nl;
os.writeKeyword("minTempLimit")
<< minTempLimit_ << token::END_STATEMENT << nl;
os.writeKeyword("maxTempLimit")
<< maxTempLimit_ << token::END_STATEMENT << nl;
this->writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
outletMappedUniformInletHeatAdditionFvPatchField
);
}
// ************************************************************************* //

View File

@ -0,0 +1,202 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 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::outletMappedUniformInletHeatAdditionFvPatchField
Group
grpInletBoundaryConditions
Description
This temperature boundary conditon averages the temperature over the
"outlet" patch specified by name "outletPatch" and applies an extra
heat source. This is set as a uniform temperature value on this patch.
Additionally minTempLimit/maxTempLimit limits can be applied
\heading Patch usage
\table
Property | Description | Required | Default value
outletPatch | name of outlet patch | yes |
Q | Heat addition | yes
phi | flux field name | no | phi
minTempLimit | min temperature limit | no | 0.0
maxTempLimit | max temperature limit | no | 5000.0
\endtable
Example of the boundary condition specification:
\verbatim
myPatch
{
type outletMappedUniformInletHeatAddition;
outletPatch aPatch;
Q 10; // Heat addition in W
phi phi;
value uniform 0;
}
\endverbatim
SeeAlso
Foam::fixedValueFvPatchField
SourceFiles
outletMappedUniformInletHeatAdditionFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef outletMappedUniformInletHeatAdditionFvPatchField_H
#define outletMappedUniformInletHeatAdditionFvPatchField_H
#include "fixedValueFvPatchFields.H"
#include "fvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class outletMappedUniformInletHeatAdditionFvPatchField Declaration
\*---------------------------------------------------------------------------*/
class outletMappedUniformInletHeatAdditionFvPatchField
:
public fixedValueFvPatchScalarField
{
// Private data
//- Name of the outlet patch to be mapped
word outletPatchName_;
//- Name of the flux transporting the field
word phiName_;
//- Input energy
scalar Q_;
//- Minimum Temperature Limit
scalar minTempLimit_;
//- Maxmum Temperature Limit
scalar maxTempLimit_;
public:
//- Runtime type information
TypeName("outletMappedUniformInletHeatAddition");
// Constructors
//- Construct from patch and internal field
outletMappedUniformInletHeatAdditionFvPatchField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
outletMappedUniformInletHeatAdditionFvPatchField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given outletMappedUniformInletHeatAdditionFvPatchField
// onto a new patch
outletMappedUniformInletHeatAdditionFvPatchField
(
const outletMappedUniformInletHeatAdditionFvPatchField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
outletMappedUniformInletHeatAdditionFvPatchField
(
const outletMappedUniformInletHeatAdditionFvPatchField&
);
//- Construct and return a clone
virtual tmp<fvPatchField<scalar>> clone() const
{
return tmp<fvPatchField<scalar>>
(
new outletMappedUniformInletHeatAdditionFvPatchField(*this)
);
}
//- Construct as copy setting internal field reference
outletMappedUniformInletHeatAdditionFvPatchField
(
const outletMappedUniformInletHeatAdditionFvPatchField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<scalar>> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchField<scalar>>
(
new outletMappedUniformInletHeatAdditionFvPatchField(*this, iF)
);
}
// Member functions
// Access
//- Name of the outlet patch to be mapped
const word& outletPatchName() const
{
return outletPatchName_;
}
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -204,10 +204,10 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
<< "Did not find field " << kappaName_
<< " on mesh " << mesh.name() << " patch " << patch_.name()
<< nl
<< "Please set 'kappa' to one of "
<< "Please set 'kappaMethod' to one of "
<< KMethodTypeNames_.toc()
<< " and 'kappaName' to the name of the volScalar"
<< " or volSymmTensor field (if kappa=lookup)"
<< " and 'kappa' to the name of the volScalar"
<< " or volSymmTensor field (if kappaMethod=lookup)"
<< exit(FatalError);
}
@ -218,9 +218,10 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
{
FatalErrorInFunction
<< "Unimplemented method " << KMethodTypeNames_[method_] << nl
<< "Please set 'kappa' to one of " << KMethodTypeNames_.toc()
<< " and 'kappaName' to the name of the volScalar"
<< " or volSymmTensor field (if kappa=lookup)"
<< "Please set 'kappaMethod' to one of "
<< KMethodTypeNames_.toc()
<< " and 'kappa' to the name of the volScalar"
<< " or volSymmTensor field (if kappaMethod=lookup)"
<< exit(FatalError);
}
}

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) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -26,8 +26,8 @@ Class
Description
IDDESDelta used by the IDDES (improved low Re Spalart-Allmaras DES model)
The min and max delta are calculated using the double distance of the min or
max from the face centre to the cell centre.
The min and max delta are calculated using the face to face distance of
the cell.
SourceFiles
IDDESDelta.C

View File

@ -15,8 +15,13 @@ if [ "$WM_LABEL_SIZE" = 64 ]
then
# The libccmio uses int32_t.
# The OpenFOAM adapter thus requires additional work for 64-bit labels.
echo "Skipping optional component libccm"
echo "Skipping optional 'libccm' adapter component"
echo " does not support 64-bit labels"
elif [ "$WM_PRECISION_OPTION" = SP ]
then
# The OpenFOAM adapter was originally only designed for 'double'
echo "Skipping optional 'libccm' adapter component"
echo " was not originally designed for 'single precision' values"
elif [ -e $CCMIO_ARCH_PATH/include/libccmio/ccmio.h \
-a -e $CCMIO_ARCH_PATH/lib/libccmio.a ]
then

View File

@ -230,7 +230,7 @@ void Foam::fileFormats::STARCDCore::writePoints
(
Ostream& os,
const pointField& points,
const double scaleFactor
const scalar scaleFactor
)
{
writeHeader(os, HEADER_VRT);

View File

@ -116,7 +116,7 @@ Foam::foamVtkFormatter::openTag(const word& tag)
Foam::foamVtkFormatter&
Foam::foamVtkFormatter::closeTag(bool isEmpty)
Foam::foamVtkFormatter::closeTag(const bool isEmpty)
{
if (!inTag_)
{
@ -207,20 +207,23 @@ Foam::foamVtkFormatter&
Foam::foamVtkFormatter::xmlAttr
(
const word& k,
const label v,
const int32_t v,
const char quote
)
{
if (!inTag_)
{
WarningInFunction
<< "xml attribute '" << k << "' but not within a tag!"
<< endl;
}
return xmlAttribute(k, v, quote);
}
os_ << ' ' << k << '=' << quote << v << quote;
return *this;
Foam::foamVtkFormatter&
Foam::foamVtkFormatter::xmlAttr
(
const word& k,
const int64_t v,
const char quote
)
{
return xmlAttribute(k, v, quote);
}
@ -232,16 +235,7 @@ Foam::foamVtkFormatter::xmlAttr
const char quote
)
{
if (!inTag_)
{
WarningInFunction
<< "xml attribute '" << k << "' but not within a tag!"
<< endl;
}
os_ << ' ' << k << '=' << quote << v << quote;
return *this;
return xmlAttribute(k, v, quote);
}
@ -253,16 +247,7 @@ Foam::foamVtkFormatter::xmlAttr
const char quote
)
{
if (!inTag_)
{
WarningInFunction
<< "xml attribute '" << k << "' but not within a tag!"
<< endl;
}
os_ << ' ' << k << '=' << quote << v << quote;
return *this;
return xmlAttribute(k, v, quote);
}
@ -283,7 +268,18 @@ Foam::foamVtkFormatter&
Foam::foamVtkFormatter::operator()
(
const word& k,
const label v
const int32_t v
)
{
return xmlAttr(k, v);
}
Foam::foamVtkFormatter&
Foam::foamVtkFormatter::operator()
(
const word& k,
const int64_t v
)
{
return xmlAttr(k, v);

View File

@ -70,6 +70,16 @@ class foamVtkFormatter
mutable bool inTag_;
//- Write XML attribute
template<class Type>
foamVtkFormatter& xmlAttribute
(
const word&,
const Type&,
const char quote
);
protected:
// Protected Member Functions
@ -113,9 +123,9 @@ public:
virtual void writeSize(const uint64_t) = 0;
virtual void write(const uint8_t) = 0;
virtual void write(const label) = 0;
virtual void write(const float) = 0;
virtual void write(const double) = 0;
virtual void write(const label) = 0;
virtual void write(const float) = 0;
virtual void write(const double) = 0;
virtual void flush() = 0;
@ -136,7 +146,7 @@ public:
//- Close XML tag, optional as an empty container.
// Always adds a trailing newline.
foamVtkFormatter& closeTag(bool isEmpty = false);
foamVtkFormatter& closeTag(const bool isEmpty = false);
//- End XML tag, optional with sanity check
// Always adds a trailing newline.
@ -164,21 +174,28 @@ public:
}
//- Write XML attribute
foamVtkFormatter& xmlAttr
(
const word&,
const std::string&,
const char quote='\''
const char quote = '\''
);
//- Write XML attribute
foamVtkFormatter& xmlAttr
(
const word&,
const label,
const char quote='\''
const int32_t,
const char quote = '\''
);
//- Write XML attribute
foamVtkFormatter& xmlAttr
(
const word&,
const int64_t,
const char quote = '\''
);
//- Write XML attribute
@ -186,7 +203,7 @@ public:
(
const word&,
const uint64_t,
const char quote='\''
const char quote = '\''
);
//- Write XML attribute
@ -194,7 +211,7 @@ public:
(
const word&,
const scalar,
const char quote='\''
const char quote = '\''
);
@ -205,7 +222,10 @@ public:
foamVtkFormatter& operator()(const word&, const std::string&);
//- Write XML attribute
foamVtkFormatter& operator()(const word&, const label);
foamVtkFormatter& operator()(const word&, const int32_t);
//- Write XML attribute
foamVtkFormatter& operator()(const word&, const int64_t);
//- Write XML attribute
foamVtkFormatter& operator()(const word&, const uint64_t);

View File

@ -26,6 +26,28 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
Foam::foamVtkFormatter&
Foam::foamVtkFormatter::xmlAttribute
(
const word& k,
const Type& v,
const char quote
)
{
if (!inTag_)
{
WarningInFunction
<< "xml attribute '" << k << "' but not within a tag!"
<< endl;
}
os_ << ' ' << k << '=' << quote << v << quote;
return *this;
}
template<class Type, int nComp>
Foam::foamVtkFormatter& Foam::foamVtkFormatter::openDataArray
(

View File

@ -77,8 +77,9 @@ void Foam::foamVtkLegacyFormatter::writeSize(const uint64_t)
void Foam::foamVtkLegacyFormatter::write(const uint8_t val)
{
// Can only handle integers
int copy(val);
// Legacy can only handle 32-bit integers.
// Nonetheless promote to 'label' (32 or 64 bit) and deal with it later
label copy(val);
write(copy);
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -122,6 +122,37 @@ Foam::porosityModel::porosityModel
<< "cannot find porous cellZone " << zoneName_
<< exit(FatalError);
}
Info<< incrIndent << indent << coordSys_ << decrIndent << endl;
const pointField& points = mesh_.points();
const cellList& cells = mesh_.cells();
const faceList& faces = mesh_.faces();
DynamicList<point> localPoints;
forAll(cellZoneIDs_, zoneI)
{
const cellZone& cZone = mesh_.cellZones()[cellZoneIDs_[zoneI]];
localPoints.setCapacity(10*cells.size());
forAll(cZone, i)
{
const label cellI = cZone[i];
const cell& c = mesh_.cells()[cellI];
const pointField cellPoints(c.points(faces, points));
forAll(cellPoints, pointI)
{
const point& pt = cellPoints[pointI];
localPoints.append(coordSys_.localPosition(pt));
}
}
boundBox bb(localPoints, true);
Info<< " local bounds: " << bb << endl;
localPoints.clear();
}
}

View File

@ -71,7 +71,7 @@ flowRateInletVelocityFvPatchVectorField
{
volumetric_ = false;
flowRate_ = Function1<scalar>::New("massFlowRate", dict);
rhoName_ = word(dict.lookupOrDefault<word>("rho", "rho"));
rhoName_ = dict.lookupOrDefault<word>("rho", "rho");
}
else
{

View File

@ -29,13 +29,13 @@ Group
Description
This boundary conditon averages the field over the "outlet" patch specified
by name "outletPatchName" and applies this as the uniform value of the
by name "outletPatch" and applies this as the uniform value of the
field over this patch.
Usage
\table
Property | Description | Required | Default value
outletPatchName | name of outlet patch | yes |
outletPatch | name of outlet patch | yes |
phi | flux field name | no | phi
\endtable
@ -44,7 +44,7 @@ Usage
<patchName>
{
type outletMappedUniformInlet;
outletPatchName aPatch;
outletPatch aPatch;
phi phi;
value uniform 0;
}

View File

@ -1104,9 +1104,9 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::write(Ostream& os) const
fvPatchField<vector>::write(os);
writeEntry("value", os);
os.writeKeyword("delta") << delta_ << token::END_STATEMENT << nl;
writeEntryIfDifferent(os, "d", 1.0, d_);
writeEntryIfDifferent(os, "kappa", 0.41, kappa_);
writeEntryIfDifferent(os, "perturb", 1e-5, perturb_);
writeEntryIfDifferent<scalar>(os, "d", 1.0, d_);
writeEntryIfDifferent<scalar>(os, "kappa", 0.41, kappa_);
writeEntryIfDifferent<scalar>(os, "perturb", 1e-5, perturb_);
writeEntryIfDifferent<label>(os, "nCellPerEddy", 5, nCellPerEddy_);
writeEntryIfDifferent(os, "writeEddies", false, writeEddies_);

View File

@ -113,7 +113,7 @@ bool Foam::functionObjects::DESModelRegions::read(const dictionary& dict)
fvMeshFunctionObject::read(dict);
writeFile::read(dict);
dict.readIfPresent("resultName", resultName_);
dict.readIfPresent("result", resultName_);
return true;
}

View File

@ -27,6 +27,7 @@ License
#include "volFields.H"
#include "dictionary.H"
#include "wordReListMatcher.H"
#include "steadyStateDdtScheme.H"
#include "addToRunTimeSelectionTable.H"
@ -77,25 +78,6 @@ bool Foam::functionObjects::ddt2::checkFormatName(const word& str)
}
void Foam::functionObjects::ddt2::uniqWords(wordReList& lst)
{
boolList retain(lst.size());
wordHashSet uniq;
forAll(lst, i)
{
const wordRe& select = lst[i];
retain[i] =
(
select.isPattern()
|| uniq.insert(static_cast<const word&>(select))
);
}
inplaceSubset(retain, lst);
}
bool Foam::functionObjects::ddt2::accept(const word& fieldName) const
{
// check input vs possible result names
@ -130,6 +112,7 @@ Foam::functionObjects::ddt2::ddt2
)
:
fvMeshFunctionObject(name, runTime, dict),
prevTimeIndex_(-1),
selectFields_(),
resultName_(word::null),
blacklist_(),
@ -160,10 +143,11 @@ bool Foam::functionObjects::ddt2::read(const dictionary& dict)
return false;
}
fvMeshFunctionObject::read(dict);
dict.lookup("fields") >> selectFields_;
uniqWords(selectFields_);
selectFields_ = wordReListMatcher::uniq
(
wordReList(dict.lookup("fields"))
);
Info<< type() << " fields: " << selectFields_ << nl;
resultName_ = dict.lookupOrDefault<word>
(
@ -234,12 +218,20 @@ bool Foam::functionObjects::ddt2::execute()
<< "Unprocessed field " << ignored << endl;
}
// Update time index
prevTimeIndex_ = obr_.time().timeIndex();
return true;
}
bool Foam::functionObjects::ddt2::write()
{
if (prevTimeIndex_ < obr_.time().timeIndex())
{
// Ensure written results reflect the current state
execute();
}
if (results_.size())
{
Log << type() << ' ' << name() << " write:" << endl;

View File

@ -101,6 +101,9 @@ class ddt2
{
// Private data
//- Time at last execute, ensures write uses up-to-date values
label prevTimeIndex_;
//- Name of fields to process
wordReList selectFields_;
@ -124,9 +127,6 @@ class ddt2
//- Check that the word contains the appropriate substitution token(s).
static bool checkFormatName(const word&);
//- Eliminate duplicate 'word' entries
static void uniqWords(wordReList&);
//- Accept unless field name appears to have already been processed
bool accept(const word& fieldName) const;

View File

@ -52,7 +52,55 @@ namespace functionObjects
Foam::word Foam::functionObjects::externalCoupled::lockName = "OpenFOAM";
Foam::string Foam::functionObjects::externalCoupled::patchKey = "# Patch: ";
Foam::string Foam::functionObjects::externalCoupled::patchKey = "// Patch:";
template<>
const char* Foam::NamedEnum
<
Foam::functionObjects::externalCoupled::stateEnd,
2
>::names[] =
{
"remove",
"done"
// The 'IGNORE' enumeration is internal use only and thus has no name
};
const Foam::NamedEnum
<
Foam::functionObjects::externalCoupled::stateEnd,
2
> Foam::functionObjects::externalCoupled::stateEndNames_;
namespace Foam
{
//! \cond fileScope
//- Write list content with size, bracket, content, bracket one-per-line.
// This makes for consistent for parsing, regardless of the list length.
template <class T>
static void writeList(Ostream& os, const string& header, const UList<T>& L)
{
// Header string
os << header.c_str() << nl;
// Write size and start delimiter
os << L.size() << nl
<< token::BEGIN_LIST;
// Write contents
forAll(L, i)
{
os << nl << L[i];
}
// Write end delimiter
os << nl << token::END_LIST << nl << endl;
}
//! \endcond
}
// namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -91,7 +139,7 @@ Foam::fileName Foam::functionObjects::externalCoupled::lockFile() const
}
void Foam::functionObjects::externalCoupled::createLockFile() const
void Foam::functionObjects::externalCoupled::useMaster() const
{
if (!Pstream::master())
{
@ -107,13 +155,13 @@ void Foam::functionObjects::externalCoupled::createLockFile() const
Log << type() << ": creating lock file" << endl;
OFstream os(fName);
os << "lock file";
os << "status=openfoam\n";
os.flush();
}
}
void Foam::functionObjects::externalCoupled::removeLockFile() const
void Foam::functionObjects::externalCoupled::useSlave() const
{
if (!Pstream::master())
{
@ -122,7 +170,37 @@ void Foam::functionObjects::externalCoupled::removeLockFile() const
Log << type() << ": removing lock file" << endl;
rm(lockFile());
Foam::rm(lockFile());
}
void Foam::functionObjects::externalCoupled::cleanup() const
{
if (!Pstream::master())
{
return;
}
const fileName lck(lockFile());
switch (stateEnd_)
{
case REMOVE:
{
Log << type() << ": removing lock file" << endl;
Foam::rm(lck);
}
break;
case DONE:
{
Log << type() << ": lock file status=done" << endl;
OFstream os(lck);
os << "status=done\n";
os.flush();
}
break;
case IGNORE:
break;
}
}
@ -192,30 +270,29 @@ void Foam::functionObjects::externalCoupled::removeWriteFiles() const
}
void Foam::functionObjects::externalCoupled::wait() const
void Foam::functionObjects::externalCoupled::waitForSlave() const
{
const fileName fName(lockFile());
label found = 0;
label totalTime = 0;
bool found = false;
Log << type() << ": beginning wait for lock file " << fName << nl;
while (found == 0)
while (!found)
{
if (Pstream::master())
{
if (totalTime > timeOut_)
{
FatalErrorInFunction
<< "Wait time exceeded time out time of " << timeOut_
<< "Wait time exceeded timeout of " << timeOut_
<< " s" << abort(FatalError);
}
IFstream is(fName);
if (is.good())
{
found++;
found = true;
Log << type() << ": found lock file " << fName << endl;
}
@ -229,7 +306,7 @@ void Foam::functionObjects::externalCoupled::wait() const
}
// Prevent other procs from racing ahead
reduce(found, sumOp<label>());
reduce(found, orOp<bool>());
}
}
@ -384,8 +461,6 @@ void Foam::functionObjects::externalCoupled::writeGeometry
fileName dir(groupDir(commsDir, compositeName(regionNames), groupName));
Info<< typeName << ": writing geometry to " << dir << endl;
autoPtr<OFstream> osPointsPtr;
autoPtr<OFstream> osFacesPtr;
if (Pstream::master())
@ -393,124 +468,87 @@ void Foam::functionObjects::externalCoupled::writeGeometry
mkDir(dir);
osPointsPtr.reset(new OFstream(dir/"patchPoints"));
osFacesPtr.reset(new OFstream(dir/"patchFaces"));
osPointsPtr() << "// Group: " << groupName << endl;
osFacesPtr() << "// Group: " << groupName << endl;
Info<< typeName << ": writing geometry to " << dir << endl;
}
// Individual region/patch entries
DynamicList<face> allMeshesFaces;
DynamicField<point> allMeshesPoints;
DynamicList<face> allFaces;
DynamicField<point> allPoints;
labelList pointToGlobal;
labelList uniquePointIDs;
forAll(meshes, meshi)
{
const fvMesh& mesh = meshes[meshi];
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
const labelList patchIDs
(
pbm.patchSet(List<wordRe>(1, groupName)).sortedToc()
mesh.boundaryMesh().patchSet
(
List<wordRe>(1, groupName)
).sortedToc()
);
// Count faces
label nFaces = 0;
forAll(patchIDs, i)
{
nFaces += pbm[patchIDs[i]].size();
}
const polyPatch& p = mesh.boundaryMesh()[patchIDs[i]];
// Collect faces
DynamicList<label> allFaceIDs(nFaces);
forAll(patchIDs, i)
{
const polyPatch& p = pbm[patchIDs[i]];
mesh.globalData().mergePoints
(
p.meshPoints(),
p.meshPointMap(),
pointToGlobal,
uniquePointIDs
);
forAll(p, pi)
label proci = Pstream::myProcNo();
List<pointField> collectedPoints(Pstream::nProcs());
collectedPoints[proci] = pointField(mesh.points(), uniquePointIDs);
Pstream::gatherList(collectedPoints);
List<faceList> collectedFaces(Pstream::nProcs());
faceList& patchFaces = collectedFaces[proci];
patchFaces = p.localFaces();
forAll(patchFaces, facei)
{
allFaceIDs.append(p.start()+pi);
inplaceRenumber(pointToGlobal, patchFaces[facei]);
}
}
Pstream::gatherList(collectedFaces);
// Construct overall patch
indirectPrimitivePatch allPatch
(
IndirectList<face>(mesh.faces(), allFaceIDs),
mesh.points()
);
labelList pointToGlobal;
labelList uniquePointIDs;
mesh.globalData().mergePoints
(
allPatch.meshPoints(),
allPatch.meshPointMap(),
pointToGlobal,
uniquePointIDs
);
label proci = Pstream::myProcNo();
List<pointField> collectedPoints(Pstream::nProcs());
collectedPoints[proci] = pointField(mesh.points(), uniquePointIDs);
Pstream::gatherList(collectedPoints);
List<faceList> collectedFaces(Pstream::nProcs());
faceList& patchFaces = collectedFaces[proci];
patchFaces = allPatch.localFaces();
forAll(patchFaces, facei)
{
inplaceRenumber(pointToGlobal, patchFaces[facei]);
}
Pstream::gatherList(collectedFaces);
if (Pstream::master())
{
// Append and renumber
label nPoints = allMeshesPoints.size();
forAll(collectedPoints, proci)
if (Pstream::master())
{
allMeshesPoints.append(collectedPoints[proci]);
allPoints.clear();
allFaces.clear();
}
face newFace;
forAll(collectedFaces, proci)
{
const faceList& procFaces = collectedFaces[proci];
forAll(procFaces, facei)
for (label proci=0; proci < Pstream::nProcs(); ++proci)
{
const face& f = procFaces[facei];
newFace.setSize(f.size());
forAll(f, fp)
{
newFace[fp] = f[fp]+nPoints;
}
allMeshesFaces.append(newFace);
allPoints.append(collectedPoints[proci]);
allFaces.append(collectedFaces[proci]);
}
nPoints += collectedPoints[proci].size();
Info<< typeName << ": mesh " << mesh.name()
<< ", patch " << p.name()
<< ": writing " << allPoints.size() << " points to "
<< osPointsPtr().name() << nl
<< typeName << ": mesh " << mesh.name()
<< ", patch " << p.name()
<< ": writing " << allFaces.size() << " faces to "
<< osFacesPtr().name() << endl;
// The entry name (region / patch)
const string entryHeader =
patchKey + ' ' + mesh.name() + ' ' + p.name();
writeList(osPointsPtr(), entryHeader, allPoints);
writeList(osFacesPtr(), entryHeader, allFaces);
}
}
{
Info<< typeName << ": for mesh " << mesh.name()
<< " writing " << allMeshesPoints.size() << " points to "
<< osPointsPtr().name() << endl;
Info<< typeName << ": for mesh " << mesh.name()
<< " writing " << allMeshesFaces.size() << " faces to "
<< osFacesPtr().name() << endl;
}
}
// Write points
if (osPointsPtr.valid())
{
osPointsPtr() << allMeshesPoints << endl;
}
// Write faces
if (osFacesPtr.valid())
{
osFacesPtr() << allMeshesFaces << endl;
}
}
@ -532,7 +570,7 @@ Foam::word Foam::functionObjects::externalCoupled::compositeName
{
// For compatibility with single region cases suppress single
// region name
return word("");
return word::null;
}
else
{
@ -759,7 +797,7 @@ void Foam::functionObjects::externalCoupled::initialise()
if (initByExternal_)
{
// Wait for initial data to be made available
wait();
waitForSlave();
// Read data passed back from external source
readData();
@ -780,7 +818,7 @@ Foam::functionObjects::externalCoupled::externalCoupled
:
functionObject(name),
time_(runTime),
enabled_(true),
stateEnd_(REMOVE),
initialised_(false)
{
read(dict);
@ -792,7 +830,7 @@ Foam::functionObjects::externalCoupled::externalCoupled
if (!initByExternal_)
{
createLockFile();
useMaster();
}
}
@ -800,7 +838,9 @@ Foam::functionObjects::externalCoupled::externalCoupled
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::externalCoupled::~externalCoupled()
{}
{
cleanup();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -815,11 +855,12 @@ bool Foam::functionObjects::externalCoupled::execute()
// Write data for external source
writeData();
// remove lock file, signalling external source to execute
removeLockFile();
// Signal external source to execute (by removing lock file)
// - Wait for slave to provide data
useSlave();
// Wait for response
wait();
waitForSlave();
// Remove old data files from OpenFOAM
removeWriteFiles();
@ -827,8 +868,8 @@ bool Foam::functionObjects::externalCoupled::execute()
// Read data passed back from external source
readData();
// create lock file for external source
createLockFile();
// Signal external source to wait (by creating the lock file)
useMaster();
return true;
}
@ -846,7 +887,9 @@ bool Foam::functionObjects::externalCoupled::end()
// Remove old data files
removeReadFiles();
removeWriteFiles();
removeLockFile();
cleanup();
stateEnd_ = IGNORE; // Avoid running cleanup() again in destructor
return true;
}
@ -856,28 +899,24 @@ bool Foam::functionObjects::externalCoupled::read(const dictionary& dict)
{
functionObject::read(dict);
dict.readIfPresent("enabled", enabled_);
if (!enabled_)
{
return true;
}
calcFrequency_ = dict.lookupOrDefault("calcFrequency", 1);
dict.lookup("commsDir") >> commsDir_;
commsDir_.expand();
commsDir_.clean();
waitInterval_ = dict.lookupOrDefault("waitInterval", 1);
timeOut_ = dict.lookupOrDefault("timeOut", 100*waitInterval_);
calcFrequency_ = dict.lookupOrDefault("calcFrequency", 1);
waitInterval_ = dict.lookupOrDefault("waitInterval", 1);
timeOut_ = dict.lookupOrDefault("timeOut", 100*waitInterval_);
initByExternal_ = readBool(dict.lookup("initByExternal"));
// initByExternal_ = dict.lookupOrDefault<Switch>("initByExternal", false);
stateEnd_ =
stateEndNames_[dict.lookupOrDefault<word>("stateEnd", "remove")];
// Get names of all fvMeshes (and derived types)
wordList allRegionNames(time_.lookupClass<fvMesh>().sortedToc());
const dictionary& allRegionsDict = dict.subDict("regions");
forAllConstIter(dictionary, allRegionsDict, iter)
{
if (!iter().isDict())

View File

@ -82,6 +82,7 @@ Usage
log yes;
commsDir "${FOAM_CASE}/comms";
initByExternal yes;
stateEnd remove; // (remove | done)
regions
{
@ -113,6 +114,7 @@ Usage
application.
SourceFiles
externalCoupled.C
externalCoupledTemplates.C
\*---------------------------------------------------------------------------*/
@ -124,6 +126,7 @@ SourceFiles
#include "DynamicList.H"
#include "wordReList.H"
#include "scalarField.H"
#include "NamedEnum.H"
#include "Switch.H"
#include "UPtrList.H"
@ -147,14 +150,29 @@ class externalCoupled
:
public functionObject
{
public:
// Public data types
//- Lockfile state on termination
enum stateEnd
{
REMOVE, //!< Remove lock file on end
DONE, //!< Lock file contains status=done on end
IGNORE //!< Internal use only (for handling cleanup).
};
private:
//- State end names
static const NamedEnum<stateEnd, 2> stateEndNames_;
// Private data
//- Reference to the time database
const Time& time_;
//- Switch for the execution - defaults to 'yes/on'
Switch enabled_;
//- Path to communications directory
fileName commsDir_;
@ -170,6 +188,9 @@ class externalCoupled
//- Flag to indicate values are initialised by external application
bool initByExternal_;
//- Lockfile state on termination
stateEnd stateEnd_;
//- Names of (composite) regions
DynamicList<word> regionGroupNames_;
@ -208,11 +229,15 @@ class externalCoupled
//- Return the file path to the lock file
fileName lockFile() const;
//- Create lock file
void createLockFile() const;
//- Remove lock file
void removeLockFile() const;
//- Create lock file to indicate that OpenFOAM is in charge
void useMaster() const;
//- Remove lock file to indicate that the external program is in charge
void useSlave() const;
//- Remove lock file or status=done in lock.
void cleanup() const;
//- Remove files written by OpenFOAM
void removeWriteFiles() const;
@ -220,8 +245,9 @@ class externalCoupled
//- Remove files written by external code
void removeReadFiles() const;
//- Wait for response from external source
void wait() const;
//- Wait for indication that the external program has supplied input
// (ie, for the lock file to reappear).
void waitForSlave() const;
//- Read data for a single region, single field
@ -290,10 +316,10 @@ public:
//- Runtime type information
TypeName("externalCoupled");
//- Name of lock file
//- Name of lock file (normally 'OpenFOAM.lock')
static word lockName;
//- Name of patch key, e.g. '# Patch:' when looking for start of patch data
//- Name of patch key, e.g. '// Patch:' when looking for start of patch data
static string patchKey;
@ -335,7 +361,7 @@ public:
// separated by '_'
static word compositeName(const wordList&);
//- Write geometry for the group/patch
//- Write geometry for the group as region/patch
static void writeGeometry
(
const UPtrList<const fvMesh>& meshes,

View File

@ -81,8 +81,6 @@ bool Foam::functionObjects::externalCoupled::readData
label nFound = 0;
forAll(meshes, i)
{
const fvMesh& mesh = meshes[i];

View File

@ -623,7 +623,7 @@ bool Foam::functionObjects::fluxSummary::read(const dictionary& dict)
writeFile::read(dict);
mode_ = modeTypeNames_.read(dict.lookup("mode"));
phiName_= dict.lookupOrDefault<word>("phiName", "phi");
phiName_= dict.lookupOrDefault<word>("phi", "phi");
dict.readIfPresent("scaleFactor", scaleFactor_);
dict.readIfPresent("tolerance", tolerance_);

View File

@ -79,8 +79,8 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::pressure::rhoScale
FatalErrorInFunction
<< type() << " " << name() << ": "
<< "pressure identified as incompressible, but reference "
<< "density is not set. Please set rhoName to rhoInf, and "
<< "set an appropriate value for rhoInf"
<< "density is not set. Please set 'rho' to 'rhoInf', and "
<< "set an appropriate value for 'rhoInf'"
<< exit(FatalError);
}

View File

@ -558,7 +558,7 @@ bool Foam::functionObjects::streamLineBase::read(const dictionary& dict)
//Info<< " using interpolation " << interpolationScheme_ << endl;
cloudName_ = dict.lookupOrDefault<word>("cloudName", type());
cloudName_ = dict.lookupOrDefault<word>("cloud", type());
dict.lookup("seedSampleSet") >> seedSet_;
const dictionary& coeffsDict = dict.subDict(seedSet_ + "Coeffs");

View File

@ -70,7 +70,7 @@ Foam::functionObjects::valueAverage::valueAverage
:
regionFunctionObject(name, runTime, dict),
writeFile(obr_, name, typeName, dict),
functionObjectName_("unknown-functionObjectName"),
functionObjectName_("unknown-functionObject"),
fieldNames_(),
window_(-1),
totalTime_(),
@ -109,7 +109,7 @@ bool Foam::functionObjects::valueAverage::read(const dictionary& dict)
regionFunctionObject::read(dict);
writeFile::read(dict);
dict.lookup("functionObjectName") >> functionObjectName_;
dict.lookup("functionObject") >> functionObjectName_;
dict.lookup("fields") >> fieldNames_;
window_ = dict.lookupOrDefault<scalar>("window", -1);

View File

@ -27,6 +27,7 @@ License
#include "volFields.H"
#include "dictionary.H"
#include "wordReListMatcher.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -76,25 +77,6 @@ bool Foam::functionObjects::zeroGradient::checkFormatName(const word& str)
}
void Foam::functionObjects::zeroGradient::uniqWords(wordReList& lst)
{
boolList retain(lst.size());
wordHashSet uniq;
forAll(lst, i)
{
const wordRe& select = lst[i];
retain[i] =
(
select.isPattern()
|| uniq.insert(static_cast<const word&>(select))
);
}
inplaceSubset(retain, lst);
}
int Foam::functionObjects::zeroGradient::process(const word& fieldName)
{
int state = 0;
@ -118,6 +100,7 @@ Foam::functionObjects::zeroGradient::zeroGradient
)
:
fvMeshFunctionObject(name, runTime, dict),
prevTimeIndex_(-1),
selectFields_(),
resultName_(string::null),
results_()
@ -138,8 +121,11 @@ bool Foam::functionObjects::zeroGradient::read(const dictionary& dict)
{
fvMeshFunctionObject::read(dict);
dict.lookup("fields") >> selectFields_;
uniqWords(selectFields_);
selectFields_ = wordReListMatcher::uniq
(
wordReList(dict.lookup("fields"))
);
Info<< type() << " fields: " << selectFields_ << nl;
resultName_ = dict.lookupOrDefault<word>("result", type() + "(@@)");
return checkFormatName(resultName_);
@ -189,12 +175,20 @@ bool Foam::functionObjects::zeroGradient::execute()
<< "Unprocessed field " << ignored << endl;
}
// Update time index
prevTimeIndex_ = obr_.time().timeIndex();
return true;
}
bool Foam::functionObjects::zeroGradient::write()
{
if (prevTimeIndex_ < obr_.time().timeIndex())
{
// Ensure written results reflect the current state
execute();
}
if (results_.size())
{
Log << type() << ' ' << name() << " write:" << endl;

View File

@ -95,6 +95,9 @@ class zeroGradient
{
// Private data
//- Time at last execute, ensures write uses up-to-date values
label prevTimeIndex_;
//- Name of fields to process
wordReList selectFields_;
@ -110,9 +113,6 @@ class zeroGradient
//- Check that the word contains the appropriate substitution token(s).
static bool checkFormatName(const word&);
//- Eliminate duplicate 'word' entries
static void uniqWords(wordReList&);
//- Accept unless field only has constraint patches
// (ie, empty/zero-gradient/processor).

View File

@ -514,7 +514,7 @@ Foam::functionObjects::fieldVisualisationBase::fieldVisualisationBase
:
parent_(parent),
colours_(colours),
fieldName_(dict.lookup("fieldName")),
fieldName_(dict.lookup("field")),
colourBy_(cbColour),
colourMap_(cmRainbow),
range_()

View File

@ -63,9 +63,9 @@ Foam::functionObjects::runTimePostPro::functionObjectCloud::functionObjectCloud
:
pointData(parent, dict, colours),
fieldVisualisationBase(parent, dict, colours),
cloudName_(dict.lookup("cloudName")),
cloudName_(dict.lookup("cloud")),
functionObject_(dict.lookup("functionObject")),
colourFieldName_(dict.lookup("colourFieldName")),
colourFieldName_(dict.lookup("colourField")),
actor_()
{
actor_ = vtkSmartPointer<vtkActor>::New();

View File

@ -29,6 +29,7 @@ License
#include "fvmDiv.H"
#include "fvmLaplacian.H"
#include "fvmSup.H"
#include "CMULES.H"
#include "turbulentTransportModel.H"
#include "turbulentFluidThermoModel.H"
#include "addToRunTimeSelectionTable.H"
@ -85,7 +86,8 @@ Foam::volScalarField& Foam::functionObjects::scalarTransport::transportedField()
Foam::tmp<Foam::volScalarField> Foam::functionObjects::scalarTransport::D
(
const volScalarField& s,
const surfaceScalarField& phi
const surfaceScalarField& phi,
const volScalarField& alpha
) const
{
typedef incompressible::turbulenceModel icoModel;
@ -93,9 +95,11 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::scalarTransport::D
word Dname("D" + s.name());
volScalarField phaseMask(pos(alpha - 0.99));
if (constantD_)
{
return tmp<volScalarField>
tmp<volScalarField> tD
(
new volScalarField
(
@ -111,6 +115,18 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::scalarTransport::D
dimensionedScalar(Dname, phi.dimensions()/dimLength, D_)
)
);
return phaseMask*tD;
}
else if (nutName_ != "none")
{
const volScalarField& nutMean =
mesh_.lookupObject<volScalarField>(nutName_);
return tmp<volScalarField>
(
new volScalarField(Dname, phaseMask*nutMean)
);
}
else if (foundObject<icoModel>(turbulenceModel::propertiesName))
{
@ -119,7 +135,10 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::scalarTransport::D
turbulenceModel::propertiesName
);
return model.nuEff();
return tmp<volScalarField>
(
new volScalarField(Dname, phaseMask*model.nuEff())
);
}
else if (foundObject<cmpModel>(turbulenceModel::propertiesName))
{
@ -128,7 +147,10 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::scalarTransport::D
turbulenceModel::propertiesName
);
return model.muEff();
return tmp<volScalarField>
(
new volScalarField(Dname, phaseMask*model.muEff())
);
}
else
{
@ -163,14 +185,22 @@ Foam::functionObjects::scalarTransport::scalarTransport
:
fvMeshFunctionObject(name, runTime, dict),
fieldName_(dict.lookupOrDefault<word>("field", "s")),
phiName_("phi"),
rhoName_("rho"),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
UPhiName_(dict.lookupOrDefault<word>("UPhi", "none")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
nutName_(dict.lookupOrDefault<word>("nut", "none")),
phaseName_(dict.lookupOrDefault<word>("phase", "none")),
phasePhiCompressedName_
(
dict.lookupOrDefault<word>("phasePhiCompressed", "alphaPhiUn")
),
D_(0),
constantD_(false),
nCorr_(0),
resetOnStartUp_(false),
schemesField_("unknown-schemesField"),
fvOptions_(mesh_)
fvOptions_(mesh_),
bounded01_(dict.lookupOrDefault<bool>("bounded01", true))
{
read(dict);
@ -199,6 +229,11 @@ bool Foam::functionObjects::scalarTransport::read(const dictionary& dict)
dict.readIfPresent("phi", phiName_);
dict.readIfPresent("rho", rhoName_);
dict.readIfPresent("UPhi", UPhiName_);
dict.readIfPresent("nut", nutName_);
dict.readIfPresent("phase", phaseName_);
dict.readIfPresent("bounded01", bounded01_);
schemesField_ = dict.lookupOrDefault("schemesField", fieldName_);
constantD_ = false;
@ -223,12 +258,93 @@ bool Foam::functionObjects::scalarTransport::execute()
{
Log << type() << " write:" << endl;
const surfaceScalarField& phi = lookupObject<surfaceScalarField>(phiName_);
tmp<surfaceScalarField> tPhi
(
new surfaceScalarField
(
IOobject
(
"phi",
mesh_.time().timeName(),
mesh_.time(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("tPhi", dimMass/dimTime, 0.0)
)
);
surfaceScalarField& phi = tPhi.ref();
const dimensionSet dim
(
mesh_.lookupObject<surfaceScalarField>(phiName_).dimensions()
);
bool compressible = true;
if (dim == dimVolume/dimTime)
{
compressible = false;
phi.dimensions().reset(dimVolume/dimTime);
}
//Obtain phi from phiName or constructed from UPhiName
if (phiName_ != "none")
{
phi = const_cast<surfaceScalarField&>
(
mesh_.lookupObject<surfaceScalarField>(phiName_)
);
}
else if (UPhiName_ != "none")
{
const volVectorField& Uphi =
mesh_.lookupObject<volVectorField>(UPhiName_);
if (!compressible)
{
phi = fvc::interpolate(Uphi) & mesh_.Sf();
}
else
{
const volScalarField& rho =
mesh_.lookupObject<volScalarField>(rhoName_);
phi = fvc::interpolate(rho*Uphi) & mesh_.Sf();
}
}
tmp<volScalarField> tPhaseMask
(
new volScalarField
(
IOobject
(
"tPhaseMask",
mesh_.time().timeName(),
mesh_.time(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("tPhaseMask", dimless, 1.0)
)
);
volScalarField& phaseMask = tPhaseMask.ref();
// Set phaseMask if s is transported in a phase
if (phaseName_ != "none")
{
const volScalarField& alpha =
mesh_.lookupObject<volScalarField>(phaseName_);
phaseMask = alpha;
}
volScalarField& s = transportedField();
// Calculate the diffusivity
volScalarField D(this->D(s, phi));
volScalarField D(this->D(s, phi, phaseMask));
word divScheme("div(phi," + schemesField_ + ")");
word laplacianScheme("laplacian(" + D.name() + "," + schemesField_ + ")");
@ -240,12 +356,84 @@ bool Foam::functionObjects::scalarTransport::execute()
relaxCoeff = mesh_.equationRelaxationFactor(schemesField_);
}
if (phi.dimensions() == dimMass/dimTime)
// two phase scalar transport
if (phaseName_ != "none")
{
const volScalarField& alpha =
mesh_.lookupObject<volScalarField>(phaseName_);
const surfaceScalarField& limitedPhiAlpa =
mesh_.lookupObject<surfaceScalarField>(phasePhiCompressedName_);
/*
surfaceScalarField phic(2.0*mag(phi/mesh_.magSf()));
const volVectorField gradAlpha(fvc::grad(alpha, "nHat"));
surfaceVectorField gradAlphaf(fvc::interpolate(gradAlpha));
dimensionedScalar deltaN
(
"deltaN", 1e-8/pow(average(mesh_.V()), 1.0/3.0)
);
surfaceVectorField nHatfv(gradAlphaf/(mag(gradAlphaf) + deltaN));
surfaceScalarField nHat(nHatfv & mesh_.Sf());
surfaceScalarField phir(phic*nHat);
surfaceScalarField limitedPhiAlpa
(
fvc::flux
(
phi,
alpha,
"div(phi,s)"
)
+ fvc::flux
(
-fvc::flux(-phir, (1-alpha), "div(phirb,s)"),
alpha,
"div(phirb,s)"
)
);
*/
// Reset D dimensions consistent with limitedPhiAlpa
D.dimensions().reset(limitedPhiAlpa.dimensions()/dimLength);
tmp<surfaceScalarField> tTPhiUD;
// Solve
for (label i = 0; i <= nCorr_; i++)
{
fvScalarMatrix sEqn
(
fvm::ddt(s)
+ fvm::div(limitedPhiAlpa, s, divScheme)
- fvm::laplacian(D, s, laplacianScheme)
==
alpha*fvOptions_(s)
);
sEqn.relax(relaxCoeff);
fvOptions_.constrain(sEqn);
sEqn.solve(mesh_.solverDict(schemesField_));
tTPhiUD = sEqn.flux();
}
if (bounded01_)
{
MULES::explicitSolve(s, phi, tTPhiUD.ref(), 1, 0);
}
}
else if (compressible)
{
const volScalarField& rho = lookupObject<volScalarField>(rhoName_);
for (label i = 0; i <= nCorr_; i++)
{
fvScalarMatrix sEqn
(
fvm::ddt(rho, s)
@ -262,7 +450,7 @@ bool Foam::functionObjects::scalarTransport::execute()
sEqn.solve(mesh_.solverDict(schemesField_));
}
}
else if (phi.dimensions() == dimVolume/dimTime)
else if (!compressible)
{
for (label i = 0; i <= nCorr_; i++)
{

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -33,8 +33,12 @@ Description
- To specify the field name set the 'field' entry
- To employ the same numerical schemes as another field set
the 'schemesField' entry,
- The diffusivity can be set manually using the 'D' entry, or retrieved
from the turbulence model (if applicable).
- The diffusivity can be set manually using the 'D' entry, retrieved
from the turbulence model or specified nut
- To specify a different flux derived from U enter UPhi velocity field name
(the phi used will be calculated based on this UPhi)
- To specify a transport quantity within a phase enter phase.
- bounded01 bounds the transported scalar within 0 and 1.
Usage
Example of function object specification to solve a scalar transport
@ -47,6 +51,11 @@ Usage
type scalarTransport;
libs ("libutilityFunctionObjects.so");
resetOnStartUp no;
region cabin;
field H2O;
fvOptions
{
...
@ -55,17 +64,67 @@ Usage
}
\endverbatim
Example of function object specification to solve a residency time
in a two phase flow:
equation:
\verbatim
functions
{
sTransport
{
type scalarTransport;
libs ("libsolverFunctionObjects.so");
enabled true;
writeControl outputTime;
writeInterval 1;
field s;
bounded01 false;
phase alpha.water;
write true;
fvOptions
{
unitySource
{
type scalarSemiImplicitSource;
enabled true;
scalarSemiImplicitSourceCoeffs
{
selectionMode all;
volumeMode specific;
injectionRateSuSp
{
s (1 0);
}
}
}
}
resetOnStartUp false;
}
}
\endverbatim
Where the entries comprise:
\table
Property | Description | Required | Default value
type | Type name: scalarTransport | yes |
phi | Name of flux field | no | phi
rho | Name of density field | no | rho
D | Diffision coefficient | no | auto generated
UPhi | Name of U to generate phi | no | none
phase | Name of the phase name | no | none
nut | Name of the turbulence viscocity | no | none
D | Diffusion coefficient | no | auto generated
nCorr | Number of correctors | no | 0
resetOnStartUp | Reset scalar to zero on start-up | no | no
schemesField | Name of field to specify schemes | no | fieldName
fvOptions | List of scalar sources | no |
bounded01 | Bounds scalar betwee 0-1 for multiphase | no |true
phasePhiCompressed |Compressed flux for VOF | no | alphaPhiUn
\endtable
See also
@ -106,9 +165,22 @@ class scalarTransport
//- Name of flux field (optional)
word phiName_;
//- Name of velocity field from which the flux is obtained if phiName is
// not given (optional)
word UPhiName_;
//- Name of density field (optional)
word rhoName_;
//- Name of turbulent viscosity field (optional)
word nutName_;
//- Name of phase field
word phaseName_;
//- Name of phase field compressed flux
word phasePhiCompressedName_;
//- Diffusion coefficient (optional)
scalar D_;
@ -127,6 +199,9 @@ class scalarTransport
//- Run-time selectable finite volume options, e.g. sources, constraints
fv::optionList fvOptions_;
//- Bound scalar between 0-1 using MULES for multiphase case
bool bounded01_;
// Private Member Functions
@ -137,7 +212,8 @@ class scalarTransport
tmp<volScalarField> D
(
const volScalarField& s,
const surfaceScalarField& phi
const surfaceScalarField& phi,
const volScalarField& alpha
) const;
//- Disallow default bitwise copy construct

View File

@ -53,7 +53,7 @@ Foam::functionObjects::runTimeControls::averageCondition::averageCondition
)
:
runTimeCondition(name, obr, dict, state),
functionObjectName_(dict.lookup("functionObjectName")),
functionObjectName_(dict.lookup("functionObject")),
fieldNames_(dict.lookup("fields")),
tolerance_(readScalar(dict.lookup("tolerance"))),
window_(dict.lookupOrDefault<scalar>("window", -1)),

View File

@ -67,9 +67,9 @@ Foam::functionObjects::thermoCoupleProbes::thermoCoupleProbes
}
// Check if the property exist (resume old calculation)
// or of it is new
// or of it is new.
dictionary probeDict;
if (getDict(name, probeDict))
if (getDict(typeName, probeDict))
{
probeDict.lookup("Tc") >> Ttc_;
}
@ -125,9 +125,9 @@ void Foam::functionObjects::thermoCoupleProbes::derivatives
muc = this->sample(thermo_.mu()());
Cpc = this->sample(thermo_.Cp()());
scalarField Re(rhoc*Uc*d_/(muc + ROOTVSMALL));
scalarField Pr(Cpc*muc/(kappac + ROOTVSMALL));
//scalarField Nu(2.0 + 0.6*sqrt(Re)*cbrt(Pr));
scalarField Re(rhoc*Uc*d_/muc);
scalarField Pr(Cpc*muc/kappac);
Pr = max(ROOTVSMALL, Pr);
scalarField Nu(2.0 + (0.4*sqrt(Re) + 0.06*pow(Re, 2/3))*pow(Pr, 0.4));
scalarField htc(Nu*kappac/d_);
@ -172,7 +172,7 @@ bool Foam::functionObjects::thermoCoupleProbes::write()
dictionary probeDict;
probeDict.add("Tc", Ttc_);
setProperty(name(), probeDict);
setProperty(typeName, probeDict);
return true;
}

View File

@ -102,7 +102,7 @@ Foam::fv::interRegionOption::interRegionOption
mesh
),
master_(coeffs_.lookupOrDefault<bool>("master", true)),
nbrRegionName_(coeffs_.lookup("nbrRegionName")),
nbrRegionName_(coeffs_.lookup("nbrRegion")),
meshInterpPtr_()
{
if (active())

View File

@ -106,7 +106,7 @@ Foam::fv::acousticDampingSource::acousticDampingSource
zeroGradientFvPatchField<vector>::typeName
)
),
URefName_("unknown-URefName"),
URefName_("unknown-URef"),
x0_(Zero),
r1_(0),
r2_(0),

View File

@ -304,9 +304,9 @@ bool Foam::fv::effectivenessHeatExchangerSource::read(const dictionary& dict)
{
if (cellSetOption::read(dict))
{
UName_ = coeffs_.lookupOrDefault<word>("UName", "U");
TName_ = coeffs_.lookupOrDefault<word>("TName", "T");
phiName_ = coeffs_.lookupOrDefault<word>("phiName", "phi");
UName_ = coeffs_.lookupOrDefault<word>("U", "U");
TName_ = coeffs_.lookupOrDefault<word>("T", "T");
phiName_ = coeffs_.lookupOrDefault<word>("phi", "phi");
coeffs_.lookup("faceZone") >> faceZoneName_;
coeffs_.lookup("secondaryMassFlowRate") >> secondaryMassFlowRate_;

View File

@ -207,10 +207,10 @@ Foam::fv::tabulatedNTUHeatTransfer::tabulatedNTUHeatTransfer
)
:
interRegionHeatTransferModel(name, modelType, dict, mesh),
UName_(coeffs_.lookupOrDefault<word>("UName", "U")),
UNbrName_(coeffs_.lookupOrDefault<word>("UNbrName", "U")),
rhoName_(coeffs_.lookupOrDefault<word>("rhoName", "rho")),
rhoNbrName_(coeffs_.lookupOrDefault<word>("rhoNbrName", "rho")),
UName_(coeffs_.lookupOrDefault<word>("U", "U")),
UNbrName_(coeffs_.lookupOrDefault<word>("UNbr", "U")),
rhoName_(coeffs_.lookupOrDefault<word>("rho", "rho")),
rhoNbrName_(coeffs_.lookupOrDefault<word>("rhoNbr", "rho")),
ntuTable_(),
geometryMode_(gmCalculated),
Ain_(-1),
@ -275,10 +275,10 @@ bool Foam::fv::tabulatedNTUHeatTransfer::read(const dictionary& dict)
{
if (option::read(dict))
{
coeffs_.readIfPresent("UName", UName_);
coeffs_.readIfPresent("UNbrName", UNbrName_);
coeffs_.readIfPresent("rhoName", rhoName_);
coeffs_.readIfPresent("rhoNbrName", rhoNbrName_);
coeffs_.readIfPresent("U", UName_);
coeffs_.readIfPresent("UNbr", UNbrName_);
coeffs_.readIfPresent("rho", rhoName_);
coeffs_.readIfPresent("rhoNbr", rhoNbrName_);
// Force geometry re-initialisation
Ain_ = -1;

View File

@ -68,13 +68,13 @@ Description
tabulatedNTUHeatTransferCoeffs
{
interpolationMethod cellVolumeWeight;
nbrRegionName air;
nbrRegion air;
master true;
fieldNames (h);
outOfBounds clamp;
fileName "ntuTable";
nbrModelName airToCooler;
nbrModel airToCooler;
semiImplicit no;

View File

@ -318,16 +318,19 @@ Foam::InjectionModel<CloudType>::InjectionModel
Info<< " injector ID: " << injectorID_ << endl;
}
if (owner.solution().transient())
if (owner.solution().active())
{
this->coeffDict().lookup("massTotal") >> massTotal_;
this->coeffDict().lookup("SOI") >> SOI_;
}
else
{
massFlowRate_.reset(this->coeffDict());
massTotal_ = massFlowRate_.value(owner.db().time().value());
this->coeffDict().readIfPresent("SOI", SOI_);
if (owner.solution().transient())
{
this->coeffDict().lookup("massTotal") >> massTotal_;
this->coeffDict().lookup("SOI") >> SOI_;
}
else
{
massFlowRate_.reset(this->coeffDict());
massTotal_ = massFlowRate_.value(owner.db().time().value());
this->coeffDict().readIfPresent("SOI", SOI_);
}
}
SOI_ = owner.db().time().userTimeToTime(SOI_);

View File

@ -40,7 +40,7 @@ Foam::PatchFlowRateInjection<CloudType>::PatchFlowRateInjection
)
:
InjectionModel<CloudType>(dict, owner, modelName,typeName),
patchInjectionBase(owner.mesh(), this->coeffDict().lookup("patchName")),
patchInjectionBase(owner.mesh(), this->coeffDict().lookup("patch")),
phiName_(this->coeffDict().template lookupOrDefault<word>("phi", "phi")),
rhoName_(this->coeffDict().template lookupOrDefault<word>("rho", "rho")),
duration_(readScalar(this->coeffDict().lookup("duration"))),

View File

@ -38,7 +38,7 @@ Foam::PatchInjection<CloudType>::PatchInjection
)
:
InjectionModel<CloudType>(dict, owner, modelName, typeName),
patchInjectionBase(owner.mesh(), this->coeffDict().lookup("patchName")),
patchInjectionBase(owner.mesh(), this->coeffDict().lookup("patch")),
duration_(readScalar(this->coeffDict().lookup("duration"))),
parcelsPerSecond_
(

View File

@ -37,26 +37,17 @@ Foam::InterfaceForce<CloudType>::InterfaceForce
)
:
ParticleForce<CloudType>(owner, mesh, dict, typeName, true),
alpaName_
(
this->coeffs().template lookup("alphaName")
),
C_
(
readScalar(this->coeffs().lookup("C"))
),
alphaName_(this->coeffs().lookup("alpha")),
C_(readScalar(this->coeffs().lookup("C"))),
gradInterForceInterpPtr_(nullptr)
{}
template<class CloudType>
Foam::InterfaceForce<CloudType>::InterfaceForce
(
const InterfaceForce& pf
)
Foam::InterfaceForce<CloudType>::InterfaceForce(const InterfaceForce& pf)
:
ParticleForce<CloudType>(pf),
alpaName_(pf.alpaName_),
alphaName_(pf.alphaName_),
C_(pf.C_),
gradInterForceInterpPtr_(pf.gradInterForceInterpPtr_)
{}
@ -84,7 +75,7 @@ void Foam::InterfaceForce<CloudType>::cacheFields(const bool store)
if (!fieldExists)
{
const volScalarField& alpha = this->mesh().template
lookupObject<volScalarField>(alpaName_);
lookupObject<volScalarField>(alphaName_);
volVectorField* gradInterForcePtr =
new volVectorField(fName, fvc::grad(alpha*(1-alpha)));

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