CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   CFX (http://www.cfd-online.com/Forums/cfx/)
-   -   Saving of monitor points in batch mode. (http://www.cfd-online.com/Forums/cfx/26765-saving-monitor-points-batch-mode.html)

Martijn December 5, 2008 10:44

Saving of monitor points in batch mode.
 
Hi all,

I am trying to run several simulations in batch mode via Perl. After one simulation is finished the value of some variables calculated in the finished run should be used to determine which simulation has to be started next. I made a monitor point from these points. I can not find a way to export this data in batch mode. Does anyone know how to solve this problem?

I am using CFX 11.

Thanks in advance,

Martijn

CycLone December 5, 2008 21:47

Re: Saving of monitor points in batch mode.
 
You can extract the monitor data from the results but a better solution would be to run a session file in CFX-Post in batch mode (with some Perl commands to write the data to file).

By the way, there is capability coming with version 12 (configurations) that will allow you to set this all up in advance in CFX-Pre!

-CycLone

Joey2007 December 8, 2008 07:54

Re: Saving of monitor points in batch mode.
 
Go on launer -> command line. type cfx5dfile -help. There is a command read-mon or something like that. You got text with all monitor data. With a little experience in data processing and programming you will be able to extract the data you want.

Heard that 12 there will be improvement.


Martijn December 10, 2008 11:36

Re: Saving of monitor points in batch mode.
 
Thanks!

With the following (part of a) perl file I could read my monitor points:

system("cfx5dfile LastResidu.res -read-monitor -output output.csv");

open (Outputcsvfile, "output.csv") || die "couldn't open the file!";

$NumberOfLinesInFile=0; while ($record = <Outputcsvfile>) {

$NumberOfLinesInFile=$NumberOfLinesInFile+1; }

$LineNumber=0; while ($record = <Outputcsvfile>) { # Loop over regels

$record2=$record;

$LineNumber=$LineNumber+1;

if ($LineNumber eq $NumberOfLinesInFile) {

@field = parse_csv($record);

chomp(@field);

$DispLastIteration=$field[172]; # $field now contains the last iteration value of a certain monitor point.

} }

exit;

sub parse_csv {

my $text = shift;

my @new = ();

push( @new, $+ ) while $text =~ m{

"([^\"\\]*(?:\\.[^\"\\]*)*)",?

| ([^,]+),?

| ,

}gx;

push( @new, undef ) if substr( $text, -1, 1 ) eq ',';

return @new; }


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