321 views
Synrad tutorial: Simple dipole with a target = In this example we'll create the first working Synrad simulation, equivalent to the "test pipe" in Molflow. By default, Synrad starts with an empty geometry, where we have to add regions, representing magnetic elements. We will add a single dipole: ## Adding a dipole In Synrad, each region has to be backed by a ```.param``` file on disk. Therefore, when choosing ```Regions/New```, you'll have to specify a location and a filename: ![](https://codimd.web.cern.ch/uploads/upload_417583210bc3a64dd86031e16e7ff2db.png) Once the location is defined, the region editor pops up to define the parameters: ![](https://codimd.web.cern.ch/uploads/upload_85fbf0f5d1993fab80a3531114ee1d10.png) Full info on the text fields is in the documentation [here](https://molflow.web.cern.ch/content/documentation-region-editor). The parameters that we'll set are: - **Beam start position**: in centimeters. We'll set X,Y,Z = 0,0,0 - **Beam start direction**: in the Z direction (corresponding to theta=alpha=0) - **Trajectory step length**: Synrad approximates all magnetic elements by short, straight sections, then recalculates the (curved) beam direction. We'll aim for around a 1000 points by choosing step length=0.1cm - **Calculation boundary**: currently magnetic regions are defined by their limit (not their length). The first of the X,Y,Z coordinates that will be hit will stop the calculation. We start the element at 0,0,0 and since it is 1m long, the boundary is (X=1000,Y=1000,Z=100), of which the Z boundary will be hit first. - **Particle mass and charge**: click ```Electron```. - **Beam energy**: in our simple system it will be 1GeV - **Beam current**: 100mA - **Lattice functions**: We'll use "Ideal beam" in this example, resulting in 0 beam width - **Photon generation**: We can restrict the SR spectrum to between two energies. (The SR spectrum is "infinite" in the lower energy direction and has a sharp cutoff in the high energy region) - **Magnetic field**: we'll put a constant magnetic field of 1T in the Y direction Clicking Apply&Recalculate we can see the curvature of the dipole: ![](https://codimd.web.cern.ch/uploads/upload_95d49690cde12595a1b7bc3f64348b1b.png) ![](https://codimd.web.cern.ch/uploads/upload_4014a3f86c3f1f789004706fff971bb1.png) Note that the GUI is just a front-end to the ```.param``` file, which can be viewed and edited directly in a text editor (save and reload if you do that and Synrad will take changes into account). ![](https://codimd.web.cern.ch/uploads/upload_7166b6956d2aecc4ab31477f513245bf.png) **Note about the location of the ```.param``` files**: They are saved to your specified location. However, if you save the whole geometry as a compressed ```.syn7z``` file, they are packaged with the file (a copy is made). After opening the syn7z file, the param files will be in a temporary directory. ![](https://codimd.web.cern.ch/uploads/upload_6e094e72221c9f0e38dfa32b8f408461.png) After changing and saving the edited file, the Reload file button parses it again and calculates the points. ![](https://codimd.web.cern.ch/uploads/upload_84feb937611847be220985182401bec2.png) You have a tool to see the trajectory points (View points) in the region edtior. ![](https://codimd.web.cern.ch/uploads/upload_1125b835ee10d420813c1188478f074e.png) Clicking on a row displays the point, clicking on a point with the *trajectory selector* tool in the 3D scene selects it in the point view dialog. ![](https://codimd.web.cern.ch/uploads/upload_8538f4236d9b758464396224b797e69e.png) The trajectory selector tool is next to the vertex selector tool. ![](https://codimd.web.cern.ch/uploads/upload_d722b2a380d99fce45f1fff3100c82be.png) ## Starting the simulation Turn on leak display (no geometry yet): ![](https://codimd.web.cern.ch/uploads/upload_6c4f278240d5ce878474e10dcf2a4258.png) You can see that the trajectory creates photons, which cause leaks for the moment: ![](https://codimd.web.cern.ch/uploads/upload_bd13d47eeec2b5e284b27aff1cc30893.png) ## Adding a target Use the Facet / Create shape tool: ![](https://codimd.web.cern.ch/uploads/upload_a23e265cb677626524c8d754b5816602.png) Create a 100x100 cm square at Z=200cm ![](https://codimd.web.cern.ch/uploads/upload_81333c09d5ed806448ea4d5e93353a5c.png) Make its normal point towards the dipole: ![](https://codimd.web.cern.ch/uploads/upload_7bb614e8c538d7eb06a5c808a9faac5a.png) ![](https://codimd.web.cern.ch/uploads/upload_afdcdc90b81a8f139cb3d5776947a51e.png) Add sticking to it so it absorbs photons: ![](https://codimd.web.cern.ch/uploads/upload_eb242031859e1b0df8d47494ee1e44fa.png) Your simulation is now running: ![](https://codimd.web.cern.ch/uploads/upload_ba3520bc5aa4e6275ac38c01ae00aa12.png) ## Record spectrum Turn on the Record spectrum property for the facet: ![](https://codimd.web.cern.ch/uploads/upload_0e271155340f5b07259276f3c17578c0.png) Add the curve to the plotter: ![](https://codimd.web.cern.ch/uploads/upload_8ab60cf8498ad284edea899c900b4ff6.png) ![](https://codimd.web.cern.ch/uploads/upload_5b7e02c1156cccd188fe7ef378958064.png) The plotted spectrum: ![](https://codimd.web.cern.ch/uploads/upload_371f5590af2c9973a250893b6ba4c842.png) We can see that photons are recorded until 1MeV whereas they are generated until ~10keV. Let's restrict the generation range: ![](https://codimd.web.cern.ch/uploads/upload_1e597496e7a2e09eb01c79cb71171169.png) ![](https://codimd.web.cern.ch/uploads/upload_9789f274f17091c2851dcd50905f2ffb.png) ![](https://codimd.web.cern.ch/uploads/upload_9a6842249da747fbd9bcae6d104748e7.png) Now the spectrum is filling the recorded range better: ![](https://codimd.web.cern.ch/uploads/upload_0feb8099d4bf743829b0bc1d13ff7350.png) ## Add a profile Turn on u,v view: ![](https://codimd.web.cern.ch/uploads/upload_b2d912a04f90a246ab9f8fa295cd3751.png) We'll plot the profile in the u direction: ![](https://codimd.web.cern.ch/uploads/upload_1e2aeb1b79ab93b8d68ffc3b075a6a8c.png) ![](https://codimd.web.cern.ch/uploads/upload_36a67ebc6f24ecf97dcd0e4ef0cd0036.png) Add the curve to the profile plotter: ![](https://codimd.web.cern.ch/uploads/upload_c73b8a80f79f738c9fbbd44e7acf2f2a.png) ![](https://codimd.web.cern.ch/uploads/upload_6c70968c30ed9333e4e0d2548cd9937a.png) ![](https://codimd.web.cern.ch/uploads/upload_efed18ffeb0f6a6ba2f4880bac7149ad.png) ## Adding textures In Synrad there isn't (yet) an "<< Adv" button for the advanced facet parameters. Use the Mesh... button to add a texture: ![](https://codimd.web.cern.ch/uploads/upload_fc1c91cefd0ea9f7ba0e587ff71f002f.png) Let's use 10 cells/cm: ![](https://codimd.web.cern.ch/uploads/upload_4cd1e986060ba816157de8f9f021d575.png) ![](https://codimd.web.cern.ch/uploads/upload_b3021234cd60d440720820bb74640f00.png) Turn off lines view and zoom in on the texture: ![](https://codimd.web.cern.ch/uploads/upload_10b864d31653982fb20a7e9fe8b8c805.png) Make the scale logarithmic: ![](https://codimd.web.cern.ch/uploads/upload_f234dfe1bfddbf3cd254c5f0ddd4027d.png) ![](https://codimd.web.cern.ch/uploads/upload_e4c474e284e1f6ca31aa22cbc8730e5c.png) linear scale: ![](https://codimd.web.cern.ch/uploads/upload_67146170be60be098cc20fcdca548029.png) ![](https://codimd.web.cern.ch/uploads/upload_1145f10886da77303e1dfde3a85d3f8b.png) Selecting a cell or block of cells in the Texture plotter displays it in the 3D scene: ![](https://codimd.web.cern.ch/uploads/upload_4d4ab8d080406cc6713136ac372a53f8.png)