MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: FEM contourplotter - conversion completed

  • To: mathgroup at smc.vnet.net
  • Subject: [mg88202] Re: [mg88188] FEM contourplotter - conversion completed
  • From: danl at wolfram.com
  • Date: Mon, 28 Apr 2008 04:38:52 -0400 (EDT)
  • References: <200804271101.HAA25324@smc.vnet.net>

> The translation of the Fortran IV 1966 finite element
> contourplot to Mathematica is complete. Those interested in
> that specialized topic may download a mini test version from
>
> http://caswww.colorado.edu/courses.d/IFEM.d/IFEM.Ch27.d/IFEM.Ch27.index.html
>
> Click on ContBandPlotterMini.nb  link. Download and execute.
> Self contained data. Tested so far under V4.1, 4.2 & 5.2.
> Untested under V6.0 as my laptop in Spain lacks it.
> Test plots take ~0.5 sec on 2.4 GHz MacBook Pro under 5.2.
>
> To run under 6.0 set DisplayChannel to Print (see top comment).
>
> The original Fortran code was roughly 9000 lines.  Code was
> typical "write only" thesis spaghetti, with over 1000 GOTOs
> and (believe it or not) even a PAUSE statement! Mathematica
> code is about 800 lines. Imperative procedural logic reflects
> source, but could simplify later conversion to C or assembly.
>
> Posted mini is about 220 lines including test code. Size
> was reduced by deleting 6 element types out of 7, and
> removing an alternative divide & conquer contourplotting
> method. (D&C produces higher quality plots but is slower.)
>
> Code is slow (about 10K poly/sec) but that is enough for
> coursework. A C or assembly version will be needed for FEM
> production work (>=1M poly/sec) at the cost of portability.
> Worst flaw is the shoddy contour value labeling, done in a
> hurry.  To see what's wrong, try resizing top plot with
> mouse.  Advice on how to fix that mess welcome.
>

I'm out of my element for finite elements. There are some regular posters
on this group with considerable knowledge and maybe they will have good
suggestions. As you took the trouble to get the code size reduced by a
factor of 9, and removed spaghetti, I thought I would say what little I
can in case it might help with the speed issues.

(1) You might be losing time to effects of evaluating Graphics[], Line[],
and other objects. You could instead use List[] in many places, and
convert to whatever heads are needed only at the end.

(2) You might gain speed by using machine reals consistently. It looks
like you may be mixing reals and integers. Among other things, this will
make it difficult to use packed arrays.

(3) If you can arrange the code to use List objects and machine reals,
there is a good chance you could use Compile on code in your For loops. My
guess is this is where the most time is spent, and Compile could give this
a nice boost.

Daniel Lichtblau
Wolfram Research







  • Prev by Date: TimeConstrained and returning a partial answer
  • Next by Date: Re: Problems with NSolve
  • Previous by thread: FEM contourplotter - conversion completed
  • Next by thread: RE: FEM contourplotter - conversion completed