Class: CodeRunner::Gryfx

Inherits:
Run::FortranNamelistC
  • Object
show all
Defined in:
lib/gryfxcrmod/gryfx.rb

Overview

This is a customised subclass of the CodeRunner::Run class which allows CodeRunner to run and analyse the gyrofluid GPU turbulent transport solver Gryfx.

It  generates the Gryfx input file, and both analyses the results and allows easy plotting of them.

Instance Method Summary collapse

Instance Method Details

#generate_input_fileObject

This is a hook which gets called just before submitting a simulation. It sets up the folder and generates any necessary input files.



55
56
57
# File 'lib/gryfxcrmod/gryfx.rb', line 55

def generate_input_file
		write_input_file
end

#parameter_stringObject

Parameters which follow the Trinity executable, in this case just the input file.



65
66
67
# File 'lib/gryfxcrmod/gryfx.rb', line 65

def parameter_string
	@run_name + ".in"
end

#parameter_transitionObject



69
70
# File 'lib/gryfxcrmod/gryfx.rb', line 69

def parameter_transition
end

A hook which gets called when printing the standard run information to the screen using the status command.



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/gryfxcrmod/gryfx.rb', line 39

def print_out_line
	#p ['id', id, 'ctd', ctd]
	#p rcp.results.zip(rcp.results.map{|r| send(r)})
	name = @run_name
	name += " (res: #@restart_id)" if @restart_id
	name += " real_id: #@real_id" if @real_id
	beginning = sprintf("%2d:%d %-60s %1s:%2.1f(%s) %3s%1s",  @id, @job_no, name, @status.to_s[0,1],  @run_time.to_f / 60.0, @nprocs.to_s, percent_complete, "%")
	if ctd
		beginning += sprintf("Q:%f, Pfusion:%f MW, Ti0:%f keV, Te0:%f keV, n0:%f x10^20", fusionQ, pfus, ti0, te0, ne0)
	end
	beginning += "  ---#{@comment}" if @comment
	beginning
end

#process_directory_code_specificObject

This method, as its name suggests, is called whenever CodeRunner is asked to analyse a run directory. This happens if the run status is not :Complete, or if the user has specified recalc_all(-A on the command line) or reprocess_all (-a on the command line).



77
78
79
80
81
82
83
84
# File 'lib/gryfxcrmod/gryfx.rb', line 77

def process_directory_code_specific
	get_status
	#p ['id is', id, 'ctd is ', ctd]
	if ctd
		calculate_results 
	end
	#p ['fusionQ is ', fusionQ]
end

#write_input_fileObject

This command uses the infrastructure provided by Run::FortranNamelist, provided by CodeRunner itself.



60
61
62
# File 'lib/gryfxcrmod/gryfx.rb', line 60

def write_input_file
	File.open(@run_name + ".in", 'w'){|file| file.puts input_file_text}
end