trinitycrmod 0.8.10 → 0.8.11
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 +14 -7
- data/lib/trinitycrmod/read_netcdf.rb +26 -5
- data/lib/trinitycrmod/trinity.rb +17 -3
- data/lib/trinitycrmod/trinity_gs2.rb +7 -3
- data/trinitycrmod.gemspec +4 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f1483d6a2c54bf25934cd21ab4ea09aac04046d
|
4
|
+
data.tar.gz: e918fe7626ebc736ec38efbf0bc3d8bd29e99925
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78d81fb7310a3b62d9d2edb610b09f0289de4b8461dc70fbd0921fe299f4960c4443ae1a9fd527a256b855afd9cdbbf0dfd5a90106a4bbb2fe07ff9fbd7648d1
|
7
|
+
data.tar.gz: 96bbc8c46ace6eecad55b20fc514f6c71ff24c90ffd352644a21c130a2e9929b38018cc832820b66a5e473d8e9be10cf4fc6a3d18f9bf1961ca8c156cf691086
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.11
|
data/lib/trinitycrmod/graphs.rb
CHANGED
@@ -96,13 +96,20 @@ class CodeRunner::Trinity
|
|
96
96
|
def integrate_profkit(kit, area_vectors, t_indices)
|
97
97
|
datavecs = kit.data.map{|d| d.y.data}
|
98
98
|
#p 'datavecs.size', datavecs.size
|
99
|
-
rhovec = kit.data[0].x.data
|
100
|
-
rhoarea_vectors = get_1d_array_float('geo', /1:\s*rho/)
|
101
|
-
int = GSL::ScatterInterp.alloc(:linear, [rhoarea_vectors.to_gslv, area_vectors.to_gslv], false )
|
99
|
+
#rhovec = kit.data[0].x.data
|
100
|
+
#rhoarea_vectors = get_1d_array_float('geo', /1:\s*rho/)
|
101
|
+
#int = GSL::ScatterInterp.alloc(:linear, [rhoarea_vectors.to_gslv, area_vectors.to_gslv], false )
|
102
102
|
|
103
|
-
area2 = rhovec.map{|rh| int.eval(rh)}
|
104
|
-
|
105
|
-
|
103
|
+
#area2 = rhovec.map{|rh| int.eval(rh)}
|
104
|
+
#area_vectors = new_netcdf_file.var('area_grid').get[-1].to_gslv
|
105
|
+
grho_vector= new_netcdf_file.var('grho_grid').get.to_a[-1].to_gslv
|
106
|
+
rho_vector= new_netcdf_file.var('rad_grid').get.to_a[-1][-1].to_gslv
|
107
|
+
integrated_values = datavecs.map{|dat|
|
108
|
+
p 'dat.size', dat.size, area_vectors.size, grho_vector.size
|
109
|
+
integrand = dat.to_gslv*area_vectors/grho_vector
|
110
|
+
(integrand.subvector(0,dat.size-1) * (rho_vector.subvector(1,dat.size-1) - rho_vector.subvector(0,dat.size-1))).sum
|
111
|
+
}
|
112
|
+
k2 = GraphKit.quick_create([list(:t).values.to_gslv, integrated_values])
|
106
113
|
k2.title = kit.title
|
107
114
|
k2.ylabel = kit.ylabel
|
108
115
|
return k2
|
@@ -116,7 +123,7 @@ class CodeRunner::Trinity
|
|
116
123
|
#kit.gnuplot
|
117
124
|
#area_vectors = t_indices.map{|i| get_2d_array_float('geo', /13:\s*area/, /1.*time/)[i].to_gslv}
|
118
125
|
#system "less #@directory/#@run_name.geo"
|
119
|
-
area_vectors =
|
126
|
+
area_vectors = new_netcdf_file.var('area_grid').get.to_a[-1].to_gslv
|
120
127
|
kit.each_with_index do |k,ik|
|
121
128
|
kit[ik] = integrate_profkit(k, area_vectors, t_indices)
|
122
129
|
end
|
@@ -73,7 +73,7 @@ class NetcdfSmartReader
|
|
73
73
|
end
|
74
74
|
def dim_start(name, options)
|
75
75
|
sym = name.to_sym
|
76
|
-
if i=options[sym + :_index]
|
76
|
+
if i=options[sym + :_index] or i = options[sym]
|
77
77
|
return i-1
|
78
78
|
elsif i=options[sym + :_element]
|
79
79
|
return i
|
@@ -88,7 +88,7 @@ class NetcdfSmartReader
|
|
88
88
|
end
|
89
89
|
def dim_end(name, options)
|
90
90
|
sym = name.to_sym
|
91
|
-
if i=options[sym + :_index]
|
91
|
+
if i=options[sym + :_index] or i=options[sym]
|
92
92
|
return i-1
|
93
93
|
elsif i=options[sym + :_element]
|
94
94
|
return i
|
@@ -99,12 +99,12 @@ class NetcdfSmartReader
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
def self.dimensions
|
102
|
-
['t','tspec', 'iter', 'rad', 'cc', 'mrow', 'mcol', 'ivar', 'jac', 'grad', 'eval', 'cegrid']
|
102
|
+
['t','tspec', 'iter', 'rad', 'cc', 'mrow', 'mcol', 'ivar', 'jac', 'grad', 'eval', 'cegrid', 'job']
|
103
103
|
end
|
104
104
|
|
105
105
|
def axiskit(variable, options)
|
106
106
|
case variable
|
107
|
-
when 'mrow', 'mcol', 'ivar', 'tspec', 'iter', 'jac', 'grad', 'eval'
|
107
|
+
when 'mrow', 'mcol', 'ivar', 'tspec', 'iter', 'jac', 'grad', 'eval', 'job'
|
108
108
|
return GraphKit::AxisKit.autocreate(data: GSL::Vector.linspace(1, sz=@file.dim(variable).length, sz), title: variable)
|
109
109
|
end
|
110
110
|
GraphKit::AxisKit.autocreate(data: read_variable(variable, options), units: @file.var(variable).att('units').get, title: @file.var(variable).att('description').get.sub(/(,|summed|average).*$/, '').sub(/[vV]alues of (the )?/, '').sub(/ coordinate/, '').sub(/.*rho.*The definition.*/, 'rho'))
|
@@ -147,6 +147,9 @@ def netcdf_smart_reader
|
|
147
147
|
NetcdfSmartReader.new(new_netcdf_file)
|
148
148
|
end
|
149
149
|
|
150
|
+
class SmartGraphKitError < StandardError
|
151
|
+
end
|
152
|
+
|
150
153
|
def smart_graphkit(options)
|
151
154
|
case options[:command]
|
152
155
|
when :help
|
@@ -154,7 +157,25 @@ def smart_graphkit(options)
|
|
154
157
|
when :options
|
155
158
|
[:nmat_index, :t_index, :tspec_index, :iter_index]
|
156
159
|
else
|
157
|
-
|
160
|
+
case options[:graphkit_name]
|
161
|
+
when /_vs_/
|
162
|
+
kits = options[:graphkit_name].sub(/^nc_/, '').split(/_vs_/).map{|n| netcdf_smart_reader.graphkit(n, options)}
|
163
|
+
kit = kits[-1]
|
164
|
+
raise SmartGraphKitError.new("Number of axes does not match number of variables") if kits.size != kit.naxes
|
165
|
+
for i in 0...kit.data.size
|
166
|
+
if kit.naxes > 1
|
167
|
+
kit.data[i].x = kits[0].data[i].y
|
168
|
+
end
|
169
|
+
if kit.naxes > 2
|
170
|
+
kit.data[i].x = kits[0].data[i].z
|
171
|
+
kit.data[i].y = kits[1].data[i].z
|
172
|
+
end
|
173
|
+
end
|
174
|
+
kit.autocreate
|
175
|
+
kit
|
176
|
+
else
|
177
|
+
netcdf_smart_reader.graphkit(options[:graphkit_name].sub(/^nc_/, ''), options)
|
178
|
+
end
|
158
179
|
end
|
159
180
|
end
|
160
181
|
|
data/lib/trinitycrmod/trinity.rb
CHANGED
@@ -111,6 +111,12 @@ class CodeRunner
|
|
111
111
|
new_run.flux_runs[i].set(v, run.send(v)) if run.send(v) or new_run.flux_runs[i].send(v)
|
112
112
|
}
|
113
113
|
end
|
114
|
+
elsif @flux_option == "gryfx"
|
115
|
+
flux_runs.each_with_index do |run, i|
|
116
|
+
CodeRunner::Gryfx.rcp.variables.each{|v|
|
117
|
+
new_run.flux_runs[i].set(v, run.send(v)) if run.send(v) or new_run.flux_runs[i].send(v)
|
118
|
+
}
|
119
|
+
end
|
114
120
|
end
|
115
121
|
@naming_pars.delete(:preamble)
|
116
122
|
SUBMIT_OPTIONS.each{|v| new_run.set(v, self.send(v)) unless new_run.send(v)}
|
@@ -128,8 +134,6 @@ class CodeRunner
|
|
128
134
|
# This is unnecessary for single restart file.
|
129
135
|
warning( "Restart is not on the same number of processors as the previous run: new is #{new_run.nprocs.inspect} and old is #{@nprocs.inspect}... this is only OK if you are using parallel netcdf and single restart files.") if flux_gs2? and not new_run.no_restart_gs2 and (!new_run.nprocs or new_run.nprocs != @nprocs)
|
130
136
|
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
|
131
|
-
# @runner.parameters.each{|var, value| new_run.set(var,value)} if @runner.parameters
|
132
|
-
# ep @runner.parameters
|
133
137
|
new_run.run_name = nil
|
134
138
|
new_run.naming_pars = @naming_pars
|
135
139
|
new_run.update_submission_parameters(new_run.parameter_hash.inspect, false) if new_run.parameter_hash
|
@@ -163,6 +167,16 @@ class CodeRunner
|
|
163
167
|
end
|
164
168
|
end
|
165
169
|
end
|
170
|
+
if (new_run.flux_gryfx? and flux_gryfx?) and not new_run.no_restart_gs2
|
171
|
+
for i in 0...n_flux_tubes
|
172
|
+
break if i >= new_run.n_flux_tubes
|
173
|
+
next if not FileTest.exist? flux_runs[i].directory + '/' + flux_runs[i].run_name + '.restart.cdf'
|
174
|
+
folder = flux_folder_name(i)
|
175
|
+
new_run.flux_runs[i].directory = new_run.directory + "/#{folder}"
|
176
|
+
FileUtils.makedirs(new_run.flux_runs[i].directory)
|
177
|
+
flux_runs[i].set_restart(new_run.flux_runs[i])
|
178
|
+
end
|
179
|
+
end
|
166
180
|
new_run
|
167
181
|
end
|
168
182
|
# This is a hook which gets called just before submitting a simulation. It sets up the folder and generates any necessary input files.
|
@@ -407,7 +421,7 @@ class CodeRunner
|
|
407
421
|
if not component
|
408
422
|
#p "HEELO"
|
409
423
|
#p [i, '3,', component, '4', @component_runs.size]
|
410
|
-
component = @component_runs[i] = fclass.new(@runner, self).create_component
|
424
|
+
component = @component_runs[i] = fclass.new(@runner, self, i).create_component
|
411
425
|
#component.instance_variable_set(:@output_file, output_file)
|
412
426
|
#p [i, '3,', component, '4', @component_runs.size]
|
413
427
|
if false
|
@@ -10,11 +10,15 @@ class CodeRunner
|
|
10
10
|
class Trinity
|
11
11
|
module TrinityComponent
|
12
12
|
attr_accessor :trinity_run
|
13
|
-
def initialize(runner, trinity_run)
|
13
|
+
def initialize(runner, trinity_run, trinity_id)
|
14
14
|
super(runner)
|
15
15
|
@trinity_run = trinity_run
|
16
|
+
@trinity_id = trinity_id
|
16
17
|
self
|
17
18
|
end
|
19
|
+
def generate_run_name
|
20
|
+
@run_name = @trinity_run.flux_run_name(@trinity_id)
|
21
|
+
end
|
18
22
|
def output_file
|
19
23
|
#@output_file ||= '../' + self.class.to_s
|
20
24
|
'../' + @trinity_run.output_file
|
@@ -25,7 +29,7 @@ class CodeRunner
|
|
25
29
|
#'aa'
|
26
30
|
end
|
27
31
|
def dup
|
28
|
-
return self.class.new(@runner, @trinity_run).learn_from(self)
|
32
|
+
return self.class.new(@runner, @trinity_run, @trinity_id).learn_from(self)
|
29
33
|
end
|
30
34
|
def save
|
31
35
|
#p ['output_file', output_file]
|
@@ -83,7 +87,7 @@ end)
|
|
83
87
|
EOF2
|
84
88
|
|
85
89
|
}
|
86
|
-
FileUtils.mv(defaults_filename, central_defaults_filename)
|
90
|
+
#FileUtils.mv(defaults_filename, central_defaults_filename)
|
87
91
|
FileUtils.rm(tmp_filename)
|
88
92
|
CodeRunner.fetch_runner(C: rcp.code, m: (rcp.modlet? ? rcp.modlet : nil), D: name)
|
89
93
|
|
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.8.
|
5
|
+
# stub: trinitycrmod 0.8.11 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "trinitycrmod"
|
9
|
-
s.version = "0.8.
|
9
|
+
s.version = "0.8.11"
|
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 = "2016-
|
14
|
+
s.date = "2016-04-01"
|
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 = [
|
@@ -45,7 +45,7 @@ Gem::Specification.new do |s|
|
|
45
45
|
]
|
46
46
|
s.homepage = "http://github.com/edmundhighcock/trinitycrmod"
|
47
47
|
s.licenses = ["GPLv3"]
|
48
|
-
s.rubygems_version = "2.
|
48
|
+
s.rubygems_version = "2.2.0"
|
49
49
|
s.summary = "CodeRunner module for the Trinity simulation software."
|
50
50
|
|
51
51
|
if s.respond_to? :specification_version then
|
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.8.
|
4
|
+
version: 0.8.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edmund Highcock
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coderunner
|
@@ -203,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
203
203
|
version: '0'
|
204
204
|
requirements: []
|
205
205
|
rubyforge_project:
|
206
|
-
rubygems_version: 2.
|
206
|
+
rubygems_version: 2.2.0
|
207
207
|
signing_key:
|
208
208
|
specification_version: 4
|
209
209
|
summary: CodeRunner module for the Trinity simulation software.
|