-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some question about FlowAccumulator, StreamPowerEroder and LinearDiffuser #170
Comments
@kookil Thank you for your interest in landlab!
|
Thank you for your help. With your help, I solved part of the problem.
After re-reading the official documentation, I found that the existing version does not have use_Q, so I modified the previous code. But when using the latest StreamPowerEroder I encountered a similar problem to the first question, which is the part of the code you wish I could provide.
The documentation mentions "The default is to use the grid field 'drainage_area'. To use custom spatially/temporally varying rainfall, use 'water__unit_flux_in' to specify water input to the FlowAccumulator and use "surface_water__discharge" for this keyword argument."
To control the runoff, I used the following code:
mg=RasterModelGrid((9,9))
_=mg.add_field('topographic__elevation',mg.node_x**0.5+mg.node_y**2,at='node')
for edge in (mg.nodes_at_left_edge, mg.nodes_at_right_edge):
mg.status_at_node[edge] = mg.BC_NODE_IS_FIXED_VALUE
for edge in (mg.nodes_at_top_edge, mg.nodes_at_bottom_edge):
mg.status_at_node[edge] = mg.BC_NODE_IS_CLOSED
lst = random.random(size=(9,9))
mg.at_node['water__unit_flux_in'] = lst
fr = FlowAccumulator(mg, flow_director='D8')
sp = StreamPowerEroder(
mg,
K_sp=1.,
sp_type='Unit',
a_sp=1.,
b_sp=0.5,
c_sp=1.,
discharge_field='surface_water__discharge')
fr.run_one_step()
sp.run_one_step(1.)
But no matter how lst changes, the final topographic__elevation value is fixed.
I still don't understand why the result is always fixed, I hope you can answer my doubts.
|
@kookil In the future, if possible, please reply to GitHub issues through the website rather than by email as GitHub doesn't properly format the emails. I'm having trouble reproducing your problem. If I run the following code, which I think is what you are also using, the resulting import numpy as np
from numpy import random
from landlab import RasterModelGrid
from landlab.components import FlowAccumulator, StreamPowerEroder
mg = RasterModelGrid((9, 9))
mg.add_field('topographic__elevation', mg.node_x**0.5 + mg.node_y**2, at='node')
for edge in (mg.nodes_at_left_edge, mg.nodes_at_right_edge):
mg.status_at_node[edge] = mg.BC_NODE_IS_FIXED_VALUE
for edge in (mg.nodes_at_top_edge, mg.nodes_at_bottom_edge):
mg.status_at_node[edge] = mg.BC_NODE_IS_CLOSED
lst = random.random(size=(9,9))
mg.at_node['water__unit_flux_in'] = lst
fr = FlowAccumulator(mg, flow_director='D8')
z_initial = mg.at_node["topographic__elevation"].copy()
sp = StreamPowerEroder(
mg,
K_sp=1.,
sp_type='Unit',
a_sp=1.,
b_sp=0.5,
c_sp=1.,
discharge_field='surface_water__discharge'
)
fr.run_one_step()
sp.run_one_step(1.)
assert not np.allcose(z_initial, mg.at_node["topographic__elevation"]) Are you doing something differently? Or perhaps I misunderstand what you are expecting? |
I'm sorry for the inconvenience caused by replying by mail earlier. |
@kookil Could you please paste a minimal code example that demonstrates the issue you are seeing? |
I am using real terrain and precipitation to calculate soil erosion and sediment transport by landlab. And here is part of my code.
(mg, z) = read_esri_ascii(path, name="topographic__elevation") fr = FlowAccumulator(mg) Q = mg.at_node['surface_water__discharge'] ld = LinearDiffuser(mg, linear_diffusivity=0.0001) sp = StreamPowerEroder(mg, K_sp=1., sp_type='Unit', a_sp=1., b_sp=0.5, c_sp=1., use_Q=Q)
The problem I'm having is as follows:
Because I want to change the runoff, so I add
runoff_rate = np.arange(mg.number_of_nodes, dtype=float) rnff = mg.add_field(" water__unit_flux_in ", runoff_rate, at=" node", clobber=True)
like the document, but I find the result mg.at_node['surface_water__discharge'] does not change, and I can't find the reason;
I follow the method StreamPowerEroder in landlab to add existing precipitation values in use_Q, but the code reports an error that there is no use_Q in the function, is this a version problem? my landlab version is 2.2.0;
The grid data I am using has several thousand rows and columns, and I run LinerDiffuser for many days without results, is this because the number of data is too large?
I would be grateful if you can give any assistance.
The text was updated successfully, but these errors were encountered: