This week we will revisit an old friend in terms of blog-posts. I will do a new post on the topic of Simcenter STAR-CCM+ field function syntax. We at VOLUPE have notices that the field function syntax posts, 1 and 2, are some of the most visited pages on our site. And where there is a demand for knowledge, VOLUPE will provide. First, if you feel the need to revisit the old posts, you do that here [Syntax1] and here [Syntax2] respectively.
Last week we where hosting a webinar on updates from this year in Simcenter STARCCM+ (it can be found here Webinars – VOLUPE Software) where I presented in short, a couple of syntax updates. They are insidePart, distanceToSurface and distanceToPart. This post will look a bit deeper into the functionality of these functions. Note that the inside part function replace, or at least complement, the procedure in the old syntax post number 1.
The inside part field function provides a 0-1 field of values that indicates if a point lie outside (0) or inside (1) a location that is described by a geometrical part. Two types of arguments can be specified for the InsidePart function; @GeometryPart and @Filter. We will look at both examples here.
In the picture below you can see the default, unspecified syntax in the top left square. To the top right is the use of the syntax, with the geometrical shape (“My_shape”) and the scalar field it gives when using the function on my shape, and with the addition of the temperature-statement, circle in red.
This can in this example replace the syntax presented in the old post. Don’t get me wrong! The old syntax still work, but the new one is far more efficient. The picture below show what syntax to be replaced.
This might not seem like a huge win, in terms of syntax. But imagine specifying a square in the center instead (in 3 dimensions). The top row show that the syntax needs no change (only the shape needs to be changed to fit our wish). But the “old syntax” it replaces is a lot longer now that the spatial reach of the limit is in full 3 dimensions. And where you before had to specify a local coordinate system to do a sphere in the center, you now inly need to crate the sphere shape instead.
How about using a filter instead? When can that be useful? Imagine you have disconnected volumes where you wish to specify an increased temperature. And instead of specifying several shapes, we let a filter point to those shapes instead. A filter called “My_filter_shape” is created by looking at the names (“corner…”) and groups all, in this case, shapes in to one selection. Using the insidePart with a filter then exactly targets the geometry corners and obtain the field we want all in a short syntax line. (again with the temperature statement in the end).
The distanceToPart function work in a similar manner as the insidePart function. It provides a 0-1 field for the maximum search distance, but it is also multiplied with that search distance. The figure below reuses the same example as prior, but for the distanceToPart function. Where the insidePart function answered 1 if a part is inside, the distanceToPart answers a 1 (multiplied with the search distance) if the position has the distance to the part. Meaning that you also get a gradient that describes the distance between the part and the maximum search distance (and the value of the search distance for all distances larger).
The function also works with filters, again making it possible to save syntax using a filter instead of a number of &&-operators in the syntax for each separate part. See the picture below for the same example. The functions in the above and below pictures are equivalent aside from the fact the one use a single part and the other use a filter pointing toward several parts.
The distanceToSurface works very similar to the distanceToPart, with the difference that it also looks inside the part. Assuming you have as I do in the example here, only one surface, the results comparison between distanceToPart and distanceToSurface can be seen below.
This can be useful when you wish to make specifications on both sides of a surface.
Note that it is possible to leave out a specification of maximum search distance, both for distanceToPart and distanceToSurface. The scalar field will not stop at maximum distance then, but the scalar field will be as large as the part of interest require. See the example below for a comparison with and without a max distance.
I hope this has been useful and that it explains not only what these functions can be used for, but also exactly how to use them in the most generic of cases (a box in a box!). Do not hesitate to reach out to firstname.lastname@example.org.