# 快速参数计算


#define beadsdistance 6// distance between Beads 1 and Beads 2 the centre of the ball




#!/bin/sh
date="20151028-1"
templatesource="HF-p-d.c"
prefix="HF-p-d"
preprog="HFpd"

mkdir ../run/${date} for i in$( seq 0 1 )
do
prog=$preprog${i}
source=$prefix${i}".c"
oldline="#define beadsdistance 6// distance between Beads 1 and Beads 2 the centre of the ball"
line="#define beadsdistance "${i} cd ~/source/ cp${templatesource} ./${source} sed -i "s@$oldline@$line@" ./${source}

gcc -O2 ${source} -o${prog} -lm
mkdir ../run/${date}/dist${i}
cp ${prog} ../run/${date}/dist${i} cd ../run/${date}/dist${i} for j in$( seq 1 8 )
do
mkdir ~/run/${date}/dist${i}/no${j} cd ~/run/${date}/dist${i}/no${j}
cp ~/run/${date}/dist${i}/${prog} . ./${prog}>record  &
sleep 5
echo "Done${j}" done echo "Done distance${i}"

done



# 绘制流场线(如何从MATLAB的figure中得到曲线信息)


clear;
figure
M = dlmread('XXX/Wholevelcoity.txt', '\t');
N = dlmread('XXX/Provelcoity.txt', '\t');

x=N(:,2);
y=N(:,3);
u=N(:,4);
v=N(:,5);

quiver(x,y,15*u,15*v)
daspect([1 1 1]);

%系统参数
Lx = 62;
Ly = 20;

XX = M(:,2);
XX = changeshape(XX,Lx,Ly);

YY = M(:,3);
YY = changeshape(YY,Lx,Ly);

UU = M(:,4);
UU =changeshape(UU,Lx,Ly);

VV = M(:,5);
VV = changeshape(VV,Lx,Ly);

starty=4 : 2 :20;
startx = ones(size(starty));
startx = startx+20 ;

streamline(XX,YY,UU,VV,startx,starty)

ax = get(gcf,'children'); % get all subplots
XALL=[];YALL=[];
for iax = 1:length(ax)
child = get(ax(iax),'children'); % for each subplot, get all lines
for ichild = 1 : length(child)
XALL{end+1} = get(child(ichild),'xdata');
YALL{end+1} = get(child(ichild),'ydata');
end
end

for j = 1: length(XALL)-1
X1=transpose(XALL{1,j});
Y1=transpose(YALL{1,j});
figure
plot(X1,Y1);
filenm = ['Line'    num2str(j)  '.txt' ];
fid=fopen(filenm,'w+');
fprintf(fid, '%f \t %f \n', [X1 Y1]');
fclose(fid);

end




function [out] = changeshape(in,Lx,Ly)

XXnew=reshape(in,Lx,Ly);
out = transpose(XXnew);



x   y   vx  vy





\documentclass[tikz]{standalone}
\usetikzlibrary{positioning}
\usepackage{lmodern}
\newcommand{\tikzmark}[2]{\tikz[remember picture, baseline] \node[inner sep=0pt, outer sep=0pt, anchor=base] (#1) {#2};}

\newcommand{\ZuiDa}{\fontsize{100pt}{0.5pt}}

\begin{document}

\begin{tikzpicture}[remember picture]
\node (A) at(-40,0) {
{\includegraphics{B2portB.eps}}
};

\draw (-78.5,25.0) node { \ZuiDa \textbf{(\emph{a})}};

\node[right=of A] (B) at (0,0){
{\includegraphics{B2vector.eps}}
};

\draw (-1.5,25) node { \ZuiDa \textbf{(\emph{b})}};

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%B3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\node (C) at(0,-60) {
{\includegraphics{B3portB.eps}}
};

\draw (-78.5,-40.0) node { \ZuiDa \textbf{(\emph{c})}};

\node[right=of C] (D) at (-80,-118){
{\includegraphics{B3vector.eps}}
};
\draw (-78.5,-100) node { \ZuiDa \textbf{(\emph{d})}};

%node[right=of B] (C) at (-2.641,-2.15){
%{\includegraphics[width=.5\textwidth]{system5.pdf}}
%};
\end{tikzpicture}
\end{document}



Written on November 4, 2015