gs2crmod 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/gs2crmod.gemspec +2 -2
- data/lib/gs2crmod/graphs.rb +43 -1
- data/lib/gs2crmod/gsl_data.rb +24 -0
- data/test/test_gs2crmod.rb +4 -1
- metadata +14 -14
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.2
|
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.9.
|
8
|
+
s.version = "0.9.2"
|
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 = "2013-07-
|
12
|
+
s.date = "2013-07-31"
|
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"]
|
data/lib/gs2crmod/graphs.rb
CHANGED
@@ -21,7 +21,8 @@ def auto_axiskits(name, options)
|
|
21
21
|
'es_heat_by_kx_over_time' => ['Phi^2 by ky', ''],
|
22
22
|
'phi2_by_mode_over_time' => ["Phi^2 by mode", ''],
|
23
23
|
'tpar2_by_mode_over_time' => ["(delta T_parallel)^2 by mode", '%'],
|
24
|
-
|
24
|
+
'tperp2_by_mode_over_time' => ["(delta T_perp)^2 by mode", '%'],
|
25
|
+
'hflux_tot' => ['Total Heat Flux', ''],
|
25
26
|
'ky' => ['ky', "1/rho_#{species_letter}"],
|
26
27
|
'kx' => ['kx', "1/rho_#{species_letter}"],
|
27
28
|
'kpar' => ['kpar', "2 pi/qR"],
|
@@ -1935,6 +1936,47 @@ module GraphKits
|
|
1935
1936
|
end
|
1936
1937
|
end
|
1937
1938
|
|
1939
|
+
def tperp2_by_mode_vs_time_graphkit(options={})
|
1940
|
+
case options[:command]
|
1941
|
+
when :help
|
1942
|
+
return "'tperp2_by_ky_vs_time' or 'tperp2_by_kx_vs_time': tperp^2 over time for a given kx or ky, integrated over the other direction"
|
1943
|
+
when :options
|
1944
|
+
return [:ky, :ky_index, :kx, :kx_index]
|
1945
|
+
else
|
1946
|
+
kxy = :mode
|
1947
|
+
|
1948
|
+
# i.e. tperp2_by_ky_vs_time or tperp2_by_kx_vs_time or tperp2_by_mode_vs_time
|
1949
|
+
|
1950
|
+
nt_options = options.dup # 'no time' options
|
1951
|
+
nt_options.delete(:t_index) if nt_options[:t_index]
|
1952
|
+
nt_options.delete(:frame_index) if nt_options[:frame_index]
|
1953
|
+
tperpax = axiskit("tperp2_by_#{kxy}_over_time", nt_options)
|
1954
|
+
kit = GraphKit.autocreate({x: axiskit('t', options), y: tperpax})
|
1955
|
+
kit.data[0].title = "Tperp^2 total: #{kxy} = #{options[kxy]}"
|
1956
|
+
if options[:t_index]
|
1957
|
+
# p 'hello'
|
1958
|
+
array_element = options[:t_index_window] ? options[:t_index] - options[:t_index_window][0] : options[:t_index] - 1
|
1959
|
+
# p tparax.data.size, array_element
|
1960
|
+
# p options[:t_index], options[:t_index_window]
|
1961
|
+
time = DataKit.autocreate({x: {data: GSL::Vector.alloc([list(:t)[options[:t_index]]])}, y: {data: GSL::Vector.alloc([tperpax.data[array_element]]) } })
|
1962
|
+
time.pointsize = 3.0
|
1963
|
+
# p time
|
1964
|
+
# kit.data[0].axes[:x].data = -kit.data[0].axes[:x].data
|
1965
|
+
kit.data.push time
|
1966
|
+
end
|
1967
|
+
if options[:norm]
|
1968
|
+
xrange, yrange = kit.plot_area_size
|
1969
|
+
kit.each_axiskit(:y) do |axiskit|
|
1970
|
+
axiskit.data /= yrange[1] / (options[:height] or 1.0)
|
1971
|
+
end
|
1972
|
+
end
|
1973
|
+
kit.log_axis = 'y'
|
1974
|
+
#kit.data[0].title = "gs2:#@run_name"
|
1975
|
+
kit.data[0].with = "l" #"linespoints"
|
1976
|
+
kit.file_name = options[:graphkit_name]
|
1977
|
+
kit
|
1978
|
+
end
|
1979
|
+
end
|
1938
1980
|
def apar2_vs_time_graphkit(options={})
|
1939
1981
|
case options[:command]
|
1940
1982
|
when :help
|
data/lib/gs2crmod/gsl_data.rb
CHANGED
@@ -450,6 +450,30 @@ module GSLVectors
|
|
450
450
|
end
|
451
451
|
end
|
452
452
|
|
453
|
+
def tperp2_by_mode_over_time_gsl_vector(options)
|
454
|
+
Dir.chdir(@directory) do #Necessary options: :ky and :kx
|
455
|
+
#Optional options: :t_index_window
|
456
|
+
# eputs "got here"
|
457
|
+
#options[:begin_element], options[:end_element] = (options[:t_index_window] ? options[:t_index_window].map{|ind| ind -1} : [0, -1])
|
458
|
+
options.setup_time_window
|
459
|
+
tperp_t_array=nil
|
460
|
+
if @grid_option == "single"
|
461
|
+
tperp_t_array = netcdf_file.var('tperp2').get('start' => [options[:begin_element]], 'end' => [options[:end_element]]).to_a.flatten
|
462
|
+
else
|
463
|
+
# value = options[:ky]
|
464
|
+
# eputs value
|
465
|
+
# get_list_of(:ky)
|
466
|
+
# index = @ky_list.find{|index,val| (val-value).abs < Float::EPSILON}[0]
|
467
|
+
options.convert_to_index(self, :kx, :ky, :species)
|
468
|
+
# p options
|
469
|
+
tperp_t_array = netcdf_file.var("tperp2_by_mode").get('start' => [options[:kx_index] - 1, options[:ky_index] - 1, options[:species_index] - 1, options[:begin_element]], 'end' => [options[:kx_index] - 1, options[:ky_index] - 1, options[:species_index] - 1, options[:end_element]]).to_a.flatten
|
470
|
+
# eputs 'tperp_t_array.size', tperp_t_array.size
|
471
|
+
end
|
472
|
+
return GSL::Vector.alloc(tperp_t_array)
|
473
|
+
|
474
|
+
end
|
475
|
+
end
|
476
|
+
|
453
477
|
def phi0_by_kx_by_ky_over_time_gsl_vector(options)
|
454
478
|
Dir.chdir(@directory) do
|
455
479
|
options.convert_to_index(self, :kx, :ky)
|
data/test/test_gs2crmod.rb
CHANGED
@@ -96,8 +96,11 @@ class TestAnalysis < Test::Unit::TestCase
|
|
96
96
|
|
97
97
|
kit = @run.graphkit('tpar2_by_mode_vs_time', {ky_index:2, kx_index:1, species_index:1})
|
98
98
|
#kit.gnuplot
|
99
|
-
|
100
99
|
assert_equal(@runner.run_list[1].netcdf_file.var('tpar2_by_mode').get('start' => [0,1,0,4], 'end' => [0,1,0,4]).to_a[0][0][0][0], kit.data[0].y.data[4])
|
100
|
+
|
101
|
+
kit = @run.graphkit('tperp2_by_mode_vs_time', {ky_index:2, kx_index:1, species_index:1})
|
102
|
+
#kit.gnuplot
|
103
|
+
assert_equal(@runner.run_list[1].netcdf_file.var('tperp2_by_mode').get('start' => [0,1,0,4], 'end' => [0,1,0,4]).to_a[0][0][0][0], kit.data[0].y.data[4])
|
101
104
|
end
|
102
105
|
def test_3d_graphs
|
103
106
|
kit = @runner.run_list[1].graphkit('phi_real_space', {n0: 3, Rgeo: 3})
|
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.9.
|
4
|
+
version: 0.9.2
|
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: 2013-07-
|
13
|
+
date: 2013-07-31 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: coderunner
|
17
|
-
requirement: &
|
17
|
+
requirement: &10308540 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 0.12.16
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *10308540
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: ruby-netcdf
|
28
|
-
requirement: &
|
28
|
+
requirement: &10307700 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 0.6.6.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *10307700
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: shoulda
|
39
|
-
requirement: &
|
39
|
+
requirement: &10306140 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *10306140
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: rdoc
|
50
|
-
requirement: &
|
50
|
+
requirement: &10247600 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ~>
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: '3.12'
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *10247600
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: bundler
|
61
|
-
requirement: &
|
61
|
+
requirement: &9765940 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ! '>'
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: 1.0.0
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *9765940
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: jeweler
|
72
|
-
requirement: &
|
72
|
+
requirement: &9764800 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ! '>='
|
@@ -77,7 +77,7 @@ dependencies:
|
|
77
77
|
version: 1.8.4
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *9764800
|
81
81
|
description: GS2 is a gyrokinetic flux tube initial value turbulence code which can
|
82
82
|
be used for fusion or astrophysical plasmas. CodeRunner is a framework for the automated
|
83
83
|
running and analysis of large simulations. This module allows GS2 (and its sister
|