y_list = list(eval(file2.readline().replace('\n',''))) w_list = list(eval(file2.readline().replace('\n',''))) v_list = list(eval(file2.readline().replace('\n',''))) b_list = list(eval(file2.readline().replace('\n',''))) p_list = list(eval(file2.readline().replace('\n',''))) T_list = list(eval(file2.readline().replace('\n',''))) m_list = list(eval(file2.readline().replace('\n',''))) t_list = list(eval(file2.readline().replace('\n',''))) r_list = list(eval(file2.readline().replace('\n',''))) used = list(eval(file2.readline().replace('\n',''))) jumps, start_time, end_time, save_step, R, grid_spacing, g, a, v_0, layers, datafile = eval(file2.readline().replace('\n','')) print('DONE\n') # Make an output directory dirname='Origin_Landing' psp.mkdir_p(dirname) print('Extracting Materials...') # Open the datafile model=psp.opendatfile(datafile) model.setScale('km') step = model.readStep('TrP', 0) yy = np.append(np.zeros(0), step.ymark) col = [] for i in range(len(yy)): # find materials based on starting height if yy[i] > layers[0]: co = 'black' elif yy[i] > layers[1]: co = 'darkgrey' elif yy[i] > layers[2]: co = 'y'
import numpy as np import scipy as sc import scipy.stats as stats import pySALEPlot as psp import matplotlib.pyplot as plt field1 = 'Pre' field2 = 'V_y' field3 = 'Den' field4 = 'TPS' field5 = 'Tmp' dirname = 'shockfronts' model = psp.opendatfile('./jdata.dat') # Open datafile psp.mkdir_p('./shockfronts') model.setScale('mm') tstart = 1 # Start at t>0 such that there IS a shock present tfin = 250 tintv = 1 YC = model.yc XC = model.xc TME = np.zeros((int((tfin - tstart + 1) / tintv))) # time YSF = np.zeros((int((tfin - tstart + 1) / tintv))) # Shock Front Y position PBD = np.zeros((int((tfin - tstart + 1) / tintv))) # Shock in Particle Bed array. 1 is yes 0 is no QUP = np.zeros((int( (tfin - tstart + 1) / tintv))) # Quasi steady state Particle velocity Us = np.zeros((int((tfin - tstart + 1) / (5 * tintv)) + 1)) Up = np.zeros( (int((tfin - tstart + 1) / (5 * tintv)) +
import pySALEPlot as psp from matplotlib.pyplot import figure,colorbar import matplotlib.pyplot as plt import numpy as np from mpl_toolkits.axes_grid1 import make_axes_locatable # This example plotting script designed to plot # damage in the demo2D example simulation # Make an output directory #field1 = 'Den'#raw_input('Which field is to be considered? (3 chars) =>') field2 = 'Den'#raw_input('Which field is to be considered? (3 chars) =>') dirname='./%s'%field2 psp.mkdir_p(dirname) # Open the datafile model=psp.opendatfile('jdata.dat') # Set the distance units to km model.setScale('um') # Set up a pylab figure fig=figure() ax=fig.add_subplot(111,aspect='equal') fig.set_size_inches(4,3) # Loop over timesteps, in increments of 5 #step_1=model.readStep('%s'%field2,0) #MAXvalue = abs(np.amax(step_1.data[0])) plt.tight_layout() for i in np.arange(0,37,1): # Set the axis labels
import pySALEPlot as psp import matplotlib.pyplot as plt import numpy as np from math import atan, pi, sqrt, sin from aux_library import Bin psp.mkdir_p('Combined/Landing') psp.mkdir_p('Combined/Material') psp.mkdir_p('Combined/Pressure') psp.mkdir_p('Combined/Temperature') pres_lim = [0, 200] temp_lim = [0, 4000] print('Opening data file...') # open tracer file file2 = open('Results.dat', 'r') x_list = list(eval(file2.readline().replace('\n', ''))) y_list = list(eval(file2.readline().replace('\n', ''))) w_list = list(eval(file2.readline().replace('\n', ''))) v_list = list(eval(file2.readline().replace('\n', ''))) b_list = list(eval(file2.readline().replace('\n', ''))) p_list = list(eval(file2.readline().replace('\n', ''))) T_list = list(eval(file2.readline().replace('\n', ''))) m_list = list(eval(file2.readline().replace('\n', ''))) t_list = list(eval(file2.readline().replace('\n', ''))) r_list = list(eval(file2.readline().replace('\n', ''))) used = list(eval(file2.readline().replace('\n', ''))) jumps, start_time, end_time, save_step, R, grid_spacing, g, a, v_0, layers, datafile = eval( file2.readline().replace('\n', '')) print('DONE\n')
def hugoniot_point_general_ND(AAA,YSF,TME,N): global t1,t2 t1 = .0 t2 = 0.8 D = -3.2e-2 # in mm and -ve as up is +ve AAA = np.ma.masked_invalid(AAA) time = TME[(YSF<(N*D))*(YSF>-1.)*(TME<t2)] # Only use times and particle velocities for results WITHIN the particle bed a = AAA[(YSF<(N*D))*(YSF>-1.)*(TME<t2)] # .8mm into the particle bed is given, for the shock to stabilise sf = YSF[(YSF<(N*D))*(YSF>-1.)*(TME<t2)] # Shock front positions A = np.ma.mean(a[1:]) ASD = np.ma.std(a[1:]) return A,ASD dir_0 = './hugoniot_data' # Directory name for the output files dirs = ['A-1.1201_K-28.673'] psp.mkdir_p(dir_0) psp.mkdir_p(dir_0+'/cmaps') N = 11 UP_2 = np.zeros((N)) US_2 = np.zeros((N)) UPSD_2 = np.zeros((N)) SGY_ = np.zeros((N)) SGYSD = np.zeros((N)) TPS_ = np.zeros((N)) TPSSD = np.zeros((N)) PRE_ = np.zeros((N))
import numpy as np import scipy as sc import scipy.stats as stats import pySALEPlot as psp import matplotlib.pyplot as plt field1 = 'Pre' field2 = 'V_y' field3 = 'Den' field4 = 'TPS' field5 = 'Tmp' dirname= 'shockfronts' model = psp.opendatfile('./jdata.dat') # Open datafile psp.mkdir_p('./shockfronts') model.setScale('mm') tstart = 1 # Start at t>0 such that there IS a shock present tfin = 250 tintv = 1 YC = model.yc XC = model.xc TME = np.zeros(( int((tfin-tstart+1)/tintv) )) # time YSF = np.zeros(( int((tfin-tstart+1)/tintv) )) # Shock Front Y position PBD = np.zeros(( int((tfin-tstart+1)/tintv) )) # Shock in Particle Bed array. 1 is yes 0 is no QUP = np.zeros(( int((tfin-tstart+1)/tintv) )) # Quasi steady state Particle velocity Us = np.zeros(( int((tfin-tstart+1)/(5*tintv))+1 )) Up = np.zeros(( int((tfin-tstart+1)/(5*tintv))+1 )) # Shock and particle velocities calculated every 5 timesteps Time = np.zeros(( int((tfin-tstart+1)/(5*tintv))+1 )) # Equivalent time every 5 timesteps (=.1 us)
print "**** ERROR ****" # Print output print "The selected Lagrangian pseudo-cell is made of tracers:" print "# {} --- {} #".format(tl, tr) print "# --------------- #" print "# {} --- {} #".format(bl, br) print "===================================" # Calculate Time Resolution T_res = (step_final.time - step_initial.time) / model.nsteps ####################################################################################################################################### USER # Create output directory dirname = 'StressStrain_{}'.format(TR) psp.mkdir_p(namemodel + '/' + dirname) ####################################################################################################################################### USER # ---------------------------------------------------------------------------------- # # LOOP OVER TIMESTEPS TO FIND LOCATION DATA AND STRESS DATA, THEN ORGANISE THAT DATA # # ---------------------------------------------------------------------------------- # # ------------------- NOTE ------------------- # # DEVIATORIC STRESS TENSOR in 3D has the form # # ( 'TrX' 'TrR' 0 ) # ( 'TrR' 'TrY' 0 ) # ( 0 0 'TrH' ) # FULL STRESS TENSOR in 3D has the form # # ( 'TrX'-'TrP' 'TrR' 0 ) # ( 'TrR' 'TrY'-'TrP' 0 )