diff --git a/ReleaseNotes-dev b/ReleaseNotes-dev index d35d1b518e..12aa0ed485 100644 --- a/ReleaseNotes-dev +++ b/ReleaseNotes-dev @@ -29,13 +29,29 @@ =metis-5.0pre2=, =ParMetis-3.1= and =ParMGridGen-1.0=. * Library developments + There have been a number of developments to the libraries to support the extension of functionality in solver and utility applications. *** Core library + Large number of code refinements and consistency improvements to support other developments. *** Turbulence modelling -*** Thermo-physical Models +*** *Updated* thermophysical libraries + + Now use the more descriptive dictionary input format, e.g. for a single + component mixture: + + thermoType hPsiThermo>>>>; + + mixture + { + nMoles 1; + molWeight 28.9; + Cp 1007; + Hf 0; + As 1.4792e-06; + Ts 116; + } + *** DSMC *** Dynamic Mesh *** Numerics @@ -67,8 +83,10 @@ + Additional wall functions for primary region momentum and temperature taking film into account + Parallel aware +*** *New* ptscotch decomposition method *** *Updated* particle tracking algorithm - +*** *Updated* split cyclics into two separate patches. See doc/changed/splitCyclics.txt +*** *New* compact binary I/O for faces and cells. This speeds up reading/writing meshes in binary. * Solvers A number of new solvers have been developed for a range of engineering applications. There has been a set of improvements to certain classes of @@ -108,10 +126,12 @@ + extrudes into master direction (i.e. away from the owner cell if flipMap is false) *** Updated utilities - + ... - + + =setFields=: optionally use faceSets to set patch values (see e.g. hotRoom tutorial). + + =blockMesh=: specify patches via dictionary instead of type only. This + makes rereading the boundary superfluous. see + e.g. pitzDailyDirectMapped tutorial. * Post-processing - + =foamToEnsight=: new =-nodeValues= option to generate and output nodal + + =foamToEnsight=: parallel continuous data. new =-nodeValues= option to generate and output nodal field data. + Function objects: + =residualControl=: new function object to allow users to terminate steady diff --git a/applications/utilities/mesh/advanced/selectCells/selectCells.C b/applications/utilities/mesh/advanced/selectCells/selectCells.C index a298c4207d..827449c02c 100644 --- a/applications/utilities/mesh/advanced/selectCells/selectCells.C +++ b/applications/utilities/mesh/advanced/selectCells/selectCells.C @@ -55,6 +55,7 @@ Description #include "edgeStats.H" #include "treeDataTriSurface.H" #include "indexedOctree.H" +#include "globalMeshData.H" using namespace Foam; @@ -298,7 +299,7 @@ label selectOutsideCells mesh, outsideFaces.shrink(), outsideFacesInfo.shrink(), - mesh.nCells() // max iterations + mesh.globalData().nTotalCells()+1 // max iterations ); // Now regionCalc should hold info on cells that are reachable from diff --git a/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L b/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L index 5fd94ef38d..6f0f7c976d 100644 --- a/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L +++ b/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L @@ -43,7 +43,7 @@ Description #include "polyMeshZipUpCells.H" #include "wallPolyPatch.H" #include "symmetryPolyPatch.H" -#include "cyclicPolyPatch.H" +#include "oldCyclicPolyPatch.H" #include "Swap.H" #include "IFstream.H" #include "readHexLabel.H" @@ -900,7 +900,7 @@ int main(int argc, char *argv[]) fluentToFoamType.insert("interface", polyPatch::typeName); fluentToFoamType.insert("internal", polyPatch::typeName); fluentToFoamType.insert("solid", polyPatch::typeName); - fluentToFoamType.insert("fan", cyclicPolyPatch::typeName); + fluentToFoamType.insert("fan", oldCyclicPolyPatch::typeName); fluentToFoamType.insert("radiator", polyPatch::typeName); fluentToFoamType.insert("porous-jump", polyPatch::typeName); diff --git a/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C b/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C index ab764547a3..066fab386f 100644 --- a/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C +++ b/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C @@ -41,7 +41,7 @@ Description #include "wallPolyPatch.H" #include "symmetryPolyPatch.H" #include "wedgePolyPatch.H" -#include "cyclicPolyPatch.H" +#include "oldCyclicPolyPatch.H" #include "unitConversion.H" using namespace Foam; diff --git a/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H b/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H index 04b36020ea..1a559559e9 100644 --- a/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H +++ b/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H @@ -196,7 +196,7 @@ const word* kivaPatchTypes[nBCs] = &polyPatch::typeName, &polyPatch::typeName, &symmetryPolyPatch::typeName, - &cyclicPolyPatch::typeName + &oldCyclicPolyPatch::typeName }; enum patchTypeNames diff --git a/applications/utilities/mesh/conversion/sammToFoam/readBoundary.C b/applications/utilities/mesh/conversion/sammToFoam/readBoundary.C index 53dffd39c6..d01a114111 100644 --- a/applications/utilities/mesh/conversion/sammToFoam/readBoundary.C +++ b/applications/utilities/mesh/conversion/sammToFoam/readBoundary.C @@ -29,7 +29,7 @@ Description #include "sammMesh.H" #include "Time.H" #include "wallPolyPatch.H" -#include "cyclicPolyPatch.H" +#include "oldCyclicPolyPatch.H" #include "symmetryPolyPatch.H" #include "preservePatchTypes.H" #include "IFstream.H" @@ -208,7 +208,7 @@ void sammMesh::readBoundary() { // incorrect. should be cyclicPatch but this // requires info on connected faces. - patchTypes_[patchLabel] = cyclicPolyPatch::typeName; + patchTypes_[patchLabel] = oldCyclicPolyPatch::typeName; } else { diff --git a/applications/utilities/mesh/conversion/star3ToFoam/readBoundary.C b/applications/utilities/mesh/conversion/star3ToFoam/readBoundary.C index a96ee6e96b..75a1860006 100644 --- a/applications/utilities/mesh/conversion/star3ToFoam/readBoundary.C +++ b/applications/utilities/mesh/conversion/star3ToFoam/readBoundary.C @@ -29,7 +29,7 @@ Description #include "starMesh.H" #include "Time.H" #include "wallPolyPatch.H" -#include "cyclicPolyPatch.H" +#include "oldCyclicPolyPatch.H" #include "symmetryPolyPatch.H" #include "preservePatchTypes.H" #include "IFstream.H" @@ -206,7 +206,7 @@ void starMesh::readBoundary() { // incorrect. should be cyclicPatch but this // requires info on connected faces. - patchTypes_[patchLabel] = cyclicPolyPatch::typeName; + patchTypes_[patchLabel] = oldCyclicPolyPatch::typeName; } else { diff --git a/applications/utilities/mesh/generation/snappyHexMesh/Make/options b/applications/utilities/mesh/generation/snappyHexMesh/Make/options index 3c224d318f..b7fd6d3bd2 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/Make/options +++ b/applications/utilities/mesh/generation/snappyHexMesh/Make/options @@ -11,7 +11,7 @@ EXE_INC = \ EXE_LIBS = \ -lfiniteVolume \ -ldecompositionMethods \ - -L$(FOAM_MPI_LIBBIN) -lptscotchDecomp \ + -L$(FOAM_LIBBIN)/dummy -lptscotchDecomp \ -lmeshTools \ -ldynamicMesh \ -lautoMesh diff --git a/applications/utilities/mesh/manipulation/createBaffles/SetPatchFields.C b/applications/utilities/mesh/manipulation/createBaffles/SetPatchFields.C new file mode 100644 index 0000000000..25de86d62f --- /dev/null +++ b/applications/utilities/mesh/manipulation/createBaffles/SetPatchFields.C @@ -0,0 +1,47 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 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 . + +\*---------------------------------------------------------------------------*/ + +#include "SetPatchFields.H" + +// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // + +template +void Foam::SetPatchFields +( + PtrList& fields, + const label patchI, + const typename GeoField::value_type& initVal +) +{ + forAll(fields, i) + { + typename GeoField::PatchFieldType& pfld = + fields[i].boundaryField()[patchI]; + pfld == initVal; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantPimpleFoam/hotRoom/setHotRoom/setHotRoom.C b/applications/utilities/mesh/manipulation/createBaffles/SetPatchFields.H similarity index 51% rename from tutorials/heatTransfer/buoyantPimpleFoam/hotRoom/setHotRoom/setHotRoom.C rename to applications/utilities/mesh/manipulation/createBaffles/SetPatchFields.H index 73cb4df097..1dcb1e346a 100644 --- a/tutorials/heatTransfer/buoyantPimpleFoam/hotRoom/setHotRoom/setHotRoom.C +++ b/applications/utilities/mesh/manipulation/createBaffles/SetPatchFields.H @@ -21,73 +21,46 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Application - setHotRoom +Global + Foam::SetPatchFields Description - Set the initial field of T for the hot room problem. + Helper routine to initialise a patch field to a constant value + +SourceFiles + SetPatchFields.C \*---------------------------------------------------------------------------*/ -#include "fvCFD.H" -#include "OSspecific.H" -#include "fixedValueFvPatchFields.H" +#ifndef SetPatchFields_H +#define SetPatchFields_H + +#include "PtrList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -int main(int argc, char *argv[]) +namespace Foam { -# include "setRootCase.H" +//- Helper routine to read fields +template +void SetPatchFields +( + PtrList& fields, + const label patchI, + const typename GeoField::value_type& initVal +); -# include "createTime.H" -# include "createMesh.H" -# include "createFields.H" +} // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -volScalarField::GeometricBoundaryField& Tpatches = T.boundaryField(); +#ifdef NoRepository +# include "SetPatchFields.C" +#endif -forAll(Tpatches, patchI) -{ - if - ( - isA(Tpatches[patchI]) - && mesh.boundaryMesh()[patchI].name() == "floor" - ) - { - fixedValueFvPatchScalarField& Tpatch = - refCast(Tpatches[patchI]); - - const vectorField& faceCentres = - mesh.Cf().boundaryField()[patchI]; +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - forAll(faceCentres, facei) - { - if - ( - (faceCentres[facei].x() > 4.5) && - (faceCentres[facei].x() < 5.5) && - (faceCentres[facei].z() > 4.5) && - (faceCentres[facei].z() < 5.5) - ) - { - Tpatch[facei] = 600; - } - else - { - Tpatch[facei] = 300; - } - } - }; +#endif - Info<< "Writing modified field T\n" << endl; - T.write(); - - Info<< "End\n" << endl; - - return 0; -} - -} // ************************************************************************* // diff --git a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C index f01c2cd602..a94dc42144 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C +++ b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C @@ -43,6 +43,8 @@ Description #include "volFields.H" #include "surfaceFields.H" #include "ZoneIDs.H" +#include "fvMeshMapper.H" +#include "SetPatchFields.H" using namespace Foam; @@ -241,45 +243,39 @@ int main(int argc, char *argv[]) IOobjectList objects(mesh, runTime.timeName()); // Read vol fields. - if (args.optionFound("updateFields")) - { - Info<< "Reading geometric fields" << nl << endl; - PtrList vsFlds; - ReadFields(mesh, objects, vsFlds); + Info<< "Reading geometric fields" << nl << endl; + PtrList vsFlds; + ReadFields(mesh, objects, vsFlds); - PtrList vvFlds; - ReadFields(mesh, objects, vvFlds); + PtrList vvFlds; + ReadFields(mesh, objects, vvFlds); - PtrList vstFlds; - ReadFields(mesh, objects, vstFlds); + PtrList vstFlds; + ReadFields(mesh, objects, vstFlds); - PtrList vsymtFlds; - ReadFields(mesh, objects, vsymtFlds); + PtrList vsymtFlds; + ReadFields(mesh, objects, vsymtFlds); - PtrList vtFlds; - ReadFields(mesh, objects, vtFlds); + PtrList vtFlds; + ReadFields(mesh, objects, vtFlds); - // Read surface fields. + // Read surface fields. - PtrList ssFlds; - ReadFields(mesh, objects, ssFlds); + PtrList ssFlds; + ReadFields(mesh, objects, ssFlds); - PtrList svFlds; - ReadFields(mesh, objects, svFlds); + PtrList svFlds; + ReadFields(mesh, objects, svFlds); - PtrList sstFlds; - ReadFields(mesh, objects, sstFlds); + PtrList sstFlds; + ReadFields(mesh, objects, sstFlds); - PtrList ssymtFlds; - ReadFields(mesh, objects, ssymtFlds); + PtrList ssymtFlds; + ReadFields(mesh, objects, ssymtFlds); + + PtrList stFlds; + ReadFields(mesh, objects, stFlds); - PtrList stFlds; - ReadFields(mesh, objects, stFlds); - } - else - { - Info<< "Not updating geometric fields" << nl << endl; - } // Mesh change container polyTopoChange meshMod(mesh); @@ -484,6 +480,58 @@ int main(int argc, char *argv[]) // Update fields mesh.updateMesh(map); + // Correct boundary faces mapped-out-of-nothing. + { + fvMeshMapper mapper(mesh, map); + bool hasWarned = false; + forAll(newMasterPatches, i) + { + label patchI = newMasterPatches[i]; + const fvPatchMapper& pm = mapper.boundaryMap()[patchI]; + if (pm.sizeBeforeMapping() == 0) + { + if (!hasWarned) + { + hasWarned = true; + WarningIn(args.executable()) + << "Setting field on boundary faces to zero." << endl + << "You might have to edit these fields." << endl; + } + + SetPatchFields(vsFlds, patchI, pTraits::zero); + SetPatchFields(vvFlds, patchI, pTraits::zero); + SetPatchFields(vstFlds, patchI, pTraits::zero); + SetPatchFields(vsymtFlds, patchI, pTraits::zero); + SetPatchFields(vtFlds, patchI, pTraits::zero); + + SetPatchFields(ssFlds, patchI, pTraits::zero); + SetPatchFields(svFlds, patchI, pTraits::zero); + SetPatchFields(sstFlds, patchI, pTraits::zero); + SetPatchFields(ssymtFlds, patchI, pTraits::zero); + SetPatchFields(stFlds, patchI, pTraits::zero); + } + } + forAll(newSlavePatches, i) + { + label patchI = newSlavePatches[i]; + const fvPatchMapper& pm = mapper.boundaryMap()[patchI]; + if (pm.sizeBeforeMapping() == 0) + { + SetPatchFields(vsFlds, patchI, pTraits::zero); + SetPatchFields(vvFlds, patchI, pTraits::zero); + SetPatchFields(vstFlds, patchI, pTraits::zero); + SetPatchFields(vsymtFlds, patchI, pTraits::zero); + SetPatchFields(vtFlds, patchI, pTraits::zero); + + SetPatchFields(ssFlds, patchI, pTraits::zero); + SetPatchFields(svFlds, patchI, pTraits::zero); + SetPatchFields(sstFlds, patchI, pTraits::zero); + SetPatchFields(ssymtFlds, patchI, pTraits::zero); + SetPatchFields(stFlds, patchI, pTraits::zero); + } + } + } + // Move mesh (since morphing might not do this) if (map().hasMotionPoints()) { diff --git a/applications/utilities/mesh/manipulation/subsetMesh/Make/options b/applications/utilities/mesh/manipulation/subsetMesh/Make/options index d27c95d033..969020c4af 100644 --- a/applications/utilities/mesh/manipulation/subsetMesh/Make/options +++ b/applications/utilities/mesh/manipulation/subsetMesh/Make/options @@ -4,4 +4,5 @@ EXE_INC = \ EXE_LIBS = \ -lfiniteVolume \ - -lmeshTools + -lmeshTools \ + -lgenericPatchFields diff --git a/applications/utilities/parallelProcessing/decomposePar/Make/options b/applications/utilities/parallelProcessing/decomposePar/Make/options index 3ae2128234..7a9f1df3f5 100644 --- a/applications/utilities/parallelProcessing/decomposePar/Make/options +++ b/applications/utilities/parallelProcessing/decomposePar/Make/options @@ -7,6 +7,6 @@ EXE_INC = \ EXE_LIBS = \ -lfiniteVolume \ -lgenericPatchFields \ - -ldecompositionMethods -lmetisDecomp -lscotchDecomp \ + -ldecompositionMethods -L$(FOAM_LIBBIN)/dummy -lmetisDecomp -lscotchDecomp \ -llagrangian \ -lmeshTools diff --git a/applications/utilities/parallelProcessing/redistributeMeshPar/Make/options b/applications/utilities/parallelProcessing/redistributeMeshPar/Make/options index 505234515d..05d603887a 100644 --- a/applications/utilities/parallelProcessing/redistributeMeshPar/Make/options +++ b/applications/utilities/parallelProcessing/redistributeMeshPar/Make/options @@ -7,6 +7,6 @@ EXE_INC = \ EXE_LIBS = \ -lfiniteVolume \ -ldecompositionMethods \ - -L$(FOAM_MPI_LIBBIN) -lptscotchDecomp \ + -L$(FOAM_LIBBIN)/dummy -lptscotchDecomp \ -lmeshTools \ -ldynamicMesh diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/cellSets.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/cellSets.H index 86eaa03d88..ff358d7887 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/cellSets.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/cellSets.H @@ -57,7 +57,6 @@ public: labelList prisms; labelList wedges; labelList hexes; - labelList hexesWedges; labelList polys; @@ -77,7 +76,6 @@ public: prisms(nCells), wedges(nCells), hexes(nCells), - hexesWedges(nCells), polys(nCells) {} }; diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C index 8a79f54d96..5434209711 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C @@ -38,6 +38,32 @@ using namespace Foam; // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // +template +Field map +( + const Field& vf, + const labelList& map1, + const labelList& map2 +) +{ + Field mf(map1.size() + map2.size()); + + forAll(map1, i) + { + mf[i] = vf[map1[i]]; + } + + label offset = map1.size(); + + forAll(map2, i) + { + mf[i + offset] = vf[map2[i]]; + } + + return mf; +} + + template void writeField ( @@ -274,7 +300,8 @@ void ensightField const labelList& tets = meshCellSets.tets; const labelList& pyrs = meshCellSets.pyrs; const labelList& prisms = meshCellSets.prisms; - const labelList& hexesWedges = meshCellSets.hexesWedges; + const labelList& wedges = meshCellSets.wedges; + const labelList& hexes = meshCellSets.hexes; const labelList& polys = meshCellSets.polys; ensightStream* ensightFilePtr = NULL; @@ -328,7 +355,7 @@ void ensightField writeField ( "hexa8", - Field(vf, hexesWedges), + map(vf, hexes, wedges), ensightFile ); @@ -548,99 +575,99 @@ void ensightPointField } - label ensightPatchI = eMesh.patchPartOffset(); + label ensightPatchI = eMesh.patchPartOffset(); - forAll(allPatchNames, patchi) - { - const word& patchName = allPatchNames[patchi]; + forAll(allPatchNames, patchi) + { + const word& patchName = allPatchNames[patchi]; - eMesh.barrier(); + eMesh.barrier(); - if (patchNames.empty() || patchNames.found(patchName)) - { - const fvPatch& p = mesh.boundary()[patchi]; - if - ( - returnReduce(p.size(), sumOp