diff --git a/src/turbulenceModels/incompressible/RAS/Make/files b/src/turbulenceModels/incompressible/RAS/Make/files index 7ddd1d4e3b24fa0d6156d5f6fed061beebf8ace1..f6107822dfbc1cee80f472537f5ef4448d187c6d 100644 --- a/src/turbulenceModels/incompressible/RAS/Make/files +++ b/src/turbulenceModels/incompressible/RAS/Make/files @@ -43,6 +43,7 @@ $(kqRWallFunctions)/kqRWallFunction/kqRWallFunctionFvPatchFields.C derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C +derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C new file mode 100644 index 0000000000000000000000000000000000000000..0397d52fae48f2550a1dde5e662fa914e4b4ac2e --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C @@ -0,0 +1,164 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "fixedShearStressFvPatchVectorField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "RASModel.H" +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +fixedShearStressFvPatchVectorField:: +fixedShearStressFvPatchVectorField +( + const fvPatch& p, + const DimensionedField<vector, volMesh>& iF +) +: + fixedValueFvPatchVectorField(p, iF), + tau0_(vector::zero) +{} + + +fixedShearStressFvPatchVectorField:: +fixedShearStressFvPatchVectorField +( + const fvPatch& p, + const DimensionedField<vector, volMesh>& iF, + const dictionary& dict +) +: + fixedValueFvPatchVectorField(p, iF), + tau0_(dict.lookupOrDefault<vector>("tau", vector::zero)) +{ + fvPatchField<vector>::operator=(patchInternalField()); +} + + +fixedShearStressFvPatchVectorField:: +fixedShearStressFvPatchVectorField +( + const fixedShearStressFvPatchVectorField& ptf, + const fvPatch& p, + const DimensionedField<vector, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchVectorField(ptf, p, iF, mapper), + tau0_(ptf.tau0_) +{} + + +fixedShearStressFvPatchVectorField:: +fixedShearStressFvPatchVectorField +( + const fixedShearStressFvPatchVectorField& ptf +) +: + fixedValueFvPatchVectorField(ptf), + tau0_(ptf.tau0_) +{} + + +fixedShearStressFvPatchVectorField:: +fixedShearStressFvPatchVectorField +( + const fixedShearStressFvPatchVectorField& ptf, + const DimensionedField<vector, volMesh>& iF +) +: + fixedValueFvPatchVectorField(ptf, iF), + tau0_(ptf.tau0_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void fixedShearStressFvPatchVectorField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchI = patch().index(); + + const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); + + const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; + + const vectorField Ui = Uw.patchInternalField(); + + vector tauHat = tau0_/mag(tau0_); + + const scalarField& ry = patch().deltaCoeffs(); + + scalarField nuEffw = rasModel.nuEff()().boundaryField()[patchI]; + + vectorField UwUpdated = + tauHat*(tauHat & (tau0_*(1.0/(ry*nuEffw)) + Ui)); + + operator==(UwUpdated); + + if (debug) + { + vectorField nHat = this->patch().nf(); + volSymmTensorField Reff = rasModel.devReff(); + Info << "tau : " << (nHat & Reff.boundaryField()[patchI])() << endl; + } + + fixedValueFvPatchVectorField::updateCoeffs(); +} + + +void fixedShearStressFvPatchVectorField::write(Ostream& os) const +{ + fixedValueFvPatchVectorField::write(os); + os.writeKeyword("tau") << tau0_ << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchVectorField, + fixedShearStressFvPatchVectorField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace incompressible +} // End namespace Foam +// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.H new file mode 100644 index 0000000000000000000000000000000000000000..25e65f4bbf2c54efd64f3509be1ee3ffa0f9575a --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.H @@ -0,0 +1,147 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::fixedShearStressFvPatchVectorField + +Description + Set a constant shear stress as tau0 = -nuEff dU/dn. + +SourceFiles + fixedShearStressFvPatchVectorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fixedShearStressFvPatchVectorField_H +#define fixedShearStressFvPatchVectorField_H + +#include "fvPatchFields.H" +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +/*---------------------------------------------------------------------------*\ + Class fixedShearStressFvPatchVectorField Declaration +\*---------------------------------------------------------------------------*/ + +class fixedShearStressFvPatchVectorField +: + public fixedValueFvPatchVectorField +{ + // Private data + + //- Constant shear stress + vector tau0_; + + +public: + + //- Runtime type information + TypeName("fixedShearStress"); + + + // Constructors + + //- Construct from patch and internal field + fixedShearStressFvPatchVectorField + ( + const fvPatch&, + const DimensionedField<vector, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + fixedShearStressFvPatchVectorField + ( + const fvPatch&, + const DimensionedField<vector, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given + fixedShearStressFvPatchVectorField + ( + const fixedShearStressFvPatchVectorField&, + const fvPatch&, + const DimensionedField<vector, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + fixedShearStressFvPatchVectorField + ( + const fixedShearStressFvPatchVectorField& + ); + + //- Construct and return a clone + virtual tmp<fvPatchVectorField> clone() const + { + return tmp<fvPatchVectorField> + ( + new fixedShearStressFvPatchVectorField(*this) + ); + } + + //- Construct as copy setting internal field reference + fixedShearStressFvPatchVectorField + ( + const fixedShearStressFvPatchVectorField&, + const DimensionedField<vector, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchVectorField> clone + ( + const DimensionedField<vector, volMesh>& iF + ) const + { + return tmp<fvPatchVectorField> + ( + new fixedShearStressFvPatchVectorField(*this, iF) + ); + } + + + // Member functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace incompressible +} // End namespace Foam +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* //