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

sample.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 Description
00026     Sample field data with a choice of interpolation schemes, sampling options
00027     and write formats.
00028 
00029     Keywords:
00030 
00031     @param setFormat : set output format, choice of \n
00032       - xmgr
00033       - jplot
00034       - gnuplot
00035       - raw
00036 
00037     @param surfaceFormat : surface output format, choice of \n
00038       - null        : suppress output
00039       - foamFile    : separate points, faces and values file
00040       - dx          : DX scalar or vector format
00041       - vtk         : VTK ascii format
00042       - raw         : x y z value format for use with e.g. gnuplot 'splot'.
00043       - obj         : Wavefron stl. Does not contain values!
00044       - stl         : ascii stl. Does not contain values!
00045 
00046     @param interpolationScheme : interpolation scheme, choice of \n
00047       - cell          : use cell-centre value; constant over cells (default)
00048       - cellPoint     : use cell-centre and vertex values
00049       - cellPointFace : use cell-centre, vertex and face values. \n
00050         -# vertex values determined from neighbouring cell-centre values
00051         -# face values determined using the current face interpolation scheme
00052            for the field (linear, limitedLinear, etc.)
00053 
00054     @param fields : list of fields to sample
00055 
00056     @param sets : list of sets to sample, choice of \n
00057       - uniform             evenly distributed points on line
00058       - face                one point per face intersection
00059       - midPoint            one point per cell, inbetween two face intersections
00060       - midPointAndFace     combination of face and midPoint
00061 
00062       - curve               specified points, not nessecary on line, uses
00063                             tracking
00064       - cloud               specified points, uses findCell
00065 
00066         Option axis: how to write point coordinate. Choice of
00067           - x/y/z: x/y/z coordinate only
00068           - xyz: three columns
00069             (probably does not make sense for anything but raw)
00070           - distance: distance from start of sampling line (if uses line)
00071             or distance from first specified sampling point
00072 
00073         Type specific options:
00074             uniform, face, midPoint, midPointAndFace : start and end coordinate
00075             uniform: extra number of sampling points
00076             curve, cloud: list of coordinates
00077 
00078     @param surfaces : list of surfaces to sample, choice of \n
00079       - plane : values on plane defined by point, normal.
00080       - patch : values on patch.
00081 
00082 Notes
00083     Runs in parallel
00084 
00085 \*---------------------------------------------------------------------------*/
00086 
00087 #include "argList.H"
00088 #include "timeSelector.H"
00089 #include "IOsampledSets.H"
00090 #include "IOsampledSurfaces.H"
00091 
00092 using namespace Foam;
00093 
00094 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00095 // Main program:
00096 
00097 int main(int argc, char *argv[])
00098 {
00099     timeSelector::addOptions();
00100 #   include "addRegionOption.H"
00101 #   include "setRootCase.H"
00102 #   include "createTime.H"
00103     instantList timeDirs = timeSelector::select0(runTime, args);
00104 #   include "createNamedMesh.H"
00105 
00106     IOsampledSets sSets
00107     (
00108         sampledSets::typeName,
00109         mesh,
00110         "sampleDict",
00111         IOobject::MUST_READ,
00112         true
00113     );
00114 
00115     IOsampledSurfaces sSurfs
00116     (
00117         sampledSurfaces::typeName,
00118         mesh,
00119         "sampleDict",
00120         IOobject::MUST_READ,
00121         true
00122     );
00123 
00124     forAll(timeDirs, timeI)
00125     {
00126         runTime.setTime(timeDirs[timeI], timeI);
00127         Info<< "Time = " << runTime.timeName() << endl;
00128 
00129         // Handle geometry/topology changes
00130         polyMesh::readUpdateState state = mesh.readUpdate();
00131 
00132         sSets.readUpdate(state);
00133         sSurfs.readUpdate(state);
00134 
00135         sSets.write();
00136         sSurfs.write();
00137 
00138         Info<< endl;
00139     }
00140 
00141     Info<< "End\n" << endl;
00142 
00143     return 0;
00144 }
00145 
00146 
00147 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd