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 Application 00025 sample 00026 00027 Description 00028 Sample field data with a choice of interpolation schemes, sampling options 00029 and write formats. 00030 00031 Keywords: 00032 00033 @param setFormat : set output format, choice of \n 00034 - @c xmgr 00035 - @c jplot 00036 - @c gnuplot 00037 - @c raw 00038 00039 @param surfaceFormat : surface output format, choice of \n 00040 - @c null : suppress output 00041 - @c foamFile : separate points, faces and values file 00042 - @c dx : DX scalar or vector format 00043 - @c vtk : VTK ascii format 00044 - @c raw : x y z value format for use with e.g. gnuplot 'splot'. 00045 - @c obj : Wavefron stl. Does not contain values! 00046 - @c stl : ascii stl. Does not contain values! 00047 00048 @param interpolationScheme : interpolation scheme, choice of \n 00049 - @c cell : use cell-centre value; constant over cells (default) 00050 - @c cellPoint : use cell-centre and vertex values 00051 - @c cellPointFace : use cell-centre, vertex and face values. \n 00052 -# vertex values determined from neighbouring cell-centre values 00053 -# face values determined using the current face interpolation scheme 00054 for the field (linear, limitedLinear, etc.) 00055 00056 @param fields : list of fields to sample 00057 00058 @param sets : list of sets to sample, choice of \n 00059 - @c uniform : evenly distributed points on line 00060 - @c face : one point per face intersection 00061 - @c midPoint : one point per cell, inbetween two face intersections 00062 - @c midPointAndFace : combination of face and midPoint 00063 - @c curve : specified points, not nessecary on line, uses 00064 tracking 00065 - @c cloud : specified points, uses findCell 00066 . 00067 Option axis: how to write point coordinate. Choice of 00068 - @c x/y/z: x/y/z coordinate only 00069 - @c xyz: three columns 00070 (probably does not make sense for anything but raw) 00071 - @c distance: distance from start of sampling line (if uses line) 00072 or distance from first specified sampling point 00073 . 00074 Type specific options: 00075 - @c uniform, face, midPoint, midPointAndFace : start and end coordinate 00076 - @c uniform: extra number of sampling points 00077 - @c curve, @c cloud: list of coordinates 00078 00079 @param surfaces : list of surfaces to sample, choice of \n 00080 - @c plane : values on plane defined by point, normal. 00081 - @c patch : values on patch. 00082 00083 Usage 00084 00085 - sample [OPTION] 00086 00087 @param -noZero \n 00088 Do not sample the @em 0 directory. 00089 00090 @param -case <dir> \n 00091 Path to the case directory. Defaults to the 00092 current working directory. 00093 00094 @param -parallel \n 00095 Run in parallel. 00096 00097 @param -latestTime \n 00098 Only sample the latest time directory. 00099 00100 @param -time <time> \n 00101 Only sample the @em time directory. 00102 00103 @param -constant \n 00104 Include the constant directory. 00105 00106 @param -help \n 00107 Display help message. 00108 00109 @param -doc \n 00110 Display Doxygen API documentation page for this application. 00111 00112 @param -srcDoc \n 00113 Display Doxygen source documentation page for this application. 00114 00115 Notes 00116 Runs in parallel 00117 00118 \*---------------------------------------------------------------------------*/ 00119 00120 #include <OpenFOAM/argList.H> 00121 #include <OpenFOAM/timeSelector.H> 00122 #include <sampling/IOsampledSets.H> 00123 #include <sampling/IOsampledSurfaces.H> 00124 00125 using namespace Foam; 00126 00127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00128 // Main program: 00129 00130 int main(int argc, char *argv[]) 00131 { 00132 timeSelector::addOptions(); 00133 #include <OpenFOAM/addRegionOption.H> 00134 argList::validOptions.insert("dict", "dictionary name"); 00135 00136 #include <OpenFOAM/setRootCase.H> 00137 #include <OpenFOAM/createTime.H> 00138 instantList timeDirs = timeSelector::select0(runTime, args); 00139 #include <OpenFOAM/createNamedMesh.H> 00140 00141 word sampleDict = "sampleDict"; 00142 if (args.optionFound("dict")) 00143 { 00144 sampleDict = args.option("dict"); 00145 Info<< "Reading sample dictionary: " << sampleDict << nl << endl; 00146 } 00147 00148 IOsampledSets sSets 00149 ( 00150 sampledSets::typeName, 00151 mesh, 00152 sampleDict, 00153 IOobject::MUST_READ, 00154 true 00155 ); 00156 00157 IOsampledSurfaces sSurfs 00158 ( 00159 sampledSurfaces::typeName, 00160 mesh, 00161 sampleDict, 00162 IOobject::MUST_READ, 00163 true 00164 ); 00165 00166 forAll(timeDirs, timeI) 00167 { 00168 runTime.setTime(timeDirs[timeI], timeI); 00169 Info<< "Time = " << runTime.timeName() << endl; 00170 00171 // Handle geometry/topology changes 00172 polyMesh::readUpdateState state = mesh.readUpdate(); 00173 00174 sSets.readUpdate(state); 00175 sSurfs.readUpdate(state); 00176 00177 sSets.write(); 00178 sSurfs.write(); 00179 00180 Info<< endl; 00181 } 00182 00183 Info<< "End\n" << endl; 00184 00185 return 0; 00186 } 00187 00188 00189 // ************************ vim: set sw=4 sts=4 et: ************************ //