from vita.modules.equilibrium.fiesta import Fiesta from vita.modules.projection.projection2D.field_line.field_line import FieldLine from vita.modules.projection.projection2D.field_line.map_field_lines import map_field_lines from vita.modules.utils.getOption import getOption if __name__ == "__main__": #FILEPATH = '/home/jmbols/Postdoc/ST40/Programme 1/Equilibrium/eq001_limited.mat' #FILEPATH = '/media/jmbols/Data/jmbols/ST40/Programme 3/Equilibrium/eq_0002.mat' FILEPATH = get_resource("ST40-IVC1", "equilibrium", "eq_006_2T_export") #HESEL_FILE_PATH = '/media/jmbols/Data/jmbols/ST40/Programme 1/n_inner_bnd_scan/ST40.00001.03.h5' #HESEL_FILE_PATH = '/media/jmbols/Data/jmbols/ST40/Programme 3/Te(i)_grad_scan/ST40.00003.20.h5' #FILE = h5py.File(HESEL_FILE_PATH, 'r') #HESEL_PARAMS = HESELparams(FILE) #FILE.close() FIESTA = Fiesta(FILEPATH) FIELD_LINE = FieldLine(FIESTA) MID_PLANE_LOC = FIESTA.get_midplane_lcfs()[1] X_AFTER_LCFS = np.linspace(0, 10, 100)*1e-3 + MID_PLANE_LOC # I_AFTER_LCFS = np.where(HESEL_PARAMS.xaxis >= 0)[0] # X_AFTER_LCFS = HESEL_PARAMS.xaxis[I_AFTER_LCFS] + MID_PLANE_LOC FIELD_LINES = map_field_lines(X_AFTER_LCFS, FIESTA) # save_as_pickle(FIELD_LINES, 'eq_0002') plt.plot(FIELD_LINE.fiesta_equil.r_limiter, FIELD_LINE.fiesta_equil.z_limiter) for I in X_AFTER_LCFS: plt.plot(FIELD_LINES[I]['R'], FIELD_LINES[I]['Z'])
from vita.modules.equilibrium.fiesta import Fiesta from vita.utility import get_resource # the world scene-graph world = World() ########################## # add machine components # config_file = get_resource("ST40-IVC1", "configuration", 'st40_ivc1_config') load_wall_configuration(config_file, world) eq002 = get_resource("ST40-IVC1", "equilibrium", "eq_006_2T_export") fiesta = Fiesta(eq002) b_field = fiesta.b_field lcfs = fiesta.get_midplane_lcfs()[1] seed_points = [ Point3D(0.75, 0, 0), Point3D(lcfs + 0.001, 0, 0), Point3D(lcfs + 0.01, 0, 0), Point3D(lcfs + 0.02, 0, -0.01) ] field_tracer = FieldlineTracer(b_field, method=RK2(step_size=0.0001)) end_point, _, trajectory1 = field_tracer.trace(world, seed_points[0], save_trajectory=True, max_length=15)
fx = np.array([divertor_map[i]["f_x"] for i in x_axis]) power = x_axis * footprint._q / (r_div * (fx / np.cos(angles))) return [r_div, z_div, power] ########################## # add machine components # config_file = get_resource("ST40-IVC1", "configuration", 'st40_ivc1_config') ######################## # load the equilibrium # eq = get_resource("ST40-IVC1", "equilibrium", "eq_006_2T_export") fiesta = Fiesta(eq) ############################## # setup the heatflux profile # # specify and load heatflux profile lcfs = fiesta.get_midplane_lcfs(psi_p=1.00001)[1] footprint = Eich(1.0e-3, 0.0001e-3, r0_lfs=lcfs) # lambda_q=2.5, S=0.5 x = np.linspace(-1, 10, 100) * 1e-3 footprint.set_coordinates(x) footprint.calculate_heat_flux_density("lfs") POINT_A = Point2D(0.345941, -0.593439) POINT_B = Point2D(0.51091, -0.757166) power_profile = sample_power_at_surface(POINT_A, POINT_B, fiesta, footprint)
# -*- coding: utf-8 -*- """ Created on Sun Oct 20 18:28:22 2019 @author: Daniel.Ibanez """ import numpy as np from matplotlib import pyplot as plt from vita.modules.equilibrium.fiesta import Fiesta from vita.modules.projection.projection2D.field_line.field_line import FieldLine from vita.utility import get_resource from vita.modules.utils.getOption import getOption R200 = get_resource("ST40-IVC1", "equilibrium", "eq_006_2T_export") FIESTA = Fiesta(R200) field_line = FieldLine(FIESTA) R = FIESTA.get_midplane_lcfs()[1] r0 = 0.45 rf = R+0.01 midplane_range = np.linspace(r0,rf,3) points = [] lengths = [] for r in midplane_range: points.append( [r,0,0] ) lengths.append( 60 - (r-r0)*120 ) print(lengths) field_line_dict = [] for idx, val in enumerate(points): field_line_dict.append(field_line.follow_field_in_plane(val, lengths[idx], break_at_limiter=False) )
Created on Sun Oct 20 18:28:22 2019 @author: Daniel.Ibanez """ import numpy as np from matplotlib import pyplot as plt import math from vita.modules.projection.projection2D.field_line.field_line import FieldLine from vita.modules.equilibrium.fiesta import Fiesta from vita.modules.utils import intersection from vita.utility import get_resource from vita.modules.utils.getOption import getOption R200 = get_resource("ST40-IVC1", "equilibrium", "eq_006_2T_export") FIESTA = Fiesta(R200) field_line = FieldLine(FIESTA) R = field_line.fiesta_equil.get_midplane_lcfs()[1] r0 = R + 0.001 rf = R + 0.012 midplane_range = np.linspace(r0, rf, 3) points = [] lengths = [] for r in midplane_range: points.append([r, 0, 0]) lengths.append(60 - (r - r0) * 120) print(lengths) field_line_dict = [] for idx, val in enumerate(points): field_line_dict.append( field_line.follow_field_in_plane(val,
from vita.modules.equilibrium.fiesta import Fiesta from vita.utility import get_resource # the world scene-graph world = World() ########################## # add machine components # config_file = get_resource("ST40-IVC1", "configuration", 'st40_ivc1_config') load_wall_configuration(config_file, world) ######################## # load the equilibrium # eq007 = get_resource("ST40-IVC1", "equilibrium", "eq_006_3T_export") fiesta = Fiesta(eq007) b_field = fiesta.b_field field_tracer = FieldlineTracer(b_field, method=RK2(step_size=0.0001)) equilibrium = fiesta.to_cherab_equilibrium() psin2d = equilibrium.psi_normalised ############################## # setup the heatflux profile # # specify and load heatflux profile # footprint = Eich(3, 0.0001) # lambda_q=2.5, S=0.5 # # x = np.linspace(-1, 10, 100) # footprint.set_coordinates(x) # footprint.s_disconnected_dn_max = 2.1 # footprint.fx_in_out = 5.
# the world scene-graph world = World() ########################## # add machine components # config_file = get_resource("ST40-IVC1", "configuration", 'st40_ivc1_config') load_wall_configuration(config_file, world) ######################## # load the equilibrium # eq007 = get_resource("ST40-IVC1", "equilibrium", "eq_006_2T_export") fiesta = Fiesta(eq007) b_field = fiesta.b_field field_tracer = FieldlineTracer(b_field, method=RK2(step_size=0.0001)) equilibrium = fiesta.to_cherab_equilibrium() psin2d = equilibrium.psi_normalised ############################## # setup the heatflux profile # # specify and load heatflux profile footprint = Eich(2.5E-3, 0.0001E-3) # lambda_q=2.5, S=0.5 x = np.linspace(-1, 10, 100)*1E-3 footprint.set_coordinates(x) footprint.s_disconnected_dn_max = 2.1
import numpy as np from mayavi import mlab from raysect.core import Point3D, World from raysect.primitive import import_obj from vita.modules.projection.cherab import FieldlineTracer, RK2 from vita.modules.equilibrium.fiesta import Fiesta from vita.utility import get_resource # the world scene-graph world = World() ST40_mesh = get_resource("ST40", "mesh", "ST40_IVC") import_obj(ST40_mesh, scaling=0.001, parent=world) eq001 = get_resource("ST40", "equilibrium", "limited_eq001_export") fiesta = Fiesta(eq001) b_field = fiesta.b_field seed_points = [] n = 20 for i in range(n): lcfs = 0.72677891 seed_points.append(Point3D(lcfs + i * 0.001, 0.0, 0.0 + 0.02)) #Point3D(0.7270, 0, 0), #Point3D(0.7275, 0, 0), #Point3D(0.7280, 0, 0)] field_tracer = FieldlineTracer(b_field, method=RK2(step_size=0.00005)) end_points = []
Created on Sun Oct 20 18:28:22 2019 @author: Daniel.Ibanez """ import numpy as np from matplotlib import pyplot as plt import math from vita.modules.projection.projection2D.field_line.field_line import FieldLine from vita.modules.equilibrium.fiesta import Fiesta from vita.modules.utils import intersection from vita.utility import get_resource from vita.modules.utils.getOption import getOption EQUIL = get_resource("ST40-IVC1", "equilibrium", "eq_006_2T_export") FIESTA = Fiesta(EQUIL) field_line = FieldLine(FIESTA) R = field_line.fiesta_equil.get_midplane_lcfs()[1] r0 = R + 0.001 rf = R + 0.012 midplane_range = np.linspace(r0, rf, 3) points = [] lengths = [] for r in midplane_range: points.append([r, 0, 0]) lengths.append(60 - (r - r0) * 120) print(lengths) field_line_dict = [] for idx, val in enumerate(points): field_line_dict.append( field_line.follow_field_in_plane(val,