feat: separate ThermoParams/GridParams for v0.3.0#218
Merged
Conversation
- Add `GridParams` struct for numerical grid settings (z_max, Δz, n_depth), extracted from the old monolithic `ThermoParams` - Redesign `ThermoParams` to hold only material properties; rename `thermal_conductivity` → `conductivity`; remove grid fields - Add scalar outer constructor `ThermoParams(k, ρ, Cₚ, R_vis, R_ir, ε)` that creates length-1 vectors for uniform surfaces - `SingleAsteroidThermoPhysicalProblem` now takes `(shape, thermo_params, grid_params)` and expands length-1 ThermoParams vectors to n_face at construction time via `_expand_thermo_params`, eliminating the `resize!` mutation in `broadcast_thermo_params!` - Remove `broadcast_thermo_params!` from `tpm_state.jl` - Add `_to_pair` helper; binary convenience constructor now accepts `ThermoParams`/Tuple and `GridParams`/Tuple for per-body or shared params - Update `*EulerCache` / `CrankNicolsonCache` constructors to accept `GridParams` instead of `AbstractThermoParams` - Update `_build_single_state` to access `problem.grid_params` Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add box-style section separators for single/binary problem sections
- Add `Union{ThermoParams, Tuple}` and `Union{GridParams, Tuple}` type
annotations to the binary convenience constructor to restore type
safety lost when `_to_pair` helper was introduced
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace `thermo_params.thermal_conductivity` with `thermo_params.conductivity` in heat_conduction.jl and tpm_solution.jl - Replace `thermo_params.Δz` with `grid_params.Δz` in heat_conduction.jl and tpm_solution.jl - Replace `thermo_params.n_depth` with `grid_params.n_depth` in tpm_solution.jl Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
GridParams is unrelated to thermophysical material properties, so it is moved from thermo_params.jl to its own file for clarity. Also adds a note in the docstring about planned variable-spacing support. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Delegates to existing positional constructors, so both scalar Float64
and Vector{Float64} inputs work without additional dispatch logic.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rams.jl Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ar/vector args
Replace the scalar-only outer constructor with a single generalized constructor
that accepts Union{Float64, Vector{Float64}} per field. Scalar arguments are
automatically broadcast (fill) to match the length of any vector arguments,
so users no longer need to call fill manually for partially non-uniform surfaces.
Vector length consistency is validated at construction time, so _expand_thermo_params
only needs to check a single field when validating against n_face.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add GridParams(; z_max, n_depth) keyword constructor that auto-computes Δz = z_max / (n_depth - 1), preventing inconsistency between z_max/n_depth and Δz. Reorder fields to (z_max, n_depth, Δz) so primary parameters come first and the derived Δz is last. Update tpm_problem.jl docstring example to reflect the new field order. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add test/test_thermo_grid_params.jl covering: - ThermoParams: scalar, keyword, vector, mixed scalar/vector, keyword mixed, and validation (mismatched vector lengths) - GridParams: keyword auto-Δz, positional explicit Δz, consistency between both constructors Register the new file in runtests.jl. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Update all test files to use the new separated ThermoParams and GridParams API: - Replace positional 9-arg ThermoParams with keyword constructor - Construct GridParams(; z_max, n_depth) separately and pass as third arg to SingleAsteroidThermoPhysicalProblem - Remove manual Δz = z_max / (n_depth - 1) computations (now auto-computed) - Remove fill() calls in non-uniform test (scalars are now auto-broadcast) - Update field accesses: thermal_conductivity → conductivity, thermo_params.n_depth/Δz → grid_params.n_depth/Δz Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Document the ThermoParams/GridParams separation introduced in this release: - Breaking changes: removed grid fields from ThermoParams, renamed thermal_conductivity → conductivity, updated problem constructor signatures, removed broadcast_thermo_params! - Added: GridParams type with keyword constructor, ThermoParams keyword constructor, mixed scalar/vector ThermoParams support - Migration guide with before/after code examples for all affected APIs Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ThermoParams/GridParams for v0.3.0
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #218 +/- ##
==========================================
+ Coverage 96.59% 96.75% +0.16%
==========================================
Files 14 15 +1
Lines 704 709 +5
==========================================
+ Hits 680 686 +6
+ Misses 24 23 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add test asserting ArgumentError when ThermoParams vector length is neither 1 nor n_face, covering the missing codecov line in tpm_problem.jl. 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
GridParamsfrom the monolithicThermoParamsso that thermophysical material properties and numerical grid configuration are held in separate, focused typesThermoParamsChanges
New type:
GridParamsFields:
z_max,n_depth,Δz(primary params first, derived last).Redesigned
ThermoParamsUpdated problem constructors
Breaking Changes
ThermoParams(k, ρ, Cₚ, R_vis, R_ir, ε, z_max, Δz, n_depth)ThermoParams(…) + GridParams(; z_max, n_depth)thermo_params.thermal_conductivitythermo_params.conductivitythermo_params.n_depth/.Δzgrid_params.n_depth/.ΔzProblem(shape, thermo_params; …)Problem(shape, thermo_params, grid_params; …)broadcast_thermo_params!Test plan
ThermoParams: scalar, keyword, vector, mixed scalar/vector, keyword mixed, mismatched-length validation (test/test_thermo_grid_params.jl)GridParams: keyword auto-Δz, positional explicit Δz, constructor consistencyPkg.test()— 189 tests, 0 failures)CHANGELOG.md🤖 Generated with Claude Code