gryfxcrmod 0.0.0 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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,7 @@
1
+ require 'helper'
2
+ CodeRunner.setup_run_class('gryfx')
3
+
4
+ raise "curl failed" unless system %[curl 'http://sourceforge.net/apps/mediawiki/gyrokinetics/index.php?title=Gryfx_Input_Parameters&action=edit' | sed 's/&amp;/\&/g' | sed 's/&quot;/"/g' | sed 's/&gt;/>/g' | sed 's/&lt;/</g' | sed 's/&nbsp;/ /g' > gryfx_mediawiki.txt]
5
+ CodeRunner::Gryfx.read_mediawiki_documentation('gryfx_mediawiki.txt')
6
+ CodeRunner::Gryfx.write_mediawiki_documentation('gryfx_mediawiki.txt')
7
+ system 'kwrite gryfx_mediawiki.txt' or system '/Applications/TextEdit.app/Contents/MacOS/TextEdit gryfx_mediawiki.txt'
@@ -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,27 @@
1
+ require 'helper'
2
+ CodeRunner.setup_run_class('gryfx')
3
+
4
+ ###################################################################################
5
+ # Code to analyse the source code to look for new input variables... very imperfect
6
+ ################################################################################
7
+
8
+ CodeRunner::Gryfx.synchronise_variables_from_input_file('test/cyclone_miller_ke.in')
9
+ #CodeRunner::Gryfx.update_defaults_from_source_code(ENV['GRYFX_SOURCE'])
10
+
11
+
12
+ ############################################################
13
+ # Attempt to copy help from equivalent variables in GS2
14
+ ###########################################################
15
+
16
+ CodeRunner.setup_run_class('gs2')
17
+
18
+ CodeRunner::Gryfx.rcp.namelists.each do |namelist, namelist_hash|
19
+ namelist_hash[:variables].each do |var, varhash|
20
+ if CodeRunner::Gs2.rcp.namelists[namelist] and CodeRunner::Gs2.rcp.namelists[namelist][:variables][var]
21
+ varhash[:help] = CodeRunner::Gs2.rcp.namelists[namelist][:variables][var][:help]
22
+ varhash[:description] = CodeRunner::Gs2.rcp.namelists[namelist][:variables][var][:description]
23
+ CodeRunner::Gryfx.save_namelists
24
+ end
25
+ end
26
+ end
27
+
@@ -0,0 +1,200 @@
1
+ !-------------------LINEAR CYCLONE ITG CASE-----------------------
2
+ ! Widely used benchmark case. Original study published
3
+ ! in Phys. Plasmas Vol. 7, p. 969 (Dimits et al.)
4
+ ! Can compare linear.out file with linear.test, which
5
+ ! is included in this directory.
6
+ !-----------------------------------------------------------------
7
+
8
+ &collisions_knobs
9
+ collision_model='none'
10
+ /
11
+ !
12
+ !&hyper_knobs
13
+ ! hyper_option = 'visc_only'
14
+ ! const_amp = .false.
15
+ ! isotropic_shear = .false.
16
+ ! D_hypervisc = 0.1
17
+ !/
18
+
19
+ &theta_grid_parameters
20
+
21
+ ntheta = 12
22
+ nperiod = 1
23
+
24
+ rhoc = 0.54
25
+ eps = 0.18
26
+ shat = 0.8
27
+ qinp = 1.4
28
+ Rmaj = 1.0
29
+ R_geo = 3.0
30
+ shift = 0.0
31
+ akappa = 1.0
32
+ akappri = 0.0
33
+ tri = 0.0
34
+ tripri = 0.0
35
+ drhodpsi = 1.0
36
+ epsl = 2.0
37
+ kxfac = 1.0
38
+ /
39
+ &parameters
40
+ !beta = 0.0
41
+ !zeff = 1.0
42
+ /
43
+ &theta_grid_eik_knobs
44
+ !itor = 1
45
+ !iflux = 0
46
+ irho = 2
47
+ equilibrium_type = "miller"
48
+
49
+ !ppl_eq = F
50
+ !gen_eq = F
51
+ !efit_eq = F
52
+ !local_eq = T
53
+
54
+ eqfile = 'dskeq.cdf'
55
+ equal_arc = T
56
+ bishop = 4
57
+ s_hat_input = 0.8
58
+ beta_prime_input = 0.0
59
+ !delrho = 1.e-3
60
+ !isym = 0
61
+ !writelots = F
62
+ /
63
+ &fields_knobs
64
+ !field_option='implicit'
65
+ /
66
+ &gs2_diagnostics_knobs
67
+ !print_flux_line = T
68
+ !write_nl_flux = T
69
+ !print_line = F
70
+ !write_line = F
71
+ !write_omega = F
72
+ !write_final_fields = T
73
+ !write_g = F
74
+ !write_verr = T
75
+ nwrite= 10
76
+ navg= 40000
77
+ nsave = 20
78
+ !omegatinst = 500.0
79
+ !save_for_restart = .true.
80
+ !omegatol = -1.0e-3
81
+ /
82
+ !&le_grids_knobs
83
+ ! ngauss = 5
84
+ ! negrid = 12
85
+ ! vcut= 2.5
86
+ !/
87
+
88
+ &dist_fn_knobs
89
+ !adiabatic_option="iphi00=2"
90
+ !gridfac= 1.0
91
+ !boundary_option="linked"
92
+ g_exb = 0.0
93
+ /
94
+
95
+ &kt_grids_knobs
96
+ !grid_option='box'
97
+ /
98
+ &kt_grids_box_parameters
99
+ ! naky = (ny-1)/3 + 1
100
+ ny = 8
101
+ ! nakx = 2*(nx-1)/3 + 1
102
+ nx = 8
103
+ ! ky_min = 1/y0
104
+ y0 = 20
105
+ x0 = 20
106
+ jtwist = 5
107
+ /
108
+ &init_g_knobs
109
+ !chop_side = F
110
+ !phiinit= 1.e-3
111
+ !restart_file = "nc/cyclone_miller_ke.nc"
112
+ !ginit_option= "noise"
113
+ /
114
+
115
+ &knobs
116
+ ! fphi = 1.0
117
+ ! fapar = 0.0
118
+ !faperp = 0.0
119
+ ! delt = 0.05
120
+ dt = 0.02
121
+ maxdt = 0.02
122
+ nstep = 1000
123
+ /
124
+ &species_knobs
125
+ nspec= 1
126
+ /
127
+ &species_parameters_1
128
+ z= 1.0
129
+ mass= 1.0
130
+ dens= 1.0
131
+ temp= 1.0
132
+ tprim= 6.9
133
+ fprim= 2.2
134
+ uprim= 0.0
135
+ vnewk= 0.0
136
+ type='ion'
137
+ /
138
+ &dist_fn_species_knobs_1
139
+ !fexpr= 0.45
140
+ !bakdif= 0.05
141
+ /
142
+ &species_parameters_2
143
+ z= -1.0
144
+ mass= 2.7e-4
145
+ dens= 1.0
146
+ temp= 1.0
147
+ tprim= 2.3
148
+ fprim= 0.733
149
+ uprim= 0.0
150
+ vnewk= 0.0
151
+ type='electron'
152
+ /
153
+ &dist_fn_species_knobs_2
154
+ !fexpr= 0.45
155
+ !bakdif= 0.05
156
+ /
157
+ &theta_grid_knobs
158
+ !equilibrium_option='eik'
159
+ /
160
+ &nonlinear_terms_knobs
161
+ nonlinear_mode='off'
162
+ cfl = 0.1
163
+ /
164
+ &reinit_knobs
165
+ !delt_adj = 2.0
166
+ !delt_minimum = 1.e-4
167
+ /
168
+ &layouts_knobs
169
+ ! layout = 'lxyes'
170
+ ! local_field_solve = F
171
+ /
172
+
173
+ &gryfx_knobs
174
+ inlpm = 2
175
+ dnlpm = 1.0
176
+ hyper = "off"
177
+ nu_hyper = 1.0
178
+ p_hyper = 2
179
+ init_amp = 1.0e-5
180
+ scan_type = "outputs"
181
+ scan_number = 1
182
+ zero_restart_avg = "off"
183
+ no_zderiv_covering = "off"
184
+ write_omega = 'off'
185
+ write_phi = "off"
186
+ restart = "off"
187
+ no_omegad = "off"
188
+ const_curv = "off"
189
+ varenna = "off"
190
+ nlpm = "off"
191
+ smagorinsky = "off"
192
+ init = "density"
193
+ debug = "on"
194
+ s_alpha = "on"
195
+ fluxfile = "./scan/output/linearflux"
196
+ stopfile = "linear.stop"
197
+ restartfile = "restart/linear.bin"
198
+ /
199
+
200
+
Binary file
@@ -5,5 +5,59 @@ class TestGryfxcrmod < Test::Unit::TestCase
5
5
  CodeRunner.setup_run_class('gryfx')
6
6
  end
7
7
  def test_basics
8
+ assert_equal("gryfx", CodeRunner::Gryfx.rcp.code)
9
+ end
10
+ end
11
+
12
+
13
+ if ENV['GRYFX_EXEC']
14
+ class TestSubmission < Test::Unit::TestCase
15
+ def setup
16
+ CodeRunner.setup_run_class('gryfx')
17
+ CodeRunner::Gryfx.make_new_defaults_file('test_gryfxcrmod', 'test/cyclone_miller_ke.in')
18
+ FileUtils.mv('test_gryfxcrmod_defaults.rb', CodeRunner::Gryfx.rcp.user_defaults_location + '/.')
19
+ FileUtils.makedirs(tfolder)
20
+ end
21
+ def tfolder
22
+ 'test/cyclone_miller_ke'
23
+ end
24
+ def teardown
25
+ FileUtils.rm(CodeRunner::Gryfx.rcp.user_defaults_location + '/' + 'test_gryfxcrmod_defaults.rb')
26
+ FileUtils.rm(tfolder + '/.CODE_RUNNER_TEMP_RUN_LIST_CACHE')
27
+ FileUtils.rm(tfolder + '/v/id_1/.code_runner_run_data')
28
+ FileUtils.rm(tfolder + '/v/id_1/code_runner_results.rb')
29
+ ## Don't uncomment the line below unless you *really* know what you are doing! Replacing the test archive will break many of the tests
30
+ Dir.chdir('test'){system "tar -czf cyclone_miller_ke.tgz cyclone_miller_ke/" unless FileTest.exist?('cyclone_miller_ke.tgz')}
31
+ FileUtils.rm_r(tfolder)
32
+ end
33
+ def test_submission
34
+ CodeRunner.submit(T: false, C: 'gryfx', X: ENV['GRYFX_EXEC'], D: 'test_gryfxcrmod', n: '1', Y: tfolder, p: '{}')
35
+ CodeRunner::Gryfx.diff_input_files(tfolder + '/v/id_1/v_id_1.in', 'test/cyclone_miller_ke.in')
36
+ CodeRunner.status(Y: tfolder)
37
+ end
38
+ end
39
+ else
40
+ puts "\n************************************\nWarning: submission tests not run. Please specify the evironment variable GRYFX_EXEC (the path to the gs2 executable) if you wish to test submission.\n************************************\n"
41
+ sleep 0.1
42
+ end
43
+
44
+ class TestAnalysis < Test::Unit::TestCase
45
+ def setup
46
+ Dir.chdir('test'){assert(system "tar -xzf cyclone_miller_ke.tgz")}
47
+ @runner = CodeRunner.fetch_runner(Y: tfolder)
48
+ @run = @runner.run_list[1]
49
+ end
50
+ def test_analysis
51
+ CodeRunner.status(Y: tfolder)
52
+ assert_equal(1, @runner.run_list.size)
53
+ #assert_equal(0.13066732664774272, @runner.run_list[1].max_growth_rate)
54
+ #assert_equal(0.13066732664774272, @runner.run_list[1].growth_rate_at_ky[0.5])
55
+ #assert_equal(:Complete, @runner.run_list[1].status)
56
+ end
57
+ def tfolder
58
+ 'test/cyclone_miller_ke'
59
+ end
60
+ def teardown
61
+ FileUtils.rm_rf(tfolder)
8
62
  end
9
63
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gryfxcrmod
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-09 00:00:00.000000000 Z
12
+ date: 2013-08-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: coderunner
@@ -27,6 +27,38 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: 0.13.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: gs2crmod
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 0.9.9
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 0.9.9
46
+ - !ruby/object:Gem::Dependency
47
+ name: ruby-netcdf
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: 0.6.6
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 0.6.6
30
62
  - !ruby/object:Gem::Dependency
31
63
  name: shoulda
32
64
  requirement: !ruby/object:Gem::Requirement
@@ -43,6 +75,22 @@ dependencies:
43
75
  - - ! '>='
44
76
  - !ruby/object:Gem::Version
45
77
  version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: shoulda-context
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: 1.1.5
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: 1.1.5
46
94
  - !ruby/object:Gem::Dependency
47
95
  name: rdoc
48
96
  requirement: !ruby/object:Gem::Requirement
@@ -108,8 +156,16 @@ files:
108
156
  - VERSION
109
157
  - gryfxcrmod.gemspec
110
158
  - lib/gryfxcrmod.rb
159
+ - lib/gryfxcrmod/deleted_variables.rb
111
160
  - lib/gryfxcrmod/gryfx.rb
161
+ - lib/gryfxcrmod/namelist_tools.rb
112
162
  - lib/gryfxcrmod/namelists.rb
163
+ - sync_mediawiki/helper.rb
164
+ - sync_mediawiki/sync_mediawiki.rb
165
+ - sync_variables/helper.rb
166
+ - sync_variables/sync_variables.rb
167
+ - test/cyclone_miller_ke.in
168
+ - test/cyclone_miller_ke.tgz
113
169
  - test/helper.rb
114
170
  - test/test_gryfxcrmod.rb
115
171
  homepage: http://github.com/edmundhighcock/gryfxcrmod
@@ -127,7 +183,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
183
  version: '0'
128
184
  segments:
129
185
  - 0
130
- hash: 3372535012813393564
186
+ hash: -2691510310459698350
131
187
  required_rubygems_version: !ruby/object:Gem::Requirement
132
188
  none: false
133
189
  requirements: