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 |
Holds the BC settings that EntropySolver reads, plus a standalone flux dispatch: surface (grey-body, UTBL, prescribed flux/T) and inner (prescribed flux/T). Core cooling (inner_boundary_condition = 1) is applied inside EntropySolver. |
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. |
The solver checks the CMB closure of each energy_balance, gradient and core_module call (ledger check of the CMB closure):
aragog.solver.entropy_solver.CMBClosureError, aRuntimeError, is raised when the node slope \((\partial T/\partial S)_P\) is not finite and positive.- Its subclass
CMBLedgerMissErroris raised for a ledger miss above 10 times its bound in 2 cases:solver.rtolis below \(10^{-8}\) (no repeat), or the one repeat of the call from its start atrtol = 1e-10is not kept.- The run keeps the repeat only when its check ran and did not skip the call, and its miss is at most 10 times the bounds of both attempts (what happens after a miss).
- A repeat that stops early, or raises
CMBClosureError,CMBEddyFluxErrororAcceptedStateRangeError, is not kept; any other error of the repeat propagates as it is. - Each repeat that ends logs one warning line with the refused miss and its outcome. An interrupt (
KeyboardInterrupt) in the repeat logs no line and is not counted as a failed repeat.
- After either error, and after any other error of the repeat, the solver puts back the solution it held at the start of the call. After a repeat that is not kept it also puts back the
rtol, the tolerances,stop_early, the ledger counts and the lid state of the refused attempt. - A
RuntimeErroris raised in place of the repeat when the refused attempt changed the start state. EntropySolver.cmb_ledgeris a dict with the terms of the last checked call:randbound(J inenergy_balanceandgradient, K incore_module),rel(dimensionless: the term \(\epsilon_\text{tab}\) of the bound) andexcluded(true when the check was skipped). After a kept repeat it also holdsrepeat_of, the terms and thertolof the refused solve, and the solution hascmb_ledger_repeatset toTrue. After a repeat that is not kept it holds the refused terms with theirrtol, and the terms of the repeat underrepeat(None when its check did not run). It isNoneafter a call that the check does not cover.
aragog.solver.energy_stream evaluates the per-call energy integrals and the node checks over every accepted CVODE step in chunks of 2048 nodes while the solve runs. A node is passed on once CVODE has returned the output time after it, so the memory of a call grows with the steps of one output interval (at most max_steps), not with its step count.
The solver also checks the eddy diffusivity rule of the CMB basic node (Eddy diffusivity at the CMB node) in every NumPy EntropyState.update with convection on:
aragog.solver.entropy_state.check_cmb_convective_fluxcompares the convective flux of the CMB node with the 2 inputs of the rule. It requires the flux to equal the rule within \(10^{-12}\) relative, and it does not check a state with an input that is not finite.- The check takes the 2 inputs from the same mixing-length call that sets the eddy diffusivity of the CMB node, so it checks the value that this call gives the CMB node, not how the call computes the inputs. The test
tests/test_cmb_eddy_diffusivity.py::test_cmb_rule_holds_on_random_stateschecks the rule itself: it computes the floor of node 0 from the melt fraction of node 0 and compares the NumPy update and the JAX functioncompute_mltwith the rule. - The check runs on the NumPy path: in the energy replay, in the NumPy right-hand side and in the update of the end state of each call. It does not run inside the JAX right-hand side.
- On a failure it raises
aragog.solver.entropy_state.CMBEddyFluxError, aRuntimeError, which names the part that fails, (i) to (iv). EntropyState.cmb_eddy_diffusivity_inputsholds the 2 inputs of the last update: the mixing-length eddy diffusivity of node 1 before the floor and the floor of node 0, both in m\(^2\) s\(^{-1}\).
The mixing flux of EntropyState and of the JAX right-hand side takes the melt fraction of each cell from aragog.utilities.mixing_melt_fraction (Chemical mixing of melt fraction). Three constants of aragog.utilities set its form, in the lever-rule coordinate \(g = (S - S_\mathrm{sol})/(S_\mathrm{liq} - S_\mathrm{sol})\):
MIX_CLIP_EPS= \(10^{-3}\): the width of the smooth clip of \(g\) to \([0, 1]\).MIX_TAIL_START= 0.01 andMIX_TAIL_END= 0.02: the cubic join to exactly 1 runs from \(g = 1.01\) to \(g = 1.02\), and the cubic join to exactly 0 from \(g = -0.01\) to \(g = -0.02\); the value and the slope are continuous at the ends of each join, the second derivative is not.
The result:
- lies in \([0, 1]\) and never falls when \(g\) grows;
- is exactly 0 for \(g \le -0.02\) and exactly 1 for \(g \ge 1.02\);
- is NaN for a NaN or infinite \(g\), and for \(|g|\) above about \(10^{154}\), where \(g^2\) overflows.
phase_smoothing does not act on the mixing flux.
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
95 96 97 98 99 100 101 102 | |
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: Core cooling (EntropySolver only; raises here) 2: Prescribed heat flux 3: Prescribed temperature
Source code in src/aragog/solver/boundary.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
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
38 39 40 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 | |
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
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
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
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
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
1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 | |
entropy_staggered
property
Entropy at staggered nodes from the solution.
For the bower2018, energy_balance and core_module modes the solver state vector is longer than N; we strip the trailing extra rows 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.
surface_temperature_bc
property
Surface entropy [J/kg/K], surface temperature [K] and face half cell [m] of BC 5,
the S_surf, outer_bc_value and surf_dr_half of a JAX BoundaryParams;
None for the other outer modes. A changed outer_boundary_value is inverted first,
and an invalid one raises ValueError.
temperature_staggered
property
Temperature at staggered nodes (derived from S via EOS).
cmb_shell_surface_temperature()
Surface temperature [K] of the shell contrast of the core_module CMB law: the BC 5
surface temperature, else the surface_temperature setting, else NaN (the top cell
stands in). A setting changed between calls is checked here.
Source code in src/aragog/solver/entropy_solver.py
2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 | |
dSdt(time, state_vec)
Time derivative of the full state vector.
The layout and the length of the state vector depend on the
core BC mode (_dSdt_single lists the five), and this
returns the derivative in the same layout.
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], one column of the length of the active core BC mode. |
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
4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 | |
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
1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 | |
get_current_core_temperature()
Return the most recent core temperature from the solver state.
Reads self._solution.y[T_core_slot, -1] (the final T_core from the
last accepted solve). Returns None when no solution exists yet,
or when the state vector lacks the T_core slot (core_bc other than
bower2018 or core_module).
Used by PROTEUS's retry ladder to snapshot the pre-solve
T_core before a sequence of retry attempts and restore it on
each retry, mirroring get_current_dSdr_cmb.
Source code in src/aragog/solver/entropy_solver.py
4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 | |
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 or core_module).
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
4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 | |
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
7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 | |
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
1926 1927 1928 1929 1930 1931 1932 1933 1934 | |
jax_lid_params()
The sub-grid lid data of this solver for the JAX right-hand side
(:class:aragog.jax.surface_lid.LidParams), from its EOS tables and mesh.
Source code in src/aragog/solver/entropy_solver.py
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 3653 | |
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
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 | |
set_initial_core_temperature(T_core_init)
Set the initial core temperature (bower2018 / core_module).
Must be called BEFORE set_initial_entropy. If not called,
the initial T_core defaults to the previous solution's final value
(if any), else to the EOS temperature of the bottom cell's entropy
in S_init, at the CMB pressure for core_module (no CMB flux at
the start without a shell) and at the bottom-cell pressure for bower2018.
The value applies to every later call of set_initial_entropy.
Pass None to clear it, restoring the hot-start behaviour; only a
set value is checked against the mantle temperature at the CMB.
Source code in src/aragog/solver/entropy_solver.py
4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 | |
set_initial_dSdr_cmb(dSdr_cmb_init)
Set the initial CMB entropy gradient (energy_balance / core_module).
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
4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 | |
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; core_module uses length N+2
(dSdr_cmb and T_core) plus the shell temperatures of a
stratified core. 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
3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 | |
set_initial_lid(delta, E_lid=None, handover_time=float('nan'))
Set the initial lid thickness [m] and energy [J/m^2] (a resume).
It holds in either order with set_initial_entropy, apart from a start that refuses
the lid of the previous solution, and the phantom start of a new solver, which needs the
top cell the full floor gap above the solidus and outside the heat-jump band (a
handed-over lid over a solid top cell, or a lid in the slack of the step check, is
refused there): a resume calls it first. With lid_mush_base a live lid set after
set_initial_entropy is written into that start and checked when the solve starts,
against the top cell of the start: below S_sol + LID_FLOOR_SLACK, not finite or in
the heat-jump band, the solve refuses it and leaves the state as it was. Every start
uses it until the next solve, which consumes it.
With lid_mush_base a lid at or above 0.7 of the top cell hands over at the call
start, and a lid the merge cannot take (the merged top cell or top node leaves the EOS
table) is refused with its size; without it a lid above the growth stop (0.8 of the top cell) is
refused. None clears
the stored value: a later start then takes the lid of the previous solution, or the
phantom lid (lid_delta_lo, linear profile). (0, 0) is a lid handed over to the
mesh, which does not grow again; handover_time [yr] is then the
lid_handover_time of the output, NaN if not known. A live lid has no hand-over time
and clears the stored one. A 0-d real value (a scalar read from a NetCDF file) counts as
a number; a masked-out value is refused.
Raises:
| Type | Description |
|---|---|
ValueError
|
For a time that is neither NaN nor finite and >= 0, a time with a live or cleared
lid, or a lid other than |
Source code in src/aragog/solver/entropy_solver.py
3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 | |
set_initial_shell_temperature(t_shell)
Set the shell temperatures [K] of a stratified core (a resume).
Must be called before set_initial_entropy. The profile applies to every later
call of set_initial_entropy; None clears it, so the shell starts from the
previous solution, or on the adiabat of the core without one.
Source code in src/aragog/solver/entropy_solver.py
4127 4128 4129 4130 4131 4132 4133 4134 | |
set_jax_cvode_factory(factory, *, phase_params=None)
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 |
phase_params
|
PhaseParams
|
When supplied, validates immediately that |
None
|
Source code in src/aragog/solver/entropy_solver.py
1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 | |
solve(_floor_discard=None, _start=_CALL_START)
Run the BDF time integration of one call (see _solve_call).
A call that the CMB ledger check refuses (CMBLedgerMissError) at an rtol of at
least 100 times _LEDGER_REPEAT_RTOL is solved once more from its start at that rtol,
and the run keeps the repeat when its check ran, did not skip the call, and
_repeat_keeps passes it: cmb_ledger then holds the repeat's terms and
'repeat_of' the refused ones, and the solution has cmb_ledger_repeat True.
_cmb_ledger_repeats counts the repeats started and the failed ones (an interrupt is
not a failed one). A floor-discard solve inside a call never repeats. A repeat that is
not kept, stops early, or raises CMBClosureError, CMBEddyFluxError or
AcceptedStateRangeError raises CMBLedgerMissError; its __cause__ and
__context__ are the error of the repeat, whose __context__ is the refusal. Any
other error of the repeat propagates as it is. The solver is then at the call start,
with the rtol, stop_early, tolerances, ledger counts and lid state of the refused
attempt, and cmb_ledger holds the refused terms with the repeat's (or None) under
'repeat'.
Raises:
| Type | Description |
|---|---|
CMBLedgerMissError
|
When the call misses the ledger at an rtol below 100 times the repeat rtol, or its repeat is not kept. |
RuntimeError
|
When the refused attempt changed the start state, so no repeat can run. |
Source code in src/aragog/solver/entropy_solver.py
5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 | |
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
7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 | |
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', convective_threshold=CONVECTIVE_THRESHOLD_DEFAULT)
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
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 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | |
bottom_temperature
property
Temperature at the innermost basic node [K].
cmb_eddy_diffusivity_inputs
property
(kh_mlt[1], floor[0]) of the last update, the inputs of the CMB node rule.
eta_eff_basic
property
Solid effective viscosity at basic nodes [Pa s].
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.
lid_state
property
Stagnant-lid diagnostic state dictionary from the last update, or None.
temperature_basic
property
Temperature at basic nodes (derived from S via EOS).
top_temperature
property
Temperature at the outermost basic node [K].
basic_entropy(entropy, dSdr_cmb=None, entropy_basic=None)
Entropy at the basic nodes that update gives the basic phase evaluator.
The mesh transform of the staggered entropy (or a copy of entropy_basic); with
dSdr_cmb the CMB node is the bottom cell carried to the CMB by that gradient, and
with a set surface temperature (BC 5) the top node holds its entropy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entropy
|
ndarray
|
Entropy at the staggered nodes [J/kg/K]. |
required |
dSdr_cmb
|
float
|
Entropy gradient at the CMB [J/kg/K/m] (energy_balance and core_module). |
None
|
entropy_basic
|
ndarray
|
Entropy at the basic nodes (gradient mode), used in place of the transform. |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Entropy at the basic nodes [J/kg/K]. |
Source code in src/aragog/solver/entropy_state.py
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 | |
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
1156 1157 1158 1159 1160 1161 1162 | |
dTdr()
Temperature gradient at basic nodes (from T profile, for BCs).
Source code in src/aragog/solver/entropy_state.py
1197 1198 1199 1200 | |
set_surface_temperature(entropy, temperature, half_cell)
Prescribe the surface temperature (outer boundary condition 5).
Each update then sets the surface basic node to entropy and its gradient so that the
conductive face flux is k (T_stag[-1] - T_node) / half_cell, with T_node the
temperature of the node at entropy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entropy
|
float
|
Entropy where |
required |
temperature
|
float
|
Prescribed surface temperature [K]. |
required |
half_cell
|
float
|
Distance of the surface face from the top cell, |
required |
Source code in src/aragog/solver/entropy_state.py
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | |
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 and core_module modes: 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
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 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 | |
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, porosity_b, rho_solid_b, rho_melt_b, g_b, 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_core_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, time, status, cvode_flag=0, cvode_flag_name='N/A', tcore_change_max=0.0, tcore_change_exceeded=False, core_T_shell=None, core_layer_base=float('nan'), core_T_top=float('nan'), step_core_tol_J=float('nan'), lid_delta=float('nan'), lid_E=float('nan'), lid_T_mean=float('nan'), lid_T_surface=float('nan'), lid_T_base=float('nan'), lid_weight=float('nan'), lid_delta_eff=float('nan'), lid_conductance=float('nan'), lid_F_base=float('nan'), lid_handover_time=float('nan'), lid_weight_max=float('nan'))
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. status 0 (success)
and 1 (stop at a step-cap event) are successful runs, any other status is a
failure; failed tells the two apart.
failed
property
Whether the integration failed (a status other than 0 and 1).
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
1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 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 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 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 | |
mixing_melt_fraction(gphi, xp=np)
Cell melt fraction of the mixing flux.
The lever-rule coordinate is clipped to [0, 1] with the sqrt smooth clip of bandwidth
MIX_CLIP_EPS, which keeps a small tail beyond each phase boundary (smooth_clip
gives its size). Between the distances MIX_TAIL_START and MIX_TAIL_END beyond a
boundary the cubic smoothstep blends the tail to exactly 1 above the liquidus and to exactly
0 below the solidus, with a continuous value and slope, so 2 pure-melt or 2 pure-solid cells
have no mixing flux between them. Between the 2 joins the result is the smooth clip unchanged.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gphi
|
float or ndarray
|
Lever-rule coordinate |
required |
xp
|
module
|
Array backend ( |
numpy
|
Returns:
| Type | Description |
|---|---|
float or ndarray
|
Melt fraction in |
Source code in src/aragog/utilities.py
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 | |
check_cmb_convective_flux(*, jconv_0, rho_t_0, dsdr_0, kh_mlt_1, kh_floor_0, threshold, rtol=1e-12)
Check the convective flux at the CMB basic node against the inputs of its rule.
The CMB node takes kh[0] = max(kh_mlt_1, kh_floor_0), so its convective flux
J = -rho T kh[0] dS/dr[0] must satisfy, with g = dS/dr[0] and D the
convective threshold:
(i) for g >= D: |J| <= rho T kh_mlt_1 |g| (no floor of node 1 crosses a
stable CMB);
(ii) for g < D: |J| >= rho T kh_floor_0 |g| (node 0 keeps its own floor);
(iii) J g <= 0 (no flux against its own gradient);
(iv) J = -rho T max(kh_mlt_1, kh_floor_0) g (the rule itself).
kh_floor_0 is already 0 where g >= D. Parts (i) to (iii) name the failure; (iv)
also catches a flux between the bounds of (i) and (ii).
A state with a non-finite input is not checked.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
jconv_0
|
float
|
Convective heat flux at the CMB node [W m^-2]. |
required |
rho_t_0
|
float
|
Density times temperature at the CMB node [kg K m^-3]. |
required |
dsdr_0
|
float
|
Entropy gradient at the CMB node [J kg^-1 K^-1 m^-1]. |
required |
kh_mlt_1
|
float
|
Mixing-length eddy diffusivity of node 1 before the floor [m^2 s^-1]. |
required |
kh_floor_0
|
float
|
Floor of node 0 under its own mask [m^2 s^-1]. |
required |
threshold
|
float
|
Convective threshold |
required |
rtol
|
float
|
Relative tolerance of parts (i), (ii) and (iv). |
1e-12
|
Raises:
| Type | Description |
|---|---|
CMBEddyFluxError
|
If a part of the invariant fails; the message names the part. |
Source code in src/aragog/solver/entropy_state.py
120 121 122 123 124 125 126 127 128 129 130 131 132 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 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
CMBEddyFluxError
Bases: RuntimeError
The convective flux at the CMB basic node breaks the rule of its eddy diffusivity.
energy_stream
Per-call energy integrals and node checks, evaluated in bounded chunks while CVODE steps.
The quadrature nodes of a call are every accepted CVODE step, every output point and, on a fired root, the root-search points below the root. They pass through three stages:
CallNodesfilters the nodes of one CVODE call to increasing times up to the call end and brackets them by the start and end states.SolveNodesjoins the calls of one solve, keeps the last of each run of nodes that round to the same physical time, converts them to physical units and collects them in chunks ofCHUNKnodes.- The consumers (
EnergyQuadrature,TableGuard,DomainCheck,FloorMin,RegimeCheck) take one chunk at a time and keep only running sums, extremes and the last node.
So the memory of a call is bounded by the steps of one output interval (at most
max_steps, which wait in CallNodes) and one chunk, not by its step count. The nodes,
their order and the arithmetic per node are those of a stored trace; only the trapezoid sums
are added chunk by chunk. A consumer stores its first error and raises it after the solve, never inside a CVODE
callback.
CMBLedger(solver, core=False)
Running form of the CMB closure check of EntropySolver._check_cmb_ledger.
add takes the nodes of a chunk with the CMB power p [W] (energy_balance and
gradient) or the core-top change d [K] (core_module, core True) and keeps the
end-point temperatures of the CMB node, the largest s w, rel and the exclusion
flag, the scale and the every-other-node trapezoid; finish applies the bound. A node
slope that is not finite and positive is kept in error for finish.
Source code in src/aragog/solver/energy_stream.py
350 351 352 353 354 355 356 357 358 359 360 361 | |
finish(q)
Check the call with its CMB heat q [J] (energy_balance and gradient).
Source code in src/aragog/solver/energy_stream.py
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 | |
CallNodes(sink, t0, y0, t_out, start=True)
Quadrature nodes of one CVODE call, passed to sink in increasing time.
Nodes later than the call end and nodes not later than the previous kept node are
dropped; the rest are bracketed by the start state (unless start is False, when the
previous call's end state is the same node) and the end state. The call end is known only
when the call returns: it is the root, or an output time of t_out that CVODE reached.
CVODE returns an output time once a step that passes it ends without a root, so a node at
or before the last output time passed by the step before the latest one is final and is
passed on; the later nodes, at most the steps of one output interval, wait for end.
A node at the time of a waiting node is never kept and is dropped at once.
Source code in src/aragog/solver/energy_stream.py
75 76 77 78 79 80 81 82 83 84 85 | |
end(t, y)
Close the call with its result times t and states y (n_state, n_t).
Source code in src/aragog/solver/energy_stream.py
110 111 112 113 114 115 116 117 118 | |
record(t, y)
Record the state the root function sees at time t.
Source code in src/aragog/solver/energy_stream.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
DomainCheck(solver, domain, tol, k_cmb)
EOS lookup points outside the valid table window (EntropySolver._eos_domain_failure).
Keeps the count of states, the count of points more than tol table S cells outside and
the worst such point; k_cmb is the state row of the CMB gradient, if there is one.
Source code in src/aragog/solver/energy_stream.py
269 270 271 272 273 274 275 276 | |
EnergyQuadrature(solver)
Per-call energy integrals [J] and the per-node invariant checks, chunk by chunk.
The running form of EntropySolver._compute_step_energy_integrals: per chunk the
powers come from the JAX batch (or, without it, from _step_powers at each node), the
trapezoid sums carry the last node of the previous chunk, and the core heat change, its
tolerance scale, the CMB ledger (CMBLedger) and the largest lid weight are kept the
same way.
Each check keeps its first failure, with the node index in the whole call, and result
raises them in the order of a stored trace (_ORDER, then the CMB ledger): the batch
checks of the whole call, then the per-node checks of the loop, then the core capacity.
After a failure the later chunks run only the checks that come before it. When the batch
fails on a chunk, that chunk and all later ones use _step_powers with its per-node
checks; the earlier chunks keep their batch powers and batch checks, since their nodes
are gone, and a warning names them.
Source code in src/aragog/solver/energy_stream.py
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | |
result(sol)
The integrals of the call; raises the first failed check.
Source code in src/aragog/solver/energy_stream.py
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 | |
FloorMin(solver, weights)
Smallest floor entropy and smallest cell entropy over the nodes (the EOS floor check).
Source code in src/aragog/solver/energy_stream.py
313 314 315 | |
ListSink()
Collects nondimensional nodes; the trace of a CVODE call made outside solve.
Source code in src/aragog/solver/energy_stream.py
48 49 | |
arrays()
Node times and states (n_state, n), or None without nodes.
Source code in src/aragog/solver/energy_stream.py
55 56 57 58 59 | |
RegimeCheck(solver, budget)
refuse_unmodelled_regime on the T_core of every node; keeps its first error.
Source code in src/aragog/solver/energy_stream.py
326 327 328 | |
SolveNodes(consumers, t_ref, scale, offset, change_from, lid=False, keep=False)
Joined nodes of one solve, in physical units, handed to the consumers in chunks.
Of each run of nondimensional times that round to the same year the last node is kept;
nodes at an equal nondimensional time (the two states of a lid hand-over) are all kept.
Each state becomes y_nd * scale + offset; the rows from change_from on are also
passed as y_nd * scale, their change from the call start. With a sub-grid lid the lid
energy is set to 0 where the lid thickness is 0.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
consumers
|
list
|
Objects with |
required |
t_ref
|
float
|
Time scale [yr]. |
required |
scale
|
ndarray
|
State scale and offset per row. |
required |
offset
|
ndarray
|
State scale and offset per row. |
required |
change_from
|
int
|
First row of the changes. |
required |
lid
|
bool
|
The state ends with the lid thickness and energy. |
False
|
keep
|
bool
|
Also keep every node (for tests); see |
False
|
Source code in src/aragog/solver/energy_stream.py
146 147 148 149 150 151 152 153 154 155 156 | |
close()
Pass on the last node and the partial chunk.
Source code in src/aragog/solver/energy_stream.py
190 191 192 193 194 195 | |
kept()
The kept nodes (t, y) and their states times the scale, without the offset.
Source code in src/aragog/solver/energy_stream.py
197 198 199 200 201 202 203 | |
TableGuard(solver)
First node with a cell entropy outside the EOS tables (EntropySolver._eos_table_failure).
bad holds its time [yr] and message; with strict_accepted_range on, error also
holds the AcceptedStateRangeError the solve raises.
Source code in src/aragog/solver/energy_stream.py
230 231 232 233 234 | |
feed(consumers, t_pts, y_pts, change=None)
Pass a stored trace (t_pts, y_pts) (physical) to consumers chunk by chunk.
Source code in src/aragog/solver/energy_stream.py
206 207 208 209 210 211 212 213 214 215 | |