50. plugins.neu_exp — Gambit neutral file exporter.

This module contains some functions to export pyFormex mesh models to Gambit neutral files.

50.1. Functions defined in module plugins.neu_exp

plugins.neu_exp.writeHeading(fil, nodes, elems, nbsets=0, heading='')[source]

Write the heading of the Gambit neutral file.

nbsets: number of boundary condition sets (border patches).

plugins.neu_exp.writeNodes(fil, nodes)[source]

Write nodal coordinates.

plugins.neu_exp.writeElems(fil, elems)[source]

Write element connectivity.

plugins.neu_exp.writeGroup(fil, elems)[source]

Write group of elements.

plugins.neu_exp.writeBCsets(fil, bcsets, elgeotype)[source]

Write boundary condition sets of faces.

Parameters:

  • bcsets: a dict where the values are BorderFace arrays (see below).
  • elgeotype: element geometry type: 4 for hexahedrons, 6 for tetrahedrons.

BorderFace array: A set of border faces defined as a (n,2) shaped int array: echo row contains an element number (enr) and face number (fnr).

There are 2 ways to construct the BorderFace arrays:

# find border both as mesh and enr/fnr and keep correspondence:

  brde, brdfaces = M.getFreeEntities(level=-1,return_indices=True)
  brd = Mesh(M.coords, brde)

.. note: This needs further explanation. Gianluca?
# matchFaces: Given a volume mesh M and a surface meshes S, being

(part of) the border of M, BorderFace array for the surface S can be obtained from:

bf = M.matchFaces(S)[1]

To define other boundary types: Value - Boundary Entity Type,

0 UNSPECIFIED, 1 AXIS, 2 CONJUGATE, 3 CONVECTION, 4 CYCLIC, 5 DEAD, 6 ELEMENT_SIDE, 7 ESPECIES, 8 EXHAUST_FAN, 9 FAN, 10 FREE_SURFACE, 11 GAP, 12 INFLOW, 13 INLET, 14 INLET_VENT, 15 INTAKE_FAN, 16 INTERFACE, 17 INTERIOR, 18 INTERNAL, 19 LIVE, 20 MASS_FLOW_INLET, 21 MELT, 22 MELT_INTERFACE, 23 MOVING_BOUNDARY, 24 NODE, 25 OUTFLOW, 26 OUTLET, 27 OUTLET_VENT, 28 PERIODIC, 29 PLOT, 30 POROUS, 31 POROUS_JUMP, 32 PRESSURE, 33 PRESSURE_FAR_FIELD, 34 PRESSURE_INFLOW, 35 PRESSURE_INLET, 36 PRESSURE_OUTFLOW, 37 PRESSURE_OUTLET, 38 RADIATION, 39 RADIATOR , 40 RECIRCULATION_INLET, 41 RECIRCULATION_OUTLET, 42 SLIP, 43 SREACTION, 44 SURFACE, 45 SYMMETRY, 46 TRACTION, 47 TRAJECTORY, 48 VELOCITY, 49 VELOCITY_INLET, 50 VENT, 51 WALL, 52 SPRING

See also http://combust.hit.edu.cn:8080/fluent/Gambit13_help/modeling_guide/mg0b.htm#mg0b01 for the description of the neu file syntax.

plugins.neu_exp.read_tetgen(filename)[source]

Read a tetgen tetraedral model.

filename is the base of the path of the input files. For a filename ‘proj’, nodes are expected in ‘proj.1.node’ and elems are in file ‘proj.1.ele’.

plugins.neu_exp.write_neu(fil, mesh, bcsets=None, heading='generated with pyFormex')[source]

Export a mesh as .neu file (For use in Gambit/Fluent)

  • fil: file name
  • mesh: pyFormex Mesh
  • heading: heading text to be shown in the gambit header
  • bcsets: dictionary of 2D arrays: {‘name1’: brdfaces1, …}, see writeBCsets