feat: Problem-Solver API redesign for v0.2.0#201
Merged
Conversation
Reflects the addition of CommonSolve.jl as a dependency and Julia version update from 1.11.6 to 1.12.6. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
v0.2.0 requires AbstractShapeModel (introduced in v0.5.0) for the new problem types. Support for v0.4.x is dropped as planned. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…oPhysicalProblem Introduce problem definition types that separate "what to solve" from "how to solve it", following the DifferentialEquations.jl Problem-Solver pattern. SingleAsteroidThermoPhysicalProblem holds: - shape (AbstractShapeModel), thermo_params - with_self_shadowing, with_self_heating (modeling flags) - upper_boundary_condition, lower_boundary_condition BinaryAsteroidThermoPhysicalProblem composes two single-asteroid problems and adds with_mutual_shadowing, with_mutual_heating flags. Both constructors handle automatic BVH / face_visibility_graph building and call broadcast_thermo_params!. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add src/tpm_solve.jl with solve(::SingleAsteroidThermoPhysicalProblem, ...) and solve(::BinaryAsteroidThermoPhysicalProblem, ...) extending CommonSolve.solve - Add _build_single_tpm and _build_cache internal helpers - Remove run_TPM! from tpm_run.jl (replaced by solve) - Reorganize AsteroidThermoPhysicalModels.jl: interleave export with include so each file's public API is visible at its definition site Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace SingleAsteroidTPM/BinaryAsteroidTPM construction + init_temperature! + run_TPM! with SingleAsteroidThermoPhysicalProblem / BinaryAsteroidThermoPhysicalProblem + solve. Benchmark setup functions now return (problem, ephem); component benchmarks use _build_single_tpm for direct access to internal model state. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The main package now requires AsteroidShapeModels >= 0.5 (AbstractShapeModel), so update the benchmark environment to match. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… utilities - Rename tpm_run.jl → tpm_init.jl (file now contains only init_temperature!) - Move subsolar_temperature to thermo_params.jl where thermal params are defined - Add init_temperature!(stpm, T₀::AbstractMatrix) for initializing from a previous result - Add init_temperature!(btpm, T₀_primary, T₀_secondary) for per-body initialization - Export subsolar_temperature from main module Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ody kwargs - Remove default value from T₀ in single-asteroid solve (must be explicitly provided) - Replace T₀ with T₀_primary and T₀_secondary in binary solve (no defaults) - T₀ accepts Real or AbstractMatrix of size (n_depth, n_face) in both solve methods - Update test (TPM_Didymos) and benchmark calls accordingly Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…blem types - Add BinaryAsteroidThermoPhysicalProblem(shape, thermo_params; kwargs...) convenience constructor accepting tuples (shape1, shape2) and (thermo_params1, thermo_params2); single-body kwargs are applied identically to both bodies - Add ::Bool type annotations to all boolean kwargs in problem constructors - Add ::SingleAsteroidThermoPhysicalProblem annotations to primary/secondary args Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Consistent with CommonSolve.jl convention and the solve docstrings. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #201 +/- ##
==========================================
- Coverage 92.84% 92.00% -0.85%
==========================================
Files 11 13 +2
Lines 559 600 +41
==========================================
+ Hits 519 552 +33
- Misses 40 48 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ThermoParams is a fundamental user-facing type that must be accessible without module qualification after `using AsteroidThermoPhysicalModels`. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Covers subsolar_temperature, BinaryAsteroidThermoPhysicalProblem convenience constructor (tuple args, per-body params, shared kwargs), and init_temperature! with AbstractMatrix and per-body binary overloads. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Now that ThermoParams is exported, the AsteroidThermoPhysicalModels. prefix is no longer needed in test files. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The params overload silently uses the first element of reflectance_vis and emissivity, which is inconsistent for non-uniform ThermoParams. Marks the overload for future removal. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements the Problem-Solver API redesign planned for v0.2.0, separating problem definition from simulation state and introducing a
solveinterface inspired by DifferentialEquations.jl.SingleAsteroidThermoPhysicalProblemandBinaryAsteroidThermoPhysicalProblemproblem types that encapsulate shape, thermophysical parameters, boundary conditions, and modeling flagssolve(problem, algorithm; kwargs...)viaCommonSolve.jl, replacingrun_TPM!ExplicitEuler,ImplicitEuler,CrankNicolson) and boundary condition types (RadiationBoundaryCondition,InsulationBoundaryCondition,IsothermalBoundaryCondition)BinaryAsteroidThermoPhysicalProblem(shape, thermo_params; kwargs...)convenience constructor accepting tuples(shape1, shape2)and(thermo_params1, thermo_params2)init_temperature!(stpm, T₀::AbstractMatrix)for warm-start from a previous resultinit_temperature!(btpm, T₀_primary, T₀_secondary)for per-body initializationThermoParamsandsubsolar_temperature; movesubsolar_temperaturetothermo_params.jltpm_run.jl→tpm_init.jlrun_TPM!Migration
Test plan
julia --project test/runtests.jl)julia --project=benchmark benchmark/run_benchmarks.jl)T₀_primary/T₀_secondarykwargs🤖 Generated with Claude Code