If you're writing a deposition script and want to vary the beach slopes of tailings (perhaps for sensitivity analysis), there are a couple of ways to do it. If there's a specific set of slopes that you're wanting to run, then it might be easy to simply define a number of different tailings streams in the tailings database, and then use them. The other option is to create the beach profile programatically using the Muk3D Python API.
Using predefined beach slopes
A basic script that does a deposition run is shown below, recorded as a macro. The tailings definition used in the deposition run is CST, which has been defined in the tailings database.
1 2 3 4 5 6 7 |
cmd = get_command('Single stream no pond, as drawn')
result = cmd({ 'base': u'grid+dam.mgrid',
'deposition model': 'Single stream no pond, as drawn',
'dischargePoints': u'disch_1.mcurve',
'maxPondIterations': 1,
'pond_location': None,
'tailings': u'CST'})
|
If we were to go into the tailings database and define some tailings streams (e.g. CST-1%, CST-2%, CST-3%) we could modify the script to run using one of these streams. The tailings stream name is replaced with a variable.
1 2 3 4 5 6 7 8 9 |
tailings_stream = 'CST-1%'
cmd = get_command('Single stream no pond, as drawn')
result = cmd({ 'base': u'grid+dam.mgrid',
'deposition model': 'Single stream no pond, as drawn',
'dischargePoints': u'disch_1.mcurve',
'maxPondIterations': 1,
'pond_location': None,
'tailings': tailings_stream})
|
Now, when the script is executed it will use the tailings_stream variable as the tailings stream for the run. If you want to run multiple scenarios then you could embed the deposition code in a loop, as shown below. Note that in this example the results of the deposition run are not processed.
1 2 3 4 5 6 7 8 9 10 11 |
for tailings_stream in ['CST-1%', 'CST-2%', 'CST-3%']:
cmd = get_command('Single stream no pond, as drawn')
result = cmd({ 'base': u'grid+dam.mgrid',
'deposition model': 'Single stream no pond, as drawn',
'dischargePoints': u'disch_1.mcurve',
'maxPondIterations': 1,
'pond_location': None,
'tailings': tailings_stream})
# process the deposition result from each stream
# ...
|
In this example, the for loop will execute 3 times, looping through the values in the list of tailings names.
Running many tailings slopes
If you had a lot of beach slopes you wanted to run, for example, between 1% and 5% in 0.1% increments, it would be a time consuming exercise to go through and define 41 sets of tailings properties. Instead, we can use an API function to create tailings properties within the script. The function is called muk3d.ooze.create_linear_tailings.
The use of this is shown below.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
from muk3d.ooze import create_linear_tailings
tailings_properties = create_linear_tailings(0.01, 0.03)
cmd = get_command('Single stream no pond, as drawn')
result = cmd({ 'base': u'grid+dam.mgrid',
'deposition model': 'Single stream no pond, as drawn',
'dischargePoints': u'disch_1.mcurve',
'maxPondIterations': 1,
'pond_location': None,
'user tailings': tailings_properties
#'tailings': tailings_stream,
})
|
In line #1 create_linear_tailings is imported. Tailings properties are constructed in line 3. The function takes 2 mandatory arguments - the first is the slope above water (% as a decimal fraction - in this example 0.01 is a 1% beach slope) and the second is the slope below water.
In line 11 a new entry is added to the dictionary passed to the deposition function, with the key equal to 'user tailings' and the value the variable tailings_properties.
In line 12 the tailings key/value pair is commented out.
Now, when the command is run it will use the user defined tailings slope.
Sensitivity
To run a range of combinations or beach above and below water slopes, the deposition function could be embedded within 2 for loops.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
from muk3d.ooze import create_linear_tailings
from muk3d.util import frange
for baw in frange(0.01, 0.05, 0.01):
for bbw in frange(0.02, 0.06, 0.01):
tailings_properties = create_linear_tailings(baw, bbw)
cmd = get_command('Single stream no pond, as drawn')
result = cmd({ 'base': u'grid+dam.mgrid',
'deposition model': 'Single stream no pond, as drawn',
'dischargePoints': u'disch_1.mcurve',
'maxPondIterations': 1,
'pond_location': None,
'user tailings': tailings_properties
#'tailings': tailings_stream,
})
# process the deposition result from each stream
# ...
|
In Python, when you want to loop through a numeric sequence, you'd use the range function to generate that sequence. The problem with range is that it only works for integers. In the Muk3D Python API there is a function called frange (muk3d.util.frange) which works like range, except it works with decimals. In this case, in Line 4, the frange will go from 0.01 to 0.05 (inclusive) in steps of 0.01.
Similarly, in line 5 the bbw variable is set to values between 0.02 and 0.06 in steps of 0.01.
Once this runs it will get the first baw slope (0.01) and then do all the bbw slopes. Then it'll move to the next baw slope (0.02) and do all bbw slopes again.