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

laplaceFilter.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) 1991-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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 \*---------------------------------------------------------------------------*/
00025 
00026 #include "laplaceFilter.H"
00027 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00028 #include <finiteVolume/calculatedFvPatchFields.H>
00029 #include <finiteVolume/fvm.H>
00030 #include <finiteVolume/fvc.H>
00031 
00032 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00033 
00034 namespace Foam
00035 {
00036     defineTypeNameAndDebug(laplaceFilter, 0);
00037     addToRunTimeSelectionTable(LESfilter, laplaceFilter, dictionary);
00038 }
00039 
00040 
00041 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00042 
00043 Foam::laplaceFilter::laplaceFilter(const fvMesh& mesh, scalar widthCoeff)
00044 :
00045     LESfilter(mesh),
00046     widthCoeff_(widthCoeff),
00047     coeff_
00048     (
00049         IOobject
00050         (
00051             "laplaceFilterCoeff",
00052             mesh.time().timeName(),
00053             mesh
00054         ),
00055         mesh,
00056         dimensionedScalar("zero", dimLength*dimLength, 0),
00057         calculatedFvPatchScalarField::typeName
00058     )
00059 {
00060     coeff_.internalField() = pow(mesh.V(), 2.0/3.0)/widthCoeff_;
00061 }
00062 
00063 
00064 Foam::laplaceFilter::laplaceFilter(const fvMesh& mesh, const dictionary& bd)
00065 :
00066     LESfilter(mesh),
00067     widthCoeff_(readScalar(bd.subDict(type() + "Coeffs").lookup("widthCoeff"))),
00068     coeff_
00069     (
00070         IOobject
00071         (
00072             "laplaceFilterCoeff",
00073             mesh.time().timeName(),
00074             mesh
00075         ),
00076         mesh,
00077         dimensionedScalar("zero", dimLength*dimLength, 0),
00078         calculatedFvPatchScalarField::typeName
00079     )
00080 {
00081     coeff_.internalField() = pow(mesh.V(), 2.0/3.0)/widthCoeff_;
00082 }
00083 
00084 
00085 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00086 
00087 void Foam::laplaceFilter::read(const dictionary& bd)
00088 {
00089     bd.subDict(type() + "Coeffs").lookup("widthCoeff") >> widthCoeff_;
00090 }
00091 
00092 
00093 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
00094 
00095 Foam::tmp<Foam::volScalarField> Foam::laplaceFilter::operator()
00096 (
00097     const tmp<volScalarField>& unFilteredField
00098 ) const
00099 {
00100     tmp<volScalarField> filteredField =
00101         unFilteredField() + fvc::laplacian(coeff_, unFilteredField());
00102 
00103     unFilteredField.clear();
00104 
00105     return filteredField;
00106 }
00107 
00108 
00109 Foam::tmp<Foam::volVectorField> Foam::laplaceFilter::operator()
00110 (
00111     const tmp<volVectorField>& unFilteredField
00112 ) const
00113 {
00114     tmp<volVectorField> filteredField =
00115         unFilteredField() + fvc::laplacian(coeff_, unFilteredField());
00116 
00117     unFilteredField.clear();
00118 
00119     return filteredField;
00120 }
00121 
00122 
00123 Foam::tmp<Foam::volSymmTensorField> Foam::laplaceFilter::operator()
00124 (
00125     const tmp<volSymmTensorField>& unFilteredField
00126 ) const
00127 {
00128     tmp<volSymmTensorField> filteredField =
00129         unFilteredField() + fvc::laplacian(coeff_, unFilteredField());
00130 
00131     unFilteredField.clear();
00132 
00133     return filteredField;
00134 }
00135 
00136 
00137 Foam::tmp<Foam::volTensorField> Foam::laplaceFilter::operator()
00138 (
00139     const tmp<volTensorField>& unFilteredField
00140 ) const
00141 {
00142     tmp<volTensorField> filteredField =
00143         unFilteredField() + fvc::laplacian(coeff_, unFilteredField());
00144 
00145     unFilteredField.clear();
00146 
00147     return filteredField;
00148 }
00149 
00150 
00151 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines