Skip to content

Commit

Permalink
Add e_field attribute to Plasma object for electric field vector.
Browse files Browse the repository at this point in the history
  • Loading branch information
vsnever committed Aug 30, 2024
1 parent a40827b commit ae9c476
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Project Changelog
=================

Release 1.6.0 (TBD)
-------------------

New:
* Add e_field attribute to Plasma object for electric field vector. (#465)


Release 1.5.0 (27 Aug 2024)
-------------------

Expand Down
3 changes: 3 additions & 0 deletions cherab/core/plasma/node.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ cdef class Plasma(Node):

readonly object notifier
VectorFunction3D _b_field
VectorFunction3D _e_field
DistributionFunction _electron_distribution
Composition _composition
AtomicData _atomic_data
Expand All @@ -72,6 +73,8 @@ cdef class Plasma(Node):

cdef VectorFunction3D get_b_field(self)

cdef VectorFunction3D get_e_field(self)

cdef DistributionFunction get_electron_distribution(self)

cdef Composition get_composition(self)
Expand Down
21 changes: 21 additions & 0 deletions cherab/core/plasma/node.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ cdef class Plasma(Node):
All plasma emission from this plasma will be calculated with the same provider.
:ivar VectorFunction3D b_field: A vector function in 3D space that returns the
magnetic field vector at any requested point.
:ivar VectorFunction3D e_field: A vector function in 3D space that returns the
electric field vector at any requested point.
:ivar Composition composition: The composition object manages all the atomic plasma
species and provides access to their distribution functions.
:ivar DistributionFunction electron_distribution: A distribution function object
Expand Down Expand Up @@ -324,6 +326,7 @@ cdef class Plasma(Node):

# plasma properties
self.b_field = None
self.e_field = None
self.electron_distribution = None

# setup plasma composition handler and pass through notifications
Expand Down Expand Up @@ -362,6 +365,24 @@ cdef class Plasma(Node):
cdef VectorFunction3D get_b_field(self):
return self._b_field

@property
def e_field(self):
return self._e_field

@e_field.setter
def e_field(self, object value):
# assign Vector3D(0, 0, 0) if None is passed
if value is None:
self._e_field = autowrap_vectorfunction3d(Vector3D(0, 0, 0))
else:
self._e_field = autowrap_vectorfunction3d(value)

self._modified()

# cython fast access
cdef VectorFunction3D get_e_field(self):
return self._e_field

@property
def electron_distribution(self):
return self._electron_distribution
Expand Down

0 comments on commit ae9c476

Please sign in to comment.