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

CFX 10.0 If command

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 1 Post By ghorrocks
  • 1 Post By ghorrocks

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 5, 2017, 21:17
Default CFX 10.0 If command
  #1
New Member
 
Fernando
Join Date: Apr 2013
Posts: 15
Rep Power: 9
camposrf is on a distinguished road
I am trying to make a conditional expression with "if" command in CFX-10.0

I read these articles:
Conditional Expression in CFX Pre

"if" command in CFX-13 is not really an "if" command!!!!

But I do not know how to do it in CFX pre 10.0

I saw in youtube that "if" expression works on CFX 14, but I do not have it (my PC is old)
https://www.youtube.com/watch?v=GJXQNhmqyhE
(11:25)

The string that I want to use is for define the volume fraction in a water tank:
WaterVolFrac =if(y<WaterHt,1,0)*if(y>-0.1[ft],1,0)

This is the error message:
__________________________________________

ERROR
Error in setting: "WaterVolFrac" via the expression:
if(y<WaterHt,1,0)*if(y>-0.1[ft],1,0)
Error found at the start of the line, at item: if
unrecognised name
__________________________________________


I read the _CFXTutorial.book.pdf, Tutorial_FreeSurfaceBump.pdf but they don't use the if command, they use this string:
DownVFAir = step((y-DownH)/1[m])
camposrf is offline   Reply With Quote

Old   July 6, 2017, 07:32
Default
  #2
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 16,467
Rep Power: 128
ghorrocks is a jewel in the roughghorrocks is a jewel in the roughghorrocks is a jewel in the roughghorrocks is a jewel in the rough
The if statement was introduced in a "recent" version of CFX. Not sure which one, maybe CFX 12, but it looks like CFX 10 did not have it. Sounds like a good time to upgrade to the current version of CFX to me.
ghorrocks is online now   Reply With Quote

Old   July 7, 2017, 17:42
Default CFX-Pre 10.0 "if and step" command
  #3
New Member
 
Fernando
Join Date: Apr 2013
Posts: 15
Rep Power: 9
camposrf is on a distinguished road
I just adapted the original string to my case "WaterVolFrac =if(y<WaterHt,1,0)*if(y>-0.1[ft],1,0)". The function plot works and makes sense.



But I still do not knowing how "the step commad" works. On the other hand, the results in the post environment says that the tank is full of water until the top!...



I was waiting something like this:
Attached Images
File Type: png TankVF.PNG (68.1 KB, 41 views)
File Type: png TankVFb.PNG (60.8 KB, 41 views)
File Type: png TankLevel.PNG (32.4 KB, 41 views)
camposrf is offline   Reply With Quote

Old   July 9, 2017, 09:03
Default
  #4
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 16,467
Rep Power: 128
ghorrocks is a jewel in the roughghorrocks is a jewel in the roughghorrocks is a jewel in the roughghorrocks is a jewel in the rough
The step command is very simple, and is explained in the documentation (CFX Reference manual). If the argument is positive, it returns +1, if negative it returns 0, if exactly zero it returns 0.5.
camposrf likes this.
ghorrocks is online now   Reply With Quote

Old   August 9, 2017, 17:15
Default CFX-Pre 10.0 "if and step" command
  #5
New Member
 
Fernando
Join Date: Apr 2013
Posts: 15
Rep Power: 9
camposrf is on a distinguished road
Quote:
Originally Posted by ghorrocks View Post
(...) If the argument is positive, it returns +1, if negative it returns 0, if exactly zero it returns 0.5. (...)
Thx ghorrocks,

Your comment was very useful, now I can adapt this string for make a synthetic "if" command if "step" returns +1 0 or 0.5



The problem with my simulation was not the step command. The mistake was in the vertical definition (Expressions: UpH, UpVFair) as you can see in my second comment in this post; the vertical variable was "Y" but the correct one is "Z".

Here you can see the results with the corrections applied.

Water Volume Fraction profile:




Water Volume fraction surface

Water Volume Fraction profile and surface:

Attached Images
File Type: png tkvfwatersurfaceVF.PNG (67.0 KB, 27 views)
File Type: png tkVF2.PNG (38.5 KB, 27 views)
File Type: png tkvfwatersurface.PNG (82.9 KB, 50 views)
File Type: png tkvfwater3.PNG (47.8 KB, 51 views)

Last edited by camposrf; August 9, 2017 at 17:33. Reason: wrong "preview" clicking
camposrf is offline   Reply With Quote

Old   August 9, 2017, 19:23
Default
  #6
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 16,467
Rep Power: 128
ghorrocks is a jewel in the roughghorrocks is a jewel in the roughghorrocks is a jewel in the roughghorrocks is a jewel in the rough
Please do not post multiple versions of the same post on different threads.

Your surface looks very lumpy and rough. I assume it is not meant to be like this.
* You probably have too coarse a mesh. Have you done a mesh sensitivity study?
* For the initial condition you should blur the free surface over a small distance so irregularities in the mesh do not distort the surface. Have a look in the CFX documentation under best practices guide for multiphase for tips on this.
camposrf likes this.
ghorrocks is online now   Reply With Quote

Old   August 9, 2017, 22:32
Default mesh sensitivity study FAQ
  #7
New Member
 
Fernando
Join Date: Apr 2013
Posts: 15
Rep Power: 9
camposrf is on a distinguished road
Quote:
Originally Posted by ghorrocks View Post
Please do not post multiple versions of the same post on different threads.(...)
I do not want to do that, I was just trying to help

Quote:
Originally Posted by camposrf View Post

Quote:
Originally Posted by glik View Post
(...) I have a problem with the interface when I had a horizontal acceleration to simulate the seism. (...)
I had the same issue with the interface. I defined the volume fraction (...)
Quote:
Originally Posted by ghorrocks View Post
(...) Your surface looks very lumpy and rough. I assume it is not meant to be like this. (...)
Yes, you are right.

Quote:
Originally Posted by ghorrocks View Post
(...)* You probably have too coarse a mesh. (...)
Yes, right again, it is a coarsed one. I have to do approximation cases first before run a detailed model “if I want the results this year” (joke). Further more, it has a worst residuals convergence (0.01). The good news is that the time step is ok because it is a steady simulation.
I have to do this previous work because I do not have a powerful PC. I accept donations (is not a joke).

Quote:
Originally Posted by ghorrocks View Post
(...) Have you done a mesh sensitivity study? (...)
No, I have not done. I think that my PC can not handle that. I do not know how I can do that. I did not find the FAQ with the instructions.

Quote:
Originally Posted by ghorrocks View Post
(...) Anyone - we really need to write a FAQ on the basics of checking mesh, timestep and residuals convergence and sensitivity for these type of basic questions. 90% of the "my simulation is not accurate" questions do not do the basics here - any takers?

Glenn Horrocks
Quote:
Originally Posted by ghorrocks View Post
(...)* For the initial condition you should blur the free surface over a small distance so irregularities in the mesh do not distort the surface. Have a look in the CFX documentation under best practices guide for multiphase for tips on this.
Thanks for your comment, I will check it.
camposrf is offline   Reply With Quote

Old   August 9, 2017, 22:46
Default the mesh of the tank
  #8
New Member
 
Fernando
Join Date: Apr 2013
Posts: 15
Rep Power: 9
camposrf is on a distinguished road
This is the mesh that I used, is not a detailed one but works for preliminary runs.

Attached Images
File Type: png tankMesh.PNG (192.4 KB, 27 views)
camposrf is offline   Reply With Quote

Old   August 13, 2017, 00:26
Default Grid and error analysis FAQ
  #9
New Member
 
Fernando
Join Date: Apr 2013
Posts: 15
Rep Power: 9
camposrf is on a distinguished road
Quote:
Originally Posted by camposrf View Post
(...) I did not find the FAQ with the instructions. (...)
Finally I found the FAQ, but searching from an external search engine.

Quote:
Originally Posted by ghorrocks View Post
There is an FAQ about linear solver overflow now: http://www.cfd-online.com/Wiki/Ansys...do_about_it.3F
https://www.cfd-online.com/Wiki/Ansy..._inaccurate.3F
camposrf is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
launch cfx from command line question windhair CFX 3 May 19, 2011 08:16
Export CGNS with CFX 10.0 Luca CFX 1 December 29, 2010 07:09
Low Reynolds Number k-epsilon formulation CFX 10.0 Chris CFX 4 December 8, 2009 00:51
How to red a Gambit mesh with Ansys CFX 10.0 jpsegura CFX 5 June 12, 2007 03:20
CFX 4.4 installation problem Pandu Sattvika CFX 1 December 1, 2001 05:07


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