Transforming old code into new version #2705
Answered
by
jgostick
kizzle4shaw
asked this question in
Q&A
-
def run_mp(trapping=False, residual=None, snap_off=False, plot=True, flowrate=None, phase=None):
alg = mp(network=net)
if snap_off:
alg.settings['snap_off'] = 'throat.snap_off'
alg.setup(phase=phase)
alg.set_inlets(pores=net.pores('left'))
if residual is not None:
alg.set_residual(pores=residual)
alg.run()
if trapping:
alg.set_outlets(net.pores('right'))
alg.apply_trapping()
inv_points = np.arange(0, 100, 1)
# returns data as well as plotting
alg_data = alg.get_intrusion_data(inv_points=inv_points)
water.update(alg.results(Pc=inv_points.max()))
if plot:
fig, ax = plt.subplots(figsize=[5, 5])
L = np.sqrt(net.Np).astype(int)
ax.imshow(alg['pore.invasion_sequence'].reshape([L, L]),
cmap=plt.get_cmap('Blues'))
plt.show()
if flowrate is not None:
alg.apply_flow(flowrate=flowrate)
return alg |
Beta Was this translation helpful? Give feedback.
Answered by
jgostick
Feb 24, 2023
Replies: 1 comment 3 replies
-
Or you could just use the old version of openpnm? |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
ma-sadeghi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Or you could just use the old version of openpnm?