gryfxcrmod 0.1.10 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69c84f64a5d074515f4393a796c79c3fefdb23b3
4
- data.tar.gz: 36ac4d1d5e4224efc7af68ac191b5f91836ed67c
3
+ metadata.gz: 800a98285a49848e158c4604a6c228b99f3866e1
4
+ data.tar.gz: a8d9eef858291a583893c8e9d54e282ff0596493
5
5
  SHA512:
6
- metadata.gz: 27138bebfdaa45012ec228aa16c9fae41063c5d6625d7bcb5e7e78bddf2edf9afb9304a5a9b4816634de3c2d910617038cb3bdca6f9cbc6287bb0ffe47124b22
7
- data.tar.gz: 9d66d52602943407a118d9fbaad59bd49600f390b68a03195c13d6af385096f28cfb9cadbbdfcafd61187f89d49087e09a72b3ede1f8560df92aa62a28550b57
6
+ metadata.gz: 9d98226c8cbb4ae969e2a363c070afe83bc5444916dc4ecf530e06682f437a0e6bdd017f11530bc8c97aaa2c5a95c71d3976f2e950a9c8419a0b0e1e4f191575
7
+ data.tar.gz: a6291daacd5e099bef7587205a041a695831391124c297814e4dfdcac020f949dba00c092e4180c9bb918d41983be7cdab6ac246294d507f7a02ea1e8cf8d18a
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.10
1
+ 0.1.11
@@ -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: gryfxcrmod 0.1.10 ruby lib
5
+ # stub: gryfxcrmod 0.1.11 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "gryfxcrmod"
9
- s.version = "0.1.10"
9
+ s.version = "0.1.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 = "2015-07-27"
14
+ s.date = "2016-09-23"
15
15
  s.description = "This is a customised subclass of the CodeRunner::Run class which allows CodeRunner to run and analyse the gyrofluid GPU turbulent transport solver Gryfx."
16
16
  s.email = "edmundhighcock@users.sourceforge.net"
17
17
  s.extra_rdoc_files = [
@@ -42,7 +42,7 @@ Gem::Specification.new do |s|
42
42
  ]
43
43
  s.homepage = "http://github.com/edmundhighcock/gryfxcrmod"
44
44
  s.licenses = ["MIT"]
45
- s.rubygems_version = "2.4.8"
45
+ s.rubygems_version = "2.2.0"
46
46
  s.summary = "CodeRunner module for the Gryfx Gyrofluid Transport Solver"
47
47
 
48
48
  if s.respond_to? :specification_version then
@@ -3,13 +3,18 @@ class CodeRunner
3
3
  #
4
4
  # It generates the Gryfx input file, and both analyses the results and allows easy plotting of them.
5
5
  CodeRunner.setup_run_class('gs2')
6
+ class Gs2
7
+ # This is necessary because the restart
8
+ # parameter overrwrites this function in Gryfx
9
+ alias :set_restart :restart
10
+ end
6
11
  class Gryfx < Gs2
7
12
  #include CodeRunner::SYSTEM_MODULE
8
13
 
9
14
 
10
15
 
11
16
  # Where this file is
12
- @code_module_folder = folder = File.dirname(File.expand_path(__FILE__)) # i.e. the directory this file is in
17
+ @code_module_folder = File.dirname(File.expand_path(__FILE__)) # i.e. the directory this file is in
13
18
 
14
19
  # Use the Run::FortranNamelist tools to process the variable database
15
20
  setup_namelists(@code_module_folder)
@@ -64,11 +69,44 @@ class CodeRunner
64
69
  beginning
65
70
  end
66
71
 
72
+ def set_restart(new_run)
73
+ eputs 'Restarting ' + @run_name
74
+ #(rcp.variables).each{|v| new_run.set(v, send(v)) if send(v)}
75
+ #@naming_pars.delete(:preamble)
76
+ #SUBMIT_OPTIONS.each{|v| new_run.set(v, self.send(v)) unless new_run.send(v)}
77
+ #new_run.is_a_restart = true
78
+ #new_run.restart_id = @id
79
+ #new_run.restart_run_name = @run_name
80
+ #@runner.nprocs = @nprocs if @runner.nprocs == "1" # 1 is the default
81
+ #new_run.run_name = nil
82
+ #new_run.naming_pars = @naming_pars
83
+ #new_run.update_submission_parameters(new_run.parameter_hash_string, false) if new_run.parameter_hash
84
+ #new_run.naming_pars.delete(:restart_id)
85
+ #new_run.generate_run_name
86
+ #copy_restart_files(new_run)
87
+ super(new_run)
88
+ new_run.restart = "on"
89
+ # Gryfx automatically configures GS2 for restart so here we set the GS2
90
+ # parameters to default
91
+ new_run.delt_option = "default"
92
+ new_run.ginit_option = "noise"
93
+ new_run
94
+ end
95
+
96
+ def copy_restart_files(new_run)
97
+ eputs 'Copying gryfx restart file...', ''
98
+ FileUtils.cp(
99
+ @directory + '/' + @run_name + '.restart.cdf',
100
+ new_run.directory + '/' + new_run.run_name + '.restart.cdf'
101
+ )
102
+ super(new_run)
103
+ end
104
+
67
105
 
68
106
  # This is a hook which gets called just before submitting a simulation. It sets up the folder and generates any necessary input files.
69
107
  def generate_input_file
70
108
  if @restart_id and (not @is_a_restart or @resubmit_id)
71
- @runner.run_list[@restart_id].restart(self)
109
+ @runner.run_list[@restart_id].set_restart(self)
72
110
  elsif ((@save_for_restart and @save_for_restart.fortran_true?) or
73
111
  (@save_for_restart_new and @save_for_restart_new.fortran_true?)) and
74
112
  (not @is_a_restart or @resubmit_id)
@@ -76,6 +114,7 @@ class CodeRunner
76
114
  FileUtils.makedirs @restart_dir
77
115
  @restart_file = "#@run_name.nc"
78
116
  end
117
+ @avail_cpu_time = (@wall_mins - 1.0) * 60.0 if @wall_mins
79
118
  write_input_file
80
119
  end
81
120
 
@@ -99,7 +138,7 @@ class CodeRunner
99
138
  #
100
139
  def process_directory_code_specific
101
140
  @grid_option = "box" # For compatibility with the GS2 routines
102
- @write_phi_over_time = "true" # For compatibility with the GS2 routines
141
+ @write_phi_over_time = ".true." # For compatibility with the GS2 routines
103
142
  get_status
104
143
  #p ['id is', id, 'ctd is ', ctd]
105
144
  if ctd
@@ -132,7 +171,16 @@ class CodeRunner
132
171
 
133
172
  def get_completed_timesteps
134
173
  if FileTest.exist?(@run_name + '.cdf')
135
- @completed_timesteps = netcdf_file.var('t').get.size #gsl_vector('t').size
174
+ count = 0
175
+ begin
176
+ @completed_timesteps = netcdf_file.var('t').get.size #gsl_vector('t').size
177
+ rescue NetcdfError => err
178
+ eputs err
179
+ count += 1
180
+ eputs "Retrying: #{count} attempt(s) out of 4"
181
+ sleep 1
182
+ count < 5 ? retry : raise(err)
183
+ end
136
184
  else
137
185
  @completed_timesteps = 0
138
186
  end
@@ -2113,6 +2113,16 @@
2113
2113
  :explanation=>"This variable must be an integer."}],
2114
2114
  :type=>:Integer,
2115
2115
  :autoscanned_defaults=>[1]},
2116
+ :write_netcdf=>
2117
+ {:should_include=>"true",
2118
+ :description=>"Set true to write to netcdf file.",
2119
+ :help=>"",
2120
+ :code_name=>:write_netcdf,
2121
+ :must_pass=>
2122
+ [{:test=>"kind_of? String and FORTRAN_BOOLS.include? self",
2123
+ :explanation=>
2124
+ "This variable must be a fortran boolean. (In Ruby this is represented as a string: e.g. '.true.')"}],
2125
+ :type=>:Fortran_Bool},
2116
2126
  :hyper=>
2117
2127
  {:should_include=>"true",
2118
2128
  :description=>"",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gryfxcrmod
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.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: 2015-07-27 00:00:00.000000000 Z
11
+ date: 2016-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coderunner
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  version: '0'
144
144
  requirements: []
145
145
  rubyforge_project:
146
- rubygems_version: 2.4.8
146
+ rubygems_version: 2.2.0
147
147
  signing_key:
148
148
  specification_version: 4
149
149
  summary: CodeRunner module for the Gryfx Gyrofluid Transport Solver