gs2crmod 0.9.2 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/VERSION +1 -1
- data/gs2crmod.gemspec +3 -6
- data/lib/gs2crmod/gsl_data.rb +11 -6
- data/lib/gs2crmod/gsl_tools.rb +2 -2
- data/lib/gs2crmod/spectrogk/namelists.rb +40 -0
- data/test/test_gs2crmod.rb +3 -0
- metadata +34 -20
data/Gemfile
CHANGED
@@ -2,7 +2,7 @@ source "http://rubygems.org"
|
|
2
2
|
# Add dependencies required to use your gem here.
|
3
3
|
# Example:
|
4
4
|
gem "coderunner", ">= 0.12.16"
|
5
|
-
gem "ruby-netcdf", ">= 0.6.6.1"
|
5
|
+
# gem "ruby-netcdf", ">= 0.6.6.1"
|
6
6
|
|
7
7
|
# Add dependencies to develop your gem here.
|
8
8
|
# Include everything needed to run rake, tests, features, etc.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.4
|
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.4"
|
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-08-07"
|
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"]
|
@@ -78,7 +78,7 @@ Gem::Specification.new do |s|
|
|
78
78
|
s.licenses = ["GSLv3"]
|
79
79
|
s.require_paths = ["lib"]
|
80
80
|
s.required_ruby_version = Gem::Requirement.new(">= 1.9.1")
|
81
|
-
s.rubygems_version = "1.8.
|
81
|
+
s.rubygems_version = "1.8.23"
|
82
82
|
s.summary = "Module to allow CodeRunner to run and analyse the GS2 and AstroGK codes."
|
83
83
|
|
84
84
|
if s.respond_to? :specification_version then
|
@@ -86,14 +86,12 @@ Gem::Specification.new do |s|
|
|
86
86
|
|
87
87
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
88
88
|
s.add_runtime_dependency(%q<coderunner>, [">= 0.12.16"])
|
89
|
-
s.add_runtime_dependency(%q<ruby-netcdf>, [">= 0.6.6.1"])
|
90
89
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
91
90
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
92
91
|
s.add_development_dependency(%q<bundler>, ["> 1.0.0"])
|
93
92
|
s.add_development_dependency(%q<jeweler>, [">= 1.8.4"])
|
94
93
|
else
|
95
94
|
s.add_dependency(%q<coderunner>, [">= 0.12.16"])
|
96
|
-
s.add_dependency(%q<ruby-netcdf>, [">= 0.6.6.1"])
|
97
95
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
98
96
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
99
97
|
s.add_dependency(%q<bundler>, ["> 1.0.0"])
|
@@ -101,7 +99,6 @@ Gem::Specification.new do |s|
|
|
101
99
|
end
|
102
100
|
else
|
103
101
|
s.add_dependency(%q<coderunner>, [">= 0.12.16"])
|
104
|
-
s.add_dependency(%q<ruby-netcdf>, [">= 0.6.6.1"])
|
105
102
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
106
103
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
107
104
|
s.add_dependency(%q<bundler>, ["> 1.0.0"])
|
data/lib/gs2crmod/gsl_data.rb
CHANGED
@@ -541,8 +541,9 @@ module GSLVectors
|
|
541
541
|
Dir.chdir(@directory) do
|
542
542
|
# , /kpar_spectrum/
|
543
543
|
#ep 'zero?', (@s_hat_input||@shat)==0.0
|
544
|
-
unless (@s_hat_input||@shat||0.
|
544
|
+
unless agk? or (@s_hat_input||@shat||0.0).abs<1.0e-5
|
545
545
|
phi = gsl_vector_complex('phi_along_field_line', options)
|
546
|
+
phi = phi.subvector(0,phi.size-1)
|
546
547
|
#i = 0
|
547
548
|
#phi = phi.collect{|re,im|
|
548
549
|
#i+=1; GSL::Complex.alloc(Math.sin(0.1*i), Math.cos(0.1*i))+
|
@@ -587,10 +588,11 @@ module GSLVectors
|
|
587
588
|
end
|
588
589
|
case phi.size%2
|
589
590
|
when 0
|
590
|
-
kpar = GSL::Vector.indgen(phi.size, -(phi.size-
|
591
|
+
kpar = GSL::Vector.indgen(phi.size-1, -((phi.size-3)/2))*dk
|
591
592
|
when 1
|
592
|
-
kpar = GSL::Vector.indgen(phi.size, -(phi.size-
|
593
|
+
kpar = GSL::Vector.indgen(phi.size-1, -((phi.size-2)/2))*dk
|
593
594
|
end
|
595
|
+
#ep 'kpar', kpar, 'phi.size', phi.size
|
594
596
|
|
595
597
|
#ep 'kpar.class', kpar.class
|
596
598
|
return kpar
|
@@ -999,9 +1001,9 @@ module GSLMatrices
|
|
999
1001
|
end
|
1000
1002
|
temp = phi_av = (lkx.keys.map do |kx_index|
|
1001
1003
|
if options[:t_index]
|
1002
|
-
phi = netcdf_file.var('phi_t').get({'start' => [0,0,kx_index-1,0, options[:t_index] - 1], 'end' => [-1,-
|
1004
|
+
phi = netcdf_file.var('phi_t').get({'start' => [0,0,kx_index-1,0, options[:t_index] - 1], 'end' => [-1,-2,kx_index-1,-1, options[:t_index] - 1]})
|
1003
1005
|
else
|
1004
|
-
phi = netcdf_file.var('phi').get({'start' => [0, 0, kx_index - 1, 0], 'end' => [-1, -
|
1006
|
+
phi = netcdf_file.var('phi').get({'start' => [0, 0, kx_index - 1, 0], 'end' => [-1, -2, kx_index-1, -1]})
|
1005
1007
|
end
|
1006
1008
|
#ep phi.shape
|
1007
1009
|
phi.reshape(*phi.shape.values_at(0,1,3))
|
@@ -1010,16 +1012,19 @@ module GSLMatrices
|
|
1010
1012
|
phi_t = phi_av.to_a #.map{|arr| arr.transpose}.transpose.map{|a| a.transpose}
|
1011
1013
|
#ep 'phi_t', phi_t.size, phi_t[0].size, phi_t[0][0].size
|
1012
1014
|
gvky = gsl_vector('ky')
|
1013
|
-
gm = GSL::Matrix.alloc(gvky.size, gsl_vector('theta').size)
|
1015
|
+
gm = GSL::Matrix.alloc(gvky.size, gsl_vector('theta').size-1)
|
1014
1016
|
for ky_element in 0...gm.shape[0]
|
1015
1017
|
#p phi_t[ky_element].transpose[0]
|
1016
1018
|
spectrum = GSL::Vector::Complex.alloc(phi_t[ky_element]).forward.square
|
1017
1019
|
if options[:no_kpar0]
|
1018
1020
|
spectrum[0]=0.0
|
1019
1021
|
end
|
1022
|
+
#ep spectrum.size
|
1020
1023
|
spectrum = spectrum.from_box_order
|
1021
1024
|
#ep spectrum.shape
|
1022
1025
|
spectrum = spectrum*gvky[ky_element]**2 unless options[:phi2_only]
|
1026
|
+
#ep gm.size
|
1027
|
+
#ep spectrum.size
|
1023
1028
|
gm.set_row(ky_element, spectrum)
|
1024
1029
|
end
|
1025
1030
|
if options[:no_zonal]
|
data/lib/gs2crmod/gsl_tools.rb
CHANGED
@@ -35,12 +35,12 @@ class GSL::Vector
|
|
35
35
|
|
36
36
|
def from_box_order
|
37
37
|
size = self.size
|
38
|
-
v1, v2 = self.subvector(0, (size+
|
38
|
+
v1, v2 = self.subvector(0, (size+2)/2), self.subvector((size+2)/2, (size-1)/2)
|
39
39
|
return v2.connect(v1)
|
40
40
|
end
|
41
41
|
def to_box_order
|
42
42
|
size = self.size
|
43
|
-
v1, v2 = self.subvector(0, (size-1)/2), self.subvector((size-1)/2, (size+
|
43
|
+
v1, v2 = self.subvector(0, (size-1)/2), self.subvector((size-1)/2, (size+2)/2)
|
44
44
|
return v2.connect(v1)
|
45
45
|
end
|
46
46
|
|
@@ -2030,6 +2030,46 @@
|
|
2030
2030
|
[{:test=>"kind_of? Integer",
|
2031
2031
|
:explanation=>"This variable must be an integer."}],
|
2032
2032
|
:type=>:Integer},
|
2033
|
+
:iky_init=>
|
2034
|
+
{:should_include=>"true",
|
2035
|
+
:description=>nil,
|
2036
|
+
:help=>nil,
|
2037
|
+
:tests=>["Tst::INT"],
|
2038
|
+
:code_name=>:iky_init,
|
2039
|
+
:must_pass=>
|
2040
|
+
[{:test=>"kind_of? Integer",
|
2041
|
+
:explanation=>"This variable must be an integer."}],
|
2042
|
+
:type=>:Integer},
|
2043
|
+
:ikpar_init2=>
|
2044
|
+
{:should_include=>"true",
|
2045
|
+
:description=>nil,
|
2046
|
+
:help=>nil,
|
2047
|
+
:tests=>["Tst::INT"],
|
2048
|
+
:code_name=>:ikpar_init2,
|
2049
|
+
:must_pass=>
|
2050
|
+
[{:test=>"kind_of? Integer",
|
2051
|
+
:explanation=>"This variable must be an integer."}],
|
2052
|
+
:type=>:Integer},
|
2053
|
+
:ikx_init2=>
|
2054
|
+
{:should_include=>"true",
|
2055
|
+
:description=>nil,
|
2056
|
+
:help=>nil,
|
2057
|
+
:tests=>["Tst::INT"],
|
2058
|
+
:code_name=>:ikx_init2,
|
2059
|
+
:must_pass=>
|
2060
|
+
[{:test=>"kind_of? Integer",
|
2061
|
+
:explanation=>"This variable must be an integer."}],
|
2062
|
+
:type=>:Integer},
|
2063
|
+
:iky_init2=>
|
2064
|
+
{:should_include=>"true",
|
2065
|
+
:description=>nil,
|
2066
|
+
:help=>nil,
|
2067
|
+
:tests=>["Tst::INT"],
|
2068
|
+
:code_name=>:iky_init2,
|
2069
|
+
:must_pass=>
|
2070
|
+
[{:test=>"kind_of? Integer",
|
2071
|
+
:explanation=>"This variable must be an integer."}],
|
2072
|
+
:type=>:Integer},
|
2033
2073
|
:force_single_kpar=>
|
2034
2074
|
{:should_include=>"true",
|
2035
2075
|
:description=>
|
data/test/test_gs2crmod.rb
CHANGED
@@ -167,6 +167,9 @@ class TestAgkAnalysis < Test::Unit::TestCase
|
|
167
167
|
#kit.gnuplot
|
168
168
|
assert_equal(126, kit.data[0].y.data.size)
|
169
169
|
assert_equal(@runner.run_list[1].netcdf_file.var('phi2').get('start' => [4], 'end' => [4]).to_a[0], kit.data[0].y.data[4])
|
170
|
+
assert_equal(nil,@runner.run_list[1].instance_variable_get(:@shat))
|
171
|
+
kit = @runner.run_list[1].graphkit('kpar_spectrum',{})
|
172
|
+
#kit.gnuplot
|
170
173
|
end
|
171
174
|
def test_analysis
|
172
175
|
assert_equal(1, @runner.run_list.size)
|
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.4
|
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-08-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: coderunner
|
17
|
-
requirement:
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,21 +22,15 @@ dependencies:
|
|
22
22
|
version: 0.12.16
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements:
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name: ruby-netcdf
|
28
|
-
requirement: &10307700 !ruby/object:Gem::Requirement
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
29
26
|
none: false
|
30
27
|
requirements:
|
31
28
|
- - ! '>='
|
32
29
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: *10307700
|
30
|
+
version: 0.12.16
|
37
31
|
- !ruby/object:Gem::Dependency
|
38
32
|
name: shoulda
|
39
|
-
requirement:
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
40
34
|
none: false
|
41
35
|
requirements:
|
42
36
|
- - ! '>='
|
@@ -44,10 +38,15 @@ dependencies:
|
|
44
38
|
version: '0'
|
45
39
|
type: :development
|
46
40
|
prerelease: false
|
47
|
-
version_requirements:
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
48
47
|
- !ruby/object:Gem::Dependency
|
49
48
|
name: rdoc
|
50
|
-
requirement:
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
51
50
|
none: false
|
52
51
|
requirements:
|
53
52
|
- - ~>
|
@@ -55,10 +54,15 @@ dependencies:
|
|
55
54
|
version: '3.12'
|
56
55
|
type: :development
|
57
56
|
prerelease: false
|
58
|
-
version_requirements:
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ~>
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '3.12'
|
59
63
|
- !ruby/object:Gem::Dependency
|
60
64
|
name: bundler
|
61
|
-
requirement:
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
62
66
|
none: false
|
63
67
|
requirements:
|
64
68
|
- - ! '>'
|
@@ -66,10 +70,15 @@ dependencies:
|
|
66
70
|
version: 1.0.0
|
67
71
|
type: :development
|
68
72
|
prerelease: false
|
69
|
-
version_requirements:
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>'
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 1.0.0
|
70
79
|
- !ruby/object:Gem::Dependency
|
71
80
|
name: jeweler
|
72
|
-
requirement:
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
73
82
|
none: false
|
74
83
|
requirements:
|
75
84
|
- - ! '>='
|
@@ -77,7 +86,12 @@ dependencies:
|
|
77
86
|
version: 1.8.4
|
78
87
|
type: :development
|
79
88
|
prerelease: false
|
80
|
-
version_requirements:
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 1.8.4
|
81
95
|
description: GS2 is a gyrokinetic flux tube initial value turbulence code which can
|
82
96
|
be used for fusion or astrophysical plasmas. CodeRunner is a framework for the automated
|
83
97
|
running and analysis of large simulations. This module allows GS2 (and its sister
|
@@ -166,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
180
|
version: '0'
|
167
181
|
requirements: []
|
168
182
|
rubyforge_project:
|
169
|
-
rubygems_version: 1.8.
|
183
|
+
rubygems_version: 1.8.23
|
170
184
|
signing_key:
|
171
185
|
specification_version: 3
|
172
186
|
summary: Module to allow CodeRunner to run and analyse the GS2 and AstroGK codes.
|