giantlayers 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- giantlayers-0.1.0/.readthedocs.yaml +11 -0
- giantlayers-0.1.0/LICENSE +21 -0
- giantlayers-0.1.0/MANIFEST.in +6 -0
- giantlayers-0.1.0/PKG-INFO +58 -0
- giantlayers-0.1.0/README.md +33 -0
- giantlayers-0.1.0/docs/advanced.md +350 -0
- giantlayers-0.1.0/docs/assets/solver-flow.svg +48 -0
- giantlayers-0.1.0/docs/atmos.md +225 -0
- giantlayers-0.1.0/docs/how-it-works.md +20 -0
- giantlayers-0.1.0/docs/index.md +9 -0
- giantlayers-0.1.0/docs/quickstart.md +47 -0
- giantlayers-0.1.0/docs/requirements.txt +1 -0
- giantlayers-0.1.0/docs/spherical.md +23 -0
- giantlayers-0.1.0/docs/validation.md +270 -0
- giantlayers-0.1.0/mkdocs.yml +15 -0
- giantlayers-0.1.0/pyproject.toml +8 -0
- giantlayers-0.1.0/setup.cfg +62 -0
- giantlayers-0.1.0/setup.py +24 -0
- giantlayers-0.1.0/src/giantlayers/__init__.py +11 -0
- giantlayers-0.1.0/src/giantlayers/__main__.py +4 -0
- giantlayers-0.1.0/src/giantlayers/_chemistry_kernel.py +197 -0
- giantlayers-0.1.0/src/giantlayers/atlas9_odf.py +102 -0
- giantlayers-0.1.0/src/giantlayers/atlas_writer.py +118 -0
- giantlayers-0.1.0/src/giantlayers/atmos/__init__.py +1 -0
- giantlayers-0.1.0/src/giantlayers/atmos/cli.py +411 -0
- giantlayers-0.1.0/src/giantlayers/atmos/continuum.py +449 -0
- giantlayers-0.1.0/src/giantlayers/atmos/export.py +107 -0
- giantlayers-0.1.0/src/giantlayers/atmos/hydrogen.py +143 -0
- giantlayers-0.1.0/src/giantlayers/atmos/linelists.py +234 -0
- giantlayers-0.1.0/src/giantlayers/atmos/linetables.py +299 -0
- giantlayers-0.1.0/src/giantlayers/atmos/model.py +790 -0
- giantlayers-0.1.0/src/giantlayers/atmos/opacity.py +250 -0
- giantlayers-0.1.0/src/giantlayers/atmos/startgrid.py +84 -0
- giantlayers-0.1.0/src/giantlayers/atmos/transfer.py +427 -0
- giantlayers-0.1.0/src/giantlayers/atmos/xsec.py +51 -0
- giantlayers-0.1.0/src/giantlayers/audit_resolution.py +116 -0
- giantlayers-0.1.0/src/giantlayers/benchmark_sampling.py +86 -0
- giantlayers-0.1.0/src/giantlayers/cli.py +659 -0
- giantlayers-0.1.0/src/giantlayers/collision_induced.py +94 -0
- giantlayers-0.1.0/src/giantlayers/compare_atmospheres.py +58 -0
- giantlayers-0.1.0/src/giantlayers/compare_marcs_chemistry.py +72 -0
- giantlayers-0.1.0/src/giantlayers/compare_marcs_flux.py +101 -0
- giantlayers-0.1.0/src/giantlayers/data/__init__.py +1 -0
- giantlayers-0.1.0/src/giantlayers/data/atmos_startgrid.npz +0 -0
- giantlayers-0.1.0/src/giantlayers/data/atmos_template.dat +57 -0
- giantlayers-0.1.0/src/giantlayers/data/atmos_template_3000.dat +57 -0
- giantlayers-0.1.0/src/giantlayers/data/atmos_template_3500.dat +57 -0
- giantlayers-0.1.0/src/giantlayers/data/atmos_template_5000_g0.dat +57 -0
- giantlayers-0.1.0/src/giantlayers/data/atmos_template_cstar.dat +57 -0
- giantlayers-0.1.0/src/giantlayers/data/barklem_collet.json +127 -0
- giantlayers-0.1.0/src/giantlayers/data/continuum/CIA.H-He.dat +49 -0
- giantlayers-0.1.0/src/giantlayers/data/continuum/CIA.H2-H.dat +73 -0
- giantlayers-0.1.0/src/giantlayers/data/continuum/CIA.H2-H2.Yi.dat +1006 -0
- giantlayers-0.1.0/src/giantlayers/data/continuum/CIA.H2-He.dat +248 -0
- giantlayers-0.1.0/src/giantlayers/data/continuum/ionization_energies.dat +95 -0
- giantlayers-0.1.0/src/giantlayers/data/continuum/jonabs_vac_v07.3.dat +4477 -0
- giantlayers-0.1.0/src/giantlayers/depth_refinement.py +80 -0
- giantlayers-0.1.0/src/giantlayers/examples/__init__.py +1 -0
- giantlayers-0.1.0/src/giantlayers/examples/continuum-wavelengths.dat +81 -0
- giantlayers-0.1.0/src/giantlayers/examples/solar-gs98.json +94 -0
- giantlayers-0.1.0/src/giantlayers/exomol_import.py +115 -0
- giantlayers-0.1.0/src/giantlayers/gray_atmosphere.py +98 -0
- giantlayers-0.1.0/src/giantlayers/hminus.py +106 -0
- giantlayers-0.1.0/src/giantlayers/kernel_module.c +15 -0
- giantlayers-0.1.0/src/giantlayers/kurucz_atomic_lines.py +79 -0
- giantlayers-0.1.0/src/giantlayers/lte_chemistry.py +411 -0
- giantlayers-0.1.0/src/giantlayers/lte_opacity.py +296 -0
- giantlayers-0.1.0/src/giantlayers/marcs_atomic_lines.py +60 -0
- giantlayers-0.1.0/src/giantlayers/marcs_model.py +70 -0
- giantlayers-0.1.0/src/giantlayers/marcs_opacity.py +66 -0
- giantlayers-0.1.0/src/giantlayers/marcs_writer.py +154 -0
- giantlayers-0.1.0/src/giantlayers/mixing_length.py +243 -0
- giantlayers-0.1.0/src/giantlayers/molecular_cross_section.py +92 -0
- giantlayers-0.1.0/src/giantlayers/native_marcs.py +118 -0
- giantlayers-0.1.0/src/giantlayers/native_transfer.py +224 -0
- giantlayers-0.1.0/src/giantlayers/nonlinear_atmosphere.py +139 -0
- giantlayers-0.1.0/src/giantlayers/odf_transfer.py +269 -0
- giantlayers-0.1.0/src/giantlayers/opacity_table.py +66 -0
- giantlayers-0.1.0/src/giantlayers/profile_plot.py +51 -0
- giantlayers-0.1.0/src/giantlayers/spherical_heating.py +1071 -0
- giantlayers-0.1.0/src/giantlayers/spherical_hydrostatic.py +213 -0
- giantlayers-0.1.0/src/giantlayers/spherical_kernel.c +179 -0
- giantlayers-0.1.0/src/giantlayers/spherical_kernel.py +44 -0
- giantlayers-0.1.0/src/giantlayers/spherical_kernel_loader.py +58 -0
- giantlayers-0.1.0/src/giantlayers/spherical_transfer.py +155 -0
- giantlayers-0.1.0/src/giantlayers/transfer_cache.py +66 -0
- giantlayers-0.1.0/src/giantlayers/two_group_atmosphere.py +145 -0
- giantlayers-0.1.0/src/giantlayers.egg-info/PKG-INFO +58 -0
- giantlayers-0.1.0/src/giantlayers.egg-info/SOURCES.txt +110 -0
- giantlayers-0.1.0/src/giantlayers.egg-info/dependency_links.txt +1 -0
- giantlayers-0.1.0/src/giantlayers.egg-info/entry_points.txt +3 -0
- giantlayers-0.1.0/src/giantlayers.egg-info/requires.txt +12 -0
- giantlayers-0.1.0/src/giantlayers.egg-info/top_level.txt +1 -0
- giantlayers-0.1.0/tests/__init__.py +0 -0
- giantlayers-0.1.0/tests/check_wheel.py +45 -0
- giantlayers-0.1.0/tests/test_adaptive_jacobian.py +17 -0
- giantlayers-0.1.0/tests/test_atlas_writer.py +84 -0
- giantlayers-0.1.0/tests/test_atmos.py +188 -0
- giantlayers-0.1.0/tests/test_audit_resolution.py +22 -0
- giantlayers-0.1.0/tests/test_bottom_flux_bracket.py +36 -0
- giantlayers-0.1.0/tests/test_compare_marcs_flux.py +21 -0
- giantlayers-0.1.0/tests/test_exomol_doppler_kernel.py +31 -0
- giantlayers-0.1.0/tests/test_exomol_import.py +15 -0
- giantlayers-0.1.0/tests/test_mixing_length.py +59 -0
- giantlayers-0.1.0/tests/test_molecular_cross_section.py +32 -0
- giantlayers-0.1.0/tests/test_native_atmosphere.py +253 -0
- giantlayers-0.1.0/tests/test_spherical_hydrostatic.py +53 -0
- giantlayers-0.1.0/tests/test_spherical_transfer.py +278 -0
- giantlayers-0.1.0/tests/test_transfer_cache.py +35 -0
- giantlayers-0.1.0/tools/exomol_doppler.c +89 -0
- giantlayers-0.1.0/tools/exomol_doppler.py +101 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 David Nidever
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: giantlayers
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Experimental spherical LTE model atmospheres for cool giant stars
|
|
5
|
+
Home-page: https://github.com/dnidever/giantlayers
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Documentation, https://giantlayers.readthedocs.io/
|
|
8
|
+
Project-URL: Issues, https://github.com/dnidever/giantlayers/issues
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
12
|
+
Requires-Python: >=3.9
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Provides-Extra: atmos
|
|
16
|
+
Requires-Dist: numba>=0.57; extra == "atmos"
|
|
17
|
+
Requires-Dist: pandas; extra == "atmos"
|
|
18
|
+
Requires-Dist: scipy; extra == "atmos"
|
|
19
|
+
Requires-Dist: h5py; extra == "atmos"
|
|
20
|
+
Provides-Extra: exomol
|
|
21
|
+
Requires-Dist: h5py; extra == "exomol"
|
|
22
|
+
Provides-Extra: plot
|
|
23
|
+
Requires-Dist: matplotlib>=3.6; extra == "plot"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# GiantLayers
|
|
27
|
+
|
|
28
|
+
GiantLayers is an experimental spherical LTE stellar atmosphere solver for cool giants. It starts from effective temperature, surface gravity, stellar mass, and an elemental abundance mixture. The solver couples hydrostatic structure, LTE chemistry, wavelength-dependent radiative transfer with continuum scattering, and mixing-length convection. It writes a CSV with the luminosity residual at each layer and can export MARCS, ATLAS9, and ATLAS12 atmosphere files.
|
|
29
|
+
|
|
30
|
+
## Install and run
|
|
31
|
+
|
|
32
|
+
GiantLayers requires Python 3.9 or later. Install the alpha release from PyPI with `python -m pip install --pre giantlayers`. To install a repository checkout, use `python -m pip install .`.
|
|
33
|
+
|
|
34
|
+
Binary wheels use the included C transfer kernel automatically, with no compiler required to install or run the wheel. Use `--python-kernel` to select Python transfer or `--kernel PATH` for a custom shared library. On platforms without a matching binary wheel, pip can install the universal wheel and GiantLayers uses Python transfer.
|
|
35
|
+
|
|
36
|
+
The package includes a small solar-composition example. Run it from any directory after installing.
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
EXAMPLE_DIR=$(python -c "from importlib.resources import files; print(files('giantlayers.examples'))")
|
|
40
|
+
giantlayers "$EXAMPLE_DIR/continuum-wavelengths.dat" "$EXAMPLE_DIR/solar-gs98.json" \
|
|
41
|
+
--teff 3500 --logg 1 --mass 1 --layers 12 --upper-knots 4 \
|
|
42
|
+
--steps 1 --output-model trial.mod > trial.csv
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
This continuum-only example exercises the solver and exporter. For a line-blanketed calculation, provide an atomic transition CSV with `--lines` and molecular cross sections with repeatable `--molecular-cross-section` options. The output identifies unconverged profiles. Check the maximum luminosity error and sensitivity to wavelength and depth resolution before using a model.
|
|
46
|
+
|
|
47
|
+
See the [Quickstart](docs/quickstart.md) for installation and export, and [Advanced usage](docs/advanced.md) for opacity preparation and solver diagnostics. The gray Eddington benchmark is available through `python -m giantlayers.gray_atmosphere`. Run the regression tests with `python -m unittest discover`.
|
|
48
|
+
|
|
49
|
+
## MARCS-like opacity-sampling solver
|
|
50
|
+
|
|
51
|
+
`giantlayers-atmos` (package `giantlayers.atmos`) computes MARCS-like models on the MARCS Rosseland grid. It uses opacity sampling with per-species line tables, the MARCS continuum package, spherical transfer with variable Eddington factors, Henyey convection and a Newton temperature correction. Install it with `pip install .[atmos]`. Over log τ_R −4 to 0 its models are within 12–32 K RMS of MARCS for 3500–5000 K giants. See [docs/atmos.md](docs/atmos.md).
|
|
52
|
+
|
|
53
|
+
## Documentation
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
python3 -m pip install -r docs/requirements.txt
|
|
57
|
+
python3 -m mkdocs serve
|
|
58
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# GiantLayers
|
|
2
|
+
|
|
3
|
+
GiantLayers is an experimental spherical LTE stellar atmosphere solver for cool giants. It starts from effective temperature, surface gravity, stellar mass, and an elemental abundance mixture. The solver couples hydrostatic structure, LTE chemistry, wavelength-dependent radiative transfer with continuum scattering, and mixing-length convection. It writes a CSV with the luminosity residual at each layer and can export MARCS, ATLAS9, and ATLAS12 atmosphere files.
|
|
4
|
+
|
|
5
|
+
## Install and run
|
|
6
|
+
|
|
7
|
+
GiantLayers requires Python 3.9 or later. Install the alpha release from PyPI with `python -m pip install --pre giantlayers`. To install a repository checkout, use `python -m pip install .`.
|
|
8
|
+
|
|
9
|
+
Binary wheels use the included C transfer kernel automatically, with no compiler required to install or run the wheel. Use `--python-kernel` to select Python transfer or `--kernel PATH` for a custom shared library. On platforms without a matching binary wheel, pip can install the universal wheel and GiantLayers uses Python transfer.
|
|
10
|
+
|
|
11
|
+
The package includes a small solar-composition example. Run it from any directory after installing.
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
EXAMPLE_DIR=$(python -c "from importlib.resources import files; print(files('giantlayers.examples'))")
|
|
15
|
+
giantlayers "$EXAMPLE_DIR/continuum-wavelengths.dat" "$EXAMPLE_DIR/solar-gs98.json" \
|
|
16
|
+
--teff 3500 --logg 1 --mass 1 --layers 12 --upper-knots 4 \
|
|
17
|
+
--steps 1 --output-model trial.mod > trial.csv
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
This continuum-only example exercises the solver and exporter. For a line-blanketed calculation, provide an atomic transition CSV with `--lines` and molecular cross sections with repeatable `--molecular-cross-section` options. The output identifies unconverged profiles. Check the maximum luminosity error and sensitivity to wavelength and depth resolution before using a model.
|
|
21
|
+
|
|
22
|
+
See the [Quickstart](docs/quickstart.md) for installation and export, and [Advanced usage](docs/advanced.md) for opacity preparation and solver diagnostics. The gray Eddington benchmark is available through `python -m giantlayers.gray_atmosphere`. Run the regression tests with `python -m unittest discover`.
|
|
23
|
+
|
|
24
|
+
## MARCS-like opacity-sampling solver
|
|
25
|
+
|
|
26
|
+
`giantlayers-atmos` (package `giantlayers.atmos`) computes MARCS-like models on the MARCS Rosseland grid. It uses opacity sampling with per-species line tables, the MARCS continuum package, spherical transfer with variable Eddington factors, Henyey convection and a Newton temperature correction. Install it with `pip install .[atmos]`. Over log τ_R −4 to 0 its models are within 12–32 K RMS of MARCS for 3500–5000 K giants. See [docs/atmos.md](docs/atmos.md).
|
|
27
|
+
|
|
28
|
+
## Documentation
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
python3 -m pip install -r docs/requirements.txt
|
|
32
|
+
python3 -m mkdocs serve
|
|
33
|
+
```
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
# Advanced usage
|
|
2
|
+
|
|
3
|
+
The [Quickstart](quickstart.md) shows how to build a spherical atmosphere from stellar parameters. Use these workflows to prepare opacity inputs, compare against reference atmospheres, or isolate individual parts of the solve. Commands that take a MARCS model as input are diagnostics or comparisons on a supplied structure.
|
|
4
|
+
|
|
5
|
+
## Run with a two-group opacity table
|
|
6
|
+
|
|
7
|
+
The nonlinear prototype can read both mass opacities from a CSV file.
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
python -m giantlayers.nonlinear_atmosphere --opacity-table opacities.csv > atmosphere.csv
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Use the following header and provide one row for each temperature–pressure pair on a complete rectangular grid with at least two values on each axis. All input values must be positive and finite. Opacities are in cm²/g.
|
|
14
|
+
|
|
15
|
+
```csv
|
|
16
|
+
temperature_K,pressure_dyn_cm2,group1_opacity_cm2_g,group2_opacity_cm2_g
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The solver interpolates in log temperature, log pressure, and log opacity. Pressures below the lowest grid point, including the vacuum surface, use the lowest-pressure row. A temperature outside the table or a pressure above its upper limit stops the run. Make sure the table covers the temperatures encountered during iteration as well as the final profile.
|
|
20
|
+
|
|
21
|
+
The two groups retain equal Planck weights. Tables supplied here should contain the group means appropriate to that simplified model.
|
|
22
|
+
|
|
23
|
+
## Compare with a MARCS atmosphere
|
|
24
|
+
|
|
25
|
+
Use a matching MARCS model structure, continuum table, and sampled surface flux from the same grid point. Keep the published MARCS wavelength grid alongside the flux file. [MARCS downloads](https://marcs.astro.uu.se/data.html) · [File formats and wavelength grid](https://marcs.astro.uu.se/docs.html)
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
python -m giantlayers.odf_transfer p00big2.bdf --marcs-model model.mod.gz \
|
|
29
|
+
--marcs-continuum model.opa.gz > bands.csv
|
|
30
|
+
python -m giantlayers.compare_marcs_flux bands.csv flx_wavelengths.vac.gz model.flx.gz > comparison.csv
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
GiantLayers uses the MARCS true continuum absorption with ATLAS9 line opacity on the fixed temperature and pressure structure. The transfer uses plane-parallel two-stream geometry. Add `--continuum-scattering` to include isotropic coherent scattering from the MARCS table. The comparison integrates published flux samples only over bands fully covered by the MARCS wavelength grid.
|
|
34
|
+
|
|
35
|
+
### Inspect radiative heating
|
|
36
|
+
|
|
37
|
+
Add `--heating-output heating.csv` to write the heating profile while keeping the band flux CSV on standard output. The profile includes column mass, local net heating per gram, integrated heating in each depth cell, and net outward radiative flux. A positive heating rate means the matter absorbs more energy than it emits. The diagnostic uses the conservative two-stream solver and prints the closure error between the summed cell heating and the change in radiative flux across the atmosphere.
|
|
38
|
+
|
|
39
|
+
## Write a MARCS atmosphere file
|
|
40
|
+
|
|
41
|
+
The exporter writes a complete MARCS model as plain text or gzip. The command below reads an existing model and re-exports its header, 92 elemental abundances, structure, thermodynamics, and partial pressures.
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
python -m giantlayers.marcs_writer input.mod.gz output.mod
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
From Python, call `marcs_writer.write_document(model, path)` with a complete `MarcsDocument`. Supply every table and the abundance pattern for the same physical model. The gray and two-group CSV outputs contain only a subset of the fields required for export.
|
|
48
|
+
|
|
49
|
+
## Calculate opacities for a custom composition
|
|
50
|
+
|
|
51
|
+
Run the native LTE opacity solver with Python 3.9 or later. It uses the Python standard library and the thermochemistry data included in the checkout.
|
|
52
|
+
|
|
53
|
+
Save a composition as JSON. The optional metal offset shifts every element heavier than helium in dex relative to the input MARCS atmosphere. Individual values override the shifted abundances on the absolute scale where hydrogen is 12.
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"metallicity_offset": -0.3,
|
|
58
|
+
"log_epsilon": {"C": 8.72, "N": 7.92, "O": 8.83}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Supply a transition CSV with vacuum wavelength in Å, species, lower excitation energy in eV, and log gf. Use element symbols for neutral atoms, append `+` for singly ionized atoms, and use formulas such as `CO` for molecules. An optional `damping_s` column supplies the total Lorentz damping rate in s⁻¹. With no damping rate, the profile is Doppler broadened.
|
|
63
|
+
|
|
64
|
+
```csv
|
|
65
|
+
wavelength_vacuum_A,species,lower_energy_eV,log_gf
|
|
66
|
+
15570.299575,CO,6.996,-6.129123
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
python -m giantlayers.lte_opacity model.mod.gz transitions.csv mixture.json 15570 15585 0.05 opacity.csv --vmic 2
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The reference MARCS structure supplies the temperature and gas pressure. The solver recomputes the mass density, electron density and species populations at each layer. The output contains sampled line absorption, continuum absorption, and continuum scattering in cm²/g. For isotopologue lines, include the isotopic fraction in the oscillator strength used in the transition CSV.
|
|
74
|
+
|
|
75
|
+
The bundled data cover 1,000–10,000 K and include neutral atoms, first ions, H⁻, 20 neutral diatomic molecules, and H₂O. Water equilibrium uses the NASA Glenn data through 6,000 K. Continuum terms include H⁻ bound-free and free-free absorption, hydrogenic H I bound-free absorption, electron–ion free-free absorption, and Thomson scattering. The hydrogenic continuum terms use unit Gaunt factors. Additional polyatomic and charged molecules, higher ionization stages, metal photoionization, and calculated collisional line damping are future extensions.
|
|
76
|
+
|
|
77
|
+
[Atomic and diatomic thermochemistry data](https://doi.org/10.1051/0004-6361/201526961) · [H⁻ continuum data in the ATLAS9 HMINOP routine](https://wwwuser.oats.inaf.it/fiorella.castelli/sources/atlas9g/atlas9mem.for) · [APOGEE DR17 line data reference](https://ui.adsabs.harvard.edu/abs/2021AJ....161..254S/abstract)
|
|
78
|
+
|
|
79
|
+
### Evaluate radiative heating with native opacities
|
|
80
|
+
|
|
81
|
+
Provide a text file containing increasing vacuum wavelengths in Å. The transfer uses the same grid for all layers and integrates in frequency using trapezoidal weights. Include broad wavelength coverage and enough samples to resolve the lines when interpreting the result as a bolometric energy balance.
|
|
82
|
+
|
|
83
|
+
```sh
|
|
84
|
+
python -m giantlayers.native_transfer model.mod.gz transitions.csv mixture.json wavelengths.txt heating.csv
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Add `--adjust-layers 6 --steps 3` to try up to three damped temperature corrections in the outermost six layers. Gas pressure and column mass stay fixed. Each trial recomputes LTE equilibrium, opacity, and transfer, and is accepted only if it reduces the maximum outer-layer net heating relative to thermal emission. Deeper layers supply a fixed lower structure.
|
|
88
|
+
|
|
89
|
+
The CSV reports initial and corrected temperature, radiative flux, local heating, and integrated cell heating. These corrections are a radiative test on a fixed pressure structure. A converged atmosphere also requires adequate opacity coverage, a flux constraint, and treatment of convective energy transport.
|
|
90
|
+
|
|
91
|
+
### Use the fiducial cool giant
|
|
92
|
+
|
|
93
|
+
Use the spherical MARCS GS98 model at 3,500 K, log g 1.0, one solar mass, and 2 km/s microturbulence for the cool-giant benchmark. The model header reports [Fe/H] = +0.05 and [α/Fe] = +0.11 on the MARCS reference scale.
|
|
94
|
+
|
|
95
|
+
Extract this member from the MARCS GS98 structure archive. Use an empty JSON object for the published abundance pattern. [MARCS GS98 archive](https://marcs.astro.uu.se/data.html)
|
|
96
|
+
|
|
97
|
+
```text
|
|
98
|
+
s3500_g+1.0_m1.0_t02_gs_z+0.05_a+0.11_c+0.08_n+0.09_o+0.12_r+0.00_s+0.00.mod.gz
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The energy-balance CSV includes the radiative flux, published MARCS convective contribution, and total flux error at each depth. The reference flux is scaled by the inverse square of the model radius for spherical models. The transfer still uses plane-parallel geometry. Add `--flux-guard` to a temperature trial to reject steps that reduce the local heating imbalance while worsening the surface flux error. The diagnostic keeps the MARCS convective flux fixed.
|
|
102
|
+
|
|
103
|
+
### Add tabulated TiO and water absorption
|
|
104
|
+
|
|
105
|
+
Both native opacity and transfer commands accept repeatable `--molecular-cross-section FILE` options. A portable JSON or gzip-compressed JSON table has the following fields.
|
|
106
|
+
|
|
107
|
+
| Field | Contents |
|
|
108
|
+
| --- | --- |
|
|
109
|
+
| `species` | Chemistry species such as `TiO` or `H2O` |
|
|
110
|
+
| `isotopologue` | Optional data identifier |
|
|
111
|
+
| `isotope_fraction` | Fraction of the parent species represented by the table. Defaults to 1. |
|
|
112
|
+
| `temperature_K`, `pressure_dyn_cm2`, `wavelength_vacuum_A` | Increasing grid axes |
|
|
113
|
+
| `cross_section_cm2` | Three-dimensional array ordered by temperature, pressure, and wavelength. Values are in cm² per isotopologue. |
|
|
114
|
+
|
|
115
|
+
The code scales each cross section by the molecule population and isotope fraction. It interpolates in temperature, log pressure, and wavelength, using endpoint temperature or pressure values outside those axes. Wavelengths outside the table contribute zero absorption. Represent each isotopologue once by choosing either its cross section or its transitions on overlapping wavelengths.
|
|
116
|
+
|
|
117
|
+
The first fiducial experiment sampled ExoMol ToTo and POKAZATEL cross sections over 0.3–50 μm on a 2,200–3,400 K grid. Deeper, hotter layers use the hottest tabulated cross section for each molecule that remains in the chemistry calculation. Use the same wavelength grid when comparing runs. [TiO ToTo](https://exomol.com/data/data-types/opacity/TiO/48Ti-16O/Toto/) · [H₂O POKAZATEL](https://zenodo.org/records/5722861) · [NASA Glenn thermochemistry](https://ntrs.nasa.gov/citations/20020085330)
|
|
118
|
+
|
|
119
|
+
### Check wavelength sampling
|
|
120
|
+
|
|
121
|
+
Run the sampling benchmark with cross-section tables on a common wavelength axis. It keeps the reference atmosphere fixed and reports surface flux, the maximum total-flux error with depth, and the heating/flux closure error on each nested grid. Supply any additional wavelengths outside the tabulated range or in line windows through `--supplemental-wavelengths`.
|
|
122
|
+
|
|
123
|
+
```sh
|
|
124
|
+
python -m giantlayers.benchmark_sampling model.mod.gz transitions.csv mixture.json tio.json.gz h2o.json.gz --strides 4 2 1 > sampling.csv
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
For expanded optical and infrared coverage, include ExoMol HyVO and Li2015 CO tables on the same grid. If the CO table replaces the explicit CO transitions, remove those transitions from the input CSV. A header-only transition CSV is valid when using cross sections alone. These files add molecular opacity over the common sampled range and inherit the temperature and pressure coverage of the source tables. [VO HyVO](https://exomol.com/data/molecules/VO/51V-16O/HyVO/) · [CO Li2015](https://www.exomol.com/data/molecules/CO/12C-16O/Li2015/)
|
|
128
|
+
|
|
129
|
+
### Run on the published MARCS wavelength grid
|
|
130
|
+
|
|
131
|
+
Pass the published vacuum grid directly to native transfer with `--quadrature wavelength`. The reader accepts the original gzip file, and the transfer processes the opacity in wavelength blocks while retaining quadrature weights across block boundaries.
|
|
132
|
+
|
|
133
|
+
```sh
|
|
134
|
+
python -m giantlayers.native_transfer model.mod.gz transitions.csv mixture.json flx_wavelengths.vac.gz full-grid.csv --quadrature wavelength --molecular-cross-section tio.json.gz
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
To compare coarse startup sampling with the full published grid, pass the same input file to the sampling benchmark. Stride 10 retains every tenth sample and both endpoints. Stride 1 uses all 100,724 wavelengths.
|
|
138
|
+
|
|
139
|
+
```sh
|
|
140
|
+
python -m giantlayers.benchmark_sampling model.mod.gz transitions.csv mixture.json tio.json.gz --reference-wavelengths flx_wavelengths.vac.gz --strides 10 1 --quadrature wavelength > marcs-sampling.csv
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Use the native-resolution opacity tables when comparing the grids. The transfer evaluates the available opacities at the MARCS sample positions. This matches the published wavelength axis and the wavelength integration convention. The geometry, opacity inventory, and convection model also affect how closely the calculated atmosphere reproduces MARCS. [MARCS wavelength download](https://marcs.astro.uu.se/docs.html) · [MARCS methods](https://arxiv.org/abs/0805.0554)
|
|
144
|
+
|
|
145
|
+
### Compare spherical and plane-parallel surface transfer
|
|
146
|
+
|
|
147
|
+
Convert the published MARCS oscillator-strength revisions from VALD air wavelengths into the native vacuum-wavelength transition format. These files provide a subset of the atomic lines used by MARCS. The converted transitions use Doppler broadening. [MARCS auxiliary atomic data](https://marcs.astro.uu.se/docs.html#Auxiliary)
|
|
148
|
+
|
|
149
|
+
```sh
|
|
150
|
+
python -m giantlayers.marcs_atomic_lines astroph_gfVALD1.dat astroph_gfVALD2.dat > revised-atomic-lines.csv
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
An atomic transition CSV can supply `damping_s` for a density-independent Lorentz damping rate in s⁻¹. Add `electron_damping_cm3_s` and `neutral_h_damping_cm3_s` for rate coefficients at 10,000 K. The optional `electron_damping_exponent` and `neutral_h_damping_exponent` multiply those coefficients by a power of `T / 10,000 K`. GiantLayers multiplies each coefficient by its local perturber number density and adds the three rates before computing the line profile. Missing coefficients and exponents default to zero. Convert logarithmic coefficients to linear units when preparing the CSV.
|
|
154
|
+
|
|
155
|
+
Convert a Kurucz wavelength-format GFALL or per-ion `.pos` list with `python -m giantlayers.kurucz_atomic_lines gf2600.pos --wavelength-nm 400 700 > iron.csv`. The converter accepts neutral and singly ionized atoms and uses the rates supplied in the line records. It assumes temperature-independent electron coefficients and a neutral H exponent of 0.3 for this conversion. Use `--vacuum` for a list supplied entirely in vacuum or `--doppler-only` for a coverage-only comparison. When combining line lists, replace overlapping transitions to avoid counting them twice.
|
|
156
|
+
|
|
157
|
+
Use a spherical model and the same opacity inputs to compare surface transfer in both geometries. Pass several `--molecular-cross-section` options to include multiple absorbers. The spherical solver traces rays through atmospheric shells and integrates the emergent intensity over the apparent disk. The plane-parallel case uses the same surface angles and quadrature weights. Both modes use LTE true absorption and fixed temperatures and gas pressures for this benchmark.
|
|
158
|
+
|
|
159
|
+
```sh
|
|
160
|
+
python -m giantlayers.spherical_transfer model.mod.gz revised-atomic-lines.csv mixture.json flx_wavelengths.vac.gz --stride 50 --core-rays 24 --molecular-cross-section tio.json.gz > spherical-comparison.csv
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
The CSV contains monochromatic surface fluxes per Hz and frequency weights. The printed spherical ratio normalizes the flux to the MARCS reference radius. The planar ratio uses the corresponding target flux at the outer boundary. Reduce `--stride` and increase `--core-rays` to test sensitivity to the wavelength and ray grids.
|
|
164
|
+
|
|
165
|
+
### Compute spherical heating with scattering
|
|
166
|
+
|
|
167
|
+
Use the same spherical model and opacity inputs with the depth-resolved solver. It iterates the isotropic coherent continuum scattering source on the shared impact-parameter rays. Net heating is calculated from true absorption and the difference between the mean intensity and the LTE Planck function. Use `--absorption-only` to isolate the effect of scattering.
|
|
168
|
+
|
|
169
|
+
```sh
|
|
170
|
+
python -m giantlayers.spherical_heating model.mod.gz revised-atomic-lines.csv mixture.json flx_wavelengths.vac.gz --stride 100 --core-rays 24 --molecular-cross-section tio.json.gz > spherical-heating.csv
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
The CSV reports integrated radiative flux, luminosity, and pointwise true-absorption heating at each layer. The shell columns give the mean net heating and energy gain between the current layer and the next deeper layer, calculated from the luminosity difference and shell mass. Positive heating means the gas gains energy. The shell values balance the luminosity change by construction. Standard error reports how far a separate trapezoidal integration of the pointwise rates departs from that budget. Use that difference to assess whether pointwise heating is suitable for a temperature update. The MARCS temperature, pressure, and convection profiles are held fixed.
|
|
174
|
+
|
|
175
|
+
### Try spherical temperature corrections
|
|
176
|
+
|
|
177
|
+
Add `--adjust-layers 3 --steps 2` to the spherical heating command to try two damped temperature corrections in the outer three layers. Each trial recomputes LTE chemistry, opacities, and spherical scattering. The correction uses finite differences to reduce the change in radiative plus convective luminosity across the selected shells. The deeper temperature profile, radii, gas pressure and published MARCS convective contribution stay fixed.
|
|
178
|
+
|
|
179
|
+
The solver reports the maximum outer-shell luminosity residual and the surface total-flux error separately. The correction targets local shell balance. Fitting the absolute emergent flux requires a separate constraint. The CSV includes the initial and corrected temperature.
|
|
180
|
+
|
|
181
|
+
### Fit the absolute luminosity and check the full wavelength grid
|
|
182
|
+
|
|
183
|
+
Add `--luminosity-target` to fit the MARCS surface luminosity alongside the outer-shell luminosity differences. The correction adds one smooth temperature mode centered at Rosseland optical depth one. It tapers to zero at log optical depths −1.5 and +1.5. Gas pressure, radii, and the reference convective flux stay fixed.
|
|
184
|
+
|
|
185
|
+
With a coarse startup stride, `--verify-full` reevaluates the accepted profile on every input wavelength and writes the full-grid diagnostics. The verification holds the accepted temperatures fixed. For larger runs, the optional C99 kernel accelerates the ray solve while chemistry and opacity remain in Python.
|
|
186
|
+
|
|
187
|
+
The main `giantlayers` command automatically uses the C kernel when installed from a binary wheel. The commands below compile a custom library from a source checkout for the heating diagnostic, which takes an explicit `--kernel` path.
|
|
188
|
+
|
|
189
|
+
```sh
|
|
190
|
+
cc -O3 -std=c99 -shared -fPIC src/giantlayers/spherical_kernel.c -o spherical_kernel.so -lm
|
|
191
|
+
python -m giantlayers.spherical_heating model.mod.gz revised-atomic-lines.csv mixture.json flx_wavelengths.vac.gz --stride 400 --adjust-layers 3 --steps 5 --luminosity-target --verify-full --kernel ./spherical_kernel.so --molecular-cross-section tio.json.gz > luminosity-check.csv
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Solve pressure and radius on a fixed temperature profile
|
|
195
|
+
|
|
196
|
+
Run the spherical hydrostatic benchmark on a MARCS reference model.
|
|
197
|
+
|
|
198
|
+
```sh
|
|
199
|
+
python -m giantlayers.spherical_hydrostatic model.mod.gz > hydrostatic.csv
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
The benchmark takes the temperature, composition, and outer gas pressure from MARCS. It integrates the published density over radial distance to define a comparison column-mass grid. GiantLayers then computes its own gas pressure, density, and radius at each depth using spherical gravity and its native LTE equation of state. The reference radius is set by the input mass and gravity at the layer with Rosseland optical depth one. This version solves gas-pressure balance. Radiation and turbulent pressure are outside that equation.
|
|
203
|
+
|
|
204
|
+
The Python `solve` function also accepts a radial column-mass grid and boundary values supplied independently of MARCS.
|
|
205
|
+
|
|
206
|
+
### Compare transfer after hydrostatic reconstruction
|
|
207
|
+
|
|
208
|
+
Add `--hydrostatic` to the spherical heating command to rebuild pressure, electron pressure, density, and radii before evaluating transfer. The reconstruction and transfer use the same input abundance pattern. The temperatures and reference convective fractions stay fixed. Run the command with and without the option using identical wavelength, line, and cross-section inputs to isolate the effect of hydrostatic reconstruction.
|
|
209
|
+
|
|
210
|
+
The reconstructed CSV reports radial column mass measured from the upper boundary. The original comparison reports the model's published column mass. Match rows by layer index. The reconstructed radius at Rosseland depth one follows the input mass and gravity, so its reference luminosity normalization uses that radius.
|
|
211
|
+
|
|
212
|
+
### Couple the hydrostatic and temperature updates
|
|
213
|
+
|
|
214
|
+
Combine `--hydrostatic` with `--adjust-layers` to solve hydrostatic balance before each temperature trial, including the finite-difference perturbations and the line-search evaluations. The original radial mass grid, surface gas pressure, stellar mass, and gravity define the boundary throughout the run. Each trial recomputes pressure, electron pressure, density, radius, opacities, and scattering. With `--luminosity-target`, it also fits the target at the reconstructed reference radius.
|
|
215
|
+
|
|
216
|
+
```sh
|
|
217
|
+
python -m giantlayers.spherical_heating model.mod.gz revised-atomic-lines.csv mixture.json flx_wavelengths.vac.gz --hydrostatic --adjust-layers 3 --steps 2 --luminosity-target --stride 400 --molecular-cross-section tio.json.gz > coupled-trial.csv
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
The output includes the updated temperatures and hydrostatic structure. The Rosseland layer labels and convective luminosity fractions are carried over from MARCS for this benchmark.
|
|
221
|
+
|
|
222
|
+
### Calculate mixing-length convection
|
|
223
|
+
|
|
224
|
+
Run the Henyey mixing-length calculation on the fiducial pressure and temperature profile. GiantLayers computes the logarithmic temperature gradient, estimates the heat capacity and thermal expansion from its native LTE chemistry, and reports the convective velocity and flux beside the MARCS values. The default benchmark uses the published MARCS Rosseland opacities to isolate the convection calculation. [MARCS mixing-length equations](https://arxiv.org/abs/0805.0554)
|
|
225
|
+
|
|
226
|
+
```sh
|
|
227
|
+
python -m giantlayers.mixing_length model.mod.gz > convection.csv
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Pass `--wavelengths flx_wavelengths.vac.gz` to compute the Rosseland mean from GiantLayers opacities. Add the atomic transition list with `--lines` and molecular tables with repeatable `--molecular-cross-section` arguments. Use `--hydrostatic` to evaluate convection on the reconstructed pressure and radius profile. These commands diagnose convection on a fixed temperature structure.
|
|
231
|
+
|
|
232
|
+
In the development version, use `--lte-radiation-pressure` with the standalone `giantlayers.mixing_length` diagnostic to test a total-pressure gradient at Rosseland optical depths of one and greater. In those layers, it evaluates the thermal expansion and enthalpy derivatives at constant gas plus LTE radiation pressure. The diagnostic uses the isotropic LTE approximation for radiation pressure. This option is for fixed-structure comparisons. The coupled atmosphere command uses the gas-pressure formulation.
|
|
233
|
+
|
|
234
|
+
### Recompute convection during the coupled solve
|
|
235
|
+
|
|
236
|
+
Add `--native-convection` to use the Henyey flux in place of the benchmark's published convection. Each trial computes a Rosseland mean from the same line and continuum opacities used by spherical transfer. It then recomputes the convective flux from the trial temperature and gas pressure gradients and the native LTE equation of state.
|
|
237
|
+
|
|
238
|
+
```sh
|
|
239
|
+
python -m giantlayers.spherical_heating model.mod.gz revised-atomic-lines.csv mixture.json flx_wavelengths.vac.gz --hydrostatic --native-convection --adjust-layers 3 --adjust-deep 2 --steps 1 --luminosity-target --stride 400 --molecular-cross-section tio.json.gz > coupled-convection.csv
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
The outer temperature variables target adjacent-shell luminosity balance. The photospheric mode targets absolute surface luminosity, and `--adjust-deep` varies the deepest temperatures individually to target total luminosity at those layers. The solver reports these errors separately. This trial adjusts selected depths and retains the original radial mass grid and outer pressure.
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
### Fit the total luminosity at every layer
|
|
246
|
+
|
|
247
|
+
Use `--global-balance` to solve for the temperature profile with native spherical transfer, hydrostatic balance, and Henyey mixing-length convection. The target is the same total luminosity at every radius. Each trial recomputes the gas structure, chemistry, wavelength-dependent opacities, and radiative and convective fluxes on the input model's radial mass grid. The input mass, gravity, and surface gas pressure set the boundaries.
|
|
248
|
+
|
|
249
|
+
GiantLayers identifies the contiguous region extending inward to the model's deepest layer where convection carries at least 0.01% of the target luminosity. Each layer in that region gets its own temperature variable. Above it, fractional temperature corrections are interpolated in the input model's log Rosseland depth between five control points by default. Change that number with `--upper-knots`. The solver evaluates the total luminosity error at every layer. Its line search accepts a step when the RMS error plus one quarter of the maximum absolute error decreases.
|
|
250
|
+
|
|
251
|
+
```sh
|
|
252
|
+
python -m giantlayers.spherical_heating model.mod.gz revised-atomic-lines.csv mixture.json flx_wavelengths.vac.gz --global-balance --stride 400 --core-rays 24 --steps 1 --kernel ./spherical_kernel.so --molecular-cross-section tio.json.gz > global-luminosity.csv
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
The CSV contains the corrected structure and the relative total-flux error at every layer. Increase `--steps` to attempt additional corrections. For a wavelength-resolution check, add `--verify-full` to reevaluate the resulting profile across the full input wavelength grid.
|
|
256
|
+
|
|
257
|
+
## Control sampling, restarts, and export
|
|
258
|
+
|
|
259
|
+
Use `--stride` to subsample the wavelength grid and repeat `--refine-stride` to solve on denser subsets. `--steps` sets the correction budget per grid. For long runs, `--checkpoint-csv` saves the accepted profile at each step. Use `--restart-csv` with the same mass-grid parameters to resume and `--steps 0` to evaluate the profile without temperature corrections.
|
|
260
|
+
|
|
261
|
+
Use the experimental `--heating-transition-tau 0.01` option to fit local radiative balance at shallower Rosseland depths and total luminosity deeper down. This option replaces `--outer-heating-weight` and retains a surface luminosity constraint. The partition is set at the start of each fitting stage. The final report gives both the luminosity error and the peak normalized heating over the final optically thin layers. With a 100,724-point input grid, `--stride 120 --refine-stride 12 --full-grid-correction` uses about 840 and 8,400 points for successive temperature fits and verifies the result on the full grid. Add a final `--refine-stride 1` to fit on the full grid when that compute cost is practical. [MARCS energy-balance methods](https://www.aanda.org/articles/aa/pdf/2008/30/aa09724-08.pdf)
|
|
262
|
+
|
|
263
|
+
The MARCS-format export contains native thermochemical partial pressures, Rosseland and 5000 Å optical depth, convection, and the calculated gas structure. By default the radius is anchored at the fixed mass coordinate selected from the seed. Use `--photospheric-anchor` to update the reference radius coordinate to the computed Rosseland photosphere. The export uses an isotropic LTE estimate for radiation pressure and zero turbulent pressure. The H₂⁺ column uses the absent-species sentinel, and the Other column sums the unlisted supported molecules. Files with large residuals are labeled unconverged.
|
|
264
|
+
|
|
265
|
+
The ATLAS export includes the input abundance mixture and all native depth points. The title identifies the spherical solution and its luminosity convergence status. The deck stores column mass and omits shell radii. Consumers that require a plane-parallel atmosphere or exactly 72 layers need to account for those assumptions. The `PRADK` field estimates surface radiation pressure from the emergent radiative flux assuming isotropic intensity over the outgoing hemisphere. [Published ATLAS9 grid files](https://wwwuser.oats.inaf.it/fiorella.castelli/grids/gridp00k2odfnew/ap00k2tab.html)
|
|
266
|
+
|
|
267
|
+
Use `--output-atlas trial.dat --atlas-format atlas12` for the Castelli ATLAS12 punch layout. It uses the same `READ DECK6` depth convention with nine columns and includes a separate `ABUNDANCE TABLE` with the model's uniform mixture. The reference ATLAS12 reader supports at most 72 depth points. Give ATLAS12 the uncompressed file with `READ PUNCH`. The export describes the GiantLayers atmosphere and retains its native depth grid. [ATLAS12 source and input examples](https://wwwuser.oats.inaf.it/fiorella.castelli/sources/atlas12.html)
|
|
268
|
+
|
|
269
|
+
## Diagnose radiative equilibrium in the outer layers
|
|
270
|
+
|
|
271
|
+
The native CSV includes the Rosseland mean and the ratio of net radiative heating to LTE thermal emission at each layer. An optically thin layer can have substantial local heating while barely changing the total luminosity. Set `--outer-heating-weight 0.1` to include that local balance in the trial objective. The weight falls exponentially with the initial Rosseland depth on a scale of 0.03. The luminosity status printed by the command is based on total flux. Check the heating column as well when fitting both terms.
|
|
272
|
+
|
|
273
|
+
The continuum includes coherent electron scattering and Rayleigh scattering by H I, H₂, and He I. The Rayleigh terms use long-wavelength expansions on the red side of the first resonance. The transfer solves those opacities with an isotropic coherent source. When accelerated scattering iterations reach their budget, GiantLayers solves the linear source equation directly. [H I cross section](https://adsabs.harvard.edu/pdf/1964ApJ...140.1381S) · [H₂ cross section](https://adsabs.harvard.edu/pdf/1962apj...136..690d) · [He I cross section](https://arxiv.org/abs/1601.01005)
|
|
274
|
+
|
|
275
|
+
## Convert ExoMolOP opacity tables
|
|
276
|
+
|
|
277
|
+
Download a TauREx HDF5 cross-section table for the desired isotopologue and convert it into the JSON format used by the solver. The optional h5py dependency is used by the converter. The transfer command reads the resulting table using Python's standard library.
|
|
278
|
+
|
|
279
|
+
```sh
|
|
280
|
+
python -m pip install --pre 'giantlayers[exomol]'
|
|
281
|
+
python -m giantlayers.exomol_import TiO.xsec.TauREx.h5 tio.json.gz --species TiO \
|
|
282
|
+
--isotope-fraction 0.7372 --temperature-range 2200 3400 --pressure-range 10 10000
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
The output keeps the native wavelength samples in increasing vacuum Å and converts pressure from bar to dyn/cm². The temperature and pressure ranges select tabulated points inclusively. Each selected axis needs at least two points. The solver clamps values outside the supplied temperature and pressure range. Provide tables that cover the line-forming layers and include the contributing isotopologues for your mixture. [ExoMolOP data and formats](https://arxiv.org/abs/2009.00687)
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
## Update the spherical hydrostatic boundary
|
|
289
|
+
|
|
290
|
+
With `--photospheric-anchor`, GiantLayers integrates the native Rosseland opacity through the radial column mass and locates optical depth one between layers. The solver sets the gravity specified by `--logg` at that interpolated radius. The grid must bracket the photosphere.
|
|
291
|
+
|
|
292
|
+
The native CSV also contains the radiative acceleration from the frequency integral of flux times mass extinction divided by the speed of light. With `--radiative-force`, GiantLayers subtracts that acceleration from gravity when it updates gas pressure and the mixing-length pressure scale. The solver requires positive effective gravity on the mass grid. By default, the acceleration is reported and hydrostatic balance uses gravity alone.
|
|
293
|
+
|
|
294
|
+
The optional boundary updates use the latest solved profile between wavelength stages. After the final wavelength stage, GiantLayers iterates the boundary and hydrostatic structure at fixed temperature and reports the resulting luminosity error.
|
|
295
|
+
|
|
296
|
+
## Check depth resolution and compare with a reference
|
|
297
|
+
|
|
298
|
+
In the development version, combine `--deep-layers` with `--deep-grid-power 2` to concentrate the deep points toward the inner boundary while retaining the same number of points and the same depth endpoints. Use `--restart-csv` with `--interpolate-restart` to move a solved temperature profile to a different number of layers. The previous mass grid must cover the new one. For a nested refinement, keep the original grid options and repeat `--refine-mass-at COLUMN` with the interior column masses to insert, in g/cm². This development option preserves the original layers, endpoints, and reference mass anchor. When moving to another stage, retain the masses inserted at earlier stages. GiantLayers recomputes the gas structure and transfer on the new grid. The solver reports how many final layers used molecular cross sections clamped to the edge of their temperature or pressure axes.
|
|
299
|
+
|
|
300
|
+
For a continuation that inserts exactly one new mass, add `--local-refinement-correction COLUMN` with that same value. With `--restart-csv` and `--interpolate-restart`, the solver tries a bounded correction to the inserted temperature and its two neighbors. The sampled fit recomputes both radiative and convective flux and uses the full-grid starting residual for calibration. GiantLayers accepts the seed only if an independent full-grid transfer lowers the maximum luminosity residual. The rest of the temperature profile is held fixed during this local step. Use `--steps 0 --stride 1` to export the locally corrected profile without a subsequent global temperature fit.
|
|
301
|
+
|
|
302
|
+
Compare the exported model with a published model at the same stellar parameters. The comparison interpolates only over the shared Rosseland depth range and reports the temperature difference in kelvin and the pressure differences in dex.
|
|
303
|
+
|
|
304
|
+
```sh
|
|
305
|
+
python -m giantlayers.compare_atmospheres published.mod.gz trial.mod.gz > structure-comparison.csv
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
## Carbon-rich mixtures
|
|
309
|
+
|
|
310
|
+
Change the carbon abundance in the input JSON to set C/O. The native LTE equation of state includes CO, CN, C₂, HCN, and acetylene. HCN and acetylene use NASA Glenn Gibbs energies for the dissociation equilibrium and ExoMol partition functions for explicit line strengths. The tabulated dissociation constants cover 1,000–6,000 K. Above the available partition-function temperatures (4,000 K for HCN and 5,000 K for acetylene), the line-strength partition function uses the closest tabulated value. [NASA Glenn thermochemistry](https://ntrs.nasa.gov/citations/20020085330) · [HCN partition function](https://exomol.com/data/data-types/opacity/HCN/1H-12C-14N/Harris/) · [Acetylene line list](https://academic.oup.com/mnras/article/493/2/1531/5716685)
|
|
311
|
+
|
|
312
|
+
To include carbon-bearing molecular absorption, convert the published CN and C₂ cross sections and add them with `--molecular-cross-section`. The abundance inputs independently set the molecular number densities used to convert the cross sections to mass opacity. [CN MoLLIST](https://www.exomol.com/data/data-types/linelist/CN/12C-14N/MoLLIST-CN/) · [C₂ 8states](https://exomol.com/data/data-types/opacity/C2/12C2/8states/)
|
|
313
|
+
|
|
314
|
+
Use `--adaptive-knots 4` to allow up to four additional temperature controls at layers with large luminosity residuals during each stage. `--peak-error-weight` changes the weight assigned to the maximum residual in the acceptance criterion. The final CSV records the luminosity error of every layer.
|
|
315
|
+
|
|
316
|
+
For mixtures that strongly change the line blanketing, start with reduced line opacity using `--opacity-ramp 0.1 0.5`. GiantLayers solves on the startup wavelength grid at each supplied fraction, then at full line opacity. The continuum and LTE chemistry are evaluated throughout. The optional finer wavelength stages use full opacity.
|
|
317
|
+
|
|
318
|
+
Use `--workers 4` to distribute finite-difference temperature perturbations among processes. For a fixed-profile `--steps 0` or `--verify-full` evaluation, the processes integrate separate wavelength bands and combine the flux, Rosseland moments, and radiative acceleration. Spectrum output uses a serial sweep.
|
|
319
|
+
|
|
320
|
+
Use `--full-grid-correction` to calibrate the last sampled stage against a transfer on the complete input grid. The solver holds the initial difference between the sampled and full-grid luminosity residuals fixed while it computes temperature corrections on the sampled grid. The command then recomputes the final luminosity on the full grid and reports the measured residual.
|
|
321
|
+
|
|
322
|
+
## Export the emergent spectrum
|
|
323
|
+
|
|
324
|
+
Pass `--output-spectrum spectrum.csv` to evaluate the final atmosphere and write the outgoing surface flux on the final wavelength grid. The spectrum reports flux per Hz and per Å at the model's reference radius, plus the integration weight of each sample. Summing flux per Hz times its weight recovers the integrated radiative surface flux at the reference radius.
|
|
325
|
+
|
|
326
|
+
## Add hydrogen and helium collision-induced absorption
|
|
327
|
+
|
|
328
|
+
Download the rectangular H₂–H₂, H₂–He, H₂–H, and He–H files from HITRAN and pass each selected pair with `--cia FILE.cia`. The reader also accepts gzip-compressed tables. It interpolates in temperature and wavenumber, then multiplies the coefficient by the two LTE species number densities and divides by mass density. CIA is continuum absorption and retains its full weight during an opacity ramp. Temperature outside a table's axis uses the nearest tabulated value. Wavenumbers outside the tabulated range contribute zero. [HITRAN CIA files](https://hitran.org/cia/) · [Format and reference data](https://hitran.org/data/CIA/CIA_Readme_2024.pdf)
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
## Use the solver from Python
|
|
332
|
+
|
|
333
|
+
```python
|
|
334
|
+
import json
|
|
335
|
+
from importlib.resources import files
|
|
336
|
+
from giantlayers import initialize
|
|
337
|
+
from giantlayers.native_transfer import read_wavelengths
|
|
338
|
+
from giantlayers.spherical_heating import balance_all_layers
|
|
339
|
+
|
|
340
|
+
examples = files("giantlayers.examples")
|
|
341
|
+
with examples.joinpath("solar-gs98.json").open(encoding="utf-8") as stream:
|
|
342
|
+
abundances = json.load(stream)
|
|
343
|
+
seed, boundary = initialize(3500, 1, 1, abundances, layers=12)
|
|
344
|
+
wavelengths = read_wavelengths(examples.joinpath("continuum-wavelengths.dat"))
|
|
345
|
+
model, diagnostics, history, knots, convective_start = balance_all_layers(
|
|
346
|
+
seed, wavelengths, (), {}, boundary=boundary, core_rays=12, steps=1
|
|
347
|
+
)
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
This example makes one correction with continuum extinction. Pass loaded atomic transitions through the third argument and loaded molecular tables through `tables`. When supplying your own initial seed and boundary, use the same abundance mixture in the structure and opacity calculations.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="660" height="585" viewBox="0 0 660 585" role="img" aria-labelledby="title desc">
|
|
2
|
+
<title id="title">GiantLayers atmosphere solver</title>
|
|
3
|
+
<desc id="desc">Stellar inputs lead to an initial profile. The solver computes structure and chemistry, solves energy transport, and checks luminosity balance. When another iteration is needed, it updates the temperatures and repeats. The final pass reports convergence and writes outputs.</desc>
|
|
4
|
+
<defs>
|
|
5
|
+
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto">
|
|
6
|
+
<path d="M0 0L10 5L0 10z" fill="#315674"/>
|
|
7
|
+
</marker>
|
|
8
|
+
</defs>
|
|
9
|
+
<rect width="660" height="585" rx="14" fill="#f4f8fb"/>
|
|
10
|
+
<g fill="#fff" stroke="#7397b0" stroke-width="1.5">
|
|
11
|
+
<rect x="34" y="24" width="395" height="64" rx="9"/>
|
|
12
|
+
<rect x="34" y="112" width="395" height="64" rx="9"/>
|
|
13
|
+
<rect x="34" y="200" width="395" height="64" rx="9"/>
|
|
14
|
+
<rect x="34" y="288" width="395" height="64" rx="9"/>
|
|
15
|
+
<rect x="34" y="376" width="395" height="64" rx="9"/>
|
|
16
|
+
<rect x="34" y="495" width="395" height="64" rx="9"/>
|
|
17
|
+
<rect x="468" y="288" width="164" height="64" rx="9"/>
|
|
18
|
+
</g>
|
|
19
|
+
<g fill="none" stroke="#315674" stroke-width="2" marker-end="url(#arrow)">
|
|
20
|
+
<path d="M231 88V110"/>
|
|
21
|
+
<path d="M231 176V198"/>
|
|
22
|
+
<path d="M231 264V286"/>
|
|
23
|
+
<path d="M231 352V374"/>
|
|
24
|
+
<path d="M231 440V493"/>
|
|
25
|
+
<path d="M429 408H550V354"/>
|
|
26
|
+
<path d="M550 288V232H431"/>
|
|
27
|
+
</g>
|
|
28
|
+
<g font-family="system-ui, sans-serif" text-anchor="middle" fill="#123047" font-size="20" font-weight="700">
|
|
29
|
+
<text x="231" y="51">Inputs</text>
|
|
30
|
+
<text x="231" y="139">Initial atmosphere</text>
|
|
31
|
+
<text x="231" y="227">Structure and LTE chemistry</text>
|
|
32
|
+
<text x="231" y="315">Spherical energy transport</text>
|
|
33
|
+
<text x="231" y="403">Check luminosity by layer</text>
|
|
34
|
+
<text x="231" y="522">Verify and export</text>
|
|
35
|
+
<text x="550" y="315">Adjust</text>
|
|
36
|
+
<text x="550" y="338">temperatures</text>
|
|
37
|
+
</g>
|
|
38
|
+
<g font-family="system-ui, sans-serif" text-anchor="middle" fill="#304f65" font-size="15">
|
|
39
|
+
<text x="231" y="73">Stellar parameters, abundances, and opacity data</text>
|
|
40
|
+
<text x="231" y="161">Depth grid and starting temperatures</text>
|
|
41
|
+
<text x="231" y="249">Pressure, radius, density, and species populations</text>
|
|
42
|
+
<text x="231" y="337">Opacity, radiation, and convection</text>
|
|
43
|
+
<text x="231" y="425">Compare computed and target luminosity</text>
|
|
44
|
+
<text x="231" y="544">Convergence status, diagnostics, and model files</text>
|
|
45
|
+
<text x="529" y="430">More iterations</text>
|
|
46
|
+
<text x="244" y="470" text-anchor="start">Converged or stopping limit reached</text>
|
|
47
|
+
</g>
|
|
48
|
+
</svg>
|