trinitycrdriver 0.1.2 → 0.1.3
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/trinitycrdriver/optimisation.rb +20 -10
- data/trinitycrdriver.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: f7b2758a1b2de950fa15844e8417af7a2fda9347
|
4
|
+
data.tar.gz: d2d260a1b03c9efea5897b29182a2a0e40215248
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e3527b629a309bed3fc36b6b168c50591dcd40e153359499720b33653797ab5b146f21eb8499a8c91550553413fc5f3a2d12f72b36502ad4a69e00731fae48a
|
7
|
+
data.tar.gz: 70cf6073972cbe52db54569f51589bcaa6f5cc1bff4f0cfcdc9c52d8403818d93e128939b1471d909a218858a6a5f12abf2c1bebe11e966f5170a00509e84a90
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
@@ -46,13 +46,13 @@ class CodeRunner::Trinity::Optimisation
|
|
46
46
|
optimisation_meth = case optimisation_method
|
47
47
|
when :simplex
|
48
48
|
FMinimizer::NMSIMPLEX
|
49
|
-
else
|
49
|
+
else
|
50
50
|
raise "Unknown optimisation_method"
|
51
51
|
end
|
52
52
|
@results_hash[:start_time] = Time.now.to_i
|
53
53
|
opt = FMinimizer.alloc(optimisation_meth, @optimisation_variables.size)
|
54
54
|
@parameters_obj = parameters_obj
|
55
|
-
catch(:out_of_time) do
|
55
|
+
catch(:out_of_time) do
|
56
56
|
func = Proc.new{|v, optimiser| optimiser.func(v)}
|
57
57
|
eputs 'Created func'
|
58
58
|
gsl_func = Function.alloc(func, dimension)
|
@@ -89,7 +89,7 @@ class CodeRunner::Trinity::Optimisation
|
|
89
89
|
if ((val_old - val)/val).abs < @parameters_obj.convergence
|
90
90
|
if @parameters_obj.use_ifspppl_first and not @ifspppl_converged
|
91
91
|
@ifspppl_converged = true
|
92
|
-
else
|
92
|
+
else
|
93
93
|
break
|
94
94
|
end
|
95
95
|
end
|
@@ -135,7 +135,7 @@ class CodeRunner::Trinity::Optimisation
|
|
135
135
|
#pars[:trinity][:niter] = 2
|
136
136
|
|
137
137
|
# The line below assumes that the whole first run is done
|
138
|
-
# with ifspppl, in which case we don't want the timestep to get
|
138
|
+
# with ifspppl, in which case we don't want the timestep to get
|
139
139
|
# too large for the gryfx run afterwards.
|
140
140
|
#pars[:trinity][:ntdelt_max] = 0.05
|
141
141
|
#pars[:trinity][:convergetol] = -1.0
|
@@ -212,14 +212,14 @@ class CodeRunner::Trinity::Optimisation
|
|
212
212
|
eputs "Remaining wall mins #{remaining_wall_mins}, wall mins #{@parameters_obj.wall_mins}, start time #{@parameters_obj.start_time}, time #{Time.now.to_i}, margin #{@parameters_obj.wall_mins_margin}"
|
213
213
|
if remaining_wall_mins < @parameters_obj.wall_mins_margin
|
214
214
|
eputs "Run out of time"
|
215
|
-
throw(:out_of_time)
|
216
|
-
end
|
215
|
+
throw(:out_of_time)
|
216
|
+
end
|
217
217
|
eputs "Starting real run, @id = ",@id
|
218
218
|
# Create and initialize the gs run
|
219
219
|
gsrun = gs_runner.run_class.new(gs_runner)
|
220
220
|
raise "No gs_defaults strings" unless @parameters_obj.gs_defaults_strings.size > 0
|
221
221
|
@parameters_obj.gs_defaults_strings.each{|prc| gsrun.instance_eval(prc)}
|
222
|
-
if gs_runner.run_list.size > 0
|
222
|
+
if gs_runner.run_list.size > 0
|
223
223
|
#gsrun.restart_id = @gsid
|
224
224
|
if @parameters_obj.gs_code == 'chease'
|
225
225
|
last_converged = @id
|
@@ -236,7 +236,7 @@ class CodeRunner::Trinity::Optimisation
|
|
236
236
|
pars[:gs][:nfunc] = 4
|
237
237
|
#if prid = @parameters_obj.use_previous_pressure and not @first_trinity_run_completed
|
238
238
|
# If the last trinity run did not converge we may want to run exactly
|
239
|
-
# the same case again, and in particular use the pressure profile from
|
239
|
+
# the same case again, and in particular use the pressure profile from
|
240
240
|
# the previous Trinity run as input (as an unconverged pressure profile
|
241
241
|
# can lead to a wacky GS solution)
|
242
242
|
#gsrun.expeq_in=trinity_runner.combined_run_list[prid].directory + '/chease/EXPEQ.NOSURF'
|
@@ -285,8 +285,18 @@ class CodeRunner::Trinity::Optimisation
|
|
285
285
|
eputs ['Set gs_folder', run.gs_folder]
|
286
286
|
trinity_runner.run_class.instance_variable_set(:@delay_execution, true)
|
287
287
|
if trinity_runner.run_list.size > 0
|
288
|
-
|
289
|
-
|
288
|
+
if (old_run = trinity_runner.run_list[@id]).is_converged?
|
289
|
+
eputs "Previous trinity run #@id converged: using profile as initial condition"
|
290
|
+
run.init_option="trinity"
|
291
|
+
## We have to copy the file because we need to be able to access the original from R
|
292
|
+
#FileUtils.cp("../id_#@id/#{old_run.run_name}.out.nc", "../id_#@id/#{old_run.run_name}_copy.out.nc")
|
293
|
+
run.init_file = "../id_#@id/#{old_run.run_name}.out.nc"
|
294
|
+
run.init_time = old_run.new_netcdf_file.var("t").get[-1]
|
295
|
+
old_run.new_ncclose rescue nil # Make sure the file is closed
|
296
|
+
else
|
297
|
+
eputs "Previous trinity run #@id not converged: restarting"
|
298
|
+
run.restart_id = @id
|
299
|
+
end
|
290
300
|
end
|
291
301
|
eputs 'Submitting run'
|
292
302
|
run.wall_mins = remaining_wall_mins
|
data/trinitycrdriver.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
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: trinitycrdriver 0.1.
|
5
|
+
# stub: trinitycrdriver 0.1.3 ruby lib
|
6
6
|
# stub: ext/trinitycrdriver/extconf.rb
|
7
7
|
|
8
8
|
Gem::Specification.new do |s|
|
9
9
|
s.name = "trinitycrdriver"
|
10
|
-
s.version = "0.1.
|
10
|
+
s.version = "0.1.3"
|
11
11
|
|
12
12
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
13
13
|
s.require_paths = ["lib"]
|
14
14
|
s.authors = ["Edmund Highcock"]
|
15
|
-
s.date = "2016-
|
15
|
+
s.date = "2016-07-22"
|
16
16
|
s.description = "A gem to allow coderunner to run the trinity code directly."
|
17
17
|
s.email = "edmundhighcock@users.sourceforge.net"
|
18
18
|
s.extensions = ["ext/trinitycrdriver/extconf.rb"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trinitycrdriver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
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-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coderunner
|