# parabolic

Solve parabolic PDE problem

## Syntax

u1 = parabolic(u0,tlist,model,c,a,f,d)
u1 = parabolic(u0,tlist,model,c,a,f,d,rtol)
u1 = parabolic(u0,tlist,model,c,a,f,d,rtol,atol)
u1 = parabolic(u0,tlist,b,p,e,t,c,a,f,d)
u1 = parabolic(u0,tlist,b,p,e,t,c,a,f,d,rtol)
u1 = parabolic(u0,tlist,b,p,e,t,c,a,f,d,rtol,atol)
u1 = parabolic(u0,tlist,K,F,B,ud,M)
u1 = parabolic(u0,tlist,K,F,B,ud,M,rtol)
u1 = parabolic(u0,tlist,K,F,B,ud,M,rtol,atol)
u1 = parabolic(___,'Stats','off')

## Description

u1 = parabolic(u0,tlist,model,c,a,f,d) produces the solution to the FEM formulation of the scalar PDE problem

$d\frac{\partial u}{\partial t}-\nabla \cdot \left(c\nabla u\right)+au=f,$

on a 2-D or 3-D region Ω, or the system PDE problem

$d\frac{\partial u}{\partial t}-\nabla \cdot \left(c\otimes \nabla u\right)+au=f,$

with geometry, mesh, and boundary conditions specified in model, and with initial value u0. model is a PDEModel object. See Solve Problems Using PDEModel Objects.

For a scalar PDE problem, each row in the solution matrix u1 is the solution at the coordinates given by the corresponding column in the points p = model.Mesh.Nodes. Each column in u1 is the solution at the time given by the corresponding item in tlist. For a system of dimension N with np node points, the first np rows of u1 describe the first component of u, the following np rows of u1 describe the second component of u, and so on. Thus, the components of u are placed in the vector u as N blocks of node point rows.

The coefficients c, a, d, and f of the PDE problem can be given in a variety of ways. The coefficients can depend on t, the time. They can also depend on u, the solution, and on the components of the gradient of u, namely ux, uy, and, for 3-D geometry, uz. For a complete listing of all options, see Scalar PDE Coefficients and Coefficients for Systems of PDEs.

atol and rtol are absolute and relative tolerances that are passed to the ODE solver.

u1 = parabolic(u0,tlist,b,p,e,t,c,a,f,d) solves the problem using a mesh described by p, e, and t, with boundary conditions given by b.

b describes the boundary conditions of the PDE problem. For the recommended way of specifying boundary conditions, see Specify Boundary Conditions Objects. For all methods of specifying boundary conditions, see Forms of Boundary Condition Specification.

The geometry of the PDE problem is given by the mesh data p, e, and t. For details on the mesh data representation, see Mesh Data.

u1 = parabolic(u0,tlist,K,F,B,ud,M) produces the solution to the ODE problem

$\begin{array}{c}{B}^{\prime }MB\frac{d{u}_{i}}{dt}+K\text{\hspace{0.17em}}·\text{\hspace{0.17em}}{u}_{i}=F\\ u=B{u}_{i}+{u}_{d}\end{array}$

with initial value for u being u0.

Add the Stats name-value pair at the end of any syntax to control the display of internal ODE solver statistics. Valid values for Stats are 'off' and 'on' (default).

## Examples

Solve the heat equation

$\frac{\partial u}{\partial t}=\Delta u$

on a square geometry –1 ≤ x,y ≤ 1 (squareg). Choose u(0) = 1 on the disk x2 +y2 < 0.42, and u(0) = 0 otherwise. Use Dirichlet boundary conditions u = 0 (squareb1). Compute the solution at times linspace(0,0.1,20). Plot the initial condition and the solution at the final time.

model = createpde;
geometryFromEdges(model,@squareg);
generateMesh(model,'Hmax',0.02);
p = model.Mesh.Nodes;
u0 = zeros(size(p,2),1);
ix = find(sqrt(p(1,:).^2 + p(2,:).^2) < 0.4);
u0(ix) = ones(size(ix));
tlist = linspace(0,0.1,20);
c = 1;
a = 0;
f = 0;
d = 1;
applyBoundaryCondition(model,'Edge',1:model.Geometry.NumEdges,'u',0);
u1 = parabolic(u0,tlist,model,c,a,f,d);
pdeplot(model,'xydata',u1(:,1));
axis equal
figure
pdeplot(model,'xydata',u1(:,20))
axis equal

 Note   In expressions for boundary conditions and PDE coefficients, the symbol t is used to denote time. The variable t is often used to store the triangle matrix of the mesh. You can use any variable to store the triangle matrix, but in the Partial Differential Equation Toolbox™ expressions, t always denotes time.