Skip to content

Commit

Permalink
Added ability to check for the NeutPy main configuration file before …
Browse files Browse the repository at this point in the history
…trying to run it.

Updated README.md
Uploading shot 144977_3000 for reference.
  • Loading branch information
veto1024 committed Oct 16, 2020
1 parent 2663423 commit d6f207d
Show file tree
Hide file tree
Showing 19 changed files with 28,628 additions and 1 deletion.
14 changes: 14 additions & 0 deletions GT3/Neutrals/neutrals.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from neutpy import neutrals
from collections import namedtuple
import json
import os.path
from GT3.Core.Processors import NumpyEncoder


Expand All @@ -17,6 +18,7 @@ class Neutrals:

def __init__(self, inp, core, cpus=False):


if abs(1.0 - core.sep_val) > .0001:
print "The separatrix value has been overwritten. Cannot run Neutrals calculation"
return
Expand All @@ -36,9 +38,12 @@ def __init__(self, inp, core, cpus=False):
except:
# Run NeutPy
print "Neutrals data not found. Running NeutPy"
if not self._check_conf("neutpy.conf"):
raise IOError("No NeutPy main configuration file found.")
self.npi = neutrals()
if cpus:
self.npi.set_cpu_cores(cpus)

self.npi.from_gt3(core, inp)
self.data = self.NeutralDataNT(self.npi.midpts[:, 0],
self.npi.midpts[:, 1],
Expand All @@ -56,6 +61,8 @@ def __init__(self, inp, core, cpus=False):

def reRun(self, cpus=False):
print ("Manually re-running NeutPy")
if not self._check_conf("neutpy.conf"):
raise IOError("No NeutPy main configuration file found.")
self.npi = neutrals()
if cpus:
self.npi.set_cpu_cores(cpus)
Expand Down Expand Up @@ -87,4 +94,11 @@ def _save_data(self):
except Exception as e:
print "Unable to save NeutPy data to file: %s" % str(e)

def _check_conf(self, f):
"""
Checks to see if a neutpy.conf file exists
:return: A boolean of whether the file exists.
:rtype: bool
"""
return os.path.isfile(f)

40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The Georgia Tech Tokamak Transport Code (GT3)
The Georgia Tech Tokamak Transport Code (GT3). Also known as GTEDGE2.

**Installation**

Expand Down Expand Up @@ -36,3 +36,41 @@ To install NeutPy:

`$ pip install neutpy`

**Usage**

GT3 can be run in 2 different ways: via a config file and profiles or via a test data class.

- **From Files**

The primary method of running GT3 is via the gt3 class

```python
from GT3 import gt3
```

If `neutpy` is installed, you'll see a message indicating that it is being imported. Otherwise, a warning
will be given. If you will be running `neutpy`, the main configuration file needs to be placed in the
CWD. A sample configuration file can be found on the neutpy github as `neutpy.conf`

GT3 is instantiated in this manner by providing an input file.

```python
myPlasma = gt3(inputFile="myInputFile")
```

See the `/inputs` directory for example input files (generally called `togt3_d3d_shotid_timeid`).
The `inputFile` argument takes a file relative to the current working directory (CWD). An input file will
include some plasma parameters and meshing information. In addition, the locations of 1D and 2D
profile data are entered into this file. The locations also must be relative to the CWD. See the
`inputs` directory for an example with DIII-D shot 144977.3000.

GT3 includes various modules that provide information and calculations about the plasma. Running `gt3()`
with the `mode` argument will run different sets of modules (see `gt3.py` for a list of modes).
Modules can also be run using the various arguments (`run_IOL()`, `run_NBI()`, `run_radial_transport()`, etc.).

To run the full radial transport code, use the `mode='radialtrans'` argument in `gt3()` or run
`myPlasma.run_radial_transport()`.

- **From A Class**

*Documentation Coming Soon*
201 changes: 201 additions & 0 deletions inputs/144977_3000/gt3_144977_3000_Te.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
0.0 1.8774444
0.005 1.8767302
0.01 1.8760077
0.015 1.8752684
0.02 1.8745041
0.025 1.8737064
0.03 1.8728669
0.035 1.8719772
0.04 1.871029
0.045 1.870014
0.05 1.8689238
0.055 1.86775
0.06 1.8664843
0.065 1.8651183
0.07 1.8636436
0.075 1.8620519
0.08 1.8603349
0.085 1.8584842
0.09 1.8564914
0.095 1.8543482
0.1 1.8520472
0.105 1.8495878
0.11 1.8469729
0.115 1.844205
0.12 1.8412869
0.125 1.8382212
0.13 1.8350107
0.135 1.8316581
0.14 1.8281659
0.145 1.824537
0.15 1.820774
0.155 1.8168796
0.16 1.8130698
0.165 1.8091401
0.17 1.8050685
0.175 1.8008575
0.18 1.7965096
0.185 1.7920276
0.19 1.7874138
0.195 1.7826709
0.2 1.7778015
0.205 1.7729336
0.21 1.7679868
0.215 1.7629077
0.22 1.7576991
0.225 1.7523635
0.23 1.7469035
0.235 1.7413217
0.24 1.7356207
0.245 1.7299447
0.25 1.7241438
0.255 1.7182207
0.26 1.712178
0.265 1.7060185
0.27 1.6997446
0.275 1.6933952
0.28 1.687015
0.285 1.6805192
0.29 1.6739106
0.295 1.667192
0.3 1.6603658
0.305 1.6534656
0.31 1.6465291
0.315 1.6394853
0.32 1.6323369
0.325 1.6250867
0.33 1.6177375
0.335 1.6103602
0.34 1.6028997
0.345 1.5953412
0.35 1.5876876
0.355 1.5799416
0.36 1.5721576
0.365 1.5643035
0.37 1.5563588
0.375 1.5483266
0.38 1.5402097
0.385 1.5320677
0.39 1.523847
0.395 1.5155439
0.4 1.5071616
0.405 1.4987253
0.41 1.490245
0.415 1.4816886
0.42 1.4730589
0.425 1.464364
0.43 1.455643
0.435 1.4468522
0.44 1.4379949
0.445 1.4290741
0.45 1.4201324
0.455 1.411128
0.46 1.4020641
0.465 1.3929477
0.47 1.383807
0.475 1.3746113
0.48 1.3653637
0.485 1.3560792
0.49 1.3467633
0.495 1.3374006
0.5 1.3279943
0.505 1.3185659
0.51 1.3091007
0.515 1.299597
0.52 1.290066
0.525 1.2805114
0.53 1.270924
0.535 1.2613088
0.54 1.2516791
0.545 1.2420224
0.55 1.2323424
0.555 1.2226511
0.56 1.2129402
0.565 1.2032122
0.57 1.1934754
0.575 1.183726
0.58 1.1739659
0.585 1.1642006
0.59 1.154429
0.595 1.1446532
0.6 1.1348767
0.605 1.1250997
0.61 1.1153256
0.615 1.105555
0.62 1.0957901
0.625 1.0860356
0.63 1.0762875
0.635 1.0665531
0.64 1.0568345
0.645 1.0471279
0.65 1.0374428
0.655 1.0277769
0.66 1.018131
0.665 1.0085144
0.67 0.99891856
0.675 0.98935334
0.68 0.97982222
0.685 0.97031642
0.69 0.96085229
0.695 0.95142156
0.7 0.94202911
0.705 0.9326867
0.71 0.92337439
0.715 0.91411672
0.72 0.90490506
0.725 0.89574074
0.73 0.88663994
0.735 0.8775776
0.74 0.86858323
0.745 0.85964591
0.75 0.85076726
0.755 0.84196291
0.76 0.83320932
0.765 0.82453806
0.77 0.81592859
0.775 0.80739624
0.78 0.79894456
0.785 0.79056008
0.79 0.7822728
0.795 0.77404952
0.8 0.76592445
0.805 0.75788444
0.81 0.74993088
0.815 0.74208496
0.82 0.73431212
0.825 0.72665693
0.83 0.71908852
0.835 0.71162758
0.84 0.70428307
0.845 0.69702473
0.85 0.68989818
0.855 0.68286768
0.86 0.67595631
0.865 0.66917212
0.87 0.66248184
0.875 0.65592775
0.88 0.64947884
0.885 0.64314067
0.89 0.63691218
0.895 0.63076949
0.9 0.62468917
0.905 0.61863074
0.91 0.61257507
0.915 0.60629122
0.92 0.59987883
0.925 0.59280014
0.93 0.58501595
0.935 0.57573627
0.94 0.56434535
0.945 0.54981531
0.95 0.53065475
0.955 0.50520302
0.96 0.47177339
0.965 0.42947346
0.97 0.37876794
0.975 0.32243277
0.98 0.26508076
0.985 0.21175854
0.99 0.16618656
0.995 0.12987616
1.0 0.10241394
Loading

0 comments on commit d6f207d

Please sign in to comment.