trinitycrmod 0.4.7 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/VERSION +1 -1
- data/lib/trinitycrmod/chease.rb +1 -1
- data/lib/trinitycrmod/check_parameters.rb +1 -1
- data/lib/trinitycrmod/namelists.rb +59 -4
- data/lib/trinitycrmod/trinity.rb +46 -9
- data/trinitycrmod.gemspec +6 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7744e267e114d444760b4f828d2feb7fec8b7834
|
4
|
+
data.tar.gz: 4f71662ed8dca1954360babff96474492ca6e514
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fd2a34beb1768bb9aa7021e81dee50a9d80a3d09b6e0c90c906bcf7f1a33bfa3af430fe03c2b060cbca5c969fba6c0e7851698bd9c828641199fc3f6bf7f08f
|
7
|
+
data.tar.gz: 9d0a10905bcc7c8d5c250f4b04f54009b11bcc1abe1adb26dc16cf895f4290c743eef202bd8c8d1c58c5b159a46fee9124649daa07862567c30f55e60f6edc95
|
data/Gemfile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
data/lib/trinitycrmod/chease.rb
CHANGED
@@ -4,7 +4,7 @@ class CodeRunner::Trinity
|
|
4
4
|
end
|
5
5
|
def setup_chease
|
6
6
|
ep "Setting up chease files..."
|
7
|
-
FileUtils.mkdir('chease')
|
7
|
+
FileUtils.mkdir('chease') unless FileTest.exist? 'chease'
|
8
8
|
origfile = @runner.root_folder + '/ogyropsi.dat'
|
9
9
|
FileUtils.cp(origfile, 'chease/ogyropsi.dat') if FileTest.exist? origfile
|
10
10
|
end
|
@@ -14,7 +14,7 @@ class CodeRunner::Trinity
|
|
14
14
|
|
15
15
|
def check_parallelisation
|
16
16
|
error("nrad must be explicitly specified") unless @nrad
|
17
|
-
error("Number of jobs: #{
|
17
|
+
error("Number of jobs: #{n_flux_tubes_jac} must evenly divide the number of processors: #{actual_number_of_processors} when fork_flag is .true.") if fork_flag_actual.fortran_true? and not actual_number_of_processors%n_flux_tubes_jac == 0
|
18
18
|
|
19
19
|
end
|
20
20
|
|
@@ -854,7 +854,39 @@
|
|
854
854
|
:explanation=>
|
855
855
|
"This variable must be a floating point number (an integer is also acceptable: it will be converted into a floating point number)."}],
|
856
856
|
:type=>:Float,
|
857
|
-
:autoscanned_defaults=>[1.0]}
|
857
|
+
:autoscanned_defaults=>[1.0]},
|
858
|
+
:ncc_calibrate=>
|
859
|
+
{:should_include=>"true",
|
860
|
+
:description=>"Number of calibration jobs.",
|
861
|
+
:help=>
|
862
|
+
"Number of calibration jobs. Minimum 1, maximum number of cell centers. Only applies when neval_calibrate > 0.",
|
863
|
+
:code_name=>:ncc_calibrate,
|
864
|
+
:must_pass=>
|
865
|
+
[{:test=>"kind_of? Integer",
|
866
|
+
:explanation=>"This variable must be an integer."}],
|
867
|
+
:type=>:Integer},
|
868
|
+
:neval_calibrate=>
|
869
|
+
{:should_include=>"true",
|
870
|
+
:description=>"Number of flux evaluations between recalibrations.",
|
871
|
+
:help=>
|
872
|
+
"Number of flux evaluations between recalibrations. Set > 0 to trigger calibration mode.",
|
873
|
+
:code_name=>:neval_calibrate,
|
874
|
+
:must_pass=>
|
875
|
+
[{:test=>"kind_of? Integer",
|
876
|
+
:explanation=>"This variable must be an integer."}],
|
877
|
+
:type=>:Integer},
|
878
|
+
:match_gs2_species=>
|
879
|
+
{:should_include=>"true",
|
880
|
+
:description=>
|
881
|
+
"If true, try to match gs2 species to trinity species by examining species properties.",
|
882
|
+
:help=>
|
883
|
+
"If true, try to match gs2 species to trinity species by examining species properties. If false, gs2 species must be in the same order as trinity species.",
|
884
|
+
:code_name=>:match_gs2_species,
|
885
|
+
:must_pass=>
|
886
|
+
[{:test=>"kind_of? String and FORTRAN_BOOLS.include? self",
|
887
|
+
:explanation=>
|
888
|
+
"This variable must be a fortran boolean. (In Ruby this is represented as a string: e.g. '.true.')"}],
|
889
|
+
:type=>:Fortran_Bool}}},
|
858
890
|
:init=>
|
859
891
|
{:description=>"",
|
860
892
|
:should_include=>"true",
|
@@ -868,7 +900,7 @@
|
|
868
900
|
[{:test=>"kind_of? String",
|
869
901
|
:explanation=>"This variable must be a string."}],
|
870
902
|
:type=>:String,
|
871
|
-
:autoscanned_defaults=>["default"]},
|
903
|
+
:autoscanned_defaults=>["default", "iterdb"]},
|
872
904
|
:init_file=>
|
873
905
|
{:should_include=>"true",
|
874
906
|
:description=>" file with input data",
|
@@ -1051,7 +1083,7 @@
|
|
1051
1083
|
:explanation=>
|
1052
1084
|
"This variable must be a fortran boolean. (In Ruby this is represented as a string: e.g. '.true.')"}],
|
1053
1085
|
:type=>:Fortran_Bool,
|
1054
|
-
:autoscanned_defaults=>[".false."]},
|
1086
|
+
:autoscanned_defaults=>[".false.", ".true."]},
|
1055
1087
|
:flux_groups=>
|
1056
1088
|
{:should_include=>"true",
|
1057
1089
|
:description=>" The number of processors for each flux calculation",
|
@@ -1061,7 +1093,30 @@
|
|
1061
1093
|
[{:test=>"kind_of? Integer",
|
1062
1094
|
:explanation=>"This variable must be an integer."}],
|
1063
1095
|
:type=>:Integer,
|
1064
|
-
:autoscanned_defaults=>["nproc/njobs"]}
|
1096
|
+
:autoscanned_defaults=>["nproc/njobs"]},
|
1097
|
+
:dyn_load_balance=>
|
1098
|
+
{:should_include=>"true",
|
1099
|
+
:description=>"Activate dynamic load balancing for gs2.",
|
1100
|
+
:help=>
|
1101
|
+
"Activate dynamic load balancing for gs2. Jobs which fail to converge are given successively larger proportions of processors.",
|
1102
|
+
:code_name=>:dyn_load_balance,
|
1103
|
+
:must_pass=>
|
1104
|
+
[{:test=>"kind_of? String and FORTRAN_BOOLS.include? self",
|
1105
|
+
:explanation=>
|
1106
|
+
"This variable must be a fortran boolean. (In Ruby this is represented as a string: e.g. '.true.')"}],
|
1107
|
+
:type=>:Fortran_Bool},
|
1108
|
+
:peaking_factor=>
|
1109
|
+
{:should_include=>"true",
|
1110
|
+
:description=>
|
1111
|
+
"Experimental. Enhance all gradients. Negative off, 1.0 no change.",
|
1112
|
+
:help=>
|
1113
|
+
"Experimental. Enhance the peakedness, i.e. the gradient, of all profiles. Negative off, 1.0 no change.",
|
1114
|
+
:code_name=>:peaking_factor,
|
1115
|
+
:must_pass=>
|
1116
|
+
[{:test=>"kind_of? Numeric",
|
1117
|
+
:explanation=>
|
1118
|
+
"This variable must be a floating point number (an integer is also acceptable: it will be converted into a floating point number)."}],
|
1119
|
+
:type=>:Float}}},
|
1065
1120
|
:sources=>
|
1066
1121
|
{:description=>"",
|
1067
1122
|
:should_include=>"true",
|
data/lib/trinitycrmod/trinity.rb
CHANGED
@@ -54,7 +54,7 @@ class CodeRunner
|
|
54
54
|
|
55
55
|
@code_long="Trinity Turbulent Transport Solver"
|
56
56
|
|
57
|
-
@run_info=[:time, :is_a_restart, :restart_id, :restart_run_name, :completed_timesteps, :percent_complete]
|
57
|
+
@run_info=[:time, :is_a_restart, :restart_id, :restart_run_name, :completed_timesteps, :percent_complete, :no_restart_gs2]
|
58
58
|
|
59
59
|
@uses_mpi = true
|
60
60
|
|
@@ -97,7 +97,10 @@ class CodeRunner
|
|
97
97
|
(rcp.variables).each{|v| new_run.set(v, send(v)) if send(v)}
|
98
98
|
if @flux_option == "gs2"
|
99
99
|
gs2_runs.each_with_index do |run, i|
|
100
|
-
CodeRunner::Gs2.rcp.variables.each{|v|
|
100
|
+
CodeRunner::Gs2.rcp.variables.each{|v|
|
101
|
+
next if [:ginit_option, :delt_option].include? v and new_run.no_restart_gs2
|
102
|
+
new_run.gs2_runs[i].set(v, run.send(v)) if run.send(v)
|
103
|
+
}
|
101
104
|
end
|
102
105
|
end
|
103
106
|
@naming_pars.delete(:preamble)
|
@@ -112,6 +115,7 @@ class CodeRunner
|
|
112
115
|
new_run.init_file = @run_name + ".tmp"
|
113
116
|
@runner.nprocs = @nprocs if @runner.nprocs == "1" # 1 is the default so this means the user probably didn't specify nprocs
|
114
117
|
raise "Restart must be on the same number of processors as the previous run: new is #{new_run.nprocs.inspect} and old is #{@nprocs.inspect}" if !new_run.nprocs or new_run.nprocs != @nprocs
|
118
|
+
raise "Restart cannot have a different sized jacobian: new is #{new_run.n_flux_tubes_jac} and old is #{n_flux_tubes_jac}" unless new_run.n_flux_tubes_jac == n_flux_tubes_jac
|
115
119
|
# @runner.parameters.each{|var, value| new_run.set(var,value)} if @runner.parameters
|
116
120
|
# ep @runner.parameters
|
117
121
|
new_run.run_name = nil
|
@@ -125,9 +129,20 @@ class CodeRunner
|
|
125
129
|
['iternt', 'iterflx', 'tmp'].each do |ext|
|
126
130
|
FileUtils.cp("#@directory/#@run_name.#{ext}", "#{new_run.directory}/.")
|
127
131
|
end
|
128
|
-
if new_run.flux_option == "gs2" and @flux_option == "gs2"
|
132
|
+
if new_run.flux_option == "gs2" and @flux_option == "gs2" and not new_run.no_restart_gs2
|
129
133
|
for i in 0...n_flux_tubes
|
130
|
-
|
134
|
+
break if i >= new_run.n_flux_tubes
|
135
|
+
if i >= n_flux_tubes_jac
|
136
|
+
jn = i - n_flux_tubes_jac + 1
|
137
|
+
#run_name = "calibrate_" + @run_name + (jn).to_s
|
138
|
+
folder = "calibrate_#{jn}"
|
139
|
+
else
|
140
|
+
jn = i + 1
|
141
|
+
#run_name = @run_name + (jn).to_s
|
142
|
+
folder = "flux_tube_#{jn}"
|
143
|
+
end
|
144
|
+
|
145
|
+
new_run.gs2_runs[i].directory = new_run.directory + "/#{folder}"
|
131
146
|
FileUtils.makedirs(new_run.gs2_runs[i].directory)
|
132
147
|
#ep ['gs2_runs[i] before', gs2_runs[i].nwrite, new_run.gs2_runs[i].nwrite, new_run.gs2_runs[i].parameter_hash]
|
133
148
|
gs2_runs[i].restart(new_run.gs2_runs[i])
|
@@ -202,7 +217,7 @@ class CodeRunner
|
|
202
217
|
end
|
203
218
|
|
204
219
|
# The number of separate flux tube results needed for the jacobian
|
205
|
-
def
|
220
|
+
def n_flux_tubes_jac
|
206
221
|
d1 = dflx_stencil_actual - 1
|
207
222
|
ngrads =d1 * case @grad_option
|
208
223
|
when "tigrad", "ngrad", "lgrad"
|
@@ -224,6 +239,15 @@ class CodeRunner
|
|
224
239
|
#p 'nraaad', @nrad
|
225
240
|
(@nrad-1) * njac
|
226
241
|
end
|
242
|
+
def n_flux_tubes
|
243
|
+
if @neval_calibrate and @neval_calibrate > 0
|
244
|
+
raise "neval_calibrate set but ncc_calibrate not set" unless @ncc_calibrate
|
245
|
+
n_flux_tubes_jac + @ncc_calibrate
|
246
|
+
else
|
247
|
+
n_flux_tubes_jac
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
227
251
|
# Writes the gs2 input files, creating separate subfolders
|
228
252
|
# for them if @subfolders is .true.
|
229
253
|
def generate_gs2_input_files
|
@@ -236,16 +260,26 @@ class CodeRunner
|
|
236
260
|
gs2run = gs2_runs[i]
|
237
261
|
#ep ['gs2_runs[i] in generate', gs2_runs[i].nwrite]
|
238
262
|
#p ['i',i]
|
263
|
+
if i >= n_flux_tubes_jac
|
264
|
+
jn = i - n_flux_tubes_jac + 1
|
265
|
+
run_name = "calibrate_" + @run_name + (jn).to_s
|
266
|
+
folder = "calibrate_#{jn}"
|
267
|
+
else
|
268
|
+
jn = i + 1
|
269
|
+
run_name = @run_name + (jn).to_s
|
270
|
+
folder = "flux_tube_#{jn}"
|
271
|
+
end
|
272
|
+
|
239
273
|
if @subfolders and @subfolders.fortran_true?
|
240
|
-
gs2run.directory = @directory + "/
|
274
|
+
gs2run.directory = @directory + "/" + folder
|
241
275
|
FileUtils.makedirs(gs2run.directory)
|
242
|
-
gs2run.relative_directory = @relative_directory + "/
|
276
|
+
gs2run.relative_directory = @relative_directory + "/" + folder
|
243
277
|
gs2run.restart_dir = gs2run.directory + "/nc"
|
244
278
|
else
|
245
279
|
gs2run.directory = @directory
|
246
280
|
gs2run.relative_directory = @relative_directory
|
247
281
|
end
|
248
|
-
gs2run.run_name =
|
282
|
+
gs2run.run_name = run_name
|
249
283
|
gs2run.nprocs = @nprocs
|
250
284
|
if i==0
|
251
285
|
block = Proc.new{ingen}
|
@@ -264,7 +298,7 @@ class CodeRunner
|
|
264
298
|
if @subfolders and @subfolders.fortran_true?
|
265
299
|
infile = gs2run.directory + "/" + gs2run.run_name + ".in"
|
266
300
|
text = File.read(infile)
|
267
|
-
File.open(infile, 'w'){|f| f.puts text.sub(/restart_dir\s*=\s*"nc"/, "restart_dir = \"
|
301
|
+
File.open(infile, 'w'){|f| f.puts text.sub(/restart_dir\s*=\s*"nc"/, "restart_dir = \"#{folder}/nc\"")}
|
268
302
|
end
|
269
303
|
end
|
270
304
|
end
|
@@ -292,6 +326,9 @@ class CodeRunner
|
|
292
326
|
@component_runs ||= []
|
293
327
|
if @flux_option == "gs2"
|
294
328
|
#puts "HERE"
|
329
|
+
#puts "generate_component_runs", @component_runs.size, @runner.run_list.size, caller.to_a.slice(0..9)
|
330
|
+
#puts @component_runs[1].ginit_option if @component_runs.size > 0
|
331
|
+
#STDIN.gets
|
295
332
|
|
296
333
|
for i in 0...n_flux_tubes
|
297
334
|
component = @component_runs[i]
|
data/trinitycrmod.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
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: trinitycrmod 0.
|
5
|
+
# stub: trinitycrmod 0.5.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "trinitycrmod"
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.5.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Edmund Highcock"]
|
14
|
-
s.date = "
|
14
|
+
s.date = "2015-01-25"
|
15
15
|
s.description = "This module allows Trinity, the Multiscale Gyrokinetic Turbulent Transport solver for Fusion Reactors, to harness the power of CodeRunner, a framework for the automated running and analysis of simulations."
|
16
16
|
s.email = "edmundhighcock@sourceforge.net"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -48,7 +48,7 @@ Gem::Specification.new do |s|
|
|
48
48
|
s.specification_version = 4
|
49
49
|
|
50
50
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
51
|
-
s.add_runtime_dependency(%q<coderunner>, [">= 0.
|
51
|
+
s.add_runtime_dependency(%q<coderunner>, [">= 0.15.5"])
|
52
52
|
s.add_runtime_dependency(%q<text-data-tools>, [">= 1.1.3"])
|
53
53
|
s.add_runtime_dependency(%q<gs2crmod>, [">= 0.11.33"])
|
54
54
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
@@ -56,7 +56,7 @@ Gem::Specification.new do |s|
|
|
56
56
|
s.add_development_dependency(%q<bundler>, ["> 1.0.0"])
|
57
57
|
s.add_development_dependency(%q<jeweler>, [">= 2.0.0"])
|
58
58
|
else
|
59
|
-
s.add_dependency(%q<coderunner>, [">= 0.
|
59
|
+
s.add_dependency(%q<coderunner>, [">= 0.15.5"])
|
60
60
|
s.add_dependency(%q<text-data-tools>, [">= 1.1.3"])
|
61
61
|
s.add_dependency(%q<gs2crmod>, [">= 0.11.33"])
|
62
62
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
@@ -65,7 +65,7 @@ Gem::Specification.new do |s|
|
|
65
65
|
s.add_dependency(%q<jeweler>, [">= 2.0.0"])
|
66
66
|
end
|
67
67
|
else
|
68
|
-
s.add_dependency(%q<coderunner>, [">= 0.
|
68
|
+
s.add_dependency(%q<coderunner>, [">= 0.15.5"])
|
69
69
|
s.add_dependency(%q<text-data-tools>, [">= 1.1.3"])
|
70
70
|
s.add_dependency(%q<gs2crmod>, [">= 0.11.33"])
|
71
71
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trinitycrmod
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.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:
|
11
|
+
date: 2015-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coderunner
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.15.5
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.15.5
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: text-data-tools
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|