# Documentation: Superstructures

Superstructures, often simply referred as structures, are smaller parts of your geometry.

Why we need them? After a facet is hit and a particles is rebounced in a new direction, Molflow looks for the next collision with the help of ray tracing algorithms. The program must essentially search for collision wiht ALL of the facets, then decide which collision is closest, thus which is happening in the "real world". Therefore, in a geometry with 10.000 facets, it takes more or less 10 times as much computing time to calculate the next hit as in a system with 1.000 facets only. You might feel that it is not optimal to look for collisions with facets that are very far in the system.

Superstructures help Molflow by defining which parts of the system are together.

Therefore, we do the following:

• We split our system to smaller parts, each part belonging to a different structure
• We create links between them, these links are "port" facets that all particles going from structure A to structure B will cross
• When a particle is in structure A (got there through a link or desorbed from a facet in structure A), it will only check collisions with facets in structure A (which is faster than checking with all facets)

In the structure below, we can see two clearly separable parts that are connected via a link facet. The simulation is more or less two times faster.

## Creating structures

You can define structures by two different methods.

One is by importing different geometry files on each other, using the "insert to new structure" option:

You can select different structures in the view menu (cycle through them by CTRL+F11, CTRL+F12):

The other method is to edit the facets directly. In the facet parameters, you can see a "structure" field. Each structure has a number, beginning from 1.

If you change this number, the facet will belong to a new structure. You can add new structures in the view menu "New structure" command, which will create an empty structure. After you have this new structure, move facets into it by changing their structure numbers in their parameters.

To let particles know that they arrive to a new strcture by crossing a "port", you have to define links. Links are two facets in the same position, each belonging to its own structure. They have to fulfil the following:

• They have exactly the same shape
• They are in the same position
• Both are one-sided
• One belongs to structure A, one to structure B
• The one that belongs to structure A has its normal pointing towards structure A, the other's normal is pointing towards structure B
• The one that belongs to A links to B, the one belonging to B links to A (ie. the facets are "showing their backs" to each other)

To make a facet link towards an other structure, enter the destination structure's number in the Link parameter.

To disable linking, enter 0 as destination.

A link facet is always transparent. You can see hits as "transparent passes", colored in light blue.

To help understand the concept, download this simple example geometry that contains two structures with their links defined correctly.

Note that if you have the time to run the simulation longer, it is not required to define structures. Putting everything in structure 1 will have the only negative effect of slowing down the simulation.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer