Skip to content
Permalink
Browse files

--Can now submit gs2 runs

  • Loading branch information...
edmundhighcock committed Feb 3, 2014
1 parent 1b065cb commit 0797dbea0c2ec273d3282b634f29c48451814566
@@ -3,13 +3,13 @@ source "http://rubygems.org"
# Example:
gem "coderunner", ">= 0.13.32"
gem "text-data-tools", ">= 1.1.3"
gem "gs2crmod", ">=0.11"
gem "gs2crmod", ">=0.11.9"

# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
group :development do
gem "shoulda", ">= 0"
gem "rdoc", "~> 3.12"
gem "bundler", "> 1.0.0"
gem "jeweler", ">= 1.8.4"
gem "jeweler", ">= 2.0.0"
end
@@ -820,7 +820,16 @@
:explanation=>
"This variable must be a fortran boolean. (In Ruby this is represented as a string: e.g. '.true.')"}],
:type=>:Fortran_Bool,
:autoscanned_defaults=>[".true."]}}},
:autoscanned_defaults=>[".true."]},
:subfolders=>
{:should_include=>"true",
:description=>"If true, run flux tubes in numbered subfolders.",
:help=>"If true, run flux tubes in numbered subfolders.",
:code_name=>:subfolders,
:must_pass=>
[{:test=>"kind_of? Integer",
:explanation=>"This variable must be an integer."}],
:type=>:Integer}}},
:init=>
{:description=>"",
:should_include=>"true",
@@ -1201,78 +1210,70 @@
:autoscanned_defaults=>[".false."]},
:nbi_mult=>
{:should_include=>"true",
:description=>
" multiplies QNBII, QNBIE and SNBIE when using the tokamak profile db, may not be self consistent when using TORQ for torque input (as opposed to pioq)",
:help=>
" multiplies QNBII, QNBIE and SNBIE when using the tokamak profile db, may not be self consistent when using TORQ for torque input (as opposed to pioq)",
:description=>nil,
:help=>nil,
:code_name=>:nbi_mult,
:must_pass=>
[{:test=>"kind_of? Numeric",
:explanation=>
"This variable must be a floating point number (an integer is also acceptable: it will be converted into a floating point number)."}],
:type=>:Float,
:autoscanned_defaults=>[1.0]},
:autoscanned_defaults=>[]},
:icrh_mult=>
{:should_include=>"true",
:description=>
" multiplies QICRHI and QICRHE when using the tokamak profile db",
:help=>
" multiplies QICRHI and QICRHE when using the tokamak profile db",
:description=>nil,
:help=>nil,
:code_name=>:icrh_mult,
:must_pass=>
[{:test=>"kind_of? Numeric",
:explanation=>
"This variable must be a floating point number (an integer is also acceptable: it will be converted into a floating point number)."}],
:type=>:Float,
:autoscanned_defaults=>[1.0]},
:autoscanned_defaults=>[]},
:ech_mult=>
{:should_include=>"true",
:description=>
" multiplies QECHI and QECHE when using the tokamak profile db",
:help=>" multiplies QECHI and QECHE when using the tokamak profile db",
:description=>nil,
:help=>nil,
:code_name=>:ech_mult,
:must_pass=>
[{:test=>"kind_of? Numeric",
:explanation=>
"This variable must be a floating point number (an integer is also acceptable: it will be converted into a floating point number)."}],
:type=>:Float,
:autoscanned_defaults=>[1.0]},
:autoscanned_defaults=>[]},
:lh_mult=>
{:should_include=>"true",
:description=>
" multiplies QLHI and QLHE when using the tokamak profile db",
:help=>" multiplies QLHI and QLHE when using the tokamak profile db",
:description=>nil,
:help=>nil,
:code_name=>:lh_mult,
:must_pass=>
[{:test=>"kind_of? Numeric",
:explanation=>
"This variable must be a floating point number (an integer is also acceptable: it will be converted into a floating point number)."}],
:type=>:Float,
:autoscanned_defaults=>[1.0]},
:autoscanned_defaults=>[]},
:ibw_mult=>
{:should_include=>"true",
:description=>
" multiplies QIBWI and QIBWE when using the tokamak profile db",
:help=>" multiplies QIBWI and QIBWE when using the tokamak profile db",
:description=>nil,
:help=>nil,
:code_name=>:ibw_mult,
:must_pass=>
[{:test=>"kind_of? Numeric",
:explanation=>
"This variable must be a floating point number (an integer is also acceptable: it will be converted into a floating point number)."}],
:type=>:Float,
:autoscanned_defaults=>[1.0]},
:autoscanned_defaults=>[]},
:dwn_mult=>
{:should_include=>"true",
:description=>
" multiplies DWIR, DWER, DNER when using the tokamak profile db",
:help=>" multiplies DWIR, DWER, DNER when using the tokamak profile db",
:description=>nil,
:help=>nil,
:code_name=>:dwn_mult,
:must_pass=>
[{:test=>"kind_of? Numeric",
:explanation=>
"This variable must be a floating point number (an integer is also acceptable: it will be converted into a floating point number)."}],
:type=>:Float,
:autoscanned_defaults=>[1.0]}}},
:autoscanned_defaults=>[]}}},
:physics=>
{:description=>"",
:should_include=>"true",
@@ -78,21 +78,42 @@ def print_out_line
def generate_input_file
@run_name += "_t"
write_input_file
if @flux_option == "gs2"
for i in 0...(@nrad-1)
gs2run = gs2_run(:base).dup
gs2_run(i).instance_variables.each do |var|
gs2run.instance_variable_set(var, gs2_run(i).instance_variable_get(var))
end
gs2run.run_name = @run_name + i.to_s
gs2run.nprocs = @nprocs
gs2run.directory = @directory
gs2run.relative_directory = @relative_directory
gs2run.generate_input_file
end
generate_gs2_input_files if @flux_option == "gs2"
end

# Writes the gs2 input files, creating separate subfolders
# for them if @subfolders is .true.
def generate_gs2_input_files
for i in 0...(@nrad-1)*2
gs2run = gs2_run(:base).dup
gs2_run(i).instance_variables.each do |var|
gs2run.instance_variable_set(var, gs2_run(i).instance_variable_get(var))
end
if @subfolders and @subfolders.fortran_true?
gs2run.directory = @directory + "/flux_tube_#{i+1}"
FileUtils.makedirs(gs2run.directory)
gs2run.relative_directory = @relative_directory + "/flux_tube_#{i+1}"
gs2run.restart_dir = gs2run.directory + "/nc"
else
gs2run.directory = @directory
gs2run.relative_directory = @relative_directory
end
gs2run.run_name = @run_name + (i+1).to_s
gs2run.nprocs = @nprocs
Dir.chdir(gs2run.directory){gs2run.generate_input_file}
if @subfolders and @subfolders.fortran_true?
infile = gs2run.directory + "/" + gs2run.run_name + ".in"
text = File.read(infile)
File.open(infile, 'w'){|f| f.puts text.sub(/restart_dir\s*=\s*"nc"/, "restart_dir = \"flux_tube_#{i+1}/nc\"")}
end
end
end

def vim_output
system "vim -Ro #{output_file} #{error_file} #@directory/#@run_name.error #@directory/#@run_name.out "
end
alias :vo :vim_output

# This command uses the infrastructure provided by Run::FortranNamelist, provided by CodeRunner itself.
def write_input_file
File.open(@run_name + ".trin", 'w'){|file| file.puts input_file_text}
@@ -10,7 +10,7 @@
/

&theta_grid_parameters
ntheta= 16
ntheta= 8
nperiod= 1

! commented out parameters specified via Trinity
@@ -118,10 +118,10 @@

&kt_grids_box_parameters
! (25-1)/3+1 = 9 ky values
ny = 96
ny = 8

! 2*(40-1)/3 + 1 = 27 kx values
nx = 96
nx = 8

! dky = 1/y0 = 0.1 => ky: 0 -> 0.8
y0 = 10.
@@ -133,8 +133,8 @@
/

&le_grids_knobs
ngauss = 5
negrid = 16
ngauss = 3
negrid = 6
vcut= 2.5
/

@@ -144,7 +144,7 @@
fapar = 0.0
faperp = 0.0
delt = 0.01
nstep = 1000
nstep = 60
/

&fields_knobs
@@ -3,11 +3,11 @@

&geometry
geo_option = "iterdb"
geo_file = "pr08_jet_42982_2d.dat"
geo_file = "../../pr08_jet_42982_2d.dat"
geo_time = 15.2
fluxlabel_option = "aminor"
rad_out = 0.85
nrad = 9
nrad = 5
use_external_geo = .false.
write_dbinfo = .true.
/
@@ -34,8 +34,9 @@ ntdelt_max = 100.0
&fluxes
flux_option = "gs2"
vtfac = 2.0
grad_option = "tgrads"
grad_option = "tigrad"
fork_flag = .true.
subfolders = .true.
/

&physics
@@ -32,7 +32,11 @@ def setup
}
end
def test_submit
CodeRunner.submit(Y: 'test/gs2_42982', T: true, X: '/dev/null', n: '8')
if ENV['TRINITY_EXEC']
CodeRunner.submit(Y: 'test/gs2_42982', X: ENV['TRINITY_EXEC'], n: '8')
else
CodeRunner.submit(Y: 'test/gs2_42982', T: true, X: '/dev/null', n: '8')
end
end
end

0 comments on commit 0797dbe

Please sign in to comment.
You can’t perform that action at this time.