sphere

GPU-based 3D discrete element method algorithm with optional fluid coupling
git clone git://src.adamsgaard.dk/sphere
Log | Files | Refs | LICENSE

commit 3a3e4b680084c869f0c33d45b9c289b47b53962b
parent 04f2ad532d725f3d2d96257be713b3344f3eaa0a
Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date:   Thu, 11 Sep 2014 12:41:23 +0200

improve plot appearance, fix max pressure

Diffstat:
Mpython/consolidation-curve.py | 7++++---
Mpython/shear-results-forces.py | 38++++++++++++++++++++++++--------------
Mpython/shear-results.py | 14+++++++-------
3 files changed, 35 insertions(+), 24 deletions(-)

diff --git a/python/consolidation-curve.py b/python/consolidation-curve.py @@ -90,10 +90,11 @@ plt.xlabel('Time [s]') #plt.ylabel('Normalized thickness change [-]') plt.ylabel('Thickness change [m]') #plt.ticklabel_format(style='sci', axis='y', scilimits=(0,0)) -for c in range(len(c_grad_p_list)): +#for c in range(len(c_grad_p_list)): #H[c] /= -min_H_c - plt.semilogx(t[c], H[c], '-', label='$c$ = %.2f' % (c_grad_p_list[c])) -plt.grid() +plt.semilogx(t[0], H[1], '-', label='$c$ = %.2f' % (c_grad_p_list[c])) +plt.semilogx(t[1], H[0], '--', label='$c$ = %.2f' % (c_grad_p_list[c])) +#plt.grid() plt.legend(loc=0, prop={'size':18}) plt.tight_layout() diff --git a/python/shear-results-forces.py b/python/shear-results-forces.py @@ -16,7 +16,7 @@ from matplotlib.ticker import MaxNLocator #steps = [5, 10, 100] #steps = [5, 10] steps = sys.argv[1:] -nsteps_avg = 3 # no. of steps to average over +nsteps_avg = 5 # no. of steps to average over sigma0 = 10.0e3 c_grad_p = 1.0 @@ -119,13 +119,16 @@ for s in numpy.arange(len(steps)): ax[s*4+1].plot(f_pf[s], zpos_p[s], ',', color = '#888888') ax[s*4+1].plot(f_pf_mean[s], zpos_c[s], color = 'k') + ax[s*4+1].plot([0.0, 0.0], [0.0, sim.L[2]], '--', color='k') ax[s*4+2].plot(dev_p[s]/1000.0, zpos_c[s], 'k') - phicolor = '#888888' - ax[s*4+3].plot(phi_bar[s], zpos_c[s], '-', color = phicolor) - for tl in ax[s*4+3].get_xticklabels(): - tl.set_color(phicolor) + #phicolor = '#888888' + #ax[s*4+3].plot(phi_bar[s], zpos_c[s], '-', color = phicolor) + #for tl in ax[s*4+3].get_xticklabels(): + #tl.set_color(phicolor) + ax[s*4+3].plot(phi_bar[s,1:], zpos_c[s,1:], '-k', linewidth=3) + ax[s*4+3].plot(phi_bar[s,1:], zpos_c[s,1:], '-w', linewidth=2) max_z = numpy.max(zpos_p) ax[s*4+0].set_ylim([0, max_z]) @@ -137,10 +140,11 @@ for s in numpy.arange(len(steps)): #plt.loglog(dpdz[c], K[c], 'o-', label='$c$ = %.2f' % (cvals[c])) ax[s*4+0].set_ylabel('Vertical position $z$ [m]') - ax[s*4+0].set_xlabel('$x^3_\\text{p}$ [m]') - ax[s*4+1].set_xlabel('$\\boldsymbol{f}_\\text{pf}$ [N]') + ax[s*4+0].set_xlabel('$\\boldsymbol{x}^x_\\text{p}$ [m]') + ax[s*4+1].set_xlabel('$\\boldsymbol{f}^z_\\text{pf}$ [N]') ax[s*4+2].set_xlabel('$\\bar{p_\\text{f}}$ [kPa]') - ax[s*4+3].set_xlabel('$\\bar{\\phi}$ [-]', color=phicolor) + #ax[s*4+3].set_xlabel('$\\bar{\\phi}$ [-]', color=phicolor) + ax[s*4+3].set_xlabel('$\\bar{\\phi}$ [-]') plt.setp(ax[s*4+1].get_yticklabels(), visible=False) plt.setp(ax[s*4+2].get_yticklabels(), visible=False) @@ -153,13 +157,19 @@ for s in numpy.arange(len(steps)): plt.setp(ax[s*4+2].xaxis.get_majorticklabels(), rotation=90) plt.setp(ax[s*4+3].xaxis.get_majorticklabels(), rotation=90) - if s == 0: - y = 0.95 - if s == 1: - y = 0.55 + #if s == 0: + #y = 0.95 + #if s == 1: + #y = 0.55 + + strain_str = 'Shear strain $\\gamma = %.3f$' % (shear_strain[s]) + #fig.text(0.1, y, strain_str, horizontalalignment='left', fontsize=22) + #ax[s*4+0].annotate(strain_str, xytext=(0,1.1), textcoords='figure fraction', + #horizontalalignment='left', fontsize=22) + plt.text(0.05, 1.06, strain_str, horizontalalignment='left', fontsize=22, + transform=ax[s*4+0].transAxes) + #ax[s*4+0].set_title(strain_str) - fig.text(0.1, y, 'Shear strain $\\gamma = %.3f$' % (shear_strain[s]), - horizontalalignment='left', fontsize=22) #ax1.grid() #ax2.grid() #ax1.legend(loc='lower right', prop={'size':18}) diff --git a/python/shear-results.py b/python/shear-results.py @@ -29,7 +29,7 @@ fluid=True # dry shear sid = 'shear-sigma0=' + str(10.0e3) sim = sphere.sim(sid) -sim.readlast() +sim.readlast(verbose=False) sim.visualize('shear') shear_strain[0] = sim.shear_strain friction[0] = sim.tau/sim.sigma_eff @@ -50,7 +50,7 @@ for c in numpy.arange(1,len(cvals)+1): friction[c] = numpy.zeros_like(shear_strain[c]) dilation[c] = numpy.zeros_like(shear_strain[c]) - sim.readlast() + sim.readlast(verbose=False) sim.visualize('shear') shear_strain[c] = sim.shear_strain friction[c] = sim.tau/sim.sigma_eff @@ -64,7 +64,7 @@ for c in numpy.arange(1,len(cvals)+1): iz_top = int(sim.w_x[0]/(sim.L[2]/sim.num[2]))-1 p_mean[c][i] = numpy.mean(sim.p_f[:,:,0:iz_top]) p_min[c][i] = numpy.min(sim.p_f[:,:,0:iz_top]) - p_max[c][i] = numpy.min(sim.p_f[:,:,0:iz_top]) + p_max[c][i] = numpy.max(sim.p_f[:,:,0:iz_top]) else: print(sid + ' not found') @@ -97,16 +97,16 @@ for c in numpy.arange(1,len(cvals)+1): ax2.plot(shear_strain[c][1:], dilation[c][1:], \ label='$c$ = %.2f' % (cvals[c-1])) - ax3.plot(shear_strain[c][1:], p_max[c][1:], '--' + color[c]) - ax3.plot(shear_strain[c][1:], p_mean[c][1:], '-' + color[c], \ + ax3.plot(shear_strain[c][1:], p_max[c][1:]/1000, '--' + color[c]) + ax3.plot(shear_strain[c][1:], p_mean[c][1:]/1000, '-' + color[c], \ label='$c$ = %.2f' % (cvals[c-1])) - ax3.plot(shear_strain[c][1:], p_min[c][1:], '--' + color[c]) + ax3.plot(shear_strain[c][1:], p_min[c][1:]/1000, '--' + color[c]) ax3.set_xlabel('Shear strain $\\gamma$ [-]') ax1.set_ylabel('Shear friction $\\tau/\\sigma\'$ [-]') ax2.set_ylabel('Dilation $\\Delta h/(2r)$ [-]') -ax3.set_ylabel('Fluid pressure $p_\\text{f}$ [Pa]') +ax3.set_ylabel('Fluid pressure $p_\\text{f}$ [kPa]') plt.setp(ax1.get_xticklabels(), visible=False) plt.setp(ax2.get_xticklabels(), visible=False)