Model reaction diffusion brusselator 2d matlab

Click For Summary

Discussion Overview

The discussion centers around a MATLAB implementation of the Brusselator model for reaction-diffusion in two dimensions. Participants are addressing issues related to initial conditions, code efficiency, and numerical stability in the context of a project involving differential equations.

Discussion Character

  • Technical explanation
  • Homework-related
  • Debate/contested

Main Points Raised

  • One participant shares the equations for the Brusselator model and the initial and boundary conditions they are using.
  • Another participant requests a clearer description of the problem to assist with debugging the MATLAB code.
  • A participant identifies a mistake in the initialization of the arrays for u and v, noting that the indices should be used correctly to set initial conditions.
  • Concerns are raised about the numerical stability of the solution, particularly with NaN values appearing at certain time steps.
  • Another participant comments on the efficiency of the code, suggesting the use of array operations instead of for loops and recommending a different approach for handling boundary conditions.
  • One participant expresses a lack of familiarity with MATLAB, indicating challenges in performing calculations and writing code.

Areas of Agreement / Disagreement

Participants do not appear to reach a consensus on the best approach to resolve the coding issues, and multiple viewpoints regarding coding efficiency and numerical stability are present.

Contextual Notes

Participants have noted issues with initial conditions leading to NaN values, and there are suggestions for improving code efficiency, but no specific solutions have been agreed upon.

Who May Find This Useful

This discussion may be useful for individuals working on reaction-diffusion models, particularly those using MATLAB for numerical simulations, as well as those interested in debugging and optimizing code in scientific computing contexts.

RiseFox
Messages
3
Reaction score
0
Moved from a technical forum, so homework template missing
Hello, I have a project (model reaction diffusion brusselator 2d)
∂u/∂t=A+u^2v-(B−1)u+D1((∂^2)u/∂(x^2)+(∂^2)u/∂(y^2))
∂v/∂t=Bu−u^2v+D2((∂^2)v/∂(x^2)+(∂^2)v/∂(y^2))

initial conditions:
u(x,y,0) = 0.5 + y,
v(x,y,0) = 1 + 5x.

boundary conditions:
∂u/∂n = 0, ∂v/∂t = 0

n-external normal to the boundary

for numerical experiment:
A=1;B=3.4; D1=D2=2*10-3

I attached .zip with MATLAB code, but it is not working properly for some reason (( pls help me with code (problems with initial conditions)
 

Attachments

Physics news on Phys.org
RiseFox said:
I attached .zip with MATLAB code, but it is not working properly for some reason (( pls help me with code (problems with initial conditions)
You'll have to describe the problem better than that.
 
ok, I already found one mistake there was to be no x, y and i, j
Code:
for i =1:n
    for j =1:n
        u(i,j) = 0.5 + i;
        v(i,j) = 1 + 5*j;
    end
end

at t = 0
Screenshot_10.png
is good,
but in other cases(t=0.25; t=0.75),
my u = NaN go in and I'm stuck at this point
Screenshot_7.png
 
Why is t_max = 0?

While not related to your problem, I must say that your program if not efficient. In the brusselator functions, you should use array operations, not for loops. In laplacian, you should not have a series of ifs for border cases. Use instead a main loop dealing with core points, and then treat the border values independently.
 
I realized now, even if I knew how to write, since I do not use matlab, and perform calculations have it
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
Replies
2
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K