aragog.solver
The aragog.solver package contains the time-integration driver, the per-RHS state container, the boundary-condition handler, and the output dataclass.
The public surface re-exported from aragog.solver is:
| Name | Role |
|---|---|
EntropySolver |
The ODE driver. Owns the integrator dispatch (Radau / BDF / CVODE), the nondimensionalisation layer, the retry-ladder hooks, and the SolverOutput post-processing. |
EntropyState |
Per-RHS state container. Computes phase, density, \(T\), \(c_p\), \(\alpha\), \(k\), the four flux contributions, and the internal heating at each call. |
BoundaryConditions |
Surface (grey-body, UTBL, prescribed flux/T) and inner (core cooling, prescribed flux/T) BC dispatch. |
SolverOutput |
Dataclass returned by EntropySolver.get_state(). Carries the staggered-node profiles, basic-node fluxes, scalar diagnostics, the per-call energy integrals (step_dE_F_int_J, step_dE_F_cmb_J, step_dE_Q_radio_J, step_dE_Q_tidal_J, plus frozen-mass step_dE_Q_radio_cons_J/step_dE_Q_tidal_cons_J and the entropy-ODE solver residual step_solver_residual_J), the conservation-grade integrated mantle enthalpy E_state_cons (frozen-mass), and the integration status flag. See Energy diagnostics for the conservation-residual interpretation. |
SECS_PER_YEAR |
Module-level constant scipy.constants.Julian_year (\(31{,}557{,}600\) s). The ODE is integrated in years; converting flux divergence (J/kg/K/s) to per-year requires this factor. |
solver
Solver package for the Aragog interior dynamics model.
Provides the entropy-formulation solver (EntropySolver) and supporting classes (BoundaryConditions, EntropyState).
BoundaryConditions(_parameters, _mesh)
dataclass
Boundary conditions
Args: parameters: Parameters mesh: Mesh
apply_flux_boundary_conditions(state)
Applies the boundary conditions to the state.
Args: state: The state to apply the boundary conditions to
Source code in src/aragog/solver/boundary.py
98 99 100 101 102 103 104 105 106 107 | |
apply_flux_inner_boundary_condition(state)
Applies the flux boundary condition to the state at the inner boundary.
Args: state: The state to apply the boundary conditions to
Equivalent to CORE_BC in C code. 1: Simple core cooling 2: Prescribed heat flux 3: Prescribed temperature
Source code in src/aragog/solver/boundary.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
apply_flux_outer_boundary_condition(state)
Applies the flux boundary condition to the state at the outer boundary.
Args: state: The state to apply the boundary conditions to
Equivalent to SURFACE_BC in C code. 1: Grey-body atmosphere 2: Zahnle steam atmosphere (not implemented) 4: Prescribed surface heat flux (atmosphere coupling) 5: Prescribed surface temperature
Source code in src/aragog/solver/boundary.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
apply_temperature_boundary_conditions(temperature, temperature_basic, dTdr)
Conforms the temperature and dTdr at the basic nodes to temperature boundary conditions.
Args: temperature: Temperature at the staggered nodes temperature_basic: Temperature at the basic nodes dTdr: Temperature gradient at the basic nodes
Source code in src/aragog/solver/boundary.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
apply_temperature_boundary_conditions_melt(melt_fraction, melt_fraction_basic, dphidr)
Conforms the melt fraction gradient dphidr at the basic nodes to temperature boundary conditions.
Args: melt_fraction: Melt fraction at the staggered nodes melt_fraction_basic: Melt fraction at the basic nodes dphidr: Melt fraction gradient at the basic nodes
Source code in src/aragog/solver/boundary.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
core_cooling(state)
Applies a core cooling heat flux according to Eq. (37) of Bower et al., 2018.
The core is modelled as a well-mixed reservoir with an effective temperature T_core = tfac_core_avg * T_cmb. The factor tfac_core_avg accounts for the adiabatic temperature gradient within the core (mass-weighted average core temperature / CMB temperature). Default 1.147 is for Earth-like parameters (Bower+2018, Table 2).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
State
|
The state to apply the boundary condition to. |
required |
Source code in src/aragog/solver/boundary.py
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | |
grey_body(state)
Applies a grey body flux at the surface.
When param_utbl is enabled, the surface radiating temperature is reduced to account for the ultra-thin thermal boundary layer at the magma ocean surface. The temperature drop across this unresolved boundary layer is parameterized as dT = b * T_surf^3 (Bower et al. 2018, Eq. 18), giving the cubic relation T_interior = T_surf + b * T_surf^3. The analytical solution (Cardano's formula) gives T_surf < T_interior.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
State
|
The state to apply the boundary conditions to. |
required |
Source code in src/aragog/solver/boundary.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
EntropySolver(parameters, entropy_eos=None)
Entropy-based interior dynamics solver.
Drop-in replacement for Solver (T-based) when using PALEOS P-S tables. Same interface: initialize() -> set_initial_entropy() -> solve(). PROTEUS can swap Solver for EntropySolver without changing the wrapper.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameters
|
Parameters
|
Parsed configuration (same as T-based Solver). |
required |
entropy_eos
|
EntropyEOS
|
Loaded P-S EOS tables. |
None
|
Source code in src/aragog/solver/entropy_solver.py
932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 | |
entropy_staggered
property
Entropy at staggered nodes from the solution.
For bower2018 and energy_balance modes the solver state vector is N+1 in length; we strip the trailing extra row and return only the entropy block. For gradient mode, we reconstruct S from the gradient state.
solution
property
Last solve_ivp result, or None if solve() has not been
called yet. Returning None (instead of raising
AttributeError) matters for the PROTEUS JAX dispatch path,
where AragogJAXRunner handles the actual integration and
the scipy EntropySolver lives only to hold Parameters / BC
state โ its solve() is never invoked, so _solution is
never set. Callers already handle sol is None.
staggered_mass_coordinates
property
Lagrangian mass coordinate at each staggered node.
Labels each mass parcel independently of physical radius, which shifts when the structure re-solves. Used to carry the entropy field across a re-solve by parcel rather than by node index.
temperature_staggered
property
Temperature at staggered nodes (derived from S via EOS).
dSdt(time, state_vec)
Time derivative of the full state vector.
For the bower2018 core BC the state vector is
[S_0, ..., S_{N-1}, T_core] of length N+1, and this returns
[dS/dt, dT_core/dt] of the same length.
For the quasi_steady BC the state vector is just
[S_0, ..., S_{N-1}] of length N.
The integrator passes vectorized=False; this RHS handles
the 1D path only.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time
|
float
|
Time [yr]. |
required |
state_vec
|
array
|
Solver state vector [J/kg/K for entropy, K for T_core]. Shape (N,) or (N+1,) only. |
required |
Returns:
| Type | Description |
|---|---|
array
|
d(state_vec)/dt with the same shape as the input. |
Source code in src/aragog/solver/entropy_solver.py
1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 | |
from_file(filename, eos_dir, root='')
classmethod
Create EntropySolver from a config file and EOS directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Path to TOML configuration file. |
required |
eos_dir
|
str
|
Path to directory with SPIDER-format P-S tables. |
required |
root
|
str
|
Root directory for the config file. |
''
|
Source code in src/aragog/solver/entropy_solver.py
1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 | |
get_current_dSdr_cmb()
Return the most recent CMB entropy gradient from the solver state.
Reads self._solution.y[n_stag, -1] (the final dSdr_cmb from the
last accepted solve). Returns None when no solution exists yet,
or when the state vector lacks the dSdr_cmb slot (core_bc other
than energy_balance).
Used by PROTEUS's retry ladder to snapshot the pre-solve dSdr_cmb before a sequence of retry attempts and restore it on each retry, breaking the positive-feedback loop where a rejected attempt's final dSdr_cmb would otherwise become the next retry's hot-start IC and drive the boundary state further from the pre-solve value each time.
Source code in src/aragog/solver/entropy_solver.py
1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 | |
get_state()
Extract the solver state as a clean output dataclass.
This is the primary API for callers to retrieve results. It avoids the need to access solver internals (evaluator, mesh, state, phase objects).
Returns:
| Type | Description |
|---|---|
SolverOutput
|
Dataclass containing all quantities needed by PROTEUS. |
Source code in src/aragog/solver/entropy_solver.py
3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 | |
initialize()
Initialize mesh, boundary conditions, and entropy state.
Unlike the T-based Solver, we only need the mesh and BCs from the Evaluator. The T-based phase evaluators (which require solidus/liquidus files) are replaced by EntropyPhaseEvaluator.
Source code in src/aragog/solver/entropy_solver.py
1055 1056 1057 1058 1059 1060 1061 1062 1063 | |
reset()
Reset for a new integration (PROTEUS coupling loop).
Re-reads the EOS mesh file if eos_method=2, then rebuilds the mesh, BCs, and entropy state. Matches Solver.reset().
Source code in src/aragog/solver/entropy_solver.py
1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 | |
set_initial_core_temperature(T_core_init)
Set the initial core temperature (bower2018 core_bc only).
Must be called BEFORE set_initial_entropy. If not called,
the initial T_core defaults to the bottom-cell mantle
temperature derived from S_init via the EOS.
Source code in src/aragog/solver/entropy_solver.py
1755 1756 1757 1758 1759 1760 1761 1762 | |
set_initial_dSdr_cmb(dSdr_cmb_init)
Set the initial CMB entropy gradient (energy_balance mode only).
Must be called BEFORE set_initial_entropy. If not called,
the initial dSdr_cmb is taken from the previous solution
(if any), else from a one-sided FD of the staggered S_init at
the bottom (which is zero for a uniform isentrope).
Pass None to clear a previously-set override, restoring
the hot-start behaviour on the next call to
set_initial_entropy. Used by PROTEUS's retry ladder to
restore the pre-solve dSdr_cmb after a rejection, then release
the override so the subsequent coupling step can hot-start
from its own _solution normally.
Source code in src/aragog/solver/entropy_solver.py
1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 | |
set_initial_entropy(S_init)
Set the initial entropy profile and (if used) initial T_core.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
S_init
|
array or float
|
Entropy at staggered nodes [J/kg/K]. If scalar, sets uniform (isentropic) profile. |
required |
Notes
State vector length depends on the active core BC mode:
quasi_steady uses length N; energy_balance and
bower2018 use length N+1 (entropy block plus one extra
state variable: dSdr_cmb or T_core respectively);
gradient uses length N+2. For the bower2018 mode the
initial T_core is taken from the bottom-cell mantle
temperature derived from S_init via the EOS unless
set_initial_core_temperature has been called first.
Source code in src/aragog/solver/entropy_solver.py
1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 | |
set_jax_cvode_factory(factory)
Register a factory that produces JAX-derived CVODE callbacks.
The factory is called inside solve() when use_jax_jacobian
is enabled in the config. It is given the current nondim scaling
spec (NonDimScales) and core-BC mode and must return the
(rhs_fn, jac_fn) pair accepted by scikits.odes CVODE.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
factory
|
callable
|
|
required |
Source code in src/aragog/solver/entropy_solver.py
977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 | |
solve()
Run the BDF time integration.
Source code in src/aragog/solver/entropy_solver.py
2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 | |
write_netcdf(path, *, time=None, description=None)
Convenience wrapper: self.get_state().to_netcdf(path).
Designed for the standalone solver script: build the solver,
call solve(), then dump the final state as a NetCDF4 file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Destination NetCDF4 file (overwrites if it exists). |
required |
time
|
float
|
Simulation time at which this snapshot was taken [yr].
Defaults to |
None
|
description
|
str
|
Free-form description string written as the dataset's
|
None
|
See Also
SolverOutput.to_netcdf : underlying writer with the full schema.
Source code in src/aragog/solver/entropy_solver.py
3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 | |
EntropyState(evaluator, phase_staggered, phase_basic, conduction=True, convection=True, gravitational_separation=False, mixing=False, radionuclides=False, tidal=False, tidal_array=None, eddy_diffusivity_thermal=1.0, eddy_diffusivity_chemical=1.0, kappah_floor=0.0, bottom_up_grav_sep=True, phase_smoothing='tanh')
Stores and updates the thermodynamic state using entropy.
The key difference from State: the prognostic variable is S(r,t), not T(r,t). All properties are looked up from (P, S) via the EntropyPhaseEvaluator. Convective transport is driven by dS/dr (entropy gradient), not by the superadiabatic T gradient.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
evaluator
|
Evaluator
|
Contains mesh and boundary conditions. |
required |
phase
|
EntropyPhaseEvaluator
|
Entropy-based phase evaluator with (P,S) lookups. |
required |
settings
|
dict
|
Energy settings (conduction, convection, mixing, etc.) |
required |
Source code in src/aragog/solver/entropy_state.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | |
bottom_temperature
property
Temperature at the innermost basic node [K].
heating
property
Total internal heating [W/kg] at staggered nodes.
heating_radio
property
Radiogenic heating contribution [W/kg] at staggered nodes.
heating_tidal
property
Tidal heating contribution [W/kg] at staggered nodes.
temperature_basic
property
Temperature at basic nodes (derived from S via EOS).
top_temperature
property
Temperature at the outermost basic node [K].
capacitance_staggered()
Capacitance for entropy equation: rho * T [kg K / m^3].
The entropy equation is: rho * T * dS/dt = -div(F) + sources. Compare T-formulation: rho * Cp * dT/dt = -div(F) + sources.
Source code in src/aragog/solver/entropy_state.py
1034 1035 1036 1037 1038 1039 1040 | |
dTdr()
Temperature gradient at basic nodes (from T profile, for BCs).
Source code in src/aragog/solver/entropy_state.py
1061 1062 1063 1064 | |
update(entropy, time, dSdr_cmb=None, dSdr=None, entropy_basic=None)
Update the state from the entropy profile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entropy
|
array
|
Entropy at staggered nodes [J/kg/K]. |
required |
time
|
float
|
Current time [yr]. |
required |
dSdr_cmb
|
float
|
energy_balance mode: override the CMB boundary gradient with the value from the extended state vector. |
None
|
dSdr
|
array
|
Gradient-mode: provide dS/dr at all basic nodes directly, bypassing the FD transform. Shape (N+1,). |
None
|
entropy_basic
|
array
|
Gradient-mode: provide S at all basic nodes directly, bypassing the quantity transform. Shape (N+1,). |
None
|
Source code in src/aragog/solver/entropy_state.py
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 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 | |
SolverOutput(S_final, T_stag, phi_stag, rho_stag, visc_stag, P_stag, r_basic, r_stag, vol, mass_stag, heat_flux, heating, eddy_diff, cap_stag, jcond_b, jconv_b, jgrav_b, jmix_b, dSdr_b, phi_basic, T_basic, cp_basic, rho_basic, T_magma, T_core, Phi_global, Phi_global_vol, M_mantle, M_mantle_liquid, M_mantle_solid, RF_depth, E_th, E_state, E_state_cons, Cp_eff, F_heat_total, F_cmb, Q_radio_total, Q_tidal_total, step_dE_F_int_J, step_dE_F_cmb_J, step_dE_Q_radio_J, step_dE_Q_tidal_J, step_dE_Q_radio_cons_J, step_dE_Q_tidal_cons_J, step_solver_residual_J, step_dE_compression_J, step_dE_state_heat_J, dt_actual, status)
dataclass
Complete output from one EntropySolver integration step.
This dataclass is the public contract between Aragog and PROTEUS. All quantities needed by the coupling wrapper are included here, so callers never need to reach into solver internals.
to_netcdf(path, *, time=None, description='Aragog SolverOutput snapshot')
Write this solver snapshot to a NetCDF4 file.
Produces a self-contained file that captures the full
SolverOutput dataclass: scalar diagnostics, staggered-node
profiles (entropy, temperature, melt fraction, density,
viscosity, ...), basic-node profiles (heat flux, per-component
flux decomposition, ...), and run-level metadata (Aragog
version, optional simulation time, status code). All fields
carry CF-style units and long_name attributes so the
file is interpretable without consulting the source.
Designed for the standalone solver path: a script that builds
an EntropySolver, runs solve(), and wants a portable
record of the final state. PROTEUS-coupled runs do not use
this; they assemble their own per-iteration helpfile rows on
the wrapper side. The two writers are independent on purpose
so the standalone schema can evolve without breaking PROTEUS.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Destination NetCDF4 file. Overwrites if the file exists. |
required |
time
|
float
|
Simulation time at which this snapshot was taken [yr].
Stored as the scalar |
None
|
description
|
str
|
Free-form description string written to the dataset's
|
'Aragog SolverOutput snapshot'
|
Notes
- Uses
netCDF4directly (already a hard dependency); no xarray import to keep startup lean. - All array fields are written as
f8(float64). The integerstatusfield is stored asi4. - Reading back:
netCDF4.Dataset(path)orxarray.open_dataset(path)both work; the file follows the CF-1.8 attribute convention.
Source code in src/aragog/solver/entropy_solver.py
672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 | |