5.3.1. Example: Generating a Similar Mesh from Different Curve Files

As mentioned above, the most common approach to generating session files for use in batch processing is to record sessions carried out interactively. For example, you may record a session file of an entire session in which you load profile points, generate topology, create a mesh and save it to a .gtm file. If you then edit the session file (using a text editor) replacing the hub, shroud, blade and mesh files with other filenames, you can then repeat the same actions on different curve files by running the edited session file.

You may also edit a session file to include a loop written with Power Syntax (Perl script). The session file could load a state file before entering the loop so that only the CCL block structure that controls the parameters that vary must be in the loop. To obtain a particular CCL block structure, you can do one of the following:

  1. Write a state file and then use a text editor to select the appropriate CCL block.

  2. Write a state file, saving only the CCL blocks that you need.

  3. Begin recording a session file. Click Apply on the object editor for the object of interest. Stop recording the session file. Open the session file in a text editor and extract the appropriate CCL block.

The following is a simplified example of a loop that could be used in a parametric study. It loads 4 different blade files, blade1.curve, blade2.curve... and so on, and writes 4 corresponding mesh files, mesh1.gtm, mesh2.gtm... while keeping all other settings the same.

! for (1..4)
! {
! 	my $bladefile = "blade".$_.".curve";
!	my $meshfile = "mesh".$_.".gtm";
GEOMETRY:GEOMETRY
  BLADE:Blade 1
    Coordinate Frame Type = Cartesian
    Curve Representation = Bspline 
    Input Angle Units = degree
    Input Filename = $bladefile
    Input Length Units = m
    Show Curve = Off
    Show Surface = On
    Surface Representation = Bspline 
    Visibility = On
  END
END
> mesh
> savemesh filename=$meshfile, onefile=On, solver=cfx5
! }

The next example illustrates how a numerical parameter can be modified in a batch loop. It makes use of a list of values.

! for (20,27.5,35,42.5)
! {
!
! my $hubAngle = $_." [degree]";
GEOMETRY:GEOMETRY
  INLET:  
    Hub Angle = $hubAngle
    Override Automatic Angles = On
    Shroud Angle = 0.0 [degree]
    Visibility = Off
    GEO POINT:Low Hub Point
      Requested ART = -58.09,166.585,54.1607
      Visibility = On
    END
    GEO POINT:Low Shroud Point
      Visibility = On
    END
  END
END
! }

A hash table may be used to map integers to numbers or text strings. The following example makes use of a hash table to map from the loop index (an integer) to various real numbers:

! my %hubAngle= 
! (
! 	1	 => 	20,
! 	2 	 => 	27.5,
! 	3	 => 	35,
! 	4	 => 	42.5,
! );
! for (1..4)
! {
!
! my $hubAngleVal = $hubAngle{$_}." [degree]";
GEOMETRY:GEOMETRY
  INLET:  
    Hub Angle = $hubAngleVal
    Override Automatic Angles = On
    Shroud Angle = 0.0 [degree]
    Visibility = Off
    GEO POINT:Low Hub Point
      Requested ART = -58.09,166.585,54.1607
      Visibility = On
    END
    GEO POINT:Low Shroud Point
      Visibility = On
    END
  END
END
! }

A hash table can also control parameters that require string values. An example of a string hash table follows:

! my %values = 
! (
! 	1	 => 	"On",
! 	2	 => 	"Off",
! 	3	 => 	"lastval"
! );
! my $firstval = $values{1};

In this example, firstval will be set to On. To use this hash table in a loop, the quantity in {} after $values could be $_ which represents the loop index.