If you use one of the fully implicit solvers from the AD-OO framework (ad-core,
ad-blackoil, etc) and want to change the rock properties at *any* time step, you
would probably have to dig a bit deeper into the code since I do not remember
that we have made any hook that would allow you to insert your own code that
modifies the rock object. If you only want to modify the rock properties once,
or a few times, you can just add an outer loop the performs the first years,
updated the permeability, continues to the next period, etc.
You can, for instance, look at the 'blackoilTutorialSPE1.m' example from the
'ad-blackoil' module. A *brute-force* approach would be something like
[G, rock, fluid, deck, state] = setupYourModel();
for n=1:nmod
rock = modifyRockFunction(rock);
schedule = simpleSchedule(timesteps{n});
[wellSols, states, report] = simulateScheduleAD(state, model, schedule);
% Plot something
end
My colleagues can probably chime in with some more advanced or efficient
solution, but I think this should give you the basic idea.
i) the problem of changing permeability in specific cells after few years,
ii) variable injection rates (which I think I have figured how to include that),
iii) obtaining rates for CO2 and brine from the production well.
Dear Harry,
Here is a quick script that hopefully does what you want. It sets up a simulation schedule (varying rates and timesteps) and repeats it two times. The second time around the permeability of a few arbitrary cells are modified before plotting the well rates in field units (stb/day). I just used a simple two-phase model for this problem since the key part is the construction of the schedule, which will be similar regardless of the chosen fluid physics.
Best regards,
Olav
Oh, by the way – that script assumes that the ad-core and ad-blackoil modules are loaded using
mrstModule add ad-core ad-blackoil
before running it.
Olav
Dear Harry,
If you add a line setting the “extraStateOutput” flag to the model,
model.extraStateOutput = true;
The wellSols will contain fields qWr, qOr for reservoir condition rates as well so that you can do,
qOr = abs(getWellOutput(ws, 'qOr', 2));
qWr = abs(getWellOutput(ws, 'qWr', 2));
For this example, I did not set any compressibility, so they will be equal to the rates at standard conditions.
Error in updateConnectionDP (line 87)
wbqs(zi,:) = ones(nnz(zi),1)*w.compi;
Error using LinearSolverAD/solveLinearProblem (line 109)
Linear system rhs must have finite entries.You may want to use EOS for CO2 while remaining with the linear model for water, i.e., you can choose the approach for each fluid independently.
You can get a function expressing CO2 density from the object generated by the call to CO2props(). This object will contain a field called 'rho', providing CO2 density as a function of pressure and temperature. If you want a function only depending on pressure, you could fix the temperature, e.g. by doing something like this:
co2 = CO2props();
p_ref = /your reference pressure goes here/
T_ref = /your reference temperature goes here/
....
generate your fluid object here
fluid = ....
...
% use isothermal EOS-based co2 density function
fluid.bG = @(p) co2.rho(p, T_ref) ./ fluid.rhoGS;
I have not tested the snipped above, so there might be errors, but it outlines the idea of it. If you run into trouble, let me know.
Oh, and the object generated by CO2props is based on a sampled table. If your pressure and temperature range falls outside this sampled table, a different table would need to be used. See the documentation for CO2props for how to specify a different table. Custom tables can be generated with the generaterPropsTable function, but requires that you have the CoolProp (http://www.coolprop.org/) package available so that Matlab can call the PropsSI function. Let me know if you need assistance on this.
I hope this takes care of your question.
Regards,
Odd A.