CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   Boundary Distance (https://www.cfd-online.com/Forums/cfx/157303-boundary-distance.html)

Pietro Giorgio July 25, 2015 15:19

Boundary Distance
 
Hi, someone can tell me if I can calculate the shortest distance of all domain cells to a specific boundary surface? I'm trying to use the variable "Boundary Distance", but it calculates the distance of each cell to the nearest boundary.

ghorrocks July 25, 2015 18:34

The "Wall Distance" parameter contains the distance to the nearest wall.

If you want to calculate the distance to a specific boundary object I can think of two possibilities:
1) If the object has a simple topology (ie just a plane or a sphere) then writing a CEL expression to give the distance from any point is pretty simple.
2) For an arbitrary shape things get a little more interesting. One approach which might be worth consideration is to define a diffusion only additional variable. Then define the surface you are interested in as a source term for the variable, give the fluid domain a constant diffusion coefficient, and put a source term sink somewhere far away. Then the diffusion pattern will automatically find the path from source to sink. If the source has a value of 1 and the sink a value of 0 and they are 10m apart, then where the variable has a value of 0.5 is half way from the source to sink and will therefore be 5m from the source.

I will leave it as an exercise for the enthusiastic reader to prove (or otherwise) whether the approach I describe in (2) is mathematically correct or not :) But it will be close regardless.

Pietro Giorgio July 25, 2015 19:53

Hi! Thank you for your quick reply.
The approach (2) is great! But I believe that (1) is enough, taking into account the simplifed geometry. The problem is that I do not need the distance to any point, I need the distances from the wall until all the cells that define the domain. This information will be useful for added mass analysis due to the heave motion of a hull, which was what I simulated. Do you know how I can refer to the position of each cell? On the same idea as I refer to speed through the "Mesh Velocity", with that I would solve quite easily

ghorrocks July 26, 2015 05:11

CEL variables can be field variables. So the CEL expression:

test = x+y+z

will define a scalar variable field set to the sum of the x, y and z coordinate values. If you want to write this variable to the results file then define an additional variable, set it to your CEL expression, and make sure your new variable is included in the results file.

Pietro Giorgio July 26, 2015 07:06

Work Perfectly, my friend! Thank you for the support!


All times are GMT -4. The time now is 22:51.