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

Custom derivative method in ODE solver.

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 25, 2010, 09:02
Default Custom derivative method in ODE solver.
  #1
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
Hello,

When using the ODE solvers, I want to calculate the derivatives. This is reasonably complicated so I have a separate class for doing this.

The problem is that the derivative method in the ODE base class is 'const'. So I can't do the following:

Code:
  void
    MyODE::derivatives
    (
        const scalar x,
        const scalarField& y,
        scalarField& dydx
    ) const
    {

        myDerivativeCalculator.solve();
      
        for (int i=0;i<nEqns();++i){
            dydx[i] = myDerivativeCalculator.getSources(i);
            myDerivativeCalculator.setY(y[i]);
        }

    }
...unless I declare myDerivativeCalculator as mutable in the header of MyODE.

I was wondering why the derivative method is const, and the best way to get around this.
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   January 28, 2011, 00:12
Default
  #2
Senior Member
 
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17
balkrishna is on a distinguished road
In a similar situation ,I wanted to calculate the numerical jacobian in one of my cases . Have you found a workaround for this ? Besides this is OpenFOAM a good platform to solve a system of differential algebraic equation system ? As of now , I am using SUNDIALS ......
balkrishna 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
two mixing compresible fluids solver ziemowitzima OpenFOAM Running, Solving & CFD 27 August 13, 2020 13:40
Need ODE solver Levi Main CFD Forum 3 April 9, 2003 23:38
The NAC Method solver Maciej Matyka Main CFD Forum 2 June 8, 2001 17:04
Mesh generator and CFD solver Gennady Kireyko Main CFD Forum 0 May 6, 2001 12:13
Laplace or Stokes equations solver by Boundary Elements Method Lemonnier Main CFD Forum 3 December 28, 1999 14:48


All times are GMT -4. The time now is 22:32.