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 Description 00025 snGrad scheme with limited non-orthogonal correction. 00026 00027 The limiter is controlled by a coefficient with a value between 0 and 1 00028 which when 0 switches the correction off and the scheme behaves as 00029 uncorrectedSnGrad, when set to 1 the full correction is applied and the 00030 scheme behaves as correctedSnGrad and when set to 0.5 the limiter is 00031 calculated such that the non-orthogonal contribution does not exceed the 00032 orthogonal part. 00033 00034 \*---------------------------------------------------------------------------*/ 00035 00036 #include <finiteVolume/fv.H> 00037 #include "limitedSnGrad.H" 00038 #include <finiteVolume/volFields.H> 00039 #include <finiteVolume/surfaceFields.H> 00040 #include <finiteVolume/correctedSnGrad.H> 00041 #include <finiteVolume/localMax.H> 00042 00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00044 00045 namespace Foam 00046 { 00047 00048 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00049 00050 namespace fv 00051 { 00052 00053 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // 00054 00055 template<class Type> 00056 limitedSnGrad<Type>::~limitedSnGrad() 00057 {} 00058 00059 00060 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 00061 00062 template<class Type> 00063 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > 00064 limitedSnGrad<Type>::correction 00065 ( 00066 const GeometricField<Type, fvPatchField, volMesh>& vf 00067 ) const 00068 { 00069 GeometricField<Type, fvsPatchField, surfaceMesh> corr = 00070 correctedSnGrad<Type>(this->mesh()).correction(vf); 00071 00072 surfaceScalarField limiter 00073 ( 00074 min 00075 ( 00076 limitCoeff_ 00077 *mag(snGradScheme<Type>::snGrad(vf, deltaCoeffs(vf), "orthSnGrad")) 00078 /( 00079 (1 - limitCoeff_)*mag(corr) 00080 + dimensionedScalar("small", corr.dimensions(), SMALL) 00081 ), 00082 dimensionedScalar("one", dimless, 1.0) 00083 ) 00084 ); 00085 00086 if (fv::debug) 00087 { 00088 Info<< "limitedSnGrad :: limiter min: " << min(limiter.internalField()) 00089 << " max: "<< max(limiter.internalField()) 00090 << " avg: " << average(limiter.internalField()) << endl; 00091 } 00092 00093 return limiter*corr; 00094 } 00095 00096 00097 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00098 00099 } // End namespace fv 00100 00101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00102 00103 } // End namespace Foam 00104 00105 // ************************ vim: set sw=4 sts=4 et: ************************ //