trinitycrmod 0.6.6 → 0.6.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e806f723897ae7fea3253b2b6f194190df4f0a6
4
- data.tar.gz: 44ebb54fdf4dcd7357b3250fdc64d3036a9ed799
3
+ metadata.gz: a503c473f40ba4b2ca103f5090436139493cb4bf
4
+ data.tar.gz: cc96ac7458372f96ecee8699c46acb961dcb6adb
5
5
  SHA512:
6
- metadata.gz: d39cf428ee12e70619165a41588f64f98a08cb39751afea93f49bfd9aeae17a85ad63ad99ed0a6444ede11fc47dcfdfa546288e0aeb605e813658621d5c859af
7
- data.tar.gz: 6f18556a3a5355d8ee8fbf7006d220704c3ebdeb4c916cd83ab0813f9ab8b717378587958376395342dbdefb44aebe42aa2a03c7ebae44c2b1ababb3e8b76623
6
+ metadata.gz: d72b2c4f73867e77416463d28cdc2f417588a2137670789e273231f19cad231bd189e012e32df00bd185e460160b50c4f89ab0d3715e03ac8e16ba988fd82ede
7
+ data.tar.gz: 0985fc5769ef619c157882057103078adb5a361d9d6eae0f725dbf61369ae19112aedf26e460bca76e82a079b37611ede885311cb27b0ff7149a439ed8e3d498
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.6
1
+ 0.6.7
@@ -31,7 +31,7 @@ class CodeRunner::Trinity
31
31
  array = t_indices.map{|i| get_2d_array_float(options[:outfile], options[:header], /1.*time/)[i].to_gslv}.mean.to_a
32
32
  rho_array = t_indices.map{|i| get_2d_array_float(options[:outfile], options[:radius_match]||/2.*radius/, /1.*time/)[i].to_gslv}.mean.to_a
33
33
  if options[:exclude_perturbed_fluxes]
34
- s = array.size
34
+ #s = array.size
35
35
  array = array.slice(0...nrad-1)
36
36
  rho_array = rho_array.slice(0...nrad-1)
37
37
  end
@@ -92,6 +92,36 @@ class CodeRunner::Trinity
92
92
  def torque_prof_graphkit(options)
93
93
  return pbalance_prof_graphkit(options.absorb({header: /torque/, title: 'Integrated torque', units: 'Nm'}))
94
94
  end
95
+
96
+ def integrate_profkit(kit, area_vectors, t_indices)
97
+ datavecs = kit.data.map{|d| d.y.data}
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 )
102
+
103
+ area2 = rhovec.map{|rh| int.eval(rh)}
104
+ integrated_values = datavecs.map{|dat| (dat.to_gslv*area2.to_gslv).sum}
105
+ k2 = GraphKit.quick_create([list(:t).values, integrated_values])
106
+ k2.title = kit.title
107
+ k2.ylabel = kit.ylabel
108
+ return k2
109
+ end
110
+ private :integrate_profkit
111
+
112
+ # Graph of integrated profiles vs time
113
+ def integrated_profiles_graphkit(options)
114
+ t_indices = list(:t).keys
115
+ kit = t_indices.map{|it| profiles_graphkit(options.absorb({t_index: it}))}.inject{|o,n| o.merge(n)}
116
+ #kit.gnuplot
117
+ #area_vectors = t_indices.map{|i| get_2d_array_float('geo', /13:\s*area/, /1.*time/)[i].to_gslv}
118
+ #system "less #@directory/#@run_name.geo"
119
+ area_vectors = get_1d_array_float('geo', /13:\s*area/)
120
+ kit.each_with_index do |k,ik|
121
+ kit[ik] = integrate_profkit(k, area_vectors, t_indices)
122
+ end
123
+
124
+ end
95
125
  end
96
126
 
97
127
  include TrinityGraphKits
@@ -22,6 +22,10 @@ class CodeRunner
22
22
  # File ending in '.nt': contains profiles: Ti, Te etc.
23
23
  def nt_outfile
24
24
  TextDataTools::Column::DataFile.new(@directory + '/' + @run_name + '.nt', true, /\S+/, /(?:\#\s+)?\d:.*?(?=\d:|\Z)/)
25
+ end
26
+ # File ending in '.geo': contains geometric information
27
+ def geo_outfile
28
+ TextDataTools::Column::DataFile.new(@directory + '/' + @run_name + '.geo', true, /\S+/, /(?:\#\s+)?\d+:\D*?(?=\d:|\d\d:|\Z)/)
25
29
  end
26
30
  # File ending in '.pbalance': contains fluxes and sources
27
31
  def pbalance_outfile
@@ -51,6 +55,12 @@ class CodeRunner
51
55
  cache[:array_2d][[outfile, column_header, index_header]] ||= send(outfile + :_outfile).get_2d_array_float(column_header, index_header)
52
56
  end
53
57
 
58
+ def get_1d_array_float(outfile, column_header)
59
+ cache[:array_1d] = {} unless [:Complete, :Failed].include? @status
60
+ cache[:array_1d] ||= {}
61
+ cache[:array_1d][[outfile, column_header]] ||= send(outfile + :_outfile).get_1d_array_float(column_header)
62
+ end
63
+
54
64
  # Returns a hash of the specified dimension in the form {index=> value} where index is 1-based
55
65
  # Dimension can be:
56
66
  # :t
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.6.6 ruby lib
5
+ # stub: trinitycrmod 0.6.7 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "trinitycrmod"
9
- s.version = "0.6.6"
9
+ s.version = "0.6.7"
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 = "2015-02-20"
14
+ s.date = "2015-02-21"
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.6.6
4
+ version: 0.6.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edmund Highcock
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-20 00:00:00.000000000 Z
11
+ date: 2015-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coderunner