gs2crmod 0.10.15 → 0.10.16
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -1
- data/VERSION +1 -1
- data/gs2crmod.gemspec +5 -2
- data/lib/gs2crmod/graphs.rb +47 -7
- data/lib/gs2crmod/gsl_data.rb +53 -0
- metadata +60 -14
data/Gemfile
CHANGED
@@ -3,7 +3,8 @@ source "http://rubygems.org"
|
|
3
3
|
# Example:
|
4
4
|
gem "coderunner", ">= 0.13.13"
|
5
5
|
gem "rubyhacks", ">= 0.1.2"
|
6
|
-
#
|
6
|
+
# It seems necessary to have the following line un-commented on some systems but commented out on other systems:
|
7
|
+
gem "ruby-netcdf", ">= 0.6.6.1"
|
7
8
|
|
8
9
|
# Add dependencies to develop your gem here.
|
9
10
|
# Include everything needed to run rake, tests, features, etc.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.10.
|
1
|
+
0.10.16
|
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.
|
8
|
+
s.version = "0.10.16"
|
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"]
|
@@ -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
|
@@ -87,6 +87,7 @@ Gem::Specification.new do |s|
|
|
87
87
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
88
88
|
s.add_runtime_dependency(%q<coderunner>, [">= 0.13.13"])
|
89
89
|
s.add_runtime_dependency(%q<rubyhacks>, [">= 0.1.2"])
|
90
|
+
s.add_runtime_dependency(%q<ruby-netcdf>, [">= 0.6.6.1"])
|
90
91
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
91
92
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
92
93
|
s.add_development_dependency(%q<bundler>, ["> 1.0.0"])
|
@@ -94,6 +95,7 @@ Gem::Specification.new do |s|
|
|
94
95
|
else
|
95
96
|
s.add_dependency(%q<coderunner>, [">= 0.13.13"])
|
96
97
|
s.add_dependency(%q<rubyhacks>, [">= 0.1.2"])
|
98
|
+
s.add_dependency(%q<ruby-netcdf>, [">= 0.6.6.1"])
|
97
99
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
98
100
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
99
101
|
s.add_dependency(%q<bundler>, ["> 1.0.0"])
|
@@ -102,6 +104,7 @@ Gem::Specification.new do |s|
|
|
102
104
|
else
|
103
105
|
s.add_dependency(%q<coderunner>, [">= 0.13.13"])
|
104
106
|
s.add_dependency(%q<rubyhacks>, [">= 0.1.2"])
|
107
|
+
s.add_dependency(%q<ruby-netcdf>, [">= 0.6.6.1"])
|
105
108
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
106
109
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
107
110
|
s.add_dependency(%q<bundler>, ["> 1.0.0"])
|
data/lib/gs2crmod/graphs.rb
CHANGED
@@ -14,15 +14,19 @@ def auto_axiskits(name, options)
|
|
14
14
|
'apar2_over_time' => ['Apar^2 Total', ''],
|
15
15
|
'growth_rate_by_ky_over_time' => ['Growth Rate by ky', ''],
|
16
16
|
'growth_rate_by_kx_over_time' => ['Growth Rate by kx', ''],
|
17
|
-
|
17
|
+
'growth_rate_by_mode_over_time' => ["Growth Rate by mode", ''],
|
18
|
+
# <MJL additions 2013-09-19>
|
19
|
+
'frequency_by_ky_over_time' => ['Real frequency by ky', ''],
|
20
|
+
'frequency_by_kx_over_time' => ['Real frequency by kx', ''],
|
21
|
+
# </MJL>
|
18
22
|
'phi2_by_ky_over_time' => ['Phi^2 by ky', ''],
|
19
23
|
'phi2_by_kx_over_time' => ['Phi^2 by ky', ''],
|
20
24
|
'es_heat_by_ky_over_time' => ['Phi^2 by ky', ''],
|
21
25
|
'es_heat_by_kx_over_time' => ['Phi^2 by kx', ''],
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
+
'phi2_by_mode_over_time' => ["Phi^2 by mode", ''],
|
27
|
+
'tpar2_by_mode_over_time' => ["(delta T_parallel)^2 by mode", '%'],
|
28
|
+
'tperp2_by_mode_over_time' => ["(delta T_perp)^2 by mode", '%'],
|
29
|
+
'hflux_tot' => ['Total Heat Flux', ''],
|
26
30
|
'es_heat_par' => ['Parallel electrostatic heat flux', ''],
|
27
31
|
'es_heat_perp' => ['Perpendicular electrostatic heat flux', ''],
|
28
32
|
'ky' => ['ky', "1/rho_#{species_letter}"],
|
@@ -1846,14 +1850,50 @@ module GraphKits
|
|
1846
1850
|
x = axiskit('t', options)
|
1847
1851
|
x.data = x.data.subvector(0, x.data.size-1)
|
1848
1852
|
kit = GraphKit.autocreate({x: x , y: phiax})
|
1849
|
-
kit.data[0].title = "Growth Rate: #{kxy} = #{options[kxy]}"
|
1850
|
-
kit.data[0].title = "gs2:#@run_name"
|
1853
|
+
#kit.data[0].title = "Growth Rate: #{kxy} = #{options[kxy]}"
|
1854
|
+
#kit.data[0].title = "gs2:#@run_name"
|
1855
|
+
# <MJL additions on 2013-09-19>
|
1856
|
+
kxy_index = kxy + :_index
|
1857
|
+
kit.data[0].title = "gs2:#@run_name, #{kxy}_index = #{options[kxy_index]}"
|
1858
|
+
# </MJL>
|
1851
1859
|
kit.data[0].with = "l" #"linespoints"
|
1852
1860
|
kit.file_name = options[:graphkit_name]
|
1853
1861
|
kit
|
1854
1862
|
end
|
1855
1863
|
end
|
1856
1864
|
|
1865
|
+
# <MJL additions on 2013-09-19>
|
1866
|
+
def frequency_by_kx_vs_time_graphkit(options={})
|
1867
|
+
options[:direction] = :kx
|
1868
|
+
frequency_by_kxy_or_mode_vs_time_graphkit(options)
|
1869
|
+
end
|
1870
|
+
|
1871
|
+
def frequency_by_ky_vs_time_graphkit(options={})
|
1872
|
+
options[:direction] = :ky
|
1873
|
+
frequency_by_kxy_or_mode_vs_time_graphkit(options)
|
1874
|
+
end
|
1875
|
+
|
1876
|
+
def frequency_by_kxy_or_mode_vs_time_graphkit(options={})
|
1877
|
+
case options[:command]
|
1878
|
+
when :help
|
1879
|
+
return "'frequency_by_ky_vs_time' or 'frequency_by_kx_vs_time': Real part of the frequency vs time for a given kx or ky, integrated over the other direction"
|
1880
|
+
when :options
|
1881
|
+
return [:ky, :ky_index, :kx, :kx_index]
|
1882
|
+
else
|
1883
|
+
raise "Frequencies are not available in non-linear mode" if @nonlinear_mode == "on"
|
1884
|
+
kxy = options[:direction]
|
1885
|
+
x_data = axiskit('t', options)
|
1886
|
+
y_data = axiskit("frequency_by_#{kxy}_over_time", options)
|
1887
|
+
kit = GraphKit.autocreate({x: x_data , y: y_data})
|
1888
|
+
kxy_index = kxy + :_index
|
1889
|
+
kit.data[0].title = "gs2:#@run_name, #{kxy}_index = #{options[kxy_index]}"
|
1890
|
+
kit.data[0].with = "l" #"linespoints"
|
1891
|
+
kit.file_name = options[:graphkit_name]
|
1892
|
+
kit
|
1893
|
+
end
|
1894
|
+
end
|
1895
|
+
# </MJL>
|
1896
|
+
|
1857
1897
|
def es_heat_by_mode_vs_time_graphkit(options={})
|
1858
1898
|
options[:direction] = :mode
|
1859
1899
|
es_heat_by_kxy_or_mode_vs_time_graphkit(options)
|
data/lib/gs2crmod/gsl_data.rb
CHANGED
@@ -304,6 +304,59 @@ module GSLVectors
|
|
304
304
|
return fix_norm(dphi/gsl_vector('dt'), 0, options)
|
305
305
|
end
|
306
306
|
|
307
|
+
# <MJL edits on 2013-09-19>
|
308
|
+
# The real frequency of the fluctuations, read from the .out file, indexed by time and normalised to vth_1/a.
|
309
|
+
# :ky_index or :kx_index must be specified in options.
|
310
|
+
|
311
|
+
def frequency_by_kx_over_time_gsl_vector(options)
|
312
|
+
options[:direction] = :kx
|
313
|
+
frequency_by_kxy_over_time_gsl_vector(options)
|
314
|
+
end
|
315
|
+
|
316
|
+
def frequency_by_ky_over_time_gsl_vector(options)
|
317
|
+
options[:direction] = :ky
|
318
|
+
frequency_by_kxy_over_time_gsl_vector(options)
|
319
|
+
end
|
320
|
+
|
321
|
+
def frequency_by_kxy_over_time_gsl_vector(options)
|
322
|
+
kxy = options[:direction]
|
323
|
+
kxy_index = kxy + :_index
|
324
|
+
kxys = get_list_of(kxy)
|
325
|
+
desired_kxy = kxys[options[kxy_index]]
|
326
|
+
raise "No k found at the desired index" if desired_kxy.nil?
|
327
|
+
|
328
|
+
omega_reals = []
|
329
|
+
File.open(@run_name+".out",'r') do |fileHandle|
|
330
|
+
fileHandle.each_line do |fileLine|
|
331
|
+
if fileLine.include?('aky=') # Only examine the lines of the .out file that contain frequency information.
|
332
|
+
|
333
|
+
index = fileLine.index('akx=')
|
334
|
+
raise "akx wasn't found where it was expected in the .out file." if index.nil?
|
335
|
+
akx = fileLine[(index+4)..-1].to_f
|
336
|
+
|
337
|
+
index = fileLine.index('aky=')
|
338
|
+
raise "aky wasn't found where it was expected in the .out file." if index.nil?
|
339
|
+
aky = fileLine[(index+4)..-1].to_f
|
340
|
+
|
341
|
+
index = fileLine.index('om=')
|
342
|
+
raise "om wasn't found where it was expected in the .out file." if index.nil?
|
343
|
+
omr = fileLine[(index+3)..-1].to_f
|
344
|
+
if kxy == :kx
|
345
|
+
# You need to be careful when testing equality of the desired k with the k in the .out file
|
346
|
+
# since the .out file is only written to ~ 5 significant digits:
|
347
|
+
omega_reals << omr if ((desired_kxy - akx).abs/(desired_kxy.abs + 1e-7) < 1e-4)
|
348
|
+
else
|
349
|
+
omega_reals << omr if ((desired_kxy - aky).abs/(desired_kxy.abs + 1e-7) < 1e-4)
|
350
|
+
end
|
351
|
+
end
|
352
|
+
end
|
353
|
+
end
|
354
|
+
raise "No real frequencies found in the .out file for the desired k" if (omega_reals.size==0)
|
355
|
+
GSL::Vector.alloc(omega_reals)
|
356
|
+
end
|
357
|
+
# </MJL>
|
358
|
+
|
359
|
+
|
307
360
|
# The size of each time step, indexed by time, normalised to a/v_th1.
|
308
361
|
|
309
362
|
def dt_gsl_vector(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.10.
|
4
|
+
version: 0.10.16
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ date: 2013-09-19 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,10 +22,15 @@ dependencies:
|
|
22
22
|
version: 0.13.13
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements:
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 0.13.13
|
26
31
|
- !ruby/object:Gem::Dependency
|
27
32
|
name: rubyhacks
|
28
|
-
requirement:
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
29
34
|
none: false
|
30
35
|
requirements:
|
31
36
|
- - ! '>='
|
@@ -33,10 +38,31 @@ dependencies:
|
|
33
38
|
version: 0.1.2
|
34
39
|
type: :runtime
|
35
40
|
prerelease: false
|
36
|
-
version_requirements:
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.1.2
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: ruby-netcdf
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.6.6.1
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 0.6.6.1
|
37
63
|
- !ruby/object:Gem::Dependency
|
38
64
|
name: shoulda
|
39
|
-
requirement:
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
40
66
|
none: false
|
41
67
|
requirements:
|
42
68
|
- - ! '>='
|
@@ -44,10 +70,15 @@ dependencies:
|
|
44
70
|
version: '0'
|
45
71
|
type: :development
|
46
72
|
prerelease: false
|
47
|
-
version_requirements:
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
48
79
|
- !ruby/object:Gem::Dependency
|
49
80
|
name: rdoc
|
50
|
-
requirement:
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
51
82
|
none: false
|
52
83
|
requirements:
|
53
84
|
- - ~>
|
@@ -55,10 +86,15 @@ dependencies:
|
|
55
86
|
version: '3.12'
|
56
87
|
type: :development
|
57
88
|
prerelease: false
|
58
|
-
version_requirements:
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ~>
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '3.12'
|
59
95
|
- !ruby/object:Gem::Dependency
|
60
96
|
name: bundler
|
61
|
-
requirement:
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
62
98
|
none: false
|
63
99
|
requirements:
|
64
100
|
- - ! '>'
|
@@ -66,10 +102,15 @@ dependencies:
|
|
66
102
|
version: 1.0.0
|
67
103
|
type: :development
|
68
104
|
prerelease: false
|
69
|
-
version_requirements:
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>'
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.0.0
|
70
111
|
- !ruby/object:Gem::Dependency
|
71
112
|
name: jeweler
|
72
|
-
requirement:
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
73
114
|
none: false
|
74
115
|
requirements:
|
75
116
|
- - ! '>='
|
@@ -77,7 +118,12 @@ dependencies:
|
|
77
118
|
version: 1.8.4
|
78
119
|
type: :development
|
79
120
|
prerelease: false
|
80
|
-
version_requirements:
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ! '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: 1.8.4
|
81
127
|
description: GS2 is a gyrokinetic flux tube initial value turbulence code which can
|
82
128
|
be used for fusion or astrophysical plasmas. CodeRunner is a framework for the automated
|
83
129
|
running and analysis of large simulations. This module allows GS2 (and its sister
|
@@ -166,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
212
|
version: '0'
|
167
213
|
requirements: []
|
168
214
|
rubyforge_project:
|
169
|
-
rubygems_version: 1.8.
|
215
|
+
rubygems_version: 1.8.23
|
170
216
|
signing_key:
|
171
217
|
specification_version: 3
|
172
218
|
summary: Module to allow CodeRunner to run and analyse the GS2 and AstroGK codes.
|