Skip to content

Instantly share code, notes, and snippets.

@mayflower12
Last active September 5, 2018 15:20
Show Gist options
  • Save mayflower12/28bb3db8e113a3727a93c909fda14cca to your computer and use it in GitHub Desktop.
Save mayflower12/28bb3db8e113a3727a93c909fda14cca to your computer and use it in GitHub Desktop.
Pretreatment for counter-current spontaneous imbibition
%use Pretreatment (testTreatment.m) to get file 'Proceded_LBM_DVM_original_from_online_577_388.raw';
%And use the following command to get 'decimalFile_577_388.dat':
fileID=fopen('Proceded_LBM_DVM_original_from_online_577_388.raw');
A=fread(fileID,[577,388],'uint8=>uint');
dlmwrite('decimalFile_577_388.dat', A);
%then add the inlet layers
load decimalFile_577_388.dat
B=decimalFile_577_388;
finalmatrix=B(2:577,:);
dlmwrite('cut_spontaneous.dat',finalmatrix); % cut 577 by 1 to 576 in order to be divided by 24
load cut_spontaneous.dat
C=cut_spontaneous;
A=zeros(24,388);% add 24 lines on the x direction to make 600X388
A(:,1:352)=1;
addleft=A;
finalfinalmatrix=cat(1,addleft,C);
dlmwrite('Grid_try_3.dat', finalfinalmatrix);
@mayflower12
Copy link
Author

create "added_layers_fracture6.dat":
1.Use AutoCAD to draw jpeg; (Key step is to print-plot the jpeg with 'extents' and then crop the image online at https://imagesplitter.net/), left:0 Top:272 Width: 1600 Height:1008)
File generated by this step is called "fracture6-Model-cropped.jpeg"
2. use testTreatment.m to get "Proceded_LBM_DVM_fracture6-Model-cropped_1600_1008.raw";
3. add 40 layers at both inlet and outlet with the following code:

fileID=fopen('Proceded_LBM_DVM_fracture6-Model-cropped_1600_1008.raw');
A=fread(fileID,[1600,1008],'uint8=>uint');
dlmwrite('fracture6_1600_1008.dat', A);
load fracture6_1600_1008.dat
B=fracture6_1600_1008;
A=zeros(40,1008);
A(:,1:960)=1;
addleft=A;
finalmatrix=cat(1,addleft,B);
C=zeros(40,1008);
C(:,1:960)=1;
addright=C;
finalfinalmatrix=cat(1,finalmatrix,addright);
dlmwrite('added_layers_fracture6.dat',finalfinalmatrix);
fclose('all');

@mayflower12
Copy link
Author

mayflower12 commented Sep 5, 2018

Fracture 6 has the same dimension as fracture 5. The only difference is that fracture 6 added some channels to make it look less symmetrical.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment