Importing OBJ Files
FlexPDE supports the import of 3D bounding surface meshes in the OBJ file format, allowing you to use a CAD program like Rhino to prepare your 3D model. The EXTRUSION section will be absent and the BOUNDARIES section will contain the one statement to import the OBJ file :
IMPORT OBJ 'filename'
To prepare the OBJ mesh, use the following rules :
•Build a closed mesh of your object and name it. FlexPDE must have a closed mesh - no open meshes. Do not use spaces in the name.
•Extract any mesh faces to which you would like to apply a boundary condition. Group and name them. Groups intended to have different boundary conditions must have different names. Do not use spaces in the name.
•Export the mesh in OBJ format without vertex normals, without mesh texture coordinates, and without materials. Also be sure to export object names as OBJ names, and group names as OBJ groups.
To have FlexPDE automatically generate a basic starting script file to import the OBJ mesh, do the following :
•Select the "Import->OBJ 3D" item from the "File" menu. Browse to the desired OBJ file and click "Open". (Alternatively, you may use the "Open" menu item and switch the file filter to "OBJ"). This will create a basic script file with the appropriate sections for the import process. This step is optional and may be skipped once you have familiarity with the script grammar for importing OBJ files.
Note : FlexPDE will use flat-sided tetrahedra when creating computation meshes from imported OBJ surface meshes. It will not curve the sides as in self constructed surface meshes.
Since there are no REGIONS or boundary paths stated in the script when you import an OBJ mesh file, we have provided two new sections for defining material property sets and boundary condition sets. They are the MATERIALS and BOUNDARY CONDITIONS sections.
In a normal script these definitions can be used in the normal flow with USE MATERIAL "name" and USE BC "name". In order to use them in your OBJ import you have to label and group some items in the OBJ file (usually before exporting from the CAD program, although it can be reopened and patched up by hand if needed).
In order to apply material parameters to a given object, simply select the complete bounding mesh of that object and name it. That name will be used to apply a parameter set definition. If you name the object "box" then a MATERIAL named "box" must be present in the FlexPDE script.
In order to apply a BC to a set of mesh cells (like the side of a box) you will need to extract those cells from the closed mesh, group them, and name the group. The group name will be used to apply a BC set definition. If you name the group "right side" then a BOUNDARY CONDITION named "right side" must be present in the FlexPDE script.
Try and get a uniform mesh created in the CAD program. It is easy to get a mesh with large long skinny cells very close to other small cells. FlexPDE does a pre-process pass where it will split cells in order to make them more uniform, but it is better to try and get uniformity from the CAD mesh generator first.
FlexPDE will accept triangular and square cells from the OBJ mesh, but it is better to make them triangular in the CAD program before exporting the OBJ file. FlexPDE will divide a square cell into four cells, whereas in the CAD program you can divide them into two. The reason for FlexPDE dividing into four is related to matching up common cell faces and their normals on faces shared between objects.
The normals of the cells will need to be directed outward. This is the default for most CAD programs when creating a mesh from closed objects. If you make an object from pieces, you will need to make sure the normals point outward.
Create two objects one inside the other. Invert the normals of the inside object. Name them as the same object.
Please see the supplementary YouTube videos on OBJ mesh construction and import : www.youtube.com/playlist?list=PLfkFm0BfPLmw_hxfw7KSBCt-xqaxyaYB0