# Geometry viewer performance

**URL:** <https://fluka-forum.web.cern.ch/t/geometry-viewer-performance/2762>\
**Category:** Flair\
**Created:** [9 February 2022 07:45 UTC](https://fluka-forum.web.cern.ch/t/geometry-viewer-performance/2762 "2022-02-09T07:45:47Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sean\_Winters](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/s/71c47a/32.png) [@Sean\_Winters](https://fluka-forum.web.cern.ch/u/Sean_Winters)\
**Post date:** [9 February 2022 07:45 UTC](https://fluka-forum.web.cern.ch/t/geometry-viewer-performance/2762/1 "2022-02-09T07:45:47Z")

</div>

Dear experts,  
I m currently running fluka on a fedora sysytem ,i m wondering if there is something i can do to make my geometry viewer works better, i mean when i try to rotate the mode i build ,it always takes a lot of time before i can get a clear viewpoint. Can i somehow make the geo viewer work faster?

---

<div class="post-metadata">

**Author:** ![vasilis](https://fluka-forum.web.cern.ch/user_avatar/fluka-forum.web.cern.ch/vasilis/32/16_2.png) [@vasilis](https://fluka-forum.web.cern.ch/u/vasilis)\
**Post date:** [9 February 2022 12:39 UTC](https://fluka-forum.web.cern.ch/t/geometry-viewer-performance/2762/3 "2022-02-09T12:39:51Z")

</div>

Could you share your model so we can check?

---

<div class="post-metadata">

**Author:** ![Sean\_Winters](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/s/71c47a/32.png) [@Sean\_Winters](https://fluka-forum.web.cern.ch/u/Sean_Winters)\
**Post date:** [10 February 2022 08:14 UTC](https://fluka-forum.web.cern.ch/t/geometry-viewer-performance/2762/4 "2022-02-10T08:14:44Z")

</div>

[hf AR DECRESS ENERGY.flair](https://fluka-forum.web.cern.ch/uploads/short-url/oLYyMRH5hmwUFcNuKzRZ5dWPBbD.flair) (39.1 KB)  
[hf AR DECRESS ENERGY.inp](https://fluka-forum.web.cern.ch/uploads/short-url/xc3Zm1JxsTc7sgI2MKra72ghOJi.inp) (40.5 KB)  
here is my model  
thanks for the attention and time  
also it took me 3h to run a dose rate compution with a history of 10 million (ie 10000000)  
is this normal time ? the cpu is amd R9 5900HX and i m running on fedora32

---

<div class="post-metadata">

**Author:** ![kbat](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/k/8dc957/32.png) [@kbat](https://fluka-forum.web.cern.ch/u/kbat)\
**Post date:** [10 February 2022 09:48 UTC](https://fluka-forum.web.cern.ch/t/geometry-viewer-performance/2762/5 "2022-02-10T09:48:35Z")

</div>

You can immensely speedup your model by simplifying geometry, in particular your FLOOR1, OUTWALL1 and first of all the AIR region.  
Split them by several simple regions.

On each step the geometry tracker needs to understand in which region the particle is located and complexity (=speed) of this calculation depends on complexity of the zone expression. Now imagine the challenge you give to geometry tracker in the AIR region, and don’t forget that it needs to calculate this for all particles on each step!

As far as I understand, in FLUKA the geometry tracker calculates disjunctive normal form from the zone definition and of course if a zone is complex the DNF form will contain lots of literals which can take very long time to resolve. For example, the codes line MCNP and PHITS do not rely on the DNF form and therefore their tracking performance through the complex zones is significantly better, but even for these codes your AIR region is extremely complex.

Basically, the rule of thumb is to use as simple zones as possible and as @amario suggests below think twice before you define a region with parentheses.

---

<div class="post-metadata">

**Author:** ![amario](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/a/47e85d/32.png) [@amario](https://fluka-forum.web.cern.ch/u/amario)\
**Post date:** [10 February 2022 10:00 UTC](https://fluka-forum.web.cern.ch/t/geometry-viewer-performance/2762/6 "2022-02-10T10:00:32Z")

</div>

Dear @Sean_Winters,

@kbat is right, you should avoid to use parentheses in the definition of regions. Parentheses slow down both the simulation and the geometry viewer. Their use is deprecated, have a look at slide 26 of the [geometry lecture](https://indico.cern.ch/event/1012211/contributions/4247788/attachments/2255261/3826586/04_Geometry_Basic_2021_online.pdf) from the last Fluka course.  
Also, despite unrelated, Fedora 32 has already reached its End of Life.

---

<div class="post-metadata">

**Author:** ![vasilis](https://fluka-forum.web.cern.ch/user_avatar/fluka-forum.web.cern.ch/vasilis/32/16_2.png) [@vasilis](https://fluka-forum.web.cern.ch/u/vasilis)\
**Post date:** [10 February 2022 15:05 UTC](https://fluka-forum.web.cern.ch/t/geometry-viewer-performance/2762/7 "2022-02-10T15:05:52Z")

</div>

Hi @Sean_Winters  
in line of the suggestions of @kbat and @amario you can do the following:

1. In the geometry editor select **ALL** regions. (Only the regions no other object)
2. The region context tab in the ribbon should appear (top-right).  
Click the  
i. **Expand** parenthesis button, wait for a while  
ii. and then followed by the **Optimize** button  
The expand will try to expand parenthesis, and the optimize will try to remove logical operations from the region description so as the result to be the same with smaller expression.  
It will not cure completely the Air region, but it can help a lot  
 ![image](https://fluka-forum.web.cern.ch/uploads/default/original/2X/f/f2e83332d0b7dde11b181196f759bd0f61ce88b7.jpeg)

Other things

- As it concerns the flair geometry speed, avoid to use 3D display on many viewports. The 3D is quite expensive in CPU and it uses as many threads as your CPU cores PER viewport. I would suggest having 3 viewports in 2D mode e.g. displaying media and one with the 3D. You will see a great improvement in performance
- Having also the 2D display it helps to spot geometry errors, like the overlap you have on the concrete floor, seen in red in the above image

But none of the above automatic methods cannot beat the manual optimization you can do.  
Check our lectures on how to create and edit the zones graphically with the geometry editor, it can make your life very very easy

---

<div class="post-metadata">

**Author:** ![Sean\_Winters](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/s/71c47a/32.png) [@Sean\_Winters](https://fluka-forum.web.cern.ch/u/Sean_Winters)\
**Post date:** [11 February 2022 01:44 UTC](https://fluka-forum.web.cern.ch/t/geometry-viewer-performance/2762/8 "2022-02-11T01:44:27Z")

</div>

Thanks a lot for the advice! Just gonna go through the lecture to improve my skills in simplifying the model!

---

<div class="post-metadata">

**Author:** ![Sean\_Winters](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/s/71c47a/32.png) [@Sean\_Winters](https://fluka-forum.web.cern.ch/u/Sean_Winters)\
**Post date:** [11 February 2022 01:47 UTC](https://fluka-forum.web.cern.ch/t/geometry-viewer-performance/2762/9 "2022-02-11T01:47:25Z")

</div>

Thank you for the detailed solution, really appreciate that!

---

<div class="post-metadata">

**Author:** ![rversaci](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/r/cc9497/32.png) [@rversaci](https://fluka-forum.web.cern.ch/u/rversaci)\
**Post date:** [11 February 2022 05:35 UTC](https://fluka-forum.web.cern.ch/t/geometry-viewer-performance/2762/10 "2022-02-11T05:35:04Z")

</div>

Closed on 11 February 2022 05:35 UTC


