TAGGED: ansys-cfx, batch-processing, batch-script, batchmode, cfd-post, hyperloop
-
-
June 22, 2023 at 10:33 pm
Dr Fatima Razavi, PhD in MEC ENG
SubscriberHello,
I have been attempting to automate the export of simulated data from ANSYS CFX using a Perl script and CEL (CFX Expression Language). The code is relatively simple: I'm trying to iterate over 120 timesteps with a difference of 100 between each timestep. For each iteration, I load the corresponding timestep and save the data on a specific plane to a separate CSV file.
I have successfully tested the script for 3 timesteps individually, and it works well. However, when I attempt to implement a loop to iterate over all 120 timesteps, I encounter errors that I have been unable to resolve. These errors seem to be preventing the script from executing correctly.
I would greatly appreciate your assistance in troubleshooting and resolving these errors. If needed, I can provide you with the Perl script, the CEL expressions, or any specific error messages that I'm receiving.
Thank you for your help. My email address is: dr.fatemeh.razavi@gmail.com
#THIS ONE WORKS# Session file started: 2023/06/22 12:37:39# CFX-21.2# To avoid unnecessary file pre-processing and modifications, include# COMMAND FILE at the top of your session file.# If it is not included, the file is assumed to be older and will be# modified for backward compatibility.COMMAND FILE:CFX Post Version = 21.2ENDPLANE:Plane 1Apply Instancing Transform = OnApply Texture = OffBlend Texture = OnBound Radius = 0.5 [m]Colour = 0.75, 0.75, 0.75Colour Map = Default Colour MapColour Mode = VariableColour Scale = LogarithmicColour Variable = Ragweed.Averaged Volume FractionColour Variable Boundary Values = ConservativeCulling Mode = No CullingDirection 1 Bound = 1.0 [m]Direction 1 Orientation = 0 [degree]Direction 1 Points = 10Direction 2 Bound = 1.0 [m]Direction 2 Points = 10Domain List = /DOMAIN GROUP:All DomainsDraw Contours = OffDraw Faces = OnDraw Lines = OffInstancing Transform = /DEFAULT INSTANCE TRANSFORM:Default TransformInvert Plane Bound = OffLighting = OnLine Colour = 0, 0, 0Line Colour Mode = DefaultLine Width = 1Max = 0.0Min = 0.0Normal = 1 , 0 , 0Number of Contours = 11Option = XY PlanePlane Bound = NonePlane Type = SlicePoint = 0 [m], 0 [m], 0 [m]Point 1 = 0 [m], 0 [m], 0 [m]Point 2 = 1 [m], 0 [m], 0 [m]Point 3 = 0 [m], 1 [m], 0 [m]Range = GlobalRender Edge Angle = 0 [degree]Specular Lighting = OnSurface Drawing = Smooth ShadingTexture Angle = 0Texture Direction = 0 , 1 , 0Texture File =Texture Material = MetalTexture Position = 0 , 0Texture Scale = 1Texture Type = PredefinedTile Texture = OffTransform Texture = OffTransparency = 0.0X = 0.0 [m]Y = 0.0 [m]Z = 1.6 [m]OBJECT VIEW TRANSFORM:Apply Reflection = OffApply Rotation = OffApply Scale = OffApply Translation = OffPrincipal Axis = ZReflection Plane Option = XY PlaneRotation Angle = 0.0 [degree]Rotation Axis From = 0 [m], 0 [m], 0 [m]Rotation Axis To = 0 [m], 0 [m], 0 [m]Rotation Axis Type = Principal AxisScale Vector = 1 , 1 , 1Translation Vector = 0 [m], 0 [m], 0 [m]X = 0.0 [m]Y = 0.0 [m]Z = 0.0 [m]ENDEND# Sending visibility action from ViewUtilities>show /PLANE:Plane 1, view=/VIEW:View 1##################> load timestep=30888EXPORT:ANSYS Export Data = Element Heat FluxANSYS File Format = ANSYSANSYS Reference Temperature = 0.0 [K]ANSYS Specify Reference Temperature = OffANSYS Supplemental HTC = 0.0 [W m^-2 K^-1]Additional Variable List =BC Profile Type = Inlet VelocityCSV Type = CSVCase Name = Case 2nd3min7msExport Connectivity = OffExport Coord Frame = GlobalExport File = E:/Fatemeh (Live Runs)/BEST CFD Runs/2023-06-05-Transient-\8Diff-4PartInj-FansSQ-0TO180-7ms/2023-06-05-ExhaustsOnWall-8SwirrlDiffON-\4Aerosolizers-FansFwBw7msSynchronized-FansSQ_003/CSV Files/303.csvExport Geometry = OnExport Location Aliases =Export Node Numbers = OffExport Null Data = OnExport Type = GenericExport Units System = CurrentExport Variable Type = CurrentExternal Export Data = NoneInclude File Information = OffInclude Header = OnLocation = CeilingWallLocation List = /PLANE:Plane 1Null Token = nullOverwrite = OnPrecision = 8Separator = ", "Spatial Variables = X,Y,ZVariable List = Ragweed.Averaged Volume FractionVector Brackets = ()Vector Display = ScalarEND>export
################################
################################################################
#This one does not work as I added the loop in Perl and it gives me many warnings and errors# Session file started: 2023/06/20 11:37:01# CFX-21.2# To avoid unnecessary file pre-processing and modifications, include# COMMAND FILE at the top of your session file.# If it is not included, the file is assumed to be older and will be# modified for backward compatibility.COMMAND FILE:CFX Post Version = 21.2END# Session file stopped: 2023/06/20 11:37:15# Session file started: 2023/06/20 11:37:39# CFX-21.2# To avoid unnecessary file pre-processing and modifications, include# COMMAND FILE at the top of your session file.# If it is not included, the file is assumed to be older and will be# modified for backward compatibility.COMMAND FILE:CFX Post Version = 21.2ENDPLANE:Plane 1Apply Instancing Transform = OnApply Texture = OffBlend Texture = OnBound Radius = 0.5 [m]Colour = 0.75, 0.75, 0.75Colour Map = Default Colour MapColour Mode = VariableColour Scale = LogarithmicColour Variable = Ragweed.Averaged Volume FractionColour Variable Boundary Values = ConservativeCulling Mode = No CullingDirection 1 Bound = 1.0 [m]Direction 1 Orientation = 0 [degree]Direction 1 Points = 10Direction 2 Bound = 1.0 [m]Direction 2 Points = 10Domain List = /DOMAIN GROUP:All DomainsDraw Contours = OffDraw Faces = OnDraw Lines = OffInstancing Transform = /DEFAULT INSTANCE TRANSFORM:Default TransformInvert Plane Bound = OffLighting = OnLine Colour = 0, 0, 0Line Colour Mode = DefaultLine Width = 1Max = 0.0Min = 0.0Normal = 1 , 0 , 0Number of Contours = 11Option = XY PlanePlane Bound = NonePlane Type = SlicePoint = 0 [m], 0 [m], 0 [m]Point 1 = 0 [m], 0 [m], 0 [m]Point 2 = 1 [m], 0 [m], 0 [m]Point 3 = 0 [m], 1 [m], 0 [m]Range = GlobalRender Edge Angle = 0 [degree]Specular Lighting = OnSurface Drawing = Smooth ShadingTexture Angle = 0Texture Direction = 0 , 1 , 0Texture File =Texture Material = MetalTexture Position = 0 , 0Texture Scale = 1Texture Type = PredefinedTile Texture = OffTransform Texture = OffTransparency = 0.0X = 0.0 [m]Y = 0.0 [m]Z = 1.6 [m]OBJECT VIEW TRANSFORM:Apply Reflection = OffApply Rotation = OffApply Scale = OffApply Translation = OffPrincipal Axis = ZReflection Plane Option = XY PlaneRotation Angle = 0.0 [degree]Rotation Axis From = 0 [m], 0 [m], 0 [m]Rotation Axis To = 0 [m], 0 [m], 0 [m]Rotation Axis Type = Principal AxisScale Vector = 1 , 1 , 1Translation Vector = 0 [m], 0 [m], 0 [m]X = 0.0 [m]Y = 0.0 [m]Z = 0.0 [m]ENDEND# Sending visibility action from ViewUtilities>show /PLANE:Plane 1, view=/VIEW:View 1################### Specify the starting timestep and the number of iterationsno warnings 'redefine';use strict;my $startTimestep = 24588;my $numIterations = 5; # Adjust the number of iterations as needed# Loop to load timesteps with a difference of 100for (my $i = 0; $i < $numIterations; $i++) {my $timestep = $startTimestep + ($i * 100);> load timestep = $timestepEXPORT:ANSYS Export Data = Element Heat FluxANSYS File Format = ANSYSANSYS Reference Temperature = 0.0 [K]ANSYS Specify Reference Temperature = OffANSYS Supplemental HTC = 0.0 [W m^-2 K^-1]Additional Variable List =BC Profile Type = Inlet VelocityCSV Type = CSVCase Name = Case 2nd3min7msExport Connectivity = OffExport Coord Frame = Global# Generate the CSV file pathExport File = E:/Fatemeh (Live Runs)/BEST CFD Runs/2023-06-05-Transient-\8Diff-4PartInj-FansSQ-0TO180-7ms/2023-06-05-ExhaustsOnWall-8SwirrlDiffON-\4Aerosolizers-FansFwBw7msSynchronized-FansSQ_003/CSV Files/$timestep.csv"Export Geometry = OnExport Location Aliases =Export Node Numbers = OffExport Null Data = OnExport Type = GenericExport Units System = CurrenExport Variable Type = CurrentExternal Export Data = NoneInclude File Information = OffInclude Header = OnLocation = CeilingWallLocation List = /PLANE:Plane 1Null Token = nullOverwrite = OnPrecision = 8Separator = ", "Spatial Variables = X,Y,ZVariable List = Ragweed.Averaged Volume FractionVector Brackets = ()Vector Display = ScalarEND>export}################################
################################
SAMPLE ERRORS AND WARNINGS
Variable "$timestep" is not imported at (eval 189) line 11.
Variable "$timestep" is not imported at (eval 189) line 24.
Use of uninitialized value $CUEPost::startTimestep in concatenation (.) or string at (eval 193) line 5.
Use of uninitialized value $CUEPost::numIterations in concatenation (.) or string at (eval 193) line 6.
Use of uninitialized value $CUEPost::i in concatenation (.) or string at (eval 193) line 7.
Use of uninitialized value $CUEPost::i in concatenation (.) or string at (eval 193) line 7.
Use of uninitialized value $CUEPost::numIterations in concatenation (.) or string at (eval 193) line 7.
Use of uninitialized value $CUEPost::i in concatenation (.) or string at (eval 193) line 7.
Variable "$startTimestep" is not imported at (eval 217) line 7.
Variable "$numIterations" is not imported at (eval 217) line 8.
Variable "$i" is not imported at (eval 217) line 9.
Variable "$i" is not imported at (eval 217) line 9.
Variable "$numIterations" is not imported at (eval 217) line 9.
Variable "$i" is not imported at (eval 217) line 9.
Variable "$timestep" is not imported at (eval 217) line 10.
Variable "$startTimestep" is not imported at (eval 217) line 10.
Variable "$i" is not imported at (eval 217) line 10.
Variable "$timestep" is not imported at (eval 217) line 11.
Variable "$timestep" is not imported at (eval 217) line 24.
Variable "$i" is not imported at (eval 221) line 9.
Variable "$i" is not imported at (eval 221) line 9.
Variable "$i" is not imported at (eval 221) line 9.
Variable "$timestep" is not imported at (eval 221) line 10.
Variable "$i" is not imported at (eval 221) line 10.
Variable "$timestep" is not imported at (eval 221) line 11.
Variable "$timestep" is not imported at (eval 221) line 24. -
June 23, 2023 at 7:53 am
rosa bella
SubscriberI've been checking this blog on a frequent basis and I'm amazed at 2048! Very fascinating stuff, particularly the final section.
-
- You must be logged in to reply to this topic.

Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- License Error
- Error with workbench SceneGraphChart
- Sizing on Ansys Workbench 19.2
- Workbench not opening
- Error: Exception of type ‘Ansys.Fluent.Cortex.Cortex not availableException’ was thrown
- Workbench error
- how to open DesignModeler
- FlexNet Licensing – Not running
- Problem with FlexNet Licensing
- An error occurred when the post processor attempted to load a specific result.
-
7584
-
4434
-
2951
-
1422
-
1322
© 2023 Copyright ANSYS, Inc. All rights reserved.