|
[Sponsors] |
April 18, 2015, 00:29 |
CFD-post probe
|
#1 |
New Member
Join Date: Jul 2013
Posts: 16
Rep Power: 12 |
hi every 1
I want to write below function to take b values of a values in CFD-post to define new expression and so new variable, but I dont know how to do it, b: when a=0 --> b=0 & when a is not zero --> b=1/a tank U my friends |
|
April 18, 2015, 02:21 |
|
#2 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,700
Rep Power: 143 |
b = if(a=0,0,1/a)
|
|
April 18, 2015, 14:17 |
|
#3 |
New Member
Join Date: Jul 2013
Posts: 16
Rep Power: 12 |
tank U dear ghorrocks
I try it in details of expressions in the expressions tab, but I see this error: """""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""" WARNING Syntax error detected in the expression assigned to 'h2VF'. Successfully read 26 characters: if(H2 at STP.Mass Fraction then error detected at: =0,0,1/(1+(0.09/1.185)*(1/H2 at STP.Mass Fraction-1))) Details - Unexpected character. ERROR Syntax error detected in the expression assigned to 'h2VF'. Successfully read 26 characters: if(H2 at STP.Mass Fraction then error detected at: =0,0,1/(1+(0.09/1.185)*(1/H2 at STP.Mass Fraction-1))) Details - Unexpected character. """""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""" my variable is HVF ( hydrogen volume fraction) and define so: HVF=1/(1+(0.09/1.185)*(1/H2 at STP.Mass Fraction-1)) but where "H2 at STP.Mass Fraction" is zero HVF undefined |
|
April 19, 2015, 06:53 |
|
#4 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,700
Rep Power: 143 |
Your variable name is hydrogen VOLUME FRACTION but the CEL expression is using the H2 MASS FRACTION. Are you talking about mass fractions or volume fractions?
|
|
April 20, 2015, 06:26 |
|
#5 |
New Member
Join Date: Jul 2013
Posts: 16
Rep Power: 12 |
Deer ghorrocks
Thank you for all of your efforts. I explain it so: My solution contains H2 Mass Fraction(HMF) and I need H2 Volume Fraction(HVF), and we know that: HVF=1/(1+(0.09/1.185)*(1/HMF-1)) I created a new expression (VHF) in expression tab, Now please exactly tell me: what I write in the expression details? I really appreciate it if you can guide me, on this. Thank you for your time |
|
April 20, 2015, 07:37 |
|
#6 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,700
Rep Power: 143 |
I suspect CFX is looking for the C equality test (==), not the variable assignment operator (=). So try if(a==0,0,1/a)
You might need to put a bit of a tolerance around this to handle numerical noise. But as you just seem to be handling the special case for when a=0 maybe not. |
|
April 30, 2015, 10:45 |
|
#7 |
New Member
Join Date: Jul 2013
Posts: 16
Rep Power: 12 |
thank U very much deer ghorrocks
your answer was true. I faced with new problem: I decide to define "Hazard region" so: where: 0.04<HVF<0.07 with this relation, when or where hazard region existe, CFD post show me '1' and when it not existe, CFD post referd '0' to me. I try to define (0.04<HVF) and it was successful , but the try to define it (0.04<HVF<0.07) was unsuccessful and CFD post dont refered any thing to me. |
|
April 30, 2015, 18:39 |
|
#8 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,700
Rep Power: 143 |
CFX uses C logic operations so look at a C reference manual for the correct syntax. There is also a breif description in the CFX reference manual.
try something like if(HVF>0.04 && HVF<0.07,do this,or do that) |
|
May 1, 2015, 16:20 |
|
#9 |
New Member
Join Date: Jul 2013
Posts: 16
Rep Power: 12 |
Yes it is working very well
Thank U dignified ghorrocks! |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem in CFD -post | pratikvn | ANSYS | 4 | March 21, 2018 02:56 |
Post processing in CFD Post or Fluent. | Blobs | OpenFOAM Post-Processing | 2 | June 26, 2016 07:23 |
CFD Design...The CFD Future | John C. Chien | Main CFD Forum | 20 | November 19, 2015 23:40 |
CFD Online Celebrates 20 Years Online | jola | Site News & Announcements | 22 | January 31, 2015 00:30 |
CFD for fans & blower housings | David Carroll | Main CFD Forum | 8 | August 24, 2000 17:25 |