コード例 #1
0
else:  # nothing given
    print("read_parts error: Invalid commandline arguments.")
    print("Usage: ")
    print("   ./read_parts.py <./path/to/sim/output> <start_time>")
    print(" or")
    print("   ./read_parts.py <./path/to/sim/output>")
    sys.exit()

# initialize the reader
times = bbparts.init(data_dir)

# visit all outputted time values
for time in times:
    # open the CGNS file for this particular output time
    bbparts.open(time)

    # read the CGNS file
    t = bbparts.read_time()
    n = bbparts.read_nparts()
    (x, y, z) = bbparts.read_part_position()
    (u, v, w) = bbparts.read_part_velocity()

    print("time = ", time, "t =", t, "n =", n)

    print(u)
    sys.exit()

    # close the CGNS file
    bbparts.close()
コード例 #2
0
D[1, 2, :] = data[:, 6]
D[2, 0, :] = data[:, 7]
D[2, 1, :] = data[:, 8]
D[2, 2, :] = data[:, 9]

# Predefine simulation parameters
a = 2.1  # [mm]
Lx = 42.  # [mm]
Ly = 42.  # [mm]
Lz = 126.  # [mm]
nu = 0.01715  # [mm^2/ms]
rho_f = 8.75e-4  # [g/mm^3]

# Pull particle density from cgns file
cgns_times = bbparts.init(data_dir)
bbparts.open(cgns_times[0])
rho_p = bbparts.read_mean_part_density()
nparts = bbparts.read_nparts()

# Derived quantities
part_vol = 4. / 3. * np.pi * a**3
phi = nparts * part_vol / (Lx * Ly * Lz)
rho = rho_p / rho_f
tau_p = (2. * a)**2 * rho / (18. * nu)  # [ms]

# Plot

# Set up imgidr
imgdir = data_dir + "/../analysis/pair-dispersion/img/"
if not os.path.exists(imgdir):
    os.makedirs(imgdir)
コード例 #3
0
############################################################
# visit each realization to find minimum simulation duration
############################################################

# maximum time of shortest realization
t_end = 10e10;

# number of time outputs
nt = 0;

for realization in ensemble:
  timeseries = bb.init(realization + "/output")[int(timestart/DT_out):]

  # open final output in timeseries and read time for comparison
  bb.open(timeseries[-1])
  t_tmp = bb.read_time()
  if t_tmp < t_end:
    t_end = t_tmp
    nt = len(timeseries)

  # close this output
  bb.close()

# overwrite number of time outputs to read (for testing)
#nt = 300
#t_end = 3

####################################################################
# store particle position data at initial time t_init
####################################################################
コード例 #4
0
    if len(sys.argv) >= 3:  # start time given
        t_start = sys.argv[2]

else:  # nothing given
    print("plot_part_velocity error: Invalid commandline arguments.")
    print("Usage: ")
    print("   ./plot_part_velocity.py <./path/to/sim/output> <start_time>")
    print(" or")
    print("   ./plot_part_velocity.py <./path/to/sim/output>")
    sys.exit()

# Init the reader
times = bbparts.init(data_dir)

# Get nparts
bbparts.open(times[0])
nparts = bbparts.read_nparts()
bbparts.close()

# Init data arays
u = np.zeros((len(times), nparts))
v = np.zeros((len(times), nparts))
w = np.zeros((len(times), nparts))
t = np.zeros(len(times))

# Loop over time and pull data
for tt, time in enumerate(times):
    bbparts.open(time)

    t[tt] = bbparts.read_time()
コード例 #5
0
ファイル: read.py プロジェクト: dwille/redfish
#!/usr/bin/env python

# bluebottle_particle_reader python module example code

import sys, getopt
import numpy as np
import bluebottle_particle_reader as bb

# initialize the reader
times = bb.init("/home/asiera/bluebottle/sim/output")

# visit all outputted time values
for time in times:
  # open the CGNS file for this particular output time
  bb.open(time)

  # read the CGNS file
  t = bb.read_time()
  (x,y,z) = bb.read_part_position()
  (u,v,w) = bb.read_part_velocity()

  print("t =", t)

  # close the CGNS file
  bb.close()
コード例 #6
0
############################################################
# visit each realization to find minimum simulation duration
############################################################

# maximum time of shortest realization
t_end = 10e10;

# number of time outputs
nt = 0;

for realization in ensemble:
  timeseries = bb.init(realization + "/output")

  # open final output in timeseries and read time for comparison
  bb.open(timeseries[-1])
  t_tmp = bb.read_time()
  if t_tmp < t_end:
    t_end = t_tmp
    nt = len(timeseries)

  # close this output
  bb.close()

# overwrite number of time outputs to read (for testing)
#nt = 5000
#t_end = 50.0

####################################################################
# average particle velocity over all particles as a function of time
####################################################################