/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . Application foamToEnsight Group grpPostProcessingUtilitie Description Translates OpenFOAM data to EnSight format. An Ensight part is created for the internalMesh and for each patch. Usage \b foamToEnsight [OPTION] Translates OpenFOAM data to EnSight format Options: - \par -ascii Write Ensight data in ASCII format instead of "C Binary" - \par -noZero Exclude the often incomplete initial conditions. - \par -noLagrangian \n Suppress writing lagrangian positions and fields. - \par -noPatches Suppress writing any patches. - \par -patches patchList \n Specify particular patches to write. Specifying an empty list suppresses writing the internalMesh. - \par -faceZones zoneList \n Specify faceZones to write, with wildcards - \par -cellZone zoneName Specify single cellZone to write (not lagrangian) - \par -width \\n Width of EnSight data subdir (default: 8) Note Parallel support for cloud data is not supported - writes to \a EnSight directory to avoid collisions with foamToEnsightParts \*---------------------------------------------------------------------------*/ #include "argList.H" #include "timeSelector.H" #include "IOobjectList.H" #include "IOmanip.H" #include "OFstream.H" #include "volFields.H" #include "labelIOField.H" #include "scalarIOField.H" #include "tensorIOField.H" #include "ensightFile.H" #include "ensightMesh.H" #include "ensightField.H" #include "ensightCloud.H" #include "fvc.H" #include "cellSet.H" #include "fvMeshSubset.H" #include "memInfo.H" using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // bool inFileNameList(const fileNameList& nameList, const word& name) { forAll(nameList, i) { if (nameList[i] == name) { return true; } } return false; } int main(int argc, char *argv[]) { timeSelector::addOptions(); #include "addRegionOption.H" argList::addBoolOption ( "ascii", "write in ASCII format instead of 'C Binary'" ); argList::addBoolOption ( "nodeValues", "write values in nodes" ); argList::addBoolOption ( "noLagrangian", "suppress writing lagrangian positions and fields" ); argList::addBoolOption ( "noPatches", "suppress writing any patches" ); argList::addOption ( "patches", "wordReList", "specify particular patches to write - eg '(outlet \"inlet.*\")'. " "An empty list suppresses writing the internalMesh." ); argList::addOption ( "faceZones", "wordReList", "specify faceZones to write - eg '( slice \"mfp-.*\" )'." ); argList::addOption ( "fields", "wordReList", "specify fields to export (all by default) - eg '( \"U.*\" )'." ); argList::addOption ( "cellZone", "word", "specify cellZone to write" ); argList::addOption ( "name", "subdir", "define sub-directory name to use for ensight data " "(default: 'EnSight')" ); argList::addOption ( "width", "n", "width of ensight data subdir" ); // the volume field types that we handle const label nVolFieldTypes = 10; const word volFieldTypes[] = { volScalarField::typeName, volVectorField::typeName, volSphericalTensorField::typeName, volSymmTensorField::typeName, volTensorField::typeName, volScalarField::Internal::typeName, volVectorField::Internal::typeName, volSphericalTensorField::Internal::typeName, volSymmTensorField::Internal::typeName, volTensorField::Internal::typeName }; #include "setRootCase.H" // default to binary output, unless otherwise specified const IOstream::streamFormat format = ( args.optionFound("ascii") ? IOstream::ASCII : IOstream::BINARY ); const bool nodeValues = args.optionFound("nodeValues"); cpuTime timer; memInfo mem; Info<< "Initial memory " << mem.update().size() << " kB" << endl; #include "createTime.H" instantList timeDirs = timeSelector::select0(runTime, args); // adjust output width if (args.optionFound("width")) { ensightFile::subDirWidth(args.optionRead