This shows you the differences between two versions of the page.
Next revision | Previous revision Next revision Both sides next revision | ||
start:first_simulation [2015/07/18 14:04] pklapetek created |
start:first_simulation [2018/09/04 14:41] pgrolich |
||
---|---|---|---|
Line 1: | Line 1: | ||
===== Your first simulation ===== | ===== Your first simulation ===== | ||
- | XSvit example No.1 | + | <html> |
+ | <h2>Basic FDTD algorithm operation example</h2> | ||
+ | |||
+ | <h3>Summary</h3> | ||
+ | <p>We will use cubic volume with centered point source, similar to a dipole located in center of computation space. | ||
+ | Outputs will be different cross-section planes to Gwyddion file and a text file (from single point). | ||
+ | Calculation will be performed on CPU or on GPU and material mode selection for speedup will be tested. | ||
+ | </p> | ||
+ | <p> | ||
+ | What can be tested using this example: | ||
+ | <ul> | ||
+ | <li>basic performance of the software (first test to see whether it works after installation) | ||
+ | <li>performance of Yee algorithm with none material properties (compare with material mode calling | ||
+ | full algorithm, resulting in different speed and memory allocation.) | ||
+ | <li>GPU performance | ||
+ | <li>GPU performance with none/full material properties (combine GPU and material mode checking) | ||
+ | <li>scaling of basic calculation speed and memory requirements (varying computational volume size) | ||
+ | <li>point source properties (varying the orientation or using file input for source). | ||
+ | </ul> | ||
+ | <p> | ||
+ | </p> | ||
+ | |||
+ | <h3>Setup all this with XSvit</h3> | ||
+ | |||
+ | <p><i>Note that some of the screenshots might be from an older version of XSvit.</i></p> | ||
+ | |||
+ | <p>First, start the XSvit application. If haven't done this before, setup the location of GSvit and Gwyddion under | ||
+ | File->Preferences menu, so you can run the calculation from the GUI and see the results afterwards. Otherwise | ||
+ | you will be able to use GUI only for parameter file setup.</p> | ||
+ | |||
+ | <p>When you start XSvit, there is already a default parameter file loaded, using computational space of size 100x100x100 voxels. | ||
+ | We will use this computational space and we will add point souce and point output. In the next figure you can | ||
+ | see how the default settings look after XSvit start (you can rotate the 3D projection by mouse, so this was done to get a better view). | ||
+ | Note the values of discretisation step (10 nm) in the list of all the entries on the left side of the window; if we work in vacuum | ||
+ | (which is the case in this example) we should not | ||
+ | use source with wavelength that is smaller than this step multiplied by ten. You can alter the discretisation | ||
+ | settings and computational volume size by double clicking on its values in the list. </p> | ||
+ | |||
+ | {{:start:screenshots:first-simulation-init.png?400|}} | ||
+ | {{start:screenshots:file-preferences.png?400 |}} | ||
+ | |||
+ | <!-- | ||
+ | <a href="http://gsvit.net/images_v18/ex1_init.png"><img src="http://gsvit.net/images_v18/ex1_init.png" width="800"></a> | ||
+ | --> | ||
+ | |||
+ | <p>It is reasonable to save your parameter file at this stage using <i>File->Save</i> command. We can do it also later, | ||
+ | just before running computation, however doing it right now will set the current directory and other input/output files | ||
+ | set later can be referred to it (instead of using absolute path). Moreover, by saving parameter file we also set default directory | ||
+ | for temporary files (e.g. generated sources), which is also important.</p> | ||
+ | |||
+ | <p>First we will add <b>point source</b>. This can be done using menu entry <i>Edit parameters->Add point source</i>. | ||
+ | The dialogue shown below appears. We set the point source properties, i.e. its position in voxel coordinates, | ||
+ | its type (load from file or construct a temporary file for it with sine wave or sine impulse) | ||
+ | and orientation given for temporary file sources by two angles (see the angles for TSF in GSvit documentation). | ||
+ | Here we have chosen sine source given by Ez component only.</p> | ||
+ | <img src="http://gsvit.net/images_v18/ex1_psource.png"> | ||
+ | |||
+ | <p>After adding the source we can see it in the 3D window as shown below and also on the list of entries. If we are not satisfied with its position | ||
+ | we can double-click on the entry and correct it. </p><p><i>Hint: if we switch to "par. file" tab we can edit the source in native GSvit format | ||
+ | file much faster and see the position changes immediately.</i></p> | ||
+ | <a href="http://gsvit.net/images_v18/ex1_source.png"><img src="http://gsvit.net/images_v18/ex1_source.png" width="800"></a> | ||
+ | |||
+ | <p>Next we will add <b>point and image outputs</b>. This is done by menu entry <i>Edit parameters->Add point output</i> | ||
+ | and <i>Edit parameters->Add image output</i> that again open dialogues for specifying how often (parameter "skip") | ||
+ | and which component should be output. Point output is collected from a single point within computational volume | ||
+ | and is stored into a text file. Image output comes to general output file that can be opened by <a href=gwyddion.net>Gwyddion</a> | ||
+ | open source software. A cross section in certain normal direction is output, selected as shown below. We will add | ||
+ | a cross section in every direction, so we will call the dialog three times.</p> | ||
+ | <img src="http://gsvit.net/images_v18/ex1_imout.png"> | ||
+ | |||
+ | <p>Similarily we will add point output as shown below.</p> | ||
+ | <img src="http://gsvit.net/images_v18/ex1_pout.png"> | ||
+ | |||
+ | <p>Note that all the outputs can be also seen in 3D view window. We can adjust some more computational parameters, | ||
+ | here namely we will increase <b>number of steps</b> to be calculated to 300 (clicking to any of the entries in "Basic parameters" group). | ||
+ | Physical length of the time step is calculated automatically on the basis of space discretisation.</p> | ||
+ | <img src="http://gsvit.net/images_v18/ex1_steps.png"> | ||
+ | |||
+ | <p>Finally we need to save the parameter file if we haven't done it at beginning, as since now we worked only with a temporary file or at least modified file | ||
+ | (it is important to save it always before running computation which is not done automatically). This is done by <i>File->Save</i> command as usual. Then we can | ||
+ | <b>start the computation</b> clicking on the arrow in the toolbar or using <i>Execute->Run</i> menu command.</p> <p><i>Hint: if we don't want to use | ||
+ | the GUI for starting the computation we can always run GSvit manually on our parameter file.</i></p> | ||
+ | <a href="http://gsvit.net/images_v18/ex1_nonebcout.png"><img src="http://gsvit.net/images_v18/ex1_nonebcout.png" width="800"></a> | ||
+ | |||
+ | <p>While computation is running we can see the GSvit output (if the verbose level is not 0) and we can choose any text file output | ||
+ | to be visualised in the graph window. You can also watch preview of last saved images - slices through the computational volume - directly in 3D view. | ||
+ | The GSvit output is directly what you would see if you run it at console, with no GUI. | ||
+ | Note that graph is updated at maximum as often as the data are saved, so if we skip every 100 points | ||
+ | while setting the output we will see the graph updated only e.g. every few seconds (depending on computational volume size, etc.). | ||
+ | Similarily, the images in the 3D view are updated when these are saved by the computational core (so you can affect the update frequency | ||
+ | by image output skipping parameter).</p> | ||
+ | |||
+ | <p>When computation is finished or killed by the Stop command (again via toolbar or menu), we can <b>open the output</b> file. As most of the | ||
+ | data are output in Gwyddion file we can directly open it using Gwyddion called from the menu or toolbar. Gwyddion is a powerfull 2D/3D data | ||
+ | processing software, however we will only use it to see the images in this example. As image outputs are saved succesively as the GSvit | ||
+ | is running, we will be probably having more channels to see in Gwyddion, so we pick what is interesting for us in the Gwyddion Data Browser.</p> | ||
+ | <a href="http://gsvit.net/images_v18/ex1_shortwrong.png"><img src="http://gsvit.net/images_v18/ex1_shortwrong.png" width="800"></a> | ||
+ | <p>Note that in this example we have clicked on <i>Data Process->Presentation->Logscale</i> for every displayed output to see the data in | ||
+ | better scale. We can see that in different cross-sections of the computational space there is a wave similar to a dipole output.</p> | ||
+ | |||
+ | <p>If we check the data in further time steps, we can see that they look much worse.</p> | ||
+ | <a href="http://gsvit.net/images_v18/ex1_longwrong.png"><img src="http://gsvit.net/images_v18/ex1_longwrong.png" width="800"></a> | ||
+ | |||
+ | <p>This behavior is caused by unset <b>boundary conditions</b> that behave like mirrors here. | ||
+ | In order to let the wave go out of the computational | ||
+ | space we need to apply an absorbing boundary condition, so we click on any entry in "Boundary conditions" set to change the boundary conditions | ||
+ | on all the faces to a simple absorbing condition (Liao).</p> | ||
+ | <img src="http://gsvit.net/images_v18/ex1_bcs.png"> | ||
+ | |||
+ | <p>After that (and saving the file, running computation and redisplaying data again) we can see that the output is already propagating | ||
+ | freely outside of the computation volume.</p> | ||
+ | <a href="http://gsvit.net/images_v18/ex1_longok.png"><img src="http://gsvit.net/images_v18/ex1_longok.png" width="800"></a> | ||
+ | |||
+ | </html> |