Skip to content
Snippets Groups Projects
Commit 6a515a3f authored by rem's avatar rem
Browse files

restructured AUG before adding TCV

git-svn-id: https://solps-mdsplus.aug.ipp.mpg.de/repos/TORBEAM/branches/python@523 438fab6c-3626-0410-97ee-e5509541aacd
parent 416ac5e7
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
from ctbm import *
from getECangles import *
system = 0
system = 5
time = 3.78
shot = 30594
power = 0.6806
# Build eqdata from a topfile
m, n, eqdata = readTopfile('topfile');
......@@ -9,10 +18,24 @@ k, l, prdata = readPrdata('ne.dat', 'Te.dat');
# Initialize beam parameters to sensible values
intinbeam, dblinbeam = default_inbeams();
# Set beam power
dblinbeam[23] = power;
# Set launcher position
dblinbeam[3] = 236.1;
dblinbeam[5] = 32.;
if system == 7 or system == 8:
dblinbeam[5] = -32.
if system > 0:
pol, tor = getECRHanglesAUG(shot, system, time=time)
dblinbeam[2], dblinbeam[1] = ecrh2tbm(pol, tor, system, shot);
print intinbeam
print dblinbeam
# Call the library
rhoresult, t1data, t1tdata, t2data, t2n_data, icnt, ibgout, nv, volprof = call_torbeam(intinbeam, dblinbeam, m, n, eqdata, k, l, prdata);
......
......
......@@ -125,28 +125,23 @@ def default_inbeams():
intinbeam = np.zeros(50, dtype=int);
dblinbeam = np.zeros(50);
intinbeam[49] = 0;
intinbeam[0] = 2;
intinbeam[1] = 2;
intinbeam[2] = -1;
intinbeam[3] = 1;
intinbeam[4] = 1;
intinbeam[5] = 2;
intinbeam[6] = 11;
intinbeam[7] = 25;
intinbeam[6] = 10;
intinbeam[7] = 30;
intinbeam[8] = 0;
intinbeam[9] = 0;
intinbeam[10] = 2;
intinbeam[11] = 0;
intinbeam[12] = 1;
intinbeam[11] = 1;
intinbeam[12] = 0;
intinbeam[13] = 0;
dblinbeam[0] = 140.0e9;
dblinbeam[1] = 0.0;
dblinbeam[2] = 0.0;
dblinbeam[3] = 0;
dblinbeam[4] = 0;
dblinbeam[5] = 0;
# ... stay 0 ...
dblinbeam[6] = 10.2e13;
dblinbeam[7] = 1.0e13;
dblinbeam[8] = 2.0;
......@@ -160,10 +155,10 @@ def default_inbeams():
dblinbeam[16] = 1.0;
dblinbeam[17] = 1.5;
dblinbeam[18] = 1.5;
dblinbeam[19] = 87.93;
dblinbeam[20] = 87.93;
dblinbeam[21] = 3.64;
dblinbeam[22] = 3.64;
dblinbeam[19] = 85.4;
dblinbeam[20] = 85.4;
dblinbeam[21] = 2.55;
dblinbeam[22] = 2.55;
dblinbeam[23] = 1.;
dblinbeam[24] = 165.;
dblinbeam[25] = 60.;
......@@ -352,40 +347,3 @@ def readDump(fname):
return intinbeam, dblinbeam, k, l, prdata, m, n, eqdata
def ecrh2tbm(pol_ecs, tor_ecs, jgy, nshot):
"""Converts ECRH machine parameters to TORBEAM compatible angles
Input can be directly from values read from shotfile.
System ECRH1 has parameters GPolPos and GTorPos in parameter set
P_sy1_g which don't change during a shot.
System ECRH2 has parameters beta and time-varying poloidal mirror
which can be read from ECN.
"""
if nshot > 27400:
datum = 0;
else:
datum = 20000101;
c_err = c_int32(0);
c_sysunt = c_int32(100 + 100*(jgy / 4) + (jgy % 4));
if jgy > 4:
c_theta = c_double(1.e3*pol_ecs); # [m] -> [mm]
else:
c_theta = c_double(pol_ecs);
c_phi = c_double(tor_ecs);
_err = byref(c_err);
_sysunt = byref(c_sysunt);
_theta = byref(c_theta);
_phi = byref(c_phi);
c_datum = c_double(datum);
_datum = byref(c_datum);
s = ecrh.setval2tp_(_err, _sysunt, _theta, _phi, _datum);
if c_err.value < 0 or c_err.value > 100:
raise Exception("Parameter problem: "+str(c_err.value));
if c_err.value > 0:
raise Exception("Calculation problem: "+str(c_err.value));
return -c_theta.value, -c_phi.value;
import dd
from ctypes import *
def getECRHangles(shot, jgy, time=0.0):
libecrh = '/afs/ipp/home/e/ecrh/@sys/lib/libaug_ecrh_setmirrors.so';
ecrh = cdll.LoadLibrary(libecrh)
def getECRHanglesAUG(shot, jgy, time=0.0):
if jgy < 5:
sys = 'P_sy1_g'+str(jgy);
else:
......@@ -21,3 +25,41 @@ def getECRHangles(shot, jgy, time=0.0):
return pol, tor;
def ecrh2tbm(pol_ecs, tor_ecs, jgy, nshot):
"""Converts ECRH machine parameters to TORBEAM compatible angles
Input can be directly from values read from shotfile.
System ECRH1 has parameters GPolPos and GTorPos in parameter set
P_sy1_g which don't change during a shot.
System ECRH2 has parameters beta and time-varying poloidal mirror
which can be read from ECN.
"""
if nshot > 27400:
datum = 0;
else:
datum = 20000101;
c_err = c_int32(0);
c_sysunt = c_int32(100 + 100*(jgy / 5) + (jgy % 5) + (jgy / 5));
if jgy > 4:
c_theta = c_double(1.e3*pol_ecs); # [m] -> [mm]
else:
c_theta = c_double(pol_ecs);
c_phi = c_double(tor_ecs);
_err = byref(c_err);
_sysunt = byref(c_sysunt);
_theta = byref(c_theta);
_phi = byref(c_phi);
c_datum = c_double(datum);
_datum = byref(c_datum);
s = ecrh.setval2tp_(_err, _sysunt, _theta, _phi, _datum);
if c_err.value < 0 or c_err.value > 100:
raise Exception("Parameter problem: "+str(c_err.value));
if c_err.value > 0:
raise Exception("Calculation problem: "+str(c_err.value));
return -c_theta.value, -c_phi.value;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment