OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

surfaceInterpolate.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-2009 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 2 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 "surfaceInterpolate.H"
00028 
00029 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00030 
00031 namespace Foam
00032 {
00033 
00034 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00035 
00036 namespace fvc
00037 {
00038 
00039 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00040 
00041 // Return weighting factors for scheme given by name in dictionary
00042 template<class Type>
00043 tmp<surfaceInterpolationScheme<Type> > scheme
00044 (
00045     const surfaceScalarField& faceFlux,
00046     Istream& streamData
00047 )
00048 {
00049     return surfaceInterpolationScheme<Type>::New
00050     (
00051         faceFlux.mesh(),
00052         faceFlux,
00053         streamData
00054     );
00055 }
00056 
00057 
00058 // Return weighting factors for scheme given by name in dictionary
00059 template<class Type>
00060 tmp<surfaceInterpolationScheme<Type> > scheme
00061 (
00062     const surfaceScalarField& faceFlux,
00063     const word& name
00064 )
00065 {
00066     return surfaceInterpolationScheme<Type>::New
00067     (
00068         faceFlux.mesh(),
00069         faceFlux,
00070         faceFlux.mesh().interpolationScheme(name)
00071     );
00072 }
00073 
00074 
00075 // Return weighting factors for scheme given by name in dictionary
00076 template<class Type>
00077 tmp<surfaceInterpolationScheme<Type> > scheme
00078 (
00079     const fvMesh& mesh,
00080     Istream& streamData
00081 )
00082 {
00083     return surfaceInterpolationScheme<Type>::New
00084     (
00085         mesh,
00086         streamData
00087     );
00088 }
00089 
00090 
00091 // Return weighting factors for scheme given by name in dictionary
00092 template<class Type>
00093 tmp<surfaceInterpolationScheme<Type> > scheme
00094 (
00095     const fvMesh& mesh,
00096     const word& name
00097 )
00098 {
00099     return surfaceInterpolationScheme<Type>::New
00100     (
00101         mesh,
00102         mesh.interpolationScheme(name)
00103     );
00104 }
00105 
00106 
00107 // Interpolate field onto faces using scheme given by name in dictionary
00108 template<class Type>
00109 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > 
00110 interpolate
00111 (
00112     const GeometricField<Type, fvPatchField, volMesh>& vf,
00113     const surfaceScalarField& faceFlux,
00114     Istream& schemeData
00115 )
00116 {
00117     if (surfaceInterpolation::debug)
00118     {
00119         Info<< "interpolate"
00120             << "(const GeometricField<Type, fvPatchField, volMesh>&, "
00121             << "const surfaceScalarField&, Istream&) : "
00122             << "interpolating GeometricField<Type, fvPatchField, volMesh> "
00123             << endl;
00124     }
00125 
00126     return scheme<Type>(faceFlux, schemeData)().interpolate(vf);
00127 }
00128 
00129 
00130 // Interpolate field onto faces using scheme given by name in dictionary
00131 template<class Type>
00132 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > 
00133 interpolate
00134 (
00135     const GeometricField<Type, fvPatchField, volMesh>& vf,
00136     const surfaceScalarField& faceFlux,
00137     const word& name
00138 )
00139 {
00140     if (surfaceInterpolation::debug)
00141     {
00142         Info<< "interpolate"
00143             << "(const GeometricField<Type, fvPatchField, volMesh>&, "
00144             << "const surfaceScalarField&, const word&) : "
00145             << "interpolating GeometricField<Type, fvPatchField, volMesh> "
00146             << "using " << name
00147             << endl;
00148     }
00149 
00150     return scheme<Type>(faceFlux, name)().interpolate(vf);
00151 }
00152 
00153 // Interpolate field onto faces using scheme given by name in dictionary
00154 template<class Type>
00155 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > 
00156 interpolate
00157 (
00158     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf,
00159     const surfaceScalarField& faceFlux,
00160     const word& name
00161 )
00162 {
00163     tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsf =
00164         interpolate(tvf(), faceFlux, name);
00165 
00166     tvf.clear();
00167 
00168     return tsf;
00169 }
00170 
00171 // Interpolate field onto faces using scheme given by name in dictionary
00172 template<class Type>
00173 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > 
00174 interpolate
00175 (
00176     const GeometricField<Type, fvPatchField, volMesh>& vf,
00177     const tmp<surfaceScalarField>& tFaceFlux,
00178     const word& name
00179 )
00180 {
00181     tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsf =
00182         interpolate(vf, tFaceFlux(), name);
00183 
00184     tFaceFlux.clear();
00185 
00186     return tsf;
00187 }
00188 
00189 // Interpolate field onto faces using scheme given by name in dictionary
00190 template<class Type>
00191 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > 
00192 interpolate
00193 (
00194     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf,
00195     const tmp<surfaceScalarField>& tFaceFlux,
00196     const word& name
00197 )
00198 {
00199     tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsf =
00200         interpolate(tvf(), tFaceFlux(), name);
00201 
00202     tvf.clear();
00203     tFaceFlux.clear();
00204 
00205     return tsf;
00206 }
00207 
00208 
00209 // Interpolate field onto faces using scheme given by name in dictionary
00210 template<class Type>
00211 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > 
00212 interpolate
00213 (
00214     const GeometricField<Type, fvPatchField, volMesh>& vf,
00215     Istream& schemeData
00216 )
00217 {
00218     if (surfaceInterpolation::debug)
00219     {
00220         Info<< "interpolate"
00221             << "(const GeometricField<Type, fvPatchField, volMesh>&, "
00222             << "Istream&) : "
00223             << "interpolating GeometricField<Type, fvPatchField, volMesh> "
00224             << endl;
00225     }
00226 
00227     return scheme<Type>(vf.mesh(), schemeData)().interpolate(vf);
00228 }
00229 
00230 // Interpolate field onto faces using scheme given by name in dictionary
00231 template<class Type>
00232 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > 
00233 interpolate
00234 (
00235     const GeometricField<Type, fvPatchField, volMesh>& vf,
00236     const word& name
00237 )
00238 {
00239     if (surfaceInterpolation::debug)
00240     {
00241         Info<< "interpolate"
00242             << "(const GeometricField<Type, fvPatchField, volMesh>&, "
00243             << "const word&) : "
00244             << "interpolating GeometricField<Type, fvPatchField, volMesh> "
00245             << "using " << name
00246             << endl;
00247     }
00248 
00249     return scheme<Type>(vf.mesh(), name)().interpolate(vf);
00250 }
00251 
00252 // Interpolate field onto faces using scheme given by name in dictionary
00253 template<class Type>
00254 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > 
00255 interpolate
00256 (
00257     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf,
00258     const word& name
00259 )
00260 {
00261     tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsf =
00262         interpolate(tvf(), name);
00263 
00264     tvf.clear();
00265 
00266     return tsf;
00267 }
00268 
00269 
00270 // Interpolate field onto faces using central differencing
00271 template<class Type>
00272 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > 
00273 interpolate
00274 (
00275     const GeometricField<Type, fvPatchField, volMesh>& vf
00276 )
00277 {
00278     if (surfaceInterpolation::debug)
00279     {
00280         Info<< "interpolate"
00281             << "(const GeometricField<Type, fvPatchField, volMesh>&) : "
00282             << "interpolating GeometricField<Type, fvPatchField, volMesh> "
00283             << "using run-time selected scheme"
00284             << endl;
00285     }
00286 
00287     return interpolate(vf, "interpolate(" + vf.name() + ')');
00288 }
00289 
00290 
00291 // Interpolate field onto faces using central differencing
00292 template<class Type>
00293 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > 
00294 interpolate
00295 (
00296     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf
00297 )
00298 {
00299     tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsf =
00300         interpolate(tvf());
00301     tvf.clear();
00302     return tsf;
00303 }
00304 
00305 
00306 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00307 
00308 } // End namespace fvc
00309 
00310 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00311 
00312 } // End namespace Foam
00313 
00314 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd