# Getting Started with MEQ

Check out the README.md file for general setup and compilation instructions.

## Contents

- Tutorials
- General help
- Understanding meq's function naming scheme
- Main data structures

## Tutorials

Several tutorials are available that can be run either as live scripts or as `.m` files.

## General help

Help on output naming:

- General equilibrium quantities
- FBT specific output naming
- FGS specific output naming
- FGE specific output naming)
- RZP specific output naming)

[+MEQ MatlabEQuilibrium Toolbox+] Swiss Plasma Center EPFL Lausanne 2022. All rights reserved.

Help on parameter naming:

- General parameter naming
- FBT parameter naming
- FGS parameter naming
- FGE parameter naming
- RZP parameter naming

Get help on variable naming scheme:

- meq help
- basis function help

## Understanding meq's function naming scheme

Codes:

- fbt Inverse equilibrium problem: given constraints and cost function in terms of , B, coil (etc), find coil currents `Ia`.
- liu Equilibrium reconstruction: given measurements, find
- fgs Forward solver: given `Ia`, `Iv`, `p'`, `TT'` (or integral parameters), find
- fge Forward evolutive solver: given `Va(t)`, integral parameters (t), find `Ia(t)`, Iv(t),
- meq Generic functions for all three codes

Tokamaks `[tok]`:

- `tcv` : TCV tokamak
- `rfx` : RFX-mod
- `create` : CREATE ITER definition files
- `ana` : tokamak with user-specified geometry (through analytical formulas) for stand-alone tests

Functions naming scheme:

- `[code].m` : Main calling function
- `[code]x.m`: Retrieval of data
- `[code]g.m`: Code specific geometry calculations
- `[code]c.m`: Consolidate parameters, geometry and ancillary data for code
- `[code]t.m`: Solver / time stepper
- `[code]x[tok].m`: retrieve data for specific tokamak
- `[code]w[tok].m`: MDS writer for code output
- `[code]g[tok].m`: Code-specific geometry calculations
- `meqg[tok].m`: Geometry definition for given tokamak [tok]
- `meqp[tok].m`: Main parameters of a given device

## Main data structures

- `L`: General parameters structure
- `L.P`: User-set Parameters
- `L.G`: Geometry parameters
- `L.T`: Tunable parameters that only affect `[code]t.m` [not used yet]
- `L.*`: Parameters computed from `L.P`, `L.G` by `[code]c.m`
- `LX`: Input data structure
- `LY`: Output data structure