我有一个gnuplot问题,我是初学者,我相信他们可以帮助我... 我正在尝试重现此链接的图形(图4.5,https://homepages.see.leeds.ac.uk/~amt6xw/Distance%20Learning/CFD5050TURB/node22.html,但不幸的是,我没有成功。图表仅绘制了一条曲线(代码中的第一条曲线),而我编写的最后两条曲线却出现了错误(图例中出现了很多线,但没有图表),您能帮我吗?>
代码也仅在“ set trange [0:25]”行中搜索参考,这使得无法绘制其他图形,我需要学习如何确定变量的多个“范围”。
reset
## CONFIGURAÇÕES DO ARQUIVO DE SAÍDA (http://www.gnuplotting.org/output-terminals/):
set terminal pngcairo size 800,600 enhanced font "Verdana,10"
set output "yPlus.png"
# AJUSTE DAS MARGENS DO CONTEÚDO NO INTERIOR DA TELA:
# GUIA: l = left; r = right; t = top; b - bottom
set lmargin 7.5
set rmargin 3.5
set bmargin 3.5
set tmargin 1
set grid
# LEGENDAS LATERAIS:
set xlabel "r+" font "Verdana,10"
set ylabel "<u_{z}>+" font "Verdana,10"
# RANGE DO EIXO Y:
set parametric
set trange [0:25]
# RANGE DO EIXO X:
set logscale x
set xrange [*:1000]
set format x "10^{%L}"
# LEGENDA DO GRÁFICO:
set key ins vert
set key top left
set key box
## CONFIGURAÇÕES DOS GRÁFICOS:
# SPALDING'S LAW OF THE WALL (https://homepages.see.leeds.ac.uk/~amt6xw/Distance%20Learning/CFD5050TURB/node22.html) (- 1/24*((k*t)**4)):
# Karman's constant (k = 0.4):
k = 0.4187
# ...for a smooth wall (A = 0.1108):
E = 9.0
f(t) = t + 1/E*(exp(k*t) - 1 - k*t - 1/2*((k*t)**2) - 1/6*((k*t)**3))
plot f(t),t title "Spalding's Law of the Wall" with lines linetype -1
# LOGARITHIMIC OVERLAP:
g(y) = 1/k*log10(E)*y
plot for [y = 35:350] g(y),y title "Logarithimic overlap" with lines linetype -1
# LINEAR SUBLAYER:
plot for [t = 0:20] t,t title "Linear Sublayer" with lines linetype -1
答案 0 :(得分:0)
如果要在单个图/图中绘制所有内容,则只需调用一次plot
命令。另外,为了对同一图中的不同依赖项使用不同的“范围”,可以如下所示手动重新缩放t
变量。例如,由于t
从0
到25
,scale1
函数将其按预期转换为[35; 350]
...
set trange [0:25]
f(t) = t + 1/E*(exp(k*t) - 1 - k*t - 1/2*((k*t)**2) - 1/6*((k*t)**3))
g(y) = 1/k*log10(E)*y
scale1(t) = t*315./25 + 35
scale2(t) = t*20./25
plot \
f(t),t title "Spalding's Law of the Wall" with lines linetype -1, \
g(scale1(t)),scale1(t) title "Logarithimic overlap" with lines linetype -1, \
scale2(t),scale2(t) title "Linear Sublayer" with lines linetype -1