CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Could someone suggest simple (nonlinear) solver

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 4, 2009, 09:26
Default Could someone suggest simple (nonlinear) solver
  #1
Bren
Guest
 
Posts: n/a
Hi Guys, I'm trying to solve a single equation (of one variable) which is nonlinear. It's quite a nasty equation containing a log(x) and an exp(1/x) term as well as some polynomial terms.

Could someone please suggest a numerical scheme I could use to solve such an equation? I want something that will calculate the answer very quickly.

Basically I'm trying to avoid an iterative procedure and have managed to write all my equations in terms of one unknown - this final equation is nonlinear and once I've solved it I can solve all the others. If the solution of the nonlinear eqn takes longer than the iterative procedure then the whole thing will be rather pointless.

I'd be very grateful for any help you guys could provide. Bren
  Reply With Quote

Old   February 4, 2009, 13:01
Default Re: Could someone suggest simple (nonlinear) solve
  #2
ag
Guest
 
Posts: n/a
As far as I am aware, there is no general "non-iterative" solver for non-linear equations. You may be able to find a solution technique for a particular equation, but that's what makes non-linear equations so tough - there are no general methods for coming up with exact solutions. Unless the equation presents itself in a form that allows an exact solution I don't think you'll find a non-iterative numerical technique. The only idea that comes to mind right off the bat is to see if you can implement a variable transformation that would result in an equation form that can be readily solved in an exact sense, i.e. one that would turn the existing equation into a simple polynomial form for which the roots are known.

A Newton-Raphson iterative solver is not particularly slow, unless you have an equation with a set of badly placed roots or you have no idea what to use as a starting guess.
  Reply With Quote

Old   February 4, 2009, 14:51
Default Re: Could someone suggest simple (nonlinear) solve
  #3
Jed
Guest
 
Posts: n/a
Bren, I'd like to point out that division, roots, and all the transcendental functions are implemented using iterative methods (the first two usually use Newton's method). Ignoring these iterations, it is not possible to find the roots of a general fifth (or higher) degree polynomial without iteration. In practice, the polynomial rootfinding problem is often transformed into an eigenvalue problem, but this does not work for non-polynomial functions. Due to this duality, there is no non-iterative eigenvalue procedure.

Also, it's not necessarily beneficial to eliminate as many variables as possible. That is, it's possible that the behavior of the function becomes more nasty as you eliminate variables.

If you want to speed up your solver, the initial guess is where you can gain the most time. Depending on the number of independent parameters, you might benefit from a small lookup table. Or perhaps there is a heuristic to get close, or the root of the last set of equations is close because of spatial correlation.
  Reply With Quote

Old   February 4, 2009, 16:38
Default Re: Could someone suggest simple (nonlinear) solve
  #4
Ahmed
Guest
 
Posts: n/a
Bren, I have used maxima (an open source programme that is available on most linux distributions) to solve such equations, try it
  Reply With Quote

Old   February 4, 2009, 22:36
Default Re: Could someone suggest simple (nonlinear) solve
  #5
fluent-user
Guest
 
Posts: n/a
many people have already commented that it might not be possible to find direct solution to your problem.

If i were you I would be trying to look of a equation whose direct solution is available and solution closely resembles the equation you have in your hand. I would use this initial guess with iterative procedure and quickly come out of it.

Anyway this is only a suggestion actual implementation may even not be possible though. So consider this just as a suggestion. My 2 cents (in this recession).
  Reply With Quote

Old   February 5, 2009, 05:24
Default Many thanks
  #6
Bren
Guest
 
Posts: n/a
Thank you very much everyone - your responses have been very helpful.

I think I will give the Newton-Raphson method a whirl as I've had some luck with it in the past. I have to be able to code up the method myself (using fortran) so, unfortunately, using commercially available software isn't an option.

Many thanks, Bren

  Reply With Quote

Old   February 5, 2009, 14:31
Default Re: Many thanks
  #7
andy2o
Guest
 
Posts: n/a
Bren,

You don't necessarily have to start from scratch with your code!

There are plenty of sources of free public domain code numerical routines around (www.netlib.org takes a bit of getting used to but has good Fortran / C codes, most (but not all) of which are public domain). A web search will find many other sources (of mixed quality of course, like anything on the internet, so be careful and test, test, test....).

Certainly look at the advice in the "Numerical Recipes" books too (in most libraries have copies or free access to the older editions is available on line at http://www.nr.com/oldverswitcher.html ). They should be a good starting point....

What language will you be using? If you're lucky someone might know of a code in your language!

Regards, Andy2o
  Reply With Quote

Old   February 5, 2009, 22:23
Default Re: Could someone suggest simple (nonlinear) solve
  #8
momentum_waves
Guest
 
Posts: n/a
It's dead easy. Write an Excel spreadsheet, & iterate into solution.

Be careful to approach the solution carefully by hand until the changes slow, then turn on automatic iteration.

Have fun. mw...

Momentum waves <www.adthermtech.com/wordpress3>

  Reply With Quote

Old   February 6, 2009, 22:02
Default Re: due correction
  #9
Ahmed
Guest
 
Posts: n/a
Bren On planet Earth, poeple know that the Linux OS and all the projects related to it are free open source codes including maxima (wxmaxima with the gui), you have your reasons to start from scratch, I do not enter here, but please do not tell us that "maxima" is a commercial code, there is even a windows installer. Good Luck to all living on Orion
  Reply With Quote

Old   February 8, 2009, 18:36
Default Re: due correction
  #10
Bren
Guest
 
Posts: n/a
I didn't mean to suggest that maxima was a commercial code Ahmed. I appologise for not being clear enough - I need to adapt an existing fortran code to include a nonlinear solver. That is why I need to code the method myself rather than rely on software produced by someone else, whether it be commercial or open source. I thought that my position was clear in my post: "able to code up the method myself" was a strong hint.

Here on Orion it's considered good manners to respond to a polite statement (such as my "Many Thanks" post) with a polite response, being a sarcastic tool is actually considered quite rude here! You should visit some time - though I would advise that you adopt a less hostile attitude.

Bren

  Reply With Quote

Old   March 7, 2009, 07:36
Default Re: Could someone suggest simple (nonlinear) solve
  #11
ztdep
Guest
 
Posts: n/a
try matlab or maple

  Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating New Solver: For particle-laden compressible jets sankarv OpenFOAM Running, Solving & CFD 17 December 3, 2014 20:41
OpenCL linear solver for OpenFoam 1.7 (alpha) will come out very soon qinmaple OpenFOAM Announcements from Other Sources 4 August 10, 2012 12:00
SIMPLE on unsteady solver? impecca OpenFOAM Running, Solving & CFD 2 May 5, 2010 13:28
Is there any nonlinear solver package at Windows? leaf Main CFD Forum 0 July 11, 2006 00:45
public domain f77 separable nonlinear least squares solver wanted Sergei Chernyshenko Main CFD Forum 10 January 28, 2000 14:56


All times are GMT -4. The time now is 04:27.