phoebe-project / phoebe2

PHOEBE - Eclipsing Binary Star Modeling Software
http://phoebe-project.org
GNU General Public License v3.0
79 stars 30 forks source link

Errors in model 'semi-detached' #391

Closed fallingelf closed 3 years ago

fallingelf commented 3 years ago

when i run the scripts below

import phoebe b = phoebe.default_binary() b.add_dataset('lc', times=phoebe.linspace(0,2,101)) b.run_compute() b.plot(show=True)

it gives great results. If I add semi-detached configure as below

import phoebe b = phoebe.default_binary() b.add_constraint('semidetached', 'primary') b.add_dataset('lc', times=phoebe.linspace(0,2,101)) b.run_compute() b.plot(show=True)

errors below follows,

Traceback (most recent call last): File "/home/mine/miniconda3/lib/python3.7/site-packages/phoebe/backend/universe.py", line 1815, in _populate_lc photon_weighted=intens_weighting=='photon') File "/home/mine/miniconda3/lib/python3.7/site-packages/phoebe/atmospheres/passbands.py", line 2864, in ldint raise ValueError('Atmosphere parameters out of bounds: Teff=%s, logg=%s, abun=%s' % (Teff[nanmask], logg[nanmask], abun[nanmask])) ValueError: Atmosphere parameters out of bounds: Teff=[348.51161081], logg=[-11.66455964], abun=[0.]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "/home/mine/miniconda3/lib/python3.7/site-packages/phoebe/parameters/parameters.py", line 401, in _send_if_client return fctn(self, *args, kwargs) File "/home/mine/miniconda3/lib/python3.7/site-packages/phoebe/frontend/bundle.py", line 10146, in run_compute system, pblums_abs, pblums_scale, pblums_rel, pbfluxes = self.compute_pblums(compute=compute, ret_structured_dicts=True, skip_checks=True, {k:v for k,v in kwargs.items() if k in computeparams.qualifiers}) File "/home/mine/miniconda3/lib/python3.7/site-packages/phoebe/frontend/bundle.py", line 9136, in compute_pblums system = kwargs.get('system', self._compute_intrinsic_system_at_t0(compute=compute, datasets=pblum_datasets, kwargs)) File "/home/mine/miniconda3/lib/python3.7/site-packages/phoebe/frontend/bundle.py", line 8825, in _compute_intrinsic_system_at_t0 system = backends.PhoebeBackend()._compute_intrinsic_system_at_t0(self, system_compute, datasets=datasets, reset=False, lc_only=False, kwargs) File "/home/mine/miniconda3/lib/python3.7/site-packages/phoebe/backend/backends.py", line 892, in _compute_intrinsic_system_at_t0 system.populate_observables(t0, ['lc' for dataset in datasets], datasets, ignore_effects=True) File "/home/mine/miniconda3/lib/python3.7/site-packages/phoebe/backend/universe.py", line 319, in populate_observables body.populate_observable(time, kind, dataset, ignore_effects=ignore_effects) File "/home/mine/miniconda3/lib/python3.7/site-packages/phoebe/backend/universe.py", line 1069, in populate_observable new_mesh_cols = getattr(self, 'populate{}'.format(kind.lower()))(dataset, ignore_effects=ignore_effects, **kwargs) File "/home/mine/miniconda3/lib/python3.7/site-packages/phoebe/backend/universe.py", line 1824, in _populate_lc raise ValueError("Could not compute ldint with ldatm='{}'. Try changing atm to a table that covers a sufficient range of values. If necessary, set atm to 'blackbody' and/or ld_mode to 'manual' (in which case coefficients will need to be explicitly provided via ld_coeffs). Enable 'warning' logger to see out-of-bound arrays.".format(ldatm)) ValueError: Could not compute ldint with ldatm='ck2004'. Try changing atm to a table that covers a sufficient range of values. If necessary, set atm to 'blackbody' and/or ld_mode to 'manual' (in which case coefficients will need to be explicitly provided via ld_coeffs). Enable 'warning' logger to see out-of-bound arrays.

fallingelf commented 3 years ago

details about my system and phoebe: ubuntu 16.04 LTS PHOEBE 2.3.6

aprsa commented 3 years ago

It's failing because you are using model atmospheres, and the point region is too cool/rare for that. Try switching to blackbody:

b['atm@primary'] = 'blackbody'

aprsa commented 3 years ago

We're working on the possibility to blend model atmospheres and blackbody intensities for such scenarios. We're close but not quite there yet.

fallingelf commented 3 years ago

We're working on the possibility to blend model atmospheres and blackbody intensities for such scenarios. We're close but not quite there yet.

It's failing because you are using model atmospheres, and the point region is too cool/rare for that. Try switching to blackbody:

b['atm@primary'] = 'blackbody'

Thank your reply very much. Actually I want to model a semi-detached binary consisting of a white dwarf and a Roche-lobe filling red dwarf, so it is better to use model atmospheres for the red dwarf. Can I fine-tune other parameters to bypass the errors?

kecnry commented 3 years ago

As the error messages state, the limb-darkening interpolation will also fail at this same region, so you will need to set ld_mode to manual (at least for the primary star) and provide appropriate values for ld_func and ld_coeffs.

The following works:

import phoebe
b = phoebe.default_binary()
b.add_constraint('semidetached', 'primary')
b.add_dataset('lc', times=phoebe.linspace(0,2,101))

b.set_value('atm', component='primary', value='blackbody')
b.set_value('ld_mode', component='primary', value='manual')
print(b.filter(qualifier=['ld_func', 'ld_coeffs']))  
# change ld_func and ld_coeffs to something reasonable for your system, 
# but the default does compute without errors

b.run_compute()
b.plot(show=True)

I just added a note at the bottom of this tutorial and the semidetached constraint API with similar "instructions". If you have other suggestions to clarify the error messages or docs, please let us know!

kecnry commented 3 years ago

Actually I want to model a semi-detached binary consisting of a white dwarf and a Roche-lobe filling red dwarf, so it is better to use model atmospheres for the red dwarf. Can I fine-tune other parameters to bypass the errors?

Unfortunately there is nothing else you can currently do if ANY of the surface elements fall outside the grid. Some situations of stellar parameters may not fall outside the grid, so it may be worth setting your other parameters (mainly teff, q, sma) and see if that brings you within the grid.

You can always inspect the temperatures or surface gravities of the mesh itself with a mesh-dataset (you'll either need to disable or not create an LC dataset to avoid the error though). For example:

import phoebe

b = phoebe.default_binary()
b.add_constraint('semidetached', 'primary')
b.add_dataset('mesh', compute_times=[0], columns=['teffs', 'loggs'])
b.run_compute()
print("teffs {}-{}".format(min(b.get_value('teffs', component='primary')), max(b.get_value('teffs', component='primary'))))
print("loggs {}-{}".format(min(b.get_value('loggs', component='primary')), max(b.get_value('loggs', component='primary'))))
b.plot(x='ws', fc='teffs', show=True)

sd_mesh

fallingelf commented 3 years ago

Thank both of you very very much @aprsa @kecnry .