diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C index d02853591e..38f3a7c647 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C @@ -36,6 +36,7 @@ Description #include "fixedGradientFvPatchFields.H" #include "radiationModel.H" #include "simpleControl.H" +#include "IOMRFZoneList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -46,6 +47,7 @@ int main(int argc, char *argv[]) #include "createMesh.H" #include "readGravitationalAcceleration.H" #include "createFields.H" + #include "createZones.H" #include "createRadiationModel.H" #include "initContinuityErrs.H" diff --git a/applications/solvers/multiphase/bubbleFoam/DDtU.H b/applications/solvers/multiphase/bubbleFoam/DDtU.H deleted file mode 100644 index 96b6a63a43..0000000000 --- a/applications/solvers/multiphase/bubbleFoam/DDtU.H +++ /dev/null @@ -1,11 +0,0 @@ -{ - DDtU1 = - fvc::ddt(U1) - + fvc::div(phi1, U1) - - fvc::div(phi1)*U1; - - DDtU2 = - fvc::ddt(U2) - + fvc::div(phi2, U2) - - fvc::div(phi2)*U2; -} diff --git a/applications/solvers/multiphase/bubbleFoam/Make/files b/applications/solvers/multiphase/bubbleFoam/Make/files deleted file mode 100644 index 1bc79aa226..0000000000 --- a/applications/solvers/multiphase/bubbleFoam/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -bubbleFoam.C - -EXE = $(FOAM_APPBIN)/bubbleFoam diff --git a/applications/solvers/multiphase/bubbleFoam/Make/options b/applications/solvers/multiphase/bubbleFoam/Make/options deleted file mode 100644 index 39da2bd6db..0000000000 --- a/applications/solvers/multiphase/bubbleFoam/Make/options +++ /dev/null @@ -1,6 +0,0 @@ -EXE_INC = \ - -I$(LIB_SRC)/finiteVolume/lnInclude - -EXE_LIBS = \ - -lfiniteVolume \ - -lmeshTools diff --git a/applications/solvers/multiphase/bubbleFoam/UEqns.H b/applications/solvers/multiphase/bubbleFoam/UEqns.H deleted file mode 100644 index 703f6b6d8d..0000000000 --- a/applications/solvers/multiphase/bubbleFoam/UEqns.H +++ /dev/null @@ -1,74 +0,0 @@ -fvVectorMatrix U1Eqn(U1, U1.dimensions()*dimVol/dimTime); -fvVectorMatrix U2Eqn(U2, U2.dimensions()*dimVol/dimTime); - -{ - volTensorField Rc1(-nuEff1*(T(fvc::grad(U1)))); - Rc1 = Rc1 + (2.0/3.0)*sqr(Ct)*I*k - (2.0/3.0)*I*tr(Rc1); - - surfaceScalarField phiR1 - ( - - fvc::interpolate(nuEff1) - *mesh.magSf()*fvc::snGrad(alpha1) - /fvc::interpolate(alpha1 + scalar(0.001)) - ); - - U1Eqn = - ( - (scalar(1) + Cvm*rho2*alpha2/rho1)* - ( - fvm::ddt(U1) - + fvm::div(phi1, U1, "div(phi1,U1)") - - fvm::Sp(fvc::div(phi1), U1) - ) - - - fvm::laplacian(nuEff1, U1) - + fvc::div(Rc1) - - + fvm::div(phiR1, U1, "div(phi1,U1)") - - fvm::Sp(fvc::div(phiR1), U1) - + (fvc::grad(alpha1)/(fvc::average(alpha1) + scalar(0.001)) & Rc1) - == - // g // Buoyancy term transfered to p-equation - - fvm::Sp(alpha2/rho1*dragCoef, U1) - //+ alpha2/rho1*dragCoef*U2 // Explicit drag transfered to p-equation - - alpha2/rho1*(liftCoeff - Cvm*rho2*DDtU2) - ); - - U1Eqn.relax(); - - - volTensorField Rc2(-nuEff2*T(fvc::grad(U2))); - Rc2 = Rc2 + (2.0/3.0)*I*k - (2.0/3.0)*I*tr(Rc2); - - surfaceScalarField phiR2 - ( - - fvc::interpolate(nuEff2) - *mesh.magSf()*fvc::snGrad(alpha2) - /fvc::interpolate(alpha2 + scalar(0.001)) - ); - - U2Eqn = - ( - (scalar(1) + Cvm*rho2*alpha1/rho2)* - ( - fvm::ddt(U2) - + fvm::div(phi2, U2, "div(phi2,U2)") - - fvm::Sp(fvc::div(phi2), U2) - ) - - - fvm::laplacian(nuEff2, U2) - + fvc::div(Rc2) - - + fvm::div(phiR2, U2, "div(phi2,U2)") - - fvm::Sp(fvc::div(phiR2), U2) - - + (fvc::grad(alpha2)/(fvc::average(alpha2) + scalar(0.001)) & Rc2) - == - // g // Buoyancy term transfered to p-equation - - fvm::Sp(alpha1/rho2*dragCoef, U2) - //+ alpha1/rho2*dragCoef*U1 // Explicit drag transfered to p-equation - + alpha1/rho2*(liftCoeff + Cvm*rho2*DDtU1) - ); - - U2Eqn.relax(); -} diff --git a/applications/solvers/multiphase/bubbleFoam/alphaEqn.H b/applications/solvers/multiphase/bubbleFoam/alphaEqn.H deleted file mode 100644 index 0ecab03016..0000000000 --- a/applications/solvers/multiphase/bubbleFoam/alphaEqn.H +++ /dev/null @@ -1,61 +0,0 @@ -{ - word scheme("div(phi,alpha1)"); - - surfaceScalarField phir(phi1 - phi2); - - Info<< "Max Ur Courant Number = " - << ( - max - ( - mesh.surfaceInterpolation::deltaCoeffs()*mag(phir) - /mesh.magSf() - )*runTime.deltaT() - ).value() - << endl; - - for (int acorr=0; acorr phi1Ptr(NULL); - - if (phi1Header.headerOk()) - { - Info<< "Reading face flux field phi1\n" << endl; - - phi1Ptr.reset - ( - new surfaceScalarField - ( - IOobject - ( - "phi1", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ) - ); - } - else - { - Info<< "Calculating face flux field phi1\n" << endl; - - wordList phiTypes - ( - U1.boundaryField().size(), - calculatedFvPatchScalarField::typeName - ); - - forAll(U1.boundaryField(), i) - { - if (isA(U1.boundaryField()[i])) - { - phiTypes[i] = fixedValueFvPatchScalarField::typeName; - } - } - - phi1Ptr.reset - ( - new surfaceScalarField - ( - IOobject - ( - "phi1", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - fvc::interpolate(U1) & mesh.Sf(), - phiTypes - ) - ); - } - - surfaceScalarField& phi1 = phi1Ptr(); diff --git a/applications/solvers/multiphase/bubbleFoam/createPhi2.H b/applications/solvers/multiphase/bubbleFoam/createPhi2.H deleted file mode 100644 index ebba6a3f6c..0000000000 --- a/applications/solvers/multiphase/bubbleFoam/createPhi2.H +++ /dev/null @@ -1,67 +0,0 @@ - IOobject phi2Header - ( - "phi2", - runTime.timeName(), - mesh, - IOobject::NO_READ - ); - - autoPtr phi2Ptr(NULL); - - if (phi2Header.headerOk()) - { - Info<< "Reading face flux field phi2\n" << endl; - - phi2Ptr.reset - ( - new surfaceScalarField - ( - IOobject - ( - "phi2", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ) - ); - } - else - { - Info<< "Calculating face flux field phi2\n" << endl; - - wordList phiTypes - ( - U2.boundaryField().size(), - calculatedFvPatchScalarField::typeName - ); - - forAll(U2.boundaryField(), i) - { - if (isA(U2.boundaryField()[i])) - { - phiTypes[i] = fixedValueFvPatchScalarField::typeName; - } - } - - phi2Ptr.reset - ( - new surfaceScalarField - ( - IOobject - ( - "phi2", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - fvc::interpolate(U2) & mesh.Sf(), - phiTypes - ) - ); - } - - surfaceScalarField& phi2 = phi2Ptr(); diff --git a/applications/solvers/multiphase/bubbleFoam/liftDragCoeffs.H b/applications/solvers/multiphase/bubbleFoam/liftDragCoeffs.H deleted file mode 100644 index d2ebb75a2f..0000000000 --- a/applications/solvers/multiphase/bubbleFoam/liftDragCoeffs.H +++ /dev/null @@ -1,23 +0,0 @@ - volVectorField Ur(U1 - U2); - volScalarField magUr(mag(Ur)); - - volScalarField Cd1MagUr - ( - (24.0*nu2/d1)*(scalar(1) + 0.15*pow(d1*magUr/nu2, 0.687)) - ); - - volScalarField Cd2MagUr - ( - (24.0*nu1/d2)*(scalar(1) + 0.15*pow(d2*magUr/nu1, 0.687)) - ); - - volScalarField dragCoef - ( - "Cd", - 0.75*(alpha2*rho2*Cd1MagUr/d1 + alpha1*rho1*Cd2MagUr/d2) - ); - - volVectorField liftCoeff - ( - Cl*(alpha2*rho2 + alpha1*rho1)*(Ur ^ fvc::curl(U)) - ); diff --git a/applications/solvers/multiphase/bubbleFoam/pEqn.H b/applications/solvers/multiphase/bubbleFoam/pEqn.H deleted file mode 100644 index d438b1124f..0000000000 --- a/applications/solvers/multiphase/bubbleFoam/pEqn.H +++ /dev/null @@ -1,94 +0,0 @@ -{ - surfaceScalarField alpha1f(fvc::interpolate(alpha1)); - surfaceScalarField alpha2f(scalar(1) - alpha1f); - - volScalarField rAU1(1.0/U1Eqn.A()); - volScalarField rAU2(1.0/U2Eqn.A()); - - surfaceScalarField rAU1f(fvc::interpolate(rAU1)); - surfaceScalarField rAU2f(fvc::interpolate(rAU2)); - - volVectorField HbyA1("HbyA1", U1); - HbyA1 = rAU1*U1Eqn.H(); - - volVectorField HbyA2("HbyA2", U2); - HbyA2 = rAU2*U2Eqn.H(); - - surfaceScalarField phiDrag1 - ( - fvc::interpolate(alpha2/rho1*dragCoef*rAU1)*phi2 - + rAU1f*(g & mesh.Sf()) - ); - surfaceScalarField phiDrag2 - ( - fvc::interpolate(alpha1/rho2*dragCoef*rAU2)*phi1 - + rAU2f*(g & mesh.Sf()) - ); - - forAll(p.boundaryField(), patchi) - { - if (isA(p.boundaryField()[patchi])) - { - phiDrag1.boundaryField()[patchi] = 0.0; - phiDrag2.boundaryField()[patchi] = 0.0; - } - } - - surfaceScalarField phiHbyA1 - ( - (fvc::interpolate(HbyA1) & mesh.Sf()) - + fvc::ddtPhiCorr(rAU1, U1, phi1) - ); - - surfaceScalarField phiHbyA2 - ( - (fvc::interpolate(HbyA2) & mesh.Sf()) - + fvc::ddtPhiCorr(rAU2, U2, phi2) - ); - - phi = alpha1f*phiHbyA1 + alpha2f*phiHbyA2; - - phiHbyA1 += phiDrag1; - phiHbyA2 += phiDrag2; - surfaceScalarField phiHbyA("phiHbyA", alpha1f*phiHbyA1 + alpha2f*phiHbyA2); - - surfaceScalarField Dp - ( - "Dp", - alpha1f*rAU1f/rho1 + alpha2f*rAU2f/rho2 - ); - - while (pimple.correctNonOrthogonal()) - { - fvScalarMatrix pEqn - ( - fvm::laplacian(Dp, p) == fvc::div(phiHbyA) - ); - - pEqn.setReference(pRefCell, pRefValue); - - pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - - if (pimple.finalNonOrthogonalIter()) - { - surfaceScalarField SfGradp(pEqn.flux()/Dp); - - phi1 = phiHbyA1 - rAU1f*SfGradp/rho1; - phi2 = phiHbyA2 - rAU2f*SfGradp/rho2; - phi = alpha1f*phi1 + alpha2f*phi2; - - p.relax(); - SfGradp = pEqn.flux()/Dp; - - U1 = HbyA1 + (fvc::reconstruct(phiDrag1 - rAU1f*SfGradp/rho1)); - U1.correctBoundaryConditions(); - - U2 = HbyA2 + (fvc::reconstruct(phiDrag2 - rAU2f*SfGradp/rho2)); - U2.correctBoundaryConditions(); - - U = alpha1*U1 + alpha2*U2; - } - } -} - -#include "continuityErrs.H" diff --git a/applications/solvers/multiphase/bubbleFoam/readBubbleFoamControls.H b/applications/solvers/multiphase/bubbleFoam/readBubbleFoamControls.H deleted file mode 100644 index 248f608f5c..0000000000 --- a/applications/solvers/multiphase/bubbleFoam/readBubbleFoamControls.H +++ /dev/null @@ -1,4 +0,0 @@ - - int nAlphaCorr(readInt(pimple.dict().lookup("nAlphaCorr"))); - - Switch correctAlpha(pimple.dict().lookup("correctAlpha")); diff --git a/applications/solvers/multiphase/bubbleFoam/write.H b/applications/solvers/multiphase/bubbleFoam/write.H deleted file mode 100644 index 303661beb6..0000000000 --- a/applications/solvers/multiphase/bubbleFoam/write.H +++ /dev/null @@ -1,17 +0,0 @@ - if (runTime.outputTime()) - { - volVectorField Ur - ( - IOobject - ( - "Ur", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - U1 - U2 - ); - - runTime.write(); - } diff --git a/applications/solvers/multiphase/settlingFoam/createFields.H b/applications/solvers/multiphase/settlingFoam/createFields.H index 8d161edd82..9a9fdee2df 100644 --- a/applications/solvers/multiphase/settlingFoam/createFields.H +++ b/applications/solvers/multiphase/settlingFoam/createFields.H @@ -12,12 +12,12 @@ mesh ); - Info<< "Reading field alpha\n" << endl; - volScalarField alpha + Info<< "Reading field Alpha\n" << endl; + volScalarField Alpha ( IOobject ( - "alpha", + "Alpha", runTime.timeName(), mesh, IOobject::MUST_READ, @@ -100,21 +100,20 @@ IOobject::NO_READ, IOobject::NO_WRITE ), - (scalar(1) - alpha)*rhoc + alpha*rhod + rhoc/(scalar(1) + (rhoc/rhod - 1.0)*Alpha) ); - volScalarField Alpha + volScalarField alpha ( IOobject ( - "Alpha", + "alpha", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), - alpha*rhod/rho, - alpha.boundaryField().types() + rho*Alpha/rhod ); #include "compressibleCreatePhi.H" diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/Make/options b/applications/solvers/multiphase/twoPhaseEulerFoam/Make/options index 1bf97d106c..f4a6229714 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/Make/options +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/Make/options @@ -1,5 +1,4 @@ EXE_INC = \ - -I../bubbleFoam \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ -IturbulenceModel \ diff --git a/applications/solvers/multiphase/bubbleFoam/createRASTurbulence.H b/applications/solvers/multiphase/twoPhaseEulerFoam/createRASTurbulence.H similarity index 100% rename from applications/solvers/multiphase/bubbleFoam/createRASTurbulence.H rename to applications/solvers/multiphase/twoPhaseEulerFoam/createRASTurbulence.H diff --git a/applications/solvers/multiphase/bubbleFoam/kEpsilon.H b/applications/solvers/multiphase/twoPhaseEulerFoam/kEpsilon.H similarity index 100% rename from applications/solvers/multiphase/bubbleFoam/kEpsilon.H rename to applications/solvers/multiphase/twoPhaseEulerFoam/kEpsilon.H diff --git a/applications/solvers/multiphase/bubbleFoam/wallDissipation.H b/applications/solvers/multiphase/twoPhaseEulerFoam/wallDissipation.H similarity index 95% rename from applications/solvers/multiphase/bubbleFoam/wallDissipation.H rename to applications/solvers/multiphase/twoPhaseEulerFoam/wallDissipation.H index 14224fd646..207fb40a32 100644 --- a/applications/solvers/multiphase/bubbleFoam/wallDissipation.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/wallDissipation.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/multiphase/bubbleFoam/wallFunctions.H b/applications/solvers/multiphase/twoPhaseEulerFoam/wallFunctions.H similarity index 100% rename from applications/solvers/multiphase/bubbleFoam/wallFunctions.H rename to applications/solvers/multiphase/twoPhaseEulerFoam/wallFunctions.H diff --git a/applications/solvers/multiphase/bubbleFoam/wallViscosity.H b/applications/solvers/multiphase/twoPhaseEulerFoam/wallViscosity.H similarity index 100% rename from applications/solvers/multiphase/bubbleFoam/wallViscosity.H rename to applications/solvers/multiphase/twoPhaseEulerFoam/wallViscosity.H diff --git a/applications/utilities/mesh/advanced/combinePatchFaces/Make/options b/applications/utilities/mesh/advanced/combinePatchFaces/Make/options index 7d4e1304f0..4f26f666de 100644 --- a/applications/utilities/mesh/advanced/combinePatchFaces/Make/options +++ b/applications/utilities/mesh/advanced/combinePatchFaces/Make/options @@ -5,4 +5,5 @@ EXE_INC = \ EXE_LIBS = \ -lmeshTools \ + -lsampling \ -ldynamicMesh diff --git a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C index 877579fa5f..8c8be624f0 100644 --- a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C +++ b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -53,105 +53,19 @@ Description #include "polyMesh.H" #include "mapPolyMesh.H" #include "unitConversion.H" +#include "motionSmoother.H" using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// Same check as snapMesh -void checkSnapMesh -( - const Time& runTime, - const polyMesh& mesh, - labelHashSet& wrongFaces -) -{ - IOdictionary snapDict - ( - IOobject - ( - "snapMeshDict", - runTime.system(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ); - - // Max nonorthogonality allowed - scalar maxNonOrtho(readScalar(snapDict.lookup("maxNonOrtho"))); - // Max concaveness allowed. - scalar maxConcave(readScalar(snapDict.lookup("maxConcave"))); - // Min volume allowed (factor of minimum cellVolume) - scalar relMinVol(readScalar(snapDict.lookup("minVol"))); - const scalar minCellVol = min(mesh.cellVolumes()); - const scalar minPyrVol = relMinVol*minCellVol; - // Min area - scalar minArea(readScalar(snapDict.lookup("minArea"))); - - if (maxNonOrtho < 180.0-SMALL) - { - Pout<< "Checking non orthogonality" << endl; - - label nOldSize = wrongFaces.size(); - mesh.setNonOrthThreshold(maxNonOrtho); - mesh.checkFaceOrthogonality(false, &wrongFaces); - - Pout<< "Detected " << wrongFaces.size() - nOldSize - << " faces with non-orthogonality > " << maxNonOrtho << " degrees" - << endl; - } - - if (minPyrVol > -GREAT) - { - Pout<< "Checking face pyramids" << endl; - - label nOldSize = wrongFaces.size(); - mesh.checkFacePyramids(false, minPyrVol, &wrongFaces); - Pout<< "Detected additional " << wrongFaces.size() - nOldSize - << " faces with illegal face pyramids" << endl; - } - - if (maxConcave < 180.0-SMALL) - { - Pout<< "Checking face angles" << endl; - - label nOldSize = wrongFaces.size(); - mesh.checkFaceAngles(false, maxConcave, &wrongFaces); - Pout<< "Detected additional " << wrongFaces.size() - nOldSize - << " faces with concavity > " << maxConcave << " degrees" - << endl; - } - - if (minArea > -SMALL) - { - Pout<< "Checking face areas" << endl; - - label nOldSize = wrongFaces.size(); - - const scalarField magFaceAreas(mag(mesh.faceAreas())); - - forAll(magFaceAreas, faceI) - { - if (magFaceAreas[faceI] < minArea) - { - wrongFaces.insert(faceI); - } - } - Pout<< "Detected additional " << wrongFaces.size() - nOldSize - << " faces with area < " << minArea << " m^2" << endl; - } -} - - // Merge faces on the same patch (usually from exposing refinement) // Can undo merges if these cause problems. label mergePatchFaces ( const scalar minCos, const scalar concaveSin, - const bool snapMeshDict, + const autoPtr& qualDictPtr, const Time& runTime, polyMesh& mesh ) @@ -212,9 +126,9 @@ label mergePatchFaces // Faces in error. labelHashSet errorFaces; - if (snapMeshDict) + if (qualDictPtr.valid()) { - checkSnapMesh(runTime, mesh, errorFaces); + motionSmoother::checkMesh(false, mesh, qualDictPtr(), errorFaces); } else { @@ -437,8 +351,8 @@ int main(int argc, char *argv[]) ); argList::addBoolOption ( - "snapMesh", - "use system/snapMeshDict" + "meshQuality", + "read user-defined mesh quality criterions from system/meshQualityDict" ); # include "setRootCase.H" @@ -455,8 +369,8 @@ int main(int argc, char *argv[]) scalar concaveAngle = args.optionLookupOrDefault("concaveAngle", 30.0); scalar concaveSin = Foam::sin(degToRad(concaveAngle)); - const bool snapMeshDict = args.optionFound("snapMesh"); const bool overwrite = args.optionFound("overwrite"); + const bool meshQuality = args.optionFound("meshQuality"); Info<< "Merging all faces of a cell" << nl << " - which are on the same patch" << nl @@ -468,23 +382,47 @@ int main(int argc, char *argv[]) << " (sin:" << concaveSin << ')' << nl << endl; + autoPtr qualDict; + if (meshQuality) + { + Info<< "Enabling user-defined geometry checks." << nl << endl; + + qualDict.reset + ( + new IOdictionary + ( + IOobject + ( + "meshQualityDict", + mesh.time().system(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ) + ); + } + + if (!overwrite) { runTime++; } + + // Merge faces on same patch label nChanged = mergePatchFaces ( minCos, concaveSin, - snapMeshDict, + qualDict, runTime, mesh ); // Merge points on straight edges and remove unused points - if (snapMeshDict) + if (qualDict.valid()) { Info<< "Merging all 'loose' points on surface edges, " << "regardless of the angle they make." << endl; diff --git a/applications/utilities/mesh/generation/cvMesh/Make/options b/applications/utilities/mesh/generation/cvMesh/Make/options index 2255a9a271..2228fc2b12 100644 --- a/applications/utilities/mesh/generation/cvMesh/Make/options +++ b/applications/utilities/mesh/generation/cvMesh/Make/options @@ -17,6 +17,7 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude @@ -29,5 +30,6 @@ EXE_LIBS = \ -ldecompositionMethods \ -L$(FOAM_LIBBIN)/dummy -lptscotchDecomp \ -ledgeMesh \ + -lsampling \ -ltriSurface \ -ldynamicMesh diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/Make/options b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/Make/options index 97e045f305..62649cf232 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/Make/options +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/Make/options @@ -17,6 +17,7 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \ -I../vectorTools diff --git a/applications/utilities/mesh/generation/cvMesh/cvMesh.C b/applications/utilities/mesh/generation/cvMesh/cvMesh.C index ecd7f102ba..f15ebea29a 100644 --- a/applications/utilities/mesh/generation/cvMesh/cvMesh.C +++ b/applications/utilities/mesh/generation/cvMesh/cvMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,6 +36,7 @@ Description #include "argList.H" #include "conformalVoronoiMesh.H" +#include "vtkSetWriter.H" using namespace Foam; @@ -48,6 +49,11 @@ int main(int argc, char *argv[]) "noFilter", "Do not filter the mesh" ); + Foam::argList::addBoolOption + ( + "checkGeometry", + "check all surface geometry for quality" + ); #include "setRootCase.H" #include "createTime.H" @@ -55,6 +61,7 @@ int main(int argc, char *argv[]) runTime.functionObjects().off(); const bool noFilter = !args.optionFound("noFilter"); + const bool checkGeometry = args.optionFound("checkGeometry"); Info<< "Mesh filtering is " << (noFilter ? "on" : "off") << endl; @@ -74,6 +81,29 @@ int main(int argc, char *argv[]) conformalVoronoiMesh mesh(runTime, cvMeshDict); + + if (checkGeometry) + { + const searchableSurfaces& allGeometry = mesh.allGeometry(); + + // Write some stats + allGeometry.writeStats(List(0), Info); + // Check topology + allGeometry.checkTopology(true); + // Check geometry + allGeometry.checkGeometry + ( + 100.0, // max size ratio + 1e-9, // intersection tolerance + autoPtr >(new vtkSetWriter()), + 0.01, // min triangle quality + true + ); + + return 0; + } + + while (runTime.loop()) { Info<< nl << "Time = " << runTime.timeName() << endl; diff --git a/applications/utilities/mesh/generation/cvMesh/cvMeshSurfaceSimplify/Make/options b/applications/utilities/mesh/generation/cvMesh/cvMeshSurfaceSimplify/Make/options index c7c073ab17..35c90b1f48 100644 --- a/applications/utilities/mesh/generation/cvMesh/cvMeshSurfaceSimplify/Make/options +++ b/applications/utilities/mesh/generation/cvMesh/cvMeshSurfaceSimplify/Make/options @@ -9,6 +9,7 @@ EXE_INC = \ -I$(FASTDUALOCTREE_SRC_PATH) \ -I../conformalVoronoiMesh/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude @@ -21,6 +22,7 @@ EXE_LIBS = \ -lconformalVoronoiMesh \ -ldecompositionMethods -L$(FOAM_LIBBIN)/dummy -lscotchDecomp \ -ledgeMesh \ + -lsampling \ -ltriSurface \ -lmeshTools \ -ldynamicMesh diff --git a/applications/utilities/mesh/generation/snappyHexMesh/Make/options b/applications/utilities/mesh/generation/snappyHexMesh/Make/options index b7fd6d3bd2..94ff17ee99 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/Make/options +++ b/applications/utilities/mesh/generation/snappyHexMesh/Make/options @@ -3,6 +3,7 @@ EXE_INC = \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \ -I$(LIB_SRC)/mesh/autoMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \ @@ -13,5 +14,6 @@ EXE_LIBS = \ -ldecompositionMethods \ -L$(FOAM_LIBBIN)/dummy -lptscotchDecomp \ -lmeshTools \ + -lsampling \ -ldynamicMesh \ -lautoMesh diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index 2372b144ec..6b63430918 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -46,7 +46,7 @@ Description #include "refinementParameters.H" #include "snapParameters.H" #include "layerParameters.H" - +#include "vtkSetWriter.H" using namespace Foam; @@ -122,6 +122,12 @@ void writeMesh int main(int argc, char *argv[]) { # include "addOverwriteOption.H" + Foam::argList::addBoolOption + ( + "checkGeometry", + "check all surface geometry for quality" + ); + # include "setRootCase.H" # include "createTime.H" runTime.functionObjects().off(); @@ -131,6 +137,7 @@ int main(int argc, char *argv[]) << runTime.cpuTimeIncrement() << " s" << endl; const bool overwrite = args.optionFound("overwrite"); + const bool checkGeometry = args.optionFound("checkGeometry"); // Check patches and faceZones are synchronised mesh.boundaryMesh().checkParallelSync(true); @@ -244,6 +251,56 @@ int main(int argc, char *argv[]) << mesh.time().cpuTimeIncrement() << " s" << nl << endl; + // Checking only? + + if (checkGeometry) + { + // Extract patchInfo + List patchTypes(allGeometry.size()); + + const PtrList& patchInfo = surfaces.patchInfo(); + const labelList& surfaceGeometry = surfaces.surfaces(); + forAll(surfaceGeometry, surfI) + { + label geomI = surfaceGeometry[surfI]; + const wordList& regNames = allGeometry.regionNames()[geomI]; + + patchTypes[geomI].setSize(regNames.size()); + forAll(regNames, regionI) + { + label globalRegionI = surfaces.globalRegion(surfI, regionI); + + if (patchInfo.set(globalRegionI)) + { + patchTypes[geomI][regionI] = + word(patchInfo[globalRegionI].lookup("type")); + } + else + { + patchTypes[geomI][regionI] = wallPolyPatch::typeName; + } + } + } + + // Write some stats + allGeometry.writeStats(patchTypes, Info); + // Check topology + allGeometry.checkTopology(true); + // Check geometry + allGeometry.checkGeometry + ( + 100.0, // max size ratio + 1e-9, // intersection tolerance + autoPtr >(new vtkSetWriter()), + 0.01, // min triangle quality + true + ); + + return 0; + } + + + // Read refinement shells // ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/applications/utilities/mesh/manipulation/setsToZones/Make/options b/applications/utilities/mesh/manipulation/setsToZones/Make/options index 54c035b8f5..ec38e1cbdb 100644 --- a/applications/utilities/mesh/manipulation/setsToZones/Make/options +++ b/applications/utilities/mesh/manipulation/setsToZones/Make/options @@ -2,4 +2,5 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude EXE_LIBS = \ - -lmeshTools + -lmeshTools \ + -lsampling diff --git a/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C b/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C index 2f56bb5693..c3d3d6297a 100644 --- a/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C +++ b/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -48,6 +48,7 @@ Description #include "IFstream.H" #include "IOobjectList.H" #include "SortableList.H" +#include "timeSelector.H" using namespace Foam; @@ -57,6 +58,7 @@ using namespace Foam; int main(int argc, char *argv[]) { + timeSelector::addOptions(true, false); argList::addNote ( "add point/face/cell Zones from similar named point/face/cell Sets" @@ -76,15 +78,7 @@ int main(int argc, char *argv[]) const bool noFlipMap = args.optionFound("noFlipMap"); // Get times list - instantList Times = runTime.times(); - - label startTime = Times.size()-1; - label endTime = Times.size(); - - // check -time and -latestTime options - #include "checkTimeOption.H" - - runTime.setTime(Times[startTime], startTime); + (void)timeSelector::selectIfPresent(runTime, args); #include "createNamedPolyMesh.H" diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H index 397dc7ecc2..363f09d7f3 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H @@ -446,13 +446,6 @@ class vtkPV3Foam template vtkPolyData* patchVTKMesh(const word& name, const PatchType&); - //- Add face zone mesh - vtkPolyData* faceZoneVTKMesh - ( - const fvMesh&, - const labelList& faceLabels - ); - //- Add point zone vtkPolyData* pointZoneVTKMesh ( diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C index b229da9479..b80acb4949 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C @@ -450,7 +450,8 @@ void Foam::vtkPV3Foam::convertMeshFaceZones << zoneName << endl; } - vtkPolyData* vtkmesh = faceZoneVTKMesh(mesh, zMesh[zoneId]); + vtkPolyData* vtkmesh = patchVTKMesh(zoneName, zMesh[zoneId]()); + if (vtkmesh) { AddToBlock(output, vtkmesh, range, datasetNo, zoneName); diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C index 28a1fd4c5f..bfa3e1acc9 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,78 +35,6 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -vtkPolyData* Foam::vtkPV3Foam::faceZoneVTKMesh -( - const fvMesh& mesh, - const labelList& faceLabels -) -{ - vtkPolyData* vtkmesh = vtkPolyData::New(); - - if (debug) - { - Info<< " Foam::vtkPV3Foam::faceZoneVTKMesh" << endl; - printMemory(); - } - - // Construct primitivePatch of faces in faceZone - - const faceList& meshFaces = mesh.faces(); - faceList patchFaces(faceLabels.size()); - forAll(faceLabels, faceI) - { - patchFaces[faceI] = meshFaces[faceLabels[faceI]]; - } - primitiveFacePatch p(patchFaces, mesh.points()); - - - // The balance of this routine should be identical to patchVTKMesh - - // Convert OpenFOAM mesh vertices to VTK - const pointField& points = p.localPoints(); - - vtkPoints* vtkpoints = vtkPoints::New(); - vtkpoints->Allocate(points.size()); - forAll(points, i) - { - vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]); - } - - vtkmesh->SetPoints(vtkpoints); - vtkpoints->Delete(); - - - // Add faces as polygons - const faceList& faces = p.localFaces(); - - vtkCellArray* vtkcells = vtkCellArray::New(); - vtkcells->Allocate(faces.size()); - - forAll(faces, faceI) - { - const face& f = faces[faceI]; - vtkIdType nodeIds[f.size()]; - - forAll(f, fp) - { - nodeIds[fp] = f[fp]; - } - vtkcells->InsertNextCell(f.size(), nodeIds); - } - - vtkmesh->SetPolys(vtkcells); - vtkcells->Delete(); - - if (debug) - { - Info<< " Foam::vtkPV3Foam::faceZoneVTKMesh" << endl; - printMemory(); - } - - return vtkmesh; -} - - vtkPolyData* Foam::vtkPV3Foam::pointZoneVTKMesh ( const fvMesh& mesh, diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H index 78582fe7e3..e74937cd2f 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -129,6 +129,42 @@ void Foam::vtkPV3Foam::convertPointFields datasetNo ); } + + // + // Convert faceZones - if activated + // + for + ( + int partId = arrayRangeFaceZones_.start(); + partId < arrayRangeFaceZones_.end(); + ++partId + ) + { + const word zoneName = getPartName(partId); + const label datasetNo = partDataset_[partId]; + const label zoneId = mesh.faceZones().findZoneID(zoneName); + + if (!partStatus_[partId] || datasetNo < 0 || zoneId < 0) + { + continue; + } + + // Extract the field on the zone + Field fld + ( + ptf.internalField(), + mesh.faceZones()[zoneId]().meshPoints() + ); + + convertPatchPointField + ( + fieldName, + fld, + output, + arrayRangeFaceZones_, + datasetNo + ); + } } } diff --git a/bin/tools/CleanFunctions b/bin/tools/CleanFunctions index 758627a29a..8a6301a545 100644 --- a/bin/tools/CleanFunctions +++ b/bin/tools/CleanFunctions @@ -101,7 +101,7 @@ cleanCase() rm -rf constant/tetDualMesh > /dev/null 2>&1 rm -rf VTK > /dev/null 2>&1 - rm -f 0/cellLevel 0/pointLevel + rm -f 0/cellLevel 0/pointLevel 0/cellDist constant/cellDecomposition if [ -e constant/polyMesh/blockMeshDict.m4 ] then diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 2fb7c7dfe2..d1061458e8 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -526,7 +526,7 @@ $(Fields)/symmTensorField/symmTensorField.C $(Fields)/tensorField/tensorField.C $(Fields)/complexFields/complexFields.C -$(Fields)/labelField/labelIOField. +$(Fields)/labelField/labelIOField.C $(Fields)/labelField/labelFieldIOField.C $(Fields)/scalarField/scalarIOField.C $(Fields)/scalarField/scalarFieldIOField.C diff --git a/src/OpenFOAM/algorithms/subCycle/subCycle.H b/src/OpenFOAM/algorithms/subCycle/subCycle.H index a4a1ea1844..f0c8958dd0 100644 --- a/src/OpenFOAM/algorithms/subCycle/subCycle.H +++ b/src/OpenFOAM/algorithms/subCycle/subCycle.H @@ -51,8 +51,13 @@ class subCycleField //- Reference to the field being sub-cycled GeometricField& gf_; + //- Reference to the field old-time field being sub-cycled + // Needed to avoid calls to oldTime() which may cause + // unexpected updates of the old-time field + GeometricField& gf0_; + //- Copy of the "real" old-time value of the field - GeometricField gf0_; + GeometricField gf_0_; public: @@ -63,19 +68,33 @@ public: subCycleField(GeometricField& gf) : gf_(gf), - gf0_(gf.oldTime()) + gf0_(gf.oldTime()), + gf_0_(gf0_.name() + "_", gf0_) {} //- Destructor ~subCycleField() { + // Reset the old-time field + gf0_ = gf_0_; + // Correct the time index of the field to correspond to the global time gf_.timeIndex() = gf_.time().timeIndex(); + gf0_.timeIndex() = gf_.time().timeIndex(); + } - // Reset the old-time field value - gf_.oldTime() = gf0_; - gf_.oldTime().timeIndex() = gf0_.timeIndex(); + + //- Correct the time index of the field to correspond to + // the sub-cycling time. + // + // The time index is incremented to protect the old-time value from + // being updated at the beginning of the time-loop in the case of + // outer iteration + void updateTimeIndex() + { + gf_.timeIndex() = gf_.time().timeIndex() + 1; + gf0_.timeIndex() = gf_.time().timeIndex() + 1; } }; @@ -106,16 +125,18 @@ public: //- Construct field and number of sub-cycles subCycle(GeometricField& gf, const label nSubCycles) : - subCycleField(gf), subCycleTime(const_cast(gf.time()), nSubCycles) - {} + { + // Update the field time index to correspond to the sub-cycle time + this->updateTimeIndex(); + } //- Destructor + // End the subCycleTime, which restores the time state ~subCycle() { - // End the subCycleTime, which restores the time state endSubCycle(); } }; diff --git a/src/OpenFOAM/dimensionSet/dimensionSet.C b/src/OpenFOAM/dimensionSet/dimensionSet.C index c0da41236e..64396290eb 100644 --- a/src/OpenFOAM/dimensionSet/dimensionSet.C +++ b/src/OpenFOAM/dimensionSet/dimensionSet.C @@ -372,6 +372,12 @@ Foam::dimensionSet Foam::sqrt(const dimensionSet& ds) } +Foam::dimensionSet Foam::cbrt(const dimensionSet& ds) +{ + return pow(ds, 1.0/3.0); +} + + Foam::dimensionSet Foam::magSqr(const dimensionSet& ds) { return pow(ds, 2); diff --git a/src/OpenFOAM/dimensionSet/dimensionSet.H b/src/OpenFOAM/dimensionSet/dimensionSet.H index ca4c3ed2d1..6dc1219562 100644 --- a/src/OpenFOAM/dimensionSet/dimensionSet.H +++ b/src/OpenFOAM/dimensionSet/dimensionSet.H @@ -76,6 +76,7 @@ dimensionSet pow6(const dimensionSet&); dimensionSet pow025(const dimensionSet&); dimensionSet sqrt(const dimensionSet&); +dimensionSet cbrt(const dimensionSet&); dimensionSet magSqr(const dimensionSet&); dimensionSet mag(const dimensionSet&); dimensionSet sign(const dimensionSet&); diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedScalarField/DimensionedScalarField.C b/src/OpenFOAM/fields/DimensionedFields/DimensionedScalarField/DimensionedScalarField.C index 14e1030b4b..a4296ff91b 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedScalarField/DimensionedScalarField.C +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedScalarField/DimensionedScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -377,6 +377,7 @@ UNARY_FUNCTION(scalar, scalar, pow5, pow5) UNARY_FUNCTION(scalar, scalar, pow6, pow6) UNARY_FUNCTION(scalar, scalar, pow025, pow025) UNARY_FUNCTION(scalar, scalar, sqrt, sqrt) +UNARY_FUNCTION(scalar, scalar, cbrt, cbrt) UNARY_FUNCTION(scalar, scalar, sign, sign) UNARY_FUNCTION(scalar, scalar, pos, pos) UNARY_FUNCTION(scalar, scalar, neg, neg) diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedScalarField/DimensionedScalarField.H b/src/OpenFOAM/fields/DimensionedFields/DimensionedScalarField/DimensionedScalarField.H index 5c4a2b217a..b6e76631e0 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedScalarField/DimensionedScalarField.H +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedScalarField/DimensionedScalarField.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -85,6 +85,7 @@ UNARY_FUNCTION(scalar, scalar, pow5, pow5) UNARY_FUNCTION(scalar, scalar, pow6, pow6) UNARY_FUNCTION(scalar, scalar, pow025, pow025) UNARY_FUNCTION(scalar, scalar, sqrt, sqrt) +UNARY_FUNCTION(scalar, scalar, cbrt, cbrt) UNARY_FUNCTION(scalar, scalar, sign, sign) UNARY_FUNCTION(scalar, scalar, pos, pos) UNARY_FUNCTION(scalar, scalar, neg, neg) diff --git a/src/OpenFOAM/fields/FieldFields/scalarFieldField/scalarFieldField.C b/src/OpenFOAM/fields/FieldFields/scalarFieldField/scalarFieldField.C index bf58529828..4132ba79f3 100644 --- a/src/OpenFOAM/fields/FieldFields/scalarFieldField/scalarFieldField.C +++ b/src/OpenFOAM/fields/FieldFields/scalarFieldField/scalarFieldField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -105,6 +105,7 @@ UNARY_FUNCTION(scalar, scalar, pow5) UNARY_FUNCTION(scalar, scalar, pow6) UNARY_FUNCTION(scalar, scalar, pow025) UNARY_FUNCTION(scalar, scalar, sqrt) +UNARY_FUNCTION(scalar, scalar, cbrt) UNARY_FUNCTION(scalar, scalar, sign) UNARY_FUNCTION(scalar, scalar, pos) UNARY_FUNCTION(scalar, scalar, neg) diff --git a/src/OpenFOAM/fields/FieldFields/scalarFieldField/scalarFieldField.H b/src/OpenFOAM/fields/FieldFields/scalarFieldField/scalarFieldField.H index f2c851c0cd..f6fcc4c901 100644 --- a/src/OpenFOAM/fields/FieldFields/scalarFieldField/scalarFieldField.H +++ b/src/OpenFOAM/fields/FieldFields/scalarFieldField/scalarFieldField.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -98,6 +98,7 @@ UNARY_FUNCTION(scalar, scalar, pow5) UNARY_FUNCTION(scalar, scalar, pow6) UNARY_FUNCTION(scalar, scalar, pow025) UNARY_FUNCTION(scalar, scalar, sqrt) +UNARY_FUNCTION(scalar, scalar, cbrt) UNARY_FUNCTION(scalar, scalar, sign) UNARY_FUNCTION(scalar, scalar, pos) UNARY_FUNCTION(scalar, scalar, neg) diff --git a/src/OpenFOAM/fields/Fields/scalarField/scalarField.C b/src/OpenFOAM/fields/Fields/scalarField/scalarField.C index cd18592265..96e41d9571 100644 --- a/src/OpenFOAM/fields/Fields/scalarField/scalarField.C +++ b/src/OpenFOAM/fields/Fields/scalarField/scalarField.C @@ -128,6 +128,7 @@ UNARY_FUNCTION(scalar, scalar, pow5) UNARY_FUNCTION(scalar, scalar, pow6) UNARY_FUNCTION(scalar, scalar, pow025) UNARY_FUNCTION(scalar, scalar, sqrt) +UNARY_FUNCTION(scalar, scalar, cbrt) UNARY_FUNCTION(scalar, scalar, sign) UNARY_FUNCTION(scalar, scalar, pos) UNARY_FUNCTION(scalar, scalar, neg) diff --git a/src/OpenFOAM/fields/Fields/scalarField/scalarField.H b/src/OpenFOAM/fields/Fields/scalarField/scalarField.H index d5a3b7659b..ff322d3fe4 100644 --- a/src/OpenFOAM/fields/Fields/scalarField/scalarField.H +++ b/src/OpenFOAM/fields/Fields/scalarField/scalarField.H @@ -103,6 +103,7 @@ UNARY_FUNCTION(scalar, scalar, pow5) UNARY_FUNCTION(scalar, scalar, pow6) UNARY_FUNCTION(scalar, scalar, pow025) UNARY_FUNCTION(scalar, scalar, sqrt) +UNARY_FUNCTION(scalar, scalar, cbrt) UNARY_FUNCTION(scalar, scalar, sign) UNARY_FUNCTION(scalar, scalar, pos) UNARY_FUNCTION(scalar, scalar, neg) diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricScalarField/GeometricScalarField.C b/src/OpenFOAM/fields/GeometricFields/GeometricScalarField/GeometricScalarField.C index 43b2f1c7f5..ce78313efb 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricScalarField/GeometricScalarField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricScalarField/GeometricScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -448,6 +448,7 @@ UNARY_FUNCTION(scalar, scalar, pow5, pow5) UNARY_FUNCTION(scalar, scalar, pow6, pow6) UNARY_FUNCTION(scalar, scalar, pow025, pow025) UNARY_FUNCTION(scalar, scalar, sqrt, sqrt) +UNARY_FUNCTION(scalar, scalar, cbrt, cbrt) UNARY_FUNCTION(scalar, scalar, sign, sign) UNARY_FUNCTION(scalar, scalar, pos, pos) UNARY_FUNCTION(scalar, scalar, neg, neg) diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricScalarField/GeometricScalarField.H b/src/OpenFOAM/fields/GeometricFields/GeometricScalarField/GeometricScalarField.H index fa3280ce74..fd20e171c9 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricScalarField/GeometricScalarField.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricScalarField/GeometricScalarField.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -93,6 +93,7 @@ UNARY_FUNCTION(scalar, scalar, pow5, pow5) UNARY_FUNCTION(scalar, scalar, pow6, pow6) UNARY_FUNCTION(scalar, scalar, pow025, pow025) UNARY_FUNCTION(scalar, scalar, sqrt, sqrt) +UNARY_FUNCTION(scalar, scalar, cbrt, cbrt) UNARY_FUNCTION(scalar, scalar, sign, sign) UNARY_FUNCTION(scalar, scalar, pos, pos) UNARY_FUNCTION(scalar, scalar, neg, neg) diff --git a/src/OpenFOAM/fields/GeometricFields/SlicedGeometricField/SlicedGeometricField.C b/src/OpenFOAM/fields/GeometricFields/SlicedGeometricField/SlicedGeometricField.C index 43d14a5740..1ea9ae6e11 100644 --- a/src/OpenFOAM/fields/GeometricFields/SlicedGeometricField/SlicedGeometricField.C +++ b/src/OpenFOAM/fields/GeometricFields/SlicedGeometricField/SlicedGeometricField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "SlicedGeometricField.H" +#include "processorFvPatch.H" // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * // @@ -40,7 +41,8 @@ slicedBoundaryField ( const Mesh& mesh, const Field& completeField, - const bool preserveCouples + const bool preserveCouples, + const bool preserveProcessorOnly ) { tmp > tbf @@ -52,7 +54,15 @@ slicedBoundaryField forAll(mesh.boundary(), patchi) { - if (preserveCouples && mesh.boundary()[patchi].coupled()) + if + ( + preserveCouples + && mesh.boundary()[patchi].coupled() + && ( + !preserveProcessorOnly + || isA(mesh.boundary()[patchi]) + ) + ) { // For coupled patched construct the correct patch field type bf.set @@ -243,7 +253,8 @@ SlicedGeometricField const dimensionSet& ds, const Field& completeIField, const Field& completeBField, - const bool preserveCouples + const bool preserveCouples, + const bool preserveProcessorOnly ) : GeometricField @@ -252,7 +263,13 @@ SlicedGeometricField mesh, ds, Field(), - slicedBoundaryField(mesh, completeBField, preserveCouples) + slicedBoundaryField + ( + mesh, + completeBField, + preserveCouples, + preserveProcessorOnly + ) ) { // Set the internalField to the slice of the complete field diff --git a/src/OpenFOAM/fields/GeometricFields/SlicedGeometricField/SlicedGeometricField.H b/src/OpenFOAM/fields/GeometricFields/SlicedGeometricField/SlicedGeometricField.H index e04690e042..dd23712e67 100644 --- a/src/OpenFOAM/fields/GeometricFields/SlicedGeometricField/SlicedGeometricField.H +++ b/src/OpenFOAM/fields/GeometricFields/SlicedGeometricField/SlicedGeometricField.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -83,7 +83,8 @@ private: ( const Mesh& mesh, const Field& completeField, - const bool preserveCouples + const bool preserveCouples, + const bool preserveProcessorOnly = false ); //- Slice the given field and a create a PtrList of SlicedPatchField @@ -133,7 +134,8 @@ public: const dimensionSet&, const Field& completeIField, const Field& completeBField, - const bool preserveCouples=true + const bool preserveCouples=true, + const bool preserveProcessorOnly = false ); //- Construct from GeometricField. Reuses full internal and diff --git a/src/conversion/meshReader/createPolyBoundary.C b/src/conversion/meshReader/createPolyBoundary.C index e0c898156a..47fb2008f7 100644 --- a/src/conversion/meshReader/createPolyBoundary.C +++ b/src/conversion/meshReader/createPolyBoundary.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -303,14 +303,12 @@ void Foam::meshReader::createPolyBoundary() Info<< "Added " << nMissingFaces << " unmatched faces" << endl; + // Add missing faces to last patch ('Default_Empty' etc.) if (nMissingFaces > 0) { patchSizes_.last() = nMissingFaces; } - else - { - patchStarts_.setSize(patchStarts_.size() - 1); - } + // reset the size of the face list meshFaces_.setSize(nCreatedFaces); diff --git a/src/fieldSources/Make/options b/src/fieldSources/Make/options index 5927956469..a98e673d25 100644 --- a/src/fieldSources/Make/options +++ b/src/fieldSources/Make/options @@ -13,5 +13,5 @@ LIB_LIBS = \ -lfiniteVolume \ -lsampling \ -lmeshTools \ - -lsolidThermo \ + /*-lsolidThermo*/ \ -lcompressibleTurbulenceModel diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C index d56bf6421a..f09f38d4ee 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C @@ -296,6 +296,12 @@ Foam::MRFZone::MRFZone // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +Foam::vector Foam::MRFZone::Omega() const +{ + return omega_->value(mesh_.time().timeOutputValue())*axis_; +} + + void Foam::MRFZone::addCoriolis ( const volVectorField& U, @@ -312,7 +318,7 @@ void Foam::MRFZone::addCoriolis vectorField& ddtUc = ddtU.internalField(); const vectorField& Uc = U.internalField(); - const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_; + const vector Omega = this->Omega(); forAll(cells, i) { @@ -334,7 +340,7 @@ void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn) const vectorField& Usource = UEqn.source(); const vectorField& U = UEqn.psi(); - const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_; + const vector Omega = this->Omega(); forAll(cells, i) { @@ -360,7 +366,7 @@ void Foam::MRFZone::addCoriolis vectorField& Usource = UEqn.source(); const vectorField& U = UEqn.psi(); - const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_; + const vector Omega = this->Omega(); forAll(cells, i) { @@ -374,7 +380,7 @@ void Foam::MRFZone::relativeVelocity(volVectorField& U) const { const volVectorField& C = mesh_.C(); - const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_; + const vector Omega = this->Omega(); const labelList& cells = mesh_.cellZones()[cellZoneID_]; @@ -412,7 +418,7 @@ void Foam::MRFZone::absoluteVelocity(volVectorField& U) const { const volVectorField& C = mesh_.C(); - const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_; + const vector Omega = this->Omega(); const labelList& cells = mesh_.cellZones()[cellZoneID_]; @@ -480,7 +486,7 @@ void Foam::MRFZone::absoluteFlux void Foam::MRFZone::correctBoundaryVelocity(volVectorField& U) const { - const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_; + const vector Omega = this->Omega(); // Included patches diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZone.H b/src/finiteVolume/cfdTools/general/MRF/MRFZone.H index 74160cf39b..5c6e05e2d3 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZone.H +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZone.H @@ -47,7 +47,7 @@ SourceFiles #include "volFieldsFwd.H" #include "surfaceFieldsFwd.H" #include "fvMatricesFwd.H" -#include "fvMatrices.H" +#include "mapPolyMesh.H" #include "DataEntry.H" #include "autoPtr.H" @@ -164,6 +164,9 @@ public: //- Return const access to the MRF active flag inline bool active() const; + //- Return the current Omega vector + vector Omega() const; + // Evaluation diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZoneTemplates.C b/src/finiteVolume/cfdTools/general/MRF/MRFZoneTemplates.C index 872bf53a82..bc0087826c 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZoneTemplates.C +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZoneTemplates.C @@ -27,6 +27,7 @@ License #include "fvMesh.H" #include "volFields.H" #include "surfaceFields.H" +#include "fvMatrices.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/finiteVolume/fvMesh/fvMeshGeometry.C b/src/finiteVolume/fvMesh/fvMeshGeometry.C index 0a06ef7364..5abdb45d11 100644 --- a/src/finiteVolume/fvMesh/fvMeshGeometry.C +++ b/src/finiteVolume/fvMesh/fvMeshGeometry.C @@ -133,6 +133,8 @@ void fvMesh::makeC() const << abort(FatalError); } + // Construct as slices. Only preserve processor (not e.g. cyclic) + CPtr_ = new slicedVolVectorField ( IOobject @@ -148,33 +150,10 @@ void fvMesh::makeC() const *this, dimLength, cellCentres(), - faceCentres() + faceCentres(), + true, //preserveCouples + true //preserveProcOnly ); - - - // Need to correct for cyclics transformation since absolute quantity. - // Ok on processor patches since hold opposite cell centre (no - // transformation) - slicedVolVectorField& C = *CPtr_; - - forAll(C.boundaryField(), patchi) - { - if - ( - isA(C.boundaryField()[patchi]) - || isA(C.boundaryField()[patchi]) - ) - { - // Note: cyclic is not slice but proper field - C.boundaryField()[patchi] == static_cast - ( - static_cast&> - ( - boundary_[patchi].patchSlice(faceCentres()) - ) - ); - } - } } diff --git a/src/fvMotionSolver/Make/options b/src/fvMotionSolver/Make/options index 7c440dd78f..fa13513b50 100644 --- a/src/fvMotionSolver/Make/options +++ b/src/fvMotionSolver/Make/options @@ -3,6 +3,7 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/postProcessing/functionObjects/forces/lnInclude \ LIB_LIBS = \ diff --git a/src/mesh/autoMesh/Make/options b/src/mesh/autoMesh/Make/options index ca8cb9e2e4..0ee4f07bb0 100644 --- a/src/mesh/autoMesh/Make/options +++ b/src/mesh/autoMesh/Make/options @@ -4,6 +4,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \ -I$(LIB_SRC)/surfMesh/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H index 7cf1e79f61..e4cea95be2 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H @@ -167,7 +167,7 @@ class autoSnapDriver void correctAttraction ( const DynamicList& surfacePoints, - const DynamicList