Cart3D Home
home news images pubs c3dTeam
whatIsCart3D?
surfaceModeling
meshGen?
flowSolvers?
postprocess?
mailList?
betaTest?
licensing?


   Surface Modeling and Geometry Import


Component based approach
The Process 
Geometry import into Cart3D - fem2tri, off2tri, dxf2tri, & triangulate
Auxiliary Programs - intersect, trix, comp2tri & diagnoseGeom
A Few Technical Topics and Computational Geometry

         Component based approachexploded view of components making up a shuttle
                  geometry 
Loosely speaking, all geometry comes into Cart3D as a collection of components, which we call a configuration. In the exploded view of a space shuttle at the right, there are 20 "component triangulations"  which comprise this configuration. By treating each of these components as its own entity, we're free to move or modify an individual component to alter the configuration. Using this Component Based Approach you can  do a study in which components move or change (for example a  control surface gets deflected, or the wing is modified), without having to re-generate a completely new surface triangulation for the modified geometry. 
In more specific language, each component is a simplicial polytope. Think of this as a solid whose surface is a triangulation. Thus, each component must be represented as a single, watertight, triangulation, (no internal geometry). By "watertight" I mean that this triangulation must be locally manifold, so that one can traverse the entire surface by starting in any triangle, and traversing (recursively) over that triangle's edges into the next triangle. If one paints each triangle when it is visited, all the triangles on the component will get painted, regardless of where one begins the process. By this definition, every edge in the triangulation will have exactly 2 neighboring triangles. 

A "component" is one such simplicial polytope, and a "configuration" is a collection of components which describe the geometry you want to grid and run a flow simulation on. A configuration may have any number of components. Cart3D has been used on configurations with up to 1800 components, and there is (in principle) no upper limit. The package comes with tools which will diagnose problems with incomming geometry and help you to correct them. Follow this link for details about Cart3D triangulation formats.


(top)
   The Process
  1. Import the components that make up your configuration
  2. Extract the wetted surface (using intersect)
  3. Build the Cartesian mesh (using cubes)
  4. Launch the flow solver (flowCart)
Modifying your configuration and then repeating steps 2-4 allows you to conduct parametric studies on a given configuration. 
(top)
 
  Geometry Import
Tools are available for importing both geometry from both unstructured and structured sources. These are summarized in the table below. 
 
Unstructured Sources
Typical source
import path
   STL triangulations CAD programs, or www admesh->off2tri
   OFF triangulations CAD programs, or www off2tri
   DXF triangulations AutoCad, other PC based CAD dxf2STL->admesh->off2tri
   FNF triangulations  CAD programs (esp. ProE) fem2tri
Structured Sources

   plot3d surface grids CFD codes/mesh generators triangulate
   LaWGS networks various net2p3d->triangulate

Import Tools:
fem2tri:

takes a "finite element neutral" format triangulation and converts it into an individual component triangulation (which you can feed to "comp2tri" to build a configuration). The perl script *$CART3D/perl/fem2tri.pl" is extensively documented.
Usage: fem2tri infile.fem > outfile.tri
(top)
 
STL:
Stereolithography files (*STL) should be first converted to OFF format triangulations and then converted into Cart3D triangulations using off2tri (below).
 
off2tri:
takes a "OFF triangulation" format triangulation and converts it into an individual component triangulation (which you can feed to "comp2tri" to build a configuration).The perl script *$CART3D/perl/off2tri.pl" is extensively documented.  OFF format triangulations are relatively common. Of particular note is that "admesh" which is a code that tries to produce manifold triangulations from StereoLithography (STL) files, produces "OFF" format triangulations. This is particularly useful for geometry acquisition from CAD since most CAD systems now produce *STL triangulations.

Usage: off2tri infile.fem > outfile.tri
(top)

tri2dat.csh:  (New! v1.5)
a simple shell script for converting an ascii formatted Cart3D surface triangulation to a format readable by tecplot or paraview.
Usage: tri2dat.csh my_file.tri
Produces:
my_file.dat
 
 
dxf2STL:
takes a "dxf triangulation" format triangulation and converts it into an STL triangulation.The perl script $CART3D/perl/dxf2tri.pl is extensively documented. DXF format triangulations are put out by autoCAD and some other popular CAD programs. 
  Usage: dxf2STL infile.dxf > outfile
  1. Generate an STL file with dxf2STL
  2. Use admesh to convert this to an OFF format triangulation
  3. Convert the *off file to an ascii format  component triangulation (*.a.tri) with off2tri
(top)
 
 
triangulate:
triangulate a Multiple-grid plot3d file. Triangulate takes a multiple-grid plot3d format configuration and triangulates it component-by-component. Points with duplicate geometry (same point in physical space) are removed. It is used for converting components specified from structured geometry sources into  intersection-ready triangulations. Component information is retained for each triangulation. To prevent problems downstream, The default  behavior includes slightly (10x machine zero) perturbing vertices which are shared between separate components. This behavior can be suppressed with the "-n" option. Extremely degenerate geometry can be inflated (slightly - 10xMachineZero) around component centers in an attempt to avoid excessive tie-breaking down-stream. Normally the "-r" flag is set when triangulate is run to remove duplicate vertices from the geometry. Component lists generated by net2p3d (or by hand) may be fed into triangulate with the -C flag. The output of triangulate is a Cart3D component triangulation or a  Cart3D configuration triangulation (*.tri) file which has a component-by-component triangulation of the configuration, ready for intersection. 
% triangulate -
Usage: triangulate [-i infile -o outfile -T -v -r -n
                      -C comp_file -inward -inflate ]
 Options: 
    -i ..... Input  file name, def:<mgrid.unf>
    -o ..... Output file name, def:<Components.tri>
    -T ..... Output to tecplot file "tec.dat"
    -fast .. Output to unformatted FAST file "Components.fast"
    -C ..... Component list for infile, def:<Component.list>
    -v ..... Verbose mode
    -r ..... Remove duplicate nodes in input file
    -lex ... Lexicographically sort the triangle verts (needs -r)
    -n ..... Dont perturb identical pts on diff components
    -inward. Norm vectors on input geom face inward. def:<outward>
    -ascii . Input file is ascii fmt -  (output still unformatted)
    -dp .... Double precision I/O (Output trix format) unformatted)
    -zero .. set (data < ZERO) to 0.0000 - (param ZERO = 1.E-12)
    -inflate.Inflate geometry by 10*Eps to break  degeneracies
(top)


net2p3d :

Converts a LaWGS net into multiple grid plot3d format. The LaWGS format consists of any number of structured  patches with header information between each. Currently net2p3d does not parse scaling, translations or rotations in the LaWGS header. When a single watertight component is described by several meshes within the LaWGS file, these are identified by the component number in the LaWGS file. (In the LaWGS file, this is the first integer following the string which is the component's name, and comes just before the dimensions of the network. In addition to the multiple-grid plot3d representation of the mesh, net2p3d outputs a (human readable) Components.list file which describes the mapping of LaWGS networks to component numbers. This file can be suppressed with the "-no" option when this mapping is 1-to-1 (the default for triangulate).
 
% net2p3d -
     Usage: net2p3d [-i infile -o outfile  -v -m 
                      -C Compfile -no -ascii]
 Options: 
   -i ........ Input  file name, def:<LaWGS.net>
   -o ........ Output file name, def:<mgrid.unf>
   -v ........ Verbose mode
   -m ........ "memory verbose" report malloc/free
   -C ........ Component list file name,def:<Component.list>
   -no ....... Dont write out a Component list
   -ascii..... Output file ascii format
 (top)

  Other Auxiliary Programs
comp2tri: (New Features!)
combines any number of individual components into a cart3d "configuration" (generally *.tri file extension). Original component numbers of triangles are retained. The output of comp2tri is a Cart3D configuration triangulation (*.tri) file ready for intersection.
% comp2tri -
   Usage: comp2tri [OPTIONS] file0.tri file1.tri file2.tri ...

 Options:
  -v ............. Verbose more ON
  -inflate ....... Inflate geometry to break degeneracies
  -o %s .......... Output filename <Components.tri>
  -trix .......... Output file will be eXtended-TRI (trix) format
  -ascii ......... Output file will be ASCII (if not trix)
  -keepComps ..... Preserve 'intersect' component tags
  -makeGMPtags ... Create GMPtags from volume indexes
  -gmp2comp ...... Copy GMPtags to IntersectComponents
  -config ........ Write Config.xml using component tags
  -dp ............ Use double precision vert-coordinates <FALSE>
  -gmpTagOffset %d Renumber GMPtags by adding "1 x offset" to tags
                   in file1.tri, '2 x offset' to tags in file2.tri, etc.
                   First file, file0.tri, gets no offset (
tags left unchanged)

top
 
intersect: (New Features!)
Extracts the wetted surface of a configuration. "Configurations" are collections of components output either by triangulate, comp2tri, or made by some other method. intersect is extensively documented in AIAA 97-0197. The wetted surface extracted by intersect is in the form of a Cart3D wetted surface triangulation and is watertight.  Component information is retained. By convention, output files are generally named *.i.tri to indicate that they are post-intersection and do not contain any internal geometry. If "intersect" ever fails, it drops an "Error.dat" file which is a tecplotable file containing geometry local to the problem which caused it to fail. One may then  view the complete geometry and overlay the geometry contained in "Error.dat" to diagnose the source of the problem. Intersect is quite robust, and it begins and ends with a geometry verification phase. If intersect stops during the initial geometry verification it will suggest possible problems in the input geometry (e.g.  Component N is not closed", "Component X is non-manifold" etc These checks are topological in nature and do not depend on floating point math. They are therefore robust, and I've never seen a case where they were incorrect. In verbose mode ("-v"), this verification phase is step #4. Try to diagnose any geometry verification problems by viewing the Error.dat geometry against overlaid with the input geometry. Check in KNOWN_BUGS for a current listing. Intersect is based on boolean intersection predicates and uses adaptive precision floating point math with automatic tie-breaking to resolve degeneracies
% intersect -
   Usage: 
     intersect [ -i infile -o outfile -T -v -intersections -ascii -mem]
  Options:
  -i ............ Input  file name, def:<Components.tri>
  -o ............ Output file name, def:<Components.i.tri>
  -ascii ........ Input  geometry file is ASCII
  -T ............ Also output tecplot file "Components.i.plt"
  -fast.......... Also output unformatted FAST file "Components.i.fast"
  -v ............ Verbose Mode
  -mem .......... Report memory useage (auto on with "-v")
  -cutout %d..... Perform boolean subtraction (A-B) for component <%d> (details!)
   -overlap %d.... Perform boolean intersection of comp <%d> with others (details!)
  -intersections. write tecplot file of intersections <intersect.dat>
(top)

trix:  (New!)
The swiss-army knife of triangulations: format converter, translations, rotations and more. The default action is to convert the input files to the extended triangulation (VTK) format. Shape sensitivities (if present) are automatically
adjusted to reflect any geometry manipulation. Numerical parameters can be specified as expressions using operators +, -, *, /, ^ (exponent), unary +, unary -, sqrt, exp, log, pow, sin (radians), con, tan, asin, acos, atan, atan2 (2 args), sind (degrees), cosd, tand, dasin, dacos, datan, datan2, floor, ceil, and constants pi and e.

Usage:
   trix [-OPTIONS] [file(s) ...]
    Options are listed in the order they are applied:

-select ...         Select component(s) to mirror/scale/translate/rotate,
                    e.g. -select 1 2 5, omit to select all
     Scale Geometry:
-mirror %c          Mirror the X, Y or Z coordinate <none>
-sx %F              Scale geometry in X <1.>
-sy %F              Scale geometry in Y <1.>
-sz %F              Scale geometry in Z <1.>
     Translate geometry:
-x %F               Translate geometry in x-direction <0.>
-y %F               Translate geometry in y-direction <0.>
-z %F               Translate geometry in z-direction <0.>
     Rotate geometry (order rx-ry-rz):
-cx %F              X center of rotation <0.>
-cy %F              Y center of rotation <0.>
-cz %F              Z center of rotation <0.>
-rx %F              Rotate geometry around x-axis (deg) <0.>
-ry %F              Rotate geometry around y-axis (deg) <0.>
-rz %F              Rotate geometry around z-axis (deg) <0.>
-rg %F %F %F %F     Rotate geometry around vector with tail <cx, cy, cz>
                    and head < 0., 0., 0. > (deg) <0.>
     IO options:
-v                  Be verbose <FALSE>
-dp                 Use double precision vert-coordinates <FALSE>
-o %s               Output filename prefix <Components> (in VTU format)
-T                  Output a Tecplot file for each component (.dat)
-tri                Output all files as traditional Cart3D tri-files
-noVTK              Do not write an extended triangulation (VTK) file <FALSE>
     Tag manipulations:
-comp2gmp           Overwrite or create GMPtags from component tags
-tagRegion %F %F %F %F %F %F
                    Tag rectangular region inside XMIN XMAX YMIN YMAX ZMIN ZMAX
-add2comp %d        Increment or decrement component tags by this amount <0>
-add2gmp %d         Increment or decrement GMPtags by this amount <0>
     Linearization:
-dx                 Linearize with respect to x translation <FALSE>
-dy                 Linearize with respect to y translation <FALSE>
-dz                 Linearize with respect to z translation <FALSE>
     Input file list:
 ...                file1.tri file2.triq (extensions not important)


(top) 

diagnoseGeom:
diagnoseGeom is a utility aimed at helping you diagnose configuration geometries that intersect rejects. It verifies that components in your configuration are all valid and then performs intersection checks on all combinations of components in the configuration. When errors are found, they are reported and logged into a (newly created) subdirectory called "diagnosis". From this information you can quickly identify the offending component and make a repair.
Usage: 
   diagnoseGeom [-ascii -base=basename -split -verbose]

Example: (Tell me what's wrong with the ascii configuration triangulation "myConfig.a.tri")
 % diagnoseGeom -ascii myConfig  

   A Few Technical Topics and Computational Geometry
        (top)

Questions?   Visit Cart3D Discuss,   or  Contact Us
last update October 2020, M. Aftosmis