Solver
solver
Core solver loop for the Zalmoxis interior structure model.
Contains the main() function that implements the three nested iterative procedures: mass-radius convergence (outer), Picard density iteration (middle), and Brent root-finding on central pressure with RK45 ODE integration (inner).
Numerical solver parameters (tolerances, iteration limits, step sizes)
are set internally via _default_solver_params() with mass-adaptive
scaling. Callers do not need to provide them. If a first solve attempt
fails to converge, main() automatically retries with tighter settings.
main(config_params, material_dictionaries, melting_curves_functions, input_dir, layer_mixtures=None, volatile_profile=None, temperature_function=None, temperature_arrays=None, p_center_hint=None, initial_density=None, initial_radii=None)
Run the exoplanet internal structure model with automatic retry.
Calls _solve() with mass-adaptive default parameters. If the first
attempt does not converge, automatically retries once with tighter
tolerances and doubled iteration limits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_params
|
dict
|
Configuration parameters for the model. Numerical solver parameters (tolerances, iteration limits, step sizes) are optional; sensible mass-adaptive defaults are used when absent. |
required |
material_dictionaries
|
dict
|
EOS registry dict keyed by EOS identifier string. |
required |
melting_curves_functions
|
tuple or None
|
(solidus_func, liquidus_func) for EOS needing external melting curves. |
required |
input_dir
|
str
|
Directory containing input files. |
required |
layer_mixtures
|
dict or None
|
Per-layer LayerMixture objects. If None, parsed from
|
None
|
volatile_profile
|
VolatileProfile or None
|
Volatile profile for binodal-aware structure. Passed through to
|
None
|
temperature_function
|
callable or None
|
External temperature function with signature |
None
|
temperature_arrays
|
tuple[ndarray, ndarray] or None
|
Explicit r-indexed T profile |
None
|
initial_density
|
ndarray or None
|
Density profile from a previous solve, used to seed the Picard
iteration. Must be paired with |
None
|
initial_radii
|
ndarray or None
|
Radial grid corresponding to |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Model results including radii, density, gravity, pressure, temperature,
mass enclosed, convergence status, and timing. |
Raises:
| Type | Description |
|---|---|
StructureSolveError
|
A structure solve gave a non-finite profile (a stop in the integration deep inside the planet), with either outer solver. Any trial central pressure counts, including a bracket end of the pressure search. |
Source code in src/zalmoxis/solver.py
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 | |