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

Define an Expression in Pre with another User Defined Expression and a Variable

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

Like Tree1Likes
  • 1 Post By fuGGet321

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 3, 2018, 14:52
Default Define an Expression in Pre with another User Defined Expression and a Variable
  #1
New Member
 
Lucas
Join Date: Feb 2017
Posts: 4
Rep Power: 9
fuGGet321 is on a distinguished road
Hello,

I am toying with an ANSYS bubble column tutorial featuring a fairly simply geometry, but complex physics. Unfortunately the pdfs to the tutorial were both too large to upload as regular files, so here are Google Drive links to them:

First part:
https://drive.google.com/open?id=1e-...8ZFqYnl3GyZnl5

Second part:
https://drive.google.com/open?id=1FA...thTXZyPywkpwK7

Basically, I was having difficulty completing the second part of the tutorial (implementing additional non-drag forces) after the first part went well. I am following this tutorial verbatim and am not getting the same results/contours as are being shown in these files.

My main issue lies in the preservation of the water-air interface. No matter what I do in terms of tweaking timestep size/transient loop iterations, the interface gets lost in one way or another over the course of a run. Either all of the water spontaneously drains out (using the top of the bubble column as an Opening boundary), or the pocket of air in the top 10 cm of the column disappears (using the top of the bubble column as a Degassing Outlet boundary - apparently the ideal choice for bubble columns).

So, as part of my troubleshooting/debugging process, I tried to run the simulation with no input mass and a Degassing Outlet boundary, and somehow the pocket of air in the top 10 cm of the column still slowly leaves the boundary, without any external stimulation to the domain.

Now to my question. In this "static" case, I'm trying to look at multiple Pressure Monitor Points throughout the domain to try and figure out what's happening, and I want to know if I can define an Expression which incorporates a previously defined Expression used in the Global Initialization. To summarize:

Global Initialization Expression:
intDef = (rhoAir - rhoWater) *g*(1.0 [m] - y)* if( y > 0.9 [m], 1.0, 0.0)

Possible Pseudo Expressions for Pressure Monitor Point at y = 0.5[m]:
prMonitor = intDef()@y=0.5
prMonitor = intDef(y=0.5 [m])
prMonitor = ... ?

Hopefully that's more clear. Again, I want to use an Expression which I defined (used for Global Initialization) and a Variable (y, depth of fluid in the bubble column domain) to define a second Expression (prMonitor) which I can monitor over the course of the simulation so I can get a better idea of what's happening to the disappearing interface.

I apologize for the long winded question, but I figure more information off the bat is more helpful to the bright CFD mind out there that will hopefully help me solve my problem.

Thanks in advance!
fuGGet321 is offline   Reply With Quote

Old   May 3, 2018, 19:09
Default
  #2
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,701
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
You cannot do what is in effect a function call in CEL. So what you are asking for is not possible.

But you don't need to. You have set up your intDef function, and then define monitor points at all the locations you are interested in and get them to report the intDef function. This will return the intDef evaluated at the monitor point location. Does this achieve what you are looking for?
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   May 4, 2018, 18:00
Default
  #3
New Member
 
Lucas
Join Date: Feb 2017
Posts: 4
Rep Power: 9
fuGGet321 is on a distinguished road
Hi Glenn,

Thank you for the reply. I wasn't too hopeful that this was possible, but in my mind it seemed like the most likely way to achieve what I wanted.

My counter to your suggestion: while I do agree what you suggested makes sense, I don't know how I would go about this. When I define a Monitor Point in Output Control, call it somePoint, I need to define what its coordinates are, and an Output Variable from a set list of built-in variables. Therefore, as far as I know, I cannot have somePoint report the intDef function.

This issue of "available" properties is what originally led me to attempting to perform a "function call". If the way I had originally suggested was possible, I would monitor somePoint as a Monitor Expression, where the Expression being monitored would be prMonitor at y = 0.5[m], if that makes sense?

In that case, I guess my question becomes whether I can define a Monitor Point to be a User Defined Expression instead of a built-in Output Variable..
fuGGet321 is offline   Reply With Quote

Old   May 5, 2018, 07:07
Default
  #4
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,701
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
Try a monitor point of a CEL expression, and the CEL expression is the probe() function. Look in the CFX reference manual for the syntax of the probe() function. You might need to define a second function of a normal variable at a XYZ point location as a point reference for the probe() function to refer to.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   May 7, 2018, 16:33
Default
  #5
New Member
 
Lucas
Join Date: Feb 2017
Posts: 4
Rep Power: 9
fuGGet321 is on a distinguished road
I followed your suggestion to use the probe() function as a CEL expression, and was still unsuccessful. This is what happened, with accompanying screenshots.

First off, I looked in the CFX Manual to double check I had the right syntax for the probe() function, and I believe I do. If I'm interpreting this right (attached screenshot is straight from the manual), you can use a Variable (I assume this means built in Variable) or an Expression (I assume this means it can be User Defined) as an argument.

Then, I defined a Monitor Point using Pressure as an arbitrary Variable at the point where I want to monitor my function, called somePoint.

Next, I defined a new Expression, Py0p5byexpression which uses the probe() function on my intDef Expression at my somePoint Monitor Point. So far so good, Pre is not showing any errors.

Last, I define a Monitor Expression as Py0p5 using my probe() function Expression Py0p5byexpression. Upon trying to confirm this, I get an error saying this type of operation is not supported by the Solver.

I honestly can't think of another way to go about this.. any other suggestions?
Attached Images
File Type: jpg probe-in-CFX-Manual.jpg (45.4 KB, 50 views)
File Type: png somePoint-Monitor-Point-definition.png (79.3 KB, 35 views)
File Type: png probe-Expression-definition.png (28.6 KB, 31 views)
File Type: png probe-function-Monitor-Expression-definition.png (34.8 KB, 27 views)
File Type: png Monitor-Expression-error.png (79.6 KB, 22 views)
fuGGet321 is offline   Reply With Quote

Old   May 8, 2018, 15:28
Default
  #6
Senior Member
 
Join Date: Jun 2009
Posts: 1,803
Rep Power: 32
Opaque will become famous soon enough
The error message states:

"... Only arguments that consist of a single recognized variable name are supported by the solver".

IntDef is not a variable (in the CFX sense), but an expression for the CFX-Solver and CFD-Post.

Try inserting an Additional Variable, say MyIntDefVar. Select Unspecified, Press Apply

Activate MyIntDefVar under the domain you plan to use, select Algebraic Equation, and set it to IntDef

Additional Variable Value = IntDef

Now you can use MyIntDefVar anywhere, monitor point at a given location, the argument of any of the CEL quantitative functions, etc.
Opaque is offline   Reply With Quote

Old   May 8, 2018, 16:19
Default
  #7
New Member
 
Lucas
Join Date: Feb 2017
Posts: 4
Rep Power: 9
fuGGet321 is on a distinguished road
Hi Opaque,

The method you suggested ended up solving my problem, thank you so much! Easy to get mixed up with the whole Expression/Variable/Function jargon when you're fiddling with CEL..

For those following at home, here is how I solved in problem in detail (in continuation from my previous posts):

1) Define new Additional Variable as MyIntDefVar with an Unspecified Variable Type, just as Opaque said. You can't just put anything for units here, they must match whatever your Expression's units are. In my case, this was Pa.

Side note: From my understanding of the CFX Manual, this is the only Variable Type which allows for a custom Algebraic Equation to be used. A Specific Variable Type is for variables solved on a per-unit-mass basis, and Volumetric is solved per-volume-basis. More on this in 28.1.2.1 in the Manual.

2) Default Domain > Fluid Models > Additional Variable Models > MyIntDefVar. Check this off, which should give you only one Option in the drop down menu, Fluid Dependent. I should reiterate here I'm working with a multiphase simulation, so the available selections in the Option menu may differ if you're doing Single Phase.

3) Default Domain > Fluid Specific Models > Fluid > Water (only because in my example my pressure point is underwater, but you should repeat this for every fluid you want to apply MyIntDefVar to). Then, Additional Variable Models > MyIntDefVar. Check this off, which again should give you only one Option in the drop down menu, Algebraic Equation. Then, Add. Var. Value is the Expression, not the Variable, so it's intDef.

4) Output Control > Monitor > Monitor Objects (check this) > Monitor Points and Expressions > Add New (called mine prMonitor). Then, under prMonitor, define your point by Cartesian Coordinates, and choose MyIntDefar from Output Variables List. If you attached your Additional Variable to more than one material (which I did, Air and Water), then it will appear in the Output Variables List as Air.MyIntDefVar and Water.MyIntDefVar.

These forums have helped me tremendously in many of my most frustrating numerical times that I'm sure every CFD user on the planet can empathize with, so if this forum post helps even one other person save the headache I went through to figure this out, then I consider my original post a success!
Mathieu_Mettille likes this.
fuGGet321 is offline   Reply With Quote

Reply

Tags
bubble column, degassing, expressions, interface, multiphase

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
Referencing a User Location for a Monitor point expression in CFX pre ct18 CFX 2 February 18, 2018 16:31
Outlet boundary condition in interFoam Andrea_85 OpenFOAM Running, Solving & CFD 51 July 20, 2017 13:31
Plot of user defined variable in CFD Post dreamz Main CFD Forum 0 December 8, 2013 22:00
Transient User Defined Function in CFX Niru CFX 0 November 12, 2013 17:07
emag beta feature: charge density charlotte CFX 4 March 22, 2011 09:14


All times are GMT -4. The time now is 00:52.