Skip to content

Instantly share code, notes, and snippets.

@mayflower12
mayflower12 / dl.sh
Created July 12, 2018 11:05
Bulk download and rename file
#!/bin/sh
mkdir RGD_PDF
counter=0
for id in `cut -d "=" -f 2 google_file_links`;
do
echo $((counter++));
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=${id}' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=${id}" -O RGD_PDF/RGD_$counter.pdf && rm -rf /tmp/cookies.txt
done;
@mayflower12
mayflower12 / grid_preprocess.m
Last active September 5, 2018 15:20
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,:);
@mayflower12
mayflower12 / image_ascii.m
Last active June 7, 2018 18:35
grid preprocess for counter current spontaneous imbibition test case
IMG = imread('original_from_online.jpeg'); % image data
L = im2bw(IMG); % image data to logical data
I = int8(L); % convert to 8 bit integer
dlmwrite('spontaneous.dat', I,' ') % write ascii file, using space(' ') as delimeter
% open data.dat to view it
load spontaneous.dat
B=spontaneous;
finalmatrix=B(:, 2:577);
dlmwrite('cut_spontaneous.dat',finalmatrix); % cut 577 by 1 to 576 in order to be divided by 24
```bash
### OpenMPI
module load compilers/intel/2018_0
./configure --prefix=/home/appLEIWU/MPI/intel/openmpi/2.1.0 CC=/home/appLEIWU/compiler/intel/compilers_and_libraries_2018.0.128/linux/bin/intel64/icc CXX=/home/appLEIWU/compiler/intel/compilers_and_libraries_2018.0.128/linux/bin/intel64/icpc F77=/home/appLEIWU/compiler/intel/compilers_and_libraries_2018.0.128/linux/bin/intel64/ifort FC=/home/appLEIWU/compiler/intel/compilers_and_libraries_2018.0.128/linux/bin/intel64/ifort
make -j 28
sudo make install
### HDF5
CC=/home/appLEIWU/MPI/intel/openmpi/2.1.0/bin/mpicc ./configure --enable-parallel --prefix=/home/appLEIWU/tool/HDF5/intel/openmpi/1.8.5-patch1
make -j 28