CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Finding root of a function

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By hjasak

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 7, 2008, 10:27
Default Finding root of a function
  #1
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33
hjasak will become famous soon enough
Dear All,

I have just implemented root-finding operations of a function f(x) = 0. If someone is interested, have a look at the SVN - it currently lives in the ODE library.

Enjoy,

Hrv
sabago likes this.
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   July 15, 2008, 08:25
Default Hihttp://www.cfd-online.com/Op
  #2
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi

I am about to be solving 4 sets of non-linear equations on each face on certain boundary-patches. As far as I can see, the function implemented by Hrv is for 1 equation!?!
Is there anywhere in OF implemented some kind of solver for N non-linear set of equations?
If not, could you please suggest to me a suitable open-source implementation, preferable in C++.

Best regards,

Niels

P.S. Thank you for an utterly fantastic workshop.
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   June 1, 2015, 16:05
Default
  #3
Member
 
Sandra
Join Date: Oct 2014
Posts: 58
Rep Power: 11
sabago is on a distinguished road
Dear all,

Has anyone been able to use the BisectionRoot, or RiddersRoot or the NewtonSecant methods in the "findRoot" folder on the svn?

Say I want to solve for x in

0 = -3 + 4(Exp(2x)-Exp(3x))

I have the findRoot folder in src/ODE and added the path to my /make for the solver.

How, then do I implement any of the findRoot methods to get x?

Best regards,
Sandra
sabago is offline   Reply With Quote

Old   November 1, 2015, 12:23
Default
  #4
Member
 
Sandra
Join Date: Oct 2014
Posts: 58
Rep Power: 11
sabago is on a distinguished road
I fixed my issue on this link : http://www.cfd-online.com/Forums/ope...ng-method.html
Quote:
Originally Posted by sabago View Post
Dear all,

Has anyone been able to use the BisectionRoot, or RiddersRoot or the NewtonSecant methods in the "findRoot" folder on the svn?

Say I want to solve for x in

0 = -3 + 4(Exp(2x)-Exp(3x))

I have the findRoot folder in src/ODE and added the path to my /make for the solver.

How, then do I implement any of the findRoot methods to get x?

Best regards,
Sandra
sabago is offline   Reply With Quote

Old   August 10, 2016, 11:16
Default
  #5
Senior Member
 
Saideep
Join Date: Apr 2015
Location: INDIA
Posts: 203
Rep Power: 12
Saideep is on a distinguished road
Hi guys;

I guess my post is best fitted to this thread.

I am trying to solve 2 non-linear equations simultaneously using Newton-secant method.

As Niels had asked the "findRoot" is tested over one equation. How can I couple and use two equations in order to find the solution roots? Any example case already implemented in Foam-extend?

Additionally is it possible to write the number of iterations taken in order to reach the tolerance?

Thanks,
Saideep
Saideep is offline   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
root of 1d monotone picewise linear function bill Main CFD Forum 14 February 2, 2009 16:51
Installing as root in opt bastil OpenFOAM Installation 8 October 22, 2008 02:54
ROOT-MEAN-SQUARE Andy Siemens 1 June 19, 2007 13:25
Polynomial Root finding agg Main CFD Forum 3 May 4, 2004 11:46
root mean square John FLUENT 4 May 30, 2002 16:14


All times are GMT -4. The time now is 12:15.