POSYDON-code / POSYDON

POSYDON is a next-generation single and binary-star population synthesis code incorporating full stellar structure and evolution modeling with the use of MESA.
BSD 3-Clause "New" or "Revised" License
30 stars 19 forks source link

Error with track interpolation #235

Closed dimsour94 closed 8 months ago

dimsour94 commented 10 months ago

Had multiple runs with POSYDON within 1 month (using the latest development branch, the latsest ini file and track interpolation on) and in each run I got the same error, which is the following:

Error during breakdown of BinaryStar(initial_RLOF, END, p=0.01, S1=(WD,M=1.21), S2=(stripped_He_non_burning,M=0.16)):
setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (28,) + inhomogeneous part.
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (28,) + inhomogeneous part.

The error always refers to binary_state = initial_RLOF Similar errors in the past were related to the fact that some conditions in the ini file were not specified well (not importing a step correctly or if a step is missing in ini file, wrong options etc). @celiotine @ezapartas @kasdaglie Thus, starting from default ini.file that works fine, and adding in each run a new change in my ini file, I figured out that this error pops up only when the track_interpolation = True and only for the step_CO_HeMS_RLO. I'll try to solve the issue by myself but ideas are welcome.

ezapartas commented 10 months ago

@dimsour94 realized that it may not be only happening for step_CO_HeMS_RLO, but in general in step_mesa with initial_RLO with track_interpolation = True

Error during breakdown of BinaryStar(initial_RLOF, END, p=0.55, S1=(NS,M=1.20),\
 S2=(H-rich_Core_H_burning,M=4.35)):
setting an array element with a sequence. The requested array has an inhomogene\
ous shape after 1 dimensions. The detected shape was (28,) + inhomogeneous part\
astroJeff commented 10 months ago

Error has been identified in try/except statement: binary_population.py, line 561.

@dimsour94, @ezapartas, @kkovlakas can you work on this? @celiotine @kasdaglie

dimsour94 commented 9 months ago

Updates on 1/2/2024: The issue remains unsolved. Eirini did some digging and printed out some additional information:
image

Me and Manos made sure that NN did not select a failed run by checking a few NN systems in the raw MESA data that are printed with verbose in the pop_syn.out file and they looked fine.

Some additional info with verbose on which shows the path of one binary where the error appears error

Not sure whether we can print the binary object in POSYDON just before having the error. If anyone knows if we can catch the moment of the fail in a try try/ except case (where we can print the whole binary in the except)?

astroJeff commented 9 months ago

Update (Feb 1): We discussed this during dev meeting. An offline meeting to solve this - @kkovlakas to join.

maxbriel commented 9 months ago

I tried to setup a binary that recreates this issue given the model parameters of the closest MESA binary track in the image from @dimsour94.

At 1Zun, this binary evolves "fine", but gives the error you've found when trying to show put the binary into a df. (The exact error has a different shape though.) The evolution is not a nice evolution with a model being added even though the system is intial_RLOF and should probably be fixed.

The exact error comes from star1 with its lg_mdot_history only being 3 long compared to the rest of the history items being 15 long for this star. This causes a failure on line 251 in singlestar.py in the SingleStar.to_df() function, because numpy cannot work with inhomogenous arrays.

I don't know if this is useful for pinpointing this issue.

# setup sim_pop (SimulationProperties)

STAR1 = SingleStar(**{'mass': 1.2,
                      'state': 'NS',
                      'spin': 0})
STAR2 = SingleStar(**{'mass': 4.35,
                      'state': 'H-rich_Core_H_burning',})

BINARY = BinaryStar(STAR1, STAR2,  **{'time' : 0., 'state' : 'RLO2', 'event' : 'oRLO2', 'orbital_period' : 0.85, 'eccentricity' : 0.},
                    properties = sim_pop)

BINARY.evolve()

Error:

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (53,) + inhomogeneous part.
maxbriel commented 8 months ago

This issue should be fixed with PR #251