-
-
Save mayflower12/28bb3db8e113a3727a93c909fda14cca to your computer and use it in GitHub Desktop.
%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); |
Following the above comments, the pretreatment step looks like this:
%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 and outlet layers
load decimalFile_577_388.dat
B=decimalFile_577_388;
A=zeros(12,388);
A(:,1:352)=1;
addleft=A;
finalmatrix=cat(1,addleft,B);
C=zeros(11,388);
C(:,1:352)=1;
addright=C;
finalfinalmatrix=cat(1,finalmatrix,addright);
dlmwrite('Grid_try_4.dat',finalfinalmatrix);
Use this one for the final successful treatment of the geometry to get 'Grid_try_4.dat'.
The top right side is blocked. To improve, Grid_try_5.dat is generated.
Firstly, use imageMagic to convert 'original_from_online.jpeg' to 'original_from_online_black_2.png' and 'original_from_online_black_2_negate.png'.
Use command:
convert original_from_online.jpeg -fuzz 60%(or 55%, tried but almost the same with 55%) -fill black -opaque purple original_from_online_black_2.png
convert original_from_online_black_2.png -negate original_from_online_black_2_negate.png
Then use 'testTreatment.m' to get 'Proceded_LBM_DVM_original_from_online_black_2_negate_577_388.raw';
Finally,
fileID=fopen('Proceded_LBM_DVM_original_from_online_black_2_negate_577_388.raw');
A=fread(fileID,[577,388],'uint8=>uint');
dlmwrite('decimalFile_577_388.dat', A);
load decimalFile_577_388.dat
B=decimalFile_577_388;
A=zeros(12,388);
A(:,1:352)=1;
addleft=A;
finalmatrix=cat(1,addleft,B);
C=zeros(11,388);
C(:,1:352)=1;
addright=C;
finalfinalmatrix=cat(1,finalmatrix,addright);
dlmwrite('Grid_try_5.dat',finalfinalmatrix);
create "added_layers_circle.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:223 Width: 1600 Height:1056 then resize it to 800X528)
File generated by this step is called "Drawing1-Model-extents-V2-800-528-V2.jpeg"
2. use testTreatment.m to get "Proceded_LBM_DVM_circle_800_528.raw";
3. add 20 layers at both inlet and outlet with the following code:
fileID=fopen('Proceded_LBM_DVM_circle_800_528.raw');
A=fread(fileID,[800,528],'uint8=>uint');
dlmwrite('decimalFile_800_528.dat', A);
load decimalFile_800_528.dat
B=decimalFile_800_528;
A=zeros(20,528);
A(:,1:464)=1;
addleft=A;
finalmatrix=cat(1,addleft,B);
C=zeros(20,528);
C(:,1:464)=1;
addright=C;
finalfinalmatrix=cat(1,finalmatrix,addright);
dlmwrite('added_layers_circle.dat',finalfinalmatrix);
create "added_layers_fracture.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:223 Width: 1600 Height:1056 then resize it to 800X528)
File generated by this step is called "fracture-Model-resized.jpeg"
2. use testTreatment.m to get "Proceded_LBM_DVM_fracture-Model-resized_800_528.raw";
3. add 20 layers at both inlet and outlet with the following code:
fileID=fopen('Proceded_LBM_DVM_fracture-Model-resized_800_528.raw');
A=fread(fileID,[800,528],'uint8=>uint');
dlmwrite('fracture_800_528.dat', A);
load fracture_800_528.dat
B=fracture_800_528;
A=zeros(20,528);
A(:,1:479)=1;
addleft=A;
finalmatrix=cat(1,addleft,B);
C=zeros(20,528);
C(:,1:479)=1;
addright=C;
finalfinalmatrix=cat(1,finalmatrix,addright);
dlmwrite('added_layers_fracture.dat',finalfinalmatrix);
create "added_layers_fracture2.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:705 Width: 1600 Height:575 then resize it to 800X287)
File generated by this step is called "fracture2-Model-resized.jpeg"
2. use testTreatment.m to get "Proceded_LBM_DVM_fracture2-Model-resized_800_287.raw";
3. add 20 layers at both inlet and outlet with the following code:
fileID=fopen('Proceded_LBM_DVM_fracture2-Model-resized_800_287.raw');
A=fread(fileID,[800,287],'uint8=>uint');
dlmwrite('fracture2_800_287.dat', A);
load fracture2_800_287.dat
B=fracture2_800_287;
A=zeros(20,287);
A(:,1:240)=1;
addleft=A;
finalmatrix=cat(1,addleft,B);
C=zeros(20,287);
C(:,1:240)=1;
addright=C;
finalfinalmatrix=cat(1,finalmatrix,addright);
dlmwrite('added_layers_fracture2.dat',finalfinalmatrix);
create "added_layers_fracture3.dat":
same with create "added_layers_fracture2.dat"
create "added_layers_fracture4.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:226 Width: 1600 Height:1054 then resize it to 800X527)
File generated by this step is called "fracture4-Model-resized.jpeg"
2. use testTreatment.m to get "Proceded_LBM_DVM_fracture4-Model-resized_800_527.raw";
3. add 20 layers at both inlet and outlet with the following code:
fileID=fopen('Proceded_LBM_DVM_fracture4-Model-resized_800_527.raw');
A=fread(fileID,[800,527],'uint8=>uint');
dlmwrite('fracture4_800_527.dat', A);
load fracture4_800_527.dat
B=fracture4_800_527;
A=zeros(20,527);
A(:,1:480)=1;
addleft=A;
finalmatrix=cat(1,addleft,B);
C=zeros(20,527);
C(:,1:480)=1;
addright=C;
finalfinalmatrix=cat(1,finalmatrix,addright);
dlmwrite('added_layers_fracture4.dat',finalfinalmatrix);
create "added_layers_fracture5.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/)
File generated by this step is called "fracture5-Model-cropped.jpeg"
2. use testTreatment.m to get "Proceded_LBM_DVM_fracture5-Model-cropped_1600_1008";
3. add 40 layers at both inlet and outlet with the following code:
fileID=fopen('Proceded_LBM_DVM_fracture5-Model-cropped_1600_1008.raw');
A=fread(fileID,[1600,1008],'uint8=>uint');
dlmwrite('fracture5_1600_1008.dat', A);
load fracture5_1600_1008.dat
B=fracture5_1600_1008;
A=zeros(40,1008);
A(:,1:960)=1; %960 can be acquired from paint in windows.
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_fracture5.dat',finalfinalmatrix);
03/09/2018
The inlet and outlet should have at least two layers solid nodes besides the solid nodes which is the nearest neighbor of the first layer of fluid nodes. This is to guarantee the eight-order accurate way of getting mesh_nx and mesh_ny.
The following illustration shows the correct implementation:
The way to test this is to add one more layer at the inlet based on "fracture3_800_287.dat", and 39 layers more at the outlet for the sake of number of processors is able to be divided by 40.
load fracture3_800_287.dat
B=fracture3_800_287;
A=zeros(1,287);
A(:,1:240)=1;
addleft=A;
finalmatrix=cat(1,addleft,B);
C=zeros(39,287);
C(:,1:240)=1;
addright=C;
finalfinalmatrix=cat(1,finalmatrix,addright);
dlmwrite('1_layer_left_fracture3.dat',finalfinalmatrix);
It turns out that the mysterious red at the inlet no longer appears as shown below at ts=100000.
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');
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.
The above treatment involves cut one line and then add 24 lines, what if add 23 lines directly?
Also should try add lines on both the right hand side. This will be discussed in the following comments.