toolkit

void print_help(global_variable gv)
[source]

function to print help and give command line parameters

bulk_info retrieve_bulk_PT(global_variable gv, io_data *input_data, int sgleP, bulk_info z_b)
[source]

retrieve bulk rock composition and PT compositions

void convert_system_comp(global_variable gv, char *sys_in, bulk_info z_b, double *bulk_rock)
[source]

retrieve bulk rock composition and PT compositions This function is not used in the C version of MAGEMin, but can be called via the Julia wrapper MAGEMin_C to normalize the composition

double AFunction(int mode, double v, double *data)
[source]

test function for Brent method

int RootBracketed(double x1, double x2)
[source]

TRUE if x1*x2 negative

double Minimum(double a, double b)
[source]

returns the minimum of two real numbers

double Maximum(double a, double b)
[source]

returns the maimum of two real numbers

double BrentRoots(double x1, double x2, double *data, double Tolerance, int mode, int maxIterations, double *valueAtRoot, int *niter, int *error)
[source]

main Brent root finding routine

double norm_vector(double *array, int n)
[source]

function to calculate norm of a vector

double euclidean_distance(double *array1, double *array2, int n)
[source]

function to calculate the Euclidean distance between two normalized vectors - used to decypher which phase to add during phase update

void inverseMatrix(int *ipiv, double *A1, int n, double *work, int lwork)
[source]

inverse a matrix using LAPACKE dgetrf and dgetri

double VecVecMul(double *B0, double *B1, int n)
[source]

vector vectorT multiplication

void VecMatMul(double *B1, double *A1, double *B, int n)
[source]

vector matrix multiplication

void MatVecMul(double *A1, double *br, double *n_vec, int n)
[source]

matrix vector multiplication

int get_active_em(double *array, int n)
[source]

get active endmember

int EndsWithTail(char *name, char *tail)
[source]

compare last character of a string with a reference character - function to find out the Liquid endmembers, and remove them from considerations after levelling

double sum_array(double *array, int size)
[source]

function to calculate the sum of an array

int check_sign(double v1, double v2)
[source]

function to compare the sign of two variables

double sign(double x)
[source]

function to compare the sign of two variables

void print_cp(global_variable gv, csd_phase_set *cp)
[source]

function to print out considered phases structure

void print_SS_informations(global_variable gv, SS_ref SS_ref_db, int iss)
[source]

rotate G-hyperplane using Gamma

SS_ref rotate_hyperplane(global_variable gv, SS_ref SS_ref_db)
[source]

rotate G-hyperplane using Gamma

SS_ref non_rot_hyperplane(global_variable gv, SS_ref SS_ref_db)
[source]

non rotated G-hyperplane

SS_ref raw_hyperplane(global_variable gv, SS_ref SS_ref_db, double *gb)
[source]

raw G-hyperplane using Gamma

SS_ref restrict_SS_HyperVolume(global_variable gv, SS_ref SS_ref_db, double box_size)
[source]

restrict solution phase hyper volume for local minimization

SS_ref check_SS_bounds(global_variable gv, SS_ref SS_ref_db)
[source]

check bounds

int getActiveSPhaseN(global_variable gv, PP_ref *PP_ref_db, SS_ref *SS_ref_db)
[source]

retrieve the number of solution phase that are active

int getActivePhaseN(global_variable gv, PP_ref *PP_ref_db, SS_ref *SS_ref_db)
[source]

retrieve the number of phases that are active

global_variable get_pp_id(global_variable gv)
[source]

get id of active pure phases

global_variable get_ss_id(global_variable gv, csd_phase_set *cp)
[source]

get id of active solution phases

global_variable wave_melt_correction(global_variable gv, bulk_info z_b, double aspectRatio)
[source]

Melt-fraction correction for P-wave and S-wave velocities The routine uses the reduction formulation of Clark et al., (2017) and is based on the equilibrium geometry model for the solid skeleton of Takei et al., 1997. * aspectRatio: Coefficient defining the geometry of the solid framework (contiguity): 0.0 (layered melt distributed) < 0.1 (grain boundary melt) < 1.0 (melt in separated bubble pockets)

printf(” Vp_Sol (harm) : %+12.5ft [km/s]n”,gv.solid_Vp); printf(” Vs_Sol (harm) : %+12.5ft [km/s]n”,gv.solid_Vs); gv.solid_Vs = anelastic_correction( 0,

gv.solid_Vs, z_b.P, z_b.T );

printf(” Vs_Sol (anel) : %+12.5ft [km/s]n”,gv.solid_Vs); if (gv.melt_fraction > 0.0){

wave_melt_correction( gv.melt_bulkModulus,

gv.solid_bulkModulus, gv.solid_shearModulus, gv.melt_density, gv.solid_density, gv.solid_Vp, gv.solid_Vs, gv.melt_fraction, 0.1, gv.V_cor );

printf(”n Vp_Melt_cor : %+12.5ft [km/s]n”, gv.V_cor[0]); printf(” Vs_Melt_cor : %+12.5ft [km/s]n”, gv.V_cor[1]); printf(” Vp/Vs_Melt_cor : %+12.5ft [km/s]n”,gv.V_cor[0]/gv.V_cor[1]);

} printf(”n”);

global_variable compute_phase_mol_fraction(global_variable gv, PP_ref *PP_ref_db, SS_ref *SS_ref_db, csd_phase_set *cp)
[source]

This routine convert the molar fraction on 1 atom basis to mol fraction