2.7. Surface
2.7.1. Class: BasicSurface
BasicSurface is the parent class that generates surfaces between control sections. The control sections are objects of BasicSection. In CST-Modeling, a surface is interpolated between two control sections, i.e., two 3D planar curves. Multiple surfaces are generated when multiple sections are provided.
The surface is constructed by linear interpolation by default, but they can be smoothed by spline curves. One guide curve going through leading edge points can be specified to construct bent surfaces.
The generated surface is like the Swept surfaces or Multi-Sections Surfaces in CATIA:
A swept surface is generated by sweeping a section curve along an arbitrary trajectory.
A multi-sections surface is defined by two planar sections and two guide curves. You can make a multi-sections surface tangent to an adjacent surface by selecting an end section that lies on the adjacent surface. In this case, the guides must also be tangent to the surface.
It provides a read_setting function to read control files, which contains all the layout parameters. The control file is sometimes more convenient for optimization softwares or programs. It is also useful to provide the same layout for different scripts. But of course, you can just define them in your own python script.
1surface = BasicSurface(n_sec=2, name='basic-surface', nn=1001, ns=101, projection=True)
2surface.read_setting('Settings.txt')
3surface.geo()
4surface.output_tecplot(fname='basic-surface.dat', one_piece=False)
1==========================================
2[Surf] basic-surface
3==========================================
4---------------------------------------------------
5Layout: LE XYZ(m), chord(m), twist(deg), rel-thick
6---------------------------------------------------
7 0.0 0.0 0.0 5.5 3.0 0.18
8 2.0 1.0 7.0 3.2 0.0 0.14
2.7.2. Class: OpenSurface
OpenSurface is a child class of BasicSurface. It uses OpenSection objects as the control sections, which uses CST method for constructing the unit 2D open curve.
It provides a read_setting function to read control files, which contains all the layout parameters and CST coefficients.
1surface = OpenSurface(n_sec=2, name='open-surface', nn=1001, ns=101, projection=True)
2surface.read_setting('Settings.txt')
3surface.geo()
4surface.output_tecplot(fname='open-surface.dat', one_piece=False)
1==========================================
2[Surf] open-surface
3==========================================
4---------------------------------------------------
5Layout: LE XYZ(m), chord(m), twist(deg), rel-thick
6---------------------------------------------------
7 0.0 0.0 0.0 5.5 3.0 0.18
8 2.0 1.0 7.0 3.2 0.0 0.14
9---------------------------------------------------
10CST_coefs:
11---------------------------------------------------
12Section 1---------------
13 1.0 1.0 1.0 1.0 1.0 1.0 1.0
14Section 2---------------
15 1.0 1.0 1.0 1.0 1.0 1.0 1.0
16---------------------------------------------------
17CST_refine:
18---------------------------------------------------
19n_cst start-index
20 20 0
21Section 1---------------
22 0.1 0.1
23Section 2---------------
24 0.1 0.1 0.1
2.7.3. Class: Surface
Surface is a child class of BasicSurface. It uses Section objects as the control sections, which uses CST method for constructing the unit 2D airfoil, i.e., a closed curve.
It also provides a read_setting function to read control files, which contains all the layout parameters and CST coefficients.
The following code and control file show an example of generating a 3D airfoil surface. The surface has unit span length, unit chord length, zero twist angle and zero swept angle. It is a 3D surface of a 2D airfoil, which can be used for meshing in ICEM CFD.
1wing = Surface(n_sec=0, name='Airfoil3D', nn=1001, ns=101, projection=True)
2wing.read_setting('Settings.txt', tail=0.1)
3wing.geo()
4wing.output_plot3d(fname='Airfoil3D-basic.xyz', split=True)
5plot3d_to_igs(fname='Airfoil3D')
1==========================================
2[Surf] Airfoil3D
3==========================================
4---------------------------------------------------
5Layout: LE XYZ(m), chord(m), twist(deg), rel-thick
6---------------------------------------------------
7 0.0 0.0 0.0 1.0 0.0 0.11
8---------------------------------------------------
9CST_coefs:
10---------------------------------------------------
11Section 1---------------
12 0.118598 0.118914 0.155731 0.136732 0.209265 0.148305 0.193591
13-0.115514 -0.134195 -0.109145 -0.253206 -0.012220 -0.118463 0.064100
14---------------------------------------------------
15CST_refine:
16---------------------------------------------------
17n_cst start-index
18 20 0
19Section 1---------------
20 0.1 0.1
21 0.0 0.0
2.7.4. Built-in functions
(1) Essential functions
The following functions are essential to construct surfaces.
geo(flip_x=False, update_sec=True):
generate surfaces by linear interpolation. It will update control sections when update_sec=True.
geo_axisymmetric(phi, flip_x=False, update_sec=True):
generate axisymmetric surfaces by linear interpolation and rotation.
update_sections(flip_x=False):
update control sections. It first construct the 2D unit curves (optional), and then transform them to 3D curves.
output_tecplot(fname, one_piece=False):
output surface in Tecplot format.
output_plot3d(fname):
output surface in Plot3D format.
output_section(fname, TwoD=True):
output control sections (3D curves or 2D curves).
(2) Useful functions
There are some useful built-in functions users should be aware of.
add_sec(location, axis=’Z’):
add sections to the surface. This can be helpful for meshing.
The new sections are interpolated from the existed ones.
translate(dX=0.0, dY=0.0, dZ=0.0):
translate the surfaces by [dX, dY, dZ].
scale(scale=1.0, X0=0.0, Y0=0.0, Z0=0.0):
scale the surfaces by scale, the scale center is [X0, Y0, Z0].
split(ips):
split all surfaces in the chord-wise direction by the splitting points.
The index of splitting points in the 3D control curves are ips.
Length of surfs is multiplied by len(ips)+1.
smooth(i_sec0, i_sec1, smooth0=False, smooth1=False, dyn0=None, ratio_end=10):
smooth the span-wise curves between control sections i_sec0 and i_sec1.
smooth_axisymmetric(i_sec0, i_sec1, phi)
smooth the axisymmetric curves between control sections i_sec0 and i_sec1.
bend(i_sec0, i_sec1, leader=None, kx=None, ky=None, kc=None, rot_x=False):
bend surfaces between control sections i_sec0 and i_sec1 by a guide curve, i.e., leader.
plot():
plot surfaces.