CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   CFX (http://www.cfd-online.com/Forums/cfx/)
-   -   ANSYS CFX POST write an output file with perl (http://www.cfd-online.com/Forums/cfx/120923-ansys-cfx-post-write-output-file-perl.html)

say July 17, 2013 09:35

ANSYS CFX POST write an output file with perl
 
Hi
I'm trying to write a session in POST. The Script should average over some Contour Levels some values and then it should write the values into a file, called "file.txt". I've already written some lines but it doesn't work. can anybody help me please.

! open (RB, '>>D:\TXT\RB_data.txt');

!for ($i=1 ; $i<=$x; $i++) {

USER SURFACE:USRadius
Apply Instancing Transform = On
Apply Rotation = On
Apply Scale = On
Apply Texture = Off
Apply Translation = Off
Associated Boundary = Out Hub
Associated Boundary Specified = On
Blend Texture = On
Colour = 0, 0.8, 0
Colour Map = Default Colour Map
Colour Mode = Constant
Colour Scale = Linear
Colour Variable = Pressure
Colour Variable Boundary Values = Hybrid
Contour Level = $i
Contour Name = /CONTOUR:CONRadius
Culling Mode = No Culling
Domain List = /DOMAIN GROUP:All Domains
Draw Faces = On
Draw Lines = Off
File Units = m
Input File =
Instancing Transform = /DEFAULT INSTANCE TRANSFORM:Default Transform
Lighting = On
Line Colour = 0, 0, 0
Line Colour Mode = Default
Line Width = 1
Maintain Conservative Values = Off
Max = 0.0 [Pa]
Min = 0.0 [Pa]
Offset Direction = 1 , 0 , 0
Offset Distance = 0.0 [m]
Offset Mode = Uniform
Offset Type = Normal
Option = From Contour
Principal Axis = Z
Range = Global
Render Edge Angle = 0 [degree]
Rotation Angle = 0 [degree]
Rotation Axis From = 0 [m], 0 [m], 0 [m]
Rotation Axis To = 1 [m], 0 [m], 0 [m]
Rotation Axis Type = Principal Axis
Scale Factor = 1.0
Specular Lighting = On
Surface Drawing = Smooth Shading
Texture Angle = 0
Texture Direction = 0 , 1 , 0
Texture File =
Texture Material = Metal
Texture Position = 0 , 0
Texture Scale = 1
Texture Type = Predefined
Tile Texture = Off
Transform Texture = Off
Translation Vector = 0 [m], 0 [m], 0 [m]
Transparency = 0.0
Use Mid Side Nodes = On
OBJECT VIEW TRANSFORM:
Apply Reflection = Off
Apply Rotation = On
Apply Scale = On
Apply Translation = Off
Principal Axis = Z
Reflection Plane Option = XY Plane
Rotation Angle = 0 [degree]
Rotation Axis From = 0 [m], 0 [m], 0 [m]
Rotation Axis To = 1 [m], 0 [m], 0 [m]
Rotation Axis Type = Principal Axis
Scale Vector = 1 , 1 , 1
Translation Vector = 0 [m], 0 [m], 0 [m]
X = 0.0 [m]
Y = 0.0 [m]
Z = 0.0 [m]
END
END

#---------------------------------------
#Expressions
#---------------------------------------

LIBRARY:
CEL:
EXPRESSIONS:
AveTotPres = massFlowAve(Total Pressure)/@USRadius
END
END
END
 
! print RB "$AveTotPres" "\n ;
 
!}

! close (RB);

What's wrong there?
thanks


mjgraf July 17, 2013 16:40

you wrapped your AveTotPres in the expression tags. This created the expression in CFX and can not be called using perl variable syntax.

You either have to create the power syntax for the expression or use the getExprVal() function to set a perl variable to the expression value.

where is $x defined?
I do my variable to file differently but yours is fine.

open file
if () {
user surface
! $AveTotPres = massFlowAve("Total Pressure","USRadius");
! print RB "$AveTotPres\n";
}
close file


All times are GMT -4. The time now is 06:00.