Help in defining c coefficient and BCs for two coupled reaction-diffusion equations in 2d in solvepde

4 visualizzazioni (ultimi 30 giorni)
Hello,
Help in defining c coefficient for two coupled reaction-diffusion equations in 2d in solvepde. I have two equations with two dependent functions phi and mu that I'm solving between two concentric cylinders. The equations are:
so the first equation is diffusion-like and the second is Poisson-like. I am writing them as
  1. du1/dt-1/a^2*laplacian(u2)=0
  2. 0=-B/a^2*laplacian(u1)+g(u1)-u2
where u1=phi and u2=mu. The diffusion coefficients include the parameters a and B. The auxiliiary function g is g(u1)=b*u1+c*u1^3 where b (b<0) and c (c>0) are constants.
The system is to be solved in between two concentric cylinders of dimensionless radii r=1 and r=L. The boundary conditions are these:
Here phi0 and J0 are constantrs. The BCs can be written as
u1(r=L)=phi0 (Dirichlet)
u2(r=L)=b*phi0+c*phi0^3 (Dirichlet)
grad(u1)(r=L)*n=0 (Neumann)
grad(u2)(r=1)=-J0 (Neumann)
I have two questions, one for the c coefficient and one for the boundary conditions:
1. How do I define c? Currently I am using
CA=specifyCoefficients(model,'m',0,'d',[100;0.1],'c',[0;-Ba2;1/a^2;0],'a',0,'f',@fcoeff);
u=solvepde(model,tlist);
I have an f function defined as
%__________________________________________
function f=fcoeff(location,state)
global b c
nr=length(location.x); % number of columns
f=zeros(2,nr); % allocate f
f(1,:)=zeros(1,nr);
f(2,:)=b*state.u(1,:)+c*state.u(1,:).^3-state.u(2,:);
end
Is this correct?
2. Regarding the boundary conditions, I have 4 edges on the outer cylinder (1:4) and 4 edges on the inner cylinder (5:8). Currently I am using
applyBoundaryCondition(model,'dirichlet','Edge',[1,2,3,4],'u',[phi0,b*phi0+c*phi0^3]); % Dirichlet BCs at outer radius:
applyBoundaryCondition(model,'neumann','Edge',[5,6,7,8],'q',[0 0;0 0],'g',[-J0/a;0]); % Neumann BCs at inner radius:
Is this correct?
Thanks in advance,
Yoav

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by