CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   Define an Expression in Pre with another User Defined Expression and a Variable (https://www.cfd-online.com/Forums/cfx/201475-define-expression-pre-another-user-defined-expression-variable.html)

fuGGet321 May 3, 2018 14:52

Define an Expression in Pre with another User Defined Expression and a Variable
 
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!

ghorrocks May 3, 2018 19:09

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?

fuGGet321 May 4, 2018 18:00

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..

ghorrocks May 5, 2018 07:07

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.

fuGGet321 May 7, 2018 16:33

5 Attachment(s)
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?

Opaque May 8, 2018 15:28

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.

fuGGet321 May 8, 2018 16:19

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!


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