alexrobomind / fusionsc

FusionSC
MIT License
1 stars 2 forks source link

Request for new feature of DP^m calculation #2

Open WenyinWei opened 7 months ago

WenyinWei commented 7 months ago

Hi Alex, here is the matrix A

$$\mathbf{A} (R,Z,\phi) = \begin{bmatrix} \partial{R} \left ( \frac{RB{R}}{B\phi} \right ) & \partial{Z} \left ( \frac{RB{R}}{B\phi} \right ) \ \partial{R} \left ( \frac{RB{Z}}{B\phi} \right ) & \partial{Z} \left ( \frac{RB{Z}}{B\phi} \right ) \end{bmatrix} =\begin{bmatrix} \frac{ \partial{R}(RB{R} )B\phi - RB{R}\partial{R}B{\phi} }{B\phi^2} & \frac{ \partial{Z}(RB{R} )B\phi - RB{R}\partial{Z}B{\phi} }{B\phi^2} \ \frac{ \partial{R}(RB{Z} )B\phi - RB{Z}\partial{R}B{\phi} }{B\phi^2} & \frac{ \partial{Z}(RB{Z} )B\phi - RB{Z}\partial{Z}B{\phi} }{B\phi^2} \end{bmatrix}$$

based on which $DP^m$ can be calculated from a matrix ODE:

\frac{\partial }{\partial \phi_e } D\boldsymbol{X}_{\text{pol}} (\phi_{s}, \phi_{e}) = \mathbf{A} ( \boldsymbol{X}_{\text{pol}}(\phi_{e}),\phi_{e})  D\boldsymbol{X}_{\text{pol}} (\phi_{s}, \phi_{e}),  \text{with init. cond.}  D\boldsymbol{X}_{\text{pol}} (\phi_{s}, \phi_{s}) = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} ,

where $\boldsymbol{X}_{\text{pol}} (\phi_{s}, \phi_{e})$ is the field line trace initiating from some fixed point $(x{0R}, x{0Z}, x_{0\phi}=\phi_s)$ to $\phie$-section. $x{0R}$ and $x{0Z}$ are the variables to be differentiated by the $D$ operator of $` D\boldsymbol{X}{\text{pol}} $, but they are omitted in $ D\boldsymbol{X}{\text{pol}} (\phi{s}, \phi_{e}) `$ for brevity.

When $\phi{e} = \phi{s}+2m\pi$, $D\boldsymbol{X}_{\text{pol}} (\phi_{s}, \phi_{e})$ becomes $DP^m (\phi)$. No need to distinguish $\phi{s}$ from $\phi{e}$ anymore, so $\phi$ is enough.

A pretty convenient advantage of this method compared to direct finite difference of the Poincare points in the neighbourhood of the initiating point is that once we know the $DP^m$ of a cycle at a point on a $\phi$-section, we can easily know the $DP^m$ on the same cycle at other points on other $\phi$-sections by the following matrix ODE:

\frac{\mathrm{d} }{\mathrm{d} \phi } DP^m (\phi) = \left[ \mathbf{A} ( \boldsymbol{X}_{\text{pol}}(\phi) , \phi), DP^m (\phi) \right]
WenyinWei commented 7 months ago

I am not sure whether the method of direct finite difference of Poincare points is sensitive to the seeding points density near the initiating point that we want to solve $DP^m$ for, but I am sure the matrix ODEs above are insensitive to the magnetic field grid quality. Here I attach a Julia notebook in which I do that for W7-X equilibrium file given by HINT. I didn't use any design patterns in this notebook. Everything including every function is exposed directly. field_line_tracing_DPm_calculation_on_W7X.zip

WenyinWei commented 7 months ago

Here is the $DP^m$ eigenvalue growth analysis (one year ago) for different traces started from points on a straight line. Although it is in Chinese, I guess you can understand all slides easily since they all discuss the growth rate of the $DP^m$ eigenvalues, just for different orbits. We need flexible data access to the calculated results so that further analysis on the behaviours of $DP^m$ near Cantorus or LCFS can be facilitated. Thanks for your cooperation!

20221103 Routine report Whether an orbit is on an invariant torus.pdf

WenyinWei commented 7 months ago

I tried to go higher order derivatives to explore $D^k P^m$. I can deduce something and approximate the Poincare map by its multi-order expansion like $P^m(\boldsymbol{x}_0 + \Delta \boldsymbol{x}) = \boldsymbol{x}_0 + DP^m \Delta \boldsymbol{x}+ D^2 P^m \Delta \boldsymbol{x}^2 + ...$, but the results are not that interesting. It cost a few tens of orders to have a good approximation around the magnetic axis (I require it approximates the true value at $m>50$, which might be demanding).