ivezic / dusty

Radiative transfer code Dusty
BSD 3-Clause "New" or "Revised" License
12 stars 3 forks source link

free(): invalid pointer #5

Closed jdrevon closed 4 years ago

jdrevon commented 4 years ago

Hi it's me again ;)

This time I don't know if I reached the limits of physical computations and DUSTY just can handle non-physical shape.

I'm currently making iterations and model fitting with DUSTY then I iterated over the size envelope. Reaching the size envelope value Y = 1.0E+01 for tau = 0.1 it crashed. While for tau=0 and tau=0.01 it successfully estimated intensity values. And it seems to work with DUSTY V2.

free(): invalid pointer

Program received signal SIGABRT: Process abort signal.

Backtrace for this error:
#0  0x7fb6cd06e32a
#1  0x7fb6cd06d503
#2  0x7fb6cc4bbf1f
#3  0x7fb6cc4bbe97
#4  0x7fb6cc4bd800
#5  0x7fb6cc506896
#6  0x7fb6cc50d909
#7  0x7fb6cc514e1b
#8  0x5632a8e2fbed
#9  0x5632a8e49c89
#10  0x5632a8e531d6
#11  0x5632a8e6af7f
#12  0x5632a8e6bd75
#13  0x5632a8e0a4fe
#14  0x7fb6cc49eb96
#15  0x5632a8e0a539
#16  0xffffffffffffffff
Aborted (core dumped)

Here is the full output :

Found master input file dusty.mas on on command line.
 Grain:  1 Sublimation Temperature:    1300.000
 Inner Boundary Temperature of fiducial Grain(  1)= 1300.00
 aveV:   1.5894917958968438E-005 a3ave/Cnorm:   3.7946320392196936E-006
 COMPOSITE GRAIN
 -------------------------------
 Done with getOptPr
 working on input file: examples/sphere1/sphere1.inp
 Done with reading input
 Done with GetTau
 model =    1, tau=      0.0000
  going to Solve 
    In Solve:   1 iteration over fbol
          15
  Calculating with nY=  16 nP=  39 nCav=  10
  Done with transmitted radiation.
  Done with initial dust temperature.

  Done with finding dust temperature after   3 iterations
    errT: 1.418E-03 errU: 0.000E+00
  Done with finding energy density and diffuse flux.
  Done with radiative transfer. 
  Achieved error in bolometric Flux:     0.000%
  After Flux_Cons nY= 16
  Done with finding intensity 
 Done with Analysis.
 Done with prOut
  ----------- 

 model =    2, tau=      0.0100
  going to Solve 
    In Solve:   1 iteration over fbol
  Calculating with nY=  16 nP=  39 nCav=  10
  Done with transmitted radiation.
  Done with initial dust temperature.

  Done with finding dust temperature after   3 iterations
    errT: 8.260E-04 errU: 3.394E-02
  Done with finding energy density and diffuse flux.
  Done with radiative transfer. 
  Achieved error in bolometric Flux:     0.395%
  After Flux_Cons nY= 16
  Done with finding intensity 
 Done with Analysis.
 Done with prOut
  ----------- 

 model =    3, tau=      0.1000
  going to Solve 
    In Solve:   1 iteration over fbol
  Calculating with nY=  16 nP=  39 nCav=  10
  Done with transmitted radiation.
  Done with initial dust temperature.
...........................  
  Done with finding dust temperature after  27 iterations
    errT: 1.831E-07 errU: 7.477E-02
  Done with finding energy density and diffuse flux.
  Done with radiative transfer. 
  Achieved error in bolometric Flux:     2.003%
  After Flux_Cons nY= 16
free(): invalid pointer

Program received signal SIGABRT: Process abort signal.

Backtrace for this error:
#0  0x7fb6cd06e32a
#1  0x7fb6cd06d503
#2  0x7fb6cc4bbf1f
#3  0x7fb6cc4bbe97
#4  0x7fb6cc4bd800
#5  0x7fb6cc506896
#6  0x7fb6cc50d909
#7  0x7fb6cc514e1b
#8  0x5632a8e2fbed
#9  0x5632a8e49c89
#10  0x5632a8e531d6
#11  0x5632a8e6af7f
#12  0x5632a8e6bd75
#13  0x5632a8e0a4fe
#14  0x7fb6cc49eb96
#15  0x5632a8e0a539
#16  0xffffffffffffffff
Aborted (core dumped)

Any suggestions? Thank you

Julien

ivezic commented 4 years ago

Julien, without input files I cannot reproduce the problem and thus cannot offer much help. I would try again with a finer greed of tau between 0.01 and 0.10, then perhaps try to start with tau=0.10 or whatever value in that new grid bombs first. You could also try keeping minimal output (e.g. don't ask for intensity files) and see if the problem appears in the main calculation, or (internal) after-convergence calculation of intensity. I didn't work on that code (V4), but I suspect that the intensity calculation was not throughly tested as the main thrust of V4 was on multi-grain dust composition and external hearing source.

jdrevon commented 4 years ago

Thank you for your comments and fast answer ! Here are the files used : https://we.tl/t-QW1WU0A0d7 I encounter an other bug (maybe linked to the previous one).

I first tried to do not asked for the image files and this converged perfectly without any error.

Then I decided to asked again the image file and I also replaced the density distribution fromt RDWA to a normal RDW. Here an other bug appears but this time for tau = 0.5.

 model =    4, tau=      0.5000
  going to Solve 
    In Solve:   1 iteration over fbol
  Calculating with nY=  15 nP=  36 nCav=  10
  Done with transmitted radiation.
  Done with initial dust temperature.
.........................  
  Done with finding dust temperature after  25 iterations
    errT: 8.866E-05 errU: 8.543E-02
  Done with finding energy density and diffuse flux.
  Done with radiative transfer. 
  Achieved error in bolometric Flux:     8.871%
  After Flux_Cons nY= 15
             1 . iteration over eta
  Doing Dynamics
corrupted size vs. prev_size

Program received signal SIGABRT: Process abort signal.

Backtrace for this error:
#0  0x7f9b8ddf732a
#1  0x7f9b8ddf6503
#2  0x7f9b8d244f1f
#3  0x7f9b8d244e97
#4  0x7f9b8d246800
#5  0x7f9b8d28f896
#6  0x7f9b8d296909
#7  0x7f9b8d29e15e
#8  0x557950f62b96
#9  0x557950f7cc89
#10  0x557950f861d6
#11  0x557950f9df7f
#12  0x557950f9ed75
#13  0x557950f3d4fe
#14  0x7f9b8d227b96
#15  0x557950f3d539
#16  0xffffffffffffffff
Abandon (core dumped)

And if I put one more time the density distribution RDWA and not RDW this time, the first error occurs again at 0.1 with the first error message : free():invalid pointer not the new one above.

ivezic commented 4 years ago

Julien, I was able to reproduce your problem. It seems that there at least two problems: one with the intensity calculation, and another one with the radiatively-driven wind calculation. Unfortunately, it seems that it would be a major undertaking for me to get to the bottom of these SIGSEGV and core dump problems (I didn't work on the development of the f90 V4 version). I think that for your SED studies, it will be just fine to use analytic RDW calculation and this could be a workaround. If the problem with the intensity calculation persists, unfortunately, I don't see an easy workaround.

jdrevon commented 4 years ago

Hi! Thank you for your answers, well for now, I only saw this problem for simulation with small Y (size of the enveloppe) in both case RDWA and RDW but with different errors. I hope that I will not have to deal with those kind of situation. The RDW or RDWA inputs induced directly or not errors in this kind of situation, then I suggest maybe to stay with the RDW to get better estimation in outputs.

Thank you again

Julien