The Mathematica Journal
Departments
Feature Articles
Columns
New Products
New Publications
Classifieds
Calendar
News Bulletins
Mailbox
Letters
Write Us
About the Journal
Staff and Contributors
Submissions
Subscriptions
Advertising
Back Issues
Home
Download this Issue

A More Interesting Example

Let's solve a larger and more interesting Laplacian problem: a simple sink and a source on a rectangular grid. It can be defined with the following boundary conditions and mesh.

[Graphics:../Images/index_gr_96.gif]

(a)

[Graphics:../Images/index_gr_97.gif]

(b)

Figure 3. A two-dimensional Laplacian problem: (a) Problem description and (b) the FEM mesh.
© Copyright Naci M. Dai.

The mesh in Figure 3(b) is formed by the following regular grid:

[Graphics:../Images/index_gr_98.gif]

Each node in the domain has only one degree-of-freedom [Graphics:../Images/index_gr_99.gif]; therefore it has the same index as the node number. Providing the fixed dofs and their values as below, we solve the linear system of equations:

[Graphics:../Images/index_gr_100.gif]

The FEM domain is represented by a regular grid. The result can be plotted with the built-in function ListContourPlot.

Needs["Graphics`Graphics3D`"];
Needs["Graphics`Legend`"];

HueMod[h_]   := Hue[1- 0.8*h];

ShowLegend[
 ListContourPlot[Partition[ans,cols],Contours->19,
 ContourSmoothing->Automatic,
 ColorFunction->HueMod,
 DisplayFunction->Identity],
 {HueMod, 10, "0", " 10", 
 LegendPosition->{1.1,-0.4}}];

[Graphics:../Images/index_gr_101.gif]

Figure 4. The contour plot for the scalar field approximated by the FEM solution.
© Copyright Naci M. Dai.


Converted by Mathematica     

[Article Index] [Prev Page][Next Page]