Set non-constant boundary condition proportional to solution at that point and time

조회 수: 2 (최근 30일)
Hiya,
I'm attempting to model diffusion from a 3D geometry using PDE Toolbox. I have set up a cylinder and wish for diffusion to occur at a rate proportional to the concentration at that point. I have specified the following:
%Apply F1 rate of flux = 0
applyBoundaryCondition(model,"neumann","Face",1,"g",0,"q",0);
%Apply F2 rate of flux = 3e-6 mol/m2/s = 3e-24 mol/nm2/s
applyBoundaryCondition(model,"neumann","Face",2,"g",3e-24,"q",0);
%Apply F3 rate of exit = 3e-6 mol/m2/s = 3e-24 mol/nm2/s
applyBoundaryCondition(model,"neumann","Face",3,"g",@myfunc,"q",0);
tlist = 0:1e8:1e9;
solution = solvepde(model,tlist);
sol = solution.NodalSolution;
function bcMatrix = myfunc(location,state)
R=1
bcMatrix = R*state.u
end
I was hoping to set my Neumann boundary condition 'g' parameter equal to some constant R multiplied by the concentration on that boundary at that point. I read the forums trying to find an answer but couldn't find one!
I have been trying to model this for hours!! Please help!!

채택된 답변

Ravi Kumar
Ravi Kumar 2020년 11월 5일
Hi Ollie,
The function you have written does exactly what you describe. What is the issue you are encountering?
Regards,
Ravi
  댓글 수: 1
Ollie Bardsley
Ollie Bardsley 2020년 11월 5일
Hiya Ravi,
Thank you for the response. I'm confused because it's taking a ridiculously long time to produce a result from? I had presumed this was because something was wrong with the function...
Best wishes
Ollie

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Boundary Conditions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by