cheasecrmod 0.0.0 → 0.1.0

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.
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'coderunner'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,6 @@
1
+
2
+ require 'helper'
3
+ CodeRunner.setup_run_class('chease')
4
+ #CodeRunner::Chease.get_input_help_from_source_code(ENV['CHEASE_SOURCE'])
5
+ #CodeRunner::Chease.update_defaults_from_source_code(ENV['CHEASE_SOURCE'])
6
+ CodeRunner::Chease.synchronise_variables(ENV['CHEASE_SOURCE'])
data/test/helper.rb CHANGED
@@ -28,7 +28,7 @@ require 'shoulda'
28
28
 
29
29
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
30
30
  $LOAD_PATH.unshift(File.dirname(__FILE__))
31
- require 'cheasecrmod'
31
+ #require 'cheasecrmod'
32
32
 
33
33
  class Test::Unit::TestCase
34
34
  end
@@ -0,0 +1,95 @@
1
+ ! Example CHEASE namelist - circular flux surfaces, 80% of ballooning
2
+ ! - parabolic pressure & q
3
+ ! Equation references are from Lutjens, et al, Comp Phys Comm 97, 219-260 (1996)
4
+ ! E Highcock 2012 (edmundhighcock@sourceforge.net)
5
+
6
+
7
+ &eqdata
8
+
9
+ ! Specify outer surface:
10
+ nsurf = 1 ! Use Solevev -- eq (48)
11
+ nsurf = 4 ! Use INTOR formula ... eq (49)
12
+ elong = 1.35 ! kappa
13
+ aspct = 0.27 ! aspect ratio
14
+ rc = 1.0
15
+ triang = 0.0
16
+ beans = 0.0
17
+ delta = 0.5
18
+ sgma = 1.3
19
+ nsym = 0
20
+ xi = 8.0e-4
21
+ theta0 = -1.57
22
+
23
+
24
+ ! Specify pressure profile
25
+ ! nppfun = 1 ! Use polynomial -- eq (52)
26
+ ! nsour = 3 ! of order 2
27
+ nppfun = 2 ! Use combination of polynomials...
28
+ npp = 1
29
+ ! ap = 0.16,1,-1 ! p' = 0 + x + 0*x^2 = x = 1 - psi / psi_min
30
+ ap = 0.3,0.5,0.4,0.0,0.4,0.0,0.0 ! p' = 0 + x + 0*x^2 = x = 1 - psi / psi_min
31
+
32
+ ! Specify current profile
33
+ nsttp = 2 ! Specify I* -- surface averaged toroidal current, eq (7)
34
+ nfunc = 1 ! Use polynomial (must be same order as p' func)
35
+ nfunc = 2 ! Use
36
+ nipr = 1
37
+ ! at = 0.5,0.5,0.4 ! I* = 1 + 0 * x - x^2 = 1 - x^2 = 1 - (1 - psi/psi_min_)**2
38
+ ! at = 1,0,-1 ! I* = 1 + 0 * x - x^2 = 1 - x^2 = 1 - (1 - psi/psi_min_)**2
39
+ at = 0.16,1.0,1.0,-1.1,-1.1 ! I* = 1 + 0 * x - x^2 = 1 - x^2 = 1 - (1 - psi/psi_min_)**2
40
+
41
+ ! Specify ballooning criterion
42
+ nblopt = 0 ! Optimise for ballooning
43
+ cfbal = 0.2 ! find p profile at 80% of ballooning stability
44
+ nbal = 1 ! ?? Flag related to ballooning stability
45
+ nblc0 = 8 ! Number of values used for chi_0 (eq 17)
46
+ nppr = 20 ! Number of s values where p' is modified
47
+
48
+ ! Grid sizes
49
+ npsi = 40 ! Number of surfaces
50
+ ns = 30 ! Number of s values (internal flux surface coord)
51
+ nt = 30 ! Number of theta values (internal poloidal angle)
52
+ nrbox = 400 ! Number of R values for gridded output (e.g EQDSK)
53
+ nzbox = 400 ! Number of Z values for gridded output
54
+ niso = 200
55
+ nchi = 200 ! Num values of generalised poloidal angle for stability calcs.
56
+
57
+ ! Mesh densification at theta = -1.57 (-pi/2)
58
+ nmeshd = 1 ! Label densification rule - d
59
+ npoidd = 1 ! No. of densification points
60
+ dplace = -1.5707
61
+ dwidth = 0.157
62
+ solpdd = 0.6
63
+
64
+
65
+ ! Rescaling the equlibrium
66
+ ncscal = 1 ! Scale to give a specified value of q at one location
67
+ ntmf0 = 0 ! 1 for T=1 at centre, 0 for T=1 at edge
68
+ qspec = 2.0 ! Specify q of 2
69
+ csspec = 0.33 ! -- at s = 0.33
70
+ ndift = 1
71
+ ! s = sqrt( (psi_edge - psi)/(psi_edge - psi0) )
72
+ nrscal = 0 ! Specify rmaj = 1 at centre
73
+
74
+ ! Output
75
+ nideal = 9 ! 1 for ERRATO, 6 for EQDSK
76
+
77
+ ! Solver
78
+ epslon = 1.e-8 ! Solver accuray
79
+ ninsca = 20 ! Number iterations over nonlinearity
80
+ ninmap = 20 ! Number of iterations over current profile
81
+
82
+
83
+
84
+ ! Misc
85
+ nsym = 1 ! Enforces updown symmetric ?
86
+ nopt = 0 ! Don't read stored eq
87
+ nplot = 1 ! Output quantities for plotting??
88
+ negp = 0 ! |nabla psi| exponent in Jacobian (i.e. sign of psi??)
89
+ ner = 2 ! R exponent in Jacobian -- leave !
90
+
91
+
92
+
93
+
94
+ /
95
+
@@ -1,7 +1,46 @@
1
1
  require 'helper'
2
+ require 'coderunner'
2
3
 
3
4
  class TestCheasecrmod < Test::Unit::TestCase
4
- should "probably rename this file and start testing for real" do
5
- flunk "hey buddy, you should probably rename this file and start testing for real"
5
+ def setup
6
+ @runner = CodeRunner.fetch_runner(Y: 'test/solovev', C: 'chease', X: '/dev/null')
7
+ end
8
+ def teardown
9
+ end
10
+ def test_basics
11
+ assert_equal(@runner.run_class, CodeRunner::Chease)
12
+ end
13
+ def test_submit
14
+ Dir.chdir('test/solovev'){@runner.run_class.use_new_defaults_file("rake_test", "chease_namelist_EXAMPLE.in")}
15
+ #FileUtils.mv('rake_test_defaults.rb', @runner.run_class.rcp.user_defaults_location)
16
+ if ENV['CHEASE_EXEC']
17
+ CodeRunner.submit(Y: 'test/solovev', p: '{ap: [0.3,0.5,0.4,0.0,0.4,0.0,0.0], at: [0.16,1.0,1.0,-1.1,-1.1]}', T: false, D: 'rake_test', n: '1', X: ENV['CHEASE_EXEC'])
18
+ CodeRunner.submit(Y: 'test/solovev', p: '{restart_id: 1, nblopt: 1}', T: false, D: 'rake_test', n: '1', X: ENV['CHEASE_EXEC'])
19
+ FileUtils.rm(@runner.run_class.rcp.user_defaults_location + '/rake_test_defaults.rb')
20
+ FileUtils.rm('test/solovev/rake_test_defaults.rb')
21
+ FileUtils.rm_r('test/solovev/v')
22
+ end
23
+ #CodeRunner.submit(Y: 'test/ifspppl', T: false, D: 'rake_test', n: '1', X: ENV['TRINITY_EXEC'], p: '{restart_id: 1}')
24
+ #Dir.chdir('test/ifspppl') do
25
+ #system "ls v/id_2/"
26
+ ##system "less v/id_2/#{@runner.run_list[2].error_file}"
27
+ #end
28
+ ##@runner.update
29
+ ##CodeRunner.status(Y: 'test/ifspppl')
30
+ ##STDIN.gets
31
+ #assert_equal(:Complete, @runner.run_list[1].status)
32
+ #assert_equal(:Complete, @runner.run_list[2].status)
33
+ #assert_equal(@runner.run_list[1].list(:t).values.max, @runner.run_list[2].list(:t).values.min)
34
+ #else
35
+ #CodeRunner.submit(Y: 'test/ifspppl', T: true, D: 'rake_test')
36
+ #end
37
+ #base_hash = @runner.run_class.parse_input_file('test/ifspppl/test.trin')
38
+ #test_hash = @runner.run_class.parse_input_file('test/ifspppl/v/id_1/v_id_1_t.trin')
39
+ #assert_equal(base_hash, test_hash)
40
+ #CodeRunner.status(Y: 'test/ifspppl')
41
+ end
42
+ def teardown
43
+ FileUtils.rm('test/solovev/.code_runner_script_defaults.rb')
44
+ FileUtils.rm('test/solovev/.CODE_RUNNER_TEMP_RUN_LIST_CACHE')
6
45
  end
7
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cheasecrmod
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edmund Highcock
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-24 00:00:00.000000000 Z
11
+ date: 2014-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coderunner
@@ -125,7 +125,12 @@ files:
125
125
  - VERSION
126
126
  - cheasecrmod.gemspec
127
127
  - lib/cheasecrmod.rb
128
+ - lib/cheasecrmod/chease.rb
129
+ - lib/cheasecrmod/namelists.rb
130
+ - sync_variables/helper.rb
131
+ - sync_variables/sync_variables.rb
128
132
  - test/helper.rb
133
+ - test/solovev/chease_namelist_EXAMPLE.in
129
134
  - test/test_cheasecrmod.rb
130
135
  homepage: http://github.com/edmundhighcock/cheasecrmod
131
136
  licenses: