Re: Numerical evaluation is Mathematica bottleneck?!
- To: mathgroup at smc.vnet.net
- Subject: [mg69066] Re: Numerical evaluation is Mathematica bottleneck?!
- From: Oliver Ruebenkoenig <ruebenko at uni-freiburg.de>
- Date: Tue, 29 Aug 2006 03:26:02 -0400 (EDT)
- References: <email@example.com>
- Sender: owner-wri-mathgroup at wolfram.com
Dear Gregor, It is difficult to give a definite answer since you do not give the exact problem. Here are some _thoughts_ on the problem. > > I am solving a non-linear semiconductor PDE problem with finite > difference discretization. The Compiled algebraic equation and its > Jacobian take as input central point and two adjacent neighbors and > they are Threaded over the whole mesh. A LinearSolve and some damping > schemes are used to obtain next step towards the solution. Typical mesh > is about 300 points and the solution is usually found in 7 iterations, > which takes about 7 seconds of computational time.This is already too > slow, but since I plan to solve the problem in 2D this is much too > slow!!! The bottleneck is the numerical evaluation of the compiled > equation and its Jacobian. I am thinking of using MathLink and write the > numerical evaluation routine in C++, which would take a list of data and > return evaluated function and the Jacobian. > OK, you might want to look at the finite element operators i have implemented: http://www.imtek.uni-freiburg.de/simulation/mathematica/IMSweb/imsTOC/Differential%20Equation%20Systems/Discretization/FEMOperatorsDocu.html And some examples which can be found here: http://www.imtek.uni-freiburg.de/simulation/mathematica/IMSweb/imsTOC/Application%20Examples/Finite%20Element%20Method/index.html (Maybe the Navier-Stokes one is interesting for you since it is non-linear) An important step will be the linearization which can be done symbolically. See: http://www.imtek.uni-freiburg.de/simulation/mathematica/IMSweb/imsTOC/Differential%20Equation%20Systems/Utilities/NonlinearPDEDocu.html This will give you the input to the finite element (or any other PDE discretization method) operators. The point here is that you do the linearization once and feed the operators with the old state variable until convergence has been reached. > Is this the right way? Could the link itself be a timing bottleneck? Any > other suggestions? > MathLink is good if you can write out all the data _one_ compute in C and read back _once_. If you do lots of interaction. If might loose to much performance. I have done a thorough analysis of MathLink for Mathematica Version 4. You can have a look at it: http://www.imtek.uni-freiburg.de/simulation/mathematica/IMSweb/imsTOC/Interfaces/MathLibDevCon2003Docu.html Does this help???? Oliver Oliver Ruebenkoenig, <ruebenko at imtek.de> Phone: ++49 +761 203 7388