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



35
36
37
# File 'lib/trinitycrmod/graphs.rb', line 35

def ang_mom_prof_graphkit(options)
  return nt_prof_graphkit(options.dup.absorb({header: /ang\s+mom/, title: 'Angular Momentum', units: ''}))
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.dup.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



27
28
29
# File 'lib/trinitycrmod/graphs.rb', line 27

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

#ion_temp_prof_graphkit(options) ⇒ Object

Graph of Ti against rho for a given t_index



39
40
41
# File 'lib/trinitycrmod/graphs.rb', line 39

def ion_temp_prof_graphkit(options)
  return nt_prof_graphkit(options.dup.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



31
32
33
# File 'lib/trinitycrmod/graphs.rb', line 31

def lflux_gb_prof_graphkit(options)
  fluxes_prof_graphkit(options.dup.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

#prof_graphkit(options) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/trinitycrmod/graphs.rb', line 11

def prof_graphkit(options)
  raise "Please specify t_index" unless options[:t_index]
  it = options[:t_index] - 1
  array = get_2d_array_float(options[:outfile], options[:header], /1.*time/)[it]
  rho_array = get_2d_array_float(options[:outfile], /2.*radius/, /1.*time/)[it]
  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
  GraphKit.autocreate(x: {data: rho_array.to_gslv, title: 'rho', units: ''},
                      y: {data: array.to_gslv, title: options[:title]||"", units: options[:units]||""}
                     )
end