|
|
These are the options available to QLKNN fortran. The options are given as a [derived data type ](https://www.tutorialspoint.com/fortran/fortran_derived_data_types.htm) found in [src/qlknn_types.f90](https://gitlab.com/qualikiz-group/QLKNN-fortran/blob/master/src/qlknn_types.f90). All options are also exposed to MATLAB, where they are given by a struct.
|
|
|
|
|
|
| option | default | description
|
|
|
| ------------------------------------- | ------- | --------------------------------------------------- |
|
|
|
| apply_victor_rule | false | Apply the 'Victor' rotation model in postprocessing |
|
|
|
| use_ion_diffusivity_networks | false | True: Return $`D_i`$ if `use_effective_diffusivity = false` |
|
|
|
| | | False: Return $`D_e`$ if `use_effective_diffusivity = false` |
|
|
|
| use_effective_diffusivity | true | Return $`\Gamma_{e}`$, not separarate $`D`$s and $`V`$s |
|
|
|
| calc_heat_transport | true | Return $`q_i`$ and $`q_e`$ for all modes (not implemented yet) |
|
|
|
| calc_part_transport | true | Return $`\Gamma_{e,eff}`$, $`D`$s, and $`V`$s for all modes |
|
|
|
| use_ETG | true | Return $`q_{e,ETG}`$ |
|
|
|
| use_ITG | true | Return $`q_{e,ITG}`$, $`q_{i,ITG}`$, $`\Gamma_{e,ITG}`$, $`D_{i,ITG}`$, $`D_{e,ITG}`$ |
|
|
|
| use_TEM | true | Return $`q_{e,TEM}`$, $`q_{i,TEM}`$, $`\Gamma_{e,TEM}`$, $`D_{i,TEM}`$, $`D_{e,TEM}`$ |
|
|
|
| constrain_inputs | true | Constrain inputs at QLKNN ingestion to set ranges |
|
|
|
| min_input, max_input, margin_input | per net | min, max and margin of QLKNN input clipping |
|
|
|
| constrain_outputs | true | Constrain outputs after QLKNN calculation, but _before_ merging modes together |
|
|
|
| min_output, max_output, margin_output | per net | min, max and margin of QLKNN output clipping |
|
|
|
|
|
|
The following debug options are also available, but should not be touched in general. Additionally, the verbosity input is passed from any implementing interface where `QLKNN verbosity = interface verbosity - 1`
|
|
|
|
|
|
| option | default | description
|
|
|
| ------------------------------------- | ------- | --------------------------------------------------- |
|
|
|
| apply_stability_clipping | true | Clip all transport if leading flux is $`<=0`$
|
|
|
| merge_modes | true | Merge modes together. (e.g. $`q_{e} = q_{e, ETG} + q_{e, ITG} + q_{e, TEM}`$) |
|
|
|
| force_evaluate_all | false | Override all flags, and evaluate and return all fluxes |
|
|
|
|
|
|
Flags can be combined in an and-like fashion. For example `use_ITG = false` `use_effective_diffusivity = false` and rest default will return $`q_{e,ETG}`$, $`q_{e,TEM}`$, $`q_{i,TEM}`$, $`\Gamma_{e,TEM}`$, $`D_{e,TEM}`$
|
|
|
|
|
|
# QLKNN-10D IO
|
|
|
The call signature of QLKNN-10D is as follows
|
|
|
``` fortran
|
|
|
evaluate_QLKNN_10D(input, nets, qlknn_out, verbosityin, optsin, qlknn_normsin, dqlknn_out_dinput)
|
|
|
```
|
|
|
| argument | description | shape | optional |
|
|
|
| -------- | ----------- | ----- | -------- |
|
|
|
| input | Input array to NNs | 11xnrho | no |
|
|
|
| nets | The networks to be evaluated, see `type net_collection` in [src/qlknn_types.f90](https://gitlab.com/qualikiz-group/QLKNN-fortran/blob/master/src/qlknn_types.f90) | - | no |
|
|
|
| qlknn_out| output array of the evaluated networks | nrho x nout | no |
|
|
|
| verbosityin | verbosity of debug messages | - | yes, default = 0 |
|
|
|
| optsin | Options (described above) to QLKNN | - | yes, defaults as above |
|
|
|
| qlknn_normsin | normalizations needed for victor rule | - | yes, mandatory if `use_victor_rule = true` |
|
|
|
| dqlknn_out_dinput | Jacobian of QLKNN with respect to input vector | nout x nrho x 10 | yes |
|
|
|
|
|
|
nout is the amount of networks if `merge_modes = false`. The columns are (1)$`q_{e,ETG}`$, (2)$`q_{e,ITG}`$, (3)$`q_{e,TEM}`$, (4)$`q_{i,ITG}`$, (5)$`q_{i,TEM}`$, (6)$`\Gamma_{e,ITG}`$, (7)$`\Gamma_{e,TEM}`$, (8)$`D_{e,ITG}`$, (9)$`D_{e,TEM}`$, (10)$`V_{t,e,ITG}`$, (11)$`V_{t,e,TEM}`$, (12)$`V_{c,e,ITG}`$, (13)$`V_{c,e,TEM}`$, (14)$`D_{i,ITG}`$, (15)$`D_{i,TEM}`$, (16)$`V_{t,i,ITG}`$, (17)$`V_{t,i,TEM}`$, (18)$`V_{c,i,ITG}`$, (19)$`V_{c,i,TEM}`$, (20)$`\gamma_0`$
|
|
|
|
|
|
if `merge_modes = true` `nout = 10`, namely (1)$`q_{e}`$, (2)$`q_{e,ETG}`$, (3)$`q_{i}`$, (4)$`\Gamma_{e}`$, (5)$`D_{e}`$, (6)$`V_{t,e}`$, (7)$`V_{c,e}`$, (8)$`D_{i}`$, (9)$`V_{t,i}`$, (10)$`V_{c,i}`$
|
|
|
|
|
|
RAPTOR NOTE: As of legacy (sorry!) in RAPTOR it is: if `merge_modes = true` `nout = 7`, namely (1)$`q_{e}`$, (2)$`q_{i}`$, (3)$`\Gamma_{e}`$, (4)$`D_{e}`$, (5)$`V_{e}`$, (6)$`D_{i}`$, (7)$`V_{i}`$
|
|
|
|
|
|
|
|
|
Input is not hard-coded, but currently:
|
|
|
(1)$`Z_{eff}`$, (2)$`RLT_i`$, (3)$`RLT_e`$, (4)$`RLn`$, (5)$`q`$, (6)$`\hat{s}`$, (7)$`x`$, (8)$`T_i/T_e`$, (9)$`\log{\nu^*}`$, (10)$`\gamma_{ExB}`$, (11)$`T_e`$, where $`T_e`$ is only needed if `use_victor_rule = true`
|
|
|
|
|
|
All in-out quantities are in GyroBohm and/or QuaLiKiz convenient units when applicable.
|
|
|
|
|
|
# Conversion from QLKNN to TCI interface
|
|
|
The QLKNN outputs fluxes in [QuaLiKiz GB units](https://gitlab.com/qualikiz-group/QuaLiKiz/wikis/Input-and-output-variables#gyrobohm). The inputs are QuaLiKiz convenient units.
|
|
|
|
|
|
| variable | definition | calculation | TCI field |
|
|
|
| -------- | ---------- | ----------- | --------- |
|
|
|
$`A_{ns}`$ | Normalized logarithmic density gradient | $`-\frac{R_0}{n_{s, FSA}} * \frac{dn_{s, FSA}}{dr_{minor}}`$ | - |
|
|
|
$`A_{ts}`$ | Normalized logarithmic temperature gradient | $`-\frac{R_0}{T_s} \frac{dT_s}{dr_{minor}}`$ | - |
|
|
|
$`n_{s,LFS}`$ | Density in [m**-3] on LFS midplane | - | `ni_LFS`/`ne_LFS` |
|
|
|
$`n_{s,FSA}`$ | Density in [m**-3] Flux Surface Avaraged | - | `ni`/`ne` |
|
|
|
$`T_e`$ | temperature in [J] | - | `Te` |
|
|
|
$`q_s`$ | Heat transport SI| $`(n_{s,LFS} * T_s * \chi_{GB})/a_{ref} * q_{s,NN}`$ | `heat_fluxes` |
|
|
|
$`\Gamma_e`$ | Particle transport SI| $`(n_{s,LFS} * \chi_{GB})/a_{ref} * \Gamma_{e,NN}`$ | `particle_fluxes` |
|
|
|
$`\chi_{s, eff}`$ | Effective heat diffusivity | $`q_s / (n_{s,FSA} * A_{ts} * \frac{T_s}{R_0})`$ | `chieff` |
|
|
|
$`V_{s, t, eff}`$ | Effective heat pinch | $`q_s / (n_{s,FSA} T_s)`$ | - |
|
|
|
$`D_{s, eff}`$ | Effective diffusivity | $`\Gamma_{FSA} / (A_{ns} \frac{n_{s, FSA}}{R_0})`$ | `deff` |
|
|
|
$`V_{s, p, eff}`$ | Effective particle pinch | $`\Gamma_{FSA} / n_{s, FSA}`$ | - |
|
|
|
|
|
|
Note that QuaLiKiz $`R_0 == R_{0,TCI}`$, and we don't have heavy impurity 2D effects, so `$\Gamma_{FSA} == \Gamma_{asym} == \Gamma$`. `$aref=Rmin_in(1)$`.
|
|
|
|
|
|
Now there are multiple options to get the $`\chi`$, $`V_t`$, $`D`$ and $`V`$ terms for the transport equation solver (TCI `chi`, `Vt`, `d` and `Vp` respectively)
|
|
|
|
|
|
## 1. effective flux
|
|
|
If `heat_fluxes` * $`A_{ts}`$ > 0 and $`|A_{ts}|`$ >=0.1:
|
|
|
|
|
|
`chi` = $`\chi_{s, eff}`$
|
|
|
|
|
|
`Vt` = 0
|
|
|
|
|
|
else (as RAPTOR doesn't have `Vt`, this is never true in RAPTOR)
|
|
|
|
|
|
`chi` = 0
|
|
|
|
|
|
`Vt` = $`V_{s, t, eff}`$
|
|
|
|
|
|
Similar for the particle fluxes, if `particle_fluxes` * $`A_{ns}`$ > 0 and $`|A_{ns}|`$ >=0.1:
|
|
|
|
|
|
|
|
|
`D` = $`D_{s, eff}`$
|
|
|
|
|
|
`Vp` = 0
|
|
|
|
|
|
else (as RAPTOR doesn't have `Vt`, this is never true in RAPTOR)
|
|
|
|
|
|
`D` = 0
|
|
|
|
|
|
`Vp` = $`V_{s, p, eff}`$
|
|
|
|
|
|
2. Using the electron D's/V's
|
|
|
|
|
|
# Transport in transport codes
|
|
|
In general it depends on the transport equation being solved which transport coefficients QLKNN has to provide. In jetto this is for _all_ ions and electrons:
|
|
|
|
|
|
``` fortran
|
|
|
TRANSPORT%chi
|
|
|
TRANSPORT%Vt
|
|
|
TRANSPORT%d
|
|
|
TRANSPORT%Vp
|
|
|
TRANSPORT%chimom
|
|
|
``` |