gs2crmod 0.11.55 → 0.11.56

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.11.55
1
+ 0.11.56
data/gs2crmod.gemspec CHANGED
@@ -2,17 +2,14 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: gs2crmod 0.11.55 ruby lib
6
- # stub: ext/extconf.rb
7
5
 
8
6
  Gem::Specification.new do |s|
9
7
  s.name = "gs2crmod"
10
- s.version = "0.11.55"
8
+ s.version = "0.11.56"
11
9
 
12
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
13
- s.require_paths = ["lib"]
14
11
  s.authors = ["Edmund Highcock", "Ferdinand van Wyk"]
15
- s.date = "2014-07-22"
12
+ s.date = "2014-07-25"
16
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."
17
14
  s.email = "edmundhighcock@sourceforge.net"
18
15
  s.extensions = ["ext/extconf.rb"]
@@ -78,12 +75,13 @@ Gem::Specification.new do |s|
78
75
  ]
79
76
  s.homepage = "http://gs2crmod.sourceforge.net"
80
77
  s.licenses = ["GSLv3"]
78
+ s.require_paths = ["lib"]
81
79
  s.required_ruby_version = Gem::Requirement.new(">= 1.9.1")
82
- s.rubygems_version = "2.2.2"
80
+ s.rubygems_version = "1.8.11"
83
81
  s.summary = "Module to allow CodeRunner to run and analyse the GS2 and AstroGK codes."
84
82
 
85
83
  if s.respond_to? :specification_version then
86
- s.specification_version = 4
84
+ s.specification_version = 3
87
85
 
88
86
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
89
87
  s.add_runtime_dependency(%q<coderunner>, [">= 0.14.15"])
@@ -129,8 +129,6 @@ def ingen
129
129
 
130
130
  warning("You have set both ny and naky; naky will override ny.") if @ny and @naky
131
131
 
132
- error("Boundary options should not be periodic with finite magnetic shear") if @boundary_option == "periodic" and ((@s_hat_input and @s_hat_input.abs > 1.0e-6) or (@shat and @shat.abs > 1.0e-6))
133
-
134
132
  error("abs(shat) should not be less that 1.0e-6") if @shat and @shat.abs < 1.0e-6 and not agk?
135
133
  error("abs(s_hat_input) should not be less that 1.0e-6") if @s_hat_input and @s_hat_input.abs < 1.0e-6 and not agk?
136
134
 
@@ -147,6 +145,13 @@ def ingen
147
145
 
148
146
  # nakx
149
147
  warning("You have set both nx and ntheta0; ntheta0 will override nx.") if @nx and @ntheta0
148
+
149
+ warning("Do you have a reason for setting equal_arc = true (default)? If not set false.") if !@equal_arc or @equal_arc.fortran_true?
150
+
151
+ warning("Recommend nperiod > 1 for linear runs.") if @nonlinear_mode == "off" and (!@nperiod or @nperiod == 1)
152
+ warning("Recommend nperiod = 1 for nonlinear runs.") if @nonlinear_mode == "on" and (@nperiod > 1)
153
+
154
+ warning("Look into using field_option = local and associated optimizations.") if @field_option and @field_option == "implicit"
150
155
 
151
156
  #################################
152
157
  # Parallelisation/Layout Errors #
@@ -175,6 +180,8 @@ def ingen
175
180
 
176
181
  error("ginit_option is 'many' but is_a_restart is false") if @ginit_option == "many" and not @is_a_restart
177
182
 
183
+ error("chop_side should not be used (remove test if default changes from T to F)") if !@chop_side or @chop_side.fortran_true?
184
+
178
185
  #####################
179
186
  # Diagnostic errors #
180
187
  #####################
@@ -218,11 +225,16 @@ def ingen
218
225
 
219
226
  warning("The system will abort with rapid timestep changes...") if !@abort_rapid_time_step_change or @abort_rapid_time_step_change.fortran_true?
220
227
 
228
+ warning("local_field_solve is an old variable that should not really be used.") if @local_field_solve and @local_field_solve.fortran_true?
229
+
221
230
  #############################
222
231
  # Boundary Condition Errors #
223
232
  #############################
224
233
 
225
- warning("The correct BC is not being implemented. Preferably specify nonad_zero = true in input file.") if (not (@nonad_zero and @nonad_zero.fortran_true?) and not agk?)
234
+ error("Boundary options should be linked with finite magnetic shear.") if (!@boundary_option or @boundary_option != "linked") and ((@s_hat_input and @s_hat_input.abs > 1.0e-6) or (@shat and @shat.abs > 1.0e-6))
235
+
236
+ error("Set nonad_zero = true.") if @nonad_zero and not @nonad_zero.fortran_true?
237
+
226
238
 
227
239
  ###################
228
240
  # Spectrogk tests #
@@ -238,15 +250,30 @@ def ingen
238
250
  # Damping Rate #
239
251
  ################
240
252
 
241
- warning("Recommend that const_amp = TRUE for linear runs.") if @nonlinear_mode == "off" and (!@const_amp or @const_amp.fortran_false?)
253
+ error("Linear runs with hyperviscosity are NOT recommended!") if @nonlinear_mode="off" and (@hyper_option and @hyper_option=="visc_only") and (@d_hypervisc and @d_hypervisc!=0)
242
254
 
243
- ##################
244
- # Geometry Errors
245
- # ###############
246
-
255
+ warning("Amplitude dependent part of hyperviscosity being ignored since const_amp = true") if (@hyper_option and @hyper_option=="visc_only") and (@d_hypervisc and @d_hypervisc!=0)
256
+
257
+ ###################
258
+ # Geometry Errors #
259
+ ###################
247
260
 
248
261
  error("You must set bishop = 4 for Miller(local) geometry. Remember also that s_hat_input will override shat") if (@bishop!=4 and (@local_eq and @local_eq.fortran_true?))
249
262
 
263
+ error("Shift should be > 0 for s-alpha equilibrium.") if @equilibrium_option=="s-alpha" and (@shift and @shift < 0)
264
+ error("Shift should be < 0 for Miller equilibrium.") if @equilibrium_option=="eik" and @local_eq.fortran_true? and (@shift and @shift > 0)
265
+
266
+ error("irho must be 2 for Miller equilibrium.") if @equilibrium_option=="eik" and @local_eq.fortran_true? and (@irho and @irho!=2)
267
+
268
+ warning("Note that shat != s_hat_input") if @shat and @s_hat_input and @shat!=@s_hat_input
269
+
270
+ ##################
271
+ # Species Errors #
272
+ ##################
273
+
274
+ error("Must set z = -1 for electron species.") if (@type_2 and @z_2 and @type_2=='electron' and @z_2 != -1)
275
+
276
+
250
277
  end
251
278
 
252
279
  # A hash which gives the actual numbers of gridpoints indexed by their corresponding letters in the layout string.
@@ -1043,7 +1043,7 @@
1043
1043
  :should_include=>"true",
1044
1044
  :description=>nil,
1045
1045
  :tests=>["Tst::FORTRAN_BOOL"],
1046
- :autoscanned_defaults=>[".false.", ".true."],
1046
+ :autoscanned_defaults=>[".true."],
1047
1047
  :must_pass=>
1048
1048
  [{:test=>"kind_of? String and FORTRAN_BOOLS.include? self",
1049
1049
  :explanation=>
@@ -1808,8 +1808,8 @@
1808
1808
  :autoscanned_defaults=>[".false."]},
1809
1809
  :opt_source=>
1810
1810
  {:should_include=>"true",
1811
- :description=>"",
1812
- :help=>"",
1811
+ :description=>"If true then use an optimised linear source calculation which uses pre-calculated coefficients.",
1812
+ :help=>"If true then use an optimised linear source calculation which uses pre-calculated coefficients, calculates both sigma together and skips work associated with empty fields. Can contribute 10-25% savings for linear electrostatic collisionless simulations. For more complicated runs the savings will likely be less. If enabled memory usage will increase due to using an additional array of size 2-4 times gnew. Can potentially slow down certain runs.",
1813
1813
  :code_name=>:opt_source,
1814
1814
  :must_pass=>
1815
1815
  [{:test=>"kind_of? String and FORTRAN_BOOLS.include? self",
@@ -2406,7 +2406,7 @@
2406
2406
  :autoscanned_defaults=>[".false."]},
2407
2407
  :opt_local_copy=>
2408
2408
  {:should_include=>"true",
2409
- :description=>"A recent optimisation ..please add better help!",
2409
+ :description=>"Setting to .true. enables optimising redistribute code, used in FFTs for evaluating nonlinear terms, that avoids indirect addressing.",
2410
2410
  :help=>
2411
2411
  "Setting to .true. enables optimising redistribute code, used in FFTs for evaluating nonlinear terms, that avoids indirect addressing. \nThis can introduces worthwhile savings in nonlinear GS2 simulations at lower core counts. \n* [http://www.gyrokinetics.sourceforge.net/wikifiles/CMR/GS2_Final_report_NAG_Version_v1.0.pdf See Adrian Jackson's DCSE report \"Improved Data Distribution Routines for Gyrokinetic Plasma Simulations\"]\n",
2412
2412
  :code_name=>:opt_local_copy,
@@ -2418,8 +2418,8 @@
2418
2418
  :autoscanned_defaults=>[".false."]},
2419
2419
  :opt_redist_persist=>
2420
2420
  {:should_include=>"true",
2421
- :description=>"",
2422
- :help=>"",
2421
+ :description=>"Set to true to use persistent (non-blocking) comms in the redistribute routines.",
2422
+ :help=>"Set to true to use persistent (non-blocking) comms in the redistribute routines. \n* Must also set opt_redist_nbk=.true. \n* Can help improve scaling efficiency at large core counts, but can cause slow down at low core counts.",
2423
2423
  :code_name=>:opt_redist_persist,
2424
2424
  :must_pass=>
2425
2425
  [{:test=>"kind_of? String and FORTRAN_BOOLS.include? self",
@@ -2429,8 +2429,8 @@
2429
2429
  :autoscanned_defaults=>[".false."]},
2430
2430
  :opt_redist_persist_overlap=>
2431
2431
  {:should_include=>"true",
2432
- :description=>"",
2433
- :help=>"",
2432
+ :description=>"Set to true to try to overlap the mpi and local parts of the gather/scatter routines.",
2433
+ :help=>"Set to true to try to overlap the mpi and local parts of the gather/scatter routines. \n* Should only be used with opt_redist_persist=.true. \n* See Optimising your runs for more details.",
2434
2434
  :code_name=>:opt_redist_persist_overlap,
2435
2435
  :must_pass=>
2436
2436
  [{:test=>"kind_of? String and FORTRAN_BOOLS.include? self",
@@ -2775,7 +2775,7 @@
2775
2775
  :module=>:hyper},
2776
2776
  :const_amp=>
2777
2777
  {:help=>
2778
- "Determines whether hyperviscosity includes time dependent amplitude factor when calculating damping rate. Recommend TRUE for linear runs and FALSE for nolinear runs, since amplutide of turbulence grows linearly with time in linear run.",
2778
+ "Determines whether hyperviscosity includes time dependent amplitude factor when calculating damping rate. Not recommended for linear runs.",
2779
2779
  :should_include=>"true",
2780
2780
  :description=>
2781
2781
  "Detrmines whether damping rate depends on amplitude variations. Recommend FALSE for nonlinear, TRUE for linear.",
@@ -2842,9 +2842,9 @@
2842
2842
  :code_name=>:nexp,
2843
2843
  :module=>:hyper},
2844
2844
  :d_hypervisc=>
2845
- {:help=>nil,
2845
+ {:help=>"Sets hyperviscosity parameter multiplying damping term. See Belli (2006) thesis for more information.",
2846
2846
  :should_include=>"true",
2847
- :description=>nil,
2847
+ :description=>"Sets hyperviscosity parameter multiplying damping term. See Belli (2006) thesis for more information.",
2848
2848
  :tests=>["Tst::FLOAT"],
2849
2849
  :autoscanned_defaults=>[],
2850
2850
  :must_pass=>
@@ -3496,9 +3496,10 @@
3496
3496
  :tests=>["Tst::STRING"],
3497
3497
  :autoscanned_defaults=>[".true."],
3498
3498
  :must_pass=>
3499
- [{:test=>"kind_of? String",
3500
- :explanation=>"This variable must be a string."}],
3501
- :type=>:String},
3499
+ [{:test=>"kind_of? String and FORTRAN_BOOLS.include? self",
3500
+ :explanation=>
3501
+ "This variable must be a fortran boolean. (In Ruby this is represented as a string: e.g. '.true.')"}],
3502
+ :type=>:Fortran_Bool},
3502
3503
  :width0=>
3503
3504
  {:help=>
3504
3505
  "Initial perturbation has Gaussian envelope in theta, with width width0",
@@ -1,4 +1,4 @@
1
- # This module reads data from the new diagnostics output file
1
+ # This module reads data from the new diagnostics output file
2
2
  # <run_name>.cdf.
3
3
  #
4
4
  # It is intended to replace a lot of the function of gsl_data.rb
@@ -11,26 +11,26 @@ class CodeRunner::Gs2
11
11
  module ReadNetcdf
12
12
 
13
13
  def new_netcdf_file
14
- if (open = @runner.run_list.keys.find_all{|id| @runner.run_list[id].cache[:new_netcdf_file]}).size > 200
15
- open = open.sort_by{|id| @runner.run_list[id].cache[:new_netcdf_file_otime]}
16
- @runner.run_list[open[0]].new_ncclose
17
- end
14
+ if (open = @runner.run_list.keys.find_all{|id| @runner.run_list[id].cache[:new_netcdf_file]}).size > 200
15
+ open = open.sort_by{|id| @runner.run_list[id].cache[:new_netcdf_file_otime]}
16
+ @runner.run_list[open[0]].new_ncclose
17
+ end
18
18
 
19
- if cache[:new_netcdf_file] and not [:Complete, :Failed].include? @status
20
- new_ncclose
21
- end
22
- cache[:new_netcdf_file_otime] = Time.now.to_i
23
- cache[:new_netcdf_file] ||= NumRu::NetCDF.open(new_netcdf_filename)
24
- cache[:new_netcdf_file].sync
25
- cache[:new_netcdf_file]
19
+ if cache[:new_netcdf_file] and not [:Complete, :Failed].include? @status
20
+ new_ncclose
21
+ end
22
+ cache[:new_netcdf_file_otime] = Time.now.to_i
23
+ cache[:new_netcdf_file] ||= NumRu::NetCDF.open(new_netcdf_filename)
24
+ cache[:new_netcdf_file].sync
25
+ cache[:new_netcdf_file]
26
26
  end
27
27
 
28
28
  def new_netcdf_filename
29
- @directory + '/' + @run_name + '.cdf'
29
+ @directory + '/' + @run_name + '.cdf'
30
30
  end
31
31
  def new_ncclose
32
- cache[:new_netcdf_file].close
33
- cache.delete(:new_netcdf_file)
32
+ cache[:new_netcdf_file].close
33
+ cache.delete(:new_netcdf_file)
34
34
  end
35
35
 
36
36
 
@@ -38,159 +38,159 @@ end #module ReadNetcdf
38
38
  include ReadNetcdf
39
39
 
40
40
  class NetcdfSmartReader
41
- def initialize(file)
42
- @file = file
43
- end
44
- def dimensions(varname)
45
- #p 'varname', varname
46
- @file.var(varname).dims
47
- end
48
- def read_variable(varname, options)
49
- #start = get_start(dims, options)
50
- if varname == 's' # dummy response for species index
51
- return NArray.float(@nspec||1)
52
- end
53
- dims = dimensions(varname)
54
- narray = @file.var(varname).get('start'=>starts(dims, options), 'end'=>ends(dims, options))
55
- if options[:modify_variable]
56
- hsh = dims.inject({}){|hsh, dim|
57
- opts = options.dup
58
- opts[:modify_variable] = nil
59
- dimval = read_variable(dimension_variable_name(dim.name), opts)
60
- hsh[dim.name] = dimval
61
- hsh
62
- }
63
- narray = options[:modify_variable].call(varname, narray, hsh)
64
- end
65
- shape = narray.shape
66
- shape.delete_if{|i| i==1}
67
- #p 'shape', shape; STDIN.gets
68
- narray.reshape!(*shape)
69
- narray
41
+ def initialize(file)
42
+ @file = file
43
+ end
44
+ def dimensions(varname)
45
+ #p 'varname', varname
46
+ @file.var(varname).dims
47
+ end
48
+ def read_variable(varname, options)
49
+ #start = get_start(dims, options)
50
+ if varname == 's' # dummy response for species index
51
+ return NArray.float(@nspec||1)
52
+ end
53
+ dims = dimensions(varname)
54
+ narray = @file.var(varname).get('start'=>starts(dims, options), 'end'=>ends(dims, options))
55
+ if options[:modify_variable]
56
+ myhsh = dims.inject({}){|hsh, dim|
57
+ opts = options.dup
58
+ opts[:modify_variable] = nil
59
+ dimval = read_variable(dimension_variable_name(dim.name), opts)
60
+ hsh[dim.name] = dimval
61
+ hsh
62
+ }
63
+ narray = options[:modify_variable].call(varname, narray, myhsh)
64
+ end
65
+ shape = narray.shape
66
+ shape.delete_if{|i| i==1}
67
+ #p 'shape', shape; STDIN.gets
68
+ narray.reshape!(*shape)
69
+ narray
70
70
 
71
- end
72
- def starts(dims, options)
73
- dims.map{|d| dim_start(d.name, options)}
74
- end
75
- def dim_start(name, options)
76
- sym = name.to_sym
77
- if i=options[sym + :_index]
78
- return i-1
79
- elsif i=options[sym + :_element]
80
- return i
81
- elsif i=options[sym + :min]
82
- return i
83
- else
84
- return 0
85
- end
86
- end
87
- def ends(dims, options)
88
- dims.map{|d| dim_end(d.name, options)}
89
- end
90
- def dim_end(name, options)
91
- sym = name.to_sym
92
- if i=options[sym + :_index]
93
- return i-1
94
- elsif i=options[sym + :_element]
95
- return i
96
- elsif i=options[sym + :max]
97
- return i
98
- else
99
- return -1
100
- end
101
- end
71
+ end
72
+ def starts(dims, options)
73
+ dims.map{|d| dim_start(d.name, options)}
74
+ end
75
+ def dim_start(name, options)
76
+ sym = name.to_sym
77
+ if i=options[sym + :_index]
78
+ return i-1
79
+ elsif i=options[sym + :_element]
80
+ return i
81
+ elsif i=options[sym + :min]
82
+ return i
83
+ else
84
+ return 0
85
+ end
86
+ end
87
+ def ends(dims, options)
88
+ dims.map{|d| dim_end(d.name, options)}
89
+ end
90
+ def dim_end(name, options)
91
+ sym = name.to_sym
92
+ if i=options[sym + :_index]
93
+ return i-1
94
+ elsif i=options[sym + :_element]
95
+ return i
96
+ elsif i=options[sym + :max]
97
+ return i
98
+ else
99
+ return -1
100
+ end
101
+ end
102
102
 
103
- def axiskit(variable, options)
104
- GraphKit::AxisKit.autocreate(data: read_variable(variable, options), units: @file.var(variable).att('Units').get, title: @file.var(variable).att('Description').get.sub(/(,|summed|average).*$/, '').sub(/[vV]alues of (the )?/, '').sub(/ coordinate/, ''))
105
- end
106
- def dimension_variable_name(n)
107
- case n
108
- when 'X'
109
- 'kx'
110
- when 'Y'
111
- 'ky'
112
- when 'z'
113
- 'kz'
114
- when 'e'
115
- 'energy'
116
- when 'l'
117
- 'lambda'
118
- when 't'
119
- n
120
- when 'm'
121
- 'hermite'
122
- when 'p'
123
- 'hankel'
124
- when 's'
125
- 's'
126
- else
127
- raise "Unknown dimension #{n}"
128
- end
129
- end
130
- def check_no_r(non_flat_dims)
131
- raise "Please specify the r index for real or imaginary" if non_flat_dims.include? @file.dim('r')
132
- end
133
- def graphkit(variable, options)
134
- non_flat_dims=dimensions(variable).find_all{|dim| dim_start(dim.name, options) != dim_end(dim.name, options) and dim.length != 1}
135
- check_no_r(non_flat_dims)
136
- axiskits = non_flat_dims.map{|dim| dimvar = dimension_variable_name(dim.name); axiskit(dimvar, options)} + [axiskit(variable, options)]
137
- hash = {}
138
- axes = [:x, :y, :z, :f]
139
- axiskits.each_with_index{|ax, i| hash[axes[i]] = ax}
140
- kit = GraphKit.autocreate(hash)
141
- opts = options.dup
142
- opts.delete(:modify_variable)
143
- opts.delete(:graphkit_name)
144
- #kit.data[0].title += " with options: " + opts.to_s
145
- kit.data[0].title += " " + opts.to_s.gsub(/_(index|element)/, '')
146
- if kit.zlabel
147
- kit.zlabel = "'#{kit.zlabel}' rotate by 90"
148
- #kit.zlabel = nil
149
- end
150
- kit
151
- end
103
+ def axiskit(variable, options)
104
+ GraphKit::AxisKit.autocreate(data: read_variable(variable, options), units: @file.var(variable).att('Units').get, title: @file.var(variable).att('Description').get.sub(/(,|summed|average).*$/, '').sub(/[vV]alues of (the )?/, '').sub(/ coordinate/, ''))
105
+ end
106
+ def dimension_variable_name(n)
107
+ case n
108
+ when 'X'
109
+ 'kx'
110
+ when 'Y'
111
+ 'ky'
112
+ when 'z'
113
+ 'kz'
114
+ when 'e'
115
+ 'energy'
116
+ when 'l'
117
+ 'lambda'
118
+ when 't'
119
+ n
120
+ when 'm'
121
+ 'hermite'
122
+ when 'p'
123
+ 'hankel'
124
+ when 's'
125
+ 's'
126
+ else
127
+ raise "Unknown dimension #{n}"
128
+ end
129
+ end
130
+ def check_no_r(non_flat_dims)
131
+ raise "Please specify the r index for real or imaginary" if non_flat_dims.include? @file.dim('r')
132
+ end
133
+ def graphkit(variable, options)
134
+ non_flat_dims=dimensions(variable).find_all{|dim| dim_start(dim.name, options) != dim_end(dim.name, options) and dim.length != 1}
135
+ check_no_r(non_flat_dims)
136
+ axiskits = non_flat_dims.map{|dim| dimvar = dimension_variable_name(dim.name); axiskit(dimvar, options)} + [axiskit(variable, options)]
137
+ hash = {}
138
+ axes = [:x, :y, :z, :f]
139
+ axiskits.each_with_index{|ax, i| hash[axes[i]] = ax}
140
+ kit = GraphKit.autocreate(hash)
141
+ opts = options.dup
142
+ opts.delete(:modify_variable)
143
+ opts.delete(:graphkit_name)
144
+ #kit.data[0].title += " with options: " + opts.to_s
145
+ kit.data[0].title += " " + opts.to_s.gsub(/_(index|element)/, '')
146
+ if kit.zlabel
147
+ kit.zlabel = "'#{kit.zlabel}' rotate by 90"
148
+ #kit.zlabel = nil
149
+ end
150
+ kit
151
+ end
152
152
  end # class NetcdfSmartReader
153
153
 
154
154
  class OldNetcdfSmartReader < NetcdfSmartReader
155
- def dimension_variable_name(n)
156
- if (dimnames = @file.dims.map{|dim| dim.name}).include? n
157
- #p ['dimnames', dimnames, n]
158
- n
159
- else
160
- raise "Unknown dimension #{r}: dimensions are: #{dimnames}"
161
- end
162
- end
163
- def check_no_r(non_flat_dims)
164
- raise "Please specify the ri index for real or imaginary" if non_flat_dims.include? @file.dim('ri')
165
- end
166
- def axiskit(variable, options)
167
- GraphKit::AxisKit.autocreate(data: read_variable(variable, options), title: variable)
168
- end
155
+ def dimension_variable_name(n)
156
+ if (dimnames = @file.dims.map{|dim| dim.name}).include? n
157
+ #p ['dimnames', dimnames, n]
158
+ n
159
+ else
160
+ raise "Unknown dimension #{r}: dimensions are: #{dimnames}"
161
+ end
162
+ end
163
+ def check_no_r(non_flat_dims)
164
+ raise "Please specify the ri index for real or imaginary" if non_flat_dims.include? @file.dim('ri')
165
+ end
166
+ def axiskit(variable, options)
167
+ GraphKit::AxisKit.autocreate(data: read_variable(variable, options), title: variable)
168
+ end
169
169
  end
170
170
 
171
171
  def netcdf_smart_reader
172
- NetcdfSmartReader.new(new_netcdf_file)
172
+ NetcdfSmartReader.new(new_netcdf_file)
173
173
  end
174
174
 
175
175
  def smart_graphkit(options)
176
- case options[:command]
177
- when :help
178
- "A smart graphkit is a direct plot of a given variable from the new netcdf file. The name of the graphkit is the name of the variable prefixed by 'cdf_'. To plot, for example, the heat flux vs time, you would give the graph name cdf_heat_flux_tot. You can use index specifiers in the the options; for example, to plot the potential as a function of kx and ky for a given time index, you would use the graph name cdf_phi2_by_mode, and the options {t_index: n}. To plot the potential as function of kx for a given ky and time would use the options {t_index, n, Y_index: m}. For each dimension you can specify the index, or a minium and/or maximum."
179
- when :options
180
- [:X_index, :Y_index, :t_index, :e_index, :l_index, :s_index, :Xmax, :Xmin, :X_element]
181
- else
182
- netcdf_smart_reader.graphkit(options[:graphkit_name].sub(/^cdf_/, ''), options)
183
- end
176
+ case options[:command]
177
+ when :help
178
+ "A smart graphkit is a direct plot of a given variable from the new netcdf file. The name of the graphkit is the name of the variable prefixed by 'cdf_'. To plot, for example, the heat flux vs time, you would give the graph name cdf_heat_flux_tot. You can use index specifiers in the the options; for example, to plot the potential as a function of kx and ky for a given time index, you would use the graph name cdf_phi2_by_mode, and the options {t_index: n}. To plot the potential as function of kx for a given ky and time would use the options {t_index, n, Y_index: m}. For each dimension you can specify the index, or a minium and/or maximum."
179
+ when :options
180
+ [:X_index, :Y_index, :t_index, :e_index, :l_index, :s_index, :Xmax, :Xmin, :X_element]
181
+ else
182
+ netcdf_smart_reader.graphkit(options[:graphkit_name].sub(/^cdf_/, ''), options)
183
+ end
184
184
  end
185
185
  def old_smart_graphkit(options)
186
- case options[:command]
187
- when :help
188
- "An old smart graphkit is a direct plot of a given variable from the old netcdf file. The name of the graphkit is the name of the variable prefixed by 'nc_'. To plot, for example, the heat flux vs time, you would give the graph name nc_hflux_tot. You can use index specifiers in the the options; for example, to plot the potential as a function of kx and ky for a given time index, you would use the graph name nc_phi2_by_mode, and the options {t_index: n}. To plot the potential as function of kx for a given ky and time would use the options {t_index, n, ky_index: m}. For each dimension you can specify the index, or a minium and/or maximum."
189
- when :options
190
- [:kx_index, :ky_index, :t_index, :e_index, :l_index, :s_index, :kxmax, :kxmin, :kx_element]
191
- else
192
- vars = OldNetcdfSmartReader.new(netcdf_file).graphkit(options[:graphkit_name].sub(/^nc_/, ''), options)
193
- end
186
+ case options[:command]
187
+ when :help
188
+ "An old smart graphkit is a direct plot of a given variable from the old netcdf file. The name of the graphkit is the name of the variable prefixed by 'nc_'. To plot, for example, the heat flux vs time, you would give the graph name nc_hflux_tot. You can use index specifiers in the the options; for example, to plot the potential as a function of kx and ky for a given time index, you would use the graph name nc_phi2_by_mode, and the options {t_index: n}. To plot the potential as function of kx for a given ky and time would use the options {t_index, n, ky_index: m}. For each dimension you can specify the index, or a minium and/or maximum."
189
+ when :options
190
+ [:kx_index, :ky_index, :t_index, :e_index, :l_index, :s_index, :kxmax, :kxmin, :kx_element]
191
+ else
192
+ return OldNetcdfSmartReader.new(netcdf_file).graphkit(options[:graphkit_name].sub(/^nc_/, ''), options)
193
+ end
194
194
  end
195
195
 
196
196
  def hyperviscosity_graphkit(options)
@@ -302,4 +302,4 @@ def lenardbern_graphkit(options)
302
302
  end
303
303
 
304
304
 
305
- end
305
+ end
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gs2crmod
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.55
4
+ version: 0.11.56
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Edmund Highcock
@@ -9,120 +10,96 @@ authors:
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2014-07-22 00:00:00.000000000 Z
13
+ date: 2014-07-25 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: coderunner
16
- requirement: !ruby/object:Gem::Requirement
17
+ requirement: &9232300 !ruby/object:Gem::Requirement
18
+ none: false
17
19
  requirements:
18
- - - ">="
20
+ - - ! '>='
19
21
  - !ruby/object:Gem::Version
20
22
  version: 0.14.15
21
23
  type: :runtime
22
24
  prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- version: 0.14.15
25
+ version_requirements: *9232300
28
26
  - !ruby/object:Gem::Dependency
29
27
  name: rubyhacks
30
- requirement: !ruby/object:Gem::Requirement
28
+ requirement: &9230480 !ruby/object:Gem::Requirement
29
+ none: false
31
30
  requirements:
32
- - - ">="
31
+ - - ! '>='
33
32
  - !ruby/object:Gem::Version
34
33
  version: 0.1.2
35
34
  type: :runtime
36
35
  prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- version: 0.1.2
36
+ version_requirements: *9230480
42
37
  - !ruby/object:Gem::Dependency
43
38
  name: ruby-netcdf-updated
44
- requirement: !ruby/object:Gem::Requirement
39
+ requirement: &9228940 !ruby/object:Gem::Requirement
40
+ none: false
45
41
  requirements:
46
- - - ">="
42
+ - - ! '>='
47
43
  - !ruby/object:Gem::Version
48
44
  version: 0.6.6.1
49
45
  type: :runtime
50
46
  prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: 0.6.6.1
47
+ version_requirements: *9228940
56
48
  - !ruby/object:Gem::Dependency
57
49
  name: shoulda
58
- requirement: !ruby/object:Gem::Requirement
50
+ requirement: &9227400 !ruby/object:Gem::Requirement
51
+ none: false
59
52
  requirements:
60
- - - '='
53
+ - - =
61
54
  - !ruby/object:Gem::Version
62
55
  version: 3.0.1
63
56
  type: :development
64
57
  prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - '='
68
- - !ruby/object:Gem::Version
69
- version: 3.0.1
58
+ version_requirements: *9227400
70
59
  - !ruby/object:Gem::Dependency
71
60
  name: rdoc
72
- requirement: !ruby/object:Gem::Requirement
61
+ requirement: &9836120 !ruby/object:Gem::Requirement
62
+ none: false
73
63
  requirements:
74
- - - "~>"
64
+ - - ~>
75
65
  - !ruby/object:Gem::Version
76
66
  version: '3.12'
77
67
  type: :development
78
68
  prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - "~>"
82
- - !ruby/object:Gem::Version
83
- version: '3.12'
69
+ version_requirements: *9836120
84
70
  - !ruby/object:Gem::Dependency
85
71
  name: bundler
86
- requirement: !ruby/object:Gem::Requirement
72
+ requirement: &9834760 !ruby/object:Gem::Requirement
73
+ none: false
87
74
  requirements:
88
- - - ">"
75
+ - - ! '>'
89
76
  - !ruby/object:Gem::Version
90
77
  version: 1.0.0
91
78
  type: :development
92
79
  prerelease: false
93
- version_requirements: !ruby/object:Gem::Requirement
94
- requirements:
95
- - - ">"
96
- - !ruby/object:Gem::Version
97
- version: 1.0.0
80
+ version_requirements: *9834760
98
81
  - !ruby/object:Gem::Dependency
99
82
  name: jeweler
100
- requirement: !ruby/object:Gem::Requirement
83
+ requirement: &9833280 !ruby/object:Gem::Requirement
84
+ none: false
101
85
  requirements:
102
- - - ">="
86
+ - - ! '>='
103
87
  - !ruby/object:Gem::Version
104
88
  version: 1.8.4
105
89
  type: :development
106
90
  prerelease: false
107
- version_requirements: !ruby/object:Gem::Requirement
108
- requirements:
109
- - - ">="
110
- - !ruby/object:Gem::Version
111
- version: 1.8.4
91
+ version_requirements: *9833280
112
92
  - !ruby/object:Gem::Dependency
113
93
  name: minitest
114
- requirement: !ruby/object:Gem::Requirement
94
+ requirement: &9832200 !ruby/object:Gem::Requirement
95
+ none: false
115
96
  requirements:
116
- - - "~>"
97
+ - - ~>
117
98
  - !ruby/object:Gem::Version
118
99
  version: '4'
119
100
  type: :development
120
101
  prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- requirements:
123
- - - "~>"
124
- - !ruby/object:Gem::Version
125
- version: '4'
102
+ version_requirements: *9832200
126
103
  description: GS2 is a gyrokinetic flux tube initial value turbulence code which can
127
104
  be used for fusion or astrophysical plasmas. CodeRunner is a framework for the automated
128
105
  running and analysis of large simulations. This module allows GS2 (and its sister
@@ -136,7 +113,7 @@ extra_rdoc_files:
136
113
  - README.md
137
114
  - README.rdoc
138
115
  files:
139
- - ".document"
116
+ - .document
140
117
  - Gemfile
141
118
  - LICENSE.txt
142
119
  - README.md
@@ -192,25 +169,26 @@ files:
192
169
  homepage: http://gs2crmod.sourceforge.net
193
170
  licenses:
194
171
  - GSLv3
195
- metadata: {}
196
172
  post_install_message:
197
173
  rdoc_options: []
198
174
  require_paths:
199
175
  - lib
200
176
  required_ruby_version: !ruby/object:Gem::Requirement
177
+ none: false
201
178
  requirements:
202
- - - ">="
179
+ - - ! '>='
203
180
  - !ruby/object:Gem::Version
204
181
  version: 1.9.1
205
182
  required_rubygems_version: !ruby/object:Gem::Requirement
183
+ none: false
206
184
  requirements:
207
- - - ">="
185
+ - - ! '>='
208
186
  - !ruby/object:Gem::Version
209
187
  version: '0'
210
188
  requirements: []
211
189
  rubyforge_project:
212
- rubygems_version: 2.2.2
190
+ rubygems_version: 1.8.11
213
191
  signing_key:
214
- specification_version: 4
192
+ specification_version: 3
215
193
  summary: Module to allow CodeRunner to run and analyse the GS2 and AstroGK codes.
216
194
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: c31f9f94d4ee877354ea333dc090790a3d3d40ac
4
- data.tar.gz: aceb9deb1003065b4fb3941dd19568689c36c6f5
5
- SHA512:
6
- metadata.gz: 8b11926703a4627d36891b5289baa606257da618c26d2945744224611c259efc80fc9c1b58a53efa5ebcff1409055f9dfd1b2f8c56afe919e90aed3d87754930
7
- data.tar.gz: a04cbd4bba9223f25b3d5dbec7fe1170bdbef6e2e4058780a39f5b1b021a54c859ab16008a46df18aac1a40fb07ad6d005bbe08c86ff6d98c654a23aa58f2e42