Skip to content
37 changes: 37 additions & 0 deletions docs/How-to/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,3 +296,40 @@ Environment variables
FWL_DATA: ok
RAD_DIR: ok
```

## Melting Curves

PROTEUS uses precomputed solidus and liquidus curves from laboratory experiments and theoretical parametrizations of silicate melting. These define the temperatures at which materials begin to melt and become fully molten as a function of pressure.

### Available parametrizations

Available melting_dir options
-----------------------------
The following directory names are supported and should be used exactly as written in the TOML configuration in the 'melting_dir' parameter:

- andrault_2011
- monteux_2016
- wolf_bower_2018
- katz_2003
- fei_2021
- belonoshko_2005
- fiquet_2010
- hirschmann_2000
- stixrude_2014
- lin_2024
Comment on lines +310 to +319
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.


### Generate melting curves

Before running PROTEUS, generate the lookup tables:

```console
python src/proteus/utils/solidus_func.py --all
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executable script should be located in tools/ not in src/.

```

Alternatively, you can generate a single parametrization using a specific flag (e.g.--katz2003, --lin2024).

This will compute all parametrizations, convert them to P–T and P–S space, and store them in:

```console
$FWL_DATA/interior_lookup_tables/Melting_curves/
```
2 changes: 1 addition & 1 deletion input/all_options.toml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ version = "2.0"
core_density = 10738.33 # Core density [kg m-3]
core_heatcap = 880.0 # Core specific heat capacity [J K-1 kg-1]

module = "zalmoxis" # self | zalmoxis
module = "self" # self | zalmoxis
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change this?

update_interval = 0 # max interval (ceiling) between structure updates [yr]; 0 = only at init
update_min_interval = 0 # min interval (floor) between updates [yr]; prevents thrashing
update_dtmagma_frac = 0.03 # trigger on relative T_magma change (3%)
Expand Down
52 changes: 42 additions & 10 deletions src/proteus/utils/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1190,33 +1190,65 @@ def download_interior_lookuptables(clean=False):
)


def download_melting_curves(config: Config, clean=False):
def download_melting_curves(config: Config, clean: bool = False):
"""
Download melting curve data
Ensure melting curve data are available locally.

Expected layout:
interior_lookup_tables/
Melting_curves/
<melting_dir>/
solidus_P-T.dat
liquidus_P-T.dat
solidus_P-S.dat
liquidus_P-S.dat
"""
log.debug('Download melting curve data')
dir = 'Melting_curves/' + config.interior.melting_dir
rel_dir = Path('Melting_curves') / config.interior.melting_dir

data_dir = GetFWLData() / 'interior_lookup_tables'
data_dir.mkdir(parents=True, exist_ok=True)

folder_dir = data_dir / dir
folder_dir = data_dir / rel_dir

if clean:
safe_rm(folder_dir.as_posix())
source_info = get_data_source_info(dir)

# ------------------------------------------------------------------
# Canonical flat layout: if files already exist locally, do not download.
# ------------------------------------------------------------------
solidus_pt = folder_dir / 'solidus_P-T.dat'
liquidus_pt = folder_dir / 'liquidus_P-T.dat'
solidus_ps = folder_dir / 'solidus_P-S.dat'
liquidus_ps = folder_dir / 'liquidus_P-S.dat'

if all(p.is_file() for p in (solidus_pt, liquidus_pt, solidus_ps, liquidus_ps)):
log.debug('Melting curve data already present locally: %s', folder_dir)
return

# ------------------------------------------------------------------
# Fallback: try remote source mapping.
# ------------------------------------------------------------------
source_info = get_data_source_info(rel_dir.as_posix())
if not source_info:
raise ValueError(f'No data source mapping found for folder: {dir}')
raise ValueError(
f'No data source mapping found for folder: {rel_dir}. '
f'Also did not find local melting curve data in: {folder_dir}'
)

download(
folder=dir,
folder=rel_dir.as_posix(),
target=data_dir,
osf_id=source_info['osf_project'],
zenodo_id=source_info['zenodo_id'],
desc=f'Melting curve data: {dir}',
desc=f'Melting curve data: {rel_dir}',
)

# Create canonical _P-T copies from Zenodo legacy names (solidus.dat -> solidus_P-T.dat).
# Keep originals so md5sum checks don't trigger unnecessary re-downloads.
# ------------------------------------------------------------------
# Legacy compatibility:
# - if download contains solidus.dat / liquidus.dat, treat them as P-T
# and create canonical *_P-T.dat copies
# ------------------------------------------------------------------
for stem in ('solidus', 'liquidus'):
legacy = folder_dir / f'{stem}.dat'
canonical = folder_dir / f'{stem}_P-T.dat'
Expand Down
Loading
Loading