trinitycrmod 0.3.13 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/trinitycrmod/graphs.rb +3 -1
- data/lib/trinitycrmod/trinity.rb +66 -3
- data/trinitycrmod.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16211ebc1a757304ac250cb4a34b7bf71653c309
|
4
|
+
data.tar.gz: f6fc555a64872639ddf3f24fd3f31d9ce5aa6ce8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 452495ee189e29d44751d59644c3cdc835078a6e2cd323e018fe0b441ca9cc59d5ce8062c0444f71080ba62ef3acb24b6a77a9a777d291aed12f1696cf4e20fd
|
7
|
+
data.tar.gz: d1009653a4f0bc66776d074691e21c1567ac6fdf1762c3dadcdbd5a8505ebcb5962f4011054b09ba71900b12ea6bfeb71ed979b6de8a539c85cb5e049c2cb014
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/lib/trinitycrmod/graphs.rb
CHANGED
@@ -72,7 +72,7 @@ class CodeRunner::Trinity
|
|
72
72
|
return nt_prof_graphkit(options.absorb({header: /e\- temp/, title: 'Te', units: 'keV'}))
|
73
73
|
end
|
74
74
|
# Graph of n against rho for a given t_index
|
75
|
-
def
|
75
|
+
def dens_prof_graphkit(options)
|
76
76
|
return nt_prof_graphkit(options.absorb({header: /dens/, title: 'n', units: '10^20 m^-3'}))
|
77
77
|
end
|
78
78
|
|
@@ -92,6 +92,8 @@ class CodeRunner::Trinity
|
|
92
92
|
|
93
93
|
include TrinityGraphKits
|
94
94
|
|
95
|
+
# This is the hook that is called by CodeRunner, providing the
|
96
|
+
# graphkit with the given name and functions to the CodeRunner framework
|
95
97
|
def graphkit(name, options)
|
96
98
|
[:t].each do |var|
|
97
99
|
#ep 'index', var
|
data/lib/trinitycrmod/trinity.rb
CHANGED
@@ -87,10 +87,52 @@ class CodeRunner
|
|
87
87
|
#end
|
88
88
|
|
89
89
|
|
90
|
+
# Modify new_run so that it becomes a restart of self. Adusts
|
91
|
+
# all the parameters of the new run to be equal to the parameters
|
92
|
+
# of the run that calls this function, and sets up its run name
|
93
|
+
# correctly
|
94
|
+
def restart(new_run)
|
95
|
+
#new_run = self.dup
|
96
|
+
(rcp.variables).each{|v| new_run.set(v, send(v)) if send(v)}
|
97
|
+
if @flux_option == "gs2"
|
98
|
+
gs2_runs.each_with_index do |run, i|
|
99
|
+
CodeRunner::Gs2.rcp.variables.each{|v| new_run.gs2_runs[i].set(v, run.send(v)) if run.send(v)}
|
100
|
+
end
|
101
|
+
end
|
102
|
+
@naming_pars.delete(:preamble)
|
103
|
+
SUBMIT_OPTIONS.each{|v| new_run.set(v, self.send(v)) unless new_run.send(v)}
|
104
|
+
#(rcp.results + rcp.gs2_run_info).each{|result| new_run.set(result, nil)}
|
105
|
+
new_run.is_a_restart = true
|
106
|
+
new_run.restart_id = @id
|
107
|
+
new_run.restart_run_name = @run_name
|
108
|
+
new_run.init_option = "restart"
|
109
|
+
new_run.iternt_file = @run_name + ".iternt"
|
110
|
+
new_run.iterflx_file = @run_name + ".iterflx"
|
111
|
+
new_run.init_file = @run_name + ".tmp"
|
112
|
+
@runner.nprocs = @nprocs if @runner.nprocs == "1" # 1 is the default so this means the user probably didn't specify nprocs
|
113
|
+
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
|
114
|
+
# @runner.parameters.each{|var, value| new_run.set(var,value)} if @runner.parameters
|
115
|
+
# ep @runner.parameters
|
116
|
+
new_run.run_name = nil
|
117
|
+
new_run.naming_pars = @naming_pars
|
118
|
+
new_run.update_submission_parameters(new_run.parameter_hash.inspect, false) if new_run.parameter_hash
|
119
|
+
new_run.naming_pars.delete(:restart_id)
|
120
|
+
new_run.generate_run_name
|
121
|
+
eputs 'Copying Restart files', ''
|
122
|
+
system "ls #@directory"
|
123
|
+
['iternt', 'iterflx', 'tmp'].each do |ext|
|
124
|
+
FileUtils.cp("#@directory/#@run_name.#{ext}", "#{new_run.directory}/.")
|
125
|
+
end
|
126
|
+
#@runner.submit(new_run)
|
127
|
+
new_run
|
128
|
+
end
|
90
129
|
# This is a hook which gets called just before submitting a simulation. It sets up the folder and generates any necessary input files.
|
91
130
|
def generate_input_file
|
92
131
|
@run_name += "_t"
|
93
132
|
check_parameters
|
133
|
+
if @restart_id
|
134
|
+
@runner.run_list[@restart_id].restart(self)
|
135
|
+
end
|
94
136
|
write_input_file
|
95
137
|
generate_gs2_input_files if @flux_option == "gs2"
|
96
138
|
end
|
@@ -312,10 +354,14 @@ class CodeRunner
|
|
312
354
|
end
|
313
355
|
else
|
314
356
|
get_completed_timesteps
|
315
|
-
if
|
357
|
+
if @completed_timesteps == @ntstep
|
316
358
|
@status = :Complete
|
317
359
|
else
|
318
|
-
|
360
|
+
if FileTest.exist?(output_file) and File.read(output_file) =~/trinity\s+finished/i
|
361
|
+
@status = :Complete
|
362
|
+
else
|
363
|
+
@status = :Failed
|
364
|
+
end
|
319
365
|
end
|
320
366
|
end
|
321
367
|
end
|
@@ -339,7 +385,7 @@ class CodeRunner
|
|
339
385
|
@ne0 = info_outfile.get_variable_value(/core\s+density/i).to_f
|
340
386
|
@ti0 = info_outfile.get_variable_value(/core\s+T_i/i).to_f
|
341
387
|
@te0 = info_outfile.get_variable_value(/core\s+T_e/i).to_f
|
342
|
-
@omega0 = info_outfile.get_variable_value(/core\s+omega/i).to_f
|
388
|
+
@omega0 = info_outfile.get_variable_value(/core\s+omega/i).to_f rescue 0.0 # Old info files don't have omega
|
343
389
|
#p 'send(fusionQ)', send(:fusionQ)
|
344
390
|
end
|
345
391
|
|
@@ -412,6 +458,23 @@ EOF
|
|
412
458
|
EOF1
|
413
459
|
end
|
414
460
|
|
461
|
+
def run_heuristic_analysis
|
462
|
+
ep 'run_heuristic_analysis', Dir.pwd
|
463
|
+
infiles = Dir.entries.grep(/^[^\.].*\.trin$/)
|
464
|
+
ep infiles
|
465
|
+
raise CRMild.new('No input file') unless infiles[0]
|
466
|
+
raise CRError.new("More than one input file in this directory: \n\t#{infiles}") if infiles.size > 1
|
467
|
+
input_file = infiles[0]
|
468
|
+
#ep 'asdf'
|
469
|
+
@nprocs ||= "1"
|
470
|
+
@executable ||= "/dev/null"
|
471
|
+
make_info_file(input_file, false)
|
472
|
+
end
|
473
|
+
|
474
|
+
def input_file_extension
|
475
|
+
'.trin'
|
476
|
+
end
|
477
|
+
|
415
478
|
end
|
416
479
|
end
|
417
480
|
|
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.4.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.4.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 = "2014-
|
14
|
+
s.date = "2014-03-15"
|
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 = [
|
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.4.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-
|
11
|
+
date: 2014-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coderunner
|