Module: CodeRunner::Gs2::FixNormOption

Included in:
CodeRunner::Gs2
Defined in:
lib/gs2crmod/gsl_data.rb

Instance Method Summary collapse

Instance Method Details

#fix_heat_flux_norm(tensor, options = {}) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/gs2crmod/gsl_data.rb', line 75

def fix_heat_flux_norm(tensor, options={})
	case fix_norm_action(options)
	when :none
		#eputs "none"
		return tensor
	when :to_root_2
		eputs "to_root_2"
		return tensor / 2.0**1.5
	when :from_root_2
		return tensor * 2.0**1.5
	end
end

#fix_norm(tensor, power, options = {}) ⇒ Object

Return tensor normalised according to options (which may be “t_over_m”, “bd” or “with_root_2”, “mtk” etc) regardless of the original normalisation.

power should be the power to which the reference thermal velocity is raised in the normalising quantity. For example, t is normalised to a / v_thr, so for times, power should be set equal to -1.



97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/gs2crmod/gsl_data.rb', line 97

def fix_norm(tensor, power, options={})
	case fix_norm_action(options)
	when :none
		#eputs "none"
		return tensor
	when :to_root_2
		eputs "to_root_2"
		return tensor / 2.0**(0.5 * power)
	when :from_root_2
		return tensor * 2.0**(0.5 * power)
	end
end

#fix_norm_action(options) ⇒ Object

class << self



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/gs2crmod/gsl_data.rb', line 56

def fix_norm_action(options)
	case options[:set_norm_option]
	when "t_over_m", "bd"
		if ["t_over_m", "bd"].include? @norm_option
			return :none
		else
			return :from_root_2
		end
	else
		#eputs "else", norm_option
		if ["t_over_m", "bd"].include? @norm_option
			#eputs "norm old"
			return :to_root_2
		else
			return :none
		end
	end
end