## How to get the u, ux and uy while solving a parabolic PDE?

on 23 Nov 2012

### Bill Greene (view profile)

Hello all,

I'm trying to solve a parabolic PDE, which the coefficients may depend on location, time and its partial derivatives.

According to the standard parabolic form in Matlab, the coefficients c, a, f and d need to be prepared. From the Matlab document http://www.mathworks.co.uk/help/pde/ug/scalar-coefficients-in-string-form.html, the coefficients can be written in the "string form" with their dependences:

c = 'pde_coeff_c(x,y,t)';

a = 'pde_coeff_a(x,y,t)';

f = 'pde_coeff_f(x,y,t,u,ux,uy)';

d = 1;

with all the corresponding functions.

Boundary condition and geometry are exported from PDE toolbox GUI as myBoundaryMatrix and myGeomMatrix. Therefore, the mesh is generated as:

[p,e,t] = initmesh(myGeomMatrix, 'hmax', 0.03);

Initial condition u0 is initialised as:

u0 = 0;

and time sequence as:

tlist = 0:0.1:1;

Finally, call the parabolic solver:

u = parabolic(u0,tlist,myBoundaryMatrix,p,e,t,c,a,f,d);

With these configurations, I can successfully use the x, y and t variables to organise my coefficients like c and a. However, I cannot use the u, ux or uy while constructing coefficient f. The u, ux and uy are always empty matrices.

I believe the parabolic coefficients should be able to use u, ux and uy, as mentioned in http://www.mathworks.co.uk/help/pde/ug/pde-coefficients.html:

In all cases, the coefficients d, c, a, and f can be functions of position (x and y) and the subdomain index. For all cases except eigenvalue, the coefficients can also depend on the solution u and its gradient. And for parabolic and hyperbolic equations, the coefficients can also depend on time.

Thank you.

Best Regards,

Bowen

## Products

No products are associated with this question.

### Bill Greene (view profile)

on 24 Nov 2012

Hi,

Are you by any chance using a version of MATLAB older than R2012b? The capability to have coefficients in parabolic (and hyperbolic) analyses that depend on u, ux, and uy is new in that version of the product.

Bill

Bowen

### Bowen (view profile)

on 27 Nov 2012

Yes, you're right. The problem solved in 2012b. Thank you very much.

Bowen

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi