v_sat = np.sum(np.ones([points_in_calc, points_in_calc, points_in_calc])) savedata = [time_minutes] for D_m2s in logD_list: D3 = [D_m2s]*3 percent_water_remaining = np.zeros_like(time_minutes) rim_location_microns = np.zeros_like(time_minutes) idx = 0 for minutes in time_minutes: time_seconds = minutes * 60. v, x, y = diff.diffusion3Dnpi(lengths_microns, D3, time_seconds, plot3=False, points=points_in_calc) percent_water_remaining[idx] = 100. * (v_sat - np.sum(v)) / v_sat idx_rim = (np.abs(y[direction][0:points_in_calc/2] - water_fraction)).argmin() rim_location_microns[idx] = x[direction][idx_rim] print ''.join(('logD=', '{:.1f}'.format(D_m2s), ', ', '{:.1f}'.format(minutes), ' minutes done')) idx = idx + 1 savedata.append(list(rim_location_microns)) savedata.append(logD_list) # Save data to file
v_sat = np.sum(np.ones([points_in_calc, points_in_calc, points_in_calc])) volume_mm3 = lengths_microns[0] * lengths_microns[1] * lengths_microns[2] / 1E9 center_microns = lengths_microns[direction] / 2. cpx_percent_water_remaining = np.zeros_like(time_hours) cpx_rim_location_microns = np.zeros_like(time_hours) mid_percent_water_remaining = np.zeros_like(time_hours) mid_rim_location_microns = np.zeros_like(time_hours) oli_percent_water_remaining = np.zeros_like(time_hours) oli_rim_location_microns = np.zeros_like(time_hours) idx = 0 for hours in time_hours: time_seconds = hours * 3600. cpx_v, cpx_x, cpx_y = diff.diffusion3Dnpi(lengths_microns, cpx_log10D_m2s, time_seconds, plot3=False, points=points_in_calc) cpx_percent_water_remaining[idx] = 100. * (v_sat - np.sum(cpx_v)) / v_sat cpx_idx_rim = (np.abs(cpx_y[direction][0:points_in_calc/2] - water_fraction)).argmin() cpx_rim_location_microns[idx] = cpx_x[direction][cpx_idx_rim] mid_v, mid_x, mid_y = diff.diffusion3Dnpi(lengths_microns, mid_log10D_m2s, time_seconds, plot3=False, points=points_in_calc) mid_percent_water_remaining[idx] = 100. * (v_sat - np.sum(mid_v)) / v_sat mid_idx_rim = (np.abs(mid_y[direction][0:points_in_calc/2] - water_fraction)).argmin() mid_rim_location_microns[idx] = mid_x[direction][mid_idx_rim] oli_v, oli_x, oli_y = diff.diffusion3Dnpi(lengths_microns, oli_log10D_m2s, time_seconds, plot3=False, points=points_in_calc) oli_percent_water_remaining[idx] = 100. * (v_sat - np.sum(oli_v)) / v_sat oli_idx_rim = (np.abs(oli_y[direction][0:points_in_calc/2] - water_fraction)).argmin() oli_rim_location_microns[idx] = oli_x[direction][oli_idx_rim]
savefolder = '\\Users\\Ferriss\\Documents\\Code\\Python\\' lengths_microns = [3000.] * 3 logD_list = [-12.5, -12., -11.5, -11., -10.5, -10.] # 0 to 60 minutes time_minutes = list(np.arange(0.001, 61., 0.5)) water_fraction = 0.80 # How much does concentration drop to qualify as a rim direction = 0 # 0=[100]*, 1=[010], 2=[001] points_in_calc = 300 ################## Set up and run calculation ################################ fig, ax, v, x, y = diff.diffusion3Dnpi(lengths_microns, [-20.]*3, time_seconds=0.000000000001, plot3=True, points=points_in_calc, centered=False) v_sat = np.sum(v) #%% savedata = [time_minutes] for D_m2s in logD_list: D3 = [D_m2s]*3 percent_water_remaining = np.zeros_like(time_minutes) rim_location_microns = np.zeros_like(time_minutes) for idx, minutes in enumerate(time_minutes): time_seconds = minutes * 60.
center_microns = lengths_microns[direction] / 2. cpx_percent_water_remaining = np.zeros_like(time_hours) cpx_rim_location_microns = np.zeros_like(time_hours) mid_percent_water_remaining = np.zeros_like(time_hours) mid_rim_location_microns = np.zeros_like(time_hours) oli_percent_water_remaining = np.zeros_like(time_hours) oli_rim_location_microns = np.zeros_like(time_hours) idx = 0 for hours in time_hours: time_seconds = hours * 3600. cpx_v, cpx_x, cpx_y = diff.diffusion3Dnpi(lengths_microns, cpx_log10D_m2s, time_seconds, plot3=False, points=points_in_calc) cpx_percent_water_remaining[idx] = 100. * (v_sat - np.sum(cpx_v)) / v_sat cpx_idx_rim = (np.abs(cpx_y[direction][0:points_in_calc / 2] - water_fraction)).argmin() cpx_rim_location_microns[idx] = cpx_x[direction][cpx_idx_rim] mid_v, mid_x, mid_y = diff.diffusion3Dnpi(lengths_microns, mid_log10D_m2s, time_seconds, plot3=False, points=points_in_calc) mid_percent_water_remaining[idx] = 100. * (v_sat - np.sum(mid_v)) / v_sat mid_idx_rim = (np.abs(mid_y[direction][0:points_in_calc / 2] - water_fraction)).argmin()