Плавный переход: eps формулой

Профиль eps от координат против резкой границы

Параметр Значение
Раздел библиотеки Среды, плазма, ЭПР
Ядро PlanarRT H (planarrt_h.exe)
Источник неоднородная среда, профиль формулой
Сетка 180 × 36 узлов, шаг 1 мм
Время счёта задания 30 нс модельного времени, шагов: 32
Длительность прогона около 20 с на шестиядерном ПК, без вывода поля

Постановка задачи

Переход из вакуума в плотный диэлектрик. Резкая граница отражает на всех частотах одинаково, а плавный — линейный по длине — профиль тем лучше, чем длиннее переход по сравнению с волной. Профиль задан формулой от x: так в ядро уходит любая неоднородная eps, а на холсте она видна градиентом.

Ядро на первом шаге сохранит посчитанный профиль в файл grad.eps — этот же файл можно потом подключить блоком FILE.

  • Один профиль задан формулой от x: так в ядро уходит любая неоднородная eps. Градиент виден и на холсте.

Теоретические сведения

В этой группе среда неоднородна. Плоская волна при нормальном падении задаётся каналом с магнитными стенками: однородное поле распространяется в нём так же, как в свободном пространстве, а задача сводится к границам и слоям. Открытые задачи (рассеяние, линзы) считаются в области с контуром поглотителя, и волна входит через широкий порт слева. Порт плоской волны здесь стоит на границе области, как в микрополосковых образцах, поэтому в задании есть отражение порядка −15…−25 дБ, и результаты глубже этого уровня не показательны. Это свойство постановки, а не ядра.

Резкая граница вакуум — диэлектрик отражает одинаково на всех частотах:

|Γ|=|1−ε1+ε|=0,42  (−7,5 дБ при ε=6)

Плавный профиль ε(x) длиной не меньше волны убирает отражение, так как составляющие от слоёв приходят с разными фазами. Профиль задан формулой от x; так же в ядро уходит любая неоднородная среда.

Паспорт образца. Значения, которые TPL Designer вычисляет по формулам для параметров по умолчанию.

Величина Значение
Переход eps от 1 до 6 на длине 60 мм (1 λ на 5 ГГц)
Резкая граница, точно |S11| = -7.5 дБ на всех частотах
Плавный профиль отражение падает с ростом частоты: переход длиннее волны
Файл профиля grad.eps пишется ядром на первом шаге; готовый файл подключают блоком FILE — см. образец «Среда из файла .eps»

Создание файла задания

Образец уже встроен в TPL Designer: скачивать ничего не нужно. Выполните шаги по порядку.

  1. Запустите TPL Designer. На стартовом экране в карточке «Взять образец» нажмите «Открыть библиотеку».
  2. Слева выберите раздел «Среды, плазма, ЭПР» и щёлкните в галерее плитку «Плавный переход: eps формулой». Справа откроется карточка образца с паспортом и параметрами.
Карточка образца в библиотеке TPL Designer
Карточка образца в библиотеке TPL Designer
  1. Параметры оставьте по умолчанию: все числа на этой странице получены именно для них. Изменённые значения можно сбросить кнопкой «Вернуть умолчания».
  2. Нажмите «Открыть в редакторе». Задание откроется в мастере из пяти разделов, список которых находится слева.
  3. Откройте раздел «Геометрия». На холсте показано то, что посчитает ядро: металлические стенки, порты, диэлектрик или плазма. Зелёный значок отмечает активный порт, красный — пассивный. Двойной щелчок по объекту откроет его свойства.
Раздел «Геометрия» мастера TPL Designer
Раздел «Геометрия» мастера TPL Designer
  1. Если хотите посмотреть поле в FieldView, откройте раздел «Вывод данных» и отметьте «Выгружать топологию (файл .tt)» и «Выгружать поля (файлы .ex, .ey, .hz)», вариант «только на первом шаге». Запись поля замедляет счёт в разы, поэтому в образцах она выключена, если задание не требует её само.
  2. Откройте раздел «Проверка». Слева показана сводка расчёта, справа текст файла задания, а полоса внизу сообщает, что замечаний нет.
Раздел «Проверка» мастера TPL Designer
Раздел «Проверка» мастера TPL Designer
  1. Нажмите «Создать файл задания» и выберите пустую папку. В ней появятся файлы: grad.tpl, grad_step.h.

Запуск расчёта

  1. Запустите программу PlanarRT H (planarrt_h.exe).
  2. Нажмите Открыть Открыть или Ctrl+O и выберите файл grad.tpl в созданной папке. Если в строке состояния появилось Шаг:1;Error:no, задание прочитано верно.
  3. Нажмите Запуск Запуск или F5. Ядро посчитает все шаги задания (32), на шестиядерном ПК это занимает около 20 с.
  4. Дождитесь надписи «Готово» в строке состояния.

Ядро дописывает файл .s, а не перезаписывает его. Перед повторным запуском удалите старый файл .s, иначе старые точки смешаются с новыми.

Просмотр результатов

Матрица рассеяния. Нажмите Показать S-матрицу Показать S-матрицу: откроется TMCGROUT с кривой первого элемента. Он показывает КСВН; чтобы увидеть модули, нажмите Ctrl+H и выберите «Шкала Y» → «|S|», а другие элементы добавьте через Ctrl+D.

Окно TMCGROUT сразу после открытия файла .s
Окно TMCGROUT сразу после открытия файла .s

Сигналы на портах. Нажмите Показать выходной сигнал Показать выходной сигнал: откроется TMCROS с файлом .t.

Окно TMCROS с сигналом на порту
Окно TMCROS с сигналом на порту

Поле. Если вы включили вывод поля на шаге 6, нажмите Показать поле и топологию Показать поле и топологию: откроется FieldView. Анимацию он сохраняет командой экспорта.

Результаты

Частотная характеристика: модули элементов матрицы рассеяния, рассчитанные ядром
Частотная характеристика: модули элементов матрицы рассеяния, рассчитанные ядром
Развёрнутая фаза прохождения S21
Развёрнутая фаза прохождения S21
Баланс мощности: сумма квадратов модулей первого столбца матрицы
Баланс мощности: сумма квадратов модулей первого столбца матрицы
Сигналы на портах во времени
Сигналы на портах во времени

Числа расчёта: значения на краях диапазона, в середине и в точке наилучшего согласования.

резкая граница

Частота, ГГц |S11|, дБ |S21|, дБ
2,5 -7,17 -1,03
6,5 -8,2 -1,07
9 -8,26 -1,14
10 -7,58 -1,16

плавный профиль

Частота, ГГц |S11|, дБ |S21|, дБ
2,5 -16,04 -0,26
6,5 -24,28 -0,22
8,5 -30,71 -0,28
10 -23,03 -0,35

Анимация поля

Поле, рассчитанное ядром на частоте 6,5 ГГц: 320 кадров через 5 тактов, до 3,81 нс. Шкала «Волна», как в FieldView

Разбор результатов

Варианты показывают эффект наглядно. У резкой границы |S11| держится между −7,2 и −8,3 дБ на всём диапазоне, что сходится с точным −7,5 дБ. Плавный профиль даёт −16 дБ на 2,5 ГГц и −24…−31 дБ на верхних частотах, а прохождение улучшается с −1 дБ до −0,3 дБ. Выигрыш растёт с отношением длины перехода к длине волны, как и должен. Уровни глубже −25 дБ определяются постановкой порта.

Файл задания

Этот текст TPL Designer показывает в разделе «Проверка». Файл записан в кодировке CP1251.

grad.tpl
#TMC_RT_H
! Задание сгенерировано TPL Designer.
! Плавный переход из вакуума в диэлектрик eps = 6: профиль eps формулой против резкой границы.
! Ядро: tmc_rth (H-мода)
! Перед прогоном удалить grad_step.s и grad_taper.s -- дописывается, а не перезаписывается.

#include grad_step.h

! вариант: резкая граница
gradstep1 2.5; grad_step_f2p5; grad_step;
gradstep1 3.0; grad_step_f3; grad_step;
gradstep1 3.5; grad_step_f3p5; grad_step;
gradstep1 4.0; grad_step_f4; grad_step;
gradstep1 4.5; grad_step_f4p5; grad_step;
gradstep1 5.0; grad_step_f5; grad_step;
gradstep1 5.5; grad_step_f5p5; grad_step;
gradstep1 6.0; grad_step_f6; grad_step;
gradstep1 6.5; grad_step_f6p5; grad_step;
gradstep1 7.0; grad_step_f7; grad_step;
gradstep1 7.5; grad_step_f7p5; grad_step;
gradstep1 8.0; grad_step_f8; grad_step;
gradstep1 8.5; grad_step_f8p5; grad_step;
gradstep1 9.0; grad_step_f9; grad_step;
gradstep1 9.5; grad_step_f9p5; grad_step;
gradstep1 10.0; grad_step_f10; grad_step;

! ===== Шаг записан явно: здесь считается профиль eps, дальше берётся из файла =====
! вариант: плавный профиль
#STEP
#PARM
 ANGLE_UNIT radian;
 FREQ_UNIT  GHz;
 LONG_UNIT  mm;
 TIME_UNIT  ns;
 DELTA  1.0;
 TIME   0.; 30.0;
 X_MIN  0.0;
 X_MAX  180.0;
 Y_MIN  0.0;
 Y_MAX  36.0;
 FREQ   2.5;
#END_PARM
#TOPOLOGY
 BLOCK 1;   ! канал, низ
  POLYGON_STAT MAGNETIC;
   L 0.0; 3.0;
   L 90.0; 3.0;
   L 180.0; 3.0;
 END_B
 BLOCK 2;   ! канал, верх
  POLYGON_STAT MAGNETIC;
   L 0.0; 33.0;
   L 90.0; 33.0;
   L 180.0; 33.0;
 END_B
 BLOCK 4;   ! плавный профиль — профиль eps по формуле; результат сохраняется в grad.eps
  RECT_STAT [grad](1+(5.0)*(x+30.0)/60.0)-1; -30.0; 30.0; -15.0; 15.0;
 END_B
 BLOCK 5;   ! диэлектрик за переходом
  RECT_STAT 5.0; 120.0; 180.0; 3.0; 33.0;
 END_B
 BLOCK 6;   ! вход 1 (вакуум) — АКТИВНЫЙ
  INPUT_X MAGNETIC; 3.0; 33.0; 0; 30; 1; 0;
 END_B
 BLOCK 7;   ! вход 2 (в диэлектрике) — пассивный
  INPUT_X MAGNETIC; 3.0; 33.0; 60; 90; 0; 0; 5.0;
 END_B
#END_TOPOLOGY
#LINK_LIST
 T 1; 0.0; 0.0;
 T 2; 0.0; 0.0;
 T 4; 90.0; 18.0;
 T 5; 0.0; 0.0;
 T 6; 0.0; 0.0;
 T 7; 180.0; 0.0;
#END_LINK
#OUTPUT
 FILE grad_taper_f2p5;
 SMATRIX grad_taper; 2.5; 22.5; 30.0;
#END_OUTPUT
#END_STEP

! вариант: плавный профиль
gradstep2 3.0; grad_taper_f3; grad_taper;
gradstep2 3.5; grad_taper_f3p5; grad_taper;
gradstep2 4.0; grad_taper_f4; grad_taper;
gradstep2 4.5; grad_taper_f4p5; grad_taper;
gradstep2 5.0; grad_taper_f5; grad_taper;
gradstep2 5.5; grad_taper_f5p5; grad_taper;
gradstep2 6.0; grad_taper_f6; grad_taper;
gradstep2 6.5; grad_taper_f6p5; grad_taper;
gradstep2 7.0; grad_taper_f7; grad_taper;
gradstep2 7.5; grad_taper_f7p5; grad_taper;
gradstep2 8.0; grad_taper_f8; grad_taper;
gradstep2 8.5; grad_taper_f8p5; grad_taper;
gradstep2 9.0; grad_taper_f9; grad_taper;
gradstep2 9.5; grad_taper_f9p5; grad_taper;
gradstep2 10.0; grad_taper_f10; grad_taper;

#EOF
grad_step.h
! ==========================================================================
! grad_step.h — макроопределения шагов расчёта.
! Подключается строкой  #include grad_step.h  и должен лежать РЯДОМ с .tpl
!
! ДВА бэкслеша в конце строки = "текст макроса продолжается ниже".
! У ПОСЛЕДНЕЙ строки макроса переноса НЕТ — это признак конца.
! ==========================================================================
! вариант: резкая граница
#define gradstep1 Freq__; Tfile__; Sfile__; @\\
#STEP\\
#PARM\\
 ANGLE_UNIT radian;\\
 FREQ_UNIT  GHz;\\
 LONG_UNIT  mm;\\
 TIME_UNIT  ns;\\
 DELTA  1.0;\\
 TIME   0.; 30.0;\\
 X_MIN  0.0;\\
 X_MAX  180.0;\\
 Y_MIN  0.0;\\
 Y_MAX  36.0;\\
 FREQ   Freq__;\\
#END_PARM\\
#TOPOLOGY\\
 BLOCK 1;\\   ! канал, низ
  POLYGON_STAT MAGNETIC;\\
   L 0.0; 3.0;\\
   L 90.0; 3.0;\\
   L 180.0; 3.0;\\
 END_B\\
 BLOCK 2;\\   ! канал, верх
  POLYGON_STAT MAGNETIC;\\
   L 0.0; 33.0;\\
   L 90.0; 33.0;\\
   L 180.0; 33.0;\\
 END_B\\
 BLOCK 3;\\   ! резкая граница
  RECT_STAT 5.0; 60.0; 120.0; 3.0; 33.0;\\
 END_B\\
 BLOCK 5;\\   ! диэлектрик за переходом
  RECT_STAT 5.0; 120.0; 180.0; 3.0; 33.0;\\
 END_B\\
 BLOCK 6;\\   ! вход 1 (вакуум) — АКТИВНЫЙ
  INPUT_X MAGNETIC; 3.0; 33.0; 0; 30; 1; 0;\\
 END_B\\
 BLOCK 7;\\   ! вход 2 (в диэлектрике) — пассивный
  INPUT_X MAGNETIC; 3.0; 33.0; 60; 90; 0; 0; 5.0;\\
 END_B\\
#END_TOPOLOGY\\
#LINK_LIST\\
 T 1; 0.0; 0.0;\\
 T 2; 0.0; 0.0;\\
 T 3; 0.0; 0.0;\\
 T 5; 0.0; 0.0;\\
 T 6; 0.0; 0.0;\\
 T 7; 180.0; 0.0;\\
#END_LINK\\
#OUTPUT\\
 FILE Tfile__;\\
 SMATRIX Sfile__; Freq__; 22.5; 30.0;\\
#END_OUTPUT\\
#END_STEP

! вариант: плавный профиль
#define gradstep2 Freq__; Tfile__; Sfile__; @\\
#STEP\\
#PARM\\
 ANGLE_UNIT radian;\\
 FREQ_UNIT  GHz;\\
 LONG_UNIT  mm;\\
 TIME_UNIT  ns;\\
 DELTA  1.0;\\
 TIME   0.; 30.0;\\
 X_MIN  0.0;\\
 X_MAX  180.0;\\
 Y_MIN  0.0;\\
 Y_MAX  36.0;\\
 FREQ   Freq__;\\
#END_PARM\\
#TOPOLOGY\\
 BLOCK 1;\\   ! канал, низ
  POLYGON_STAT MAGNETIC;\\
   L 0.0; 3.0;\\
   L 90.0; 3.0;\\
   L 180.0; 3.0;\\
 END_B\\
 BLOCK 2;\\   ! канал, верх
  POLYGON_STAT MAGNETIC;\\
   L 0.0; 33.0;\\
   L 90.0; 33.0;\\
   L 180.0; 33.0;\\
 END_B\\
 BLOCK 4;\\   ! плавный профиль — тот же профиль eps; файл уже записан на первом шаге
  RECT_STAT (1+(5.0)*(x+30.0)/60.0)-1; -30.0; 30.0; -15.0; 15.0;\\
 END_B\\
 BLOCK 5;\\   ! диэлектрик за переходом
  RECT_STAT 5.0; 120.0; 180.0; 3.0; 33.0;\\
 END_B\\
 BLOCK 6;\\   ! вход 1 (вакуум) — АКТИВНЫЙ
  INPUT_X MAGNETIC; 3.0; 33.0; 0; 30; 1; 0;\\
 END_B\\
 BLOCK 7;\\   ! вход 2 (в диэлектрике) — пассивный
  INPUT_X MAGNETIC; 3.0; 33.0; 60; 90; 0; 0; 5.0;\\
 END_B\\
#END_TOPOLOGY\\
#LINK_LIST\\
 T 1; 0.0; 0.0;\\
 T 2; 0.0; 0.0;\\
 T 4; 90.0; 18.0;\\
 T 5; 0.0; 0.0;\\
 T 6; 0.0; 0.0;\\
 T 7; 180.0; 0.0;\\
#END_LINK\\
#OUTPUT\\
 FILE Tfile__;\\
 SMATRIX Sfile__; Freq__; 22.5; 30.0;\\
#END_OUTPUT\\
#END_STEP

Smooth transition: eps by formula

An eps profile of the coordinates versus a sharp boundary

Parameter Value
Library section Media, plasma, RCS
Kernel PlanarRT H (planarrt_h.exe)
Source inhomogeneous medium, profile by formula
Mesh 180 × 36 nodes, step 1 mm
Task time 30 ns of model time, steps: 32
Run duration about 20 s on a six-core PC, without field output

Problem statement

A transition from vacuum to a dense dielectric. A sharp boundary reflects equally at all frequencies, while a smooth profile, linear along the length, is the better the longer the transition is compared with the wavelength. The profile is given by a formula of x: this is how any inhomogeneous eps is passed to the kernel, and on the canvas it is shown as a gradient.

At the first step the kernel saves the computed profile to the file grad.eps; the same file can later be connected by a FILE block.

  • One profile is given by a formula of x: this is how any inhomogeneous eps is passed to the kernel. The gradient is also visible on the canvas.

Theoretical background

The medium in this group is inhomogeneous. A plane wave at normal incidence is set up by a channel with magnetic walls: a uniform field propagates in it exactly as in free space, and the problem reduces to boundaries and layers. Open problems (scattering, lenses) are solved in a region bounded by an absorber contour, and the wave enters through a wide port on the left. The plane-wave port sits on the region boundary here, as in the microstrip samples, so the task has a reflection of about −15…−25 dB, and results below that level are not meaningful. This is a property of the setup, not of the kernel.

A sharp vacuum–dielectric boundary reflects equally at all frequencies:

|Γ|=|1−ε1+ε|=0.42  (−7.5 dB at ε=6)

A smooth profile ε(x) no shorter than a wavelength removes the reflection, since the contributions of the layers arrive with different phases. The profile is given by a formula in x; any inhomogeneous medium reaches the kernel the same way.

Sample datasheet. The values that TPL Designer computes by formulas for the default parameters.

Quantity Value
Transition eps from 1 to 6 over a length of 60 mm (1 lambda at 5 GHz)
Sharp boundary, exact |S11| = -7.5 dB at all frequencies
Smooth profile the reflection falls as the frequency grows: the transition is longer than the wavelength
Profile file the kernel writes grad.eps at the first step; a ready file is connected by a FILE block, see the sample "Medium from an .eps file"

Creating the task file

The sample is built into TPL Designer, so there is nothing to download. Follow the steps in order.

  1. Start TPL Designer. On the start screen, in the Take a sample card, click Open library.
  2. Choose the Media, plasma, RCS section on the left and click the Smooth transition: eps by formula tile in the gallery. The sample card with its datasheet and parameters opens on the right.
The sample card in the TPL Designer library
The sample card in the TPL Designer library
  1. Keep the default parameters: all the numbers on this page were obtained for them. Changed values can be reset with Restore defaults.
  2. Click Open in editor. The task opens in the five-section wizard; the section list is on the left.
  3. Open the Geometry section. The canvas shows what the kernel will compute: metal walls, ports, dielectric or plasma. A green icon marks the active port and a red one the passive port. Double-click an object to open its properties.
The Geometry section of the TPL Designer wizard
The Geometry section of the TPL Designer wizard
  1. If you want to view the field in FieldView, open the Output section and tick Export topology (.tt file) and Export fields (.ex, .ey, .hz files), option only at the first step. Field output slows the calculation several times, so it is off in the samples unless a task requires it.
  2. Open the Check section. The left side shows the summary, the right side shows the task file text, and the strip at the bottom reports that there are no issues.
The Check section of the TPL Designer wizard
The Check section of the TPL Designer wizard
  1. Click Create task file and choose an empty folder. It will contain these files: grad.tpl, grad_step.h.

Running the calculation

  1. Start PlanarRT H (planarrt_h.exe).
  2. Click Open Open or press Ctrl+O and choose grad.tpl in the folder you created. If the status bar shows Step:1;Error:no, the task was read correctly.
  3. Click Run Run or press F5. The kernel computes all task steps (32); on a six-core PC this takes about 20 s.
  4. Wait for "Done" in the status bar.

The kernel appends to the .s file instead of overwriting it. Delete the old .s file before a repeated run, or old points will mix with new ones.

Viewing the results

Scattering matrix. Click View S-matrix View S-matrix: TMCGROUT opens with the curve of the first element. It shows VSWR; to see magnitudes press Ctrl+H and choose "Y-scale" → "|S|", and add other elements with Ctrl+D.

The TMCGROUT window right after opening the .s file
The TMCGROUT window right after opening the .s file

Port signals. Click View output View output: TMCROS opens with the .t file.

The TMCROS window with a port signal
The TMCROS window with a port signal

Field. If you enabled field output in step 6, click View field and topology View field and topology: FieldView opens. It saves animations with the export command.

Results

Frequency response: magnitudes of the scattering-matrix elements computed by the kernel
Frequency response: magnitudes of the scattering-matrix elements computed by the kernel
Unwrapped transmission phase S21
Unwrapped transmission phase S21
Power balance: sum of squared magnitudes of the first matrix column
Power balance: sum of squared magnitudes of the first matrix column
Port signals over time
Port signals over time

Computed numbers: values at the range edges, mid-range and at the best match.

sharp boundary

Frequency, GHz |S11|, dB |S21|, dB
2.5 -7.17 -1.03
6.5 -8.2 -1.07
9 -8.26 -1.14
10 -7.58 -1.16

smooth profile

Frequency, GHz |S11|, dB |S21|, dB
2.5 -16.04 -0.26
6.5 -24.28 -0.22
8.5 -30.71 -0.28
10 -23.03 -0.35

Field animation

Field computed by the kernel at 6.5 GHz: 320 frames every 5 ticks, up to 3.81 ns. The Wave scale, as in FieldView

Discussion

The variants show the effect clearly. With the sharp boundary |S11| stays between −7.2 and −8.3 dB over the whole range, in agreement with the exact −7.5 dB. The smooth profile gives −16 dB at 2.5 GHz and −24…−31 dB at the upper frequencies, and transmission improves from −1 dB to −0.3 dB. The gain grows with the ratio of taper length to wavelength, as it should. Levels below −25 dB are set by the port setup.

Task file

TPL Designer shows this text in the Check section. The file is written in the CP1251 encoding.

grad.tpl
#TMC_RT_H
! Task generated by TPL Designer.
! Smooth transition from vacuum to dielectric eps = 6: an eps profile given by a formula versus a sharp boundary.
! Kernel: tmc_rth (H-mode)
! Delete grad_step.s and grad_taper.s before the run -- it is appended to, not overwritten.

#include grad_step.h

! variant: sharp boundary
gradstep1 2.5; grad_step_f2p5; grad_step;
gradstep1 3.0; grad_step_f3; grad_step;
gradstep1 3.5; grad_step_f3p5; grad_step;
gradstep1 4.0; grad_step_f4; grad_step;
gradstep1 4.5; grad_step_f4p5; grad_step;
gradstep1 5.0; grad_step_f5; grad_step;
gradstep1 5.5; grad_step_f5p5; grad_step;
gradstep1 6.0; grad_step_f6; grad_step;
gradstep1 6.5; grad_step_f6p5; grad_step;
gradstep1 7.0; grad_step_f7; grad_step;
gradstep1 7.5; grad_step_f7p5; grad_step;
gradstep1 8.0; grad_step_f8; grad_step;
gradstep1 8.5; grad_step_f8p5; grad_step;
gradstep1 9.0; grad_step_f9; grad_step;
gradstep1 9.5; grad_step_f9p5; grad_step;
gradstep1 10.0; grad_step_f10; grad_step;

! ===== Step written explicitly: the eps profile is computed here, later it is taken from the file =====
! variant: smooth profile
#STEP
#PARM
 ANGLE_UNIT radian;
 FREQ_UNIT  GHz;
 LONG_UNIT  mm;
 TIME_UNIT  ns;
 DELTA  1.0;
 TIME   0.; 30.0;
 X_MIN  0.0;
 X_MAX  180.0;
 Y_MIN  0.0;
 Y_MAX  36.0;
 FREQ   2.5;
#END_PARM
#TOPOLOGY
 BLOCK 1;   ! channel, bottom
  POLYGON_STAT MAGNETIC;
   L 0.0; 3.0;
   L 90.0; 3.0;
   L 180.0; 3.0;
 END_B
 BLOCK 2;   ! channel, top
  POLYGON_STAT MAGNETIC;
   L 0.0; 33.0;
   L 90.0; 33.0;
   L 180.0; 33.0;
 END_B
 BLOCK 4;! smooth profile -- eps profile by formula; the result is saved to grad.eps
  RECT_STAT [grad](1+(5.0)*(x+30.0)/60.0)-1; -30.0; 30.0; -15.0; 15.0;
 END_B
 BLOCK 5;   ! dielectric beyond the transition
  RECT_STAT 5.0; 120.0; 180.0; 3.0; 33.0;
 END_B
 BLOCK 6;   ! port 1 (vacuum) -- ACTIVE
  INPUT_X MAGNETIC; 3.0; 33.0; 0; 30; 1; 0;
 END_B
 BLOCK 7;   ! port 2 (in the dielectric) -- passive
  INPUT_X MAGNETIC; 3.0; 33.0; 60; 90; 0; 0; 5.0;
 END_B
#END_TOPOLOGY
#LINK_LIST
 T 1; 0.0; 0.0;
 T 2; 0.0; 0.0;
 T 4; 90.0; 18.0;
 T 5; 0.0; 0.0;
 T 6; 0.0; 0.0;
 T 7; 180.0; 0.0;
#END_LINK
#OUTPUT
 FILE grad_taper_f2p5;
 SMATRIX grad_taper; 2.5; 22.5; 30.0;
#END_OUTPUT
#END_STEP

! variant: smooth profile
gradstep2 3.0; grad_taper_f3; grad_taper;
gradstep2 3.5; grad_taper_f3p5; grad_taper;
gradstep2 4.0; grad_taper_f4; grad_taper;
gradstep2 4.5; grad_taper_f4p5; grad_taper;
gradstep2 5.0; grad_taper_f5; grad_taper;
gradstep2 5.5; grad_taper_f5p5; grad_taper;
gradstep2 6.0; grad_taper_f6; grad_taper;
gradstep2 6.5; grad_taper_f6p5; grad_taper;
gradstep2 7.0; grad_taper_f7; grad_taper;
gradstep2 7.5; grad_taper_f7p5; grad_taper;
gradstep2 8.0; grad_taper_f8; grad_taper;
gradstep2 8.5; grad_taper_f8p5; grad_taper;
gradstep2 9.0; grad_taper_f9; grad_taper;
gradstep2 9.5; grad_taper_f9p5; grad_taper;
gradstep2 10.0; grad_taper_f10; grad_taper;

#EOF
grad_step.h
! ==========================================================================
! grad_step.h -- macro definitions of the computation steps.
! Included with the line  #include grad_step.h  and must lie NEXT TO the .tpl
!
! TWO backslashes at the end of a line = "the macro text continues below".
! The LAST line of the macro has NO continuation -- that marks the end.
! ==========================================================================
! variant: sharp boundary
#define gradstep1 Freq__; Tfile__; Sfile__; @\\
#STEP\\
#PARM\\
 ANGLE_UNIT radian;\\
 FREQ_UNIT  GHz;\\
 LONG_UNIT  mm;\\
 TIME_UNIT  ns;\\
 DELTA  1.0;\\
 TIME   0.; 30.0;\\
 X_MIN  0.0;\\
 X_MAX  180.0;\\
 Y_MIN  0.0;\\
 Y_MAX  36.0;\\
 FREQ   Freq__;\\
#END_PARM\\
#TOPOLOGY\\
 BLOCK 1;\\   ! channel, bottom
  POLYGON_STAT MAGNETIC;\\
   L 0.0; 3.0;\\
   L 90.0; 3.0;\\
   L 180.0; 3.0;\\
 END_B\\
 BLOCK 2;\\   ! channel, top
  POLYGON_STAT MAGNETIC;\\
   L 0.0; 33.0;\\
   L 90.0; 33.0;\\
   L 180.0; 33.0;\\
 END_B\\
 BLOCK 3;\\   ! sharp boundary
  RECT_STAT 5.0; 60.0; 120.0; 3.0; 33.0;\\
 END_B\\
 BLOCK 5;\\   ! dielectric beyond the transition
  RECT_STAT 5.0; 120.0; 180.0; 3.0; 33.0;\\
 END_B\\
 BLOCK 6;\\   ! port 1 (vacuum) -- ACTIVE
  INPUT_X MAGNETIC; 3.0; 33.0; 0; 30; 1; 0;\\
 END_B\\
 BLOCK 7;\\   ! port 2 (in the dielectric) -- passive
  INPUT_X MAGNETIC; 3.0; 33.0; 60; 90; 0; 0; 5.0;\\
 END_B\\
#END_TOPOLOGY\\
#LINK_LIST\\
 T 1; 0.0; 0.0;\\
 T 2; 0.0; 0.0;\\
 T 3; 0.0; 0.0;\\
 T 5; 0.0; 0.0;\\
 T 6; 0.0; 0.0;\\
 T 7; 180.0; 0.0;\\
#END_LINK\\
#OUTPUT\\
 FILE Tfile__;\\
 SMATRIX Sfile__; Freq__; 22.5; 30.0;\\
#END_OUTPUT\\
#END_STEP

! variant: smooth profile
#define gradstep2 Freq__; Tfile__; Sfile__; @\\
#STEP\\
#PARM\\
 ANGLE_UNIT radian;\\
 FREQ_UNIT  GHz;\\
 LONG_UNIT  mm;\\
 TIME_UNIT  ns;\\
 DELTA  1.0;\\
 TIME   0.; 30.0;\\
 X_MIN  0.0;\\
 X_MAX  180.0;\\
 Y_MIN  0.0;\\
 Y_MAX  36.0;\\
 FREQ   Freq__;\\
#END_PARM\\
#TOPOLOGY\\
 BLOCK 1;\\   ! channel, bottom
  POLYGON_STAT MAGNETIC;\\
   L 0.0; 3.0;\\
   L 90.0; 3.0;\\
   L 180.0; 3.0;\\
 END_B\\
 BLOCK 2;\\   ! channel, top
  POLYGON_STAT MAGNETIC;\\
   L 0.0; 33.0;\\
   L 90.0; 33.0;\\
   L 180.0; 33.0;\\
 END_B\\
 BLOCK 4;\\   ! smooth profile -- the same eps profile; the file was already written at the first step
  RECT_STAT (1+(5.0)*(x+30.0)/60.0)-1; -30.0; 30.0; -15.0; 15.0;\\
 END_B\\
 BLOCK 5;\\   ! dielectric beyond the transition
  RECT_STAT 5.0; 120.0; 180.0; 3.0; 33.0;\\
 END_B\\
 BLOCK 6;\\   ! port 1 (vacuum) -- ACTIVE
  INPUT_X MAGNETIC; 3.0; 33.0; 0; 30; 1; 0;\\
 END_B\\
 BLOCK 7;\\   ! port 2 (in the dielectric) -- passive
  INPUT_X MAGNETIC; 3.0; 33.0; 60; 90; 0; 0; 5.0;\\
 END_B\\
#END_TOPOLOGY\\
#LINK_LIST\\
 T 1; 0.0; 0.0;\\
 T 2; 0.0; 0.0;\\
 T 4; 90.0; 18.0;\\
 T 5; 0.0; 0.0;\\
 T 6; 0.0; 0.0;\\
 T 7; 180.0; 0.0;\\
#END_LINK\\
#OUTPUT\\
 FILE Tfile__;\\
 SMATRIX Sfile__; Freq__; 22.5; 30.0;\\
#END_OUTPUT\\
#END_STEP