Simcenter STAR-CCM+ How to quickly compute the distance between Parts

Simcenter STAR-CCM+ Teamcenter Share Simcenter Cloud HPC


The aim of this article is to show a two different methods for quickly compute the distance between surfaces of differents parts.


Let's consider a simple case where we have two geometries (two blocks in this case) and we want to quickly compute the distance between them. 

Two different (and equivalent) approaches will be showed here. 

The first one involves the usage of the built in field function

The second one requires the definition of a user field function and the usage of the System Function 
distanceToSurface(@PartSurface("Composite|Part|PartSurface"), {maxSearchDistance})


The surface of the two blocks have been split and each single patch has been renamed. For simplicity, the patches of the two blocks which we want 
to measure the distance between, have been assigned the same name. 


So, let's compute the distance between the surface -Xface of the two blocks, as shown in the image below.


At this point we need to set the field function $DeviationDistance.Root.

This field function has been introduced to compute the deviation between the root representation of a part and its remeshed one, with the aim to check if the surface and meshing process dramatically changed the shape of the original/imported geometry. 
However the field function can also be used to compare two different parts. This can be achieved my unticking the option Only Compare Same Parts.
The parts to be selected in the Parts field can be either the -Xface of Block01 or Block02. In this case we have chosen the latter:


At this point, what we need is a scene with a scalar displayer. 
The input part of it has to be the -Xface of Block01 and the scalar quantity to display will be $DeviationDistance.Root
With this settings the distance between -Xface of Block01 and -Xface of Block02 will be plot on the Block01 face:


If we want to visualize the distance between different faces we simply need to modify the Part input field of the field function $DeviationDistance.Root and the input part in the scalar
displayer, accordingly.


This method requires the definition of a user field function in order to identify the surface from where we want to compute the distance. Like for the first method, we are free 
to choose any surface of one of the two geometries. Like for the first method, -Xface of Block02 can be chosen.

Let's name this field function _DistanceFromBlock02. As the name suggests, we are going to plot on the -Xface of Block01 the distance from the correspondent surface of Block02. 

For the definition of this field function we need to use the System Function 
distanceToSurface(@PartSurface("Composite|Part|PartSurface"), {maxSearchDistance})



allows to specify the full path to the surface we want to calculate the distance from;



is an optional feature that imposes a cap on the maximum distance to measure from the target surfaces. 
Using this parameter provides a performance gain for cases where you are not interested in distances far from the target surfaces.

In this example, the field function has been defined as:

_DistanceFromBlock02 = distanceToSurface(@PartSurface("Block02|-Xface"), 10)

At this point a scalar scene very similar to the previous one can be created. The only difference is that the field function we want to plot on -Xface of Block01 will be _DistanceFromBlock02


The two methods are equivalent as it can be seen from the image below


Both methods can be particularly useful when different parts forming an assembly are imported in the wrong locations and need to be re-positioned, as it will quickly provide the information about the translation to apply.

Simcenter STAR-CCM+ Documentation
  • User Interface > Expressions > Expression Syntax > Operators and Functions

KB Article ID# KB000054020_EN_US



Associated Components

Design Manager Electronics Cooling In-Cylinder (STAR-ICE) Job Manager Simcenter STAR-CCM+