The ElectricField
class holds settings for the parallel electric field solved for by DREAM,
which is described by the unknown E_field
. This quantity is defined as
where angle brackets \(\langle\cdot\rangle\) denote a flux-surface average, \(\boldsymbol{E}\) denotes the electric field, \(\boldsymbol{B}\) the magnetic field and \(\varphi\) the toroidal angle.
The electric field can be solved for in two different ways:
By prescribing the electric field profile in time \(E_\parallel = \tilde{E}(t,r)\) (TYPE_PRESCRIBED
)
By solving the induction equation (TYPE_SELFCONSISTENT
):
(1)¶\[\begin{split} \begin{cases} \frac{\partial\psi_{\rm p}}{\partial t} &= V_{\rm loop},\\ \mu_0\frac{j_\parallel}{B}\left\langle \boldsymbol{B}\cdot\nabla\varphi \right\rangle &= \frac{1}{V'}\frac{\partial}{\partial r}\left[ V'\left\langle \frac{\left|\nabla r\right|^2}{R^2} \right\rangle \frac{\partial\psi_{\rm p}}{\partial r} \right] \end{cases}\end{split}\]where \(\psi_{\rm p}\) is the poloidal flux, \(\mu_0\) is the vacuum permeability, \(V'\) the spatial Jacobian and \(r\) the minor radius in the outer midplane. The loop voltage \(V_{\rm loop}\) is defined by
\[V_{\rm loop} = 2\pi \frac{\langle \boldsymbol{E}\cdot\boldsymbol{B} \rangle}{\langle \nabla \varphi \cdot \boldsymbol{B} \rangle}.\]
The electric field can be prescribed in both space and time. The full syntax for prescribing an electric field evolution is
ds.eqsys.E_field.setPrescribedData(efield=E_field, radius=E_field_r, times=E_field_t)
where E_field
is an array of shape (nt, nr)
specifying the parallel
electric field strength in space and time, E_field_r
is a vector with nr
elements representing the radial grid on which the electric field is prescribed,
and E_field_t
is a vector with nt
elements representing the time grid on
which the electric field is prescribed.
For convenience, it is possible to prescribe a constant and radially uniform electric field by only specifying it as a scalar:
ds.eqsys.E_field.setPrescribedData(0.3)
This will cause the electric field to be \(E_\parallel = 0.3\,\mathrm{V/m}\) at every radius, in every time step, during the simulation.
In this mode the electric field is evolved by solving the system
(1). The evolution of the electric field is thus coupled to the
poloidal flux \(\psi_{\rm p}\) and, by extension, to the total plasma
current density \(j_{\rm tot}\). To evolve the electric field
self-consistently, the first thing one must do is to set the type of the
electric field to TYPE_SELFCONSISTENT
via a call to
setType()
:
import DREAM.Settings.Equations.ElectricField as ElectricField
...
ds.eqsys.E_field.setType(ElectricField.TYPE_SELFCONSISTENT)
By default, the initial electric field profile will be identically zero. This
is automatically overridden if the settings are loaded from an old output file
(see restart), but the initial profile can also be set explicitly via a
call to setInitialProfile()
:
ds.eqsys.E_field.setInitialProfile(efield=E_field, radius=E_field_r)
where E_field
is a vector of size nr
giving the initial electric field
profile, and E_field_r
is a vector representing the radial grid on which the
initial electrc field profile is defined.
The second equation in (1) requires a boundary condition at \(r=r_{\rm wall}\) to be given. In DREAM, three different boundary conditions can be applied at the tokamak wall.
The first boundary condition, BC_TYPE_PRESCRIBED
, prescribes the time
evolution of the loop voltage \(V_{\rm loop,wall}\) on the tokamak wall
(normalized to the tokamak major radius \(R_0\)). This is particularly
useful for simulating experimental scenarios where the parameter
\(V_{\rm loop,wall}\) has been measured.
import DREAM.Settings.Equations.ElectricField as ElectricField
ds = DREAMSettings()
...
# Tokamak major radius
R0 = 1.65
# Define evolution of V_loop/R0
Vmax = 1
V_loop_t = np.linspace(0, 1, 100)
V_loop_R0 = (Vmax/R0)*(1 - (1-t)**2)
ds.eqsys.E_field.setBoundaryCondition(bctype=ElectricField.BC_TYPE_PRESCRIBED,
V_loop_wall_R0=V_loop_R0, times=V_loop_t, R0=R0)
The second boundary condition, BC_TYPE_SELFCONSISTENT
, instead lets the user
specify the (inverse) tokamak wall time, \(1/\tau_{\rm wall}\), which
directly corresponds to the wall resistivity. The perfectly conducting limit
\(\tau_{\rm wall} = \infty\) is supported, and is obtained by setting
inverse_wall_time = 0
. In case a cylindrical geometry is used, the major
radius R0
can be explicitly set, independently of the geometry used, since
the external inductance otherwise diverges for infinite major radius.
import DREAM.Settings.Equations.ElectricField as ElectricField
ds = DREAMSettings()
...
# Tokamak major radius
R0 = 1.65
# Wall time
tau_wall = .01 # (s)
ds.eqsys.E_field.setBoundaryCondition(bctype=ElectricField.BC_TYPE_SELFCONSISTENT,
inverse_wall_time=1/tau_wall, R0=R0)
The third boundary condition, BC_TYPE_TRANSFORMER
, can be seen as a
combination of the two other boundary conditions, with a resistive wall and
a prescribed loop voltage (although at the transformer, which passes through the
axis of symmetry at \(R=0\)).
import DREAM.Settings.Equations.ElectricField as ElectricField
ds = DREAMSettings()
...
# Tokamak major radius
R0 = 1.65
# Define evolution of V_loop/R0
Vmax = 1
V_loop_t = np.linspace(0, 1, 100)
V_loop_R0 = (Vmax/R0)*(1 - (1-t)**2)
# Wall time
tau_wal = .01 # (s)
ds.eqsys.E_field.setBoundaryCondition(bctype=ElectricField.BC_TYPE_PRESCRIBED,
inverse_wall_time=1/tau_wall, R0=R0,
V_loop_wall_R0=V_loop_R0, times=V_loop_t)
Note
With all boundary conditions, the tokamak wall location wall_radius
must
be specified. This parameter denotes the minor radial coordinate of the
tokamak wall (i.e. the distance of the wall from the center of the plasma).
This is done via the call ds.radialgrid.setWallRadius(b)
, where b
is
the desired wall radius.
DREAM.Settings.Equations.ElectricField.
ElectricField
(settings, ttype=1, efield=None, radius=0, times=0)¶Bases: DREAM.Settings.Equations.PrescribedParameter.PrescribedParameter
, DREAM.Settings.Equations.PrescribedInitialParameter.PrescribedInitialParameter
, DREAM.Settings.Equations.PrescribedScalarParameter.PrescribedScalarParameter
, DREAM.Settings.Equations.UnknownQuantity.UnknownQuantity
__getitem__
(index)¶Returns the value of the prescribed electric field at the given indices.
__init__
(settings, ttype=1, efield=None, radius=0, times=0)¶Constructor.
settings (DREAM.DREAMSettings) – Parent settings object.
ttype (int) – Method to use for evolving electric field.
efield – Prescribed or initial electric field (profile).
radius – Radial grid on which the prescribed or initial electric field (profile) is defined.
times – Time grid on which the prescribed electric field is defined.
fromdict
(data)¶Sets this paramater from settings provided in a dictionary.
setBoundaryCondition
(bctype=2, V_loop_wall_R0=None, times=0, inverse_wall_time=None, R0=0)¶Specifies the boundary condition to use when solving for the electric
field self-consistently, i.e. with TYPE_SELFCONSISTENT
. Possible
boundary condition types are:
Name |
Description |
---|---|
BC_TYPE_PRESCRIBED |
Set \(V_{\rm loop}\) on the tokamak wall. |
BC_TYPE_SELFCONSISTENT |
Specify the tokamak wall time and solve self-consistently for \(V_{\rm loop,wall}\). |
BC_TYPE_TRANSFORMER |
Same as |
bctype (int) – Type of boundary condition to use (see table above for available options).
V_loop_wall_R0 – Prescribed value of \(V_{\rm loop}/R_0\) on the tokamak wall (or at transformer in case of type=BC_TYPE_TRANSFORMER
), normalized to the tokamak major radius \(R_0\).
times – Time grid on which V_loop_wall_R0
is given.
inverse_wall_time – Inverse wall time for the tokamak, used when solving for \(V_{\rm loop,wall}\) self-consistently.
R0 – Major radius for the tokamak, only used when solving for \(V_{\rm loop,wall}\) self-consistently (independent of radial-grid major radius).
setInitialProfile
(efield, radius=0)¶When TYPE_SELFCONSISTENT
, sets the initial electric field profile.
The parameter efield
may be either a scalar (in which case the
profile is taken to be uniform) or an array. The associated radial grid
radius
must be of the same type and dimension.
efield – Initial electric field profile.
radius – Radial grid on which the initial profile is defined.
setPrescribedData
(efield, radius=0, times=0)¶When TYPE_PRESCRIBED
, sets the spatiotemporal evolution of the
electric field during the simulation. The parameter efield
may be
either a scalar (in which case the electric field is taken to be
constant and uniform in time and radius) or a 2D array of shape
(nt, nr). The associated time grid times
must be of size nt
and
the radial grid must be of size nr
.
efield – Prescribed electric field.
radius – Radial grid on which the electric field is prescribed.
times – Time grid on which the electric field is prescribed.
setType
(ttype)¶Set the type of equation to use for evolving the electric field. The available types are
Name |
Description |
---|---|
TYPE_PRESCRIBED |
Prescribe spatiotemporal evolution of electric field. |
TYPE_SELFCONSISTENT |
Evolve electric field consistent with the evolution of the poloidal flux and plasma current. |
TYPE_PRESCRIBED_OHMIC_CURRENT |
Evolve electric field consistent with the evolution of the poloidal flux and plasma current. |
ttype (int) – Type of electric field evolution to use.
todict
()¶Returns a Python dictionary containing all settings of this ColdElectrons object.
verifySettings
()¶Verify that the settings of this unknown are correctly set.