diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/alphaEqn.H b/applications/solvers/multiphase/twoPhaseEulerFoam/alphaEqn.H index 77a04592e3..8ce175b85c 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/alphaEqn.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/alphaEqn.H @@ -92,6 +92,13 @@ ) ); + // Ensure that the flux at inflow BCs is preserved + alphaPhic1.boundaryField() = min + ( + phi1.boundaryField()*alpha1.boundaryField(), + alphaPhic1.boundaryField() + ); + MULES::explicitSolve ( geometricOneField(), diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/pEqn.H b/applications/solvers/multiphase/twoPhaseEulerFoam/pEqn.H index e9211def7f..073fe092d0 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/pEqn.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/pEqn.H @@ -8,6 +8,10 @@ surfaceScalarField rAlphaAU1f(fvc::interpolate(alpha1*rAU1)); surfaceScalarField rAlphaAU2f(fvc::interpolate(alpha2*rAU2)); + // Update the phi BCs from U before p BCs are updated + phi1.boundaryField() == (mesh.Sf().boundaryField() & U1.boundaryField()); + phi2.boundaryField() == (mesh.Sf().boundaryField() & U2.boundaryField()); + volVectorField HbyA1 ( IOobject::groupName("HbyA", phase1.name()), diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index 5536aed6ff..2475f2a043 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -420,11 +420,24 @@ autoPtr createRefinementSurfaces const refinementSurfaces& rf = surfacePtr(); - Info<< setw(20) << "Region" + // Determine maximum region name length + label maxLen = 0; + forAll(rf.surfaces(), surfI) + { + label geomI = rf.surfaces()[surfI]; + const wordList& regionNames = allGeometry.regionNames()[geomI]; + forAll(regionNames, regionI) + { + maxLen = Foam::max(maxLen, label(regionNames[regionI].size())); + } + } + + + Info<< setw(maxLen) << "Region" << setw(10) << "Min Level" << setw(10) << "Max Level" << setw(10) << "Gap Level" << nl - << setw(20) << "------" + << setw(maxLen) << "------" << setw(10) << "---------" << setw(10) << "---------" << setw(10) << "---------" << endl; @@ -441,7 +454,7 @@ autoPtr createRefinementSurfaces { label globalI = rf.globalRegion(surfI, regionI); - Info<< setw(20) << regionNames[regionI] + Info<< setw(maxLen) << regionNames[regionI] << setw(10) << rf.minLevel()[globalI] << setw(10) << rf.maxLevel()[globalI] << setw(10) << rf.gapLevel()[globalI] << endl; diff --git a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C index 8a12740cb6..66065c4528 100644 --- a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C +++ b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C @@ -206,14 +206,26 @@ Foam::functionEntries::codeStream::getFunction off_t masterSize = mySize; Pstream::scatter(masterSize); + if (debug) + { + Pout<< endl<< "on processor " << Pstream::myProcNo() + << " have masterSize:" << masterSize + << " and localSize:" << mySize + << endl; + } + + if (mySize < masterSize) { - Pout<< "Local file " << libPath - << " not of same size (" << mySize - << ") as master (" - << masterSize << "). Waiting for " - << regIOobject::fileModificationSkew - << " seconds." << endl; + if (debug) + { + Pout<< "Local file " << libPath + << " not of same size (" << mySize + << ") as master (" + << masterSize << "). Waiting for " + << regIOobject::fileModificationSkew + << " seconds." << endl; + } Foam::sleep(regIOobject::fileModificationSkew); // Recheck local size @@ -237,6 +249,14 @@ Foam::functionEntries::codeStream::getFunction << exit(FatalIOError); } } + + if (debug) + { + Pout<< endl<< "on processor " << Pstream::myProcNo() + << " after waiting: have masterSize:" << masterSize + << " and localSize:" << mySize + << endl; + } } if (isA(topDict(parentDict))) @@ -244,6 +264,12 @@ Foam::functionEntries::codeStream::getFunction // Cached access to dl libs. Guarantees clean up upon destruction // of Time. dlLibraryTable& dlLibs = libs(parentDict); + + if (debug) + { + Pout<< "Opening cached dictionary:" << libPath << endl; + } + if (!dlLibs.open(libPath, false)) { FatalIOErrorIn @@ -261,10 +287,28 @@ Foam::functionEntries::codeStream::getFunction else { // Uncached opening of libPath + if (debug) + { + Pout<< "Opening uncached dictionary:" << libPath << endl; + } lib = dlOpen(libPath, true); } } + bool haveLib = lib; + reduce(haveLib, andOp()); + + if (!haveLib) + { + FatalIOErrorIn + ( + "functionEntries::codeStream::execute(..)", + parentDict + ) << "Failed loading library " << libPath + << " on some processors." + << exit(FatalIOError); + } + // Find the function handle in the library streamingFunctionType function = diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.C index 282377f4f3..401a3cfa76 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.C @@ -267,7 +267,13 @@ Foam::Tuple2 Foam::lduAddressing::band() const } label bandwidth = max(cellBandwidth); - scalar profile = sum(1.0*cellBandwidth); + + // Do not use field algebra because of conversion label to scalar + scalar profile = 0.0; + forAll(cellBandwidth, cellI) + { + profile += 1.0*cellBandwidth[cellI]; + } return Tuple2(bandwidth, profile); } diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C index caad93731c..2b6b17da92 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -90,6 +90,11 @@ Foam::labelPairList Foam::globalPoints::addSendTransform const labelPairList& info ) const { + scalar tol = refCast + ( + mesh_.boundaryMesh()[patchI] + ).matchTolerance(); + labelPairList sendInfo(info.size()); forAll(info, i) @@ -111,7 +116,8 @@ Foam::labelPairList Foam::globalPoints::addSendTransform ( globalIndexAndTransform::transformIndex(info[i]), patchI, - true // patchI is sending side + true, // patchI is sending side + tol // tolerance for comparison ) ); } diff --git a/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.H b/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.H index 408b1f2d32..7cb4bab495 100644 --- a/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.H +++ b/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -195,7 +195,8 @@ public: ( const label transformIndex, const label patchI, - const bool isSendingSide = true + const bool isSendingSide = true, + const scalar tol = SMALL ) const; //- Combine two transformIndices diff --git a/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransformI.H b/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransformI.H index bb72f8d43d..9227e6a990 100644 --- a/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransformI.H +++ b/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransformI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -190,7 +190,8 @@ Foam::label Foam::globalIndexAndTransform::addToTransformIndex ( const label transformIndex, const label patchI, - const bool isSendingSide + const bool isSendingSide, + const scalar tol ) const { const Pair