CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   CFX post-exprestion for reffrencing a case (https://www.cfd-online.com/Forums/cfx/123132-cfx-post-exprestion-reffrencing-case.html)

hmasenger September 5, 2013 04:43

CFX post-expression for referencing a case
 
hi
i have loaded some separate results in CFX post and i need to extract some plots from conturs ,vectors and etc.
would you pleas show me how can i define an annotation in plots which expresses a variable like pressure in every current case views?i have already set an annotation(TEXT) but when i change the case view,the annotation(TEXT) doesn't change. it is very time consuming to change the annotation(Text) for very case views manually.
i think i should define an expression that references 'current case' but i don't know how to ..

best regards

ghorrocks September 5, 2013 09:16

You can put variables in the text, such as time step, current time and many others. You can even put CEL expressions in there so it has some smarts. If that does not work you could script it with perl or a session file.

You have lots of options.

hmasenger September 5, 2013 09:31

pleas give me a reference to how to use perl or session file.i am not familiar with them

hmasenger September 5, 2013 09:34

Quote:

Originally Posted by hmasenger (Post 450058)
pleas give me a reference to how to use perl or session file.i am not familiar with them

i think there is a bug in CFD -post !just load more than 2 results in cfd-post and then add a text with auto annotation expression in it.then you see the text doesn't change while changing the result view!!.

singer1812 September 5, 2013 09:41

Please list the expression you are using within the text object.

hmasenger September 5, 2013 09:51

the expression is "ave(Total Pressure)@inlet"
i want it to be displayed at any case results while i change the result view to take a picture from contures and vectors

singer1812 September 5, 2013 10:19

I have confirmed that behavior using CFX v14.5.7

I even created an expression in the expression editor that evaluated the expression for Case1. Made a text object, it showed that value, then changed the expression to be evaluated on Case2, the expression value updated, but the text object did not.

I tried creating 2 different text objects, with a different one for each view, the expression values remained the same.

I tried creating 2 different expressions, the same type of expression, but with one using Case1 as the case and the other using Case2, and then creating 2 text objects using the 2 different expressions, and the text ojbects remained the same.

I suggest you log this with ANSYS. If you get a solution to this, I would be interested in it.

hmasenger September 5, 2013 10:26

i tried this with ansys CFX 14.5.0 and same thing happened!
don't you have any other idea how to get through this instead of time consuming challenge with ansys staff?

singer1812 September 5, 2013 10:40

On the quick I don't. Perhaps someone else has a slick solution.

I tried to embed a \Data Reader\Case# type of logic into the expression, but couldnt quickly get it to work in the time that I am willing to spend on this.

Perhaps people smarter than I will come forward :)

hmasenger September 5, 2013 10:51

;) you are smart enough my Friend.i have posted the problem to ANSYSinfo moments ago. i hope they answer the question.
thanks anyway

brunoc September 5, 2013 16:15

I'm not sure you're taking this into account, but when post-processing multiple cases at once the expressions should mention the case name. That means that instead of

massFlowAve(Total Pressure)@inlet

you should use

massFlowAve(Total Pressure)@CASE:casename.inlet

I've tried that here on 14.5.0 and it worked fine.

Also, text labels are not tied to which case you're visualizing. They'll show anything you tell them to show. So if you're using only one view and are switching from Case 1 to Case 2 on the 3D view, the values shown by the text label will remain the same.

If you'd like to know how to write other CEL Expressions, just enable the 'Show equivalent expression' option at the bottom of the calculator ('Tools > Funtion Calculator').

Cheers

hmasenger September 5, 2013 17:59

yes i already know that but in that way, what is the advantage of AUTO ANOTATION !!!should i change the exprestion for every single case i am trying to taking some images? can you imagine how time consuming would be to take image of some contures and vectors for several variables for 30 different result cases that you just want to be high lighted which variable refers to which case by just setting a text!??i think that doesn't make seance at all!! maybe there is a way to define an expression that refers to current view results?

brunoc September 5, 2013 22:43

Yeah, that's not how Annotations work. They show you the value you tell them to show. Period. And if you have an expression such as massFlowAve(T)@inlet and several cases loaded, CFD-Post can't know which case it needs to use for the calculation. I do think what you said is a good idea, though.

Still, if all you want to do is export some calculated values from a bunch of results file, then loading them all at once is really not the way to do it. You see, the ability to load more then one result at a time is meant to compare them side-by-side. That's why the 'Case Comparison' feature only uses two Cases. The idea is to make qualitative comparisons (contours, planes, streamlines, etc). Yes, you can do quantitative comparisons too, but then you need to be explicit about the results you want.

To just export values across a list of result files, what you want is a script file that loads each result and exports the desired values to a text file in a sequence. It's not hard to do that with Perl. I don't have an example with me right now, but I can send you one tomorrow.

Cheers

hmasenger September 6, 2013 03:36

thanks bruno for your nice answer.
i am not familiar with pearl or the script thing mentioned .would you pleas show me a way that i can express the inlet pressure in every picture taken from every case result? i need to be able to have some images from contures and vectors from every cases and i need them to be highlighted that which pic refers to which case result in report. i am totally exhausted with pasting case conditions typed in Microsoft paint for each countor and vector plot !!
your guides would really help me trough this problem
best regards

singer1812 September 6, 2013 09:39

Hamed:

Really look into perl for post processing stuff. It makes your life much easier.

Below is a sample script which loads in a results (my results were titled with numbers so it was easy to loop through the naming, you might have to get more creative). The view is already setup in post, so i dont have perl scripting for that (it is the same for all pics). The script outputs a jpg called cfxOutpu.jpg and then changes its name to aviod overwriting.

Pay close attention to syntax as using perl in CFX requires additional "!" to signify it is a perl command:



!for($i=1;$i<=145;$i+=1) {
!$b=($i-1)*5+109;
!$c=$b."_001.res";
> load filename=H:/Ed_Singer/CFX_IRAD/ARL_Magnus_M910/ARL-RP-131_M910_M102_3a_3649spin_DES/$c

HARDCOPY:
Antialiasing = On
Hardcopy Filename = H:/Ed_Singer/CFX_IRAD/ARL_Magnus_M910/DES_jpg/cfxOutput.jpg
Hardcopy Format = jpg
Hardcopy Tolerance = 0.0001
Image Height = 620
Image Scale = 100
Image Width = 1172
JPEG Image Quality = 100
Screen Capture = Off
Use Screen Size = Off
White Background = Off
END
>print
!rename("H:/Ed_Singer/CFX_IRAD/ARL_Magnus_M910/DES_jpg/cfxOutput.jpg","H:/Ed_Singer/CFX_IRAD/ARL_Magnus_M910/DES_jpg/$b.jpg");
!}

brunoc September 6, 2013 11:11

Hi Singer,

I was going to send a huge Perl script to do everything, but yours is a lot easier to understand and edit.

For reference, you can use Perl variables inside CCL commands, so instead of renaming the file afterwards you can just export it with its final name:

Hardcopy Filename = H:/Ed_Singer/CFX_IRAD/ARL_Magnus_M910/DES_jpg/$b.jpg

Cheers.

singer1812 September 6, 2013 11:50

Regarding the perl within ccl, I seem to remember I tried that with this script (it is a few years old) and the naming was having some sort of issues. Dont remember what it was, but ultimately I just ended up just renaming.

Of course Hamed can tailor it to his needs.

hmasenger September 7, 2013 01:24

thanks dear frinds.
you are absolutely CFD experts.it would take me a year to find such a script ;).

soumitra2102 February 11, 2021 21:05

Exactly what I wanted! Listing Variables concerned with different cases
 
Quote:

Originally Posted by brunoc (Post 450117)
I'm not sure you're taking this into account, but when post-processing multiple cases at once the expressions should mention the case name. That means that instead of

massFlowAve(Total Pressure)@inlet

you should use

massFlowAve(Total Pressure)@CASE:casename.inlet

I've tried that here on 14.5.0 and it worked fine.

Also, text labels are not tied to which case you're visualizing. They'll show anything you tell them to show. So if you're using only one view and are switching from Case 1 to Case 2 on the 3D view, the values shown by the text label will remain the same.

If you'd like to know how to write other CEL Expressions, just enable the 'Show equivalent expression' option at the bottom of the calculator ('Tools > Funtion Calculator').

Cheers


I simply wanted to extract area averaged values of a variable (pressure) at a boundary (inlet) each from different cases and list them in a Table all in ANSYS CFD-Post.
But the Table in ANSYS CFD-Post does not allow variables from different cases to appear in a single Table type report unlike the Chart type report option. So, I used the above-mentioned syntax with the appropriate case name, and it worked exactly how I wanted. It's like you beat the software at this ridicules hurdle!

just use this syntax and you can access same variables yet with different result cases in ANSYS CFD-Post
=<expression>(<variable>)@CASE:<casename>.<boundary>

Thank You


All times are GMT -4. The time now is 10:18.