[go: up one dir, main page]

0% found this document useful (0 votes)
64 views8 pages

Chapter 9: Batch Mode Studies: 9.1. Before You Begin

09 Batch-Mode-Studies.pdf

Uploaded by

rewmarine
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views8 pages

Chapter 9: Batch Mode Studies: 9.1. Before You Begin

09 Batch-Mode-Studies.pdf

Uploaded by

rewmarine
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Chapter 9: Batch Mode Studies

Note

This tutorial requires using ANSYS TurboGrid in batch mode, which is not possible from ANSYS
Workbench.

This tutorial has two parts:

• Part 1: Parametric Study (p. 71)

• Part 2: Grid Refinement (p. 75)

Part 1 of this tutorial demonstrates one basic way of performing a parametric study using ANSYS Tur-
boGrid in batch mode: using a script loop to repeatedly modify and run a session file with ANSYS Tur-
boGrid. Each modified session file loads a baseline state file, reloads the blade geometry from a different
file, and generates and saves output (including a mesh).

Part 2 of this tutorial demonstrates a grid refinement study using a method similar to part 1. The main
difference in part 2 is the use of the “end ratio” option throughout the mesh data specification to allow
the grid refinement to occur evenly through the mesh.

Variations of the algorithm described in this tutorial are possible. For example:

• You could modify the state file instead of the session file.

• You could use a loop within a session file (written in Perl) to avoid loading and closing ANSYS TurboGrid
repeatedly, which should improve efficiency.

Such variations are beyond the scope of this tutorial. You are encouraged to try the algorithm used in
this tutorial and then explore other methods as required in order to meet your specific requirements.

9.1. Before You Begin


If this is your first tutorial, review the topics in Introduction to the ANSYS TurboGrid Tutorials (p. 1).

9.2. Part 1: Parametric Study


This part of the tutorial includes:
9.2.1. Starting ANSYS TurboGrid
9.2.2. Defining the Geometry
9.2.3. Creating the Topology and Modifying the Mesh
9.2.4. Creating the Session File
9.2.5. Running the Session File

Release 14.5 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 71
Batch Mode Studies

9.2.1. Starting ANSYS TurboGrid


1. Prepare the working directory using the files in the examples/rotor37 directory.

For details, see Preparing a Working Directory (p. 1).

2. Set the working directory and start ANSYS TurboGrid.

For details, see Setting the Working Directory and Starting ANSYS TurboGrid (p. 1).

9.2.2. Defining the Geometry


1. Select File > Load BladeGen.

2. Open the BladeGen.inf file.

3. Select File > Load Curves.

4. Set TurboGrid Curve Files > Blade to profile.1.curve.

5. Click OK to load the geometry.

6. Edit Geometry > Blade Set > Shroud Tip.

7. Set Tip Option to Constant Span.

8. Set Span to 0.95.

9. Click Apply.

9.2.3. Creating the Topology and Modifying the Mesh


1. Open Topology Set.

2. Set Topology Definition > Placement to Traditional with Control Points .

This provides access to the legacy topology methods. The other option, ATM Optimized, provides
access to the newest topology method.

3. Set Topology Definition > Method to H/J/C/L-Grid.

4. Click Apply to set the topology.

5. Right-click Topology Set and turn off Suspend Object Updates.

After a short time, the topology is generated.

6. Click Freeze to freeze the topology settings.

7. Double-click Mesh Data to open it for editing. All settings will be changed to use explicit node counts.

8. Configure the following setting(s):

Release 14.5 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
72 of ANSYS, Inc. and its subsidiaries and affiliates.
Part 1: Parametric Study

Tab Option Value


Mesh Method Topology Block Edge
Size Split
Passage Spanwise Blade Distribution Paramet- Element Count and Size
ers > Method
O-Grid > Method Element Count and Size
Shroud Shroud Tip Distribution Para- Element Count and Size
Tip meters > Method

9. Click Apply.

10. Save the state to baseline_mesh.tst.

11. Quit ANSYS TurboGrid.

You now have a state file that sets up a mesh based on profile.1.curve.

The particular blade geometry used by the state file needs only to be representative of the geometries
that will be used in the study because it will be overridden by what is specified in the session file, which
is produced next.

9.2.4. Creating the Session File


1. Start ANSYS TurboGrid.

2. Select Session > New Session from the menu bar to create a new session named generate_mesh.tse.

3. Start recording to the session file by clicking Start Recording .

4. Load the state file that was saved earlier (baseline_mesh.tst).

The session is now at the point where you would typically make a change to the state. In this case,
the change will be to select a new blade curve file. To be able to load a new file, the CCL (CFX
Command Language) block responsible for loading the geometry will be included in the session
file at this point; you will create this CCL block in the next step. With that block created, you can
create a script to control which blade geometry file is loaded by changing the name of the file
within the CCL block. (The script creation is in the next section.)

5. Open Geometry > Blade Set > Blade 1 for editing and click Apply without changing any settings.

6. Click Insert > Mesh.

7. Select File > Save Mesh As and save the mesh with filename mesh.1.gtm with File type set to ANSYS
CFX and Export Units set to cm.

8. Select Tools > Command Editor and enter the following lines in the Command Editor dialog box:

! $minFAngle = minVal("Minimum Face Angle", "/DOMAIN:Passage")*180/3.14159;


! open F,"> mesh_statistics.1.txt";
! print F "minimum face angle in Passage mesh: $minFAngle\n";
! close F;

Release 14.5 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 73
Batch Mode Studies

9. Click Process, then Close. This adds Power Syntax commands that cause Minimum Face Angle to
be written to a file.

10. Stop recording the session file by clicking Stop Recording .

11. Exit ANSYS TurboGrid.

A prompt will suggest that you save the state. You do not have to save the state since this was
done earlier.

You now have a session file that loads the baseline state file, reloads the blade geometry, creates a
mesh, saves the mesh, and generates statistical output for the mesh.

9.2.5. Running the Session File


1. Using a basic text editor, write a script that, in a loop, modifies the blade file name in the session file,
and runs each modified session file using ANSYS TurboGrid in batch mode. You may give this file any
name. The example script shown here is written in Perl:

Note

This script defines and uses a variable, turbogrid, which must be defined as the full
path name to the cfxtg.exe in the bin directory of the ANSYS TurboGrid installation.

#!/usr/bin/perl
# Point to the location of the cfxtg.exe (full pathname),
# usually in <CFXROOT>/bin/
$turbogrid = "C:/Program Files/ANSYS Inc/v145/TurboGrid/bin/cfxtg.exe";
# Initialize the input and output session filenames.
$base_tse = "generate_mesh.tse";
$output_tse = "gen_mesh.tse";

# Get the baseline session file data.


open(BASE_FH, "<$base_tse")
or die "Can't open file (${base_tse}) for input: $!";
@session_data = <BASE_FH>;
close(BASE_FH);

# Loop over each blade geometry file.


foreach $loopindex(1,2){
# Make a copy of the baseline session file
# so we don't destroy the original template.
@copy_data = @session_data;

# Write a session file (based on the original session file) that is


# customized to use the blade associated with this loop.
open(OUTPUT_FH, ">$output_tse")
or die "Can't open file (${output_tse}) for output: $!";
foreach $line (@copy_data) {
chomp($line);
$line =~ s/\.1\./\.${loopindex}\./g;
print OUTPUT_FH "$line\n";
}
close(OUTPUT_FH);

# Run TurboGrid in batch mode with the customized session file.


(system("\"${turbogrid}\" -batch \"${output_tse}\"") == 0)
or die "Batch run of TurboGrid failed ($?): $!";
}
exit 0;

Release 14.5 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
74 of ANSYS, Inc. and its subsidiaries and affiliates.
Part 2: Grid Refinement

2. Run the script shown above by opening a command prompt from the ANSYS TurboGrid Launcher (with
the correct working directory set) and entering the line:

perl <scriptname>

where <scriptname> represents the name of the script file.

The script will take a few minutes to run. When it completes, it will have written two .gtm files to your
working directory, as well as two text files containing the value of the minimum face angle.

9.3. Part 2: Grid Refinement


This part of the tutorial includes:
9.3.1. Starting ANSYS TurboGrid
9.3.2. Defining the Geometry and Topology
9.3.3. Creating the Session File
9.3.4. Running the Session File

9.3.1. Starting ANSYS TurboGrid


1. Prepare the working directory using the files in the examples/rotor37 directory.

For details, see Preparing a Working Directory (p. 1).

2. Set the working directory and start ANSYS TurboGrid.

For details, see Setting the Working Directory and Starting ANSYS TurboGrid (p. 1).

9.3.2. Defining the Geometry and Topology


1. Select File > Load BladeGen.

2. Open the BladeGen.inf file.

3. Edit Geometry > Blade Set > Shroud Tip.

4. Set Tip Option to Constant Span.

5. Set Span to 0.95.

6. Click Apply.

7. Open Topology Set.

8. Set Topology Definition > Placement to Traditional with Control Points .

This provides access to the legacy topology methods. The other option, ATM Optimized, provides
access to the newest topology method.

9. Set Topology Definition > Method to H/J/C/L-Grid.

10. Click Apply to set the topology.

11. Right-click Topology Set and turn off Suspend Object Updates.

Release 14.5 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 75
Batch Mode Studies

After a short time, the topology is generated.

12. Click Freeze to freeze the topology settings.

13. Double-click Mesh Data.

14. Configure the following setting(s):

Tab Option Value


Mesh Method Target Passage Mesh
Size Size
Node Count Specify
Passage Spanwise Blade Distribution Paramet- End Ratio
ers > Method
O-Grid > Method End Ratio
Shroud Shroud Tip Distribution Para- Match Expansion at
Tip meters > Method Blade Tip

15. Click Apply.

16. Save the state to baseline_mesh.tst.

17. Exit ANSYS TurboGrid.

You now have a state file that sets up a mesh based on the default value of the target mesh node
count.

The particular mesh node count target used by the state file will be overridden by what is specified in
a session file, which is produced next.

9.3.3. Creating the Session File


1. Start ANSYS TurboGrid.

2. Create a new session named generate_mesh.tse.

3. Start recording to the session file by clicking Start Recording .

4. Load the state file that was saved earlier (baseline_mesh.tst).

The session is now at the point where you would typically make a change to the state. In this case,
the change will be to select a different target mesh node count. To be able to change the target
mesh node count, the CCL (CFX Command Language) block responsible for specifying the mesh
data settings will be included at this point in the session file; you will do this in the next step. With
that block created, you can create a script to control the target mesh node count by changing the
Target Mesh Node Count CCL parameter in the CCL block. (The script creation is in the next
section.)

5. Double-click Mesh Data to open it and click Apply without changing any settings.

6. Click Insert > Mesh.

Release 14.5 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
76 of ANSYS, Inc. and its subsidiaries and affiliates.
Part 2: Grid Refinement

7. Select File > Save Mesh As and save the mesh as outputmesh.1.gtm with File type set to ANSYS
CFX and Export Units set to cm.

8. Select Tools > Command Editor and enter the following lines in the Command Editor dialog box:

! $minFAngle = minVal("Minimum Face Angle", "/DOMAIN:Passage")*180/3.14159;


! $nodeCount = count("/DOMAIN:Passage");
! open F,"> meshstatistics.1.txt";
! print F "minimum face angle in Passage mesh: $minFAngle\n";
! print F "number of nodes in Passage mesh: $nodeCount\n";
! close F;

9. Click Process, then Close. This adds Power Syntax commands that cause Minimum Face Angle and
the node count to be written to a file.

10. Stop recording the session file by clicking Stop Recording .

11. Exit ANSYS TurboGrid.

A prompt will suggest that you save the state. You do not have to save the state since this was
done earlier.

You now have a session file that loads the baseline mesh state file, reapplies the Mesh Data settings,
creates a mesh, saves the mesh, and generates statistical output for the mesh.

9.3.4. Running the Session File


1. Write a script that, in a loop, modifies the target passage node count in the session file, and runs each
modified session file using ANSYS TurboGrid in batch mode. The example script shown here is written
in Perl:

Note

In the following script, the two lines following the commented line
#### The next two lines ... #### are meant to be entered as a single line.
Also, this script defines and uses a variable, turbogrid, which must be defined as the
full pathname to the cfxtg (cfxtg.exe) file in the bin directory of the installation.

#!/usr/bin/perl
# Point to the location of the cfxtg.exe (full pathname),
# usually in <CFXROOT>/bin/cfxtg.exe
$turbogrid = "C:/Program Files/ANSYS Inc/v145/TurboGrid/bin/cfxtg.exe";
# Initialize the input and output session filenames.
$base_tse = "generate_mesh.tse";
$output_tse = "gen_mesh.tse";
# This is a list of the target node values to be used.
@target_nodes = (50000, 100000, 200000);
# Get the baseline session file data.
open(BASE_FH, "<$base_tse")
or die "Can't open file (${base_tse}) for input: $!";
@session_data = <BASE_FH>;
close(BASE_FH);
# Loop over each target node value.
$loopindex = 1;
foreach $target (@target_nodes) {
# Make a copy of the baseline session file
# so we don't destroy the original template.
@copy_data = @session_data;

Release 14.5 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 77
Batch Mode Studies

# Write a session file (based on the original session file) that is


# customized to use the target node count associated with this loop.
open(OUTPUT_FH, ">$output_tse")
or die "Can't open file (${output_tse}) for output: $!";
foreach $line (@copy_data) {
chomp($line);
$line =~ s/\.1\./\.${loopindex}\./g;
#### The next two lines should be combined into one single line. ####
$line =~ s/Target Mesh Node Count =
[0-9][0-9]*/Target Mesh Node Count = ${target}/g;
print OUTPUT_FH "$line\n";
}
close(OUTPUT_FH);
# Run TurboGrid in batch mode with the customized session file.
(system("\"${turbogrid}\" -batch \"${output_tse}\"") == 0)
or die "Batch run of TurboGrid failed ($?): $!";
# Prepare for next loop iteration.
$loopindex++;
}
exit 0;

2. Run the script shown above by opening a command prompt from the ANSYS TurboGrid Launcher (with
the correct working directory set) and entering the line:

perl <scriptname>

where <scriptname> represents the name of the script file.

The script will take a few minutes to run. When it completes, it will have written some .gtm files to
your working directory, as well as some text files containing the value of the minimum face angle and
the number of nodes in the mesh.

Release 14.5 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
78 of ANSYS, Inc. and its subsidiaries and affiliates.

You might also like