From e2eab734f8cc76a2ebbddef1ff7d1b100904ef14 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 15 Jan 2010 11:59:29 +0000 Subject: [PATCH 01/39] Clean-up of patch field default field name I/O --- .../activeBaffleVelocityFvPatchVectorField.C | 32 +++++++++---------- ...MappedVelocityFluxFixedValueFvPatchField.C | 22 ++++++------- .../fixedFluxPressureFvPatchScalarField.C | 15 ++------- ...ureCompressibleDensityFvPatchScalarField.C | 6 ++-- .../fluxCorrectedVelocityFvPatchVectorField.C | 10 ++---- ...OutletTotalTemperatureFvPatchScalarField.C | 17 ++-------- .../movingWallVelocityFvPatchVectorField.C | 22 ++++++++----- .../movingWallVelocityFvPatchVectorField.H | 5 +++ ...tedInletOutletVelocityFvPatchVectorField.C | 10 ++---- ...eDirectedInletVelocityFvPatchVectorField.C | 10 ++---- ...ureInletOutletVelocityFvPatchVectorField.C | 5 +-- .../pressureInletVelocityFvPatchVectorField.C | 10 ++---- ...ngUniformTotalPressureFvPatchScalarField.C | 10 ++---- .../totalTemperatureFvPatchScalarField.C | 17 ++-------- ...sityKineticEnergyInletFvPatchScalarField.C | 8 ++++- ...sityKineticEnergyInletFvPatchScalarField.H | 4 +++ 16 files changed, 80 insertions(+), 123 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C index 1e4f3ffcc5..0ef1c8e35a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C @@ -84,7 +84,7 @@ activeBaffleVelocityFvPatchVectorField ) : fixedValueFvPatchVectorField(p, iF), - pName_("p"), + pName_(dict.lookupOrDefault("p", "p")), cyclicPatchName_(dict.lookup("cyclicPatch")), cyclicPatchLabel_(p.patch().boundaryMesh().findPatchID(cyclicPatchName_)), orientation_(readLabel(dict.lookup("orientation"))), @@ -96,11 +96,6 @@ activeBaffleVelocityFvPatchVectorField curTimeIndex_(-1) { fvPatchVectorField::operator=(vector::zero); - - if (dict.found("p")) - { - dict.lookup("p") >> pName_; - } } @@ -219,15 +214,21 @@ void Foam::activeBaffleVelocityFvPatchVectorField::updateCoeffs() } openFraction_ = - max(min( - openFraction_ - + max + max + ( + min ( - this->db().time().deltaTValue()/openingTime_, - maxOpenFractionDelta_ - ) - *(orientation_*sign(forceDiff)), - 1 - 1e-6), 1e-6); + openFraction_ + + max + ( + this->db().time().deltaTValue()/openingTime_, + maxOpenFractionDelta_ + ) + *(orientation_*sign(forceDiff)), + 1 - 1e-6 + ), + 1e-6 + ); Info<< "openFraction = " << openFraction_ << endl; @@ -264,8 +265,7 @@ void Foam::activeBaffleVelocityFvPatchVectorField::write(Ostream& os) const << maxOpenFractionDelta_ << token::END_STATEMENT << nl; os.writeKeyword("openFraction") << openFraction_ << token::END_STATEMENT << nl; - os.writeKeyword("p") - << pName_ << token::END_STATEMENT << nl; + writeEntryIfDifferent(os, "p", "p", pName_); writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.C index 526ee95639..0d1a344e03 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.C @@ -46,7 +46,7 @@ directMappedVelocityFluxFixedValueFvPatchField ) : fixedValueFvPatchVectorField(p, iF), - phiName_("undefinedPhi") + phiName_("phi") {} @@ -93,22 +93,22 @@ directMappedVelocityFluxFixedValueFvPatchField ) : fixedValueFvPatchVectorField(p, iF, dict), - phiName_(dict.lookup("phi")) + phiName_(dict.lookupOrDefault("phi", "phi")) { if (!isA(this->patch().patch())) { FatalErrorIn ( "directMappedVelocityFluxFixedValueFvPatchField::" - "directMappedVelocityFluxFixedValueFvPatchField\n" - "(\n" - " const fvPatch& p,\n" - " const DimensionedField& iF,\n" - " const dictionary& dict\n" - ")\n" - ) << "\n patch type '" << p.type() + "directMappedVelocityFluxFixedValueFvPatchField" + "(" + "const fvPatch&, " + "const DimensionedField& iF, " + "const dictionary&" + ")" + ) << "patch type '" << p.type() << "' not type '" << directMappedPatchBase::typeName << "'" - << "\n for patch " << p.name() + << " for patch " << p.name() << " of field " << dimensionedInternalField().name() << " in file " << dimensionedInternalField().objectPath() << exit(FatalError); @@ -274,7 +274,7 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs() void directMappedVelocityFluxFixedValueFvPatchField::write(Ostream& os) const { fvPatchVectorField::write(os); - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; + writeEntryIfDifferent(os, "phi", "phi", phiName_); this->writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C index 8c20f2922c..ac55d86ee2 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C @@ -161,18 +161,9 @@ void Foam::fixedFluxPressureFvPatchScalarField::updateCoeffs() void Foam::fixedFluxPressureFvPatchScalarField::write(Ostream& os) const { fvPatchScalarField::write(os); - if (UName_ != "U") - { - os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl; - } - if (phiName_ != "phi") - { - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - } - if (rhoName_ != "rho") - { - os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; - } + writeEntryIfDifferent(os, "U", "U", UName_); + writeEntryIfDifferent(os, "phi", "phi", phiName_); + writeEntryIfDifferent(os, "rho", "rho", rhoName_); os.writeKeyword("adjoint") << adjoint_ << token::END_STATEMENT << nl; gradient().writeEntry("gradient", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedPressureCompressibleDensity/fixedPressureCompressibleDensityFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedPressureCompressibleDensity/fixedPressureCompressibleDensityFvPatchScalarField.C index 0f01c960b0..a89929e428 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedPressureCompressibleDensity/fixedPressureCompressibleDensityFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedPressureCompressibleDensity/fixedPressureCompressibleDensityFvPatchScalarField.C @@ -45,7 +45,7 @@ fixedPressureCompressibleDensityFvPatchScalarField ) : fixedValueFvPatchField(p, iF), - pName_("pNameIsUndefined") + pName_("p") {} @@ -72,7 +72,7 @@ fixedPressureCompressibleDensityFvPatchScalarField ) : fixedValueFvPatchField(p, iF, dict), - pName_(dict.lookup("p")) + pName_(dict.lookupOrDefault("p", "p")) {} @@ -134,7 +134,7 @@ void fixedPressureCompressibleDensityFvPatchScalarField::write ) const { fvPatchField::write(os); - os.writeKeyword("p") << pName_ << token::END_STATEMENT << nl; + writeEntryIfDifferent(os, "p", "p", pName_); writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C index 7de0e1f9d8..675762c738 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C @@ -143,14 +143,8 @@ void Foam::fluxCorrectedVelocityFvPatchVectorField::evaluate void Foam::fluxCorrectedVelocityFvPatchVectorField::write(Ostream& os) const { fvPatchVectorField::write(os); - if (phiName_ != "phi") - { - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - } - if (rhoName_ != "rho") - { - os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; - } + writeEntryIfDifferent(os, "phi", "phi", phiName_); + writeEntryIfDifferent(os, "rho", "rho", rhoName_); writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C index d6a83b07cb..1d9141aa10 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C @@ -30,8 +30,6 @@ License #include "volFields.H" #include "surfaceFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::inletOutletTotalTemperatureFvPatchScalarField:: @@ -193,18 +191,9 @@ void Foam::inletOutletTotalTemperatureFvPatchScalarField::write(Ostream& os) const { fvPatchScalarField::write(os); - if (UName_ != "U") - { - os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl; - } - if (phiName_ != "phi") - { - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - } - if (phiName_ != "psi") - { - os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl; - } + writeEntryIfDifferent(os, "U", "U", UName_); + writeEntryIfDifferent(os, "phi", "phi", phiName_); + writeEntryIfDifferent(os, "psi", "psi", psiName_); os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl; T0_.writeEntry("T0", os); writeEntry("value", os); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C index 9c24dae9cc..ebffe092db 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C @@ -43,7 +43,8 @@ movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField const DimensionedField& iF ) : - fixedValueFvPatchVectorField(p, iF) + fixedValueFvPatchVectorField(p, iF), + UName_("U") {} @@ -55,7 +56,8 @@ movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField const fvPatchFieldMapper& mapper ) : - fixedValueFvPatchVectorField(ptf, p, iF, mapper) + fixedValueFvPatchVectorField(ptf, p, iF, mapper), + UName_(ptf.UName_) {} @@ -66,7 +68,8 @@ movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField const dictionary& dict ) : - fixedValueFvPatchVectorField(p, iF) + fixedValueFvPatchVectorField(p, iF), + UName_(dict.lookupOrDefault("U", "U")) { fvPatchVectorField::operator=(vectorField("value", dict, p.size())); } @@ -74,20 +77,22 @@ movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField ( - const movingWallVelocityFvPatchVectorField& pivpvf + const movingWallVelocityFvPatchVectorField& mwvpvf ) : - fixedValueFvPatchVectorField(pivpvf) + fixedValueFvPatchVectorField(mwvpvf), + UName_(mwvpvf.UName_) {} movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField ( - const movingWallVelocityFvPatchVectorField& pivpvf, + const movingWallVelocityFvPatchVectorField& mwvpvf, const DimensionedField& iF ) : - fixedValueFvPatchVectorField(pivpvf, iF) + fixedValueFvPatchVectorField(mwvpvf, iF), + UName_(mwvpvf.UName_) {} @@ -114,7 +119,7 @@ void movingWallVelocityFvPatchVectorField::updateCoeffs() vectorField Up = (pp.faceCentres() - oldFc)/mesh.time().deltaTValue(); - const volVectorField& U = db().lookupObject("U"); + const volVectorField& U = db().lookupObject(UName_); scalarField phip = p.patchField(fvc::meshPhi(U)); @@ -132,6 +137,7 @@ void movingWallVelocityFvPatchVectorField::updateCoeffs() void movingWallVelocityFvPatchVectorField::write(Ostream& os) const { fvPatchVectorField::write(os); + writeEntryIfDifferent(os, "U", "U", UName_); writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.H index 11118714be..ba76e373f3 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.H @@ -52,6 +52,11 @@ class movingWallVelocityFvPatchVectorField : public fixedValueFvPatchVectorField { + // Private data + + //- Name of velocity field + word UName_; + public: diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C index 49923ea891..432a8f0c51 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C @@ -196,14 +196,8 @@ void pressureDirectedInletOutletVelocityFvPatchVectorField:: write(Ostream& os) const { fvPatchVectorField::write(os); - if (phiName_ != "phi") - { - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - } - if (rhoName_ != "rho") - { - os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; - } + writeEntryIfDifferent(os, "phi", "phi", phiName_); + writeEntryIfDifferent(os, "rho", "rho", rhoName_); inletDir_.writeEntry("inletDirection", os); writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C index 287bb5b4b0..af47c95788 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C @@ -184,14 +184,8 @@ void pressureDirectedInletVelocityFvPatchVectorField::updateCoeffs() void pressureDirectedInletVelocityFvPatchVectorField::write(Ostream& os) const { fvPatchVectorField::write(os); - if (phiName_ != "phi") - { - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - } - if (rhoName_ != "rho") - { - os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; - } + writeEntryIfDifferent(os, "phi", "phi", phiName_); + writeEntryIfDifferent(os, "rho", "rho", rhoName_); inletDir_.writeEntry("inletDirection", os); writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C index 9b78fe83f8..c4cd883748 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C @@ -188,10 +188,7 @@ void pressureInletOutletVelocityFvPatchVectorField::updateCoeffs() void pressureInletOutletVelocityFvPatchVectorField::write(Ostream& os) const { fvPatchVectorField::write(os); - if (phiName_ != "phi") - { - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - } + writeEntryIfDifferent(os, "phi", "phi", phiName_); if (tangentialVelocity_.size()) { tangentialVelocity_.writeEntry("tangentialVelocity", os); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C index d6bcbf8e8d..2c0775523b 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C @@ -146,14 +146,8 @@ void pressureInletVelocityFvPatchVectorField::updateCoeffs() void pressureInletVelocityFvPatchVectorField::write(Ostream& os) const { fvPatchVectorField::write(os); - if (phiName_ != "phi") - { - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - } - if (rhoName_ != "rho") - { - os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; - } + writeEntryIfDifferent(os, "phi", "phi", phiName_); + writeEntryIfDifferent(os, "rho", "rho", rhoName_); writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformTotalPressure/timeVaryingUniformTotalPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformTotalPressure/timeVaryingUniformTotalPressureFvPatchScalarField.C index 1ee28c88a3..ef5a22a6bf 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformTotalPressure/timeVaryingUniformTotalPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformTotalPressure/timeVaryingUniformTotalPressureFvPatchScalarField.C @@ -218,14 +218,8 @@ void Foam::timeVaryingUniformTotalPressureFvPatchScalarField:: write(Ostream& os) const { fvPatchScalarField::write(os); - if (UName_ != "U") - { - os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl; - } - if (phiName_ != "phi") - { - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - } + writeEntryIfDifferent(os, "U", "U", UName_); + writeEntryIfDifferent(os, "phi", "phi", phiName_); os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl; os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C index 402ed3325f..7554aa281d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C @@ -30,8 +30,6 @@ License #include "volFields.H" #include "surfaceFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField @@ -180,18 +178,9 @@ void Foam::totalTemperatureFvPatchScalarField::updateCoeffs() void Foam::totalTemperatureFvPatchScalarField::write(Ostream& os) const { fvPatchScalarField::write(os); - if (UName_ != "U") - { - os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl; - } - if (phiName_ != "phi") - { - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - } - if (psiName_ != "psi") - { - os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl; - } + writeEntryIfDifferent(os, "U", "U", UName_); + writeEntryIfDifferent(os, "phi", "phi", phiName_); + writeEntryIfDifferent(os, "psi", "psi", psiName_); os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl; T0_.writeEntry("T0", os); writeEntry("value", os); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C index c81934c111..3aa3fccdae 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C @@ -40,6 +40,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField ) : fixedValueFvPatchField(p, iF), + UName_("U"), intensity_(0.05) {} @@ -53,6 +54,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField ) : fixedValueFvPatchField(ptf, p, iF, mapper), + UName_(ptf.UName_), intensity_(ptf.intensity_) {} @@ -65,6 +67,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField ) : fixedValueFvPatchField(p, iF, dict), + UName_(dict.lookupOrDefault("U", "U")), intensity_(readScalar(dict.lookup("intensity"))) { if (intensity_ < 0 || intensity_ > 1) @@ -92,6 +95,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField ) : fixedValueFvPatchField(ptf), + UName_(ptf.UName_), intensity_(ptf.intensity_) {} @@ -104,6 +108,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField ) : fixedValueFvPatchField(ptf, iF), + UName_(ptf.UName_), intensity_(ptf.intensity_) {} @@ -119,7 +124,7 @@ updateCoeffs() } const fvPatchField& Up = - patch().lookupPatchField("U"); + patch().lookupPatchField(UName_); operator==(1.5*sqr(intensity_)*magSqr(Up)); @@ -133,6 +138,7 @@ void Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::write ) const { fvPatchField::write(os); + writeEntryIfDifferent(os, "U", "U", UName_); os.writeKeyword("intensity") << intensity_ << token::END_STATEMENT << nl; writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.H index 6b4dfdb183..894f2b4520 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.H @@ -34,6 +34,7 @@ Description inlet { type turbulentIntensityKineticEnergyInlet; + U U; // Name of U field (optional) intensity 0.05; // 5% turbulence value uniform 1; // placeholder } @@ -64,6 +65,9 @@ class turbulentIntensityKineticEnergyInletFvPatchScalarField { // Private data + //- Name of belocity field + word UName_; + //- Turbulent intensity as fraction of mean velocity scalar intensity_; From cdb8880cb3284869895e8e4ef14e912b6dee3b96 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 15 Jan 2010 15:57:44 +0000 Subject: [PATCH 02/39] Code clean-up --- .../HashTables/HashTable/HashTable.H | 25 +- .../StaticHashTable/StaticHashTable.C | 4 +- .../StaticHashTable/StaticHashTable.H | 16 +- .../StaticHashTable/StaticHashTableI.H | 4 +- .../Lists/BiIndirectList/BiIndirectList.H | 4 +- .../Lists/BiIndirectList/BiIndirectListI.H | 4 +- .../Lists/DynamicList/DynamicList.H | 148 +++++----- .../Lists/DynamicList/DynamicListI.H | 2 +- .../Lists/IndirectList/IndirectList.H | 6 +- .../Lists/IndirectList/IndirectListI.H | 4 +- src/OpenFOAM/containers/Lists/List/List.C | 2 +- src/OpenFOAM/containers/Lists/List/List.H | 10 +- src/OpenFOAM/containers/Lists/List/ListI.H | 2 +- .../containers/Lists/PackedList/PackedList.H | 171 ++++++------ .../containers/Lists/PackedList/PackedListI.H | 11 +- .../containers/Lists/PtrList/PtrList.H | 9 +- .../containers/Lists/PtrList/PtrListI.H | 27 +- .../containers/Lists/UPtrList/UPtrList.H | 4 +- src/OpenFOAM/db/IOstreams/Tstreams/ITstream.H | 2 +- .../primitiveEntry/primitiveEntry.C | 2 +- .../primitiveEntry/primitiveEntry.H | 2 +- src/edgeMesh/edgeFormats/edgeFormatsCore.H | 5 +- .../edgeFormats/emesh/EMESHedgeFormat.C | 4 +- .../edgeFormats/emesh/EMESHedgeFormat.H | 1 + src/edgeMesh/edgeFormats/obj/OBJedgeFormat.C | 4 +- .../edgeFormats/starcd/STARCDedgeFormat.C | 6 +- .../edgeFormats/starcd/STARCDedgeFormat.H | 21 +- src/edgeMesh/edgeFormats/vtk/VTKedgeFormat.C | 6 +- src/edgeMesh/edgeFormats/vtk/VTKedgeFormat.H | 1 + src/edgeMesh/edgeMesh.C | 11 +- src/edgeMesh/edgeMesh.H | 22 +- src/edgeMesh/edgeMeshNew.C | 2 +- .../featureEdgeMesh/featureEdgeMesh.C | 4 +- src/surfMesh/MeshedSurface/MeshedSurface.C | 42 ++- src/surfMesh/MeshedSurface/MeshedSurface.H | 261 +++++++++--------- .../MeshedSurface/MeshedSurfaceZones.C | 4 +- .../MeshedSurfaceIOAllocator.C | 25 +- .../MeshedSurfaceIOAllocator.H | 29 +- .../UnsortedMeshedSurface.C | 30 +- .../UnsortedMeshedSurface.H | 29 +- src/surfMesh/surfMesh/surfMesh.C | 17 +- src/surfMesh/surfMesh/surfMesh.H | 10 +- 42 files changed, 506 insertions(+), 487 deletions(-) diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H index 492d6a9e0f..67b6944e13 100644 --- a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H +++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H @@ -109,7 +109,6 @@ struct HashTableCore { return iteratorEnd(); } - }; @@ -139,6 +138,7 @@ class HashTable //- Construct from key, next pointer and object inline hashedEntry(const Key&, hashedEntry* next, const T&); + private: //- Disallow default bitwise copy construct hashedEntry(const hashedEntry&); @@ -209,9 +209,8 @@ public: HashTable(const Xfer >&); - // Destructor - - ~HashTable(); + //- Destructor + ~HashTable(); // Member Functions @@ -247,6 +246,7 @@ public: //- Print information Ostream& printInfo(Ostream&) const; + // Edit //- Insert a new hashedEntry @@ -291,7 +291,7 @@ public: void transfer(HashTable&); //- Transfer contents to the Xfer container - inline Xfer< HashTable > xfer(); + inline Xfer > xfer(); // Member Operators @@ -356,9 +356,8 @@ public: //- Current hash index label hashIndex_; - protected: - // Protected Member Functions + protected: // Constructors @@ -380,6 +379,8 @@ public: ); + // Protected Member Functions + //- Increment to the next position inline void increment(); @@ -392,6 +393,7 @@ public: //- Return const access to referenced object inline const T& cobject() const; + public: // Member operators @@ -434,6 +436,7 @@ public: const label hashIndex ); + public: // Constructors @@ -444,13 +447,12 @@ public: //- Construct end iterator inline iterator(const iteratorEnd& unused); + // Member operators //- Conversion to a const_iterator inline operator const_iterator() const; - // Access - //- Return referenced hash value inline T& operator*(); inline T& operator()(); @@ -492,6 +494,7 @@ public: const label hashIndex ); + public: // Constructors @@ -502,9 +505,8 @@ public: //- Construct end iterator inline const_iterator(const iteratorEnd& unused); - // Member operators - // Access + // Member operators //- Return referenced hash value inline const T& operator*() const; @@ -536,7 +538,6 @@ public: Ostream&, const HashTable& ); - }; diff --git a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.C b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.C index 1d0ab2c786..9cbe3154d6 100644 --- a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.C +++ b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.C @@ -97,11 +97,10 @@ Foam::StaticHashTable::StaticHashTable {} - template Foam::StaticHashTable::StaticHashTable ( - const Xfer< StaticHashTable >& ht + const Xfer >& ht ) : StaticHashTableCore(), @@ -452,7 +451,6 @@ void Foam::StaticHashTable::clearStorage() } - template void Foam::StaticHashTable::transfer ( diff --git a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H index 9806a138e0..3a2911432c 100644 --- a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H +++ b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H @@ -72,10 +72,6 @@ template Ostream& operator<< ); -/*---------------------------------------------------------------------------*\ - Class StaticHashTableName Declaration -\*---------------------------------------------------------------------------*/ - /*---------------------------------------------------------------------------*\ Class StaticHashTableCore Declaration \*---------------------------------------------------------------------------*/ @@ -100,7 +96,6 @@ struct StaticHashTableCore iteratorEnd() {} }; - }; @@ -135,6 +130,7 @@ class StaticHashTable //- Assign a new hashed entry to a possibly already existing key bool set(const Key&, const T& newElmt, bool protect); + public: @@ -183,11 +179,11 @@ public: StaticHashTable(const StaticHashTable&); //- Construct by transferring the parameter contents - StaticHashTable(const Xfer< StaticHashTable >&); + StaticHashTable(const Xfer >&); - // Destructor - ~StaticHashTable(); + //- Destructor + ~StaticHashTable(); // Member Functions @@ -251,7 +247,7 @@ public: void transfer(StaticHashTable&); //- Transfer contents to the Xfer container - inline Xfer< StaticHashTable > xfer(); + inline Xfer > xfer(); // Member Operators @@ -275,6 +271,7 @@ public: //- The opposite of the equality operation. bool operator!=(const StaticHashTable&) const; + // STL type definitions //- Type of values the StaticHashTable contains. @@ -317,6 +314,7 @@ public: //- Index of current element at hashIndex label elemIndex_; + public: // Constructors diff --git a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTableI.H b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTableI.H index bd031708e9..8d951f6c1c 100644 --- a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTableI.H +++ b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTableI.H @@ -79,7 +79,7 @@ inline bool Foam::StaticHashTable::set template -inline Foam::Xfer< Foam::StaticHashTable > +inline Foam::Xfer > Foam::StaticHashTable::xfer() { return xferMove(*this); @@ -417,6 +417,4 @@ Foam::StaticHashTable::end() const } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // ************************************************************************* // diff --git a/src/OpenFOAM/containers/Lists/BiIndirectList/BiIndirectList.H b/src/OpenFOAM/containers/Lists/BiIndirectList/BiIndirectList.H index 1f761d9caf..d52369c606 100644 --- a/src/OpenFOAM/containers/Lists/BiIndirectList/BiIndirectList.H +++ b/src/OpenFOAM/containers/Lists/BiIndirectList/BiIndirectList.H @@ -74,7 +74,7 @@ public: ( const UList& posList, const UList& negList, - const Xfer< List