Molflow User Guide
Molflow User Guide
CERN
1.
2.
3.
4.
2.1.
2.2.
2.3.
3.2.
3.3.
3.4.
Viewers ................................................................................................................................................ 13
3.5.
3.6.
3.7.
3.8.
3.9.
3.10.
Processing results.............................................................................................................................. 34
3.11.
3.12.
3.13.
3.14.
Superstructures ................................................................................................................................. 67
3.15.
Theory ................................................................................................................................................................ 73
4.1.
5.
5.2.
5.3.
5.4.
5.5.
5.6.
Auto-updater...................................................................................................................................... 76
5.7.
5.8.
Website ............................................................................................................................................... 79
cern.ch/test-molflow
page 2
CERN
1. About Molflow
Molflow+ is a Windows program that allows you to calculate the steady-state pressure in an arbitrarily
complex geometry when ultra-high vacuum condition is met. The name comes from molecular flow,
the condition when the mean free path of molecules is so long compared to the geometry size that
collisions can be neglected. In this case, particles fly independently, which makes this physics
particularly suitable for Monte Carlo simulations. The first version of this program was written by
Roberto KERSEVAN in 1990 (see this reference article). In 2007 a new version called MolFlow+ was
written in ESRF (Grenoble, France), that uses the original algorithm in a modern environment: it takes
advantage of OpenGL acceleration for the 3D display and it can use multiple cores for the calculations.
In 2012, the further improvements were added in CERN, and also a website was created. Geometries
can be imported from most CAD programs that support the STL file format, and the development is
still underway, with current focus on being able to simulate time-dependent processes.
2. Basic concepts
This chapter is a general overview of the program and of the expressions later used.
cern.ch/test-molflow
page 3
CERN
A vertex is a point in the 3D space. In Molflow, they are interesting for two reasons:
-
All facets have an outline that consists of vertices (vertexes of a given facet are referred to as
its indices)
Some geometry operations (such as creating a facet) require creating and selecting vertices
first
Facet
Facets are polygons that are the elementary constituents of the geometry. They have indices, ie. the
vertices they consist of, and they have a normal vector defining the direction they are looking to. They
also have a local U,V coordinate system, where the U vector points from the first to the second index,
and the V vector is perpendicular to it. The normal vectors direction can be swapped, and the U,V
vectors can be rotated by the user.
Significance of facets is that their physical parameters can be specified one by one. Therefore a facet
can serve as a pump, as a gas inlet, as a teleport gate for boundary conditions and it can also have
profiles and textures.
cern.ch/test-molflow
page 4
CERN
Structures (advanced)
Structures, also called superstructures are a set of facets that are specified by the user to be distinct
from the rest of the geometry. Structures are connected by link facets. They were introduced to
Molflow to make geometry handling easier (for example, you can restrict visibility or facet selectability
to a given structure only), but their real role is to speed up simulation: ray-tracing algorithms will only
look for collisions within the current structure (instead of with every facet in the geometry).
Please note that whereas the computing time can be reduced by using structures, the time to set them
up can be long. Experience shows that unless the geometry consists of a lot of facets (in the order of
hundreds of thousands), not splitting the geometry to structures might be just fine.
Profiles
Profiles are quick measuring tools if the user wants to see the pressure along a facet. When a profiling
is enabled on a facet, it is divided into 100 equal parts along the U or V vector, and for each slice the
pressure is calculated.
The advantage is that the pressure evolution can be visualized within Molflow, and several profiles can
be plotted on the same Profile Plotter window for comparison. The disadvantage is that it only works
on rectangular facets, and sometimes the 100 element split is not enough.
cern.ch/test-molflow
page 5
CERN
Textures
Textures are tools to locally visualize the pressure on given facets with the help of a color scale that
the user can customize. To calculate them, the user has to create a Mesh first, which is the division of
a facet to squares (cells) of arbitrary size. Then the pressure is calculated individually for each of these
squares and can be displayed with colors chosen in the Texture Scaling dialog.
Whereas adding textures to existing facets is sufficient in many cases, it is possible to create transparent
facets whose only purpose is to hold a texture. These transparent facets serve as tools to visualize the
pressure in the middle of the geometry, for example.
Apart from the visual appearance, it is possible to read and export pressure values cell by cell using
the Texture Plotter.
cern.ch/test-molflow
page 6
CERN
Formulas
Molflow offers the user to set up custom formulas, which are expressions containing internal values
as variables. One could, for example, derive the transmission probability for a pipe from the number
of particles on its two sides. These formulas are then updated in real-time as the simulation is running.
cern.ch/test-molflow
page 7
CERN
cern.ch/test-molflow
page 8
CERN
cern.ch/test-molflow
page 9
CERN
Selecting facets
Using left-click
Clicking on any part of the geometry will select a facet under your mouse that has at least one
vertex visible in the viewer. (ie. large facets filling your whole screen won't be selected unless you
zoom out).
Very important: if you keep clicking without moving the mouse, the selection will cycle through all
facets below your mouse cursor. So if you want to select a particular facet, keep clicking over it
without moving your mouse. This is a function that most new users need some time to get used to,
but then it becomes really useful. Just remember, dont move your mouse between clicks.
cern.ch/test-molflow
page 10
CERN
Clicking on any row of the facet hit list will select the corresponding facet.
Click on any row (to set the focus), then holding the SHIFT key scroll up or down to select many
facets that follow each other.
Selecting vertices
With the vertex selector tool, you can click near a vertex, and Molflow will select the closest vertex
to your mouse pointer. Use SHIFT and CTRL to add/subtract from the selection, and you can also use
selection areas (drawing selection rectangles).
cern.ch/test-molflow
page 11
CERN
Message on the bottom of the viewer reminding you of the CAPS LOCK mode
This will restrict the selectable facets to those that have a vertex selected. Therefore your next click
(or selection rectangle) will select directly those whose vertex you just selected:
Selection groups
You can also select facets through your memorized selection groups. Once you have made a selection,
you can memorize it and recall later. Refer to section 3.11.1
cern.ch/test-molflow
page 12
CERN
3.4. Viewers
MolFlow offers you to have four different viewers, each of which can have different view parameters.
For example, camera angles can be different, and you can also decide to display the textures on the
first viewer, the hits on the second, and so on.
By default, the first viewer is maximized, but you can collapse and expand any of them using the button
on the bottom right.
Also, you can save and recall camera positions, so-called views with the View menu:
cern.ch/test-molflow
page 13
CERN
To save a camera view, use View -> Memorize View -> Add new (CTRL+Q). Give the camera
position a name.
To recall a camera view, the easiest way is to press ALT+F1, ALT+F2, or you can optionally
use the Select Memorized submenu.
This dialog box customizes what you want to display on the currently selected viewer. Each of the
four viewers can have different view settings.
Rules
Rules display the origin position and the direction of X,Y,Z base vectors.
cern.ch/test-molflow
page 14
CERN
Normals
Displays the normal vector of the facets, which is important to define their orientation.
U,V vectors
Displays the facet's own coordinate system. Useful when defining profiles and mesh, which follow the
orientation of the U vector.
Lines
cern.ch/test-molflow
page 15
CERN
Particle trajectories. Note that at each second the last 2048 lines in cache are displayed, so their
position might appear randomly. You can change the displayed number in the More... dialog, see later.
Leaks
Visualizes particles escaping from the system. A dot marks the last hit's position, and then the arrow
points in the direction where the particle was relaunched, and in which direction it didn't find any
collisions thus left the system.
Hits
cern.ch/test-molflow
page 16
CERN
Volume
Texture
Filtering
cern.ch/test-molflow
page 17
CERN
Vertices
All vertices in the system have a unique ID, starting from 1. You can visualize these IDs on selected
facets with this option.
Indices
All facets have an order of vertices (referring to the system-wide vertices). The order defines where
the U vector is pointing (always from indice 1 to indice 2), and which direction the normal is pointing
(left-hand rule). You might want to visualize these when using the Shift Vertex and Swap
Normal commands.
cern.ch/test-molflow
page 18
CERN
Pressing the More button opens a new dialog that enables you to set additional viewer options.
Number of lines
Max. number of displayed lines and hits.
cern.ch/test-molflow
page 19
CERN
When too many trajectories are displayed, it is a good idea to reduce this number
Number of leaks
Max. number of displayed leaks.
In Volume display mode, toggle whether outlines of selected facets should be displayed when hidden
by the object's volume.
cern.ch/test-molflow
page 20
CERN
When Texture display is disabled (ie. colors of the texture are not painted), the mesh outlines can still
be displayed with this option. As large grids consist of many lines to paint, at large texture sizes this
can slow down the rendering (making menus, etc. respond slowly to mouse clicks).
STL files
STL or STereoLithography files describe the 3D geometry. They become more and more popular
since all CAD programs support them, and they also happen to be the format recognized by 3D
cern.ch/test-molflow
page 21
CERN
printers. They consist of a list of triangles: each triangle is described by its 3 vertices and the direction
of the unit normal vector. A typical block of an STL file is:
facet normal
outer loop
vertex
vertex
vertex
endloop
endfacet
All CAD programs can export to this format, but one has to be careful when doing this, as STL files
can be binary or ASCII. While the first option results in a smaller, more compact file, the latter is
readable, and is the only format that Molflow can interpret.
For example, in Autodesk Inventor, the user can decide the format in the export settings dialog:
Another important setting is the unit of the STL file. As you can see on the above snippet, the
coordinates dont contain units. Therefore, upon opening an STL file, Molflow will ask for the units it
was created with. The thumb rule is to use the same as when exporting. If a mistake is made, one can
use the Facet scale command later to resize everything.
One last advice: To avoid geometry problems (notably the leak of the particle due to an incorrect
joint), you can feel free to use a relatively high resolution when exporting the STL file. Dont
worry: the first thing youll do upon importing the file is collapsing it in MolFlow, which will reduce
the number of facets used.
cern.ch/test-molflow
page 22
CERN
Collapse
When you import an STL file, it will consist of triangles. Now, adjacent triangles that are in the same
plane can be merged, resulting in faster simulation and easier geometry handling. Moreover, each
vertex of the system is described several times (if 3 adjacent facets have it, then 3 times); therefore
we can unify them.
In short, collapsing geometry means making a geometry use just as many facets as required and no
more. This is very important since the time required calculating a "hit" is proportional to the number
of facets in the system (except if you use structures). Collapsing is recommended in all scenarios,
therefore the Collapse dialog appears after each geometry import:
Coplanar
Adjacent to each other
Have the same outgassing, temperature, etc. parameters
and merging them.
3. Finding consecutive edges that are collinear, i.e. if a straight line is divided to 6 different
sections and merging them.
Therefore you can toggle which of these steps you want to perform, and for each of them you can set
a tolerance parameter that can be fine-tuned to the size and detail level of your geometry.
Vertices option
This is required to run at least one time, otherwise facet collapsing won't work.
It operates on all vertices of the geometry, regardless of what is selected.
The tolerance value is the maximum distance in centimeters, within which two vertices are considered
to be at the same coordinates.
Facets option
Each facet's plane can be defined by an Ax+By+Cz+D=0 equation. The tolerance value is the maximum
coefficient difference within which two facets are considered coplanar.
cern.ch/test-molflow
page 23
CERN
Hint: to speed up collapsing large systems, select a smaller part of the system, turn off vertex collapse
(after it has run for at least once!) and use the Collapse Selected command. Since the collapse function
performs an all-to-all comparison, dividing the system to (lets say) three parts and collapsing by groups
will be exactly three times faster than the Collapse All command. (1000*1000 comparison versus
3*333*333 in a 1000-facet system...) This is because you are helping Molflow to decide which facets are
next to each other.
Each facet has an ID, starting from 1. The top of the panel shows how many facets are selected, and if
only one, then it will show its ID.
cern.ch/test-molflow
page 24
CERN
Particles in
Uniform desorption: particles will fly out to every direction with equal probability for every
(spatial) angle.
Cosine desorption:
corresponds to a Lambertian radiator where the probability of the angle of radiation is
proportional to the cosine of that angle. This means in practice that particles are more
prone to leave a facet perpendicular to its plane.
CosineN desorption: The same as above, but the probability is proportional to a chosen
power of the cosine of the angle. In practice, the higher the exponent is, the more
perpendicular the gas will flow to the facet.
The outgassing and outgassing per area numbers are taken into account for two purposes: to
calculate the pressure (that is proportional to the outgassing rate), and also to help MolFlow determine
the ratio of the desorption density (when desorption happens at several surfaces).
The two parameters (outgassing and outgassing/area) are linked together, and calculated upon typing.
The units for outgassing are arbitrary_pressure_unit * liter / sec, where you can substitute that
arbitrary pressure unit with your preferred one. But you have to keep in mind your unit choice for
interpreting the pressure results: for example, if you have used mbar*l/s, then MolFlow will display the
pressure in mbars.
Defining outgassing for a single facet:
If only one facet is selected, then the outgassing and outgassing/area values are calculated as you type,
taking into account the area of the selected facet. In this case, the checkboxes don't have any meaning.
Defining outgassing for multiple facets:
cern.ch/test-molflow
page 25
CERN
The conversion between the outgassing and outgassing/area uses the sum area of the selected facets.
The checkboxes define which of the two values will be kept fixed, when outgassing is applied to
multiple facets.
Examples:
You want to set the outgassing of 10 facets to 0.5mbar*l/s each: type 0.5 to the outgassing
field, and apply the parameters keeping the "Outgassing" checkbox ticked
You want to set the outgassing of 100 different-sized copper facets to 1E-9 mbar*l/s/cm2
uniformly: type 1E-9 to the "Outgassing/area" field, and apply parameters with the checkbox
ticked next to it.
You have an outgassing structure, for example a hemisphere consisting of a lot of facets. You
want a total outgassing of 10mbar*l/s distributed between the facets, proportional
to the element areas: select all facets of the hemisphere, enter 10 to the "outgassing" field,
that will calculate the necessary "outgassing/area" value, then apply parameters with
the outgassing/area checkbox ticked.
The desorption file area in recent versions is only available if you use the Import desorption file option,
most likely exported from SynRad. If such a desorption map is loaded for a facet, this field allows you
to choose between actually using the map file or override it with a manual value.
Particles out
A facet that has a sticking factor other than zero will absorb (pump away) particles. Pumping can be
set by two parameters that are linked together: the sticking factor and the volumetric pumping speed.
Sticking factor is the probability (0..1) that a particle that hits this facet will be absorbed.
Volumetric pumping speed is converted to sticking factor before being applied. Note that if
multiple facets are selected, the sum is taken into account at the conversion (i.e. you have to
specify the total pumping speed for the facets).
The proper way of defining volumetric pumping speeds for multiple pumps is to calculate the
corresponding sticking factor on one facet, then applying the sticking factor on all selected facets. This
function might change with the upgrades to be more like the desorption definition (two checkboxes).
The formula used for the conversion is:
__ =
where the average molecule speed depends on the gas mass and temperature, so if you change it,
don't forget to update the sticking factor to correspond to the desired pumping speeds.
cern.ch/test-molflow
page 26
CERN
Sides allows you to define whether a facet is one- or two-sided. The difference is important and
new MolFlow users have to get used to the concept.
One-sided facets are opaque from the side where their normal vector is pointing (you can display
the normal vector of selected facets by ticking the Normals option in viewer parameters). They
are transparent from the other side, that is, particles will fly through them.
The area of one-sided facets is the actual geometrical area of the polygon.
Desorption from one-sided facets will happen in the direction of the normal vector.
Two-sided facets are opaque from both sides.
Their calculated are is double of the polygon area, meaning that when calculating pressure, it is
assumed that they receive hits from both sides!
They desorb particles on both sides (that is, in both directions).
Reflection type allows you to choose whether particles should be relaunched mirror to the
incident direction, or if they should be launched randomly at a cosine-weighed (Lambertian) directional
distribution. To simulate vacuum systems, use the latter (see Theory of Molflow chapter for reference
paper).
Opacity - The probability (0..1) that a particle going through the facet hits it. Useful for defining
transparent facets for measuring the pressure in arbitrary planes.
An example usage might be to simulate a plane which has holes on 20% of its surface by a 0.8 opacity
facet.
Temperature Facet temperature in Kelvins. Currently the support for non-isothermal systems is
limited (only textures are weighed taking temperature into account). However, it is recommended to
set the temperature of the system (on all facets at the same time), since the conversion between the
sticking factor and the volumetric pumping speed, and also the pressure calculation contains the
average molecular speed, that depends on the temperature.
Area field - Displays the selected facet's area in cm2. This is the sum area if multiple facets are
selected.
cern.ch/test-molflow
page 27
CERN
Teleport to facet # - This field allows you to set up a teleport, which means that an incident particle
will be transported to the facet whose ID you set here. See the relevant section (3.13) for instructions
to do this. The default value is 0, which means that the facet is not a teleport.
Structure Defines the ID of the superstructure the selected facet belongs to. See the
Superstructures section for information about this function.
Link A link is a gate facet that connects superstructures. In this field, you enter the number of the
superstructure that particles crossing the facet will belong to. For example, if the field value is 3, then
a particle that will cross this facet will look for collisions with facets that are in structure 3. For more
info on setting up structures, see section 3.14.2.
Profile Enables calculation of pressure profiles on the selected facet. For that, the facet is divided
into 100 slices of equal length along the vector U or V. The U vector is the one pointing from vertex
index 1 to vertex index 2, so the user can actually change the orientation of the U vector (and thus
the profile direction) by using the Shift Vertex command in the Facet menu.
Mode
Allows choosing between the Monte Carlo and Angular Coefficients method. Note that for the
moment, the latter is experimental and is not documented.
cern.ch/test-molflow
page 28
CERN
Hits
Shows the total number of the hits on all facets, and the simulation speed. Note that the hits/sec value
is the main indicator of your computer's speed and the simplicity of the geometry. As a thumb rule, a
geometry that contains 10 times more facets will be 10 times slower. Defining Superstructures (section
3.14) can speed up simulation.
Des.
A particle is kept in the system until it is either leaked or is pumped away. This number shows how
many particles were created (desorbed) during the simulation. If the number doesn't increase, that is
probably an indicator that the particles are stuck somewhere, thus they can't be pumped away. (Each
subprocess creates and traces one molecule at a time, so if you have 4 subprocesses and they are
stuck, this number will stay at 4)
Leaks
Indicates that some particles escaped from your system (went in a direction where they didn't collide
with any facet). These lost particles represent a geometry error, probably due to too coarse collapsing
or improperly oriented one-sided facets.
This list displays the hit, desorption and absorption number of all facets, and allows you to find and
select facets.
The list is sortable. Click on the column label of Hits, Des. or Abs and the facets will be listed based
on that number. Click again on the same column to switch between ascending/descending order. This
is a good way to find which facets are hit the most of times, for example. To reorder the list based on
facet numbers, simply click on the # column label.
The facets are selectable. Click on any row to select a facet. Once the list has the focus, you can
scroll and change selection with the UP and DOWN keys. Holding down SHIFT and using the UP and
DOWN allows you to select multiple consecutive facets. If you want to select/deselect multiple facets
by the mouse, hold down the CTRL key.
cern.ch/test-molflow
page 29
CERN
The Global Settings panel allows you to toggle simulation parameters that are not part of a facet.
These are mostly program settings, but this is also where you can define the molecular mass of the
gas in your system.
View settings
Anti-aliasing
It is a function that gives your geometry a nicer look on the screen by smoothing lines. In theory,
disabling it might increase performance, however, practice shows that the difference is negligible.
cern.ch/test-molflow
page 30
CERN
White background
Although a blue-black gradient background looks nice on the screen, if you want to print the geometry
or insert a screenshot in a document, it is better to invert colors and remove the background.
Gas settings
Gas molecular mass
This is the field where you can define the mass of the gas molecules in your system. Molecular mass is
used to determine the average molecule speed, and has therefore a role in pressure calculation and
the sticking factor/volumetric pumping speed conversion.
Total outgassing
Sum of the outgassing rate of all facets in the system. Useful to verify if outgassing / area values add up
to a total outgassing as expected or not.
Program settings
Autosave
This feature will save an autosave.geo file in the program directory at a given interval. If the program
is closed normally, this autosave file is deleted upon exit. If not, the file will remain in the directory,
and upon next launch, MolFlow will detect it and offer the user to load it.
You can enter any value in the frequency field, including fractions (like saving every 0.5 minutes). Keep
in mind though that autosaving will interrupt your work, and that is why the Autosave only when
cern.ch/test-molflow
page 31
CERN
simulation is running option has been added: it is assumed that the user is not interacting with MolFlow
while its simulating.
When Molflow exits normally, this autosave file is deleted. Thus, if Molflow finds an autosave file in its
directory upon startup, it will assume that the previous instance did not exit normally, and the option
to reload the autosave file will be offered to the user:
If you want to disable this functionality, just enter a big number, like 9999 as autosave frequency.
Turn it off if you dont want MolFlow to connect to the internet. Otherwise it is recommended to
keep it on.
cern.ch/test-molflow
page 32
CERN
Non-isothermal system
This experimental feature hasnt been fully verified so interpret results with caution. If enabled,
molecules will have a temperature, initially that of the desorption facet, and after each collision they
are thermalized to the walls temperature that they hit.
The difference is that on textures, each hit is taken into account with a factor, where Tsource
is the temperature (in Kelvins) of the facet the particle is coming from, and Twall is that what the facet
where the collision occurs and where the texture is.
Note that only textures will be different, profiles are incompatible with this calculation mode.
Subprocess control
MolFlow uses workers called subprocesses (molflowSub.exe) to do the actual simulation calculations,
whereas the main program serves as an interface to handle geometry, set up parameters and display
results.
Reasons to run a lot of processes:
On a multi-core system, for maximum performance, you should run at least as many processes
as the number of cores in your CPU
Each process uses a different random number generator seed. Thus, running 4 processes, for
example, will eliminate repetitions of the random-number generator. Molflow uses
the Mersenne-Twister algorithm to generate random numbers.
Each process keeps the geometry in the memory. Thus, running 16 processes will keep 16
copies of your geometry in the memory.
In the subprocess control panel, you can define the number of workers running in the background,
and view the state of these subprocesses as well. Please note that on some architectures the
subprocesses might appear to be in dead state (Status column), whereas its simply a false warning
message. The bug is known but a solution is yet to be provided.
The main interest for the user here is the number of subprocesses: it is advised to set it to the
number of CPU cores in your computer. To do that, enter a number in the Number of
subprocesses field, and then click Restart. This will reset your simulation. (To continue in the state
cern.ch/test-molflow
page 33
CERN
where it was before changing the number of processes, you have to manually save the file, change the
number of processes and then load it again.)
Hint: clicking the Apply button in Global Settings wont change the number of subprocesses. You
have to actually click on Restart to do it.
Changing the number of desorption molecules serves as a software limit to stop the simulation
after desorption molecules reach a certain number. If set to 0, the simulation will run until stopped by
the user. This function might be useful if we change parameters and want to compare results after a
given number of desorbed molecules. Therefore, entering 100000 here will pause the simulation after
100K desorbed molecules.
3.10.
Processing results
When your simulation is set up and has been running for some time, you can immediately see some
results, for example, the number of hits in the simulation and on certain facets.
Opening the Facet Details window will also show you a column where the average pressure on a facet
is calculated.
However, usually we need more details, and we can take advantage of the visualization and postprocessing options in MolFlow to display our results directly. For memory and speed considerations,
the counting of Profiles and Textures must be enabled manually on every facet of our interest:
Formulas
To add a new formula, use the Tools menu:
cern.ch/test-molflow
page 34
CERN
Then you will be offered a dialog window where you can define a Name for your formula (to remember
its content), and also to define the formula itself:
The majority of the formula dialog is a reference to the variables that you can use. For clarity, we go
through them:
Constants
Kb Boltzmanns constant 1.38065*10-23
R Gas constant 8.3144621 J/mol*K
Na Avogadro constant 6.022*1023
PI 3.14159
Global simulation variables
SUMABS The number of all MC particle absorptions in the system. (This number is not saved in a
GEO file)
SUMDES The number of all MC particles created (desorbed) during the simulation.
SUMHIT Total simulated hits in the simulation.
DESAR The total area (in cm2) of all facets that have a desorption set up
ABSAR The total area (in cm2) of all facets that have a desorption set up
QTOT The total outgassing rate in the system (sum f outgassing rate on all facets)
MPP - Mean pumping path, that is, the average flight distance of a particle in the system before it is
being pumped away (Total flight path divided by the number of absorptions. Not saved with a GEO
file)
cern.ch/test-molflow
page 35
CERN
MFP Mean free path, that is, the average distance a particle flies in the system between two collisions
with a wall (Total flight path divided by the number of hits).
Facet variables
An, Dn, Hn The number of absorptions, desorptions or hits on facet #n, respectively.
Example: A5, D80, H101
Sum variables
It is sometimes necessary to calculate the sum of the above facet variables over a group of facets. To
avoid adding the individual variables one by one in the formula, there are two types of SUM variables:
Hint: calculating SUM operations of a large number of facets might be slow. As formulas are updated
constantly (even when the simulation is not running), use them with caution: they might slow down
the entire program.
To edit an existing formula, click the button next to it, change the name and the expression,
and click Apply.
To delete a formula, click on the button next to it and then the delete button.
Formulas are saved with GEO files, and facets reference numbers are automatically updated when you
perform geometry operations and when you insert a GEO file to your existing geometry.
Profiles
Profiles offer you to immediately display the pressure distribution along a certain direction on a certain
facet. The direction can be either the local U vector (pointing from a facets first to second vertex) or
the V vector (perpendicular to U). These two vectors can be rotated by the Shift Vertex command
(CTRL+H) in the Facet menu.
To set up profiling on a Facet, go through the following process:
1. Select the facet(s) to profile
2. Verify the U and V vector orientation
cern.ch/test-molflow
page 36
CERN
4. From now on, profiling is set up. It means that your facet is divided into 100 slices of equal
length along the U vector, and hits (thus pressure) is calculated for each slice.
Note: To get correct pressure results, your slices have to be of equal area, thus profiling
works only on rectangular facets.
5. To visualize the pressure, open the Profile Plotter window in Tools menu:
6. By default, nothing is plotted, so you have to add the curve(s) manually. In the left/hand dropdown list, select the facet that you want to add to the plot:
Show Facet will select the facet in your geometry (so that you can identify it), and Add Curve
will display the pressure values in the 100 slices as a graph:
7. Finally, you can customize the look of your graph by right-clicking on the graph area.
In this menu, you can also customize graph appearance, including axis properties, such as
cern.ch/test-molflow
page 37
CERN
Angular profiles
Angular profiles allow you to view the angle distribution of incident molecules on a 0-100 degree
(gradient) scale on any facet. Setting it up goes the same way as setting up pressure profiles, but
in this case, the orientation of the U and V vectors dont have significance.
Perpendicular to facet
50grad = 45deg
Exporting profiles
Right-clicking on the plot will offer you to save the plots in a TXT file for further processing in
external programs.
cern.ch/test-molflow
page 38
CERN
Textures
Whereas profiles are used because they immediately show a graph within MolFlow, their shortcomings
were mentioned before: they always consist of 100 slices and they can only be used on rectangular
facets. In general, they can be regarded as a legacy of the old MolFlow version, so the use of textures
is recommended.
To add textures to your geometry, first you have to create a Mesh, which is a grid of rectangular
elements on the facet that you want to color.
1. Select the facet(s) where you want to add a Mesh. In the Selected Facet panel, click the Mesh
button.
cern.ch/test-molflow
page 39
CERN
The upcoming Facet Mesh window show you information about the selected facet(s) and allows
you to set up a mesh.
The most important parameters are to decide the size of the cell elements, and to define what to
count.
The resolution field determines how many cells there will be per cm length (the default length unit in
MolFLow). That is, if you enter 10 as resolution, it will mean that each square cm will be divided into
10x10
elements.
(And
accordingly,
one
cell
will
have
0.1cmx01.cm
size).
To help you decide the correct density for your geometry (that you can later refine), the total number
of cells in your system is calculated upon typing. Usually you dont need more than a few hundreds of
thousands of cells.
2. You have to decide what to count. For most cases, you want to visualize the pressure on a
wall in the system, in that case, pressure is derived from reflections on the wall. If your facet is
transparent, to know the pressure, you have to record the transparent passes. Thats the
two parameters you have to set up, click Apply Mesh.
3.
Your texture is now set up. You can see it in white color (default texture color) and you can
see the cell boundaries.
Hint: To show cells and textures, you have to tick the Texture toggle in Viewer settings and
enable the Show Mesh with the More button.
4. If you launch the simulation, your textures should new get their color. Note that coloring
options, and most importantly, scaling can be set in the Texture Scaling dialog in the Tools
menu:
cern.ch/test-molflow
page 40
CERN
On the bottom of this dialog, you can see the color scale that maps different pressures to
different colors. Hovering you mouse pointer over the scale will display you the pressure
corresponding to the color under your pointer.
The Autoscale option will try to extend this scale over all pressure values present in your
system (ignoring cells with 0 hits). Note that very small cell elements might have very high
displayed pressures (difficulty normalizing over the very few incoming hits), so you might
manually set the scale.
The Set to current button will disable autoscaling, but before that it will set the Texture
Range textboxes to the currently measured values (so it serves to lock autoscaling).
Often we need to read the actual cell values. There is a dialog window for this purpose, which
also allows the user to copy data on the Clipboard for external processing.
The Texture Plotter window is available from the Tools menu. It displays the map of the mesh
of the currently selected facet. Selecting a cell on it will display its position on the geometry in
the form of a white border cell.
cern.ch/test-molflow
page 41
CERN
In the view drop-down list, we can choose between different quantities to display:
a. Elem. Area: shows the area of cells in cm2. The value should be the same on all
whole cells, and smaller on cells on the border of the facet.
b. Pressure: the pressure on the cell displayed in the arbitrary units you used to
define outgassing
c. Hits: the number of MC hits on the facet. Please note that values are counted from
the pressure, therefore sometimes the results are not exactly integer.
d. Average velocity / velocity / count: these functions are for direction counting,
see later
Exporting results
If we need to post-process texture maps in an external program, we have two options:
To export texture for a single facet, we can put it on clipboard by right-clicking and using the
Copy All function.
Select the facet(s) that you want to export you can select all, for example
Use the Export Selected Textures option:
cern.ch/test-molflow
page 42
CERN
Choose a TXT file name, and the results will be written in a TXT file, separated by tabs:
Counting directions
At certain points of the geometry, it might be required to visualize / determine the average direction
of the particles. As pressure calculations assume that molecule speed is isotropic, it is sometimes
worth checking it.
Counting directions also requires to create a mesh with the Record direction option. To display average
directions in the form of cones, the Show direction option must be enabled in 3D Viewer Settings
(available by pressing the More button in the viewer parameters).
cern.ch/test-molflow
page 43
CERN
Using the Texture Plotter we can visualize the directions, using the following three options:
Average velocity: the sum of all (normalized) velocity vectors crossing the cell, divided by
the number of desorbed particles. If there would be a cell in the system that all particles cross
once, its value would be 1.
Velocity: the actual average velocity vector in X, Y, Z coordinates
Count: number of times a molecule passed the cell
Example usage: On the pipe below, we lose isotropy on the left side, where a very strong pump
(sticking probability = 1) is located (average direction tends to point to the left):
cern.ch/test-molflow
page 44
CERN
3.11.
Advanced handling
In this chapter we go through functions that make geometry handling easier in MolFlow.
Selection groups
You can memorize selections (that is, a certain group of facets). It is useful to define such groups so
you dont have to select them again if you want to change a parameter.
Apart from facilitating the re-selection of the facets in the group, selections also serve as a way to
perform SUM operations on all facets that are part of a group when you use Formulas.
To create selections, select the facets that you want to include, then choose Selection -> Memorize
Selection to -> Add new (or use the shortcut, CTRL+W). Then give a name to the selection.
cern.ch/test-molflow
page 45
CERN
To recall (select) selections, press the ALT+1, ALT+2, combinations, or use the menu:
cern.ch/test-molflow
page 46
CERN
To redefine selections, use Selection -> Memorize Selection to then choose the selection group
that you wish to overwrite.
To clear selections, (to free up ALT shortcuts, for example), use the Clear Memorized menu.
To perform SUM operations on selection groups, see the Formulas section.
Then you will be offered the usual Open File dialog, and upon opening, the new file will appear in its
original position.
cern.ch/test-molflow
page 47
CERN
As this is probably not its final place, the new facets remain selected, so you can easily apply a geometry
operation on them, most probably aligning the new body to your existing geometry (see section
3.12.6).
To export a part as a separate file, simply select the facets and use File -> Export Selected Facets:
Your part will be saved as a separate geometry that you can later insert in your system.
3.12.
Geometry Editor
Whereas it is recommended to use an external CAD program to edit your geometry, MolFlow offers
basic operations to make small modifications and to assemble different parts inserted separately. In
points 3.12.1-3.12.5 (move, mirror, scale rotate), it is always possible to apply changes on the
cern.ch/test-molflow
page 48
CERN
Moving facets
A basic dialog window where you enter the offset coordinates in centimeters. If you are not sure of
the needed offset, enter a small value (for example, dX=1cm), and every click on the Move button will
be performed immediately. Use the copy button to create a copy at an offset location:
A new tube created 4cm to the X direction from the original. Note that facets of the new copy are
selected.
Moving vertices
It is possible to distort the geometry by moving only certain vertices. All facets that contain the given
vertices will be updated (area recalculation, etc.) but you need to re-apply the mesh.
cern.ch/test-molflow
page 49
CERN
Mirroring facets
This function allows you to mirror parts. This might be useful since MolFlow uses a left-handed
coordinate system, whereas most CAD programs use a right-handed one, resulting in a mirrored view
upon importing.
cern.ch/test-molflow
page 50
CERN
The purpose of the dialog window is to define the mirror plane. This can be one of the default XY,
YZ, XZ planes, or the plane where a facet lies, but you can even define a new plane by selecting 3
vertices or by entering its equation. After mirroring, verify if the normal vectors are pointing in the
correct direction.
Scaling facets
It is possible to scale or distort facets. This function is useful if there was a unit mistake when importing
the STL file, or if we want to make an ellipse out of a tube.
cern.ch/test-molflow
page 51
CERN
The invariant point: the centre of the scaling, that is, the point which will stay at the same
position. This can be defined by coordinates, by a selected vertex or it can be the centre of a
facet.
The scale factor: for the point at X, Y, Z coordinates, the new position will be
[ factorX * (X-X0) , factorY * (Y-Y0) , factorZ * (Z-Z0) ]
Where X0,Y0,Z0 are the coordinates of the invariant, and the factor parameters are the content
of the text fields (in uniform scaling, factorX=factorY=factorZ).
cern.ch/test-molflow
page 52
CERN
Rotating facets
The axis can be one of the default X, Y, Z axes, it can be a local U,V or N vector a facet. You
can also define a new axis by either using 2 vertices or defining a base point and a direction
vector with coordinates.
The rotation angle is in degrees, and it can be negative.
Hint: If you use the 2 vertices option, the direction is not well defined. Use a positive or negative
value for the rotation angle, and see which yields the correct result.
Aligning facets
When you insert a new part or geometry, the most obvious step to do next is to attach it to your
existing geometry. This function takes some practice to master, but is very useful once learned.
cern.ch/test-molflow
page 53
CERN
cern.ch/test-molflow
page 54
CERN
When you open the window, the facets that are actually selected will be memorized as the ones to
move. If this is not what you want, you can select other facets and click the Update from selection
button.
cern.ch/test-molflow
page 55
CERN
Hint: In this example, we already had two facets at the end of the pipe. If the planes to snap together
dont have facets, you can always create some temporary facets for defining the plane. Refer to the
section 3.12.7 to read more about creating facets.
cern.ch/test-molflow
page 56
CERN
Change the 3 checkboxes until you have the result you want. You can always use the undo button to
restore the original position.
cern.ch/test-molflow
page 57
CERN
Done! Depending on what you want, you can delete the intermediate facets that were used for aligning,
and also collapse the geometry to merge collinear lines:
Shift vertex
Changes the numbering of the facet's vertices. You can see these numbers by enabling
the Indices display option and selecting a facet. Use this option if you want to change the U,V vector
positions, and also in some cases this option solves the "non simple facet" problem.
cern.ch/test-molflow
page 58
CERN
Directly view / edit the coordinates of a selected facet. Note that you can also use the Edit
Coordinates command of the Vertex menu, which will list all selected vertices.
Explode selected
With this option you can divide a facet to new facets, each inheriting their parent's parameters. First,
define a mesh on the facet(s), and then this command will create one new facet of each mesh cell.
Delete facets
Available from Facet -> Remove selected (CTRL + DEL)
Will delete selected facet(s), and also prompt to delete the liberated vertices.
page 59
CERN
cern.ch/test-molflow
page 60
CERN
2. Make it two-sided
Two-sided facets count collisions or particle crosses from both sides. Since our facet is in the
middle of our system, it can be two-sided:
Please note that pressure in molecular flow is not isotropic: it depends on the angle of
measurement. Therefore working with two-sided facets is also a good idea since the average of
the two pressures from the two sides is calculated.
3. Add a texture
To make our new facet actually count particles crossing it (and thus the pressure), we have to
add a mesh with the count transparent passes option enabled:
Done! Now our new facet will count the pressure in the middle of our system:
Pressure is measured through the cross-section of a tube while particles cross the transparent facet.
cern.ch/test-molflow
page 61
CERN
To plug this hole with a facet, we could theoretically select all vertices on the outline, but well use a
special command.
cern.ch/test-molflow
page 62
CERN
Then we select all vertices on that plane by the special Select Coplanar command:
Then select a tolerance value (in centimetres) comparable with your system size:
cern.ch/test-molflow
page 63
CERN
Now you are ready to create the new facet (dont worry if you selected concentric vertices: MolFlow
will create the largest possible facet):
cern.ch/test-molflow
page 64
CERN
3.13.
In accelerators, we often deal with periodic structures, for example with circular storage rings. The
idea is that it is sufficient to include the repeating part of the geometry only once, and then connect
its two ends by defining teleports. Therefore, once a particle hits one end of the structure, it is
transported back to the other side, thus simulating an infinite loop.
A simple tube with its two ends connected through teleports. See the yellow dotted lines which
visualize particles that are just teleported.
Though the principle is simple, several conditions have to be met to define such a structure in Molflow.
You have to have two teleport facets, that will teleport particles to each other. For the correct
functioning of the teleport, the following conditions have to be met:
cern.ch/test-molflow
page 65
CERN
Facet A must be a teleport to facet B (enter facet Bs number to the teleport facet parameter
field)
Facet B must be a teleport to facet A
In the example below, well set up a teleport on a tube consisting of 7 facets. The beginning and the
end of the tube are facets number 1 and 2, so well essentially work on them.
cern.ch/test-molflow
page 66
CERN
Make both facets 2-sided (so they can detect particles from the back as well):
Select facet #1 and fill in the Teleport parameter with 2 (the number of the teleport
destination)
Done! Launch a particle from somewhere and your simulation will be running with teleports.
3.14.
Superstructures
Superstructures, often simply referred as structures, are smaller parts of your geometry.
Their purpose
After a facet is hit and a particle is rebounded in a new direction, Molflow looks for the next collision
with the help of ray tracing algorithms. The program must essentially search for collision with ALL of
the facets, then decide which collision is closest, thus which will actually happen. 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.
cern.ch/test-molflow
page 67
CERN
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.
Linking structures
To let particles know that they arrive to a new structure 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:
cern.ch/test-molflow
page 68
CERN
To make a facet link towards another 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.
cern.ch/test-molflow
page 69
CERN
3.15.
In MolFlow, one Facet can have only one desorption value, and thus the desorption density is always
uniform. This is adequate for simulating the gas influx through a port, but if we want to model a finer
distribution of desorption, we have to do a few tricks.
Electron current density map on the wall of a tube, ideally the desorption should follow this
distribution
One approach is to break up the facet to smaller elements; one would typically do it with the
Explode command (you add a Mesh to the facet and the command makes the mesh cells become new
facets).
Once we have the smaller facets, it is enough to assign a desorption value to them one-by-one.
However, there is an automated method to do this faster, which allows you to directly import any
data table from the clipboard.
Step1: You have to define how fine the outgassing matrix is by defining adding any kind of mesh to
your facet:
cern.ch/test-molflow
page 70
CERN
Step2: Select the facet and issue the new "create outgassing map" command:
Below you see a map of the facet. For each mesh element, you can manually set the outgassing value.
Note that the edited cell's location is highlighted on the geometry (similar to texture plotter):
cern.ch/test-molflow
page 71
CERN
You can also paste values from the clipboard from Excel. The values are pasted to the right and
bottom from the actual cell. Then you can define the desorption type (Uniform, Cosine, Cosine^N).
Finally, if everything's ready, click Explode.
The exploded geometry highlights those facets that have desorption now:
To test that everything was well defined, add a mesh that counts desorbed molecules, and you'll see a
nice color map of the values you just entered:
cern.ch/test-molflow
page 72
CERN
4. Theory
4.1. Pressure calculation
In a vacuum system, the velocity of the gas molecules follows the Maxwell-Boltzmann model.
According to this, the mean speed of the molecules is:
Where
The impingement rate (collisions on a surface per second on a unit area) is therefore
1
1
8
=
4
4
When running a Monte Carlo simulation, we have a limited number of virtual molecules that our
computer can trace; therefore it is necessary to convert the MC virtual particle density to the
physical density of the real world.
Sticking to SI units, the pressure on a surface in a MC simulation is therefore:
cern.ch/test-molflow
page 73
CERN
= 4
Where
p is the pressure in Pa
Q is the total outgassing of the system in Pa*m3/sec
hits is the number MC hits recorded on the surface in question
N is the total number of MC particles our computer has created and traced
A is the area of the surface in m2
m is the molecular mass in kg/mol
In MolFlow, we prefer to use mbars, cm, liter and g/mol units, moreover, we have some computational
aspects to consider, therefore the exact code to calculate the pressure is:
4 10
8
0.001
1
2_
Where
5. Computing aspects
5.1. Random generator
MolFlow uses the Mersenne Twister algorithm, grabbed from NumPy (http://numpy.scipy.org). It relies
on Knuths PRNG and some magic constants. According to the Wikipedia article, its advantages are:
It has a very long period of 219937 1. While a long period is not a guarantee of quality in a
random number generator, short periods (such as the 232 common in many software packages)
can be problematic.
It is k-distributed to 32-bit accuracy for every 1 k 623
It passes numerous tests for statistical randomness, including the Diehard tests. It passes most,
but not all, of the even more stringent TestU01 Crush randomness tests.
cern.ch/test-molflow
page 74
CERN
This area formula is derived by taking each edge AB, and calculating the (signed) area of
triangle ABO with a vertex at the origin O, by taking the cross-product (which gives the area of a
parallelogram) and dividing by 2. As one wraps around the polygon, these triangles with positive and
negative area will overlap, and the areas between the origin and the polygon will be cancelled out and
sum to 0, while only the area inside the reference triangle remains.
The formula was described by Meister in 1769 and by Gauss in 1795. It can be verified by dividing the
polygon into triangles, but it can also be seen as a special case of Green's theorem. [source: Wikipedia
article]
cern.ch/test-molflow
page 75
CERN
Upon launching the simulation, all geometry details are written by the main process to the loader
dataport in a compact byte sequence, and then a LOAD command is issued through the dpControl
dataport to the child processes. Once they load the geometry, the simulation is started, and they
regularly update the dpHit dataport with simulation results (notable with the hits). This dpHit dataport
is then read by the main process, and after post-processing, the simulation state is visualized to the
user.
5.6. Auto-updater
MolFlow has a proprietary updater that checks for new version on startup. The updater process starts
minimized and quits in 5 seconds if it is determined that MolFlow is up to date, otherwise a window
pops up allowing updating automatically.
Please keep in mind that MolFlows update server populates anonymous user statistics of its users
(using Google Analytics), so by checking for updates you submit the same data (country, network
provider, etc.) as you do when you visit webpages. It is for this reason that you can disable checking
for updates, but generally it is advised to keep the feature on.
The updates mechanism works the following way:
1.
2.
3.
4.
5.
page 76
CERN
MolFlow uses an open-source compression engine, 7-zip to compress .geo7z files from .geo files. This
is beneficial because .geo files are essentially text files with a lot of repeating terms, and thus are prone
to good compression.
Because .geo7z files use the 7z format, if you associate them to 7-Zip, you will be able to open them
easily in Windows.
A .geo7z file open in 7-zip viewer. Note that the .geo file was compressed from 34MB to 820kB.
If you use the Compression option, files will be saved in .geo format, and then renamed to
Geometry.geo (to allow .geo7z files to be renamed without breaking reference to their content). Then
compress.exe (in MolFlow directory) will be called that serves as an interface between MolFlow and
the 7za.exe command-line version of 7-zip.
Compress.exe will do the following: it will start minimized as a background process, not interrupting
MolFlow. It calls 7-zip with the correct parameters, and then watches the output. If 7-zip returns the
Everything is OK message, then the original .geo file is deleted (since we have a compressed copy
of it), otherwise the file is kept and the error message is displayed to the user by popping up the
minimized window.
cern.ch/test-molflow
page 77
CERN
The users sees this error message (file used by another process) if something goes wrong during
GEO file compression
cern.ch/test-molflow
page 78
CERN
5.8. Website
The current website, http://cern.ch/test-moflow is running on the Drupal CMS service. Hosting and
maintenance is fully supported by the CERN infrastructure, to the extent that configuration and user
account management modules are integrated by default, and user roles are managed by CERN egroups.
As of May 2013, the website had 2700 visits from 1100 unique visitors, and the average user
spends 5 minutes on the site.
cern.ch/test-molflow
page 79