In [1]:
%%javascript
IPython.OutputArea.prototype._should_scroll = function(lines) {
return false;
}
In [2]:
# Import packages
from flumyx import *
import matplotlib.pyplot as plt
# Just a function which displays the Flumy version currently loaded
def printVersion(simu):
old_tl = simu.getTracer().getTraceLevel()
simu.getTracer().setTraceLevel(TL_DEBUG)
simu.printVersion()
simu.getTracer().setTraceLevel(old_tl)
In [3]:
# Fluvial simulation parameters
trace_level = TL_INFO # 0: None, 1: Fatal, 2: Error, 3: Warning, 4: Info, 5: Debug
# Simulator variable
simu = None
# Simulation root seed
seed = 11665544
In [4]:
# Reset the simulation (return at age 0)
if (simu is not None): iSimulator.deleteSimulator(simu)
# Create simulator and show Flumy version
simu = iSimulator.createSimulator()
printVersion(simu)
# Fluvial simulation
simu.getParameters().setUsingFluvi()
# Launch the simulation up to 9m thickness
print("Running simulation...")
params = {KEY_AV_LOC_FREQ: FREQ_NEVER,
KEY_AV_REG_FREQ: FREQ_NEVER}
runFlumy(simu, 0, seed = seed, params = params, maxiter=600, trace_level=trace_level)
params = {KEY_AV_LOC_PERIOD: 1,
KEY_AV_LOC_FREQ: FREQ_PERIODIC}
runFlumy(simu, 0, params = params, maxiter=1, keep=True, trace_level=trace_level)
params = {KEY_AV_LOC_FREQ: FREQ_NEVER,
KEY_AG_OB_FREQ: FREQ_NEVER}
runFlumy(simu, 0, params = params, maxiter=20, keep=True, trace_level=trace_level)
print("Simulation finished!")
Flumy (8.000) / 2025-02-04 Running simulation... [0] Info : Iteration 0 : Launching system Fluvial [0] Info : Iteration 0 : Automatic channel creation [0] Info : Steepest Channel Creation Success [0] Info : Iteration 119 : Overbank Flow [0] Info : Iteration 127 : Overbank Flow [0] Info : Iteration 198 : Overbank Flow [0] Info : Iteration 222 : Overbank Flow [0] Info : Iteration 326 : Overbank Flow [0] Info : Iteration 397 : Overbank Flow [0] Info : Iteration 427 : Overbank Flow [0] Info : Iteration 439 : Overbank Flow [0] Info : Iteration 487 : Overbank Flow [0] # WARNING # : Some parameters are out of the usual range of values: - Inconsistency between overbank period and local avulsion period. Interval between local avulsions (1 iterations) should be greater or equal than interval between overbank flow (70 iterations) [0] Info : Iteration 600 : Launching system Fluvial [0] Info : Iteration 601 : Levee Breaches (others) [0] Info : Local Avulsion Success - Chute cutoff (no splay) [0] Info : Local Avulsion Success - New path downstream [0] Info : Iteration 601 : Launching system Fluvial Simulation finished!
In [5]:
ch = simu.getChannel()
print(simu.getDomain().getZMaxRel())
npts = ch.number_of_points()
x = [ch.get_point(j).getX() for j in range(0,npts)]
y = [ch.get_point(j).getY() for j in range(0,npts)]
dist = [ch.get_point(j).getS() for j in range(0,npts)]
elev = [ch.get_point(j).getZ() for j in range(0,npts)]
print("[",np.min(elev),",",np.max(elev),"]")
plt.plot(x, elev)
plt.plot(dist, elev)
plt.show()
plt.plot(x,y)
0.7800000000000196 [ 0.2300404284692822 , 0.7794061192539269 ]
Out[5]:
[<matplotlib.lines.Line2D at 0x7f8366995150>]
In [6]:
topo = getTopo(simu)
g = simu.getDomain().getGrid()
l = g.getLength()
w = g.getWidth()
showTopo(topo, size=6, legend=1, extent=[0,l,0,w])
In [42]:
# Get the 3D regular block
zt = 1
dz = 0.01
# Calculate extension
fac,grain,age = simu.getBlock(dz, zb=0, zt=zt)
g = simu.getDomain().getGrid()
w = g.getWidth()
extent = [0,w,0,zt/dz]
#extent = None
# Display Facies cross-flow sections
showSection(fac = fac[10,:,:], size=8, legend=1, extent=extent)
showSection(fac = fac[30,:,:], size=8, legend=1, extent=extent)
showSection(fac = fac[50,:,:], size=8, legend=1, extent=extent)
showSection(fac = fac[80,:,:], size=8, legend=1, extent=extent)
showSection(fac = fac[110,:,:], size=8, legend=1, extent=extent)
showSection(fac = fac[140,:,:], size=8, legend=1, extent=extent)
showSection(fac = fac[170,:,:], size=8, legend=1, extent=extent)
showSection(fac = fac[200,:,:], size=8, legend=1, extent=extent)
In [ ]: