Module: CodeRunner::Trinity::TrinityGraphKits
- Included in:
- CodeRunner::Trinity
- Defined in:
- lib/trinitycrmod/graphs.rb
Instance Method Summary collapse
-
#ang_mom_prof_graphkit(options) ⇒ Object
Graph of toroidal angular momentum against rho for a given t_index.
-
#dens_prof_graphkit(options) ⇒ Object
Graph of n against rho for a given t_index.
-
#eln_hflux_calibration_graphkit(options) ⇒ Object
Graph of the electron heat calibration factor.
-
#eln_hflux_gb_prof_graphkit(options) ⇒ Object
Graph of Qe in gyroBohm units against rho for a given t_index.
-
#eln_hflux_prof_graphkit(options) ⇒ Object
Graph of Qe in MW against rho for a given t_index.
-
#eln_pwr_prof_graphkit(options) ⇒ Object
Graph of electron power integrated from the magnetic axis to rho vs rho.
-
#eln_temp_prof_graphkit(options) ⇒ Object
Graph of Te against rho for a given t_index.
-
#fluxes_prof_graphkit(options) ⇒ Object
Graphs plotting quantities from the ‘.fluxes’ file vs rho for a given t_index.
-
#integrated_profiles_graphkit(options) ⇒ Object
Graph of integrated profiles vs time.
-
#ion_hflux_calibration_graphkit(options) ⇒ Object
Graph of the ion heat calibration factor.
-
#ion_hflux_gb_prof_graphkit(options) ⇒ Object
Graph of Qi in gyroBohm units against rho for a given t_index.
-
#ion_hflux_prof_graphkit(options) ⇒ Object
Graph of Qi in MW against rho for a given t_index.
-
#ion_pwr_prof_graphkit(options) ⇒ Object
Graph of ion power integrated from the magnetic axis to rho vs rho.
-
#ion_temp_prof_graphkit(options) ⇒ Object
Graph of Ti against rho for a given t_index.
-
#lflux_gb_prof_graphkit(options) ⇒ Object
Graph of toroidal angular momentum flux in gyroBohm units against rho for a given t_index.
-
#nt_prof_graphkit(options) ⇒ Object
Graphs plotting quantities from the ‘.nt’ file vs rho for a given t_index.
-
#pbalance_prof_graphkit(options) ⇒ Object
Graphs plotting quantities from the ‘.pbalance’ file vs rho for a given t_index.
-
#pflux_calibration_graphkit(options) ⇒ Object
Graph of the particle flux calibration factor.
- #prof_graphkit(options) ⇒ Object
-
#pwr_prof_graphkit(options) ⇒ Object
Graphs plotting quantities from the ‘.nt’ file vs rho for a given t_index.
-
#torque_prof_graphkit(options) ⇒ Object
Graph of ion power integrated from the magnetic axis to rho vs rho.
Instance Method Details
#ang_mom_prof_graphkit(options) ⇒ Object
Graph of toroidal angular momentum against rho for a given t_index
67 68 69 |
# File 'lib/trinitycrmod/graphs.rb', line 67 def ang_mom_prof_graphkit() return nt_prof_graphkit(.absorb({header: /ang\s+mom/, title: 'Angular Momentum', units: ''})) end |
#dens_prof_graphkit(options) ⇒ Object
Graph of n against rho for a given t_index
79 80 81 |
# File 'lib/trinitycrmod/graphs.rb', line 79 def dens_prof_graphkit() return nt_prof_graphkit(.absorb({header: /dens/, title: 'n', units: '10^20 m^-3'})) end |
#eln_hflux_calibration_graphkit(options) ⇒ Object
Graph of the electron heat calibration factor
141 142 143 144 145 146 |
# File 'lib/trinitycrmod/graphs.rb', line 141 def eln_hflux_calibration_graphkit() calibs = Calib.analyse_file("#@directory/#@run_name.calib") k = calibs.map{|c| c.qflux_graphkit(1)}.sum k.ylabel = 'Qe' k end |
#eln_hflux_gb_prof_graphkit(options) ⇒ Object
Graph of Qe in gyroBohm units against rho for a given t_index
55 56 57 |
# File 'lib/trinitycrmod/graphs.rb', line 55 def eln_hflux_gb_prof_graphkit() fluxes_prof_graphkit(.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
59 60 61 |
# File 'lib/trinitycrmod/graphs.rb', line 59 def eln_hflux_prof_graphkit() fluxes_prof_graphkit(.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
88 89 90 |
# File 'lib/trinitycrmod/graphs.rb', line 88 def eln_pwr_prof_graphkit() return pbalance_prof_graphkit(.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
75 76 77 |
# File 'lib/trinitycrmod/graphs.rb', line 75 def eln_temp_prof_graphkit() return nt_prof_graphkit(.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
12 13 14 |
# File 'lib/trinitycrmod/graphs.rb', line 12 def fluxes_prof_graphkit() prof_graphkit(.absorb({outfile: :fluxes, exclude_perturbed_fluxes: true})) end |
#integrated_profiles_graphkit(options) ⇒ Object
Graph of integrated profiles vs time
120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/trinitycrmod/graphs.rb', line 120 def integrated_profiles_graphkit() t_indices = list(:t).keys kit = t_indices.map{|it| profiles_graphkit(.absorb({t_index: it}))}.inject{|o,n| o.merge(n)} #kit.gnuplot #area_vectors = t_indices.map{|i| get_2d_array_float('geo', /13:\s*area/, /1.*time/)[i].to_gslv} #system "less #@directory/#@run_name.geo" area_vectors = new_netcdf_file.var('area_grid').get.to_a[-1].to_gslv kit.each_with_index do |k,ik| kit[ik] = integrate_profkit(k, area_vectors, t_indices) end end |
#ion_hflux_calibration_graphkit(options) ⇒ Object
Graph of the ion heat calibration factor
134 135 136 137 138 139 |
# File 'lib/trinitycrmod/graphs.rb', line 134 def ion_hflux_calibration_graphkit() calibs = Calib.analyse_file("#@directory/#@run_name.calib") k = calibs.map{|c| c.qflux_graphkit(0)}.sum k.ylabel = 'Qi' k end |
#ion_hflux_gb_prof_graphkit(options) ⇒ Object
Graph of Qi in gyroBohm units against rho for a given t_index
47 48 49 |
# File 'lib/trinitycrmod/graphs.rb', line 47 def ion_hflux_gb_prof_graphkit() fluxes_prof_graphkit(.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
51 52 53 |
# File 'lib/trinitycrmod/graphs.rb', line 51 def ion_hflux_prof_graphkit() fluxes_prof_graphkit(.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
84 85 86 |
# File 'lib/trinitycrmod/graphs.rb', line 84 def ion_pwr_prof_graphkit() return pbalance_prof_graphkit(.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
71 72 73 |
# File 'lib/trinitycrmod/graphs.rb', line 71 def ion_temp_prof_graphkit() return nt_prof_graphkit(.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
63 64 65 |
# File 'lib/trinitycrmod/graphs.rb', line 63 def lflux_gb_prof_graphkit() fluxes_prof_graphkit(.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() prof_graphkit(.dup.absorb({outfile: :nt})) end |
#pbalance_prof_graphkit(options) ⇒ Object
Graphs plotting quantities from the ‘.pbalance’ file vs rho for a given t_index
16 17 18 |
# File 'lib/trinitycrmod/graphs.rb', line 16 def pbalance_prof_graphkit() prof_graphkit(.absorb({outfile: :pbalance})) end |
#pflux_calibration_graphkit(options) ⇒ Object
Graph of the particle flux calibration factor
148 149 150 151 152 153 |
# File 'lib/trinitycrmod/graphs.rb', line 148 def pflux_calibration_graphkit() calibs = Calib.analyse_file("#@directory/#@run_name.calib") k = calibs.map{|c| c.pflux_graphkit(1)}.sum k.ylabel = 'Gamma' k end |
#prof_graphkit(options) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/trinitycrmod/graphs.rb', line 19 def prof_graphkit() raise "Please specify t_index" unless [:t_index] it = [:t_index] - 1 if ta = [: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([:outfile], [:header], /1.*time/)[i].to_gslv}.mean.to_a rho_array = t_indices.map{|i| get_2d_array_float([:outfile], [:radius_match]||/2.*radius/, /1.*time/)[i].to_gslv}.mean.to_a if [: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: [:title]||"", units: [:units]||""} ) kit.data[0].title += " at time = #{list(:t)[it+1]} s for id #{id}" kit.data[0].gp.with = 'lp' kit end |
#pwr_prof_graphkit(options) ⇒ Object
Graphs plotting quantities from the ‘.nt’ file vs rho for a given t_index
8 9 10 |
# File 'lib/trinitycrmod/graphs.rb', line 8 def pwr_prof_graphkit() prof_graphkit(.dup.absorb({outfile: :pwr, radius_match: /2.*rad/})) end |
#torque_prof_graphkit(options) ⇒ Object
Graph of ion power integrated from the magnetic axis to rho vs rho
92 93 94 |
# File 'lib/trinitycrmod/graphs.rb', line 92 def torque_prof_graphkit() return pbalance_prof_graphkit(.absorb({header: /torque/, title: 'Integrated torque', units: 'Nm'})) end |