From dda3459f0d0ee45e093ec5c565e8f426c48e772a Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 3 Dec 2013 11:09:47 +0000 Subject: [PATCH 01/28] ENH: septernion: added slerp --- src/OpenFOAM/primitives/septernion/septernion.C | 11 +++++++++++ src/OpenFOAM/primitives/septernion/septernion.H | 9 ++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/OpenFOAM/primitives/septernion/septernion.C b/src/OpenFOAM/primitives/septernion/septernion.C index ffac2bd609..67cae051fd 100644 --- a/src/OpenFOAM/primitives/septernion/septernion.C +++ b/src/OpenFOAM/primitives/septernion/septernion.C @@ -59,6 +59,17 @@ Foam::word Foam::name(const septernion& s) } +Foam::septernion Foam::slerp +( + const septernion& qa, + const septernion& qb, + const scalar t +) +{ + return septernion((1.0-t)*qa.t()+t*qb.t(), slerp(qa.r(), qb.r(), t)); +} + + // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // Foam::Istream& Foam::operator>>(Istream& is, septernion& s) diff --git a/src/OpenFOAM/primitives/septernion/septernion.H b/src/OpenFOAM/primitives/septernion/septernion.H index 03253ed7b9..b6a672f3ec 100644 --- a/src/OpenFOAM/primitives/septernion/septernion.H +++ b/src/OpenFOAM/primitives/septernion/septernion.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 @@ -157,6 +157,13 @@ inline septernion inv(const septernion& tr); //- Return a string representation of a septernion word name(const septernion&); +//- Spherical linear interpolation of septernions. 0 for qa, 1 for qb +septernion slerp +( + const septernion& qa, + const septernion& qb, + const scalar t +); //- Data associated with septernion type are contiguous template<> From 2e6a6446f7cd68ccef45256db49a8e387793a7df Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 3 Dec 2013 12:06:48 +0000 Subject: [PATCH 02/28] BUG: displacementMeshMoverMotionSolver: update boundary condition --- .../displacementMeshMoverMotionSolver.C | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/displacementMeshMoverMotionSolver.C b/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/displacementMeshMoverMotionSolver.C index 728cae5f16..84d212e425 100644 --- a/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/displacementMeshMoverMotionSolver.C +++ b/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/displacementMeshMoverMotionSolver.C @@ -106,7 +106,15 @@ void Foam::displacementMeshMoverMotionSolver::solve() label nAllowableErrors = 0; labelList checkFaces(identity(mesh().nFaces())); - meshMover().move(coeffDict(), nAllowableErrors, checkFaces); + meshMover().move + ( + coeffDict().subDict(meshMover().type() + "Coeffs"), + nAllowableErrors, + checkFaces + ); + + // This will have updated the mesh and implicitly the pointDisplacement + pointDisplacement().correctBoundaryConditions(); } From 2a6bbf3e56033a77484a462c4ad54cdc2bff551b Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 4 Dec 2013 09:32:00 +0000 Subject: [PATCH 03/28] Corrected docs --- .../matrices/LduMatrix/LduMatrix/SolverPerformance.H | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/SolverPerformance.H b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/SolverPerformance.H index d39ecb10a8..0bc3fb389e 100644 --- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/SolverPerformance.H +++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/SolverPerformance.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,9 +25,8 @@ Class Foam::SolverPerformance Description - SolverPerformance is a general matrix class in which the coefficients are - stored as three arrays, one for the upper triangle, one for the - lower triangle and a third for the diagonal. + SolverPerformance is the class returned by the LduMatrix solver + containing performance statistics. SourceFiles SolverPerformance.C @@ -72,13 +71,10 @@ Ostream& operator<< ); - /*---------------------------------------------------------------------------*\ Class SolverPerformance Declaration \*---------------------------------------------------------------------------*/ -//- Class returned by the solver -// containing performance statistics template class SolverPerformance { From 182c703fcbd070bb77c9e2ede26ab886481421d1 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 4 Dec 2013 09:32:40 +0000 Subject: [PATCH 04/28] Corrected dimensions comment for critical volume --- .../liquidProperties/liquidProperties/liquidProperties.H | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/thermophysicalModels/properties/liquidProperties/liquidProperties/liquidProperties.H b/src/thermophysicalModels/properties/liquidProperties/liquidProperties/liquidProperties.H index 2210d567a3..fa295c97c9 100644 --- a/src/thermophysicalModels/properties/liquidProperties/liquidProperties/liquidProperties.H +++ b/src/thermophysicalModels/properties/liquidProperties/liquidProperties/liquidProperties.H @@ -64,7 +64,7 @@ class liquidProperties //- Critical pressure [Pa] scalar Pc_; - //- Critical volume [m^3/mol] + //- Critical volume [m^3/kmol] scalar Vc_; //- Critical compressibility factor [] @@ -185,7 +185,7 @@ public: //- Critical pressure [Pa] inline scalar Pc() const; - //- Critical volume [m^3/mol] + //- Critical volume [m^3/kmol] inline scalar Vc() const; //- Critical compressibilty factor From 9428ddc78b708520354c8ef8218d6124ff35239e Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 4 Dec 2013 15:01:30 +0000 Subject: [PATCH 05/28] ENH: pointMesh: added debugging printing --- src/OpenFOAM/meshes/pointMesh/pointMesh.C | 14 ++++++++++++++ src/OpenFOAM/meshes/pointMesh/pointMesh.H | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/src/OpenFOAM/meshes/pointMesh/pointMesh.C b/src/OpenFOAM/meshes/pointMesh/pointMesh.C index de6f88d16c..c00c67cdb0 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointMesh.C +++ b/src/OpenFOAM/meshes/pointMesh/pointMesh.C @@ -88,6 +88,20 @@ Foam::pointMesh::pointMesh(const polyMesh& pMesh) } +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::pointMesh::~pointMesh() +{ + if (debug) + { + Pout<< "~pointMesh::pointMesh()" + << endl; + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + bool Foam::pointMesh::movePoints() { if (debug) diff --git a/src/OpenFOAM/meshes/pointMesh/pointMesh.H b/src/OpenFOAM/meshes/pointMesh/pointMesh.H index e6ac279761..28180b1252 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointMesh.H +++ b/src/OpenFOAM/meshes/pointMesh/pointMesh.H @@ -85,6 +85,10 @@ public: explicit pointMesh(const polyMesh& pMesh); + //- Destructor + ~pointMesh(); + + // Member Functions //- Return number of points From c56d376baeedaf233b484cf6f6ef0a00c92dee0e Mon Sep 17 00:00:00 2001 From: Sergio Ferraris Date: Wed, 4 Dec 2013 15:30:35 +0000 Subject: [PATCH 06/28] ENH: Adding 'baseGroup' option to createBaffle.C to add a pair patches but in different groups. This is used in 3D baffle where the generated patches are not coupled. The tutorial circuitBoardCooling has been updated. --- .../createBaffles/createBaffles.C | 88 ++++++++++++++--- .../extrudePatchMesh/extrudePatchMesh.C | 97 +++++++++++++++++-- .../extrudePatchMesh/extrudePatchMesh.H | 20 ++++ .../thermalBaffleFvPatchScalarField.C | 82 +++++++++++++--- .../thermalBaffleFvPatchScalarField.H | 8 ++ ...tureCoupledBaffleMixedFvPatchScalarField.C | 14 +-- ...tureCoupledBaffleMixedFvPatchScalarField.H | 4 +- ...eratureRadCoupledMixedFvPatchScalarField.C | 8 +- .../0.org/baffle3DRegion/T | 6 -- .../3DBaffle/3DTemperatureMasterBafflePatches | 32 ------ .../system/createBafflesDict | 47 ++------- 11 files changed, 277 insertions(+), 129 deletions(-) diff --git a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C index bc0e78a67f..cdbe770d1a 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C +++ b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C @@ -619,19 +619,41 @@ int main(int argc, char *argv[]) const word masterName = groupName + "_master"; const word slaveName = groupName + "_slave"; - dictionary patchDict = patchSource; - patchDict.set("nFaces", 0); - patchDict.set("startFace", 0); - patchDict.set("coupleGroup", groupName); + word groupNameMaster = groupName; + word groupNameSlave = groupName; - addPatch(mesh, masterName, groupName, patchDict); - addPatch(mesh, slaveName, groupName, patchDict); + + dictionary patchDictMaster(patchSource); + patchDictMaster.set("nFaces", 0); + patchDictMaster.set("startFace", 0); + patchDictMaster.set("coupleGroup", groupName); + + dictionary patchDictSlave(patchDictMaster); + + // Note: This is added for the particular case where we want + // master and slave in different groupNames + // (ie 3D thermal baffles) + bool groupBase = false; + if (patchSource.found("groupBase")) + { + groupBase = readBool(patchSource.lookup("groupBase")); + + if (groupBase) + { + groupNameMaster = groupName + "Group_master"; + groupNameSlave = groupName + "Group_slave"; + patchDictMaster.set("coupleGroup", groupNameMaster); + patchDictSlave.set("coupleGroup", groupNameSlave); + } + } + + addPatch(mesh, masterName, groupNameMaster, patchDictMaster); + addPatch(mesh, slaveName, groupNameSlave, patchDictSlave); } } } - // Make sure patches and zoneFaces are synchronised across couples mesh.boundaryMesh().checkParallelSync(true); mesh.faceZones().checkParallelSync(true); @@ -793,6 +815,12 @@ int main(int argc, char *argv[]) else { const dictionary& patchSource = dict.subDict("patchPairs"); + bool groupBase = false; + if (patchSource.found("groupBase")) + { + groupBase = readBool(patchSource.lookup("groupBase")); + } + const word& groupName = selectors[selectorI].name(); if (patchSource.found("patchFields")) @@ -801,23 +829,51 @@ int main(int argc, char *argv[]) ( "patchFields" ); - // Add coupleGroup to all entries - forAllIter(dictionary, patchFieldsDict, iter) + + if (!groupBase) { - if (iter().isDict()) + // Add coupleGroup to all entries + forAllIter(dictionary, patchFieldsDict, iter) { - dictionary& dict = iter().dict(); - dict.set("coupleGroup", groupName); + if (iter().isDict()) + { + dictionary& dict = iter().dict(); + dict.set("coupleGroup", groupName); + } + } + + const labelList& patchIDs = + pbm.groupPatchIDs()[groupName]; + + forAll(patchIDs, i) + { + fvMeshTools::setPatchFields + ( + mesh, + patchIDs[i], + patchFieldsDict + ); } } - - const labelList& patchIDs = pbm.groupPatchIDs()[groupName]; - forAll(patchIDs, i) + else { + const word masterPatchName(groupName + "_master"); + const word slavePatchName(groupName + "_slave"); + + label patchIMaster = pbm.findPatchID(masterPatchName); + label patchISlave = pbm.findPatchID(slavePatchName); + fvMeshTools::setPatchFields ( mesh, - patchIDs[i], + patchIMaster, + patchFieldsDict + ); + + fvMeshTools::setPatchFields + ( + mesh, + patchISlave, patchFieldsDict ); } diff --git a/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.C b/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.C index 970e0dac47..ca87555627 100644 --- a/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.C +++ b/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.C @@ -43,6 +43,39 @@ defineTypeNameAndDebug(extrudePatchMesh, 0); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +extrudePatchMesh::extrudePatchMesh +( + const fvMesh& mesh, + const fvPatch& patch, + const dictionary& dict, + const word regionName, + const List& regionPatches +) +: + fvMesh + ( + IOobject + ( + regionName, + mesh.facesInstance(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE, + true + ), + xferCopy(pointField()), + xferCopy(faceList()), + xferCopy(labelList()), + xferCopy(labelList()), + false + ), + extrudedPatch_(patch.patch()), + dict_(dict) +{ + extrudeMesh(regionPatches); +} + + extrudePatchMesh::extrudePatchMesh ( const fvMesh& mesh, @@ -68,11 +101,59 @@ extrudePatchMesh::extrudePatchMesh xferCopy(labelList()), false ), - extrudedPatch_(patch.patch()) + extrudedPatch_(patch.patch()), + dict_(dict) +{ + + List regionPatches(3); + List patchNames(regionPatches.size()); + List patchTypes(regionPatches.size()); + PtrList dicts(regionPatches.size()); + + forAll (dicts, patchI) + { + if (!dicts.set(patchI)) + { + dicts.set(patchI, new dictionary()); + } + } + + dicts[bottomPatchID] = dict_.subDict("bottomCoeffs"); + dicts[sidePatchID] = dict_.subDict("sideCoeffs"); + dicts[topPatchID] = dict_.subDict("topCoeffs"); + + forAll (dicts, patchI) + { + dicts[patchI].lookup("name") >> patchNames[patchI]; + dicts[patchI].lookup("type") >> patchTypes[patchI]; + } + + forAll (regionPatches, patchI) + { + dictionary& patchDict = dicts[patchI]; + patchDict.set("nFaces", 0); + patchDict.set("startFace", 0); + + regionPatches[patchI] = polyPatch::New + ( + patchNames[patchI], + patchDict, + patchI, + mesh.boundaryMesh() + ).ptr(); + + } + + extrudeMesh(regionPatches); + +} + + +void extrudePatchMesh::extrudeMesh(const List& regionPatches) { if (this->boundaryMesh().size() == 0) { - bool columnCells = readBool(dict.lookup("columnCells")); + bool columnCells = readBool(dict_.lookup("columnCells")); PackedBoolList nonManifoldEdge(extrudedPatch_.nEdges()); for (label edgeI = 0; edgeI < extrudedPatch_.nInternalEdges(); edgeI++) @@ -83,7 +164,7 @@ extrudePatchMesh::extrudePatchMesh } } - autoPtr model_(extrudeModel::New(dict)); + autoPtr model_(extrudeModel::New(dict_)); faceList pointGlobalRegions; faceList pointLocalRegions; @@ -180,7 +261,7 @@ extrudePatchMesh::extrudePatchMesh pointLocalRegions, localRegionPoints ); - +/* List regionPatches(3); List patchNames(regionPatches.size()); List patchTypes(regionPatches.size()); @@ -194,9 +275,9 @@ extrudePatchMesh::extrudePatchMesh } } - dicts[bottomPatchID] = dict.subDict("bottomCoeffs"); - dicts[sidePatchID] = dict.subDict("sideCoeffs"); - dicts[topPatchID] = dict.subDict("topCoeffs"); + dicts[bottomPatchID] = dict_.subDict("bottomCoeffs"); + dicts[sidePatchID] = dict_.subDict("sideCoeffs"); + dicts[topPatchID] = dict_.subDict("topCoeffs"); forAll (dicts, patchI) { @@ -219,7 +300,7 @@ extrudePatchMesh::extrudePatchMesh ).ptr(); } - +*/ this->clearOut(); this->removeFvBoundary(); this->addFvPatches(regionPatches, true); diff --git a/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.H b/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.H index 0ced75eec6..6fc480b1bd 100644 --- a/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.H +++ b/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.H @@ -105,6 +105,15 @@ private: //- Const reference to the patch from which this mesh is extruded const polyPatch& extrudedPatch_; + //- Model dictionary + dictionary dict_; + + + // Private member functions + + //- Extrude mesh using polyPatches + void extrudeMesh(const List& regionPatches); + public: @@ -123,6 +132,17 @@ public: const word ); + //- Construct from mesh, patch, dictionary and new mesh + // polyPatch information + extrudePatchMesh + ( + const fvMesh&, + const fvPatch&, + const dictionary&, + const word, + const List& polyPatches + ); + //- Destructor virtual ~extrudePatchMesh(); diff --git a/src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.C b/src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.C index 027336f2e6..aa3195cc6c 100644 --- a/src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.C +++ b/src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.C @@ -25,6 +25,9 @@ License #include "thermalBaffleFvPatchScalarField.H" #include "addToRunTimeSelectionTable.H" +#include "emptyPolyPatch.H" +#include "polyPatch.H" +#include "mappedWallPolyPatch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -114,17 +117,6 @@ thermalBaffleFvPatchScalarField owner_ = true; baffle_->rename(baffleName); } - else if //Backwards compatibility (if region exists) - ( - thisMesh.time().foundObject(regionName) - && baffle_.empty() - && regionName != "none" - ) - { - baffle_.reset(baffle::New(thisMesh, dict).ptr()); - owner_ = true; - baffle_->rename(baffleName); - } } } @@ -168,19 +160,79 @@ void thermalBaffleFvPatchScalarField::rmap void thermalBaffleFvPatchScalarField::createPatchMesh() { - const fvMesh& defaultRegion = - db().time().lookupObject(fvMesh::defaultRegion); + + const fvMesh& thisMesh = patch().boundaryMesh().mesh(); word regionName = dict_.lookup("regionName"); + List regionPatches(3); + List patchNames(regionPatches.size()); + List patchTypes(regionPatches.size()); + List dicts(regionPatches.size()); + + patchNames[bottomPatchID] = word("bottom"); + patchNames[sidePatchID] = word("side"); + patchNames[topPatchID] = word("top"); + + patchTypes[bottomPatchID] = mappedWallPolyPatch::typeName; + patchTypes[topPatchID] = mappedWallPolyPatch::typeName; + + if (readBool(dict_.lookup("columnCells"))) + { + patchTypes[sidePatchID] = emptyPolyPatch::typeName; + } + else + { + patchTypes[sidePatchID] = polyPatch::typeName; + } + + const mappedPatchBase& mpp = + refCast(patch().patch()); + + const word coupleGroup(mpp.coupleGroup()); + + wordList inGroups(1); + inGroups[0] = coupleGroup; + + dicts[bottomPatchID].add("coupleGroup", coupleGroup); + dicts[bottomPatchID].add("inGroups", inGroups); + dicts[bottomPatchID].add("sampleMode", mpp.sampleModeNames_[mpp.mode()]); + + const label sepPos = coupleGroup.find('_'); + + const word coupleGroupSlave = coupleGroup(0, sepPos) + "_slave"; + + inGroups[0] = coupleGroupSlave; + dicts[topPatchID].add("coupleGroup", coupleGroupSlave); + dicts[topPatchID].add("inGroups", inGroups); + dicts[topPatchID].add("sampleMode", mpp.sampleModeNames_[mpp.mode()]); + + + forAll (regionPatches, patchI) + { + dictionary& patchDict = dicts[patchI]; + patchDict.set("nFaces", 0); + patchDict.set("startFace", 0); + + regionPatches[patchI] = polyPatch::New + ( + patchTypes[patchI], + patchNames[patchI], + dicts[patchI], + patchI, + thisMesh.boundaryMesh() + ).ptr(); + } + extrudeMeshPtr_.reset ( new extrudePatchMesh ( - defaultRegion, + thisMesh, patch(), dict_, - regionName + regionName, + regionPatches ) ); diff --git a/src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.H b/src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.H index 543df2e39b..7516656350 100644 --- a/src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.H +++ b/src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.H @@ -182,6 +182,14 @@ class thermalBaffleFvPatchScalarField { // Private data + //- Enumeration of patch IDs + enum patchID + { + bottomPatchID, + topPatchID, + sidePatchID + }; + //- Is the baffle owner bool owner_; diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C index 862d4ee6be..bd27dc874d 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.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 @@ -47,7 +47,7 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField : mixedFvPatchScalarField(p, iF), temperatureCoupledBase(patch(), "undefined", "undefined-K"), - neighbourFieldName_("undefined-neighbourFieldName") + TnbrName_("undefined-Tnbr") { this->refValue() = 0.0; this->refGrad() = 0.0; @@ -66,7 +66,7 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField : mixedFvPatchScalarField(ptf, p, iF, mapper), temperatureCoupledBase(patch(), ptf.KMethod(), ptf.kappaName()), - neighbourFieldName_(ptf.neighbourFieldName_) + TnbrName_(ptf.TnbrName_) {} @@ -80,7 +80,7 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField : mixedFvPatchScalarField(p, iF), temperatureCoupledBase(patch(), dict), - neighbourFieldName_(dict.lookup("neighbourFieldName")) + TnbrName_(dict.lookup("neighbourFieldName")) { if (!isA(this->patch().patch())) { @@ -129,7 +129,7 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField : mixedFvPatchScalarField(wtcsf, iF), temperatureCoupledBase(patch(), wtcsf.KMethod(), wtcsf.kappaName()), - neighbourFieldName_(wtcsf.neighbourFieldName_) + TnbrName_(wtcsf.TnbrName_) {} @@ -169,7 +169,7 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs() ( nbrPatch.lookupPatchField ( - neighbourFieldName_ + TnbrName_ ) ); @@ -237,7 +237,7 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::write ) const { mixedFvPatchScalarField::write(os); - os.writeKeyword("neighbourFieldName")<< neighbourFieldName_ + os.writeKeyword("TnbrName")<< TnbrName_ << token::END_STATEMENT << nl; temperatureCoupledBase::write(os); } diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.H b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.H index e9fc1f84ae..60e61d9d0f 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.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 @@ -89,7 +89,7 @@ class turbulentTemperatureCoupledBaffleMixedFvPatchScalarField // Private data //- Name of field on the neighbour region - const word neighbourFieldName_; + const word TnbrName_; public: diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C index 137db852d4..6d512d50bd 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.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 @@ -84,9 +84,9 @@ turbulentTemperatureRadCoupledMixedFvPatchScalarField : mixedFvPatchScalarField(p, iF), temperatureCoupledBase(patch(), dict), - TnbrName_(dict.lookup("Tnbr")), - QrNbrName_(dict.lookup("QrNbr")), - QrName_(dict.lookup("Qr")) + TnbrName_(dict.lookupOrDefault("Tnbr", "T")), + QrNbrName_(dict.lookupOrDefault("QrNbr", "none")), + QrName_(dict.lookupOrDefault("Qr", "none")) { if (!isA(this->patch().patch())) { diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/baffle3DRegion/T b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/baffle3DRegion/T index 2c6bde2e11..656062e8a9 100644 --- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/baffle3DRegion/T +++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/baffle3DRegion/T @@ -24,11 +24,8 @@ boundaryField bottom { type compressible::thermalBaffle; - Tnbr T; kappa solidThermo; kappaName none; - QrNbr none; - Qr none; value uniform 300; } side @@ -38,11 +35,8 @@ boundaryField top { type compressible::thermalBaffle; - Tnbr T; kappa solidThermo; kappaName none; - QrNbr none; - Qr none; value uniform 300; } } diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/include/3DBaffle/3DTemperatureMasterBafflePatches b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/include/3DBaffle/3DTemperatureMasterBafflePatches index 17ab57161f..a068b051ba 100644 --- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/include/3DBaffle/3DTemperatureMasterBafflePatches +++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/include/3DBaffle/3DTemperatureMasterBafflePatches @@ -9,15 +9,10 @@ T { type compressible::thermalBaffle; - Tnbr T; kappa fluidThermo; kappaName none; - QrNbr none; - Qr none; value uniform 300; - // Thermo baffle model - //thermalBaffleModel thermalBaffle; regionName ${baffleRegionName}; active yes; @@ -26,33 +21,6 @@ T // New fvMesh (region) information # include "extrudeModel" - - // New mesh polyPatch information - bottomCoeffs - { - name "bottom"; - type mappedWall; - sampleMode nearestPatchFace; - samplePatch ${masterPatchName}; - offsetMode uniform; - offset (0 0 0); - } - - topCoeffs - { - name "top"; - type mappedWall; - sampleMode nearestPatchFace; - samplePatch ${slavePatchName}; - offsetMode uniform; - offset (0 0 0); - } - - sideCoeffs - { - name "side"; - type patch; - } } // ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/createBafflesDict b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/createBafflesDict index fe16ef97a2..2aed1e32a6 100644 --- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/createBafflesDict +++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/createBafflesDict @@ -48,47 +48,16 @@ baffles surface triSurfaceMesh; name baffle3D.stl; - patches + patchPairs { - master + type mappedWall; + sampleMode nearestPatchFace; + //Group master and slave in different groups. (default off) + groupBase on; + patchFields { - //- Master side patch - name ${masterPatchName}; - - type mappedWall; - inGroups (baffleWallGroup); - - sampleMode nearestPatchFace; - sampleRegion ${baffleRegionName}; - samplePatch bottom; - offsetMode uniform; - offset (0 0 0); - - patchFields - { - #include "./0/include/wallBafflePatches" - #include "./0/include/3DBaffle/3DTemperatureMasterBafflePatches" - } - } - slave - { - //- Slave side patch - name ${slavePatchName}; - - type mappedWall; - inGroups (baffleWallGroup); - - sampleMode nearestPatchFace; - sampleRegion ${baffleRegionName}; - samplePatch top; - offsetMode uniform; - offset (0 0 0); - - patchFields - { - #include "./0/include/wallBafflePatches" - #include "./0/include/3DBaffle/3DTemperatureSlaveBafflePatches" - } + #include "./0/include/wallBafflePatches" + #include "./0/include/3DBaffle/3DTemperatureMasterBafflePatches" } } } From 8f9450008e5e16f91148518d2700ce83e61bf008 Mon Sep 17 00:00:00 2001 From: Sergio Ferraris Date: Wed, 4 Dec 2013 15:34:26 +0000 Subject: [PATCH 07/28] ENH: Remove unused files 1DTemperatureSlaveBafflePatches and 3DTemperatureSlaveBafflePatches --- .../1DBaffle/1DTemperatureSlaveBafflePatches | 16 --------------- .../3DBaffle/3DTemperatureSlaveBafflePatches | 20 ------------------- 2 files changed, 36 deletions(-) delete mode 100644 tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/include/1DBaffle/1DTemperatureSlaveBafflePatches delete mode 100644 tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/include/3DBaffle/3DTemperatureSlaveBafflePatches diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/include/1DBaffle/1DTemperatureSlaveBafflePatches b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/include/1DBaffle/1DTemperatureSlaveBafflePatches deleted file mode 100644 index eafad0fe98..0000000000 --- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/include/1DBaffle/1DTemperatureSlaveBafflePatches +++ /dev/null @@ -1,16 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -T -{ - type compressible::thermalBaffle1D; - samplePatch baffle1DWall_master; - value uniform 300; -} - -// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/include/3DBaffle/3DTemperatureSlaveBafflePatches b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/include/3DBaffle/3DTemperatureSlaveBafflePatches deleted file mode 100644 index 9ca00a628f..0000000000 --- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/include/3DBaffle/3DTemperatureSlaveBafflePatches +++ /dev/null @@ -1,20 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -T -{ - type compressible::thermalBaffle; - Tnbr T; - kappa fluidThermo; - kappaName none; - QrNbr none; - Qr none; - value uniform 300; -} - -// ************************************************************************* // From 6d00e12fe41a002054e0adef0c02ba82ad921a41 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 4 Dec 2013 15:44:02 +0000 Subject: [PATCH 08/28] ENH: timeVarying: print perturb only if non-default --- .../timeVaryingMappedFixedValueFvPatchField.C | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C index a7205577f3..f93817c3c7 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C @@ -536,7 +536,8 @@ void timeVaryingMappedFixedValueFvPatchField::updateCoeffs() if (debug) { Pout<< "updateCoeffs : set fixedValue to min:" << gMin(*this) - << " max:" << gMax(*this) << endl; + << " max:" << gMax(*this) + << " avg:" << gAverage(*this) << endl; } fixedValueFvPatchField::updateCoeffs(); @@ -548,7 +549,10 @@ void timeVaryingMappedFixedValueFvPatchField::write(Ostream& os) const { fvPatchField::write(os); os.writeKeyword("setAverage") << setAverage_ << token::END_STATEMENT << nl; - os.writeKeyword("perturb") << perturb_ << token::END_STATEMENT << nl; + if (perturb_ != 1e-5) + { + os.writeKeyword("perturb") << perturb_ << token::END_STATEMENT << nl; + } if (fieldTableName_ != this->dimensionedInternalField().name()) { From 55b13d854fa07dbcc084c150aa3519a49b6033d1 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 4 Dec 2013 15:45:05 +0000 Subject: [PATCH 09/28] ENH: pointToPointInterpolation: enhanced debug printing --- .../pointToPointPlanarInterpolation.C | 70 +++++++++++-------- 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C index a850308c6e..1f7de7c58c 100644 --- a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C +++ b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C @@ -210,37 +210,45 @@ void Foam::pointToPointPlanarInterpolation::calcWeights nearestVertexWeight_ ); - //if (debug) - //{ - // forAll(sourcePoints, i) - // { - // Pout<< "source:" << i << " at:" << sourcePoints[i] - // << " 2d:" << localVertices[i] - // << endl; - // } - // - // - // forAll(destPoints, i) - // { - // label v0 = nearestVertex_[i][0]; - // label v1 = nearestVertex_[i][1]; - // label v2 = nearestVertex_[i][2]; - // - // Pout<< "For location " << destPoints[i] - // << " 2d:" << localFaceCentres[i] - // << " sampling vertices" << nl - // << " " << v0 - // << " at:" << sourcePoints[v0] - // << " weight:" << nearestVertexWeight_[i][0] << nl - // << " " << v1 - // << " at:" << sourcePoints[v1] - // << " weight:" << nearestVertexWeight_[i][1] << nl - // << " " << v2 - // << " at:" << sourcePoints[v2] - // << " weight:" << nearestVertexWeight_[i][2] << nl - // << endl; - // } - //} + if (debug) + { + forAll(sourcePoints, i) + { + Pout<< "source:" << i << " at:" << sourcePoints[i] + << " 2d:" << localVertices[i] + << endl; + } + + + forAll(destPoints, i) + { + label v0 = nearestVertex_[i][0]; + label v1 = nearestVertex_[i][1]; + label v2 = nearestVertex_[i][2]; + + Pout<< "For location " << destPoints[i] + << " 2d:" << localFaceCentres[i] + << " sampling vertices" << nl + << " " << v0 + << " at:" << sourcePoints[v0] + << " weight:" << nearestVertexWeight_[i][0] << nl; + + if (v1 != -1) + { + Pout<< " " << v1 + << " at:" << sourcePoints[v1] + << " weight:" << nearestVertexWeight_[i][1] << nl; + } + if (v2 != -1) + { + Pout<< " " << v2 + << " at:" << sourcePoints[v2] + << " weight:" << nearestVertexWeight_[i][2] << nl; + } + + Pout<< endl; + } + } } From 15f34ee839be3801283bb56e2a0df22d9e234d6a Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 4 Dec 2013 15:46:20 +0000 Subject: [PATCH 10/28] ENH: timeVaryingMapped: added offset like fvPatchField variant --- ...meVaryingMappedFixedValuePointPatchField.C | 56 ++++++++++++++++--- ...meVaryingMappedFixedValuePointPatchField.H | 4 ++ 2 files changed, 52 insertions(+), 8 deletions(-) diff --git a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C index cf1b18b89d..bbbc75f396 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C @@ -48,8 +48,8 @@ timeVaryingMappedFixedValuePointPatchField startAverage_(pTraits::zero), endSampleTime_(-1), endSampledValues_(0), - endAverage_(pTraits::zero) - + endAverage_(pTraits::zero), + offset_() {} @@ -75,7 +75,13 @@ timeVaryingMappedFixedValuePointPatchField startAverage_(pTraits::zero), endSampleTime_(-1), endSampledValues_(0), - endAverage_(pTraits::zero) + endAverage_(pTraits::zero), + offset_ + ( + ptf.offset_.valid() + ? ptf.offset_().clone().ptr() + : NULL + ) {} @@ -100,8 +106,14 @@ timeVaryingMappedFixedValuePointPatchField startAverage_(pTraits::zero), endSampleTime_(-1), endSampledValues_(0), - endAverage_(pTraits::zero) + endAverage_(pTraits::zero), + offset_() { + if (dict.found("offset")) + { + offset_ = DataEntry::New("offset", dict); + } + dict.readIfPresent("fieldTableName", fieldTableName_); if (dict.found("value")) @@ -141,7 +153,13 @@ timeVaryingMappedFixedValuePointPatchField startAverage_(ptf.startAverage_), endSampleTime_(ptf.endSampleTime_), endSampledValues_(ptf.endSampledValues_), - endAverage_(ptf.endAverage_) + endAverage_(ptf.endAverage_), + offset_ + ( + ptf.offset_.valid() + ? ptf.offset_().clone().ptr() + : NULL + ) {} @@ -165,7 +183,13 @@ timeVaryingMappedFixedValuePointPatchField startAverage_(ptf.startAverage_), endSampleTime_(ptf.endSampleTime_), endSampledValues_(ptf.endSampledValues_), - endAverage_(ptf.endAverage_) + endAverage_(ptf.endAverage_), + offset_ + ( + ptf.offset_.valid() + ? ptf.offset_().clone().ptr() + : NULL + ) {} @@ -532,10 +556,18 @@ void Foam::timeVaryingMappedFixedValuePointPatchField::updateCoeffs() } } + // apply offset to mapped values + if (offset_.valid()) + { + const scalar t = this->db().time().timeOutputValue(); + this->operator==(*this + offset_->value(t)); + } + if (debug) { Pout<< "updateCoeffs : set fixedValue to min:" << gMin(*this) - << " max:" << gMax(*this) << endl; + << " max:" << gMax(*this) + << " avg:" << gAverage(*this) << endl; } fixedValuePointPatchField::updateCoeffs(); @@ -550,13 +582,21 @@ void Foam::timeVaryingMappedFixedValuePointPatchField::write { fixedValuePointPatchField::write(os); os.writeKeyword("setAverage") << setAverage_ << token::END_STATEMENT << nl; - os.writeKeyword("perturb") << perturb_ << token::END_STATEMENT << nl; + if (perturb_ != 1e-5) + { + os.writeKeyword("perturb") << perturb_ << token::END_STATEMENT << nl; + } if (fieldTableName_ != this->dimensionedInternalField().name()) { os.writeKeyword("fieldTableName") << fieldTableName_ << token::END_STATEMENT << nl; } + + if (offset_.valid()) + { + offset_->writeData(os); + } } diff --git a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.H b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.H index 942dc3e4a6..ed87fa4c54 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.H +++ b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.H @@ -41,6 +41,7 @@ SourceFiles #include "fixedValuePointPatchField.H" #include "instantList.H" #include "pointToPointPlanarInterpolation.H" +#include "DataEntry.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -91,6 +92,9 @@ class timeVaryingMappedFixedValuePointPatchField //- If setAverage: end average value Type endAverage_; + //- Time varying offset values to interpolated data + autoPtr > offset_; + public: From a7799adeb8696712d80d76d0d3b7d497515fb3d3 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 4 Dec 2013 15:47:42 +0000 Subject: [PATCH 11/28] ENH: snappyHexMeshDict: added new settings --- .../mesh/generation/snappyHexMesh/snappyHexMeshDict | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index 507891d356..87922d974d 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -401,7 +401,7 @@ addLayersControls // Angle used to pick up medial axis points // Note: changed(corrected) w.r.t 17x! 90 degrees corresponds to 130 // in 17x. - minMedianAxisAngle 90; + minMedialAxisAngle 90; // Reduce layer growth where ratio thickness to medial // distance is large @@ -414,6 +414,9 @@ addLayersControls // default is 0. nSmoothDisplacement 90; + // Optional: limit the number of steps walking away from the surface + nMedialAxisIter 10; + // Mesh shrinking From a5ebecbd3ace46ed9c4e370c0519b40bbed216e3 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 4 Dec 2013 15:48:32 +0000 Subject: [PATCH 12/28] ENH:foamJob: handling of quotes (from Mantis) --- bin/foamJob | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/bin/foamJob b/bin/foamJob index 4eda40490e..20793c3d52 100755 --- a/bin/foamJob +++ b/bin/foamJob @@ -3,7 +3,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 @@ -50,6 +50,28 @@ USAGE exit 1 } +#for being able to echo strings that have single quotes +echoArgs() { + addSpace="" + + for stringItem in "$@"; do + + echo -n "${addSpace}" + + if [ "${stringItem##* }" = "$stringItem" ] + then + echo -n "$stringItem" + addSpace=" " + else + echo -n "'$stringItem'" + addSpace=" " + fi + + done + + unset stringItem addSpace +} + unset version # replacement for possibly buggy 'which' @@ -217,11 +239,11 @@ then # if [ "$screenOpt" = true ] then - echo "Executing: $mpirun $mpiopts $APPLICATION $@ -parallel | tee log" - $mpirun $mpiopts $APPLICATION $@ -parallel | tee log + echo "Executing: $mpirun $mpiopts $APPLICATION $(echoArgs "$@") -parallel | tee log" + $mpirun $mpiopts $APPLICATION "$@" -parallel | tee log else - echo "Executing: $mpirun $mpiopts $APPLICATION $@ -parallel > log 2>&1" - $mpirun $mpiopts $APPLICATION $@ -parallel > log 2>&1 & + echo "Executing: $mpirun $mpiopts $APPLICATION $(echoArgs "$@") -parallel > log 2>&1" + $mpirun $mpiopts $APPLICATION "$@" -parallel > log 2>&1 & fi else @@ -230,12 +252,12 @@ else # if [ "$screenOpt" = true ] then - echo "Executing: $APPLICATION $@ | tee log &" - $APPLICATION $@ | tee log & + echo "Executing: $APPLICATION $(echoArgs "$@") | tee log &" + $APPLICATION "$@" | tee log & wait $! else - echo "Executing: $APPLICATION $@ > log 2>&1 &" - $APPLICATION $@ > log 2>&1 & + echo "Executing: $APPLICATION $(echoArgs "$@") > log 2>&1 &" + $APPLICATION "$@" > log 2>&1 & fi fi From bab168b5af3c28dc77cabcc8d5f666b827a5d72f Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 4 Dec 2013 15:55:39 +0000 Subject: [PATCH 13/28] ENH: pointConstraints: make polyMesh meshObject (since pointMeshes not currently updated!) --- .../motionSmoother/motionSmootherAlgo.C | 12 ++++---- .../motionSmootherAlgoTemplates.C | 4 +-- .../volPointInterpolation/pointConstraints.C | 28 +++++++++++-------- .../volPointInterpolation/pointConstraints.H | 11 ++++++-- .../pointConstraintsTemplates.C | 7 ++++- .../volPointInterpolate.C | 2 +- .../volPointInterpolation.C | 2 +- 7 files changed, 42 insertions(+), 24 deletions(-) diff --git a/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C b/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C index b6c1bd183c..a953c66ea6 100644 --- a/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C +++ b/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C @@ -169,7 +169,7 @@ void Foam::motionSmootherAlgo::minSmooth } // Single and multi-patch constraints - pointConstraints::New(newFld.mesh()).constrain(newFld, false); + pointConstraints::New(mesh()).constrain(newFld, false); } @@ -202,7 +202,7 @@ void Foam::motionSmootherAlgo::minSmooth } // Single and multi-patch constraints - pointConstraints::New(newFld.mesh()).constrain(newFld, false); + pointConstraints::New(mesh()).constrain(newFld, false); } @@ -224,7 +224,7 @@ void Foam::motionSmootherAlgo::scaleField } // Single and multi-patch constraints - pointConstraints::New(fld.mesh()).constrain(fld, false); + pointConstraints::New(mesh()).constrain(fld, false); } @@ -266,7 +266,7 @@ void Foam::motionSmootherAlgo::subtractField } // Single and multi-patch constraints - pointConstraints::New(fld.mesh()).constrain(fld); + pointConstraints::New(mesh()).constrain(fld); } @@ -476,7 +476,7 @@ void Foam::motionSmootherAlgo::setDisplacementPatchFields } // Multi-patch constraints - pointConstraints::New(displacement.mesh()).constrainCorners(displacement); + pointConstraints::New(displacement.mesh()()).constrainCorners(displacement); // Adapt the fixedValue bc's (i.e. copy internal point data to // boundaryField for all affected patches) to take the changes caused @@ -622,7 +622,7 @@ void Foam::motionSmootherAlgo::correctBoundaryConditions } // Multi-patch constraints - pointConstraints::New(displacement.mesh()).constrainCorners(displacement); + pointConstraints::New(displacement.mesh()()).constrainCorners(displacement); // Correct for problems introduced by corner constraints syncTools::syncPointList diff --git a/src/dynamicMesh/motionSmoother/motionSmootherAlgoTemplates.C b/src/dynamicMesh/motionSmoother/motionSmootherAlgoTemplates.C index fa847ff328..f78a11a9a3 100644 --- a/src/dynamicMesh/motionSmoother/motionSmootherAlgoTemplates.C +++ b/src/dynamicMesh/motionSmoother/motionSmootherAlgoTemplates.C @@ -229,7 +229,7 @@ Foam::motionSmootherAlgo::avg } // Single and multi-patch constraints - pointConstraints::New(res.mesh()).constrain(res, false); + pointConstraints::New(mesh).constrain(res, false); return tres; } @@ -256,7 +256,7 @@ void Foam::motionSmootherAlgo::smooth } // Single and multi-patch constraints - pointConstraints::New(newFld.mesh()).constrain(newFld, false); + pointConstraints::New(mesh_).constrain(newFld, false); } diff --git a/src/finiteVolume/interpolation/volPointInterpolation/pointConstraints.C b/src/finiteVolume/interpolation/volPointInterpolation/pointConstraints.C index bb370fffb8..5bc4d56e94 100644 --- a/src/finiteVolume/interpolation/volPointInterpolation/pointConstraints.C +++ b/src/finiteVolume/interpolation/volPointInterpolation/pointConstraints.C @@ -51,11 +51,11 @@ void pointConstraints::makePatchPatchAddressing() << endl; } - const pointMesh& pMesh = mesh(); - const polyMesh& mesh = pMesh(); + //const polyMesh& mesh = mesh(); + const pointMesh& pMesh = pointMesh::New(mesh()); const pointBoundaryMesh& pbm = pMesh.boundary(); - const polyBoundaryMesh& bm = mesh.boundaryMesh(); + const polyBoundaryMesh& bm = mesh().boundaryMesh(); // first count the total number of patch-patch points @@ -146,7 +146,7 @@ void pointConstraints::makePatchPatchAddressing() // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ { - const globalMeshData& gd = mesh.globalData(); + const globalMeshData& gd = mesh().globalData(); const labelListList& globalPointSlaves = gd.globalPointSlaves(); const mapDistribute& globalPointSlavesMap = gd.globalPointSlavesMap(); const Map