samuelhward / LOCUST_IO

Other
0 stars 0 forks source link

LOCUST_IO Package

This "package" is designed to process input and output for the LOCUST-GPU code, developed by Rob Akers at CCFE.

The code aims to be...

Got any burning questions? Want to feedback? Please raise an issue here on github! or email me at samuel.ward@york.ac.uk - and for quick help check the docstrings!

Table of Contents

Requirements

Tested with:

Getting Started

Usage

As well as the included LOCUST_IO/docs/example_project/ some basic usage is outlined below:

import context #tell LOCUST_IO where we are
from classes.input_classes.equilibrium import Equilibrium #import classes which encapsulate LOCUST inputs, e.g. an equilibrium

#to read a GEQDSK from LOCUST_IO/data/input_files/locust_run_1/:
my_equilibrium=Equilibrium(ID='ID_tag_describing_this_equilibrium - mandatory!',data_format='GEQDSK',filename='locust_run_1/some.eqdsk') 
#my_equilibrium now holds all the data in one object
#take a quick look at the equilibrium and its data
my_equilibrium.look()                               

#to initialise empty equilibrium to fill later with the read_data() (must always specify an ID):
my_equilibrium=Equilibrium(ID='a blank equilibrium') 
#read data at a later time from GEQDSK from input_files/
my_equilibrium.read_data(data_format='GEQDSK',filename='some.eqdsk',property1='made using EFIT')
#dump equilibrium to IMAS IDS format 
my_equilibrium.dump_data(output_data_format='IDS',shot=1,run=1) 

#you can set individual pieces of data with the .set() method
#this will overwrite the default data format, which is numpy array:
#set multiple values simultaneously
my_equilibrium.set(nw=5,fpol=[1,2,3,4])  
#equally
my_equilibrium.set(**some_dict)                     

#your input/output objects can also be copied using the .copy() method:
#copy all data from one object to another
my_equilibrium.copy(some_other_equilibrium)
#copy specific fields                                        
my_equilibrium.copy(some_other_equilibrium,'B_field_R','some_key','some_other_key')  

#to get a quick glimpse of what you're working with, LOCUST_IO can also plot input/output data: 
my_equilibrium.plot()                                         
#(you can also stack plots onto the same axis object with the ax argument - see example_project)
my_equilibrium.plot(ax=some_ax,fig=some_fig)                                         

#to check what data two objects share, use .compare():
my_equilibrium.compare(another_equilibrium,verbose=True)               

#to check if your object contains enough information for running LOCUST, use .run_check():
my_equilibrium.run_check(verbose=True)                                            

#you can also calculate new pieces of data using methods or functions in the processing folder
my_equilibrium.B_calc()         

How To Cite

Samuel H. Ward. __LOCUST_IO__, University of York, Culham Centre for Fusion Energy and ITER organization, samuel.ward@york.ac.uk