Skip to content

Commit

Permalink
Added checkpoint reader in rayleigh_diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
rpvin committed Jun 20, 2024
1 parent 9fd08ed commit 3935e4f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions post_processing/rayleigh_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -3266,3 +3266,18 @@ def streamfunction(vr,vt,r,cost,order=0):

return psi

###### Function for reading in the checkpoint files (i.e. P,PAB,T,TAB,W,WAB,Z,ZAB)
def checkpoint_read(chk_file_string,nr,ntheta):
nell=(2*ntheta)//3
shape = (nell,nell)
i,j = np.indices(shape)
m = np.ceil(i <= j).astype(bool)
target_all = zeros((nell,nell,nr),dtype="complex")
length_half = int(len(fromfile(chk_file_string,"f8"))/2)
chunk_length = int(length_half/nr)
for i in range(nr):
target = np.zeros_like((m),dtype="complex")
target[m] = (fromfile(chk_file_string,"f8")[:length_half][i*chunk_length:(i+1)*chunk_length]
+ 1j*fromfile(chk_file_string,"f8")[length_half:][i*chunk_length:(i+1)*chunk_length])
target_all[:,:,i] = target
return target_all

0 comments on commit 3935e4f

Please sign in to comment.