From 66ac8ec1ccf469ada3cdc495ebbfb8251b753fb7 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 13 Aug 2013 10:16:29 +0100 Subject: [PATCH 01/14] ENH: triSurface: added sorted writing for STL --- .../triSurface/interfaces/OBJ/writeOBJ.C | 44 +++++------- .../triSurface/interfaces/STL/writeSTL.C | 71 +++++++++++++++++-- src/triSurface/triSurface/triSurface.C | 2 +- src/triSurface/triSurface/triSurface.H | 2 +- 4 files changed, 84 insertions(+), 35 deletions(-) diff --git a/src/triSurface/triSurface/interfaces/OBJ/writeOBJ.C b/src/triSurface/triSurface/interfaces/OBJ/writeOBJ.C index 99680f8bb6..ee260ea644 100644 --- a/src/triSurface/triSurface/interfaces/OBJ/writeOBJ.C +++ b/src/triSurface/triSurface/interfaces/OBJ/writeOBJ.C @@ -52,12 +52,8 @@ void triSurface::writeOBJ(const bool writeSorted, Ostream& os) const // Print patch names as comment forAll(myPatches, patchI) { - const surfacePatch& patch = myPatches[patchI]; - - if (patch.size() > 0) - { - os << "# " << patchI << " " << patch.name() << nl; - } + os << "# " << patchI << " " + << myPatches[patchI].name() << nl; } os << "#" << nl; @@ -81,29 +77,25 @@ void triSurface::writeOBJ(const bool writeSorted, Ostream& os) const forAll(myPatches, patchI) { - const surfacePatch& patch = myPatches[patchI]; - // Print all faces belonging to this patch - if (patch.size() > 0) + + os << "g " << myPatches[patchI].name() << nl; + + for + ( + label patchFaceI = 0; + patchFaceI < myPatches[patchI].size(); + patchFaceI++ + ) { - os << "g " << patch.name() << nl; + const label faceI = faceMap[faceIndex++]; - for - ( - label patchFaceI = 0; - patchFaceI < patch.size(); - patchFaceI++ - ) - { - const label faceI = faceMap[faceIndex++]; - - os << "f " - << operator[](faceI)[0] + 1 << ' ' - << operator[](faceI)[1] + 1 << ' ' - << operator[](faceI)[2] + 1 - //<< " # " << operator[](faceI).region() - << nl; - } + os << "f " + << operator[](faceI)[0] + 1 << ' ' + << operator[](faceI)[1] + 1 << ' ' + << operator[](faceI)[2] + 1 + //<< " # " << operator[](faceI).region() + << nl; } } } diff --git a/src/triSurface/triSurface/interfaces/STL/writeSTL.C b/src/triSurface/triSurface/interfaces/STL/writeSTL.C index 63874b185e..ea3bc39845 100644 --- a/src/triSurface/triSurface/interfaces/STL/writeSTL.C +++ b/src/triSurface/triSurface/interfaces/STL/writeSTL.C @@ -31,20 +31,20 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::triSurface::writeSTLASCII(Ostream& os) const +void Foam::triSurface::writeSTLASCII(const bool writeSorted, Ostream& os) const { labelList faceMap; surfacePatchList myPatches(calcPatches(faceMap)); - label faceIndex = 0; - forAll(myPatches, patchI) + if (writeSorted) { - // Print all faces belonging to this region - const surfacePatch& patch = myPatches[patchI]; - - if (patch.size() > 0) + label faceIndex = 0; + forAll(myPatches, patchI) { + // Print all faces belonging to this region + const surfacePatch& patch = myPatches[patchI]; + os << "solid " << patch.name() << endl; for @@ -80,6 +80,63 @@ void Foam::triSurface::writeSTLASCII(Ostream& os) const os << "endsolid " << patch.name() << endl; } } + else + { + // Get patch (=compact region) per face + labelList patchIDs(size()); + forAll(myPatches, patchI) + { + label faceI = myPatches[patchI].start(); + + forAll(myPatches[patchI], i) + { + patchIDs[faceMap[faceI++]] = patchI; + } + } + + label currentPatchI = -1; + + forAll(*this, faceI) + { + if (currentPatchI != patchIDs[faceI]) + { + if (currentPatchI != -1) + { + // Have already valid patch. Close it. + os << "endsolid " << myPatches[currentPatchI].name() + << nl; + } + currentPatchI = patchIDs[faceI]; + os << "solid " << myPatches[currentPatchI].name() << nl; + } + + const vector& n = faceNormals()[faceI]; + + os << " facet normal " + << n.x() << ' ' << n.y() << ' ' << n.z() << nl + << " outer loop" << endl; + + const labelledTri& f = (*this)[faceI]; + const point& pa = points()[f[0]]; + const point& pb = points()[f[1]]; + const point& pc = points()[f[2]]; + + os << " vertex " + << pa.x() << ' ' << pa.y() << ' ' << pa.z() << nl + << " vertex " + << pb.x() << ' ' << pb.y() << ' ' << pb.z() << nl + << " vertex " + << pc.x() << ' ' << pc.y() << ' ' << pc.z() << nl + << " endloop" << nl + << " endfacet" << endl; + } + + if (currentPatchI != -1) + { + os << "endsolid " << myPatches[currentPatchI].name() + << nl; + } + } } diff --git a/src/triSurface/triSurface/triSurface.C b/src/triSurface/triSurface/triSurface.C index 258958ca69..8f80c21617 100644 --- a/src/triSurface/triSurface/triSurface.C +++ b/src/triSurface/triSurface/triSurface.C @@ -448,7 +448,7 @@ void Foam::triSurface::write } else if (ext == "stl") { - return writeSTLASCII(OFstream(name)()); + return writeSTLASCII(sort, OFstream(name)()); } else if (ext == "stlb") { diff --git a/src/triSurface/triSurface/triSurface.H b/src/triSurface/triSurface/triSurface.H index b32ca47947..cb0cf8c760 100644 --- a/src/triSurface/triSurface/triSurface.H +++ b/src/triSurface/triSurface/triSurface.H @@ -138,7 +138,7 @@ class triSurface //- Write to Ostream in ASCII STL format. // Each region becomes 'solid' 'endsolid' block. - void writeSTLASCII(Ostream&) const; + void writeSTLASCII(const bool writeSorted, Ostream&) const; //- Write to std::ostream in BINARY STL format void writeSTLBINARY(std::ostream&) const; From 472fbded8959a8d68a27c63b2c8192155ecb2e09 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 13 Aug 2013 10:19:10 +0100 Subject: [PATCH 02/14] BUG: ensight: symmTensor writing --- .../foamToEnsight/ensightField.C | 13 ++- .../writers/ensight/ensightPTraits.C | 46 ++++++++ .../writers/ensight/ensightPTraits.H | 108 ++++++++++++++++++ .../writers/ensight/ensightSurfaceWriter.C | 7 +- 4 files changed, 165 insertions(+), 9 deletions(-) create mode 100644 src/sampling/sampledSurface/writers/ensight/ensightPTraits.C create mode 100644 src/sampling/sampledSurface/writers/ensight/ensightPTraits.H diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C index 0b07b7f2eb..8284a0ddf0 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C @@ -33,6 +33,7 @@ License #include "ensightBinaryStream.H" #include "ensightAsciiStream.H" #include "globalIndex.H" +#include "ensightPTraits.H" using namespace Foam; @@ -198,7 +199,7 @@ void writePatchField ensightCaseFile.setf(ios_base::left); ensightCaseFile - << pTraits::typeName + << ensightPTraits::typeName << " per element: 1 " << setw(15) << pfName << (' ' + prepend + "****." + pfName).c_str() @@ -230,7 +231,7 @@ void writePatchField if (Pstream::master()) { - ensightFile.write(pTraits::typeName); + ensightFile.write(ensightPTraits::typeName); } if (patchi >= 0) @@ -341,14 +342,14 @@ void ensightField ensightCaseFile.setf(ios_base::left); ensightCaseFile - << pTraits::typeName + << ensightPTraits::typeName << " per element: 1 " << setw(15) << vf.name() << (' ' + prepend + "****." + vf.name()).c_str() << nl; } - ensightFile.write(pTraits::typeName); + ensightFile.write(ensightPTraits::typeName); ensightFile.writePartHeader(1); } @@ -555,14 +556,14 @@ void ensightPointField ensightCaseFile.setf(ios_base::left); ensightCaseFile - << pTraits::typeName + << ensightPTraits::typeName << " per node: 1 " << setw(15) << pf.name() << (' ' + prepend + "****." + pf.name()).c_str() << nl; } - ensightFile.write(pTraits::typeName); + ensightFile.write(ensightPTraits::typeName); ensightFile.writePartHeader(1); } diff --git a/src/sampling/sampledSurface/writers/ensight/ensightPTraits.C b/src/sampling/sampledSurface/writers/ensight/ensightPTraits.C new file mode 100644 index 0000000000..8d3ed3be5f --- /dev/null +++ b/src/sampling/sampledSurface/writers/ensight/ensightPTraits.C @@ -0,0 +1,46 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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 "ensightPTraits.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +const char* const Foam::ensightPTraits::typeName = + Foam::pTraits::typeName; + +const char* const Foam::ensightPTraits::typeName = + Foam::pTraits::typeName; + +const char* const Foam::ensightPTraits::typeName = + Foam::pTraits::typeName; + +const char* const Foam::ensightPTraits::typeName = + "tensor symm"; + +const char* const Foam::ensightPTraits::typeName = + Foam::pTraits::typeName; + + +// ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/ensight/ensightPTraits.H b/src/sampling/sampledSurface/writers/ensight/ensightPTraits.H new file mode 100644 index 0000000000..70e26756dc --- /dev/null +++ b/src/sampling/sampledSurface/writers/ensight/ensightPTraits.H @@ -0,0 +1,108 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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 . + +Class + Foam::ensightPTraits + +Description + Conversion of OpenFOAM pTraits into the Ensight equivalent + +\*---------------------------------------------------------------------------*/ + +#ifndef ensightPTraits_H +#define ensightPTraits_H + +#include "pTraits.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class ensightPTraits Declaration +\*---------------------------------------------------------------------------*/ + +template +class ensightPTraits +{ +public: + + // Static data members + + static const char* const typeName; + +}; + + +template<> +class ensightPTraits +{ +public: + + static const char* const typeName; +}; + +template<> +class ensightPTraits +{ +public: + + static const char* const typeName; +}; + +template<> +class ensightPTraits +{ +public: + + static const char* const typeName; +}; + +template<> +class ensightPTraits +{ +public: + + static const char* const typeName; +}; + +template<> +class ensightPTraits +{ +public: + + static const char* const typeName; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C index 9d4a653819..5e2ab17114 100644 --- a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,6 +29,7 @@ License #include "OSspecific.H" #include "IOmanip.H" #include "ensightPartFaces.H" +#include "ensightPTraits.H" #include "makeSurfaceWriterMethods.H" @@ -89,7 +90,7 @@ void Foam::ensightSurfaceWriter::writeTemplate << "model: 1 " << osGeom.name().name() << nl << nl << "VARIABLE" << nl - << pTraits::typeName << " per " + << ensightPTraits::typeName << " per " << word(isNodeValues ? "node:" : "element:") << setw(10) << 1 << " " << fieldName << " " << surfaceName.c_str() << ".***." << fieldName << nl @@ -107,7 +108,7 @@ void Foam::ensightSurfaceWriter::writeTemplate osGeom << ensPart; // Write field - osField.writeKeyword(pTraits::typeName); + osField.writeKeyword(ensightPTraits::typeName); ensPart.writeField(osField, values, isNodeValues); } From c8c003865556f0129b6030f631d09ef35475c636 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 13 Aug 2013 12:09:40 +0100 Subject: [PATCH 03/14] BUG: mappedPatchBase: only map if set --- .../mappedPatches/mappedPolyPatch/mappedPatchBase.C | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C index 4834c1a81a..129445ef80 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C @@ -1152,7 +1152,12 @@ Foam::mappedPatchBase::mappedPatchBase samplePatch_(mpb.samplePatch_), offsetMode_(mpb.offsetMode_), offset_(mpb.offset_), - offsets_(mpb.offsets_, mapAddressing), + offsets_ + ( + offsetMode_ == NONUNIFORM + ? vectorField(mpb.offsets_, mapAddressing) + : vectorField(0) + ), distance_(mpb.distance_), sameRegion_(mpb.sameRegion_), mapPtr_(NULL), From 8f144c3ab7498c5866a539d37afdaf894951cfcc Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 13 Aug 2013 12:23:51 +0100 Subject: [PATCH 04/14] COMP: sampling: missing .C in Make/files --- src/sampling/Make/files | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sampling/Make/files b/src/sampling/Make/files index 6d5b7ad19e..79d377f43f 100644 --- a/src/sampling/Make/files +++ b/src/sampling/Make/files @@ -43,6 +43,7 @@ surfWriters = sampledSurface/writers $(surfWriters)/surfaceWriter.C $(surfWriters)/dx/dxSurfaceWriter.C $(surfWriters)/ensight/ensightSurfaceWriter.C +$(surfWriters)/ensight/ensightPTraits.C $(surfWriters)/foamFile/foamFileSurfaceWriter.C $(surfWriters)/nastran/nastranSurfaceWriter.C $(surfWriters)/proxy/proxySurfaceWriter.C From b2c8377ab1fb1e9444d9ca316e806cd4f7adcde7 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 13 Aug 2013 14:33:37 +0100 Subject: [PATCH 05/14] ENH: primitives: abstract out number parsing --- .../Scalar/doubleScalar/doubleScalar.H | 10 +++++++++- .../primitives/Scalar/floatScalar/floatScalar.H | 10 +++++++++- src/OpenFOAM/primitives/ints/int/int.H | 3 ++- src/OpenFOAM/primitives/ints/int/intIO.C | 11 ++++++++++- src/OpenFOAM/primitives/ints/label/label.H | 17 ++++++++++++++++- src/OpenFOAM/primitives/ints/long/long.H | 3 ++- src/OpenFOAM/primitives/ints/long/longIO.C | 9 ++++++++- .../primitives/ints/longLong/longLong.H | 3 ++- .../primitives/ints/longLong/longLongIO.C | 10 +++++++++- 9 files changed, 67 insertions(+), 9 deletions(-) diff --git a/src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.H b/src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.H index 3e8b2a3b05..13a70e475e 100644 --- a/src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.H +++ b/src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.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 @@ -58,6 +58,14 @@ static const doubleScalar doubleScalarSMALL = 1.0e-15; static const doubleScalar doubleScalarVSMALL = 1.0e-300; static const doubleScalar doubleScalarROOTVSMALL = 1.0e-150; +//- Read whole of buf as a scalar. Return true if succesful. +inline bool readScalar(const char* buf, doubleScalar& s) +{ + char* endPtr; + s = strtod(buf, &endPtr); + + return (*endPtr == '\0'); +} #define Scalar doubleScalar #define ScalarVGREAT doubleScalarVGREAT diff --git a/src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.H b/src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.H index 3386d3630e..5401bc79a6 100644 --- a/src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.H +++ b/src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.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 @@ -58,6 +58,14 @@ static const floatScalar floatScalarSMALL = 1.0e-6; static const floatScalar floatScalarVSMALL = 1.0e-37; static const floatScalar floatScalarROOTVSMALL = 1.0e-18; +//- Read whole of buf as a scalar. Return true if succesful. +inline bool readScalar(const char* buf, floatScalar& s) +{ + char* endPtr; + s = strtof(buf, &endPtr); + + return (*endPtr == '\0'); +} #define Scalar floatScalar #define ScalarVGREAT floatScalarVGREAT diff --git a/src/OpenFOAM/primitives/ints/int/int.H b/src/OpenFOAM/primitives/ints/int/int.H index c734f3e583..9f3a34c978 100644 --- a/src/OpenFOAM/primitives/ints/int/int.H +++ b/src/OpenFOAM/primitives/ints/int/int.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 @@ -54,6 +54,7 @@ word name(const int); // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // int readInt(Istream&); +bool readInt(const char*, int&); Istream& operator>>(Istream&, int&); Ostream& operator<<(Ostream&, const int); diff --git a/src/OpenFOAM/primitives/ints/int/intIO.C b/src/OpenFOAM/primitives/ints/int/intIO.C index fb9ff8b0e3..bd02519897 100644 --- a/src/OpenFOAM/primitives/ints/int/intIO.C +++ b/src/OpenFOAM/primitives/ints/int/intIO.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -88,6 +88,15 @@ int Foam::readInt(Istream& is) } +bool Foam::readInt(const char* buf, int& s) +{ + char *endptr = NULL; + long l = strtol(buf, &endptr, 10); + s = int(l); + return (*endptr == 0); +} + + Foam::Ostream& Foam::operator<<(Ostream& os, const int i) { os.write(label(i)); diff --git a/src/OpenFOAM/primitives/ints/label/label.H b/src/OpenFOAM/primitives/ints/label/label.H index 17911aed1f..0e97dc7c57 100644 --- a/src/OpenFOAM/primitives/ints/label/label.H +++ b/src/OpenFOAM/primitives/ints/label/label.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 @@ -72,6 +72,11 @@ namespace Foam return readInt(is); } + inline bool readLabel(const char* buf, label& s) + { + return readInt(buf, s); + } + } // End namespace Foam @@ -96,6 +101,11 @@ namespace Foam return readLong(is); } + inline bool readLabel(const char* buf, label& s) + { + return readLong(buf, s); + } + } // End namespace Foam @@ -122,6 +132,11 @@ namespace Foam return readLongLong(is); } + inline bool readLabel(const char* buf, label& s) + { + return readLongLong(buf, s); + } + } // End namespace Foam #endif diff --git a/src/OpenFOAM/primitives/ints/long/long.H b/src/OpenFOAM/primitives/ints/long/long.H index 5fbf2fa95b..6e09fc2046 100644 --- a/src/OpenFOAM/primitives/ints/long/long.H +++ b/src/OpenFOAM/primitives/ints/long/long.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 @@ -53,6 +53,7 @@ word name(const long); // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // long readLong(Istream&); +bool readLong(const char*, long&); Istream& operator>>(Istream&, long&); Ostream& operator<<(Ostream&, const long); diff --git a/src/OpenFOAM/primitives/ints/long/longIO.C b/src/OpenFOAM/primitives/ints/long/longIO.C index 3a9d8e3fe5..7e352bd9db 100644 --- a/src/OpenFOAM/primitives/ints/long/longIO.C +++ b/src/OpenFOAM/primitives/ints/long/longIO.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -85,6 +85,13 @@ long Foam::readLong(Istream& is) return val; } +bool Foam::readLong(const char* buf, long& s) +{ + char *endptr = NULL; + s = strtol(buf, &endptr, 10); + return (*endptr == 0); +} + Foam::Ostream& Foam::operator<<(Ostream& os, const long l) { diff --git a/src/OpenFOAM/primitives/ints/longLong/longLong.H b/src/OpenFOAM/primitives/ints/longLong/longLong.H index 00d34b5d92..e1595e8462 100644 --- a/src/OpenFOAM/primitives/ints/longLong/longLong.H +++ b/src/OpenFOAM/primitives/ints/longLong/longLong.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 @@ -53,6 +53,7 @@ word name(long long); // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // long long readLongLong(Istream&); +bool readLongLong(const char*, long long&); Istream& operator>>(Istream&, long long&); Ostream& operator<<(Ostream&, const long long); diff --git a/src/OpenFOAM/primitives/ints/longLong/longLongIO.C b/src/OpenFOAM/primitives/ints/longLong/longLongIO.C index 146bf011ea..384fe1bf1f 100644 --- a/src/OpenFOAM/primitives/ints/longLong/longLongIO.C +++ b/src/OpenFOAM/primitives/ints/longLong/longLongIO.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -87,6 +87,14 @@ long long Foam::readLongLong(Istream& is) } +bool Foam::readLongLong(const char* buf, long long& s) +{ + char *endptr = NULL; + s = strtoll(buf, &endptr, 10); + return (*endptr == 0); +} + + Foam::Ostream& Foam::operator<<(Ostream& os, const long long l) { long long val = l; From 401b2624f9987fb3730d7b618d70bde253154385 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 13 Aug 2013 15:30:58 +0100 Subject: [PATCH 06/14] COMP: foamToEnsight: missing include dir --- .../postProcessing/dataConversion/foamToEnsight/Make/options | 2 ++ 1 file changed, 2 insertions(+) diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/options b/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/options index 5d00838fdc..7799242880 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/options +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/options @@ -2,11 +2,13 @@ EXE_INC = \ /* -DFULLDEBUG -g -O0 */ \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude EXE_LIBS = \ -lfiniteVolume \ -lmeshTools \ + -lsampling \ -lgenericPatchFields \ -llagrangian From 36a3d00766acd4a3dc9dc8108620abd13c818ab8 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 13 Aug 2013 17:23:17 +0100 Subject: [PATCH 07/14] ENH: primitives: abstract out number parsing --- src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C | 49 +++++++++++-------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C b/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C index c93aad5a36..3c7d266520 100644 --- a/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C +++ b/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.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 @@ -296,7 +296,7 @@ Foam::Istream& Foam::ISstream::read(token& t) buf[nChar++] = c; // get everything that could resemble a number and let - // strtod() determine the validity + // readScalar determine the validity while ( is_.get(c) @@ -348,24 +348,25 @@ Foam::Istream& Foam::ISstream::read(token& t) } else { - char *endptr = NULL; - if (asLabel) { - long longVal(strtol(buf, &endptr, 10)); - t = label(longVal); - - // return as a scalar if doesn't fit in a label - if (*endptr || t.labelToken() != longVal) + label labelVal; + if (readLabel(buf, labelVal)) { - t = scalar(strtod(buf, &endptr)); + t = labelVal; } - } - else - { - scalar scalarVal(strtod(buf, &endptr)); - t = scalarVal; - + else + { + // Maybe too big? Try as scalar + scalar scalarVal; + if (readScalar(buf, scalarVal)) + { + t = scalarVal; + } + else + { + t.setBad(); + } // --------------------------------------- // this would also be possible if desired: // --------------------------------------- @@ -380,12 +381,20 @@ Foam::Istream& Foam::ISstream::read(token& t) // t = labelVal; // } // } - } - // not everything converted: bad format or trailing junk - if (*endptr) + } + } + else { - t.setBad(); + scalar scalarVal; + if (readScalar(buf, scalarVal)) + { + t = scalarVal; + } + else + { + t.setBad(); + } } } } From b0bdd05626e03a0a855368d565d9ef55008f3927 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 14 Aug 2013 09:22:36 +0100 Subject: [PATCH 08/14] BUG: searchableSurface: double increment; distribute functionality --- .../searchableSurfaceCollection.C | 5 +++-- .../searchableSurfaceWithGaps.H | 20 +++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/meshTools/searchableSurface/searchableSurfaceCollection.C b/src/meshTools/searchableSurface/searchableSurfaceCollection.C index 3aad85f72d..e43d831980 100644 --- a/src/meshTools/searchableSurface/searchableSurfaceCollection.C +++ b/src/meshTools/searchableSurface/searchableSurfaceCollection.C @@ -376,7 +376,7 @@ void Foam::searchableSurfaceCollection::boundingSpheres forAll(subCentres, i) { - centres[coordI++] = transform_[surfI].globalPosition + centres[coordI] = transform_[surfI].globalPosition ( cmptMultiply ( @@ -384,7 +384,8 @@ void Foam::searchableSurfaceCollection::boundingSpheres scale_[surfI] ) ); - radiusSqr[coordI++] = maxScale*subRadiusSqr[i]; + radiusSqr[coordI] = maxScale*subRadiusSqr[i]; + coordI++; } } } diff --git a/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H b/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H index d07d331c8a..1dfe6c8420 100644 --- a/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H +++ b/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H @@ -261,16 +261,16 @@ public: // bounding boxes. The bounds are hints to the surface as for // the range of queries it can expect. faceMap/pointMap can be // set if the surface has done any redistribution. - virtual void distribute - ( - const List& bbs, - const bool keepNonLocal, - autoPtr& faceMap, - autoPtr& pointMap - ) - { - subGeom_[0].distribute(bbs, keepNonLocal, faceMap, pointMap); - } + //virtual void distribute + //( + // const List& bbs, + // const bool keepNonLocal, + // autoPtr& faceMap, + // autoPtr& pointMap + //) + //{ + // subGeom_[0].distribute(bbs, keepNonLocal, faceMap, pointMap); + //} //- WIP. Store element-wise field. virtual void setField(const labelList& values) From eb0100ff8fe01d69c2a65ae92b4211d50ddbbb79 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 14 Aug 2013 09:33:55 +0100 Subject: [PATCH 09/14] COMP: temporalInterpolate: avoid implicit instant creation --- .../miscellaneous/temporalInterpolate/temporalInterpolate.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/utilities/postProcessing/miscellaneous/temporalInterpolate/temporalInterpolate.C b/applications/utilities/postProcessing/miscellaneous/temporalInterpolate/temporalInterpolate.C index a5ed7039cb..9460c33d48 100644 --- a/applications/utilities/postProcessing/miscellaneous/temporalInterpolate/temporalInterpolate.C +++ b/applications/utilities/postProcessing/miscellaneous/temporalInterpolate/temporalInterpolate.C @@ -112,7 +112,7 @@ void fieldInterpolator::interpolate() { instant timej = instant(ti_.value() + (j + 1)*deltaT); - runTime_.setTime(timej.name(), 0); + runTime_.setTime(instant(timej.name()), 0); Info<< timej.name(); From af37ca2dec42a661e63bf8223659615857e03c75 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 14 Aug 2013 10:03:05 +0100 Subject: [PATCH 10/14] ENH: polyMesh: re-use findInstance result --- src/OpenFOAM/meshes/polyMesh/polyMesh.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C index 9b45c67e81..812caa6611 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C @@ -170,7 +170,7 @@ Foam::polyMesh::polyMesh(const IOobject& io) IOobject ( "owner", - time().findInstance(meshDir(), "faces"), + faces_.instance(), meshSubDir, *this, IOobject::READ_IF_PRESENT, @@ -182,7 +182,7 @@ Foam::polyMesh::polyMesh(const IOobject& io) IOobject ( "neighbour", - time().findInstance(meshDir(), "faces"), + faces_.instance(), meshSubDir, *this, IOobject::READ_IF_PRESENT, From 46dcabdb4d64de73b2c5836687c45d0cac08a1e2 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 14 Aug 2013 12:26:47 +0100 Subject: [PATCH 11/14] interMixingFoam: Updated to using the new naming convention for phases --- .../interFoam/interMixingFoam/createFields.H | 51 +--------- .../threePhaseMixture.C | 84 +++++++++++----- .../threePhaseMixture.H | 96 ++++++++++++------- .../damBreak/0/{alpha1.org => alpha.air.org} | 2 +- .../0/{alpha2.org => alpha.other.org} | 0 .../0/{alpha3.org => alpha.water.org} | 0 .../interMixingFoam/laminar/damBreak/Allrun | 6 +- .../damBreak/constant/polyMesh/boundary | 1 + .../damBreak/constant/transportProperties | 11 +-- .../laminar/damBreak/system/fvSchemes | 2 +- .../laminar/damBreak/system/fvSolution | 2 +- .../laminar/damBreak/system/setFieldsDict | 18 ++-- 12 files changed, 148 insertions(+), 125 deletions(-) rename tutorials/multiphase/interMixingFoam/laminar/damBreak/0/{alpha1.org => alpha.air.org} (97%) rename tutorials/multiphase/interMixingFoam/laminar/damBreak/0/{alpha2.org => alpha.other.org} (100%) rename tutorials/multiphase/interMixingFoam/laminar/damBreak/0/{alpha3.org => alpha.water.org} (100%) diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/createFields.H b/applications/solvers/multiphase/interFoam/interMixingFoam/createFields.H index a425d40e7f..196c82194c 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/createFields.H +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/createFields.H @@ -12,53 +12,6 @@ mesh ); - Info<< "Reading field alpha1\n" << endl; - volScalarField alpha1 - ( - IOobject - ( - "alpha1", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - - Info<< "Reading field alpha2\n" << endl; - volScalarField alpha2 - ( - IOobject - ( - "alpha2", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - - Info<< "Reading field alpha3\n" << endl; - volScalarField alpha3 - ( - IOobject - ( - "alpha3", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - alpha3 == 1.0 - alpha1 - alpha2; - - Info<< "Reading field U\n" << endl; volVectorField U ( @@ -77,6 +30,10 @@ threePhaseMixture threePhaseProperties(U, phi); + volScalarField& alpha1(threePhaseProperties.alpha1()); + volScalarField& alpha2(threePhaseProperties.alpha2()); + volScalarField& alpha3(threePhaseProperties.alpha3()); + const dimensionedScalar& rho1 = threePhaseProperties.rho1(); const dimensionedScalar& rho2 = threePhaseProperties.rho2(); const dimensionedScalar& rho3 = threePhaseProperties.rho3(); diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.C b/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.C index fbf1e10ce3..fa9b8eb8dd 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.C +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.C @@ -62,9 +62,64 @@ Foam::threePhaseMixture::threePhaseMixture ) ), - phase1Name_("phase1"), - phase2Name_("phase2"), - phase3Name_("phase3"), + phase1Name_(wordList(lookup("phases"))[0]), + phase2Name_(wordList(lookup("phases"))[1]), + phase3Name_(wordList(lookup("phases"))[2]), + + alpha1_ + ( + IOobject + ( + IOobject::groupName("alpha", phase1Name_), + U.time().timeName(), + U.mesh(), + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + U.mesh() + ), + + alpha2_ + ( + IOobject + ( + IOobject::groupName("alpha", phase2Name_), + U.time().timeName(), + U.mesh(), + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + U.mesh() + ), + + alpha3_ + ( + IOobject + ( + IOobject::groupName("alpha", phase3Name_), + U.time().timeName(), + U.mesh(), + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + U.mesh() + ), + + U_(U), + phi_(phi), + + nu_ + ( + IOobject + ( + "nu", + U.time().timeName(), + U.db() + ), + U.mesh(), + dimensionedScalar("nu", dimensionSet(0, 2, -1, 0, 0), 0), + calculatedFvPatchScalarField::typeName + ), nuModel1_ ( @@ -99,28 +154,9 @@ Foam::threePhaseMixture::threePhaseMixture rho1_(nuModel1_->viscosityProperties().lookup("rho")), rho2_(nuModel2_->viscosityProperties().lookup("rho")), - rho3_(nuModel3_->viscosityProperties().lookup("rho")), - - U_(U), - phi_(phi), - - alpha1_(U_.db().lookupObject ("alpha1")), - alpha2_(U_.db().lookupObject ("alpha2")), - alpha3_(U_.db().lookupObject ("alpha3")), - - nu_ - ( - IOobject - ( - "nu", - U_.time().timeName(), - U_.db() - ), - U_.mesh(), - dimensionedScalar("nu", dimensionSet(0, 2, -1, 0, 0), 0), - calculatedFvPatchScalarField::typeName - ) + rho3_(nuModel3_->viscosityProperties().lookup("rho")) { + alpha3_ == 1.0 - alpha1_ - alpha2_; calcNu(); } diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.H b/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.H index 3c8b873983..daf0f2088b 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.H +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.H @@ -60,6 +60,15 @@ class threePhaseMixture word phase2Name_; word phase3Name_; + volScalarField alpha1_; + volScalarField alpha2_; + volScalarField alpha3_; + + const volVectorField& U_; + const surfaceScalarField& phi_; + + volScalarField nu_; + autoPtr nuModel1_; autoPtr nuModel2_; autoPtr nuModel3_; @@ -68,15 +77,6 @@ class threePhaseMixture dimensionedScalar rho2_; dimensionedScalar rho3_; - const volVectorField& U_; - const surfaceScalarField& phi_; - - const volScalarField& alpha1_; - const volScalarField& alpha2_; - const volScalarField& alpha3_; - - volScalarField nu_; - // Private Member Functions @@ -103,22 +103,49 @@ public: // Member Functions - //- Return const-access to phase1 viscosityModel - const viscosityModel& nuModel1() const + const word phase1Name() const { - return nuModel1_(); + return phase1Name_; } - //- Return const-access to phase2 viscosityModel - const viscosityModel& nuModel2() const + const word phase2Name() const { - return nuModel2_(); + return phase2Name_; } - //- Return const-access to phase3 viscosityModel - const viscosityModel& nuModel3() const + const word phase3Name() const { - return nuModel3_(); + return phase3Name_; + } + + const volScalarField& alpha1() const + { + return alpha1_; + } + + volScalarField& alpha1() + { + return alpha1_; + } + + const volScalarField& alpha2() const + { + return alpha2_; + } + + volScalarField& alpha2() + { + return alpha2_; + } + + const volScalarField& alpha3() const + { + return alpha3_; + } + + volScalarField& alpha3() + { + return alpha3_; } //- Return const-access to phase1 density @@ -139,21 +166,6 @@ public: return rho3_; }; - const volScalarField& alpha1() const - { - return alpha1_; - } - - const volScalarField& alpha2() const - { - return alpha2_; - } - - const volScalarField& alpha3() const - { - return alpha3_; - } - //- Return the velocity const volVectorField& U() const { @@ -166,6 +178,24 @@ public: return phi_; } + //- Return const-access to phase1 viscosityModel + const viscosityModel& nuModel1() const + { + return nuModel1_(); + } + + //- Return const-access to phase2 viscosityModel + const viscosityModel& nuModel2() const + { + return nuModel2_(); + } + + //- Return const-access to phase3 viscosityModel + const viscosityModel& nuModel3() const + { + return nuModel3_(); + } + //- Return the dynamic laminar viscosity tmp mu() const; diff --git a/tutorials/multiphase/interMixingFoam/laminar/damBreak/0/alpha1.org b/tutorials/multiphase/interMixingFoam/laminar/damBreak/0/alpha.air.org similarity index 97% rename from tutorials/multiphase/interMixingFoam/laminar/damBreak/0/alpha1.org rename to tutorials/multiphase/interMixingFoam/laminar/damBreak/0/alpha.air.org index 04a3a4c143..204afda941 100644 --- a/tutorials/multiphase/interMixingFoam/laminar/damBreak/0/alpha1.org +++ b/tutorials/multiphase/interMixingFoam/laminar/damBreak/0/alpha.air.org @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class volScalarField; - object alpha1; + object alpha.air; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/multiphase/interMixingFoam/laminar/damBreak/0/alpha2.org b/tutorials/multiphase/interMixingFoam/laminar/damBreak/0/alpha.other.org similarity index 100% rename from tutorials/multiphase/interMixingFoam/laminar/damBreak/0/alpha2.org rename to tutorials/multiphase/interMixingFoam/laminar/damBreak/0/alpha.other.org diff --git a/tutorials/multiphase/interMixingFoam/laminar/damBreak/0/alpha3.org b/tutorials/multiphase/interMixingFoam/laminar/damBreak/0/alpha.water.org similarity index 100% rename from tutorials/multiphase/interMixingFoam/laminar/damBreak/0/alpha3.org rename to tutorials/multiphase/interMixingFoam/laminar/damBreak/0/alpha.water.org diff --git a/tutorials/multiphase/interMixingFoam/laminar/damBreak/Allrun b/tutorials/multiphase/interMixingFoam/laminar/damBreak/Allrun index 9bb76eb3c7..c07cc1113c 100755 --- a/tutorials/multiphase/interMixingFoam/laminar/damBreak/Allrun +++ b/tutorials/multiphase/interMixingFoam/laminar/damBreak/Allrun @@ -5,9 +5,9 @@ cd ${0%/*} || exit 1 # run from this directory . $WM_PROJECT_DIR/bin/tools/RunFunctions runApplication blockMesh -cp 0/alpha1.org 0/alpha1 -cp 0/alpha2.org 0/alpha2 -cp 0/alpha3.org 0/alpha3 +cp 0/alpha.air.org 0/alpha.air +cp 0/alpha.other.org 0/alpha.other +cp 0/alpha.water.org 0/alpha.water runApplication setFields runApplication `getApplication` diff --git a/tutorials/multiphase/interMixingFoam/laminar/damBreak/constant/polyMesh/boundary b/tutorials/multiphase/interMixingFoam/laminar/damBreak/constant/polyMesh/boundary index 41c06d5f3f..1b4dbb60aa 100644 --- a/tutorials/multiphase/interMixingFoam/laminar/damBreak/constant/polyMesh/boundary +++ b/tutorials/multiphase/interMixingFoam/laminar/damBreak/constant/polyMesh/boundary @@ -44,6 +44,7 @@ FoamFile defaultFaces { type empty; + inGroups 1(empty); nFaces 4536; startFace 4640; } diff --git a/tutorials/multiphase/interMixingFoam/laminar/damBreak/constant/transportProperties b/tutorials/multiphase/interMixingFoam/laminar/damBreak/constant/transportProperties index fac1cbd4fd..83c4643a5a 100644 --- a/tutorials/multiphase/interMixingFoam/laminar/damBreak/constant/transportProperties +++ b/tutorials/multiphase/interMixingFoam/laminar/damBreak/constant/transportProperties @@ -15,24 +15,23 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Air -phase1 +phases (air other water); + +air { transportModel Newtonian; nu nu [0 2 -1 0 0 0 0] 1.48e-05; rho rho [1 -3 0 0 0 0 0] 1; } -// Other Liquid -phase2 +other { transportModel Newtonian; nu nu [0 2 -1 0 0 0 0] 1e-6; rho rho [1 -3 0 0 0 0 0] 1010; } -// Water -phase3 +water { transportModel Newtonian; nu nu [0 2 -1 0 0 0 0] 1e-6; diff --git a/tutorials/multiphase/interMixingFoam/laminar/damBreak/system/fvSchemes b/tutorials/multiphase/interMixingFoam/laminar/damBreak/system/fvSchemes index c80ccb314e..ea304e7042 100644 --- a/tutorials/multiphase/interMixingFoam/laminar/damBreak/system/fvSchemes +++ b/tutorials/multiphase/interMixingFoam/laminar/damBreak/system/fvSchemes @@ -53,7 +53,7 @@ fluxRequired default no; p_rgh; pcorr; - "alpha."; + "alpha.*"; } diff --git a/tutorials/multiphase/interMixingFoam/laminar/damBreak/system/fvSolution b/tutorials/multiphase/interMixingFoam/laminar/damBreak/system/fvSolution index 235c7014d0..3403701035 100644 --- a/tutorials/multiphase/interMixingFoam/laminar/damBreak/system/fvSolution +++ b/tutorials/multiphase/interMixingFoam/laminar/damBreak/system/fvSolution @@ -17,7 +17,7 @@ FoamFile solvers { - "alpha." + "alpha.*" { nAlphaCorr 1; nAlphaSubCycles 2; diff --git a/tutorials/multiphase/interMixingFoam/laminar/damBreak/system/setFieldsDict b/tutorials/multiphase/interMixingFoam/laminar/damBreak/system/setFieldsDict index 46fd28b225..3e8e2ec983 100644 --- a/tutorials/multiphase/interMixingFoam/laminar/damBreak/system/setFieldsDict +++ b/tutorials/multiphase/interMixingFoam/laminar/damBreak/system/setFieldsDict @@ -17,9 +17,9 @@ FoamFile defaultFieldValues ( - volScalarFieldValue alpha1 0 - volScalarFieldValue alpha2 1 - volScalarFieldValue alpha3 0 + volScalarFieldValue alpha.air 0 + volScalarFieldValue alpha.other 1 + volScalarFieldValue alpha.water 0 ); regions @@ -29,9 +29,9 @@ regions box (0 0 -1) (0.1461 0.292 1); fieldValues ( - volScalarFieldValue alpha1 0 - volScalarFieldValue alpha2 0 - volScalarFieldValue alpha3 1 + volScalarFieldValue alpha.air 0 + volScalarFieldValue alpha.other 0 + volScalarFieldValue alpha.water 1 ); } boxToCell @@ -39,9 +39,9 @@ regions box (0.1461 0.05 -1) (1 1 1); fieldValues ( - volScalarFieldValue alpha1 1 - volScalarFieldValue alpha2 0 - volScalarFieldValue alpha3 0 + volScalarFieldValue alpha.air 1 + volScalarFieldValue alpha.other 0 + volScalarFieldValue alpha.water 0 ); } ); From 9780e56a57be80d32454f66848c6de173d9e3548 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 14 Aug 2013 12:27:02 +0100 Subject: [PATCH 12/14] Update headers --- .../incompressibleThreePhaseMixture/threePhaseMixture.C | 2 +- .../incompressibleThreePhaseMixture/threePhaseMixture.H | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.C b/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.C index fa9b8eb8dd..50494062d5 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.C +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.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 diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.H b/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.H index daf0f2088b..16337521d3 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.H +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.H @@ -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 From d54c9c732731c10dcd090461cbbc7e1f93f82e05 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 14 Aug 2013 12:30:05 +0100 Subject: [PATCH 13/14] cavitatingDyMFoam: Update phase names --- .../cavitatingDyMFoam/cavitatingDyMFoam.C | 2 +- .../multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/cavitatingDyMFoam.C b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/cavitatingDyMFoam.C index cf608d0a6a..2dca530c14 100644 --- a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/cavitatingDyMFoam.C +++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/cavitatingDyMFoam.C @@ -101,7 +101,7 @@ int main(int argc, char *argv[]) while (pimple.loop()) { #include "rhoEqn.H" - #include "gammaPsi.H" + #include "alphavPsi.H" #include "UEqn.H" // --- Pressure corrector loop diff --git a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H index 3c4cbb0d32..5ad7fdeb66 100644 --- a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H +++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H @@ -4,8 +4,8 @@ p = ( rho - - gamma2*rhol0 - - ((gamma*psiv + gamma2*psil) - psi)*pSat + - alphal*rhol0 + - ((alphav*psiv + alphal*psil) - psi)*pSat )/psi; } @@ -52,13 +52,13 @@ rho == max(rho0 + psi*p, rhoMin); - #include "gammaPsi.H" + #include "alphavPsi.H" p = ( rho - - gamma2*rhol0 - - ((gamma*psiv + gamma2*psil) - psi)*pSat + - alphal*rhol0 + - ((alphav*psiv + alphal*psil) - psi)*pSat )/psi; p.correctBoundaryConditions(); From 31c5a8ebeb4b1cd192357c0cbb7cfe312404309f Mon Sep 17 00:00:00 2001 From: laurence Date: Wed, 14 Aug 2013 14:43:27 +0100 Subject: [PATCH 14/14] BUG: foamyHexMesh flange tutorial reads wrong file --- tutorials/mesh/foamyHexMesh/flange/system/meshDict.geometry | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/mesh/foamyHexMesh/flange/system/meshDict.geometry b/tutorials/mesh/foamyHexMesh/flange/system/meshDict.geometry index d71298fc60..0190b2bb88 100644 --- a/tutorials/mesh/foamyHexMesh/flange/system/meshDict.geometry +++ b/tutorials/mesh/foamyHexMesh/flange/system/meshDict.geometry @@ -14,7 +14,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -flange.obj +flange.stl { name flange; type triSurfaceMesh;