A collection of petrological simulation tools.
Project description
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file petrosim-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: petrosim-0.0.4-py3-none-any.whl
- Upload date:
- Size: 32.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 740e82ff8c57cb7af7bb475862b96a013f20f0dc7f3255e2f3b5f86f1f7cd092 |
|
MD5 | e7a4c192eecca96456006011503b51fc |
|
BLAKE2b-256 | c7756da0a984c807bedb5bfba22c32132f2dc76cc1e3012f87d9eb3e9ae64236 |