gs2crmod 0.9.9 → 0.9.10
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 +18 -25
- data/lib/gs2crmod/gs2.rb +5 -1
- data/lib/gs2crmod/gsl_data.rb +18 -2
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.10
|
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.10"
|
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-16"
|
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"]
|
@@ -249,14 +249,9 @@ end
|
|
249
249
|
|
250
250
|
alias :csti :calculate_saturation_time_index
|
251
251
|
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
logf(:calculate_growth_rates_and_frequencies)
|
256
|
-
logd
|
257
|
-
|
258
|
-
# get_list_of(:ky, :kx)
|
259
|
-
@growth_rates= FloatHash.new
|
252
|
+
#Actually, this doesn't calculate the frequencies but reads them from run_name.out. Requires write_line to be .true.
|
253
|
+
#
|
254
|
+
def calculate_frequencies
|
260
255
|
@real_frequencies = FloatHash.new
|
261
256
|
gs2_out = FileUtils.tail(@run_name + ".out", list(:ky).size*list(:kx).size)
|
262
257
|
# a = gs2_out.split("\n")
|
@@ -265,19 +260,6 @@ def calculate_growth_rates_and_frequencies
|
|
265
260
|
# eputs final_timestep_list
|
266
261
|
f = LongRegexen::FLOAT.verbatim
|
267
262
|
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
|
-
## 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
|
-
|
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
263
|
@frequency_at_ky_at_kx||= FloatHash.new
|
282
264
|
ky_values = []
|
283
265
|
regex = Regexp.new( "^.*aky=\\s*(?<aky>#{f})\s*akx=\\s*(?<akx>#{f}).*omav=\\s*(?<re>#{f})\\s*(?<gr>#{f})")
|
@@ -288,16 +270,27 @@ def calculate_growth_rates_and_frequencies
|
|
288
270
|
ky_values.push aky
|
289
271
|
@frequency_at_ky_at_kx[aky][akx] = eval($~[:re])
|
290
272
|
end
|
273
|
+
end
|
274
|
+
def calculate_growth_rates_and_frequencies
|
275
|
+
return if @grid_option == "single" and @aky == 0.0 # no meaningful results
|
276
|
+
Dir.chdir(@directory) do
|
277
|
+
logf(:calculate_growth_rates_and_frequencies)
|
278
|
+
logd
|
279
|
+
|
280
|
+
calculate_frequencies
|
281
|
+
|
282
|
+
# get_list_of(:ky, :kx)
|
283
|
+
@growth_rates= FloatHash.new
|
291
284
|
#raise CRFatal.new("Unknown value of ky read from output file: #{data[:aky].to_f}. Not in list:\n#{list(:ky).values.inspect}")
|
292
285
|
# pp @ky_list
|
293
286
|
|
294
287
|
# With zero magnetic shear, calculate growth rates for both kx and ky
|
295
|
-
if @shat and @shat.abs < 1.0e-5 and @nx and @nx > 1
|
288
|
+
#if @shat and @shat.abs < 1.0e-5 and @nx and @nx > 1
|
296
289
|
to_calc = [:kx, :ky]
|
297
290
|
@growth_rate_at_kx ||= FloatHash.new
|
298
|
-
else
|
299
|
-
to_calc = [:ky]
|
300
|
-
end
|
291
|
+
#else
|
292
|
+
#to_calc = [:ky]
|
293
|
+
#end
|
301
294
|
|
302
295
|
@growth_rate_at_ky ||= FloatHash.new
|
303
296
|
eputs
|
data/lib/gs2crmod/gs2.rb
CHANGED
@@ -64,6 +64,10 @@ def spectrogk?
|
|
64
64
|
false
|
65
65
|
end
|
66
66
|
|
67
|
+
def gryfx?
|
68
|
+
false
|
69
|
+
end
|
70
|
+
|
67
71
|
CODE_SCRIPT_FOLDER = MODULE_FOLDER = File.dirname(File.expand_path(__FILE__))
|
68
72
|
|
69
73
|
# Include the other files
|
@@ -314,7 +318,7 @@ def generate_phantom_runs
|
|
314
318
|
# log('@runner.class', @runner.class)
|
315
319
|
# @runner.add_phantom_run(phantom_run)
|
316
320
|
end
|
317
|
-
elsif @scan_type and @scan_type != "none"
|
321
|
+
elsif (not gryfx?) and @scan_type and @scan_type != "none"
|
318
322
|
t = gsl_vector('t')
|
319
323
|
scan_vals = gsl_vector('scan_parameter_value')
|
320
324
|
current = scan_vals[0]
|
data/lib/gs2crmod/gsl_data.rb
CHANGED
@@ -41,9 +41,16 @@ def netcdf_file
|
|
41
41
|
ncclose
|
42
42
|
end
|
43
43
|
cache[:netcdf_file_otime] = Time.now.to_i
|
44
|
-
cache[:netcdf_file] ||= NumRu::NetCDF.open(
|
44
|
+
cache[:netcdf_file] ||= NumRu::NetCDF.open(netcdf_filename)
|
45
|
+
cache[:netcdf_file].sync
|
46
|
+
cache[:netcdf_file]
|
45
47
|
end
|
46
48
|
|
49
|
+
def netcdf_filename
|
50
|
+
@directory + '/' + @run_name + '.out.nc'
|
51
|
+
end
|
52
|
+
|
53
|
+
|
47
54
|
def ncclose
|
48
55
|
cache[:netcdf_file].close
|
49
56
|
cache.delete(:netcdf_file)
|
@@ -518,7 +525,7 @@ module GSLVectors
|
|
518
525
|
options.convert_to_index(self, :ky, :kx)
|
519
526
|
nkx = netcdf_file.var('kx').dims[0].length
|
520
527
|
# p nkx
|
521
|
-
stride = @jtwist * (options[:ky_index]
|
528
|
+
stride = @jtwist * (options[:ky_index] )
|
522
529
|
#stride = 3
|
523
530
|
nlinks = [(nkx / stride).floor, 1].max
|
524
531
|
theta0 = options[:kx_index] % @jtwist #(options[:theta0] || 0)
|
@@ -651,6 +658,15 @@ module GSLVectors
|
|
651
658
|
# ep thetas
|
652
659
|
#eputs "End theta_along_field_line"
|
653
660
|
return thetas if agk? or (@s_hat_input or @shat).abs < 1.0e-5
|
661
|
+
if gryfx?
|
662
|
+
theta_list = ((1..kx_elements.size).to_a.map do |i|
|
663
|
+
thetas * i
|
664
|
+
end)
|
665
|
+
thetas = theta_list.inject{|o,n| o.connect(n)}
|
666
|
+
thetas -= Math::PI*(kx_elements.size-1)
|
667
|
+
return thetas
|
668
|
+
|
669
|
+
end
|
654
670
|
theta_list = (kx_elements.map do |element|
|
655
671
|
|
656
672
|
kx = list(:kx)[(element + 1).to_i]
|
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.10
|
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-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: coderunner
|