CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Custom derivative method in ODE solver. (

l_r_mcglashan November 25, 2010 09:02

Custom derivative method in ODE solver.

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:


        const scalar x,
        const scalarField& y,
        scalarField& dydx
    ) const

        for (int i=0;i<nEqns();++i){
            dydx[i] = myDerivativeCalculator.getSources(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.

balkrishna January 28, 2011 00:12

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 ......

All times are GMT -4. The time now is 18:43.