# Presentation: 525377

## Magnetics measurements in NCSX: SVD/PCA methods-I

**Neil Pomphrey, Ed Lazarus**
**Stellarator Theory Teleconference**
**Sep. 23, 2004**

## Introduction

- 	A variety of magnetic diagnostics (MD’s) will be installed in NCSX and used for
- Shape Control (during shots)
- Equilibrium Reconstruction (between shots)
- Define a method for selecting a “good” set of MD’s (optimizes the invertible information)
- How much info. is available _directly_ from external MD signals? – more than tokamaks?
-   This presentation is a partial coverage of topic 2.

## Target Function on Control Surface (CS)

- A database of VMEC equilibria (many hundreds) is being generated with a wide range of shapes and profiles.
- B-fields from each of the equilibria are calculated on a single “Control Surface” (CS) that lies 1cm outside the envelope of all equilibria. These are distributions, bj(), j = 1...Neq
- Magnetic signals dj(**x**d) are also calculated for each candidate diagnostic using V3RFUN and V3POST.
- The bj() are targets for the dj(**x**d). If the targets are reproduced with adequate precision the MD’s should provide sufficient information for control and equilibrium reconstruction!

## The Equilibria in the Database have a wide variety of shapes

**A surface is defined (the “Control Surface”, CS) which encloses all plasmas in the database. It lies 1cm outside of the envelope of all equilibria. The B******** from each equilibrium is calculated by V3RFUN/V3POST and stored for analysis.**** **

**CS**

## Current Profiles in Database

## Pressure Profiles in Database

**098**

**099**

**019**

**100**

**101**

**014**

**012**

**029**

**026**

**022**

**Profiles with P_edge = 0**
**(last 3 digits of AM id shown)**

**030**

**041**

**000**

**013**

**052**

**053**

**007**

**001**

**032**

**005**

**Profiles with P_edge finite **

## Equilibrium Database Parameters

## Data Preparation and Expansion in EOF’s

- For each equilibrium, labelled by index j, calculate Bon a uniform mesh of M points on the CS. (This is bj()
- Store the signal as an M-element column vector **x**j.
- Data from Neq equilibria naturally forms an MxNeq matrix, **X**.
- Each column of **X** (B signal on the CS) has an _exact_ expansion as a linear combination of  min(M,Neq)  orthogonal patterns (called Empirical Orthogonal Eigenfunctions (EOFs)
- The EOFs are eigenfunctions of the correlation matrix **C** = **X X****T**.
- The calculation of EOFs is most conveniently done by Singular Value Decomposition of **X**

##       SVD:      XMxNeq = UMxM WMxNeq VTNeqxNeq
      equivalent to 
                    xj =  (Vjkwk) uk

                        ≡ Zk(j) uk

      Note:    xj(l) =  Zk(j) uk, minimizes  ||xj – xj(l)||

-       equivalent to
-                     **x**j =  (Vjkwk) **u**k
-                         ≡ Zk(j) **u**k
-       Note:**    x**j(l) =  Zk(j) **u**k, minimizes  **||x****j**** – x****j****(****l****)****||**

**Singular Value Decomposition (SVD),**** Principal Components, and EOF’s**

**k****th**** column of U: Empirical Orthogonal Functions (EOFs).**

**j****th**** column of X**

**Score for j****th**** observation on k****th**** Principal Component (PC)**

- k=1

**l**

- k=1

**M**

- k=1

**M**

## Interpretation of Principal Components

- Since        **x**j =  Zk(j) **u**k,
-     orthonormality of the EOFs =>
-               **x**j • **u**k = Zk(j)

- k=1

**M**

**LHS is essentially an overlap integral. **
**For X = matrix of B******** signals, Principal Component ”score”               ****Z****k****(j)** = ∫∫**d********d********B********(j)**** ****(********) ****u****(k)****(********) measures importance of k****th**** EOF in determining the shape of j****th**** equilibrium signal on the CS.**

## Interpretation (Cont)

**SVD on X** = **U W** **V****T** **can be interpreted as a ****variable transformation X ****:= Z = U****T**** X  ****(= WV****T****)**
**                ****Z****1j**** = U****11**** X****1j**** + U****21**** X****2j**** + U****31**** X****3j**** + ... ****(= W****1****V****j1****)**
**                ****Z****2j**** = U****12**** X****1j**** + U****22**** X****2j**** + U****32**** X****3j**** + ... ****(= W****2****V****j2****)**
**                ****Z****3j**** = U****13**** X****1j**** + U****23**** X****2j**** + U****33**** X****3j**** + ... ****(= W****3****V****j3****)**** **
**                ... ... ... ... ... ... ****etc ... ... ... ... ... ... ... ... **
**The  **Uij **are weights which measure the contribution of each of the original variables to the variance of the data in the transformed coordinates ******** means for selection/rejection of candidate magnetic diagnostics.**

## Singular Value Analysis of Vacuum Signal (BTotal - BPlasma) on Control Surface

** ****The 8 patterns are to be expected because we have 8    equilibrium coil current groups        (M1-3, TF, PF3-6).**

- s.v. index

- Log10 [w(k)/w(1)]

-   0

- -2

- -4

- -6

- s.v. index

- Log10 [w(k)/w(1)]

-   0

- -5

- -10

-   100

-   200

-   300

- 4

- 6

- 8

- 10

- 2

**504 equilibria in database**

**Singular Value Analysis of Vacuum Signal ****(B********Total ****- B********Plasma****) on Control Surface**

-   400

-   500

## Correlation EOF’s for Vac. Signal on CS(#s 1, 2)

**EOF 1   Min=-3.33e-02, Max=+3.32e-02**

**Phi=0 cut**

**Phi=60 deg cut**

**Phi=0 cut**

**Phi=60 deg cut**

**Theta (degrees)**

**Theta (degrees)**

**Theta (degrees)**

**Theta (degrees)**

**Phi(0********120)**

**Phi(0********120)**

**Theta(0********360))**

**Theta(0********360))**

**EOF(theta,phi=0)**

**EOF(theta,phi=60)**

**EOF(theta,phi=60)**

**EOF(theta,phi=0)**

**EOF 2   Min=-8.11e-02, Max=+6.08e-02**

## SVD Analysis of BPlasma

-   0

- -2

- -4

- -6

- Log10 [w(k)/w(1)]

- s.v. index

-   100

-   200

-   300

- Log10 [w(k)/w(1)]

-   0

- -2

- -1

-  10

-  20

-  30

-  40

-  50

- s.v. index

- 0.0

- [W(k+1) – w(k)] / w(1)

- -0.2

- -0.4

- -0.6

-  10

-  20

-  30

-  40

-  50

- s.v. index

**First 2 dominant patterns of B********plasma**** contribute 94.5% of total variance. Next 3 contribute an additional 4.0%.**
**Speculate 2, and possibly up to 5, combined moments of p(s) and <J.B>(s) may be measurable.**

-   400

-   500

**Second break here after 5**

## How many independent pieces of information (PC’s) are available from the Data Matrix?

**Several procedures (mainly ad hoc)**
**Broken Stick Rule:** Retain principal components for which
-       L(k) = (wk/w1)2 > 1/N  j -1 (expected length of kth longest segment of a stick of unit length broken at random into N segments)
**Average Based:** Retain PC’s for which wk2 > 0.7 < wj2 >
**Cumulative Variance Based: **Retain as many PC’s as necessary to bring the cumulative variance of the retained PC’s up to some desired value, say 95% of the total variance – i.e., find k such that wj2/ wj2 > 0.95

**j=k**

**N**

**j=1**

**j=1**

**k**

**N**

## Correlation EOF’s for Plasma Signal on CS(#s 1, 2)

**More structure (shorter wavelength) seen here than for vacuum signal – simply distance attenuation?**

**Theta(0********360))**

**Theta(0********360))**

**EOF 1   Min=-3.86e-02, Max=+6.47e-03**

**EOF 1   Min=-4.28e-02, Max=+4.52e-02**

**Phi=0 cut**

**Phi=0 cut**

**Phi=60 deg cut**

**Phi=60 deg cut**

**Theta (degrees)**

**Theta (degrees)**

**Theta (degrees)**

**Theta (degrees)**

**Phi(0********120)**

**Phi(0********120)**

## PC Scores (All Equilibria) 

**Z****3****(j)**

**Z****2****(j)**

**Z****1****(j)**

**Z****3****(j)**

**Z****1****(j)**

**Z****2****(j)**

**Each dot represents a particular equilibrium.**
**All equilibria in the 07/15/04 database are shown.**
**As an attempt to discover what properties of the equilibria are responsible for the dominant B******** signal patterns, try color coding.**

## PC2 vs PC1 with Color Coding for Various Plasma Properties

**Sort by color on J.B profile shape **
**(only profiles with J.B > 0 everywhere)**

**Sort by color on P profile shape**
**(only profiles with Pedge = 0)**

**Would like to see a separation of colors along one or other of the axes, thereby associating a particular pattern of B******** with a profile parameter variation. A sensible guess for the appropriate profile parameters for color separation are  **l**i****/2 and ********pol**

## Current and Pressure Profiles in Database

## PC2 vs PC1 with Color Coding for Various Plasma Properties

**Sort by color on value of ******

**Sort by color on value of I****p**

****** ****and I****p**** not individually responsible for the two dominant B******** patterns.**

## Why should we think any of this is possible?

- Because of results obtained from a similar analysis using equilibria from the plasma flexibiliity studies made in preparation for the CDR.   There, we had a much more limited set of equilibria, but with the advantage of systematic variation of profiles and plasma parameters.

## Can we detect current profile variation from external magnetic measurements?

**1****st**** group: 6 equilibria where <J.B> is varied in core region ****(red)**
**2****nd**** group: 2 equilibria where current is added to the edge ****(blue)**

**Can we detect current profile variation from external magnetic measurements?**

## PCA provides a method for distinguishing equilibria

- - The B-matrix on the CS is analysed by
-    Singular Value Decomposition.
-                    X = U W VT
-   According to this decomposition, the
-    columns of U (denote by **u**k) provide a basis
-    for the expansion of any of the field patterns
-    (columns of X) on the CS.
- The **u**k are called Empirical Orthogonal Functions
-   (EOF’s) and the coefficients of the {**u**k} are called
-    Principal Components.
-  A linear combination of the first few EOF’s can
-   describe much of the variation in the data.

**A 2D scatterplot of the first two PC’s of the B********-matrix data corresponding**
** ****to the 8 equilibria in the J-profile scan distinguishes equilibria where the**
**current profile was varied in the core (red cluster) and equilibria where**
**edge current was added (blue cluster).**

**J in core region was varied for these equilibria**

**J at edge was varied for these equilibria**

## Note: The plasma boundary shape  variation is very small between these 8 equilibria

-  **Therefore if analysis of the B******** signals on the CS can distinguish  between these equilibria, it is mainly due to the profile variation, not the consequent shape variation.**

**Note: The plasma boundary shape  variation is very small between these 8 equilibria**

## B signals on Control Surface for equilibria with different <J.B>-profile shapes (fixed Ip and )

- -The B pattern change is subtle.
-  Principal Component Analysis (PCA)
-   can distinguish the equilibria.

- =0.0

- =0.5

******=0.5**

******=0.0**

**B******** signals on Control Surface for equilibria with different <J.B>-profile shapes (fixed I****p**** and ********)**

## Projection onto plane of the leading 2 principal components separates an Ip- equilibrium sequence

**Z****1****(j)**

**Z****2****(j)**

****

**I****p**

**I****p****=0.kA**

**44.kA**

**87.5.kA**

**135.kA**

**174.kA**

**23 equilibria with constant <J.B>(s) and p(s) profiles**

**Difference between B****┴**** signals on CS for ********=0.0 and ********=0.5**