gs2crmod 0.9.6 → 0.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/gs2crmod.gemspec +2 -2
- data/lib/gs2crmod/calculations.rb +22 -11
- data/lib/gs2crmod/graphs.rb +18 -0
- data/lib/gs2crmod/gs2.rb +1 -0
- data/lib/gs2crmod/gsl_data.rb +6 -0
- data/test/cyclone_low_res.tgz +0 -0
- data/test/test_gs2crmod.rb +10 -3
- metadata +2 -2
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.9.
|
|
1
|
+
0.9.7
|
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.7"
|
|
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-08-
|
|
12
|
+
s.date = "2013-08-15"
|
|
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"]
|
|
@@ -265,19 +265,30 @@ def calculate_growth_rates_and_frequencies
|
|
|
265
265
|
# eputs final_timestep_list
|
|
266
266
|
f = LongRegexen::FLOAT.verbatim
|
|
267
267
|
logi(f)
|
|
268
|
-
regex = Regexp.new( "^.*aky=\\s*(?<aky>#{f}).*omav=\\s*(?<re>#{f})\\s*(?<gr>#{f})")
|
|
269
|
-
logi(regex)
|
|
270
|
-
final_timestep_list.gsub(regex) do
|
|
271
|
-
data = $~
|
|
272
|
-
|
|
273
|
-
|
|
268
|
+
#regex = Regexp.new( "^.*aky=\\s*(?<aky>#{f}).*omav=\\s*(?<re>#{f})\\s*(?<gr>#{f})")
|
|
269
|
+
#logi(regex)
|
|
270
|
+
#final_timestep_list.gsub(regex) do
|
|
271
|
+
#data = $~
|
|
272
|
+
## eputs data.inspect; gets
|
|
273
|
+
##raise CRFatal.new("Unknown value of ky read from output file: #{data[:aky].to_f}. Not in list:\n#{list(:ky).values.inspect}")
|
|
274
274
|
|
|
275
|
-
next unless (list(:ky).values).include? data[:aky].to_f
|
|
276
|
-
|
|
277
|
-
aky = data[:aky].to_f
|
|
278
|
-
next if aky==0.0
|
|
279
|
-
|
|
275
|
+
#next unless (list(:ky).values).include? data[:aky].to_f
|
|
276
|
+
##@growth_rates[data[:aky].to_f] = data[:gr].to_f
|
|
277
|
+
#aky = data[:aky].to_f
|
|
278
|
+
#next if aky==0.0
|
|
279
|
+
#@real_frequencies[data[:aky].to_f] = data[:re].to_f
|
|
280
|
+
#end
|
|
281
|
+
@frequency_at_ky_at_kx||= FloatHash.new
|
|
282
|
+
ky_values = []
|
|
283
|
+
regex = Regexp.new( "^.*aky=\\s*(?<aky>#{f})\s*akx=\\s*(?<akx>#{f}).*omav=\\s*(?<re>#{f})\\s*(?<gr>#{f})")
|
|
284
|
+
final_timestep_list.scan(regex) do
|
|
285
|
+
aky = eval($~[:aky])
|
|
286
|
+
akx = eval($~[:akx])
|
|
287
|
+
@frequency_at_ky_at_kx[aky] = FloatHash.new unless ky_values.include? aky
|
|
288
|
+
ky_values.push aky
|
|
289
|
+
@frequency_at_ky_at_kx[aky][akx] = eval($~[:re])
|
|
280
290
|
end
|
|
291
|
+
#raise CRFatal.new("Unknown value of ky read from output file: #{data[:aky].to_f}. Not in list:\n#{list(:ky).values.inspect}")
|
|
281
292
|
# pp @ky_list
|
|
282
293
|
|
|
283
294
|
# With zero magnetic shear, calculate growth rates for both kx and ky
|
data/lib/gs2crmod/graphs.rb
CHANGED
|
@@ -28,6 +28,7 @@ def auto_axiskits(name, options)
|
|
|
28
28
|
'kpar' => ['kpar', "2 pi/qR"],
|
|
29
29
|
'growth_rate_over_kx' => ['Growth Rate', "v_th#{species_letter}/a", 1],
|
|
30
30
|
'growth_rate_over_ky' => ['Growth Rate', "v_th#{species_letter}/a", 1],
|
|
31
|
+
'frequency_over_ky' => ['Frequency', "v_th#{species_letter}/a", 1],
|
|
31
32
|
'transient_es_heat_flux_amplification_over_kx' => ['Transient Electrostatic Heat Amplification', "", 1],
|
|
32
33
|
'transient_es_heat_flux_amplification_over_ky' => ['Transient Electrostatic Heat Amplification', "", 1],
|
|
33
34
|
'transient_amplification_over_kx' => ['Transient Amplification', "", 1],
|
|
@@ -521,6 +522,23 @@ module GraphKits
|
|
|
521
522
|
end
|
|
522
523
|
end
|
|
523
524
|
|
|
525
|
+
def frequency_vs_ky_graphkit(options={})
|
|
526
|
+
case options[:command]
|
|
527
|
+
when :help
|
|
528
|
+
return "Frequencies vs ky. "
|
|
529
|
+
when :options
|
|
530
|
+
return []
|
|
531
|
+
else
|
|
532
|
+
raise "Frequencies are not available in non-linear mode" if @nonlinear_mode == "on"
|
|
533
|
+
kxy = options[:kxy]
|
|
534
|
+
kit = GraphKit.autocreate({x: axiskit('ky', options), y: axiskit("frequency_over_ky", options)})
|
|
535
|
+
kit.title = "Frequencies vs ky"
|
|
536
|
+
kit.data[0].gp.with = "lp"
|
|
537
|
+
kit.data[0].gp.title = @run_name
|
|
538
|
+
kit.file_name = options[:graphkit_name]
|
|
539
|
+
kit
|
|
540
|
+
end
|
|
541
|
+
end
|
|
524
542
|
def hflux_tot_vs_time_graphkit(options={})
|
|
525
543
|
case options[:command]
|
|
526
544
|
when :help
|
data/lib/gs2crmod/gs2.rb
CHANGED
data/lib/gs2crmod/gsl_data.rb
CHANGED
|
@@ -322,6 +322,12 @@ module GSLVectors
|
|
|
322
322
|
end
|
|
323
323
|
private :growth_rate_over_kxy_gsl_vector
|
|
324
324
|
|
|
325
|
+
# Frequency, indexed over ky, taken direct from the gs2 output file
|
|
326
|
+
def frequency_over_ky_gsl_vector(options)
|
|
327
|
+
options.convert_to_index(self, :kx)
|
|
328
|
+
return GSL::Vector.alloc(gsl_vector('ky').to_a.map{|ky| frequency_at_ky_at_kx[ky].values[options[:kx_index]-1]})
|
|
329
|
+
end
|
|
330
|
+
|
|
325
331
|
def es_heat_by_kx_over_time_gsl_vector(options)
|
|
326
332
|
options[:direction] = :kx
|
|
327
333
|
es_heat_by_kxy_over_time_gsl_vector(options)
|
data/test/cyclone_low_res.tgz
CHANGED
|
Binary file
|
data/test/test_gs2crmod.rb
CHANGED
|
@@ -36,7 +36,7 @@ if ENV['GS2_EXEC']
|
|
|
36
36
|
FileUtils.rm_r(tfolder)
|
|
37
37
|
end
|
|
38
38
|
def test_submission
|
|
39
|
-
CodeRunner.submit(C: 'gs2', X: ENV['GS2_EXEC'], D: 'test_gs2crmod', n: '1', Y: tfolder, p: '{write_moments: ".true."}')
|
|
39
|
+
CodeRunner.submit(C: 'gs2', X: ENV['GS2_EXEC'], D: 'test_gs2crmod', n: '1', Y: tfolder, p: '{write_moments: ".true.", write_line: ".true."}')
|
|
40
40
|
CodeRunner.status(Y: tfolder)
|
|
41
41
|
end
|
|
42
42
|
end
|
|
@@ -55,6 +55,10 @@ class TestAnalysis < Test::Unit::TestCase
|
|
|
55
55
|
assert_equal(0.13066732664774272, @runner.run_list[1].max_growth_rate)
|
|
56
56
|
assert_equal(0.13066732664774272, @runner.run_list[1].growth_rate_at_ky[0.5])
|
|
57
57
|
assert_equal(:Complete, @runner.run_list[1].status)
|
|
58
|
+
p @run.frequency_at_ky_at_kx, @run.gsl_vector('kx')[1]
|
|
59
|
+
assert_equal(6.6036e-01, @run.frequency_at_ky_at_kx[0.5][2.5133])
|
|
60
|
+
#p @run.gsl_vector('kx'); STDIN.gets
|
|
61
|
+
assert_equal(6.6036e-01, @run.frequency_at_ky_at_kx[0.5][@run.gsl_vector('kx')[3]])
|
|
58
62
|
end
|
|
59
63
|
def test_interpolation
|
|
60
64
|
assert_equal(5, @run.gsl_vector('kx').size)
|
|
@@ -94,13 +98,16 @@ class TestAnalysis < Test::Unit::TestCase
|
|
|
94
98
|
assert_equal(51, kit.data[0].y.data.size)
|
|
95
99
|
assert_equal(@runner.run_list[1].netcdf_file.var('phi2_by_ky').get('start' => [1,4], 'end' => [1,4]).to_a[0][0], kit.data[0].y.data[4])
|
|
96
100
|
|
|
97
|
-
|
|
101
|
+
kit = @run.graphkit('tpar2_by_mode_vs_time', {ky_index:2, kx_index:1, species_index:1})
|
|
98
102
|
#kit.gnuplot
|
|
99
103
|
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
104
|
|
|
101
|
-
|
|
105
|
+
kit = @run.graphkit('tperp2_by_mode_vs_time', {ky_index:2, kx_index:1, species_index:1})
|
|
102
106
|
#kit.gnuplot
|
|
103
107
|
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])
|
|
108
|
+
kit = @run.graphkit('frequency_vs_ky', {kx_index:1})
|
|
109
|
+
assert_equal(@run.frequency_at_ky_at_kx[0.5][0.0], kit.data[0].y.data[1])
|
|
110
|
+
#kit.gnuplot
|
|
104
111
|
end
|
|
105
112
|
def test_3d_graphs
|
|
106
113
|
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.7
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2013-08-
|
|
13
|
+
date: 2013-08-15 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: coderunner
|