# Partial Differential Equation Toolbox Examples

## Partial Differential Equation Toolbox Examples

Inhomogeneous Heat Equation on a Square Domain

This example shows how to solve the heat equation with a source term using the parabolic function in the Partial Differential Equation Toolbox™.

The basic heat equation with a unit source term is

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

This is solved on a square domain with a discontinuous initial condition and zero Dirichlet boundary conditions.

Problem Definition

g: A specification function that is used by initmesh. For more information, please see the documentation page for squareg and pdegeom.

c, a, f, d: The coefficients of the PDE.

g = @squareg;
c = 1;
a = 0;
f = 1;
d = 1;

Create a PDE Model with a single dependent variable

numberOfPDE = 1;
pdem = createpde(numberOfPDE);

Create a geometry and append it to the PDE Model

geometryFromEdges(pdem,g);

Apply Boundary Conditions

% Plot the geometry and display the edge labels for use in the boundary
% condition definition.
figure
pdegplot(pdem, 'edgeLabels', 'on');
axis([-1.1 1.1 -1.1 1.1]);
title 'Geometry With Edge Labels Displayed'

% Solution is zero at all four outer edges of the square
applyBoundaryCondition(pdem,'Edge',(1:4), 'u', 0);

dandani

Messages : 5
Date d'inscription : 11/06/2015
Age : 26

Sujets similaires

Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum