00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 2008-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 Class 00025 Foam::calcTypes::randomise 00026 00027 Description 00028 Adds a random component to a field, with a given perturbation magnitude. 00029 00030 SourceFiles 00031 randomise.C 00032 00033 \*---------------------------------------------------------------------------*/ 00034 00035 #ifndef randomise_H 00036 #define randomise_H 00037 00038 #include <foamCalcFunctions/calcType.H> 00039 #include <OpenFOAM/Random.H> 00040 00041 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00042 00043 namespace Foam 00044 { 00045 00046 namespace calcTypes 00047 { 00048 00049 /*---------------------------------------------------------------------------*\ 00050 Class randomise Declaration 00051 \*---------------------------------------------------------------------------*/ 00052 00053 class randomise 00054 : 00055 public calcType 00056 { 00057 // Private Member Functions 00058 00059 //- Disallow default bitwise copy construct 00060 randomise(const randomise&); 00061 00062 //- Disallow default bitwise assignment 00063 void operator=(const randomise&); 00064 00065 00066 protected: 00067 00068 // Member Functions 00069 00070 // Calculation routines 00071 00072 //- Initialise - typically setting static variables, 00073 // e.g. command line arguments 00074 virtual void init(); 00075 00076 //- Pre-time loop calculations 00077 virtual void preCalc 00078 ( 00079 const argList& args, 00080 const Time& runTime, 00081 const fvMesh& mesh 00082 ); 00083 00084 //- Time loop calculations 00085 virtual void calc 00086 ( 00087 const argList& args, 00088 const Time& runTime, 00089 const fvMesh& mesh 00090 ); 00091 00092 00093 // I-O 00094 00095 //- Write component fields 00096 template<class Type> 00097 void writeRandomField 00098 ( 00099 const IOobject& header, 00100 const scalar pertMag, 00101 Random& rand, 00102 const fvMesh& mesh, 00103 bool& processed 00104 ); 00105 00106 00107 public: 00108 00109 //- Runtime type information 00110 TypeName("randomise"); 00111 00112 00113 // Constructors 00114 00115 //- Construct null 00116 randomise(); 00117 00118 00119 // Destructor 00120 00121 virtual ~randomise(); 00122 }; 00123 00124 00125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00126 00127 } // End namespace calcTypes 00128 } // End namespace Foam 00129 00130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00131 00132 #ifdef NoRepository 00133 # include "writeRandomField.C" 00134 #endif 00135 00136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00137 00138 #endif 00139 00140 // ************************ vim: set sw=4 sts=4 et: ************************ //