From dcef9a2843b8176a57a4f3b82dfd47c265e49bc0 Mon Sep 17 00:00:00 2001 From: sergio Date: Fri, 16 Mar 2012 09:28:49 +0000 Subject: [PATCH 01/72] DEV: Fiel for enthalpyJump --- .../solvers/heatTransfer/buoyantPimpleFoam/Make/options | 4 +++- .../fields/fvPatchFields/fvPatchField/fvPatchFieldNew.C | 4 +++- src/thermophysicalModels/basic/Make/options | 6 ++++-- src/thermophysicalModels/basic/basicThermo/basicThermo.C | 9 +++++++-- .../basic/rhoThermo/hRhoThermo/hRhoThermo.C | 5 ++++- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options b/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options index 8d01214e6c..69a3f27e44 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options @@ -10,4 +10,6 @@ EXE_LIBS = \ -lcompressibleTurbulenceModel \ -lcompressibleRASModels \ -lcompressibleLESModels \ - -lfiniteVolume + -lfiniteVolume \ + -L$(FOAM_USER_LIBBIN) \ + -lFvPatchScalarFieldEnthalpyJump diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldNew.C b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldNew.C index 7d07ca649f..8483524871 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldNew.C +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldNew.C @@ -65,8 +65,10 @@ Foam::tmp > Foam::fvPatchField::New || actualPatchType != p.type() ) { + Info << actualPatchType << endl; + Info << p.type() << endl; typename patchConstructorTable::iterator patchTypeCstrIter = - patchConstructorTablePtr_->find(p.type()); + patchConstructorTablePtr_->find(actualPatchType);//p.type()); if (patchTypeCstrIter != patchConstructorTablePtr_->end()) { diff --git a/src/thermophysicalModels/basic/Make/options b/src/thermophysicalModels/basic/Make/options index 8b8c0733d0..4eba2f1e11 100644 --- a/src/thermophysicalModels/basic/Make/options +++ b/src/thermophysicalModels/basic/Make/options @@ -1,6 +1,8 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I/home/tom3/sergio/development/chtMultiRegionCoupledFoam/lnInclude LIB_LIBS = \ - -lfiniteVolume + -lfiniteVolume \ + -L$(FOAM_USER_LIBBIN)/FvPatchScalarFieldEnthalpyJump diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.C b/src/thermophysicalModels/basic/basicThermo/basicThermo.C index 59c0056040..8eed4f2311 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.C +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.C @@ -33,6 +33,7 @@ License #include "fixedInternalEnergyFvPatchScalarField.H" #include "gradientInternalEnergyFvPatchScalarField.H" #include "mixedInternalEnergyFvPatchScalarField.H" +#include "enthalpyJumpFvPatchScalarField.H" /* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ @@ -64,10 +65,14 @@ Foam::wordList Foam::basicThermo::hBoundaryTypes() { hbt[patchi] = gradientEnthalpyFvPatchScalarField::typeName; } - else if (isA(tbf[patchi])) + else if(isA(tbf[patchi])) { hbt[patchi] = mixedEnthalpyFvPatchScalarField::typeName; } + else if (isA(tbf[patchi])) + { + hbt[patchi] = enthalpyJumpFvPatchScalarField::typeName; + } } return hbt; @@ -85,7 +90,7 @@ void Foam::basicThermo::hBoundaryCorrection(volScalarField& h) refCast(hbf[patchi]).gradient() = hbf[patchi].fvPatchField::snGrad(); } - else if (isA(hbf[patchi])) + else if(isA(hbf[patchi])) { refCast(hbf[patchi]).refGrad() = hbf[patchi].fvPatchField::snGrad(); diff --git a/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.C b/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.C index 9d3f3c2ba7..92db569532 100644 --- a/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.C +++ b/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.C @@ -118,9 +118,11 @@ Foam::hRhoThermo::hRhoThermo(const fvMesh& mesh) ), mesh, dimEnergy/dimMass, + this->hBoundaryTypes(), this->hBoundaryTypes() ) { + Info << "hBounda" << this->hBoundaryTypes() << endl; scalarField& hCells = h_.internalField(); const scalarField& TCells = this->T_.internalField(); @@ -136,8 +138,9 @@ Foam::hRhoThermo::hRhoThermo(const fvMesh& mesh) } hBoundaryCorrection(h_); - + Info << h_ << endl; calculate(); + } From 03a43701195aeb53ba2e8f6ac0d7b95923b2ca78 Mon Sep 17 00:00:00 2001 From: sergio Date: Mon, 19 Mar 2012 17:04:54 +0000 Subject: [PATCH 02/72] DEV: Addeing special construction for h --- .../basic/rhoThermo/hRhoThermo/hRhoThermo.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.C b/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.C index 92db569532..79f3a90568 100644 --- a/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.C +++ b/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.C @@ -119,10 +119,10 @@ Foam::hRhoThermo::hRhoThermo(const fvMesh& mesh) mesh, dimEnergy/dimMass, this->hBoundaryTypes(), - this->hBoundaryTypes() + mesh.boundaryMesh().types() ) { - Info << "hBounda" << this->hBoundaryTypes() << endl; + scalarField& hCells = h_.internalField(); const scalarField& TCells = this->T_.internalField(); @@ -138,7 +138,7 @@ Foam::hRhoThermo::hRhoThermo(const fvMesh& mesh) } hBoundaryCorrection(h_); - Info << h_ << endl; + calculate(); } From ba3286ff8b3cf543dc7b9425d53280b7e941f1e6 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 2 May 2012 12:56:01 +0100 Subject: [PATCH 03/72] ENH: Use pre-calculated list size instead of re-evaluating --- .../rotorDiskSource/profileModel/lookup/lookupProfile.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fieldSources/basicSource/rotorDiskSource/profileModel/lookup/lookupProfile.C b/src/fieldSources/basicSource/rotorDiskSource/profileModel/lookup/lookupProfile.C index ae80d03995..1dda6b403b 100644 --- a/src/fieldSources/basicSource/rotorDiskSource/profileModel/lookup/lookupProfile.C +++ b/src/fieldSources/basicSource/rotorDiskSource/profileModel/lookup/lookupProfile.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -65,9 +65,9 @@ void Foam::lookupProfile::interpolateWeights ddx = 0.0; return; } - else if (i2 == values.size()) + else if (i2 == nElem) { - i2 = values.size() - 1; + i2 = nElem - 1; i1 = i2; ddx = 0.0; return; From 8d43b7842abe3128ecb1baea1d158d6f60908a4e Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 2 May 2012 12:57:49 +0100 Subject: [PATCH 04/72] ENH: rotor source: split series profile Cd and Cl coeff calculation --- .../profileModel/series/seriesProfile.C | 23 ++++++++++++++++--- .../profileModel/series/seriesProfile.H | 23 +++++++++++++------ 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/src/fieldSources/basicSource/rotorDiskSource/profileModel/series/seriesProfile.C b/src/fieldSources/basicSource/rotorDiskSource/profileModel/series/seriesProfile.C index fb69507825..77dad6d371 100644 --- a/src/fieldSources/basicSource/rotorDiskSource/profileModel/series/seriesProfile.C +++ b/src/fieldSources/basicSource/rotorDiskSource/profileModel/series/seriesProfile.C @@ -38,7 +38,24 @@ namespace Foam // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -Foam::scalar Foam::seriesProfile::evaluate +Foam::scalar Foam::seriesProfile::evaluateDrag +( + const scalar& xIn, + const List& values +) const +{ + scalar result = 0.0; + + forAll(values, i) + { + result += values[i]*cos((i + 1)*xIn); + } + + return result; +} + + +Foam::scalar Foam::seriesProfile::evaluateLift ( const scalar& xIn, const List& values @@ -108,8 +125,8 @@ Foam::seriesProfile::seriesProfile void Foam::seriesProfile::Cdl(const scalar alpha, scalar& Cd, scalar& Cl) const { - Cd = evaluate(alpha, CdCoeffs_); - Cl = evaluate(alpha, ClCoeffs_); + Cd = evaluateDrag(alpha, CdCoeffs_); + Cl = evaluateLift(alpha, ClCoeffs_); } diff --git a/src/fieldSources/basicSource/rotorDiskSource/profileModel/series/seriesProfile.H b/src/fieldSources/basicSource/rotorDiskSource/profileModel/series/seriesProfile.H index 7c4793e28e..5e2611d6c3 100644 --- a/src/fieldSources/basicSource/rotorDiskSource/profileModel/series/seriesProfile.H +++ b/src/fieldSources/basicSource/rotorDiskSource/profileModel/series/seriesProfile.H @@ -28,7 +28,7 @@ Description Series-up based profile data - drag and lift coefficients computed as sum of cosine series - Cd = sum_i(CdCoeff)*sin(i*AOA) + Cd = sum_i(CdCoeff)*cos(i*AOA) Cl = sum_i(ClCoeff)*sin(i*AOA) where: @@ -79,12 +79,21 @@ protected: // Protected Member Functions - //- Evaluate - scalar evaluate - ( - const scalar& xIn, - const List& values - ) const; + // Evaluate + + //- Drag + scalar evaluateDrag + ( + const scalar& xIn, + const List& values + ) const; + + //- Lift + scalar evaluateLift + ( + const scalar& xIn, + const List& values + ) const; public: From d481b14c298029921579d2e1cedd4ef8164dee94 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 2 May 2012 12:58:16 +0100 Subject: [PATCH 05/72] STYLE: Use point instead of vector for consistency --- .../basicSource/rotorDiskSource/trimModel/fixed/fixedTrim.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fieldSources/basicSource/rotorDiskSource/trimModel/fixed/fixedTrim.C b/src/fieldSources/basicSource/rotorDiskSource/trimModel/fixed/fixedTrim.C index 4d8f1499e5..d5f4843d58 100644 --- a/src/fieldSources/basicSource/rotorDiskSource/trimModel/fixed/fixedTrim.C +++ b/src/fieldSources/basicSource/rotorDiskSource/trimModel/fixed/fixedTrim.C @@ -67,7 +67,7 @@ void Foam::fixedTrim::read(const dictionary& dict) scalar theta1c = degToRad(readScalar(coeffs_.lookup("theta1c"))); scalar theta1s = degToRad(readScalar(coeffs_.lookup("theta1s"))); - const List& x = rotor_.x(); + const List& x = rotor_.x(); forAll(thetag_, i) { scalar psi = x[i].y(); From 388f1c4dd3a943438a616e60689136f28edd2427 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 2 May 2012 12:58:52 +0100 Subject: [PATCH 06/72] ENH: rotor source: flip geometric AOA if blade is spinning in reverse --- .../rotorDiskSource/rotorDiskSource.C | 17 ++++++++++++----- .../rotorDiskSource/rotorDiskSource.H | 19 ++++++++++--------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.C b/src/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.C index e6381c543b..20161147df 100644 --- a/src/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.C +++ b/src/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.C @@ -446,15 +446,15 @@ Foam::rotorDiskSource::rotorDiskSource inletVelocity_(vector::zero), tipEffect_(1.0), flap_(), - trim_(trimModel::New(*this, coeffs_)), - blade_(coeffs_.subDict("blade")), - profiles_(coeffs_.subDict("profiles")), x_(cells_.size(), vector::zero), R_(cells_.size(), I), invR_(cells_.size(), I), area_(cells_.size(), 0.0), coordSys_(false), - rMax_(0.0) + rMax_(0.0), + trim_(trimModel::New(*this, coeffs_)), + blade_(coeffs_.subDict("blade")), + profiles_(coeffs_.subDict("profiles")) { read(dict); } @@ -521,9 +521,16 @@ void Foam::rotorDiskSource::calculate scalar invDr = 0.0; blade_.interpolate(radius, twist, chord, i1, i2, invDr); + // flip geometric angle if blade is spinning in reverse (clockwise) + scalar alphaGeom = alphag[i] + twist; + if (omega_ < 0) + { + alphaGeom = mathematical::pi - alphaGeom; + } + // effective angle of attack scalar alphaEff = - mathematical::pi + atan2(Uc.z(), Uc.y()) - (alphag[i] + twist); + mathematical::pi + atan2(Uc.z(), Uc.y()) - alphaGeom; if (alphaEff > mathematical::pi) { diff --git a/src/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.H b/src/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.H index 2df09f9f7b..8e26425e10 100644 --- a/src/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.H +++ b/src/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.H @@ -149,6 +149,7 @@ protected: word rhoName_; //- Rotational speed [rad/s] + // Positive anti-clockwise when looking along -ve lift direction scalar omega_; //- Number of blades @@ -167,15 +168,6 @@ protected: //- Blade flap coefficients [rad/s] flapData flap_; - //- Trim model - autoPtr trim_; - - //- Blade data - bladeModel blade_; - - //- Profile data - profileModelList profiles_; - //- Cell centre positions in local rotor frame // (Cylindrical r, theta, z) List x_; @@ -195,6 +187,15 @@ protected: //- Maximum radius scalar rMax_; + //- Trim model + autoPtr trim_; + + //- Blade data + bladeModel blade_; + + //- Profile data + profileModelList profiles_; + // Protected Member Functions From 86bf75dee90a7efce38ad9a2a97f8f25b7ea4bb0 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 2 May 2012 13:08:22 +0100 Subject: [PATCH 07/72] ENH: Enable flowRateInletVelocity BC to operate as VFR by setting 'rho' to 'none' when phi is kg/s --- .../flowRateInletVelocityFvPatchVectorField.C | 16 ++++++++++++---- .../flowRateInletVelocityFvPatchVectorField.H | 7 +++++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C index c64b616a86..64c1120cc9 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C @@ -129,11 +129,19 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs() } else if (phi.dimensions() == dimDensity*dimVelocity*dimArea) { - const fvPatchField& rhop = - patch().lookupPatchField(rhoName_); + if (rhoName_ == "none") + { + // volumetric flow-rate if density not given + operator==(n*avgU); + } + else + { + // mass flow-rate + const fvPatchField& rhop = + patch().lookupPatchField(rhoName_); - // mass flow-rate - operator==(n*avgU/rhop); + operator==(n*avgU/rhop); + } } else { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.H index f40674ea01..7410e5290f 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.H @@ -30,8 +30,10 @@ Description The basis of the patch (volumetric or mass) is determined by the dimensions of the flux, phi. - The current density is used to correct the velocity when applying the - mass basis. + + If the flux is mass-based + - the current density is used to correct the velocity + - volumetric flow rate can be applied by setting the 'rho' entry to 'none' Example of the boundary condition specification: \verbatim @@ -39,6 +41,7 @@ Description { type flowRateInletVelocity; flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s] + rho rho; // none | rho [m3/s or kg/s] value uniform (0 0 0); // placeholder } \endverbatim From e2e95b470d8345d57f0c3f3926eb87a8f7046362 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 2 May 2012 17:07:40 +0100 Subject: [PATCH 08/72] STYLE: Minor code formatting update --- .../CollisionRecordList/CollisionRecordList.H | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/CollisionRecordList.H b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/CollisionRecordList.H index ae5cc47c10..57546dfc2e 100644 --- a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/CollisionRecordList.H +++ b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/CollisionRecordList.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -85,6 +85,7 @@ class CollisionRecordList //- List of active wall collisions DynamicList > wallRecords_; + public: // Constructors @@ -115,11 +116,11 @@ public: //- Return the active pair collisions inline const DynamicList >& - pairRecords() const; + pairRecords() const; //- Return the active wall collisions inline const DynamicList >& - wallRecords() const; + wallRecords() const; // Fields representing the data from each record, i.e if the // records 0-N containing each data members {a, b, c, d...} From bd075a3c9f8f51cad83c021974c6d8addd23e545 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 3 May 2012 18:22:13 +0100 Subject: [PATCH 09/72] BUG: Corrected ReactingParcel cell value source correction --- .../Templates/ReactingParcel/ReactingParcel.C | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C index 88acc1a9af..dde11bd2f7 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C @@ -80,12 +80,15 @@ void Foam::ReactingParcel::cellValueSourceCorrection ) { scalar addedMass = 0.0; + scalar maxMassI = 0.0; forAll(td.cloud().rhoTrans(), i) { - addedMass += td.cloud().rhoTrans(i)[cellI]; + scalar dm = td.cloud().rhoTrans(i)[cellI]; + maxMassI = max(maxMassI, mag(dm)); + addedMass += dm; } - if (addedMass < ROOTVSMALL) + if (maxMassI < ROOTVSMALL) { return; } @@ -95,16 +98,13 @@ void Foam::ReactingParcel::cellValueSourceCorrection this->rhoc_ += addedMass/td.cloud().pMesh().cellVolumes()[cellI]; const scalar massCellNew = massCell + addedMass; - this->Uc_ += td.cloud().UTrans()[cellI]/massCellNew; + this->Uc_ = (this->Uc_*massCell + td.cloud().UTrans()[cellI])/massCellNew; scalar CpEff = 0.0; - if (addedMass > ROOTVSMALL) + forAll(td.cloud().rhoTrans(), i) { - forAll(td.cloud().rhoTrans(), i) - { - scalar Y = td.cloud().rhoTrans(i)[cellI]/addedMass; - CpEff += Y*td.cloud().composition().carrier().Cp(i, this->Tc_); - } + scalar Y = td.cloud().rhoTrans(i)[cellI]/addedMass; + CpEff += Y*td.cloud().composition().carrier().Cp(i, this->Tc_); } const scalar Cpc = td.CpInterp().psi()[cellI]; From b30ad82fc9019b696abcca5336588639df7c829f Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 4 May 2012 11:23:11 +0100 Subject: [PATCH 10/72] ENH: Added proc no to output or min/max field function object --- .../field/fieldMinMax/fieldMinMax.C | 19 ++++- .../field/fieldMinMax/fieldMinMaxTemplates.C | 74 ++++++++++++++++--- 2 files changed, 80 insertions(+), 13 deletions(-) diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C index 5a9e4b1d1e..608cddbc73 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C @@ -157,9 +157,22 @@ void Foam::fieldMinMax::writeFileHeader() { fieldMinMaxFilePtr_() << "# Time" << token::TAB << "field" << token::TAB - << "min" << token::TAB << "position(min)" << token::TAB - << "max" << token::TAB << "position(max)" << token::TAB - << endl; + << "min" << token::TAB << "position(min)"; + + if (Pstream::parRun()) + { + fieldMinMaxFilePtr_() << token::TAB << "proc"; + } + + fieldMinMaxFilePtr_() + << token::TAB << "max" << token::TAB << "position(max)"; + + if (Pstream::parRun()) + { + fieldMinMaxFilePtr_() << token::TAB << "proc"; + } + + fieldMinMaxFilePtr_() << endl; } } diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C index c2e9674329..d014ecd0a6 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C @@ -88,16 +88,43 @@ void Foam::fieldMinMax::calcMinMaxFields fieldMinMaxFilePtr_() << obr_.time().value() << token::TAB << fieldName << token::TAB - << minValue << token::TAB << minC << token::TAB - << maxValue << token::TAB << maxC << endl; + << minValue << token::TAB << minC; + + if (Pstream::parRun()) + { + fieldMinMaxFilePtr_() << token::TAB << minI; + } + + fieldMinMaxFilePtr_() + << token::TAB << maxValue << token::TAB << maxC; + + if (Pstream::parRun()) + { + fieldMinMaxFilePtr_() << token::TAB << maxI; + } + + fieldMinMaxFilePtr_() << endl; } if (log_) { Info<< " min(mag(" << fieldName << ")) = " - << minValue << " at position " << minC << nl - << " max(mag(" << fieldName << ")) = " - << maxValue << " at position " << maxC << nl; + << minValue << " at position " << minC; + + if (Pstream::parRun()) + { + Info<< " on processor " << minI; + } + + Info<< nl << " max(mag(" << fieldName << ")) = " + << maxValue << " at position " << maxC; + + if (Pstream::parRun()) + { + Info<< " on processor " << maxI; + } + + Info<< endl; } } break; @@ -142,16 +169,43 @@ void Foam::fieldMinMax::calcMinMaxFields fieldMinMaxFilePtr_() << obr_.time().value() << token::TAB << fieldName << token::TAB - << minValue << token::TAB << minC << token::TAB - << maxValue << token::TAB << maxC << endl; + << minValue << token::TAB << minC; + + if (Pstream::parRun()) + { + fieldMinMaxFilePtr_() << token::TAB << minI; + } + + fieldMinMaxFilePtr_() + << token::TAB << maxValue << token::TAB << maxC; + + if (Pstream::parRun()) + { + fieldMinMaxFilePtr_() << token::TAB << maxI; + } + + fieldMinMaxFilePtr_() << endl; } if (log_) { Info<< " min(" << fieldName << ") = " - << minValue << " at position " << minC << nl - << " max(" << fieldName << ") = " - << maxValue << " at position " << maxC << nl; + << minValue << " at position " << minC; + + if (Pstream::parRun()) + { + Info<< " on processor " << minI; + } + + Info<< nl << " max(" << fieldName << ") = " + << maxValue << " at position " << maxC; + + if (Pstream::parRun()) + { + Info<< " on processor " << maxI; + } + + Info<< endl; } } break; From de772cfd3bfc272834c5ac62142869fd7b3b619a Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 4 May 2012 14:33:30 +0100 Subject: [PATCH 11/72] ENH: ReactingParcel - only apply surface correction if Bird correction is selected --- .../parcels/Templates/ReactingParcel/ReactingParcel.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C index dde11bd2f7..538ef84c82 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -152,7 +152,7 @@ void Foam::ReactingParcel::correctSurfaceValues ) { // No correction if total concentration of emitted species is small - if (sum(Cs) < SMALL) + if (!td.cloud().heatTransfer().BirdCorrection() || (sum(Cs) < SMALL)) { return; } From f125005e68e98637cfa5101d2e1e63df8401b5b3 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 4 May 2012 14:44:01 +0100 Subject: [PATCH 12/72] ENH: Surface films - updated Co number calculation --- .../kinematicSingleLayer.C | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C index a448083f99..86f5b34b63 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -879,22 +879,19 @@ scalar kinematicSingleLayer::CourantNumber() const if (regionMesh().nInternalFaces() > 0) { - const scalar deltaT = time_.deltaTValue(); + const scalarField sumPhi(fvc::surfaceSum(mag(phi_))); - const surfaceScalarField SfUfbyDelta - ( - regionMesh().surfaceInterpolation::deltaCoeffs()*mag(phi_) - ); - const surfaceScalarField rhoDelta(fvc::interpolate(rho_*delta_)); - const surfaceScalarField& magSf = regionMesh().magSf(); + const scalarField& V = regionMesh().V(); - forAll(rhoDelta, i) + forAll(deltaRho_, i) { - if (rhoDelta[i] > ROOTVSMALL) + if (deltaRho_[i] > SMALL) { - CoNum = max(CoNum, SfUfbyDelta[i]/rhoDelta[i]/magSf[i]*deltaT); + CoNum = max(CoNum, sumPhi[i]/deltaRho_[i]/V[i]); } } + + CoNum *= 0.5*time_.deltaTValue(); } reduce(CoNum, maxOp()); From 8c3a48b20dce0006b3916249267af0c5a295b815 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 9 May 2012 10:16:57 +0100 Subject: [PATCH 13/72] ENH: Updated code templates copyright year to 2012 --- etc/codeTemplates/source/_Template.C | 2 +- etc/codeTemplates/source/_Template.H | 2 +- etc/codeTemplates/source/_TemplateApp.C | 2 +- etc/codeTemplates/source/_TemplateI.H | 2 +- etc/codeTemplates/source/_TemplateIO.C | 2 +- etc/codeTemplates/template/_TemplateTemplate.C | 2 +- etc/codeTemplates/template/_TemplateTemplate.H | 2 +- etc/codeTemplates/template/_TemplateTemplateI.H | 2 +- etc/codeTemplates/template/_TemplateTemplateIO.C | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/etc/codeTemplates/source/_Template.C b/etc/codeTemplates/source/_Template.C index 2587eff0a1..db0fb9ba1a 100644 --- a/etc/codeTemplates/source/_Template.C +++ b/etc/codeTemplates/source/_Template.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/etc/codeTemplates/source/_Template.H b/etc/codeTemplates/source/_Template.H index 5dfa751e3f..1226ef835c 100644 --- a/etc/codeTemplates/source/_Template.H +++ b/etc/codeTemplates/source/_Template.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/etc/codeTemplates/source/_TemplateApp.C b/etc/codeTemplates/source/_TemplateApp.C index 834c4ca826..070100f96e 100644 --- a/etc/codeTemplates/source/_TemplateApp.C +++ b/etc/codeTemplates/source/_TemplateApp.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/etc/codeTemplates/source/_TemplateI.H b/etc/codeTemplates/source/_TemplateI.H index da5a6787bf..8de09a51e1 100644 --- a/etc/codeTemplates/source/_TemplateI.H +++ b/etc/codeTemplates/source/_TemplateI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/etc/codeTemplates/source/_TemplateIO.C b/etc/codeTemplates/source/_TemplateIO.C index 6eef477e74..bb2972330b 100644 --- a/etc/codeTemplates/source/_TemplateIO.C +++ b/etc/codeTemplates/source/_TemplateIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/etc/codeTemplates/template/_TemplateTemplate.C b/etc/codeTemplates/template/_TemplateTemplate.C index 98b9748f15..0cd8a3fbc9 100644 --- a/etc/codeTemplates/template/_TemplateTemplate.C +++ b/etc/codeTemplates/template/_TemplateTemplate.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/etc/codeTemplates/template/_TemplateTemplate.H b/etc/codeTemplates/template/_TemplateTemplate.H index 783c9e505b..8db7a0fc99 100644 --- a/etc/codeTemplates/template/_TemplateTemplate.H +++ b/etc/codeTemplates/template/_TemplateTemplate.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/etc/codeTemplates/template/_TemplateTemplateI.H b/etc/codeTemplates/template/_TemplateTemplateI.H index da5a6787bf..8de09a51e1 100644 --- a/etc/codeTemplates/template/_TemplateTemplateI.H +++ b/etc/codeTemplates/template/_TemplateTemplateI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/etc/codeTemplates/template/_TemplateTemplateIO.C b/etc/codeTemplates/template/_TemplateTemplateIO.C index 456d28ba8e..8a5e6e56c4 100644 --- a/etc/codeTemplates/template/_TemplateTemplateIO.C +++ b/etc/codeTemplates/template/_TemplateTemplateIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License From ed1d7f067ab727ca8ce68311aa6119afa7b5ae1d Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 9 May 2012 10:19:30 +0100 Subject: [PATCH 14/72] ENH: Updated definition of series profie for rotorDiskSource --- .../rotorDiskSource/profileModel/series/seriesProfile.C | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fieldSources/basicSource/rotorDiskSource/profileModel/series/seriesProfile.C b/src/fieldSources/basicSource/rotorDiskSource/profileModel/series/seriesProfile.C index 77dad6d371..5c8a20c108 100644 --- a/src/fieldSources/basicSource/rotorDiskSource/profileModel/series/seriesProfile.C +++ b/src/fieldSources/basicSource/rotorDiskSource/profileModel/series/seriesProfile.C @@ -48,7 +48,7 @@ Foam::scalar Foam::seriesProfile::evaluateDrag forAll(values, i) { - result += values[i]*cos((i + 1)*xIn); + result += values[i]*cos(i*xIn); } return result; @@ -65,7 +65,9 @@ Foam::scalar Foam::seriesProfile::evaluateLift forAll(values, i) { - result += values[i]*sin((i + 1)*xIn); + // note: first contribution always zero since sin(0) = 0, but + // keep zero base to be consitent with drag coeffs + result += values[i]*sin(i*xIn); } return result; From 03e4f7cc4afb2d2abcd73d2ee4938cc02279cc8c Mon Sep 17 00:00:00 2001 From: laurence Date: Fri, 11 May 2012 09:12:21 +0100 Subject: [PATCH 15/72] BUG: checkMesh: sort number of cells with a given number of faces --- .../mesh/manipulation/checkMesh/printMeshStats.C | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/applications/utilities/mesh/manipulation/checkMesh/printMeshStats.C b/applications/utilities/mesh/manipulation/checkMesh/printMeshStats.C index 874ebc3fb2..9ff4ed0334 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/printMeshStats.C +++ b/applications/utilities/mesh/manipulation/checkMesh/printMeshStats.C @@ -152,13 +152,17 @@ void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology) { Pstream::mapCombineGather(polyhedralFaces, plusEqOp