Problem using EmbeddedRungeKutta

41 views
Skip to first unread message

Praveen C

unread,
Aug 26, 2021, 11:56:13 AM8/26/21
to Deal. II Googlegroup
Dear all

I am using TimeStepper with classical RK4 which works fine. I am facing some issue with using embedded RK schemes. My usage is like this.

typedef LinearAlgebra::distributed::Vector<double> PVector; 
const TimeStepping::runge_kutta_method method = TimeStepping::DOPRI;

If I do

TimeStepping::EmbeddedExplicitRungeKutta<PVector> time_integrator(method);

then it runs in release mode.

If I do this

 TimeStepping::EmbeddedExplicitRungeKutta<PVector> time_integrator;
 time_integrator.initialize(method);
 time_integrator.set_time_adaptation_parameters(1.2, 0.8, 1e-14, 1e100, 1e-8, 1e-12); // default values

then I get segmentation fault in release mode but runs in debug mode !!!

I dont get any backtrace so dont know how to find the problem. 

Thanks
praveen

Praveen C

unread,
Aug 26, 2021, 12:14:48 PM8/26/21
to Deal. II Googlegroup
I modified step-52 in following way

Change this line

    TimeStepping::EmbeddedExplicitRungeKutta<Vector<double>>
      embedded_explicit_runge_kutta(method,
                                    coarsen_param,
                                    refine_param,
                                    min_delta,
                                    max_delta,
                                    refine_tol,
                                    coarsen_tol);

into the following three steps

    TimeStepping::EmbeddedExplicitRungeKutta<Vector<double>>
      embedded_explicit_runge_kutta;
    embedded_explicit_runge_kutta.initialize(method);
    embedded_explicit_runge_kutta.set_time_adaptation_parameters(
                                    coarsen_param,
                                    refine_param,
                                    min_delta,
                                    max_delta,
                                    refine_tol,
                                    coarsen_tol);

I get this error

$ ./step-52
Explicit methods:
   Forward Euler:            error=1.00883
   Third order Runge-Kutta:  error=0.000227982
   Fourth order Runge-Kutta: error=1.90541e-06

Implicit methods:
   Backward Euler:           error=1.03428
   Implicit Midpoint:        error=0.00862702
   Crank-Nicolson:           error=0.00862675
   SDIRK:                    error=0.0042349

Embedded explicit methods:

--------------------------------------------------------
An error occurred in line <356> of file </Users/praveen/Applications/deal.II/9.3.1/include/deal.II/lac/vector.templates.h> in function
    void dealii::Vector<double>::sadd(const Number, const Number, const Vector<Number> &) [number = double]
The violated condition was: 
    size() == v.size()
Additional information: 
    Dimension 1089 not equal to 0.

Stacktrace:
-----------
#0  2   libdeal_II.g.9.3.1.dylib            0x00000001069035dc _ZN6dealii6VectorIdE4saddEddRKS1_ + 532: 2   libdeal_II.g.9.3.1.dylib            0x00000001069035dc _ZN6dealii6VectorIdE4saddEddRKS1_ 
#1  3   libdeal_II.g.9.3.1.dylib            0x0000000106ebb45c _ZN6dealii12TimeStepping26EmbeddedExplicitRungeKuttaINS_6VectorIdEEE14compute_stagesERKNSt3__18functionIFS3_dRKS3_EEEddS8_RNS5_6vectorIS3_NS5_9allocatorIS3_EEEE + 244: 3   libdeal_II.g.9.3.1.dylib            0x0000000106ebb45c _ZN6dealii12TimeStepping26EmbeddedExplicitRungeKuttaINS_6VectorIdEEE14compute_stagesERKNSt3__18functionIFS3_dRKS3_EEEddS8_RNS5_6vectorIS3_NS5_9allocatorIS3_EEEE 
#2  4   libdeal_II.g.9.3.1.dylib            0x0000000106ebb144 _ZN6dealii12TimeStepping26EmbeddedExplicitRungeKuttaINS_6VectorIdEEE20evolve_one_time_stepERKNSt3__18functionIFS3_dRKS3_EEEddRS3_ + 216: 4   libdeal_II.g.9.3.1.dylib            0x0000000106ebb144 _ZN6dealii12TimeStepping26EmbeddedExplicitRungeKuttaINS_6VectorIdEEE20evolve_one_time_stepERKNSt3__18functionIFS3_dRKS3_EEEddRS3_ 
#3  5   step-52                             0x0000000102fdf28c _ZN6Step529Diffusion24embedded_explicit_methodEN6dealii12TimeStepping18runge_kutta_methodEjdd + 324: 5   step-52                             0x0000000102fdf28c _ZN6Step529Diffusion24embedded_explicit_methodEN6dealii12TimeStepping18runge_kutta_methodEjdd 
#4  6   step-52                             0x0000000102fdf6b4 _ZN6Step529Diffusion3runEv + 728: 6   step-52                             0x0000000102fdf6b4 _ZN6Step529Diffusion3runEv 
#5  7   step-52                             0x0000000102fdfee0 main + 72: 7   step-52                             0x0000000102fdfee0 main 
#6  8   libdyld.dylib                       0x00000001831a5430 start + 4: 8   libdyld.dylib                       0x00000001831a5430 start 
--------------------------------------------------------

zsh: abort      ./step-52

Thanks
praveen

Wolfgang Bangerth

unread,
Aug 26, 2021, 12:27:55 PM8/26/21
to dea...@googlegroups.com
On 8/26/21 10:14 AM, Praveen C wrote:
>
> Embedded explicit methods:
>
> --------------------------------------------------------
> An error occurred in line <356> of file
> </Users/praveen/Applications/deal.II/9.3.1/include/deal.II/lac/vector.templates.h>
> in function
>     void dealii::Vector<double>::sadd(const Number, const Number, const
> Vector<Number> &) [number = double]
> The violated condition was:
>     size() == v.size()
> Additional information:
>     Dimension 1089 not equal to 0.

So that looks like there is a vector somewhere that hasn't been given
the right size. You'll have to find out in the debugger why not.

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

Bruno Turcksin

unread,
Aug 27, 2021, 12:12:36 PM8/27/21
to deal.II User Group
Praveen,

Good catch. When you split the initialization part there is flag that is not initialized. I guess in debug, the flag is correctly set to false (0) while in release mode the flag is undetermined and you may get true. I'll fix this.

Best,

Bruno

Bruno Turcksin

unread,
Aug 30, 2021, 3:10:39 PM8/30/21
to deal.II User Group
Praveen,


Best,

Bruno
Reply all
Reply to author
Forward
0 new messages