Phase Diagrams
It is possible to employ phase diagrams as lookup tables, which can be used to compute density, melt fraction or seismic properties, for example.
Perple_X
A popular way to compute phase diagrams (pseudosections) for a given (fixed) chemical composition as a function of pressure and temperature is by using Perple_X. Once a stable assemblage is computed, through Gibbs energy minimisation, it allows you to output a large number of properties such as density, melt fraction or seismic velocities.
Within GeoParams, we can import this diagram (provided it is formatted in the same manner as LaMEM expects Perple_X input to be).
GeoParams.PerpleX_LaMEM_Diagram Function
PD_Data = PerpleX_LaMEM_Diagram(fname::String; CharDim = nothing, type::AbstractString = "Perple_X/LaMEM")Reads a precomputed phase diagram in the Perple_X/MAGEMin/LaMEM format (which is a phase diagram computed using Perple_X/MAGEMin, but formatted in a manner that is readable using LaMEM or potentially any other geodynamic code). The data is stored in the PhaseDiagram_LookupTable structure.
If the CharDim object is specified, the values of all diagrams will be non-dimensionalized. The type kwarg is a string that indicates the type of phase diagram (default is "Perple_X/LaMEM").
Example
julia> PD_Data = PerpleX_LaMEM_Diagram("./test_data/Peridotite.in")
Perple_X/LaMEM Phase Diagram Lookup Table:
File : ./test_data/Peridotite.in
T : 293.0 - 1573.000039
P : 1.0e7 - 2.9999999944e9
fields : :meltRho, :meltRho, :meltFrac, :rockRho, :Rho, :rockVp
:rockVs, :rockVpVs, :meltVp, :meltVs, :meltVpVs
:Vp, :Vs, :VpVsOnce imported, the properties on the diagram can be interpolated in a simple manner:
julia> PD_Data.Rho(1500,1e7)
3042.836820256982This also works for vectors or arrays:
julia> T = [1500 1800; 1233 1300]
julia> P = [1e8 1e9; 1e7 1e7]
julia> rho = PD_Data.Rho.(T,P)(Note the dot . in front of the bracket while evaluating arrays).
The fields that are available depend on what is listed in the diagram file. The units of the fields are automatically evaluated, and employed to non-dimensionalize the parameters if CharDim is specified.
Algorithm
Internally, we employ a linear 2D interpolation scheme for evaluating the phase diagram values at arbitrary (T,P) points using bilinear interpolation. Values outside the range of the diagram are set to the boundary of the diagram. The interpolation object is directly encoded in the `PhaseDiagram_LookupTable`` object.
sourceGeoParams.MaterialParameters.PhaseDiagrams.PhaseDiagram_LookupTable Type
Contains data of a Phase Diagram that is regularly spaced in P & TFields
Type::Ptr{UInt8}: String pointer indicating the type of phase diagram (e.g., "Perple_X/MAGEMin/LaMEM")Name::Ptr{UInt8}: String pointer to the name of the phase diagram filerockRho::Union{T, Nothing}: Interpolation object for rock densitymeltRho::Union{T, Nothing}: Interpolation object for melt densitymeltFrac::Union{T, Nothing}: Interpolation object for melt fractionRho::Union{T, Nothing}: Interpolation object for total densityrockVp::Union{T, Nothing}: Interpolation object for rock P-wave velocityrockVs::Union{T, Nothing}: Interpolation object for rock S-wave velocityrockVpVs::Union{T, Nothing}: Interpolation object for rock Vp/Vs ratiomeltVp::Union{T, Nothing}: Interpolation object for melt P-wave velocitymeltVs::Union{T, Nothing}: Interpolation object for melt S-wave velocitymeltVpVs::Union{T, Nothing}: Interpolation object for melt Vp/Vs ratioVp::Union{T, Nothing}: Interpolation object for total P-wave velocityVs::Union{T, Nothing}: Interpolation object for total S-wave velocityVpVs::Union{T, Nothing}: Interpolation object for total Vp/Vs ratioSpecificCp::Union{T, Nothing}: Interpolation object for specific heat capacitysolid_Vp::Union{T, Nothing}: Interpolation object for solid P-wave velocitysolid_Vs::Union{T, Nothing}: Interpolation object for solid S-wave velocitymelt_bulkModulus::Union{T, Nothing}: Interpolation object for melt bulk modulussolid_bulkModulus::Union{T, Nothing}: Interpolation object for solid bulk modulussolid_shearModulus::Union{T, Nothing}: Interpolation object for solid shear modulusVp_uncorrected::Union{T, Nothing}: Interpolation object for uncorrected P-wave velocityVs_uncorrected::Union{T, Nothing}: Interpolation object for uncorrected S-wave velocity