Skip to content

Commit

Permalink
pySTEL: Added python inteface to INDATA volume calculation.
Browse files Browse the repository at this point in the history
  • Loading branch information
lazersos committed Jan 9, 2025
1 parent 536c915 commit 29959d8
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pySTEL/libstell/libstell.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,28 @@ def write_indata(self,filename,out_dict=None):
write_indata_namelist.restype=None
write_indata_namelist(filename.encode('UTF-8'),len(filename))

def indataVolume(self):
"""Wrapper to the INDATA_VOLUME subroutine
This routine wrappers the INDATA_VOLUME subroutine
which calcualtes the plasma volume for a given INDATA
boundary deffinition.
Returns
-------
Volume : real
Total volume of plasma [m^3]
"""
import ctypes as ct
# Load Libraries
module_name = self.s1+'vmec_input_'+self.s2
indata_volume = getattr(self.libstell,module_name+'_indata_volume'+self.s3)
indata_volume.argtypes = [ct.POINTER(ct.c_double)]
indata_volume.restype = None
volume = ct.c_double(0.0)
indata_volume(ct.byref(volume))
return volume.value

def read_bootin(self,filename):
"""Reads a BOOTSJ BOOTIN namelist
Expand Down
13 changes: 13 additions & 0 deletions pySTEL/libstell/vmec.py
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,19 @@ def pcurr(self,x):
"""
return self.libStell.pcurr(x)

def calcVolume(self):
"""Calculate total volume
The routine computes the total volume based on the boundary
shape.
Returns
-------
volume : real
Total equilibrium volume [m^3]
"""
return self.libStell.indataVolume()



# Main routine
Expand Down

0 comments on commit 29959d8

Please sign in to comment.