cpinte / mcfost

MCFOST radiative transfer code
Other
24 stars 24 forks source link

Atomictransfer branch seg fault trying to compute emission maps #28

Closed danieljprice closed 3 years ago

danieljprice commented 3 years ago

currently the Atomictransfer branch fails with seg fault during emission_line_map, I am trying to track the origin of this:

*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*
 * Solving for the radiative transfer equation for atomic lines. *
 *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*
 Reading            1  species
 Reading atomic model of atom H 
 Abundance of atom H : A =   1.00000000000000     
  -> mass fraction (%) =    73.82587    
 Nlevel=           4  Nline=           1  Ncont=           3
 Continuum   1 ->   4 at     91.17631 nm
 -> lower edge cut at     50.00000 nm !
 Continuum   2 ->   4 at    364.70520 nm
 -> lower edge cut at     91.17600 nm !
 Continuum   3 ->   4 at    820.58702 nm
 -> lower edge cut at    205.14700 nm !
 order#     ID   periodic-table#    ACTIVE    #lines   #continua
           1 H            1 F           1           3
 resol(km/s)   50.00000      min(vD) (km/s) =    1.64041437215132     
  Generating sub wavelength grid and lines boundary for all atoms...
 ..done
  Maximum number of ionisation stages among all elements:            6
ne.fits.gz
  Reading old ne.fits.gz file
  -- min(ne)=      2.8536923E-057 m^-3; max(ne)=      2.6225699E+023 m^-3
 Setting LTE populations for hydrogen
nHmin.fits.gz
 Total continuum frequencies, before merging :          304
  Found            0  overlapping regions for           1  lines
  -->            1  groups of lines
 bounds:
   -> max lam:   713.724663671264       max_cont:   820.587018411838     
        1318  unique wavelengths
        1032  line wavelengths
         304  continuum wavelengths
 Mean number of lines per group:   1.000000    
 Mean number of wavelengths per group:   1032.000    
 Mean number of wavelengths per line:   1032.000    
 Resolution of line's groups (km/s):   50.00000    
 Mean number of wavelengths per continuum:   95.33334    
 Wavelength grid:   49.9999999999999       nm   820.587018411838      
 nm             
 Number of max freq points for all lines at this resolution :         334
 Number of max freq points for all cont at this resolution :        1175
 Number of max freq points for all trans at this resolution :        1175
 Maximum shift in index:         350   349.874276443424     
  ->contopac:   19329.89      MB
  ->contopac (line grid):   83805.24      MB
Total memory allocated in alloc_spectrum:  1.03135523E+005 MB
  Computing background opacities...
  Size of all local profiles for interp:   4673.510      MB
Total memory allocated in alloc_atom_quantities:  4.67351318E+003 MB
  ..done
H.fits.gz
 WARNING: Size of fits file to store flux map for each line might be large
  allocating   0.8043671      MB for total flux arrays..
  allocating    2.793274      GB of mem for flux map for selected lines!
   ->    2861.117      MB in total
Total memory allocated in alloc_flux_image:  1.43228320E+003 MB
 Computing emission flux map...
Total memory allocated for image calculation:  1.06680992E+002 GB
 Vector to observer =  0.0000000E+00 -1.7453293E-22   1.000000    
 i=  0.0000000E+00 az=  0.0000000E+00
 x-image =              1.000000      0.0000000E+00  0.0000000E+00
 y-image =             0.0000000E+00   1.000000      1.7453293E-22
forrtl: severe (174): SIGSEGV, segmentation fault occurred
forrtl: severe (174): SIGSEGV, segmentation fault occurred
forrtl: severe (174): SIGSEGV, segmentation fault occurred
forrtl: severe (174): SIGSEGV, segmentation fault occurred
forrtl: severe (174): SIGSEGV, segmentation fault occurred
forrtl: severe (174): SIGSEGV, segmentation fault occurred
^C
danieljprice commented 3 years ago

got a line number at least:

*** longjmp causes uninitialized stack frame ***: mcfost terminated
======= Backtrace: =========
*** longjmp causes uninitialized stack frame ***: mcfost terminated
/lib64/libc.so.6(+0x1185ad)[0x2b8d63b195ad]
/lib64/libc.so.6(__fortify_fail+0x37)[0xmcfost2b8d63b19697]
[0x19872a2/lib64/libc.so.6(+0x]

followed by:

Image              PC                Routine            Line        Source             
mcfost             0000000001896ABD  Unknown               Unknown  Unknown
libpthread-2.17.s  00002B8D637F4630  Unknown               Unknown  Unknown
mcfost             00000000011EDBF7  atom_transfer_mp_         671  atom_transfer.f90
mcfost             00000000011DDE9D  atom_transfer_mp_         923  atom_transfer.f90
libiomp5.so        00002B8D634F17A3  __kmp_invoke_micr     Unknown  Unknown
libiomp5.so        00002B8D634BF53A  Unknown               Unknown  Unknown
libiomp5.so        00002B8D634BECCA  Unknown               Unknown  Unknown
libiomp5.so        00002B8D634F1C00  Unknown               Unknown  Unknown
libpthread-2.17.s  00002B8D637ECEA5  Unknown               Unknown  Unknown
libc-2.17.so       00002B8D63AFF9FD  clone                 Unknown  Unknown
Aborted

which corresponds to the line of code:

                I0_star = I0_star + Istar_loc(:,id) / npix2
danieljprice commented 3 years ago

so probably the issue is that there are no stars!

danieljprice commented 3 years ago

confirmed, if I comment out this line then everything runs ok. Not sure the best way to skip it... presumably just if (n_etoiles > 0)?

btessore commented 3 years ago

yes yes I'll modify it accordingly. That's because in general I always have a star even if Teff = 0 (basically I'm using the star as a spherical boundary, optically thick, condition). Meanwhile you can also set T = 0 in the parameter file and a very small radius.