Welcome to JCMsuite’s Electromagnetics Tutorial!

This document shows how to run electromagnetic field simulations using the software package JCMsuite. The examples are organized into application areas. The archive EMTutorial.zip contains all examples discussed in this tutorial. Each example is placed in a separate sub-folder containing the project folders with the simulation specification. To run a project within JCMcontrol open the corresponding .jcmp project file.

Download tutorial examples

Please download the archive EMTutorial.zip which contains the project files for all examples discussed in this tutorial.

Usage from Python

In each project folder you also find a script run_project.py which can be used to run the project within Python. To run the scripts, you can use the Python interpreter included in the JCMsuite installation in the sub-folder ThirdPartySupport/Python/bin. If you use your own Python interpreter, you need to append the sub-folder ThirdPartySupport/Python of your JCMsuite installation directory (here called JCMROOT) to the sys.path:

import sys
import os
jcm_root = os.getenv('JCMROOT') # -> set your JCMROOT installation directory
sys.path.append(os.path.join(jcm_root, 'ThirdPartySupport', 'Python'))

To learn more about the Python interface to JCMsuite see the document Python Interface. In most examples of the tutorial the script run_project.py is a direct call of the solver:

results = jcmwave.solve('project.jcmp')

followed by an analysis of the results.

Usage from Matlab® ([1])

In each project folder you also find a script run_project.m which can be used to run the project within Matlab. Before you can use JCMsuite within Matlab you have to add the sub-folder ThirdPartySupport/Matlab of your JCMsuite installation directory (here called JCMROOT) to the Matlab search path

jcm_root = getenv('JCMROOT'); % Linux: use: jcm_root = <JCMROOT> -> set your JCMROOT installation directory
addpath(fullfile(jcm_root, 'ThirdPartySupport', 'Matlab'));

To learn more about the Matlab interface to JCMsuite see the document Matlab Interface. In most examples of the tutorial the script run_project.m is a direct call of the solver:

results = jcmwave_solve('project.jcmp')

followed by an analysis of the results.

Data analysis

Many examples are supplemented with scripts for the data analysis of the simulation results, which show you how to run parameter scans within Python or Matlab (e.g. geometry variations, wavelength or incidence angle scans). These scripts are based on parameterized .jcmt input files (layout.jcmt, sources.jcmt, etc.)

Running the test suite

To check your installation we have equipped all examples with reference results. Please download the testsuite archive EMTutorialTestSuite.zip which contains a verification script test_jcm_installation.m that will verify the accuracy of the results and run-time performance.

[1]Matlab is a registered trademark of The MathWorks, Inc.
[2]Octave is mostly compatible to Matlab and is freely available from http://www.gnu.org/software/octave/ under the terms of the GNU General Public License (GPL) as published by the Free Software Foundation.

Table Of Contents