Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with boost::numeric::odeint::make_contolled for a custom error stepper #239

Open
SamyuktaV opened this issue Mar 19, 2019 · 0 comments

Comments

@SamyuktaV
Copy link

SamyuktaV commented Mar 19, 2019

Hello,
I am trying to do a comparison between implicit and explicit solvers for stiff system as part of my PhD. I wanted to use a runge-kutta-fehlberg45 stepper for the comparison. I used the template from runge_kutta_fehlberg78 to build a custom stepper by changing the number and values of the parameters of the Butchers Tableau. (I am coding in C++)
This stepper works just fine when I have the problem set up with boost::numeric::ublas::vector< double >. However when I change the problem from type 'double' to type 'complex< double >', I get an error.

The system I am using has the following specifications:

  • System of 2 ODEs
  • The stepper is defined for the type:
    typedef boost::numeric::ublas::vector< complex< double > > comp_type;
  • The stepper definition is as follows:
    typedef my_runge_kutta_fehlberg45< comp_type > error_stepper_type_expI;
  • The RHS struct is defined as follows:
    *struct phys
    {
    vector_type gamma;
    comp_type sD, kD;
    phys( vector_type gam ) : gamma( gam ) { ..... }
    void operator()(const comp_type &p, comp_type &dpdt, complex< double > dt)
    { ............. }
    }; *
  • The line of code causing the error is:
    nos = integrate_adaptive( make_controlled( a_err , r_err , error_stepper_type_expI() ), phys(gamma), p, 0.0, tau, dt);
    where [a_err = 1.0e-06], [r_err = 1.0e-06], [phys(gamma) is a struct whose definition is given above], [p - variable of type comp_type which contains the initial value for the IVP], [tau = 1.0] and [dt is the step size]

I get the following error:
In file included from /usr/local/include/boost/numeric/odeint/stepper/generation.hpp:21,
from /usr/local/include/boost/numeric/odeint.hpp:76,
from main.cpp:1:
/usr/local/include/boost/numeric/odeint/stepper/generation/make_controlled.hpp: In instantiation of ‘struct boost::numeric::odeint::result_of::make_controlled<my_runge_kutta_fehlberg45<boost::numeric::ublas::vector<std::complex > > >’:
/usr/local/include/boost/numeric/odeint/stepper/generation/make_controlled.hpp:71:54: required by substitution of ‘template typename boost::numeric::odeint::result_of::make_controlled::type boost::numeric::odeint::make_controlled(typename Stepper::value_type, typename Stepper::value_type, const Stepper&) [with Stepper = my_runge_kutta_fehlberg45<boost::numeric::ublas::vector<std::complex > >]’
main.cpp:715:88: required from here
/usr/local/include/boost/numeric/odeint/stepper/generation/make_controlled.hpp:65:58: error: no type named ‘type’ in ‘struct boost::numeric::odeint::get_controller<my_runge_kutta_fehlberg45<boost::numeric::ublas::vector<std::complex > > >’
typedef typename get_controller< Stepper >::type type;
^~~~
main.cpp: In function ‘int main()’:
main.cpp:715:88: error: no matching function for call to ‘make_controlled(double, double, error_stepper_type_expI)’
nos = integrate_adaptive( make_controlled( a_err , r_err , error_stepper_type_expI() ), phys(gamma), p, 0.0, tau, dt);
^
In file included from /usr/local/include/boost/numeric/odeint/stepper/generation.hpp:21,
from /usr/local/include/boost/numeric/odeint.hpp:76,
from my_rk4.hpp:11,
from main.cpp:1:
/usr/local/include/boost/numeric/odeint/stepper/generation/make_controlled.hpp:71:54: note: candidate: ‘template typename boost::numeric::odeint::result_of::make_controlled::type boost::numeric::odeint::make_controlled(typename Stepper::value_type, typename Stepper::value_type, const Stepper&)’
typename result_of::make_controlled< Stepper >::type make_controlled(
^~~~~~~~~~~~~~~
/usr/local/include/boost/numeric/odeint/stepper/generation/make_controlled.hpp:71:54: note: substitution of deduced template arguments resulted in errors seen above
/usr/local/include/boost/numeric/odeint/stepper/generation/make_controlled.hpp:85:54: note: candidate: ‘template typename boost::numeric::odeint::result_of::make_controlled::type boost::numeric::odeint::make_controlled(typename Stepper::value_type, typename Stepper::value_type, typename Stepper::time_type, const Stepper&)’
typename result_of::make_controlled< Stepper >::type make_controlled(
^~~~~~~~~~~~~~~
/usr/local/include/boost/numeric/odeint/stepper/generation/make_controlled.hpp:85:54: note: template argument deduction/substitution failed:
main.cpp:715:88: note: couldn't deduce template parameter ‘Stepper’
nos = integrate_adaptive( make_controlled( a_err , r_err , error_stepper_type_expI() ), phys(gamma), p, 0.0, tau, dt);
^
make: [: main.o] Error 1

I am not able to figure out what is causing the problem as I have only changed the data type for the input parameters. The problem seems to be coming from the namespace result_of{} function in make_contolled. I would really appreciate any assistance for this error.

Thanks in advance and looking forward to your comments.
Samyukta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant