Runtime Error When Running EDFM on a 2D Matrix Grid

30 views
Skip to first unread message

Calvin Scott

unread,
Jan 11, 2026, 2:09:42 PM (10 days ago) Jan 11
to MRST-users: The Matlab Reservoir Simulation Toolbox User Group

Dear all,

When I was working on an EDFM model with a 2D matrix grid, I encountered a runtime error.

The required files for running the case are attached below. I would greatly appreciate it if anyone could help clarify this issue. Thank you.

ERROR:
>> sample_of_heterogeneous_2D
Solving timestep 01/12:          -> 2 Hours, 2925 Seconds
Error using assert
Expected single index, got 2

Error in indexing (line 279)
                      assert(numel(s(1).subs) == 1, ...

Error in PhysicalModel/getProp (line 1036)
                p = state.(fn)(:, index);

Error in PhysicalModel>@(x)model.getProp(state,x) (line 1189)
        varargout = cellfun(@(x) model.getProp(state, x), ...

Error in PhysicalModel/getProps (line 1189)
        varargout = cellfun(@(x) model.getProp(state, x), ...

Error in PhasePressures/evaluateOnDomain (line 23)
            p = model.getProps(state, 'Pressure');

Error in StateFunctionGrouping/evaluateStateFunction (line 212)
            props_struct.(name) = prop.evaluateOnDomain(model, state);

Error in StateFunctionGrouping/evaluateStateFunctionWithDependencies (line 237)
            state = props.evaluateStateFunction(model, state, name);

Error in StateFunctionGrouping/evaluateDependencies (line 286)
                    state = props.evaluateStateFunctionWithDependencies(model, state, name);

Error in StateFunctionGrouping/evaluateStateFunctionWithDependencies (line 235)
            state = props.evaluateDependencies(model, state, prop.dependencies);

Error in StateFunctionGrouping/get (line 189)
                state = props.evaluateStateFunctionWithDependencies(model, state, name);

Error in PhysicalModel/getProp (line 1022)
                    [p, state] = c.get(model, state, nms{sub});

Error in PhysicalModel>@(x)model.getProp(state,x) (line 1189)
        varargout = cellfun(@(x) model.getProp(state, x), ...

Error in PhysicalModel/getProps (line 1189)
        varargout = cellfun(@(x) model.getProp(state, x), ...

Error in equationsBlackOil (line 163)
[b, pv] = model.getProps(state, 'ShrinkageFactors', 'PoreVolume');

Error in ThreePhaseBlackOilModel/getEquations (line 202)
        [problem, state] = equationsBlackOil(state0, state, model, dt, drivingForces, varargin{:});

Error in PhysicalModel/stepFunction (line 717)
        [problem, state] = model.getEquations(state0, state, dt, drivingForces, ...

Error in ReservoirModel/stepFunction (line 307)
        [state, report] = stepFunction@PhysicalModel(model, state, state0, dt, drivingForces, linsolver, nonlinsolver, iteration, varargin{:});

Error in NonLinearSolver/solveMinistep (line 374)
                    model.stepFunction(state, state0, dt, drivingForces, ...

Error in NonLinearSolver/solveTimestep (line 210)
                    solveMinistep(solver, model, state, state0_inner, dt, drivingForces);

Error in simulateScheduleAD (line 295)
            [state, report] = solver.solveTimestep(state0, dt, model,...

Error in sample_of_heterogeneous_2D (line 171)
[ws, states,reports] = simulateScheduleAD(state0, model, schedule);

f1.mat
fluid_properties_simple.DATA
sample_of_heterogeneous_2D.m

Olav Møyner

unread,
Jan 12, 2026, 4:44:28 AM (9 days ago) Jan 12
to Calvin Scott, MRST-users: The Matlab Reservoir Simulation Toolbox User Group
Hi,

What version of MRST and MATLAB are you using? Several errors of this type were fixed in the latest released and stem from a change in MATLAB behavior.

Best regards,
Olav

From: sinte...@googlegroups.com <sinte...@googlegroups.com> on behalf of Calvin Scott <kungcli...@gmail.com>
Sent: Sunday, January 11, 2026 20:09
To: MRST-users: The Matlab Reservoir Simulation Toolbox User Group <sinte...@googlegroups.com>
Subject: [MRST Users] Runtime Error When Running EDFM on a 2D Matrix Grid
 
--
You received this message because you are subscribed to the Google Groups "MRST-users: The Matlab Reservoir Simulation Toolbox User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sintef-mrst...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/sintef-mrst/ae8e389e-6b59-42db-8a6c-66d030c4627bn%40googlegroups.com.

Calvin Scott

unread,
Jan 12, 2026, 10:18:48 AM (9 days ago) Jan 12
to MRST-users: The Matlab Reservoir Simulation Toolbox User Group

Hi Olav,

Thank you very much for your reply.

I am currently using MATLAB R2024a together with MRST 2025b.
Based on your comment, I understand that several similar runtime errors were related to changes in MATLAB behavior and have been fixed in the latest MRST releases.

I would like to clarify one point:
if I intend to use MRST 2025b, does this imply that I should also use a corresponding newer MATLAB version (for example MATLAB 2025b or 2026a) to ensure full compatibility?
Or is MRST 2025b expected to work correctly with MATLAB R2024a as well?

Thank you again for your help and for maintaining MRST.

Best regards,
Calvin

Olav Møyner

unread,
Jan 12, 2026, 11:55:44 AM (9 days ago) Jan 12
to Calvin Scott, MRST-users: The Matlab Reservoir Simulation Toolbox User Group
Hi,

We generally try to support 5 years of versions back. MATLAB R2024a with 2025b should be fine.  Since you are already using the latest version, the error could be from something else.

Best regards,
Olav

Sent: Monday, January 12, 2026 16:18

To: MRST-users: The Matlab Reservoir Simulation Toolbox User Group <sinte...@googlegroups.com>
Subject: Re: [MRST Users] Runtime Error When Running EDFM on a 2D Matrix Grid
 

Calvin Scott

unread,
Jan 12, 2026, 12:15:15 PM (9 days ago) Jan 12
to MRST-users: The Matlab Reservoir Simulation Toolbox User Group

Hi Olav,

Just to add one more piece of information that may be relevant for debugging:

On my machine, I currently have MATLAB R2024a installed.
I tested the same script under different MRST versions, and observed the following behavior:

  • With MRST 2024b, the script runs without any issues.

  • With MRST 2025b, the script triggers the runtime error I reported earlier.


Best regards,
Calvin

Calvin Scott

unread,
Jan 13, 2026, 4:20:47 AM (8 days ago) Jan 13
to MRST-users: The Matlab Reservoir Simulation Toolbox User Group

Hi Olav,

Thank you for your patience. I would like to clarify my previous message, as my earlier wording may have caused some confusion.

After further checks, the situation is actually the following:

  • On another machine, the same script runs without any issues under both MRST 2024b and MRST 2025b.

  • On my own machine, the same script fails with a runtime error under both MRST 2024b and MRST 2025b.

On my machine, MATLAB R2024a has been installed for quite a long time and the script used to run correctly before.
The only recent change to my environment is that I installed the MinGW compiler two days ago.

Therefore, I am wondering whether the installation of MinGW (or changes to the compiler / environment variables associated with it) could be related to the runtime error I am seeing now.

Please let me know if you think this is a plausible cause, or if you would recommend any specific checks or tests.

Best regards,
Calvin

Olav Møyner

unread,
Jan 13, 2026, 4:59:18 AM (8 days ago) Jan 13
to Calvin Scott, MRST-users: The Matlab Reservoir Simulation Toolbox User Group
Hi,

I do not think MinGW will have any impact on this. It is more likely that you have local modifications or shadowed files (for example multiple versions of MRST, or of files from MRST added to path).

I would check pathdef (which tells you what files MATLAB is actually using) and verify that the files are exactly the same. The easiest way is to copy everything over from the computer that is working and test from there.

Bset regards,
Olav

Sent: Tuesday, January 13, 2026 10:20

Calvin Scott

unread,
Jan 13, 2026, 11:10:16 AM (8 days ago) Jan 13
to MRST-users: The Matlab Reservoir Simulation Toolbox User Group

Hi Olav,

Thank you very much for your helpful suggestions.

Following your advice, I checked the MATLAB path using pathdef and carefully compared the files being used.
You were absolutely right — the issue was caused by local modifications and shadowed files.

Specifically, in my chemical reaction module folder, I found several files that were originally from MRST but had been locally modified. These modified files were being picked up by MATLAB and led to the runtime error. After cleaning up the path and restoring consistency with the original MRST files, the problem was resolved.

Thank you again for your clear guidance — it was very helpful in pinpointing the root cause.

Best regards,
Calvin

Reply all
Reply to author
Forward
0 new messages