PetroSim
PetroSim is a collection of petrological simulation tools.
Installation
PetroSim can be installed from the source or with pip as follows:
pip install petrosim
EC-AFC
The EC-AFC1 model is a tool for simulating the evolution of the geochemical composition of a magma body as it intrudes into country rock, assimilating wallrock into the melt and fractionally crystallizing out cumulates.
EC-RAFC
The EC-RAFC2 model is a tool for simulating the evolution of the geochemical composition of a magma body as it and subsequent recharges intrude into country rock, assimilating wallrock into the melt and fractionally crystallizing out cumulates.
Usage
An EC-AFC simulation is run with the standalone driver script using the command below, taking the initial parameters via a YAML formatted input.in file and outputting the results in the output.csv CSV file:
python3 -m petrosim.models.ecafc.driver input.in output.csv
Likewise, an EC-RAFC simulation can be run by replacing petrosim.models.ecafc.driver with petrosim.models.ecrafc.driver in the command above.
Example input files are located at petrosim/models/<model_type>/example.in. This file may be generated at any location by running the utility script from the desired location in the following manner by specifyting the model type (either "ecafc" or "ecrafc"):
python3 -m petrosim.utils.generate_example_input <model_type>
Running the simulation is by default silent and only outputs the CSV file, but this may be changed to also print to screen the first and last N lines of the results by adding the -print <N> flag in the command.
Basic visualization of the simulation results may be achieved with the included plotter, where one passes the resulting CSV file, the x-axis column name and the y-axis column name. An example of how to use the plotter on the resulting CSV file is below.
python3 -m petrosim.results.plotter output.csv -x Tm -y "Sr Cm"
This will both show a figure on screen and write a PNG file named Tm-Sr_Cm.png. To turn off saving to file, pass the -nosave flag, and to turn off showing the figure on screen, pass the -noshow flag in the command.
References
- Spera, F. J.; Bohrson, W. A. Energy-Constrained Open-System Magmatic Processes I. General Model and Energy-Constrained Assimilation and Fractional Crystallization (EC-AFC) Formulation J. Petrol., 2001, 42, 999-1018, DOI: 10.1093/petrology/42.5.999
- Spera, F. J.; Bohrson, W. A. Energy-Constrained Open-System Magmatic Processes 3. Energy-Constrained Recharge, Assimilation and Fractional Crystallization (EC-RAFC) Geochem. Geophys. Geosyst., 2002, 3, 8001, DOI: 10.1029/2007GC001781
Metadata
Release files for petrosim 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| petrosim-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for petrosim-0.0.4-py3-none-any.whl |
Release files / petrosim-0.0.4-py3-none-any.whl
| Download URL | petrosim-0.0.4-py3-none-any.whl |
|---|---|
| Size | 32.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
740e82ff8c57cb7af7bb475862b96a013f20f0dc7f3255e2f3b5f86f1f7cd092
|
|
BLAKE2b-256 checksum How to use checksums |
c7756da0a984c807bedb5bfba22c32132f2dc76cc1e3012f87d9eb3e9ae64236
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Security for petrosim 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.