{ "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](https://scikit-rf.org/) [Network](https://scikit-rf.readthedocs.io/en/latest/tutorials/Networks.html), which is then modified to fit the WEST ICRH antenna electrical model requirements." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Importing the S-parameters in the electric model" ] }, { "cell_type": "code", "execution_count": null, "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": null, "metadata": {}, "outputs": [], "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 to match the expected definition by the electrical model." ] }, { "cell_type": "code", "execution_count": null, "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", "# deembed all the 4 ports\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": [ "The COMSOL S-parameters have been exported using a 50 Ohm reference impedance. However, we expect the port reference impedance equals to the characteristic impedance, that is, about 46.64 ohm, so we renormalize the Network to fit this need:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "front_face_conventional.renormalize(46.64) # done inplace" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And finally, for historical reasons (may change one day...), the S-matrix port ordering should be adjusted:" ] }, { "cell_type": "code", "execution_count": null, "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": null, "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": null, "metadata": {}, "outputs": [], "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": null, "metadata": {}, "outputs": [], "source": [ "power = [1, 1]\n", "phase = [0, np.pi]\n", "\n", "# Coupling resistance\n", "ant.Rc(power, phase)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The total voltages and currents at the capacitors are:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "power = [1.6/2, 1.6/2] # 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": null, "metadata": {}, "outputs": [], "source": [ "abs(ant.currents(power, phase)) # results in kA" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Exporting voltage excitations\n", "Now that the electrical model has been created and the antenna matched, one can export the voltage values at the front-face port into COMSOL to visualize the electric field and currents in the antenna front face and in the plasma." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Depending of the needs, the total voltages at the front-face port can be splitted into forward and reflected voltages:\n", "$$\n", "V = V_{fwd} + V_{ref} \n", "$$" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "V_fwd, V_ref = ant.front_face_voltage_waves(power, phase, Cs=Cs)\n", "print(V_fwd)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Of course, we find the same total voltage:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Vtot = V_fwd + V_ref\n", "V = ant.voltages(power, phase, Cs=Cs)\n", "# pay attention that the voltage index differ from the front-face port indexes...\n", "np.allclose(Vtot[:,[0,2,1,3]], V, rtol=1e-5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "It is also possible to deduce the forward powers and phases to setup on the four ports (assuming the reference impedance is real):" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "powers, phases = ant.front_face_powers_phases(power, phase, Cs=Cs)\n", "print(powers) # in Watt\n", "print(phases) # in degrees" ] }, { "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.13.7" } }, "nbformat": 4, "nbformat_minor": 4 }