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



82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/gs2crmod/gsl_data.rb', line 82

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.



104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/gs2crmod/gsl_data.rb', line 104

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



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/gs2crmod/gsl_data.rb', line 63

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