0% found this document useful (0 votes)
106 views9 pages

FEKO ParameterSweep Guide

This document provides instructions for performing parameter sweeps in FEKO both locally and on the W&M HPC. It outlines how to define a variable parameter, select it for sweeping, generate models, and merge results locally or submit a job to the HPC. It also describes how to change the FEKO temporary directory to accommodate larger out-of-core simulations.

Uploaded by

WANDERS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
106 views9 pages

FEKO ParameterSweep Guide

This document provides instructions for performing parameter sweeps in FEKO both locally and on the W&M HPC. It outlines how to define a variable parameter, select it for sweeping, generate models, and merge results locally or submit a job to the HPC. It also describes how to change the FEKO temporary directory to accommodate larger out-of-core simulations.

Uploaded by

WANDERS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

A How-To Guide for Performing Parameter Sweeps in

FEKO
William Miyahira
July 22, 2021

This document outlines how to perform a sweep of an arbitrary parameter in FEKO,


both locally and on the W&M HPC. It should be noted that at the time of writing this I
have only looked into sweeping a single parameter at a time (including frequency). Though
there is the option to select multiple parameters to sweep, doing will increase the overall run
time of the job.
At the end of the document, I also outline how to change the location of the FEKO
temporary directory. This is primarily useful when running out-of-core jobs, as you can
change it to a hard disk with more space for larger models.

Local Parameter Sweeps


First let’s look at how to do a parameter sweep locally on the lab workstations. In this
example I sweep the phase of a voltage source for a single microstrip, but the technique can
be applied to any arbitrary parameter(s).
The idea in this phase sweep example is that we want to set the excitation phase of the
voltage source equal to a variable rather than a fixed value. So to start let’s define a variable
called phase. Here I set phase = 0, but the value doesn’t really matter since we choose what
values it takes later on.

Next, define the phase of the voltage source to be the variable phase.
When you are ready to run the sweep, save your work. Then, on the Home tab of the
top menu go to Application macro and select Parameter Sweep: Create models.

When selected, a menu will pop up that allows you to select which parameter(s) you
want to sweep and which values that parameter will take during the sweep. Here I choose a
linearly spaced grid going from 0 → 180 with three samples. Thus, the variable phase will
take on values 0, 90, and 180 when ran.
When you are done selecting the sweep variables and their ranges, select Next. Another
menu will pop up that asks where you would like FEKO to put the files generated for the
sweep, as well as whether you would like to run the models when Finish is selected. FEKO
will automatically add the parameter sweep folder to your current directory to put the sweep
files, but you can choose whichever directory you want by selecting Browse...

Once Finish is selected, FEKO will generate n models, with n being the number of
sweep samples (in this example, n = 3) and put them all in the chosen directory.
A *.bat file will then open and run the generated FEKO files sequentially. When all the
models have finished running, text will appear that asks if you’d like to merge the results in
POSTFEKO. Type y or Y on the keyboard to choose this option.
Another menu will appear asking which *.xml file you want to use to merge the results
of the sweep. This file is automatically generated by FEKO along with the sweep models
and basically just tells POSTFEKO which files to merge. Luckily it’s already chosen, so
we just have to select Next.

And that’s it! The results for the sweep are merged and you can view the results. Below
I show the reflection coefficient as a function of phase.
Parameter Sweeps on the HPC
Running a parameter sweep on the W&M HPC is very similar to running it locally. Just
follow all the steps as before up to the Output pop-up menu, but now make sure Run Feko
Solver is NOT selected. This will still create all of the sweep files and put them in your
desired directory, but it won’t automatically run the *.bat file to solve the models.

Submitting a Job
Next, transfer the sweep *.cfx files (labeled by feko model name {01,02,...}.cfx) onto your
W&M HPC account. To see how to use the HPC, see ShuangLi Du’s guide on the lab website
(bottom of the Docs page). You will also need the runfeko sweep script (and starttime
and endtime files if you want to know when your job starts/ends). This script can be
found in my Snapdragon folder: \\Snapdragon\Common\William\HPC\runfeko files. The
runfeko sweep script is shown below:
Here’s what you will have to change:
ˆ The name (not necessary, but makes it easier to keep track of multiple jobs), number
of nodes, and walltime of your job
ˆ The FEKO TPDIR. Change this to your hpc username and wherever you want to put
the Temp folder. Here I made a folder called temp in my scr20 directory.
ˆ The number of sweeps. This should be equal to the number of sweep models you have.
For the phase sweep example I set this number to 03.
ˆ Additionally, don’t forget to have the name of your file match the name in the script
(i.e. replace input in lines 19-21 with your file name).
If you are also interested in how long it takes to run your job, you can include the
starttime and endtime files found the same Snapdragon folder. When your job has finished
running it will output a text file showing the start and end times of your job. Note that you
can also include these files for any other job you submit, just make sure you let the HPC
know by including lines 13 and 25 in the above script. Also of note is that even if you have
these lines in your script, there is no penalty for not including the corresponding starttime
and endtime files in your HPC directory, you just won’t get the run time information.
Now just submit this job to the HPC as you normally would (qsub runfeko sweeps)
and transfer the files from your HPC account to your desired directory in Snapdragon (or
wherever else).

Merging Results in POSTFEKO


To merge results in POSTFEKO, open up one of the sweep files *.fek files to open up
POSTFEKO.
A pop-up menu will then ask you which *.xml file you want to use to combine the results.
Although it’s already selected, for some reason it has trouble merging the files as is. So you
just have to select Browse... and choose the *.xml file manually. It will be in the same folder
as the generated sweep files (should automatically take you to that folder).

And that’s it! It will open up the merged POSTFEKO file and you can view your
results as a function of the sweep parameter(s).

Nodes and Walltime


Here I make a couple of notes about running parameter sweep jobs on the HPC.
Firstly, since the runfeko sweep file runs one FEKO file at a time, you only need to
request the number of nodes needed for the largest sweep file. It’s important to keep this
in mind if you are doing a sweep of a variable that changes your model’s geometry (such
as the width of the trace in the example presented). This will change the number of mesh
elements you have, which directly affects the memory required to run the job (memory ∝
(# mesh elements)2 ).
Secondly, keep in mind the maximum walltime for the HPC clusters, which can be found
on the W&M HPC website. It may be good to run a single sweep file to get an idea for how
long each one will take to run if you are worried about hitting that maximum.

Changing the FEKO Temporary Directory


In this section I go through the steps of changing the FEKO temporary directory (FEKO TMPDIR)
on your computer. According to the 2019.3.3 FEKO user manual, “this variable specifies
the directory where Feko will write paging files, when using the out-of-core solution.” When
performing an out-of-core solution, FEKO will use the hard disk (specified by the location
of the temporary directory) to store the matrices while the RAM solves chunks of the ma-
trix at a time. Thus, one could accommodate a larger out-of-core solution by having the
FEKO TMPDIR associated with a disk with more space. Here’s how to change it:

1. First, create a folder called Temp in the disk you want to use for the FEKO TMPDIR.

2. Next, locate the file FEKOenvironmentFromSetup.lua. This will be on the hard disk used
to install FEKO, and should be located in the folder: C:\Program Files\Altair\2019\feko.

3. Open the file using a text editor such as Notepad++ that allows you to edit the code.

4. On the last line you see where we choose to set the FEKO TMPDIR. All you need to do
here is change the current disk (C in this case) to the new disk.

5. With the change made, save the file. It will as if you want to run Notepad++ in admin-
istrator mode. Select “Yes” to save.

6. You might have to close and reopen FEKO to solidify the change. You can see if it’s
been made by going into the Feko terminal and running “set”. Here I’ve changed it from
C→E, as verified in the Feko terminal.

You might also like