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

Loop through timesteps in the command editor of CFD-Post and write evaluated function

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 5, 2014, 13:00
Default Loop through timesteps in the command editor of CFD-Post and write evaluated function
  #1
New Member
 
Sagar
Join Date: Apr 2014
Posts: 10
Rep Power: 12
eaysk is on a distinguished road
Hello!

I am trying evaluate the volume averaged water volume fraction for each timestep I have run.
I have written these commands in the command editor of CFD-Post.

#************************************************* *********************

! open(OFH, " >> file.dat"); # writing to a file

# for loop start

! for ($i=100; $i <= 28000; $i=$i+100) {

COMMAND FILE:
CFX Post Version = 14.5.7
END

> load filename=C:\bcp4_3_v4_sr4_omg15_pw3\bcp4_3_v4_sr4_ omg15_pw3 (fi=0.9097)\bcp4_3_v4_sr4_omg15-13-00$i.dat
! $vff= volumeAve(Water.Volume Fraction, "Plane 1");
! printf (OFH "1.8f\n",$vff;
!}

! close(OFH);
#************************************************* *********

I get the error-
ERROR
CCL parser failed with message:
Perl Syntax errors detected:
syntax error at (eval 6235) line 11, at EOF

Could somebody tell me whether I am on the right track with the code? If yes, then how can I correct it?

Cheers.
eaysk is offline   Reply With Quote

Old   April 7, 2014, 07:29
Default
  #2
New Member
 
Sagar
Join Date: Apr 2014
Posts: 10
Rep Power: 12
eaysk is on a distinguished road
I don't see the difference..

I have changed the code now. I get no errors, but nothing is written to file.txt, no matter what I do. Even the simplest of commands such as

!open(FH, '<file.txt');
!printf (FH, "Hello");
!close(FH);

does not print to file!

Here is my new code-

#*************************************************
COMMAND FILE:
CFX Post Version = 14.5.7
END
! my $file=file.txt;
! open(FH, '>$file'); # writing to a file

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

!if($i<1000){
> load filename=C:\bcp4_3_v4_sr4_omg15_pw3\bcp4_3_v4_sr4_ omg15_pw3 (fi=0.9097)\Data files\bcp4_3_v4_sr4_omg15-13-00$i.dat
!}
!elsif($i<10000){
> load filename=C:\bcp4_3_v4_sr4_omg15_pw3\bcp4_3_v4_sr4_ omg15_pw3 (fi=0.9097)\Data files\bcp4_3_v4_sr4_omg15-13-0$i.dat
!}
!else{
> load filename=C:\bcp4_3_v4_sr4_omg15_pw3\bcp4_3_v4_sr4_ omg15_pw3 (fi=0.9097)\Data files\bcp4_3_v4_sr4_omg15-13-$i.dat
!}
! $vol_frac_fluid= areaAve("Water.Volume Fraction", "Plane 1");
!printf(FH "1.8f\n",$vol_frac_fluid);

!}

! close(FH);
#************************************************* *********
eaysk is offline   Reply With Quote

Reply

Tags
cfd - post, command editor, loop, timesteps


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
[Helyx OS] Helyx-OS (GUI for SnappyHexMesh elvis OpenFOAM Community Contributions 210 January 30, 2017 19:57
Guide: Getting Started with the CFD Online Discussion Forums pete Site Help, Feedback & Discussions 8 July 29, 2016 06:00


All times are GMT -4. The time now is 09:08.