From 60ff30a5d7b6b3b3919e1943f3ea9db05aa22fff Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 4 Jul 2011 11:54:30 +0100 Subject: [PATCH 01/54] STYLE: corrected poor formatting --- .../pairPatchAgglomeration.C | 67 ++++++++++--------- .../pairPatchAgglomeration.H | 5 +- 2 files changed, 38 insertions(+), 34 deletions(-) diff --git a/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.C b/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.C index 12946afadf..372d6deacc 100644 --- a/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.C +++ b/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.C @@ -25,6 +25,7 @@ License #include "pairPatchAgglomeration.H" #include "meshTools.H" +#include "unitConversion.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -53,7 +54,7 @@ void Foam::pairPatchAgglomeration::setBasedEdgeWeights() const bPatch& coarsePatch = patchLevels_[0]; forAll(coarsePatch.edges(), i) { - if(coarsePatch.isInternalEdge(i)) + if (coarsePatch.isInternalEdge(i)) { scalar edgeLength = coarsePatch.edges()[i].mag(coarsePatch.localPoints()); @@ -63,12 +64,12 @@ void Foam::pairPatchAgglomeration::setBasedEdgeWeights() if (eFaces.size() == 2) { scalar cosI = - coarsePatch.faceNormals()[eFaces[0]] & - coarsePatch.faceNormals()[eFaces[1]]; + coarsePatch.faceNormals()[eFaces[0]] + & coarsePatch.faceNormals()[eFaces[1]]; const edge edgeCommon = edge(eFaces[0], eFaces[1]); - if(facePairWeight_.found(edgeCommon)) + if (facePairWeight_.found(edgeCommon)) { facePairWeight_[edgeCommon] += edgeLength; } @@ -77,14 +78,7 @@ void Foam::pairPatchAgglomeration::setBasedEdgeWeights() facePairWeight_.insert(edgeCommon, edgeLength); } - if - ( - cosI < - Foam::cos - ( - featureAngle_*constant::mathematical::pi/180.0 - ) - ) + if (cosI < Foam::cos(degToRad(featureAngle_))) { facePairWeight_[edgeCommon] = -1.0; } @@ -109,11 +103,8 @@ void Foam::pairPatchAgglomeration::setEdgeWeights const bPatch& coarsePatch = patchLevels_[fineLevelIndex]; const labelList& fineToCoarse = restrictAddressing_[fineLevelIndex]; - const label nCoarseI = max(fineToCoarse)+1; - labelListList coarseToFine - ( - invertOneToMany(nCoarseI, fineToCoarse) - ); + const label nCoarseI = max(fineToCoarse) + 1; + labelListList coarseToFine(invertOneToMany(nCoarseI, fineToCoarse)); HashSet > fineFeaturedFaces(coarsePatch.nEdges()/10); @@ -138,7 +129,7 @@ void Foam::pairPatchAgglomeration::setEdgeWeights forAll(coarsePatch.edges(), i) { - if(coarsePatch.isInternalEdge(i)) + if (coarsePatch.isInternalEdge(i)) { scalar edgeLength = coarsePatch.edges()[i].mag(coarsePatch.localPoints()); @@ -148,7 +139,7 @@ void Foam::pairPatchAgglomeration::setEdgeWeights if (eFaces.size() == 2) { const edge edgeCommon = edge(eFaces[0], eFaces[1]); - if(facePairWeight_.found(edgeCommon)) + if (facePairWeight_.found(edgeCommon)) { facePairWeight_[edgeCommon] += edgeLength; } @@ -220,11 +211,13 @@ Foam::pairPatchAgglomeration::pairPatchAgglomeration setBasedEdgeWeights(); } + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::pairPatchAgglomeration::~pairPatchAgglomeration() {} + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // const Foam::bPatch& Foam::pairPatchAgglomeration::patchLevel @@ -259,8 +252,15 @@ bool Foam::pairPatchAgglomeration::agglomeratePatch { if (min(fineToCoarse) == -1) { - FatalErrorIn("pairPatchAgglomeration::agglomeratePatch") - << "min(fineToCoarse) == -1" << exit(FatalError); + FatalErrorIn + ( + "pairPatchAgglomeration::agglomeratePatch" + "(" + "const bPatch&, " + "const labelList&, " + "const label" + ")" + ) << "min(fineToCoarse) == -1" << exit(FatalError); } if (fineToCoarse.size() != patch.size()) @@ -268,7 +268,11 @@ bool Foam::pairPatchAgglomeration::agglomeratePatch FatalErrorIn ( "pairPatchAgglomeration::agglomeratePatch" - "(const label fineLevelIndex)" + "(" + "const bPatch&, " + "const labelList&, " + "const label" + ")" ) << "restrict map does not correspond to fine level. " << endl << " Sizes: restrictMap: " << fineToCoarse.size() << " nEqns: " << patch.size() @@ -279,10 +283,7 @@ bool Foam::pairPatchAgglomeration::agglomeratePatch List patchFaces(nCoarseI); // Patch faces per agglomeration - labelListList coarseToFine - ( - invertOneToMany(nCoarseI, fineToCoarse) - ); + labelListList coarseToFine(invertOneToMany(nCoarseI, fineToCoarse)); for (label coarseI = 0; coarseI < nCoarseI; coarseI++) { @@ -371,7 +372,7 @@ void Foam::pairPatchAgglomeration:: agglomerate() restrictAddressing_.set(nCreatedLevels, finalAgglomPtr); mapBaseToTopAgglom(nCreatedLevels); - if(!continueAgglomerating(nCoarseCells)) + if (!continueAgglomerating(nCoarseCells)) { break; } @@ -407,7 +408,7 @@ Foam::tmp Foam::pairPatchAgglomeration::agglomerateOneLevel nCoarseCells = 0; - forAll (faceFaces, facei) + forAll(faceFaces, facei) { const labelList& fFaces = faceFaces[facei]; @@ -425,8 +426,8 @@ Foam::tmp Foam::pairPatchAgglomeration::agglomerateOneLevel if ( facePairWeight_[edgeCommon] > maxFaceWeight - && coarseCellMap[faceNeig] < 0 - && facePairWeight_[edgeCommon] != -1.0 + && coarseCellMap[faceNeig] < 0 + && facePairWeight_[edgeCommon] != -1.0 ) { // Match found. Pick up all the necessary data @@ -472,7 +473,8 @@ Foam::tmp Foam::pairPatchAgglomeration::agglomerateOneLevel coarseCellMap[facei] = coarseCellMap[clusterMatchFaceNo]; } else - {// if not create single-cell "clusters" for each + { + // if not create single-cell "clusters" for each coarseCellMap[facei] = nCoarseCells; nCoarseCells ++; } @@ -499,6 +501,7 @@ Foam::tmp Foam::pairPatchAgglomeration::agglomerateOneLevel return tcoarseCellMap; } + void Foam::pairPatchAgglomeration::combineLevels(const label curLevel) { label prevLevel = curLevel - 1; @@ -522,4 +525,6 @@ void Foam::pairPatchAgglomeration::combineLevels(const label curLevel) patchLevels_.set(prevLevel, patchLevels_.set(curLevel, NULL)); } + + // ************************************************************************* // diff --git a/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.H b/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.H index ed66673bd7..26fe7984fa 100644 --- a/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.H +++ b/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.H @@ -148,13 +148,13 @@ public: // Destructor - ~pairPatchAgglomeration(); + ~pairPatchAgglomeration(); // Member Functions //- Agglomerate patch - void agglomerate(); + void agglomerate(); // Access @@ -200,7 +200,6 @@ public: const Field& cf, const label coarseLevelIndex ) const; - }; From 96477bd9c026cb03cf0e5faee2d002dbc99262ee Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 4 Jul 2011 11:55:33 +0100 Subject: [PATCH 02/54] ENH: USe flowRateProfile instead of volumeFlowRate in injector model --- .../ConeNozzleInjection/ConeNozzleInjection.C | 12 ++++++------ .../ConeNozzleInjection/ConeNozzleInjection.H | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C index e8844a5261..90ed4afcbf 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C @@ -130,11 +130,11 @@ Foam::ConeNozzleInjection::ConeNozzleInjection ( readScalar(this->coeffDict().lookup("parcelsPerSecond")) ), - volumeFlowRate_ + flowRateProfile_ ( DataEntry::New ( - "volumeFlowRate", + "flowRateProfile", this->coeffDict() ) ), @@ -208,7 +208,7 @@ Foam::ConeNozzleInjection::ConeNozzleInjection tanVec2_ = direction_^tanVec1_; // Set total volume to inject - this->volumeTotal_ = volumeFlowRate_().integrate(0.0, duration_); + this->volumeTotal_ = flowRateProfile_().integrate(0.0, duration_); } @@ -227,7 +227,7 @@ Foam::ConeNozzleInjection::ConeNozzleInjection injectorCell_(im.injectorCell_), direction_(im.direction_), parcelsPerSecond_(im.parcelsPerSecond_), - volumeFlowRate_(im.volumeFlowRate_().clone().ptr()), + flowRateProfile_(im.flowRateProfile_().clone().ptr()), thetaInner_(im.thetaInner_().clone().ptr()), thetaOuter_(im.thetaOuter_().clone().ptr()), sizeDistribution_(im.sizeDistribution_().clone().ptr()), @@ -283,7 +283,7 @@ Foam::scalar Foam::ConeNozzleInjection::volumeToInject { if ((time0 >= 0.0) && (time0 < duration_)) { - return volumeFlowRate_().integrate(time0, time1); + return flowRateProfile_().integrate(time0, time1); } else { @@ -405,7 +405,7 @@ void Foam::ConeNozzleInjection::setProperties scalar Ai = 0.25*mathematical::pi*innerDiameter_*innerDiameter_; scalar massFlowRate = this->massTotal() - *volumeFlowRate_().value(t) + *flowRateProfile_().value(t) /this->volumeTotal(); scalar Umag = massFlowRate/(parcel.rho()*Cd_().value(t)*(Ao - Ai)); diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.H index 46f876acf8..189390febe 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.H @@ -131,8 +131,8 @@ private: //- Number of parcels to introduce per second [] const label parcelsPerSecond_; - //- Volume flow rate of parcels to introduce relative to SOI [m^3/s] - const autoPtr > volumeFlowRate_; + //- Flow rate profile relative to SOI [] + const autoPtr > flowRateProfile_; //- Inner cone angle relative to SOI [deg] const autoPtr > thetaInner_; From b2d939833acf0bbe7f19fc60ac2f8fc5af2f0277 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 5 Jul 2011 10:12:02 +0100 Subject: [PATCH 03/54] ENH: Added missing enthalpy write for liquids --- src/thermophysicalModels/properties/liquidProperties/Ar/Ar.H | 1 + .../properties/liquidProperties/C10H22/C10H22.H | 1 + .../properties/liquidProperties/C12H26/C12H26.H | 1 + .../properties/liquidProperties/C13H28/C13H28.H | 1 + .../properties/liquidProperties/C14H30/C14H30.H | 1 + .../properties/liquidProperties/C16H34/C16H34.H | 1 + .../properties/liquidProperties/C2H5OH/C2H5OH.H | 1 + .../properties/liquidProperties/C2H6/C2H6.H | 1 + .../properties/liquidProperties/C2H6O/C2H6O.H | 1 + .../properties/liquidProperties/C3H6O/C3H6O.H | 1 + .../properties/liquidProperties/C3H8/C3H8.H | 1 + .../properties/liquidProperties/C4H10O/C4H10O.H | 1 + .../properties/liquidProperties/C6H14/C6H14.H | 1 + .../properties/liquidProperties/C6H6/C6H6.H | 1 + .../properties/liquidProperties/C7H16/C7H16.H | 1 + .../properties/liquidProperties/C7H8/C7H8.H | 1 + .../properties/liquidProperties/C8H10/C8H10.H | 1 + .../properties/liquidProperties/C8H18/C8H18.H | 1 + .../properties/liquidProperties/C9H20/C9H20.H | 1 + .../properties/liquidProperties/CH3OH/CH3OH.H | 1 + .../properties/liquidProperties/CH4N2O/CH4N2O.H | 1 + src/thermophysicalModels/properties/liquidProperties/H2O/H2O.H | 1 + .../properties/liquidProperties/IC8H18/IC8H18.H | 1 + .../properties/liquidProperties/IDEA/IDEA.H | 1 + src/thermophysicalModels/properties/liquidProperties/MB/MB.H | 1 + src/thermophysicalModels/properties/liquidProperties/N2/N2.H | 1 + .../properties/liquidProperties/aC10H7CH3/aC10H7CH3.H | 1 + .../properties/liquidProperties/aC10H7CH3/aC10H7CH3I.H | 2 -- .../properties/liquidProperties/bC10H7CH3/bC10H7CH3.H | 1 + .../properties/liquidProperties/iC3H8O/iC3H8O.H | 1 + .../properties/liquidProperties/nC3H8O/nC3H8O.H | 1 + 31 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/thermophysicalModels/properties/liquidProperties/Ar/Ar.H b/src/thermophysicalModels/properties/liquidProperties/Ar/Ar.H index dbcce489ce..d9e9c1f3a2 100644 --- a/src/thermophysicalModels/properties/liquidProperties/Ar/Ar.H +++ b/src/thermophysicalModels/properties/liquidProperties/Ar/Ar.H @@ -178,6 +178,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/C10H22/C10H22.H b/src/thermophysicalModels/properties/liquidProperties/C10H22/C10H22.H index 91abdc41ee..3adbe67070 100644 --- a/src/thermophysicalModels/properties/liquidProperties/C10H22/C10H22.H +++ b/src/thermophysicalModels/properties/liquidProperties/C10H22/C10H22.H @@ -178,6 +178,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/C12H26/C12H26.H b/src/thermophysicalModels/properties/liquidProperties/C12H26/C12H26.H index 1651d288d4..88983a7d33 100644 --- a/src/thermophysicalModels/properties/liquidProperties/C12H26/C12H26.H +++ b/src/thermophysicalModels/properties/liquidProperties/C12H26/C12H26.H @@ -178,6 +178,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/C13H28/C13H28.H b/src/thermophysicalModels/properties/liquidProperties/C13H28/C13H28.H index 346a9ef480..7f4514af7c 100644 --- a/src/thermophysicalModels/properties/liquidProperties/C13H28/C13H28.H +++ b/src/thermophysicalModels/properties/liquidProperties/C13H28/C13H28.H @@ -178,6 +178,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/C14H30/C14H30.H b/src/thermophysicalModels/properties/liquidProperties/C14H30/C14H30.H index ba8033499f..d1d2cb395e 100644 --- a/src/thermophysicalModels/properties/liquidProperties/C14H30/C14H30.H +++ b/src/thermophysicalModels/properties/liquidProperties/C14H30/C14H30.H @@ -178,6 +178,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/C16H34/C16H34.H b/src/thermophysicalModels/properties/liquidProperties/C16H34/C16H34.H index de16ec9db6..1f59b19392 100644 --- a/src/thermophysicalModels/properties/liquidProperties/C16H34/C16H34.H +++ b/src/thermophysicalModels/properties/liquidProperties/C16H34/C16H34.H @@ -178,6 +178,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/C2H5OH/C2H5OH.H b/src/thermophysicalModels/properties/liquidProperties/C2H5OH/C2H5OH.H index 4c282b4ca4..f68d5e4654 100644 --- a/src/thermophysicalModels/properties/liquidProperties/C2H5OH/C2H5OH.H +++ b/src/thermophysicalModels/properties/liquidProperties/C2H5OH/C2H5OH.H @@ -178,6 +178,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/C2H6/C2H6.H b/src/thermophysicalModels/properties/liquidProperties/C2H6/C2H6.H index fe5e7b9e52..a578dca5aa 100644 --- a/src/thermophysicalModels/properties/liquidProperties/C2H6/C2H6.H +++ b/src/thermophysicalModels/properties/liquidProperties/C2H6/C2H6.H @@ -178,6 +178,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/C2H6O/C2H6O.H b/src/thermophysicalModels/properties/liquidProperties/C2H6O/C2H6O.H index 380bdd6dce..8dcfa5a019 100644 --- a/src/thermophysicalModels/properties/liquidProperties/C2H6O/C2H6O.H +++ b/src/thermophysicalModels/properties/liquidProperties/C2H6O/C2H6O.H @@ -178,6 +178,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/C3H6O/C3H6O.H b/src/thermophysicalModels/properties/liquidProperties/C3H6O/C3H6O.H index 88e6edcdac..f1490f9dcb 100644 --- a/src/thermophysicalModels/properties/liquidProperties/C3H6O/C3H6O.H +++ b/src/thermophysicalModels/properties/liquidProperties/C3H6O/C3H6O.H @@ -178,6 +178,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/C3H8/C3H8.H b/src/thermophysicalModels/properties/liquidProperties/C3H8/C3H8.H index b539f4b504..30174f45e2 100644 --- a/src/thermophysicalModels/properties/liquidProperties/C3H8/C3H8.H +++ b/src/thermophysicalModels/properties/liquidProperties/C3H8/C3H8.H @@ -178,6 +178,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/C4H10O/C4H10O.H b/src/thermophysicalModels/properties/liquidProperties/C4H10O/C4H10O.H index 9a1ab395c4..710618889d 100644 --- a/src/thermophysicalModels/properties/liquidProperties/C4H10O/C4H10O.H +++ b/src/thermophysicalModels/properties/liquidProperties/C4H10O/C4H10O.H @@ -178,6 +178,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/C6H14/C6H14.H b/src/thermophysicalModels/properties/liquidProperties/C6H14/C6H14.H index 3734d712dc..6f4667623a 100644 --- a/src/thermophysicalModels/properties/liquidProperties/C6H14/C6H14.H +++ b/src/thermophysicalModels/properties/liquidProperties/C6H14/C6H14.H @@ -178,6 +178,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/C6H6/C6H6.H b/src/thermophysicalModels/properties/liquidProperties/C6H6/C6H6.H index 0eb4935bf5..3a30afaa83 100644 --- a/src/thermophysicalModels/properties/liquidProperties/C6H6/C6H6.H +++ b/src/thermophysicalModels/properties/liquidProperties/C6H6/C6H6.H @@ -178,6 +178,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/C7H16/C7H16.H b/src/thermophysicalModels/properties/liquidProperties/C7H16/C7H16.H index 00a0b8a3a2..ff41c44f3d 100644 --- a/src/thermophysicalModels/properties/liquidProperties/C7H16/C7H16.H +++ b/src/thermophysicalModels/properties/liquidProperties/C7H16/C7H16.H @@ -178,6 +178,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/C7H8/C7H8.H b/src/thermophysicalModels/properties/liquidProperties/C7H8/C7H8.H index 6e8541115d..ebbc91a45e 100644 --- a/src/thermophysicalModels/properties/liquidProperties/C7H8/C7H8.H +++ b/src/thermophysicalModels/properties/liquidProperties/C7H8/C7H8.H @@ -178,6 +178,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/C8H10/C8H10.H b/src/thermophysicalModels/properties/liquidProperties/C8H10/C8H10.H index 1c2b0bc5db..48b47c072a 100644 --- a/src/thermophysicalModels/properties/liquidProperties/C8H10/C8H10.H +++ b/src/thermophysicalModels/properties/liquidProperties/C8H10/C8H10.H @@ -177,6 +177,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/C8H18/C8H18.H b/src/thermophysicalModels/properties/liquidProperties/C8H18/C8H18.H index 5b841caa28..97b52808e8 100644 --- a/src/thermophysicalModels/properties/liquidProperties/C8H18/C8H18.H +++ b/src/thermophysicalModels/properties/liquidProperties/C8H18/C8H18.H @@ -178,6 +178,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/C9H20/C9H20.H b/src/thermophysicalModels/properties/liquidProperties/C9H20/C9H20.H index 9d03c03970..bbc64258a6 100644 --- a/src/thermophysicalModels/properties/liquidProperties/C9H20/C9H20.H +++ b/src/thermophysicalModels/properties/liquidProperties/C9H20/C9H20.H @@ -178,6 +178,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/CH3OH/CH3OH.H b/src/thermophysicalModels/properties/liquidProperties/CH3OH/CH3OH.H index d334e240b6..7973434ef1 100644 --- a/src/thermophysicalModels/properties/liquidProperties/CH3OH/CH3OH.H +++ b/src/thermophysicalModels/properties/liquidProperties/CH3OH/CH3OH.H @@ -178,6 +178,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/CH4N2O/CH4N2O.H b/src/thermophysicalModels/properties/liquidProperties/CH4N2O/CH4N2O.H index 62d5c8b7eb..126cc1feb3 100644 --- a/src/thermophysicalModels/properties/liquidProperties/CH4N2O/CH4N2O.H +++ b/src/thermophysicalModels/properties/liquidProperties/CH4N2O/CH4N2O.H @@ -178,6 +178,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/H2O/H2O.H b/src/thermophysicalModels/properties/liquidProperties/H2O/H2O.H index 4925bdc819..ab1ec8bc60 100644 --- a/src/thermophysicalModels/properties/liquidProperties/H2O/H2O.H +++ b/src/thermophysicalModels/properties/liquidProperties/H2O/H2O.H @@ -177,6 +177,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/IC8H18/IC8H18.H b/src/thermophysicalModels/properties/liquidProperties/IC8H18/IC8H18.H index 500fd6c117..3554db75b2 100644 --- a/src/thermophysicalModels/properties/liquidProperties/IC8H18/IC8H18.H +++ b/src/thermophysicalModels/properties/liquidProperties/IC8H18/IC8H18.H @@ -178,6 +178,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/IDEA/IDEA.H b/src/thermophysicalModels/properties/liquidProperties/IDEA/IDEA.H index e3a0ff4c1c..73ccc9f7ce 100644 --- a/src/thermophysicalModels/properties/liquidProperties/IDEA/IDEA.H +++ b/src/thermophysicalModels/properties/liquidProperties/IDEA/IDEA.H @@ -200,6 +200,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; mu_.writeData(os); os << nl; mug_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/MB/MB.H b/src/thermophysicalModels/properties/liquidProperties/MB/MB.H index fa91d57f39..6a11d7526d 100644 --- a/src/thermophysicalModels/properties/liquidProperties/MB/MB.H +++ b/src/thermophysicalModels/properties/liquidProperties/MB/MB.H @@ -178,6 +178,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/N2/N2.H b/src/thermophysicalModels/properties/liquidProperties/N2/N2.H index 94412e3beb..e159754ed2 100644 --- a/src/thermophysicalModels/properties/liquidProperties/N2/N2.H +++ b/src/thermophysicalModels/properties/liquidProperties/N2/N2.H @@ -178,6 +178,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/aC10H7CH3/aC10H7CH3.H b/src/thermophysicalModels/properties/liquidProperties/aC10H7CH3/aC10H7CH3.H index 3f93f4509b..b0da27a3a8 100644 --- a/src/thermophysicalModels/properties/liquidProperties/aC10H7CH3/aC10H7CH3.H +++ b/src/thermophysicalModels/properties/liquidProperties/aC10H7CH3/aC10H7CH3.H @@ -178,6 +178,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/aC10H7CH3/aC10H7CH3I.H b/src/thermophysicalModels/properties/liquidProperties/aC10H7CH3/aC10H7CH3I.H index 1c858c47c0..bd4acb076f 100644 --- a/src/thermophysicalModels/properties/liquidProperties/aC10H7CH3/aC10H7CH3I.H +++ b/src/thermophysicalModels/properties/liquidProperties/aC10H7CH3/aC10H7CH3I.H @@ -101,8 +101,6 @@ inline Foam::scalar Foam::aC10H7CH3::D(scalar p, scalar T) const } - - inline Foam::scalar Foam::aC10H7CH3::D(scalar p, scalar T, scalar Wb) const { return D_.f(p, T, Wb); diff --git a/src/thermophysicalModels/properties/liquidProperties/bC10H7CH3/bC10H7CH3.H b/src/thermophysicalModels/properties/liquidProperties/bC10H7CH3/bC10H7CH3.H index 74989233e8..f9ad40607c 100644 --- a/src/thermophysicalModels/properties/liquidProperties/bC10H7CH3/bC10H7CH3.H +++ b/src/thermophysicalModels/properties/liquidProperties/bC10H7CH3/bC10H7CH3.H @@ -178,6 +178,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/iC3H8O/iC3H8O.H b/src/thermophysicalModels/properties/liquidProperties/iC3H8O/iC3H8O.H index d1dbf718ca..0381b37160 100644 --- a/src/thermophysicalModels/properties/liquidProperties/iC3H8O/iC3H8O.H +++ b/src/thermophysicalModels/properties/liquidProperties/iC3H8O/iC3H8O.H @@ -177,6 +177,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; diff --git a/src/thermophysicalModels/properties/liquidProperties/nC3H8O/nC3H8O.H b/src/thermophysicalModels/properties/liquidProperties/nC3H8O/nC3H8O.H index 69c0e66a6f..14b1a39619 100644 --- a/src/thermophysicalModels/properties/liquidProperties/nC3H8O/nC3H8O.H +++ b/src/thermophysicalModels/properties/liquidProperties/nC3H8O/nC3H8O.H @@ -177,6 +177,7 @@ public: pv_.writeData(os); os << nl; hl_.writeData(os); os << nl; Cp_.writeData(os); os << nl; + h_.writeData(os); os << nl; Cpg_.writeData(os); os << nl; B_.writeData(os); os << nl; mu_.writeData(os); os << nl; From 30f2589d00886413cf43d69bb3dd9b0586d66d46 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 6 Jul 2011 10:13:30 +0100 Subject: [PATCH 04/54] BUG: codeStream.C: commented out code for master-only checking since would not work for fields --- .../functionEntries/codeStream/codeStream.C | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C index ebbb6efb81..34dd4e80d1 100644 --- a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C +++ b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C @@ -197,22 +197,25 @@ Foam::functionEntries::codeStream::getFunction } } - // all processes must wait for compile to finish - except if this - // file is only read on the master - bool masterOnly = - ( - regIOobject::fileModificationChecking - == regIOobject::timeStampMaster - ) - || ( - regIOobject::fileModificationChecking - == regIOobject::inotifyMaster - ); - - if (!masterOnly) - { + //- We don't know whether this code was from IOdictionary + // (possibly read on master only) or from e.g. Field so cannot + // decide here. + //// all processes must wait for compile to finish - except if this + //// file is only read on the master + //bool masterOnly = + // ( + // regIOobject::fileModificationChecking + // == regIOobject::timeStampMaster + // ) + // || ( + // regIOobject::fileModificationChecking + // == regIOobject::inotifyMaster + // ); + // + //if (!masterOnly) + //{ reduce(create, orOp()); - } + //} if (isA(topDict(parentDict))) { From 49285512c7a60f89c208d8f896c56a035bb739bd Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 6 Jul 2011 12:40:06 +0100 Subject: [PATCH 05/54] etc/controlDict: add support for merging etc/controlDict with user-specialised versions --- .../foamDebugSwitches/foamDebugSwitches.C | 9 ++- src/OSspecific/POSIX/POSIX.C | 67 +++++++++++-------- src/OpenFOAM/global/debug/debug.C | 13 ++-- src/OpenFOAM/include/OSspecific.H | 11 ++- 4 files changed, 65 insertions(+), 35 deletions(-) diff --git a/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C b/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C index 8f0e53f4e2..7f84d96bc2 100644 --- a/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C +++ b/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -61,7 +61,12 @@ int main(int argc, char *argv[]) if (args.optionFound("old") || args.optionFound("new")) { - dictionary controlDict(IFstream(findEtcFile("controlDict", true))()); + fileNameList controlDictFiles = findEtcFile("controlDict", true); + dictionary controlDict; + forAllReverse(controlDictFiles, cdfi) + { + controlDict.merge(dictionary(IFstream(controlDictFiles[cdfi])())); + } wordHashSet oldDebug ( diff --git a/src/OSspecific/POSIX/POSIX.C b/src/OSspecific/POSIX/POSIX.C index c79d8f0290..920d720cf5 100644 --- a/src/OSspecific/POSIX/POSIX.C +++ b/src/OSspecific/POSIX/POSIX.C @@ -264,10 +264,11 @@ bool Foam::chDir(const fileName& dir) } -Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory) +Foam::fileNameList Foam::findEtcFiles(const fileName& name, bool mandatory) { - // - // search for user files in + fileNameList results; + + // Search for user files in // * ~/.OpenFOAM/VERSION // * ~/.OpenFOAM // @@ -277,19 +278,17 @@ Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory) fileName fullName = searchDir/FOAMversion/name; if (isFile(fullName)) { - return fullName; + results.append(fullName); } fullName = searchDir/name; if (isFile(fullName)) { - return fullName; + results.append(fullName); } } - - // - // search for group (site) files in + // Search for group (site) files in // * $WM_PROJECT_SITE/VERSION // * $WM_PROJECT_SITE // @@ -301,19 +300,18 @@ Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory) fileName fullName = searchDir/FOAMversion/name; if (isFile(fullName)) { - return fullName; + results.append(fullName); } fullName = searchDir/name; if (isFile(fullName)) { - return fullName; + results.append(fullName); } } } else { - // // OR search for group (site) files in // * $WM_PROJECT_INST_DIR/site/VERSION // * $WM_PROJECT_INST_DIR/site @@ -324,20 +322,18 @@ Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory) fileName fullName = searchDir/"site"/FOAMversion/name; if (isFile(fullName)) { - return fullName; + results.append(fullName); } fullName = searchDir/"site"/name; if (isFile(fullName)) { - return fullName; + results.append(fullName); } } } - - // - // search for other (shipped) files in + // Search for other (shipped) files in // * $WM_PROJECT_DIR/etc // searchDir = getEnv("WM_PROJECT_DIR"); @@ -346,24 +342,41 @@ Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory) fileName fullName = searchDir/"etc"/name; if (isFile(fullName)) { - return fullName; + results.append(fullName); } } // Not found - // abort if the file is mandatory, otherwise return null - if (mandatory) + if (results.empty()) { - std::cerr - << "--> FOAM FATAL ERROR in Foam::findEtcFile() :" - " could not find mandatory file\n '" - << name.c_str() << "'\n\n" << std::endl; - ::exit(1); + // Abort if the file is mandatory, otherwise return null + if (mandatory) + { + std::cerr + << "--> FOAM FATAL ERROR in Foam::findEtcFiles() :" + " could not find mandatory file\n '" + << name.c_str() << "'\n\n" << std::endl; + ::exit(1); + } } - // Return null-constructed fileName rather than fileName::null - // to avoid cyclic dependencies in the construction of globals - return fileName(); + // Return list of matching paths or empty list if none found + return results; +} + + +Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory) +{ + fileNameList results(findEtcFiles(name, mandatory)); + + if (results.size()) + { + return results[0]; + } + else + { + return fileName(); + } } diff --git a/src/OpenFOAM/global/debug/debug.C b/src/OpenFOAM/global/debug/debug.C index b0c696987a..2cd9c861fe 100644 --- a/src/OpenFOAM/global/debug/debug.C +++ b/src/OpenFOAM/global/debug/debug.C @@ -75,10 +75,15 @@ Foam::dictionary& Foam::debug::controlDict() { if (!controlDictPtr_) { - controlDictPtr_ = new dictionary - ( - IFstream(findEtcFile("controlDict", true))() - ); + fileNameList controlDictFiles = findEtcFiles("controlDict", true); + controlDictPtr_ = new dictionary(); + forAllReverse(controlDictFiles, cdfi) + { + controlDictPtr_->merge + ( + dictionary(IFstream(controlDictFiles[cdfi])()) + ); + } } return *controlDictPtr_; diff --git a/src/OpenFOAM/include/OSspecific.H b/src/OpenFOAM/include/OSspecific.H index b774997339..119c669b5f 100644 --- a/src/OpenFOAM/include/OSspecific.H +++ b/src/OpenFOAM/include/OSspecific.H @@ -93,7 +93,7 @@ fileName cwd(); // else return false bool chDir(const fileName& dir); -//- Search for a file from user/group/shipped directories. +//- Search for files from user/group/shipped directories. // The search scheme allows for version-specific and // version-independent files using the following hierarchy: // - \b user settings: @@ -108,7 +108,14 @@ bool chDir(const fileName& dir); // - \b other (shipped) settings: // - $WM_PROJECT_DIR/etc/ // -// \return The full path name or fileName() if the name cannot be found +// \return The list of full paths of all the matching files or +// an empty list if the name cannot be found. +// Optionally abort if the file cannot be found +fileNameList findEtcFiles(const fileName&, bool mandatory=false); + +//- Search for a file using findEtcFiles. +// \return The full path name of the first file found which in the +// search hierarchy or an empty fileName if the name cannot be found. // Optionally abort if the file cannot be found fileName findEtcFile(const fileName&, bool mandatory=false); From 2169a5de4039ab5388ce255b62c02d9cd13c7d56 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 6 Jul 2011 12:40:15 +0100 Subject: [PATCH 06/54] etc/controlDict: Removed redundant entry --- etc/controlDict | 1 - 1 file changed, 1 deletion(-) diff --git a/etc/controlDict b/etc/controlDict index 9edaf1025e..352541fa75 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -24,7 +24,6 @@ Documentation "$WM_PROJECT_USER_DIR/html" "~OpenFOAM/html" "$WM_PROJECT_DIR/doc/Doxygen/html" - "$WM_PROJECT_DIR/doc/doxygen/html" ); doxySourceFileExts ( From 64ec1bab0716cb1d64c13504e26fc654e012d8e3 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 6 Jul 2011 12:40:26 +0100 Subject: [PATCH 07/54] simpleFoam/motorBike tutorial: Changed loaded libraries to avoid error on completion --- .../simpleFoam/motorBike/system/controlDict | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tutorials/incompressible/simpleFoam/motorBike/system/controlDict b/tutorials/incompressible/simpleFoam/motorBike/system/controlDict index 3e5b2dfbd0..55c8016a8e 100644 --- a/tutorials/incompressible/simpleFoam/motorBike/system/controlDict +++ b/tutorials/incompressible/simpleFoam/motorBike/system/controlDict @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | +| \\ / O peration | Version: 2.0.0 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ @@ -16,19 +16,19 @@ FoamFile application simpleFoam; -startFrom latestTime; +startFrom latestTime; startTime 0; -stopAt nextWrite; +stopAt nextWrite; endTime 500; deltaT 1; -writeControl timeStep; +writeControl timeStep; -writeInterval 1; +writeInterval 1; purgeWrite 0; @@ -48,7 +48,7 @@ libs ( "libOpenFOAM.so" "libcompressibleTurbulenceModels.so" - "libincompressibleRASModels.so" + "libcompressibleRASModels.so" ); functions From 576805a3f2c930ee0b4121dbb426b42d5d7b70ce Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 6 Jul 2011 12:42:43 +0100 Subject: [PATCH 08/54] Corrected header --- .../incompressible/simpleFoam/motorBike/system/controlDict | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/incompressible/simpleFoam/motorBike/system/controlDict b/tutorials/incompressible/simpleFoam/motorBike/system/controlDict index 55c8016a8e..fc5893222c 100644 --- a/tutorials/incompressible/simpleFoam/motorBike/system/controlDict +++ b/tutorials/incompressible/simpleFoam/motorBike/system/controlDict @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 2.0.0 | +| \\ / O peration | Version: dev | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ From 11cf5b182930c062941e8c8453fcfb7a49bf10f1 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 6 Jul 2011 18:58:19 +0100 Subject: [PATCH 09/54] ENH: triSurfaceMesh: add quality filter for triangle normals. On degenerate triangles the problem is that the determination of inside/outside goes wrong. Intersection is not affected since the triangles have no area. So eliminate degenerate triangles from normals calculation --- .../searchableSurface/triSurfaceMesh.C | 84 ++++++++++++++++--- .../searchableSurface/triSurfaceMesh.H | 7 +- 2 files changed, 77 insertions(+), 14 deletions(-) diff --git a/src/meshTools/searchableSurface/triSurfaceMesh.C b/src/meshTools/searchableSurface/triSurfaceMesh.C index aa117c2794..ab26033eed 100644 --- a/src/meshTools/searchableSurface/triSurfaceMesh.C +++ b/src/meshTools/searchableSurface/triSurfaceMesh.C @@ -331,6 +331,7 @@ Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io, const triSurface& s) ), triSurface(s), tolerance_(indexedOctree::perturbTol()), + minQuality_(-1), maxTreeDepth_(10), surfaceClosed_(-1) {} @@ -375,6 +376,7 @@ Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io) ) ), tolerance_(indexedOctree::perturbTol()), + minQuality_(-1), maxTreeDepth_(10), surfaceClosed_(-1) {} @@ -422,6 +424,7 @@ Foam::triSurfaceMesh::triSurfaceMesh ) ), tolerance_(indexedOctree::perturbTol()), + minQuality_(-1), maxTreeDepth_(10), surfaceClosed_(-1) { @@ -444,6 +447,13 @@ Foam::triSurfaceMesh::triSurfaceMesh << tolerance_ << endl; } + // Have optional minimum quality for normal calculation + if (dict.readIfPresent("minQuality", minQuality_) && minQuality_ > 0) + { + Info<< searchableSurface::name() + << " : ignoring triangles with quality < " + << minQuality_ << " for normals calculation." << endl; + } // Have optional non-standard tree-depth to limit storage. if (dict.readIfPresent("maxTreeDepth", maxTreeDepth_) && maxTreeDepth_ > 0) @@ -804,22 +814,70 @@ void Foam::triSurfaceMesh::getNormal { normal.setSize(info.size()); - forAll(info, i) + if (minQuality_ >= 0) { - if (info[i].hit()) - { - label faceI = info[i].index(); - //- Cached: - //normal[i] = faceNormals()[faceI]; + // Make sure we don't use triangles with low quality since + // normal is not reliable. - //- Uncached - normal[i] = triSurface::operator[](faceI).normal(points()); - normal[i] /= mag(normal[i]) + VSMALL; - } - else + const triSurface& s = static_cast(*this); + const labelListList& faceFaces = s.faceFaces(); + + forAll(info, i) { - // Set to what? - normal[i] = vector::zero; + if (info[i].hit()) + { + label faceI = info[i].index(); + + scalar qual = s[faceI].tri(points()).quality(); + + if (qual < minQuality_) + { + // Search neighbouring triangles + const labelList& fFaces = faceFaces[faceI]; + + forAll(fFaces, j) + { + label nbrI = fFaces[j]; + scalar nbrQual = s[nbrI].tri(points()).quality(); + if (nbrQual > qual) + { + qual = nbrQual; + normal[i] = s[nbrI].normal(points()); + } + } + } + else + { + normal[i] = s[faceI].normal(points()); + } + normal[i] /= mag(normal[i]); + } + else + { + // Set to what? + normal[i] = vector::zero; + } + } + } + else + { + forAll(info, i) + { + if (info[i].hit()) + { + label faceI = info[i].index(); + //- Cached: + //normal[i] = faceNormals()[faceI]; + + //- Uncached + normal[i] = triSurface::operator[](faceI).normal(points()); + normal[i] /= mag(normal[i]) + VSMALL; + } + else + { + // Set to what? + normal[i] = vector::zero; + } } } } diff --git a/src/meshTools/searchableSurface/triSurfaceMesh.H b/src/meshTools/searchableSurface/triSurfaceMesh.H index e1615ccc9b..19d2e78c88 100644 --- a/src/meshTools/searchableSurface/triSurfaceMesh.H +++ b/src/meshTools/searchableSurface/triSurfaceMesh.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,6 +31,7 @@ Description - scale : scaling factor. - tolerance : relative tolerance for doing intersections (see triangle::intersection) + - minQuality: discard triangles with low quality when getting normal SourceFiles triSurfaceMesh.C @@ -70,6 +71,10 @@ private: //- Optional tolerance to use in searches scalar tolerance_; + //- Optional min triangle quality. Triangles below this get + // ignored for normal calculation + scalar minQuality_; + //- Optional max tree depth of octree label maxTreeDepth_; From b490acc1a5379a8617d8d53878e33e9b0180817f Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 6 Jul 2011 18:58:48 +0100 Subject: [PATCH 10/54] ENH: closedTriSurfaceMesh: triSurfaceMesh that fakes to be closed. --- src/meshTools/Make/files | 1 + .../searchableSurface/closedTriSurfaceMesh.C | 74 ++++++++++++ .../searchableSurface/closedTriSurfaceMesh.H | 111 ++++++++++++++++++ 3 files changed, 186 insertions(+) create mode 100644 src/meshTools/searchableSurface/closedTriSurfaceMesh.C create mode 100644 src/meshTools/searchableSurface/closedTriSurfaceMesh.H diff --git a/src/meshTools/Make/files b/src/meshTools/Make/files index e9b137abc7..cac3aa685c 100644 --- a/src/meshTools/Make/files +++ b/src/meshTools/Make/files @@ -62,6 +62,7 @@ $(searchableSurface)/searchableSurfaces.C $(searchableSurface)/searchableSurfacesQueries.C $(searchableSurface)/searchableSurfaceWithGaps.C $(searchableSurface)/triSurfaceMesh.C +$(searchableSurface)/closedTriSurfaceMesh.C topoSets = sets/topoSets $(topoSets)/cellSet.C diff --git a/src/meshTools/searchableSurface/closedTriSurfaceMesh.C b/src/meshTools/searchableSurface/closedTriSurfaceMesh.C new file mode 100644 index 0000000000..14a505e356 --- /dev/null +++ b/src/meshTools/searchableSurface/closedTriSurfaceMesh.C @@ -0,0 +1,74 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "closedTriSurfaceMesh.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + +defineTypeNameAndDebug(closedTriSurfaceMesh, 0); +addToRunTimeSelectionTable(searchableSurface, closedTriSurfaceMesh, dict); + +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::closedTriSurfaceMesh::closedTriSurfaceMesh +( + const IOobject& io, + const triSurface& s +) +: + triSurfaceMesh(io, s) +{} + + +Foam::closedTriSurfaceMesh::closedTriSurfaceMesh(const IOobject& io) +: + triSurfaceMesh(io) +{} + + +Foam::closedTriSurfaceMesh::closedTriSurfaceMesh +( + const IOobject& io, + const dictionary& dict +) +: + triSurfaceMesh(io, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::closedTriSurfaceMesh::~closedTriSurfaceMesh() +{} + + +// ************************************************************************* // diff --git a/src/meshTools/searchableSurface/closedTriSurfaceMesh.H b/src/meshTools/searchableSurface/closedTriSurfaceMesh.H new file mode 100644 index 0000000000..9290782719 --- /dev/null +++ b/src/meshTools/searchableSurface/closedTriSurfaceMesh.H @@ -0,0 +1,111 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::closedTriSurfaceMesh + +Description + A triSurfaceMesh where it is forced to check volumeTypes, used for surfaces + that are topologically non-manifold (small holes or multiple parts) but are + geometrically essentially closed + +SourceFiles + closedTriSurfaceMesh.C + +\*---------------------------------------------------------------------------*/ + +#ifndef closedTriSurfaceMesh_H +#define closedTriSurfaceMesh_H + +#include "triSurfaceMesh.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class closedTriSurfaceMesh Declaration +\*---------------------------------------------------------------------------*/ + +class closedTriSurfaceMesh +: + public triSurfaceMesh +{ +private: + + //- Disallow default bitwise copy construct + closedTriSurfaceMesh(const closedTriSurfaceMesh&); + + //- Disallow default bitwise assignment + void operator=(const closedTriSurfaceMesh&); + + +public: + + //- Runtime type information + TypeName("closedTriSurfaceMesh"); + + + // Constructors + + //- Construct from triSurface + closedTriSurfaceMesh(const IOobject&, const triSurface&); + + //- Construct read. + closedTriSurfaceMesh(const IOobject& io); + + //- Construct from IO and dictionary (used by searchableSurface). + // Dictionary may contain a 'scale' entry (eg, 0.001: mm -> m) + closedTriSurfaceMesh + ( + const IOobject& io, + const dictionary& dict + ); + + + // Destructor + + virtual ~closedTriSurfaceMesh(); + + // Member Functions + + //- Whether supports volume type, forcing to true to force getVolumeType + // queries for this type + virtual bool hasVolumeType() const + { + return true; + } + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From 19184de04246cfa06ac74e13d4f0e872b227989e Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 6 Jul 2011 18:59:17 +0100 Subject: [PATCH 11/54] STYLE: autoRefineDriver.C: comment --- .../autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C index 03c29aefd3..a7ec879794 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C @@ -744,7 +744,8 @@ void Foam::autoRefineDriver::doRefine 100 // maxIter ); - // Introduce baffles at surface intersections + // Introduce baffles at surface intersections. Remove sections unreachable + // from keepPoint. baffleAndSplitMesh(refineParams, prepareForSnapping, motionDict); // Mesh is at its finest. Do optional zoning. From 1209e915d9af47820cc2b2d4e1ebc1614d11054a Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 7 Jul 2011 10:02:52 +0100 Subject: [PATCH 12/54] ENH: Added PV library existence check to paraFoam script --- bin/paraFoam | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/bin/paraFoam b/bin/paraFoam index fe11bcb6e8..08ef45e952 100755 --- a/bin/paraFoam +++ b/bin/paraFoam @@ -117,6 +117,24 @@ do done +# +# check that reader module has been built +# +if [ ! -f $PV_PLUGIN_PATH/libPV3FoamReader_SM.so ] +then + cat<< BUILDREADER + +FATAL ERROR: ParaView reader module libraries do not exist + +Please build the reader module before continuing: +cd \$FOAM_UTILITIES/postProcessing/graphics/PV3Readers +./Allwclean +./Allwmake + +BUILDREADER + exit 1 +fi + # # check for --data=... argument # From 227f440496ae64904b610e5d109185acf3baa53e Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 7 Jul 2011 10:25:16 +0100 Subject: [PATCH 13/54] BUG: foamDebubSwitches: use findEtcFiles --- .../miscellaneous/foamDebugSwitches/foamDebugSwitches.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C b/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C index 7f84d96bc2..9370236411 100644 --- a/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C +++ b/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C @@ -61,7 +61,7 @@ int main(int argc, char *argv[]) if (args.optionFound("old") || args.optionFound("new")) { - fileNameList controlDictFiles = findEtcFile("controlDict", true); + fileNameList controlDictFiles = findEtcFiles("controlDict", true); dictionary controlDict; forAllReverse(controlDictFiles, cdfi) { From c2d99767a27cf05deaf1976bf21819c6a1fb7224 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 7 Jul 2011 14:59:18 +0200 Subject: [PATCH 14/54] ENH: reinstate short-circuit behaviour for findEtcFile() --- src/OSspecific/POSIX/POSIX.C | 38 +++++++++++++++++++++++++++++-- src/OpenFOAM/include/OSspecific.H | 14 ++++++++---- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/src/OSspecific/POSIX/POSIX.C b/src/OSspecific/POSIX/POSIX.C index 920d720cf5..3dbd628f04 100644 --- a/src/OSspecific/POSIX/POSIX.C +++ b/src/OSspecific/POSIX/POSIX.C @@ -264,7 +264,12 @@ bool Foam::chDir(const fileName& dir) } -Foam::fileNameList Foam::findEtcFiles(const fileName& name, bool mandatory) +Foam::fileNameList Foam::findEtcFiles +( + const fileName& name, + bool mandatory, + bool findFirst +) { fileNameList results; @@ -279,12 +284,20 @@ Foam::fileNameList Foam::findEtcFiles(const fileName& name, bool mandatory) if (isFile(fullName)) { results.append(fullName); + if (findFirst) + { + goto DONE; + } } fullName = searchDir/name; if (isFile(fullName)) { results.append(fullName); + if (findFirst) + { + goto DONE; + } } } @@ -301,12 +314,20 @@ Foam::fileNameList Foam::findEtcFiles(const fileName& name, bool mandatory) if (isFile(fullName)) { results.append(fullName); + if (findFirst) + { + goto DONE; + } } fullName = searchDir/name; if (isFile(fullName)) { results.append(fullName); + if (findFirst) + { + goto DONE; + } } } } @@ -323,12 +344,20 @@ Foam::fileNameList Foam::findEtcFiles(const fileName& name, bool mandatory) if (isFile(fullName)) { results.append(fullName); + if (findFirst) + { + goto DONE; + } } fullName = searchDir/"site"/name; if (isFile(fullName)) { results.append(fullName); + if (findFirst) + { + goto DONE; + } } } } @@ -343,6 +372,10 @@ Foam::fileNameList Foam::findEtcFiles(const fileName& name, bool mandatory) if (isFile(fullName)) { results.append(fullName); + if (findFirst) + { + goto DONE; + } } } @@ -360,6 +393,7 @@ Foam::fileNameList Foam::findEtcFiles(const fileName& name, bool mandatory) } } +DONE: // Return list of matching paths or empty list if none found return results; } @@ -367,7 +401,7 @@ Foam::fileNameList Foam::findEtcFiles(const fileName& name, bool mandatory) Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory) { - fileNameList results(findEtcFiles(name, mandatory)); + fileNameList results(findEtcFiles(name, mandatory, true)); if (results.size()) { diff --git a/src/OpenFOAM/include/OSspecific.H b/src/OpenFOAM/include/OSspecific.H index 119c669b5f..5491223fcd 100644 --- a/src/OpenFOAM/include/OSspecific.H +++ b/src/OpenFOAM/include/OSspecific.H @@ -110,13 +110,19 @@ bool chDir(const fileName& dir); // // \return The list of full paths of all the matching files or // an empty list if the name cannot be found. -// Optionally abort if the file cannot be found -fileNameList findEtcFiles(const fileName&, bool mandatory=false); +// Optionally abort if the file cannot be found. +// Optionally stop search after the first file has been found. +fileNameList findEtcFiles +( + const fileName&, + bool mandatory=false, + bool findFirst=false +); //- Search for a file using findEtcFiles. -// \return The full path name of the first file found which in the +// \return The full path name of the first file found in the // search hierarchy or an empty fileName if the name cannot be found. -// Optionally abort if the file cannot be found +// Optionally abort if the file cannot be found. fileName findEtcFile(const fileName&, bool mandatory=false); //- Make a directory and return an error if it could not be created From 8f435b1b1894498d339c6e6b10e9e6a53be02923 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 7 Jul 2011 16:17:58 +0100 Subject: [PATCH 15/54] ENH: particleI.H: check for duplicate faces --- src/lagrangian/basic/particle/particleI.H | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lagrangian/basic/particle/particleI.H b/src/lagrangian/basic/particle/particleI.H index 6107df0c4e..a9246510f5 100644 --- a/src/lagrangian/basic/particle/particleI.H +++ b/src/lagrangian/basic/particle/particleI.H @@ -514,6 +514,16 @@ inline void Foam::particle::crossEdgeConnectedFace { continue; } + else if (f == pFaces[fI]) + { + // This is a necessary condition if using duplicate baffles + // (so coincident faces). We need to make sure we don't cross into + // the face with the same vertices since we might enter a tracking + // loop where it never exits. This test should be cheap + // for most meshes so can be left in for 'normal' meshes. + + continue; + } else { //Found edge on other face From d8ac6673593f5597a39ec93f7648f42d35688edd Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 7 Jul 2011 16:24:34 +0100 Subject: [PATCH 16/54] BUG: particleTemplates: reference to temporary --- src/lagrangian/basic/particle/particleTemplates.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lagrangian/basic/particle/particleTemplates.C b/src/lagrangian/basic/particle/particleTemplates.C index cb58c21653..80009d44c5 100644 --- a/src/lagrangian/basic/particle/particleTemplates.C +++ b/src/lagrangian/basic/particle/particleTemplates.C @@ -738,7 +738,7 @@ void Foam::particle::hitWallFaces { // Get the decomposition of this wall face - const List& faceTetIs = + const List faceTetIs = polyMeshTetDecomposition::faceTetIndices(mesh_, fI, cellI_); const Foam::face& f = pFaces[fI]; From d2a4df60eeba58ade454e40444bad48abc3aabda Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 7 Jul 2011 16:25:17 +0100 Subject: [PATCH 17/54] STYLE: lagrangian: moved include files to .C --- src/lagrangian/basic/Cloud/Cloud.H | 1 - src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C | 1 + src/meshTools/momentOfInertia/momentOfInertia.C | 3 ++- src/meshTools/momentOfInertia/momentOfInertia.H | 3 +-- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lagrangian/basic/Cloud/Cloud.H b/src/lagrangian/basic/Cloud/Cloud.H index b7d39f61f4..e11905b266 100644 --- a/src/lagrangian/basic/Cloud/Cloud.H +++ b/src/lagrangian/basic/Cloud/Cloud.H @@ -44,7 +44,6 @@ SourceFiles #include "indexedOctree.H" #include "treeDataCell.H" #include "tetPointRef.H" -#include "polyMeshTetDecomposition.H" #include "PackedBoolList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C index b23817d98e..b45f3cae8b 100644 --- a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C +++ b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C @@ -29,6 +29,7 @@ License #include "InflowBoundaryModel.H" #include "constants.H" #include "zeroGradientFvPatchFields.H" +#include "polyMeshTetDecomposition.H" using namespace Foam::constant; diff --git a/src/meshTools/momentOfInertia/momentOfInertia.C b/src/meshTools/momentOfInertia/momentOfInertia.C index 8dc1a53d61..469f9c8ce8 100644 --- a/src/meshTools/momentOfInertia/momentOfInertia.C +++ b/src/meshTools/momentOfInertia/momentOfInertia.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2007-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2007-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "momentOfInertia.H" +#include "polyMeshTetDecomposition.H" // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // diff --git a/src/meshTools/momentOfInertia/momentOfInertia.H b/src/meshTools/momentOfInertia/momentOfInertia.H index bb5ffef6a8..2366a6132c 100644 --- a/src/meshTools/momentOfInertia/momentOfInertia.H +++ b/src/meshTools/momentOfInertia/momentOfInertia.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2007-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2007-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,7 +41,6 @@ SourceFiles #include "triFaceList.H" #include "triSurface.H" #include "polyMesh.H" -#include "polyMeshTetDecomposition.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // From 07c882fa78ce891d571f4469ba943c6a540be6d4 Mon Sep 17 00:00:00 2001 From: sergio Date: Fri, 8 Jul 2011 09:18:26 +0100 Subject: [PATCH 18/54] BUG: Error in init of YS0 when re-start --- .../ODESolidChemistryModel/ODESolidChemistryModel.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.C b/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.C index bd7ac96a46..5498b92772 100644 --- a/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.C +++ b/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.C @@ -135,11 +135,11 @@ ODESolidChemistryModel Y0Default ) ); - } - // Calculate inital values of Ysi0 = rho*delta*Yi - Ys0_[fieldI].internalField() = - this->solidThermo().rho()*max(Ys_[fieldI],scalar(0.001))*mesh.V(); + Ys0_[fieldI].internalField() = + this->solidThermo().rho() + *max(Ys_[fieldI], scalar(0.001))*mesh.V(); + } } forAll(RRg_, fieldI) From cf54434499232072687100d9cc92f0194fead150 Mon Sep 17 00:00:00 2001 From: sergio Date: Fri, 8 Jul 2011 09:43:48 +0100 Subject: [PATCH 19/54] BUG: Proper handling of zero size patches --- .../faceAgglomerate/faceAgglomerate.C | 2 +- .../preProcessing/viewFactorsGen/shootRays.H | 68 +++++------ .../pairPatchAgglomeration.C | 2 +- .../radiationModel/viewFactor/viewFactor.C | 115 ++++++++++-------- 4 files changed, 95 insertions(+), 92 deletions(-) diff --git a/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C b/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C index 387b791592..13ea44c345 100644 --- a/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C +++ b/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C @@ -104,7 +104,7 @@ int main(int argc, char *argv[]) label patchI = pp.index(); finalAgglom[patchI].setSize(pp.size(), 0); - if (pp.size() > 0 && !pp.coupled()) + if (!pp.coupled()) { if (agglomDict.found(pp.name())) { diff --git a/applications/utilities/preProcessing/viewFactorsGen/shootRays.H b/applications/utilities/preProcessing/viewFactorsGen/shootRays.H index 75eca8bc28..095436b1a1 100644 --- a/applications/utilities/preProcessing/viewFactorsGen/shootRays.H +++ b/applications/utilities/preProcessing/viewFactorsGen/shootRays.H @@ -2,8 +2,7 @@ // Pre-size by assuming a certain percentage is visible. // Maximum lenght for dynamicList -const label maxDynListLenght = 10000; -//label lenghtCount = 0; +const label maxDynListLength = 10000; for (label procI = 0; procI < Pstream::nProcs(); procI++) { @@ -22,69 +21,51 @@ for (label procI = 0; procI < Pstream::nProcs(); procI++) const pointField& remoteArea = remoteCoarseSf[procI]; const pointField& remoteFc = remoteCoarseCf[procI]; - if (myFc.size()*remoteFc.size() > 0) + label i = 0; + label j = 0; + do { - forAll(myFc, i) + for (; i < myFc.size(); i++) { const point& fc = myFc[i]; const vector& fA = myArea[i]; - forAll(remoteFc, j) + for (; j < remoteFc.size(); j++)// { if (procI != Pstream::myProcNo() || i != j) { const point& remFc = remoteFc[j]; const vector& remA = remoteArea[j]; - const vector& d = remFc-fc; + const vector& d = remFc - fc; if (((d & fA) < 0.) && ((d & remA) > 0)) { - //lenghtCount ++; start.append(fc + 0.0001*d); startIndex.append(i); end.append(fc + 0.9999*d); label globalI = globalNumbering.toGlobal(procI, j); endIndex.append(globalI); - - if (startIndex.size() > maxDynListLenght) + if (startIndex.size() > maxDynListLength) { - List hitInfo(startIndex.size()); - surfacesMesh.findLine - ( - start, - end, - hitInfo - ); - surfacesMesh.findLine(start, end, hitInfo); - forAll (hitInfo, rayI) - { - if (!hitInfo[rayI].hit()) - { - rayStartFace.append(startIndex[rayI]); - rayEndFace.append(endIndex[rayI]); - } - } - //lenghtCount = 0; - start.clear(); - startIndex.clear(); - end.clear(); - endIndex.clear(); + break; } } } } + if (startIndex.size() > maxDynListLength) + { + break; + } + + if (j == remoteFc.size()) + { + j = 0; + } } - } - if (!start.empty()) - { + List hitInfo(startIndex.size()); - surfacesMesh.findLine - ( - start, - end, - hitInfo - ); surfacesMesh.findLine(start, end, hitInfo); + forAll (hitInfo, rayI) { if (!hitInfo[rayI].hit()) @@ -93,5 +74,12 @@ for (label procI = 0; procI < Pstream::nProcs(); procI++) rayEndFace.append(endIndex[rayI]); } } - } + + start.clear(); + startIndex.clear(); + end.clear(); + endIndex.clear(); + + }while (returnReduce(i < myFc.size(), orOp())); + } diff --git a/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.C b/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.C index 12946afadf..40110454ad 100644 --- a/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.C +++ b/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.C @@ -351,7 +351,7 @@ void Foam::pairPatchAgglomeration:: agglomerate() tmp finalAgglomPtr(new labelField(patch.size())); bool agglomOK = false; - while (!agglomOK) + while (!agglomOK && patch.size()) { finalAgglomPtr = agglomerateOneLevel ( diff --git a/src/thermophysicalModels/radiationModels/radiationModel/viewFactor/viewFactor.C b/src/thermophysicalModels/radiationModels/radiationModel/viewFactor/viewFactor.C index 759f50297b..e008f5d00a 100644 --- a/src/thermophysicalModels/radiationModels/radiationModel/viewFactor/viewFactor.C +++ b/src/thermophysicalModels/radiationModels/radiationModel/viewFactor/viewFactor.C @@ -108,10 +108,10 @@ Foam::radiation::viewFactor::viewFactor(const volScalarField& T) label count = 0; forAll(Qrp, patchI) { - const polyPatch& pp = mesh_.boundaryMesh()[patchI]; + //const polyPatch& pp = mesh_.boundaryMesh()[patchI]; const fvPatchScalarField& QrPatchI = Qrp[patchI]; - if ((isA(QrPatchI)) && (pp.size() > 0)) + if ((isA(QrPatchI))) { selectedPatches_[count] = QrPatchI.patch().index(); nLocalCoarseFaces_ += coarsePatches[patchI].size(); @@ -362,38 +362,49 @@ void Foam::radiation::viewFactor::calculate() const polyPatch& pp = coarseMesh_.boundaryMesh()[patchID]; const labelList& coarsePatchFace = coarseMesh_.patchFaceMap()[patchID]; - const labelList& agglom = finalAgglom_[patchID]; - label nAgglom = max(agglom) + 1; - - labelListList coarseToFine(invertOneToMany(nAgglom, agglom)); - scalarList Tave(pp.size(), 0.0); scalarList Eave(Tave.size(), 0.0); scalarList Hoiave(Tave.size(), 0.0); - forAll(coarseToFine, coarseI) + if (pp.size() > 0) { - const label coarseFaceID = coarsePatchFace[coarseI]; - const labelList& fineFaces = coarseToFine[coarseFaceID]; - UIndirectList fineSf - ( - sf, - fineFaces - ); - scalar area = sum(fineSf()); - // Temperature, emissivity and external flux area weighting - forAll(fineFaces, j) - { - label faceI = fineFaces[j]; - Tave[coarseI] += (Tp[faceI]*sf[faceI])/area; - Eave[coarseI] += (eb[faceI]*sf[faceI])/area; - Hoiave[coarseI] += (Hoi[faceI]*sf[faceI])/area; - } + const labelList& agglom = finalAgglom_[patchID]; + label nAgglom = max(agglom) + 1; - localCoarseTave.append(Tave[coarseI]); - localCoarseEave.append(Eave[coarseI]); - localCoarseHoave.append(Hoiave[coarseI]); + labelListList coarseToFine(invertOneToMany(nAgglom, agglom)); + + //scalarList Tave(pp.size(), 0.0); + //scalarList Eave(Tave.size(), 0.0); + //scalarList Hoiave(Tave.size(), 0.0); + + forAll(coarseToFine, coarseI) + { + const label coarseFaceID = coarsePatchFace[coarseI]; + const labelList& fineFaces = coarseToFine[coarseFaceID]; + UIndirectList fineSf + ( + sf, + fineFaces + ); + scalar area = sum(fineSf()); + // Temperature, emissivity and external flux area weighting + forAll(fineFaces, j) + { + label faceI = fineFaces[j]; + Tave[coarseI] += (Tp[faceI]*sf[faceI])/area; + Eave[coarseI] += (eb[faceI]*sf[faceI])/area; + Hoiave[coarseI] += (Hoi[faceI]*sf[faceI])/area; + } + + //localCoarseTave.append(Tave[coarseI]); + //localCoarseEave.append(Eave[coarseI]); + //localCoarseHoave.append(Hoiave[coarseI]); + } } + + localCoarseTave.append(Tave); + localCoarseEave.append(Eave); + localCoarseHoave.append(Hoiave); } // Fill the local values to distribute @@ -494,7 +505,7 @@ void Foam::radiation::viewFactor::calculate() scalar invEj = 1.0/E[j]; if (i==j) { - CLU_()[i][j] = invEj - (invEj-1.0)*Fmatrix_()[i][j]; + CLU_()[i][j] = invEj-(invEj-1.0)*Fmatrix_()[i][j]; } else { @@ -540,30 +551,35 @@ void Foam::radiation::viewFactor::calculate() forAll(selectedPatches_, i) { const label patchID = selectedPatches_[i]; - scalarField& Qrp = Qr_.boundaryField()[patchID]; - const scalarField& sf = mesh_.magSf().boundaryField()[patchID]; - const labelList& agglom = finalAgglom_[patchID]; - label nAgglom = max(agglom)+1; - - labelListList coarseToFine(invertOneToMany(nAgglom, agglom)); - - const labelList& coarsePatchFace = coarseMesh_.patchFaceMap()[patchID]; - - scalar heatFlux = 0.0; - forAll(coarseToFine, coarseI) + const polyPatch& pp = mesh_.boundaryMesh()[patchID]; + if (pp.size() > 0) { - label globalCoarse = - globalNumbering.toGlobal(Pstream::myProcNo(), globCoarseId); - const label coarseFaceID = coarsePatchFace[coarseI]; - const labelList& fineFaces = coarseToFine[coarseFaceID]; - forAll(fineFaces, k) - { - label faceI = fineFaces[k]; + scalarField& Qrp = Qr_.boundaryField()[patchID]; + const scalarField& sf = mesh_.magSf().boundaryField()[patchID]; + const labelList& agglom = finalAgglom_[patchID]; + label nAgglom = max(agglom)+1; - Qrp[faceI] = q[globalCoarse]; - heatFlux += Qrp[faceI]*sf[faceI]; + labelListList coarseToFine(invertOneToMany(nAgglom, agglom)); + + const labelList& coarsePatchFace = + coarseMesh_.patchFaceMap()[patchID]; + + scalar heatFlux = 0.0; + forAll(coarseToFine, coarseI) + { + label globalCoarse = + globalNumbering.toGlobal(Pstream::myProcNo(), globCoarseId); + const label coarseFaceID = coarsePatchFace[coarseI]; + const labelList& fineFaces = coarseToFine[coarseFaceID]; + forAll(fineFaces, k) + { + label faceI = fineFaces[k]; + + Qrp[faceI] = q[globalCoarse]; + heatFlux += Qrp[faceI]*sf[faceI]; + } + globCoarseId ++; } - globCoarseId ++; } } @@ -634,5 +650,4 @@ Foam::radiation::viewFactor::Ru() const ); } - // ************************************************************************* // From 9aab5c234b538069cfb9a30f5430420ebf458284 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 8 Jul 2011 13:11:50 +0100 Subject: [PATCH 20/54] ENH: Added pre-evolve hook to cloud function objects BUG: Corrected particleTracks cloud model for parallel usage --- .../Templates/KinematicCloud/KinematicCloud.C | 2 ++ .../CloudFunctionObject/CloudFunctionObject.C | 7 +++++++ .../CloudFunctionObject/CloudFunctionObject.H | 3 +++ .../CloudFunctionObjectList.C | 10 ++++++++++ .../CloudFunctionObjectList.H | 3 +++ .../ParticleTracks/ParticleTracks.C | 19 ++++++++++++++++--- .../ParticleTracks/ParticleTracks.H | 3 +++ 7 files changed, 44 insertions(+), 3 deletions(-) diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index 42467d15d2..1a28edcaeb 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C @@ -609,6 +609,8 @@ void Foam::KinematicCloud::preEvolve() pAmbient_ = constProps_.dict().template lookupOrDefault("pAmbient", pAmbient_); + + functions_.preEvolve(); } diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.C index ba7e869816..c7408718bc 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.C @@ -74,6 +74,13 @@ Foam::CloudFunctionObject::~CloudFunctionObject() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +void Foam::CloudFunctionObject::preEvolve() +{ + // do nothing +} + + template void Foam::CloudFunctionObject::postEvolve() { diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.H index 6a2b05d866..9708b92594 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.H @@ -123,6 +123,9 @@ public: // Evaluation + //- Pre-evolve hook + virtual void preEvolve(); + //- Post-evolve hook virtual void postEvolve(); diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.C index 639276e7cd..bcfaa80fa9 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.C @@ -107,6 +107,16 @@ Foam::CloudFunctionObjectList::~CloudFunctionObjectList() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +void Foam::CloudFunctionObjectList::preEvolve() +{ + forAll(*this, i) + { + this->operator[](i).preEvolve(); + } +} + + template void Foam::CloudFunctionObjectList::postEvolve() { diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.H index dcc27143ab..d1e430e2ca 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.H @@ -103,6 +103,9 @@ public: // Evaluation + //- Pre-evolve hook + virtual void preEvolve(); + //- Post-evolve hook virtual void postEvolve(); diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.C index f02eb29076..3deca9409c 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.C @@ -95,6 +95,19 @@ Foam::ParticleTracks::~ParticleTracks() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +void Foam::ParticleTracks::preEvolve() +{ + if (!cloudPtr_.valid()) + { + cloudPtr_.reset + ( + this->owner().cloneBare(this->owner().name() + "Tracks").ptr() + ); + } +} + + template void Foam::ParticleTracks::postPatch(const parcelType&, const label) {} @@ -111,10 +124,10 @@ void Foam::ParticleTracks::postFace(const parcelType& p) { if (!cloudPtr_.valid()) { - cloudPtr_.reset + FatalErrorIn ( - this->owner().cloneBare(this->owner().name() + "Tracks").ptr() - ); + "Foam::ParticleTracks::postFace(const parcelType&)" + )<< "Cloud storage not allocated" << abort(FatalError); } hitTableType::iterator iter = diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.H index 283d03d7cd..0aee5d57f2 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.H @@ -136,6 +136,9 @@ public: // Evaluation + //- Pre-evolve hook + virtual void preEvolve(); + //- Post-patch hook virtual void postPatch(const parcelType& p, const label patchI); From 6c9dacd22964e0f56f570944095166a408a0ae18 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 8 Jul 2011 16:21:21 +0200 Subject: [PATCH 21/54] STYLE: drop 'goto' in favour of returning a value --- src/OSspecific/POSIX/POSIX.C | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/OSspecific/POSIX/POSIX.C b/src/OSspecific/POSIX/POSIX.C index 3dbd628f04..bc06554811 100644 --- a/src/OSspecific/POSIX/POSIX.C +++ b/src/OSspecific/POSIX/POSIX.C @@ -286,7 +286,7 @@ Foam::fileNameList Foam::findEtcFiles results.append(fullName); if (findFirst) { - goto DONE; + return results; } } @@ -296,7 +296,7 @@ Foam::fileNameList Foam::findEtcFiles results.append(fullName); if (findFirst) { - goto DONE; + return results; } } } @@ -316,7 +316,7 @@ Foam::fileNameList Foam::findEtcFiles results.append(fullName); if (findFirst) { - goto DONE; + return results; } } @@ -326,7 +326,7 @@ Foam::fileNameList Foam::findEtcFiles results.append(fullName); if (findFirst) { - goto DONE; + return results; } } } @@ -346,7 +346,7 @@ Foam::fileNameList Foam::findEtcFiles results.append(fullName); if (findFirst) { - goto DONE; + return results; } } @@ -356,7 +356,7 @@ Foam::fileNameList Foam::findEtcFiles results.append(fullName); if (findFirst) { - goto DONE; + return results; } } } @@ -374,7 +374,7 @@ Foam::fileNameList Foam::findEtcFiles results.append(fullName); if (findFirst) { - goto DONE; + return results; } } } @@ -393,7 +393,6 @@ Foam::fileNameList Foam::findEtcFiles } } -DONE: // Return list of matching paths or empty list if none found return results; } From 6f505d8318d5e5c320d2e4fa67f8f3f85640b3c6 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 8 Jul 2011 17:09:36 +0100 Subject: [PATCH 22/54] SpalartAllmaras: corrected the turbulent viscosity used to transport nuTilda --- .../compressible/RAS/SpalartAllmaras/SpalartAllmaras.H | 2 +- .../incompressible/RAS/SpalartAllmaras/SpalartAllmaras.C | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/turbulenceModels/compressible/RAS/SpalartAllmaras/SpalartAllmaras.H b/src/turbulenceModels/compressible/RAS/SpalartAllmaras/SpalartAllmaras.H index 1293fa6d70..d9c1e59c7d 100644 --- a/src/turbulenceModels/compressible/RAS/SpalartAllmaras/SpalartAllmaras.H +++ b/src/turbulenceModels/compressible/RAS/SpalartAllmaras/SpalartAllmaras.H @@ -170,7 +170,7 @@ public: new volScalarField ( "DnuTildaEff", - rho_*nuTilda_/sigmaNut_ + mu() + (rho_*nuTilda_ + mu())/sigmaNut_ ) ); } diff --git a/src/turbulenceModels/incompressible/RAS/SpalartAllmaras/SpalartAllmaras.C b/src/turbulenceModels/incompressible/RAS/SpalartAllmaras/SpalartAllmaras.C index 381a4e17fe..e2bf3cc1fd 100644 --- a/src/turbulenceModels/incompressible/RAS/SpalartAllmaras/SpalartAllmaras.C +++ b/src/turbulenceModels/incompressible/RAS/SpalartAllmaras/SpalartAllmaras.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -233,7 +233,7 @@ tmp SpalartAllmaras::DnuTildaEff() const { return tmp ( - new volScalarField("DnuTildaEff", nuTilda_/sigmaNut_ + nu()) + new volScalarField("DnuTildaEff", (nuTilda_ + nu())/sigmaNut_) ); } From f6a370064863cb3db81d8cb6ab73258b6cf45824 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 8 Jul 2011 17:55:29 +0100 Subject: [PATCH 23/54] ENH: MultiInteraction: combine multiple wall interaction models --- .../makeParcelPatchInteractionModels.H | 4 +- .../MultiInteraction/MultiInteraction.C | 188 ++++++++++++++++++ .../MultiInteraction/MultiInteraction.H | 165 +++++++++++++++ 3 files changed, 356 insertions(+), 1 deletion(-) create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.C create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.H diff --git a/src/lagrangian/intermediate/parcels/include/makeParcelPatchInteractionModels.H b/src/lagrangian/intermediate/parcels/include/makeParcelPatchInteractionModels.H index 13697f2092..9c0e8d2ec5 100644 --- a/src/lagrangian/intermediate/parcels/include/makeParcelPatchInteractionModels.H +++ b/src/lagrangian/intermediate/parcels/include/makeParcelPatchInteractionModels.H @@ -32,6 +32,7 @@ License #include "NoInteraction.H" #include "Rebound.H" #include "StandardWallInteraction.H" +#include "MultiInteraction.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -42,7 +43,8 @@ License makePatchInteractionModelType(LocalInteraction, CloudType); \ makePatchInteractionModelType(NoInteraction, CloudType); \ makePatchInteractionModelType(Rebound, CloudType); \ - makePatchInteractionModelType(StandardWallInteraction, CloudType); + makePatchInteractionModelType(StandardWallInteraction, CloudType); \ + makePatchInteractionModelType(MultiInteraction, CloudType); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.C b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.C new file mode 100644 index 0000000000..9a18036797 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.C @@ -0,0 +1,188 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "MultiInteraction.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +bool Foam::MultiInteraction::read(const dictionary& dict) +{ + // Count dictionaries + + Info<< "Patch interaction model " << typeName << nl + << "Executing in turn " << endl; + + label nModels = 0; + forAllConstIter(dictionary, dict, iter) + { + if (iter().isDict()) + { + Info<< " " << iter().name() << endl; + + nModels++; + } + } + + models_.setSize(nModels); + nModels = 0; + forAllConstIter(dictionary, dict, iter) + { + if (iter().isDict()) + { + models_.set + ( + nModels++, + PatchInteractionModel::New + ( + iter().dict(), + this->owner() + ) + ); + } + } + + oneInteractionOnly_ = Switch(dict.lookup("oneInteractionOnly")); + + if (oneInteractionOnly_) + { + Info<< "Stopping upon first model that interacts with particle." + << nl << endl; + } + else + { + Info<< "Allowing multiple models to interact." + << nl << endl; + } + + return true; +} + + +// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * // + +template +Foam::MultiInteraction::MultiInteraction +( + const dictionary& dict, + CloudType& cloud +) +: + PatchInteractionModel(dict, cloud, typeName) +{ + read(this->coeffDict()); +} + + +template +Foam::MultiInteraction::MultiInteraction +( + const MultiInteraction& pim +) +: + PatchInteractionModel(pim), + oneInteractionOnly_(pim.oneInteractionOnly_), + models_(pim.models_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::MultiInteraction::~MultiInteraction() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +template +bool Foam::MultiInteraction::active() const +{ + forAll(models_, i) + { + if (models_[i].active()) + { + return true; + } + } + return false; +} + + +template +bool Foam::MultiInteraction::correct +( + typename CloudType::parcelType& p, + const polyPatch& pp, + bool& keepParticle, + const scalar trackFraction, + const tetIndices& tetIs +) +{ + label origFacei = p.face(); + label patchi = pp.index(); + + bool interacted = false; + + forAll(models_, i) + { + bool myInteracted = models_[i].correct + ( + p, + this->owner().pMesh().boundaryMesh()[patchi], + keepParticle, + trackFraction, + tetIs + ); + + if (myInteracted && oneInteractionOnly_) + { + break; + } + + interacted = (interacted || myInteracted); + + + // Check if perhaps the interaction model has changed patches + // (CoincidentBaffleInteraction can do this) + + if (p.face() != origFacei) + { + origFacei = p.face(); + patchi = p.patch(p.face()); + + // Interaction model has moved particle off wall? + if (patchi == -1) + { + break; + } + } + } + + return interacted; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.H b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.H new file mode 100644 index 0000000000..b5d8f00a47 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.H @@ -0,0 +1,165 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::MultiInteraction + +Description + Runs multiple patch interaction models in turn. Takes dictionary + where all the subdictionaries are the interaction models. + + // Exit upon first successful interaction or continue doing other + // models. Returned nteraction status will be true if there has been any + // interaction (so logical or) + oneInteractionOnly true; + + model1 + { + patchInteractionModel coincidentBaffleInteraction; + coincidentBaffleInteractionCoeffs + { + coincidentPatches + ( + (pipetteWall_A pipetteCyclic_half0) + (pipetteWall_B pipetteCyclic_half1) + ); + } + } + model2 + { + patchInteractionModel localInteraction; + localInteractionCoeffs + { + patches + ( + cWall + { + type rebound; + } + pipetteWall_A + { + type rebound; + } + pipetteWall_B + { + type rebound; + } + ); + } + } + + +\*---------------------------------------------------------------------------*/ + +#ifndef MultiInteraction_H +#define MultiInteraction_H + +#include "PatchInteractionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class MultiInteraction Declaration +\*---------------------------------------------------------------------------*/ + +template +class MultiInteraction +: + public PatchInteractionModel +{ + // Private data + + Switch oneInteractionOnly_; + + //- Submodels + PtrList > models_; + + + // Private Member Functions + + //- Read settings + bool read(const dictionary&); + +public: + + //- Runtime type information + TypeName("multiInteraction"); + + + // Constructors + + //- Construct from dictionary + MultiInteraction(const dictionary& dict, CloudType& cloud); + + //- Construct copy from owner cloud and patch interaction model + MultiInteraction(const MultiInteraction& pim); + + //- Construct and return a clone using supplied owner cloud + virtual autoPtr > clone() const + { + return autoPtr > + ( + new MultiInteraction(*this) + ); + } + + + //- Destructor + virtual ~MultiInteraction(); + + + // Member Functions + + //- Flag to indicate whether model activates patch interaction model + virtual bool active() const; + + //- Apply velocity correction + // Returns true if particle remains in same cell + virtual bool correct + ( + typename CloudType::parcelType& p, + const polyPatch& pp, + bool& keepParticle, + const scalar trackFraction, + const tetIndices& tetIs + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "MultiInteraction.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From d81d99d490abac139dd83095e7fef0944918c4ab Mon Sep 17 00:00:00 2001 From: Henry Date: Sat, 9 Jul 2011 22:24:28 +0100 Subject: [PATCH 24/54] bubbleFoam, twoPhaseEulerFoam: Added storage of pressure from the previous iteration for PIMPLE --- .../multiphase/bubbleFoam/bubbleFoam.C | 19 +++++++++++++++---- .../twoPhaseEulerFoam/twoPhaseEulerFoam.C | 9 ++++++--- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C b/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C index d028a1376f..e526266c90 100644 --- a/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C +++ b/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C @@ -34,6 +34,7 @@ Description #include "nearWallDist.H" #include "wallFvPatch.H" #include "Switch.H" + #include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,6 +48,9 @@ int main(int argc, char *argv[]) #include "readGravitationalAcceleration.H" #include "createFields.H" #include "initContinuityErrs.H" + #include "readTimeControls.H" + #include "CourantNo.H" + #include "setInitialDeltaT.H" pimpleControl pimple(mesh); @@ -54,16 +58,23 @@ int main(int argc, char *argv[]) Info<< "\nStarting time loop\n" << endl; - while (runTime.loop()) + while (runTime.run()) { - Info<< "Time = " << runTime.timeName() << nl << endl; - #include "readBubbleFoamControls.H" #include "CourantNo.H" + #include "setDeltaT.H" + + runTime++; + Info<< "Time = " << runTime.timeName() << nl << endl; // --- Pressure-velocity PIMPLE corrector loop for (pimple.start(); pimple.loop(); pimple++) { + if (pimple.nOuterCorr() != 1) + { + p.storePrevIter(); + } + #include "alphaEqn.H" #include "liftDragCoeffs.H" #include "UEqns.H" @@ -73,7 +84,7 @@ int main(int argc, char *argv[]) { #include "pEqn.H" - if (correctAlpha) + if (correctAlpha && !pimple.finalIter()) { #include "alphaEqn.H" } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C index 17cf2e7ec0..3341d192dd 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C @@ -26,7 +26,7 @@ Application Description Solver for a system of 2 incompressible fluid phases with one phase - dispersed, e.g. gas bubbles in a liquid. + dispersed, e.g. gas bubbles in a liquid or solid particles in a gas. \*---------------------------------------------------------------------------*/ @@ -78,10 +78,13 @@ int main(int argc, char *argv[]) // --- Pressure-velocity PIMPLE corrector loop for (pimple.start(); pimple.loop(); pimple++) { + if (pimple.nOuterCorr() != 1) + { + p.storePrevIter(); + } + #include "alphaEqn.H" - #include "liftDragCoeffs.H" - #include "UEqns.H" // --- PISO loop From 0ac85fbdf58132a6fb97c70df88fbdf19eb01f1a Mon Sep 17 00:00:00 2001 From: Henry Date: Sat, 9 Jul 2011 22:26:06 +0100 Subject: [PATCH 25/54] Clang: Updates to support the changes in the current SVN version of Clang/LLVM --- etc/config/settings.csh | 4 +-- etc/config/settings.sh | 4 +-- src/OpenFOAM/db/typeInfo/className.H | 2 -- .../fanPressureFvPatchScalarField.C | 4 +-- .../surfaceFilmModels/noFilm/noFilm.C | 6 ++-- .../surfaceFilmModel/surfaceFilmModel.C | 32 ++++++++----------- .../surfaceFilmModel/surfaceFilmModel.H | 3 -- .../triSurfaceFields/triSurfaceFields.C | 12 ------- 8 files changed, 22 insertions(+), 45 deletions(-) diff --git a/etc/config/settings.csh b/etc/config/settings.csh index 6b5f43dbc8..2ec4117a2b 100644 --- a/etc/config/settings.csh +++ b/etc/config/settings.csh @@ -236,8 +236,8 @@ case ThirdParty: # using clang - not gcc setenv WM_CC 'clang' setenv WM_CXX 'clang++' - set clang_version=llvm-2.9 - #set clang_version=llvm-svn + #set clang_version=llvm-2.9 + set clang_version=llvm-svn breaksw default: echo diff --git a/etc/config/settings.sh b/etc/config/settings.sh index 4e801efd83..057709d316 100644 --- a/etc/config/settings.sh +++ b/etc/config/settings.sh @@ -253,8 +253,8 @@ OpenFOAM | ThirdParty) # using clang - not gcc export WM_CC='clang' export WM_CXX='clang++' - clang_version=llvm-2.9 - #clang_version=llvm-svn + #clang_version=llvm-2.9 + clang_version=llvm-svn ;; *) echo diff --git a/src/OpenFOAM/db/typeInfo/className.H b/src/OpenFOAM/db/typeInfo/className.H index f14cc6100c..d4b87023d2 100644 --- a/src/OpenFOAM/db/typeInfo/className.H +++ b/src/OpenFOAM/db/typeInfo/className.H @@ -119,7 +119,6 @@ public: \ defineTypeNameWithName(Type, Name) //- Define the typeName as \a Name for template sub-classes # define defineTemplate2TypeNameWithName(Type, Name) \ - template<> \ template<> \ defineTypeNameWithName(Type, Name) #endif @@ -161,7 +160,6 @@ public: \ defineDebugSwitchWithName(Type, Name, DebugSwitch) //- Define the debug information for templates sub-classes, lookup as \a Name # define defineTemplate2DebugSwitchWithName(Type, Name, DebugSwitch) \ - template<> \ template<> \ defineDebugSwitchWithName(Type, Name, DebugSwitch) #endif diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C index 260fb328dc..19404c4f53 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C @@ -33,9 +33,9 @@ License namespace Foam { template<> - const char* Foam::NamedEnum + const char* NamedEnum < - Foam::fanPressureFvPatchScalarField::fanFlowDirection, + fanPressureFvPatchScalarField::fanFlowDirection, 2 >::names[] = { diff --git a/src/regionModels/surfaceFilmModels/noFilm/noFilm.C b/src/regionModels/surfaceFilmModels/noFilm/noFilm.C index 26bad8f390..7fe71e4ead 100644 --- a/src/regionModels/surfaceFilmModels/noFilm/noFilm.C +++ b/src/regionModels/surfaceFilmModels/noFilm/noFilm.C @@ -62,12 +62,12 @@ bool noFilm::read() noFilm::noFilm ( - const word&, + const word& modelType, const fvMesh& mesh, - const dimensionedVector& + const dimensionedVector& g ) : - surfaceFilmModel(mesh) + surfaceFilmModel(modelType, mesh, g) {} diff --git a/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.C b/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.C index bfded1d8fa..f595568ce5 100644 --- a/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.C +++ b/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.C @@ -28,17 +28,19 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -template<> -const char* Foam::NamedEnum -< - Foam::regionModels::surfaceFilmModels::surfaceFilmModel::thermoModelType, - 2 ->::names[] = +namespace Foam { - "constant", - "singleComponent" -}; - + template<> + const char* NamedEnum + < + regionModels::surfaceFilmModels::surfaceFilmModel::thermoModelType, + 2 + >::names[] = + { + "constant", + "singleComponent" + }; +} const Foam::NamedEnum < @@ -48,7 +50,7 @@ const Foam::NamedEnum Foam::regionModels::surfaceFilmModels::surfaceFilmModel::thermoModelTypeNames_; -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { @@ -81,14 +83,6 @@ bool surfaceFilmModel::read() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -surfaceFilmModel::surfaceFilmModel(const fvMesh& mesh) -: - singleLayerRegion(mesh), - g_(vector::zero), - thermoModel_(tmConstant) -{} - - surfaceFilmModel::surfaceFilmModel ( const word& modelType, diff --git a/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H b/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H index 1e26c9db9c..00a4814695 100644 --- a/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H +++ b/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H @@ -130,9 +130,6 @@ public: // Constructors - //- Construct null - surfaceFilmModel(const fvMesh& mesh); - //- Construct from type name, mesh and gravity vector surfaceFilmModel ( diff --git a/src/triSurface/triSurfaceFields/triSurfaceFields.C b/src/triSurface/triSurfaceFields/triSurfaceFields.C index d597f9ecba..6f48d9f2c3 100644 --- a/src/triSurface/triSurfaceFields/triSurfaceFields.C +++ b/src/triSurface/triSurfaceFields/triSurfaceFields.C @@ -32,36 +32,24 @@ namespace Foam // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -#ifndef __clang__ template<> -#endif const word triSurfaceLabelField::typeName("triSurfaceLabelField"); -#ifndef __clang__ template<> -#endif const word triSurfaceScalarField::typeName("triSurfaceScalarField"); -#ifndef __clang__ template<> -#endif const word triSurfaceVectorField::typeName("triSurfaceVectorField"); -#ifndef __clang__ template<> -#endif const word triSurfaceSphericalTensorField::typeName ("triSurfaceSphericalTensorField"); -#ifndef __clang__ template<> -#endif const word triSurfaceSymmTensorField::typeName ("triSurfaceSymmTensorField"); -#ifndef __clang__ template<> -#endif const word triSurfaceTensorField::typeName("triSurfaceTensorField"); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // From d9d8c9c02d7f76cc436d3e61f7b71b54c0f19bea Mon Sep 17 00:00:00 2001 From: sergio Date: Mon, 11 Jul 2011 10:22:33 +0100 Subject: [PATCH 26/54] ENH: editng Allrun --- .../multiRegionHeaterRadiation/Allrun | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun index 208c5c815a..1b0ffb01e9 100755 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun @@ -42,12 +42,23 @@ done #-- Run on single processor runApplication `getApplication` +## Run in parallel ## Decompose #for i in bottomAir topAir heater leftSolid rightSolid #do # decomposePar -region $i > log.decomposePar.$i 2>&1 #done # +#for i in bottomAir topAir +#do +# mpirun -np 4 faceAgglomerate -region $i -dict viewFactorsDict -parallel> log.faceAgglomerate.$i 2>&1 +#done + +#for i in bottomAir topAir +#do +# mpirun -np 4 viewFactorsGen -region $i -parallel > log.viewFactorsGen.$i 2>&1 +#done + ## Run #runParallel `getApplication` 4 # @@ -61,9 +72,6 @@ runApplication `getApplication` echo echo "creating files for paraview post-processing" echo -for i in bottomAir topAir heater leftSolid rightSolid -do - paraFoam -touch -region $i -done +paraFoam -touchAll # ----------------------------------------------------------------- end-of-file From 87df0374749e8d243b4cc37f4b494d0de19d92e2 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 11 Jul 2011 10:37:43 +0100 Subject: [PATCH 27/54] ENH: Cloud.H: protect remainder for tracking rescue message --- src/lagrangian/basic/Cloud/Cloud.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lagrangian/basic/Cloud/Cloud.H b/src/lagrangian/basic/Cloud/Cloud.H index e11905b266..e55232a2f4 100644 --- a/src/lagrangian/basic/Cloud/Cloud.H +++ b/src/lagrangian/basic/Cloud/Cloud.H @@ -193,7 +193,7 @@ public: void trackingRescue() const { nTrackingRescues_++; - if (cloud::debug && nTrackingRescues_ % size() == 0) + if (cloud::debug && size() && (nTrackingRescues_ % size() == 0)) { Pout<< " " << nTrackingRescues_ << " tracking rescues " << endl; From 5c0570bb888e60864c6921e10fb65e9fffa7a527 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 11 Jul 2011 11:06:32 +0100 Subject: [PATCH 28/54] ENH: partialWrite: do lagrangian fields --- .../functionObjects/IO/controlDict | 13 ++++- .../IO/partialWrite/partialWrite.C | 49 ++++++++++++++++++- 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/src/postProcessing/functionObjects/IO/controlDict b/src/postProcessing/functionObjects/IO/controlDict index 11ecd9b106..d0fa908273 100644 --- a/src/postProcessing/functionObjects/IO/controlDict +++ b/src/postProcessing/functionObjects/IO/controlDict @@ -14,6 +14,10 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// So we get a decent warning if we have multiple functionObject entries +// with the same name. +#inputMode error; + application icoFoam; startFrom startTime; @@ -56,11 +60,16 @@ functions // Where to load it from functionObjectLibs ("libIOFunctionObjects.so"); + // Optional mesh region to operate on. Only one partialWrite per + // region allowed. + region wallFilmRegion; + // Execute upon outputTime outputControl outputTime; - // Objects to write every outputTime - objectNames (p); + // Objects (fields or lagrangian fields in any of the clouds) + // to write every outputTime + objectNames (p positions nParticle); // Write as normal every writeInterval'th outputTime. writeInterval 3; } diff --git a/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.C b/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.C index 1ea7ae253d..431c1febd9 100644 --- a/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.C +++ b/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.C @@ -28,6 +28,7 @@ License #include "Time.H" #include "IOobjectList.H" #include "polyMesh.H" +#include "cloud.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -132,7 +133,12 @@ void Foam::partialWrite::write() IOobjectList objects(obr_, obr_.time().timeName()); - forAllConstIter(HashPtrTable, objects, iter) + if (debug) + { + Pout<< "For region:" << obr_.name() << endl; + } + + forAllConstIter(IOobjectList, objects, iter) { if (!objectNames_.found(iter()->name())) { @@ -147,6 +153,47 @@ void Foam::partialWrite::write() rm(f); } } + + // Do the lagrangian files as well. + fileNameList cloudDirs + ( + readDir + ( + obr_.time().timePath()/dbDir/cloud::prefix, + fileName::DIRECTORY + ) + ); + forAll(cloudDirs, i) + { + if (debug) + { + Pout<< "For cloud:" << cloudDirs[i] << endl; + } + + IOobjectList sprayObjs + ( + obr_, + obr_.time().timeName(), + cloud::prefix/cloudDirs[i] + ); + forAllConstIter(IOobjectList, sprayObjs, iter) + { + if (!objectNames_.found(iter()->name())) + { + const fileName f = + obr_.time().timePath() + /dbDir + /cloud::prefix + /cloudDirs[i] + /iter()->name(); + if (debug) + { + Pout<< " rm " << f << endl; + } + rm(f); + } + } + } } } } From bbbaf89c20b7488d7fd42cef8c7cc02a4d3ffa60 Mon Sep 17 00:00:00 2001 From: sergio Date: Tue, 12 Jul 2011 15:51:08 +0100 Subject: [PATCH 29/54] ENH: Adding general constructors with dictionary to implement thermal baffle hold at a boundary --- .../extrudeToRegionMeshDict | 7 + .../regionModel/regionModel/regionModel.C | 90 ++++++- .../regionModel/regionModel/regionModel.H | 20 ++ .../regionModel/regionModel/regionModelI.H | 6 + .../regionModel/regionModel1D/regionModel1D.C | 44 ++++ .../regionModel/regionModel1D/regionModel1D.H | 14 ++ .../thermoBaffleModels/Make/files | 2 + ...emperatureThermoBaffleFvPatchScalarField.C | 235 ++++++++++++++++++ ...emperatureThermoBaffleFvPatchScalarField.H | 216 ++++++++++++++++ .../thermoBaffleModels/noThermo/noThermo.C | 8 + .../thermoBaffleModels/noThermo/noThermo.H | 7 + .../thermoBaffle2D/thermoBaffle2D.C | 111 +++++++-- .../thermoBaffle2D/thermoBaffle2D.H | 22 +- .../thermoBaffle2D/thermoBaffle2DI.H | 5 - .../thermoBaffleModel/thermoBaffleModel.C | 81 ++++-- .../thermoBaffleModel/thermoBaffleModel.H | 49 +++- .../thermoBaffleModel/thermoBaffleModelNew.C | 29 +++ .../basicSolidThermo/basicSolidThermo.C | 87 +++++++ .../basicSolidThermo/basicSolidThermo.H | 18 ++ .../basicSolidThermo/basicSolidThermoNew.C | 34 ++- .../constSolidThermo/constSolidThermo.C | 44 ++++ .../constSolidThermo/constSolidThermo.H | 4 + .../directionalKSolidThermo.C | 70 +++++- .../directionalKSolidThermo.H | 6 + .../interpolateSolid/interpolateSolid.C | 7 +- .../interpolatedSolidThermo.C | 15 +- .../interpolatedSolidThermo.H | 9 + .../isotropicKSolidThermo.C | 34 +++ .../isotropicKSolidThermo.H | 4 + .../makeSolidMixtureThermo.H | 6 + .../solidMixtureThermo/solidMixtureThermo.C | 26 ++ .../solidMixtureThermo/solidMixtureThermo.H | 3 + 32 files changed, 1245 insertions(+), 68 deletions(-) create mode 100644 src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.C create mode 100644 src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.H diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMeshDict b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMeshDict index fbd26416b8..739f929fd3 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMeshDict +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMeshDict @@ -20,6 +20,9 @@ region liquidFilm; // FaceZones to extrude faceZones (f0); +// FaceZone shadow +//faceZonesShadow (fBaffleShadow); + // Adapt the original mesh to have directMapped patches at where the // faceZones are? // If true: @@ -32,6 +35,10 @@ adaptMesh true; // Extrude 1D-columns of cells? oneD false; +// If oneD is true. Specify which boundary is wanted between the layers +//oneDPolyPatchType emptyPolyPatch; //wedgePolyPatch + + //- Extrusion model to use. The only logical choice is linearNormal? //- Linear extrusion in normal direction diff --git a/src/regionModels/regionModel/regionModel/regionModel.C b/src/regionModels/regionModel/regionModel/regionModel.C index bd699e05ae..df40e55b1e 100644 --- a/src/regionModels/regionModel/regionModel/regionModel.C +++ b/src/regionModels/regionModel/regionModel/regionModel.C @@ -60,6 +60,28 @@ void Foam::regionModels::regionModel::constructMeshObjects() } +void Foam::regionModels::regionModel::constructMeshObjects +( + const dictionary& dict +) +{ + // construct region mesh + regionMeshPtr_.reset + ( + new fvMesh + ( + IOobject + ( + dict.lookup("regionName"), + time_.timeName(), + time_, + IOobject::MUST_READ + ) + ) + ); +} + + void Foam::regionModels::regionModel::initialise() { if (debug) @@ -148,6 +170,26 @@ bool Foam::regionModels::regionModel::read() } +bool Foam::regionModels::regionModel::read(const dictionary& dict) +{ + if (active_) + { + if (const dictionary* dictPtr = dict.subDictPtr(modelName_ + "Coeffs")) + { + coeffs_ <<= *dictPtr; + } + + infoOutput_.readIfPresent("infoOutput", dict); + + return true; + } + else + { + return false; + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::regionModels::regionModel::regionModel(const fvMesh& mesh) @@ -219,6 +261,52 @@ Foam::regionModels::regionModel::regionModel } +Foam::regionModels::regionModel::regionModel +( + const fvMesh& mesh, + const word& regionType, + const word& modelName, + const dictionary& dict, + bool readFields +) +: + IOdictionary + ( + IOobject + ( + regionType, + mesh.time().constant(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE, + true + ), + dict + ), + primaryMesh_(mesh), + time_(mesh.time()), + active_(dict.lookup("active")), + infoOutput_(false), + modelName_(modelName), + regionMeshPtr_(NULL), + coeffs_(dict.subOrEmptyDict(modelName + "Coeffs")), + primaryPatchIDs_(), + intCoupledPatchIDs_(), + mappedPatches_() +{ + if (active_) + { + constructMeshObjects(dict); + initialise(); + + if (readFields) + { + read(dict); + } + } +} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::regionModels::regionModel::~regionModel() @@ -254,7 +342,7 @@ void Foam::regionModels::regionModel::evolve() << regionMesh().name() << endl; // Update any input information - read(); + //read(); // Pre-evolve preEvolveRegion(); diff --git a/src/regionModels/regionModel/regionModel/regionModel.H b/src/regionModels/regionModel/regionModel/regionModel.H index 01300671d9..9caf929e2e 100644 --- a/src/regionModels/regionModel/regionModel/regionModel.H +++ b/src/regionModels/regionModel/regionModel/regionModel.H @@ -76,6 +76,9 @@ private: //- Construct region mesh and fields void constructMeshObjects(); + //- Construct region mesh and dictionary + void constructMeshObjects(const dictionary& dict); + //- Initialise the region void initialise(); @@ -123,6 +126,9 @@ protected: //- Read control parameters from dictionary virtual bool read(); + //- Read control parameters from dictionary + virtual bool read(const dictionary& dict); + public: @@ -144,6 +150,17 @@ public: bool readFields = true ); + //- Construct from mesh and name and dict + regionModel + ( + const fvMesh& mesh, + const word& regionType, + const word& modelName, + const dictionary& dict, + bool readFields = true + ); + + //- Destructor virtual ~regionModel(); @@ -162,6 +179,9 @@ public: //- Return the active flag inline const Switch& active() const; + //- Return the information flag + inline const Switch& infoOutput() const; + //- Return the model name inline const word& modelName() const; diff --git a/src/regionModels/regionModel/regionModel/regionModelI.H b/src/regionModels/regionModel/regionModel/regionModelI.H index d99b156bf6..bf543c7b4b 100644 --- a/src/regionModels/regionModel/regionModel/regionModelI.H +++ b/src/regionModels/regionModel/regionModel/regionModelI.H @@ -46,6 +46,12 @@ inline const Foam::Switch& Foam::regionModels::regionModel::active() const } +inline const Foam::Switch& Foam::regionModels::regionModel::infoOutput() const +{ + return infoOutput_; +} + + inline const Foam::word& Foam::regionModels::regionModel::modelName() const { return modelName_; diff --git a/src/regionModels/regionModel/regionModel1D/regionModel1D.C b/src/regionModels/regionModel/regionModel1D/regionModel1D.C index 3902a689a7..2266ffc655 100644 --- a/src/regionModels/regionModel/regionModel1D/regionModel1D.C +++ b/src/regionModels/regionModel/regionModel1D/regionModel1D.C @@ -159,6 +159,21 @@ bool Foam::regionModels::regionModel1D::read() } +bool Foam::regionModels::regionModel1D::read(const dictionary& dict) +{ + if (regionModel::read(dict)) + { + moveMesh_.readIfPresent("moveMesh", dict); + + return true; + } + else + { + return false; + } +} + + Foam::tmp Foam::regionModels::regionModel1D::moveMesh ( const scalarList& deltaV, @@ -301,6 +316,35 @@ Foam::regionModels::regionModel1D::regionModel1D } +Foam::regionModels::regionModel1D::regionModel1D +( + const fvMesh& mesh, + const word& regionType, + const word& modelName, + const dictionary& dict, + bool readFields +) +: + regionModel(mesh, regionType, modelName, dict, readFields), + boundaryFaceFaces_(regionMesh().nCells()), + boundaryFaceCells_(regionMesh().nCells()), + boundaryFaceOppositeFace_(regionMesh().nCells()), + nLayers_(0), + nMagSfPtr_(NULL), + moveMesh_(false) +{ + if (active_) + { + constructMeshObjects(); + initialise(); + + if (readFields) + { + read(dict); + } + } +} + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::regionModels::regionModel1D::~regionModel1D() diff --git a/src/regionModels/regionModel/regionModel1D/regionModel1D.H b/src/regionModels/regionModel/regionModel1D/regionModel1D.H index 7d51d3ef36..eb7304d704 100644 --- a/src/regionModels/regionModel/regionModel1D/regionModel1D.H +++ b/src/regionModels/regionModel/regionModel1D/regionModel1D.H @@ -105,6 +105,9 @@ protected: //- Read control parameters from dictionary virtual bool read(); + //- Read control parameters from dictionary + virtual bool read(const dictionary& dict); + //- Move mesh points according to change in cell volumes // Returns map ordered by cell where 1 = cell moved, 0 = cell unchanged tmp moveMesh @@ -134,6 +137,17 @@ public: bool readFields = true ); + //- Construct from mesh, region type and name and dict + regionModel1D + ( + const fvMesh& mesh, + const word& regionType, + const word& modelName, + const dictionary& dict, + bool readFields = true + ); + + //- Destructor virtual ~regionModel1D(); diff --git a/src/regionModels/thermoBaffleModels/Make/files b/src/regionModels/thermoBaffleModels/Make/files index 1a0352a4bf..41bb7d03db 100644 --- a/src/regionModels/thermoBaffleModels/Make/files +++ b/src/regionModels/thermoBaffleModels/Make/files @@ -3,5 +3,7 @@ thermoBaffleModel/thermoBaffleModelNew.C thermoBaffle2D/thermoBaffle2D.C noThermo/noThermo.C +derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.C + LIB = $(FOAM_LIBBIN)/libthermoBaffleModels diff --git a/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.C b/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.C new file mode 100644 index 0000000000..a78bb2c311 --- /dev/null +++ b/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.C @@ -0,0 +1,235 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "temperatureThermoBaffleFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +temperatureThermoBaffleFvPatchScalarField:: +temperatureThermoBaffleFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + turbulentTemperatureCoupledBaffleMixedFvPatchScalarField(p, iF), + owner_(false), + baffle_(), + solidThermoType_("undefined") +{} + + +temperatureThermoBaffleFvPatchScalarField:: +temperatureThermoBaffleFvPatchScalarField +( + const temperatureThermoBaffleFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + turbulentTemperatureCoupledBaffleMixedFvPatchScalarField + ( + ptf, + p, + iF, + mapper + ), + owner_(ptf.owner_), + baffle_(ptf.baffle_), + solidThermoType_(ptf.solidThermoType_) +{} + + +temperatureThermoBaffleFvPatchScalarField:: +temperatureThermoBaffleFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + turbulentTemperatureCoupledBaffleMixedFvPatchScalarField(p, iF, dict), + owner_(false), + baffle_(), + solidThermoType_() +{ + if (!isA(patch().patch())) + { + FatalErrorIn + ( + "temperatureThermoBaffleFvPatchScalarField::" + "temperatureThermoBaffleFvPatchScalarField\n" + "(\n" + " const fvPatch& p,\n" + " const DimensionedField& iF,\n" + " const dictionary& dict\n" + ")\n" + ) << "\n patch type '" << patch().type() + << "' not type '" << directMappedPatchBase::typeName << "'" + << "\n for patch " << patch().name() + << " of field " << dimensionedInternalField().name() + << " in file " << dimensionedInternalField().objectPath() + << exit(FatalError); + } + + const fvMesh& thisMesh = patch().boundaryMesh().mesh(); + + typedef regionModels::thermoBaffleModels::thermoBaffleModel baffle; + + if + ( + thisMesh.name() == polyMesh::defaultRegion + && !thisMesh.foundObject("thermoBaffle") + && !owner_ + ) + { + Info << "Creating thermal baffle..." << endl; + baffle_.reset(baffle::New(thisMesh, dict).ptr()); + owner_ = true; + dict.lookup("thermoType") >> solidThermoType_; + } +} + + +temperatureThermoBaffleFvPatchScalarField:: +temperatureThermoBaffleFvPatchScalarField +( + const temperatureThermoBaffleFvPatchScalarField& ptf, + const DimensionedField& iF +) +: + turbulentTemperatureCoupledBaffleMixedFvPatchScalarField(ptf, iF), + owner_(ptf.owner_), + baffle_(ptf.baffle_), + solidThermoType_(ptf.solidThermoType_) +{} + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + + +void temperatureThermoBaffleFvPatchScalarField::autoMap +( + const fvPatchFieldMapper& m +) +{ + mixedFvPatchScalarField::autoMap(m); +} + + +void temperatureThermoBaffleFvPatchScalarField::rmap +( + const fvPatchScalarField& ptf, + const labelList& addr +) +{ + mixedFvPatchScalarField::rmap(ptf, addr); +} + + +void temperatureThermoBaffleFvPatchScalarField::updateCoeffs() +{ + if (this->updated()) + { + return; + } + + const fvMesh& thisMesh = patch().boundaryMesh().mesh(); + + if + ( + thisMesh.name() == polyMesh::defaultRegion + && owner_ + ) + { + baffle_->evolve(); + } + + turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs(); +} + + +void temperatureThermoBaffleFvPatchScalarField::write(Ostream& os) const +{ + turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::write(os); + + const fvMesh& thisMesh = patch().boundaryMesh().mesh(); + + if (thisMesh.name() == polyMesh::defaultRegion && owner_) + { + os.writeKeyword("thermoBaffleModel") << baffle_->modelName() + << token::END_STATEMENT << nl; + + os.writeKeyword("regionName") << baffle_->regionMesh().name() + << token::END_STATEMENT << nl; + + os.writeKeyword("infoOutput") << baffle_->infoOutput() + << token::END_STATEMENT << nl; + + os.writeKeyword("active") << baffle_->active() + << token::END_STATEMENT << nl; + + os.writeKeyword(word(baffle_->modelName() + "coeffs")); + + os << baffle_->coeffs() << nl; + + os.writeKeyword("thermoType") << solidThermoType_ + << token::END_STATEMENT << nl; + + os.writeKeyword(word(solidThermoType_ + "Coeffs")) << nl; + + os << indent << '{' << nl + << indent << baffle_->thermo() << nl + << indent << '}' << nl; + } +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + temperatureThermoBaffleFvPatchScalarField +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +// ************************************************************************* // diff --git a/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.H b/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.H new file mode 100644 index 0000000000..2d61bf09c6 --- /dev/null +++ b/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.H @@ -0,0 +1,216 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::temperatureThermoBaffleFvPatchScalarField + +Description + Thermal bounday applied to both sides of the thermal baffle region and + in the primary region. + The primary region creates and evolves the thermal baffle heat transfer + equation. The solid thermo and baffle dictionaries are located on the + primary region. + + type compressible::temperatureThermoBaffle; + + // Coupled BC. + neighbourFieldName T; + K basicThermo; + KName none; + + + // Thermo baffle model + thermoBaffleModel thermoBaffle2D; + regionName baffleRegion; + infoOutput yes; + active yes; + thermoBaffle2DCoeffs + { + } + + + // Solid thermo + thermoType constSolidThermo; + + constSolidThermoCoeffs + { + //- thermo properties + rho rho [1 -3 0 0 0 0 0] 80; + Cp Cp [0 2 -2 -1 0 0 0] 15; + K K [1 1 -3 -1 0 0 0] 0.01; + + //- radiative properties + kappa kappa [0 -1 0 0 0 0 0] 0; + sigmaS sigmaS [0 -1 0 0 0 0 0] 0; + emissivity emissivity [0 0 0 0 0 0 0] 1; + + //- chemical properties + Hf Hf [0 2 -2 0 0 0 0] 0; + } + + value uniform 300; + + +SourceFiles + temperatureThermoBaffleFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef temperatureThermoBaffleFvPatchScalarField_H +#define temperatureThermoBaffleFvPatchScalarField_H + + +#include "autoPtr.H" +#include "regionModel.H" +#include "thermoBaffleModel.H" +#include "turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +namespace Foam +{ +namespace compressible +{ + +/*---------------------------------------------------------------------------*\ + Class temperatureThermoBaffleFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class temperatureThermoBaffleFvPatchScalarField +: + public turbulentTemperatureCoupledBaffleMixedFvPatchScalarField +{ + // Private data + + //- Is the baffle owner + bool owner_; + + //- Thermal baffle + autoPtr baffle_; + + //- Solid thermo type + word solidThermoType_; + + +public: + + //- Runtime type information + TypeName("compressible::temperatureThermoBaffle"); + + + // Constructors + + //- Construct from patch and internal field + temperatureThermoBaffleFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + temperatureThermoBaffleFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // temperatureThermoBaffleFvPatchScalarField onto a new patch + temperatureThermoBaffleFvPatchScalarField + ( + const temperatureThermoBaffleFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new temperatureThermoBaffleFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + temperatureThermoBaffleFvPatchScalarField + ( + const temperatureThermoBaffleFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new temperatureThermoBaffleFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchScalarField&, + const labelList& + ); + + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/thermoBaffleModels/noThermo/noThermo.C b/src/regionModels/thermoBaffleModels/noThermo/noThermo.C index 32b8e32e04..841cfba283 100644 --- a/src/regionModels/thermoBaffleModels/noThermo/noThermo.C +++ b/src/regionModels/thermoBaffleModels/noThermo/noThermo.C @@ -127,6 +127,14 @@ const volScalarField& noThermo::T() const } +const basicSolidThermo& noThermo::thermo() const +{ + FatalErrorIn("const volScalarField& noThermo::T() const") + << "T field not available for " << type() << abort(FatalError); + return reinterpret_cast(null); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace thermoBaffleModels diff --git a/src/regionModels/thermoBaffleModels/noThermo/noThermo.H b/src/regionModels/thermoBaffleModels/noThermo/noThermo.H index 387241cca4..fa4f7f289c 100644 --- a/src/regionModels/thermoBaffleModels/noThermo/noThermo.H +++ b/src/regionModels/thermoBaffleModels/noThermo/noThermo.H @@ -92,6 +92,13 @@ public: // Member Functions + + // Thermo properties + + //- Return const reference to the basicSolidThermo + virtual const basicSolidThermo& thermo() const; + + // Fields //- Return the film specific heat capacity [J/kg/K] diff --git a/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.C b/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.C index 0cf810afc1..c77ac867d7 100644 --- a/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.C +++ b/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.C @@ -46,6 +46,7 @@ namespace thermoBaffleModels defineTypeNameAndDebug(thermoBaffle2D, 0); addToRunTimeSelectionTable(thermoBaffleModel, thermoBaffle2D, mesh); +addToRunTimeSelectionTable(thermoBaffleModel, thermoBaffle2D, dictionary); // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -90,8 +91,8 @@ void thermoBaffle2D::solveEnergy() volScalarField K("K", thermo_->K()); - //If region is one-dimension variable thickness can be used. - if (oneD_) + //If region is one-dimension variable thickness + if (oneD_ && !constantThickness_) { // Scale K and rhoCp and fill Q in the internal baffle region. const label patchI = intCoupledPatchIDs_[0]; @@ -136,6 +137,60 @@ void thermoBaffle2D::solveEnergy() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +thermoBaffle2D::thermoBaffle2D +( + const word& modelType, + const fvMesh& mesh, + const dictionary& dict +) +: + thermoBaffleModel(modelType, mesh, dict), + nNonOrthCorr_(readLabel(solution().lookup("nNonOrthCorr"))), + thermo_(basicSolidThermo::New(regionMesh(), dict)), + T_(thermo_->T()), + Qs_ + ( + IOobject + ( + "Qs", + regionMesh().time().timeName(), + regionMesh(), + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + regionMesh(), + dimensionedScalar + ( + "zero", + dimEnergy/dimArea/dimTime, + pTraits::zero + ) + ), + Q_ + ( + IOobject + ( + "Q", + regionMesh().time().timeName(), + regionMesh(), + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + regionMesh(), + dimensionedScalar + ( + "zero", + dimEnergy/dimVolume/dimTime, + pTraits::zero + ) + ) +{ + init(); + thermo_->correct(); +} + + thermoBaffle2D::thermoBaffle2D ( const word& modelType, @@ -183,26 +238,7 @@ thermoBaffle2D::thermoBaffle2D ) ) { - if (oneD_) - { - label patchI = intCoupledPatchIDs_[0]; - const label Qsb = Qs_.boundaryField()[patchI].size(); - if (Qsb!= thickness_.size()) - { - FatalErrorIn - ( - "thermoBaffle2D::thermoBaffle2D" - "(" - " const word& modelType," - " const fvMesh& mesh" - ")" - ) << "the boundary field of Qs is " - << Qsb << " and " << nl - << "the field 'thickness' is " << thickness_.size() << nl - << exit(FatalError); - } - } - + init(); thermo_->correct(); } @@ -215,6 +251,31 @@ thermoBaffle2D::~thermoBaffle2D() // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // +void thermoBaffle2D::init() +{ + if (oneD_ && !constantThickness_) + { + label patchI = intCoupledPatchIDs_[0]; + const label Qsb = Qs_.boundaryField()[patchI].size(); + if (Qsb!= thickness_.size()) + { + FatalErrorIn + ( + "thermoBaffle2D::thermoBaffle2D" + "(" + " const word& modelType," + " const fvMesh& mesh," + " const dictionary& dict" + ")" + ) << "the boundary field of Qs is " + << Qsb << " and " << nl + << "the field 'thickness' is " << thickness_.size() << nl + << exit(FatalError); + } + } +} + + void thermoBaffle2D::preEvolveRegion() {} @@ -258,6 +319,12 @@ const volScalarField& thermoBaffle2D::T() const } +const basicSolidThermo& thermoBaffle2D::thermo() const +{ + return thermo_; +} + + void thermoBaffle2D::info() const { Info<< indent << "min/max(T) = " << min(T_).value() << ", " diff --git a/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.H b/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.H index 8cd28b76e5..1b66813be8 100644 --- a/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.H +++ b/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.H @@ -37,7 +37,6 @@ SourceFiles #define thermoBaffle2D_H #include "thermoBaffleModel.H" -#include "basicSolidThermo.H" #include "volFieldsFwd.H" @@ -69,6 +68,9 @@ private: //- Disallow default bitwise assignment void operator=(const thermoBaffle2D&); + //- Initialize thermoBaffle2D + void init(); + protected: @@ -106,7 +108,7 @@ protected: // Equations //- Solve energy equation - virtual void solveEnergy(); + void solveEnergy(); public: @@ -120,6 +122,16 @@ public: //- Construct from components thermoBaffle2D(const word& modelType, const fvMesh& mesh); + //- Construct from components and dict + thermoBaffle2D + ( + const word& modelType, + const fvMesh& mesh, + const dictionary& dict + + ); + + //- Destructor virtual ~thermoBaffle2D(); @@ -130,7 +142,7 @@ public: // Thermo properties //- Return const reference to the basicSolidThermo - inline const basicSolidThermo& thermo() const; + virtual const basicSolidThermo& thermo() const; // Fields @@ -176,10 +188,10 @@ public: // Evolution - //- Pre-evolve film + //- Pre-evolve thermal baffle virtual void preEvolveRegion(); - //- Evolve the film equations + //- Evolve the thermal baffle virtual void evolveRegion(); diff --git a/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2DI.H b/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2DI.H index 0e3978da3c..227a25975b 100644 --- a/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2DI.H +++ b/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2DI.H @@ -38,11 +38,6 @@ namespace thermoBaffleModels // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -inline const basicSolidThermo& thermoBaffle2D::thermo() const -{ - return thermo_; -} - inline tmp thermoBaffle2D::hs ( diff --git a/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.C b/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.C index 901e8c1600..0ca4856fe6 100644 --- a/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.C +++ b/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.C @@ -41,6 +41,7 @@ namespace thermoBaffleModels defineTypeNameAndDebug(thermoBaffleModel, 0); defineRunTimeSelectionTable(thermoBaffleModel, mesh); +defineRunTimeSelectionTable(thermoBaffleModel, dictionary); // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -52,23 +53,7 @@ bool thermoBaffleModel::read() } -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -thermoBaffleModel::thermoBaffleModel(const fvMesh& mesh) -: - regionModel1D(mesh), - thickness_(), - delta_("delta", dimLength, 0.0), - oneD_(false) -{} - - -thermoBaffleModel::thermoBaffleModel(const word& modelType, const fvMesh& mesh) -: - regionModel1D(mesh, "thermoBaffle", modelType), - thickness_(), - delta_("delta", dimLength, 0.0), - oneD_(false) +void thermoBaffleModel::init() { if (active_) { @@ -86,7 +71,14 @@ thermoBaffleModel::thermoBaffleModel(const word& modelType, const fvMesh& mesh) label nFaces = 0; forAll (rbm, patchi) { - if (rbm[patchi].size() && isA(rbm[patchi])) + if ( + rbm[patchi].size() + && + ( + isA(rbm[patchi]) + || isA(rbm[patchi]) + ) + ) { nFaces += rbm[patchi].size(); } @@ -108,7 +100,11 @@ thermoBaffleModel::thermoBaffleModel(const word& modelType, const fvMesh& mesh) const label patchI = intCoupledPatchIDs_[i]; const polyPatch& pp = rbm[patchI]; - if (!isA(pp) && oneD_) + if ( + !isA(pp) + && oneD_ + && !constantThickness_ + ) { FatalErrorIn ( @@ -120,7 +116,8 @@ thermoBaffleModel::thermoBaffleModel(const word& modelType, const fvMesh& mesh) ) << "\n patch type '" << pp.type() << "' not type '" << directMappedVariableThicknessWallPolyPatch::typeName - << "'. This is necessary for 1D solution" + << "'. This is necessary for 1D solution " + << " and variable thickness" << "\n for patch. " << pp.name() << exit(FatalError); } @@ -142,7 +139,7 @@ thermoBaffleModel::thermoBaffleModel(const word& modelType, const fvMesh& mesh) } } - if (oneD_) + if (oneD_ && !constantThickness_) { const label patchI = intCoupledPatchIDs_[0]; const polyPatch& pp = rbm[patchI]; @@ -192,6 +189,48 @@ thermoBaffleModel::thermoBaffleModel(const word& modelType, const fvMesh& mesh) } +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +thermoBaffleModel::thermoBaffleModel(const fvMesh& mesh) +: + regionModel1D(mesh), + thickness_(), + delta_("delta", dimLength, 0.0), + oneD_(false), + constantThickness_(true) +{} + + +thermoBaffleModel::thermoBaffleModel +( + const word& modelType, + const fvMesh& mesh, + const dictionary& dict + +) +: + regionModel1D(mesh, "thermoBaffle", modelType, dict, true), + thickness_(), + delta_("delta", dimLength, 0.0), + oneD_(false), + constantThickness_(dict.lookupOrDefault("constantThickness", true)) +{ + init(); +} + + +thermoBaffleModel::thermoBaffleModel(const word& modelType, const fvMesh& mesh) +: + regionModel1D(mesh, "thermoBaffle", modelType), + thickness_(), + delta_("delta", dimLength, 0.0), + oneD_(false), + constantThickness_(lookupOrDefault("constantThickness", true)) +{ + init(); +} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // thermoBaffleModel::~thermoBaffleModel() diff --git a/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.H b/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.H index 1a20d9222b..cee13d8e68 100644 --- a/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.H +++ b/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.H @@ -38,6 +38,7 @@ SourceFiles #include "scalarIOField.H" #include "autoPtr.H" #include "volFieldsFwd.H" +#include "basicSolidThermo.H" #include "regionModel1D.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -67,6 +68,9 @@ private: //- Disallow default bitwise assignment void operator=(const thermoBaffleModel&); + //- Initialize thermal Baffle + void init(); + protected: @@ -75,12 +79,15 @@ protected: //- Baffle physical thickness scalarField thickness_; - //- Baffle geometric thickness + //- Baffle mesh thickness dimensionedScalar delta_; //- Is it one dimension bool oneD_; + //- Is thickness constant + bool constantThickness_; + // Protected Member Functions @@ -94,7 +101,7 @@ public: TypeName("thermoBaffleModel"); - // Declare runtime constructor selection table + // Declare runtime constructor selection tables declareRunTimeSelectionTable ( @@ -108,6 +115,20 @@ public: (modelType, mesh) ); + declareRunTimeSelectionTable + ( + autoPtr, + thermoBaffleModel, + dictionary, + ( + const word& modelType, + const fvMesh& mesh, + const dictionary& dict + ), + (modelType, mesh, dict) + ); + + // Constructors //- Construct null from mesh @@ -116,12 +137,27 @@ public: //- Construct from type name and mesh thermoBaffleModel(const word& modelType, const fvMesh& mesh); + //- Construct from type name and mesh and dict + thermoBaffleModel + ( + const word& modelType, + const fvMesh& mesh, + const dictionary& dict + ); + // Selectors //- Return a reference to the selected model static autoPtr New(const fvMesh& mesh); + //- Return a reference to the selected model using dictionary + static autoPtr New + ( + const fvMesh& mesh, + const dictionary& dict + ); + //- Destructor virtual ~thermoBaffleModel(); @@ -129,8 +165,11 @@ public: // Member Functions + // Access + //- Return solid thermo + virtual const basicSolidThermo& thermo() const = 0; //- Return thickness const scalarField& thickness() const @@ -150,6 +189,12 @@ public: return oneD_; } + //- Return if region has constant thickness + bool constantThickness() const + { + return constantThickness_; + } + // Fields diff --git a/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModelNew.C b/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModelNew.C index 976b478e33..15dcb296a1 100644 --- a/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModelNew.C +++ b/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModelNew.C @@ -76,6 +76,35 @@ autoPtr thermoBaffleModel::New(const fvMesh& mesh) } +autoPtr thermoBaffleModel::New +( + const fvMesh& mesh, + const dictionary& dict +) +{ + + word modelType = dict.lookup("thermoBaffleModel"); + + Info<< "Selecting baffle model " << modelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(modelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + + FatalErrorIn("thermoBaffleModel::New(const fvMesh&,const dictionary&)") + << "Unknown thermoBaffleModel type " << modelType + << nl << nl + << "Valid thermoBaffleModel types are:" << nl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr(cstrIter()(modelType, mesh, dict)); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace thermoBaffleModels diff --git a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.C index 2888eeea17..991a7c2a4f 100644 --- a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.C @@ -33,6 +33,7 @@ namespace Foam { defineTypeNameAndDebug(basicSolidThermo, 0); defineRunTimeSelectionTable(basicSolidThermo, mesh); + defineRunTimeSelectionTable(basicSolidThermo, dictionary); } @@ -120,6 +121,92 @@ Foam::basicSolidThermo::basicSolidThermo(const fvMesh& mesh) {} +Foam::basicSolidThermo::basicSolidThermo +( + const fvMesh& mesh, + const dictionary& dict +) +: + IOdictionary + ( + IOobject + ( + "solidThermophysicalProperties", + mesh.time().constant(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + dict + ), + mesh_(mesh), + T_ + ( + IOobject + ( + "T", + mesh.time().timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ), + rho_ + ( + IOobject + ( + "rho", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimMass/dimVolume + ), + kappa_ + ( + IOobject + ( + "kappa", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimless/dimLength + ), + sigmaS_ + ( + IOobject + ( + "sigmaS", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimless/dimLength + ), + emissivity_ + ( + IOobject + ( + "emissivity", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimless + ) +{} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::basicSolidThermo::~basicSolidThermo() diff --git a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.H index f93a89bc73..c9deef0ee4 100644 --- a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.H @@ -98,15 +98,33 @@ public: ); + // Declare run-time constructor selection tables + declareRunTimeSelectionTable + ( + autoPtr, + basicSolidThermo, + dictionary, + (const fvMesh& mesh, const dictionary& dict), + (mesh, dict) + ); + + // Constructors //- Construct from mesh basicSolidThermo(const fvMesh&); + //- Construct from mesh and dict + basicSolidThermo(const fvMesh&, const dictionary& dict); + //- Return a pointer to a new basicSolidThermo created from // the solidThermophysicalProperties dictionary static autoPtr New(const fvMesh&); + //- Return a pointer to a new basicSolidThermo created from + // local dictionary + static autoPtr New(const fvMesh&, const dictionary&); + //- Destructor virtual ~basicSolidThermo(); diff --git a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermoNew.C b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermoNew.C index a398516f2a..8a7ca3bc57 100644 --- a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermoNew.C +++ b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermoNew.C @@ -62,7 +62,7 @@ Foam::autoPtr Foam::basicSolidThermo::New { FatalErrorIn ( - "basicSolidThermo::New(const fvMesh&, const word&)" + "basicSolidThermo::New(const fvMesh&)" ) << "Unknown solidThermo type " << thermoType << endl << endl << "Valid solidThermo types are :" << endl @@ -74,4 +74,36 @@ Foam::autoPtr Foam::basicSolidThermo::New } +Foam::autoPtr Foam::basicSolidThermo::New +( + const fvMesh& mesh, const dictionary& dict +) +{ + if (debug) + { + Info<< "basicSolidThermo::New(const fvMesh&, const dictionary&): " + << "constructing basicSolidThermo" + << endl; + } + + const word thermoType = dict.lookup("thermoType"); + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(thermoType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "basicSolidThermo::New(const fvMesh&, const dictionary&)" + ) << "Unknown solidThermo type " << thermoType + << endl << endl + << "Valid solidThermo types are :" << endl + << dictionaryConstructorTablePtr_->toc() + << exit(FatalError); + } + + return autoPtr(cstrIter()(mesh, dict)); +} + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.C index 083849c7ab..6d6ac784a4 100644 --- a/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.C @@ -32,11 +32,55 @@ namespace Foam { defineTypeNameAndDebug(constSolidThermo, 0); addToRunTimeSelectionTable(basicSolidThermo, constSolidThermo, mesh); + addToRunTimeSelectionTable(basicSolidThermo, constSolidThermo, dictionary); } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +Foam::constSolidThermo::constSolidThermo +( + const fvMesh& mesh, + const dictionary& dict +) +: + basicSolidThermo(mesh, dict), + dict_(dict.subDict(typeName + "Coeffs")), + constK_(dimensionedScalar(dict_.lookup("K"))), + K_ + ( + IOobject + ( + "K", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + constK_ + ), + constRho_(dimensionedScalar(dict_.lookup("rho"))), + constCp_(dimensionedScalar(dict_.lookup("Cp"))), + constHf_(dimensionedScalar(dict_.lookup("Hf"))), + constEmissivity_(dimensionedScalar(dict_.lookup("emissivity"))), + constKappa_(dimensionedScalar(dict_.lookup("kappa"))), + constSigmaS_(dimensionedScalar(dict_.lookup("sigmaS"))) +{ + read(); + + K_ = constK_; + + rho_ = constRho_; + + emissivity_ = constEmissivity_; + + kappa_ = constKappa_; + + sigmaS_ = constSigmaS_; +} + + Foam::constSolidThermo::constSolidThermo(const fvMesh& mesh) : basicSolidThermo(mesh), diff --git a/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.H index aff314ae73..fa4743706e 100644 --- a/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.H @@ -93,6 +93,10 @@ public: //- Construct from mesh constSolidThermo(const fvMesh& mesh); + //- Construct from mesh and dict + constSolidThermo(const fvMesh& mesh, const dictionary& dict); + + //- Destructor virtual ~constSolidThermo(); diff --git a/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.C index 908db0b62a..b0a05d6e64 100644 --- a/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.C @@ -39,11 +39,57 @@ namespace Foam directionalKSolidThermo, mesh ); + + addToRunTimeSelectionTable + ( + basicSolidThermo, + directionalKSolidThermo, + dictionary + ); + } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +Foam::directionalKSolidThermo::directionalKSolidThermo +( + const fvMesh& mesh, + const dictionary& dict +) +: + interpolatedSolidThermo(mesh, typeName + "Coeffs", dict), + directionalK_ + ( + IOobject + ( + "K", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimEnergy/dimTime/(dimLength*dimTemperature) + ), + ccTransforms_ + ( + IOobject + ( + "ccTransforms", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimLength + ) +{ + init(); +} + + Foam::directionalKSolidThermo::directionalKSolidThermo(const fvMesh& mesh) : interpolatedSolidThermo(mesh, typeName + "Coeffs"), @@ -73,9 +119,25 @@ Foam::directionalKSolidThermo::directionalKSolidThermo(const fvMesh& mesh) mesh, dimLength ) +{ + init(); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::directionalKSolidThermo::~directionalKSolidThermo() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::directionalKSolidThermo::init() { KValues_ = Field(subDict(typeName + "Coeffs").lookup("KValues")); + const fvMesh& mesh = K().mesh(); + // Determine transforms for cell centres forAll(mesh.C(), cellI) { @@ -244,14 +306,6 @@ Foam::directionalKSolidThermo::directionalKSolidThermo(const fvMesh& mesh) } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::directionalKSolidThermo::~directionalKSolidThermo() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - Foam::symmTensor Foam::directionalKSolidThermo::transformPrincipal ( const tensor& tt, diff --git a/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.H index e1ee3cba9f..d879db4c1a 100644 --- a/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.H @@ -86,6 +86,9 @@ class directionalKSolidThermo //- Calculate properties void calculate(); + //- Initialize thermo + void init(); + public: @@ -98,6 +101,9 @@ public: //- Construct from mesh directionalKSolidThermo(const fvMesh& mesh); + //- Construct from mesh and dictionary + directionalKSolidThermo(const fvMesh& mesh, const dictionary& dict); + //- Destructor virtual ~directionalKSolidThermo(); diff --git a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.C b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.C index 9e08c9bd16..9066081803 100644 --- a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.C +++ b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.C @@ -86,11 +86,14 @@ bool Foam::interpolateSolid::writeData(Ostream& os) const os.writeKeyword("rhoValues") << rhoValues_ << token::END_STATEMENT << nl; os.writeKeyword("cpValues") << cpValues_ << token::END_STATEMENT << nl; os.writeKeyword("HfValues") << HfValues_ << token::END_STATEMENT << nl; - os.writeKeyword("emissivityValues") << emissivityValues_ << nl; - os.writeKeyword("kappaValues") << kappaValues_ << nl; + os.writeKeyword("emissivityValues") << emissivityValues_ << + token::END_STATEMENT << nl; + os.writeKeyword("kappaValues") << kappaValues_ + << token::END_STATEMENT << nl; os.writeKeyword("sigmaSValues") << sigmaSValues_ << token::END_STATEMENT << nl; + return os.good(); } diff --git a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.C index 431e6c98b4..5164710a65 100644 --- a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.C @@ -24,7 +24,6 @@ License \*---------------------------------------------------------------------------*/ #include "interpolatedSolidThermo.H" -#include "addToRunTimeSelectionTable.H" #include "interpolateXY.H" @@ -44,6 +43,20 @@ Foam::interpolatedSolidThermo::interpolatedSolidThermo } +Foam::interpolatedSolidThermo::interpolatedSolidThermo +( + const fvMesh& mesh, + const word dictName, + const dictionary& dict + ) +: + basicSolidThermo(mesh, dict), + interpolateSolid(subDict(dictName)), + dict_(subDict(dictName)) +{ + calculate(); +} + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::interpolatedSolidThermo::~interpolatedSolidThermo() diff --git a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.H index d604b160be..0719d67baf 100644 --- a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.H @@ -67,6 +67,15 @@ public: //- Construct from mesh interpolatedSolidThermo(const fvMesh& mesh, const word); + //- Construct from mesh and dictionary + interpolatedSolidThermo + ( + const fvMesh& mesh, + const word, + const dictionary& dict + ); + + //- Destructor virtual ~interpolatedSolidThermo(); diff --git a/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.C index 9b1a7d3858..41f587a6b9 100644 --- a/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.C @@ -37,11 +37,45 @@ namespace Foam isotropicKSolidThermo, mesh ); + + addToRunTimeSelectionTable + ( + basicSolidThermo, + isotropicKSolidThermo, + dictionary + ); + } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +Foam::isotropicKSolidThermo::isotropicKSolidThermo +( + const fvMesh& mesh, + const dictionary& dict +) +: + interpolatedSolidThermo(mesh, typeName + "Coeffs", dict), + K_ + ( + IOobject + ( + "K", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimEnergy/dimTime/(dimLength*dimTemperature) + ), + KValues_ (Field(subDict(typeName + "Coeffs").lookup("KValues"))) +{ + correct(); +} + + Foam::isotropicKSolidThermo::isotropicKSolidThermo(const fvMesh& mesh) : interpolatedSolidThermo(mesh, typeName + "Coeffs"), diff --git a/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.H index a54e386c38..44a85f9af1 100644 --- a/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.H @@ -70,6 +70,10 @@ public: //- Construct from mesh isotropicKSolidThermo(const fvMesh& mesh); + //- Construct from mesh and dicionary + isotropicKSolidThermo(const fvMesh& mesh, const dictionary& dict); + + //- Destructor virtual ~isotropicKSolidThermo(); diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/makeSolidMixtureThermo.H b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/makeSolidMixtureThermo.H index 94c4880a1d..537ca0b083 100644 --- a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/makeSolidMixtureThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/makeSolidMixtureThermo.H @@ -54,6 +54,12 @@ addToRunTimeSelectionTable \ mesh \ ); \ \ +addToRunTimeSelectionTable \ +( \ + CThermo, \ + MixtureThermo##Mixture##Transport##Radiation##Thermo##Rho, \ + dictionary \ +); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.C b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.C index 36f590e838..6dfbd3c339 100644 --- a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.C @@ -87,6 +87,32 @@ Foam::solidMixtureThermo::solidMixtureThermo } +template +Foam::solidMixtureThermo::solidMixtureThermo +( + const fvMesh& mesh, + const dictionary& dict +) +: + basicSolidThermo(mesh, dict), + MixtureType(*this, mesh), + K_ + ( + IOobject + ( + "K", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimEnergy/dimTime/(dimLength*dimTemperature) + ) +{ + calculate(); +} + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.H b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.H index a8c2f9e3e4..c6c16917d1 100644 --- a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.H @@ -79,6 +79,9 @@ public: //- Construct from mesh solidMixtureThermo(const fvMesh&); + //- Construct from mesh and dictionary + solidMixtureThermo(const fvMesh&, const dictionary&); + //- Destructor virtual ~solidMixtureThermo(); From cbf1731385dc7b221d1cfab0500a18eb68c25d32 Mon Sep 17 00:00:00 2001 From: sergio Date: Tue, 12 Jul 2011 16:19:04 +0100 Subject: [PATCH 30/54] STY: changing dates --- .../basicSolidThermo/basicSolidThermo/basicSolidThermo.C | 2 +- .../basicSolidThermo/basicSolidThermo/basicSolidThermo.H | 2 +- .../basicSolidThermo/basicSolidThermo/basicSolidThermoNew.C | 2 +- .../basicSolidThermo/constSolidThermo/constSolidThermo.H | 2 +- .../directionalKSolidThermo/directionalKSolidThermo.C | 2 +- .../directionalKSolidThermo/directionalKSolidThermo.H | 2 +- .../interpolatedSolidThermo/interpolateSolid/interpolateSolid.C | 2 +- .../interpolatedSolidThermo/interpolatedSolidThermo.C | 2 +- .../interpolatedSolidThermo/interpolatedSolidThermo.H | 2 +- .../isotropicKSolidThermo/isotropicKSolidThermo.C | 2 +- .../isotropicKSolidThermo/isotropicKSolidThermo.H | 2 +- .../solidMixtureThermo/makeSolidMixtureThermo.H | 2 +- .../solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.C | 2 +- .../solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.H | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.C index 991a7c2a4f..f45bd2c6bf 100644 --- a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.H index c9deef0ee4..f5d29461c0 100644 --- a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermoNew.C b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermoNew.C index 8a7ca3bc57..42f266055d 100644 --- a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermoNew.C +++ b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermoNew.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.H index fa4743706e..42061066bd 100644 --- a/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.C index b0a05d6e64..58e422bac1 100644 --- a/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.H index d879db4c1a..504e62163e 100644 --- a/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.C b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.C index 9066081803..635b6bdb3c 100644 --- a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.C +++ b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.C index 5164710a65..3ec615c42c 100644 --- a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.H index 0719d67baf..7bc56fa973 100644 --- a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.C index 41f587a6b9..f5666ac554 100644 --- a/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.H index 44a85f9af1..8d7ad8c6de 100644 --- a/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/makeSolidMixtureThermo.H b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/makeSolidMixtureThermo.H index 537ca0b083..0094fb8a0b 100644 --- a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/makeSolidMixtureThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/makeSolidMixtureThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.C b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.C index 6dfbd3c339..4eb83cdbe4 100644 --- a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.H b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.H index c6c16917d1..e121c5c19e 100644 --- a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License From 776ae0a6a53f4be002235e34beea4ff8fdb16a2a Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 13 Jul 2011 16:38:13 +0100 Subject: [PATCH 31/54] ENH: gmshToFoam: remove empty defaultFaces patch --- .../mesh/conversion/gmshToFoam/gmshToFoam.C | 45 ++++++++++++++++++- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C b/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C index 650393d5ec..205dc6fc5c 100644 --- a/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C +++ b/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -757,9 +757,23 @@ int main(int argc, char *argv[]) "retain raw orientation for prisms/hexs" ); +# include "addRegionOption.H" + # include "setRootCase.H" # include "createTime.H" + Foam::word regionName; + + if (args.optionReadIfPresent("region", regionName)) + { + Foam::Info + << "Creating polyMesh for region " << regionName << endl; + } + else + { + regionName = Foam::polyMesh::defaultRegion; + } + const bool keepOrientation = args.optionFound("keepOrientation"); IFstream inFile(args[1]); @@ -894,7 +908,7 @@ int main(int argc, char *argv[]) ( IOobject ( - polyMesh::defaultRegion, + regionName, runTime.constant(), runTime ), @@ -984,6 +998,7 @@ int main(int argc, char *argv[]) //Get polyMesh to write to constant + runTime.setTime(instant(runTime.constant()), 0); repatcher.repatch(); @@ -1079,6 +1094,32 @@ int main(int argc, char *argv[]) mesh.addZones(List(0), fz, cz); } + // Remove empty defaultFaces + label defaultPatchID = mesh.boundaryMesh().findPatchID(defaultFacesName); + if (mesh.boundaryMesh()[defaultPatchID].size() == 0) + { + List newPatchPtrList((mesh.boundaryMesh().size() - 1)); + label newPatchI = 0; + forAll(mesh.boundaryMesh(), patchI) + { + if (patchI != defaultPatchID) + { + const polyPatch& patch = mesh.boundaryMesh()[patchI]; + + newPatchPtrList[newPatchI] = patch.clone + ( + mesh.boundaryMesh(), + newPatchI, + patch.size(), + patch.start() + ).ptr(); + + newPatchI++; + } + } + repatcher.changePatches(newPatchPtrList); + } + mesh.write(); Info<< "End\n" << endl; From 0f82d2ce074b698a3eabc7b590c1249d9fe92e47 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 13 Jul 2011 16:38:41 +0100 Subject: [PATCH 32/54] COMP: entry: call base constructor --- src/OpenFOAM/db/dictionary/entry/entry.C | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/OpenFOAM/db/dictionary/entry/entry.C b/src/OpenFOAM/db/dictionary/entry/entry.C index 3bba611dee..d933585265 100644 --- a/src/OpenFOAM/db/dictionary/entry/entry.C +++ b/src/OpenFOAM/db/dictionary/entry/entry.C @@ -39,12 +39,14 @@ int Foam::entry::disableFunctionEntries Foam::entry::entry(const keyType& keyword) : + IDLList::link(), keyword_(keyword) {} Foam::entry::entry(const entry& e) : + IDLList::link(), keyword_(e.keyword_) {} From 71fa63273e67fd4777d39101dae79e89333872ce Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 13 Jul 2011 16:41:13 +0100 Subject: [PATCH 33/54] ENH: patchCloudSet: new sampledSet for nearest point on cloud --- .../postProcessing/sampling/sample/sampleDict | 18 + src/finiteVolume/Make/files | 1 + .../interpolationCellPatchConstrained.C | 76 +++++ .../interpolationCellPatchConstrained.H | 97 ++++++ .../makeInterpolationCellPatchConstrained.C | 41 +++ src/sampling/Make/files | 1 + .../sampledSet/patchCloud/patchCloudSet.C | 322 ++++++++++++++++++ .../sampledSet/patchCloud/patchCloudSet.H | 122 +++++++ 8 files changed, 678 insertions(+) create mode 100644 src/finiteVolume/interpolation/interpolation/interpolationCellPatchConstrained/interpolationCellPatchConstrained.C create mode 100644 src/finiteVolume/interpolation/interpolation/interpolationCellPatchConstrained/interpolationCellPatchConstrained.H create mode 100644 src/finiteVolume/interpolation/interpolation/interpolationCellPatchConstrained/makeInterpolationCellPatchConstrained.C create mode 100644 src/sampling/sampledSet/patchCloud/patchCloudSet.C create mode 100644 src/sampling/sampledSet/patchCloud/patchCloudSet.H diff --git a/applications/utilities/postProcessing/sampling/sample/sampleDict b/applications/utilities/postProcessing/sampling/sample/sampleDict index becaae12f7..ca79e6aa47 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleDict +++ b/applications/utilities/postProcessing/sampling/sample/sampleDict @@ -49,6 +49,9 @@ formatOptions // cell : use cell-centre value only; constant over cells (default) // cellPoint : use cell-centre and vertex values // cellPointFace : use cell-centre, vertex and face values. +// pointMVC : use point values only (Mean Value Coordinates) +// cellPatchConstrained : use cell-centre except on boundary faces where +// it uses the boundary value. For use with e.g. patchCloudSet. // 1] vertex values determined from neighbouring cell-centre values // 2] face values determined using the current face interpolation scheme // for the field (linear, gamma, etc.) @@ -83,6 +86,7 @@ fields // uniform, face, midPoint, midPointAndFace : start and end coordinate // uniform: extra number of sampling points // polyLine, cloud: list of coordinates +// patchCloud: list of coordinates and set of patches to look for nearest sets ( lineX1 @@ -113,8 +117,21 @@ sets points ((0.049 0.049 0.00501)(0.051 0.049 0.00501)); } + somePatchPoints + { + // Sample nearest points on selected patches. Use with + // interpolations: + // - cell (cell value) + // - cellPatchConstrained (boundary value) + // - cellPoint (interpolated boundary value) + type patchCloud; + axis xyz; + points ((0.049 0.099 0.005)(0.051 0.054 0.005)); + patches (".*Wall.*"); + } ); + // Surface sampling definition // // 1] patches are not triangulated by default @@ -241,4 +258,5 @@ surfaces } ); + // *********************************************************************** // diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 360ecc6b07..a66495843b 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -201,6 +201,7 @@ interpolation = interpolation/interpolation $(interpolation)/interpolation/interpolations.C $(interpolation)/interpolationCell/makeInterpolationCell.C +$(interpolation)/interpolationCellPatchConstrained/makeInterpolationCellPatchConstrained.C $(interpolation)/interpolationCellPoint/cellPointWeight/cellPointWeight.C $(interpolation)/interpolationCellPoint/makeInterpolationCellPoint.C $(interpolation)/interpolationCellPointFace/makeInterpolationCellPointFace.C diff --git a/src/finiteVolume/interpolation/interpolation/interpolationCellPatchConstrained/interpolationCellPatchConstrained.C b/src/finiteVolume/interpolation/interpolation/interpolationCellPatchConstrained/interpolationCellPatchConstrained.C new file mode 100644 index 0000000000..139121a31c --- /dev/null +++ b/src/finiteVolume/interpolation/interpolation/interpolationCellPatchConstrained/interpolationCellPatchConstrained.C @@ -0,0 +1,76 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "interpolationCellPatchConstrained.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * // + +template +interpolationCellPatchConstrained::interpolationCellPatchConstrained +( + const GeometricField& psi +) +: + interpolation(psi) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Type interpolationCellPatchConstrained::interpolate +( + const vector& pt, + const label cellI, + const label faceI +) const +{ + if (faceI >= 0 && faceI >= this->psi_.mesh().nInternalFaces()) + { + // Use boundary value + const polyBoundaryMesh& pbm = this->psi_.mesh().boundaryMesh(); + label patchI = pbm.patchID()[faceI-this->psi_.mesh().nInternalFaces()]; + label patchFaceI = pbm[patchI].whichFace(faceI); + + return this->psi_.boundaryField()[patchI][patchFaceI]; + } + else + { + return this->psi_[cellI]; + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/interpolation/interpolation/interpolationCellPatchConstrained/interpolationCellPatchConstrained.H b/src/finiteVolume/interpolation/interpolation/interpolationCellPatchConstrained/interpolationCellPatchConstrained.H new file mode 100644 index 0000000000..814988a9f3 --- /dev/null +++ b/src/finiteVolume/interpolation/interpolation/interpolationCellPatchConstrained/interpolationCellPatchConstrained.H @@ -0,0 +1,97 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::interpolationCellPatchConstrained + +Description + Uses the cell value for any point in the cell apart from a boundary face + where it uses the boundary value directly. + Note: will not work on an empty patch. + +\*---------------------------------------------------------------------------*/ + +#ifndef interpolationCellPatchConstrained_H +#define interpolationCellPatchConstrained_H + +#include "interpolation.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class fvMesh; + +/*---------------------------------------------------------------------------*\ + Class interpolationCellPatchConstrained Declaration +\*---------------------------------------------------------------------------*/ + +template +class interpolationCellPatchConstrained +: + public interpolation +{ + +public: + + //- Runtime type information + TypeName("cellPatchConstrained"); + + + // Constructors + + //- Construct from components + interpolationCellPatchConstrained + ( + const GeometricField& psi + ); + + + // Member Functions + + //- Interpolate field to the given point in the given cell + Type interpolate + ( + const vector& position, + const label cellI, + const label faceI = -1 + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "interpolationCellPatchConstrained.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/interpolation/interpolation/interpolationCellPatchConstrained/makeInterpolationCellPatchConstrained.C b/src/finiteVolume/interpolation/interpolation/interpolationCellPatchConstrained/makeInterpolationCellPatchConstrained.C new file mode 100644 index 0000000000..adae604e0e --- /dev/null +++ b/src/finiteVolume/interpolation/interpolation/interpolationCellPatchConstrained/makeInterpolationCellPatchConstrained.C @@ -0,0 +1,41 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "interpolationCellPatchConstrained.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makeInterpolation(interpolationCellPatchConstrained); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/sampling/Make/files b/src/sampling/Make/files index ddf46a17e8..0c679f52d8 100644 --- a/src/sampling/Make/files +++ b/src/sampling/Make/files @@ -5,6 +5,7 @@ probes/probesFunctionObject/probesFunctionObject.C sampledSet/cloud/cloudSet.C sampledSet/coordSet/coordSet.C +sampledSet/patchCloud/patchCloudSet.C sampledSet/polyLine/polyLineSet.C sampledSet/face/faceOnlySet.C sampledSet/midPoint/midPointSet.C diff --git a/src/sampling/sampledSet/patchCloud/patchCloudSet.C b/src/sampling/sampledSet/patchCloud/patchCloudSet.C new file mode 100644 index 0000000000..85877da3b8 --- /dev/null +++ b/src/sampling/sampledSet/patchCloud/patchCloudSet.C @@ -0,0 +1,322 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "patchCloudSet.H" +#include "polyMesh.H" +#include "addToRunTimeSelectionTable.H" +#include "pointIndexHit.H" +#include "Tuple2.H" +#include "treeBoundBox.H" +#include "indexedOctree.H" +#include "treeDataFace.H" +#include "Time.H" +#include "meshTools.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(patchCloudSet, 0); + addToRunTimeSelectionTable(sampledSet, patchCloudSet, word); + + + //- Helper class for finding nearest + // Nearest: + // - point+local index + // - sqr(distance) + // - processor + typedef Tuple2 > nearInfo; + + class nearestEqOp + { + + public: + + void operator()(nearInfo& x, const nearInfo& y) const + { + if (y.first().hit()) + { + if (!x.first().hit()) + { + x = y; + } + else if (y.second().first() < x.second().first()) + { + x = y; + } + } + } + }; +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::patchCloudSet::calcSamples +( + DynamicList& samplingPts, + DynamicList