gs2crmod 0.12.2 → 0.12.3
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.
- data/VERSION +1 -1
 - data/gs2crmod.gemspec +2 -2
 - data/lib/gs2crmod/calculations.rb +7 -26
 - data/lib/gs2crmod/gs2.rb +1 -0
 - metadata +2 -2
 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            0.12. 
     | 
| 
      
 1 
     | 
    
         
            +
            0.12.3
         
     | 
    
        data/gs2crmod.gemspec
    CHANGED
    
    | 
         @@ -5,11 +5,11 @@ 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       7 
7 
     | 
    
         
             
              s.name = "gs2crmod"
         
     | 
| 
       8 
     | 
    
         
            -
              s.version = "0.12. 
     | 
| 
      
 8 
     | 
    
         
            +
              s.version = "0.12.3"
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         
     | 
| 
       11 
11 
     | 
    
         
             
              s.authors = ["Edmund Highcock", "Ferdinand van Wyk"]
         
     | 
| 
       12 
     | 
    
         
            -
              s.date = "2015-08- 
     | 
| 
      
 12 
     | 
    
         
            +
              s.date = "2015-08-18"
         
     | 
| 
       13 
13 
     | 
    
         
             
              s.description = "GS2 is a gyrokinetic flux tube initial value turbulence code which can be used for fusion or astrophysical plasmas. CodeRunner is a framework for the automated running and analysis of large simulations. This module allows GS2 (and its sister code AstroGK) to harness the power of the CodeRunner framework."
         
     | 
| 
       14 
14 
     | 
    
         
             
              s.email = "edmundhighcock@sourceforge.net"
         
     | 
| 
       15 
15 
     | 
    
         
             
              s.extensions = ["ext/extconf.rb"]
         
     | 
| 
         @@ -430,47 +430,38 @@ def calculate_transient_amplifications 
     | 
|
| 
       430 
430 
     | 
    
         
             
            		end
         
     | 
| 
       431 
431 
     | 
    
         | 
| 
       432 
432 
     | 
    
         
             
            		@transient_amplification_at_ky ||= FloatHash.new
         
     | 
| 
      
 433 
     | 
    
         
            +
            		@max_transient_amplification_index_at_ky ||= FloatHash.new
         
     | 
| 
       433 
434 
     | 
    
         
             
             		eputs
         
     | 
| 
       434 
435 
     | 
    
         
             
            		to_calc.each do |kxy|
         
     | 
| 
       435 
436 
     | 
    
         
             
            			transient_amplifications = send(:transient_amplification_at_ + kxy)
         
     | 
| 
       436 
437 
     | 
    
         
             
            			list(kxy).values.sort.each do |value|
         
     | 
| 
       437 
     | 
    
         
            -
            			
         
     | 
| 
       438 
     | 
    
         
            -
            				#p transient_amplifications.keys, value, transient_amplifications[value.to_f-0.0],
         
     | 
| 
       439 
     | 
    
         
            -
            				#transient_amplifications.class, transient_amplifications.keys.include?(value); exit
         
     | 
| 
       440 
     | 
    
         
            -
            		
         
     | 
| 
       441 
438 
     | 
    
         
             
            				next if transient_amplifications.keys.include? value
         
     | 
| 
       442 
     | 
    
         
            -
             
     | 
| 
       443 
439 
     | 
    
         | 
| 
       444 
440 
     | 
    
         
             
            				Terminal.erewind(1)
         
     | 
| 
       445 
     | 
    
         
            -
            				#ep transient_amplifications.keys
         
     | 
| 
       446 
441 
     | 
    
         
             
            				eputs sprintf("Calculating transient amplification for #{kxy} = % 1.5e#{Terminal::CLEAR_LINE}", value) 
         
     | 
| 
       447 
     | 
    
         
            -
             
     | 
| 
       448 
     | 
    
         
            -
             
     | 
| 
       449 
     | 
    
         
            -
            						# Mode has 0 growth rate at ky==0
         
     | 
| 
      
 442 
     | 
    
         
            +
                            
         
     | 
| 
      
 443 
     | 
    
         
            +
                            # Mode has 0 growth rate at ky==0
         
     | 
| 
       450 
444 
     | 
    
         
             
            				(transient_amplifications[value] = 0.0; next) if value == 0.0 and kxy == :ky 
         
     | 
| 
       451 
445 
     | 
    
         
             
            				phi2_vec = gsl_vector("phi2_by_#{kxy}_over_time", {kxy=>value})
         
     | 
| 
       452 
     | 
    
         
            -
            				#(transient_amplifications[value] = 0.0; next) if phi2_vec.min <= 0.0
         
     | 
| 
       453 
446 
     | 
    
         
             
            				transient_amplifications[value] = calculate_transient_amplification(phi2_vec)
         
     | 
| 
       454 
447 
     | 
    
         
             
            				(eputs "\n\n----------\nIn #@run_name:\n\nphi2_by_#{kxy}_over_time is all NaN; unable to calculate growth rate\n----------\n\n"; transient_amplifications[value] = -1; next) if transient_amplifications[value].to_s == "NaN"
         
     | 
| 
      
 448 
     | 
    
         
            +
                            @max_transient_amplification_index_at_ky[value] = phi2_vec.max_index
         
     | 
| 
       455 
449 
     | 
    
         
             
            			end
         
     | 
| 
       456 
450 
     | 
    
         
             
            		end
         
     | 
| 
       457 
451 
     | 
    
         | 
| 
       458 
452 
     | 
    
         
             
             		write_results
         
     | 
| 
       459 
453 
     | 
    
         | 
| 
       460 
     | 
    
         
            -
            # 		ep "transient_amplification_at_ky", @transient_amplification_at_ky
         
     | 
| 
       461 
454 
     | 
    
         
             
            		if ENV['GS2_CALCULATE_ALL']
         
     | 
| 
       462 
455 
     | 
    
         
             
            		trap(0){eputs "Calculation of spectrum did not complete: run 'cgrf' (i.e. calculate_transient_amplifications_and_frequencies) for this run. E.g. from the command line \n $ coderunner rc 'cgrf' -j #{@id}"; exit}
         
     | 
| 
       463 
456 
     | 
    
         
             
            		@transient_amplification_at_ky_at_kx ||= FloatHash.new
         
     | 
| 
       464 
457 
     | 
    
         
             
            		list(:ky).values.sort.each do |kyv|
         
     | 
| 
       465 
458 
     | 
    
         
             
            			@transient_amplification_at_ky_at_kx[kyv] ||= FloatHash.new
         
     | 
| 
       466 
     | 
    
         
            -
            			#p @transient_amplification_at_ky_at_kx[kyv]
         
     | 
| 
       467 
459 
     | 
    
         
             
            			list(:kx).values.sort.each do |kxv|	
         
     | 
| 
       468 
460 
     | 
    
         
             
            				next if @transient_amplification_at_ky_at_kx[kyv].keys.include? kxv
         
     | 
| 
       469 
461 
     | 
    
         
             
            				Terminal.erewind(1)
         
     | 
| 
       470 
462 
     | 
    
         
             
            				eputs sprintf("Calculating growth rate for kx = % 1.5e and ky = % 1.5e#{Terminal::CLEAR_LINE}", kxv, kyv) 
         
     | 
| 
       471 
463 
     | 
    
         
             
            				(@transient_amplification_at_ky_at_kx[kyv][kxv] = 0.0; next) if kyv == 0.0 # Mode has 0 growth rate at ky==0
         
     | 
| 
       472 
464 
     | 
    
         
             
            				phi2_vec = gsl_vector("phi2_by_mode_over_time", {:kx=>kxv, :ky=>kyv})
         
     | 
| 
       473 
     | 
    
         
            -
            				#(@transient_amplification_at_ky_at_kx[kyv][kxv] = 0.0; next) if phi2_vec.min <= 0.0
         
     | 
| 
       474 
465 
     | 
    
         
             
            				@transient_amplification_at_ky_at_kx[kyv][kxv] = calculate_transient_amplification(phi2_vec)
         
     | 
| 
       475 
466 
     | 
    
         
             
            				(eputs "\n\n----------\nIn #@run_name:\n\nphi2_by_#{kxy}_over_time is all NaN; unable to calculate growth rates\n----------\n\n"; @transient_amplification_at_ky_at_kx[kyv][kxv] = -1; next) if @transient_amplification_at_ky_at_kx[kyv][kxv].to_s == "NaN" 
         
     | 
| 
       476 
467 
     | 
    
         
             
            			end
         
     | 
| 
         @@ -481,19 +472,8 @@ def calculate_transient_amplifications 
     | 
|
| 
       481 
472 
     | 
    
         
             
            		@transient_amplifications = @transient_amplification_at_ky
         
     | 
| 
       482 
473 
     | 
    
         
             
            		@max_transient_amplification = @transient_amplifications.values.max
         
     | 
| 
       483 
474 
     | 
    
         
             
            		@most_amplified_mode = @transient_amplifications.key(@max_transient_amplification)
         
     | 
| 
       484 
     | 
    
         
            -
             
     | 
| 
       485 
     | 
    
         
            -
            		#ep @max_transient_amplification, @transient_amplifications
         
     | 
| 
       486 
     | 
    
         
            -
            		#@decaying = (@max_transient_amplification < 0) if @max_transient_amplification
         
     | 
| 
      
 475 
     | 
    
         
            +
             
     | 
| 
       487 
476 
     | 
    
         
             
            		@ky = @aky if @aky
         
     | 
| 
       488 
     | 
    
         
            -
            		#if @grid_option == "single"
         
     | 
| 
       489 
     | 
    
         
            -
            ## 			ep @aky, @transient_amplifications
         
     | 
| 
       490 
     | 
    
         
            -
            			#@gamma_r = @transient_amplifications[@aky.to_f]
         
     | 
| 
       491 
     | 
    
         
            -
            			#@gamma_i = @real_frequencies[@aky.to_f]
         
     | 
| 
       492 
     | 
    
         
            -
            		#end
         
     | 
| 
       493 
     | 
    
         
            -
            # 		ep @gamma_r
         
     | 
| 
       494 
     | 
    
         
            -
            		
         
     | 
| 
       495 
     | 
    
         
            -
            		
         
     | 
| 
       496 
     | 
    
         
            -
            # 		eputs @transient_amplifications; gets
         
     | 
| 
       497 
477 
     | 
    
         
             
            	end
         
     | 
| 
       498 
478 
     | 
    
         
             
            end
         
     | 
| 
       499 
479 
     | 
    
         | 
| 
         @@ -673,7 +653,8 @@ alias :ctehfa :calculate_transient_es_heat_flux_amplifications 
     | 
|
| 
       673 
653 
     | 
    
         | 
| 
       674 
654 
     | 
    
         
             
            def calculate_transient_amplification(vector, options={})
         
     | 
| 
       675 
655 
     | 
    
         
             
              if @g_exb_start_timestep 
         
     | 
| 
       676 
     | 
    
         
            -
                return GSL::Sf::log(vector[(@g_exb_start_timestep/@nwrite).to_i...-1].max /  
     | 
| 
      
 656 
     | 
    
         
            +
                return GSL::Sf::log(vector[(@g_exb_start_timestep/@nwrite).to_i...-1].max / 
         
     | 
| 
      
 657 
     | 
    
         
            +
                                    vector[(@g_exb_start_timestep/@nwrite).to_i])/2
         
     | 
| 
       677 
658 
     | 
    
         
             
              else
         
     | 
| 
       678 
659 
     | 
    
         
             
                eputs "Warning: set g_exb_start_timestep to calculate transient amplifications."
         
     | 
| 
       679 
660 
     | 
    
         
             
                return 0
         
     | 
    
        data/lib/gs2crmod/gs2.rb
    CHANGED
    
    | 
         @@ -141,6 +141,7 @@ eval(%[ 
     | 
|
| 
       141 
141 
     | 
    
         
             
              :transient_amplification_at_kx,
         
     | 
| 
       142 
142 
     | 
    
         
             
              :transient_amplification_at_ky,
         
     | 
| 
       143 
143 
     | 
    
         
             
              :transient_amplification_at_ky_at_kx,
         
     | 
| 
      
 144 
     | 
    
         
            +
              :max_transient_amplification_index_at_ky,
         
     | 
| 
       144 
145 
     | 
    
         
             
              :transient_es_heat_flux_amplification_at_species_at_kx,
         
     | 
| 
       145 
146 
     | 
    
         
             
              :transient_es_heat_flux_amplification_at_species_at_ky,
         
     | 
| 
       146 
147 
     | 
    
         
             
              :transient_es_heat_flux_amplification_at_species_at_ky_at_kx,
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: gs2crmod
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.12. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.12.3
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -10,7 +10,7 @@ authors: 
     | 
|
| 
       10 
10 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       11 
11 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       12 
12 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       13 
     | 
    
         
            -
            date: 2015-08- 
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2015-08-18 00:00:00.000000000 Z
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies:
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       16 
16 
     | 
    
         
             
              name: coderunner
         
     |