Module: CodeRunner::Trinity::TrinityGraphKits

Included in:
CodeRunner::Trinity
Defined in:
lib/trinitycrmod/graphs.rb

Instance Method Summary collapse

Instance Method Details

#ang_mom_prof_graphkit(options) ⇒ Object

Graph of toroidal angular momentum against rho for a given t_index



63
64
65
# File 'lib/trinitycrmod/graphs.rb', line 63

def ang_mom_prof_graphkit(options)
	return nt_prof_graphkit(options.absorb({header: /ang\s+mom/, title: 'Angular Momentum', units: ''}))
end

#eln_hflux_gb_prof_graphkit(options) ⇒ Object

Graph of Qe in gyroBohm units against rho for a given t_index



51
52
53
# File 'lib/trinitycrmod/graphs.rb', line 51

def eln_hflux_gb_prof_graphkit(options)
	fluxes_prof_graphkit(options.absorb({header: /Qe.*\(GB/, title: 'Electron Heat Flux', units: 'Q_gB'}))
end

#eln_hflux_prof_graphkit(options) ⇒ Object

Graph of Qe in MW against rho for a given t_index



55
56
57
# File 'lib/trinitycrmod/graphs.rb', line 55

def eln_hflux_prof_graphkit(options)
	fluxes_prof_graphkit(options.absorb({header: /Qe.*\(MW/, title: 'Electron Heat Flux', units: 'MW'}))
end

#eln_pwr_prof_graphkit(options) ⇒ Object

Graph of electron power integrated from the magnetic axis to rho vs rho



80
81
82
# File 'lib/trinitycrmod/graphs.rb', line 80

def eln_pwr_prof_graphkit(options)
	return pbalance_prof_graphkit(options.absorb({header: /e\- pwr/, title: 'Integrated electron power', units: 'MW'}))
end

#eln_temp_prof_graphkit(options) ⇒ Object

Graph of Te against rho for a given t_index



71
72
73
# File 'lib/trinitycrmod/graphs.rb', line 71

def eln_temp_prof_graphkit(options)
	return nt_prof_graphkit(options.absorb({header: /e\- temp/, title: 'Te', units: 'keV'}))
end

#fluxes_prof_graphkit(options) ⇒ Object

Graphs plotting quantities from the ‘.fluxes’ file vs rho for a given t_index



8
9
10
# File 'lib/trinitycrmod/graphs.rb', line 8

def fluxes_prof_graphkit(options)
	prof_graphkit(options.absorb({outfile: :fluxes, exclude_perturbed_fluxes: true}))
end

#ion_hflux_gb_prof_graphkit(options) ⇒ Object

Graph of Qi in gyroBohm units against rho for a given t_index



43
44
45
# File 'lib/trinitycrmod/graphs.rb', line 43

def ion_hflux_gb_prof_graphkit(options)
	fluxes_prof_graphkit(options.absorb({header: /Qi.*\(GB/, title: 'Ion Heat Flux', units: 'Q_gB'}))
end

#ion_hflux_prof_graphkit(options) ⇒ Object

Graph of Qi in MW against rho for a given t_index



47
48
49
# File 'lib/trinitycrmod/graphs.rb', line 47

def ion_hflux_prof_graphkit(options)
	fluxes_prof_graphkit(options.absorb({header: /Qi.*\(MW/, title: 'Ion Heat Flux', units: 'MW'}))
end

#ion_pwr_prof_graphkit(options) ⇒ Object

Graph of ion power integrated from the magnetic axis to rho vs rho



76
77
78
# File 'lib/trinitycrmod/graphs.rb', line 76

def ion_pwr_prof_graphkit(options)
	return pbalance_prof_graphkit(options.absorb({header: /i\+ pwr/, title: 'Integrated ion power', units: 'MW'}))
end

#ion_temp_prof_graphkit(options) ⇒ Object

Graph of Ti against rho for a given t_index



67
68
69
# File 'lib/trinitycrmod/graphs.rb', line 67

def ion_temp_prof_graphkit(options)
	return nt_prof_graphkit(options.absorb({header: /i\+ temp/, title: 'Ti', units: 'keV'}))
end

#lflux_gb_prof_graphkit(options) ⇒ Object

Graph of toroidal angular momentum flux in gyroBohm units against rho for a given t_index



59
60
61
# File 'lib/trinitycrmod/graphs.rb', line 59

def lflux_gb_prof_graphkit(options)
	fluxes_prof_graphkit(options.absorb({header: /Pi.*\(GB/, title: 'Toroidal Angular Momentum Flux', units: 'Pi_gB'}))
end

#nt_prof_graphkit(options) ⇒ Object

Graphs plotting quantities from the ‘.nt’ file vs rho for a given t_index



4
5
6
# File 'lib/trinitycrmod/graphs.rb', line 4

def nt_prof_graphkit(options)
	prof_graphkit(options.dup.absorb({outfile: :nt}))
end

#pbalance_prof_graphkit(options) ⇒ Object

Graphs plotting quantities from the ‘.pbalance’ file vs rho for a given t_index



12
13
14
# File 'lib/trinitycrmod/graphs.rb', line 12

def pbalance_prof_graphkit(options)
	prof_graphkit(options.absorb({outfile: :pbalance}))
end

#prof_graphkit(options) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/trinitycrmod/graphs.rb', line 15

def prof_graphkit(options)
	raise "Please specify t_index" unless options[:t_index]
	it = options[:t_index] - 1
	if ta  = options[:time_average]
		if ta < 0
			t_indices = (it+ta..it).to_a
		else
			t_indices = (it..it+ta).to_a
		end
	else
		t_indices = [it]
	end
	array = t_indices.map{|i| get_2d_array_float(options[:outfile], options[:header], /1.*time/)[i].to_gslv}.mean.to_a
	rho_array = t_indices.map{|i| get_2d_array_float(options[:outfile], /2.*radius/, /1.*time/)[i].to_gslv}.mean.to_a
	if options[:exclude_perturbed_fluxes]
		s = array.size
		array = array.slice(0...nrad-1)
		rho_array = rho_array.slice(0...nrad-1)
	end
	#p rho_array, array
	kit = GraphKit.autocreate(x: {data: rho_array.to_gslv, title: 'rho', units: ''},
											y: {data: array.to_gslv, title: options[:title]||"", units: options[:units]||""}
										 )
	kit.data[0].title += " at time = #{list(:t)[it+1]} s for id #{id}"
	kit.data[0].gp.with = 'lp'
	kit
end

#torque_prof_graphkit(options) ⇒ Object

Graph of ion power integrated from the magnetic axis to rho vs rho



84
85
86
# File 'lib/trinitycrmod/graphs.rb', line 84

def torque_prof_graphkit(options)
	return pbalance_prof_graphkit(options.absorb({header: /torque/, title: 'Integrated torque', units: 'Nm'}))
end