2013-03-20 4 views
0

그리드의 모든 점에서 x와 y 유속을 제공하는 2D CFD 코드가 있습니다. 현재 gnuplot의 벡터 필드를 사용하여 데이터를 시각화하고 있습니다. 저의 목표는 분출물이 얼마나 멀리 퍼져 나가는지를 보는 것입니다. 그래서 어떤 크기 아래로 떨어지면 벡터가 나타나지 않게하는 것이 훨씬 더 깔끔해질 것입니다. 누구든지 이것에 대해 어떻게 생각하는지 알고 있습니까? 내 현재 gnuplot 스크립트는 아래와 같습니다. 필요에 따라 입력 파일을 수정할 수도 있습니다.Gnuplot : 벡터 필드에서 특정 크기 이하의 벡터를 제거하는 방법은 무엇입니까?

reset 
set nokey 
set term png 
set xrange [0:5.1] 
set yrange [0:10.1] 
do for [i=0:10] { 
    set title 'Eruption simulation: Timestep '.i 
    set output 'path/FlowVel'.sprintf('%04.0f',i).'.png' 
    plot 'path/Flow'.sprintf('%04.0f',i).'.dat' using 1:2:3:4 with vec 
} 

답변

0

난 당신이 정말없는의 gnuplot 필터링의 종류를 원하는 생각하지만, (의 gnuplot에서 "예 사용에 도움"에서 가져온) 다음과 같은 트릭을 달성 할 수 있습니다

One trick is to use the ternary `?:` operator to filter data: 

     plot 'file' using 1:($3>10 ? $2 : 1/0) 

which plots the datum in column two against that in column one provided 
the datum in column three exceeds ten. `1/0` is undefined; `gnuplot` 
quietly ignores undefined points, so unsuitable points are suppressed. 
Or you can use the pre-defined variable NaN to achieve the same result. 

그래서 난 당신이 경우 mag_sq가 원하는 크기의 정사각형

plot "data.dat" u 1:2:($3**2+$4**2>mag_sq?$3:NaN):($3**2+$4**2>mag_sq?$4:NaN) w vector 

이 뭔가를 원할 것 같아요.

관련 문제