diff --git a/doc/COMSOL_WEST_port_index.png b/doc/COMSOL_WEST_port_index.png new file mode 100644 index 0000000..f4a6ce3 Binary files /dev/null and b/doc/COMSOL_WEST_port_index.png differ diff --git a/doc/coupling_to_plasma_from_COMSOL.ipynb b/doc/coupling_to_plasma_from_COMSOL.ipynb new file mode 100644 index 0000000..5412e4b --- /dev/null +++ b/doc/coupling_to_plasma_from_COMSOL.ipynb @@ -0,0 +1,274 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Plasma Coupling Using COMSOL Results" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "In this example, we use a COMSOL front-face coupling calculation provided by ORNL, exported as a standard Touchstone file.\n", + "\n", + "The Touchstone file is first import as a scikit-rf Network, which is then modified to fit the WEST ICRH antenna electrical model requirements." + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "import skrf as rf\n", + "\n", + "# WEST ICRH Antenna package\n", + "import sys; sys.path.append('..')\n", + "from west_ic_antenna import WestIcrhAntenna" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "4-Port Network: 'ORNL_front_face_conventional', 55000000.0-55000000.0 Hz, 1 pts, z0=[50.+0.j 50.+0.j 50.+0.j 50.+0.j]\n" + ] + } + ], + "source": [ + "front_face_conventional = rf.Network(\n", + " '../west_ic_antenna/data/Sparameters/front_faces/COMSOL/ORNL_front_face_conventional.s4p')\n", + "print(front_face_conventional) # 50 Ohm S-param component at a single frequency of 55 MHz" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The ports have been defined as:\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "So before to use the S-parameters directly to feed the electrical model, we need to:\n", + "- deembed the ports by 0.3m.\n", + "- renomalize port reference impedance to the front-face coax characteristic impedances. \n", + "- reverse ports 2 and 3." + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [], + "source": [ + "# creating a 50 Ohm dummy coax line to be removed from the front face \n", + "media_coax = rf.DefinedGammaZ0(frequency=front_face_conventional.frequency) # 50 Ohm TEM media\n", + "extra_line = media_coax.line(d=0.3, unit='m')\n", + "# deembedding all the 4 pourts\n", + "for port_idx in range(4):\n", + " front_face_conventional = rf.connect(front_face_conventional, port_idx, extra_line.inv, 0)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We expect the port to have a characteristic impedance of about 46.64 ohm, so we renormalize the Network to fit this need:" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": {}, + "outputs": [], + "source": [ + "front_face_conventional.renormalize(46.64) # done inplace" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "And finally, for historical reasons (may change in a near future ;), the S-matrix port ordering should be ajusted:" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [], + "source": [ + "front_face_conventional.renumber([1, 2], [2, 1]) # done inplace" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "OK, so now we can create the WEST antenna object:" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [], + "source": [ + "ant = WestIcrhAntenna(front_face=front_face_conventional,\n", + " frequency=front_face_conventional.frequency) # restrict to single frequ" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Let's match the antenna for this coupling:" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Looking for individual solutions separately for 1st guess...\n", + "Wrong solution (out of range capacitor) ! Re-doing...\n", + "False solution #1: [150. 150.]\n", + "True solution #1: [52.57986227 45.88696785]\n", + "True solution #1: [52.30894839 46.0700872 ]\n", + "Searching for the active match point solution...\n", + "Reducing search range to +/- 5pF around individual solutions\n", + "True solution #1: [53.67807308 46.12207788 53.62800637 46.30935881]\n" + ] + } + ], + "source": [ + "Cs = ant.match_both_sides(f_match=55e6)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The coupling resistance of the antenna for this coupling in a nominal dipole excitation is:" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([0.70081638, 0.6878438 ])" + ] + }, + "execution_count": 32, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "power = [1, 1]\n", + "phase = [0, np.pi]\n", + "\n", + "# Coupling resistance\n", + "ant.Rc(power, phase)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The voltage and currents are:" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[22.16126386, 23.75535708, 20.56902439, 25.21223565]])" + ] + }, + "execution_count": 44, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "power = [1, 1] # MW, to adjust to fit with experiment\n", + "phase = [0, np.pi] # rad\n", + "\n", + "abs(ant.voltages(power, phase)) # results in kV" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[0.70248687, 0.75556107, 0.65298786, 0.80405425]])" + ] + }, + "execution_count": 41, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "abs(ant.currents(power, phase)) # results in kA" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.7" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/west_ic_antenna/data/Sparameters/front_faces/COMSOL/ORNL_front_face_conventional.s4p b/west_ic_antenna/data/Sparameters/front_faces/COMSOL/ORNL_front_face_conventional.s4p new file mode 100644 index 0000000..fed11bc --- /dev/null +++ b/west_ic_antenna/data/Sparameters/front_faces/COMSOL/ORNL_front_face_conventional.s4p @@ -0,0 +1,5 @@ +# Hz S MA R 50 +5.5E7 0.9833673750492276 80.96377443955839 0.008159649655058979 7.738772614443071 0.0145413437349296 16.766538738668693 0.0010505712330604862 -169.75560162791115 + 0.005398399959278055 22.968885177373394 0.9848074824065548 80.65809524512109 0.002317451028156058 3.2454593187084524 0.013899534074545427 14.553096258345233 + 0.015466057366109193 15.352573092351177 0.0017852444452037635 2.802734655640837 0.9830347719457835 80.74299676938419 0.00812386410086659 7.621156795969611 + 0.0010813303292888372 -61.44581050964589 0.014724345533904457 13.318047129975318 0.005359073489960678 22.934149123418244 0.9850374253641254 80.8905612330192 diff --git a/west_ic_antenna/data/Sparameters/front_faces/COMSOL/ORNL_front_face_plasma_inside.s4p b/west_ic_antenna/data/Sparameters/front_faces/COMSOL/ORNL_front_face_plasma_inside.s4p new file mode 100644 index 0000000..43d6755 --- /dev/null +++ b/west_ic_antenna/data/Sparameters/front_faces/COMSOL/ORNL_front_face_plasma_inside.s4p @@ -0,0 +1,5 @@ +# Hz S MA R 50 +5.5E7 0.9531014698199719 74.68128260423282 0.011727825824109023 22.140672391691247 0.0042213470494665405 11.518713731671811 0.002189631421892682 42.58156998869071 + 9.251508660246946E-4 -70.21624695384136 0.958437677141582 73.97406838963975 1.7232083904810094E-4 -60.95155708607013 0.005781121306569129 11.04470231400275 + 0.003550071050919271 -5.440992958402874 0.0031673180639685814 30.852889750516837 0.9523110682604861 74.3856493165878 0.011744626700427849 22.11148013138784 + 1.7657833450556378E-4 -67.23316376248191 0.005247609440270916 0.5440706526584136 9.356608093953542E-4 -69.87439488938504 0.9590992784229622 74.23536526952307