How to couple interface of two domains in MATLAB?
40 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
Can you give me an idea/useful links/example code of similar type of problem to solve the following problems(variation of u1 and u2 along x asis)? Actually I am struggling with the interface coupling/interface boundary conditions.
Any kinds of suggestion will be appreciated!
Regards,
Anadi
6 Kommentare
Taj
am 12 Okt. 2023
In this case you can defined a double node at the interface u1(b)=u2(b). But in this case you will the problem of ghost point values that youn can solve by using the second coupling condition for example after approximation your nodes e.g x_I is your interface node in the schme for the left hand boundary you will have u1(x_I+1) also for the right hand region you will have u2(x_I-1). These you can interpolate by using one sided approximation as well as the central differnce approximation.
Antworten (1)
Bill Greene
am 6 Sep. 2022
As I said, I believe that the expression for S in your definition of the problem is not correct and your explanation did not really clarify this.
Nevertheless, here is a solution using pdepe to the problem I think you may be trying to solve. As I said in my comment, only a single dependent variable (PDE) is needed to describe the problem-- not two as you show in your definition.
function twoRegionExample
a=0; b=1; c=3;
x2=linspace(b,c,20);
N1=10;
x = [linspace(a,b,N1) x2(2:end)];
t = linspace(0,.05,50);
A=10; B=2;
pdeFunc = @(x,t,u,DuDx) heatpde(x,t,u,DuDx,b);
icFunc = @(x) heatic(x, A,B, b);
bcFunc = @(xl,ul,xr,ur,t) heatbc(xl,ul,xr,ur,t,A,B);
m=0;
u = pdepe(m, pdeFunc,icFunc,bcFunc,x,t);
figure; plot(x, u(1,:)); grid on;
title 'initial value'; xlabel 'x';
figure; plot(x, u(end,:)); grid on;
title 'solution at final time'; xlabel 'x';
figure; plot(t, u(:,N1)); grid on;
title 'solution at x=b as a function of time'; xlabel 'time';
end
function [c,f,s] = heatpde(x,t,u,DuDx,b)
c = 1;
D1=10; D2=3;
if(x < b)
f = D1*DuDx;
else
f = D2*DuDx;
end
s = 0;
end
function u0 = heatic(x,T1,T2,b)
if(x < b)
u0 = T1;
else
u0 = T2;
end
end
% --------------------------------------------------------------
function [pl,ql,pr,qr] = heatbc(xl,ul,xr,ur,t,A,B)
pl = ul-A;
ql = 0;
pr = ur-B;
qr = 0;
end
1 Kommentar
Francesco Santoni
am 11 Apr. 2024 um 1:12
Hello,
how would you implement a different Neumann boundary condition, such as: ?
Siehe auch
Kategorien
Mehr zu Boundary Conditions finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!