Surface ======================== 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. .. code-block:: python :linenos: surface = BasicSurface(n_sec=2, name='basic-surface', nn=1001, ns=101, projection=True) surface.read_setting('Settings.txt') surface.geo() surface.output_tecplot(fname='basic-surface.dat', one_piece=False) .. code-block:: text :linenos: ========================================== [Surf] basic-surface ========================================== --------------------------------------------------- Layout: LE XYZ(m), chord(m), twist(deg), rel-thick --------------------------------------------------- 0.0 0.0 0.0 5.5 3.0 0.18 2.0 1.0 7.0 3.2 0.0 0.14 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**. .. code-block:: python :linenos: surface = OpenSurface(n_sec=2, name='open-surface', nn=1001, ns=101, projection=True) surface.read_setting('Settings.txt') surface.geo() surface.output_tecplot(fname='open-surface.dat', one_piece=False) .. code-block:: text :linenos: ========================================== [Surf] open-surface ========================================== --------------------------------------------------- Layout: LE XYZ(m), chord(m), twist(deg), rel-thick --------------------------------------------------- 0.0 0.0 0.0 5.5 3.0 0.18 2.0 1.0 7.0 3.2 0.0 0.14 --------------------------------------------------- CST_coefs: --------------------------------------------------- Section 1--------------- 1.0 1.0 1.0 1.0 1.0 1.0 1.0 Section 2--------------- 1.0 1.0 1.0 1.0 1.0 1.0 1.0 --------------------------------------------------- CST_refine: --------------------------------------------------- n_cst start-index 20 0 Section 1--------------- 0.1 0.1 Section 2--------------- 0.1 0.1 0.1 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. .. code-block:: python :linenos: wing = Surface(n_sec=0, name='Airfoil3D', nn=1001, ns=101, projection=True) wing.read_setting('Settings.txt', tail=0.1) wing.geo() wing.output_plot3d(fname='Airfoil3D-basic.xyz', split=True) plot3d_to_igs(fname='Airfoil3D') .. code-block:: text :linenos: ========================================== [Surf] Airfoil3D ========================================== --------------------------------------------------- Layout: LE XYZ(m), chord(m), twist(deg), rel-thick --------------------------------------------------- 0.0 0.0 0.0 1.0 0.0 0.11 --------------------------------------------------- CST_coefs: --------------------------------------------------- Section 1--------------- 0.118598 0.118914 0.155731 0.136732 0.209265 0.148305 0.193591 -0.115514 -0.134195 -0.109145 -0.253206 -0.012220 -0.118463 0.064100 --------------------------------------------------- CST_refine: --------------------------------------------------- n_cst start-index 20 0 Section 1--------------- 0.1 0.1 0.0 0.0 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.