Time based conditional statement
3 ビュー (過去 30 日間)
古いコメントを表示
I am in a class based on estuaries and we were told to write a conditional flux statement to track nitrogen concentration.
I want to condition to show 1000 mg N/L for the first 10 hours, and then I want it to drop to zero. I am supposed to enter this as a left boundary condition. Could anyone tell me how to write a code for this condition? Thank you!
This is what that part of my code looks like currently
Boundary conditions
function [pl,ql,pr,qr] = pdex1bc(xl,cl,xr,cr,t)
pl = 1000; % ***
ql = 1; % ***
pr = cr - 0; % ***
qr = 0; % ***
% Concentration (c): pi = ci - Conci; qi = 0 (i = l,r)
% Flux (F): pi = Fi; qi = 1 (i = l,r)
0 件のコメント
回答 (1 件)
Walter Roberson
2023 年 10 月 11 日
I have not used the pde functions myself. I have, however, used the ODE functions, and knowing something about those and reading the documentation https://www.mathworks.com/help/matlab/ref/pdepe.html it looks to me as if you should have time-dependent boundary conditions in a single call.
Instead, what you should do is make two calls with two different tspan. The first one would be out to 10 hours, and the second one would start from 10 hours and run to whenever. You would use the outputs of the first call as inputs to the second call. You would have arranged 1000 mg N/L as the value for the first call, but 0 as the value for the second call.
0 件のコメント
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!