The `pyUserCalc` modeling package was developed as part of the ENKI package to reproduce the functionality of Spiegelman (2000)’s original `UserCalc` code. The package has since been expanded to include a number of additional tools. `UserCalc` provided a tool that solved the one-dimensional, steady state equilibrium porous flow melting equations of Spiegelman & Elliott (1993), using numerical integration methods to solve for the concentrations and activities of coexisting nuclides in the uranium decay series during magma generation and two-phase (solid and liquid) flow. `pyUserCalc` by Elkins & Spiegelman (2021) built on this work by developing a new two-phase flow model for chemical disequilibrium during magma transport, based on the appendix formulas of Spiegelman & Elliott (1993), and then incorporating a back-reaction term for scaled chemical re-equilibration. This reactivity rate term uses a user-defined Damköhler number, a dimensionless scaling value that compares the rate of chemical exchange (in this case, between the liquid and the solid matrix) with the rate of a physical process like mantle decompression.
Additional modeling methods that have been developed and are included in the current package include tracking of stable (non-radioactive) trace element concentrations in magmas; computing radioactive decay in magmas that have aged; integration over the melting depth to simulate the accumulation of aggregated magmas from a triangular decompressing and melting mantle regime, a numerical solution to the equations of McKenzie (1985), Richardson & McKenzie (1994), and Zou & Zindler (REF) for traditional dynamic melting; and analytical solutions to dynamic and equilibrium porous flow (chromatographic) melting in a simplified system with constant melting rates and constant trace element partitioning with depth. Assorted other tools for practical model production are also available, including scripts to generate various kinds of input files for the models, and a MS Excel spreadsheet tool for calculating the composition of mantle rocks that have been metasomatized by subduction-derived fluids.
`pyUserCalc` has been written entirely in python, an accessible, free, open-source language with a great deal of coding and debugging support available online. All of the `pyUserCalc` code is open source, and much if it has been published as supplementary materials to scientific research publications in peer-reviewed articles. Appropriate citation and reference information is provided with each script or notebook. Bug reports, suggestions, and requests are very welcome and can be submitted by professional email admin@magmagenesis.org!
