@@ -199,7 +199,7 @@ def read(self, filename, endian='l'):
199199 np .fromfile (file , dtype = np .float64 , count = 9 )
200200
201201 # Truncation
202- self .n_r_max , self .n_theta_max , self .n_phi_tot , self .minc ,\
202+ self .n_r_max , self .n_theta_max , self .n_phi_tot , self .minc , \
203203 self .nalias , self .n_r_ic_max = \
204204 np .fromfile (file , dtype = np .int32 , count = 6 )
205205 if self .version > 3 :
@@ -342,7 +342,7 @@ def write(self, filename):
342342 file = open (filename , 'wb' )
343343
344344 # Header
345- version = np .array ([4 ], np .int32 )
345+ version = np .array ([5 ], np .int32 )
346346 version .tofile (file )
347347 time = np .array ([self .time ], np .float64 )
348348 time .tofile (file )
@@ -369,15 +369,15 @@ def write(self, filename):
369369 self .ek , self .stef , self .radratio , self .sigma_ratio ],
370370 np .float64 )
371371 else :
372- x = np .array ([1e5 , 1.0 , 0.0 , 1.0 , 5.0 , 1.0e-3 , self .radratio , 1.0 ],
372+ x = np .array ([1e5 , 1.0 , 0.0 , 1.0 , 5.0 , 1.0e-3 , 0. , self .radratio , 1.0 ],
373373 np .float64 )
374374 x .tofile (file )
375375
376376 # Truncation
377377 x = np .array ([self .n_r_max , self .n_theta_max , self .n_phi_tot , self .minc ,
378378 self .nalias , self .n_r_ic_max ], np .int32 )
379379 x .tofile (file )
380- if not hasattr (self ," m_min" ):
380+ if not hasattr (self , ' m_min' ):
381381 self .m_min = 0
382382 x = np .array ([self .l_max , self .m_min , self .m_max ], np .int32 )
383383 x .tofile (file )
@@ -405,7 +405,7 @@ def write(self, filename):
405405 dumm .tofile (file )
406406
407407 # Logicals
408- if not hasattr (self ," l_phase" ):
408+ if not hasattr (self , ' l_phase' ):
409409 self .l_phase = False
410410
411411 flags = np .array ([self .l_heat , self .l_chem , self .l_phase , self .l_mag , False ,
@@ -673,25 +673,48 @@ def graph2rst(self, gr, filename='checkpoint_ave.from_chk'):
673673 self .fd_ratio = gr .fd_ratio
674674
675675 # Flags
676+ self .ek = gr .ek
677+ self .radratio = gr .radratio
676678 if gr .mode in [2 , 3 , 7 , 8 , 9 , 10 ] or gr .ra == 0. :
677679 self .l_heat = False
680+ self .ra = 0.
681+ self .pr = 0.
678682 else :
679683 self .l_heat = True
684+ self .ra = gr .ra
685+ self .pr = gr .pr
680686 if not hasattr (gr , 'raxi' ):
681687 self .l_chem = False
688+ self .raxi = 0.
689+ self .sc = 0.
682690 else :
683691 if gr .raxi > 0. or gr .raxi < 0. :
684692 self .l_chem = True
685693 else :
686694 self .l_chem = False
695+ self .raxi = gr .raxi
696+ self .sc = gr .sc
687697 if gr .mode in [0 , 2 , 3 , 6 , 8 , 9 ]:
688698 self .l_mag = True
699+ self .prmag = 0.
689700 else :
690701 self .l_mag = False
702+ self .prmag = gr .prmag
691703 if gr .sigma_ratio == 0. :
692704 self .l_cond_ic = False
705+ self .sigma_ratio = 0.
693706 else :
694707 self .l_cond_ic = True
708+ self .sigma_ratio = gr .sigma
709+ if not hasattr (gr , 'stef' ):
710+ self .l_phase = False
711+ self .stef = 0.
712+ else :
713+ if gr .stef > 0. :
714+ self .l_phase = True
715+ else :
716+ self .l_phase = False
717+ self .stef = gr .stef
695718 self .l_press = False
696719
697720 if self .l_cond_ic :
@@ -747,6 +770,13 @@ def graph2rst(self, gr, filename='checkpoint_ave.from_chk'):
747770 p = sh .spat_spec (gr .xi [:, :, i ])
748771 self .xi [i , :] = p [:]
749772
773+ # Calculate the phase field
774+ if self .l_phase :
775+ self .phase = np .zeros_like (self .wpol )
776+ for i in range (self .n_r_max ):
777+ p = sh .spat_spec (gr .phase [:, :, i ])
778+ self .phase [i , :] = p [:]
779+
750780 # Calculate the magnetic field
751781 if self .l_mag :
752782 self .bpol = np .zeros_like (self .wpol )
0 commit comments