This blog is the continuation of the series of blogs on the pump cavitation analysis in ANSYS CFX and to automate this process by using CEL (CFX Expression Language) and Perl script. The previous blogs can be found under the following links;
In this blog we are introducing to the automation of the pump cavitation analysis in ANSYS CFX by using CEL (CFX Expression Language) and Perl script.
4.1 Inserting new CEL (CFX Expression Language) Expression:
Or right click on Expressions in Outline tree and go to Expressions > Insert > Expression
This will then open a new dialogue box; select the name of the Expression as “InletPressure” and click OK.
Choose the appropriate inlet pressure in the definition tab of the details of the expression and click Apply. Choose the appropriate units for inlet pressure and remember use the square brackets “[ ]”.
4.2 Exporting CCL (CFX Command Language) File:
Or right click on Expressions in Outline tree and go to Expressions > Export CCL
This will then open a new dialogue box; choose the location of the directory, file name and also choose SIMULATION > EXPRESSIONS AND FUNCTIONS > EXPRESSION and click Save.
4.3 Editing CCL file:
Open the “150kPa.ccl” file in text editor and replace 150 [kPa] by 125 [kPa] in the InletPressure expression definition, and save the file as “125kPa.ccl”. Repeat this process for 100 [kPa], 75 [kPa], 65 [kPa] and 60 [kPa].
4.4 Creating Perl Script File:
Open a blank Notepad or any other text editor file and type in the following text:
system “cfx5solve -def CFX_CAV_On.def -ccl 150kPa.ccl -ini CFX_CAV_Off_001.res -name CFX_CAV_On_150kPa”;
system “cfx5solve -def CFX_CAV_On.def -ccl 125kPa.ccl -ini CFX_CAV_On_150kPa_001.res -name CFX_CAV_On_125kPa”;
system “cfx5solve -def CFX_CAV_On.def -ccl 100kPa.ccl -ini CFX_CAV_On_125kPa_001.res -name CFX_CAV_On_100kPa”;
system “cfx5solve -def CFX_CAV_On.def -ccl 75kPa.ccl -ini CFX_CAV_On_100kPa_001.res -name CFX_CAV_On_75kPa”;
system “cfx5solve -def CFX_CAV_On.def -ccl 65kPa.ccl -ini CFX_CAV_On_75kPa_001.res -name CFX_CAV_On_65kPa”;
system “cfx5solve -def CFX_CAV_On.def -ccl 60kPa.ccl -ini CFX_CAV_On_65kPa_001.res -name CFX_CAV_On_60kPa”;
Save this file as “runsolver.pl” in the directory where you would like to run the analysis. This directory should also contain the following files;
- CFX_CAV_On.def (The definition file created with cavitation model turned on as explained in the tutorial “Pump Cavitation Analysis in ANSYS CFX (Part II)”.
- .ccl files as explained in the section 4.3
- CFX_CAV_Off_001.res (The results file created with cavitation model turned ff as explained in the tutorial “Pump Cavitation Analysis in ANSYS CFX (Part I)”.
Please note that we have used “Perl Syntax” and “CFX command line syntax” to write the code above. For further details on CFX command line syntax please refer to ANSYS CFX Solver Manager User’s Guide and search for “Command-Line Options and Keywords for cfx5solve”.
4.5 Running Perl Script:
Open CFX launcher from the Start menu of your computer and select the working directory where you have saved the Perl script and other files as explained in section 4.4.
Go to: Tools > Command Line
Write the following command and press Enter.
This will start CFX solver in the batch mode, starting CFX_CAV_On.def with the CCL file overriding the CFX_CAV_On.def file and initialising from the CFX_CAV_Off_001.res file.
4.5 Viewing the Solver Progress: