Beispiel #1
0
#%% Load data
w, h = plt.figaspect(fig_aspect)
fig1, ax1 = plt.subplots(1, 1, figsize=(1.5 * w, h))
fig2, ax2 = plt.subplots(1, 1, figsize=(1.5 * w, h))
ax1.axhline(0, linestyle='--', color='k')

rf_out = np.zeros(len(run_ID))
g10_out = np.zeros(len(run_ID))
g20_out = np.zeros(len(run_ID))
g30_out = np.zeros(len(run_ID))
G2_out = np.zeros(len(run_ID))
G3_out = np.zeros(len(run_ID))
i = 0
for run in run_ID:
    directory = '/data/geodynamo/wongj/Work/{}'.format(run)
    (_, _, _, _, _, _, rf) = load_dimensionless(run, directory)
    if not os.path.exists('{}/gauss_ratios_timeavg'.format(directory)):
        g10, g20, g30, G2, G3 = gauss_ratios_timeavg(run, directory)
    else:  # load timeavg data
        print('Loading {}/gauss_ratios_timeavg'.format(directory))
        f = h5py.File('{}/gauss_ratios_timeavg'.format(directory), 'r')
        for key in f.keys():
            globals()[key] = np.array(f[key])
    rf_out[i] = rf
    g10_out[i] = g10
    g20_out[i] = g20
    g30_out[i] = g30
    G2_out[i] = G2
    G3_out[i] = G3
    i += 1
Beispiel #2
0
# run_ID = 'd_0_75a'
# run_ID = 'd_0_8a'
directory = '/data/geodynamo/wongj/Work/{}'.format(
    run_ID)  # path containing simulation output
# directory = '/Users/wongj/Documents/parodydata/{}'.format(run_ID)
# directory = '/Volumes/NAS/ipgp/Work/{}'.format(run_ID)

fig_aspect = 1  # figure aspect ratio
n_levels = 61  # no. of contour levels

saveOn = 1  # save figures?
saveDir = '/home/wongj/Work/figures/surface'  # path to save files
# saveDir = '/Users/wongj/Documents/isterre/parody/figures/surface'
#%%----------------------------------------------------------------------------
# Time average or load data if timeavg data exists
_, _, _, _, _, fi, rf = load_dimensionless(run_ID, directory)
if not os.path.exists('{}/surface_timeavg'.format(directory)):
    (theta, phi, Vt, Vp, Br, dtBr) = surface_timeavg(run_ID,
                                                     directory)  # timeavg
else:  # load timeavg data
    print('Loading {}/surface_timeavg'.format(directory))
    f = h5py.File('{}/surface_timeavg'.format(directory), 'r')
    for key in f.keys():
        globals()[key] = np.array(f[key])

#%%----------------------------------------------------------------------------
# Plot
w, h = plt.figaspect(fig_aspect)
fig, ax = plt.subplots(1,
                       1,
                       figsize=(1.5 * w, h),
Beispiel #3
0
mu_ADNAD = 1.4
mu_OE = 1
mu_ZNZ = 0.15
mu_FCF = 1.5
# NOTE: error = mu*sigma and mu/sigma not standard deviation
sigma_ADNAD = 2
sigma_OE = 2
sigma_ZNZ = 2.5
sigma_FCF = 1.75

i = 0
for run in run_ID:
    directory = '{}/{}'.format(dirName, run)
    print('Loading {}'.format(directory))
    (_, Ek_out, Ra_out, Pr_out, Pm_out, fi_out,
     rf_out) = load_dimensionless(run, directory)
    compliance_data = load_compliance(run, directory)
    rf[i] = rf_out
    ADNAD[i] = compliance_data["ADNAD"].mean()
    OE[i] = compliance_data["OE"].mean()
    ZNZ[i] = compliance_data["ZNZ"].mean()
    if not os.path.exists('{}/fcf'.format(directory)):
        FCF_out = fcf(run, directory)  # timeavg
    else:  # load timeavg data
        print('Loading {}/fcf'.format(directory))
        f = h5py.File('{}/fcf'.format(directory), 'r')
        for key in f.keys():
            globals()[key] = np.array(f[key])
    FCF[i] = FCF_out
    chi_ADNAD[i] = ((np.log(ADNAD[i]) - np.log(mu_ADNAD)) /
                    np.log(sigma_ADNAD))**2
Beispiel #4
0
fig2, ax2 = plt.subplots(1, 1, figsize=(1.5 * w, h))
shell_gap = cmb_radius - icb_radius
ri = icb_radius / shell_gap
ax1.axhline(0, linewidth=1, color='k', linestyle='--')

rf = np.zeros(len(run_ID))
Cf = np.zeros(len(run_ID))
Cicb = np.zeros(len(run_ID))
S = np.zeros(len(run_ID))
D = np.zeros(len(run_ID))
i = 0
for run in run_ID:
    fig1, ax1 = plt.subplots(1, 1, figsize=(1.5 * w, h))
    directory = '{}/{}'.format(dirName, run)
    print('Loading {}'.format(directory))
    (NR, Ek, Ra, Pr, Pm_out, fi, rf_out) = load_dimensionless(run, directory)
    df_mantle = load_mantle(run, directory)
    df_ic = load_innercore(run, directory)

    time = df_mantle.time.to_numpy()
    # shift to start from zero and use magnetic diffusion time
    time = (time - time[0]) / Pm_out
    # magnetic_torque_mantle = df_mantle["magnetic_torque_on_mantle"].to_numpy() # NOTE: =0 due to insulating mantle
    gravitational_torque_mantle = df_mantle[
        "gravitational_torque_on_mantle"].to_numpy()
    magnetic_torque_mantle = df_mantle["magnetic_torque_on_mantle"].to_numpy()
    # viscous_torque_ic = df_ic["viscous_torque_ic"].to_numpy() # NOTE: =0 due to stress free boundaries
    magnetic_torque_ic = df_ic["magnetic_torque_ic"].to_numpy()
    gravitational_torque_ic = df_ic["gravity_torque_ic"].to_numpy()
    total_angular_momentum = df_ic["total_angular_momentum_ic+oc+m"]
    print('Time average of total angular momentum = {:.3e}'.format(
Beispiel #5
0
saveDir = '/home/wongj/Work/figures/convective_power'  # path to save files
# saveDir = '/Users/wongj/Documents/isterre/parody/figures/convective_power'

#%%----------------------------------------------------------------------------
# Load data
shell_gap = cmb_radius - icb_radius
ri = icb_radius/shell_gap

w, h = plt.figaspect(fig_aspect)
fig1, ax1 = plt.subplots(1, 1, figsize=(1.5*w, h))
ax1.axhline(0,linestyle='--',color='k')

i=0
for run in run_ID:
    directory = '/data/geodynamo/wongj/Work/{}'.format(run)
    (NR, Ek, Ra, Pr, Pm, fi, rf) = load_dimensionless(run, directory)
    if not os.path.exists('{}/convective_power'.format(directory)):
        (radius, I) = convective_power_timeavg(run, directory)  # timeavg
    else:  # load timeavg data
        print('Loading {}/convective_power'.format(directory))
        f = h5py.File('{}/convective_power'.format(directory), 'r')
        for key in f.keys():
            globals()[key] = np.array(f[key])
    # Check with diagnostics
    df_power = load_power(run,directory)
    check_diag = df_power["available_convective_power_per_unit_vol"].mean()

    ro = radius[-1]
    convective_power = Ra*I/(Ek*radius[-1])

    # Plot
Beispiel #6
0
lineWidth = 0.8

saveOn = 1 # save figures?
saveDir = '/home/wongj/Work/figures/meridional/'  # path to save files

#%%----------------------------------------------------------------------------
# Load data
Gt_file = 'Gt={}.{}'.format(timestamp,run_ID)
filename = directory + Gt_file

(version, time, DeltaU, Coriolis, Lorentz, Buoyancy, ForcingU,
            DeltaT, ForcingT, DeltaB, ForcingB, Ek, Ra, Pm, Pr,
            nr, ntheta, nphi, azsym, radius, theta, phi, Vr, Vt, Vp,
            Br, Bt, Bp, T) = parodyload(filename)

NR, Ek, Ra, Pr, Pm, fi, rf = load_dimensionless(run_ID, directory)

#%%----------------------------------------------------------------------------
# Plot
w, h = plt.figaspect(fig_aspect)
fig = plt.figure(constrained_layout=True, figsize = (2*w,h))
spec = gridspec.GridSpec(ncols = 3, nrows = 1, figure=fig)

# Velocity
ax = fig.add_subplot(spec[0,0])
X = np.outer(np.sin(theta),radius)
Y = np.outer(np.cos(theta),radius)
Z = np.mean(Vp,0) # azimuthal avg
# Z_lim = get_Z_lim(Z)
Z_lim = Vmax
levels = np.linspace(-Z_lim,Z_lim,n_levels)