gs2crmod 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.0
1
+ 0.8.1
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.8.0"
8
+ s.version = "0.8.1"
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-16"
12
+ s.date = "2013-07-17"
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"]
@@ -69,6 +69,7 @@ Gem::Specification.new do |s|
69
69
  "test/cyclone_low_res.in",
70
70
  "test/cyclone_low_res.tgz",
71
71
  "test/helper.rb",
72
+ "test/slab_itg/dummy",
72
73
  "test/test_gs2crmod.rb"
73
74
  ]
74
75
  s.homepage = "http://gs2crmod.sourceforge.net"
@@ -373,7 +373,10 @@ def calculate_growth_rate(vector, options={})
373
373
  raise "This vector should be positive definite" if vector.min < 0.0
374
374
  offset = 0
375
375
  length = vector.length
376
- offset+=1 while vector[offset] == 0.0
376
+ while vector[offset] == 0.0
377
+ offset+=1
378
+ return 0.0 if offset == vector.length
379
+ end
377
380
  growth_rate = GSL::Fit::linear(gsl_vector(:t).subvector(offset, length-offset), 0.5*GSL::Sf::log(vector.subvector(offset, length - offset)))[1]
378
381
  divisor = 1
379
382
  while (growth_rate.to_s == "NaN")
data/lib/gs2crmod/gs2.rb CHANGED
@@ -60,6 +60,10 @@ def agk?
60
60
  false
61
61
  end
62
62
 
63
+ def spectrogk?
64
+ false
65
+ end
66
+
63
67
  CODE_SCRIPT_FOLDER = MODULE_FOLDER = File.dirname(File.expand_path(__FILE__))
64
68
 
65
69
  # Include the other files
@@ -209,6 +209,16 @@ def ingen
209
209
 
210
210
  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?)
211
211
 
212
+ ###################
213
+ # Spectrogk tests #
214
+ ###################
215
+ #
216
+ if spectrogk?
217
+ if @force_5d and @force_5d.fortran_true?
218
+ warning("Must specify interpolation method with phi_method.") if not (@phi_method)
219
+ end
220
+ end
221
+
212
222
  end
213
223
 
214
224
  # A hash which gives the actual numbers of gridpoints indexed by their corresponding letters in the layout string.
@@ -2675,6 +2675,17 @@
2675
2675
  :explanation=>
2676
2676
  "This variable must be a floating point number (an integer is also acceptable: it will be converted into a floating point number)."}],
2677
2677
  :type=>:Float},
2678
+ :nu_p=>
2679
+ {:should_include=>"true",
2680
+ :description=>nil,
2681
+ :help=>nil,
2682
+ :tests=>["Tst::FLOAT"],
2683
+ :code_name=>:nu_p,
2684
+ :must_pass=>
2685
+ [{:test=>"kind_of? Numeric",
2686
+ :explanation=>
2687
+ "This variable must be a floating point number (an integer is also acceptable: it will be converted into a floating point number)."}],
2688
+ :type=>:Float},
2678
2689
  :nexp_h=>
2679
2690
  {:should_include=>"true",
2680
2691
  :description=>nil,
@@ -2686,6 +2697,17 @@
2686
2697
  :explanation=>
2687
2698
  "This variable must be a floating point number (an integer is also acceptable: it will be converted into a floating point number)."}],
2688
2699
  :type=>:Float},
2700
+ :nexp_p=>
2701
+ {:should_include=>"true",
2702
+ :description=>nil,
2703
+ :help=>nil,
2704
+ :tests=>["Tst::FLOAT"],
2705
+ :code_name=>:nexp_p,
2706
+ :must_pass=>
2707
+ [{:test=>"kind_of? Numeric",
2708
+ :explanation=>
2709
+ "This variable must be a floating point number (an integer is also acceptable: it will be converted into a floating point number)."}],
2710
+ :type=>:Float},
2689
2711
  :adapt_hc=>
2690
2712
  {:should_include=>"true",
2691
2713
  :description=>nil,
@@ -2763,6 +2785,32 @@
2763
2785
  :explanation=>
2764
2786
  "This variable must be a floating point number (an integer is also acceptable: it will be converted into a floating point number)."}],
2765
2787
  :type=>:Float}}},
2788
+ :parameters_knobs=>
2789
+ {:description=>"",
2790
+ :should_include=>"true",
2791
+ :variables=>
2792
+ {:force_5d=>
2793
+ {:should_include=>"true",
2794
+ :description=>"Force code to include Hankel space",
2795
+ :help=>nil,
2796
+ :tests=>["Tst::FORTRAN_BOOL"],
2797
+ :code_name=>:force_5d,
2798
+ :must_pass=>
2799
+ [{:test=>"kind_of? String and FORTRAN_BOOLS.include? self",
2800
+ :explanation=>
2801
+ "This variable must be a fortran boolean. (In Ruby this is represented as a string: e.g. '.true.')"}],
2802
+ :type=>:Fortran_Bool},
2803
+ :phi_method=>
2804
+ {:should_include=>"true",
2805
+ :description=>"Method of determining fields from the distribution in Hankel space",
2806
+ :help=>
2807
+ "Should the nonlinear terms be calculated?\n \n** 'none', 'default', 'off': Do not include nonlinear terms, i.e. run a linear calculation.\n** 'on' Include nonlinear terms.",
2808
+ :tests=>["Tst::STRING"],
2809
+ :code_name=>:phi_method,
2810
+ :must_pass=>
2811
+ [{:test=>"kind_of? String",
2812
+ :explanation=>"This variable must be a string."}],
2813
+ :type=>:String}}},
2766
2814
  :theta_grid=>
2767
2815
  {:description=>"",
2768
2816
  :should_include=>"true",
@@ -51,7 +51,9 @@ CodeRunner.setup_run_class('gs2', modlet: 'astrogk') # SpectroGK Inherits from A
51
51
 
52
52
  class Gs2::Spectrogk < Gs2::Astrogk
53
53
 
54
-
54
+ def spectrogk?
55
+ true
56
+ end
55
57
 
56
58
 
57
59
  # Include the other files
File without changes
@@ -217,5 +217,7 @@ class TestBasicsSpectroGK < Test::Unit::TestCase
217
217
  def test_variables
218
218
  assert_equal(Hash, @runner.run_class.rcp.namelists.class)
219
219
  assert_equal(@runner.run_class.rcp.namelists[:layouts_knobs].class, Hash)
220
+ assert_equal(@runner.run_class.rcp.namelists[:parameters_knobs].class, Hash)
221
+ assert_equal(@runner.run_class.rcp.namelists[:parameters_knobs][:variables][:force_5d].class, Hash)
220
222
  end
221
223
  end
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.8.0
4
+ version: 0.8.1
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-07-16 00:00:00.000000000 Z
13
+ date: 2013-07-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: coderunner
@@ -155,6 +155,7 @@ files:
155
155
  - test/cyclone_low_res.in
156
156
  - test/cyclone_low_res.tgz
157
157
  - test/helper.rb
158
+ - test/slab_itg/dummy
158
159
  - test/test_gs2crmod.rb
159
160
  homepage: http://gs2crmod.sourceforge.net
160
161
  licenses: