MRST-Octave-Matlab-Pebi-Grid

Hello; (First, excuse me for my bad english)
Please, I cannot run a script on Octave which nevertheless works correctly on Matlab. Apparently, it is a question of adapting the matrix form to Octave. Thanks in advance:

P = [];
for r = exp(−3.5:.25:0),
[x,y,z] = cylinder(r,16); P = [P [x (1,:); y (1,:)]];
end
P = unique([P ' ; 0 0], ' rows ' );
G = makeLayeredGrid(pebi(triangleGrid(P)), 5);
plotGrid(G, ' FaceColor ' ,[.8 .8 .8 ]); view(30,50), axis tight off

My system

  • OS: Ubuntu 16.04
  • Octave version: Version 6.2.0

Please post the error message that Octave is returning when you try to run this code.

It appears that Matlab allows the value of r to be a scalar while octave requires r to be a vector with at least two values.

Perhaps you can tell us more about what you are trying to achieve and why the cylinder function is called inside the for loop with scalar values for r during each iteration.

I try to excute an example given by:
https://www.sintef.no/contentassets/8af8db2e42614f7fb94fb0c68f5bc256/mrst-book-2016.pdf (page 91), which i try to have cylindrical grid.
So, after execution, i obtain this error:

>> CylinderGrid

error: t(_,3): out of bound 1 (dimensions are 1x1)
error: called from
triangleGrid at line 76 column 22
CylinderGrid at line 9 column 3
  1. Is CylinderGrid the name of the file you are running ? It doesn’t have 9 lines!
  2. According to the error message that you posted, It appears that the error is finally detected in triangleGrid function of the MRST toolbox. That function appears to accept an nx2 matrix. So the error seems to be generated within the triangleGrid function. Someone familiar with that toolbox may be able to help you.

(Excuse me for the delay in my response)

  1. No, my file have another name;
  2. I believe that the error lies in the writing of “A=unique([P’ 0 0], “rows”)”, which normally has matrix form on Matlab (nx2), but it’s not in Octave.

(I don’t know if I expressed myself well in English or not. I used Google Translate).

Now, I fixed the P matrix problem. P is now an nx2 matrix. the corrected code is:

P =[];
for r=exp(-3.5:.25:0),
[x,y,z]=cylinder([r r],16); P=[[] [x(1,:); y(1,:)]];
endfor
sizeP = size(P);
sizePT= size(P');
P=unique([P';[0 0]], "rows");
%sizeP=size(P)
G = makeLayeredGrid(pebi(triangleGrid(P)), 5);
plotGrid(G, 'FaceColor' ,[.8 .8 .8 ]); view(30,50)%, axis tight off

The new error is (view attached file):

I tried another completely different example containing the pebi function and got the same error. I think the pebi function is not suitable for Octave.

In fact, the origin of the error lies in the “assert” function which is itself called by the “pebi” function:

@Octaver I think the problem is too specific for the MRST software. The authors claim to be compatible with Octave. Thus I think you get more competent help at their user group: