essos.surfaces

Attributes

mesh

sharding

Classes

SurfaceRZFourier

SurfaceClassifier

Takes in a toroidal surface and constructs an interpolant of the signed distance function

Functions

_cacheable(*values)

Return false for values created while an outer JAX transform is tracing.

toroidal_flux(→ jax.numpy.ndarray)

poloidal_flux(→ jax.numpy.ndarray)

B_on_surface(surface, field)

BdotN(surface, field)

BdotN_over_B(surface, field, **kwargs)

_squared_flux_local(surface, field)

_squared_flux_global(surface, field)

_squared_flux_normalized(surface, field)

SquaredFlux(surface, field[, definition])

nested_lists_to_array(ll)

Convert a ragged list of lists to a 2D jnp array. Any entries

surfacerzfourier_from_boundary(rbc, zbs, nfp[, ...])

Create a differentiable surface from VMEC rbc and zbs arrays.

signed_distance_from_surface_jax(xyz, surface)

Compute the signed distances from points xyz to a surface. The sign is

signed_distance_from_surface_extras(xyz, surface)

Compute the signed distances from points xyz to a surface. The sign is

plot_scalar_on_flux_surface(surface, scalar_map)

surface: the surface object in which to plot the scalar_map

Module Contents

essos.surfaces.mesh
essos.surfaces.sharding
essos.surfaces._cacheable(*values)

Return false for values created while an outer JAX transform is tracing.

essos.surfaces.toroidal_flux(surface, field, idx=0) → jax.numpy.ndarray
essos.surfaces.poloidal_flux(surface, field, idx=0) → jax.numpy.ndarray
essos.surfaces.B_on_surface(surface, field)
essos.surfaces.BdotN(surface, field)
essos.surfaces.BdotN_over_B(surface, field, **kwargs)
essos.surfaces._squared_flux_local(surface, field)
essos.surfaces._squared_flux_global(surface, field)
essos.surfaces._squared_flux_normalized(surface, field)
essos.surfaces.SquaredFlux(surface, field, definition='local')
essos.surfaces.nested_lists_to_array(ll)

Convert a ragged list of lists to a 2D jnp array. Any entries that are None are replaced by 0. This routine is useful for parsing fortran namelists that include 2D arrays using f90nml.

Parameters:

ll – A list of lists to convert.

essos.surfaces.surfacerzfourier_from_boundary(rbc, zbs, nfp, ntheta=30, nphi=30, close=False, range_torus='full torus')

Create a differentiable surface from VMEC rbc and zbs arrays.

VMEC stores arrays as [n + ntor, m] and omits negative-n modes when m=0. ESSOS stores the same independent coefficients as flat mode vectors; this function performs only that ordering conversion.

class essos.surfaces.SurfaceRZFourier(rc, zs, nfp, mpol, ntor, ntheta=30, nphi=30, close=True, range_torus='full torus', scaling_type=2, scaling_factor=0)
_initialize_state(rc, zs, nfp, mpol, ntor, ntheta, nphi, close, range_torus, scaling_type, scaling_factor)
static _normalize_scaling_type(scaling_type)

Map public scaling_type inputs to norm orders used internally.

static _compute_scaling(xm, xn, scaling_type, scaling_factor)
classmethod from_input_file(file, ntheta=30, nphi=30, close=True, range_torus='full torus')
classmethod from_vmec(vmec, s=1, ntheta=30, nphi=30, close=True, range_torus='full torus')
classmethod from_wout_file(file, s=1, ntheta=30, nphi=30, close=True, range_torus='full torus')
reset_cache()
reset_mesh()
property rc
property zs
property nfp
property mpol
property ntor
property xm
property xn
property ntheta
property nphi
property close
property range_torus
_compute_meshgrid()
property theta2d
property phi2d
property angles
property scaling_type
property scaling_factor
property scaling

Mode-by-mode scaling exp(scaling_factor * ||(xm, xn)||).

property dofs
_compute_gamma()
property gamma
property gammadash_theta
property gammadash_phi
_compute_properties()
property normal
property unitnormal
property area_element
property x
property volume
property area
plot(ax=None, show=True, close=False, axis_equal=True, **kwargs)
to_vtk(filename, extra_data=None, field=None)
to_vmec(filename)

Generates a fortran namelist file containing the RBC/RBS/ZBC/ZBS coefficients, in the form used in VMEC and SPEC input files. The result will be returned as a string. For saving a file, see the write_nml() function.

mean_cross_sectional_area()
_tree_flatten()
classmethod _tree_unflatten(aux_data, children)
class essos.surfaces.SurfaceClassifier(surface, h=0.05, padding=0.1)

Takes in a toroidal surface and constructs an interpolant of the signed distance function \(f:R^3 o R\) that is positive inside the volume contained by the surface, (approximately) zero on the surface, and negative outisde the volume contained by the surface.

zrange
rrange
dist
evaluate_xyz(xyz)
evaluate_rphiz(rphiz)
essos.surfaces.signed_distance_from_surface_jax(xyz, surface)

Compute the signed distances from points xyz to a surface. The sign is positive for points inside the volume surrounded by the surface.

essos.surfaces.signed_distance_from_surface_extras(xyz, surface)

Compute the signed distances from points xyz to a surface. The sign is positive for points inside the volume surrounded by the surface.

essos.surfaces.plot_scalar_on_flux_surface(surface, scalar_map)

surface: the surface object in which to plot the scalar_map scalar_map: a scalar_map as function of theta and phi