-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env python | ||
|
||
import numpy as np | ||
|
||
from pygacode.cgyro import data | ||
from pygacode.gacodefuncs import * | ||
|
||
# read minimal data for setup (look in current directory) | ||
sim = data.cgyrodata('./',fast=True,silent=True) | ||
|
||
# copy time vector and number of species | ||
t = sim.t | ||
ns = sim.n_species | ||
|
||
# read bin.cgyro.ky_flux | ||
sim.getflux() | ||
|
||
# select field=0 (phi), moment=1 (Q), species (0), and sum over kx | ||
field=0 ; moment=1 ; species=0 | ||
y = np.sum(sim.ky_flux[species,moment,field,:,:],axis=0) | ||
|
||
# Simulation length (max time) | ||
tmax = t[-1] | ||
|
||
# size and number of time windows | ||
dt = 50.0 | ||
nwin = int(tmax/dt) | ||
t0 = tmax-nwin*dt | ||
|
||
# averaging over all windows (note that time_average function is fast/optimized) | ||
for i in range(nwin): | ||
w=str(tmax-(i+1)*dt)+','+str(tmax-i*dt) | ||
imin,imax=time_index(t,w) | ||
ave = time_average(y[:],t,imin,imax) | ||
print(i,ave) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters