gs2crmod 0.11.74 → 0.11.75

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.11.74
1
+ 0.11.75
data/gs2crmod.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "gs2crmod"
8
- s.version = "0.11.74"
8
+ s.version = "0.11.75"
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"]
12
- s.date = "2014-09-19"
12
+ s.date = "2014-09-23"
13
13
  s.description = "GS2 is a gyrokinetic flux tube initial value turbulence code which can be used for fusion or astrophysical plasmas. CodeRunner is a framework for the automated running and analysis of large simulations. This module allows GS2 (and its sister code AstroGK) to harness the power of the CodeRunner framework."
14
14
  s.email = "edmundhighcock@sourceforge.net"
15
15
  s.extensions = ["ext/extconf.rb"]
@@ -44,7 +44,9 @@ def auto_axiskits(name, options)
44
44
  'transient_amplification_over_kx' => ['Transient Amplification', "", 1],
45
45
  'transient_amplification_over_ky' => ['Transient Amplification', "", 1],
46
46
  'spectrum_over_kx' => ["Spectrum at t = #{sprintf("%.3f" ,(options[:t] or list(:t)[options[:t_index]] or list(:t).values.max))}", '', 1],
47
+ 'spectrum_over_kx_avg' => ["Spectrum Averaged Over Time", '', 1],
47
48
  'spectrum_over_ky' => ["Spectrum at t = #{sprintf("%.3f" ,(options[:t] or list(:t)[options[:t_index]] or list(:t).values.max))}", '', 1],
49
+ 'spectrum_over_ky_avg' => ["Spectrum Averaged Over Time", '', 1],
48
50
  'es_heat_over_kx' => ["Heat Flux at t = #{sprintf("%.3f" ,(options[:t] or list(:t)[options[:t_index]] or list(:t).values.max))}", 'Q_gB', 1],
49
51
  '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],
50
52
  '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],
@@ -677,11 +679,23 @@ module GraphKits
677
679
  kxy_spectrum_graphkit(options)
678
680
  end
679
681
 
682
+ #time averaged kx spectrum
683
+ def kx_spectrum_avg_graphkit(options={})
684
+ options[:kxy] = :kx
685
+ kxy_spectrum_avg_graphkit(options)
686
+ end
687
+
680
688
  def ky_spectrum_graphkit(options={})
681
689
  options[:kxy] = :ky
682
690
  kxy_spectrum_graphkit(options)
683
691
  end
684
692
 
693
+ #time averaged ky spectrum
694
+ def ky_spectrum_avg_graphkit(options={})
695
+ options[:kxy] = :ky
696
+ kxy_spectrum_avg_graphkit(options)
697
+ end
698
+
685
699
  def kxy_spectrum_graphkit(options={})
686
700
  case options[:command]
687
701
  when :help
@@ -700,6 +714,27 @@ module GraphKits
700
714
  kit
701
715
  end
702
716
  end
717
+
718
+ #time averaged kx or ky spectrum
719
+ def kxy_spectrum_avg_graphkit(options={})
720
+ case options[:command]
721
+ when :help
722
+ return "ky_spectrum or kx_spectrum: Graph of phi^2 vs kx or ky averaged over time"
723
+ when :options
724
+ return [:t, :t_index]
725
+ else
726
+ # ie ky_spectrum or kx_spectrum
727
+ kxy = options[:kxy]
728
+ kit = GraphKit.autocreate({x: axiskit(kxy.to_s, options), y: axiskit("spectrum_over_#{kxy}_avg", options)})
729
+ kit.title = "#{kxy} Spectrum"
730
+ kit.file_name = options[:graphkit_name] + options[:t_index].to_s + "_avg"
731
+ kit.data[0].with = 'lp'
732
+ kit.ylabel = "Phi^2 #{kxy}^2"
733
+ kit.pointsize = 2.0
734
+ kit
735
+ end
736
+ end
737
+
703
738
  def lagrangian_kx_graphkit(options={})
704
739
  case options[:command]
705
740
  when :help
@@ -951,10 +951,19 @@ module GSLVectors
951
951
  options[:direction] = :kx
952
952
  spectrum_over_kxy_gsl_vector(options)
953
953
  end
954
+
955
+ def spectrum_over_kx_avg_gsl_vector(options)
956
+ options[:direction] = :kx
957
+ spectrum_over_kxy_avg_gsl_vector(options)
958
+ end
954
959
  def spectrum_over_ky_gsl_vector(options)
955
960
  options[:direction] = :ky
956
961
  spectrum_over_kxy_gsl_vector(options)
957
962
  end
963
+ def spectrum_over_ky_avg_gsl_vector(options)
964
+ options[:direction] = :ky
965
+ spectrum_over_kxy_avg_gsl_vector(options)
966
+ end
958
967
  def spectrum_over_kxy_gsl_vector(options)
959
968
  Dir.chdir(@directory) do
960
969
  # i.e. spectrum_over_ky or spectrum_over_kx
@@ -974,6 +983,30 @@ module GSLVectors
974
983
  return v
975
984
  end
976
985
  end
986
+
987
+ #spectrum averaged in time
988
+ def spectrum_over_kxy_avg_gsl_vector(options)
989
+ Dir.chdir(@directory) do
990
+ # i.e. spectrum_over_ky or spectrum_over_kx
991
+ kxy = options[:direction]
992
+ raise "Spectrum makes no sense for single modes" if @grid_option == "single"
993
+
994
+ phi_array = netcdf_file.var("phi2_by_#{kxy}").get('start' => [0, 0], 'end' => [-1, -1]) #index = [kx or ky, t]
995
+
996
+ shape = phi_array.shape
997
+ phi_av = [];
998
+ #average over time for each kx or ky individually
999
+ for i in 0...shape[0]
1000
+ phi_av[i] = phi_array[i,0..-1].sum / shape[1]
1001
+ end
1002
+
1003
+ v = GSL::Vector.alloc(phi_av)
1004
+ v = v.from_box_order if kxy == :kx
1005
+ v = v.mul(gsl_vector(kxy).square) unless options[:phi2_only]
1006
+ return v
1007
+ end
1008
+ end
1009
+
977
1010
  def x_gsl_vector(options)
978
1011
  raise "options nakx and interpolate_x are incompatible" if options[:nakx] and options[:interpolate_x]
979
1012
  kx = gsl_vector(:kx, options)
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.11.74
4
+ version: 0.11.75
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-09-19 00:00:00.000000000 Z
13
+ date: 2014-09-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: coderunner
17
- requirement: &11951880 !ruby/object:Gem::Requirement
17
+ requirement: &12211780 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 0.14.15
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *11951880
25
+ version_requirements: *12211780
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rubyhacks
28
- requirement: &11951240 !ruby/object:Gem::Requirement
28
+ requirement: &12210980 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 0.1.2
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *11951240
36
+ version_requirements: *12210980
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: ruby-netcdf-updated
39
- requirement: &11949800 !ruby/object:Gem::Requirement
39
+ requirement: &12210120 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 0.6.6.1
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *11949800
47
+ version_requirements: *12210120
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: shoulda
50
- requirement: &11948020 !ruby/object:Gem::Requirement
50
+ requirement: &12209460 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - =
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 3.0.1
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *11948020
58
+ version_requirements: *12209460
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: rdoc
61
- requirement: &11947320 !ruby/object:Gem::Requirement
61
+ requirement: &12224800 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ~>
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '3.12'
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *11947320
69
+ version_requirements: *12224800
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: bundler
72
- requirement: &11962620 !ruby/object:Gem::Requirement
72
+ requirement: &12223380 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>'
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: 1.0.0
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *11962620
80
+ version_requirements: *12223380
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: jeweler
83
- requirement: &11961880 !ruby/object:Gem::Requirement
83
+ requirement: &12221660 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ! '>='
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: 1.8.4
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *11961880
91
+ version_requirements: *12221660
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: minitest
94
- requirement: &11960740 !ruby/object:Gem::Requirement
94
+ requirement: &12219280 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ~>
@@ -99,7 +99,7 @@ dependencies:
99
99
  version: '4'
100
100
  type: :development
101
101
  prerelease: false
102
- version_requirements: *11960740
102
+ version_requirements: *12219280
103
103
  description: GS2 is a gyrokinetic flux tube initial value turbulence code which can
104
104
  be used for fusion or astrophysical plasmas. CodeRunner is a framework for the automated
105
105
  running and analysis of large simulations. This module allows GS2 (and its sister