CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

how to export every data w.r.t time to txt file

Register Blogs Community New Posts Updated Threads Search

Like Tree6Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 28, 2010, 15:32
Default
  #41
New Member
 
Germán González Silva
Join Date: Mar 2010
Location: Campinas-SP
Posts: 20
Rep Power: 16
germangsilva is on a distinguished road
Send a message via MSN to germangsilva
hi Carlitos

I'm doing studies of fluidized bed (gas-solid), I'm using cfx11 or 12, and applying LES, but I have great difficulty setting the program cfx, I ask your help please. my email is germangsilva@gmail.com
germangsilva is offline   Reply With Quote

Old   July 29, 2010, 04:04
Default
  #42
Senior Member
 
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 449
Rep Power: 20
mvoss is on a distinguished road
sorry,.. wrong thread.
mvoss is offline   Reply With Quote

Old   September 29, 2010, 17:49
Default
  #43
Senior Member
 
Joshua Counsil
Join Date: Jul 2009
Location: Halifax, Nova Scotia, Canada
Posts: 366
Rep Power: 18
Josh is on a distinguished road
This is a helpful thread, guys.

However, my problem is that I want to export the pressure and friction coefficients from a polyline of a transient simulation for averaging. Can this be done in Post? You can't create a polyline in Pre.

The only idea I've had so far (besides manually exporting each Cp/Cf graph at each timestep) is to use the Export Results option in Pre to export my pressure and wall shear surface data on the airfoil at each timestep. I'm not sure this would even produce the desired files.

Any help is much appreciated!
Josh is offline   Reply With Quote

Old   September 30, 2010, 04:00
Default
  #44
Senior Member
 
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 449
Rep Power: 20
mvoss is on a distinguished road
hi,

you can either use a session-file-script or the transient graph option within CFX-Post.

neewbie
mvoss is offline   Reply With Quote

Old   September 30, 2010, 05:45
Default
  #45
Senior Member
 
Joshua Counsil
Join Date: Jul 2009
Location: Halifax, Nova Scotia, Canada
Posts: 366
Rep Power: 18
Josh is on a distinguished road
Thanks for the reply, neewbie (I feel weird calling you that since you obviously are more adept with CFX than I am).

I've avoided scripting as I have a terrible fear of programming, particularly PERL.

Doesn't the transient graph option only work for single values (e.g., maximum pressure versus time)? I need the entire Cp/Cf distribution on the airfoil at every timestep.
Josh is offline   Reply With Quote

Old   September 30, 2010, 05:56
Default
  #46
Senior Member
 
Lance
Join Date: Mar 2009
Posts: 669
Rep Power: 22
Lance is on a distinguished road
Hi,
use the PERL script in the beginning of this thread (CycLone, February 13, 2008, 16:00). - No need for you to do any PERL programming, just copy/paste
I use it often to export lines, polylines, or even surfaces from my transient simulations.
Lance is offline   Reply With Quote

Old   September 30, 2010, 06:06
Default
  #47
Senior Member
 
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 449
Rep Power: 20
mvoss is on a distinguished road
hi also Senior Member (which i think feels weird ),

no need to fear PERL. Basicly your task is pretty easy.
1. open post
2. activate the session recording.
3.1. open the res. file
3.2. create the line, do the math and create one graph
3.3. export the graph via "export data to csv" (not sure about the nomenclature) and name it by smth. appropriate
4. stop recording
5. open the session file and include after the LOAD of the res.-file
Code:
!     $List = getValue("DATA READER","Timestep List"); #this looks for all trn.files
!    print "$List \n"; #shows the result of the search
!    @Wert = split(/,/,$List); #makes it accessible for further tasks
!    $lastFrame=$List[$#timestepList]; # very nice, this gives you the number of the last frame, nice for animations
!    foreach $List(@Wert){ #the MAINTASK, do the line and graph and export for every trn.file, see below
>         load timestep = $List #load the timestep
!         print "calculating for TIMESTEP $List \n";
!        ($time, $timeunits) = evaluate("Time");
now comes the session recording of the line, graph and export, so just adjust the name of the exportfile to $List

add an
[/CODE]
! }
[/CODE]
at the very end of the file.
Save the file in your working directory, start the CFX-CommandLine and execute the script by cfx5post - batch script.txt



neewbie
mvoss is offline   Reply With Quote

Old   October 1, 2010, 02:42
Default
  #48
Senior Member
 
Joshua Counsil
Join Date: Jul 2009
Location: Halifax, Nova Scotia, Canada
Posts: 366
Rep Power: 18
Josh is on a distinguished road
Hi guys -

Thanks for the helpful replies.

Neewbie -

The first file writes fine when I run the batch, but then I receive the following error:

-- ERROR -- CCL parser failed with message:
parseCCLLineH: syntax error near "[/CODE]"

It's just a simple syntax error, apparently, but I can't see anything wrong.

Here's my altered code:
____________________________________________

# Session file started: 2010/09/30 23:56:19
# CFX-12.1 build 2009.10.15-23.08

# 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 = 12.0
END

DATA READER:

Clear All Objects = false
Append Results = false
Edit Case Names = false
Open to Compare = false
Multi Configuration File Load Option = Last Case
Open in New View = true
Keep Camera Position = true
Load Particle Tracks = true
Files to Compare =
END

DATA READER:
Domains to Load=
END
> load filename=C:\Users\counsil\Documents\Thesis Simulations\First Paper\Re=5E4\\
AoA=5\SST\NACA0012_Re=5E4_AoA=5_SST_2D_files\dp0\C FX-1\CFX\Fluid Flow_016.res, \
force_reload=true

! $List = getValue("DATA READER","Timestep List"); #this looks for all trn.files
! print "$List \n"; #shows the result of the search
! @Wert = split(/,/,$List); #makes it accessible for further tasks
! $lastFrame=$List[$#timestepList]; # very nice, this gives you the number of the last frame, nice for animations
! foreach $List(@Wert){ #the MAINTASK, do the line and graph and export for every trn.file, see below
> load timestep = $List #load the timestep
! print "calculating for TIMESTEP $List \n";
! ($time, $timeunits) = evaluate("Time");

>readstate filename=C:\Users\counsil\Documents\Thesis Simulations\First Paper\Re=\
5E4\AoA=5\SST\NACA0012_Re=5E4_AoA=5_SST_2D_files\d p0\CFX-1\CFX\\
Polyline_Cp_Cf.cst, mode = overwrite, load = false, keepexpressions = true

EXPORT:
ANSYS Export Data = Element Heat Flux
ANSYS File Format = ANSYS
ANSYS Reference Temperature = 0.0 [K]
ANSYS Specify Reference Temperature = Off
ANSYS Supplemental HTC = 0.0 [W m^-2 K^-1]
BC Profile Type = Inlet Velocity
Export Connectivity = Off
Export Coord Frame = Global
Export File = C:\Users\counsil\Documents\Thesis Simulations\First Paper\Re=\
5E4\AoA=5\SST\NACA0012_Re=5E4_AoA=5_SST_2D_files\d p0\CFX-1\CFX\$List
Export Geometry = On
Export Node Numbers = Off
Export Null Data = On
Export Type = Generic
Export Units System = Current
Export Variable Type = Current
Include File Information = Off
Include Header = On
Location List = /POLYLINE:Polyline 1
Null Token = null
Overwrite = On
Precision = 8
Separator = ", "
Spatial Variables = X,Y,Z
Variable List = Cf, Cp, Length, xc
Vector Brackets = ()
Vector Display = Scalar
END
>export


# Session file stopped: 2010/09/30 23:58:12

[/CODE]
! }
[/CODE]

_____________________________________

It's probably a very simple mistake, but, like I mentioned, I'm a pretty useless programmer.
nuaawubin likes this.
Josh is offline   Reply With Quote

Old   October 1, 2010, 02:49
Default
  #49
Senior Member
 
Joshua Counsil
Join Date: Jul 2009
Location: Halifax, Nova Scotia, Canada
Posts: 366
Rep Power: 18
Josh is on a distinguished road
Well, like I said... I'm a useless programmer. After rereading my post, I realized I copied the "[/CODE]" part when I should have only copied the "! }"

Let that be a lesson not to debug late at night!

Thanks for everything, guys. Code works great.
Josh is offline   Reply With Quote

Old   October 1, 2010, 03:32
Default
  #50
Senior Member
 
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 449
Rep Power: 20
mvoss is on a distinguished road
hi

... yes, the [CODE] snippet is from the online formular.
I suppose it´s running??
Check back for further questions.

neewbie
mvoss is offline   Reply With Quote

Old   October 1, 2010, 04:34
Default
  #51
Senior Member
 
Joshua Counsil
Join Date: Jul 2009
Location: Halifax, Nova Scotia, Canada
Posts: 366
Rep Power: 18
Josh is on a distinguished road
Well, the only questions I have are regarding expediting the process. If you feel like it...

Suppose I want to average all of the .csv files into one. I know I can write an external code with Python, e.g., to do this, but can it be done directly in the batch file?
Josh is offline   Reply With Quote

Old   October 1, 2010, 04:57
Default
  #52
Senior Member
 
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 449
Rep Power: 20
mvoss is on a distinguished road
hi,

the thing is, that the batch doesn't know about the exported values. so, yes, you have to run another script for all of the csv files
OR
you create a lot of points, representing the "exported" line, link them to an expression like

! $CP=getExprVal("CP");
! $CP_POINT1=probe($CP, Point1);
store every "Point" in a separate list, average over the list.
But maybe you can do this way more easily in, ... let´s say EXCEL, if you have to do it only once.

neewbie
mvoss is offline   Reply With Quote

Old   October 1, 2010, 06:11
Default
  #53
Senior Member
 
Joshua Counsil
Join Date: Jul 2009
Location: Halifax, Nova Scotia, Canada
Posts: 366
Rep Power: 18
Josh is on a distinguished road
Thanks so much, MV. Cheers.
Josh is offline   Reply With Quote

Old   November 2, 2010, 20:52
Default
  #54
New Member
 
hun
Join Date: May 2009
Posts: 27
Rep Power: 17
hung is on a distinguished road
Quote:
Originally Posted by Lance View Post
Hi,
use the PERL script in the beginning of this thread (CycLone, February 13, 2008, 16:00). - No need for you to do any PERL programming, just copy/paste
I use it often to export lines, polylines, or even surfaces from my transient simulations.
hi
Is anything changed with new version of CFX?
Couple of months ago I still run this command without any problems.
Now I got version 12.1 ANSYS and it seems something wrong here.
thanks
hung is offline   Reply With Quote

Old   November 3, 2010, 04:25
Default
  #55
Senior Member
 
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 449
Rep Power: 20
mvoss is on a distinguished road
hi,

which command? Afaik: there is a change in the nomenclature for variables e.g. the molar density.

neewbie
mvoss is offline   Reply With Quote

Old   November 4, 2010, 19:33
Default
  #56
New Member
 
hun
Join Date: May 2009
Posts: 27
Rep Power: 17
hung is on a distinguished road
Quote:
Originally Posted by CycLone
;86065
Here's a crude session that will do the trick. Copy and paste it into your command window in Post and substitute your starting and finishing iteration numbers as well as your desire filename. Leave the "$i" in the name, as I have done below; Post will substitute the current value of the PERL variable $i into the name when it writes the file. You should first do a manual export to select the variables you want.

!$start = 0;
!$finish = 100;

!for($i=$start,$i<=$finish,$i++) {
> load timestep=$i

EXPORT:
Export File = export_$i.csv
END
>export
!}

-CycLone

This command.
I used to run this commands before.
hung is offline   Reply With Quote

Old   November 5, 2010, 03:01
Default
  #57
Senior Member
 
Lance
Join Date: Mar 2009
Posts: 669
Rep Power: 22
Lance is on a distinguished road
Quote:
Originally Posted by hung View Post
This command.
I used to run this commands before.
note that the code should be:

!for($i=$start;$i<=$finish;$i++) {

that is, semicolon between the variables, not comma.
(at least for me...)
Lance is offline   Reply With Quote

Old   November 7, 2010, 23:25
Default
  #58
New Member
 
hun
Join Date: May 2009
Posts: 27
Rep Power: 17
hung is on a distinguished road
Quote:
Originally Posted by Lance View Post
note that the code should be:

!for($i=$start;$i<=$finish;$i++) {

that is, semicolon between the variables, not comma.
(at least for me...)

thanks
it works
hung is offline   Reply With Quote

Old   February 25, 2011, 07:24
Default error in Linux
  #59
Member
 
Join Date: Aug 2010
Posts: 31
Rep Power: 16
Turbomachine is on a distinguished road
Dear All!

I was trying to run the macro below as you suggested earlier in the topic:


COMMAND FILE:
CFX Post Version = 12.1
END
DATA READER:
Clear All Objects = false
Append Results = false
Edit Case Names = false
Open to Compare = false
Multi Configuration File Load Option = Last Case
Open in New View = true
Keep Camera Position = true
Load Particle Tracks = true
Files to Compare =
END
DATA READER:
Domains to Load = R1
END

! $PathSeparator = "/";
! $ResFileName = getValue("DATA READER", "Current Results File");
! $ResPos = index($ResFileName, ".res");
! $ResFileLength = length($ResFileName);

! if ($ResPos == ($ResFileLength - 4)){
! $FileBase = substr($ResFileName, 0, $ResFileLength-4);
! }
! else {
! $FileBase = $ResFileName ;
! }
! $DirName = $FileBase . "_EXPORT2";
! mkdir ($DirName, 0777);
! $DirName = $DirName . $PathSeparator;



! $count = 567;

! @tlistt = (567, 568, 569, 570, 571);

! foreach $tlist (@tlistt){

DATA READERATA READER
Current Timestep = $tlist
END
> load

! $dummyfile = $DirName . "t" . $count.".csv";

EXPORT:
#ANSYS Export Data = Element Pressure
#ANSYS Export Locator = wallmeshcdb
#ANSYS Fluid Selection = All Fluids
#ANSYS Reference Temperature = 0.0 [C]
#ANSYS Specify Reference Temperature = Off
Export Type = Generic
#BC Profile Type = Inlet Velocity
Export Connectivity = Off
Export Coord Frame = Global
Export File = $dummyfile
Export Geometry = Off
Export Node Numbers = Off
Export Null Data = Off
Export Units System = Current
#Export Variable Type = Hybrid
Include File Information = Off
Include Header = On
Location List = Blade1
Null Token = 0
Overwrite = On
Precision = 10
Separator = ", "
Spatial Variables = X,Y,Z
Variable List = Pressure, Total Mesh Displacement X, Total Mesh Displacement Y, Total Mesh Displacement Z, Normal X, Normal Y, Normal Z
Vector Brackets = ()
Vector Display = Scalar
END
>export

! $count = $count + 1;

! }



However I get an error below:


https://lh6.googleusercontent.com/_k...icture%202.png


Can anyone help me point out the problem?

Thank you very much
Turbomachine is offline   Reply With Quote

Old   February 25, 2011, 11:57
Default Hi
  #60
Member
 
Dynampally Pavitran
Join Date: Mar 2010
Location: India
Posts: 74
Rep Power: 16
pavitran is on a distinguished road
Hi,

you can find the same post in page 2 also, however I am repeating the same thing again

copy the below macro in between hashes #, to some "file.cse" and copy file.cse to the directory where your *.trn files are located.

Being in the same directory, at the UNIX or Windows command line just type

cfx5post -batch file.cse ####for v11.0

cfx512post -batch file.cse ####for v12.0

cfx5121post -batch file.cse #### I guess for v12.1

As soon as you execute this and if everything is fine, I mean your location name , then on the screen you can see which case is presently in process.

eg:
:> cfx5post -batch file.cse
567
568
:>


Note : Before executing the above command, be sure to export DISPLAY, if using "putty" to connect to the LINUX machine.

export DISPLAY=IP:0.0 # IP address of windows machine

####################################
COMMAND FILE:
CFX Post Version = 12.1
END
DATA READER:
Clear All Objects = false
Append Results = false
Edit Case Names = false
Open to Compare = false
Multi Configuration File Load Option = Last Case
Open in New View = true
Keep Camera Position = true
Load Particle Tracks = true
Files to Compare =
END
DATA READER:
Domains to Load = R1
END

! for ($i=567; $i <= 571; $i=$i+1) {
! $file ="$i\_Full.trn" # eg: this loads 567_Full.trn file
! print "$file \n";
> load filename=$file, force_reload=true
EXPORT:
#ANSYS Export Data = Element Heat Flux
#ANSYS Reference Temperature = 0.0 [K]
#ANSYS Specify Reference Temperature = Off
# ANSYS Supplemental HTC = 0.0 [W m^-2 K^-1]
# BC Profile Type = Inlet Velocity
Export Connectivity = Off
Export Coord Frame = Global
Export File = $i.csv # Export file name with increment
Export Geometry = Off
Export Node Numbers = Off
Export Null Data = Off
Export Type = Generic
Export Units System = Current
Export Variable Type = Current
Include File Information = Off
Include Header = On
Location List = Blade1
Null Token = 0
Overwrite = On
Precision = 10
Separator = ","
Spatial Variables = X,Y,Z
Variable List = Pressure, Total Mesh Displacement X, Total Mesh Displacement Y, Total Mesh Displacement Z, Normal X, Normal Y, Normal Z
Vector Brackets = ()
Vector Display = Scalar
END
>export
!}
############################################
pavitran is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[swak4Foam] swak4foam building problem GGerber OpenFOAM Community Contributions 54 April 24, 2015 17:02
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07:20
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 20:08
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 02:24
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07


All times are GMT -4. The time now is 16:02.