Resolve normal depth from Manning's equation

Hello,
I aim to obtain the normal depth of a channel using Mannig's equation. Somehow I don't manage to resolve its value. Here it's the pieco of code that I'm using:
riverSlope=0.0114; % [m/m] - inletSlope, outletSlope or riverSlope
bottom_width=33.5937; % [m] - inlet or outlet bottom width
slope_Rbank=1.1336; % [m/m] - slope_Rbank_in or slope_Rbank_out
slope_Lbank=0.3334; % [m/m] - slope_Lbank_in or slope_Lbank_out
q=10; % [m3/s] - Flow discharge
n=0.04; % [-] - Manning's roughness coefficient
syms y
area=(bottom_width+(y/(2*slope_Rbank))+(y/(2*slope_Lbank)))*y;
wetted_perimeter=bottom_width+y*(sqrt(1+(1/slope_Rbank)^2)+sqrt(1+(1/slope_Lbank)^2));
manning_eqn=@(y)(1/n)*((area/wetted_perimeter)^(2/3))*(riverSlope^(1/2))*area==q;
soly=solve(manning_eqn,y)
I would really appreciate if someone can help to fix it in order to obtain the desired values and avoid the coding of an iteration loop for the manual calculation. Thanks in advance!!
Álvaro

 採用された回答

Alan Stevens
Alan Stevens 2020 年 8 月 1 日
編集済み: Alan Stevens 2020 年 8 月 1 日

0 投票

This shoud do it:
depth0 = 1; % Initial guess
depth = fzero(@manningfn, depth0);
function manning = manningfn(y)
riverSlope=0.0114; % [m/m] - inletSlope, outletSlope or riverSlope
bottom_width=33.5937; % [m] - inlet or outlet bottom width
slope_Rbank=1.1336; % [m/m] - slope_Rbank_in or slope_Rbank_out
slope_Lbank=0.3334; % [m/m] - slope_Lbank_in or slope_Lbank_out
q=10; % [m3/s] - Flow discharge
n=0.04; % [-] - Manning's roughness coefficient
area=(bottom_width+(y/(2*slope_Rbank))+(y/(2*slope_Lbank)))*y;
wetted_perimeter=bottom_width+y*(sqrt(1+(1/slope_Rbank)^2)+sqrt(1+(1/slope_Lbank)^2));
manning = (1/n)*((area/wetted_perimeter)^(2/3))*(riverSlope^(1/2))*area-q;
end

3 件のコメント

Álvaro Pardo
Álvaro Pardo 2020 年 8 月 1 日
Is there any way I can define the parameters out of the function? That would be nice because I aim to use them for other applications. Many thanks!!
Alan Stevens
Alan Stevens 2020 年 8 月 1 日
Yes, you could do this:
riverSlope=0.0114; % [m/m] - inletSlope, outletSlope or riverSlope
bottom_width=33.5937; % [m] - inlet or outlet bottom width
slope_Rbank=1.1336; % [m/m] - slope_Rbank_in or slope_Rbank_out
slope_Lbank=0.3334; % [m/m] - slope_Lbank_in or slope_Lbank_out
q=10; % [m3/s] - Flow discharge
n=0.04; % [-] - Manning's roughness coefficient
data =[riverSlope; bottom_width; slope_Rbank; slope_Lbank; q; n];
depth0 = 1; % Initial guess
depth = fzero(@manningfn, depth0,[],data);
function manning = manningfn(y, data)
riverSlope=data(1);
bottom_width=data(2);
slope_Rbank=data(3);
slope_Lbank=data(4);
q=data(5);
n=data(6);
area=(bottom_width+(y/(2*slope_Rbank))+(y/(2*slope_Lbank)))*y;
wetted_perimeter=bottom_width+y*(sqrt(1+(1/slope_Rbank)^2)+sqrt(1+(1/slope_Lbank)^2));
manning = (1/n)*((area/wetted_perimeter)^(2/3))*(riverSlope^(1/2))*area-q;
end
Álvaro Pardo
Álvaro Pardo 2020 年 8 月 1 日
Many thanks Alan!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMathematics and Optimization についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by