ComputationalThermodynamics / MAGEMin

The parallel Mineral Assemblage Gibbs Energy Minimization package
GNU General Public License v3.0
71 stars 17 forks source link

Error computing KLB-1 pseudosection in MATLAB #35

Closed sc-dyer closed 2 years ago

sc-dyer commented 2 years ago

There seems to be a problem in the computing the pseudoseciton for KLB-1 in the MATLAB app. This is the error code:

Index exceeds the number of array elements. Index must not exceed 18.

Error in ReadData_MAGEMin (line 45)
    Vs      = A(19);

Error in PerformMAGEMin_Simulation (line 97)
        [PhaseData, Status] = ReadData_MAGEMin(newPoints, PhaseData, Computation.MinPhaseFraction);

Error in ComputePhaseDiagrams_AMR (line 124)
    [PhaseData, TP_vec, FailedSimulations, CancelComputation] = PerformMAGEMin_Simulation(PhaseData, newPoints, TP_vec, VerboseLevel, Chemistry, dlg, ComputeAllPoints, UseGammaEstimation, Computation);

Error in PlotPseudosection/StartNewComputation (line 1464)
            [PseudoSectionData, CancelComputation]       =   ComputePhaseDiagrams_AMR(PseudoSectionData, DisplayPlots);

Error in matlab.apps.AppBase>@(source,event)executeCallback(appdesigner.internal.service.AppManagementService.instance(),app,callback,requiresEventData,event) (line 63)
            newCallback = @(source, event)executeCallback(appdesigner.internal.service.AppManagementService.instance(), ...

Debugging shows this error occurs when the array A only has 18 values. In this instance the values in A were:

145, 0, 4, 1900, -953.914, 8.52E-06, -1164.8, -2152.52, -997.162, -790.329, -578.577, -1351.4, -1163.17, -1298.92, -351.972, -1682.39, 0, -1

There might be a problem with the computation of this specific composition at high temperatures as I do not get this error when I change the maximum temperature to 1800C. I have been able to reproduce this error on another computer, both were running Windows 10 and MATLAB 2022a.

NicolasRiel commented 2 years ago

Which version do you use? This error should be fixed with the last release (1.2.3) for which the BinaryInstaller update has been validated during the night. Could you try to reinstall MAGEMin using the app?

If that does not help, could you provide us the PT range details of the guilty pseudosection so that we can reproduce the error.

Thanks for reporting the issue!

sc-dyer commented 2 years ago

This fix worked, thank you.