CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   command editor (https://www.cfd-online.com/Forums/cfx/66446-command-editor.html)

fkonias July 15, 2009 12:37

command editor
 
Hi all,
I am trying to create some sessions of my own in the command editor, but I do not know the commands and some general stuff…

1) Is there a command like Fortran’s “do”?

2) for example I wrote :

DATA READER:
CASE:Case 50_202pN_001
DOMAIN:Apomastefsi S3
Components to Ignore = Apomastefsi S3
Components to Update =
END
END
END

This works fine. But when I load a different case which means different case name (“Case 50_202pN_001” ), then as expected there are errors! I tried to replace the “Case 50_202pN_001” with “$case” but it didn’t work. Is there a way to bypass this problem? Is there a way to make these lines compatible with ANY case without changing the case name manually?

Thanks a lot
fkonias

LKF July 15, 2009 12:52

Hi,

I'm not familiar with 'CASE' but the following should let you loop through a series of commands for a list of different files (I've assumed that 'Case 50_202pN_001' is a res file).

Code:

!foreach $case('Case 50_202pN_001.res', ...)
!{
DATA READER:
CASE:$case
DOMAIN:Apomastefsi S3
Components to Ignore = Apomastefsi S3
Components to Update =
END
END
END
!}

Inthe sample code above, the '!' is required at the start of each code line. Perl variables, functions, commands will work following the !.

To create your own session file, I think the best bet is to record one in POST and then edit it in a command editor. This will allow you to see the commands and then you can just tweak it with your own variables and loops, etc.

I learned a little bit of the coding required to make my own session files through ANSYS training, so I'm not familiar with what content is in the documentation, but I'm sure you'll find some.

Hope this helps a bit.

fkonias July 16, 2009 08:56

Thank you for your replay, but I am not quite sure how to use this!
It looks like it’s a kind of a loop, which is repeated for all ‘things’ in the parenthesis. Am I right? Well this is something else that I might be able to use somewhere else, but it’s not what I was looking for this time. I just want to replace “Case 50_202pN_001” with a “skeleton key”. Like when we write *.* if that is possible.

ghorrocks July 16, 2009 19:31

Hi,

The for loop in LKF's example is a perl script. CFX supports perl in some of its transcript files. Read the documentation on scripting in CFX or look at the web for references on perl such as http://www.perl.org/

Glenn Horrocks

rogbrito July 21, 2009 22:47

a good book: R. Schwartz and T. Phoenix, Learning Perl, Ed. O'Reilly. At Amazon dot com:

http://www.amazon.com/Learning-Perl-...8230978&sr=8-1


All times are GMT -4. The time now is 21:47.