gs2crmod 0.10.21 → 0.10.22

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.10.21
1
+ 0.10.22
data/gs2crmod.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "gs2crmod"
8
- s.version = "0.10.21"
8
+ s.version = "0.10.22"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Edmund Highcock", "Ferdinand van Wyk"]
@@ -34,6 +34,9 @@ def auto_axiskits(name, options)
34
34
  'kpar' => ['kpar', "2 pi/qR"],
35
35
  'growth_rate_over_kx' => ['Growth Rate', "v_th#{species_letter}/a", 1],
36
36
  'growth_rate_over_ky' => ['Growth Rate', "v_th#{species_letter}/a", 1],
37
+ 'growth_rate_over_kx_slice' => ['Growth Rate', "v_th#{species_letter}/a", 1],
38
+ 'growth_rate_over_ky_slice' => ['Growth Rate', "v_th#{species_letter}/a", 1],
39
+ 'growth_rate_over_ky_over_kx' => ["Growth Rate", "v_th#{species_letter}/a", 2],
37
40
  'frequency_over_ky' => ['Frequency', "v_th#{species_letter}/a", 1],
38
41
  'transient_es_heat_flux_amplification_over_kx' => ['Transient Electrostatic Heat Amplification', "", 1],
39
42
  'transient_es_heat_flux_amplification_over_ky' => ['Transient Electrostatic Heat Amplification', "", 1],
@@ -43,7 +46,6 @@ def auto_axiskits(name, options)
43
46
  'zonal_spectrum' => ["Zonal spectrum at t = #{sprintf("%.3f" ,(options[:t] or list(:t)[options[:t_index]] or list(:t).values.max))}", '', 1],
44
47
  'spectrum_over_ky' => ["Spectrum at t = #{sprintf("%.3f" ,(options[:t] or list(:t)[options[:t_index]] or list(:t).values.max))}", '', 1],
45
48
  'es_heat_over_ky' => ["Heat Flux at t = #{sprintf("%.3f" ,(options[:t] or list(:t)[options[:t_index]] or list(:t).values.max))}", 'Q_gB', 1],
46
- 'growth_rate_over_ky_over_kx' => ["Growth Rate", "v_th#{species_letter}/a", 2],
47
49
  'es_heat_flux_over_ky_over_kx' => ["Heat flux at t = #{sprintf("%.3f" ,(options[:t] or list(:t)[options[:t_index]] or list(:t).values.max))}", '', 2],
48
50
  'spectrum_over_kpar' => ["Spectrum at t = #{sprintf("%.3f" ,(options[:t] or list(:t)[options[:t_index]] or list(:t).values.max))}", '', 1],
49
51
  'spectrum_over_ky_over_kx' => ["Spectrum at t = #{sprintf("%.3f" ,(options[:t] or list(:t)[options[:t_index]] or list(:t).values.max))}", '', 2],
@@ -553,6 +555,64 @@ module GraphKits
553
555
  end
554
556
  end
555
557
 
558
+ def growth_rate_vs_kx_slice_graphkit(options={})
559
+ case options[:command]
560
+ when :help
561
+ return "Growth rates vs kx at a fixed ky, not integrated over ky."
562
+ when :options
563
+ return [:ky, :ky_index]
564
+ else
565
+ options[:kxy] = :kx
566
+ if options[:ky_index].nil?
567
+ raise "You must specify ky or ky_index." if options[:ky].nil?
568
+ options[:title] = "Growth rate vs kx at ky = "+options[:ky].to_s
569
+ else
570
+ options[:ky] = list(:ky)[options[:ky_index]]
571
+ options[:title] = "Growth rate vs kx at ky_index = "+options[:ky_index].to_s
572
+ end
573
+ eputs "For run " + @id.to_s + ", using ky = " + options[:ky].to_s
574
+ growth_rate_vs_kxy_slice_graphkit(options)
575
+ end
576
+ end
577
+
578
+ def growth_rate_vs_ky_slice_graphkit(options={})
579
+ case options[:command]
580
+ when :help
581
+ return "Growth rates vs ky at a fixed kx, not integrated over kx."
582
+ when :options
583
+ return [:kx, :kx_index]
584
+ else
585
+ options[:kxy] = :ky
586
+ if options[:kx_index].nil?
587
+ raise "You must specify kx or kx_index." if options[:kx].nil?
588
+ options[:title] = "Growth rate vs ky at kx = "+options[:kx].to_s
589
+ else
590
+ options[:kx] = list(:kx)[options[:kx_index]]
591
+ options[:title] = "Growth rate vs ky at kx_index = "+options[:kx_index].to_s
592
+ end
593
+ eputs "For run " + @id.to_s + ", using kx = " + options[:kx].to_s
594
+ growth_rate_vs_kxy_slice_graphkit(options)
595
+ end
596
+ end
597
+
598
+ def growth_rate_vs_kxy_slice_graphkit(options={})
599
+ case options[:command]
600
+ when :help
601
+ when :options
602
+ return []
603
+ else
604
+ raise "Growth Rates are not available in non-linear mode" if @nonlinear_mode == "on"
605
+ raise "growth_rate_at_ky_at_kx was not calculated for this run, probably because the environment variable GS2_CALCULATE_ALL was not set when the run was analyzed. Try setting this variable and re-analyzing the run." if @growth_rate_at_ky_at_kx.nil?
606
+ kxy = options[:kxy]
607
+ kit = GraphKit.autocreate({x: axiskit(kxy.to_s, options), y: axiskit("growth_rate_over_#{kxy}_slice", options)})
608
+ kit.title = options[:title]
609
+ kit.data[0].with = "lp"
610
+ kit.data[0].title = @run_name
611
+ kit.file_name = options[:graphkit_name]
612
+ kit
613
+ end
614
+ end
615
+
556
616
  def growth_rate_vs_kx_vs_ky_graphkit(options={})
557
617
  case options[:command]
558
618
  when :help
@@ -387,6 +387,25 @@ module GSLVectors
387
387
  end
388
388
  private :growth_rate_over_kxy_gsl_vector
389
389
 
390
+ # The growth rate, calculated from the potential, indexed by kx. Only makes sense in linear calculations.
391
+ def growth_rate_over_kx_slice_gsl_vector(options)
392
+ Dir.chdir(@directory) do
393
+ slice_of_growth_rates = send(:growth_rate_at_ky_at_kx)[options[:ky]].values
394
+ raise "Something went wrong: slice of growth rates seems empty" if slice_of_growth_rates.nil?
395
+ return GSL::Vector.alloc(slice_of_growth_rates)
396
+ #return GSL::Vector.alloc(send(:growth_rate_at_ky_at_kx[ky]).values)
397
+ end
398
+ end
399
+
400
+ # The growth rate, calculated from the potential, indexed by ky. Only makes sense in linear calculations.
401
+ def growth_rate_over_ky_slice_gsl_vector(options)
402
+ Dir.chdir(@directory) do
403
+ slice_of_growth_rates = send(:growth_rate_at_ky_at_kx).values.map{|h| h[options[:kx]]}
404
+ raise "Something went wrong: slice of growth rates seems empty" if slice_of_growth_rates.nil?
405
+ return GSL::Vector.alloc(slice_of_growth_rates)
406
+ end
407
+ end
408
+
390
409
  # Frequency, indexed over ky, taken direct from the gs2 output file
391
410
  def frequency_over_ky_gsl_vector(options)
392
411
  options.convert_to_index(self, :kx)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gs2crmod
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.21
4
+ version: 0.10.22
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: