diff --git a/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C index 149f24420985f51efeeef7002f37677e6dd382ed..f9a2861683e6e61d40f13c86569403ee8f0c7a0e 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,7 +38,7 @@ inletOutletTotalTemperatureFvPatchScalarField const DimensionedField<scalar, volMesh>& iF ) : - mixedFvPatchScalarField(p, iF), + inletOutletFvPatchScalarField(p, iF), UName_("U"), phiName_("phi"), psiName_("psi"), @@ -60,7 +60,7 @@ inletOutletTotalTemperatureFvPatchScalarField const fvPatchFieldMapper& mapper ) : - mixedFvPatchScalarField(ptf, p, iF, mapper), + inletOutletFvPatchScalarField(ptf, p, iF, mapper), UName_(ptf.UName_), phiName_(ptf.phiName_), psiName_(ptf.psiName_), @@ -77,7 +77,7 @@ inletOutletTotalTemperatureFvPatchScalarField const dictionary& dict ) : - mixedFvPatchScalarField(p, iF), + inletOutletFvPatchScalarField(p, iF), UName_(dict.lookupOrDefault<word>("U", "U")), phiName_(dict.lookupOrDefault<word>("phi", "phi")), psiName_(dict.lookupOrDefault<word>("psi", "psi")), @@ -108,7 +108,7 @@ inletOutletTotalTemperatureFvPatchScalarField const inletOutletTotalTemperatureFvPatchScalarField& tppsf ) : - mixedFvPatchScalarField(tppsf), + inletOutletFvPatchScalarField(tppsf), UName_(tppsf.UName_), phiName_(tppsf.phiName_), psiName_(tppsf.psiName_), @@ -124,7 +124,7 @@ inletOutletTotalTemperatureFvPatchScalarField const DimensionedField<scalar, volMesh>& iF ) : - mixedFvPatchScalarField(tppsf, iF), + inletOutletFvPatchScalarField(tppsf, iF), UName_(tppsf.UName_), phiName_(tppsf.phiName_), psiName_(tppsf.psiName_), @@ -140,7 +140,7 @@ void Foam::inletOutletTotalTemperatureFvPatchScalarField::autoMap const fvPatchFieldMapper& m ) { - mixedFvPatchScalarField::autoMap(m); + inletOutletFvPatchScalarField::autoMap(m); T0_.autoMap(m); } @@ -151,7 +151,7 @@ void Foam::inletOutletTotalTemperatureFvPatchScalarField::rmap const labelList& addr ) { - mixedFvPatchScalarField::rmap(ptf, addr); + inletOutletFvPatchScalarField::rmap(ptf, addr); const inletOutletTotalTemperatureFvPatchScalarField& tiptf = refCast<const inletOutletTotalTemperatureFvPatchScalarField>(ptf); @@ -182,7 +182,7 @@ void Foam::inletOutletTotalTemperatureFvPatchScalarField::updateCoeffs() T0_/(1.0 + 0.5*psip*gM1ByG*(1.0 - pos(phip))*magSqr(Up)); this->valueFraction() = 1.0 - pos(phip); - mixedFvPatchScalarField::updateCoeffs(); + inletOutletFvPatchScalarField::updateCoeffs(); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.H index e6e8516b6e0ce1d17edffd352ed54127afbf92aa..6e553c9872232e023b84e226cd6fc4c69b2c8b2b 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,7 +35,7 @@ SourceFiles #ifndef inletOutletTotalTemperatureFvPatchScalarField_H #define inletOutletTotalTemperatureFvPatchScalarField_H -#include "mixedFvPatchFields.H" +#include "inletOutletFvPatchFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -48,7 +48,7 @@ namespace Foam class inletOutletTotalTemperatureFvPatchScalarField : - public mixedFvPatchScalarField + public inletOutletFvPatchScalarField { // Private data diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C index 4c53ea8f95a428e88af94e6ef8e8450bdb0541c3..602607a44393d5fcb61b0db76d20073d9d2d4f07 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2006-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2006-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,10 +38,15 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField const DimensionedField<scalar, volMesh>& iF ) : - fixedValueFvPatchField<scalar>(p, iF), - UName_("U"), - intensity_(0.05) -{} + inletOutletFvPatchScalarField(p, iF), + intensity_(0.0), + UName_("undefined-U"), + phiName_("undefined-phi") +{ + this->refValue() = 0.0; + this->refGrad() = 0.0; + this->valueFraction() = 0.0; +} Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField:: turbulentIntensityKineticEnergyInletFvPatchScalarField @@ -52,9 +57,10 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField const fvPatchFieldMapper& mapper ) : - fixedValueFvPatchField<scalar>(ptf, p, iF, mapper), + inletOutletFvPatchScalarField(ptf, p, iF, mapper), + intensity_(ptf.intensity_), UName_(ptf.UName_), - intensity_(ptf.intensity_) + phiName_(ptf.phiName_) {} Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField:: @@ -65,9 +71,10 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField const dictionary& dict ) : - fixedValueFvPatchField<scalar>(p, iF, dict), + inletOutletFvPatchScalarField(p, iF), + intensity_(readScalar(dict.lookup("intensity"))), UName_(dict.lookupOrDefault<word>("U", "U")), - intensity_(readScalar(dict.lookup("intensity"))) + phiName_(dict.lookupOrDefault<word>("phi", "phi")) { if (intensity_ < 0 || intensity_ > 1) { @@ -85,6 +92,12 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField << " in file " << this->dimensionedInternalField().objectPath() << exit(FatalError); } + + fvPatchScalarField::operator=(scalarField("value", dict, p.size())); + + this->refValue() = 0.0; + this->refGrad() = 0.0; + this->valueFraction() = 0.0; } Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField:: @@ -93,9 +106,10 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField const turbulentIntensityKineticEnergyInletFvPatchScalarField& ptf ) : - fixedValueFvPatchField<scalar>(ptf), + inletOutletFvPatchScalarField(ptf), + intensity_(ptf.intensity_), UName_(ptf.UName_), - intensity_(ptf.intensity_) + phiName_(ptf.phiName_) {} @@ -106,9 +120,10 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField const DimensionedField<scalar, volMesh>& iF ) : - fixedValueFvPatchField<scalar>(ptf, iF), + inletOutletFvPatchScalarField(ptf, iF), + intensity_(ptf.intensity_), UName_(ptf.UName_), - intensity_(ptf.intensity_) + phiName_(ptf.phiName_) {} @@ -122,12 +137,16 @@ updateCoeffs() return; } - const fvPatchField<vector>& Up = + const fvPatchVectorField& Up = patch().lookupPatchField<volVectorField, vector>(UName_); - operator==(1.5*sqr(intensity_)*magSqr(Up)); + const fvsPatchScalarField& phip = + patch().lookupPatchField<surfaceScalarField, scalar>(phiName_); + + this->refValue() = 1.5*sqr(intensity_)*magSqr(Up); + this->valueFraction() = 1.0 - pos(phip); - fixedValueFvPatchField<scalar>::updateCoeffs(); + inletOutletFvPatchScalarField::updateCoeffs(); } @@ -136,9 +155,10 @@ void Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::write Ostream& os ) const { - fvPatchField<scalar>::write(os); - writeEntryIfDifferent<word>(os, "U", "U", UName_); + fvPatchScalarField::write(os); os.writeKeyword("intensity") << intensity_ << token::END_STATEMENT << nl; + os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl; + os.writeKeyword("phi") << phiName_ << 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 a8614eae6c67a1c2943d7e6311a7ef21d44ec7fb..91e9d9760282202ff351b0e91d435b2d0f5c4a7c 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2006-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2006-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,7 +33,6 @@ Description inlet { type turbulentIntensityKineticEnergyInlet; - U U; // Name of U field (optional) intensity 0.05; // 5% turbulence value uniform 1; // placeholder } @@ -47,7 +46,7 @@ SourceFiles #ifndef turbulentIntensityKineticEnergyInletFvPatchScalarField_H #define turbulentIntensityKineticEnergyInletFvPatchScalarField_H -#include "fixedValueFvPatchFields.H" +#include "inletOutletFvPatchFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -60,16 +59,20 @@ namespace Foam class turbulentIntensityKineticEnergyInletFvPatchScalarField : - public fixedValueFvPatchScalarField + public inletOutletFvPatchScalarField { // Private data - //- Name of belocity field - word UName_; - //- Turbulent intensity as fraction of mean velocity scalar intensity_; + //- Name of the velocity field + word UName_; + + //- Name of the flux field + word phiName_; + + public: //- Runtime type information diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C index 6296caa2eac78cba650d562606d86e7f7d7c794d..446872ae59e33306734a043124013e40d31ca099 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2006-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2006-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -46,9 +46,15 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField const DimensionedField<scalar, volMesh>& iF ) : - fixedValueFvPatchField<scalar>(p, iF), - mixingLength_(0.001) -{} + inletOutletFvPatchScalarField(p, iF), + mixingLength_(0.0), + phiName_("undefined-phi"), + kName_("undefined-k") +{ + this->refValue() = 0.0; + this->refGrad() = 0.0; + this->valueFraction() = 0.0; +} turbulentMixingLengthDissipationRateInletFvPatchScalarField:: turbulentMixingLengthDissipationRateInletFvPatchScalarField @@ -59,8 +65,10 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField const fvPatchFieldMapper& mapper ) : - fixedValueFvPatchField<scalar>(ptf, p, iF, mapper), - mixingLength_(ptf.mixingLength_) + inletOutletFvPatchScalarField(ptf, p, iF, mapper), + mixingLength_(ptf.mixingLength_), + phiName_(ptf.phiName_), + kName_(ptf.kName_) {} turbulentMixingLengthDissipationRateInletFvPatchScalarField:: @@ -71,9 +79,17 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField const dictionary& dict ) : - fixedValueFvPatchField<scalar>(p, iF, dict), - mixingLength_(readScalar(dict.lookup("mixingLength"))) -{} + inletOutletFvPatchScalarField(p, iF), + mixingLength_(readScalar(dict.lookup("mixingLength"))), + phiName_(dict.lookupOrDefault<word>("phi", "phi")), + kName_(dict.lookupOrDefault<word>("k", "k")) +{ + fvPatchScalarField::operator=(scalarField("value", dict, p.size())); + + this->refValue() = 0.0; + this->refGrad() = 0.0; + this->valueFraction() = 0.0; +} turbulentMixingLengthDissipationRateInletFvPatchScalarField:: turbulentMixingLengthDissipationRateInletFvPatchScalarField @@ -81,8 +97,10 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField const turbulentMixingLengthDissipationRateInletFvPatchScalarField& ptf ) : - fixedValueFvPatchField<scalar>(ptf), - mixingLength_(ptf.mixingLength_) + inletOutletFvPatchScalarField(ptf), + mixingLength_(ptf.mixingLength_), + phiName_(ptf.phiName_), + kName_(ptf.kName_) {} turbulentMixingLengthDissipationRateInletFvPatchScalarField:: @@ -92,8 +110,10 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField const DimensionedField<scalar, volMesh>& iF ) : - fixedValueFvPatchField<scalar>(ptf, iF), - mixingLength_(ptf.mixingLength_) + inletOutletFvPatchScalarField(ptf, iF), + mixingLength_(ptf.mixingLength_), + phiName_(ptf.phiName_), + kName_(ptf.kName_) {} @@ -114,12 +134,16 @@ void turbulentMixingLengthDissipationRateInletFvPatchScalarField::updateCoeffs() const scalar Cmu75 = pow(Cmu, 0.75); - const fvPatchField<scalar>& kp = - patch().lookupPatchField<volScalarField, scalar>("k"); + const fvPatchScalarField& kp = + patch().lookupPatchField<volScalarField, scalar>(kName_); + + const fvsPatchScalarField& phip = + patch().lookupPatchField<surfaceScalarField, scalar>(phiName_); - operator==(Cmu75*kp*sqrt(kp)/mixingLength_); + this->refValue() = Cmu75*kp*sqrt(kp)/mixingLength_; + this->valueFraction() = 1.0 - pos(phip); - fixedValueFvPatchField<scalar>::updateCoeffs(); + inletOutletFvPatchScalarField::updateCoeffs(); } @@ -128,9 +152,11 @@ void turbulentMixingLengthDissipationRateInletFvPatchScalarField::write Ostream& os ) const { - fvPatchField<scalar>::write(os); + fvPatchScalarField::write(os); os.writeKeyword("mixingLength") << mixingLength_ << token::END_STATEMENT << nl; + os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; + os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl; writeEntry("value", os); } diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.H index 9f8e7776c7cce51f4e4fc2781380b2ee5d2c7299..8464174b53613388f94e7831369cd66a55621c8d 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2006-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2006-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,9 +32,9 @@ Description @verbatim inlet { - type compressible::turbulentMixingLengthDissipationRateInlet; + type compressible::turbulentMixingLengthDissipationRateInlet; mixingLength 0.005; // 5 mm - value uniform 200; // placeholder + value uniform 200; // placeholder } @endverbatim @@ -46,7 +46,7 @@ SourceFiles #ifndef compressibleturbulentMixingLengthDissipationRateInletFvPatchField_H #define compressibleturbulentMixingLengthDissipationRateInletFvPatchField_H -#include "fixedValueFvPatchFields.H" +#include "inletOutletFvPatchFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -61,13 +61,20 @@ namespace compressible class turbulentMixingLengthDissipationRateInletFvPatchScalarField : - public fixedValueFvPatchScalarField + public inletOutletFvPatchScalarField { // Private data //- turbulent length scale scalar mixingLength_; + //- Name of the flux field + word phiName_; + + //- Name of the turbulent kinetic energy field + word kName_; + + public: //- Runtime type information diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C index 86d2448632b8a3c4b4b10d75e339309293ba35a0..6c8f507b84f5fbbcd4dfeaa8a0ffeca6e2577c58 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2006-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2006-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,6 +26,7 @@ License #include "turbulentMixingLengthFrequencyInletFvPatchScalarField.H" #include "addToRunTimeSelectionTable.H" #include "fvPatchFieldMapper.H" +#include "surfaceFields.H" #include "volFields.H" #include "RASModel.H" @@ -45,10 +46,15 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField const DimensionedField<scalar, volMesh>& iF ) : - fixedValueFvPatchField<scalar>(p, iF), + inletOutletFvPatchScalarField(p, iF), mixingLength_(0.0), - kName_("k") -{} + phiName_("undefined-phi"), + kName_("undefined-k") +{ + this->refValue() = 0.0; + this->refGrad() = 0.0; + this->valueFraction() = 0.0; +} turbulentMixingLengthFrequencyInletFvPatchScalarField:: turbulentMixingLengthFrequencyInletFvPatchScalarField @@ -59,8 +65,9 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField const fvPatchFieldMapper& mapper ) : - fixedValueFvPatchField<scalar>(ptf, p, iF, mapper), + inletOutletFvPatchScalarField(ptf, p, iF, mapper), mixingLength_(ptf.mixingLength_), + phiName_(ptf.phiName_), kName_(ptf.kName_) {} @@ -72,10 +79,17 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField const dictionary& dict ) : - fixedValueFvPatchField<scalar>(p, iF, dict), + inletOutletFvPatchScalarField(p, iF), mixingLength_(readScalar(dict.lookup("mixingLength"))), + phiName_(dict.lookupOrDefault<word>("phi", "phi")), kName_(dict.lookupOrDefault<word>("k", "k")) -{} +{ + fvPatchScalarField::operator=(scalarField("value", dict, p.size())); + + this->refValue() = 0.0; + this->refGrad() = 0.0; + this->valueFraction() = 0.0; +} turbulentMixingLengthFrequencyInletFvPatchScalarField:: turbulentMixingLengthFrequencyInletFvPatchScalarField @@ -83,8 +97,9 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField const turbulentMixingLengthFrequencyInletFvPatchScalarField& ptf ) : - fixedValueFvPatchField<scalar>(ptf), + inletOutletFvPatchScalarField(ptf), mixingLength_(ptf.mixingLength_), + phiName_(ptf.phiName_), kName_(ptf.kName_) {} @@ -95,8 +110,9 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField const DimensionedField<scalar, volMesh>& iF ) : - fixedValueFvPatchField<scalar>(ptf, iF), + inletOutletFvPatchScalarField(ptf, iF), mixingLength_(ptf.mixingLength_), + phiName_(ptf.phiName_), kName_(ptf.kName_) {} @@ -116,14 +132,18 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::updateCoeffs() const scalar Cmu = rasModel.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09); - const scalar Cmu25 = pow025(Cmu); + const scalar Cmu25 = pow(Cmu, 0.25); - const fvPatchField<scalar>& kp = + const fvPatchScalarField& kp = patch().lookupPatchField<volScalarField, scalar>(kName_); - operator==(sqrt(kp)/(Cmu25*mixingLength_)); + const fvsPatchScalarField& phip = + patch().lookupPatchField<surfaceScalarField, scalar>(phiName_); + + this->refValue() = sqrt(kp)/(Cmu25*mixingLength_); + this->valueFraction() = 1.0 - pos(phip); - fixedValueFvPatchField<scalar>::updateCoeffs(); + inletOutletFvPatchScalarField::updateCoeffs(); } @@ -132,9 +152,10 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::write Ostream& os ) const { - fvPatchField<scalar>::write(os); + fvPatchScalarField::write(os); os.writeKeyword("mixingLength") << mixingLength_ << token::END_STATEMENT << nl; + os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl; writeEntry("value", os); } diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.H index 317239a75d974fbc2b5119fe581088153d4b71c6..fb3b0683e8bf8259154e38bfa66af01187f8abd5 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2006-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2006-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -46,7 +46,7 @@ SourceFiles #ifndef compressibleturbulentMixingLengthFrequencyInletFvPatchScalarField_H #define compressibleturbulentMixingLengthFrequencyInletFvPatchScalarField_H -#include "fixedValueFvPatchFields.H" +#include "inletOutletFvPatchFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -61,13 +61,16 @@ namespace compressible class turbulentMixingLengthFrequencyInletFvPatchScalarField : - public fixedValueFvPatchScalarField + public inletOutletFvPatchScalarField { // Private data //- Turbulent length scale scalar mixingLength_; + //- Name of the flux field + word phiName_; + //- Name of the turbulent kinetic energy field word kName_; diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C index f0d66d95f772c5ab9c94c95611db397b15be1bc0..c4596acbf51bc93b5930edf4eea982c39ab6cf04 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2006-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2006-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -46,9 +46,15 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField const DimensionedField<scalar, volMesh>& iF ) : - fixedValueFvPatchField<scalar>(p, iF), - mixingLength_(0.001) -{} + inletOutletFvPatchScalarField(p, iF), + mixingLength_(0.0), + phiName_("undefined-phi"), + kName_("undefined-k") +{ + this->refValue() = 0.0; + this->refGrad() = 0.0; + this->valueFraction() = 0.0; +} turbulentMixingLengthDissipationRateInletFvPatchScalarField:: turbulentMixingLengthDissipationRateInletFvPatchScalarField @@ -59,8 +65,10 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField const fvPatchFieldMapper& mapper ) : - fixedValueFvPatchField<scalar>(ptf, p, iF, mapper), - mixingLength_(ptf.mixingLength_) + inletOutletFvPatchScalarField(ptf, p, iF, mapper), + mixingLength_(ptf.mixingLength_), + phiName_(ptf.phiName_), + kName_(ptf.kName_) {} turbulentMixingLengthDissipationRateInletFvPatchScalarField:: @@ -71,9 +79,17 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField const dictionary& dict ) : - fixedValueFvPatchField<scalar>(p, iF, dict), - mixingLength_(readScalar(dict.lookup("mixingLength"))) -{} + inletOutletFvPatchScalarField(p, iF), + mixingLength_(readScalar(dict.lookup("mixingLength"))), + phiName_(dict.lookupOrDefault<word>("phi", "phi")), + kName_(dict.lookupOrDefault<word>("k", "k")) +{ + fvPatchScalarField::operator=(scalarField("value", dict, p.size())); + + this->refValue() = 0.0; + this->refGrad() = 0.0; + this->valueFraction() = 0.0; +} turbulentMixingLengthDissipationRateInletFvPatchScalarField:: turbulentMixingLengthDissipationRateInletFvPatchScalarField @@ -81,8 +97,10 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField const turbulentMixingLengthDissipationRateInletFvPatchScalarField& ptf ) : - fixedValueFvPatchField<scalar>(ptf), - mixingLength_(ptf.mixingLength_) + inletOutletFvPatchScalarField(ptf), + mixingLength_(ptf.mixingLength_), + phiName_(ptf.phiName_), + kName_(ptf.kName_) {} turbulentMixingLengthDissipationRateInletFvPatchScalarField:: @@ -92,8 +110,10 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField const DimensionedField<scalar, volMesh>& iF ) : - fixedValueFvPatchField<scalar>(ptf, iF), - mixingLength_(ptf.mixingLength_) + inletOutletFvPatchScalarField(ptf, iF), + mixingLength_(ptf.mixingLength_), + phiName_(ptf.phiName_), + kName_(ptf.kName_) {} @@ -114,12 +134,16 @@ void turbulentMixingLengthDissipationRateInletFvPatchScalarField::updateCoeffs() const scalar Cmu75 = pow(Cmu, 0.75); - const fvPatchField<scalar>& kp = - patch().lookupPatchField<volScalarField, scalar>("k"); + const fvPatchScalarField& kp = + patch().lookupPatchField<volScalarField, scalar>(kName_); + + const fvsPatchScalarField& phip = + patch().lookupPatchField<surfaceScalarField, scalar>(phiName_); - operator==(Cmu75*kp*sqrt(kp)/mixingLength_); + this->refValue() = Cmu75*kp*sqrt(kp)/mixingLength_; + this->valueFraction() = 1.0 - pos(phip); - fixedValueFvPatchField<scalar>::updateCoeffs(); + inletOutletFvPatchScalarField::updateCoeffs(); } @@ -128,9 +152,11 @@ void turbulentMixingLengthDissipationRateInletFvPatchScalarField::write Ostream& os ) const { - fvPatchField<scalar>::write(os); + fvPatchScalarField::write(os); os.writeKeyword("mixingLength") << mixingLength_ << token::END_STATEMENT << nl; + os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; + os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl; writeEntry("value", os); } diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.H index 88ad01d85df3c42500a584b116b65c64a5755bed..c6b4b00742aa93a75ef9b50d8d0cb6a12f338250 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2006-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2006-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -46,7 +46,7 @@ SourceFiles #ifndef incompressibleturbulentMixingLengthDissipationRateInlet_H #define incompressibleturbulentMixingLengthDissipationRateInlet_H -#include "fixedValueFvPatchFields.H" +#include "inletOutletFvPatchFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -61,13 +61,20 @@ namespace incompressible class turbulentMixingLengthDissipationRateInletFvPatchScalarField : - public fixedValueFvPatchScalarField + public inletOutletFvPatchScalarField { // Private data //- turbulent length scale scalar mixingLength_; + //- Name of the flux field + word phiName_; + + //- Name of the turbulent kinetic energy field + word kName_; + + public: //- Runtime type information diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C index d12b1ebd0d3f1142fe6f3e9e0cbe0fde8a191f44..63970dff2fa0ac73b247a3aaf4d1acbbecfd2c33 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2006-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2006-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -46,10 +46,15 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField const DimensionedField<scalar, volMesh>& iF ) : - fixedValueFvPatchField<scalar>(p, iF), + inletOutletFvPatchScalarField(p, iF), mixingLength_(0.0), + phiName_("undefined-phi"), kName_("undefined-k") -{} +{ + this->refValue() = 0.0; + this->refGrad() = 0.0; + this->valueFraction() = 0.0; +} turbulentMixingLengthFrequencyInletFvPatchScalarField:: turbulentMixingLengthFrequencyInletFvPatchScalarField @@ -60,8 +65,9 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField const fvPatchFieldMapper& mapper ) : - fixedValueFvPatchField<scalar>(ptf, p, iF, mapper), + inletOutletFvPatchScalarField(ptf, p, iF, mapper), mixingLength_(ptf.mixingLength_), + phiName_(ptf.phiName_), kName_(ptf.kName_) {} @@ -73,10 +79,17 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField const dictionary& dict ) : - fixedValueFvPatchField<scalar>(p, iF, dict), + inletOutletFvPatchScalarField(p, iF), mixingLength_(readScalar(dict.lookup("mixingLength"))), + phiName_(dict.lookupOrDefault<word>("phi", "phi")), kName_(dict.lookupOrDefault<word>("k", "k")) -{} +{ + fvPatchScalarField::operator=(scalarField("value", dict, p.size())); + + this->refValue() = 0.0; + this->refGrad() = 0.0; + this->valueFraction() = 0.0; +} turbulentMixingLengthFrequencyInletFvPatchScalarField:: turbulentMixingLengthFrequencyInletFvPatchScalarField @@ -84,8 +97,9 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField const turbulentMixingLengthFrequencyInletFvPatchScalarField& ptf ) : - fixedValueFvPatchField<scalar>(ptf), + inletOutletFvPatchScalarField(ptf), mixingLength_(ptf.mixingLength_), + phiName_(ptf.phiName_), kName_(ptf.kName_) {} @@ -96,8 +110,9 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField const DimensionedField<scalar, volMesh>& iF ) : - fixedValueFvPatchField<scalar>(ptf, iF), + inletOutletFvPatchScalarField(ptf, iF), mixingLength_(ptf.mixingLength_), + phiName_(ptf.phiName_), kName_(ptf.kName_) {} @@ -117,14 +132,18 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::updateCoeffs() const scalar Cmu = rasModel.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09); - const scalar Cmu25 = pow025(Cmu); + const scalar Cmu25 = pow(Cmu, 0.25); - const fvPatchField<scalar>& kp = + const fvPatchScalarField& kp = patch().lookupPatchField<volScalarField, scalar>(kName_); - operator==(sqrt(kp)/(Cmu25*mixingLength_)); + const fvsPatchScalarField& phip = + patch().lookupPatchField<surfaceScalarField, scalar>(phiName_); + + this->refValue() = sqrt(kp)/(Cmu25*mixingLength_); + this->valueFraction() = 1.0 - pos(phip); - fixedValueFvPatchField<scalar>::updateCoeffs(); + inletOutletFvPatchScalarField::updateCoeffs(); } @@ -133,9 +152,10 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::write Ostream& os ) const { - fvPatchField<scalar>::write(os); + fvPatchScalarField::write(os); os.writeKeyword("mixingLength") << mixingLength_ << token::END_STATEMENT << nl; + os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl; writeEntry("value", os); } diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.H index 7f706ed19bbb30b9be9b19d629a93f6a2c1c5c75..80bb14aaf382c2dd877aaa74a5393067e108d627 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2006-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2006-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -46,7 +46,7 @@ SourceFiles #ifndef incompressibleturbulentMixingLengthFrequencyInletFvPatchScalarField_H #define incompressibleturbulentMixingLengthFrequencyInletFvPatchScalarField_H -#include "fixedValueFvPatchFields.H" +#include "inletOutletFvPatchFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -61,13 +61,16 @@ namespace incompressible class turbulentMixingLengthFrequencyInletFvPatchScalarField : - public fixedValueFvPatchScalarField + public inletOutletFvPatchScalarField { // Private data //- Turbulent length scale scalar mixingLength_; + //- Name of the flux field + word phiName_; + //- Name of the turbulent kinetic energy field word kName_;