|
|
|
writeFluentVectorField.CGo 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 Given a volVectorField and Fluent field identifier, write the field in 00027 Fluent data format 00028 00029 00030 \*---------------------------------------------------------------------------*/ 00031 00032 #include "writeFluentFields.H" 00033 00034 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00035 00036 namespace Foam 00037 { 00038 00039 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00040 00041 void writeFluentField 00042 ( 00043 const volVectorField& phi, 00044 const label fluentFieldIdentifier, 00045 Ostream& stream 00046 ) 00047 { 00048 const vectorField& phiInternal = phi.internalField(); 00049 00050 // Writing cells 00051 stream 00052 << "(300 (" 00053 << fluentFieldIdentifier << " " // Field identifier 00054 << "1 " // Zone ID: (cells=1, internal faces=2, 00055 // patch faces=patchI+10) 00056 << "3 " // Number of components (scalar=1, vector=3) 00057 << "0 0 " // Unused 00058 << "1 " << phiInternal.size() // Start and end of list 00059 << ")(" << endl; 00060 00061 forAll (phiInternal, cellI) 00062 { 00063 stream 00064 << phiInternal[cellI].x() << " " 00065 << phiInternal[cellI].y() << " " 00066 << phiInternal[cellI].z() << " " 00067 << endl; 00068 } 00069 00070 stream 00071 << "))" << endl; 00072 00073 label nWrittenFaces = phiInternal.size(); 00074 00075 // Writing boundary faces 00076 forAll (phi.boundaryField(), patchI) 00077 { 00078 const vectorField& patchPhi = phi.boundaryField()[patchI]; 00079 00080 // Write header 00081 stream 00082 << "(300 (" 00083 << fluentFieldIdentifier << " " // Field identifier 00084 << patchI + 10 << " " // Zone ID: patchI+10 00085 << "3 " // Number of components (scalar=1, vector=3) 00086 << "0 0 " // Unused 00087 << nWrittenFaces + 1 << " " << nWrittenFaces + patchPhi.size() 00088 // Start and end of list 00089 << ")(" << endl; 00090 00091 nWrittenFaces += patchPhi.size(); 00092 00093 forAll (patchPhi, faceI) 00094 { 00095 stream 00096 << patchPhi[faceI].x() << " " 00097 << patchPhi[faceI].y() << " " 00098 << patchPhi[faceI].z() << " " 00099 << endl; 00100 } 00101 00102 stream 00103 << "))" << endl; 00104 } 00105 } 00106 00107 00108 } // End namespace Foam 00109 00110 // ************************************************************************* // |