Alternative Equation of State to Peng-Robinson in MRST

36 views
Skip to first unread message

Williams Jang

unread,
Jun 19, 2024, 8:08:00 AM (11 days ago) Jun 19
to MRST-users: The Matlab Reservoir Simulation Toolbox User Group
Dear All,

Is it possible to implement an alternative EoS to Peng-Robison (PR) in MRST to more accurately capture gas-water dissolution/miscibility? Has anyone done this before in MRST and if so, can you help with the procedures? 

The PR EoS is unlikely to yield good predictions for the solubility or density of the water phase. From a literature search, other methods like Huron Vidal and CPA-EoS appear to do a better job at this but are not available within MRST.

While this seems like a considerable amount of work, I was wondering if an alternative is to find the best and latest interaction parameters in published papers (which use PR-EoS), rather than rely solely on the PR BICs available in software like MultiFlash or ASPEN. 

Any thoughts, please?

Williams

Knut-Andreas Lie

unread,
Jun 19, 2024, 9:47:29 AM (11 days ago) Jun 19
to Williams Jang, MRST-users: The Matlab Reservoir Simulation Toolbox User Group
Hi!

This is possible, indeed. The new co2lab-mit module implements improved modelling of CO2 and brine miscibility. We have also implemented e-PC-SAFT and e-CPA. For the latter, see Xiong et al., SPE Journal: https://doi.org/10.2118/219734-PA.  Accompanying code is available from https://zenodo.org/records/10691506

With a complicated EoS, the biggest challenge is perhaps to write a code that is highly computationally efficient because of the significant computational overhead incurred by the current AD library of MRST when applied to small systems like you find in an EoS.

Best regards,
Knut-Andreas 
--
Knut-Andreas Lie, Professor, PhD
Chief Scientist, SINTEF Digital, Mathematics & Cybernetics, Oslo
Phone: +47 930 58 721 (mobile)
http://folk.ntnu.no/andreas

From: sinte...@googlegroups.com <sinte...@googlegroups.com> on behalf of Williams Jang <willj...@gmail.com>
Sent: Wednesday, June 19, 2024 11:37 AM
To: MRST-users: The Matlab Reservoir Simulation Toolbox User Group <sinte...@googlegroups.com>
Subject: [MRST Users] Alternative Equation of State to Peng-Robinson in MRST
 
--
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 on the web visit https://groups.google.com/d/msgid/sintef-mrst/64e3097d-9709-4a87-96a9-1914cf2db891n%40googlegroups.com.

Williams Jang

unread,
Jun 20, 2024, 8:45:29 AM (10 days ago) Jun 20
to MRST-users: The Matlab Reservoir Simulation Toolbox User Group
Thank you very much for the information.

Regards,
Williams

Williams Jang

unread,
Jun 20, 2024, 2:49:09 PM (10 days ago) Jun 20
to MRST-users: The Matlab Reservoir Simulation Toolbox User Group
Good afternoon,

I have been trying to adapt the code by Xiong et al. to my problem, but have faced some challenges, according to the comments in green below. Sample code attached.

The produced error for the scenarios (1) and (2) that do not work are shown below. I was wondering if you could provide some recommendations to help resolve this.

flowfluid = initSimpleADIFluid('phases','WG', 'blackoil', false, 'mu',[muW_R, muG_R], 'rho',[rhoW_R, rhoG_R], 'n',[2, 2]);
ECPAmixture = ECPATableCompositionalMixture({'Water','Carbondioxide'}); %This works
%ECPAmixture = ECPATableCompositionalMixture({'Carbondioxide','Water'}); % (1) Does not work when components are swapped
%ECPAmixture = ECPATableCompositionalMixture({'Water','Carbondioxide','Hydrogen'}); % (2) Does not work when >2 components are present, even though standard and CPA properties/parameters for Hydrogen have been added to the eCPAPropFluidsStructs file

Error 
Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 0-by-0.
Error in ECPAEquationOfStateModel/getPhaseMixCoefficients (line 717)
                        st(:,i) = st(:,i) + bsxfun(@times, x(:,j) .* bic{j,i}, G(j,i));
Error in eCPAphaseStabilityTest>getFugacity (line 201)
    [A, B, acti] = model.getPhaseMixCoefficients(xy, T, bic, a);
Error in eCPAphaseStabilityTest>checkStability (line 137)
    [f_z, v_z] = getFugacity(eos, T, z, p, insidePhaseIsVapor);
Error in eCPAphaseStabilityTest (line 82)
    [y, S_V, isTrivialV, K_V] = checkStability(eos, z, K, p, T, true, active, opt);
Error in ECPAEquationOfStateModel/performPhaseStabilityTest (line 457)
                    [stable, x, y, K] = eCPAphaseStabilityTest(model, z, P, T, K);
Error in ECPAEquationOfStateModel/stepFunction (line 300)
                    model.performPhaseStabilityTest(state.pressure(initSingle), state.T(initSingle),...
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 eCPAstandaloneFlash (line 52)
    [state, report] = solver.solveTimestep(state, 1, EOSModel);
Error in eCPAgetEOSComponent (line 28)
    [L, ~, ~, ~, ~, rhoL, rhoV] = eCPAstandaloneFlash(p, T, z, model.EOSModel);
Error in ECPAGenericOverallCompositionModel/validateModel (line 103)
                            c = eCPAgetEOSComponent(model, p, T, name, ci);
Error in Z_CPA_WJ (line 25)
ECPAoverall = ECPAoverall.validateModel();


Kind regards,
Williams
On Wednesday, June 19, 2024 at 2:47:29 PM UTC+1 Knut-Andreas Lie wrote:
Z_CPA_WJ.m

Olav Møyner

unread,
Jun 20, 2024, 3:29:30 PM (10 days ago) Jun 20
to Williams Jang, MRST-users: The Matlab Reservoir Simulation Toolbox User Group
Hi,

I think that you cannot use the name "water" for the component if you are setting up a water-gas system. Either use a oil-gas system or rename the component in the mixture before setting up the EoS. I have not tried your script, but that could fix your issue.

Best regards,
Olav

Sent: Thursday, June 20, 2024 20:18

To: MRST-users: The Matlab Reservoir Simulation Toolbox User Group <sinte...@googlegroups.com>
Subject: Re: [MRST Users] Alternative Equation of State to Peng-Robinson in MRST
 

Williams Jang

unread,
Jun 24, 2024, 10:51:23 AM (6 days ago) Jun 24
to MRST-users: The Matlab Reservoir Simulation Toolbox User Group
Many thanks for your reply. However, my issue is still unresolved. It seems strange why only CASE 1 works, i.e., ({'Water','Carbondioxide'})

CASE 1 (This works even though "water" is used for the component)
flowfluid = initSimpleADIFluid('phases','WG', 'blackoil', false, 'mu',[muW_R, muG_R], 'rho',[rhoW_R, rhoG_R], 'n',[2, 2]);
ECPAmixture = ECPATableCompositionalMixture({'Water','Carbondioxide'});
ECPAarg = {G, rock, flowfluid, ECPAmixture, 'water', true, 'oil', false, 'gas', true, 'liquidPhase', 'W', 'vaporPhase', 'G'};

CASE 2 (After changing to an oil-gas system, the error still persists)
flowfluid = initSimpleADIFluid('phases','OG', 'blackoil', false, 'mu',[muW_R, muG_R], 'rho',[rhoW_R, rhoG_R], 'n',[2, 2]);
ECPAmixture = ECPATableCompositionalMixture({'Carbondioxide','Water'});
ECPAarg = {G, rock, flowfluid, ECPAmixture, 'water', false, 'oil', true, 'gas', true, 'liquidPhase', 'O', 'vaporPhase', 'G'};

CASE 3 (After changing "water" to "H2O", MRST the same error still persists even after inputting "H2O" in the eCPAPropFluidsStructs.m function
flowfluid = initSimpleADIFluid('phases','WG', 'blackoil', false, 'mu',[muW_R, muG_R], 'rho',[rhoW_R, rhoG_R], 'n',[2, 2]);
ECPAmixture = ECPATableCompositionalMixture({'Carbondioxide','Water'});
ECPAarg = {G, rock, flowfluid, ECPAmixture, 'water', true, 'oil', false, 'gas', true, 'liquidPhase', 'W', 'vaporPhase', 'G'};
Reply all
Reply to author
Forward
0 new messages