timproved plot quality - sphere - GPU-based 3D discrete element method algorith… | |
git clone git://src.adamsgaard.dk/sphere | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit b67827916912ac1106d32edc2fa4046543d5b62e | |
parent 5941c431888db40c345ae11ab3de08c5018c8c94 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Thu, 21 Aug 2014 09:20:15 +0200 | |
improved plot quality | |
Diffstat: | |
M python/permeability-results-c=1.py | 10 +++++++++- | |
M python/permeability-results.py | 19 ++++++++++++++----- | |
M python/permeabilitycalculator.py | 12 +++++++----- | |
3 files changed, 30 insertions(+), 11 deletions(-) | |
--- | |
diff --git a/python/permeability-results-c=1.py b/python/permeability-results-c… | |
t@@ -1,4 +1,9 @@ | |
#!/usr/bin/env python | |
+import matplotlib | |
+matplotlib.use('Agg') | |
+matplotlib.rcParams.update({'font.size': 18, 'font.family': 'serif'}) | |
+ | |
+import os | |
import numpy | |
import sphere | |
from permeabilitycalculator import * | |
t@@ -54,4 +59,7 @@ plt.plot(dpdz, phi_bar, '+') | |
plt.grid() | |
plt.tight_layout() | |
-plt.savefig('permeability-dpdz-vs-K.png') | |
+filename = 'permeability-dpdz-vs-K.png' | |
+plt.savefig(filename) | |
+print(os.getcwd() + '/' + filename) | |
+plt.savefig(filename) | |
diff --git a/python/permeability-results.py b/python/permeability-results.py | |
t@@ -1,4 +1,9 @@ | |
#!/usr/bin/env python | |
+import matplotlib | |
+matplotlib.use('Agg') | |
+matplotlib.rcParams.update({'font.size': 18, 'font.family': 'serif'}) | |
+import os | |
+ | |
import numpy | |
import sphere | |
from permeabilitycalculator import * | |
t@@ -21,20 +26,24 @@ c_grad_p = numpy.empty_like(K) | |
i = 0 | |
for sid in sids: | |
- pc = PermeabilityCalc(sid, plot_evolution=False) | |
+ pc = PermeabilityCalc(sid, plot_evolution=False, print_results=False, | |
+ verbose=False) | |
K[i] = pc.conductivity() | |
c_grad_p[i] = pc.c_grad_p() | |
i += 1 | |
# produce VTK files | |
-for sid in sids: | |
- sim = sphere.sim(sid, fluid=True) | |
- sim.writeVTKall() | |
+#for sid in sids: | |
+ #sim = sphere.sim(sid, fluid=True) | |
+ #sim.writeVTKall() | |
fig = plt.figure() | |
plt.xlabel('Pressure gradient coefficient $c$ [-]') | |
plt.ylabel('Hydraulic conductivity $K$ [m/s]') | |
plt.plot(c_grad_p, K, '+') | |
plt.grid() | |
-plt.savefig('c_grad_p-vs-K.png') | |
+plt.tight_layout() | |
+filename = 'c_grad_p-vs-K.pdf' | |
+plt.savefig(filename) | |
+print(os.getcwd() + '/' + filename) | |
diff --git a/python/permeabilitycalculator.py b/python/permeabilitycalculator.py | |
t@@ -7,19 +7,21 @@ import matplotlib.pyplot as plt | |
class PermeabilityCalc: | |
''' Darcy's law: Q = -k*A/mu * dP ''' | |
- def __init__(self, sid, plot_evolution=True): | |
+ def __init__(self, sid, plot_evolution=True, print_results=True, | |
+ verbose=True): | |
self.sid = sid | |
- self.readfile() | |
+ self.readfile(verbose) | |
self.findPermeability() | |
self.findConductivity() | |
self.findMeanPorosity() | |
- self.printResults() | |
+ if print_results: | |
+ self.printResults() | |
if plot_evolution: | |
self.plotEvolution() | |
- def readfile(self): | |
+ def readfile(self, verbose=True): | |
self.sim = sphere.sim(self.sid, fluid=True) | |
- self.sim.readlast() | |
+ self.sim.readlast(verbose=verbose) | |
def findPermeability(self): | |
self.findCellSpacing() |