CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   Output force as a function of time (https://www.cfd-online.com/Forums/cfx/21852-output-force-function-time.html)

Andrew November 21, 2005 22:54

Output force as a function of time
 
I've been trying to export force on a body as a function of time from CFX-10 with little success. I can get the data I want as a txt file if I export from a chart (using expression eg. forze_z@body wall vs. time), but...I want to fully automate this to fit in with the rest of my automisation scheme i.e. not need to open post.

Help Appreciated


test November 23, 2005 00:31

Re: Output force as a function of time
 
Hi,

You can do this using a simple perl script which has to loop over different transient result files. contact your local support office and you should get one easily.

Regards, test

James Date November 23, 2005 18:12

Re: Output force as a function of time
 
I posted this a while back.

To take the forces from each of the transient output files use something like the script written below.

You need a session file and a DOS batch file.

--------------------------------------------------

# Session file started: 2004/10/21 10:38:42 # CFX-5.7 build 2004.04.01-23.00

! open (DATAFILE,">>Datafile.txt") or die "File Error\n";

! $filePath = getValue("DATA READER","Current Results File");

! $torque_x = torque("Rotor","X");

! $torque_y = torque("Rotor","Y");

! $torque_z = torque("Rotor","Z");

! $force_x = force("Rotor","X");

! $force_y = force("Rotor","Y");

! $force_z = force("Rotor","Z");

! $Cp_chord_wise = $torque_z/$force_y;

! $Cp_span_wise = $torque_x/$force_y;

! format DATAFILE= ! @>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> @>>>>>>>>>>>>> @>> @>>>>>>>>>>>>> @>> @>>>>>>>>>>>>> @>> @>>>>>>>>>>>>> @>> @>>>>>>>>>>>>> @>> @>>>>>>>>>>>>> @>> @>>>>>>>>>>>>> @>> @>>>>>>>>>>>>> ! "Full Path and Run Number", "Force-X (N)", "", "Force-Y (N)", "", "Force-Z (N)", "", "Torque-X (N*M)", "", "Torque-Y (N*M)", "", "Torque-Z (N*M)", "", "Cp-Chord (M)", "", "Cp-Span (M)" ! @>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> @.############ @>> @.############ @>> @.############ @>> @.############ @>> @.############ @>> @.############ @>> @.############ @>> @.############ ! $filePath, $force_x, "", $force_y, "", $force_z, "", $torque_x, "", $torque_y, "", $torque_z, "", $Cp_chord_wise, "", $Cp_span_wise !.

! write DATAFILE;

! close DATAFILE;

>quit

# Session file stopped: 2004/10/21 10:40:42

--------------------------------------------------

DOS Batch File

--------------------------------------------------

@ECHO Off

C:\CFX\CFX-5.7\bin\cfx5post -batch T:\ANSYS_CFX\Post_session.cse T:\ANSYS_CFX\1\1_001.res

C:\CFX\CFX-5.7\bin\cfx5post -batch T:\ANSYS_CFX\Post_session.cse T:\ANSYS_CFX\2\2_001.res

--------------------------------------------------

You could gave done some kind of perl loop, but i figured this was quicker to do.

Regards James


HR December 6, 2005 15:16

Re: Output force as a function of time
 
If you can do it interactively, then you can do in the batch mode as well. All you need to do is make a session file out of your interactive session: 1. start Post 2. start recording a session (Session > New Session, then Session > Start Recording) 3. load file, make your chart, export data, etc. 4. quit You can now tweak the recorded session if needed and play it back in batch mode.


A_Prakash August 19, 2013 09:23

I have been fiddling with things in CFD-post. I know just enough about session file to automate the routine tasks I perform.
However, I am now thinking of adding some fool-proofing options via GUI to my .cse file so that a colleague can interact with it through a message box.

Here is my question: How can I use a Perl command to display a simple message box as part of my .cse file execution?

P.S Don't wish to be ignorant.. but, I have been struggling to get to a good staring point on using GUI thru perl. I am completely new to scripting... but, with some help-in-context baby steps.. I know I will be up and running fast... Thanks.


All times are GMT -4. The time now is 23:43.