From 492cf1e7600e6fe3407fcde6a8926c265ffdf61a Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 7 Dec 2011 16:20:45 +0000 Subject: [PATCH 01/15] BUG: Corrected liquidProperties New selector for user-defined liquid --- .../liquidProperties/liquidProperties.C | 35 +++---------------- 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/src/thermophysicalModels/properties/liquidProperties/liquidProperties/liquidProperties.C b/src/thermophysicalModels/properties/liquidProperties/liquidProperties/liquidProperties.C index e23c2d5153..877462f3b7 100644 --- a/src/thermophysicalModels/properties/liquidProperties/liquidProperties/liquidProperties.C +++ b/src/thermophysicalModels/properties/liquidProperties/liquidProperties/liquidProperties.C @@ -148,20 +148,7 @@ Foam::autoPtr Foam::liquidProperties::New(Istream& is) } else if (coeffs == "coeffs") { - IstreamConstructorTable::iterator cstrIter = - IstreamConstructorTablePtr_->find(liquidPropertiesType); - - if (cstrIter == IstreamConstructorTablePtr_->end()) - { - FatalErrorIn("liquidProperties::New(Istream&)") - << "Unknown liquidProperties type " - << liquidPropertiesType << nl << nl - << "Valid liquidProperties types are:" << nl - << IstreamConstructorTablePtr_->sortedToc() - << abort(FatalError); - } - - return autoPtr(cstrIter()(is)); + return autoPtr(new liquidProperties(is)); } else { @@ -212,24 +199,12 @@ Foam::autoPtr Foam::liquidProperties::New } else { - dictionaryConstructorTable::iterator cstrIter = - dictionaryConstructorTablePtr_->find(liquidPropertiesTypeName); - - if (cstrIter == dictionaryConstructorTablePtr_->end()) - { - FatalErrorIn - ( - "liquidProperties::New(const dictionary&, const word&)" - ) << "Unknown liquidProperties type " - << liquidPropertiesTypeName << nl << nl - << "Valid liquidProperties types are:" << nl - << dictionaryConstructorTablePtr_->sortedToc() - << abort(FatalError); - } - return autoPtr ( - cstrIter()(dict.subDict(liquidPropertiesTypeName + "Coeffs")) + new liquidProperties + ( + dict.subDict(liquidPropertiesTypeName + "Coeffs") + ) ); } } From 3c0a78fb1b2a795b68e2ae1958c5fc3f67b70978 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 7 Dec 2011 16:28:10 +0000 Subject: [PATCH 02/15] ENH: Updates to rotorDiskSource momentum source --- .../rotorDiskSource/rotorDiskSource.C | 29 +++++++++++------ .../rotorDiskSource/rotorDiskSource.H | 8 +++-- .../rotorDiskSourceTemplates.C | 32 +++++++++++++------ 3 files changed, 47 insertions(+), 22 deletions(-) diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.C index 3b300e08ae..80e12aae66 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.C @@ -354,25 +354,33 @@ void Foam::rotorDiskSource::constructGeometry() { const label cellI = cells_[i]; - // position in rotor co-ordinate system + // position in (planar) rotor co-ordinate system x_[i] = coordSys_.localPosition(C[cellI]); // cache max radius rMax_ = max(rMax_, x_[i].x()); - // determine swept angle relative to rDir axis - scalar psi = x_[i].y() - rDir.y(); + // swept angle relative to rDir axis [radians] in range 0 -> 2*pi + scalar psi = x_[i].y(); + if (psi < 0) + { + psi += mathematical::twoPi; + } - // blade flap angle + // blade flap angle [radians] scalar beta = flap_.beta0 - flap_.beta1*cos(psi) - flap_.beta2*sin(psi); - // determine rotation tensor to convert into the rotor cone plane - scalar c = cos(-beta); - scalar s = sin(-beta); - R_[i] = tensor(1, 0, 0, 0, c, s, 0, -s, c); + // determine rotation tensor to convert from planar system into the + // rotor cone system + scalar cNeg = cos(-beta); + scalar sNeg = sin(-beta); + R_[i] = tensor(cNeg, 0.0, -sNeg, 0.0, 1.0, 0.0, sNeg, 0.0, cNeg); + scalar cPos = cos(beta); + scalar sPos = sin(beta); + invR_[i] = tensor(cPos, 0.0, -sPos, 0.0, 1.0, 0.0, sPos, 0.0, cPos); - // geometric angle of attack - not including twist - alphag_[i] = trim_.alphaC - trim_.A*cos(psi) - trim_.B*sin(psi); + // geometric angle of attack - not including twist [radians] + alphag_[i] = trim_.alphaC + trim_.A*cos(psi) + trim_.B*sin(psi); } } @@ -439,6 +447,7 @@ Foam::rotorDiskSource::rotorDiskSource profiles_(coeffs_.subDict("profiles")), x_(cells_.size(), vector::zero), R_(cells_.size(), I), + invR_(cells_.size(), I), alphag_(cells_.size(), 0.0), area_(cells_.size(), 0.0), coordSys_(false), diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.H index 7565fa17ce..ae2d8a2a47 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.H +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.H @@ -131,17 +131,18 @@ public: protected: // Helper structures to encapsulate flap and trim data + // Note: all input in degrees (converted to radians internally) struct flapData { - scalar beta0; // coning angle [deg] + scalar beta0; // coning angle scalar beta1; // lateral flapping coeff scalar beta2; // longitudinal flapping coeff }; struct trimData { - scalar alphaC; // collective pitch angle [deg] + scalar alphaC; // collective pitch angle scalar A; // lateral cyclic coeff scalar B; // longitudinal cyclic coeff }; @@ -186,6 +187,9 @@ protected: //- Rotation tensor for flap angle List R_; + //- Inverse rotation tensor for flap angle + List invR_; + //- Geometric angle of attack [deg] List alphag_; diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSourceTemplates.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSourceTemplates.C index acadb0ec9d..f4d02efd54 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSourceTemplates.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSourceTemplates.C @@ -29,7 +29,7 @@ License #include "unitConversion.H" #include "volFields.H" -using namespace Foam::constant; +using namespace Foam::constant::mathematical; // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -124,11 +124,11 @@ Foam::tmp Foam::rotorDiskSource::calculateForces const scalar radius = x_[i].x(); - // apply correction due to flap in cartesian frame - vector Uc = R_[i] & U[cellI]; + // velocity in local cylindrical reference frame + vector Uc = coordSys_.localVector(U[cellI]); - // velocity in local reference frame - Uc = coordSys_.localVector(Uc); + // apply correction in local system due to coning + Uc = R_[i] & Uc; // set radial component of velocity to zero Uc.x() = 0.0; @@ -149,7 +149,16 @@ Foam::tmp Foam::rotorDiskSource::calculateForces blade_.interpolate(radius, twist, chord, i1, i2, invDr); // effective angle of attack - scalar alphaEff = alphag_[i] + twist - atan(Uc.z()/Uc.y()); + scalar alphaEff = pi + atan2(Uc.z(), Uc.y()) - (alphag_[i] + twist); + if (alphaEff > pi) + { + alphaEff -= twoPi; + } + if (alphaEff < -pi) + { + alphaEff += twoPi; + } + AOAmin = min(AOAmin, alphaEff); AOAmax = max(AOAmax, alphaEff); @@ -175,10 +184,13 @@ Foam::tmp Foam::rotorDiskSource::calculateForces tipFactor = 0.0; } - // calculate forces - const scalar pDyn = 0.5*rho[cellI]*sqr(magUc); - const scalar f = pDyn*chord*nBlades_*area_[i]/(mathematical::twoPi); - const vector localForce(0.0, f*Cd, tipFactor*f*Cl); + // calculate forces perpendicular to blade + scalar pDyn = 0.5*rho[cellI]*sqr(magUc); + scalar f = pDyn*chord*nBlades_*area_[i]/twoPi; + vector localForce = vector(0.0, f*Cd, tipFactor*f*Cl); + + // convert force from local coning system into rotor cylindrical + localForce = invR_[i] & localForce; // accumulate forces dragEff += localForce.y(); From 097bb7221d5e0a624bf3957ef2a83840151f0901 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 8 Dec 2011 11:39:28 +0000 Subject: [PATCH 03/15] ENH: Added DataEntry input for cylindricalInletVelocity and swirlFlowRateInletVelocity BCs --- ...lindricalInletVelocityFvPatchVectorField.C | 66 +++++++++---------- ...lindricalInletVelocityFvPatchVectorField.H | 24 +++---- ...lFlowRateInletVelocityFvPatchVectorField.C | 56 ++++++++-------- ...lFlowRateInletVelocityFvPatchVectorField.H | 32 +++++---- 4 files changed, 88 insertions(+), 90 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C index f2badf6cfb..638323c47b 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C @@ -33,8 +33,7 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam:: -cylindricalInletVelocityFvPatchVectorField:: +Foam::cylindricalInletVelocityFvPatchVectorField:: cylindricalInletVelocityFvPatchVectorField ( const fvPatch& p, @@ -42,16 +41,15 @@ cylindricalInletVelocityFvPatchVectorField ) : fixedValueFvPatchField(p, iF), - axialVelocity_(0), centre_(pTraits::zero), axis_(pTraits::zero), - rpm_(0), - radialVelocity_(0) + axialVelocity_(), + radialVelocity_(), + rpm_() {} -Foam:: -cylindricalInletVelocityFvPatchVectorField:: +Foam::cylindricalInletVelocityFvPatchVectorField:: cylindricalInletVelocityFvPatchVectorField ( const cylindricalInletVelocityFvPatchVectorField& ptf, @@ -61,16 +59,15 @@ cylindricalInletVelocityFvPatchVectorField ) : fixedValueFvPatchField(ptf, p, iF, mapper), - axialVelocity_(ptf.axialVelocity_), centre_(ptf.centre_), axis_(ptf.axis_), - rpm_(ptf.rpm_), - radialVelocity_(ptf.radialVelocity_) + axialVelocity_(ptf.axialVelocity_().clone().ptr()), + radialVelocity_(ptf.radialVelocity_().clone().ptr()), + rpm_(ptf.rpm_().clone().ptr()) {} -Foam:: -cylindricalInletVelocityFvPatchVectorField:: +Foam::cylindricalInletVelocityFvPatchVectorField:: cylindricalInletVelocityFvPatchVectorField ( const fvPatch& p, @@ -79,32 +76,30 @@ cylindricalInletVelocityFvPatchVectorField ) : fixedValueFvPatchField(p, iF, dict), - axialVelocity_(readScalar(dict.lookup("axialVelocity"))), centre_(dict.lookup("centre")), axis_(dict.lookup("axis")), - rpm_(readScalar(dict.lookup("rpm"))), - radialVelocity_(readScalar(dict.lookup("radialVelocity"))) + axialVelocity_(DataEntry::New("axialVelocity", dict)), + radialVelocity_(DataEntry::New("radialVelocity", dict)), + rpm_(DataEntry::New("rpm", dict)) {} -Foam:: -cylindricalInletVelocityFvPatchVectorField:: +Foam::cylindricalInletVelocityFvPatchVectorField:: cylindricalInletVelocityFvPatchVectorField ( const cylindricalInletVelocityFvPatchVectorField& ptf ) : fixedValueFvPatchField(ptf), - axialVelocity_(ptf.axialVelocity_), centre_(ptf.centre_), axis_(ptf.axis_), - rpm_(ptf.rpm_), - radialVelocity_(ptf.radialVelocity_) + axialVelocity_(ptf.axialVelocity_().clone().ptr()), + radialVelocity_(ptf.radialVelocity_().clone().ptr()), + rpm_(ptf.rpm_().clone().ptr()) {} -Foam:: -cylindricalInletVelocityFvPatchVectorField:: +Foam::cylindricalInletVelocityFvPatchVectorField:: cylindricalInletVelocityFvPatchVectorField ( const cylindricalInletVelocityFvPatchVectorField& ptf, @@ -112,11 +107,11 @@ cylindricalInletVelocityFvPatchVectorField ) : fixedValueFvPatchField(ptf, iF), - axialVelocity_(ptf.axialVelocity_), centre_(ptf.centre_), axis_(ptf.axis_), - rpm_(ptf.rpm_), - radialVelocity_(ptf.radialVelocity_) + axialVelocity_(ptf.axialVelocity_().clone().ptr()), + radialVelocity_(ptf.radialVelocity_().clone().ptr()), + rpm_(ptf.rpm_().clone().ptr()) {} @@ -129,15 +124,22 @@ void Foam::cylindricalInletVelocityFvPatchVectorField::updateCoeffs() return; } + const scalar t = this->db().time().timeOutputValue(); + const scalar axialVelocity = axialVelocity_->value(t); + const scalar radialVelocity = radialVelocity_->value(t); + const scalar rpm = rpm_->value(t); + vector hatAxis = axis_/mag(axis_); const vectorField r(patch().Cf() - centre_); tmp d = r - (hatAxis & r)*hatAxis; - tmp tangVel = - (rpm_*constant::mathematical::pi/30.0)*(hatAxis) ^ d; + tmp tangVel + ( + (rpm*constant::mathematical::pi/30.0)*(hatAxis) ^ d + ); - operator==(tangVel + axis_*axialVelocity_ + radialVelocity_*d); + operator==(tangVel + axis_*axialVelocity + radialVelocity*d); fixedValueFvPatchField::updateCoeffs(); } @@ -146,13 +148,11 @@ void Foam::cylindricalInletVelocityFvPatchVectorField::updateCoeffs() void Foam::cylindricalInletVelocityFvPatchVectorField::write(Ostream& os) const { fvPatchField::write(os); - os.writeKeyword("axialVelocity") << axialVelocity_ << - token::END_STATEMENT << nl; os.writeKeyword("centre") << centre_ << token::END_STATEMENT << nl; os.writeKeyword("axis") << axis_ << token::END_STATEMENT << nl; - os.writeKeyword("rpm") << rpm_ << token::END_STATEMENT << nl; - os.writeKeyword("radialVelocity") << radialVelocity_ << - token::END_STATEMENT << nl; + axialVelocity_->writeData(os); + radialVelocity_->writeData(os); + rpm_->writeData(os); writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.H index ae2343757c..de15affbc7 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.H @@ -36,12 +36,15 @@ Description type cylindricalInletVelocity; axis (0 0 1); centre (0 0 0); - axialVelocity 30; - rpm 100; - radialVelocity -10; + axialVelocity constant 30; + radialVelocity constant -10; + rpm constant 100; } \endverbatim + The axialVelocity, radialVelocity and rpm entries are DataEntry types, able + to describe time varying functions. The example above gives the usage for + supplying constant values. SourceFiles cylindricalInletVelocityFvPatchVectorField.C @@ -52,6 +55,7 @@ SourceFiles #define cylindricalInletVelocityFvPatchVectorField_H #include "fixedValueFvPatchFields.H" +#include "DataEntry.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -67,20 +71,20 @@ class cylindricalInletVelocityFvPatchVectorField { // Private data - //- Axial velocity - const scalar axialVelocity_; - //- Central point const vector centre_; //- Axis const vector axis_; - //- RPM - const scalar rpm_; + //- Axial velocity + autoPtr > axialVelocity_; //- Radial velocity - const scalar radialVelocity_; + autoPtr > radialVelocity_; + + //- RPM + autoPtr > rpm_; public: @@ -154,13 +158,11 @@ public: // Member functions - //- Update the coefficients associated with the patch field virtual void updateCoeffs(); //- Write virtual void write(Ostream&) const; - }; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C index 8b1de46e0a..859006cd44 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C @@ -32,8 +32,7 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam:: -swirlFlowRateInletVelocityFvPatchVectorField:: +Foam::swirlFlowRateInletVelocityFvPatchVectorField:: swirlFlowRateInletVelocityFvPatchVectorField ( const fvPatch& p, @@ -41,15 +40,14 @@ swirlFlowRateInletVelocityFvPatchVectorField ) : fixedValueFvPatchField(p, iF), - flowRate_(0), phiName_("phi"), rhoName_("rho"), - rpm_(0) + flowRate_(), + rpm_() {} -Foam:: -swirlFlowRateInletVelocityFvPatchVectorField:: +Foam::swirlFlowRateInletVelocityFvPatchVectorField:: swirlFlowRateInletVelocityFvPatchVectorField ( const swirlFlowRateInletVelocityFvPatchVectorField& ptf, @@ -59,15 +57,14 @@ swirlFlowRateInletVelocityFvPatchVectorField ) : fixedValueFvPatchField(ptf, p, iF, mapper), - flowRate_(ptf.flowRate_), phiName_(ptf.phiName_), rhoName_(ptf.rhoName_), - rpm_(ptf.rpm_) + flowRate_(ptf.flowRate_().clone().ptr()), + rpm_(ptf.rpm_().clone().ptr()) {} -Foam:: -swirlFlowRateInletVelocityFvPatchVectorField:: +Foam::swirlFlowRateInletVelocityFvPatchVectorField:: swirlFlowRateInletVelocityFvPatchVectorField ( const fvPatch& p, @@ -76,30 +73,28 @@ swirlFlowRateInletVelocityFvPatchVectorField ) : fixedValueFvPatchField(p, iF, dict), - flowRate_(readScalar(dict.lookup("flowRate"))), phiName_(dict.lookupOrDefault("phi", "phi")), rhoName_(dict.lookupOrDefault("rho", "rho")), - rpm_(readScalar(dict.lookup("rpm"))) + flowRate_(DataEntry::New("flowRate", dict)), + rpm_(DataEntry::New("rpm", dict)) {} -Foam:: -swirlFlowRateInletVelocityFvPatchVectorField:: +Foam::swirlFlowRateInletVelocityFvPatchVectorField:: swirlFlowRateInletVelocityFvPatchVectorField ( const swirlFlowRateInletVelocityFvPatchVectorField& ptf ) : fixedValueFvPatchField(ptf), - flowRate_(ptf.flowRate_), phiName_(ptf.phiName_), rhoName_(ptf.rhoName_), - rpm_(ptf.rpm_) + flowRate_(ptf.flowRate_().clone().ptr()), + rpm_(ptf.rpm_().clone().ptr()) {} -Foam:: -swirlFlowRateInletVelocityFvPatchVectorField:: +Foam::swirlFlowRateInletVelocityFvPatchVectorField:: swirlFlowRateInletVelocityFvPatchVectorField ( const swirlFlowRateInletVelocityFvPatchVectorField& ptf, @@ -107,10 +102,10 @@ swirlFlowRateInletVelocityFvPatchVectorField ) : fixedValueFvPatchField(ptf, iF), - flowRate_(ptf.flowRate_), phiName_(ptf.phiName_), rhoName_(ptf.rhoName_), - rpm_(ptf.rpm_) + flowRate_(ptf.flowRate_().clone().ptr()), + rpm_(ptf.rpm_().clone().ptr()) {} @@ -123,19 +118,22 @@ void Foam::swirlFlowRateInletVelocityFvPatchVectorField::updateCoeffs() return; } + const scalar t = this->db().time().timeOutputValue(); + const scalar flowRate = flowRate_->value(t); + const scalar rpm = rpm_->value(t); + const scalar totArea = gSum(patch().magSf()); - // a simpler way of doing this would be nice - const scalar avgU = -flowRate_/totArea; + const scalar avgU = -flowRate/totArea; const vector avgCenter = gSum(patch().Cf()*patch().magSf())/totArea; const vector avgNormal = gSum(patch().Sf())/totArea; // Update angular velocity - convert [rpm] to [rad/s] - tmp tangentialVelocity = - ( - (rpm_*constant::mathematical::pi/30.0) - * (patch().Cf() - avgCenter) ^ avgNormal - ); + tmp tangentialVelocity + ( + (rpm*constant::mathematical::pi/30.0) + * (patch().Cf() - avgCenter) ^ avgNormal + ); tmp n = patch().nf(); @@ -177,10 +175,10 @@ void Foam::swirlFlowRateInletVelocityFvPatchVectorField::write ) const { fvPatchField::write(os); - os.writeKeyword("flowRate") << flowRate_ << token::END_STATEMENT << nl; writeEntryIfDifferent(os, "phi", "phi", phiName_); writeEntryIfDifferent(os, "rho", "rho", rhoName_); - os.writeKeyword("rpm") << rpm_ << token::END_STATEMENT << nl; + flowRate_->writeData(os); + rpm_->writeData(os); writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.H index 041376cb12..ef2ea8b9c9 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.H @@ -39,11 +39,15 @@ Description inlet { type swirlFlowRateInletVelocity; - flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s] - rpm 100; + flowRate constant 0.2; // Vol/mass flow rate [m3/s or kg/s] + rpm constant 100; } \endverbatim + The flowRate and rpm entries are DataEntry types, able to describe time + varying functions. The example above gives the usage for supplying + constant values. + Note - The value is positive inwards @@ -56,6 +60,7 @@ SourceFiles #define swirlFlowRateInletVelocityFvPatchVectorField_H #include "fixedValueFvPatchFields.H" +#include "DataEntry.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -71,17 +76,17 @@ class swirlFlowRateInletVelocityFvPatchVectorField { // Private data - //- Inlet integral flow rate - const scalar flowRate_; - //- Name of the flux transporting the field const word phiName_; //- Name of the density field used to normalize the mass flux const word rhoName_; + //- Inlet integral flow rate + autoPtr > flowRate_; + //- RPM - const scalar rpm_; + autoPtr > rpm_; public: @@ -157,18 +162,11 @@ public: // Access - //- Return the flux - scalar flowRate() const - { - return flowRate_; - } + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); - - //- Update the coefficients associated with the patch field - virtual void updateCoeffs(); - - //- Write - virtual void write(Ostream&) const; + //- Write + virtual void write(Ostream&) const; }; From c78781e19b2da576b1b63e08997bd945409e91a3 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 8 Dec 2011 11:44:20 +0000 Subject: [PATCH 04/15] STYLE: Added description to uniformFixedValue BC header --- .../uniformFixedValueFvPatchField.H | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.H index aa829f08aa..1643f65af8 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.H @@ -25,7 +25,21 @@ Class Foam::uniformFixedValueFvPatchField Description - Foam::uniformFixedValueFvPatchField + Enables the specification of a uniform fixed value boundary condition. + + Example of the boundary condition specification: + \verbatim + inlet + { + type uniformFixedValue; + uniformValue constant 0.2; + } + \endverbatim + + The uniformValue entry is a DataEntry type, able to describe time + varying functions. The example above gives the usage for supplying a + constant value. + SourceFiles uniformFixedValueFvPatchField.C From aa2bc1745a386ba64cd709a2674bc1c25ea477ee Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 8 Dec 2011 12:03:32 +0000 Subject: [PATCH 05/15] STYLE: Added description to oscillatingFixedValue BC header --- .../oscillatingFixedValueFvPatchField.H | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/oscillatingFixedValue/oscillatingFixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/oscillatingFixedValue/oscillatingFixedValueFvPatchField.H index 9a3120a69d..ba84bc1c26 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/oscillatingFixedValue/oscillatingFixedValueFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/oscillatingFixedValue/oscillatingFixedValueFvPatchField.H @@ -25,7 +25,24 @@ Class Foam::oscillatingFixedValueFvPatchField Description - Foam::oscillatingFixedValueFvPatchField + Describes an oscillating boundary condition in terms of amplitude and + frequency. + + Example of the boundary condition specification: + \verbatim + inlet + { + type oscillatingFixedValue; + refValue uniform 5.0; + offset 0.0; // optional + amplitude constant 0.5; + frequency constant 10; + } + \endverbatim + + The amplitude and frequency entries are DataEntry types, able to describe + time varying functions. The example above gives the usage for supplying + constant values. SourceFiles oscillatingFixedValueFvPatchField.C From f90965211fc349d8f7fbf1beedbf6964fc8f599a Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 8 Dec 2011 12:48:21 +0000 Subject: [PATCH 06/15] ENH: AMI - use pre-calculated areas instead of re-calculation --- .../AMIInterpolation/AMIInterpolation.C | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C index 74c0235606..a9c9113056 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C @@ -889,21 +889,22 @@ Foam::scalar Foam::AMIInterpolation::interArea const primitivePatch& tgtPatch ) const { - const pointField& srcPoints = srcPatch.points(); - const pointField& tgtPoints = tgtPatch.points(); - - const face& src = srcPatch[srcFaceI]; - const face& tgt = tgtPatch[tgtFaceI]; - // quick reject if either face has zero area - if ((src.mag(srcPoints) < ROOTVSMALL) || (tgt.mag(tgtPoints) < ROOTVSMALL)) + if (srcMagSf_[srcFaceI] < ROOTVSMALL || tgtMagSf_[tgtFaceI] < ROOTVSMALL) { return 0.0; } + const pointField& srcPoints = srcPatch.points(); + const pointField& tgtPoints = tgtPatch.points(); + // create intersection object faceAreaIntersect inter(srcPoints, tgtPoints, reverseTarget_); + // references to candidate faces + const face& src = srcPatch[srcFaceI]; + const face& tgt = tgtPatch[tgtFaceI]; + // crude resultant norm vector n(-src.normal(srcPoints)); if (reverseTarget_) From f6f7f8c3d500434a239088c851cd3e2a8ae110aa Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 8 Dec 2011 15:05:24 +0000 Subject: [PATCH 07/15] STYLE: Updated comments in AMI code --- .../AMIInterpolation/AMIInterpolation.C | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C index a9c9113056..f2f1a764d7 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C @@ -693,7 +693,7 @@ Foam::label Foam::AMIInterpolation::findTargetFace const pointField& srcPts = srcPatch.points(); const face& srcFace = srcPatch[srcFaceI]; const point& srcPt = srcFace.centre(srcPts); - const scalar srcFaceArea = srcFace.mag(srcPts); + const scalar srcFaceArea = srcMagSf_[srcFaceI]; // pointIndexHit sample = treePtr_->findNearest(srcPt, sqr(0.1*bb.mag())); pointIndexHit sample = treePtr_->findNearest(srcPt, 10.0*srcFaceArea); @@ -1611,11 +1611,11 @@ Foam::AMIInterpolation::AMIInterpolation { FatalErrorIn ( - "AMIInterpolation::AMIInterpolation\n" - "(\n" - " const AMIInterpolation&,\n" - " const label,\n" - " const labelList&\n" + "AMIInterpolation::AMIInterpolation" + "(" + " const AMIInterpolation&, " + " const label, " + " const labelList&" ")" ) << "Size mismatch." << nl << "Source patch size:" << fineAMI.srcAddress().size() << nl @@ -1868,7 +1868,12 @@ void Foam::AMIInterpolation::interpolateToTarget { FatalErrorIn ( - "AMIInterpolation::interpolateToTarget(const Field&) const" + "AMIInterpolation::interpolateToTarget" + "(" + "const UList&, " + "const CombineOp&, " + "List&" + ") const" ) << "Supplied field size is not equal to source patch size" << nl << " source patch = " << srcAddress_.size() << nl << " target patch = " << tgtAddress_.size() << nl @@ -1925,7 +1930,12 @@ void Foam::AMIInterpolation::interpolateToSource { FatalErrorIn ( - "AMIInterpolation::interpolateToSource(const Field) const" + "AMIInterpolation::interpolateToSource" + "(" + "const UList&, " + "const CombineOp&, " + "List&" + ") const" ) << "Supplied field size is not equal to target patch size" << nl << " source patch = " << srcAddress_.size() << nl << " target patch = " << tgtAddress_.size() << nl From ee8c2e49083c44ffe15c8f4dc7832dd90ebc6083 Mon Sep 17 00:00:00 2001 From: laurence Date: Fri, 9 Dec 2011 12:48:45 +0000 Subject: [PATCH 08/15] BUG: Remove overwrite option from extrude2DMesh and unused variable in cvMesh --- .../cellSizeControlSurfaces.C | 2 +- .../extrude2DMesh/extrude2DMeshApp.C | 34 ++++++++----------- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeControlSurfaces.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeControlSurfaces.C index 1a759248bb..158c1a1d34 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeControlSurfaces.C +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeControlSurfaces.C @@ -281,7 +281,7 @@ Foam::scalar Foam::cellSizeControlSurfaces::cellSize { scalar size = defaultCellSize_; - bool anyFunctionFound = evalCellSizeFunctions(pt, size); +// bool anyFunctionFound = evalCellSizeFunctions(pt, size); //if (!anyFunctionFound) //{ diff --git a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C index 37f12001bd..4bb6b97b16 100644 --- a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C +++ b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C @@ -111,8 +111,6 @@ static const NamedEnum ExtrudeModeNames; int main(int argc, char *argv[]) { - #include "addOverwriteOption.H" - argList::validArgs.append("surfaceFormat"); #include "setRootCase.H" @@ -128,11 +126,10 @@ int main(int argc, char *argv[]) runTimeExtruded.functionObjects().off(); - const bool overwrite = args.optionFound("overwrite"); - const ExtrudeMode surfaceFormat = ExtrudeModeNames[args[1]]; - Info<< "Extruding from " << ExtrudeModeNames[surfaceFormat] << endl; + Info<< "Extruding from " << ExtrudeModeNames[surfaceFormat] + << " at time " << runTimeExtruded.timeName() << endl; IOdictionary extrude2DMeshDict ( @@ -164,12 +161,12 @@ int main(int argc, char *argv[]) EdgeMap