Add library of solidus/liquidus parameterizations selectable via melting_dir parameter#658
Add library of solidus/liquidus parameterizations selectable via melting_dir parameter#658planetmariana wants to merge 14 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds infrastructure to support multiple solidus/liquidus parameterizations selectable via interior.melting_dir, primarily by introducing a generator that exports P–T and P–S lookup tables into $FWL_DATA/interior_lookup_tables/Melting_curves/<model>/.
Changes:
- Added
src/proteus/utils/solidus_func.pyto generate/export melting curves (P–T and P–S) for multiple literature models. - Updated
download_melting_curves()to recognize a canonical flat file layout (including P–S tables) and skip downloads when present. - Updated config/docs/examples to reference and explain the new melting-curve workflow.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/proteus/utils/solidus_func.py | New CLI/script to generate model libraries and export P–T/P–S lookup tables into FWL_DATA. |
| src/proteus/utils/data.py | Enhances melting-curve acquisition logic: checks for local canonical files, falls back to remote mapping, maintains legacy P–T filename compatibility. |
| input/ensembles/example.grid.toml | Changes example ensemble defaults (SLURM enabled and higher job/time limits). |
| input/all_options.toml | Updates example/default config values, including interior.melting_dir. |
| docs/How-to/usage.md | Adds a “Melting Curves” section describing available parameterizations and how to generate tables. |
Comments suppressed due to low confidence (1)
input/all_options.toml:314
melting_diris set here toandrault_2011, butproteus get interiordatadefaults to usinginput/all_options.tomlanddownload_melting_curves()only knows how to download a small set of melting curves from the remote DATA_SOURCE_MAP (currently Monteux±600 and Wolf_Bower+2018). On a clean install this will raise “No data source mapping found …” unless the user has already generated local tables. Consider keeping the default as a remotely downloadable curve (e.g. Monteux-600) or adding a corresponding data-source mapping / automated generation step so the default CLI path works out of the box.
melting_dir = "Monteux-600" # Melting curve set used by all interior modules (Zalmoxis, Aragog, SPIDER)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #658 +/- ##
==========================================
+ Coverage 69.12% 69.33% +0.20%
==========================================
Files 98 98
Lines 10123 10130 +7
Branches 1401 1402 +1
==========================================
+ Hits 6998 7024 +26
+ Misses 2791 2786 -5
+ Partials 334 320 -14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@planetmariana please address the bot reviewers, reply to them and click "resolve" once you are happy with this and then please ping us/me again once you think this should be reviewed by us. |
|
@timlichtenberg @maraattia @nichollsh this is ready for review ! |
nichollsh
left a comment
There was a problem hiding this comment.
Thanks for this, @planetmariana! It is going to be extremely useful to have all of these melting curves available. I am already curious to see the different types of solidification mode that will arise from switching between them.
I ran your script following the documentation instructions and it worked as described. I then modified all_options.toml to use the generated Fei+21 curve with SPIDER, which also ran fine.
A few minor code-related comments below to implement, before this is ready to be approved and merged.
| Before running PROTEUS, generate the lookup tables: | ||
|
|
||
| ```console | ||
| python src/proteus/utils/solidus_func.py --all |
There was a problem hiding this comment.
Executable script should be located in tools/ not in src/.
| core_heatcap = 880.0 # Core specific heat capacity [J K-1 kg-1] | ||
|
|
||
| module = "zalmoxis" # self | zalmoxis | ||
| module = "self" # self | zalmoxis |
| def main(): | ||
| args = parse_args() | ||
|
|
||
| shortcut_model = resolve_requested_model(args) | ||
| explicit_model = args.model | ||
|
|
||
| if args.all: | ||
| if explicit_model is not None or shortcut_model is not None: | ||
| raise SystemExit( | ||
| 'Error: please use either --all or a single model selection, not both.' | ||
| ) | ||
| try: | ||
| export_all_models(out_root=args.out_root, n=args.n, spider_dir=args.spider_dir) |
There was a problem hiding this comment.
Executable scripts should not be located inside the PROTEUS src/ folder. They should only be in the tools/ folder.
It would be best to keep most of the functions inside this file (so that they are accessible to the rest of PROTEUS) but move all of the 'executable' parts (e.g. main()) into a separate script in tools/.
Putting executables in src/ does not follow the existing code structure.
| if len(selected_models) == 0: | ||
| raise SystemExit( | ||
| 'Error: no model selected. Use --all or choose one model with ' | ||
| '--model or a shortcut like --katz2003.' |
There was a problem hiding this comment.
List the available models, here, or point the user to the documentation which lists them.
| nP = 2020 | ||
| nS_solid = 125 | ||
| nS_liquid = 95 | ||
| skip_header = 5 | ||
|
|
||
| SCALE_P_EOS = 1e9 | ||
| SCALE_T_EOS = 1.0 | ||
| SCALE_S_SOLID_EOS = 4.82426684604467e6 | ||
| SCALE_S_LIQUID_EOS = 4.805046659407042e6 | ||
|
|
||
| SCALE_P_OUT = 1_000_000_000.0 | ||
| SCALE_S_OUT = 4_824_266.84604467 |
There was a problem hiding this comment.
Global variables are generally bad practice. Can you move these into the relevant functions where possible? Ideally, can you make them optional function arguments?
| def get_default_spider_dir() -> Path: | ||
| """ | ||
| Return the default SPIDER directory relative to this module. | ||
| """ | ||
| script_dir = Path(__file__).resolve().parent | ||
| return (script_dir / '../../../SPIDER').resolve() |
There was a problem hiding this comment.
I believe there's already functionality for this in utils.py.
| andrault_2011_cut = truncate_to_physical_interval(andrault_2011) | ||
| monteux_2016_cut = truncate_to_physical_interval(monteux_2016) | ||
| wolf_bower_2018_cut = truncate_to_physical_interval(wolf_bower_2018) | ||
| katz_2003_cut = truncate_to_physical_interval(katz_2003) |
There was a problem hiding this comment.
These do not need to be global variables. Can you put them inside the relevant functions?
| print(f' Saved to : {out_dir.resolve()}') | ||
| print() |
There was a problem hiding this comment.
Use log.info rather than print if possible. This applies throughout the file.
| - andrault_2011 | ||
| - monteux_2016 | ||
| - wolf_bower_2018 | ||
| - katz_2003 | ||
| - fei_2021 | ||
| - belonoshko_2005 | ||
| - fiquet_2010 | ||
| - hirschmann_2000 | ||
| - stixrude_2014 | ||
| - lin_2024 |
There was a problem hiding this comment.
Thanks for adding this documentation. It would be worthwhile moving the large comment at the start of solidus_func.py into the documentation where people can more easily see it. This includes the literature references.
Description
This pull request introduces a script to generate and manage a collection of solidus and liquidus parameterizations from the literature. The goal is to allow users to easily select different melting curves through the
melting_dirparameter in the PROTEUS .toml file.The new script (solidus_func.py) computes melting curves in both P–T and P–S space and stores them as lookup tables in:
Each parametrization is saved in its own folder and can be selected at runtime without additional computation. For each parametrization, the workflow is as follows:
The solidus and liquidus curves are first constructed in P–T space
Any non-physical regions where the curves cross (i.e. solidus ≥ liquidus) are automatically detected and truncated to retain only the valid interval
The curves are then converted into P–S space by inverting the EOS relation, while respecting the valid thermodynamic bounds of the EOS tables (in this case the ones previously used by SPIDER - Bower et. al 2018-)
This ensures that all generated melting curves are physically consistent and compatible with the EOS used in PROTEUS.
This feature enables straightforward comparison between different melting models and facilitates testing their impact on interior evolution.
Closes #656
The full set of melting curves are shown here in P-T and P-S:

To check that all the intermediate steps were correct, I tested the final output in P-S space with the original tables from SPIDER:

Validation of changes
to generate all melting curve parametrizations.
Verifying that all expected output files (solidus_P-T.dat, liquidus_P-T.dat, solidus_P-S.dat, liquidus_P-S.dat) are correctly created in the FWL_DATA directory
Running PROTEUS simulations with different melting_dir values (e.g. wolf_bower_2018, katz_2003, lin_2024) and confirming that:
The correct melting curves are loaded
No runtime computation of melting curves is performed
Simulations take this specific file in SPIDER.
Test configuration with Python 3.12.
Checklist
Relevant people
Tag people who should know about this PR here