FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

fixedShearStressFvPatchVectorField.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 2010-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 3 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 \*---------------------------------------------------------------------------*/
00026 
00027 #include "fixedShearStressFvPatchVectorField.H"
00028 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00029 #include <finiteVolume/fvPatchFieldMapper.H>
00030 #include <finiteVolume/volFields.H>
00031 #include <incompressibleRASModels/RASModel.H>
00032 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00033 
00034 namespace Foam
00035 {
00036 namespace incompressible
00037 {
00038 
00039 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00040 
00041 fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField
00042 (
00043     const fvPatch& p,
00044     const DimensionedField<vector, volMesh>& iF
00045 )
00046 :
00047     fixedValueFvPatchVectorField(p, iF),
00048     tau0_(vector::zero)
00049 {}
00050 
00051 
00052 fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField
00053 (
00054     const fvPatch& p,
00055     const DimensionedField<vector, volMesh>& iF,
00056     const dictionary& dict
00057 )
00058 :
00059     fixedValueFvPatchVectorField(p, iF),
00060     tau0_(dict.lookupOrDefault<vector>("tau", vector::zero))
00061 {
00062     fvPatchField<vector>::operator=(patchInternalField());
00063 }
00064 
00065 
00066 fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField
00067 (
00068     const fixedShearStressFvPatchVectorField& ptf,
00069     const fvPatch& p,
00070     const DimensionedField<vector, volMesh>& iF,
00071     const fvPatchFieldMapper& mapper
00072 )
00073 :
00074     fixedValueFvPatchVectorField(ptf, p, iF, mapper),
00075     tau0_(ptf.tau0_)
00076 {}
00077 
00078 
00079 fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField
00080 (
00081     const fixedShearStressFvPatchVectorField& ptf
00082 )
00083 :
00084     fixedValueFvPatchVectorField(ptf),
00085     tau0_(ptf.tau0_)
00086 {}
00087 
00088 
00089 fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField
00090 (
00091     const fixedShearStressFvPatchVectorField& ptf,
00092     const DimensionedField<vector, volMesh>& iF
00093 )
00094 :
00095     fixedValueFvPatchVectorField(ptf, iF),
00096     tau0_(ptf.tau0_)
00097 {}
00098 
00099 
00100 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00101 
00102 void fixedShearStressFvPatchVectorField::updateCoeffs()
00103 {
00104     if (updated())
00105     {
00106         return;
00107     }
00108 
00109     const label patchI = patch().index();
00110 
00111     const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
00112 
00113     const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
00114 
00115     const vectorField Ui = Uw.patchInternalField();
00116 
00117     vector tauHat = tau0_/(mag(tau0_) + ROOTVSMALL);
00118 
00119     const scalarField& ry = patch().deltaCoeffs();
00120 
00121     scalarField nuEffw = rasModel.nuEff()().boundaryField()[patchI];
00122 
00123     vectorField UwUpdated =
00124         tauHat*(tauHat & (tau0_*(1.0/(ry*nuEffw)) + Ui));
00125 
00126     operator==(UwUpdated);
00127 
00128     if (debug)
00129     {
00130         vectorField nHat = this->patch().nf();
00131         volSymmTensorField Reff = rasModel.devReff();
00132         Info << "tau : " << (nHat & Reff.boundaryField()[patchI])() << endl;
00133     }
00134 
00135     fixedValueFvPatchVectorField::updateCoeffs();
00136 }
00137 
00138 
00139 void fixedShearStressFvPatchVectorField::write(Ostream& os) const
00140 {
00141     fixedValueFvPatchVectorField::write(os);
00142     os.writeKeyword("tau") << tau0_ << token::END_STATEMENT << nl;
00143     writeEntry("value", os);
00144 }
00145 
00146 
00147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00148 
00149 makePatchTypeField
00150 (
00151     fvPatchVectorField,
00152     fixedShearStressFvPatchVectorField
00153 );
00154 
00155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00156 
00157 } // End namespace incompressible
00158 } // End namespace Foam
00159 
00160 // ************************************************************************* //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines