Skip to content

Commit c94f6b3

Browse files
author
Daniel Ruprecht
committed
fixed u function for cadv not zero
1 parent 9cf79da commit c94f6b3

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

examples/acoustic_1d_imex/run_standard.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212

1313
nvars = 512
1414
cs = 1.0
15-
cadv = 0.0
15+
cadv = 0.05
1616
order = 4
1717

1818
def u(x,t, multiscale):
19-
u0 = np.exp(-np.square( np.mod( mesh- cs*t, 1.0 ) -x_0 )/(sigma_0*sigma_0)) + multiscale*np.exp(-np.square( np.mod( mesh -cs*t, 1.0 ) -x_1 )/(sigma_0*sigma_0))*np.cos(k*( np.mod( mesh-cs*t, 1.0 ))/sigma_0)
19+
u0 = np.exp(-np.square( np.mod( mesh - (cs+cadv)*t, 1.0 ) -x_0 )/(sigma_0*sigma_0)) + multiscale*np.exp(-np.square( np.mod( mesh -(cs+cadv)*t, 1.0 ) -x_1 )/(sigma_0*sigma_0))*np.cos(k*( np.mod( mesh - (cs+cadv)*t, 1.0 ))/sigma_0)
2020
p0 = u0
2121
return u0, p0
2222

@@ -67,28 +67,29 @@ def u(x,t, multiscale):
6767
unew_bdf, pnew_bdf = np.split(ynew_bdf, 2)
6868
uex, pex = u(mesh, float(i+1)*dt, 0.0)
6969

70-
fig.gca().clear()
71-
#plt.plot(mesh, pnew_bdf, 'b', label='BDF-2')
72-
plt.plot(mesh, pnew_tp, 'r', label='Trapezoidal')
73-
plt.plot(mesh, pex, 'k', label='Slow Mode')
74-
fig.gca().set_xlim([0, 1.0])
75-
fig.gca().set_ylim([-0.5, 1.1])
76-
fig.gca().legend(loc=3)
77-
fig.gca().grid()
78-
#plt.draw()
79-
plt.pause(0.0001)
70+
if i==Nsteps-1:
71+
fig.gca().clear()
72+
plt.plot(mesh, pnew_bdf, 'b', label='BDF-2')
73+
plt.plot(mesh, pnew_tp, 'r', label='Trapezoidal')
74+
plt.plot(mesh, pex, 'k', label='Slow Mode')
75+
fig.gca().set_xlim([0, 1.0])
76+
fig.gca().set_ylim([-0.5, 1.1])
77+
fig.gca().legend(loc=3)
78+
fig.gca().grid()
79+
plt.draw()
80+
#plt.pause(0.0001)
8081
#if i==0:
8182
#plt.gcf().savefig('initial.pdf', bbox_inches='tight')
82-
filename = 'images/standard'+"%03d" % i
83-
plt.gcf().savefig(filename+'.png', bbox_inches='tight')
84-
os.system('convert -quality 100 '+filename+'.png '+filename+'.jpeg')
85-
os.system('rm '+filename+'.png')
83+
#filename = 'images/standard'+"%03d" % i
84+
#plt.gcf().savefig(filename+'.png', bbox_inches='tight')
85+
#os.system('convert -quality 100 '+filename+'.png '+filename+'.jpeg')
86+
#os.system('rm '+filename+'.png')
8687

8788
y0_ie = ynew_ie
8889
y0_tp = ynew_tp
8990
ym1_bdf = y0_bdf
9091
y0_bdf = ynew_bdf
91-
#plt.show()
92+
plt.show()
9293
#lt.gcf().savefig('final.pdf', bbox_inches='tight')
93-
os.system('ffmpeg -r 25 -i images/standard-%03d.jpeg -vcodec libx264 -crf 25 movie.avi')
94+
#os.system('ffmpeg -r 25 -i images/standard-%03d.jpeg -vcodec libx264 -crf 25 movie.avi')
9495

0 commit comments

Comments
 (0)