flair for FLUKA Quick Start Guide: Geometry Editor /fleə(r)/ n [U,C]1 natural or instinctive ability (to do something well, to select or recognize what is best, more useful, etc. [Oxford Advanced Dictionary of Current English] author: email: www: version: last change: Vasilis Vlachoudis [email protected] http://www.fluka.org/flair 1.1 May 2013 1 n: noun, U=Uncountable, C=Countable -1- Contents 1. Introduction........................................................................................................ 3 1.1. Geometry description..................................................................................3 2. Setting up........................................................................................................... 5 2.1. Project and Input......................................................................................... 5 2.2. Geometry.................................................................................................... 6 2.3. Image Layer................................................................................................7 3. Geometry Editing.............................................................................................. 13 3.1. Bodies........................................................................................................ 13 3.2. Region Editing........................................................................................... 15 4. 3D visualization................................................................................................ 22 4.1. Clipping body............................................................................................. 24 -2- 1. Introduction 1. Introduction In the present tutorial a step-by-step example is described using the Geometry Editor in order to build a complex geometry of one beam dump (fig. 1). Figure 1. Final geometry in flair, cut with a rectangular clip body to see the interior To follow this tutorial, you will need: 1. Basic knowledge of FLUKA, especially the combinatorial geometry 2. Basic knowledge of flair (see flair basic1 tutorial) 3. Basic knowledge of the Geometry Editor The present tutorial is available also in forms of video tutorial on YouTube User=Flair4Fluka. 1.1. Geometry description First thing you have to do is to collect all technical drawings, photos information concerning your geometry to build (fig. 2,3,4). Figure 2. 3D representation of the dump cut in half -3- 1. Introduction Figure 3. External dump dimensions Figure 4. AA cross section 1. 2. 3. 4. Please note: The cylindrical symmetry All dimensions in mm. Remember FLUKA is using cm! The beam is entering the dump from the right side through the 10cm long hole in order to minimize the back scatterings. The cooling water is entering from the center hole on the left side and it follows a spiral path around our dump. Since FLUKA do not have any spiral shaped body we need to approximated it with cylinders. -4- 2. Setting up 2. Setting up 2.1. ● Project and Input Launch flair by typing the following command, or by clicking the flair icon $ flair The flair main window and the output window will appear. ● Start by selecting the root node on the left frame (it should be already selected). The right frame should show the general FLUKA project information, like title, input, geometry, executable file names and notes. ● Click on the button with the new icon (on the right of the Input Filename field) to create a new input file. The new icon on the toolbox creates a new project. A list box will pop-up to select one of the various standard templates. Select the empty by double clicking on it. The dialog will show: prefixed with “D:” the default templates that exist in the flair package prefixed and with “U:” all the user defined templates. The user defined templates are located in the user directory ~/.flair/templates A basic input file will be created with an empty geometry. It will contain two concentric spheres blkbody and void and one region called BLKBODY. All the internal geometry will be undefined. ● In the Title entry field, type something like: Main dump ● An information dialog box will appear asking user to update the TITLE and GEOBEGIN cards inside the FLUKA input using the title that was entered in the project. Click yes and automatically all FLUKA cards that require a title string will be set with the project title. ● Add also a small note describing the present project (optional). -5- 2. Setting up 2.2. ● Geometry Next move to the geometry editor either from the tool bar or by pressing F4 or from the menu View → Geometry Editor. A new window will appear with the geometry editor. For a description on how to navigate in the geometry editor please look the introduction to Geometry Editor lecture from the beginners FLUKA course ● The 4 viewports, clockwise from the top-left: ● Front: Red (X:Y) ● Top: ● Back: Magenta (-X:Y) ● Left: Blue Green (Z:X) (Z:Y) show only slanted red lines meaning that the space there is undefined, which is normal since the void sphere has a radius of 10000 cm. To see the BLKBODY region, zoom far out using the mouse wheel or the [-] button. ● The first thing to do is to choose the geometry coordinates. For this tutorial, the following coordinate system will be used: ● Z : direction of the beam, normally horizontal ● Y : vertical axis pointing upward ● X : horizontal axis perpendicular to the beam -6- 2. Setting up 2.3. Image Layer ● In this step we will create a new layer containing the technical image (Figure 4) as a calibrated background on our geometry, in order to facilitate the editing. Any bitmap image can be imported (jpg, gif, png, bmp, ... directly converted from the technical image or even from paper scanning!) ● Download the Main_Dump.png from the flair web site Main_Dump.png ● Fig.4 shows the top cross section of the geometry therefore the image coordinates correspond to horizontal-Z, vertical-X, according to the previous definition of our coordinate system. Since the beam is entering from the right-to-left the horizontal-Z is reversed moving to positive values from right-to-left. ● So we are going to work in the Top:Green, viewport. ● Click on the Layers button the shortcut Ctrl-L. ● The geometry layers will appear on the toolbar on top of the viewport or click By default there are 4 predefined layers: • • • • Borders: where only body borders on region descriptions are shown Media: where regions are filled with a random material color (user customizable) 3D: a very basic 3D view Lattice: like the media but lattices and voxel geometries are also visible ● The first two layers “Borders” and “Media” cannot be modified or deleted All the others can be renamed, modified and deleted. The user can also add his own layers, depending on his needs. ● A new layer with the technical drawing has to be created. 1. Press the icon next to the Layer name and a new layer will be added named “Layer 1” 2. rename it to “Drawing” -7- 2. Setting up 3. click on <add> last item of the listbox to insert the Image layer ● Click on the Image: button on the right and load the figure 4 named “Main_Dump.png” ● To start the image calibration, click underneath on the “Calibrate” button ● A new window will appear. Maximize it and zoom out with the mouse wheel or with the shortcut [-] until you see the entire image ● In this window, the user has to provide minimum 4 points in order the program to be able calculate the conversion from the image coordinates to the geometry. 4 points is the minimum to calculate the position, orientation, aspect and the skewness of the image. The more points you -8- 2. Setting up provide the more accurate the calibration will be done. ● Lets start with the four marker points around the Dump Core (Fig.1). Initially the points are not needed to be accurately placed, we will correct them later . ● Either click on the [Add] button below and then with the mouse left-click on the lower-right corner of the “Dump Core” or Press and Hold the Control Key (without clicking on the [Add] button) and left-click directly to the position of the marker point. ● [1] Enter the coordinates: [-8.0, 0.0, 0.0]. Figure 2, shows that the diameter of the Dump Core is 160mm, therefore X:-8cm. ● Repeat for the remaining 3 corners of the Dump core (anti-clockwise) with coordinates: [2] Top-right [8.0, 0.0, 0.0], [3] Top-left [8.0, 0.0, 40.0] and [4] Bottom-Left [-8.0, 0.0, 40.0]. The bold characters show the value you have to change. ● Clicking on the [Info] button will display the following window xi,yi are the pixel coordinates You can edit the value directly here inside the listbox x,y,z are the geometry coordinates [Editable value] -9- 2. Setting up ∆x,∆y are the pixel error when using the real coordinates and the transformation matrix below with respect to the pixel. With 4 markers the error will be the same for all of them since the system is not overdetermined. By providing more markers, a more reasonable representation of the error would be shown. The important thing in this step is the “Pixel Error” which in this case is of the order of 1.4 pixel, not that bad for a rough placement. ● Close the information window and let's improve the precision by more accurately positioning the markers. ● Zoom-in on each marker with the mouse wheel or [+]. You can also use the middle mouse button or the keyboard arrows to pan the image if needed. ● Drag the marker using the left mouse button and place it to the center of the line intersection as accurate as possible ● Repeat the procedure for all markers ● Click on the [Info] dialog and see how the Pixel error is decreasing (or increasing). ● Now it shows a value of 0.23 pixels, which is quite accurate. ● The image that has been used is coming from a image processing program (not scanned from paper), so the exact position of the markers should lie in the middle of the pixels, with decimal .5. The pixels are perfectly aligned horizontal and vertical so convert all decimals values to .5. Markers 1,2 and 3,4 have the same xi, while 1,4 and 2,3 have the same yi, reducing the error to zero! ● To edit the table move the cursor/mouse to the pixel value xi,yi and click Enter. ● Once the calibration is done, close the Info dialog, click [Ok] on the “Calibrate Image” window, and return back to the Layers dialog. - 10 - 2. Setting up ● Two more adjustments are needed and the layer is ready. ● [1] First adjust the “Black” color to some Cyan like by clicking on the “Black” button. Since the image lines are black, will be confused with the bodies boundaries which are also black. ● [2] Second tick the “Prompt draw” option. Normally the background image is displayed when the viewport is idle. However, during the editing process the background image needs to be visible all times during the various actions. The red text color of the option indicates a time consuming process, which when active delays the screen refreshing. ● The transparency is the blending amount from image and geometry. A value of 50% is a good choice ● Click [Apply] and then [Close] ● Maximize the Top:Green viewport. Benefiting from the cylindrical symmetry of the geometry, only one viewport is needed, however the user should be careful while editing the geometry on the impact on the other viewports. ● After creating the layer, the 4 markers that have been used for the calibration are shown on the viewport (can be used as snapping points if needed) and they are also appearing on the list-box on the right with a Magenta color showing that the visible attribute is On. ● From the Drop-down menu on the top-left of the viewport, select the created layer “Drawings” and the background image will appear. A bit dimmed due to the 50% transparency and reversed on the horizontal Z. - 11 - 2. Setting up ● To invert the Z axis open the Projection dialog ● To modify the projection basis, select the “Basis” tab ● Click on the [-u] button in order to swap the horizontal U axis, which in this case is the Z axis. ● Click on [Apply] and close. ● Now the viewport should display the image correctly. ● Save the project up to now with [Ctrl-S] or clicking on the button - 12 - , shortcut [o]. 3. Geometry Editing 3. Geometry Editing 3.1. Bodies The first step is to create all necessary bodies. This profiting from the snapping mechanism of flair can be done graphically, It snaps on the grid, markers, other bodies and intersection points from bodies User can insert auxiliary bodies that their intersection will provide you a snapping point. e.g. To find the half of a angle from two planes, insert a sphere centered at their intersection, and a box on the intersection points of the sphere with the two planes. A new snapping point will appear in the middle of the box edges which can be used to find the half angle. Start by introducing the necessary infinite cylinders ZCC centered at zero. To add a body, any of the following steps can be used: 1. From the Menu → Insert → Bodies 2. From the toolbar Add: 3. Using shortcut [b] which opens the bodies menu. 4. Using shortcut [B] (capital) which re-inserts the last inserted body type. 5. Using [Spacebar] which opens the Insert pop-up menu 6. Right-click and select the body insert When adding many bodies you can leave permanently the bodies insert menu by first opening the menu from the menu bar or the toolbar, and then clicking the ------ item to tear-off from the menu bar. ● Let's start by making permanent the bodies menu. To accurately place the objects is preferable to zoom in accordingly for each body you need to insert. ● Click on the ZCC button on the menu and move to the viewport. The status bar should display “Adding body 'ZCC'” The color of the bodies in the menu reflects the axis direction (RGB): X:Red, Y:Green, Z:Blue ● [1] Left-click on any point close to the Z=0 ● [2] with the left-button pressed drag the mouse upwards towards the border lines of the beam entrance cylinder. ● A new cylinder will be created with x=y=0 and radius close to 1.75cm. If it is not exactly 1.75cm, then you have to zoom-in and move the cylinder boundary to the exact location . ● Rename the cylinder to “cyl1” by pressing [F2] like in Excel or [n] (for name) or move the mouse on the “name:” field of the body properties. - 13 - 3. Geometry Editing ● Second either correct the radius by hand, typing 1.75cm or zoom-in a bit and drag the cylinder surface to exactly the middle of the line. ● Repeat the process for the remaining cylinders. To repeat the last body addition use the shortcut [B] capital Note that all subsequent bodies will use the same name prefix with an increasing number as suffix ● For this tutorial the cooling spiral will be omitted at the back (left-side of the image) ● Now add the infinite XYP planes to segment the cylinders. ● Click on the XYP ● Left-mouse click on the location of the first plane. As mentioned before, to accurately position the object zoom enough in the image. ● Press [F2] or [n] and rename to plane to z1. button from the bodies menu - 14 - 3. Geometry Editing ● Continue to add all planes for all cooling pipes on the top (shortcut [B]) ● Do not forget to add a plane also at the beam entrance ● Pan the viewport with middle-mouse button or with the keyboard arrows. ● Now the image should look like the above. With 5 cylinders (or more if you add the back) and 25 planes ● Save [Ctrl-S] Normally the bodies are not visible in flair, only the regions and their fraction of the body boundaries. The reason is that huge geometries can easily clutter the display. However for editing the geometry we need to see them and this is done by selecting the Visibility attribute and/or Wireframe attribute. 3.2. Region Editing The geometry editor of flair has an advanced feature of editing graphically the regions, more correctly the “Zones” of the regions. Just to remind the concept, “zone” is a portion of space that is described by the + (Intersection) and (Difference) operator, NO Union. A region is defined as a union of zones. Zone is a very fundamental concept in FLUKA since the particle tracking is performed always in a single zone. While the region is used to define the properties on a zone. Thus, the simpler the zone description is, the faster the simulation will go! Overlaps of zones are permitted only if they belong to the same region. Actually zone overlaps is encouraged since it will result to simpler expression and bigger volumes therefore faster tracking and less zone switching. - 15 - 3. Geometry Editing With parenthesis the concept of zone doesn't exist, and FLUKA will try to expand the parenthesis to a union of zones. It can fail when excessive parenthesis are used. Even though flair can accept both parenthesis and/or the expanded form, graphically the user can only edit/modify zones without parenthesis! Please note that zone editing in flair is completely different than all traditional CAD or CAD-like 3D programs. In flair the editing is done in 2D and the user has to ensure for the 3D outcome by controlling the other viewports. The idea behind this, is that each body splits the space in two zones, the inner and outer one. A selection of 2 bodies splits the space into 4 zones, and for n bodies to 2n zones, which many of them could be void. At this point the user needs to select graphically the zone he is interested in. The procedure (graphically) is the following: ➔ New zone on a new region 1. Select the bodies that define See course slides for selections. the boundary of the zone. 2. Press the Add: zone or shortcut [d] (define zone), move the mouse and click on the desired zone. A new region will be created and the zone expression will be appended. 3. The bodies will be unselected while the region remains selected for further working on it ➔ Add a zone on an existing region: 1. Select (if not selected already) the region where you want to add the zone 2. Add on the selection (Holding the [Control] key) the bodies that define the boundary of the zone 3. Press the Add: zone or shortcut [d] (define zone), move the mouse and click on the desired zone. A new zone will be appended on the existing region. 4. The bodies will be unselected while the region remains selected. ➔ Modify an existing zone (add or remove a body/ies): 1. Select (if not selected already) the region where you want to modify the zone 2. Click with the mouse for a second time on the zone of the region you want to modify (or from the properties menu). Now the zone will be shaded more than the region, and all the bodies of the zone will be selected. 3. Modify the bodies selection (by holding always the [Control] key) by adding or removing bodies. 4. Press the Add: zone or shortcut [d] (define zone) and do as before. Now the existing zone will be replaced with the new one ➔ Delete a zone. 1. Select the region 2. Select the zone (graphically or from the properties list-box) - 16 - 3. Geometry Editing 3. Press [Del] or [Backspace] and the zone will be deleted. WARNING: even though the region and the bodies are also selected, they will not be deleted at this moment. However, pressing [Del] for second time all the selected bodies will be deleted. Pressing [Del] for third time the selected region will be removed. Please refer to the flair online manual or FLUKA course slides for a more detailed explanation on the zone editing. ● Let's start by building the region of the “Core dump”. It should be composed by two zones, one on the right with the entrance hole and the rest. ● Hit [Esc]ape couple of times to be sure that no objects are selected. ● Move the mouse a bit outside of the upper-right corner of the first zone ● [1] Click on the Left-button and keep pressing the mouse button ● [2] drag a square to select the 3 bodies on the right side (two cylinders cyl1 and cyl2) and one plane z3. (Maybe the naming is different) ● [3] Hold the [Control] button and click with the mouse the left plane at the end of the hole (in this geometry is z25 as it had been added at the end) ● Click on Add: ● Automatically a new region named “REG1” will be created ● Move the mouse on any viewport and the various zones will be highlighted. Their expression will be shown in a popup window, as well as in the status bar ● Click somewhere inside the wanted zone, and the new zone will be appended to the newly created region. ● Since there is still undefined space and the new region is not assigned to any material (therefore the default will be BLCKHOLE). ● Press [F2] or [n]ame, or click with the mouse to change the name of the region to CORE ● Press [m]aterial or click with the mouse to assign CARBON as material to the region CORE. Once the popup list with the materials appears, type the first characters of “carbon” e.g. ca and the first match will be highlighted zone or shortcut [d]efine zone - 17 - 3. Geometry Editing ● With the region CORE selected, add on the selection the three bodies bounding the rest of the Dump Core. ● Keep Control pressed all the time when clicking individual bodies ● Selected multiple bodies at the time by clicking and dragging the mouse ● There is no need to worry about unselecting the region. You can always add it to the selection by holding the [Control] and clicking anywhere inside the region or from the listbox ● Now the region CORE should be selected (visible from the shaded zone we previously created, and should appear in the properties listbox) as well as the 3 bodies highlighted with light magenta color. ● Click on Add: ● Move the mouse inside the 3 bodies and click at any location there ● The new expression will be appended in the region definition ● All bodies will be unselected and only the region CORE will remain selected. zone or shortcut [d]efine zone - 18 - 3. Geometry Editing ● If by mistake the right zone was not selected or any of the bodies was not included in the selection, follow the instructions on the top of the section on how to modify an existing region. ● Press [Esc]ape a couple of times to unselect everything ● Continue the procedure to create the region JACKET with COPPER material as shown below. ● In the JACKET, all the spiral pipes are modeled with cylinders. ● To add the zones select the region (if not selected) and drag a small rectangle around like below. If only a region is selected (no bodies yet) you can drag a rectangle with the mouse to select the bodies without the need to press [Control]. ● Click on Add: ● Click inside the rectangle zone or shortcut [d]efine zone - 19 - 3. Geometry Editing ● Continue until the image of the viewport looks like the following ● Using the same method create the following regions (fig.1), until the image of the viewport looks like the following ● COVER with IRON ● BACK with IRON ● COOLING with WATER ● At this point, we only need to create the outside region with VACUUM and our geometry is ready. ● For this purpose we don't need neither the background image nor the visibility of the bodies. ● If you like now you can switch back to the layer [Media] from the dropdown box on the viewport, or you can leave the [Drawing] active ● Select all the bodies [a] lower case - 20 - 3. Geometry Editing ● Turn off visibility with any of the following options: 1. Click on toolbar or the shortcut [v]isibilty toggle that sets/unsets visibility until you see the message Unset visibility 2. From the Menu → Select → Visibility → Clear 3. From the Attribute listbox (lower-left corner Attributes tab) untick visibility 4. From Right-click and the popup menu ● Press [Esc]ape to unselect all bodies ● For the VOID region around the dump, keep in mind the void sphere body that has a huge dimension and is not visible in the viewport unless you zoom-out. However, zooming-out in order to see the void it will be impossible to see the dump. So, do any of the following: 1. Zoom out on another viewport for being able to select the void 2. Select the void from the objects listbox on the left 3. Select once the void using 1 or 2 and lock the selection so the void is always selected no matter what we do. Locking is done similarly with the visibility setting, either from the menu, toolbar , shortcut [l] or the attributes. Locking is very useful but dangerous too. For this reason, flair will notify the user with an orange message in all viewports. ● So, let's use the lock option. Select the void and lock it. It will appear in orange color in the viewport and in the listbox. ● Select the right-most plane z1 by clicking on it ● Click on Add: ● Click somewhere on the right and a new region “COOLING1” will be created ● Press [F2] or [n]ame to rename to VOID ● Press [m]aterial to change material to VACUUM ● [Control]+Click on the outer cylinder cyl5 ● Click on Add: ● Click anywhere outside the cylinder. Don't worry about the zone overlap, zone or shortcut [d]efine zone zone or shortcut [d]efine zone - 21 - 3. Geometry Editing actually is a good thing. ● Continue until all VOID is defined and there is no error message in the geometry, like in the plot below ● Press [a] select-all and then press [l]ock toggle (once or twice) until you see the message “Unlock selection”. The void body should be unlocked and the message will disappear. ● Press [Esc]ape to unselect everything. ● Save your work [Ctrl-S] 4. 3D visualization Lets make now a nice 3D plot of our dump. There is already an existing 3D layer which is quite primitive so several options will be added on it. 3D viewing can be switched on even during the region editing, where the user can see in 3D how the geometry is created. ● Move to the Magenta viewport ● Select the 3D layer from the dropdown menu ● At this point the viewport will show almost the same thing like before with a checker pattern representing the transparent VOID background ● Orbit the viewport: ◦ either holding the [Control] key and rotate it with the middle-mouse button ◦ or by clicking the orbi[t] button from the toolbar. ● Press orbit[t] and move the mouse clicking from the center to half way diagonally towards the lower left corner (like the yellow line in the image below). ● Continue until you get an image like the following - 22 - 4. 3D visualization ● Most probably our viewport [Magenta] cuts the front face of our dump diagonally, therefore the change of the shadow there. ● To avoid this cutting, move the viewport a bit backwards. Either: 1. Drag the viewport line [magenta] dashed line from any of the other viewports, preferably from the Green one; 2. or, press the [PgUp] button; 3. or, press [Control] and rotate the mouse wheel. ● Press orbi[t] again to disable the rotation and enable the normal mouse selection tool Now the plot is in 3D but the interior of the dump is not visible. In order to make it visible, a new layer has to be added with the following the procedure: ● Open the Layers dialog or [Control-L] ● Select the 3D layer from the drop-down box ● [1] Press the Clone ● A new layer named “3D 01” will be created ● [2] Rename it to “My3D” ● Click “Apply” ● Do not close the dialog we can leave it on for the time being. ● Select the “My3D” layer in the [Magenta] viewport, at this time the plot should be the same as before. ● One option to see inside is to use the [4] “Xray Level”. Move the Slider of “Xray Level” on the Layers dialog half way through and click “Apply” ● Experiment also with on/off [5] “Shadows” as well the “Edge Detection” ● Now the interior can be seen but not nicely. To do a better job, the use of a clipping body is needed. button to replicate the layer - 23 - 4. 3D visualization 4.1. Clipping body Any body in the geometry can be used as a clipping body (positive or negative) ● Go to the [Red] viewport ● Zoom in to see the dump ● Press [b]ody to insert a new RPP ● Click and drag from [1]→[2] ● Resize the other dimension of the RPP on the [Green] viewport from [3]→[4] ● Press [F2] or [n]ame and rename it to clip ● Go to the [Magenta] viewport and click on the Layers body like in the image below or [Control-L] to re-open the layers dialog. Re-opening is needed to reload the list of bodies - 24 - 4. 3D visualization ● [1] From the “Clipped by” drop down list, Select the clip body. Be sure that negative clip is not selected (This is to clip with the inverse of the body) ● [2] set the “Xray Level” to about 20-30%. Is good to have it as it gives a bit the feeling of the texture and shows the internal structure ● [3] turn on the “Edge detection” if is not already on ● [4] turn on the “Shadows” if is not already on ● [5] add some “Antialias” to get smoother pixel values. ● Click [Apply] and enjoy a plot like the following ● Save work with [Ctrl-S] ● Finally, the plot can be exported to any bitmap format from Menu→File→Export→Magenta - 25 -
© Copyright 2026 Paperzz