/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | foam-extend: Open Source CFD \\ / O peration | Version: 3.2 \\ / A nd | Web: http://www.foam-extend.org \\/ M anipulation | For copyright notice see file Copyright ------------------------------------------------------------------------------- License This file is part of foam-extend. foam-extend 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. foam-extend 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 foam-extend. If not, see . Application foamMeshToAbaqus Description Converts an FOAM mesh to an Abaqus input file. Creates a node set and and element set and a surface for each boundary patch. Also creates a element set for each material in the materials file (if it is exists). Only works for hexahedral cells as yet. Checked for Abaqus-6.9-2. Author philip.cardiff@ucd.ie \*---------------------------------------------------------------------------*/ #include "fvCFD.H" #include "OFstream.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) { # include "setRootCase.H" # include "createTime.H" # include "createMesh.H" //----------------------------------------------------------------------// //- open abaqus input file //----------------------------------------------------------------------// Info << "Opening Abaqus input file" << endl << endl; OFstream abaqusInp("abaqusMesh.inp"); //- input header Info << "Writing input file header" << endl << endl; abaqusInp << "*Heading\n" << "** Job name: OpenFoamMesh Model name: OpenFoamMesh\n" << "** Generated by: Abaqus/CAE 6.9-2\n" << "*Preprint, echo=NO, model=NO, history=NO, contact=NO\n" << "**\n" << "** PARTS\n" << "**\n" << "*Part, name=OpenFoamMeshPart" << endl; //----------------------------------------------------------------------// //- write nodes //----------------------------------------------------------------------// Info << "Writing Nodes" << endl << endl; abaqusInp << "*Node" << endl; const pointField& points = mesh.points(); forAll(points, pointi) { abaqusInp << "\t" << (pointi+1) << ",\t" << (points[pointi]).x() << ",\t" << (points[pointi]).y() << ",\t" << (points[pointi]).z() << endl; } //----------------------------------------------------------------------// //- determine abaqusCellPoints //----------------------------------------------------------------------// //- for hex 1st order elements, abaqus orders the points //- where nodes 1 2 3 4 are clockwise from the outside of the cell //- and then 5 6 7 8 are apposite 1 2 3 4 respectively Info << "Determining Abaqus element node ordering" << endl << endl; const cellList& cells = mesh.cells(); const faceList& faces = mesh.faces(); const labelListList pointPoints = mesh.pointPoints(); const labelListList cellPoints = mesh.cellPoints(); const labelList faceOwner = mesh.faceOwner(); const vectorField faceNormals = mesh.Sf()/mesh.magSf(); labelListList abaqusCellPoints(cellPoints.size(), List